Blob Blame History Raw
From: James Smart <jsmart2021@gmail.com>
Date: Wed, 27 Jan 2021 14:16:01 -0800
Subject: scsi: lpfc: Fix EEH encountering oops with NVMe traffic
Patch-mainline: v5.11-rc7
Git-commit: 8c65830ae1629b03e5d65e9aafae7e2cf5f8b743
References: bsc#1182574

In testing, in a configuration with Redfish and native NVMe multipath when
an EEH is injected, a kernel oops is being encountered:

(unreliable)
lpfc_nvme_ls_req+0x328/0x720 [lpfc]
__nvme_fc_send_ls_req.constprop.13+0x1d8/0x3d0 [nvme_fc]
nvme_fc_create_association+0x224/0xd10 [nvme_fc]
nvme_fc_reset_ctrl_work+0x110/0x154 [nvme_fc]
process_one_work+0x304/0x5d

the NBMe transport is issuing a Disconnect LS request, which the driver
receives and tries to post but the work queue used by the driver is already
being torn down by the eeh.

Fix by validating the validity of the work queue before proceeding with the
LS transmit.

Link: https://lore.kernel.org/r/20210127221601.84878-1-jsmart2021@gmail.com
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[dwagner: update context; the ELS rework is missing]
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/lpfc/lpfc_nvme.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -503,6 +503,10 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po
 				 ndlp->nlp_state, ndlp->nlp_type);
 		return -ENODEV;
 	}
+
+	if (!vport->phba->sli4_hba.nvmels_wq)
+		return -ENOMEM;
+
 	bmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
 	if (!bmp) {