This is a note to let you know that I've just added the patch titled scsi: qla2xxx: Avoid fcport pointer dereference to the 6.4-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-avoid-fcport-pointer-dereference.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6b504d06976fe4a61cc05dedc68b84fadb397f77 Mon Sep 17 00:00:00 2001 From: Nilesh Javali <njavali@xxxxxxxxxxx> Date: Wed, 7 Jun 2023 17:08:38 +0530 Subject: scsi: qla2xxx: Avoid fcport pointer dereference From: Nilesh Javali <njavali@xxxxxxxxxxx> commit 6b504d06976fe4a61cc05dedc68b84fadb397f77 upstream. Klocwork reported warning of NULL pointer may be dereferenced. The routine exits when sa_ctl is NULL and fcport is allocated after the exit call thus causing NULL fcport pointer to dereference at the time of exit. To avoid fcport pointer dereference, exit the routine when sa_ctl is NULL. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230607113843.37185-4-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_edif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2361,8 +2361,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_h if (!sa_ctl) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "sa_ctl allocation failed\n"); - rval = -ENOMEM; - goto done; + rval = -ENOMEM; + return rval; } fcport = sa_ctl->fcport; Patches currently in stable-queue which might be from njavali@xxxxxxxxxxx are queue-6.4/scsi-qla2xxx-fix-potential-null-pointer-dereference.patch queue-6.4/scsi-qla2xxx-correct-the-index-of-array.patch queue-6.4/scsi-qla2xxx-fix-buffer-overrun.patch queue-6.4/scsi-qla2xxx-fix-task-management-cmd-failure.patch queue-6.4/scsi-qla2xxx-array-index-may-go-out-of-bound.patch queue-6.4/scsi-qla2xxx-fix-hang-in-task-management.patch queue-6.4/scsi-qla2xxx-fix-task-management-cmd-fail-due-to-unavailable-resource.patch queue-6.4/scsi-qla2xxx-wait-for-io-return-on-terminate-rport.patch queue-6.4/scsi-qla2xxx-fix-mem-access-after-free.patch queue-6.4/scsi-qla2xxx-pointer-may-be-dereferenced.patch queue-6.4/scsi-qla2xxx-remove-unused-nvme_ls_waitq-wait-queue.patch queue-6.4/scsi-qla2xxx-avoid-fcport-pointer-dereference.patch queue-6.4/scsi-qla2xxx-multi-que-support-for-tmf.patch queue-6.4/scsi-qla2xxx-check-valid-rport-returned-by-fc_bsg_to_rport.patch