* [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops
@ 2025-04-02 13:31 Taehee Yoo
2025-04-02 14:07 ` Stanislav Fomichev
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Taehee Yoo @ 2025-04-02 13:31 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, horms, michael.chan,
pavan.chebbi, netdev
Cc: ap420073, romieu, kuniyu
When queue is being reset, callbacks of mgmt_ops are called by
netdev_nl_bind_rx_doit().
The netdev_nl_bind_rx_doit() first acquires netdev_lock() and then calls
callbacks.
So, mgmt_ops callbacks should not acquire netdev_lock() internaly.
The bnxt_queue_{start | stop}() calls napi_{enable | disable}() but they
internally acquire netdev_lock().
So, deadlock occurs.
To avoid deadlock, napi_{enable | disable}_locked() should be used
instead.
Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 1a70605fad38..28ee12186c37 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -15909,7 +15909,7 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
goto err_reset;
}
- napi_enable(&bnapi->napi);
+ napi_enable_locked(&bnapi->napi);
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
for (i = 0; i < bp->nr_vnics; i++) {
@@ -15931,7 +15931,7 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
err_reset:
netdev_err(bp->dev, "Unexpected HWRM error during queue start rc: %d\n",
rc);
- napi_enable(&bnapi->napi);
+ napi_enable_locked(&bnapi->napi);
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
bnxt_reset_task(bp, true);
return rc;
@@ -15971,7 +15971,7 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
* completion is handled in NAPI to guarantee no more DMA on that ring
* after seeing the completion.
*/
- napi_disable(&bnapi->napi);
+ napi_disable_locked(&bnapi->napi);
if (bp->tph_mode) {
bnxt_hwrm_cp_ring_free(bp, rxr->rx_cpr);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops
2025-04-02 13:31 [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops Taehee Yoo
@ 2025-04-02 14:07 ` Stanislav Fomichev
2025-04-02 16:30 ` Michael Chan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Stanislav Fomichev @ 2025-04-02 14:07 UTC (permalink / raw)
To: Taehee Yoo
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, horms, michael.chan,
pavan.chebbi, netdev, romieu, kuniyu
On 04/02, Taehee Yoo wrote:
> When queue is being reset, callbacks of mgmt_ops are called by
> netdev_nl_bind_rx_doit().
> The netdev_nl_bind_rx_doit() first acquires netdev_lock() and then calls
> callbacks.
> So, mgmt_ops callbacks should not acquire netdev_lock() internaly.
>
> The bnxt_queue_{start | stop}() calls napi_{enable | disable}() but they
> internally acquire netdev_lock().
> So, deadlock occurs.
>
> To avoid deadlock, napi_{enable | disable}_locked() should be used
> instead.
>
> Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Oh, wow, how did I miss that... Thanks for the fix!
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops
2025-04-02 13:31 [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops Taehee Yoo
2025-04-02 14:07 ` Stanislav Fomichev
@ 2025-04-02 16:30 ` Michael Chan
2025-04-02 16:51 ` Jakub Kicinski
2025-04-03 22:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Michael Chan @ 2025-04-02 16:30 UTC (permalink / raw)
To: Taehee Yoo
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, horms, pavan.chebbi,
netdev, romieu, kuniyu
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
On Wed, Apr 2, 2025 at 6:31 AM Taehee Yoo <ap420073@gmail.com> wrote:
>
> When queue is being reset, callbacks of mgmt_ops are called by
> netdev_nl_bind_rx_doit().
> The netdev_nl_bind_rx_doit() first acquires netdev_lock() and then calls
> callbacks.
> So, mgmt_ops callbacks should not acquire netdev_lock() internaly.
>
> The bnxt_queue_{start | stop}() calls napi_{enable | disable}() but they
> internally acquire netdev_lock().
> So, deadlock occurs.
>
> To avoid deadlock, napi_{enable | disable}_locked() should be used
> instead.
>
> Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Thanks.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4196 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops
2025-04-02 13:31 [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops Taehee Yoo
2025-04-02 14:07 ` Stanislav Fomichev
2025-04-02 16:30 ` Michael Chan
@ 2025-04-02 16:51 ` Jakub Kicinski
2025-04-03 22:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-04-02 16:51 UTC (permalink / raw)
To: Taehee Yoo
Cc: davem, pabeni, edumazet, andrew+netdev, horms, michael.chan,
pavan.chebbi, netdev, romieu, kuniyu
On Wed, 2 Apr 2025 13:31:23 +0000 Taehee Yoo wrote:
> When queue is being reset, callbacks of mgmt_ops are called by
> netdev_nl_bind_rx_doit().
> The netdev_nl_bind_rx_doit() first acquires netdev_lock() and then calls
> callbacks.
> So, mgmt_ops callbacks should not acquire netdev_lock() internaly.
>
> The bnxt_queue_{start | stop}() calls napi_{enable | disable}() but they
> internally acquire netdev_lock().
> So, deadlock occurs.
>
> To avoid deadlock, napi_{enable | disable}_locked() should be used
> instead.
>
> Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")
Too far back, v6.14 doesn't need this fix. I think the Fixes tags
should be:
Fixes: cae03e5bdd9e ("net: hold netdev instance lock during queue operations")
No need to repost, I'll change when applying. Unless I'm wrong.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops
2025-04-02 13:31 [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops Taehee Yoo
` (2 preceding siblings ...)
2025-04-02 16:51 ` Jakub Kicinski
@ 2025-04-03 22:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-03 22:20 UTC (permalink / raw)
To: Taehee Yoo
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, horms, michael.chan,
pavan.chebbi, netdev, romieu, kuniyu
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 2 Apr 2025 13:31:23 +0000 you wrote:
> When queue is being reset, callbacks of mgmt_ops are called by
> netdev_nl_bind_rx_doit().
> The netdev_nl_bind_rx_doit() first acquires netdev_lock() and then calls
> callbacks.
> So, mgmt_ops callbacks should not acquire netdev_lock() internaly.
>
> The bnxt_queue_{start | stop}() calls napi_{enable | disable}() but they
> internally acquire netdev_lock().
> So, deadlock occurs.
>
> [...]
Here is the summary with links:
- [net] eth: bnxt: fix deadlock in the mgmt_ops
https://git.kernel.org/netdev/net/c/e4546c6498c6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-03 22:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 13:31 [PATCH net] eth: bnxt: fix deadlock in the mgmt_ops Taehee Yoo
2025-04-02 14:07 ` Stanislav Fomichev
2025-04-02 16:30 ` Michael Chan
2025-04-02 16:51 ` Jakub Kicinski
2025-04-03 22:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).