Commit 4179cb5
vxlan: test dev->flags & IFF_UP before calling netif_rx()
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 ce6502a ("vxlan: fix a use after free
in vxlan_encap_bypass"), since the dev->stats.rx_dropped
change was done on the wrong device.
Fixes: d342894 ("vxlan: virtual extensible lan")
Fixes: ce6502a ("vxlan: fix a use after free in vxlan_encap_bypass")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Petr Machata <petrm@mellanox.com>
Cc: Ido Schimmel <idosch@mellanox.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>
Cc: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 989723b commit 4179cb5
1 file changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2219 | 2219 | | |
2220 | 2220 | | |
2221 | 2221 | | |
2222 | | - | |
| 2222 | + | |
2223 | 2223 | | |
2224 | 2224 | | |
2225 | 2225 | | |
| |||
2239 | 2239 | | |
2240 | 2240 | | |
2241 | 2241 | | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2242 | 2249 | | |
2243 | | - | |
2244 | | - | |
| 2250 | + | |
2245 | 2251 | | |
2246 | 2252 | | |
2247 | 2253 | | |
| |||
2254 | 2260 | | |
2255 | 2261 | | |
2256 | 2262 | | |
| 2263 | + | |
2257 | 2264 | | |
2258 | 2265 | | |
| 2266 | + | |
2259 | 2267 | | |
2260 | 2268 | | |
2261 | 2269 | | |
| |||
0 commit comments