From: Greg Kroah-Hartman Date: Sat, 2 Apr 2022 13:10:43 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.17.2~176 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3bf134fb587c7ce5839978d582f88d48f287590;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: acpi-properties-consistently-return-enoent-if-there-are-no-more-references.patch arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch arm64-dts-ti-k3-am65-fix-gic-v3-compatible-regs.patch arm64-dts-ti-k3-j7200-fix-gic-v3-compatible-regs.patch arm64-dts-ti-k3-j721e-fix-gic-v3-compatible-regs.patch arm64-signal-nofpsimd-do-not-allocate-fp-simd-context-when-not-available.patch bcache-fixup-multiple-threads-crash.patch block-don-t-merge-across-cgroup-boundaries-if-blkcg-is-enabled.patch block-limit-request-dispatch-loop-duration.patch brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch can-isotp-sanitize-can-id-checks-in-isotp_bind.patch carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch crypto-rsa-pkcs1pad-only-allow-with-rsa.patch crypto-rsa-pkcs1pad-restore-signature-length-check.patch dec-limit-pmax-memory-probing-to-r3k-systems.patch dm-integrity-set-journal-entry-unused-when-shrinking-device.patch drbd-fix-potential-silent-data-corruption.patch drivers-hamradio-6pack-fix-uaf-bug-caused-by-mod_timer.patch drm-edid-check-basic-audio-support-on-cea-extension-block.patch drm-i915-gem-add-missing-boundary-check-in-vm_access.patch drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch exec-force-single-empty-string-when-argv-is-empty.patch ext4-fix-ext4_fc_stats-trace-point.patch ext4-fix-fs-corruption-when-tring-to-remove-a-non-empty-directory-with-io-error.patch lib-raid6-test-fix-multiple-definition-linking-error.patch mailbox-tegra-hsp-flush-whole-channel.patch media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch mgag200-fix-memmapsl-configuration-in-gctl6-register.patch mm-hwpoison-unmap-poisoned-page-before-invalidation.patch mm-kmemleak-reset-tag-when-compare-object-pointer.patch mm-madvise-return-correct-bytes-advised-with-process_madvise.patch mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch powerpc-kvm-fix-kvm_use_magic_page.patch pstore-don-t-use-semaphores-in-always-atomic-context-code.patch revert-mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch thermal-int340x-increase-bitmap-size.patch udp-call-udp_encap_enable-for-v6-sockets-when-enabling-encap.patch video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch xtensa-fix-xtensa_wsr-always-writing-0.patch --- diff --git a/queue-5.10/acpi-properties-consistently-return-enoent-if-there-are-no-more-references.patch b/queue-5.10/acpi-properties-consistently-return-enoent-if-there-are-no-more-references.patch new file mode 100644 index 00000000000..ad404ee7ff7 --- /dev/null +++ b/queue-5.10/acpi-properties-consistently-return-enoent-if-there-are-no-more-references.patch @@ -0,0 +1,36 @@ +From babc92da5928f81af951663fc436997352e02d3a Mon Sep 17 00:00:00 2001 +From: Sakari Ailus +Date: Fri, 14 Jan 2022 13:24:49 +0200 +Subject: ACPI: properties: Consistently return -ENOENT if there are no more references + +From: Sakari Ailus + +commit babc92da5928f81af951663fc436997352e02d3a upstream. + +__acpi_node_get_property_reference() is documented to return -ENOENT if +the caller requests a property reference at an index that does not exist, +not -EINVAL which it actually does. + +Fix this by returning -ENOENT consistenly, independently of whether the +property value is a plain reference or a package. + +Fixes: c343bc2ce2c6 ("ACPI: properties: Align return codes of __acpi_node_get_property_reference()") +Cc: 4.14+ # 4.14+ +Signed-off-by: Sakari Ailus +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/property.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/acpi/property.c ++++ b/drivers/acpi/property.c +@@ -685,7 +685,7 @@ int __acpi_node_get_property_reference(c + */ + if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { + if (index) +- return -EINVAL; ++ return -ENOENT; + + ret = acpi_bus_get_device(obj->reference.handle, &device); + if (ret) diff --git a/queue-5.10/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch b/queue-5.10/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch new file mode 100644 index 00000000000..c664c26c138 --- /dev/null +++ b/queue-5.10/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch @@ -0,0 +1,36 @@ +From 0fb578a529ac7aca326a9fa475b4a6f58a756fda Mon Sep 17 00:00:00 2001 +From: Tudor Ambarus +Date: Tue, 11 Jan 2022 15:23:01 +0200 +Subject: ARM: dts: at91: sama5d2: Fix PMERRLOC resource size + +From: Tudor Ambarus + +commit 0fb578a529ac7aca326a9fa475b4a6f58a756fda upstream. + +PMERRLOC resource size was set to 0x100, which resulted in HSMC_ERRLOCx +register being truncated to offset x = 21, causing error correction to +fail if more than 22 bit errors and if 24 or 32 bit error correction +was supported. + +Fixes: d9c41bf30cf8 ("ARM: dts: at91: Declare EBI/NAND controllers") +Signed-off-by: Tudor Ambarus +Cc: # 4.13.x +Acked-by: Alexander Dahl +Signed-off-by: Nicolas Ferre +Link: https://lore.kernel.org/r/20220111132301.906712-1-tudor.ambarus@microchip.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/sama5d2.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/sama5d2.dtsi ++++ b/arch/arm/boot/dts/sama5d2.dtsi +@@ -413,7 +413,7 @@ + pmecc: ecc-engine@f8014070 { + compatible = "atmel,sama5d2-pmecc"; + reg = <0xf8014070 0x490>, +- <0xf8014500 0x100>; ++ <0xf8014500 0x200>; + }; + }; + diff --git a/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch b/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch new file mode 100644 index 00000000000..5fd8b30a9bd --- /dev/null +++ b/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch @@ -0,0 +1,34 @@ +From 60a9914cb2061ba612a3f14f6ad329912b486360 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Tue, 8 Feb 2022 18:18:14 +0100 +Subject: ARM: dts: exynos: add missing HDMI supplies on SMDK5250 + +From: Krzysztof Kozlowski + +commit 60a9914cb2061ba612a3f14f6ad329912b486360 upstream. + +Add required VDD supplies to HDMI block on SMDK5250. Without them, the +HDMI driver won't probe. Because of lack of schematics, use same +supplies as on Arndale 5250 board (voltage matches). + +Cc: # v3.15+ +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Alim Akhtar +Link: https://lore.kernel.org/r/20220208171823.226211-2-krzysztof.kozlowski@canonical.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/exynos5250-smdk5250.dts | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts ++++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts +@@ -118,6 +118,9 @@ + status = "okay"; + ddc = <&i2c_2>; + hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; ++ vdd-supply = <&ldo8_reg>; ++ vdd_osc-supply = <&ldo10_reg>; ++ vdd_pll-supply = <&ldo8_reg>; + }; + + &i2c_0 { diff --git a/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch b/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch new file mode 100644 index 00000000000..e19f0851a74 --- /dev/null +++ b/queue-5.10/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch @@ -0,0 +1,34 @@ +From 453a24ded415f7fce0499c6b0a2c7b28f84911f2 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Tue, 8 Feb 2022 18:18:15 +0100 +Subject: ARM: dts: exynos: add missing HDMI supplies on SMDK5420 + +From: Krzysztof Kozlowski + +commit 453a24ded415f7fce0499c6b0a2c7b28f84911f2 upstream. + +Add required VDD supplies to HDMI block on SMDK5420. Without them, the +HDMI driver won't probe. Because of lack of schematics, use same +supplies as on Arndale Octa and Odroid XU3 boards (voltage matches). + +Cc: # v3.15+ +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Alim Akhtar +Link: https://lore.kernel.org/r/20220208171823.226211-3-krzysztof.kozlowski@canonical.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/exynos5420-smdk5420.dts | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts ++++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts +@@ -124,6 +124,9 @@ + hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_hpd_irq>; ++ vdd-supply = <&ldo6_reg>; ++ vdd_osc-supply = <&ldo7_reg>; ++ vdd_pll-supply = <&ldo6_reg>; + }; + + &hsi2c_4 { diff --git a/queue-5.10/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch b/queue-5.10/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch new file mode 100644 index 00000000000..e224f38a7c0 --- /dev/null +++ b/queue-5.10/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch @@ -0,0 +1,34 @@ +From 372d7027fed43c8570018e124cf78b89523a1f8e Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 30 Dec 2021 20:53:23 +0100 +Subject: ARM: dts: exynos: fix UART3 pins configuration in Exynos5250 + +From: Krzysztof Kozlowski + +commit 372d7027fed43c8570018e124cf78b89523a1f8e upstream. + +The gpa1-4 pin was put twice in UART3 pin configuration of Exynos5250, +instead of proper pin gpa1-5. + +Fixes: f8bfe2b050f3 ("ARM: dts: add pin state information in client nodes for Exynos5 platforms") +Cc: +Signed-off-by: Krzysztof Kozlowski +Tested-by: Marek Szyprowski +Reviewed-by: Alim Akhtar +Link: https://lore.kernel.org/r/20211230195325.328220-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/exynos5250-pinctrl.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi ++++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi +@@ -260,7 +260,7 @@ + }; + + uart3_data: uart3-data { +- samsung,pins = "gpa1-4", "gpa1-4"; ++ samsung,pins = "gpa1-4", "gpa1-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; diff --git a/queue-5.10/arm64-dts-ti-k3-am65-fix-gic-v3-compatible-regs.patch b/queue-5.10/arm64-dts-ti-k3-am65-fix-gic-v3-compatible-regs.patch new file mode 100644 index 00000000000..a11b09f7e3c --- /dev/null +++ b/queue-5.10/arm64-dts-ti-k3-am65-fix-gic-v3-compatible-regs.patch @@ -0,0 +1,59 @@ +From 8cae268b70f387ff9e697ccd62fb2384079124e7 Mon Sep 17 00:00:00 2001 +From: Nishanth Menon +Date: Tue, 15 Feb 2022 14:10:04 -0600 +Subject: arm64: dts: ti: k3-am65: Fix gic-v3 compatible regs + +From: Nishanth Menon + +commit 8cae268b70f387ff9e697ccd62fb2384079124e7 upstream. + +Though GIC ARE option is disabled for no GIC-v2 compatibility, +Cortex-A53 is free to implement the CPU interface as long as it +communicates with the GIC using the stream protocol. This requires +that the SoC integration mark out the PERIPHBASE[1] as reserved area +within the SoC. See longer discussion in [2] for further information. + +Update the GIC register map to indicate offsets from PERIPHBASE based +on [3]. Without doing this, systems like kvm will not function with +gic-v2 emulation. + +[1] https://developer.arm.com/documentation/ddi0500/e/system-control/aarch64-register-descriptions/configuration-base-address-register--el1 +[2] https://lore.kernel.org/all/87k0e0tirw.wl-maz@kernel.org/ +[3] https://developer.arm.com/documentation/ddi0500/e/generic-interrupt-controller-cpu-interface/gic-programmers-model/memory-map + +Cc: stable@vger.kernel.org # 5.10+ +Fixes: ea47eed33a3f ("arm64: dts: ti: Add Support for AM654 SoC") +Reported-by: Marc Zyngier +Signed-off-by: Nishanth Menon +Acked-by: Marc Zyngier +Link: https://lore.kernel.org/r/20220215201008.15235-2-nm@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 5 ++++- + arch/arm64/boot/dts/ti/k3-am65.dtsi | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi +@@ -35,7 +35,10 @@ + #interrupt-cells = <3>; + interrupt-controller; + reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ +- <0x00 0x01880000 0x00 0x90000>; /* GICR */ ++ <0x00 0x01880000 0x00 0x90000>, /* GICR */ ++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ ++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ ++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ + /* + * vcpumntirq: + * virtual CPU interface maintenance interrupt +--- a/arch/arm64/boot/dts/ti/k3-am65.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am65.dtsi +@@ -84,6 +84,7 @@ + <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>, + <0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>, + <0x00 0x50000000 0x00 0x50000000 0x00 0x8000000>, ++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A53 PERIPHBASE */ + <0x00 0x70000000 0x00 0x70000000 0x00 0x200000>, + <0x05 0x00000000 0x05 0x00000000 0x01 0x0000000>, + <0x07 0x00000000 0x07 0x00000000 0x01 0x0000000>; diff --git a/queue-5.10/arm64-dts-ti-k3-j7200-fix-gic-v3-compatible-regs.patch b/queue-5.10/arm64-dts-ti-k3-j7200-fix-gic-v3-compatible-regs.patch new file mode 100644 index 00000000000..c9f8af36d63 --- /dev/null +++ b/queue-5.10/arm64-dts-ti-k3-j7200-fix-gic-v3-compatible-regs.patch @@ -0,0 +1,59 @@ +From 1a307cc299430dd7139d351a3b8941f493dfa885 Mon Sep 17 00:00:00 2001 +From: Nishanth Menon +Date: Tue, 15 Feb 2022 14:10:06 -0600 +Subject: arm64: dts: ti: k3-j7200: Fix gic-v3 compatible regs + +From: Nishanth Menon + +commit 1a307cc299430dd7139d351a3b8941f493dfa885 upstream. + +Though GIC ARE option is disabled for no GIC-v2 compatibility, +Cortex-A72 is free to implement the CPU interface as long as it +communicates with the GIC using the stream protocol. This requires +that the SoC integration mark out the PERIPHBASE[1] as reserved area +within the SoC. See longer discussion in [2] for further information. + +Update the GIC register map to indicate offsets from PERIPHBASE based +on [3]. Without doing this, systems like kvm will not function with +gic-v2 emulation. + +[1] https://developer.arm.com/documentation/100095/0002/system-control/aarch64-register-descriptions/configuration-base-address-register--el1 +[2] https://lore.kernel.org/all/87k0e0tirw.wl-maz@kernel.org/ +[3] https://developer.arm.com/documentation/100095/0002/way1382452674438 + +Cc: stable@vger.kernel.org +Fixes: d361ed88455f ("arm64: dts: ti: Add support for J7200 SoC") +Reported-by: Marc Zyngier +Signed-off-by: Nishanth Menon +Acked-by: Marc Zyngier +Link: https://lore.kernel.org/r/20220215201008.15235-4-nm@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 5 ++++- + arch/arm64/boot/dts/ti/k3-j7200.dtsi | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +@@ -47,7 +47,10 @@ + #interrupt-cells = <3>; + interrupt-controller; + reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ +- <0x00 0x01900000 0x00 0x100000>; /* GICR */ ++ <0x00 0x01900000 0x00 0x100000>, /* GICR */ ++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ ++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ ++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ + + /* vcpumntirq: virtual CPU interface maintenance interrupt */ + interrupts = ; +--- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi +@@ -127,6 +127,7 @@ + <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* timesync router */ + <0x00 0x01000000 0x00 0x01000000 0x00 0x0d000000>, /* Most peripherals */ + <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>, /* MAIN NAVSS */ ++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A72 PERIPHBASE */ + <0x00 0x70000000 0x00 0x70000000 0x00 0x00800000>, /* MSMC RAM */ + <0x00 0x18000000 0x00 0x18000000 0x00 0x08000000>, /* PCIe1 DAT0 */ + <0x41 0x00000000 0x41 0x00000000 0x01 0x00000000>, /* PCIe1 DAT1 */ diff --git a/queue-5.10/arm64-dts-ti-k3-j721e-fix-gic-v3-compatible-regs.patch b/queue-5.10/arm64-dts-ti-k3-j721e-fix-gic-v3-compatible-regs.patch new file mode 100644 index 00000000000..d15e0119b62 --- /dev/null +++ b/queue-5.10/arm64-dts-ti-k3-j721e-fix-gic-v3-compatible-regs.patch @@ -0,0 +1,59 @@ +From a06ed27f3bc63ab9e10007dc0118d910908eb045 Mon Sep 17 00:00:00 2001 +From: Nishanth Menon +Date: Tue, 15 Feb 2022 14:10:05 -0600 +Subject: arm64: dts: ti: k3-j721e: Fix gic-v3 compatible regs + +From: Nishanth Menon + +commit a06ed27f3bc63ab9e10007dc0118d910908eb045 upstream. + +Though GIC ARE option is disabled for no GIC-v2 compatibility, +Cortex-A72 is free to implement the CPU interface as long as it +communicates with the GIC using the stream protocol. This requires +that the SoC integration mark out the PERIPHBASE[1] as reserved area +within the SoC. See longer discussion in [2] for further information. + +Update the GIC register map to indicate offsets from PERIPHBASE based +on [3]. Without doing this, systems like kvm will not function with +gic-v2 emulation. + +[1] https://developer.arm.com/documentation/100095/0002/system-control/aarch64-register-descriptions/configuration-base-address-register--el1 +[2] https://lore.kernel.org/all/87k0e0tirw.wl-maz@kernel.org/ +[3] https://developer.arm.com/documentation/100095/0002/way1382452674438 + +Cc: stable@vger.kernel.org # 5.10+ +Fixes: 2d87061e70de ("arm64: dts: ti: Add Support for J721E SoC") +Reported-by: Marc Zyngier +Signed-off-by: Nishanth Menon +Acked-by: Marc Zyngier +Link: https://lore.kernel.org/r/20220215201008.15235-3-nm@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 5 ++++- + arch/arm64/boot/dts/ti/k3-j721e.dtsi | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +@@ -108,7 +108,10 @@ + #interrupt-cells = <3>; + interrupt-controller; + reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ +- <0x00 0x01900000 0x00 0x100000>; /* GICR */ ++ <0x00 0x01900000 0x00 0x100000>, /* GICR */ ++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ ++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ ++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ + + /* vcpumntirq: virtual CPU interface maintenance interrupt */ + interrupts = ; +--- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi +@@ -136,6 +136,7 @@ + <0x00 0x0e000000 0x00 0x0e000000 0x00 0x01800000>, /* PCIe Core*/ + <0x00 0x10000000 0x00 0x10000000 0x00 0x10000000>, /* PCIe DAT */ + <0x00 0x64800000 0x00 0x64800000 0x00 0x00800000>, /* C71 */ ++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A72 PERIPHBASE */ + <0x44 0x00000000 0x44 0x00000000 0x00 0x08000000>, /* PCIe2 DAT */ + <0x44 0x10000000 0x44 0x10000000 0x00 0x08000000>, /* PCIe3 DAT */ + <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */ diff --git a/queue-5.10/arm64-signal-nofpsimd-do-not-allocate-fp-simd-context-when-not-available.patch b/queue-5.10/arm64-signal-nofpsimd-do-not-allocate-fp-simd-context-when-not-available.patch new file mode 100644 index 00000000000..e09b82c0a3d --- /dev/null +++ b/queue-5.10/arm64-signal-nofpsimd-do-not-allocate-fp-simd-context-when-not-available.patch @@ -0,0 +1,50 @@ +From 0a32c88ddb9af30e8a16d41d7b9b824c27d29459 Mon Sep 17 00:00:00 2001 +From: David Engraf +Date: Fri, 25 Feb 2022 11:40:08 +0100 +Subject: arm64: signal: nofpsimd: Do not allocate fp/simd context when not available + +From: David Engraf + +commit 0a32c88ddb9af30e8a16d41d7b9b824c27d29459 upstream. + +Commit 6d502b6ba1b2 ("arm64: signal: nofpsimd: Handle fp/simd context for +signal frames") introduced saving the fp/simd context for signal handling +only when support is available. But setup_sigframe_layout() always +reserves memory for fp/simd context. The additional memory is not touched +because preserve_fpsimd_context() is not called and thus the magic is +invalid. + +This may lead to an error when parse_user_sigframe() checks the fp/simd +area and does not find a valid magic number. + +Signed-off-by: David Engraf +Reviwed-by: Mark Brown +Fixes: 6d502b6ba1b267b3 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") +Cc: # 5.6.x +Reviewed-by: Catalin Marinas +Link: https://lore.kernel.org/r/20220225104008.820289-1-david.engraf@sysgo.com +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kernel/signal.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/arch/arm64/kernel/signal.c ++++ b/arch/arm64/kernel/signal.c +@@ -572,10 +572,12 @@ static int setup_sigframe_layout(struct + { + int err; + +- err = sigframe_alloc(user, &user->fpsimd_offset, +- sizeof(struct fpsimd_context)); +- if (err) +- return err; ++ if (system_supports_fpsimd()) { ++ err = sigframe_alloc(user, &user->fpsimd_offset, ++ sizeof(struct fpsimd_context)); ++ if (err) ++ return err; ++ } + + /* fault information, if valid */ + if (add_all || current->thread.fault_code) { diff --git a/queue-5.10/bcache-fixup-multiple-threads-crash.patch b/queue-5.10/bcache-fixup-multiple-threads-crash.patch new file mode 100644 index 00000000000..cf270903fbd --- /dev/null +++ b/queue-5.10/bcache-fixup-multiple-threads-crash.patch @@ -0,0 +1,67 @@ +From 887554ab96588de2917b6c8c73e552da082e5368 Mon Sep 17 00:00:00 2001 +From: Mingzhe Zou +Date: Fri, 11 Feb 2022 14:39:15 +0800 +Subject: bcache: fixup multiple threads crash + +From: Mingzhe Zou + +commit 887554ab96588de2917b6c8c73e552da082e5368 upstream. + +When multiple threads to check btree nodes in parallel, the main +thread wait for all threads to stop or CACHE_SET_IO_DISABLE flag: + +wait_event_interruptible(check_state->wait, + atomic_read(&check_state->started) == 0 || + test_bit(CACHE_SET_IO_DISABLE, &c->flags)); + +However, the bch_btree_node_read and bch_btree_node_read_done +maybe call bch_cache_set_error, then the CACHE_SET_IO_DISABLE +will be set. If the flag already set, the main thread return +error. At the same time, maybe some threads still running and +read NULL pointer, the kernel will crash. + +This patch change the event wait condition, the main thread must +wait for all threads to stop. + +Fixes: 8e7102273f597 ("bcache: make bch_btree_check() to be multithreaded") +Signed-off-by: Mingzhe Zou +Cc: stable@vger.kernel.org # v5.7+ +Signed-off-by: Coly Li +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/bcache/btree.c | 6 ++++-- + drivers/md/bcache/writeback.c | 6 ++++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -2060,9 +2060,11 @@ int bch_btree_check(struct cache_set *c) + } + } + ++ /* ++ * Must wait for all threads to stop. ++ */ + wait_event_interruptible(check_state->wait, +- atomic_read(&check_state->started) == 0 || +- test_bit(CACHE_SET_IO_DISABLE, &c->flags)); ++ atomic_read(&check_state->started) == 0); + + for (i = 0; i < check_state->total_threads; i++) { + if (check_state->infos[i].result) { +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -952,9 +952,11 @@ void bch_sectors_dirty_init(struct bcach + } + } + ++ /* ++ * Must wait for all threads to stop. ++ */ + wait_event_interruptible(state->wait, +- atomic_read(&state->started) == 0 || +- test_bit(CACHE_SET_IO_DISABLE, &c->flags)); ++ atomic_read(&state->started) == 0); + + out: + kfree(state); diff --git a/queue-5.10/block-don-t-merge-across-cgroup-boundaries-if-blkcg-is-enabled.patch b/queue-5.10/block-don-t-merge-across-cgroup-boundaries-if-blkcg-is-enabled.patch new file mode 100644 index 00000000000..6375fa75e60 --- /dev/null +++ b/queue-5.10/block-don-t-merge-across-cgroup-boundaries-if-blkcg-is-enabled.patch @@ -0,0 +1,112 @@ +From 6b2b04590b51aa4cf395fcd185ce439cab5961dc Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Mon, 14 Mar 2022 14:30:11 -1000 +Subject: block: don't merge across cgroup boundaries if blkcg is enabled + +From: Tejun Heo + +commit 6b2b04590b51aa4cf395fcd185ce439cab5961dc upstream. + +blk-iocost and iolatency are cgroup aware rq-qos policies but they didn't +disable merges across different cgroups. This obviously can lead to +accounting and control errors but more importantly to priority inversions - +e.g. an IO which belongs to a higher priority cgroup or IO class may end up +getting throttled incorrectly because it gets merged to an IO issued from a +low priority cgroup. + +Fix it by adding blk_cgroup_mergeable() which is called from merge paths and +rejects cross-cgroup and cross-issue_as_root merges. + +Signed-off-by: Tejun Heo +Fixes: d70675121546 ("block: introduce blk-iolatency io controller") +Cc: stable@vger.kernel.org # v4.19+ +Cc: Josef Bacik +Link: https://lore.kernel.org/r/Yi/eE/6zFNyWJ+qd@slm.duckdns.org +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-merge.c | 11 +++++++++++ + include/linux/blk-cgroup.h | 17 +++++++++++++++++ + 2 files changed, 28 insertions(+) + +--- a/block/blk-merge.c ++++ b/block/blk-merge.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + #include + +@@ -554,6 +555,9 @@ static inline unsigned int blk_rq_get_ma + static inline int ll_new_hw_segment(struct request *req, struct bio *bio, + unsigned int nr_phys_segs) + { ++ if (!blk_cgroup_mergeable(req, bio)) ++ goto no_merge; ++ + if (blk_integrity_merge_bio(req->q, req, bio) == false) + goto no_merge; + +@@ -650,6 +654,9 @@ static int ll_merge_requests_fn(struct r + if (total_phys_segments > blk_rq_get_max_segments(req)) + return 0; + ++ if (!blk_cgroup_mergeable(req, next->bio)) ++ return 0; ++ + if (blk_integrity_merge_rq(q, req, next) == false) + return 0; + +@@ -861,6 +868,10 @@ bool blk_rq_merge_ok(struct request *rq, + if (rq->rq_disk != bio->bi_disk) + return false; + ++ /* don't merge across cgroup boundaries */ ++ if (!blk_cgroup_mergeable(rq, bio)) ++ return false; ++ + /* only merge integrity protected bio into ditto rq */ + if (blk_integrity_merge_bio(rq->q, rq, bio) == false) + return false; +--- a/include/linux/blk-cgroup.h ++++ b/include/linux/blk-cgroup.h +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ + #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) +@@ -599,6 +600,21 @@ static inline void blkcg_clear_delay(str + atomic_dec(&blkg->blkcg->css.cgroup->congestion_count); + } + ++/** ++ * blk_cgroup_mergeable - Determine whether to allow or disallow merges ++ * @rq: request to merge into ++ * @bio: bio to merge ++ * ++ * @bio and @rq should belong to the same cgroup and their issue_as_root should ++ * match. The latter is necessary as we don't want to throttle e.g. a metadata ++ * update because it happens to be next to a regular IO. ++ */ ++static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) ++{ ++ return rq->bio->bi_blkg == bio->bi_blkg && ++ bio_issue_as_root_blkg(rq->bio) == bio_issue_as_root_blkg(bio); ++} ++ + void blk_cgroup_bio_start(struct bio *bio); + void blkcg_add_delay(struct blkcg_gq *blkg, u64 now, u64 delta); + void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); +@@ -654,6 +670,7 @@ static inline void blkg_put(struct blkcg + static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; } + static inline void blkcg_bio_issue_init(struct bio *bio) { } + static inline void blk_cgroup_bio_start(struct bio *bio) { } ++static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) { return true; } + + #define blk_queue_for_each_rl(rl, q) \ + for ((rl) = &(q)->root_rl; (rl); (rl) = NULL) diff --git a/queue-5.10/block-limit-request-dispatch-loop-duration.patch b/queue-5.10/block-limit-request-dispatch-loop-duration.patch new file mode 100644 index 00000000000..b7c33dbdec0 --- /dev/null +++ b/queue-5.10/block-limit-request-dispatch-loop-duration.patch @@ -0,0 +1,85 @@ +From 572299f03afd676dd4e20669cdaf5ed0fe1379d4 Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Fri, 18 Mar 2022 11:26:41 +0900 +Subject: block: limit request dispatch loop duration + +From: Shin'ichiro Kawasaki + +commit 572299f03afd676dd4e20669cdaf5ed0fe1379d4 upstream. + +When IO requests are made continuously and the target block device +handles requests faster than request arrival, the request dispatch loop +keeps on repeating to dispatch the arriving requests very long time, +more than a minute. Since the loop runs as a workqueue worker task, the +very long loop duration triggers workqueue watchdog timeout and BUG [1]. + +To avoid the very long loop duration, break the loop periodically. When +opportunity to dispatch requests still exists, check need_resched(). If +need_resched() returns true, the dispatch loop already consumed its time +slice, then reschedule the dispatch work and break the loop. With heavy +IO load, need_resched() does not return true for 20~30 seconds. To cover +such case, check time spent in the dispatch loop with jiffies. If more +than 1 second is spent, reschedule the dispatch work and break the loop. + +[1] + +[ 609.691437] BUG: workqueue lockup - pool cpus=10 node=1 flags=0x0 nice=-20 stuck for 35s! +[ 609.701820] Showing busy workqueues and worker pools: +[ 609.707915] workqueue events: flags=0x0 +[ 609.712615] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 +[ 609.712626] pending: drm_fb_helper_damage_work [drm_kms_helper] +[ 609.712687] workqueue events_freezable: flags=0x4 +[ 609.732943] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 +[ 609.732952] pending: pci_pme_list_scan +[ 609.732968] workqueue events_power_efficient: flags=0x80 +[ 609.751947] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 +[ 609.751955] pending: neigh_managed_work +[ 609.752018] workqueue kblockd: flags=0x18 +[ 609.769480] pwq 21: cpus=10 node=1 flags=0x0 nice=-20 active=3/256 refcnt=4 +[ 609.769488] in-flight: 1020:blk_mq_run_work_fn +[ 609.769498] pending: blk_mq_timeout_work, blk_mq_run_work_fn +[ 609.769744] pool 21: cpus=10 node=1 flags=0x0 nice=-20 hung=35s workers=2 idle: 67 +[ 639.899730] BUG: workqueue lockup - pool cpus=10 node=1 flags=0x0 nice=-20 stuck for 66s! +[ 639.909513] Showing busy workqueues and worker pools: +[ 639.915404] workqueue events: flags=0x0 +[ 639.920197] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 +[ 639.920215] pending: drm_fb_helper_damage_work [drm_kms_helper] +[ 639.920365] workqueue kblockd: flags=0x18 +[ 639.939932] pwq 21: cpus=10 node=1 flags=0x0 nice=-20 active=3/256 refcnt=4 +[ 639.939942] in-flight: 1020:blk_mq_run_work_fn +[ 639.939955] pending: blk_mq_timeout_work, blk_mq_run_work_fn +[ 639.940212] pool 21: cpus=10 node=1 flags=0x0 nice=-20 hung=66s workers=2 idle: 67 + +Fixes: 6e6fcbc27e778 ("blk-mq: support batching dispatch in case of io") +Signed-off-by: Shin'ichiro Kawasaki +Cc: stable@vger.kernel.org # v5.10+ +Link: https://lore.kernel.org/linux-block/20220310091649.zypaem5lkyfadymg@shindev/ +Link: https://lore.kernel.org/r/20220318022641.133484-1-shinichiro.kawasaki@wdc.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-mq-sched.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/block/blk-mq-sched.c ++++ b/block/blk-mq-sched.c +@@ -194,11 +194,18 @@ static int __blk_mq_do_dispatch_sched(st + + static int blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx) + { ++ unsigned long end = jiffies + HZ; + int ret; + + do { + ret = __blk_mq_do_dispatch_sched(hctx); +- } while (ret == 1); ++ if (ret != 1) ++ break; ++ if (need_resched() || time_is_before_jiffies(end)) { ++ blk_mq_delay_run_hw_queue(hctx, 0); ++ break; ++ } ++ } while (1); + + return ret; + } diff --git a/queue-5.10/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch b/queue-5.10/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch new file mode 100644 index 00000000000..b2327479d86 --- /dev/null +++ b/queue-5.10/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch @@ -0,0 +1,36 @@ +From d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:06 +0900 +Subject: brcmfmac: firmware: Allocate space for default boardrev in nvram + +From: Hector Martin + +commit d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 upstream. + +If boardrev is missing from the NVRAM we add a default one, but this +might need more space in the output buffer than was allocated. Ensure +we have enough padding for this in the buffer. + +Fixes: 46f2b38a91b0 ("brcmfmac: insert default boardrev in nvram data if missing") +Reviewed-by: Arend van Spriel +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Reviewed-by: Andy Shevchenko +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-3-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struc + size = BRCMF_FW_MAX_NVRAM_SIZE; + else + size = data_len; ++ /* Add space for properties we may add */ ++ size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1; + /* Alloc for extra 0 byte + roundup by 4 + length field */ + size += 1 + 3 + sizeof(u32); + nvp->nvram = kzalloc(size, GFP_KERNEL); diff --git a/queue-5.10/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch b/queue-5.10/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch new file mode 100644 index 00000000000..afab2794a2c --- /dev/null +++ b/queue-5.10/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch @@ -0,0 +1,66 @@ +From b50255c83b914defd61a57fbc81d452334b63f4c Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:10 +0900 +Subject: brcmfmac: pcie: Fix crashes due to early IRQs + +From: Hector Martin + +commit b50255c83b914defd61a57fbc81d452334b63f4c upstream. + +The driver was enabling IRQs before the message processing was +initialized. This could cause IRQs to come in too early and crash the +driver. Instead, move the IRQ enable and hostready to a bus preinit +function, at which point everything is properly initialized. + +Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.") +Reviewed-by: Linus Walleij +Reviewed-by: Arend van Spriel +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Reviewed-by: Andy Shevchenko +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-7-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1306,6 +1306,18 @@ static void brcmf_pcie_down(struct devic + { + } + ++static int brcmf_pcie_preinit(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; ++ ++ brcmf_dbg(PCIE, "Enter\n"); ++ ++ brcmf_pcie_intr_enable(buspub->devinfo); ++ brcmf_pcie_hostready(buspub->devinfo); ++ ++ return 0; ++} + + static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb) + { +@@ -1414,6 +1426,7 @@ static int brcmf_pcie_reset(struct devic + } + + static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { ++ .preinit = brcmf_pcie_preinit, + .txdata = brcmf_pcie_tx, + .stop = brcmf_pcie_down, + .txctl = brcmf_pcie_tx_ctlpkt, +@@ -1786,9 +1799,6 @@ static void brcmf_pcie_setup(struct devi + + init_waitqueue_head(&devinfo->mbdata_resp_wait); + +- brcmf_pcie_intr_enable(devinfo); +- brcmf_pcie_hostready(devinfo); +- + ret = brcmf_attach(&devinfo->pdev->dev); + if (ret) + goto fail; diff --git a/queue-5.10/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch b/queue-5.10/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch new file mode 100644 index 00000000000..38c837c9b74 --- /dev/null +++ b/queue-5.10/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch @@ -0,0 +1,36 @@ +From 5e90f0f3ead014867dade7a22f93958119f5efab Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:05 +0900 +Subject: brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path + +From: Hector Martin + +commit 5e90f0f3ead014867dade7a22f93958119f5efab upstream. + +This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that +the CLM blob is released in the device remove path. + +Fixes: 82f93cf46d60 ("brcmfmac: get chip's default RAM info during PCIe setup") +Reviewed-by: Linus Walleij +Reviewed-by: Arend van Spriel +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Reviewed-by: Andy Shevchenko +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-2-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1775,6 +1775,8 @@ static void brcmf_pcie_setup(struct devi + ret = brcmf_chip_get_raminfo(devinfo->ci); + if (ret) { + brcmf_err(bus, "Failed to get RAM info\n"); ++ release_firmware(fw); ++ brcmf_fw_nvram_free(nvram); + goto fail; + } + diff --git a/queue-5.10/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch b/queue-5.10/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch new file mode 100644 index 00000000000..913d6e20a39 --- /dev/null +++ b/queue-5.10/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch @@ -0,0 +1,108 @@ +From 9466987f246758eb7e9071ae58005253f631271e Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:09 +0900 +Subject: brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio + +From: Hector Martin + +commit 9466987f246758eb7e9071ae58005253f631271e upstream. + +The alignment check was wrong (e.g. & 4 instead of & 3), and the logic +was also inefficient if the length was not a multiple of 4, since it +would needlessly fall back to copying the entire buffer bytewise. + +We already have a perfectly good memcpy_toio function, so just call that +instead of rolling our own copy logic here. brcmf_pcie_init_ringbuffers +was already using it anyway. + +Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.") +Reviewed-by: Linus Walleij +Reviewed-by: Arend van Spriel +Reviewed-by: Andy Shevchenko +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-6-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 48 +--------------- + 1 file changed, 4 insertions(+), 44 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -447,47 +448,6 @@ brcmf_pcie_write_ram32(struct brcmf_pcie + + + static void +-brcmf_pcie_copy_mem_todev(struct brcmf_pciedev_info *devinfo, u32 mem_offset, +- void *srcaddr, u32 len) +-{ +- void __iomem *address = devinfo->tcm + mem_offset; +- __le32 *src32; +- __le16 *src16; +- u8 *src8; +- +- if (((ulong)address & 4) || ((ulong)srcaddr & 4) || (len & 4)) { +- if (((ulong)address & 2) || ((ulong)srcaddr & 2) || (len & 2)) { +- src8 = (u8 *)srcaddr; +- while (len) { +- iowrite8(*src8, address); +- address++; +- src8++; +- len--; +- } +- } else { +- len = len / 2; +- src16 = (__le16 *)srcaddr; +- while (len) { +- iowrite16(le16_to_cpu(*src16), address); +- address += 2; +- src16++; +- len--; +- } +- } +- } else { +- len = len / 4; +- src32 = (__le32 *)srcaddr; +- while (len) { +- iowrite32(le32_to_cpu(*src32), address); +- address += 4; +- src32++; +- len--; +- } +- } +-} +- +- +-static void + brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset, + void *dstaddr, u32 len) + { +@@ -1561,8 +1521,8 @@ static int brcmf_pcie_download_fw_nvram( + return err; + + brcmf_dbg(PCIE, "Download FW %s\n", devinfo->fw_name); +- brcmf_pcie_copy_mem_todev(devinfo, devinfo->ci->rambase, +- (void *)fw->data, fw->size); ++ memcpy_toio(devinfo->tcm + devinfo->ci->rambase, ++ (void *)fw->data, fw->size); + + resetintr = get_unaligned_le32(fw->data); + release_firmware(fw); +@@ -1576,7 +1536,7 @@ static int brcmf_pcie_download_fw_nvram( + brcmf_dbg(PCIE, "Download NVRAM %s\n", devinfo->nvram_name); + address = devinfo->ci->rambase + devinfo->ci->ramsize - + nvram_len; +- brcmf_pcie_copy_mem_todev(devinfo, address, nvram, nvram_len); ++ memcpy_toio(devinfo->tcm + address, nvram, nvram_len); + brcmf_fw_nvram_free(nvram); + } else { + brcmf_dbg(PCIE, "No matching NVRAM file found %s\n", diff --git a/queue-5.10/can-isotp-sanitize-can-id-checks-in-isotp_bind.patch b/queue-5.10/can-isotp-sanitize-can-id-checks-in-isotp_bind.patch new file mode 100644 index 00000000000..cf9ba7411cd --- /dev/null +++ b/queue-5.10/can-isotp-sanitize-can-id-checks-in-isotp_bind.patch @@ -0,0 +1,104 @@ +From 3ea566422cbde9610c2734980d1286ab681bb40e Mon Sep 17 00:00:00 2001 +From: Oliver Hartkopp +Date: Wed, 16 Mar 2022 17:42:56 +0100 +Subject: can: isotp: sanitize CAN ID checks in isotp_bind() + +From: Oliver Hartkopp + +commit 3ea566422cbde9610c2734980d1286ab681bb40e upstream. + +Syzbot created an environment that lead to a state machine status that +can not be reached with a compliant CAN ID address configuration. +The provided address information consisted of CAN ID 0x6000001 and 0xC28001 +which both boil down to 11 bit CAN IDs 0x001 in sending and receiving. + +Sanitize the SFF/EFF CAN ID values before performing the address checks. + +Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") +Link: https://lore.kernel.org/all/20220316164258.54155-1-socketcan@hartkopp.net +Reported-by: syzbot+2339c27f5c66c652843e@syzkaller.appspotmail.com +Signed-off-by: Oliver Hartkopp +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + net/can/isotp.c | 38 ++++++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 18 deletions(-) + +--- a/net/can/isotp.c ++++ b/net/can/isotp.c +@@ -1102,6 +1102,7 @@ static int isotp_bind(struct socket *soc + struct net *net = sock_net(sk); + int ifindex; + struct net_device *dev; ++ canid_t tx_id, rx_id; + int err = 0; + int notify_enetdown = 0; + int do_rx_reg = 1; +@@ -1109,8 +1110,18 @@ static int isotp_bind(struct socket *soc + if (len < ISOTP_MIN_NAMELEN) + return -EINVAL; + +- if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) +- return -EADDRNOTAVAIL; ++ /* sanitize tx/rx CAN identifiers */ ++ tx_id = addr->can_addr.tp.tx_id; ++ if (tx_id & CAN_EFF_FLAG) ++ tx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); ++ else ++ tx_id &= CAN_SFF_MASK; ++ ++ rx_id = addr->can_addr.tp.rx_id; ++ if (rx_id & CAN_EFF_FLAG) ++ rx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); ++ else ++ rx_id &= CAN_SFF_MASK; + + if (!addr->can_ifindex) + return -ENODEV; +@@ -1122,21 +1133,13 @@ static int isotp_bind(struct socket *soc + do_rx_reg = 0; + + /* do not validate rx address for functional addressing */ +- if (do_rx_reg) { +- if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) { +- err = -EADDRNOTAVAIL; +- goto out; +- } +- +- if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) { +- err = -EADDRNOTAVAIL; +- goto out; +- } ++ if (do_rx_reg && rx_id == tx_id) { ++ err = -EADDRNOTAVAIL; ++ goto out; + } + + if (so->bound && addr->can_ifindex == so->ifindex && +- addr->can_addr.tp.rx_id == so->rxid && +- addr->can_addr.tp.tx_id == so->txid) ++ rx_id == so->rxid && tx_id == so->txid) + goto out; + + dev = dev_get_by_index(net, addr->can_ifindex); +@@ -1160,8 +1163,7 @@ static int isotp_bind(struct socket *soc + ifindex = dev->ifindex; + + if (do_rx_reg) +- can_rx_register(net, dev, addr->can_addr.tp.rx_id, +- SINGLE_MASK(addr->can_addr.tp.rx_id), ++ can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id), + isotp_rcv, sk, "isotp", sk); + + dev_put(dev); +@@ -1181,8 +1183,8 @@ static int isotp_bind(struct socket *soc + + /* switch to new settings */ + so->ifindex = ifindex; +- so->rxid = addr->can_addr.tp.rx_id; +- so->txid = addr->can_addr.tp.tx_id; ++ so->rxid = rx_id; ++ so->txid = tx_id; + so->bound = 1; + + out: diff --git a/queue-5.10/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch b/queue-5.10/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch new file mode 100644 index 00000000000..aa52a05fe92 --- /dev/null +++ b/queue-5.10/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch @@ -0,0 +1,39 @@ +From 02a95374b5eebdbd3b6413fd7ddec151d2ea75a1 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 25 Jan 2022 00:44:06 +0000 +Subject: carl9170: fix missing bit-wise or operator for tx_params + +From: Colin Ian King + +commit 02a95374b5eebdbd3b6413fd7ddec151d2ea75a1 upstream. + +Currently tx_params is being re-assigned with a new value and the +previous setting IEEE80211_HT_MCS_TX_RX_DIFF is being overwritten. +The assignment operator is incorrect, the original intent was to +bit-wise or the value in. Fix this by replacing the = operator +with |= instead. + +Kudos to Christian Lamparter for suggesting the correct fix. + +Fixes: fe8ee9ad80b2 ("carl9170: mac80211 glue and command interface") +Signed-off-by: Colin Ian King +Cc: +Acked-by: Christian Lamparter +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220125004406.344422-1-colin.i.king@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/ath/carl9170/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/carl9170/main.c ++++ b/drivers/net/wireless/ath/carl9170/main.c +@@ -1916,7 +1916,7 @@ static int carl9170_parse_eeprom(struct + WARN_ON(!(tx_streams >= 1 && tx_streams <= + IEEE80211_HT_MCS_TX_MAX_STREAMS)); + +- tx_params = (tx_streams - 1) << ++ tx_params |= (tx_streams - 1) << + IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; + + carl9170_band_2GHz.ht_cap.mcs.tx_params |= tx_params; diff --git a/queue-5.10/coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch b/queue-5.10/coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch new file mode 100644 index 00000000000..8425feb6cb6 --- /dev/null +++ b/queue-5.10/coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch @@ -0,0 +1,109 @@ +From 84158b7f6a0624b81800b4e7c90f7fb7fdecf66c Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Wed, 26 Jan 2022 03:57:39 +0100 +Subject: coredump: Also dump first pages of non-executable ELF libraries + +From: Jann Horn + +commit 84158b7f6a0624b81800b4e7c90f7fb7fdecf66c upstream. + +When I rewrote the VMA dumping logic for coredumps, I changed it to +recognize ELF library mappings based on the file being executable instead +of the mapping having an ELF header. But turns out, distros ship many ELF +libraries as non-executable, so the heuristic goes wrong... + +Restore the old behavior where FILTER(ELF_HEADERS) dumps the first page of +any offset-0 readable mapping that starts with the ELF magic. + +This fix is technically layer-breaking a bit, because it checks for +something ELF-specific in fs/coredump.c; but since we probably want to +share this between standard ELF and FDPIC ELF anyway, I guess it's fine? +And this also keeps the change small for backporting. + +Cc: stable@vger.kernel.org +Fixes: 429a22e776a2 ("coredump: rework elf/elf_fdpic vma_dump_size() into common helper") +Reported-by: Bill Messmer +Signed-off-by: Jann Horn +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/20220126025739.2014888-1-jannh@google.com +Signed-off-by: Greg Kroah-Hartman +--- + fs/coredump.c | 39 ++++++++++++++++++++++++++++++++++----- + 1 file changed, 34 insertions(+), 5 deletions(-) + +--- a/fs/coredump.c ++++ b/fs/coredump.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -969,6 +970,8 @@ static bool always_dump_vma(struct vm_ar + return false; + } + ++#define DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER 1 ++ + /* + * Decide how much of @vma's contents should be included in a core dump. + */ +@@ -1028,9 +1031,20 @@ static unsigned long vma_dump_size(struc + * dump the first page to aid in determining what was mapped here. + */ + if (FILTER(ELF_HEADERS) && +- vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ) && +- (READ_ONCE(file_inode(vma->vm_file)->i_mode) & 0111) != 0) +- return PAGE_SIZE; ++ vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) { ++ if ((READ_ONCE(file_inode(vma->vm_file)->i_mode) & 0111) != 0) ++ return PAGE_SIZE; ++ ++ /* ++ * ELF libraries aren't always executable. ++ * We'll want to check whether the mapping starts with the ELF ++ * magic, but not now - we're holding the mmap lock, ++ * so copy_from_user() doesn't work here. ++ * Use a placeholder instead, and fix it up later in ++ * dump_vma_snapshot(). ++ */ ++ return DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER; ++ } + + #undef FILTER + +@@ -1105,8 +1119,6 @@ int dump_vma_snapshot(struct coredump_pa + m->end = vma->vm_end; + m->flags = vma->vm_flags; + m->dump_size = vma_dump_size(vma, cprm->mm_flags); +- +- vma_data_size += m->dump_size; + } + + mmap_write_unlock(mm); +@@ -1116,6 +1128,23 @@ int dump_vma_snapshot(struct coredump_pa + return -EFAULT; + } + ++ for (i = 0; i < *vma_count; i++) { ++ struct core_vma_metadata *m = (*vma_meta) + i; ++ ++ if (m->dump_size == DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER) { ++ char elfmag[SELFMAG]; ++ ++ if (copy_from_user(elfmag, (void __user *)m->start, SELFMAG) || ++ memcmp(elfmag, ELFMAG, SELFMAG) != 0) { ++ m->dump_size = 0; ++ } else { ++ m->dump_size = PAGE_SIZE; ++ } ++ } ++ ++ vma_data_size += m->dump_size; ++ } ++ + *vma_data_size_ptr = vma_data_size; + return 0; + } diff --git a/queue-5.10/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch b/queue-5.10/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch new file mode 100644 index 00000000000..b2a0cb130ba --- /dev/null +++ b/queue-5.10/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch @@ -0,0 +1,52 @@ +From e316f7179be22912281ce6331d96d7c121fb2b17 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 18 Jan 2022 16:13:03 -0800 +Subject: crypto: rsa-pkcs1pad - correctly get hash from source scatterlist + +From: Eric Biggers + +commit e316f7179be22912281ce6331d96d7c121fb2b17 upstream. + +Commit c7381b012872 ("crypto: akcipher - new verify API for public key +algorithms") changed akcipher_alg::verify to take in both the signature +and the actual hash and do the signature verification, rather than just +return the hash expected by the signature as was the case before. To do +this, it implemented a hack where the signature and hash are +concatenated with each other in one scatterlist. + +Obviously, for this to work correctly, akcipher_alg::verify needs to +correctly extract the two items from the scatterlist it is given. +Unfortunately, it doesn't correctly extract the hash in the case where +the signature is longer than the RSA key size, as it assumes that the +signature's length is equal to the RSA key size. This causes a prefix +of the hash, or even the entire hash, to be taken from the *signature*. + +(Note, the case of a signature longer than the RSA key size should not +be allowed in the first place; a separate patch will fix that.) + +It is unclear whether the resulting scheme has any useful security +properties. + +Fix this by correctly extracting the hash from the scatterlist. + +Fixes: c7381b012872 ("crypto: akcipher - new verify API for public key algorithms") +Cc: # v5.2+ +Reviewed-by: Vitaly Chikunov +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + crypto/rsa-pkcs1pad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/crypto/rsa-pkcs1pad.c ++++ b/crypto/rsa-pkcs1pad.c +@@ -495,7 +495,7 @@ static int pkcs1pad_verify_complete(stru + sg_nents_for_len(req->src, + req->src_len + req->dst_len), + req_ctx->out_buf + ctx->key_size, +- req->dst_len, ctx->key_size); ++ req->dst_len, req->src_len); + /* Do the actual verification step. */ + if (memcmp(req_ctx->out_buf + ctx->key_size, out_buf + pos, + req->dst_len) != 0) diff --git a/queue-5.10/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch b/queue-5.10/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch new file mode 100644 index 00000000000..5bdca586815 --- /dev/null +++ b/queue-5.10/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch @@ -0,0 +1,33 @@ +From a24611ea356c7f3f0ec926da11b9482ac1f414fd Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 18 Jan 2022 16:13:05 -0800 +Subject: crypto: rsa-pkcs1pad - fix buffer overread in pkcs1pad_verify_complete() + +From: Eric Biggers + +commit a24611ea356c7f3f0ec926da11b9482ac1f414fd upstream. + +Before checking whether the expected digest_info is present, we need to +check that there are enough bytes remaining. + +Fixes: a49de377e051 ("crypto: Add hash param to pkcs1pad") +Cc: # v4.6+ +Cc: Tadeusz Struk +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + crypto/rsa-pkcs1pad.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/crypto/rsa-pkcs1pad.c ++++ b/crypto/rsa-pkcs1pad.c +@@ -476,6 +476,8 @@ static int pkcs1pad_verify_complete(stru + pos++; + + if (digest_info) { ++ if (digest_info->size > dst_len - pos) ++ goto done; + if (crypto_memneq(out_buf + pos, digest_info->data, + digest_info->size)) + goto done; diff --git a/queue-5.10/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch b/queue-5.10/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch new file mode 100644 index 00000000000..c6b9b58b7bb --- /dev/null +++ b/queue-5.10/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch @@ -0,0 +1,36 @@ +From 9b30430ea356f237945e52f8a3a42158877bd5a9 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 18 Jan 2022 16:13:02 -0800 +Subject: crypto: rsa-pkcs1pad - only allow with rsa + +From: Eric Biggers + +commit 9b30430ea356f237945e52f8a3a42158877bd5a9 upstream. + +The pkcs1pad template can be instantiated with an arbitrary akcipher +algorithm, which doesn't make sense; it is specifically an RSA padding +scheme. Make it check that the underlying algorithm really is RSA. + +Fixes: 3d5b1ecdea6f ("crypto: rsa - RSA padding algorithm") +Cc: # v4.5+ +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + crypto/rsa-pkcs1pad.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/crypto/rsa-pkcs1pad.c ++++ b/crypto/rsa-pkcs1pad.c +@@ -621,6 +621,11 @@ static int pkcs1pad_create(struct crypto + + rsa_alg = crypto_spawn_akcipher_alg(&ctx->spawn); + ++ if (strcmp(rsa_alg->base.cra_name, "rsa") != 0) { ++ err = -EINVAL; ++ goto err_free_inst; ++ } ++ + err = -ENAMETOOLONG; + hash_name = crypto_attr_alg_name(tb[2]); + if (IS_ERR(hash_name)) { diff --git a/queue-5.10/crypto-rsa-pkcs1pad-restore-signature-length-check.patch b/queue-5.10/crypto-rsa-pkcs1pad-restore-signature-length-check.patch new file mode 100644 index 00000000000..b590426e88a --- /dev/null +++ b/queue-5.10/crypto-rsa-pkcs1pad-restore-signature-length-check.patch @@ -0,0 +1,46 @@ +From d3481accd974541e6a5d6a1fb588924a3519c36e Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 18 Jan 2022 16:13:04 -0800 +Subject: crypto: rsa-pkcs1pad - restore signature length check + +From: Eric Biggers + +commit d3481accd974541e6a5d6a1fb588924a3519c36e upstream. + +RSA PKCS#1 v1.5 signatures are required to be the same length as the RSA +key size. RFC8017 specifically requires the verifier to check this +(https://datatracker.ietf.org/doc/html/rfc8017#section-8.2.2). + +Commit a49de377e051 ("crypto: Add hash param to pkcs1pad") changed the +kernel to allow longer signatures, but didn't explain this part of the +change; it seems to be unrelated to the rest of the commit. + +Revert this change, since it doesn't appear to be correct. + +We can be pretty sure that no one is relying on overly-long signatures +(which would have to be front-padded with zeroes) being supported, given +that they would have been broken since commit c7381b012872 +("crypto: akcipher - new verify API for public key algorithms"). + +Fixes: a49de377e051 ("crypto: Add hash param to pkcs1pad") +Cc: # v4.6+ +Cc: Tadeusz Struk +Suggested-by: Vitaly Chikunov +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + crypto/rsa-pkcs1pad.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/crypto/rsa-pkcs1pad.c ++++ b/crypto/rsa-pkcs1pad.c +@@ -538,7 +538,7 @@ static int pkcs1pad_verify(struct akciph + + if (WARN_ON(req->dst) || + WARN_ON(!req->dst_len) || +- !ctx->key_size || req->src_len < ctx->key_size) ++ !ctx->key_size || req->src_len != ctx->key_size) + return -EINVAL; + + req_ctx->out_buf = kmalloc(ctx->key_size + req->dst_len, GFP_KERNEL); diff --git a/queue-5.10/dec-limit-pmax-memory-probing-to-r3k-systems.patch b/queue-5.10/dec-limit-pmax-memory-probing-to-r3k-systems.patch new file mode 100644 index 00000000000..bf532a4ee49 --- /dev/null +++ b/queue-5.10/dec-limit-pmax-memory-probing-to-r3k-systems.patch @@ -0,0 +1,70 @@ +From 244eae91a94c6dab82b3232967d10eeb9dfa21c6 Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" +Date: Fri, 4 Mar 2022 20:16:23 +0000 +Subject: DEC: Limit PMAX memory probing to R3k systems + +From: Maciej W. Rozycki + +commit 244eae91a94c6dab82b3232967d10eeb9dfa21c6 upstream. + +Recent tightening of the opcode table in binutils so as to consistently +disallow the assembly or disassembly of CP0 instructions not supported +by the processor architecture chosen has caused a regression like below: + +arch/mips/dec/prom/locore.S: Assembler messages: +arch/mips/dec/prom/locore.S:29: Error: opcode not supported on this processor: r4600 (mips3) `rfe' + +in a piece of code used to probe for memory with PMAX DECstation models, +which have non-REX firmware. Those computers always have an R2000 CPU +and consequently the exception handler used in memory probing uses the +RFE instruction, which those processors use. + +While adding 64-bit support this code was correctly excluded for 64-bit +configurations, however it should have also been excluded for irrelevant +32-bit configurations. Do this now then, and only enable PMAX memory +probing for R3k systems. + +Reported-by: Jan-Benedict Glaw +Reported-by: Sudip Mukherjee +Signed-off-by: Maciej W. Rozycki +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Cc: stable@vger.kernel.org # v2.6.12+ +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/dec/prom/Makefile | 2 +- + arch/mips/include/asm/dec/prom.h | 15 +++++---------- + 2 files changed, 6 insertions(+), 11 deletions(-) + +--- a/arch/mips/dec/prom/Makefile ++++ b/arch/mips/dec/prom/Makefile +@@ -6,4 +6,4 @@ + + lib-y += init.o memory.o cmdline.o identify.o console.o + +-lib-$(CONFIG_32BIT) += locore.o ++lib-$(CONFIG_CPU_R3000) += locore.o +--- a/arch/mips/include/asm/dec/prom.h ++++ b/arch/mips/include/asm/dec/prom.h +@@ -43,16 +43,11 @@ + */ + #define REX_PROM_MAGIC 0x30464354 + +-#ifdef CONFIG_64BIT +- +-#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ +- +-#else /* !CONFIG_64BIT */ +- +-#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) +- +-#endif /* !CONFIG_64BIT */ +- ++/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */ ++static inline bool prom_is_rex(u32 magic) ++{ ++ return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC; ++} + + /* + * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and diff --git a/queue-5.10/dm-integrity-set-journal-entry-unused-when-shrinking-device.patch b/queue-5.10/dm-integrity-set-journal-entry-unused-when-shrinking-device.patch new file mode 100644 index 00000000000..22e539d859b --- /dev/null +++ b/queue-5.10/dm-integrity-set-journal-entry-unused-when-shrinking-device.patch @@ -0,0 +1,44 @@ +From cc09e8a9dec4f0e8299e80a7a2a8e6f54164a10b Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Sat, 26 Mar 2022 10:24:56 -0400 +Subject: dm integrity: set journal entry unused when shrinking device + +From: Mikulas Patocka + +commit cc09e8a9dec4f0e8299e80a7a2a8e6f54164a10b upstream. + +Commit f6f72f32c22c ("dm integrity: don't replay journal data past the +end of the device") skips journal replay if the target sector points +beyond the end of the device. Unfortunatelly, it doesn't set the +journal entry unused, which resulted in this BUG being triggered: +BUG_ON(!journal_entry_is_unused(je)) + +Fix this by calling journal_entry_set_unused() for this case. + +Fixes: f6f72f32c22c ("dm integrity: don't replay journal data past the end of the device") +Cc: stable@vger.kernel.org # v5.7+ +Signed-off-by: Mikulas Patocka +Tested-by: Milan Broz +[snitzer: revised header] +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/dm-integrity.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -2354,9 +2354,11 @@ static void do_journal_write(struct dm_i + dm_integrity_io_error(ic, "invalid sector in journal", -EIO); + sec &= ~(sector_t)(ic->sectors_per_block - 1); + } ++ if (unlikely(sec >= ic->provided_data_sectors)) { ++ journal_entry_set_unused(je); ++ continue; ++ } + } +- if (unlikely(sec >= ic->provided_data_sectors)) +- continue; + get_area_and_offset(ic, sec, &area, &offset); + restore_last_bytes(ic, access_journal_data(ic, i, j), je); + for (k = j + 1; k < ic->journal_section_entries; k++) { diff --git a/queue-5.10/drbd-fix-potential-silent-data-corruption.patch b/queue-5.10/drbd-fix-potential-silent-data-corruption.patch new file mode 100644 index 00000000000..e26b4730d8f --- /dev/null +++ b/queue-5.10/drbd-fix-potential-silent-data-corruption.patch @@ -0,0 +1,67 @@ +From f4329d1f848ac35757d9cc5487669d19dfc5979c Mon Sep 17 00:00:00 2001 +From: Lars Ellenberg +Date: Wed, 30 Mar 2022 20:55:51 +0200 +Subject: drbd: fix potential silent data corruption +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lars Ellenberg + +commit f4329d1f848ac35757d9cc5487669d19dfc5979c upstream. + +Scenario: +--------- + +bio chain generated by blk_queue_split(). +Some split bio fails and propagates its error status to the "parent" bio. +But then the (last part of the) parent bio itself completes without error. + +We would clobber the already recorded error status with BLK_STS_OK, +causing silent data corruption. + +Reproducer: +----------- + +How to trigger this in the real world within seconds: + +DRBD on top of degraded parity raid, +small stripe_cache_size, large read_ahead setting. +Drop page cache (sysctl vm.drop_caches=1, fadvise "DONTNEED", +umount and mount again, "reboot"). + +Cause significant read ahead. + +Large read ahead request is split by blk_queue_split(). +Parts of the read ahead that are already in the stripe cache, +or find an available stripe cache to use, can be serviced. +Parts of the read ahead that would need "too much work", +would need to wait for a "stripe_head" to become available, +are rejected immediately. + +For larger read ahead requests that are split in many pieces, it is very +likely that some "splits" will be serviced, but then the stripe cache is +exhausted/busy, and the remaining ones will be rejected. + +Signed-off-by: Lars Ellenberg +Signed-off-by: Christoph Böhmwalder +Cc: # 4.13.x +Link: https://lore.kernel.org/r/20220330185551.3553196-1-christoph.boehmwalder@linbit.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/drbd/drbd_req.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/block/drbd/drbd_req.c ++++ b/drivers/block/drbd/drbd_req.c +@@ -177,7 +177,8 @@ void start_new_tl_epoch(struct drbd_conn + void complete_master_bio(struct drbd_device *device, + struct bio_and_error *m) + { +- m->bio->bi_status = errno_to_blk_status(m->error); ++ if (unlikely(m->error)) ++ m->bio->bi_status = errno_to_blk_status(m->error); + bio_endio(m->bio); + dec_ap_bio(device); + } diff --git a/queue-5.10/drivers-hamradio-6pack-fix-uaf-bug-caused-by-mod_timer.patch b/queue-5.10/drivers-hamradio-6pack-fix-uaf-bug-caused-by-mod_timer.patch new file mode 100644 index 00000000000..13a4be01bc0 --- /dev/null +++ b/queue-5.10/drivers-hamradio-6pack-fix-uaf-bug-caused-by-mod_timer.patch @@ -0,0 +1,87 @@ +From efe4186e6a1b54bf38b9e05450d43b0da1fd7739 Mon Sep 17 00:00:00 2001 +From: Duoming Zhou +Date: Thu, 17 Feb 2022 09:43:03 +0800 +Subject: drivers: hamradio: 6pack: fix UAF bug caused by mod_timer() + +From: Duoming Zhou + +commit efe4186e6a1b54bf38b9e05450d43b0da1fd7739 upstream. + +When a 6pack device is detaching, the sixpack_close() will act to cleanup +necessary resources. Although del_timer_sync() in sixpack_close() +won't return if there is an active timer, one could use mod_timer() in +sp_xmit_on_air() to wake up timer again by calling userspace syscall such +as ax25_sendmsg(), ax25_connect() and ax25_ioctl(). + +This unexpected waked handler, sp_xmit_on_air(), realizes nothing about +the undergoing cleanup and may still call pty_write() to use driver layer +resources that have already been released. + +One of the possible race conditions is shown below: + + (USE) | (FREE) +ax25_sendmsg() | + ax25_queue_xmit() | + ... | + sp_xmit() | + sp_encaps() | sixpack_close() + sp_xmit_on_air() | del_timer_sync(&sp->tx_t) + mod_timer(&sp->tx_t,...) | ... + | unregister_netdev() + | ... + (wait a while) | tty_release() + | tty_release_struct() + | release_tty() + sp_xmit_on_air() | tty_kref_put(tty_struct) //FREE + pty_write(tty_struct) //USE | ... + +The corresponding fail log is shown below: +=============================================================== +BUG: KASAN: use-after-free in __run_timers.part.0+0x170/0x470 +Write of size 8 at addr ffff88800a652ab8 by task swapper/2/0 +... +Call Trace: + ... + queue_work_on+0x3f/0x50 + pty_write+0xcd/0xe0pty_write+0xcd/0xe0 + sp_xmit_on_air+0xb2/0x1f0 + call_timer_fn+0x28/0x150 + __run_timers.part.0+0x3c2/0x470 + run_timer_softirq+0x3b/0x80 + __do_softirq+0xf1/0x380 + ... + +This patch reorders the del_timer_sync() after the unregister_netdev() +to avoid UAF bugs. Because the unregister_netdev() is well synchronized, +it flushs out any pending queues, waits the refcount of net_device +decreases to zero and removes net_device from kernel. There is not any +running routines after executing unregister_netdev(). Therefore, we could +not arouse timer from userspace again. + +Signed-off-by: Duoming Zhou +Reviewed-by: Lin Ma +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/hamradio/6pack.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/hamradio/6pack.c ++++ b/drivers/net/hamradio/6pack.c +@@ -674,14 +674,14 @@ static void sixpack_close(struct tty_str + */ + netif_stop_queue(sp->dev); + ++ unregister_netdev(sp->dev); ++ + del_timer_sync(&sp->tx_t); + del_timer_sync(&sp->resync_t); + + /* Free all 6pack frame buffers. */ + kfree(sp->rbuff); + kfree(sp->xbuff); +- +- unregister_netdev(sp->dev); + } + + /* Perform I/O control on an active 6pack channel. */ diff --git a/queue-5.10/drm-edid-check-basic-audio-support-on-cea-extension-block.patch b/queue-5.10/drm-edid-check-basic-audio-support-on-cea-extension-block.patch new file mode 100644 index 00000000000..c4d1917e1cb --- /dev/null +++ b/queue-5.10/drm-edid-check-basic-audio-support-on-cea-extension-block.patch @@ -0,0 +1,42 @@ +From 5662abf6e21338be6d085d6375d3732ac6147fd2 Mon Sep 17 00:00:00 2001 +From: Cooper Chiou +Date: Thu, 24 Mar 2022 14:12:18 +0800 +Subject: drm/edid: check basic audio support on CEA extension block + +From: Cooper Chiou + +commit 5662abf6e21338be6d085d6375d3732ac6147fd2 upstream. + +Tag code stored in bit7:5 for CTA block byte[3] is not the same as +CEA extension block definition. Only check CEA block has +basic audio support. + +v3: update commit message. + +Cc: stable@vger.kernel.org +Cc: Jani Nikula +Cc: Shawn C Lee +Cc: intel-gfx +Signed-off-by: Cooper Chiou +Signed-off-by: Lee Shawn C +Fixes: e28ad544f462 ("drm/edid: parse CEA blocks embedded in DisplayID") +Reviewed-by: Jani Nikula +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20220324061218.32739-1-shawn.c.lee@intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_edid.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -4806,7 +4806,8 @@ bool drm_detect_monitor_audio(struct edi + if (!edid_ext) + goto end; + +- has_audio = ((edid_ext[3] & EDID_BASIC_AUDIO) != 0); ++ has_audio = (edid_ext[0] == CEA_EXT && ++ (edid_ext[3] & EDID_BASIC_AUDIO) != 0); + + if (has_audio) { + DRM_DEBUG_KMS("Monitor has basic audio support\n"); diff --git a/queue-5.10/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch b/queue-5.10/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch new file mode 100644 index 00000000000..08b46188a1d --- /dev/null +++ b/queue-5.10/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch @@ -0,0 +1,82 @@ +From 3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7 Mon Sep 17 00:00:00 2001 +From: Mastan Katragadda +Date: Thu, 3 Mar 2022 11:34:28 +0530 +Subject: drm/i915/gem: add missing boundary check in vm_access + +From: Mastan Katragadda + +commit 3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7 upstream. + +A missing bounds check in vm_access() can lead to an out-of-bounds read +or write in the adjacent memory area, since the len attribute is not +validated before the memcpy later in the function, potentially hitting: + +[ 183.637831] BUG: unable to handle page fault for address: ffffc90000c86000 +[ 183.637934] #PF: supervisor read access in kernel mode +[ 183.637997] #PF: error_code(0x0000) - not-present page +[ 183.638059] PGD 100000067 P4D 100000067 PUD 100258067 PMD 106341067 PTE 0 +[ 183.638144] Oops: 0000 [#2] PREEMPT SMP NOPTI +[ 183.638201] CPU: 3 PID: 1790 Comm: poc Tainted: G D 5.17.0-rc6-ci-drm-11296+ #1 +[ 183.638298] Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake H DDR4 RVP, BIOS CNLSFWR1.R00.X208.B00.1905301319 05/30/2019 +[ 183.638430] RIP: 0010:memcpy_erms+0x6/0x10 +[ 183.640213] RSP: 0018:ffffc90001763d48 EFLAGS: 00010246 +[ 183.641117] RAX: ffff888109c14000 RBX: ffff888111bece40 RCX: 0000000000000ffc +[ 183.642029] RDX: 0000000000001000 RSI: ffffc90000c86000 RDI: ffff888109c14004 +[ 183.642946] RBP: 0000000000000ffc R08: 800000000000016b R09: 0000000000000000 +[ 183.643848] R10: ffffc90000c85000 R11: 0000000000000048 R12: 0000000000001000 +[ 183.644742] R13: ffff888111bed190 R14: ffff888109c14000 R15: 0000000000001000 +[ 183.645653] FS: 00007fe5ef807540(0000) GS:ffff88845b380000(0000) knlGS:0000000000000000 +[ 183.646570] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 183.647481] CR2: ffffc90000c86000 CR3: 000000010ff02006 CR4: 00000000003706e0 +[ 183.648384] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 183.649271] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +[ 183.650142] Call Trace: +[ 183.650988] +[ 183.651793] vm_access+0x1f0/0x2a0 [i915] +[ 183.652726] __access_remote_vm+0x224/0x380 +[ 183.653561] mem_rw.isra.0+0xf9/0x190 +[ 183.654402] vfs_read+0x9d/0x1b0 +[ 183.655238] ksys_read+0x63/0xe0 +[ 183.656065] do_syscall_64+0x38/0xc0 +[ 183.656882] entry_SYSCALL_64_after_hwframe+0x44/0xae +[ 183.657663] RIP: 0033:0x7fe5ef725142 +[ 183.659351] RSP: 002b:00007ffe1e81c7e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 +[ 183.660227] RAX: ffffffffffffffda RBX: 0000557055dfb780 RCX: 00007fe5ef725142 +[ 183.661104] RDX: 0000000000001000 RSI: 00007ffe1e81d880 RDI: 0000000000000005 +[ 183.661972] RBP: 00007ffe1e81e890 R08: 0000000000000030 R09: 0000000000000046 +[ 183.662832] R10: 0000557055dfc2e0 R11: 0000000000000246 R12: 0000557055dfb1c0 +[ 183.663691] R13: 00007ffe1e81e980 R14: 0000000000000000 R15: 0000000000000000 + +Changes since v1: + - Updated if condition with range_overflows_t [Chris Wilson] + +Fixes: 9f909e215fea ("drm/i915: Implement vm_ops->access for gdb access into mmaps") +Signed-off-by: Mastan Katragadda +Suggested-by: Adam Zabrocki +Reported-by: Jackson Cody +Cc: Chris Wilson +Cc: Jon Bloomfield +Cc: Sudeep Dutt +Cc: # v5.8+ +Reviewed-by: Matthew Auld +[mauld: tidy up the commit message and add Cc: stable] +Signed-off-by: Matthew Auld +Link: https://patchwork.freedesktop.org/patch/msgid/20220303060428.1668844-1-mastanx.katragadda@intel.com +(cherry picked from commit 661412e301e2ca86799aa4f400d1cf0bd38c57c6) +Signed-off-by: Joonas Lahtinen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +@@ -423,7 +423,7 @@ vm_access(struct vm_area_struct *area, u + return -EACCES; + + addr -= area->vm_start; +- if (addr >= obj->base.size) ++ if (range_overflows_t(u64, addr, len, obj->base.size)) + return -EINVAL; + + /* As this is primarily for debugging, let's focus on simplicity */ diff --git a/queue-5.10/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch b/queue-5.10/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch new file mode 100644 index 00000000000..cd8d501a194 --- /dev/null +++ b/queue-5.10/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch @@ -0,0 +1,60 @@ +From 24a644ebbfd3b13cda702f98907f9dd123e34bf9 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Thu, 10 Feb 2022 12:36:42 +0200 +Subject: drm/i915/opregion: check port number bounds for SWSCI display power state +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jani Nikula + +commit 24a644ebbfd3b13cda702f98907f9dd123e34bf9 upstream. + +The mapping from enum port to whatever port numbering scheme is used by +the SWSCI Display Power State Notification is odd, and the memory of it +has faded. In any case, the parameter only has space for ports numbered +[0..4], and UBSAN reports bit shift beyond it when the platform has port +F or more. + +Since the SWSCI functionality is supposed to be obsolete for new +platforms (i.e. ones that might have port F or more), just bail out +early if the mapped and mangled port number is beyond what the Display +Power State Notification can support. + +Fixes: 9c4b0a683193 ("drm/i915: add opregion function to notify bios of encoder enable/disable") +Cc: # v3.13+ +Cc: Ville Syrjälä +Cc: Lucas De Marchi +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4800 +Signed-off-by: Jani Nikula +Reviewed-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/cc363f42d6b5a5932b6d218fefcc8bdfb15dbbe5.1644489329.git.jani.nikula@intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_opregion.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/gpu/drm/i915/display/intel_opregion.c ++++ b/drivers/gpu/drm/i915/display/intel_opregion.c +@@ -376,6 +376,21 @@ int intel_opregion_notify_encoder(struct + return -EINVAL; + } + ++ /* ++ * The port numbering and mapping here is bizarre. The now-obsolete ++ * swsci spec supports ports numbered [0..4]. Port E is handled as a ++ * special case, but port F and beyond are not. The functionality is ++ * supposed to be obsolete for new platforms. Just bail out if the port ++ * number is out of bounds after mapping. ++ */ ++ if (port > 4) { ++ drm_dbg_kms(&dev_priv->drm, ++ "[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n", ++ intel_encoder->base.base.id, intel_encoder->base.name, ++ port_name(intel_encoder->port), port); ++ return -EINVAL; ++ } ++ + if (!enable) + parm |= 4 << 8; + diff --git a/queue-5.10/exec-force-single-empty-string-when-argv-is-empty.patch b/queue-5.10/exec-force-single-empty-string-when-argv-is-empty.patch new file mode 100644 index 00000000000..d206d622b69 --- /dev/null +++ b/queue-5.10/exec-force-single-empty-string-when-argv-is-empty.patch @@ -0,0 +1,129 @@ +From dcd46d897adb70d63e025f175a00a89797d31a43 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Mon, 31 Jan 2022 16:09:47 -0800 +Subject: exec: Force single empty string when argv is empty + +From: Kees Cook + +commit dcd46d897adb70d63e025f175a00a89797d31a43 upstream. + +Quoting[1] Ariadne Conill: + +"In several other operating systems, it is a hard requirement that the +second argument to execve(2) be the name of a program, thus prohibiting +a scenario where argc < 1. POSIX 2017 also recommends this behaviour, +but it is not an explicit requirement[2]: + + The argument arg0 should point to a filename string that is + associated with the process being started by one of the exec + functions. +... +Interestingly, Michael Kerrisk opened an issue about this in 2008[3], +but there was no consensus to support fixing this issue then. +Hopefully now that CVE-2021-4034 shows practical exploitative use[4] +of this bug in a shellcode, we can reconsider. + +This issue is being tracked in the KSPP issue tracker[5]." + +While the initial code searches[6][7] turned up what appeared to be +mostly corner case tests, trying to that just reject argv == NULL +(or an immediately terminated pointer list) quickly started tripping[8] +existing userspace programs. + +The next best approach is forcing a single empty string into argv and +adjusting argc to match. The number of programs depending on argc == 0 +seems a smaller set than those calling execve with a NULL argv. + +Account for the additional stack space in bprm_stack_limits(). Inject an +empty string when argc == 0 (and set argc = 1). Warn about the case so +userspace has some notice about the change: + + process './argc0' launched './argc0' with NULL argv: empty string added + +Additionally WARN() and reject NULL argv usage for kernel threads. + +[1] https://lore.kernel.org/lkml/20220127000724.15106-1-ariadne@dereferenced.org/ +[2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html +[3] https://bugzilla.kernel.org/show_bug.cgi?id=8408 +[4] https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt +[5] https://github.com/KSPP/linux/issues/176 +[6] https://codesearch.debian.net/search?q=execve%5C+*%5C%28%5B%5E%2C%5D%2B%2C+*NULL&literal=0 +[7] https://codesearch.debian.net/search?q=execlp%3F%5Cs*%5C%28%5B%5E%2C%5D%2B%2C%5Cs*NULL&literal=0 +[8] https://lore.kernel.org/lkml/20220131144352.GE16385@xsang-OptiPlex-9020/ + +Reported-by: Ariadne Conill +Reported-by: Michael Kerrisk +Cc: Matthew Wilcox +Cc: Christian Brauner +Cc: Rich Felker +Cc: Eric Biederman +Cc: Alexander Viro +Cc: linux-fsdevel@vger.kernel.org +Cc: stable@vger.kernel.org +Signed-off-by: Kees Cook +Acked-by: Christian Brauner +Acked-by: Ariadne Conill +Acked-by: Andy Lutomirski +Link: https://lore.kernel.org/r/20220201000947.2453721-1-keescook@chromium.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/exec.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -494,8 +494,14 @@ static int bprm_stack_limits(struct linu + * the stack. They aren't stored until much later when we can't + * signal to the parent that the child has run out of stack space. + * Instead, calculate it here so it's possible to fail gracefully. ++ * ++ * In the case of argc = 0, make sure there is space for adding a ++ * empty string (which will bump argc to 1), to ensure confused ++ * userspace programs don't start processing from argv[1], thinking ++ * argc can never be 0, to keep them from walking envp by accident. ++ * See do_execveat_common(). + */ +- ptr_size = (bprm->argc + bprm->envc) * sizeof(void *); ++ ptr_size = (max(bprm->argc, 1) + bprm->envc) * sizeof(void *); + if (limit <= ptr_size) + return -E2BIG; + limit -= ptr_size; +@@ -1886,6 +1892,9 @@ static int do_execveat_common(int fd, st + } + + retval = count(argv, MAX_ARG_STRINGS); ++ if (retval == 0) ++ pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n", ++ current->comm, bprm->filename); + if (retval < 0) + goto out_free; + bprm->argc = retval; +@@ -1912,6 +1921,19 @@ static int do_execveat_common(int fd, st + if (retval < 0) + goto out_free; + ++ /* ++ * When argv is empty, add an empty string ("") as argv[0] to ++ * ensure confused userspace programs that start processing ++ * from argv[1] won't end up walking envp. See also ++ * bprm_stack_limits(). ++ */ ++ if (bprm->argc == 0) { ++ retval = copy_string_kernel("", bprm); ++ if (retval < 0) ++ goto out_free; ++ bprm->argc = 1; ++ } ++ + retval = bprm_execve(bprm, fd, filename, flags); + out_free: + free_bprm(bprm); +@@ -1940,6 +1962,8 @@ int kernel_execve(const char *kernel_fil + } + + retval = count_strings_kernel(argv); ++ if (WARN_ON_ONCE(retval == 0)) ++ retval = -EINVAL; + if (retval < 0) + goto out_free; + bprm->argc = retval; diff --git a/queue-5.10/ext4-fix-ext4_fc_stats-trace-point.patch b/queue-5.10/ext4-fix-ext4_fc_stats-trace-point.patch new file mode 100644 index 00000000000..a633e609528 --- /dev/null +++ b/queue-5.10/ext4-fix-ext4_fc_stats-trace-point.patch @@ -0,0 +1,136 @@ +From 7af1974af0a9ba8a8ed2e3e947d87dd4d9a78d27 Mon Sep 17 00:00:00 2001 +From: Ritesh Harjani +Date: Sat, 12 Mar 2022 11:09:47 +0530 +Subject: ext4: fix ext4_fc_stats trace point + +From: Ritesh Harjani + +commit 7af1974af0a9ba8a8ed2e3e947d87dd4d9a78d27 upstream. + +ftrace's __print_symbolic() requires that any enum values used in the +symbol to string translation table be wrapped in a TRACE_DEFINE_ENUM +so that the enum value can be decoded from the ftrace ring buffer by +user space tooling. + +This patch also fixes few other problems found in this trace point. +e.g. dereferencing structures in TP_printk which should not be done +at any cost. + +Also to avoid checkpatch warnings, this patch removes those +whitespaces/tab stops issues. + +Cc: stable@kernel.org +Fixes: aa75f4d3daae ("ext4: main fast-commit commit path") +Reported-by: Steven Rostedt +Signed-off-by: Ritesh Harjani +Reviewed-by: Jan Kara +Reviewed-by: Steven Rostedt (Google) +Reviewed-by: Harshad Shirwadkar +Link: https://lore.kernel.org/r/b4b9691414c35c62e570b723e661c80674169f9a.1647057583.git.riteshh@linux.ibm.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman +--- + include/trace/events/ext4.h | 80 +++++++++++++++++++++++++++----------------- + 1 file changed, 50 insertions(+), 30 deletions(-) + +--- a/include/trace/events/ext4.h ++++ b/include/trace/events/ext4.h +@@ -95,6 +95,17 @@ TRACE_DEFINE_ENUM(ES_REFERENCED_B); + { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}, \ + { FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"}) + ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_XATTR); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_CROSS_RENAME); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_NOMEM); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_SWAP_BOOT); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_RESIZE); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_RENAME_DIR); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_FALLOC_RANGE); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_INODE_JOURNAL_DATA); ++TRACE_DEFINE_ENUM(EXT4_FC_REASON_MAX); ++ + #define show_fc_reason(reason) \ + __print_symbolic(reason, \ + { EXT4_FC_REASON_XATTR, "XATTR"}, \ +@@ -2899,41 +2910,50 @@ TRACE_EVENT(ext4_fc_commit_stop, + + #define FC_REASON_NAME_STAT(reason) \ + show_fc_reason(reason), \ +- __entry->sbi->s_fc_stats.fc_ineligible_reason_count[reason] ++ __entry->fc_ineligible_rc[reason] + + TRACE_EVENT(ext4_fc_stats, +- TP_PROTO(struct super_block *sb), ++ TP_PROTO(struct super_block *sb), ++ ++ TP_ARGS(sb), ++ ++ TP_STRUCT__entry( ++ __field(dev_t, dev) ++ __array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX) ++ __field(unsigned long, fc_commits) ++ __field(unsigned long, fc_ineligible_commits) ++ __field(unsigned long, fc_numblks) ++ ), + +- TP_ARGS(sb), ++ TP_fast_assign( ++ int i; + +- TP_STRUCT__entry( +- __field(dev_t, dev) +- __field(struct ext4_sb_info *, sbi) +- __field(int, count) +- ), +- +- TP_fast_assign( +- __entry->dev = sb->s_dev; +- __entry->sbi = EXT4_SB(sb); +- ), +- +- TP_printk("dev %d:%d fc ineligible reasons:\n" +- "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; " +- "num_commits:%ld, ineligible: %ld, numblks: %ld", +- MAJOR(__entry->dev), MINOR(__entry->dev), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE), +- FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA), +- __entry->sbi->s_fc_stats.fc_num_commits, +- __entry->sbi->s_fc_stats.fc_ineligible_commits, +- __entry->sbi->s_fc_stats.fc_numblks) ++ __entry->dev = sb->s_dev; ++ for (i = 0; i < EXT4_FC_REASON_MAX; i++) { ++ __entry->fc_ineligible_rc[i] = ++ EXT4_SB(sb)->s_fc_stats.fc_ineligible_reason_count[i]; ++ } ++ __entry->fc_commits = EXT4_SB(sb)->s_fc_stats.fc_num_commits; ++ __entry->fc_ineligible_commits = ++ EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits; ++ __entry->fc_numblks = EXT4_SB(sb)->s_fc_stats.fc_numblks; ++ ), + ++ TP_printk("dev %d,%d fc ineligible reasons:\n" ++ "%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u " ++ "num_commits:%lu, ineligible: %lu, numblks: %lu", ++ MAJOR(__entry->dev), MINOR(__entry->dev), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE), ++ FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA), ++ __entry->fc_commits, __entry->fc_ineligible_commits, ++ __entry->fc_numblks) + ); + + #define DEFINE_TRACE_DENTRY_EVENT(__type) \ diff --git a/queue-5.10/ext4-fix-fs-corruption-when-tring-to-remove-a-non-empty-directory-with-io-error.patch b/queue-5.10/ext4-fix-fs-corruption-when-tring-to-remove-a-non-empty-directory-with-io-error.patch new file mode 100644 index 00000000000..c251a99523c --- /dev/null +++ b/queue-5.10/ext4-fix-fs-corruption-when-tring-to-remove-a-non-empty-directory-with-io-error.patch @@ -0,0 +1,155 @@ +From 7aab5c84a0f6ec2290e2ba4a6b245178b1bf949a Mon Sep 17 00:00:00 2001 +From: Ye Bin +Date: Mon, 28 Feb 2022 10:48:15 +0800 +Subject: ext4: fix fs corruption when tring to remove a non-empty directory with IO error + +From: Ye Bin + +commit 7aab5c84a0f6ec2290e2ba4a6b245178b1bf949a upstream. + +We inject IO error when rmdir non empty direcory, then got issue as follows: +step1: mkfs.ext4 -F /dev/sda +step2: mount /dev/sda test +step3: cd test +step4: mkdir -p 1/2 +step5: rmdir 1 + [ 110.920551] ext4_empty_dir: inject fault + [ 110.921926] EXT4-fs warning (device sda): ext4_rmdir:3113: inode #12: + comm rmdir: empty directory '1' has too many links (3) +step6: cd .. +step7: umount test +step8: fsck.ext4 -f /dev/sda + e2fsck 1.42.9 (28-Dec-2013) + Pass 1: Checking inodes, blocks, and sizes + Pass 2: Checking directory structure + Entry '..' in .../??? (13) has deleted/unused inode 12. Clear? yes + Pass 3: Checking directory connectivity + Unconnected directory inode 13 (...) + Connect to /lost+found? yes + Pass 4: Checking reference counts + Inode 13 ref count is 3, should be 2. Fix? yes + Pass 5: Checking group summary information + + /dev/sda: ***** FILE SYSTEM WAS MODIFIED ***** + /dev/sda: 12/131072 files (0.0% non-contiguous), 26157/524288 blocks + +ext4_rmdir + if (!ext4_empty_dir(inode)) + goto end_rmdir; +ext4_empty_dir + bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE); + if (IS_ERR(bh)) + return true; +Now if read directory block failed, 'ext4_empty_dir' will return true, assume +directory is empty. Obviously, it will lead to above issue. +To solve this issue, if read directory block failed 'ext4_empty_dir' just +return false. To avoid making things worse when file system is already +corrupted, 'ext4_empty_dir' also return false. + +Signed-off-by: Ye Bin +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20220228024815.3952506-1-yebin10@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/inline.c | 9 ++++----- + fs/ext4/namei.c | 10 +++++----- + 2 files changed, 9 insertions(+), 10 deletions(-) + +--- a/fs/ext4/inline.c ++++ b/fs/ext4/inline.c +@@ -1768,19 +1768,20 @@ bool empty_inline_dir(struct inode *dir, + void *inline_pos; + unsigned int offset; + struct ext4_dir_entry_2 *de; +- bool ret = true; ++ bool ret = false; + + err = ext4_get_inode_loc(dir, &iloc); + if (err) { + EXT4_ERROR_INODE_ERR(dir, -err, + "error %d getting inode %lu block", + err, dir->i_ino); +- return true; ++ return false; + } + + down_read(&EXT4_I(dir)->xattr_sem); + if (!ext4_has_inline_data(dir)) { + *has_inline_data = 0; ++ ret = true; + goto out; + } + +@@ -1789,7 +1790,6 @@ bool empty_inline_dir(struct inode *dir, + ext4_warning(dir->i_sb, + "bad inline directory (dir #%lu) - no `..'", + dir->i_ino); +- ret = true; + goto out; + } + +@@ -1808,16 +1808,15 @@ bool empty_inline_dir(struct inode *dir, + dir->i_ino, le32_to_cpu(de->inode), + le16_to_cpu(de->rec_len), de->name_len, + inline_size); +- ret = true; + goto out; + } + if (le32_to_cpu(de->inode)) { +- ret = false; + goto out; + } + offset += ext4_rec_len_from_disk(de->rec_len, inline_size); + } + ++ ret = true; + out: + up_read(&EXT4_I(dir)->xattr_sem); + brelse(iloc.bh); +--- a/fs/ext4/namei.c ++++ b/fs/ext4/namei.c +@@ -2868,14 +2868,14 @@ bool ext4_empty_dir(struct inode *inode) + sb = inode->i_sb; + if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)) { + EXT4_ERROR_INODE(inode, "invalid size"); +- return true; ++ return false; + } + /* The first directory block must not be a hole, + * so treat it as DIRENT_HTREE + */ + bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE); + if (IS_ERR(bh)) +- return true; ++ return false; + + de = (struct ext4_dir_entry_2 *) bh->b_data; + if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, +@@ -2883,7 +2883,7 @@ bool ext4_empty_dir(struct inode *inode) + le32_to_cpu(de->inode) != inode->i_ino || strcmp(".", de->name)) { + ext4_warning_inode(inode, "directory missing '.'"); + brelse(bh); +- return true; ++ return false; + } + offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); + de = ext4_next_entry(de, sb->s_blocksize); +@@ -2892,7 +2892,7 @@ bool ext4_empty_dir(struct inode *inode) + le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) { + ext4_warning_inode(inode, "directory missing '..'"); + brelse(bh); +- return true; ++ return false; + } + offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); + while (offset < inode->i_size) { +@@ -2906,7 +2906,7 @@ bool ext4_empty_dir(struct inode *inode) + continue; + } + if (IS_ERR(bh)) +- return true; ++ return false; + } + de = (struct ext4_dir_entry_2 *) (bh->b_data + + (offset & (sb->s_blocksize - 1))); diff --git a/queue-5.10/lib-raid6-test-fix-multiple-definition-linking-error.patch b/queue-5.10/lib-raid6-test-fix-multiple-definition-linking-error.patch new file mode 100644 index 00000000000..7d28e22bc6b --- /dev/null +++ b/queue-5.10/lib-raid6-test-fix-multiple-definition-linking-error.patch @@ -0,0 +1,41 @@ +From a5359ddd052860bacf957e65fe819c63e974b3a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dirk=20M=C3=BCller?= +Date: Tue, 8 Feb 2022 17:50:50 +0100 +Subject: lib/raid6/test: fix multiple definition linking error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dirk Müller + +commit a5359ddd052860bacf957e65fe819c63e974b3a6 upstream. + +GCC 10+ defaults to -fno-common, which enforces proper declaration of +external references using "extern". without this change a link would +fail with: + + lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; + lib/raid6/test/test.c:22: first defined here + +the pq.h header that is included already includes an extern declaration +so we can just remove the redundant one here. + +Cc: +Signed-off-by: Dirk Müller +Reviewed-by: Paul Menzel +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman +--- + lib/raid6/test/test.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/lib/raid6/test/test.c ++++ b/lib/raid6/test/test.c +@@ -19,7 +19,6 @@ + #define NDISKS 16 /* Including P and Q */ + + const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); +-struct raid6_calls raid6_call; + + char *dataptrs[NDISKS]; + char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); diff --git a/queue-5.10/mailbox-tegra-hsp-flush-whole-channel.patch b/queue-5.10/mailbox-tegra-hsp-flush-whole-channel.patch new file mode 100644 index 00000000000..3c60c47cd6c --- /dev/null +++ b/queue-5.10/mailbox-tegra-hsp-flush-whole-channel.patch @@ -0,0 +1,41 @@ +From 60de2d2dc284e0dd1c2c897d08625bde24ef3454 Mon Sep 17 00:00:00 2001 +From: Pekka Pessi +Date: Wed, 2 Mar 2022 16:04:24 +0100 +Subject: mailbox: tegra-hsp: Flush whole channel + +From: Pekka Pessi + +commit 60de2d2dc284e0dd1c2c897d08625bde24ef3454 upstream. + +The txdone can re-fill the mailbox. Keep polling the mailbox during the +flush until all the messages have been delivered. + +This fixes an issue with the Tegra Combined UART (TCU) where output can +get truncated under high traffic load. + +Signed-off-by: Pekka Pessi +Tested-by: Jon Hunter +Fixes: 91b1b1c3da8a ("mailbox: tegra-hsp: Add support for shared mailboxes") +Cc: stable@vger.kernel.org +Signed-off-by: Thierry Reding +Reviewed-by: Jon Hunter +Signed-off-by: Jassi Brar +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mailbox/tegra-hsp.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/mailbox/tegra-hsp.c ++++ b/drivers/mailbox/tegra-hsp.c +@@ -410,6 +410,11 @@ static int tegra_hsp_mailbox_flush(struc + value = tegra_hsp_channel_readl(ch, HSP_SM_SHRD_MBOX); + if ((value & HSP_SM_SHRD_MBOX_FULL) == 0) { + mbox_chan_txdone(chan, 0); ++ ++ /* Wait until channel is empty */ ++ if (chan->active_req != NULL) ++ continue; ++ + return 0; + } + diff --git a/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch b/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch new file mode 100644 index 00000000000..02a6ecdf9f4 --- /dev/null +++ b/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch @@ -0,0 +1,56 @@ +From d42b3ad105b5d3481f6a56bc789aa2b27aa09325 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 22 Dec 2021 15:20:23 +0100 +Subject: media: davinci: vpif: fix unbalanced runtime PM enable + +From: Johan Hovold + +commit d42b3ad105b5d3481f6a56bc789aa2b27aa09325 upstream. + +Make sure to disable runtime PM before returning on probe errors. + +Fixes: 479f7a118105 ("[media] davinci: vpif: adaptions for DT support") +Cc: stable@vger.kernel.org +Cc: Kevin Hilman +Signed-off-by: Johan Hovold +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/davinci/vpif.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/media/platform/davinci/vpif.c ++++ b/drivers/media/platform/davinci/vpif.c +@@ -428,6 +428,7 @@ static int vpif_probe(struct platform_de + static struct resource *res, *res_irq; + struct platform_device *pdev_capture, *pdev_display; + struct device_node *endpoint = NULL; ++ int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + vpif_base = devm_ioremap_resource(&pdev->dev, res); +@@ -458,8 +459,8 @@ static int vpif_probe(struct platform_de + res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res_irq) { + dev_warn(&pdev->dev, "Missing IRQ resource.\n"); +- pm_runtime_put(&pdev->dev); +- return -EINVAL; ++ ret = -EINVAL; ++ goto err_put_rpm; + } + + pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture), +@@ -493,6 +494,12 @@ static int vpif_probe(struct platform_de + } + + return 0; ++ ++err_put_rpm: ++ pm_runtime_put(&pdev->dev); ++ pm_runtime_disable(&pdev->dev); ++ ++ return ret; + } + + static int vpif_remove(struct platform_device *pdev) diff --git a/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch b/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch new file mode 100644 index 00000000000..2a07e033d1e --- /dev/null +++ b/queue-5.10/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch @@ -0,0 +1,33 @@ +From 4a321de239213300a714fa0353a5f1272d381a44 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 22 Dec 2021 15:20:22 +0100 +Subject: media: davinci: vpif: fix unbalanced runtime PM get + +From: Johan Hovold + +commit 4a321de239213300a714fa0353a5f1272d381a44 upstream. + +Make sure to balance the runtime PM usage counter on driver unbind. + +Fixes: 407ccc65bfd2 ("[media] davinci: vpif: add pm_runtime support") +Cc: stable@vger.kernel.org # 3.9 +Cc: Lad, Prabhakar +Signed-off-by: Johan Hovold +Reviewed-by: Lad Prabhakar +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/davinci/vpif.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/media/platform/davinci/vpif.c ++++ b/drivers/media/platform/davinci/vpif.c +@@ -497,6 +497,7 @@ static int vpif_probe(struct platform_de + + static int vpif_remove(struct platform_device *pdev) + { ++ pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return 0; + } diff --git a/queue-5.10/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch b/queue-5.10/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch new file mode 100644 index 00000000000..f7a3d0e1838 --- /dev/null +++ b/queue-5.10/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch @@ -0,0 +1,79 @@ +From 5ad05ecad4326ddaa26a83ba2233a67be24c1aaa Mon Sep 17 00:00:00 2001 +From: Sean Young +Date: Sun, 20 Feb 2022 15:28:24 +0100 +Subject: media: gpio-ir-tx: fix transmit with long spaces on Orange Pi PC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Sean Young + +commit 5ad05ecad4326ddaa26a83ba2233a67be24c1aaa upstream. + +Calling udelay for than 1000us does not always yield the correct +results. + +Cc: stable@vger.kernel.org +Reported-by: Михаил +Signed-off-by: Sean Young +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/rc/gpio-ir-tx.c | 28 +++++++++++++++++++++------- + 1 file changed, 21 insertions(+), 7 deletions(-) + +--- a/drivers/media/rc/gpio-ir-tx.c ++++ b/drivers/media/rc/gpio-ir-tx.c +@@ -48,11 +48,29 @@ static int gpio_ir_tx_set_carrier(struct + return 0; + } + ++static void delay_until(ktime_t until) ++{ ++ /* ++ * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on ++ * m68k ndelay(s64) does not compile; so use s32 rather than s64. ++ */ ++ s32 delta; ++ ++ while (true) { ++ delta = ktime_us_delta(until, ktime_get()); ++ if (delta <= 0) ++ return; ++ ++ /* udelay more than 1ms may not work */ ++ delta = min(delta, 1000); ++ udelay(delta); ++ } ++} ++ + static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, + uint count) + { + ktime_t edge; +- s32 delta; + int i; + + local_irq_disable(); +@@ -63,9 +81,7 @@ static void gpio_ir_tx_unmodulated(struc + gpiod_set_value(gpio_ir->gpio, !(i % 2)); + + edge = ktime_add_us(edge, txbuf[i]); +- delta = ktime_us_delta(edge, ktime_get()); +- if (delta > 0) +- udelay(delta); ++ delay_until(edge); + } + + gpiod_set_value(gpio_ir->gpio, 0); +@@ -97,9 +113,7 @@ static void gpio_ir_tx_modulated(struct + if (i % 2) { + // space + edge = ktime_add_us(edge, txbuf[i]); +- delta = ktime_us_delta(edge, ktime_get()); +- if (delta > 0) +- udelay(delta); ++ delay_until(edge); + } else { + // pulse + ktime_t last = ktime_add_us(edge, txbuf[i]); diff --git a/queue-5.10/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch b/queue-5.10/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch new file mode 100644 index 00000000000..97237af8cb3 --- /dev/null +++ b/queue-5.10/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch @@ -0,0 +1,83 @@ +From 028a73e10705af1ffd51f2537460f616dc58680e Mon Sep 17 00:00:00 2001 +From: Jocelyn Falempe +Date: Wed, 19 Jan 2022 11:29:05 +0100 +Subject: mgag200 fix memmapsl configuration in GCTL6 register +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jocelyn Falempe + +commit 028a73e10705af1ffd51f2537460f616dc58680e upstream. + +On some servers with MGA G200_SE_A (rev 42), booting with Legacy BIOS, +the hardware hangs when using kdump and kexec into the kdump kernel. +This happens when the uncompress code tries to write "Decompressing Linux" +to the VGA Console. + +It can be reproduced by writing to the VGA console (0xB8000) after +booting to graphic mode, it generates the following error: + +kernel:NMI: PCI system error (SERR) for reason a0 on CPU 0. +kernel:Dazed and confused, but trying to continue + +The root cause is the configuration of the MGA GCTL6 register + +According to the GCTL6 register documentation: + +bit 0 is gcgrmode: + 0: Enables alpha mode, and the character generator addressing system is + activated. + 1: Enables graphics mode, and the character addressing system is not + used. + +bit 1 is chainodd even: + 0: The A0 signal of the memory address bus is used during system memory + addressing. + 1: Allows A0 to be replaced by either the A16 signal of the system + address (ifmemmapsl is ‘00’), or by the hpgoddev (MISC<5>, odd/even + page select) field, described on page 3-294). + +bit 3-2 are memmapsl: + Memory map select bits 1 and 0. VGA. + These bits select where the video memory is mapped, as shown below: + 00 => A0000h - BFFFFh + 01 => A0000h - AFFFFh + 10 => B0000h - B7FFFh + 11 => B8000h - BFFFFh + +bit 7-4 are reserved. + +Current code set it to 0x05 => memmapsl to b01 => 0xa0000 (graphic mode) +But on x86, the VGA console is at 0xb8000 (text mode) +In arch/x86/boot/compressed/misc.c debug strings are written to 0xb8000 +As the driver doesn't use this mapping at 0xa0000, it is safe to set it to +0xb8000 instead, to avoid kernel hang on G200_SE_A rev42, with kexec/kdump. + +Thus changing the value 0x05 to 0x0d + +Signed-off-by: Jocelyn Falempe +Reviewed-by: Javier Martinez Canillas +Acked-by: Lyude Paul +Cc: stable@vger.kernel.org +Signed-off-by: Thomas Zimmermann +Link: https://patchwork.freedesktop.org/patch/msgid/20220119102905.1194787-1-jfalempe@redhat.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/mgag200/mgag200_mode.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/mgag200/mgag200_mode.c ++++ b/drivers/gpu/drm/mgag200/mgag200_mode.c +@@ -1243,7 +1243,10 @@ static void mgag200_set_format_regs(stru + WREG_GFX(3, 0x00); + WREG_GFX(4, 0x00); + WREG_GFX(5, 0x40); +- WREG_GFX(6, 0x05); ++ /* GCTL6 should be 0x05, but we configure memmapsl to 0xb8000 (text mode), ++ * so that it doesn't hang when running kexec/kdump on G200_SE rev42. ++ */ ++ WREG_GFX(6, 0x0d); + WREG_GFX(7, 0x0f); + WREG_GFX(8, 0x0f); + diff --git a/queue-5.10/mm-hwpoison-unmap-poisoned-page-before-invalidation.patch b/queue-5.10/mm-hwpoison-unmap-poisoned-page-before-invalidation.patch new file mode 100644 index 00000000000..e4c9a703ccd --- /dev/null +++ b/queue-5.10/mm-hwpoison-unmap-poisoned-page-before-invalidation.patch @@ -0,0 +1,67 @@ +From 3149c79f3cb0e2e3bafb7cfadacec090cbd250d3 Mon Sep 17 00:00:00 2001 +From: Rik van Riel +Date: Fri, 1 Apr 2022 11:28:42 -0700 +Subject: mm,hwpoison: unmap poisoned page before invalidation + +From: Rik van Riel + +commit 3149c79f3cb0e2e3bafb7cfadacec090cbd250d3 upstream. + +In some cases it appears the invalidation of a hwpoisoned page fails +because the page is still mapped in another process. This can cause a +program to be continuously restarted and die when it page faults on the +page that was not invalidated. Avoid that problem by unmapping the +hwpoisoned page when we find it. + +Another issue is that sometimes we end up oopsing in finish_fault, if +the code tries to do something with the now-NULL vmf->page. I did not +hit this error when submitting the previous patch because there are +several opportunities for alloc_set_pte to bail out before accessing +vmf->page, and that apparently happened on those systems, and most of +the time on other systems, too. + +However, across several million systems that error does occur a handful +of times a day. It can be avoided by returning VM_FAULT_NOPAGE which +will cause do_read_fault to return before calling finish_fault. + +Link: https://lkml.kernel.org/r/20220325161428.5068d97e@imladris.surriel.com +Fixes: e53ac7374e64 ("mm: invalidate hwpoison page cache page in fault path") +Signed-off-by: Rik van Riel +Reviewed-by: Miaohe Lin +Tested-by: Naoya Horiguchi +Reviewed-by: Oscar Salvador +Cc: Mel Gorman +Cc: Johannes Weiner +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/memory.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -3676,14 +3676,18 @@ static vm_fault_t __do_fault(struct vm_f + return ret; + + if (unlikely(PageHWPoison(vmf->page))) { ++ struct page *page = vmf->page; + vm_fault_t poisonret = VM_FAULT_HWPOISON; + if (ret & VM_FAULT_LOCKED) { ++ if (page_mapped(page)) ++ unmap_mapping_pages(page_mapping(page), ++ page->index, 1, false); + /* Retry if a clean page was removed from the cache. */ +- if (invalidate_inode_page(vmf->page)) +- poisonret = 0; +- unlock_page(vmf->page); ++ if (invalidate_inode_page(page)) ++ poisonret = VM_FAULT_NOPAGE; ++ unlock_page(page); + } +- put_page(vmf->page); ++ put_page(page); + vmf->page = NULL; + return poisonret; + } diff --git a/queue-5.10/mm-kmemleak-reset-tag-when-compare-object-pointer.patch b/queue-5.10/mm-kmemleak-reset-tag-when-compare-object-pointer.patch new file mode 100644 index 00000000000..6c6cb4a0db8 --- /dev/null +++ b/queue-5.10/mm-kmemleak-reset-tag-when-compare-object-pointer.patch @@ -0,0 +1,99 @@ +From bfc8089f00fa526dea983844c880fa8106c33ac4 Mon Sep 17 00:00:00 2001 +From: Kuan-Ying Lee +Date: Fri, 1 Apr 2022 11:28:54 -0700 +Subject: mm/kmemleak: reset tag when compare object pointer + +From: Kuan-Ying Lee + +commit bfc8089f00fa526dea983844c880fa8106c33ac4 upstream. + +When we use HW-tag based kasan and enable vmalloc support, we hit the +following bug. It is due to comparison between tagged object and +non-tagged pointer. + +We need to reset the kasan tag when we need to compare tagged object and +non-tagged pointer. + + kmemleak: [name:kmemleak&]Scan area larger than object 0xffffffe77076f440 + CPU: 4 PID: 1 Comm: init Tainted: G S W 5.15.25-android13-0-g5cacf919c2bc #1 + Hardware name: MT6983(ENG) (DT) + Call trace: + add_scan_area+0xc4/0x244 + kmemleak_scan_area+0x40/0x9c + layout_and_allocate+0x1e8/0x288 + load_module+0x2c8/0xf00 + __se_sys_finit_module+0x190/0x1d0 + __arm64_sys_finit_module+0x20/0x30 + invoke_syscall+0x60/0x170 + el0_svc_common+0xc8/0x114 + do_el0_svc+0x28/0xa0 + el0_svc+0x60/0xf8 + el0t_64_sync_handler+0x88/0xec + el0t_64_sync+0x1b4/0x1b8 + kmemleak: [name:kmemleak&]Object 0xf5ffffe77076b000 (size 32768): + kmemleak: [name:kmemleak&] comm "init", pid 1, jiffies 4294894197 + kmemleak: [name:kmemleak&] min_count = 0 + kmemleak: [name:kmemleak&] count = 0 + kmemleak: [name:kmemleak&] flags = 0x1 + kmemleak: [name:kmemleak&] checksum = 0 + kmemleak: [name:kmemleak&] backtrace: + module_alloc+0x9c/0x120 + move_module+0x34/0x19c + layout_and_allocate+0x1c4/0x288 + load_module+0x2c8/0xf00 + __se_sys_finit_module+0x190/0x1d0 + __arm64_sys_finit_module+0x20/0x30 + invoke_syscall+0x60/0x170 + el0_svc_common+0xc8/0x114 + do_el0_svc+0x28/0xa0 + el0_svc+0x60/0xf8 + el0t_64_sync_handler+0x88/0xec + el0t_64_sync+0x1b4/0x1b8 + +Link: https://lkml.kernel.org/r/20220318034051.30687-1-Kuan-Ying.Lee@mediatek.com +Signed-off-by: Kuan-Ying Lee +Reviewed-by: Catalin Marinas +Cc: Matthias Brugger +Cc: Chinwen Chang +Cc: Nicholas Tang +Cc: Yee Lee +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/kmemleak.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/mm/kmemleak.c ++++ b/mm/kmemleak.c +@@ -787,6 +787,8 @@ static void add_scan_area(unsigned long + unsigned long flags; + struct kmemleak_object *object; + struct kmemleak_scan_area *area = NULL; ++ unsigned long untagged_ptr; ++ unsigned long untagged_objp; + + object = find_and_get_object(ptr, 1); + if (!object) { +@@ -795,6 +797,9 @@ static void add_scan_area(unsigned long + return; + } + ++ untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr); ++ untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer); ++ + if (scan_area_cache) + area = kmem_cache_alloc(scan_area_cache, gfp_kmemleak_mask(gfp)); + +@@ -806,8 +811,8 @@ static void add_scan_area(unsigned long + goto out_unlock; + } + if (size == SIZE_MAX) { +- size = object->pointer + object->size - ptr; +- } else if (ptr + size > object->pointer + object->size) { ++ size = untagged_objp + object->size - untagged_ptr; ++ } else if (untagged_ptr + size > untagged_objp + object->size) { + kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr); + dump_object_info(object); + kmem_cache_free(scan_area_cache, area); diff --git a/queue-5.10/mm-madvise-return-correct-bytes-advised-with-process_madvise.patch b/queue-5.10/mm-madvise-return-correct-bytes-advised-with-process_madvise.patch new file mode 100644 index 00000000000..9c4cdd3738d --- /dev/null +++ b/queue-5.10/mm-madvise-return-correct-bytes-advised-with-process_madvise.patch @@ -0,0 +1,64 @@ +From 5bd009c7c9a9e888077c07535dc0c70aeab242c3 Mon Sep 17 00:00:00 2001 +From: Charan Teja Kalla +Date: Tue, 22 Mar 2022 14:46:44 -0700 +Subject: mm: madvise: return correct bytes advised with process_madvise + +From: Charan Teja Kalla + +commit 5bd009c7c9a9e888077c07535dc0c70aeab242c3 upstream. + +Patch series "mm: madvise: return correct bytes processed with +process_madvise", v2. With the process_madvise(), always choose to return +non zero processed bytes over an error. This can help the user to know on +which VMA, passed in the 'struct iovec' vector list, is failed to advise +thus can take the decission of retrying/skipping on that VMA. + +This patch (of 2): + +The process_madvise() system call returns error even after processing some +VMA's passed in the 'struct iovec' vector list which leaves the user +confused to know where to restart the advise next. It is also against +this syscall man page[1] documentation where it mentions that "return +value may be less than the total number of requested bytes, if an error +occurred after some iovec elements were already processed.". + +Consider a user passed 10 VMA's in the 'struct iovec' vector list of which +9 are processed but one. Then it just returns the error caused on that +failed VMA despite the first 9 VMA's processed, leaving the user confused +about on which VMA it is failed. Returning the number of bytes processed +here can help the user to know which VMA it is failed on and thus can +retry/skip the advise on that VMA. + +[1]https://man7.org/linux/man-pages/man2/process_madvise.2.html. + +Link: https://lkml.kernel.org/r/cover.1647008754.git.quic_charante@quicinc.com +Link: https://lkml.kernel.org/r/125b61a0edcee5c2db8658aed9d06a43a19ccafc.1647008754.git.quic_charante@quicinc.com +Fixes: ecb8ac8b1f14("mm/madvise: introduce process_madvise() syscall: an external memory hinting API") +Signed-off-by: Charan Teja Kalla +Cc: Suren Baghdasaryan +Cc: Vlastimil Babka +Cc: David Rientjes +Cc: Stephen Rothwell +Cc: Minchan Kim +Cc: Nadav Amit +Cc: Michal Hocko +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/madvise.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/mm/madvise.c ++++ b/mm/madvise.c +@@ -1236,8 +1236,7 @@ SYSCALL_DEFINE5(process_madvise, int, pi + iov_iter_advance(&iter, iovec.iov_len); + } + +- if (ret == 0) +- ret = total_len - iov_iter_count(&iter); ++ ret = (total_len - iov_iter_count(&iter)) ? : ret; + + release_mm: + mmput(mm); diff --git a/queue-5.10/mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch b/queue-5.10/mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch new file mode 100644 index 00000000000..23ce62c0154 --- /dev/null +++ b/queue-5.10/mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch @@ -0,0 +1,57 @@ +From 08095d6310a7ce43256b4251577bc66a25c6e1a6 Mon Sep 17 00:00:00 2001 +From: Charan Teja Kalla +Date: Tue, 22 Mar 2022 14:46:48 -0700 +Subject: mm: madvise: skip unmapped vma holes passed to process_madvise + +From: Charan Teja Kalla + +commit 08095d6310a7ce43256b4251577bc66a25c6e1a6 upstream. + +The process_madvise() system call is expected to skip holes in vma passed +through 'struct iovec' vector list. But do_madvise, which +process_madvise() calls for each vma, returns ENOMEM in case of unmapped +holes, despite the VMA is processed. + +Thus process_madvise() should treat ENOMEM as expected and consider the +VMA passed to as processed and continue processing other vma's in the +vector list. Returning -ENOMEM to user, despite the VMA is processed, +will be unable to figure out where to start the next madvise. + +Link: https://lkml.kernel.org/r/4f091776142f2ebf7b94018146de72318474e686.1647008754.git.quic_charante@quicinc.com +Fixes: ecb8ac8b1f14("mm/madvise: introduce process_madvise() syscall: an external memory hinting API") +Signed-off-by: Charan Teja Kalla +Cc: David Rientjes +Cc: Michal Hocko +Cc: Minchan Kim +Cc: Nadav Amit +Cc: Stephen Rothwell +Cc: Suren Baghdasaryan +Cc: Vlastimil Babka +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/madvise.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/mm/madvise.c ++++ b/mm/madvise.c +@@ -1222,9 +1222,16 @@ SYSCALL_DEFINE5(process_madvise, int, pi + + while (iov_iter_count(&iter)) { + iovec = iov_iter_iovec(&iter); ++ /* ++ * do_madvise returns ENOMEM if unmapped holes are present ++ * in the passed VMA. process_madvise() is expected to skip ++ * unmapped holes passed to it in the 'struct iovec' list ++ * and not fail because of them. Thus treat -ENOMEM return ++ * from do_madvise as valid and continue processing. ++ */ + ret = do_madvise(mm, (unsigned long)iovec.iov_base, + iovec.iov_len, behavior); +- if (ret < 0) ++ if (ret < 0 && ret != -ENOMEM) + break; + iov_iter_advance(&iter, iovec.iov_len); + } diff --git a/queue-5.10/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch b/queue-5.10/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch new file mode 100644 index 00000000000..0b559c27153 --- /dev/null +++ b/queue-5.10/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch @@ -0,0 +1,53 @@ +From 92912b175178c7e895f5e5e9f1e30ac30319162b Mon Sep 17 00:00:00 2001 +From: Liguang Zhang +Date: Thu, 11 Nov 2021 13:42:58 +0800 +Subject: PCI: pciehp: Clear cmd_busy bit in polling mode + +From: Liguang Zhang + +commit 92912b175178c7e895f5e5e9f1e30ac30319162b upstream. + +Writes to a Downstream Port's Slot Control register are PCIe hotplug +"commands." If the Port supports Command Completed events, software must +wait for a command to complete before writing to Slot Control again. + +pcie_do_write_cmd() sets ctrl->cmd_busy when it writes to Slot Control. If +software notification is enabled, i.e., PCI_EXP_SLTCTL_HPIE and +PCI_EXP_SLTCTL_CCIE are set, ctrl->cmd_busy is cleared by pciehp_isr(). + +But when software notification is disabled, as it is when pcie_init() +powers off an empty slot, pcie_wait_cmd() uses pcie_poll_cmd() to poll for +command completion, and it neglects to clear ctrl->cmd_busy, which leads to +spurious timeouts: + + pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x01c0 (issued 2264 msec ago) + pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x05c0 (issued 2288 msec ago) + +Clear ctrl->cmd_busy in pcie_poll_cmd() when it detects a Command Completed +event (PCI_EXP_SLTSTA_CC). + +[bhelgaas: commit log] +Fixes: a5dd4b4b0570 ("PCI: pciehp: Wait for hotplug command completion where necessary") +Link: https://lore.kernel.org/r/20211111054258.7309-1-zhangliguang@linux.alibaba.com +Link: https://bugzilla.kernel.org/show_bug.cgi?id=215143 +Link: https://lore.kernel.org/r/20211126173309.GA12255@wunner.de +Signed-off-by: Liguang Zhang +Signed-off-by: Bjorn Helgaas +Reviewed-by: Lukas Wunner +Cc: stable@vger.kernel.org # v4.19+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/hotplug/pciehp_hpc.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -98,6 +98,8 @@ static int pcie_poll_cmd(struct controll + if (slot_status & PCI_EXP_SLTSTA_CC) { + pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, + PCI_EXP_SLTSTA_CC); ++ ctrl->cmd_busy = 0; ++ smp_mb(); + return 1; + } + msleep(10); diff --git a/queue-5.10/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch b/queue-5.10/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch new file mode 100644 index 00000000000..6639fb8ee3c --- /dev/null +++ b/queue-5.10/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch @@ -0,0 +1,49 @@ +From 825da4e9cec68713fbb02dc6f71fe1bf65fe8050 Mon Sep 17 00:00:00 2001 +From: Marc Zyngier +Date: Mon, 21 Mar 2022 10:48:43 +0000 +Subject: PCI: xgene: Revert "PCI: xgene: Fix IB window setup" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marc Zyngier + +commit 825da4e9cec68713fbb02dc6f71fe1bf65fe8050 upstream. + +Commit c7a75d07827a ("PCI: xgene: Fix IB window setup") tried to +fix the damages that 6dce5aa59e0b ("PCI: xgene: Use inbound resources +for setup") caused, but actually didn't improve anything for some +plarforms (at least Mustang and m400 are still broken). + +Given that 6dce5aa59e0b has been reverted, revert this patch as well, +restoring the PCIe support on XGene to its pre-5.5, working state. + +Link: https://lore.kernel.org/r/YjN8pT5e6/8cRohQ@xps13.dannf +Link: https://lore.kernel.org/r/20220321104843.949645-3-maz@kernel.org +Fixes: c7a75d07827a ("PCI: xgene: Fix IB window setup") +Signed-off-by: Marc Zyngier +Signed-off-by: Lorenzo Pieralisi +Cc: stable@vger.kernel.org +Cc: Rob Herring +Cc: Toan Le +Cc: Lorenzo Pieralisi +Cc: Krzysztof Wilczyński +Cc: Bjorn Helgaas +Cc: Stéphane Graber +Cc: dann frazier +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/pci-xgene.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pci/controller/pci-xgene.c ++++ b/drivers/pci/controller/pci-xgene.c +@@ -467,7 +467,7 @@ static int xgene_pcie_select_ib_reg(u8 * + return 1; + } + +- if ((size > SZ_1K) && (size < SZ_4G) && !(*ib_reg_mask & (1 << 0))) { ++ if ((size > SZ_1K) && (size < SZ_1T) && !(*ib_reg_mask & (1 << 0))) { + *ib_reg_mask |= (1 << 0); + return 0; + } diff --git a/queue-5.10/powerpc-kvm-fix-kvm_use_magic_page.patch b/queue-5.10/powerpc-kvm-fix-kvm_use_magic_page.patch new file mode 100644 index 00000000000..9458680f24a --- /dev/null +++ b/queue-5.10/powerpc-kvm-fix-kvm_use_magic_page.patch @@ -0,0 +1,33 @@ +From 0c8eb2884a42d992c7726539328b7d3568f22143 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +Date: Mon, 2 Aug 2021 13:46:19 +0200 +Subject: powerpc/kvm: Fix kvm_use_magic_page + +From: Andreas Gruenbacher + +commit 0c8eb2884a42d992c7726539328b7d3568f22143 upstream. + +When switching from __get_user to fault_in_pages_readable, commit +9f9eae5ce717 broke kvm_use_magic_page: like __get_user, +fault_in_pages_readable returns 0 on success. + +Fixes: 9f9eae5ce717 ("powerpc/kvm: Prefer fault_in_pages_readable function") +Cc: stable@vger.kernel.org # v4.18+ +Signed-off-by: Andreas Gruenbacher +Signed-off-by: Anand Jain +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/kernel/kvm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/powerpc/kernel/kvm.c ++++ b/arch/powerpc/kernel/kvm.c +@@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(vo + on_each_cpu(kvm_map_magic_page, &features, 1); + + /* Quick self-test to see if the mapping works */ +- if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { ++ if (fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { + kvm_patching_worked = false; + return; + } diff --git a/queue-5.10/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch b/queue-5.10/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch new file mode 100644 index 00000000000..79ba46cd58b --- /dev/null +++ b/queue-5.10/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch @@ -0,0 +1,170 @@ +From 8126b1c73108bc691f5643df19071a59a69d0bc6 Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Mon, 14 Mar 2022 19:59:53 +0100 +Subject: pstore: Don't use semaphores in always-atomic-context code + +From: Jann Horn + +commit 8126b1c73108bc691f5643df19071a59a69d0bc6 upstream. + +pstore_dump() is *always* invoked in atomic context (nowadays in an RCU +read-side critical section, before that under a spinlock). +It doesn't make sense to try to use semaphores here. + +This is mostly a revert of commit ea84b580b955 ("pstore: Convert buf_lock +to semaphore"), except that two parts aren't restored back exactly as they +were: + + - keep the lock initialization in pstore_register + - in efi_pstore_write(), always set the "block" flag to false + - omit "is_locked", that was unnecessary since + commit 959217c84c27 ("pstore: Actually give up during locking failure") + - fix the bailout message + +The actual problem that the buggy commit was trying to address may have +been that the use of preemptible() in efi_pstore_write() was wrong - it +only looks at preempt_count() and the state of IRQs, but __rcu_read_lock() +doesn't touch either of those under CONFIG_PREEMPT_RCU. +(Sidenote: CONFIG_PREEMPT_RCU means that the scheduler can preempt tasks in +RCU read-side critical sections, but you're not allowed to actively +block/reschedule.) + +Lockdep probably never caught the problem because it's very rare that you +actually hit the contended case, so lockdep always just sees the +down_trylock(), not the down_interruptible(), and so it can't tell that +there's a problem. + +Fixes: ea84b580b955 ("pstore: Convert buf_lock to semaphore") +Cc: stable@vger.kernel.org +Acked-by: Sebastian Andrzej Siewior +Signed-off-by: Jann Horn +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/20220314185953.2068993-1-jannh@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/efi/efi-pstore.c | 2 +- + fs/pstore/platform.c | 38 ++++++++++++++++++-------------------- + include/linux/pstore.h | 6 +++--- + 3 files changed, 22 insertions(+), 24 deletions(-) + +--- a/drivers/firmware/efi/efi-pstore.c ++++ b/drivers/firmware/efi/efi-pstore.c +@@ -266,7 +266,7 @@ static int efi_pstore_write(struct pstor + efi_name[i] = name[i]; + + ret = efivar_entry_set_safe(efi_name, vendor, PSTORE_EFI_ATTRIBUTES, +- preemptible(), record->size, record->psi->buf); ++ false, record->size, record->psi->buf); + + if (record->reason == KMSG_DUMP_OOPS && try_module_get(THIS_MODULE)) + if (!schedule_work(&efivar_work)) +--- a/fs/pstore/platform.c ++++ b/fs/pstore/platform.c +@@ -143,21 +143,22 @@ static void pstore_timer_kick(void) + mod_timer(&pstore_timer, jiffies + msecs_to_jiffies(pstore_update_ms)); + } + +-/* +- * Should pstore_dump() wait for a concurrent pstore_dump()? If +- * not, the current pstore_dump() will report a failure to dump +- * and return. +- */ +-static bool pstore_cannot_wait(enum kmsg_dump_reason reason) ++static bool pstore_cannot_block_path(enum kmsg_dump_reason reason) + { +- /* In NMI path, pstore shouldn't block regardless of reason. */ ++ /* ++ * In case of NMI path, pstore shouldn't be blocked ++ * regardless of reason. ++ */ + if (in_nmi()) + return true; + + switch (reason) { + /* In panic case, other cpus are stopped by smp_send_stop(). */ + case KMSG_DUMP_PANIC: +- /* Emergency restart shouldn't be blocked. */ ++ /* ++ * Emergency restart shouldn't be blocked by spinning on ++ * pstore_info::buf_lock. ++ */ + case KMSG_DUMP_EMERG: + return true; + default: +@@ -388,21 +389,19 @@ static void pstore_dump(struct kmsg_dump + unsigned long total = 0; + const char *why; + unsigned int part = 1; ++ unsigned long flags = 0; + int ret; + + why = kmsg_dump_reason_str(reason); + +- if (down_trylock(&psinfo->buf_lock)) { +- /* Failed to acquire lock: give up if we cannot wait. */ +- if (pstore_cannot_wait(reason)) { +- pr_err("dump skipped in %s path: may corrupt error record\n", +- in_nmi() ? "NMI" : why); +- return; +- } +- if (down_interruptible(&psinfo->buf_lock)) { +- pr_err("could not grab semaphore?!\n"); ++ if (pstore_cannot_block_path(reason)) { ++ if (!spin_trylock_irqsave(&psinfo->buf_lock, flags)) { ++ pr_err("dump skipped in %s path because of concurrent dump\n", ++ in_nmi() ? "NMI" : why); + return; + } ++ } else { ++ spin_lock_irqsave(&psinfo->buf_lock, flags); + } + + oopscount++; +@@ -464,8 +463,7 @@ static void pstore_dump(struct kmsg_dump + total += record.size; + part++; + } +- +- up(&psinfo->buf_lock); ++ spin_unlock_irqrestore(&psinfo->buf_lock, flags); + } + + static struct kmsg_dumper pstore_dumper = { +@@ -591,7 +589,7 @@ int pstore_register(struct pstore_info * + psi->write_user = pstore_write_user_compat; + psinfo = psi; + mutex_init(&psinfo->read_mutex); +- sema_init(&psinfo->buf_lock, 1); ++ spin_lock_init(&psinfo->buf_lock); + + if (psi->flags & PSTORE_FLAGS_DMESG) + allocate_buf_for_compression(); +--- a/include/linux/pstore.h ++++ b/include/linux/pstore.h +@@ -14,7 +14,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + +@@ -87,7 +87,7 @@ struct pstore_record { + * @owner: module which is responsible for this backend driver + * @name: name of the backend driver + * +- * @buf_lock: semaphore to serialize access to @buf ++ * @buf_lock: spinlock to serialize access to @buf + * @buf: preallocated crash dump buffer + * @bufsize: size of @buf available for crash dump bytes (must match + * smallest number of bytes available for writing to a +@@ -178,7 +178,7 @@ struct pstore_info { + struct module *owner; + const char *name; + +- struct semaphore buf_lock; ++ spinlock_t buf_lock; + char *buf; + size_t bufsize; + diff --git a/queue-5.10/revert-mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch b/queue-5.10/revert-mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch new file mode 100644 index 00000000000..aafcbebd3d8 --- /dev/null +++ b/queue-5.10/revert-mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch @@ -0,0 +1,57 @@ +From e6b0a7b357659c332231621e4315658d062c23ee Mon Sep 17 00:00:00 2001 +From: Charan Teja Kalla +Date: Fri, 1 Apr 2022 11:28:12 -0700 +Subject: Revert "mm: madvise: skip unmapped vma holes passed to process_madvise" + +From: Charan Teja Kalla + +commit e6b0a7b357659c332231621e4315658d062c23ee upstream. + +This reverts commit 08095d6310a7 ("mm: madvise: skip unmapped vma holes +passed to process_madvise") as process_madvise() fails to return the +exact processed bytes in other cases too. + +As an example: if process_madvise() hits mlocked pages after processing +some initial bytes passed in [start, end), it just returns EINVAL +although some bytes are processed. Thus making an exception only for +ENOMEM is partially fixing the problem of returning the proper advised +bytes. + +Thus revert this patch and return proper bytes advised. + +Link: https://lkml.kernel.org/r/e73da1304a88b6a8a11907045117cccf4c2b8374.1648046642.git.quic_charante@quicinc.com +Fixes: 08095d6310a7ce ("mm: madvise: skip unmapped vma holes passed to process_madvise") +Signed-off-by: Charan Teja Kalla +Acked-by: Michal Hocko +Cc: Suren Baghdasaryan +Cc: Vlastimil Babka +Cc: David Rientjes +Cc: Nadav Amit +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/madvise.c | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +--- a/mm/madvise.c ++++ b/mm/madvise.c +@@ -1222,16 +1222,9 @@ SYSCALL_DEFINE5(process_madvise, int, pi + + while (iov_iter_count(&iter)) { + iovec = iov_iter_iovec(&iter); +- /* +- * do_madvise returns ENOMEM if unmapped holes are present +- * in the passed VMA. process_madvise() is expected to skip +- * unmapped holes passed to it in the 'struct iovec' list +- * and not fail because of them. Thus treat -ENOMEM return +- * from do_madvise as valid and continue processing. +- */ + ret = do_madvise(mm, (unsigned long)iovec.iov_base, + iovec.iov_len, behavior); +- if (ret < 0 && ret != -ENOMEM) ++ if (ret < 0) + break; + iov_iter_advance(&iter, iovec.iov_len); + } diff --git a/queue-5.10/series b/queue-5.10/series index f77bbf7ae78..1e140a7f29b 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -71,3 +71,57 @@ alsa-cs4236-fix-an-incorrect-null-check-on-list-iterator.patch alsa-hda-avoid-unsol-event-during-rpm-suspending.patch alsa-pcm-fix-potential-ab-ba-lock-with-buffer_mutex-and-mmap_lock.patch alsa-hda-realtek-fix-audio-regression-on-mi-notebook-pro-2020.patch +mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch +mm-madvise-return-correct-bytes-advised-with-process_madvise.patch +revert-mm-madvise-skip-unmapped-vma-holes-passed-to-process_madvise.patch +mm-hwpoison-unmap-poisoned-page-before-invalidation.patch +mm-kmemleak-reset-tag-when-compare-object-pointer.patch +dm-integrity-set-journal-entry-unused-when-shrinking-device.patch +drbd-fix-potential-silent-data-corruption.patch +can-isotp-sanitize-can-id-checks-in-isotp_bind.patch +powerpc-kvm-fix-kvm_use_magic_page.patch +udp-call-udp_encap_enable-for-v6-sockets-when-enabling-encap.patch +arm64-signal-nofpsimd-do-not-allocate-fp-simd-context-when-not-available.patch +arm64-dts-ti-k3-am65-fix-gic-v3-compatible-regs.patch +arm64-dts-ti-k3-j721e-fix-gic-v3-compatible-regs.patch +arm64-dts-ti-k3-j7200-fix-gic-v3-compatible-regs.patch +acpi-properties-consistently-return-enoent-if-there-are-no-more-references.patch +coredump-also-dump-first-pages-of-non-executable-elf-libraries.patch +ext4-fix-ext4_fc_stats-trace-point.patch +ext4-fix-fs-corruption-when-tring-to-remove-a-non-empty-directory-with-io-error.patch +drivers-hamradio-6pack-fix-uaf-bug-caused-by-mod_timer.patch +mailbox-tegra-hsp-flush-whole-channel.patch +block-limit-request-dispatch-loop-duration.patch +block-don-t-merge-across-cgroup-boundaries-if-blkcg-is-enabled.patch +drm-edid-check-basic-audio-support-on-cea-extension-block.patch +video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch +video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch +arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch +arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch +arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch +arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch +mgag200-fix-memmapsl-configuration-in-gctl6-register.patch +carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch +pstore-don-t-use-semaphores-in-always-atomic-context-code.patch +thermal-int340x-increase-bitmap-size.patch +lib-raid6-test-fix-multiple-definition-linking-error.patch +exec-force-single-empty-string-when-argv-is-empty.patch +crypto-rsa-pkcs1pad-only-allow-with-rsa.patch +crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch +crypto-rsa-pkcs1pad-restore-signature-length-check.patch +crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch +bcache-fixup-multiple-threads-crash.patch +dec-limit-pmax-memory-probing-to-r3k-systems.patch +media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch +media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch +media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch +xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch +xtensa-fix-xtensa_wsr-always-writing-0.patch +brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch +brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch +brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch +brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch +drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch +drm-i915-gem-add-missing-boundary-check-in-vm_access.patch +pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch +pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch diff --git a/queue-5.10/thermal-int340x-increase-bitmap-size.patch b/queue-5.10/thermal-int340x-increase-bitmap-size.patch new file mode 100644 index 00000000000..e4368f5a0ec --- /dev/null +++ b/queue-5.10/thermal-int340x-increase-bitmap-size.patch @@ -0,0 +1,35 @@ +From 668f69a5f863b877bc3ae129efe9a80b6f055141 Mon Sep 17 00:00:00 2001 +From: Srinivas Pandruvada +Date: Mon, 14 Mar 2022 15:08:55 -0700 +Subject: thermal: int340x: Increase bitmap size + +From: Srinivas Pandruvada + +commit 668f69a5f863b877bc3ae129efe9a80b6f055141 upstream. + +The number of policies are 10, so can't be supported by the bitmap size +of u8. + +Even though there are no platfoms with these many policies, but +for correctness increase to u32. + +Signed-off-by: Srinivas Pandruvada +Fixes: 16fc8eca1975 ("thermal/int340x_thermal: Add additional UUIDs") +Cc: 5.1+ # 5.1+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c ++++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +@@ -53,7 +53,7 @@ struct int3400_thermal_priv { + struct art *arts; + int trt_count; + struct trt *trts; +- u8 uuid_bitmap; ++ u32 uuid_bitmap; + int rel_misc_dev_res; + int current_uuid_index; + char *data_vault; diff --git a/queue-5.10/udp-call-udp_encap_enable-for-v6-sockets-when-enabling-encap.patch b/queue-5.10/udp-call-udp_encap_enable-for-v6-sockets-when-enabling-encap.patch new file mode 100644 index 00000000000..40c0675bbb3 --- /dev/null +++ b/queue-5.10/udp-call-udp_encap_enable-for-v6-sockets-when-enabling-encap.patch @@ -0,0 +1,105 @@ +From a4a600dd301ccde6ea239804ec1f19364a39d643 Mon Sep 17 00:00:00 2001 +From: Xin Long +Date: Wed, 3 Feb 2021 16:54:22 +0800 +Subject: udp: call udp_encap_enable for v6 sockets when enabling encap + +From: Xin Long + +commit a4a600dd301ccde6ea239804ec1f19364a39d643 upstream. + +When enabling encap for a ipv6 socket without udp_encap_needed_key +increased, UDP GRO won't work for v4 mapped v6 address packets as +sk will be NULL in udp4_gro_receive(). + +This patch is to enable it by increasing udp_encap_needed_key for +v6 sockets in udp_tunnel_encap_enable(), and correspondingly +decrease udp_encap_needed_key in udpv6_destroy_sock(). + +v1->v2: + - add udp_encap_disable() and export it. +v2->v3: + - add the change for rxrpc and bareudp into one patch, as Alex + suggested. +v3->v4: + - move rxrpc part to another patch. + +Acked-by: Willem de Bruijn +Signed-off-by: Xin Long +Signed-off-by: Jakub Kicinski +Tested-by: Antonio Quartulli +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/bareudp.c | 6 ------ + include/net/udp.h | 1 + + include/net/udp_tunnel.h | 3 +-- + net/ipv4/udp.c | 6 ++++++ + net/ipv6/udp.c | 4 +++- + 5 files changed, 11 insertions(+), 9 deletions(-) + +--- a/drivers/net/bareudp.c ++++ b/drivers/net/bareudp.c +@@ -246,12 +246,6 @@ static int bareudp_socket_create(struct + tunnel_cfg.encap_destroy = NULL; + setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg); + +- /* As the setup_udp_tunnel_sock does not call udp_encap_enable if the +- * socket type is v6 an explicit call to udp_encap_enable is needed. +- */ +- if (sock->sk->sk_family == AF_INET6) +- udp_encap_enable(); +- + rcu_assign_pointer(bareudp->sock, sock); + return 0; + } +--- a/include/net/udp.h ++++ b/include/net/udp.h +@@ -467,6 +467,7 @@ void udp_init(void); + + DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); + void udp_encap_enable(void); ++void udp_encap_disable(void); + #if IS_ENABLED(CONFIG_IPV6) + DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); + void udpv6_encap_enable(void); +--- a/include/net/udp_tunnel.h ++++ b/include/net/udp_tunnel.h +@@ -177,9 +177,8 @@ static inline void udp_tunnel_encap_enab + #if IS_ENABLED(CONFIG_IPV6) + if (sock->sk->sk_family == PF_INET6) + ipv6_stub->udpv6_encap_enable(); +- else + #endif +- udp_encap_enable(); ++ udp_encap_enable(); + } + + #define UDP_TUNNEL_NIC_MAX_TABLES 4 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -598,6 +598,12 @@ void udp_encap_enable(void) + } + EXPORT_SYMBOL(udp_encap_enable); + ++void udp_encap_disable(void) ++{ ++ static_branch_dec(&udp_encap_needed_key); ++} ++EXPORT_SYMBOL(udp_encap_disable); ++ + /* Handler for tunnels with arbitrary destination ports: no socket lookup, go + * through error handlers in encapsulations looking for a match. + */ +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -1610,8 +1610,10 @@ void udpv6_destroy_sock(struct sock *sk) + if (encap_destroy) + encap_destroy(sk); + } +- if (up->encap_enabled) ++ if (up->encap_enabled) { + static_branch_dec(&udpv6_encap_needed_key); ++ udp_encap_disable(); ++ } + } + + inet6_destroy_sock(sk); diff --git a/queue-5.10/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch b/queue-5.10/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch new file mode 100644 index 00000000000..80d5342089a --- /dev/null +++ b/queue-5.10/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch @@ -0,0 +1,62 @@ +From c8be5edbd36ceed2ff3d6b8f8e40643c3f396ea3 Mon Sep 17 00:00:00 2001 +From: Michael Schmitz +Date: Wed, 16 Feb 2022 20:26:25 +1300 +Subject: video: fbdev: atari: Atari 2 bpp (STe) palette bugfix + +From: Michael Schmitz + +commit c8be5edbd36ceed2ff3d6b8f8e40643c3f396ea3 upstream. + +The code to set the shifter STe palette registers has a long +standing operator precedence bug, manifesting as colors set +on a 2 bits per pixel frame buffer coming up with a distinctive +blue tint. + +Add parentheses around the calculation of the per-color palette +data before shifting those into their respective bit field position. + +This bug goes back a long way (2.4 days at the very least) so there +won't be a Fixes: tag. + +Tested on ARAnyM as well on Falcon030 hardware. + +Cc: stable@vger.kernel.org +Reported-by: Geert Uytterhoeven +Link: https://lore.kernel.org/all/CAMuHMdU3ievhXxKR_xi_v3aumnYW7UNUO6qMdhgfyWTyVSsCkQ@mail.gmail.com +Tested-by: Michael Schmitz +Tested-by: Geert Uytterhoeven +Signed-off-by: Michael Schmitz +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/atafb.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/video/fbdev/atafb.c ++++ b/drivers/video/fbdev/atafb.c +@@ -1691,9 +1691,9 @@ static int falcon_setcolreg(unsigned int + ((blue & 0xfc00) >> 8)); + if (regno < 16) { + shifter_tt.color_reg[regno] = +- (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) | +- (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) | +- ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); ++ ((((red & 0xe000) >> 13) | ((red & 0x1000) >> 12)) << 8) | ++ ((((green & 0xe000) >> 13) | ((green & 0x1000) >> 12)) << 4) | ++ ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); + ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) | + ((green & 0xfc00) >> 5) | + ((blue & 0xf800) >> 11)); +@@ -1979,9 +1979,9 @@ static int stste_setcolreg(unsigned int + green >>= 12; + if (ATARIHW_PRESENT(EXTD_SHIFTER)) + shifter_tt.color_reg[regno] = +- (((red & 0xe) >> 1) | ((red & 1) << 3) << 8) | +- (((green & 0xe) >> 1) | ((green & 1) << 3) << 4) | +- ((blue & 0xe) >> 1) | ((blue & 1) << 3); ++ ((((red & 0xe) >> 1) | ((red & 1) << 3)) << 8) | ++ ((((green & 0xe) >> 1) | ((green & 1) << 3)) << 4) | ++ ((blue & 0xe) >> 1) | ((blue & 1) << 3); + else + shifter_tt.color_reg[regno] = + ((red & 0xe) << 7) | diff --git a/queue-5.10/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch b/queue-5.10/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch new file mode 100644 index 00000000000..18f7e526ad6 --- /dev/null +++ b/queue-5.10/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch @@ -0,0 +1,76 @@ +From bd771cf5c4254511cc4abb88f3dab3bd58bdf8e8 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Sun, 27 Feb 2022 08:43:56 +0100 +Subject: video: fbdev: sm712fb: Fix crash in smtcfb_read() + +From: Helge Deller + +commit bd771cf5c4254511cc4abb88f3dab3bd58bdf8e8 upstream. + +Zheyu Ma reported this crash in the sm712fb driver when reading +three bytes from the framebuffer: + + BUG: unable to handle page fault for address: ffffc90001ffffff + RIP: 0010:smtcfb_read+0x230/0x3e0 + Call Trace: + vfs_read+0x198/0xa00 + ? do_sys_openat2+0x27d/0x350 + ? __fget_light+0x54/0x340 + ksys_read+0xce/0x190 + do_syscall_64+0x43/0x90 + +Fix it by removing the open-coded endianess fixup-code and +by moving the pointer post decrement out the fb_readl() function. + +Reported-by: Zheyu Ma +Signed-off-by: Helge Deller +Tested-by: Zheyu Ma +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/sm712fb.c | 25 +++++++------------------ + 1 file changed, 7 insertions(+), 18 deletions(-) + +--- a/drivers/video/fbdev/sm712fb.c ++++ b/drivers/video/fbdev/sm712fb.c +@@ -1047,7 +1047,7 @@ static ssize_t smtcfb_read(struct fb_inf + if (count + p > total_size) + count = total_size - p; + +- buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); ++ buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + +@@ -1059,25 +1059,14 @@ static ssize_t smtcfb_read(struct fb_inf + while (count) { + c = (count > PAGE_SIZE) ? PAGE_SIZE : count; + dst = buffer; +- for (i = c >> 2; i--;) { +- *dst = fb_readl(src++); +- *dst = big_swap(*dst); ++ for (i = (c + 3) >> 2; i--;) { ++ u32 val; ++ ++ val = fb_readl(src); ++ *dst = big_swap(val); ++ src++; + dst++; + } +- if (c & 3) { +- u8 *dst8 = (u8 *)dst; +- u8 __iomem *src8 = (u8 __iomem *)src; +- +- for (i = c & 3; i--;) { +- if (i & 1) { +- *dst8++ = fb_readb(++src8); +- } else { +- *dst8++ = fb_readb(--src8); +- src8 += 2; +- } +- } +- src = (u32 __iomem *)src8; +- } + + if (copy_to_user(buf, buffer, c)) { + err = -EFAULT; diff --git a/queue-5.10/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch b/queue-5.10/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch new file mode 100644 index 00000000000..2d5b713dea2 --- /dev/null +++ b/queue-5.10/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch @@ -0,0 +1,34 @@ +From f406f2d03e07afc199dd8cf501f361dde6be8a69 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Wed, 16 Mar 2022 02:04:17 -0700 +Subject: xtensa: fix stop_machine_cpuslocked call in patch_text + +From: Max Filippov + +commit f406f2d03e07afc199dd8cf501f361dde6be8a69 upstream. + +patch_text must invoke patch_text_stop_machine on all online CPUs, but +it calls stop_machine_cpuslocked with NULL cpumask. As a result only one +CPU runs patch_text_stop_machine potentially leaving stale icache +entries on other CPUs. Fix that by calling stop_machine_cpuslocked with +cpu_online_mask as the last argument. + +Cc: stable@vger.kernel.org +Fixes: 64711f9a47d4 ("xtensa: implement jump_label support") +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman +--- + arch/xtensa/kernel/jump_label.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/xtensa/kernel/jump_label.c ++++ b/arch/xtensa/kernel/jump_label.c +@@ -61,7 +61,7 @@ static void patch_text(unsigned long add + .data = data, + }; + stop_machine_cpuslocked(patch_text_stop_machine, +- &patch, NULL); ++ &patch, cpu_online_mask); + } else { + unsigned long flags; + diff --git a/queue-5.10/xtensa-fix-xtensa_wsr-always-writing-0.patch b/queue-5.10/xtensa-fix-xtensa_wsr-always-writing-0.patch new file mode 100644 index 00000000000..e567745f456 --- /dev/null +++ b/queue-5.10/xtensa-fix-xtensa_wsr-always-writing-0.patch @@ -0,0 +1,38 @@ +From a3d0245c58f962ee99d4440ea0eaf45fb7f5a5cc Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Sun, 20 Mar 2022 09:40:14 -0700 +Subject: xtensa: fix xtensa_wsr always writing 0 + +From: Max Filippov + +commit a3d0245c58f962ee99d4440ea0eaf45fb7f5a5cc upstream. + +The commit cad6fade6e78 ("xtensa: clean up WSR*/RSR*/get_sr/set_sr") +replaced 'WSR' macro in the function xtensa_wsr with 'xtensa_set_sr', +but variable 'v' in the xtensa_set_sr body shadowed the argument 'v' +passed to it, resulting in wrong value written to debug registers. + +Fix that by removing intermediate variable from the xtensa_set_sr +macro body. + +Cc: stable@vger.kernel.org +Fixes: cad6fade6e78 ("xtensa: clean up WSR*/RSR*/get_sr/set_sr") +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman +--- + arch/xtensa/include/asm/processor.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/xtensa/include/asm/processor.h ++++ b/arch/xtensa/include/asm/processor.h +@@ -226,8 +226,8 @@ extern unsigned long get_wchan(struct ta + + #define xtensa_set_sr(x, sr) \ + ({ \ +- unsigned int v = (unsigned int)(x); \ +- __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ ++ __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \ ++ "a"((unsigned int)(x))); \ + }) + + #define xtensa_get_sr(sr) \