From: Greg Kroah-Hartman Date: Fri, 26 Jan 2024 23:33:41 +0000 (-0800) Subject: 5.15-stable patches X-Git-Tag: v6.1.76~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8667dd12c251ed63202677f20279459417dd8a3;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: arm64-dts-qcom-sdm845-fix-usb-dp-dm-hs-phy-interrupts.patch arm64-dts-qcom-sdm845-fix-usb-ss-wakeup.patch arm64-dts-qcom-sm8150-fix-usb-dp-dm-hs-phy-interrupts.patch arm64-dts-qcom-sm8150-fix-usb-ss-wakeup.patch lsm-new-security_file_ioctl_compat-hook.patch mmc-core-use-mrq.sbc-in-close-ended-ffu.patch mmc-mmc_spi-remove-custom-dma-mapped-buffers.patch nouveau-vmm-don-t-set-addr-on-the-fail-path-to-avoid-warning.patch rtc-adjust-failure-return-code-for-cmos_set_alarm.patch scripts-get_abi-fix-source-path-leak.patch ubifs-ubifs_symlink-fix-memleak-of-inode-i_link-in-error-path.patch --- diff --git a/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-dp-dm-hs-phy-interrupts.patch b/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-dp-dm-hs-phy-interrupts.patch new file mode 100644 index 00000000000..0257e8dfa7b --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-dp-dm-hs-phy-interrupts.patch @@ -0,0 +1,63 @@ +From 204f9ed4bad6293933179517624143b8f412347c Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 13 Dec 2023 18:34:00 +0100 +Subject: arm64: dts: qcom: sdm845: fix USB DP/DM HS PHY interrupts + +From: Johan Hovold + +commit 204f9ed4bad6293933179517624143b8f412347c upstream. + +The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt +controller in order to be able to wake the system up from low-power +states and to be able to detect disconnect events, which requires +triggering on falling edges. + +A recent commit updated the trigger type but failed to change the +interrupt provider as required. This leads to the current Linux driver +failing to probe instead of printing an error during suspend and USB +wakeup not working as intended. + +Fixes: 84ad9ac8d9ca ("arm64: dts: qcom: sdm845: fix USB wakeup interrupt types") +Fixes: ca4db2b538a1 ("arm64: dts: qcom: sdm845: Add USB-related nodes") +Cc: stable@vger.kernel.org # 4.20 +Signed-off-by: Johan Hovold +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20231213173403.29544-3-johan+linaro@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/qcom/sdm845.dtsi | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -3767,10 +3767,10 @@ + <&gcc GCC_USB30_PRIM_MASTER_CLK>; + assigned-clock-rates = <19200000>, <150000000>; + +- interrupts = , +- , +- , +- ; ++ interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, ++ <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc_intc 8 IRQ_TYPE_EDGE_BOTH>, ++ <&pdc_intc 9 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", + "dm_hs_phy_irq", "dp_hs_phy_irq"; + +@@ -3815,10 +3815,10 @@ + <&gcc GCC_USB30_SEC_MASTER_CLK>; + assigned-clock-rates = <19200000>, <150000000>; + +- interrupts = , +- , +- , +- ; ++ interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, ++ <&intc GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc_intc 10 IRQ_TYPE_EDGE_BOTH>, ++ <&pdc_intc 11 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", + "dm_hs_phy_irq", "dp_hs_phy_irq"; + diff --git a/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-ss-wakeup.patch b/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-ss-wakeup.patch new file mode 100644 index 00000000000..1a69c5d7063 --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-sdm845-fix-usb-ss-wakeup.patch @@ -0,0 +1,44 @@ +From 971f5d8b0618d09db75184ddd8cca0767514db5d Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 13 Dec 2023 18:34:01 +0100 +Subject: arm64: dts: qcom: sdm845: fix USB SS wakeup + +From: Johan Hovold + +commit 971f5d8b0618d09db75184ddd8cca0767514db5d upstream. + +The USB SS PHY interrupts need to be provided by the PDC interrupt +controller in order to be able to wake the system up from low-power +states. + +Fixes: ca4db2b538a1 ("arm64: dts: qcom: sdm845: Add USB-related nodes") +Cc: stable@vger.kernel.org # 4.20 +Signed-off-by: Johan Hovold +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20231213173403.29544-4-johan+linaro@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -3768,7 +3768,7 @@ + assigned-clock-rates = <19200000>, <150000000>; + + interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, +- <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc_intc 6 IRQ_TYPE_LEVEL_HIGH>, + <&pdc_intc 8 IRQ_TYPE_EDGE_BOTH>, + <&pdc_intc 9 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", +@@ -3816,7 +3816,7 @@ + assigned-clock-rates = <19200000>, <150000000>; + + interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, +- <&intc GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc_intc 7 IRQ_TYPE_LEVEL_HIGH>, + <&pdc_intc 10 IRQ_TYPE_EDGE_BOTH>, + <&pdc_intc 11 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", diff --git a/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-dp-dm-hs-phy-interrupts.patch b/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-dp-dm-hs-phy-interrupts.patch new file mode 100644 index 00000000000..3e0fd96390c --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-dp-dm-hs-phy-interrupts.patch @@ -0,0 +1,66 @@ +From 134de5e831775e8b178db9b131c1d3769a766982 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 13 Dec 2023 18:34:02 +0100 +Subject: arm64: dts: qcom: sm8150: fix USB DP/DM HS PHY interrupts + +From: Johan Hovold + +commit 134de5e831775e8b178db9b131c1d3769a766982 upstream. + +The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt +controller in order to be able to wake the system up from low-power +states and to be able to detect disconnect events, which requires +triggering on falling edges. + +A recent commit updated the trigger type but failed to change the +interrupt provider as required. This leads to the current Linux driver +failing to probe instead of printing an error during suspend and USB +wakeup not working as intended. + +Fixes: 54524b6987d1 ("arm64: dts: qcom: sm8150: fix USB wakeup interrupt types") +Fixes: 0c9dde0d2015 ("arm64: dts: qcom: sm8150: Add secondary USB and PHY nodes") +Fixes: b33d2868e8d3 ("arm64: dts: qcom: sm8150: Add USB and PHY device nodes") +Cc: stable@vger.kernel.org # 5.10 +Cc: Jack Pham +Cc: Jonathan Marek +Signed-off-by: Johan Hovold +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20231213173403.29544-5-johan+linaro@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/qcom/sm8150.dtsi | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi +@@ -3092,10 +3092,10 @@ + <&gcc GCC_USB30_PRIM_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + +- interrupts = , +- , +- , +- ; ++ interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, ++ <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc 8 IRQ_TYPE_EDGE_BOTH>, ++ <&pdc 9 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", + "dm_hs_phy_irq", "dp_hs_phy_irq"; + +@@ -3137,10 +3137,10 @@ + <&gcc GCC_USB30_SEC_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + +- interrupts = , +- , +- , +- ; ++ interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, ++ <&intc GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc 10 IRQ_TYPE_EDGE_BOTH>, ++ <&pdc 11 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", + "dm_hs_phy_irq", "dp_hs_phy_irq"; + diff --git a/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-ss-wakeup.patch b/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-ss-wakeup.patch new file mode 100644 index 00000000000..3ec89209500 --- /dev/null +++ b/queue-5.15/arm64-dts-qcom-sm8150-fix-usb-ss-wakeup.patch @@ -0,0 +1,47 @@ +From cc4e1da491b84ca05339a19893884cda78f74aef Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 13 Dec 2023 18:34:03 +0100 +Subject: arm64: dts: qcom: sm8150: fix USB SS wakeup + +From: Johan Hovold + +commit cc4e1da491b84ca05339a19893884cda78f74aef upstream. + +The USB SS PHY interrupts need to be provided by the PDC interrupt +controller in order to be able to wake the system up from low-power +states. + +Fixes: 0c9dde0d2015 ("arm64: dts: qcom: sm8150: Add secondary USB and PHY nodes") +Fixes: b33d2868e8d3 ("arm64: dts: qcom: sm8150: Add USB and PHY device nodes") +Cc: stable@vger.kernel.org # 5.10 +Cc: Jack Pham +Cc: Jonathan Marek +Signed-off-by: Johan Hovold +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20231213173403.29544-6-johan+linaro@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/qcom/sm8150.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi +@@ -3093,7 +3093,7 @@ + assigned-clock-rates = <19200000>, <200000000>; + + interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, +- <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc 6 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 8 IRQ_TYPE_EDGE_BOTH>, + <&pdc 9 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", +@@ -3138,7 +3138,7 @@ + assigned-clock-rates = <19200000>, <200000000>; + + interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, +- <&intc GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, ++ <&pdc 7 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 10 IRQ_TYPE_EDGE_BOTH>, + <&pdc 11 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "hs_phy_irq", "ss_phy_irq", diff --git a/queue-5.15/lsm-new-security_file_ioctl_compat-hook.patch b/queue-5.15/lsm-new-security_file_ioctl_compat-hook.patch new file mode 100644 index 00000000000..533e26321d5 --- /dev/null +++ b/queue-5.15/lsm-new-security_file_ioctl_compat-hook.patch @@ -0,0 +1,187 @@ +From f1bb47a31dff6d4b34fb14e99850860ee74bb003 Mon Sep 17 00:00:00 2001 +From: Alfred Piccioni +Date: Tue, 19 Dec 2023 10:09:09 +0100 +Subject: lsm: new security_file_ioctl_compat() hook + +From: Alfred Piccioni + +commit f1bb47a31dff6d4b34fb14e99850860ee74bb003 upstream. + +Some ioctl commands do not require ioctl permission, but are routed to +other permissions such as FILE_GETATTR or FILE_SETATTR. This routing is +done by comparing the ioctl cmd to a set of 64-bit flags (FS_IOC_*). + +However, if a 32-bit process is running on a 64-bit kernel, it emits +32-bit flags (FS_IOC32_*) for certain ioctl operations. These flags are +being checked erroneously, which leads to these ioctl operations being +routed to the ioctl permission, rather than the correct file +permissions. + +This was also noted in a RED-PEN finding from a while back - +"/* RED-PEN how should LSM module know it's handling 32bit? */". + +This patch introduces a new hook, security_file_ioctl_compat(), that is +called from the compat ioctl syscall. All current LSMs have been changed +to support this hook. + +Reviewing the three places where we are currently using +security_file_ioctl(), it appears that only SELinux needs a dedicated +compat change; TOMOYO and SMACK appear to be functional without any +change. + +Cc: stable@vger.kernel.org +Fixes: 0b24dcb7f2f7 ("Revert "selinux: simplify ioctl checking"") +Signed-off-by: Alfred Piccioni +Reviewed-by: Stephen Smalley +[PM: subject tweak, line length fixes, and alignment corrections] +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + fs/ioctl.c | 3 +-- + include/linux/lsm_hook_defs.h | 2 ++ + include/linux/security.h | 9 +++++++++ + security/security.c | 18 ++++++++++++++++++ + security/selinux/hooks.c | 28 ++++++++++++++++++++++++++++ + security/smack/smack_lsm.c | 1 + + security/tomoyo/tomoyo.c | 1 + + 7 files changed, 60 insertions(+), 2 deletions(-) + +--- a/fs/ioctl.c ++++ b/fs/ioctl.c +@@ -920,8 +920,7 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned i + if (!f.file) + return -EBADF; + +- /* RED-PEN how should LSM module know it's handling 32bit? */ +- error = security_file_ioctl(f.file, cmd, arg); ++ error = security_file_ioctl_compat(f.file, cmd, arg); + if (error) + goto out; + +--- a/include/linux/lsm_hook_defs.h ++++ b/include/linux/lsm_hook_defs.h +@@ -165,6 +165,8 @@ LSM_HOOK(int, 0, file_alloc_security, st + LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) + LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, + unsigned long arg) ++LSM_HOOK(int, 0, file_ioctl_compat, struct file *file, unsigned int cmd, ++ unsigned long arg) + LSM_HOOK(int, 0, mmap_addr, unsigned long addr) + LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, + unsigned long prot, unsigned long flags) +--- a/include/linux/security.h ++++ b/include/linux/security.h +@@ -382,6 +382,8 @@ int security_file_permission(struct file + int security_file_alloc(struct file *file); + void security_file_free(struct file *file); + int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); ++int security_file_ioctl_compat(struct file *file, unsigned int cmd, ++ unsigned long arg); + int security_mmap_file(struct file *file, unsigned long prot, + unsigned long flags); + int security_mmap_addr(unsigned long addr); +@@ -962,6 +964,13 @@ static inline int security_file_ioctl(st + { + return 0; + } ++ ++static inline int security_file_ioctl_compat(struct file *file, ++ unsigned int cmd, ++ unsigned long arg) ++{ ++ return 0; ++} + + static inline int security_mmap_file(struct file *file, unsigned long prot, + unsigned long flags) +--- a/security/security.c ++++ b/security/security.c +@@ -1556,6 +1556,24 @@ int security_file_ioctl(struct file *fil + } + EXPORT_SYMBOL_GPL(security_file_ioctl); + ++/** ++ * security_file_ioctl_compat() - Check if an ioctl is allowed in compat mode ++ * @file: associated file ++ * @cmd: ioctl cmd ++ * @arg: ioctl arguments ++ * ++ * Compat version of security_file_ioctl() that correctly handles 32-bit ++ * processes running on 64-bit kernels. ++ * ++ * Return: Returns 0 if permission is granted. ++ */ ++int security_file_ioctl_compat(struct file *file, unsigned int cmd, ++ unsigned long arg) ++{ ++ return call_int_hook(file_ioctl_compat, 0, file, cmd, arg); ++} ++EXPORT_SYMBOL_GPL(security_file_ioctl_compat); ++ + static inline unsigned long mmap_prot(struct file *file, unsigned long prot) + { + /* +--- a/security/selinux/hooks.c ++++ b/security/selinux/hooks.c +@@ -3810,6 +3810,33 @@ static int selinux_file_ioctl(struct fil + return error; + } + ++static int selinux_file_ioctl_compat(struct file *file, unsigned int cmd, ++ unsigned long arg) ++{ ++ /* ++ * If we are in a 64-bit kernel running 32-bit userspace, we need to ++ * make sure we don't compare 32-bit flags to 64-bit flags. ++ */ ++ switch (cmd) { ++ case FS_IOC32_GETFLAGS: ++ cmd = FS_IOC_GETFLAGS; ++ break; ++ case FS_IOC32_SETFLAGS: ++ cmd = FS_IOC_SETFLAGS; ++ break; ++ case FS_IOC32_GETVERSION: ++ cmd = FS_IOC_GETVERSION; ++ break; ++ case FS_IOC32_SETVERSION: ++ cmd = FS_IOC_SETVERSION; ++ break; ++ default: ++ break; ++ } ++ ++ return selinux_file_ioctl(file, cmd, arg); ++} ++ + static int default_noexec __ro_after_init; + + static int file_map_prot_check(struct file *file, unsigned long prot, int shared) +@@ -7208,6 +7235,7 @@ static struct security_hook_list selinux + LSM_HOOK_INIT(file_permission, selinux_file_permission), + LSM_HOOK_INIT(file_alloc_security, selinux_file_alloc_security), + LSM_HOOK_INIT(file_ioctl, selinux_file_ioctl), ++ LSM_HOOK_INIT(file_ioctl_compat, selinux_file_ioctl_compat), + LSM_HOOK_INIT(mmap_file, selinux_mmap_file), + LSM_HOOK_INIT(mmap_addr, selinux_mmap_addr), + LSM_HOOK_INIT(file_mprotect, selinux_file_mprotect), +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -4767,6 +4767,7 @@ static struct security_hook_list smack_h + + LSM_HOOK_INIT(file_alloc_security, smack_file_alloc_security), + LSM_HOOK_INIT(file_ioctl, smack_file_ioctl), ++ LSM_HOOK_INIT(file_ioctl_compat, smack_file_ioctl), + LSM_HOOK_INIT(file_lock, smack_file_lock), + LSM_HOOK_INIT(file_fcntl, smack_file_fcntl), + LSM_HOOK_INIT(mmap_file, smack_mmap_file), +--- a/security/tomoyo/tomoyo.c ++++ b/security/tomoyo/tomoyo.c +@@ -546,6 +546,7 @@ static struct security_hook_list tomoyo_ + LSM_HOOK_INIT(path_rename, tomoyo_path_rename), + LSM_HOOK_INIT(inode_getattr, tomoyo_inode_getattr), + LSM_HOOK_INIT(file_ioctl, tomoyo_file_ioctl), ++ LSM_HOOK_INIT(file_ioctl_compat, tomoyo_file_ioctl), + LSM_HOOK_INIT(path_chmod, tomoyo_path_chmod), + LSM_HOOK_INIT(path_chown, tomoyo_path_chown), + LSM_HOOK_INIT(path_chroot, tomoyo_path_chroot), diff --git a/queue-5.15/mmc-core-use-mrq.sbc-in-close-ended-ffu.patch b/queue-5.15/mmc-core-use-mrq.sbc-in-close-ended-ffu.patch new file mode 100644 index 00000000000..126e007e351 --- /dev/null +++ b/queue-5.15/mmc-core-use-mrq.sbc-in-close-ended-ffu.patch @@ -0,0 +1,145 @@ +From 4d0c8d0aef6355660b6775d57ccd5d4ea2e15802 Mon Sep 17 00:00:00 2001 +From: Avri Altman +Date: Wed, 29 Nov 2023 11:25:35 +0200 +Subject: mmc: core: Use mrq.sbc in close-ended ffu + +From: Avri Altman + +commit 4d0c8d0aef6355660b6775d57ccd5d4ea2e15802 upstream. + +Field Firmware Update (ffu) may use close-ended or open ended sequence. +Each such sequence is comprised of a write commands enclosed between 2 +switch commands - to and from ffu mode. So for the close-ended case, it +will be: cmd6->cmd23-cmd25-cmd6. + +Some host controllers however, get confused when multi-block rw is sent +without sbc, and may generate auto-cmd12 which breaks the ffu sequence. +I encountered this issue while testing fwupd (github.com/fwupd/fwupd) +on HP Chromebook x2, a qualcomm based QC-7c, code name - strongbad. + +Instead of a quirk, or hooking the request function of the msm ops, +it would be better to fix the ioctl handling and make it use mrq.sbc +instead of issuing SET_BLOCK_COUNT separately. + +Signed-off-by: Avri Altman +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20231129092535.3278-1-avri.altman@wdc.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/block.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 43 insertions(+), 3 deletions(-) + +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -399,6 +399,10 @@ struct mmc_blk_ioc_data { + struct mmc_ioc_cmd ic; + unsigned char *buf; + u64 buf_bytes; ++ unsigned int flags; ++#define MMC_BLK_IOC_DROP BIT(0) /* drop this mrq */ ++#define MMC_BLK_IOC_SBC BIT(1) /* use mrq.sbc */ ++ + struct mmc_rpmb_data *rpmb; + }; + +@@ -464,7 +468,7 @@ static int mmc_blk_ioctl_copy_to_user(st + } + + static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, +- struct mmc_blk_ioc_data *idata) ++ struct mmc_blk_ioc_data **idatas, int i) + { + struct mmc_command cmd = {}, sbc = {}; + struct mmc_data data = {}; +@@ -472,10 +476,18 @@ static int __mmc_blk_ioctl_cmd(struct mm + struct scatterlist sg; + int err; + unsigned int target_part; ++ struct mmc_blk_ioc_data *idata = idatas[i]; ++ struct mmc_blk_ioc_data *prev_idata = NULL; + + if (!card || !md || !idata) + return -EINVAL; + ++ if (idata->flags & MMC_BLK_IOC_DROP) ++ return 0; ++ ++ if (idata->flags & MMC_BLK_IOC_SBC) ++ prev_idata = idatas[i - 1]; ++ + /* + * The RPMB accesses comes in from the character device, so we + * need to target these explicitly. Else we just target the +@@ -542,7 +554,7 @@ static int __mmc_blk_ioctl_cmd(struct mm + return err; + } + +- if (idata->rpmb) { ++ if (idata->rpmb || prev_idata) { + sbc.opcode = MMC_SET_BLOCK_COUNT; + /* + * We don't do any blockcount validation because the max size +@@ -550,6 +562,8 @@ static int __mmc_blk_ioctl_cmd(struct mm + * 'Reliable Write' bit here. + */ + sbc.arg = data.blocks | (idata->ic.write_flag & BIT(31)); ++ if (prev_idata) ++ sbc.arg = prev_idata->ic.arg; + sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; + mrq.sbc = &sbc; + } +@@ -561,6 +575,15 @@ static int __mmc_blk_ioctl_cmd(struct mm + mmc_wait_for_req(card->host, &mrq); + memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); + ++ if (prev_idata) { ++ memcpy(&prev_idata->ic.response, sbc.resp, sizeof(sbc.resp)); ++ if (sbc.error) { ++ dev_err(mmc_dev(card->host), "%s: sbc error %d\n", ++ __func__, sbc.error); ++ return sbc.error; ++ } ++ } ++ + if (cmd.error) { + dev_err(mmc_dev(card->host), "%s: cmd error %d\n", + __func__, cmd.error); +@@ -1030,6 +1053,20 @@ static inline void mmc_blk_reset_success + md->reset_done &= ~type; + } + ++static void mmc_blk_check_sbc(struct mmc_queue_req *mq_rq) ++{ ++ struct mmc_blk_ioc_data **idata = mq_rq->drv_op_data; ++ int i; ++ ++ for (i = 1; i < mq_rq->ioc_count; i++) { ++ if (idata[i - 1]->ic.opcode == MMC_SET_BLOCK_COUNT && ++ mmc_op_multi(idata[i]->ic.opcode)) { ++ idata[i - 1]->flags |= MMC_BLK_IOC_DROP; ++ idata[i]->flags |= MMC_BLK_IOC_SBC; ++ } ++ } ++} ++ + /* + * The non-block commands come back from the block layer after it queued it and + * processed it with all other requests and then they get issued in this +@@ -1057,11 +1094,14 @@ static void mmc_blk_issue_drv_op(struct + if (ret) + break; + } ++ ++ mmc_blk_check_sbc(mq_rq); ++ + fallthrough; + case MMC_DRV_OP_IOCTL_RPMB: + idata = mq_rq->drv_op_data; + for (i = 0, ret = 0; i < mq_rq->ioc_count; i++) { +- ret = __mmc_blk_ioctl_cmd(card, md, idata[i]); ++ ret = __mmc_blk_ioctl_cmd(card, md, idata, i); + if (ret) + break; + } diff --git a/queue-5.15/mmc-mmc_spi-remove-custom-dma-mapped-buffers.patch b/queue-5.15/mmc-mmc_spi-remove-custom-dma-mapped-buffers.patch new file mode 100644 index 00000000000..c78bda239da --- /dev/null +++ b/queue-5.15/mmc-mmc_spi-remove-custom-dma-mapped-buffers.patch @@ -0,0 +1,448 @@ +From 84a6be7db9050dd2601c9870f65eab9a665d2d5d Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Fri, 8 Dec 2023 00:19:01 +0200 +Subject: mmc: mmc_spi: remove custom DMA mapped buffers + +From: Andy Shevchenko + +commit 84a6be7db9050dd2601c9870f65eab9a665d2d5d upstream. + +There is no need to duplicate what SPI core or individual controller +drivers already do, i.e. mapping the buffers for DMA capable transfers. + +Note, that the code, besides its redundancy, was buggy: strictly speaking +there is no guarantee, while it's true for those which can use this code +(see below), that the SPI host controller _is_ the device which does DMA. + +Also see the Link tags below. + +Additional notes. Currently only two SPI host controller drivers may use +premapped (by the user) DMA buffers: + + - drivers/spi/spi-au1550.c + + - drivers/spi/spi-fsl-spi.c + +Both of them have DMA mapping support code. I don't expect that SPI host +controller code is worse than what has been done in mmc_spi. Hence I do +not expect any regressions here. Otherwise, I'm pretty much sure these +regressions have to be fixed in the respective drivers, and not here. + +That said, remove all related pieces of DMA mapping code from mmc_spi. + +Link: https://lore.kernel.org/linux-mmc/c73b9ba9-1699-2aff-e2fd-b4b4f292a3ca@raspberrypi.org/ +Link: https://stackoverflow.com/questions/67620728/mmc-spi-issue-not-able-to-setup-mmc-sd-card-in-linux +Signed-off-by: Andy Shevchenko +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20231207221901.3259962-1-andriy.shevchenko@linux.intel.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/mmc_spi.c | 186 +-------------------------------------------- + 1 file changed, 5 insertions(+), 181 deletions(-) + +--- a/drivers/mmc/host/mmc_spi.c ++++ b/drivers/mmc/host/mmc_spi.c +@@ -15,7 +15,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -119,19 +119,14 @@ struct mmc_spi_host { + struct spi_transfer status; + struct spi_message readback; + +- /* underlying DMA-aware controller, or null */ +- struct device *dma_dev; +- + /* buffer used for commands and for message "overhead" */ + struct scratch *data; +- dma_addr_t data_dma; + + /* Specs say to write ones most of the time, even when the card + * has no need to read its input data; and many cards won't care. + * This is our source of those ones. + */ + void *ones; +- dma_addr_t ones_dma; + }; + + +@@ -147,11 +142,8 @@ static inline int mmc_cs_off(struct mmc_ + return spi_setup(host->spi); + } + +-static int +-mmc_spi_readbytes(struct mmc_spi_host *host, unsigned len) ++static int mmc_spi_readbytes(struct mmc_spi_host *host, unsigned int len) + { +- int status; +- + if (len > sizeof(*host->data)) { + WARN_ON(1); + return -EIO; +@@ -159,19 +151,7 @@ mmc_spi_readbytes(struct mmc_spi_host *h + + host->status.len = len; + +- if (host->dma_dev) +- dma_sync_single_for_device(host->dma_dev, +- host->data_dma, sizeof(*host->data), +- DMA_FROM_DEVICE); +- +- status = spi_sync_locked(host->spi, &host->readback); +- +- if (host->dma_dev) +- dma_sync_single_for_cpu(host->dma_dev, +- host->data_dma, sizeof(*host->data), +- DMA_FROM_DEVICE); +- +- return status; ++ return spi_sync_locked(host->spi, &host->readback); + } + + static int mmc_spi_skip(struct mmc_spi_host *host, unsigned long timeout, +@@ -506,23 +486,11 @@ mmc_spi_command_send(struct mmc_spi_host + t = &host->t; + memset(t, 0, sizeof(*t)); + t->tx_buf = t->rx_buf = data->status; +- t->tx_dma = t->rx_dma = host->data_dma; + t->len = cp - data->status; + t->cs_change = 1; + spi_message_add_tail(t, &host->m); + +- if (host->dma_dev) { +- host->m.is_dma_mapped = 1; +- dma_sync_single_for_device(host->dma_dev, +- host->data_dma, sizeof(*host->data), +- DMA_BIDIRECTIONAL); +- } + status = spi_sync_locked(host->spi, &host->m); +- +- if (host->dma_dev) +- dma_sync_single_for_cpu(host->dma_dev, +- host->data_dma, sizeof(*host->data), +- DMA_BIDIRECTIONAL); + if (status < 0) { + dev_dbg(&host->spi->dev, " ... write returned %d\n", status); + cmd->error = status; +@@ -540,9 +508,6 @@ mmc_spi_command_send(struct mmc_spi_host + * We always provide TX data for data and CRC. The MMC/SD protocol + * requires us to write ones; but Linux defaults to writing zeroes; + * so we explicitly initialize it to all ones on RX paths. +- * +- * We also handle DMA mapping, so the underlying SPI controller does +- * not need to (re)do it for each message. + */ + static void + mmc_spi_setup_data_message( +@@ -552,11 +517,8 @@ mmc_spi_setup_data_message( + { + struct spi_transfer *t; + struct scratch *scratch = host->data; +- dma_addr_t dma = host->data_dma; + + spi_message_init(&host->m); +- if (dma) +- host->m.is_dma_mapped = 1; + + /* for reads, readblock() skips 0xff bytes before finding + * the token; for writes, this transfer issues that token. +@@ -570,8 +532,6 @@ mmc_spi_setup_data_message( + else + scratch->data_token = SPI_TOKEN_SINGLE; + t->tx_buf = &scratch->data_token; +- if (dma) +- t->tx_dma = dma + offsetof(struct scratch, data_token); + spi_message_add_tail(t, &host->m); + } + +@@ -581,7 +541,6 @@ mmc_spi_setup_data_message( + t = &host->t; + memset(t, 0, sizeof(*t)); + t->tx_buf = host->ones; +- t->tx_dma = host->ones_dma; + /* length and actual buffer info are written later */ + spi_message_add_tail(t, &host->m); + +@@ -591,14 +550,9 @@ mmc_spi_setup_data_message( + if (direction == DMA_TO_DEVICE) { + /* the actual CRC may get written later */ + t->tx_buf = &scratch->crc_val; +- if (dma) +- t->tx_dma = dma + offsetof(struct scratch, crc_val); + } else { + t->tx_buf = host->ones; +- t->tx_dma = host->ones_dma; + t->rx_buf = &scratch->crc_val; +- if (dma) +- t->rx_dma = dma + offsetof(struct scratch, crc_val); + } + spi_message_add_tail(t, &host->m); + +@@ -621,10 +575,7 @@ mmc_spi_setup_data_message( + memset(t, 0, sizeof(*t)); + t->len = (direction == DMA_TO_DEVICE) ? sizeof(scratch->status) : 1; + t->tx_buf = host->ones; +- t->tx_dma = host->ones_dma; + t->rx_buf = scratch->status; +- if (dma) +- t->rx_dma = dma + offsetof(struct scratch, status); + t->cs_change = 1; + spi_message_add_tail(t, &host->m); + } +@@ -653,23 +604,13 @@ mmc_spi_writeblock(struct mmc_spi_host * + + if (host->mmc->use_spi_crc) + scratch->crc_val = cpu_to_be16(crc_itu_t(0, t->tx_buf, t->len)); +- if (host->dma_dev) +- dma_sync_single_for_device(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); + + status = spi_sync_locked(spi, &host->m); +- + if (status != 0) { + dev_dbg(&spi->dev, "write error (%d)\n", status); + return status; + } + +- if (host->dma_dev) +- dma_sync_single_for_cpu(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); +- + /* + * Get the transmission data-response reply. It must follow + * immediately after the data block we transferred. This reply +@@ -718,8 +659,6 @@ mmc_spi_writeblock(struct mmc_spi_host * + } + + t->tx_buf += t->len; +- if (host->dma_dev) +- t->tx_dma += t->len; + + /* Return when not busy. If we didn't collect that status yet, + * we'll need some more I/O. +@@ -783,30 +722,12 @@ mmc_spi_readblock(struct mmc_spi_host *h + } + leftover = status << 1; + +- if (host->dma_dev) { +- dma_sync_single_for_device(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); +- dma_sync_single_for_device(host->dma_dev, +- t->rx_dma, t->len, +- DMA_FROM_DEVICE); +- } +- + status = spi_sync_locked(spi, &host->m); + if (status < 0) { + dev_dbg(&spi->dev, "read error %d\n", status); + return status; + } + +- if (host->dma_dev) { +- dma_sync_single_for_cpu(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); +- dma_sync_single_for_cpu(host->dma_dev, +- t->rx_dma, t->len, +- DMA_FROM_DEVICE); +- } +- + if (bitshift) { + /* Walk through the data and the crc and do + * all the magic to get byte-aligned data. +@@ -841,8 +762,6 @@ mmc_spi_readblock(struct mmc_spi_host *h + } + + t->rx_buf += t->len; +- if (host->dma_dev) +- t->rx_dma += t->len; + + return 0; + } +@@ -857,7 +776,6 @@ mmc_spi_data_do(struct mmc_spi_host *hos + struct mmc_data *data, u32 blk_size) + { + struct spi_device *spi = host->spi; +- struct device *dma_dev = host->dma_dev; + struct spi_transfer *t; + enum dma_data_direction direction; + struct scatterlist *sg; +@@ -884,31 +802,8 @@ mmc_spi_data_do(struct mmc_spi_host *hos + */ + for_each_sg(data->sg, sg, data->sg_len, n_sg) { + int status = 0; +- dma_addr_t dma_addr = 0; + void *kmap_addr; + unsigned length = sg->length; +- enum dma_data_direction dir = direction; +- +- /* set up dma mapping for controller drivers that might +- * use DMA ... though they may fall back to PIO +- */ +- if (dma_dev) { +- /* never invalidate whole *shared* pages ... */ +- if ((sg->offset != 0 || length != PAGE_SIZE) +- && dir == DMA_FROM_DEVICE) +- dir = DMA_BIDIRECTIONAL; +- +- dma_addr = dma_map_page(dma_dev, sg_page(sg), 0, +- PAGE_SIZE, dir); +- if (dma_mapping_error(dma_dev, dma_addr)) { +- data->error = -EFAULT; +- break; +- } +- if (direction == DMA_TO_DEVICE) +- t->tx_dma = dma_addr + sg->offset; +- else +- t->rx_dma = dma_addr + sg->offset; +- } + + /* allow pio too; we don't allow highmem */ + kmap_addr = kmap(sg_page(sg)); +@@ -943,8 +838,6 @@ mmc_spi_data_do(struct mmc_spi_host *hos + if (direction == DMA_FROM_DEVICE) + flush_dcache_page(sg_page(sg)); + kunmap(sg_page(sg)); +- if (dma_dev) +- dma_unmap_page(dma_dev, dma_addr, PAGE_SIZE, dir); + + if (status < 0) { + data->error = status; +@@ -981,21 +874,9 @@ mmc_spi_data_do(struct mmc_spi_host *hos + scratch->status[0] = SPI_TOKEN_STOP_TRAN; + + host->early_status.tx_buf = host->early_status.rx_buf; +- host->early_status.tx_dma = host->early_status.rx_dma; + host->early_status.len = statlen; + +- if (host->dma_dev) +- dma_sync_single_for_device(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); +- + tmp = spi_sync_locked(spi, &host->m); +- +- if (host->dma_dev) +- dma_sync_single_for_cpu(host->dma_dev, +- host->data_dma, sizeof(*scratch), +- DMA_BIDIRECTIONAL); +- + if (tmp < 0) { + if (!data->error) + data->error = tmp; +@@ -1269,52 +1150,6 @@ mmc_spi_detect_irq(int irq, void *mmc) + return IRQ_HANDLED; + } + +-#ifdef CONFIG_HAS_DMA +-static int mmc_spi_dma_alloc(struct mmc_spi_host *host) +-{ +- struct spi_device *spi = host->spi; +- struct device *dev; +- +- if (!spi->master->dev.parent->dma_mask) +- return 0; +- +- dev = spi->master->dev.parent; +- +- host->ones_dma = dma_map_single(dev, host->ones, MMC_SPI_BLOCKSIZE, +- DMA_TO_DEVICE); +- if (dma_mapping_error(dev, host->ones_dma)) +- return -ENOMEM; +- +- host->data_dma = dma_map_single(dev, host->data, sizeof(*host->data), +- DMA_BIDIRECTIONAL); +- if (dma_mapping_error(dev, host->data_dma)) { +- dma_unmap_single(dev, host->ones_dma, MMC_SPI_BLOCKSIZE, +- DMA_TO_DEVICE); +- return -ENOMEM; +- } +- +- dma_sync_single_for_cpu(dev, host->data_dma, sizeof(*host->data), +- DMA_BIDIRECTIONAL); +- +- host->dma_dev = dev; +- return 0; +-} +- +-static void mmc_spi_dma_free(struct mmc_spi_host *host) +-{ +- if (!host->dma_dev) +- return; +- +- dma_unmap_single(host->dma_dev, host->ones_dma, MMC_SPI_BLOCKSIZE, +- DMA_TO_DEVICE); +- dma_unmap_single(host->dma_dev, host->data_dma, sizeof(*host->data), +- DMA_BIDIRECTIONAL); +-} +-#else +-static inline int mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; } +-static inline void mmc_spi_dma_free(struct mmc_spi_host *host) {} +-#endif +- + static int mmc_spi_probe(struct spi_device *spi) + { + void *ones; +@@ -1406,24 +1241,17 @@ static int mmc_spi_probe(struct spi_devi + host->powerup_msecs = 250; + } + +- /* preallocate dma buffers */ ++ /* Preallocate buffers */ + host->data = kmalloc(sizeof(*host->data), GFP_KERNEL); + if (!host->data) + goto fail_nobuf1; + +- status = mmc_spi_dma_alloc(host); +- if (status) +- goto fail_dma; +- + /* setup message for status/busy readback */ + spi_message_init(&host->readback); +- host->readback.is_dma_mapped = (host->dma_dev != NULL); + + spi_message_add_tail(&host->status, &host->readback); + host->status.tx_buf = host->ones; +- host->status.tx_dma = host->ones_dma; + host->status.rx_buf = &host->data->status; +- host->status.rx_dma = host->data_dma + offsetof(struct scratch, status); + host->status.cs_change = 1; + + /* register card detect irq */ +@@ -1468,9 +1296,8 @@ static int mmc_spi_probe(struct spi_devi + if (!status) + has_ro = true; + +- dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", ++ dev_info(&spi->dev, "SD/MMC host %s%s%s%s\n", + dev_name(&mmc->class_dev), +- host->dma_dev ? "" : ", no DMA", + has_ro ? "" : ", no WP", + (host->pdata && host->pdata->setpower) + ? "" : ", no poweroff", +@@ -1481,8 +1308,6 @@ static int mmc_spi_probe(struct spi_devi + fail_gpiod_request: + mmc_remove_host(mmc); + fail_glue_init: +- mmc_spi_dma_free(host); +-fail_dma: + kfree(host->data); + fail_nobuf1: + mmc_spi_put_pdata(spi); +@@ -1504,7 +1329,6 @@ static int mmc_spi_remove(struct spi_dev + + mmc_remove_host(mmc); + +- mmc_spi_dma_free(host); + kfree(host->data); + kfree(host->ones); + diff --git a/queue-5.15/nouveau-vmm-don-t-set-addr-on-the-fail-path-to-avoid-warning.patch b/queue-5.15/nouveau-vmm-don-t-set-addr-on-the-fail-path-to-avoid-warning.patch new file mode 100644 index 00000000000..71211f72c03 --- /dev/null +++ b/queue-5.15/nouveau-vmm-don-t-set-addr-on-the-fail-path-to-avoid-warning.patch @@ -0,0 +1,80 @@ +From cacea81390fd8c8c85404e5eb2adeb83d87a912e Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Thu, 18 Jan 2024 06:19:57 +1000 +Subject: nouveau/vmm: don't set addr on the fail path to avoid warning + +From: Dave Airlie + +commit cacea81390fd8c8c85404e5eb2adeb83d87a912e upstream. + +nvif_vmm_put gets called if addr is set, but if the allocation +fails we don't need to call put, otherwise we get a warning like + +[523232.435671] ------------[ cut here ]------------ +[523232.435674] WARNING: CPU: 8 PID: 1505697 at drivers/gpu/drm/nouveau/nvif/vmm.c:68 nvif_vmm_put+0x72/0x80 [nouveau] +[523232.435795] Modules linked in: uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables nfnetlink qrtr bnep sunrpc binfmt_misc intel_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency_common isst_if_common iwlmvm nfit libnvdimm vfat fat x86_pkg_temp_thermal intel_powerclamp mac80211 snd_soc_avs snd_soc_hda_codec coretemp snd_hda_ext_core snd_soc_core snd_hda_codec_realtek kvm_intel snd_hda_codec_hdmi snd_compress snd_hda_codec_generic ac97_bus snd_pcm_dmaengine snd_hda_intel libarc4 snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec kvm iwlwifi snd_hda_core btusb snd_hwdep btrtl snd_seq btintel irqbypass btbcm rapl snd_seq_device eeepc_wmi btmtk intel_cstate iTCO_wdt cfg80211 snd_pcm asus_wmi bluetooth intel_pmc_bxt iTCO_vendor_support snd_timer ledtrig_audio pktcdvd snd mei_me +[523232.435828] sparse_keymap intel_uncore i2c_i801 platform_profile wmi_bmof mei pcspkr ioatdma soundcore i2c_smbus rfkill idma64 dca joydev acpi_tad loop zram nouveau drm_ttm_helper ttm video drm_exec drm_gpuvm gpu_sched crct10dif_pclmul i2c_algo_bit nvme crc32_pclmul crc32c_intel drm_display_helper polyval_clmulni nvme_core polyval_generic e1000e mxm_wmi cec ghash_clmulni_intel r8169 sha512_ssse3 nvme_common wmi pinctrl_sunrisepoint uas usb_storage ip6_tables ip_tables fuse +[523232.435849] CPU: 8 PID: 1505697 Comm: gnome-shell Tainted: G W 6.6.0-rc7-nvk-uapi+ #12 +[523232.435851] Hardware name: System manufacturer System Product Name/ROG STRIX X299-E GAMING II, BIOS 1301 09/24/2021 +[523232.435852] RIP: 0010:nvif_vmm_put+0x72/0x80 [nouveau] +[523232.435934] Code: 00 00 48 89 e2 be 02 00 00 00 48 c7 04 24 00 00 00 00 48 89 44 24 08 e8 fc bf ff ff 85 +c0 75 0a 48 c7 43 08 00 00 00 00 eb b3 <0f> 0b eb f2 e8 f5 c9 b2 e6 0f 1f 44 00 00 90 90 90 90 90 90 90 90 +[523232.435936] RSP: 0018:ffffc900077ffbd8 EFLAGS: 00010282 +[523232.435937] RAX: 00000000fffffffe RBX: ffffc900077ffc00 RCX: 0000000000000010 +[523232.435938] RDX: 0000000000000010 RSI: ffffc900077ffb38 RDI: ffffc900077ffbd8 +[523232.435940] RBP: ffff888e1c4f2140 R08: 0000000000000000 R09: 0000000000000000 +[523232.435940] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888503811800 +[523232.435941] R13: ffffc900077ffca0 R14: ffff888e1c4f2140 R15: ffff88810317e1e0 +[523232.435942] FS: 00007f933a769640(0000) GS:ffff88905fa00000(0000) knlGS:0000000000000000 +[523232.435943] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[523232.435944] CR2: 00007f930bef7000 CR3: 00000005d0322001 CR4: 00000000003706e0 +[523232.435945] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[523232.435946] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +[523232.435964] Call Trace: +[523232.435965] +[523232.435966] ? nvif_vmm_put+0x72/0x80 [nouveau] +[523232.436051] ? __warn+0x81/0x130 +[523232.436055] ? nvif_vmm_put+0x72/0x80 [nouveau] +[523232.436138] ? report_bug+0x171/0x1a0 +[523232.436142] ? handle_bug+0x3c/0x80 +[523232.436144] ? exc_invalid_op+0x17/0x70 +[523232.436145] ? asm_exc_invalid_op+0x1a/0x20 +[523232.436149] ? nvif_vmm_put+0x72/0x80 [nouveau] +[523232.436230] ? nvif_vmm_put+0x64/0x80 [nouveau] +[523232.436342] nouveau_vma_del+0x80/0xd0 [nouveau] +[523232.436506] nouveau_vma_new+0x1a0/0x210 [nouveau] +[523232.436671] nouveau_gem_object_open+0x1d0/0x1f0 [nouveau] +[523232.436835] drm_gem_handle_create_tail+0xd1/0x180 +[523232.436840] drm_prime_fd_to_handle_ioctl+0x12e/0x200 +[523232.436844] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 +[523232.436847] drm_ioctl_kernel+0xd3/0x180 +[523232.436849] drm_ioctl+0x26d/0x4b0 +[523232.436851] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 +[523232.436855] nouveau_drm_ioctl+0x5a/0xb0 [nouveau] +[523232.437032] __x64_sys_ioctl+0x94/0xd0 +[523232.437036] do_syscall_64+0x5d/0x90 +[523232.437040] ? syscall_exit_to_user_mode+0x2b/0x40 +[523232.437044] ? do_syscall_64+0x6c/0x90 +[523232.437046] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 + +Reported-by: Faith Ekstrand +Cc: stable@vger.kernel.org +Signed-off-by: Dave Airlie +Link: https://patchwork.freedesktop.org/patch/msgid/20240117213852.295565-1-airlied@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nouveau_vmm.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nouveau_vmm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_vmm.c +@@ -108,6 +108,9 @@ nouveau_vma_new(struct nouveau_bo *nvbo, + } else { + ret = nvif_vmm_get(&vmm->vmm, PTES, false, mem->mem.page, 0, + mem->mem.size, &tmp); ++ if (ret) ++ goto done; ++ + vma->addr = tmp.addr; + } + diff --git a/queue-5.15/rtc-adjust-failure-return-code-for-cmos_set_alarm.patch b/queue-5.15/rtc-adjust-failure-return-code-for-cmos_set_alarm.patch new file mode 100644 index 00000000000..57f04042145 --- /dev/null +++ b/queue-5.15/rtc-adjust-failure-return-code-for-cmos_set_alarm.patch @@ -0,0 +1,50 @@ +From 1311a8f0d4b23f58bbababa13623aa40b8ad4e0c Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Mon, 27 Nov 2023 23:36:51 -0600 +Subject: rtc: Adjust failure return code for cmos_set_alarm() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mario Limonciello + +commit 1311a8f0d4b23f58bbababa13623aa40b8ad4e0c upstream. + +When mc146818_avoid_UIP() fails to return a valid value, this is because +UIP didn't clear in the timeout period. Adjust the return code in this +case to -ETIMEDOUT. + +Tested-by: Mateusz Jończyk +Reviewed-by: Mateusz Jończyk +Acked-by: Mateusz Jończyk +Cc: +Fixes: cdedc45c579f ("rtc: cmos: avoid UIP when reading alarm time") +Fixes: cd17420ebea5 ("rtc: cmos: avoid UIP when writing alarm time") +Signed-off-by: Mario Limonciello +Link: https://lore.kernel.org/r/20231128053653.101798-3-mario.limonciello@amd.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Greg Kroah-Hartman +--- + drivers/rtc/rtc-cmos.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/rtc/rtc-cmos.c ++++ b/drivers/rtc/rtc-cmos.c +@@ -292,7 +292,7 @@ static int cmos_read_alarm(struct device + + /* This not only a rtc_op, but also called directly */ + if (!is_valid_irq(cmos->irq)) +- return -EIO; ++ return -ETIMEDOUT; + + /* Basic alarms only support hour, minute, and seconds fields. + * Some also support day and month, for alarms up to a year in +@@ -557,7 +557,7 @@ static int cmos_set_alarm(struct device + * Use mc146818_avoid_UIP() to avoid this. + */ + if (!mc146818_avoid_UIP(cmos_set_alarm_callback, &p)) +- return -EIO; ++ return -ETIMEDOUT; + + cmos->alarm_expires = rtc_tm_to_time64(&t->time); + diff --git a/queue-5.15/scripts-get_abi-fix-source-path-leak.patch b/queue-5.15/scripts-get_abi-fix-source-path-leak.patch new file mode 100644 index 00000000000..810db1669b5 --- /dev/null +++ b/queue-5.15/scripts-get_abi-fix-source-path-leak.patch @@ -0,0 +1,40 @@ +From 5889d6ede53bc17252f79c142387e007224aa554 Mon Sep 17 00:00:00 2001 +From: Vegard Nossum +Date: Mon, 1 Jan 2024 00:59:58 +0100 +Subject: scripts/get_abi: fix source path leak + +From: Vegard Nossum + +commit 5889d6ede53bc17252f79c142387e007224aa554 upstream. + +The code currently leaks the absolute path of the ABI files into the +rendered documentation. + +There exists code to prevent this, but it is not effective when an +absolute path is passed, which it is when $srctree is used. + +I consider this to be a minimal, stop-gap fix; a better fix would strip +off the actual prefix instead of hacking it off with a regex. + +Link: https://mastodon.social/@vegard/111677490643495163 +Cc: Jani Nikula +Cc: stable@vger.kernel.org +Signed-off-by: Vegard Nossum +Signed-off-by: Jonathan Corbet +Link: https://lore.kernel.org/r/20231231235959.3342928-1-vegard.nossum@oracle.com +Signed-off-by: Greg Kroah-Hartman +--- + scripts/get_abi.pl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/get_abi.pl ++++ b/scripts/get_abi.pl +@@ -75,7 +75,7 @@ sub parse_abi { + $name =~ s,.*/,,; + + my $fn = $file; +- $fn =~ s,Documentation/ABI/,,; ++ $fn =~ s,.*Documentation/ABI/,,; + + my $nametag = "File $fn"; + $data{$nametag}->{what} = "File $name"; diff --git a/queue-5.15/series b/queue-5.15/series index 19297a2b1b4..a6b3ada6b43 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -28,3 +28,14 @@ async-introduce-async_schedule_dev_nocall.patch arm64-dts-qcom-sc7180-fix-usb-wakeup-interrupt-types.patch arm64-dts-qcom-sdm845-fix-usb-wakeup-interrupt-types.patch arm64-dts-qcom-sm8150-fix-usb-wakeup-interrupt-types.patch +arm64-dts-qcom-sdm845-fix-usb-dp-dm-hs-phy-interrupts.patch +arm64-dts-qcom-sdm845-fix-usb-ss-wakeup.patch +arm64-dts-qcom-sm8150-fix-usb-dp-dm-hs-phy-interrupts.patch +arm64-dts-qcom-sm8150-fix-usb-ss-wakeup.patch +lsm-new-security_file_ioctl_compat-hook.patch +scripts-get_abi-fix-source-path-leak.patch +mmc-core-use-mrq.sbc-in-close-ended-ffu.patch +mmc-mmc_spi-remove-custom-dma-mapped-buffers.patch +rtc-adjust-failure-return-code-for-cmos_set_alarm.patch +nouveau-vmm-don-t-set-addr-on-the-fail-path-to-avoid-warning.patch +ubifs-ubifs_symlink-fix-memleak-of-inode-i_link-in-error-path.patch diff --git a/queue-5.15/ubifs-ubifs_symlink-fix-memleak-of-inode-i_link-in-error-path.patch b/queue-5.15/ubifs-ubifs_symlink-fix-memleak-of-inode-i_link-in-error-path.patch new file mode 100644 index 00000000000..4aaf353031a --- /dev/null +++ b/queue-5.15/ubifs-ubifs_symlink-fix-memleak-of-inode-i_link-in-error-path.patch @@ -0,0 +1,56 @@ +From 1e022216dcd248326a5bb95609d12a6815bca4e2 Mon Sep 17 00:00:00 2001 +From: Zhihao Cheng +Date: Fri, 22 Dec 2023 16:54:46 +0800 +Subject: ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path + +From: Zhihao Cheng + +commit 1e022216dcd248326a5bb95609d12a6815bca4e2 upstream. + +For error handling path in ubifs_symlink(), inode will be marked as +bad first, then iput() is invoked. If inode->i_link is initialized by +fscrypt_encrypt_symlink() in encryption scenario, inode->i_link won't +be freed by callchain ubifs_free_inode -> fscrypt_free_inode in error +handling path, because make_bad_inode() has changed 'inode->i_mode' as +'S_IFREG'. +Following kmemleak is easy to be reproduced by injecting error in +ubifs_jnl_update() when doing symlink in encryption scenario: + unreferenced object 0xffff888103da3d98 (size 8): + comm "ln", pid 1692, jiffies 4294914701 (age 12.045s) + backtrace: + kmemdup+0x32/0x70 + __fscrypt_encrypt_symlink+0xed/0x1c0 + ubifs_symlink+0x210/0x300 [ubifs] + vfs_symlink+0x216/0x360 + do_symlinkat+0x11a/0x190 + do_syscall_64+0x3b/0xe0 +There are two ways fixing it: + 1. Remove make_bad_inode() in error handling path. We can do that + because ubifs_evict_inode() will do same processes for good + symlink inode and bad symlink inode, for inode->i_nlink checking + is before is_bad_inode(). + 2. Free inode->i_link before marking inode bad. +Method 2 is picked, it has less influence, personally, I think. + +Cc: stable@vger.kernel.org +Fixes: 2c58d548f570 ("fscrypt: cache decrypted symlink target in ->i_link") +Signed-off-by: Zhihao Cheng +Suggested-by: Eric Biggers +Reviewed-by: Eric Biggers +Signed-off-by: Richard Weinberger +Signed-off-by: Greg Kroah-Hartman +--- + fs/ubifs/dir.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/ubifs/dir.c ++++ b/fs/ubifs/dir.c +@@ -1225,6 +1225,8 @@ out_cancel: + dir_ui->ui_size = dir->i_size; + mutex_unlock(&dir_ui->ui_mutex); + out_inode: ++ /* Free inode->i_link before inode is marked as bad. */ ++ fscrypt_free_inode(inode); + make_bad_inode(inode); + iput(inode); + out_fname: