public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: edumazet@google.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
	petrm@mellanox.com, idosch@mellanox.com,
	roopa@cumulusnetworks.com, sbrivio@redhat.com
Subject: Re: [PATCH net] vxlan: test dev->flags & IFF_UP before calling netif_rx()
Date: Mon, 11 Feb 2019 12:44:54 -0800 (PST)	[thread overview]
Message-ID: <20190211.124454.57457094563963413.davem@davemloft.net> (raw)
In-Reply-To: <20190207202738.155940-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Thu,  7 Feb 2019 12:27:38 -0800

> netif_rx() must be called under a strict contract.
> 
> At device dismantle phase, core networking clears IFF_UP
> and flush_all_backlogs() is called after rcu grace period
> to make sure no incoming packet might be in a cpu backlog
> and still referencing the device.
> 
> Most drivers call netif_rx() from their interrupt handler,
> and since the interrupts are disabled at device dismantle,
> netif_rx() does not have to check dev->flags & IFF_UP
> 
> Virtual drivers do not have this guarantee, and must
> therefore make the check themselves.
> 
> Otherwise we risk use-after-free and/or crashes.
> 
> Note this patch also fixes a small issue that came
> with commit ce6502a8f957 ("vxlan: fix a use after free
> in vxlan_encap_bypass"), since the dev->stats.rx_dropped
> change was done on the wrong device.
> 
> Fixes: d342894c5d2f ("vxlan: virtual extensible lan")
> Fixes: ce6502a8f957 ("vxlan: fix a use after free in vxlan_encap_bypass")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.

      parent reply	other threads:[~2019-02-11 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 20:27 [PATCH net] vxlan: test dev->flags & IFF_UP before calling netif_rx() Eric Dumazet
2019-02-07 20:34 ` Eric Dumazet
2019-02-11 20:44 ` 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=20190211.124454.57457094563963413.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=sbrivio@redhat.com \
    /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