This is a note to let you know that I've just added the patch titled scsi: qla2xxx: Fix potential NULL pointer dereference 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-fix-potential-null-pointer-dereference.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 464ea494a40c6e3e0e8f91dd325408aaf21515ba Mon Sep 17 00:00:00 2001 From: Bikash Hazarika <bhazarika@xxxxxxxxxxx> Date: Wed, 7 Jun 2023 17:08:37 +0530 Subject: scsi: qla2xxx: Fix potential NULL pointer dereference From: Bikash Hazarika <bhazarika@xxxxxxxxxxx> commit 464ea494a40c6e3e0e8f91dd325408aaf21515ba upstream. Klocwork tool reported 'cur_dsd' may be dereferenced. Add fix to validate pointer before dereferencing the pointer. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Bikash Hazarika <bhazarika@xxxxxxxxxxx> Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230607113843.37185-3-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_iocb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -603,7 +603,8 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *s put_unaligned_le32(COMMAND_TYPE_6, &cmd_pkt->entry_type); /* No data transfer */ - if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { + if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE || + tot_dsds == 0) { cmd_pkt->byte_count = cpu_to_le32(0); return 0; } Patches currently in stable-queue which might be from bhazarika@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-array-index-may-go-out-of-bound.patch