From: Greg Kroah-Hartman Date: Mon, 25 Oct 2021 07:50:47 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.4.290~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3633d3305402be4f4827b5ff518e5a3abaa7ad6a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: scsi-core-fix-shost-cmd_per_lun-calculation-in-scsi_add_host_with_dma.patch --- diff --git a/queue-4.19/scsi-core-fix-shost-cmd_per_lun-calculation-in-scsi_add_host_with_dma.patch b/queue-4.19/scsi-core-fix-shost-cmd_per_lun-calculation-in-scsi_add_host_with_dma.patch new file mode 100644 index 00000000000..fcd347adff6 --- /dev/null +++ b/queue-4.19/scsi-core-fix-shost-cmd_per_lun-calculation-in-scsi_add_host_with_dma.patch @@ -0,0 +1,42 @@ +From 50b6cb3516365cb69753b006be2b61c966b70588 Mon Sep 17 00:00:00 2001 +From: Dexuan Cui +Date: Thu, 7 Oct 2021 21:35:46 -0700 +Subject: scsi: core: Fix shost->cmd_per_lun calculation in scsi_add_host_with_dma() + +From: Dexuan Cui + +commit 50b6cb3516365cb69753b006be2b61c966b70588 upstream. + +After commit ea2f0f77538c ("scsi: core: Cap scsi_host cmd_per_lun at +can_queue"), a 416-CPU VM running on Hyper-V hangs during boot because the +hv_storvsc driver sets scsi_driver.can_queue to an integer value that +exceeds SHRT_MAX, and hence scsi_add_host_with_dma() sets +shost->cmd_per_lun to a negative "short" value. + +Use min_t(int, ...) to work around the issue. + +Link: https://lore.kernel.org/r/20211008043546.6006-1-decui@microsoft.com +Fixes: ea2f0f77538c ("scsi: core: Cap scsi_host cmd_per_lun at can_queue") +Cc: stable@vger.kernel.org +Reviewed-by: Haiyang Zhang +Reviewed-by: Ming Lei +Reviewed-by: John Garry +Signed-off-by: Dexuan Cui +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/hosts.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -218,7 +218,8 @@ int scsi_add_host_with_dma(struct Scsi_H + goto fail; + } + +- shost->cmd_per_lun = min_t(short, shost->cmd_per_lun, ++ /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ ++ shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, + shost->can_queue); + + error = scsi_init_sense_cache(shost); diff --git a/queue-4.19/series b/queue-4.19/series index 38e484934cd..d602b4644ae 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -30,3 +30,4 @@ arm-dts-spear3xx-fix-gmac-node.patch isdn-misdn-fix-sleeping-function-called-from-invalid.patch platform-x86-intel_scu_ipc-update-timeout-value-in-c.patch alsa-hda-avoid-write-to-statests-if-controller-is-in.patch +scsi-core-fix-shost-cmd_per_lun-calculation-in-scsi_add_host_with_dma.patch