From da3fbd7ccc7f38e861a113aa60e92dd6f89dd617 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 27 Jan 2023 22:46:15 -0500 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...-allocation-size-for-scsi_host_alloc.patch | 40 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 41 insertions(+) create mode 100644 queue-4.19/scsi-hpsa-fix-allocation-size-for-scsi_host_alloc.patch diff --git a/queue-4.19/scsi-hpsa-fix-allocation-size-for-scsi_host_alloc.patch b/queue-4.19/scsi-hpsa-fix-allocation-size-for-scsi_host_alloc.patch new file mode 100644 index 00000000000..a101b2dc049 --- /dev/null +++ b/queue-4.19/scsi-hpsa-fix-allocation-size-for-scsi_host_alloc.patch @@ -0,0 +1,40 @@ +From 1cac65f0e2c02bb32ba4a2ae39f875dff506c139 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Jan 2023 06:12:55 +0300 +Subject: scsi: hpsa: Fix allocation size for scsi_host_alloc() + +From: Alexey V. Vissarionov + +[ Upstream commit bbbd25499100c810ceaf5193c3cfcab9f7402a33 ] + +The 'h' is a pointer to struct ctlr_info, so it's just 4 or 8 bytes, while +the structure itself is much bigger. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: edd163687ea5 ("hpsa: add driver for HP Smart Array controllers.") +Link: https://lore.kernel.org/r/20230118031255.GE15213@altlinux.org +Signed-off-by: Alexey V. Vissarionov +Acked-by: Don Brace +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/hpsa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c +index 13931c5c0eff..25d9bdd4bc69 100644 +--- a/drivers/scsi/hpsa.c ++++ b/drivers/scsi/hpsa.c +@@ -5771,7 +5771,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) + { + struct Scsi_Host *sh; + +- sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h)); ++ sh = scsi_host_alloc(&hpsa_driver_template, sizeof(struct ctlr_info)); + if (sh == NULL) { + dev_err(&h->pdev->dev, "scsi_host_alloc failed\n"); + return -ENOMEM; +-- +2.39.0 + diff --git a/queue-4.19/series b/queue-4.19/series index 5af99da7be2..18c21d4d16d 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -39,3 +39,4 @@ block-fix-and-cleanup-bio_check_ro.patch perf-env-do-not-return-pointers-to-local-variables.patch fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch bluetooth-hci_sync-cancel-cmd_timer-if-hci_open-fail.patch +scsi-hpsa-fix-allocation-size-for-scsi_host_alloc.patch -- 2.47.2