From: Dick Kennedy Date: Wed, 23 Aug 2017 23:55:33 +0000 (-0700) Subject: scsi: lpfc: Fix oops when NVME Target is discovered in a nonNVME environment X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bb6a8a2c24f263cdff78b62ada58cecd8c89c03d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git scsi: lpfc: Fix oops when NVME Target is discovered in a nonNVME environment 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 Signed-off-by: James Smart Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index c18db8707fed..ce8d6bbf8148 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.