Skip to content

Commit b16939b

Browse files
Vasundhara Volamkuba-moo
authored andcommitted
bnxt_en: Fix NULL ptr dereference crash in bnxt_fw_reset_task()
bnxt_fw_reset_task() which runs from a workqueue can race with bnxt_remove_one(). For example, if firmware reset and VF FLR are happening at about the same time. bnxt_remove_one() already cancels the workqueue and waits for it to finish, but we need to do this earlier before the devlink reporters are destroyed. This will guarantee that the devlink reporters will always be valid when bnxt_fw_reset_task() is still running. Fixes: b148bb2 ("bnxt_en: Fix possible crash in bnxt_fw_reset_task().") Reviewed-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b340dc6 commit b16939b

File tree

1 file changed

+4
-3
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+4
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11779,16 +11779,17 @@ static void bnxt_remove_one(struct pci_dev *pdev)
1177911779
if (BNXT_PF(bp))
1178011780
bnxt_sriov_disable(bp);
1178111781

11782+
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11783+
bnxt_cancel_sp_work(bp);
11784+
bp->sp_event = 0;
11785+
1178211786
bnxt_dl_fw_reporters_destroy(bp, true);
1178311787
if (BNXT_PF(bp))
1178411788
devlink_port_type_clear(&bp->dl_port);
1178511789
pci_disable_pcie_error_reporting(pdev);
1178611790
unregister_netdev(dev);
1178711791
bnxt_dl_unregister(bp);
1178811792
bnxt_shutdown_tc(bp);
11789-
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11790-
bnxt_cancel_sp_work(bp);
11791-
bp->sp_event = 0;
1179211793

1179311794
bnxt_clear_int_mode(bp);
1179411795
bnxt_hwrm_func_drv_unrgtr(bp);

0 commit comments

Comments
 (0)