From: Greg Kroah-Hartman Date: Thu, 14 Nov 2019 06:00:25 +0000 (+0800) Subject: 4.14-stable patches X-Git-Tag: v4.4.202~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ab1dd3e273ba8e96cef789ff865c072e1ce6be1;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: mips-bcm63xx-fix-switch-core-reset-on-bcm6368.patch scsi-core-handle-drivers-which-set-sg_tablesize-to-zero.patch --- diff --git a/queue-4.14/mips-bcm63xx-fix-switch-core-reset-on-bcm6368.patch b/queue-4.14/mips-bcm63xx-fix-switch-core-reset-on-bcm6368.patch new file mode 100644 index 00000000000..4a2f63556e0 --- /dev/null +++ b/queue-4.14/mips-bcm63xx-fix-switch-core-reset-on-bcm6368.patch @@ -0,0 +1,38 @@ +From 8a38dacf87180738d42b058334c951eba15d2d47 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Mon, 10 Dec 2018 12:40:38 +0100 +Subject: MIPS: BCM63XX: fix switch core reset on BCM6368 + +From: Jonas Gorski + +commit 8a38dacf87180738d42b058334c951eba15d2d47 upstream. + +The Ethernet Switch core mask was set to 0, causing the switch core to +be not reset on BCM6368 on boot. Provide the proper mask so the switch +core gets reset to a known good state. + +Fixes: 799faa626c71 ("MIPS: BCM63XX: add core reset helper") +Signed-off-by: Jonas Gorski +Signed-off-by: Paul Burton +Cc: linux-mips@vger.kernel.org +Cc: Ralf Baechle +Cc: James Hogan +Cc: Florian Fainelli +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/bcm63xx/reset.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/bcm63xx/reset.c ++++ b/arch/mips/bcm63xx/reset.c +@@ -120,7 +120,7 @@ + #define BCM6368_RESET_DSL 0 + #define BCM6368_RESET_SAR SOFTRESET_6368_SAR_MASK + #define BCM6368_RESET_EPHY SOFTRESET_6368_EPHY_MASK +-#define BCM6368_RESET_ENETSW 0 ++#define BCM6368_RESET_ENETSW SOFTRESET_6368_ENETSW_MASK + #define BCM6368_RESET_PCM SOFTRESET_6368_PCM_MASK + #define BCM6368_RESET_MPI SOFTRESET_6368_MPI_MASK + #define BCM6368_RESET_PCIE 0 diff --git a/queue-4.14/scsi-core-handle-drivers-which-set-sg_tablesize-to-zero.patch b/queue-4.14/scsi-core-handle-drivers-which-set-sg_tablesize-to-zero.patch new file mode 100644 index 00000000000..d081dbc2ac7 --- /dev/null +++ b/queue-4.14/scsi-core-handle-drivers-which-set-sg_tablesize-to-zero.patch @@ -0,0 +1,51 @@ +From 9393c8de628cf0968d81a17cc11841e42191e041 Mon Sep 17 00:00:00 2001 +From: Michael Schmitz +Date: Tue, 5 Nov 2019 15:49:10 +1300 +Subject: scsi: core: Handle drivers which set sg_tablesize to zero + +From: Michael Schmitz + +commit 9393c8de628cf0968d81a17cc11841e42191e041 upstream. + +In scsi_mq_setup_tags(), cmd_size is calculated based on zero size for the +scatter-gather list in case the low level driver uses SG_NONE in its host +template. + +cmd_size is passed on to the block layer for calculation of the request +size, and we've seen NULL pointer dereference errors from the block layer +in drivers where SG_NONE is used and a mq IO scheduler is active, +apparently as a consequence of this (see commit 68ab2d76e4be ("scsi: +cxlflash: Set sg_tablesize to 1 instead of SG_NONE"), and a recent patch by +Finn Thain converting the three m68k NFR5380 drivers to avoid setting +SG_NONE). + +Try to avoid these errors by accounting for at least one sg list entry when +calculating cmd_size, regardless of whether the low level driver set a zero +sg_tablesize. + +Tested on 030 m68k with the atari_scsi driver - setting sg_tablesize to +SG_NONE no longer results in a crash when loading this driver. + +CC: Finn Thain +Link: https://lore.kernel.org/r/1572922150-4358-1-git-send-email-schmitzmic@gmail.com +Signed-off-by: Michael Schmitz +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + + +--- + drivers/scsi/scsi_lib.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -2277,7 +2277,8 @@ int scsi_mq_setup_tags(struct Scsi_Host + { + unsigned int cmd_size, sgl_size; + +- sgl_size = scsi_mq_sgl_size(shost); ++ sgl_size = max_t(unsigned int, sizeof(struct scatterlist), ++ scsi_mq_sgl_size(shost)); + cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size; + if (scsi_host_get_prot(shost)) + cmd_size += sizeof(struct scsi_data_buffer) + sgl_size; diff --git a/queue-4.14/series b/queue-4.14/series index 7a0832d0866..0e9d4b8ea2f 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1,2 +1,4 @@ kvm-mmu-don-t-read-pdptes-when-paging-is-not-enabled.patch kvm-x86-introduce-is_pae_paging.patch +mips-bcm63xx-fix-switch-core-reset-on-bcm6368.patch +scsi-core-handle-drivers-which-set-sg_tablesize-to-zero.patch