Skip to content

Commit f0df225

Browse files
Kalesh APrleon
authored andcommitted
RDMA/bnxt_re: Add sanity checks on rdev validity
There is a possibility that ulp_irq_stop and ulp_irq_start callbacks will be called when the device is in detached state. This can cause a crash due to NULL pointer dereference as the rdev is already freed. Fixes: cc5b9b4 ("RDMA/bnxt_re: Recover the device when FW error is detected") Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Link: https://patch.msgid.link/1738657285-23968-3-git-send-email-selvin.xavier@broadcom.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent a27c6f4 commit f0df225

File tree

1 file changed

+5
-0
lines changed
  • drivers/infiniband/hw/bnxt_re

1 file changed

+5
-0
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ static void bnxt_re_stop_irq(void *handle, bool reset)
438438
int indx;
439439

440440
rdev = en_info->rdev;
441+
if (!rdev)
442+
return;
441443
rcfw = &rdev->rcfw;
442444

443445
if (reset) {
@@ -466,6 +468,8 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
466468
int indx, rc;
467469

468470
rdev = en_info->rdev;
471+
if (!rdev)
472+
return;
469473
msix_ent = rdev->nqr->msix_entries;
470474
rcfw = &rdev->rcfw;
471475
if (!ent) {
@@ -2438,6 +2442,7 @@ static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state)
24382442
ibdev_info(&rdev->ibdev, "%s: L2 driver notified to stop en_state 0x%lx",
24392443
__func__, en_dev->en_state);
24402444
bnxt_re_remove_device(rdev, BNXT_RE_PRE_RECOVERY_REMOVE, adev);
2445+
bnxt_re_update_en_info_rdev(NULL, en_info, adev);
24412446
mutex_unlock(&bnxt_re_mutex);
24422447

24432448
return 0;

0 commit comments

Comments
 (0)