[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190211.124454.57457094563963413.davem@davemloft.net>
Date: Mon, 11 Feb 2019 12:44:54 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: edumazet@...gle.com
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com, petrm@...lanox.com,
idosch@...lanox.com, roopa@...ulusnetworks.com, sbrivio@...hat.com
Subject: Re: [PATCH net] vxlan: test dev->flags & IFF_UP before calling
netif_rx()
From: Eric Dumazet <edumazet@...gle.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@...gle.com>
Applied and queued up for -stable.
Powered by blists - more mailing lists