From 1ac90494204f00ac4039e308a7d4050d17214433 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 21 Mar 2021 13:37:48 +0100 Subject: [PATCH] 5.11-stable patches added patches: risc-v-correct-enum-sbi_ext_rfence_fid.patch scsi-lpfc-fix-some-error-codes-in-debugfs.patch scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch scsi-ufs-ufs-mediatek-correct-operator.patch --- ...sc-v-correct-enum-sbi_ext_rfence_fid.patch | 48 +++++++++++++++++++ ...lpfc-fix-some-error-codes-in-debugfs.patch | 41 ++++++++++++++++ ...not-use-gfp_kernel-in-atomic-context.patch | 39 +++++++++++++++ ...rs-fix-a-double-free-in-myrs_cleanup.patch | 37 ++++++++++++++ ...si-ufs-ufs-mediatek-correct-operator.patch | 34 +++++++++++++ queue-5.11/series | 5 ++ 6 files changed, 204 insertions(+) create mode 100644 queue-5.11/risc-v-correct-enum-sbi_ext_rfence_fid.patch create mode 100644 queue-5.11/scsi-lpfc-fix-some-error-codes-in-debugfs.patch create mode 100644 queue-5.11/scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch create mode 100644 queue-5.11/scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch create mode 100644 queue-5.11/scsi-ufs-ufs-mediatek-correct-operator.patch diff --git a/queue-5.11/risc-v-correct-enum-sbi_ext_rfence_fid.patch b/queue-5.11/risc-v-correct-enum-sbi_ext_rfence_fid.patch new file mode 100644 index 00000000000..4842b0b348c --- /dev/null +++ b/queue-5.11/risc-v-correct-enum-sbi_ext_rfence_fid.patch @@ -0,0 +1,48 @@ +From 6dd4879f59b0a0679ed8c3ebaff3d79f37930778 Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt +Date: Sat, 6 Mar 2021 06:48:01 +0100 +Subject: RISC-V: correct enum sbi_ext_rfence_fid + +From: Heinrich Schuchardt + +commit 6dd4879f59b0a0679ed8c3ebaff3d79f37930778 upstream. + +The constants in enum sbi_ext_rfence_fid should match the SBI +specification. See +https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc#78-function-listing + +| Function Name | FID | EID +| sbi_remote_fence_i | 0 | 0x52464E43 +| sbi_remote_sfence_vma | 1 | 0x52464E43 +| sbi_remote_sfence_vma_asid | 2 | 0x52464E43 +| sbi_remote_hfence_gvma_vmid | 3 | 0x52464E43 +| sbi_remote_hfence_gvma | 4 | 0x52464E43 +| sbi_remote_hfence_vvma_asid | 5 | 0x52464E43 +| sbi_remote_hfence_vvma | 6 | 0x52464E43 + +Fixes: ecbacc2a3efd ("RISC-V: Add SBI v0.2 extension definitions") +Reported-by: Sean Anderson +Signed-off-by: Heinrich Schuchardt +Reviewed-by: Anup Patel +Reviewed-by: Atish Patra +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/include/asm/sbi.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/riscv/include/asm/sbi.h ++++ b/arch/riscv/include/asm/sbi.h +@@ -51,10 +51,10 @@ enum sbi_ext_rfence_fid { + SBI_EXT_RFENCE_REMOTE_FENCE_I = 0, + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA, + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID, +- SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA, + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID, +- SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA, ++ SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA, + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID, ++ SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA, + }; + + enum sbi_ext_hsm_fid { diff --git a/queue-5.11/scsi-lpfc-fix-some-error-codes-in-debugfs.patch b/queue-5.11/scsi-lpfc-fix-some-error-codes-in-debugfs.patch new file mode 100644 index 00000000000..088dc624fba --- /dev/null +++ b/queue-5.11/scsi-lpfc-fix-some-error-codes-in-debugfs.patch @@ -0,0 +1,41 @@ +From 19f1bc7edf0f97186810e13a88f5b62069d89097 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 12 Mar 2021 10:42:11 +0300 +Subject: scsi: lpfc: Fix some error codes in debugfs + +From: Dan Carpenter + +commit 19f1bc7edf0f97186810e13a88f5b62069d89097 upstream. + +If copy_from_user() or kstrtoull() fail then the correct behavior is to +return a negative error code. + +Link: https://lore.kernel.org/r/YEsbU/UxYypVrC7/@mwanda +Fixes: f9bb2da11db8 ("[SCSI] lpfc 8.3.27: T10 additions for SLI4") +Signed-off-by: Dan Carpenter +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_debugfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_debugfs.c ++++ b/drivers/scsi/lpfc/lpfc_debugfs.c +@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file * + memset(dstbuf, 0, 33); + size = (nbytes < 32) ? nbytes : 32; + if (copy_from_user(dstbuf, buf, size)) +- return 0; ++ return -EFAULT; + + if (dent == phba->debug_InjErrLBA) { + if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && +@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file * + } + + if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) +- return 0; ++ return -EINVAL; + + if (dent == phba->debug_writeGuard) + phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; diff --git a/queue-5.11/scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch b/queue-5.11/scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch new file mode 100644 index 00000000000..5a70a75b48b --- /dev/null +++ b/queue-5.11/scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch @@ -0,0 +1,39 @@ +From a50bd64616907ed126ffbdbaa06c5ce708c4a404 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 20 Feb 2021 10:39:51 +0100 +Subject: scsi: mpt3sas: Do not use GFP_KERNEL in atomic context + +From: Christophe JAILLET + +commit a50bd64616907ed126ffbdbaa06c5ce708c4a404 upstream. + +mpt3sas_get_port_by_id() can be called when a spinlock is held. Use +GFP_ATOMIC instead of GFP_KERNEL when allocating memory. + +Issue spotted by call_kern.cocci: +./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7125 inside lock on line 7123 but uses GFP_KERNEL +./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6842 inside lock on line 6839 but uses GFP_KERNEL +./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 6854 inside lock on line 6851 but uses GFP_KERNEL +./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 7706 inside lock on line 7702 but uses GFP_KERNEL +./drivers/scsi/mpt3sas/mpt3sas_scsih.c:416:42-52: ERROR: function mpt3sas_get_port_by_id called on line 10260 inside lock on line 10256 but uses GFP_KERNEL + +Link: https://lore.kernel.org/r/20210220093951.905362-1-christophe.jaillet@wanadoo.fr +Fixes: 324c122fc0a4 ("scsi: mpt3sas: Add module parameter multipath_on_hba") +Signed-off-by: Christophe JAILLET +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +@@ -407,7 +407,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_AD + * And add this object to port_table_list. + */ + if (!ioc->multipath_on_hba) { +- port = kzalloc(sizeof(struct hba_port), GFP_KERNEL); ++ port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC); + if (!port) + return NULL; + diff --git a/queue-5.11/scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch b/queue-5.11/scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch new file mode 100644 index 00000000000..3ac0c955a6a --- /dev/null +++ b/queue-5.11/scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch @@ -0,0 +1,37 @@ +From 2bb817712e2f77486d6ee17e7efaf91997a685f8 Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Wed, 10 Mar 2021 22:30:05 -0800 +Subject: scsi: myrs: Fix a double free in myrs_cleanup() + +From: Lv Yunlong + +commit 2bb817712e2f77486d6ee17e7efaf91997a685f8 upstream. + +In myrs_cleanup(), cs->mmio_base will be freed twice by iounmap(). + +Link: https://lore.kernel.org/r/20210311063005.9963-1-lyl2019@mail.ustc.edu.cn +Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)") +Reviewed-by: Hannes Reinecke +Signed-off-by: Lv Yunlong +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/myrs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/myrs.c ++++ b/drivers/scsi/myrs.c +@@ -2273,12 +2273,12 @@ static void myrs_cleanup(struct myrs_hba + if (cs->mmio_base) { + cs->disable_intr(cs); + iounmap(cs->mmio_base); ++ cs->mmio_base = NULL; + } + if (cs->irq) + free_irq(cs->irq, cs); + if (cs->io_addr) + release_region(cs->io_addr, 0x80); +- iounmap(cs->mmio_base); + pci_set_drvdata(pdev, NULL); + pci_disable_device(pdev); + scsi_host_put(cs->host); diff --git a/queue-5.11/scsi-ufs-ufs-mediatek-correct-operator.patch b/queue-5.11/scsi-ufs-ufs-mediatek-correct-operator.patch new file mode 100644 index 00000000000..80b8dcc3d64 --- /dev/null +++ b/queue-5.11/scsi-ufs-ufs-mediatek-correct-operator.patch @@ -0,0 +1,34 @@ +From 0fdc7d5d8f3719950478cca452cf7f0f1355be10 Mon Sep 17 00:00:00 2001 +From: dongjian +Date: Tue, 16 Mar 2021 20:15:15 +0800 +Subject: scsi: ufs: ufs-mediatek: Correct operator & -> && + +From: dongjian + +commit 0fdc7d5d8f3719950478cca452cf7f0f1355be10 upstream. + +The "lpm" and "->enabled" are all boolean. We should be using && +rather than the bit operator. + +Link: https://lore.kernel.org/r/1615896915-148864-1-git-send-email-dj0227@163.com +Fixes: 488edafb1120 ("scsi: ufs-mediatek: Introduce low-power mode for device power supply") +Reviewed-by: Avri Altman +Signed-off-by: dongjian +Signed-off-by: Yue Hu +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/ufs/ufs-mediatek.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/ufs/ufs-mediatek.c ++++ b/drivers/scsi/ufs/ufs-mediatek.c +@@ -911,7 +911,7 @@ static void ufs_mtk_vreg_set_lpm(struct + if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc) + return; + +- if (lpm & !hba->vreg_info.vcc->enabled) ++ if (lpm && !hba->vreg_info.vcc->enabled) + regulator_set_mode(hba->vreg_info.vccq2->reg, + REGULATOR_MODE_IDLE); + else if (!lpm) diff --git a/queue-5.11/series b/queue-5.11/series index e15ec4d5d50..487f67d92ed 100644 --- a/queue-5.11/series +++ b/queue-5.11/series @@ -61,3 +61,8 @@ cifs-warn-and-fail-if-trying-to-use-rootfs-without-the-config-option.patch cifs-fix-allocation-size-on-newly-created-files.patch risc-v-fix-out-of-bounds-accesses-in-init_resources.patch riscv-correct-sparsemem-configuration.patch +scsi-lpfc-fix-some-error-codes-in-debugfs.patch +scsi-myrs-fix-a-double-free-in-myrs_cleanup.patch +scsi-ufs-ufs-mediatek-correct-operator.patch +scsi-mpt3sas-do-not-use-gfp_kernel-in-atomic-context.patch +risc-v-correct-enum-sbi_ext_rfence_fid.patch -- 2.47.3