diff mbox

[v2,04/20] lpfc: Fix oops when NVME Target is discovered in a nonNVME environment

Message ID 20170805004731.1335-5-jsmart2021@gmail.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

James Smart Aug. 5, 2017, 12:47 a.m. UTC
From: Dick Kennedy <dick.kennedy@broadcom.com>

lpfc oops when it discovers a NVME target but is configured for SCSI
only operation. Oops is in lpfc_nvme_register_port+0x33/0x300.

The localport is not valid so it should not have been referenced.

Added validity check for localport

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_nvme.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Johannes Thumshirn Aug. 7, 2017, 8 a.m. UTC | #1
On Fri, Aug 04, 2017 at 05:47:15PM -0700, James Smart wrote:
> From: Dick Kennedy <dick.kennedy@broadcom.com>
> 
> lpfc oops when it discovers a NVME target but is configured for SCSI
> only operation. Oops is in lpfc_nvme_register_port+0x33/0x300.

Why does it even call lpfc_nvme_register_rport if it isn't configured for
handling NVMe?
James Smart Aug. 7, 2017, 8:34 p.m. UTC | #2
On 8/7/2017 1:00 AM, Johannes Thumshirn wrote:
> On Fri, Aug 04, 2017 at 05:47:15PM -0700, James Smart wrote:
>> From: Dick Kennedy <dick.kennedy@broadcom.com>
>>
>> lpfc oops when it discovers a NVME target but is configured for SCSI
>> only operation. Oops is in lpfc_nvme_register_port+0x33/0x300.
> 
> Why does it even call lpfc_nvme_register_rport if it isn't configured for
> handling NVMe?
> 

That was the bug....  it got confused about protocol support.

-- james
diff mbox

Patch

diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 0a0a1b92d01d..2f50df6a3dca 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -2296,6 +2296,9 @@  lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 			 ndlp->nlp_DID, ndlp->nlp_type);
 
 	localport = vport->localport;
+	if (!localport)
+		return 0;
+
 	lport = (struct lpfc_nvme_lport *)localport->private;
 
 	/* NVME rports are not preserved across devloss.