]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.16-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Apr 2022 13:11:04 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Apr 2022 13:11:04 +0000 (15:11 +0200)
added patches:
arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch
arm-dts-at91-sama7g5-remove-unused-properties-in-i2c-nodes.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
bcache-fixup-multiple-threads-crash.patch
brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch
brcmfmac-pcie-declare-missing-firmware-files-in-pcie.c.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
btrfs-extend-locking-to-all-space_info-members-accesses.patch
btrfs-verify-the-tranisd-of-the-to-be-written-dirty-extent-buffer.patch
btrfs-zoned-mark-relocation-as-writing.patch
carl9170-fix-missing-bit-wise-or-operator-for-tx_params.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
drm-edid-check-basic-audio-support-on-cea-extension-block.patch
drm-fb-helper-mark-screen-buffers-in-system-memory-with-fbinfo_virtfb.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
drm-nouveau-backlight-fix-lvds-backlight-detection-on-some-laptops.patch
drm-nouveau-backlight-just-set-all-backlight-types-as-raw.patch
drm-syncobj-flatten-dma_fence_chains-on-transfer.patch
exec-force-single-empty-string-when-argv-is-empty.patch
fbdev-hot-unplug-firmware-fb-devices-on-forced-removal.patch
lib-raid6-test-fix-multiple-definition-linking-error.patch
media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch
media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch
media-davinci-vpif-fix-use-after-free-on-driver-unbind.patch
media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch
media-omap3isp-use-struct_group-for-memcpy-region.patch
media-venus-hfi_cmds-list-hdr10-property-as-unsupported-for-v1-and-v3.patch
media-venus-vdec-fixed-possible-memory-leak-issue.patch
media-venus-venc-fix-h264-8x8-transform-control.patch
mgag200-fix-memmapsl-configuration-in-gctl6-register.patch
pci-imx6-allow-to-probe-when-dw_pcie_wait_for_link-fails.patch
pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch
pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch
pm-domains-fix-sleep-in-atomic-bug-caused-by-genpd_debug_remove.patch
pstore-don-t-use-semaphores-in-always-atomic-context-code.patch
rfkill-make-new-event-layout-opt-in.patch
thermal-int340x-increase-bitmap-size.patch
video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch
video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch
xtensa-define-update_mmu_tlb-function.patch
xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch
xtensa-fix-xtensa_wsr-always-writing-0.patch

52 files changed:
queue-5.16/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch [new file with mode: 0644]
queue-5.16/arm-dts-at91-sama7g5-remove-unused-properties-in-i2c-nodes.patch [new file with mode: 0644]
queue-5.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch [new file with mode: 0644]
queue-5.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch [new file with mode: 0644]
queue-5.16/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch [new file with mode: 0644]
queue-5.16/bcache-fixup-multiple-threads-crash.patch [new file with mode: 0644]
queue-5.16/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch [new file with mode: 0644]
queue-5.16/brcmfmac-pcie-declare-missing-firmware-files-in-pcie.c.patch [new file with mode: 0644]
queue-5.16/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch [new file with mode: 0644]
queue-5.16/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch [new file with mode: 0644]
queue-5.16/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch [new file with mode: 0644]
queue-5.16/btrfs-extend-locking-to-all-space_info-members-accesses.patch [new file with mode: 0644]
queue-5.16/btrfs-verify-the-tranisd-of-the-to-be-written-dirty-extent-buffer.patch [new file with mode: 0644]
queue-5.16/btrfs-zoned-mark-relocation-as-writing.patch [new file with mode: 0644]
queue-5.16/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch [new file with mode: 0644]
queue-5.16/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch [new file with mode: 0644]
queue-5.16/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch [new file with mode: 0644]
queue-5.16/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch [new file with mode: 0644]
queue-5.16/crypto-rsa-pkcs1pad-restore-signature-length-check.patch [new file with mode: 0644]
queue-5.16/dec-limit-pmax-memory-probing-to-r3k-systems.patch [new file with mode: 0644]
queue-5.16/drm-edid-check-basic-audio-support-on-cea-extension-block.patch [new file with mode: 0644]
queue-5.16/drm-fb-helper-mark-screen-buffers-in-system-memory-with-fbinfo_virtfb.patch [new file with mode: 0644]
queue-5.16/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch [new file with mode: 0644]
queue-5.16/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch [new file with mode: 0644]
queue-5.16/drm-nouveau-backlight-fix-lvds-backlight-detection-on-some-laptops.patch [new file with mode: 0644]
queue-5.16/drm-nouveau-backlight-just-set-all-backlight-types-as-raw.patch [new file with mode: 0644]
queue-5.16/drm-syncobj-flatten-dma_fence_chains-on-transfer.patch [new file with mode: 0644]
queue-5.16/exec-force-single-empty-string-when-argv-is-empty.patch [new file with mode: 0644]
queue-5.16/fbdev-hot-unplug-firmware-fb-devices-on-forced-removal.patch [new file with mode: 0644]
queue-5.16/lib-raid6-test-fix-multiple-definition-linking-error.patch [new file with mode: 0644]
queue-5.16/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch [new file with mode: 0644]
queue-5.16/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch [new file with mode: 0644]
queue-5.16/media-davinci-vpif-fix-use-after-free-on-driver-unbind.patch [new file with mode: 0644]
queue-5.16/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch [new file with mode: 0644]
queue-5.16/media-omap3isp-use-struct_group-for-memcpy-region.patch [new file with mode: 0644]
queue-5.16/media-venus-hfi_cmds-list-hdr10-property-as-unsupported-for-v1-and-v3.patch [new file with mode: 0644]
queue-5.16/media-venus-vdec-fixed-possible-memory-leak-issue.patch [new file with mode: 0644]
queue-5.16/media-venus-venc-fix-h264-8x8-transform-control.patch [new file with mode: 0644]
queue-5.16/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch [new file with mode: 0644]
queue-5.16/pci-imx6-allow-to-probe-when-dw_pcie_wait_for_link-fails.patch [new file with mode: 0644]
queue-5.16/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch [new file with mode: 0644]
queue-5.16/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch [new file with mode: 0644]
queue-5.16/pm-domains-fix-sleep-in-atomic-bug-caused-by-genpd_debug_remove.patch [new file with mode: 0644]
queue-5.16/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch [new file with mode: 0644]
queue-5.16/rfkill-make-new-event-layout-opt-in.patch [new file with mode: 0644]
queue-5.16/series
queue-5.16/thermal-int340x-increase-bitmap-size.patch [new file with mode: 0644]
queue-5.16/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch [new file with mode: 0644]
queue-5.16/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch [new file with mode: 0644]
queue-5.16/xtensa-define-update_mmu_tlb-function.patch [new file with mode: 0644]
queue-5.16/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch [new file with mode: 0644]
queue-5.16/xtensa-fix-xtensa_wsr-always-writing-0.patch [new file with mode: 0644]

diff --git a/queue-5.16/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch b/queue-5.16/arm-dts-at91-sama5d2-fix-pmerrloc-resource-size.patch
new file mode 100644 (file)
index 0000000..c664c26
--- /dev/null
@@ -0,0 +1,36 @@
+From 0fb578a529ac7aca326a9fa475b4a6f58a756fda Mon Sep 17 00:00:00 2001
+From: Tudor Ambarus <tudor.ambarus@microchip.com>
+Date: Tue, 11 Jan 2022 15:23:01 +0200
+Subject: ARM: dts: at91: sama5d2: Fix PMERRLOC resource size
+
+From: Tudor Ambarus <tudor.ambarus@microchip.com>
+
+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 <tudor.ambarus@microchip.com>
+Cc: <stable@vger.kernel.org> # 4.13.x
+Acked-by: Alexander Dahl <ada@thorsis.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
+Link: https://lore.kernel.org/r/20220111132301.906712-1-tudor.ambarus@microchip.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/arm-dts-at91-sama7g5-remove-unused-properties-in-i2c-nodes.patch b/queue-5.16/arm-dts-at91-sama7g5-remove-unused-properties-in-i2c-nodes.patch
new file mode 100644 (file)
index 0000000..25806c1
--- /dev/null
@@ -0,0 +1,53 @@
+From cbb92a7717d2e1c512b7e81c6b22c7298b58a881 Mon Sep 17 00:00:00 2001
+From: Tudor Ambarus <tudor.ambarus@microchip.com>
+Date: Wed, 2 Mar 2022 18:18:54 +0200
+Subject: ARM: dts: at91: sama7g5: Remove unused properties in i2c nodes
+
+From: Tudor Ambarus <tudor.ambarus@microchip.com>
+
+commit cbb92a7717d2e1c512b7e81c6b22c7298b58a881 upstream.
+
+The "atmel,use-dma-rx", "atmel,use-dma-rx" dt properties are not used by
+the i2c-at91 driver, nor they are defined in the bindings file, thus remove
+them.
+
+Cc: stable@vger.kernel.org
+Fixes: 7540629e2fc7 ("ARM: dts: at91: add sama7g5 SoC DT and sama7g5-ek")
+Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
+Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
+Link: https://lore.kernel.org/r/20220302161854.32177-1-tudor.ambarus@microchip.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/boot/dts/sama7g5.dtsi |    6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/arch/arm/boot/dts/sama7g5.dtsi
++++ b/arch/arm/boot/dts/sama7g5.dtsi
+@@ -352,8 +352,6 @@
+                               dmas = <&dma0 AT91_XDMAC_DT_PERID(7)>,
+                                       <&dma0 AT91_XDMAC_DT_PERID(8)>;
+                               dma-names = "rx", "tx";
+-                              atmel,use-dma-rx;
+-                              atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+               };
+@@ -528,8 +526,6 @@
+                               dmas = <&dma0 AT91_XDMAC_DT_PERID(21)>,
+                                       <&dma0 AT91_XDMAC_DT_PERID(22)>;
+                               dma-names = "rx", "tx";
+-                              atmel,use-dma-rx;
+-                              atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+               };
+@@ -554,8 +550,6 @@
+                               dmas = <&dma0 AT91_XDMAC_DT_PERID(23)>,
+                                       <&dma0 AT91_XDMAC_DT_PERID(24)>;
+                               dma-names = "rx", "tx";
+-                              atmel,use-dma-rx;
+-                              atmel,use-dma-tx;
+                               status = "disabled";
+                       };
+               };
diff --git a/queue-5.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch b/queue-5.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch
new file mode 100644 (file)
index 0000000..5fd8b30
--- /dev/null
@@ -0,0 +1,34 @@
+From 60a9914cb2061ba612a3f14f6ad329912b486360 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Date: Tue, 8 Feb 2022 18:18:14 +0100
+Subject: ARM: dts: exynos: add missing HDMI supplies on SMDK5250
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+
+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: <stable@vger.kernel.org> # v3.15+
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
+Link: https://lore.kernel.org/r/20220208171823.226211-2-krzysztof.kozlowski@canonical.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch b/queue-5.16/arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch
new file mode 100644 (file)
index 0000000..e19f085
--- /dev/null
@@ -0,0 +1,34 @@
+From 453a24ded415f7fce0499c6b0a2c7b28f84911f2 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Date: Tue, 8 Feb 2022 18:18:15 +0100
+Subject: ARM: dts: exynos: add missing HDMI supplies on SMDK5420
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+
+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: <stable@vger.kernel.org> # v3.15+
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
+Link: https://lore.kernel.org/r/20220208171823.226211-3-krzysztof.kozlowski@canonical.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch b/queue-5.16/arm-dts-exynos-fix-uart3-pins-configuration-in-exynos5250.patch
new file mode 100644 (file)
index 0000000..e224f38
--- /dev/null
@@ -0,0 +1,34 @@
+From 372d7027fed43c8570018e124cf78b89523a1f8e Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Date: Thu, 30 Dec 2021 20:53:23 +0100
+Subject: ARM: dts: exynos: fix UART3 pins configuration in Exynos5250
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+
+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: <stable@vger.kernel.org>
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
+Link: https://lore.kernel.org/r/20211230195325.328220-1-krzysztof.kozlowski@canonical.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 = <EXYNOS_PIN_FUNC_2>;
+               samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
diff --git a/queue-5.16/bcache-fixup-multiple-threads-crash.patch b/queue-5.16/bcache-fixup-multiple-threads-crash.patch
new file mode 100644 (file)
index 0000000..a226a5e
--- /dev/null
@@ -0,0 +1,67 @@
+From 887554ab96588de2917b6c8c73e552da082e5368 Mon Sep 17 00:00:00 2001
+From: Mingzhe Zou <mingzhe.zou@easystack.cn>
+Date: Fri, 11 Feb 2022 14:39:15 +0800
+Subject: bcache: fixup multiple threads crash
+
+From: Mingzhe Zou <mingzhe.zou@easystack.cn>
+
+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 <mingzhe.zou@easystack.cn>
+Cc: stable@vger.kernel.org # v5.7+
+Signed-off-by: Coly Li <colyli@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -998,9 +998,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.16/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch b/queue-5.16/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch
new file mode 100644 (file)
index 0000000..b232747
--- /dev/null
@@ -0,0 +1,36 @@
+From d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 Mon Sep 17 00:00:00 2001
+From: Hector Martin <marcan@marcan.st>
+Date: Tue, 1 Feb 2022 01:07:06 +0900
+Subject: brcmfmac: firmware: Allocate space for default boardrev in nvram
+
+From: Hector Martin <marcan@marcan.st>
+
+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 <arend.vanspriel@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Hector Martin <marcan@marcan.st>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220131160713.245637-3-marcan@marcan.st
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/brcmfmac-pcie-declare-missing-firmware-files-in-pcie.c.patch b/queue-5.16/brcmfmac-pcie-declare-missing-firmware-files-in-pcie.c.patch
new file mode 100644 (file)
index 0000000..59e2e37
--- /dev/null
@@ -0,0 +1,51 @@
+From 6d766d8cb505ec1fae63da8faef4fc5712c3d794 Mon Sep 17 00:00:00 2001
+From: Hector Martin <marcan@marcan.st>
+Date: Tue, 1 Feb 2022 01:07:08 +0900
+Subject: brcmfmac: pcie: Declare missing firmware files in pcie.c
+
+From: Hector Martin <marcan@marcan.st>
+
+commit 6d766d8cb505ec1fae63da8faef4fc5712c3d794 upstream.
+
+Move one of the declarations from sdio.c to pcie.c, since it makes no
+sense in the former (SDIO support is optional), and add missing ones.
+
+Fixes: 75729e110e68 ("brcmfmac: expose firmware config files through modinfo")
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Hector Martin <marcan@marcan.st>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220131160713.245637-5-marcan@marcan.st
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |    7 +++++++
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |    1 -
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+@@ -59,6 +59,13 @@ BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie"
+ BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie");
+ BRCMF_FW_DEF(4371, "brcmfmac4371-pcie");
++/* firmware config files */
++MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.txt");
++MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt");
++
++/* per-board firmware binaries */
++MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.bin");
++
+ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
+       BRCMF_FW_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602),
+       BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C),
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -629,7 +629,6 @@ BRCMF_FW_CLM_DEF(43752, "brcmfmac43752-s
+ /* firmware config files */
+ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.txt");
+-MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt");
+ /* per-board firmware binaries */
+ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin");
diff --git a/queue-5.16/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch b/queue-5.16/brcmfmac-pcie-fix-crashes-due-to-early-irqs.patch
new file mode 100644 (file)
index 0000000..852b44c
--- /dev/null
@@ -0,0 +1,66 @@
+From b50255c83b914defd61a57fbc81d452334b63f4c Mon Sep 17 00:00:00 2001
+From: Hector Martin <marcan@marcan.st>
+Date: Tue, 1 Feb 2022 01:07:10 +0900
+Subject: brcmfmac: pcie: Fix crashes due to early IRQs
+
+From: Hector Martin <marcan@marcan.st>
+
+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 <linus.walleij@linaro.org>
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Hector Martin <marcan@marcan.st>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220131160713.245637-7-marcan@marcan.st
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1315,6 +1315,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)
+ {
+@@ -1423,6 +1435,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,
+@@ -1795,9 +1808,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.16/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch b/queue-5.16/brcmfmac-pcie-release-firmwares-in-the-brcmf_pcie_setup-error-path.patch
new file mode 100644 (file)
index 0000000..ca8ad03
--- /dev/null
@@ -0,0 +1,36 @@
+From 5e90f0f3ead014867dade7a22f93958119f5efab Mon Sep 17 00:00:00 2001
+From: Hector Martin <marcan@marcan.st>
+Date: Tue, 1 Feb 2022 01:07:05 +0900
+Subject: brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path
+
+From: Hector Martin <marcan@marcan.st>
+
+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 <linus.walleij@linaro.org>
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Hector Martin <marcan@marcan.st>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220131160713.245637-2-marcan@marcan.st
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1777,6 +1777,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.16/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch b/queue-5.16/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch
new file mode 100644 (file)
index 0000000..3270895
--- /dev/null
@@ -0,0 +1,108 @@
+From 9466987f246758eb7e9071ae58005253f631271e Mon Sep 17 00:00:00 2001
+From: Hector Martin <marcan@marcan.st>
+Date: Tue, 1 Feb 2022 01:07:09 +0900
+Subject: brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
+
+From: Hector Martin <marcan@marcan.st>
+
+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 <linus.walleij@linaro.org>
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Hector Martin <marcan@marcan.st>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220131160713.245637-6-marcan@marcan.st
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 <linux/interrupt.h>
+ #include <linux/bcma/bcma.h>
+ #include <linux/sched.h>
++#include <linux/io.h>
+ #include <asm/unaligned.h>
+ #include <soc.h>
+@@ -455,47 +456,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)
+ {
+@@ -1570,8 +1530,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);
+@@ -1585,7 +1545,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.16/btrfs-extend-locking-to-all-space_info-members-accesses.patch b/queue-5.16/btrfs-extend-locking-to-all-space_info-members-accesses.patch
new file mode 100644 (file)
index 0000000..86944e4
--- /dev/null
@@ -0,0 +1,49 @@
+From 06bae876634ebf837ba70ea3de532b288326103d Mon Sep 17 00:00:00 2001
+From: Niels Dossche <dossche.niels@gmail.com>
+Date: Fri, 25 Feb 2022 22:20:28 +0100
+Subject: btrfs: extend locking to all space_info members accesses
+
+From: Niels Dossche <dossche.niels@gmail.com>
+
+commit 06bae876634ebf837ba70ea3de532b288326103d upstream.
+
+bytes_pinned is always accessed under space_info->lock, except in
+btrfs_preempt_reclaim_metadata_space, however the other members are
+accessed under that lock. The reserved member of the rsv's are also
+partially accessed under a lock and partially not. Move all these
+accesses into the same lock to ensure consistency.
+
+This could potentially race and lead to a flush instead of a commit but
+it's not a big problem as it's only for preemptive flush.
+
+CC: stable@vger.kernel.org # 5.15+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Niels Dossche <niels.dossche@ugent.be>
+Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/space-info.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/btrfs/space-info.c
++++ b/fs/btrfs/space-info.c
+@@ -1059,7 +1059,6 @@ static void btrfs_preempt_reclaim_metada
+                       trans_rsv->reserved;
+               if (block_rsv_size < space_info->bytes_may_use)
+                       delalloc_size = space_info->bytes_may_use - block_rsv_size;
+-              spin_unlock(&space_info->lock);
+               /*
+                * We don't want to include the global_rsv in our calculation,
+@@ -1090,6 +1089,8 @@ static void btrfs_preempt_reclaim_metada
+                       flush = FLUSH_DELAYED_REFS_NR;
+               }
++              spin_unlock(&space_info->lock);
++
+               /*
+                * We don't want to reclaim everything, just a portion, so scale
+                * down the to_reclaim by 1/4.  If it takes us down to 0,
diff --git a/queue-5.16/btrfs-verify-the-tranisd-of-the-to-be-written-dirty-extent-buffer.patch b/queue-5.16/btrfs-verify-the-tranisd-of-the-to-be-written-dirty-extent-buffer.patch
new file mode 100644 (file)
index 0000000..0b35d02
--- /dev/null
@@ -0,0 +1,96 @@
+From 3777369ff1518b579560611a0d0c33f930154f64 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Wed, 2 Mar 2022 09:10:21 +0800
+Subject: btrfs: verify the tranisd of the to-be-written dirty extent buffer
+
+From: Qu Wenruo <wqu@suse.com>
+
+commit 3777369ff1518b579560611a0d0c33f930154f64 upstream.
+
+[BUG]
+There is a bug report that a bitflip in the transid part of an extent
+buffer makes btrfs to reject certain tree blocks:
+
+  BTRFS error (device dm-0): parent transid verify failed on 1382301696 wanted 262166 found 22
+
+[CAUSE]
+Note the failed transid check, hex(262166) = 0x40016, while
+hex(22) = 0x16.
+
+It's an obvious bitflip.
+
+Furthermore, the reporter also confirmed the bitflip is from the
+hardware, so it's a real hardware caused bitflip, and such problem can
+not be detected by the existing tree-checker framework.
+
+As tree-checker can only verify the content inside one tree block, while
+generation of a tree block can only be verified against its parent.
+
+So such problem remain undetected.
+
+[FIX]
+Although tree-checker can not verify it at write-time, we still have a
+quick (but not the most accurate) way to catch such obvious corruption.
+
+Function csum_one_extent_buffer() is called before we submit metadata
+write.
+
+Thus it means, all the extent buffer passed in should be dirty tree
+blocks, and should be newer than last committed transaction.
+
+Using that we can catch the above bitflip.
+
+Although it's not a perfect solution, as if the corrupted generation is
+higher than the correct value, we have no way to catch it at all.
+
+Reported-by: Christoph Anton Mitterer <calestyo@scientia.org>
+Link: https://lore.kernel.org/linux-btrfs/2dfcbc130c55cc6fd067b93752e90bd2b079baca.camel@scientia.org/
+CC: stable@vger.kernel.org # 5.15+
+Signed-off-by: Qu Wenruo <wqu@sus,ree.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/disk-io.c |   26 ++++++++++++++++++++------
+ 1 file changed, 20 insertions(+), 6 deletions(-)
+
+--- a/fs/btrfs/disk-io.c
++++ b/fs/btrfs/disk-io.c
+@@ -441,17 +441,31 @@ static int csum_one_extent_buffer(struct
+       else
+               ret = btrfs_check_leaf_full(eb);
+-      if (ret < 0) {
+-              btrfs_print_tree(eb, 0);
++      if (ret < 0)
++              goto error;
++
++      /*
++       * Also check the generation, the eb reached here must be newer than
++       * last committed. Or something seriously wrong happened.
++       */
++      if (unlikely(btrfs_header_generation(eb) <= fs_info->last_trans_committed)) {
++              ret = -EUCLEAN;
+               btrfs_err(fs_info,
+-                      "block=%llu write time tree block corruption detected",
+-                      eb->start);
+-              WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
+-              return ret;
++                      "block=%llu bad generation, have %llu expect > %llu",
++                        eb->start, btrfs_header_generation(eb),
++                        fs_info->last_trans_committed);
++              goto error;
+       }
+       write_extent_buffer(eb, result, 0, fs_info->csum_size);
+       return 0;
++
++error:
++      btrfs_print_tree(eb, 0);
++      btrfs_err(fs_info, "block=%llu write time tree block corruption detected",
++                eb->start);
++      WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
++      return ret;
+ }
+ /* Checksum all dirty extent buffers in one bio_vec */
diff --git a/queue-5.16/btrfs-zoned-mark-relocation-as-writing.patch b/queue-5.16/btrfs-zoned-mark-relocation-as-writing.patch
new file mode 100644 (file)
index 0000000..bae715d
--- /dev/null
@@ -0,0 +1,92 @@
+From ca5e4ea0beaec8bc674121838bf8614c089effb9 Mon Sep 17 00:00:00 2001
+From: Naohiro Aota <naohiro.aota@wdc.com>
+Date: Fri, 18 Feb 2022 13:14:19 +0900
+Subject: btrfs: zoned: mark relocation as writing
+
+From: Naohiro Aota <naohiro.aota@wdc.com>
+
+commit ca5e4ea0beaec8bc674121838bf8614c089effb9 upstream.
+
+There is a hung_task issue with running generic/068 on an SMR
+device. The hang occurs while a process is trying to thaw the
+filesystem. The process is trying to take sb->s_umount to thaw the
+FS. The lock is held by fsstress, which calls btrfs_sync_fs() and is
+waiting for an ordered extent to finish. However, as the FS is frozen,
+the ordered extents never finish.
+
+Having an ordered extent while the FS is frozen is the root cause of
+the hang. The ordered extent is initiated from btrfs_relocate_chunk()
+which is called from btrfs_reclaim_bgs_work().
+
+This commit adds sb_*_write() around btrfs_relocate_chunk() call
+site. For the usual "btrfs balance" command, we already call it with
+mnt_want_file() in btrfs_ioctl_balance().
+
+Fixes: 18bb8bbf13c1 ("btrfs: zoned: automatically reclaim zones")
+CC: stable@vger.kernel.org # 5.13+
+Link: https://github.com/naota/linux/issues/56
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/block-group.c |    8 +++++++-
+ fs/btrfs/volumes.c     |    3 +++
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/fs/btrfs/block-group.c
++++ b/fs/btrfs/block-group.c
+@@ -1521,8 +1521,12 @@ void btrfs_reclaim_bgs_work(struct work_
+       if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
+               return;
+-      if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_BALANCE))
++      sb_start_write(fs_info->sb);
++
++      if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_BALANCE)) {
++              sb_end_write(fs_info->sb);
+               return;
++      }
+       /*
+        * Long running balances can keep us blocked here for eternity, so
+@@ -1530,6 +1534,7 @@ void btrfs_reclaim_bgs_work(struct work_
+        */
+       if (!mutex_trylock(&fs_info->reclaim_bgs_lock)) {
+               btrfs_exclop_finish(fs_info);
++              sb_end_write(fs_info->sb);
+               return;
+       }
+@@ -1604,6 +1609,7 @@ next:
+       spin_unlock(&fs_info->unused_bgs_lock);
+       mutex_unlock(&fs_info->reclaim_bgs_lock);
+       btrfs_exclop_finish(fs_info);
++      sb_end_write(fs_info->sb);
+ }
+ void btrfs_reclaim_bgs(struct btrfs_fs_info *fs_info)
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -8263,10 +8263,12 @@ static int relocating_repair_kthread(voi
+       target = cache->start;
+       btrfs_put_block_group(cache);
++      sb_start_write(fs_info->sb);
+       if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_BALANCE)) {
+               btrfs_info(fs_info,
+                          "zoned: skip relocating block group %llu to repair: EBUSY",
+                          target);
++              sb_end_write(fs_info->sb);
+               return -EBUSY;
+       }
+@@ -8294,6 +8296,7 @@ out:
+               btrfs_put_block_group(cache);
+       mutex_unlock(&fs_info->reclaim_bgs_lock);
+       btrfs_exclop_finish(fs_info);
++      sb_end_write(fs_info->sb);
+       return ret;
+ }
diff --git a/queue-5.16/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch b/queue-5.16/carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch
new file mode 100644 (file)
index 0000000..f42a40e
--- /dev/null
@@ -0,0 +1,39 @@
+From 02a95374b5eebdbd3b6413fd7ddec151d2ea75a1 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.i.king@gmail.com>
+Date: Tue, 25 Jan 2022 00:44:06 +0000
+Subject: carl9170: fix missing bit-wise or operator for tx_params
+
+From: Colin Ian King <colin.i.king@gmail.com>
+
+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 <colin.i.king@gmail.com>
+Cc: <Stable@vger.kernel.org>
+Acked-by: Christian Lamparter <chunkeey@gmail.com>
+Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
+Link: https://lore.kernel.org/r/20220125004406.344422-1-colin.i.king@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1915,7 +1915,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.16/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch b/queue-5.16/crypto-rsa-pkcs1pad-correctly-get-hash-from-source-scatterlist.patch
new file mode 100644 (file)
index 0000000..b2a0cb1
--- /dev/null
@@ -0,0 +1,52 @@
+From e316f7179be22912281ce6331d96d7c121fb2b17 Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 18 Jan 2022 16:13:03 -0800
+Subject: crypto: rsa-pkcs1pad - correctly get hash from source scatterlist
+
+From: Eric Biggers <ebiggers@google.com>
+
+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: <stable@vger.kernel.org> # v5.2+
+Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch b/queue-5.16/crypto-rsa-pkcs1pad-fix-buffer-overread-in-pkcs1pad_verify_complete.patch
new file mode 100644 (file)
index 0000000..5bdca58
--- /dev/null
@@ -0,0 +1,33 @@
+From a24611ea356c7f3f0ec926da11b9482ac1f414fd Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 18 Jan 2022 16:13:05 -0800
+Subject: crypto: rsa-pkcs1pad - fix buffer overread in pkcs1pad_verify_complete()
+
+From: Eric Biggers <ebiggers@google.com>
+
+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: <stable@vger.kernel.org> # v4.6+
+Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch b/queue-5.16/crypto-rsa-pkcs1pad-only-allow-with-rsa.patch
new file mode 100644 (file)
index 0000000..c6b9b58
--- /dev/null
@@ -0,0 +1,36 @@
+From 9b30430ea356f237945e52f8a3a42158877bd5a9 Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 18 Jan 2022 16:13:02 -0800
+Subject: crypto: rsa-pkcs1pad - only allow with rsa
+
+From: Eric Biggers <ebiggers@google.com>
+
+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: <stable@vger.kernel.org> # v4.5+
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/crypto-rsa-pkcs1pad-restore-signature-length-check.patch b/queue-5.16/crypto-rsa-pkcs1pad-restore-signature-length-check.patch
new file mode 100644 (file)
index 0000000..b590426
--- /dev/null
@@ -0,0 +1,46 @@
+From d3481accd974541e6a5d6a1fb588924a3519c36e Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 18 Jan 2022 16:13:04 -0800
+Subject: crypto: rsa-pkcs1pad - restore signature length check
+
+From: Eric Biggers <ebiggers@google.com>
+
+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: <stable@vger.kernel.org> # v4.6+
+Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
+Suggested-by: Vitaly Chikunov <vt@altlinux.org>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/dec-limit-pmax-memory-probing-to-r3k-systems.patch b/queue-5.16/dec-limit-pmax-memory-probing-to-r3k-systems.patch
new file mode 100644 (file)
index 0000000..bf532a4
--- /dev/null
@@ -0,0 +1,70 @@
+From 244eae91a94c6dab82b3232967d10eeb9dfa21c6 Mon Sep 17 00:00:00 2001
+From: "Maciej W. Rozycki" <macro@orcam.me.uk>
+Date: Fri, 4 Mar 2022 20:16:23 +0000
+Subject: DEC: Limit PMAX memory probing to R3k systems
+
+From: Maciej W. Rozycki <macro@orcam.me.uk>
+
+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 <jbglaw@lug-owl.de>
+Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Cc: stable@vger.kernel.org # v2.6.12+
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/drm-edid-check-basic-audio-support-on-cea-extension-block.patch b/queue-5.16/drm-edid-check-basic-audio-support-on-cea-extension-block.patch
new file mode 100644 (file)
index 0000000..5827d77
--- /dev/null
@@ -0,0 +1,42 @@
+From 5662abf6e21338be6d085d6375d3732ac6147fd2 Mon Sep 17 00:00:00 2001
+From: Cooper Chiou <cooper.chiou@intel.com>
+Date: Thu, 24 Mar 2022 14:12:18 +0800
+Subject: drm/edid: check basic audio support on CEA extension block
+
+From: Cooper Chiou <cooper.chiou@intel.com>
+
+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 <jani.nikula@intel.com>
+Cc: Shawn C Lee <shawn.c.lee@intel.com>
+Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
+Signed-off-by: Cooper Chiou <cooper.chiou@intel.com>
+Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
+Fixes: e28ad544f462 ("drm/edid: parse CEA blocks embedded in DisplayID")
+Reviewed-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220324061218.32739-1-shawn.c.lee@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -4848,7 +4848,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.16/drm-fb-helper-mark-screen-buffers-in-system-memory-with-fbinfo_virtfb.patch b/queue-5.16/drm-fb-helper-mark-screen-buffers-in-system-memory-with-fbinfo_virtfb.patch
new file mode 100644 (file)
index 0000000..653e35a
--- /dev/null
@@ -0,0 +1,67 @@
+From cd9f7f7ac5932129fe81b4c7559cfcb226ec7c5c Mon Sep 17 00:00:00 2001
+From: Thomas Zimmermann <tzimmermann@suse.de>
+Date: Tue, 1 Feb 2022 12:53:05 +0100
+Subject: drm/fb-helper: Mark screen buffers in system memory with FBINFO_VIRTFB
+
+From: Thomas Zimmermann <tzimmermann@suse.de>
+
+commit cd9f7f7ac5932129fe81b4c7559cfcb226ec7c5c upstream.
+
+Mark screen buffers in system memory with FBINFO_VIRTFB. Otherwise, fbdev
+deferred I/O marks mmap'ed areas of system memory with VM_IO. (There's an
+inverse relationship between the two flags.)
+
+For shadow buffers, also set the FBINFO_READS_FAST hint.
+
+v3:
+       * change FB_ to FBINFO_ in commit description
+v2:
+       * updated commit description (Daniel)
+       * added Fixes tag
+
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Fixes: d536540f304c ("drm/fb-helper: Add generic fbdev emulation .fb_probe function")
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: dri-devel@lists.freedesktop.org
+Cc: <stable@vger.kernel.org> # v4.19+
+Link: https://patchwork.freedesktop.org/patch/msgid/20220201115305.9333-1-tzimmermann@suse.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_fb_helper.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/drm_fb_helper.c
++++ b/drivers/gpu/drm/drm_fb_helper.c
+@@ -2346,6 +2346,7 @@ static int drm_fb_helper_generic_probe(s
+       fbi->fbops = &drm_fbdev_fb_ops;
+       fbi->screen_size = fb->height * fb->pitches[0];
+       fbi->fix.smem_len = fbi->screen_size;
++      fbi->flags = FBINFO_DEFAULT;
+       drm_fb_helper_fill_info(fbi, fb_helper, sizes);
+@@ -2353,19 +2354,21 @@ static int drm_fb_helper_generic_probe(s
+               fbi->screen_buffer = vzalloc(fbi->screen_size);
+               if (!fbi->screen_buffer)
+                       return -ENOMEM;
++              fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
+               fbi->fbdefio = &drm_fbdev_defio;
+-
+               fb_deferred_io_init(fbi);
+       } else {
+               /* buffer is mapped for HW framebuffer */
+               ret = drm_client_buffer_vmap(fb_helper->buffer, &map);
+               if (ret)
+                       return ret;
+-              if (map.is_iomem)
++              if (map.is_iomem) {
+                       fbi->screen_base = map.vaddr_iomem;
+-              else
++              } else {
+                       fbi->screen_buffer = map.vaddr;
++                      fbi->flags |= FBINFO_VIRTFB;
++              }
+               /*
+                * Shamelessly leak the physical address to user-space. As
diff --git a/queue-5.16/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch b/queue-5.16/drm-i915-gem-add-missing-boundary-check-in-vm_access.patch
new file mode 100644 (file)
index 0000000..f8235bd
--- /dev/null
@@ -0,0 +1,82 @@
+From 3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7 Mon Sep 17 00:00:00 2001
+From: Mastan Katragadda <mastanx.katragadda@intel.com>
+Date: Thu, 3 Mar 2022 11:34:28 +0530
+Subject: drm/i915/gem: add missing boundary check in vm_access
+
+From: Mastan Katragadda <mastanx.katragadda@intel.com>
+
+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]  <TASK>
+[  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 <mastanx.katragadda@intel.com>
+Suggested-by: Adam Zabrocki <adamza@microsoft.com>
+Reported-by: Jackson Cody <cody.jackson@intel.com>
+Cc: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Jon Bloomfield <jon.bloomfield@intel.com>
+Cc: Sudeep Dutt <sudeep.dutt@intel.com>
+Cc: <stable@vger.kernel.org> # v5.8+
+Reviewed-by: Matthew Auld <matthew.auld@intel.com>
+[mauld: tidy up the commit message and add Cc: stable]
+Signed-off-by: Matthew Auld <matthew.auld@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220303060428.1668844-1-mastanx.katragadda@intel.com
+(cherry picked from commit 661412e301e2ca86799aa4f400d1cf0bd38c57c6)
+Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -438,7 +438,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;
+       i915_gem_ww_ctx_init(&ww, true);
diff --git a/queue-5.16/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch b/queue-5.16/drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch
new file mode 100644 (file)
index 0000000..0cd9717
--- /dev/null
@@ -0,0 +1,60 @@
+From 24a644ebbfd3b13cda702f98907f9dd123e34bf9 Mon Sep 17 00:00:00 2001
+From: Jani Nikula <jani.nikula@intel.com>
+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 <jani.nikula@intel.com>
+
+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: <stable@vger.kernel.org> # v3.13+
+Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Cc: Lucas De Marchi <lucas.demarchi@intel.com>
+Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4800
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/cc363f42d6b5a5932b6d218fefcc8bdfb15dbbe5.1644489329.git.jani.nikula@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -375,6 +375,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.16/drm-nouveau-backlight-fix-lvds-backlight-detection-on-some-laptops.patch b/queue-5.16/drm-nouveau-backlight-fix-lvds-backlight-detection-on-some-laptops.patch
new file mode 100644 (file)
index 0000000..8664963
--- /dev/null
@@ -0,0 +1,41 @@
+From 6b0076540faffd47f5a899bf12f3528c4f0e726b Mon Sep 17 00:00:00 2001
+From: Lyude Paul <lyude@redhat.com>
+Date: Fri, 4 Feb 2022 13:05:04 -0500
+Subject: drm/nouveau/backlight: Fix LVDS backlight detection on some laptops
+
+From: Lyude Paul <lyude@redhat.com>
+
+commit 6b0076540faffd47f5a899bf12f3528c4f0e726b upstream.
+
+It seems that some laptops will report having both an eDP and LVDS
+connector, even though only the LVDS connector is actually hooked up. This
+can lead to issues with backlight registration if the eDP connector ends up
+getting registered before the LVDS connector, as the backlight device will
+then be registered to the eDP connector instead of the LVDS connector.
+
+So, fix this by only registering the backlight on connectors that are
+reported as being connected.
+
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Fixes: 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")
+Bugzilla: https://gitlab.freedesktop.org/drm/nouveau/-/issues/137
+Cc: <stable@vger.kernel.org> # v5.15+
+Reviewed-by: Karol Herbst <kherbst@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220204180504.328999-1-lyude@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_backlight.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
++++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
+@@ -294,7 +294,8 @@ nv50_backlight_init(struct nouveau_backl
+       struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
+       struct nvif_object *device = &drm->client.device.object;
+-      if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)))
++      if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)) ||
++          nv_conn->base.status != connector_status_connected)
+               return -ENODEV;
+       if (nv_conn->type == DCB_CONNECTOR_eDP) {
diff --git a/queue-5.16/drm-nouveau-backlight-just-set-all-backlight-types-as-raw.patch b/queue-5.16/drm-nouveau-backlight-just-set-all-backlight-types-as-raw.patch
new file mode 100644 (file)
index 0000000..c6867ab
--- /dev/null
@@ -0,0 +1,58 @@
+From b21a142fd2055d8276169efcc95b624ff908a341 Mon Sep 17 00:00:00 2001
+From: Lyude Paul <lyude@redhat.com>
+Date: Fri, 4 Feb 2022 14:33:19 -0500
+Subject: drm/nouveau/backlight: Just set all backlight types as RAW
+
+From: Lyude Paul <lyude@redhat.com>
+
+commit b21a142fd2055d8276169efcc95b624ff908a341 upstream.
+
+Currently we can get a warning on systems with eDP backlights like so:
+
+  nv_backlight: invalid backlight type
+  WARNING: CPU: 4 PID: 454 at drivers/video/backlight/backlight.c:420
+    backlight_device_register+0x226/0x250
+
+This happens as a result of us not filling out props.type for the eDP
+backlight, even though we do it for all other backlight types.
+
+Since nothing in our driver uses anything but BACKLIGHT_RAW, let's take the
+props\.type assignments out of the codepaths for individual backlight types
+and just set it unconditionally to prevent this from happening again.
+
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Fixes: 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")
+Cc: <stable@vger.kernel.org> # v5.15+
+Reviewed-by: Karol Herbst <kherbst@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220204193319.451119-1-lyude@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_backlight.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
++++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
+@@ -101,7 +101,6 @@ nv40_backlight_init(struct nouveau_encod
+       if (!(nvif_rd32(device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
+               return -ENODEV;
+-      props->type = BACKLIGHT_RAW;
+       props->max_brightness = 31;
+       *ops = &nv40_bl_ops;
+       return 0;
+@@ -340,7 +339,6 @@ nv50_backlight_init(struct nouveau_backl
+       else
+               *ops = &nva3_bl_ops;
+-      props->type = BACKLIGHT_RAW;
+       props->max_brightness = 100;
+       return 0;
+@@ -408,6 +406,7 @@ nouveau_backlight_init(struct drm_connec
+               goto fail_alloc;
+       }
++      props.type = BACKLIGHT_RAW;
+       bl->dev = backlight_device_register(backlight_name, connector->kdev,
+                                           nv_encoder, ops, &props);
+       if (IS_ERR(bl->dev)) {
diff --git a/queue-5.16/drm-syncobj-flatten-dma_fence_chains-on-transfer.patch b/queue-5.16/drm-syncobj-flatten-dma_fence_chains-on-transfer.patch
new file mode 100644 (file)
index 0000000..07b635b
--- /dev/null
@@ -0,0 +1,112 @@
+From 721255b52700b320c4ae2e23d57f7d9ad1db50b9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Wed, 9 Feb 2022 19:13:04 +0100
+Subject: drm/syncobj: flatten dma_fence_chains on transfer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian König <christian.koenig@amd.com>
+
+commit 721255b52700b320c4ae2e23d57f7d9ad1db50b9 upstream.
+
+It is illegal to add a dma_fence_chain as timeline point. Flatten out
+the fences into a dma_fence_array instead.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Nirmoy Das <nirmoy.das@linux.intel.com>
+Cc: <stable@vger.kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220209182600.434803-1-christian.koenig@amd.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_syncobj.c |   61 ++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 56 insertions(+), 5 deletions(-)
+
+--- a/drivers/gpu/drm/drm_syncobj.c
++++ b/drivers/gpu/drm/drm_syncobj.c
+@@ -853,12 +853,57 @@ drm_syncobj_fd_to_handle_ioctl(struct dr
+                                       &args->handle);
+ }
++
++/*
++ * Try to flatten a dma_fence_chain into a dma_fence_array so that it can be
++ * added as timeline fence to a chain again.
++ */
++static int drm_syncobj_flatten_chain(struct dma_fence **f)
++{
++      struct dma_fence_chain *chain = to_dma_fence_chain(*f);
++      struct dma_fence *tmp, **fences;
++      struct dma_fence_array *array;
++      unsigned int count;
++
++      if (!chain)
++              return 0;
++
++      count = 0;
++      dma_fence_chain_for_each(tmp, &chain->base)
++              ++count;
++
++      fences = kmalloc_array(count, sizeof(*fences), GFP_KERNEL);
++      if (!fences)
++              return -ENOMEM;
++
++      count = 0;
++      dma_fence_chain_for_each(tmp, &chain->base)
++              fences[count++] = dma_fence_get(tmp);
++
++      array = dma_fence_array_create(count, fences,
++                                     dma_fence_context_alloc(1),
++                                     1, false);
++      if (!array)
++              goto free_fences;
++
++      dma_fence_put(*f);
++      *f = &array->base;
++      return 0;
++
++free_fences:
++      while (count--)
++              dma_fence_put(fences[count]);
++
++      kfree(fences);
++      return -ENOMEM;
++}
++
+ static int drm_syncobj_transfer_to_timeline(struct drm_file *file_private,
+                                           struct drm_syncobj_transfer *args)
+ {
+       struct drm_syncobj *timeline_syncobj = NULL;
+-      struct dma_fence *fence;
+       struct dma_fence_chain *chain;
++      struct dma_fence *fence;
+       int ret;
+       timeline_syncobj = drm_syncobj_find(file_private, args->dst_handle);
+@@ -869,16 +914,22 @@ static int drm_syncobj_transfer_to_timel
+                                    args->src_point, args->flags,
+                                    &fence);
+       if (ret)
+-              goto err;
++              goto err_put_timeline;
++
++      ret = drm_syncobj_flatten_chain(&fence);
++      if (ret)
++              goto err_free_fence;
++
+       chain = dma_fence_chain_alloc();
+       if (!chain) {
+               ret = -ENOMEM;
+-              goto err1;
++              goto err_free_fence;
+       }
++
+       drm_syncobj_add_point(timeline_syncobj, chain, fence, args->dst_point);
+-err1:
++err_free_fence:
+       dma_fence_put(fence);
+-err:
++err_put_timeline:
+       drm_syncobj_put(timeline_syncobj);
+       return ret;
diff --git a/queue-5.16/exec-force-single-empty-string-when-argv-is-empty.patch b/queue-5.16/exec-force-single-empty-string-when-argv-is-empty.patch
new file mode 100644 (file)
index 0000000..e94f7a6
--- /dev/null
@@ -0,0 +1,129 @@
+From dcd46d897adb70d63e025f175a00a89797d31a43 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Mon, 31 Jan 2022 16:09:47 -0800
+Subject: exec: Force single empty string when argv is empty
+
+From: Kees Cook <keescook@chromium.org>
+
+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 <ariadne@dereferenced.org>
+Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Christian Brauner <brauner@kernel.org>
+Cc: Rich Felker <dalias@libc.org>
+Cc: Eric Biederman <ebiederm@xmission.com>
+Cc: Alexander Viro <viro@zeniv.linux.org.uk>
+Cc: linux-fsdevel@vger.kernel.org
+Cc: stable@vger.kernel.org
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Acked-by: Christian Brauner <brauner@kernel.org>
+Acked-by: Ariadne Conill <ariadne@dereferenced.org>
+Acked-by: Andy Lutomirski <luto@kernel.org>
+Link: https://lore.kernel.org/r/20220201000947.2453721-1-keescook@chromium.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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;
+@@ -1893,6 +1899,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;
+@@ -1919,6 +1928,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);
+@@ -1947,6 +1969,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.16/fbdev-hot-unplug-firmware-fb-devices-on-forced-removal.patch b/queue-5.16/fbdev-hot-unplug-firmware-fb-devices-on-forced-removal.patch
new file mode 100644 (file)
index 0000000..d649de8
--- /dev/null
@@ -0,0 +1,119 @@
+From 27599aacbaefcbf2af7b06b0029459bbf682000d Mon Sep 17 00:00:00 2001
+From: Thomas Zimmermann <tzimmermann@suse.de>
+Date: Tue, 25 Jan 2022 10:12:18 +0100
+Subject: fbdev: Hot-unplug firmware fb devices on forced removal
+
+From: Thomas Zimmermann <tzimmermann@suse.de>
+
+commit 27599aacbaefcbf2af7b06b0029459bbf682000d upstream.
+
+Hot-unplug all firmware-framebuffer devices as part of removing
+them via remove_conflicting_framebuffers() et al. Releases all
+memory regions to be acquired by native drivers.
+
+Firmware, such as EFI, install a framebuffer while posting the
+computer. After removing the firmware-framebuffer device from fbdev,
+a native driver takes over the hardware and the firmware framebuffer
+becomes invalid.
+
+Firmware-framebuffer drivers, specifically simplefb, don't release
+their device from Linux' device hierarchy. It still owns the firmware
+framebuffer and blocks the native drivers from loading. This has been
+observed in the vmwgfx driver. [1]
+
+Initiating a device removal (i.e., hot unplug) as part of
+remove_conflicting_framebuffers() removes the underlying device and
+returns the memory range to the system.
+
+[1] https://lore.kernel.org/dri-devel/20220117180359.18114-1-zack@kde.org/
+
+v2:
+       * rename variable 'dev' to 'device' (Javier)
+
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Reported-by: Zack Rusin <zackr@vmware.com>
+Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
+Reviewed-by: Zack Rusin <zackr@vmware.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+CC: stable@vger.kernel.org # v5.11+
+Link: https://patchwork.freedesktop.org/patch/msgid/20220125091222.21457-2-tzimmermann@suse.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/fbdev/core/fbmem.c |   29 ++++++++++++++++++++++++++---
+ include/linux/fb.h               |    1 +
+ 2 files changed, 27 insertions(+), 3 deletions(-)
+
+--- a/drivers/video/fbdev/core/fbmem.c
++++ b/drivers/video/fbdev/core/fbmem.c
+@@ -25,6 +25,7 @@
+ #include <linux/init.h>
+ #include <linux/linux_logo.h>
+ #include <linux/proc_fs.h>
++#include <linux/platform_device.h>
+ #include <linux/seq_file.h>
+ #include <linux/console.h>
+ #include <linux/kmod.h>
+@@ -1557,18 +1558,36 @@ static void do_remove_conflicting_frameb
+       /* check all firmware fbs and kick off if the base addr overlaps */
+       for_each_registered_fb(i) {
+               struct apertures_struct *gen_aper;
++              struct device *device;
+               if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
+                       continue;
+               gen_aper = registered_fb[i]->apertures;
++              device = registered_fb[i]->device;
+               if (fb_do_apertures_overlap(gen_aper, a) ||
+                       (primary && gen_aper && gen_aper->count &&
+                        gen_aper->ranges[0].base == VGA_FB_PHYS)) {
+                       printk(KERN_INFO "fb%d: switching to %s from %s\n",
+                              i, name, registered_fb[i]->fix.id);
+-                      do_unregister_framebuffer(registered_fb[i]);
++
++                      /*
++                       * If we kick-out a firmware driver, we also want to remove
++                       * the underlying platform device, such as simple-framebuffer,
++                       * VESA, EFI, etc. A native driver will then be able to
++                       * allocate the memory range.
++                       *
++                       * If it's not a platform device, at least print a warning. A
++                       * fix would add code to remove the device from the system.
++                       */
++                      if (dev_is_platform(device)) {
++                              registered_fb[i]->forced_out = true;
++                              platform_device_unregister(to_platform_device(device));
++                      } else {
++                              pr_warn("fb%d: cannot remove device\n", i);
++                              do_unregister_framebuffer(registered_fb[i]);
++                      }
+               }
+       }
+ }
+@@ -1898,9 +1917,13 @@ EXPORT_SYMBOL(register_framebuffer);
+ void
+ unregister_framebuffer(struct fb_info *fb_info)
+ {
+-      mutex_lock(&registration_lock);
++      bool forced_out = fb_info->forced_out;
++
++      if (!forced_out)
++              mutex_lock(&registration_lock);
+       do_unregister_framebuffer(fb_info);
+-      mutex_unlock(&registration_lock);
++      if (!forced_out)
++              mutex_unlock(&registration_lock);
+ }
+ EXPORT_SYMBOL(unregister_framebuffer);
+--- a/include/linux/fb.h
++++ b/include/linux/fb.h
+@@ -502,6 +502,7 @@ struct fb_info {
+       } *apertures;
+       bool skip_vt_switch; /* no VT switch on suspend/resume required */
++      bool forced_out; /* set when being removed by another driver */
+ };
+ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
diff --git a/queue-5.16/lib-raid6-test-fix-multiple-definition-linking-error.patch b/queue-5.16/lib-raid6-test-fix-multiple-definition-linking-error.patch
new file mode 100644 (file)
index 0000000..7d28e22
--- /dev/null
@@ -0,0 +1,41 @@
+From a5359ddd052860bacf957e65fe819c63e974b3a6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dmueller@suse.de>
+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 <dmueller@suse.de>
+
+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: <stable@vger.kernel.org>
+Signed-off-by: Dirk Müller <dmueller@suse.de>
+Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Song Liu <song@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch b/queue-5.16/media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch
new file mode 100644 (file)
index 0000000..bd83500
--- /dev/null
@@ -0,0 +1,56 @@
+From d42b3ad105b5d3481f6a56bc789aa2b27aa09325 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Wed, 22 Dec 2021 15:20:23 +0100
+Subject: media: davinci: vpif: fix unbalanced runtime PM enable
+
+From: Johan Hovold <johan@kernel.org>
+
+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 <khilman@baylibre.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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_irq;
+       struct platform_device *pdev_capture, *pdev_display;
+       struct device_node *endpoint = NULL;
++      int ret;
+       vpif_base = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(vpif_base))
+@@ -456,8 +457,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),
+@@ -491,6 +492,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.16/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch b/queue-5.16/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch
new file mode 100644 (file)
index 0000000..143ee4b
--- /dev/null
@@ -0,0 +1,33 @@
+From 4a321de239213300a714fa0353a5f1272d381a44 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Wed, 22 Dec 2021 15:20:22 +0100
+Subject: media: davinci: vpif: fix unbalanced runtime PM get
+
+From: Johan Hovold <johan@kernel.org>
+
+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 <prabhakar.csengg@gmail.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -495,6 +495,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.16/media-davinci-vpif-fix-use-after-free-on-driver-unbind.patch b/queue-5.16/media-davinci-vpif-fix-use-after-free-on-driver-unbind.patch
new file mode 100644 (file)
index 0000000..ffe0913
--- /dev/null
@@ -0,0 +1,183 @@
+From 43acb728bbc40169d2e2425e84a80068270974be Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Wed, 22 Dec 2021 15:20:24 +0100
+Subject: media: davinci: vpif: fix use-after-free on driver unbind
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 43acb728bbc40169d2e2425e84a80068270974be upstream.
+
+The driver allocates and registers two platform device structures during
+probe, but the devices were never deregistered on driver unbind.
+
+This results in a use-after-free on driver unbind as the device
+structures were allocated using devres and would be freed by driver
+core when remove() returns.
+
+Fix this by adding the missing deregistration calls to the remove()
+callback and failing probe on registration errors.
+
+Note that the platform device structures must be freed using a proper
+release callback to avoid leaking associated resources like device
+names.
+
+Fixes: 479f7a118105 ("[media] davinci: vpif: adaptions for DT support")
+Cc: stable@vger.kernel.org      # 4.12
+Cc: Kevin Hilman <khilman@baylibre.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/platform/davinci/vpif.c |   97 ++++++++++++++++++++++++----------
+ 1 file changed, 71 insertions(+), 26 deletions(-)
+
+--- a/drivers/media/platform/davinci/vpif.c
++++ b/drivers/media/platform/davinci/vpif.c
+@@ -41,6 +41,11 @@ MODULE_ALIAS("platform:" VPIF_DRIVER_NAM
+ #define VPIF_CH2_MAX_MODES    15
+ #define VPIF_CH3_MAX_MODES    2
++struct vpif_data {
++      struct platform_device *capture;
++      struct platform_device *display;
++};
++
+ DEFINE_SPINLOCK(vpif_lock);
+ EXPORT_SYMBOL_GPL(vpif_lock);
+@@ -423,17 +428,31 @@ int vpif_channel_getfid(u8 channel_id)
+ }
+ EXPORT_SYMBOL(vpif_channel_getfid);
++static void vpif_pdev_release(struct device *dev)
++{
++      struct platform_device *pdev = to_platform_device(dev);
++
++      kfree(pdev);
++}
++
+ static int vpif_probe(struct platform_device *pdev)
+ {
+       static struct resource *res_irq;
+       struct platform_device *pdev_capture, *pdev_display;
+       struct device_node *endpoint = NULL;
++      struct vpif_data *data;
+       int ret;
+       vpif_base = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(vpif_base))
+               return PTR_ERR(vpif_base);
++      data = kzalloc(sizeof(*data), GFP_KERNEL);
++      if (!data)
++              return -ENOMEM;
++
++      platform_set_drvdata(pdev, data);
++
+       pm_runtime_enable(&pdev->dev);
+       pm_runtime_get(&pdev->dev);
+@@ -461,49 +480,75 @@ static int vpif_probe(struct platform_de
+               goto err_put_rpm;
+       }
+-      pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture),
+-                                  GFP_KERNEL);
+-      if (pdev_capture) {
+-              pdev_capture->name = "vpif_capture";
+-              pdev_capture->id = -1;
+-              pdev_capture->resource = res_irq;
+-              pdev_capture->num_resources = 1;
+-              pdev_capture->dev.dma_mask = pdev->dev.dma_mask;
+-              pdev_capture->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
+-              pdev_capture->dev.parent = &pdev->dev;
+-              platform_device_register(pdev_capture);
+-      } else {
+-              dev_warn(&pdev->dev, "Unable to allocate memory for pdev_capture.\n");
++      pdev_capture = kzalloc(sizeof(*pdev_capture), GFP_KERNEL);
++      if (!pdev_capture) {
++              ret = -ENOMEM;
++              goto err_put_rpm;
+       }
+-      pdev_display = devm_kzalloc(&pdev->dev, sizeof(*pdev_display),
+-                                  GFP_KERNEL);
+-      if (pdev_display) {
+-              pdev_display->name = "vpif_display";
+-              pdev_display->id = -1;
+-              pdev_display->resource = res_irq;
+-              pdev_display->num_resources = 1;
+-              pdev_display->dev.dma_mask = pdev->dev.dma_mask;
+-              pdev_display->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
+-              pdev_display->dev.parent = &pdev->dev;
+-              platform_device_register(pdev_display);
+-      } else {
+-              dev_warn(&pdev->dev, "Unable to allocate memory for pdev_display.\n");
++      pdev_capture->name = "vpif_capture";
++      pdev_capture->id = -1;
++      pdev_capture->resource = res_irq;
++      pdev_capture->num_resources = 1;
++      pdev_capture->dev.dma_mask = pdev->dev.dma_mask;
++      pdev_capture->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
++      pdev_capture->dev.parent = &pdev->dev;
++      pdev_capture->dev.release = vpif_pdev_release;
++
++      ret = platform_device_register(pdev_capture);
++      if (ret)
++              goto err_put_pdev_capture;
++
++      pdev_display = kzalloc(sizeof(*pdev_display), GFP_KERNEL);
++      if (!pdev_display) {
++              ret = -ENOMEM;
++              goto err_put_pdev_capture;
+       }
++      pdev_display->name = "vpif_display";
++      pdev_display->id = -1;
++      pdev_display->resource = res_irq;
++      pdev_display->num_resources = 1;
++      pdev_display->dev.dma_mask = pdev->dev.dma_mask;
++      pdev_display->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
++      pdev_display->dev.parent = &pdev->dev;
++      pdev_display->dev.release = vpif_pdev_release;
++
++      ret = platform_device_register(pdev_display);
++      if (ret)
++              goto err_put_pdev_display;
++
++      data->capture = pdev_capture;
++      data->display = pdev_display;
++
+       return 0;
++err_put_pdev_display:
++      platform_device_put(pdev_display);
++err_put_pdev_capture:
++      platform_device_put(pdev_capture);
+ err_put_rpm:
+       pm_runtime_put(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
++      kfree(data);
+       return ret;
+ }
+ static int vpif_remove(struct platform_device *pdev)
+ {
++      struct vpif_data *data = platform_get_drvdata(pdev);
++
++      if (data->capture)
++              platform_device_unregister(data->capture);
++      if (data->display)
++              platform_device_unregister(data->display);
++
+       pm_runtime_put(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
++
++      kfree(data);
++
+       return 0;
+ }
diff --git a/queue-5.16/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch b/queue-5.16/media-gpio-ir-tx-fix-transmit-with-long-spaces-on-orange-pi-pc.patch
new file mode 100644 (file)
index 0000000..f7a3d0e
--- /dev/null
@@ -0,0 +1,79 @@
+From 5ad05ecad4326ddaa26a83ba2233a67be24c1aaa Mon Sep 17 00:00:00 2001
+From: Sean Young <sean@mess.org>
+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 <sean@mess.org>
+
+commit 5ad05ecad4326ddaa26a83ba2233a67be24c1aaa upstream.
+
+Calling udelay for than 1000us does not always yield the correct
+results.
+
+Cc: stable@vger.kernel.org
+Reported-by: ÐœÐ¸Ñ…аил <vrserver1@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/media-omap3isp-use-struct_group-for-memcpy-region.patch b/queue-5.16/media-omap3isp-use-struct_group-for-memcpy-region.patch
new file mode 100644 (file)
index 0000000..266ce73
--- /dev/null
@@ -0,0 +1,128 @@
+From d4568fc8525897e683983806f813be1ae9eedaed Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Mon, 24 Jan 2022 18:29:52 +0100
+Subject: media: omap3isp: Use struct_group() for memcpy() region
+
+From: Kees Cook <keescook@chromium.org>
+
+commit d4568fc8525897e683983806f813be1ae9eedaed upstream.
+
+In preparation for FORTIFY_SOURCE performing compile-time and run-time
+field bounds checking for memcpy(), memmove(), and memset(), avoid
+intentionally writing across neighboring fields. Wrap the target region
+in struct_group(). This additionally fixes a theoretical misalignment
+of the copy (since the size of "buf" changes between 64-bit and 32-bit,
+but this is likely never built for 64-bit).
+
+FWIW, I think this code is totally broken on 64-bit (which appears to
+not be a "real" build configuration): it would either always fail (with
+an uninitialized data->buf_size) or would cause corruption in userspace
+due to the copy_to_user() in the call path against an uninitialized
+data->buf value:
+
+omap3isp_stat_request_statistics_time32(...)
+    struct omap3isp_stat_data data64;
+    ...
+    omap3isp_stat_request_statistics(stat, &data64);
+
+int omap3isp_stat_request_statistics(struct ispstat *stat,
+                                     struct omap3isp_stat_data *data)
+    ...
+    buf = isp_stat_buf_get(stat, data);
+
+static struct ispstat_buffer *isp_stat_buf_get(struct ispstat *stat,
+                                               struct omap3isp_stat_data *data)
+...
+    if (buf->buf_size > data->buf_size) {
+            ...
+            return ERR_PTR(-EINVAL);
+    }
+    ...
+    rval = copy_to_user(data->buf,
+                        buf->virt_addr,
+                        buf->buf_size);
+
+Regardless, additionally initialize data64 to be zero-filled to avoid
+undefined behavior.
+
+Link: https://lore.kernel.org/lkml/20211215220505.GB21862@embeddedor
+
+Cc: Arnd Bergmann <arnd@arndb.de>
+Fixes: 378e3f81cb56 ("media: omap3isp: support 64-bit version of omap3isp_stat_data")
+Cc: stable@vger.kernel.org
+Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/platform/omap3isp/ispstat.c |    5 +++--
+ include/uapi/linux/omap3isp.h             |   21 +++++++++++++--------
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+
+--- a/drivers/media/platform/omap3isp/ispstat.c
++++ b/drivers/media/platform/omap3isp/ispstat.c
+@@ -512,7 +512,7 @@ int omap3isp_stat_request_statistics(str
+ int omap3isp_stat_request_statistics_time32(struct ispstat *stat,
+                                       struct omap3isp_stat_data_time32 *data)
+ {
+-      struct omap3isp_stat_data data64;
++      struct omap3isp_stat_data data64 = { };
+       int ret;
+       ret = omap3isp_stat_request_statistics(stat, &data64);
+@@ -521,7 +521,8 @@ int omap3isp_stat_request_statistics_tim
+       data->ts.tv_sec = data64.ts.tv_sec;
+       data->ts.tv_usec = data64.ts.tv_usec;
+-      memcpy(&data->buf, &data64.buf, sizeof(*data) - sizeof(data->ts));
++      data->buf = (uintptr_t)data64.buf;
++      memcpy(&data->frame, &data64.frame, sizeof(data->frame));
+       return 0;
+ }
+--- a/include/uapi/linux/omap3isp.h
++++ b/include/uapi/linux/omap3isp.h
+@@ -162,6 +162,7 @@ struct omap3isp_h3a_aewb_config {
+  * struct omap3isp_stat_data - Statistic data sent to or received from user
+  * @ts: Timestamp of returned framestats.
+  * @buf: Pointer to pass to user.
++ * @buf_size: Size of buffer.
+  * @frame_number: Frame number of requested stats.
+  * @cur_frame: Current frame number being processed.
+  * @config_counter: Number of the configuration associated with the data.
+@@ -176,10 +177,12 @@ struct omap3isp_stat_data {
+       struct timeval ts;
+ #endif
+       void __user *buf;
+-      __u32 buf_size;
+-      __u16 frame_number;
+-      __u16 cur_frame;
+-      __u16 config_counter;
++      __struct_group(/* no tag */, frame, /* no attrs */,
++              __u32 buf_size;
++              __u16 frame_number;
++              __u16 cur_frame;
++              __u16 config_counter;
++      );
+ };
+ #ifdef __KERNEL__
+@@ -189,10 +192,12 @@ struct omap3isp_stat_data_time32 {
+               __s32   tv_usec;
+       } ts;
+       __u32 buf;
+-      __u32 buf_size;
+-      __u16 frame_number;
+-      __u16 cur_frame;
+-      __u16 config_counter;
++      __struct_group(/* no tag */, frame, /* no attrs */,
++              __u32 buf_size;
++              __u16 frame_number;
++              __u16 cur_frame;
++              __u16 config_counter;
++      );
+ };
+ #endif
diff --git a/queue-5.16/media-venus-hfi_cmds-list-hdr10-property-as-unsupported-for-v1-and-v3.patch b/queue-5.16/media-venus-hfi_cmds-list-hdr10-property-as-unsupported-for-v1-and-v3.patch
new file mode 100644 (file)
index 0000000..dfaef89
--- /dev/null
@@ -0,0 +1,32 @@
+From 22beb839f48d841ec75974872863dc253d37c21c Mon Sep 17 00:00:00 2001
+From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+Date: Tue, 1 Feb 2022 16:51:29 +0100
+Subject: media: venus: hfi_cmds: List HDR10 property as unsupported for v1 and v3
+
+From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+
+commit 22beb839f48d841ec75974872863dc253d37c21c upstream.
+
+The HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI HFI property is not supported
+on Venus v1 and v3.
+
+cc: stable@vger.kernel.org # 5.13+
+Fixes: 9172652d72f8 ("media: venus: venc: Add support for CLL and Mastering display controls")
+Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/platform/qcom/venus/hfi_cmds.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
++++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
+@@ -1054,6 +1054,8 @@ static int pkt_session_set_property_1x(s
+               pkt->shdr.hdr.size += sizeof(u32) + sizeof(*info);
+               break;
+       }
++      case HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI:
++              return -ENOTSUPP;
+       /* FOLLOWING PROPERTIES ARE NOT IMPLEMENTED IN CORE YET */
+       case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS:
diff --git a/queue-5.16/media-venus-vdec-fixed-possible-memory-leak-issue.patch b/queue-5.16/media-venus-vdec-fixed-possible-memory-leak-issue.patch
new file mode 100644 (file)
index 0000000..18e460e
--- /dev/null
@@ -0,0 +1,48 @@
+From 8403fdd775858a7bf04868d43daea0acbe49ddfc Mon Sep 17 00:00:00 2001
+From: Ameer Hamza <amhamza.mgc@gmail.com>
+Date: Mon, 6 Dec 2021 11:43:15 +0100
+Subject: media: venus: vdec: fixed possible memory leak issue
+
+From: Ameer Hamza <amhamza.mgc@gmail.com>
+
+commit 8403fdd775858a7bf04868d43daea0acbe49ddfc upstream.
+
+The venus_helper_alloc_dpb_bufs() implementation allows an early return
+on an error path when checking the id from ida_alloc_min() which would
+not release the earlier buffer allocation.
+
+Move the direct kfree() from the error checking of dma_alloc_attrs() to
+the common fail path to ensure that allocations are released on all
+error paths in this function.
+
+Addresses-Coverity: 1494120 ("Resource leak")
+
+cc: stable@vger.kernel.org # 5.16+
+Fixes: 40d87aafee29 ("media: venus: vdec: decoded picture buffer handling during reconfig sequence")
+Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/platform/qcom/venus/helpers.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/platform/qcom/venus/helpers.c
++++ b/drivers/media/platform/qcom/venus/helpers.c
+@@ -189,7 +189,6 @@ int venus_helper_alloc_dpb_bufs(struct v
+               buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+                                         buf->attrs);
+               if (!buf->va) {
+-                      kfree(buf);
+                       ret = -ENOMEM;
+                       goto fail;
+               }
+@@ -209,6 +208,7 @@ int venus_helper_alloc_dpb_bufs(struct v
+       return 0;
+ fail:
++      kfree(buf);
+       venus_helper_free_dpb_bufs(inst);
+       return ret;
+ }
diff --git a/queue-5.16/media-venus-venc-fix-h264-8x8-transform-control.patch b/queue-5.16/media-venus-venc-fix-h264-8x8-transform-control.patch
new file mode 100644 (file)
index 0000000..cebffe4
--- /dev/null
@@ -0,0 +1,66 @@
+From 61b3317dd424a3488b6754d7ff8301944d9d17d7 Mon Sep 17 00:00:00 2001
+From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+Date: Tue, 8 Feb 2022 02:18:16 +0100
+Subject: media: venus: venc: Fix h264 8x8 transform control
+
+From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+
+commit 61b3317dd424a3488b6754d7ff8301944d9d17d7 upstream.
+
+During encoder driver open controls are initialized via a call
+to v4l2_ctrl_handler_setup which returns EINVAL error for
+V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM v4l2 control. The control
+default value is disabled and because of firmware limitations
+8x8 transform cannot be disabled for the supported HIGH and
+CONSTRAINED_HIGH profiles.
+
+To fix the issue change the control default value to enabled
+(this is fine because the firmware enables 8x8 transform for
+high and constrained_high profiles by default). Also, correct
+the checking of profile ids in s_ctrl from hfi to v4l2 ids.
+
+cc: stable@vger.kernel.org # 5.15+
+Fixes: bfee75f73c37 ("media: venus: venc: add support for V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM control")
+Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/platform/qcom/venus/venc.c       |    4 ++--
+ drivers/media/platform/qcom/venus/venc_ctrls.c |    6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/media/platform/qcom/venus/venc.c
++++ b/drivers/media/platform/qcom/venus/venc.c
+@@ -662,8 +662,8 @@ static int venc_set_properties(struct ve
+               ptype = HFI_PROPERTY_PARAM_VENC_H264_TRANSFORM_8X8;
+               h264_transform.enable_type = 0;
+-              if (ctr->profile.h264 == HFI_H264_PROFILE_HIGH ||
+-                  ctr->profile.h264 == HFI_H264_PROFILE_CONSTRAINED_HIGH)
++              if (ctr->profile.h264 == V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ||
++                  ctr->profile.h264 == V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH)
+                       h264_transform.enable_type = ctr->h264_8x8_transform;
+               ret = hfi_session_set_property(inst, ptype, &h264_transform);
+--- a/drivers/media/platform/qcom/venus/venc_ctrls.c
++++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
+@@ -320,8 +320,8 @@ static int venc_op_s_ctrl(struct v4l2_ct
+               ctr->intra_refresh_period = ctrl->val;
+               break;
+       case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
+-              if (ctr->profile.h264 != HFI_H264_PROFILE_HIGH &&
+-                  ctr->profile.h264 != HFI_H264_PROFILE_CONSTRAINED_HIGH)
++              if (ctr->profile.h264 != V4L2_MPEG_VIDEO_H264_PROFILE_HIGH &&
++                  ctr->profile.h264 != V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH)
+                       return -EINVAL;
+               /*
+@@ -457,7 +457,7 @@ int venc_ctrl_init(struct venus_inst *in
+                         V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP, 1, 51, 1, 1);
+       v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
+-                        V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, 0, 1, 1, 0);
++                        V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, 0, 1, 1, 1);
+       v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
+                         V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP, 1, 51, 1, 1);
diff --git a/queue-5.16/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch b/queue-5.16/mgag200-fix-memmapsl-configuration-in-gctl6-register.patch
new file mode 100644 (file)
index 0000000..c4d6a70
--- /dev/null
@@ -0,0 +1,83 @@
+From 028a73e10705af1ffd51f2537460f616dc58680e Mon Sep 17 00:00:00 2001
+From: Jocelyn Falempe <jfalempe@redhat.com>
+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 <jfalempe@redhat.com>
+
+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 <jfalempe@redhat.com>
+Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
+Acked-by: Lyude Paul <lyude@redhat.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220119102905.1194787-1-jfalempe@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -529,7 +529,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.16/pci-imx6-allow-to-probe-when-dw_pcie_wait_for_link-fails.patch b/queue-5.16/pci-imx6-allow-to-probe-when-dw_pcie_wait_for_link-fails.patch
new file mode 100644 (file)
index 0000000..08c3f5f
--- /dev/null
@@ -0,0 +1,80 @@
+From f81f095e87715e198471f4653952fe5e3f824874 Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <festevam@gmail.com>
+Date: Thu, 6 Jan 2022 07:36:45 -0300
+Subject: PCI: imx6: Allow to probe when dw_pcie_wait_for_link() fails
+
+From: Fabio Estevam <festevam@gmail.com>
+
+commit f81f095e87715e198471f4653952fe5e3f824874 upstream.
+
+The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into
+common code") was to standardize the behavior of link down as explained
+in its commit log:
+
+"The behavior for a link down was inconsistent as some drivers would fail
+probe in that case while others succeed. Let's standardize this to
+succeed as there are usecases where devices (and the link) appear later
+even without hotplug. For example, a reconfigured FPGA device."
+
+The pci-imx6 still fails to probe when the link is not present, which
+causes the following warning:
+
+imx6q-pcie 8ffc000.pcie: Phy link never came up
+imx6q-pcie: probe of 8ffc000.pcie failed with error -110
+------------[ cut here ]------------
+WARNING: CPU: 0 PID: 30 at drivers/regulator/core.c:2257 _regulator_put.part.0+0x1b8/0x1dc
+Modules linked in:
+CPU: 0 PID: 30 Comm: kworker/u2:2 Not tainted 5.15.0-next-20211103 #1
+Hardware name: Freescale i.MX6 SoloX (Device Tree)
+Workqueue: events_unbound async_run_entry_fn
+[<c0111730>] (unwind_backtrace) from [<c010bb74>] (show_stack+0x10/0x14)
+[<c010bb74>] (show_stack) from [<c0f90290>] (dump_stack_lvl+0x58/0x70)
+[<c0f90290>] (dump_stack_lvl) from [<c012631c>] (__warn+0xd4/0x154)
+[<c012631c>] (__warn) from [<c0f87b00>] (warn_slowpath_fmt+0x74/0xa8)
+[<c0f87b00>] (warn_slowpath_fmt) from [<c076b4bc>] (_regulator_put.part.0+0x1b8/0x1dc)
+[<c076b4bc>] (_regulator_put.part.0) from [<c076b574>] (regulator_put+0x2c/0x3c)
+[<c076b574>] (regulator_put) from [<c08c3740>] (release_nodes+0x50/0x178)
+
+Fix this problem by ignoring the dw_pcie_wait_for_link() error like
+it is done on the other dwc drivers.
+
+Tested on imx6sx-sdb and imx6q-sabresd boards.
+
+Link: https://lore.kernel.org/r/20220106103645.2790803-1-festevam@gmail.com
+Fixes: 886a9c134755 ("PCI: dwc: Move link handling into common code")
+Signed-off-by: Fabio Estevam <festevam@gmail.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Rob Herring <robh@kernel.org>
+Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/dwc/pci-imx6.c |   10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+--- a/drivers/pci/controller/dwc/pci-imx6.c
++++ b/drivers/pci/controller/dwc/pci-imx6.c
+@@ -779,9 +779,7 @@ static int imx6_pcie_start_link(struct d
+       /* Start LTSSM. */
+       imx6_pcie_ltssm_enable(dev);
+-      ret = dw_pcie_wait_for_link(pci);
+-      if (ret)
+-              goto err_reset_phy;
++      dw_pcie_wait_for_link(pci);
+       if (pci->link_gen == 2) {
+               /* Allow Gen2 mode after the link is up. */
+@@ -817,11 +815,7 @@ static int imx6_pcie_start_link(struct d
+               }
+               /* Make sure link training is finished as well! */
+-              ret = dw_pcie_wait_for_link(pci);
+-              if (ret) {
+-                      dev_err(dev, "Failed to bring link up!\n");
+-                      goto err_reset_phy;
+-              }
++              dw_pcie_wait_for_link(pci);
+       } else {
+               dev_info(dev, "Link: Gen2 disabled\n");
+       }
diff --git a/queue-5.16/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch b/queue-5.16/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch
new file mode 100644 (file)
index 0000000..0b559c2
--- /dev/null
@@ -0,0 +1,53 @@
+From 92912b175178c7e895f5e5e9f1e30ac30319162b Mon Sep 17 00:00:00 2001
+From: Liguang Zhang <zhangliguang@linux.alibaba.com>
+Date: Thu, 11 Nov 2021 13:42:58 +0800
+Subject: PCI: pciehp: Clear cmd_busy bit in polling mode
+
+From: Liguang Zhang <zhangliguang@linux.alibaba.com>
+
+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 <zhangliguang@linux.alibaba.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Lukas Wunner <lukas@wunner.de>
+Cc: stable@vger.kernel.org     # v4.19+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch b/queue-5.16/pci-xgene-revert-pci-xgene-fix-ib-window-setup.patch
new file mode 100644 (file)
index 0000000..3193ba1
--- /dev/null
@@ -0,0 +1,49 @@
+From 825da4e9cec68713fbb02dc6f71fe1bf65fe8050 Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <maz@kernel.org>
+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 <maz@kernel.org>
+
+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 <maz@kernel.org>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: stable@vger.kernel.org
+Cc: Rob Herring <robh@kernel.org>
+Cc: Toan Le <toan@os.amperecomputing.com>
+Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: Krzysztof WilczyÅ„ski <kw@linux.com>
+Cc: Bjorn Helgaas <bhelgaas@google.com>
+Cc: Stéphane Graber <stgraber@ubuntu.com>
+Cc: dann frazier <dann.frazier@canonical.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -465,7 +465,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.16/pm-domains-fix-sleep-in-atomic-bug-caused-by-genpd_debug_remove.patch b/queue-5.16/pm-domains-fix-sleep-in-atomic-bug-caused-by-genpd_debug_remove.patch
new file mode 100644 (file)
index 0000000..e83d25e
--- /dev/null
@@ -0,0 +1,74 @@
+From f6bfe8b5b2c2a5ac8bd2fc7bca3706e6c3fc26d8 Mon Sep 17 00:00:00 2001
+From: Shawn Guo <shawn.guo@linaro.org>
+Date: Fri, 25 Feb 2022 14:48:15 +0800
+Subject: PM: domains: Fix sleep-in-atomic bug caused by genpd_debug_remove()
+
+From: Shawn Guo <shawn.guo@linaro.org>
+
+commit f6bfe8b5b2c2a5ac8bd2fc7bca3706e6c3fc26d8 upstream.
+
+When a genpd with GENPD_FLAG_IRQ_SAFE gets removed, the following
+sleep-in-atomic bug will be seen, as genpd_debug_remove() will be called
+with a spinlock being held.
+
+[    0.029183] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1460
+[    0.029204] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1, name: swapper/0
+[    0.029219] preempt_count: 1, expected: 0
+[    0.029230] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.17.0-rc4+ #489
+[    0.029245] Hardware name: Thundercomm TurboX CM2290 (DT)
+[    0.029256] Call trace:
+[    0.029265]  dump_backtrace.part.0+0xbc/0xd0
+[    0.029285]  show_stack+0x3c/0xa0
+[    0.029298]  dump_stack_lvl+0x7c/0xa0
+[    0.029311]  dump_stack+0x18/0x34
+[    0.029323]  __might_resched+0x10c/0x13c
+[    0.029338]  __might_sleep+0x4c/0x80
+[    0.029351]  down_read+0x24/0xd0
+[    0.029363]  lookup_one_len_unlocked+0x9c/0xcc
+[    0.029379]  lookup_positive_unlocked+0x10/0x50
+[    0.029392]  debugfs_lookup+0x68/0xac
+[    0.029406]  genpd_remove.part.0+0x12c/0x1b4
+[    0.029419]  of_genpd_remove_last+0xa8/0xd4
+[    0.029434]  psci_cpuidle_domain_probe+0x174/0x53c
+[    0.029449]  platform_probe+0x68/0xe0
+[    0.029462]  really_probe+0x190/0x430
+[    0.029473]  __driver_probe_device+0x90/0x18c
+[    0.029485]  driver_probe_device+0x40/0xe0
+[    0.029497]  __driver_attach+0xf4/0x1d0
+[    0.029508]  bus_for_each_dev+0x70/0xd0
+[    0.029523]  driver_attach+0x24/0x30
+[    0.029534]  bus_add_driver+0x164/0x22c
+[    0.029545]  driver_register+0x78/0x130
+[    0.029556]  __platform_driver_register+0x28/0x34
+[    0.029569]  psci_idle_init_domains+0x1c/0x28
+[    0.029583]  do_one_initcall+0x50/0x1b0
+[    0.029595]  kernel_init_freeable+0x214/0x280
+[    0.029609]  kernel_init+0x2c/0x13c
+[    0.029622]  ret_from_fork+0x10/0x20
+
+It doesn't seem necessary to call genpd_debug_remove() with the lock, so
+move it out from locking to fix the problem.
+
+Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power domains")
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
+Cc: 5.11+ <stable@vger.kernel.org> # 5.11+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/power/domain.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/base/power/domain.c
++++ b/drivers/base/power/domain.c
+@@ -2058,9 +2058,9 @@ static int genpd_remove(struct generic_p
+               kfree(link);
+       }
+-      genpd_debug_remove(genpd);
+       list_del(&genpd->gpd_list_node);
+       genpd_unlock(genpd);
++      genpd_debug_remove(genpd);
+       cancel_work_sync(&genpd->power_off_work);
+       if (genpd_is_cpu_domain(genpd))
+               free_cpumask_var(genpd->cpus);
diff --git a/queue-5.16/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch b/queue-5.16/pstore-don-t-use-semaphores-in-always-atomic-context-code.patch
new file mode 100644 (file)
index 0000000..644714c
--- /dev/null
@@ -0,0 +1,170 @@
+From 8126b1c73108bc691f5643df19071a59a69d0bc6 Mon Sep 17 00:00:00 2001
+From: Jann Horn <jannh@google.com>
+Date: Mon, 14 Mar 2022 19:59:53 +0100
+Subject: pstore: Don't use semaphores in always-atomic-context code
+
+From: Jann Horn <jannh@google.com>
+
+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 <bigeasy@linutronix.de>
+Signed-off-by: Jann Horn <jannh@google.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/20220314185953.2068993-1-jannh@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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:
+@@ -389,21 +390,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);
+       }
+       kmsg_dump_rewind(&iter);
+@@ -467,8 +466,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 = {
+@@ -594,7 +592,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 <linux/errno.h>
+ #include <linux/kmsg_dump.h>
+ #include <linux/mutex.h>
+-#include <linux/semaphore.h>
++#include <linux/spinlock.h>
+ #include <linux/time.h>
+ #include <linux/types.h>
+@@ -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.16/rfkill-make-new-event-layout-opt-in.patch b/queue-5.16/rfkill-make-new-event-layout-opt-in.patch
new file mode 100644 (file)
index 0000000..9608888
--- /dev/null
@@ -0,0 +1,180 @@
+From 54f586a9153201c6cff55e1f561990c78bd99aa7 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Wed, 16 Mar 2022 21:27:51 +0100
+Subject: rfkill: make new event layout opt-in
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 54f586a9153201c6cff55e1f561990c78bd99aa7 upstream.
+
+Again new complaints surfaced that we had broken the ABI here,
+although previously all the userspace tools had agreed that it
+was their mistake and fixed it. Yet now there are cases (e.g.
+RHEL) that want to run old userspace with newer kernels, and
+thus are broken.
+
+Since this is a bit of a whack-a-mole thing, change the whole
+extensibility scheme of rfkill to no longer just rely on the
+message lengths, but instead require userspace to opt in via a
+new ioctl to a given maximum event size that it is willing to
+understand.
+
+By default, set that to RFKILL_EVENT_SIZE_V1 (8), so that the
+behaviour for userspace not calling the ioctl will look as if
+it's just running on an older kernel.
+
+Fixes: 14486c82612a ("rfkill: add a reason to the HW rfkill state")
+Cc: stable@vger.kernel.org # 5.11+
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220316212749.16491491b270.Ifcb1950998330a596f29a2a162e00b7546a1d6d0@changeid
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/uapi/linux/rfkill.h |   14 +++++++++++-
+ net/rfkill/core.c           |   48 +++++++++++++++++++++++++++++++-------------
+ 2 files changed, 46 insertions(+), 16 deletions(-)
+
+--- a/include/uapi/linux/rfkill.h
++++ b/include/uapi/linux/rfkill.h
+@@ -159,8 +159,16 @@ struct rfkill_event_ext {
+  * old behaviour for all userspace, unless it explicitly opts in to the
+  * rules outlined here by using the new &struct rfkill_event_ext.
+  *
+- * Userspace using &struct rfkill_event_ext must adhere to the following
+- * rules
++ * Additionally, some other userspace (bluez, g-s-d) was reading with a
++ * large size but as streaming reads rather than message-based, or with
++ * too strict checks for the returned size. So eventually, we completely
++ * reverted this, and extended messages need to be opted in to by using
++ * an ioctl:
++ *
++ *  ioctl(fd, RFKILL_IOCTL_MAX_SIZE, sizeof(struct rfkill_event_ext));
++ *
++ * Userspace using &struct rfkill_event_ext and the ioctl must adhere to
++ * the following rules:
+  *
+  * 1. accept short writes, optionally using them to detect that it's
+  *    running on an older kernel;
+@@ -175,6 +183,8 @@ struct rfkill_event_ext {
+ #define RFKILL_IOC_MAGIC      'R'
+ #define RFKILL_IOC_NOINPUT    1
+ #define RFKILL_IOCTL_NOINPUT  _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
++#define RFKILL_IOC_MAX_SIZE   2
++#define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, __u32)
+ /* and that's all userspace gets */
+--- a/net/rfkill/core.c
++++ b/net/rfkill/core.c
+@@ -78,6 +78,7 @@ struct rfkill_data {
+       struct mutex            mtx;
+       wait_queue_head_t       read_wait;
+       bool                    input_handler;
++      u8                      max_size;
+ };
+@@ -1141,6 +1142,8 @@ static int rfkill_fop_open(struct inode
+       if (!data)
+               return -ENOMEM;
++      data->max_size = RFKILL_EVENT_SIZE_V1;
++
+       INIT_LIST_HEAD(&data->events);
+       mutex_init(&data->mtx);
+       init_waitqueue_head(&data->read_wait);
+@@ -1223,6 +1226,7 @@ static ssize_t rfkill_fop_read(struct fi
+                               list);
+       sz = min_t(unsigned long, sizeof(ev->ev), count);
++      sz = min_t(unsigned long, sz, data->max_size);
+       ret = sz;
+       if (copy_to_user(buf, &ev->ev, sz))
+               ret = -EFAULT;
+@@ -1237,6 +1241,7 @@ static ssize_t rfkill_fop_read(struct fi
+ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf,
+                               size_t count, loff_t *pos)
+ {
++      struct rfkill_data *data = file->private_data;
+       struct rfkill *rfkill;
+       struct rfkill_event_ext ev;
+       int ret;
+@@ -1251,6 +1256,7 @@ static ssize_t rfkill_fop_write(struct f
+        * our API version even in a write() call, if it cares.
+        */
+       count = min(count, sizeof(ev));
++      count = min_t(size_t, count, data->max_size);
+       if (copy_from_user(&ev, buf, count))
+               return -EFAULT;
+@@ -1310,31 +1316,47 @@ static int rfkill_fop_release(struct ino
+       return 0;
+ }
+-#ifdef CONFIG_RFKILL_INPUT
+ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
+                            unsigned long arg)
+ {
+       struct rfkill_data *data = file->private_data;
++      int ret = -ENOSYS;
++      u32 size;
+       if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC)
+               return -ENOSYS;
+-      if (_IOC_NR(cmd) != RFKILL_IOC_NOINPUT)
+-              return -ENOSYS;
+-
+       mutex_lock(&data->mtx);
+-
+-      if (!data->input_handler) {
+-              if (atomic_inc_return(&rfkill_input_disabled) == 1)
+-                      printk(KERN_DEBUG "rfkill: input handler disabled\n");
+-              data->input_handler = true;
++      switch (_IOC_NR(cmd)) {
++#ifdef CONFIG_RFKILL_INPUT
++      case RFKILL_IOC_NOINPUT:
++              if (!data->input_handler) {
++                      if (atomic_inc_return(&rfkill_input_disabled) == 1)
++                              printk(KERN_DEBUG "rfkill: input handler disabled\n");
++                      data->input_handler = true;
++              }
++              ret = 0;
++              break;
++#endif
++      case RFKILL_IOC_MAX_SIZE:
++              if (get_user(size, (__u32 __user *)arg)) {
++                      ret = -EFAULT;
++                      break;
++              }
++              if (size < RFKILL_EVENT_SIZE_V1 || size > U8_MAX) {
++                      ret = -EINVAL;
++                      break;
++              }
++              data->max_size = size;
++              ret = 0;
++              break;
++      default:
++              break;
+       }
+-
+       mutex_unlock(&data->mtx);
+-      return 0;
++      return ret;
+ }
+-#endif
+ static const struct file_operations rfkill_fops = {
+       .owner          = THIS_MODULE,
+@@ -1343,10 +1365,8 @@ static const struct file_operations rfki
+       .write          = rfkill_fop_write,
+       .poll           = rfkill_fop_poll,
+       .release        = rfkill_fop_release,
+-#ifdef CONFIG_RFKILL_INPUT
+       .unlocked_ioctl = rfkill_fop_ioctl,
+       .compat_ioctl   = compat_ptr_ioctl,
+-#endif
+       .llseek         = no_llseek,
+ };
index c311af4be639f6ec88f7e5b4ac5cfe8b82ef225d..097fb1eb19fe684f43a73c02b191594e1f23b2c4 100644 (file)
@@ -146,3 +146,54 @@ btrfs-zoned-put-block-group-after-final-usage.patch
 block-fix-rq-qos-breakage-from-skipping-rq_qos_done_bio.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
+fbdev-hot-unplug-firmware-fb-devices-on-forced-removal.patch
+video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch
+video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch
+rfkill-make-new-event-layout-opt-in.patch
+arm-dts-at91-sama7g5-remove-unused-properties-in-i2c-nodes.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
+pm-domains-fix-sleep-in-atomic-bug-caused-by-genpd_debug_remove.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-omap3isp-use-struct_group-for-memcpy-region.patch
+media-venus-vdec-fixed-possible-memory-leak-issue.patch
+media-venus-hfi_cmds-list-hdr10-property-as-unsupported-for-v1-and-v3.patch
+media-venus-venc-fix-h264-8x8-transform-control.patch
+media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch
+media-davinci-vpif-fix-unbalanced-runtime-pm-enable.patch
+media-davinci-vpif-fix-use-after-free-on-driver-unbind.patch
+btrfs-zoned-mark-relocation-as-writing.patch
+btrfs-extend-locking-to-all-space_info-members-accesses.patch
+btrfs-verify-the-tranisd-of-the-to-be-written-dirty-extent-buffer.patch
+xtensa-define-update_mmu_tlb-function.patch
+xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch
+xtensa-fix-xtensa_wsr-always-writing-0.patch
+drm-syncobj-flatten-dma_fence_chains-on-transfer.patch
+drm-nouveau-backlight-fix-lvds-backlight-detection-on-some-laptops.patch
+drm-nouveau-backlight-just-set-all-backlight-types-as-raw.patch
+drm-fb-helper-mark-screen-buffers-in-system-memory-with-fbinfo_virtfb.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-declare-missing-firmware-files-in-pcie.c.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-imx6-allow-to-probe-when-dw_pcie_wait_for_link-fails.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.16/thermal-int340x-increase-bitmap-size.patch b/queue-5.16/thermal-int340x-increase-bitmap-size.patch
new file mode 100644 (file)
index 0000000..e4368f5
--- /dev/null
@@ -0,0 +1,35 @@
+From 668f69a5f863b877bc3ae129efe9a80b6f055141 Mon Sep 17 00:00:00 2001
+From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+Date: Mon, 14 Mar 2022 15:08:55 -0700
+Subject: thermal: int340x: Increase bitmap size
+
+From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+
+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 <srinivas.pandruvada@linux.intel.com>
+Fixes: 16fc8eca1975 ("thermal/int340x_thermal: Add additional UUIDs")
+Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch b/queue-5.16/video-fbdev-atari-atari-2-bpp-ste-palette-bugfix.patch
new file mode 100644 (file)
index 0000000..47f8d31
--- /dev/null
@@ -0,0 +1,62 @@
+From c8be5edbd36ceed2ff3d6b8f8e40643c3f396ea3 Mon Sep 17 00:00:00 2001
+From: Michael Schmitz <schmitzmic@gmail.com>
+Date: Wed, 16 Feb 2022 20:26:25 +1300
+Subject: video: fbdev: atari: Atari 2 bpp (STe) palette bugfix
+
+From: Michael Schmitz <schmitzmic@gmail.com>
+
+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 <geert@linux-m68k.org>
+Link: https://lore.kernel.org/all/CAMuHMdU3ievhXxKR_xi_v3aumnYW7UNUO6qMdhgfyWTyVSsCkQ@mail.gmail.com
+Tested-by: Michael Schmitz <schmitzmic@gmail.com>
+Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1683,9 +1683,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));
+@@ -1971,9 +1971,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.16/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch b/queue-5.16/video-fbdev-sm712fb-fix-crash-in-smtcfb_read.patch
new file mode 100644 (file)
index 0000000..18f7e52
--- /dev/null
@@ -0,0 +1,76 @@
+From bd771cf5c4254511cc4abb88f3dab3bd58bdf8e8 Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Sun, 27 Feb 2022 08:43:56 +0100
+Subject: video: fbdev: sm712fb: Fix crash in smtcfb_read()
+
+From: Helge Deller <deller@gmx.de>
+
+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 <zheyuma97@gmail.com>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Tested-by: Zheyu Ma <zheyuma97@gmail.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/xtensa-define-update_mmu_tlb-function.patch b/queue-5.16/xtensa-define-update_mmu_tlb-function.patch
new file mode 100644 (file)
index 0000000..94624a9
--- /dev/null
@@ -0,0 +1,56 @@
+From 1c4664faa38923330d478f046dc743a00c1e2dec Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Mon, 3 Jan 2022 12:08:31 -0800
+Subject: xtensa: define update_mmu_tlb function
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+commit 1c4664faa38923330d478f046dc743a00c1e2dec upstream.
+
+Before the commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault()
+codepaths") there was a call to update_mmu_cache in alloc_set_pte that
+used to invalidate TLB entry caching invalid PTE that caused a page
+fault. That commit removed that call so now invalid TLB entry survives
+causing repetitive page faults on the CPU that took the initial fault
+until that TLB entry is occasionally evicted. This issue is spotted by
+the xtensa TLB sanity checker.
+
+Fix this issue by defining update_mmu_tlb function that flushes TLB entry
+for the faulting address.
+
+Cc: stable@vger.kernel.org # 5.12+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/xtensa/include/asm/pgtable.h |    4 ++++
+ arch/xtensa/mm/tlb.c              |    6 ++++++
+ 2 files changed, 10 insertions(+)
+
+--- a/arch/xtensa/include/asm/pgtable.h
++++ b/arch/xtensa/include/asm/pgtable.h
+@@ -411,6 +411,10 @@ extern  void update_mmu_cache(struct vm_
+ typedef pte_t *pte_addr_t;
++void update_mmu_tlb(struct vm_area_struct *vma,
++                  unsigned long address, pte_t *ptep);
++#define __HAVE_ARCH_UPDATE_MMU_TLB
++
+ #endif /* !defined (__ASSEMBLY__) */
+ #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
+--- a/arch/xtensa/mm/tlb.c
++++ b/arch/xtensa/mm/tlb.c
+@@ -162,6 +162,12 @@ void local_flush_tlb_kernel_range(unsign
+       }
+ }
++void update_mmu_tlb(struct vm_area_struct *vma,
++                  unsigned long address, pte_t *ptep)
++{
++      local_flush_tlb_page(vma, address);
++}
++
+ #ifdef CONFIG_DEBUG_TLB_SANITY
+ static unsigned get_pte_for_vaddr(unsigned vaddr)
diff --git a/queue-5.16/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch b/queue-5.16/xtensa-fix-stop_machine_cpuslocked-call-in-patch_text.patch
new file mode 100644 (file)
index 0000000..2d5b713
--- /dev/null
@@ -0,0 +1,34 @@
+From f406f2d03e07afc199dd8cf501f361dde6be8a69 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Wed, 16 Mar 2022 02:04:17 -0700
+Subject: xtensa: fix stop_machine_cpuslocked call in patch_text
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+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 <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.16/xtensa-fix-xtensa_wsr-always-writing-0.patch b/queue-5.16/xtensa-fix-xtensa_wsr-always-writing-0.patch
new file mode 100644 (file)
index 0000000..57f0db7
--- /dev/null
@@ -0,0 +1,38 @@
+From a3d0245c58f962ee99d4440ea0eaf45fb7f5a5cc Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 20 Mar 2022 09:40:14 -0700
+Subject: xtensa: fix xtensa_wsr always writing 0
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+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 <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -246,8 +246,8 @@ extern unsigned long __get_wchan(struct
+ #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) \