]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: mana: Fix potential deadlocks in mana napi ops
authorErni Sri Satya Vennela <ernis@linux.microsoft.com>
Tue, 17 Jun 2025 07:17:33 +0000 (00:17 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 19 Jun 2025 13:13:49 +0000 (15:13 +0200)
commitd5c8f0e4e0cb0ac2a4a4e015f2f5b1ba39e5e583
tree25fe58b459a0840f806a4c9b81bbed010aee05dd
parentd3623dd5bd4e1fc9acfc08dd0064658bbbf1e8de
net: mana: Fix potential deadlocks in mana napi ops

When net_shaper_ops are enabled for MANA, netdev_ops_lock
becomes active.

MANA VF setup/teardown by netvsc follows this call chain:

netvsc_vf_setup()
        dev_change_flags()
...
         __dev_open() OR __dev_close()

dev_change_flags() holds the netdev mutex via netdev_lock_ops.

Meanwhile, mana_create_txq() and mana_create_rxq() in mana_open()
path call NAPI APIs (netif_napi_add_tx(), netif_napi_add_weight(),
napi_enable()), which also try to acquire the same lock, risking
deadlock.

Similarly in the teardown path (mana_close()), netif_napi_disable()
and netif_napi_del(), contend for the same lock.

Switch to the _locked variants of these APIs to avoid deadlocks
when the netdev_ops_lock is held.

Fixes: d4c22ec680c8 ("net: hold netdev instance lock during ndo_open/ndo_stop")
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Saurabh Singh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Link: https://patch.msgid.link/1750144656-2021-2-git-send-email-ernis@linux.microsoft.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microsoft/mana/mana_en.c