diff options
author | Kalesh AP <kalesh-anakkur.purayil@broadcom.com> | 2025-02-04 00:21:23 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 18:26:53 +0100 |
commit | 8cb0eef46d70a99c88c26a1addb7fd955242e0e6 (patch) | |
tree | 4c3e09e87a5d005b8ad3e520c2645ab6947db035 /drivers/infiniband | |
parent | c69ad1cc17488be06270a052043d61dc64fa786c (diff) | |
download | linux-8cb0eef46d70a99c88c26a1addb7fd955242e0e6.tar.gz linux-8cb0eef46d70a99c88c26a1addb7fd955242e0e6.tar.bz2 linux-8cb0eef46d70a99c88c26a1addb7fd955242e0e6.zip |
RDMA/bnxt_re: Add sanity checks on rdev validity
[ Upstream commit f0df225d12fcb049429fb5bf5122afe143c2dd15 ]
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: cc5b9b48d447 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/bnxt_re/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index c143f273b759..7368b0482bb8 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -321,6 +321,8 @@ static void bnxt_re_stop_irq(void *handle) int indx; rdev = en_info->rdev; + if (!rdev) + return; rcfw = &rdev->rcfw; for (indx = BNXT_RE_NQ_IDX; indx < rdev->nqr->num_msix; indx++) { @@ -341,6 +343,8 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent) int indx, rc; rdev = en_info->rdev; + if (!rdev) + return; msix_ent = rdev->nqr->msix_entries; rcfw = &rdev->rcfw; if (!ent) { @@ -2356,6 +2360,7 @@ static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state) ibdev_info(&rdev->ibdev, "%s: L2 driver notified to stop en_state 0x%lx", __func__, en_dev->en_state); bnxt_re_remove_device(rdev, BNXT_RE_PRE_RECOVERY_REMOVE, adev); + bnxt_re_update_en_info_rdev(NULL, en_info, adev); mutex_unlock(&bnxt_re_mutex); return 0; |