This is a note to let you know that I've just added the patch titled scsi: lpfc: Address NULL pointer dereference after starget_to_rport() to the 5.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-lpfc-address-null-pointer-dereference-after-starget_to_rport.patch and it can be found in the queue-5.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6f808bd78e8296b4ded813b7182988d57e1f6176 Mon Sep 17 00:00:00 2001 From: James Smart <jsmart2021@xxxxxxxxx> Date: Fri, 3 Jun 2022 10:43:24 -0700 Subject: scsi: lpfc: Address NULL pointer dereference after starget_to_rport() From: James Smart <jsmart2021@xxxxxxxxx> commit 6f808bd78e8296b4ded813b7182988d57e1f6176 upstream. Calls to starget_to_rport() may return NULL. Add check for NULL rport before dereference. Link: https://lore.kernel.org/r/20220603174329.63777-5-jsmart2021@xxxxxxxxx Fixes: bb21fc9911ee ("scsi: lpfc: Use fc_block_rport()") Cc: <stable@xxxxxxxxxxxxxxx> # v5.18 Co-developed-by: Justin Tee <justin.tee@xxxxxxxxxxxx> Signed-off-by: Justin Tee <justin.tee@xxxxxxxxxxxx> Signed-off-by: James Smart <jsmart2021@xxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/lpfc/lpfc_scsi.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -6316,6 +6316,9 @@ lpfc_device_reset_handler(struct scsi_cm int status; u32 logit = LOG_FCP; + if (!rport) + return FAILED; + rdata = rport->dd_data; if (!rdata || !rdata->pnode) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, @@ -6394,6 +6397,9 @@ lpfc_target_reset_handler(struct scsi_cm unsigned long flags; DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); + if (!rport) + return FAILED; + rdata = rport->dd_data; if (!rdata || !rdata->pnode) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, Patches currently in stable-queue which might be from jsmart2021@xxxxxxxxx are queue-5.18/scsi-lpfc-correct-bde-type-for-xmit_seq64_wqe-in-lpf.patch queue-5.18/scsi-lpfc-address-null-pointer-dereference-after-starget_to_rport.patch queue-5.18/scsi-lpfc-resolve-some-cleanup-issues-following-abort-path-refactoring.patch queue-5.18/scsi-lpfc-resolve-some-cleanup-issues-following-sli-path-refactoring.patch