This is a note to let you know that I've just added the patch titled scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport() to the 5.15-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-qla2xxx-check-valid-rport-returned-by-fc_bsg_to_rport.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From af73f23a27206ffb3c477cac75b5fcf03410556e Mon Sep 17 00:00:00 2001 From: Nilesh Javali <njavali@xxxxxxxxxxx> Date: Wed, 7 Jun 2023 17:08:39 +0530 Subject: scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport() From: Nilesh Javali <njavali@xxxxxxxxxxx> commit af73f23a27206ffb3c477cac75b5fcf03410556e upstream. Klocwork reported warning of rport maybe NULL and will be dereferenced. rport returned by call to fc_bsg_to_rport() could be NULL and dereferenced. Check valid rport returned by fc_bsg_to_rport(). Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230607113843.37185-5-njavali@xxxxxxxxxxx Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/qla2xxx/qla_bsg.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -283,6 +283,10 @@ qla2x00_process_els(struct bsg_job *bsg_ if (bsg_request->msgcode == FC_BSG_RPT_ELS) { rport = fc_bsg_to_rport(bsg_job); + if (!rport) { + rval = -ENOMEM; + goto done; + } fcport = *(fc_port_t **) rport->dd_data; host = rport_to_shost(rport); vha = shost_priv(host); Patches currently in stable-queue which might be from njavali@xxxxxxxxxxx are queue-5.15/scsi-qla2xxx-fix-potential-null-pointer-dereference.patch queue-5.15/scsi-qla2xxx-correct-the-index-of-array.patch queue-5.15/scsi-qla2xxx-fix-buffer-overrun.patch queue-5.15/scsi-qla2xxx-array-index-may-go-out-of-bound.patch queue-5.15/scsi-qla2xxx-wait-for-io-return-on-terminate-rport.patch queue-5.15/scsi-qla2xxx-pointer-may-be-dereferenced.patch queue-5.15/scsi-qla2xxx-remove-unused-nvme_ls_waitq-wait-queue.patch queue-5.15/scsi-qla2xxx-avoid-fcport-pointer-dereference.patch queue-5.15/scsi-qla2xxx-check-valid-rport-returned-by-fc_bsg_to_rport.patch