Commit 3ec5233
hv_netvsc: fix potential deadlock in netvsc_vf_setxdp()
The MANA driver's probe registers netdevice via the following call chain:
mana_probe()
register_netdev()
register_netdevice()
register_netdevice() calls notifier callback for netvsc driver,
holding the netdev mutex via netdev_lock_ops().
Further this netvsc notifier callback end up attempting to acquire the
same lock again in dev_xdp_propagate() leading to deadlock.
netvsc_netdev_event()
netvsc_vf_setxdp()
dev_xdp_propagate()
This deadlock was not observed so far because net_shaper_ops was never set,
and thus the lock was effectively a no-op in this case. Fix this by using
netif_xdp_propagate() instead of dev_xdp_propagate() to avoid recursive
locking in this path.
And, since no deadlock is observed on the other path which is via
netvsc_probe, add the lock exclusivly for that path.
Also, clean up the unregistration path by removing the unnecessary call to
netvsc_vf_setxdp(), since unregister_netdevice_many_notify() already
performs this cleanup via dev_xdp_uninstall().
Fixes: 97246d6 ("net: hold netdev instance lock during ndo_bpf")
Cc: [email protected]
Signed-off-by: Saurabh Sengar <[email protected]>
Tested-by: Erni Sri Satya Vennela <[email protected]>
Reviewed-by: Haiyang Zhang <[email protected]>
Reviewed-by: Subbaraya Sundeep <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent c1f4cb8 commit 3ec5233
3 files changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2462 | 2462 | | |
2463 | 2463 | | |
2464 | 2464 | | |
2465 | | - | |
2466 | | - | |
2467 | 2465 | | |
2468 | 2466 | | |
2469 | 2467 | | |
| |||
2631 | 2629 | | |
2632 | 2630 | | |
2633 | 2631 | | |
| 2632 | + | |
2634 | 2633 | | |
| 2634 | + | |
2635 | 2635 | | |
2636 | 2636 | | |
2637 | 2637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9968 | 9968 | | |
9969 | 9969 | | |
9970 | 9970 | | |
| 9971 | + | |
9971 | 9972 | | |
9972 | 9973 | | |
9973 | 9974 | | |
| |||
0 commit comments