public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@redhat.com>
To: basil@pacabunga.com
Cc: jreuter@yaina.de, ralf@linux-mips.org,
	linux-hams@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	ed@wizkers.io, mcdermj@xenotropic.com
Subject: Re: [PATCH 1/1] ax25: Fix segfault when receiving an iframe with net2kiss loaded
Date: Fri, 02 Dec 2016 11:05:10 -0500 (EST)	[thread overview]
Message-ID: <20161202.110510.316320127082862142.davem@redhat.com> (raw)
In-Reply-To: <20161130111525.13f74728@brox.localnet>

From: Basil Gunn <basil@pacabunga.com>
Date: Wed, 30 Nov 2016 11:15:25 -0800

> AX.25 uses sock_queue_rcv_skb() to queue an iframe received packet.
> This routine writes NULL to the socket buffer device structure
> pointer. The socket buffer is subsequently serviced by
> __netif_receiv_skb_core() which dereferences the device structure
> pointer & segfaults.
> 
> The fix puts the ax25 device structure pointer back in the socket
> buffer struct after sock_queue_rcv_skb() is called.

You cannot do this.

We have no reference count held on the device object, therefore once
access to this SKB leaves the receive packet processing path and thus
the RCU protected region, we must set skb->dev to NULL.

Queueing the SKB to the socket causes the SKB to leave the receive
processing path.

You will have to find another way to propagate this device pointer
to the code that needs it.

      reply	other threads:[~2016-12-02 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 19:15 [PATCH 1/1] ax25: Fix segfault when receiving an iframe with net2kiss loaded Basil Gunn
2016-12-02 16:05 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161202.110510.316320127082862142.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=basil@pacabunga.com \
    --cc=ed@wizkers.io \
    --cc=jreuter@yaina.de \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcdermj@xenotropic.com \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox