Commit f0df225d authored by Kalesh AP's avatar Kalesh AP Committed by Leon Romanovsky
Browse files

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: cc5b9b48 ("RDMA/bnxt_re: Recover the device when FW error is detected")
Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/1738657285-23968-3-git-send-email-selvin.xavier@broadcom.com


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent a27c6f46
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -438,6 +438,8 @@ static void bnxt_re_stop_irq(void *handle, bool reset)
	int indx;

	rdev = en_info->rdev;
	if (!rdev)
		return;
	rcfw = &rdev->rcfw;

	if (reset) {
@@ -466,6 +468,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) {
@@ -2438,6 +2442,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;