netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Edward Cree <ecree@solarflare.com>
Cc: netdev@vger.kernel.org, Andreas Steinmetz <ast@domdv.de>
Subject: Re: [PATCH net] net: fix use-after-free in __netif_receive_skb_core
Date: Thu, 11 Jul 2019 00:47:24 +0200	[thread overview]
Message-ID: <20190710224724.GA28254@bistromath.localdomain> (raw)
In-Reply-To: <62ad16f6-c33a-407e-2f55-9be382b7ec52@solarflare.com>

2019-07-10, 16:07:43 +0100, Edward Cree wrote:
> On 10/07/2019 14:52, Sabrina Dubroca wrote:
> > -static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,
> > +static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
> >  				    struct packet_type **ppt_prev)
> >  {
> >  	struct packet_type *ptype, *pt_prev;
> >  	rx_handler_func_t *rx_handler;
> > +	struct sk_buff *skb = *pskb;
> Would it not be simpler just to change all users of skb to *pskb?
> Then you avoid having to keep doing "*pskb = skb;" whenever skb changes
>  (with concomitant risk of bugs if one gets missed).

Yes, that would be less risky. I wrote a version of the patch that did
exactly that, but found it really too ugly (both the patch and the
resulting code). We have more than 50 occurences of skb, including
things like:

    atomic_long_inc(&skb->dev->rx_dropped);

-- 
Sabrina

  reply	other threads:[~2019-07-10 22:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 13:52 [PATCH net] net: fix use-after-free in __netif_receive_skb_core Sabrina Dubroca
2019-07-10 15:07 ` Edward Cree
2019-07-10 22:47   ` Sabrina Dubroca [this message]
2019-07-12 15:29     ` Edward Cree
2019-07-12 17:06       ` Jonathan Lemon
2019-07-16 15:26       ` Sabrina Dubroca

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=20190710224724.GA28254@bistromath.localdomain \
    --to=sd@queasysnail.net \
    --cc=ast@domdv.de \
    --cc=ecree@solarflare.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).