linux/drivers/net
Saurabh Sengar 3ec5233049 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: 97246d6d21 ("net: hold netdev instance lock during ndo_bpf")
Cc: stable@vger.kernel.org
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Tested-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
Link: https://patch.msgid.link/1748513910-23963-1-git-send-email-ssengar@linux.microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-05-30 19:31:25 -07:00
..
arcnet
bonding net: core: Convert dev_set_mac_address() to struct sockaddr_storage 2025-05-27 08:25:43 +02:00
caif
can can: kvaser_pciefd: refine error prone echo_skb_max handling logic 2025-05-29 09:45:27 +02:00
dsa Networking changes for 6.16. 2025-05-28 15:24:36 -07:00
ethernet net: lan966x: Make sure to insert the vlan tags also in host mode 2025-05-29 15:48:37 +02:00
fddi
fjes
hamradio
hippi
hyperv hv_netvsc: fix potential deadlock in netvsc_vf_setxdp() 2025-05-30 19:31:25 -07:00
ieee802154
ipa net: ipa: Make the SMEM item ID constant 2025-05-13 15:42:50 -07:00
ipvlan
mctp net: mctp: start tx queue on netdev open 2025-05-27 17:23:19 -07:00
mdio net: phy: fixed_phy: remove irq argument from fixed_phy_register 2025-05-20 18:17:43 -07:00
netdevsim ipsec-next-2025-05-23 2025-05-26 18:32:48 +02:00
ovpn ovpn: fix check for skb_to_sgvec_nomark() return value 2025-05-15 13:09:36 +02:00
pcs
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-05-28 10:11:15 +02:00
plip
ppp ppp: Split ppp_exit_net() to ->exit_rtnl(). 2025-04-22 19:07:41 -07:00
pse-pd
slip
team net: core: Convert dev_set_mac_address() to struct sockaddr_storage 2025-05-27 08:25:43 +02:00
thunderbolt
usb net: usb: aqc111: debug info before sanitation 2025-05-30 12:14:53 +01:00
vmxnet3 Core x86 updates for v6.16: 2025-05-26 16:04:17 -07:00
vxlan Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-04-24 11:20:52 -07:00
wan
wireguard wireguard: allowedips: add WGALLOWEDIP_F_REMOVE_ME flag 2025-05-27 09:06:19 +02:00
wireless Lots of new things, notably: 2025-05-22 14:05:18 -07:00
wwan
xen-netback
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c net: core: Convert dev_set_mac_address() to struct sockaddr_storage 2025-05-27 08:25:43 +02:00
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
netkit.c
nlmon.c
ntb_netdev.c
pfcp.c pfcp: Convert pfcp_net_exit() to ->exit_rtnl(). 2025-04-22 19:07:41 -07:00
rionet.c
Space.c
sungem_phy.c
tap.c net: core: Convert dev_set_mac_address_user() to use struct sockaddr_storage 2025-05-27 08:25:43 +02:00
tun.c net: core: Convert dev_set_mac_address_user() to use struct sockaddr_storage 2025-05-27 08:25:43 +02:00
tun_vnet.h
veth.c veth: apply qdisc backpressure on full ptr_ring to reduce TX drops 2025-04-28 14:06:58 -07:00
virtio_net.c virtio-net: fix total qstat values 2025-05-08 11:56:12 +02:00
vrf.c net: sched: generalize check for no-queue qdisc on TX queue 2025-04-28 14:06:58 -07:00
vsockmon.c
xen-netfront.c xen-netfront: handle NULL returned by xdp_convert_buff_to_frame() 2025-04-21 18:56:46 -07:00