Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

eth: bnxt: add missing netdev lock management to bnxt_dl_reload_up

bnxt_dl_reload_up is completely missing instance lock management
which can result in `devlink dev reload` leaving with instance
lock held. Add the missing calls.

Also add netdev_assert_locked to make it clear that the up() method
is running with the instance lock grabbed.

v2:
- add net/netdev_lock.h include to bnxt_devlink.c for netdev_assert_locked

Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250309215851.2003708-3-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Stanislav Fomichev and committed by
Jakub Kicinski
adbf627f eaca6e5d

+6 -2
+6 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
··· 11 11 #include <linux/netdevice.h> 12 12 #include <linux/vmalloc.h> 13 13 #include <net/devlink.h> 14 + #include <net/netdev_lock.h> 14 15 #include "bnxt_hsi.h" 15 16 #include "bnxt.h" 16 17 #include "bnxt_hwrm.h" ··· 519 518 struct bnxt *bp = bnxt_get_bp_from_dl(dl); 520 519 int rc = 0; 521 520 521 + netdev_assert_locked(bp->dev); 522 + 522 523 *actions_performed = 0; 523 524 switch (action) { 524 525 case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: { ··· 545 542 if (!netif_running(bp->dev)) 546 543 NL_SET_ERR_MSG_MOD(extack, 547 544 "Device is closed, not waiting for reset notice that will never come"); 545 + netdev_unlock(bp->dev); 548 546 rtnl_unlock(); 549 547 while (test_bit(BNXT_STATE_FW_ACTIVATE, &bp->state)) { 550 548 if (time_after(jiffies, timeout)) { ··· 561 557 msleep(50); 562 558 } 563 559 rtnl_lock(); 560 + netdev_lock(bp->dev); 564 561 if (!rc) 565 562 *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); 566 563 clear_bit(BNXT_STATE_FW_ACTIVATE, &bp->state); ··· 580 575 } 581 576 *actions_performed |= BIT(action); 582 577 } else if (netif_running(bp->dev)) { 583 - netdev_lock(bp->dev); 584 578 netif_close(bp->dev); 585 - netdev_unlock(bp->dev); 586 579 } 580 + netdev_unlock(bp->dev); 587 581 rtnl_unlock(); 588 582 if (action == DEVLINK_RELOAD_ACTION_DRIVER_REINIT) 589 583 bnxt_ulp_start(bp, rc);