From 7b912dd25e3a449bd115ea7d725143661965a3fc Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Mar 28 2024 14:28:05 +0000 Subject: scsi: qla2xxx: Fix double free of the ha->vp_map pointer (bsc#1221816). --- diff --git a/patches.suse/scsi-qla2xxx-Fix-double-free-of-the-ha-vp_map-pointe.patch b/patches.suse/scsi-qla2xxx-Fix-double-free-of-the-ha-vp_map-pointe.patch new file mode 100644 index 0000000..0c69871 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-double-free-of-the-ha-vp_map-pointe.patch @@ -0,0 +1,35 @@ +From: Saurav Kashyap +Date: Tue, 27 Feb 2024 22:11:23 +0530 +Subject: scsi: qla2xxx: Fix double free of the ha->vp_map pointer +Patch-mainline: Queued in subsystem maintainer repository +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +Git-commit: e288285d47784fdcf7c81be56df7d65c6f10c58b +References: bsc#1221816 + +Coverity scan reported potential risk of double free of the pointer +ha->vp_map. ha->vp_map was freed in qla2x00_mem_alloc(), and again freed +in function qla2x00_mem_free(ha). + +Assign NULL to vp_map and kfree take care of NULL. + +Cc: stable@vger.kernel.org +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240227164127.36465-8-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_os.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4601,6 +4601,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha + ha->init_cb_dma = 0; + fail_free_vp_map: + kfree(ha->vp_map); ++ ha->vp_map = NULL; + fail: + ql_log(ql_log_fatal, NULL, 0x0030, + "Memory allocation failure.\n"); diff --git a/series.conf b/series.conf index 85e2866..30fa26a 100644 --- a/series.conf +++ b/series.conf @@ -20061,6 +20061,7 @@ patches.suse/scsi-qla2xxx-Update-manufacturer-detail.patch patches.suse/scsi-qla2xxx-NVME-FCP-prefer-flag-not-being-honored.patch patches.suse/scsi-qla2xxx-Fix-command-flush-on-cable-pull.patch + patches.suse/scsi-qla2xxx-Fix-double-free-of-the-ha-vp_map-pointe.patch ######################################################## # end of sorted patches