From: Sasha Levin Date: Sun, 13 Feb 2022 05:47:35 +0000 (-0500) Subject: Fixes for 5.10 X-Git-Tag: v4.9.302~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72cc5b9a6932dec8b1b715226d3e41d6dd42fa29;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/acpi-pm-s2idle-cancel-wakeup-before-dispatching-ec-g.patch b/queue-5.10/acpi-pm-s2idle-cancel-wakeup-before-dispatching-ec-g.patch new file mode 100644 index 00000000000..e2d520f195b --- /dev/null +++ b/queue-5.10/acpi-pm-s2idle-cancel-wakeup-before-dispatching-ec-g.patch @@ -0,0 +1,81 @@ +From ba75d0e76b89dda5363428be8772c8734514616a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Feb 2022 18:31:02 +0100 +Subject: ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE + +From: Rafael J. Wysocki + +[ Upstream commit dc0075ba7f387fe4c48a8c674b11ab6f374a6acc ] + +Commit 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while +suspended to idle") made acpi_ec_dispatch_gpe() check +pm_wakeup_pending(), but that is before canceling the SCI wakeup, +so pm_wakeup_pending() is always true. This causes the loop in +acpi_ec_dispatch_gpe() to always terminate after one iteration which +may not be correct. + +Address this issue by canceling the SCI wakeup earlier, from +acpi_ec_dispatch_gpe() itself. + +Fixes: 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while suspended to idle") +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/ec.c | 10 ++++++++++ + drivers/acpi/sleep.c | 14 ++++---------- + 2 files changed, 14 insertions(+), 10 deletions(-) + +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c +index 3f2e5ea9ab6b7..8347eaee679c8 100644 +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -2064,6 +2064,16 @@ bool acpi_ec_dispatch_gpe(void) + if (acpi_any_gpe_status_set(first_ec->gpe)) + return true; + ++ /* ++ * Cancel the SCI wakeup and process all pending events in case there ++ * are any wakeup ones in there. ++ * ++ * Note that if any non-EC GPEs are active at this point, the SCI will ++ * retrigger after the rearming in acpi_s2idle_wake(), so no events ++ * should be missed by canceling the wakeup here. ++ */ ++ pm_system_cancel_wakeup(); ++ + /* + * Dispatch the EC GPE in-band, but do not report wakeup in any case + * to allow the caller to process events properly after that. +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c +index 503935b1deeb1..e2614ea820bb8 100644 +--- a/drivers/acpi/sleep.c ++++ b/drivers/acpi/sleep.c +@@ -1012,21 +1012,15 @@ static bool acpi_s2idle_wake(void) + return true; + } + +- /* Check non-EC GPE wakeups and dispatch the EC GPE. */ ++ /* ++ * Check non-EC GPE wakeups and if there are none, cancel the ++ * SCI-related wakeup and dispatch the EC GPE. ++ */ + if (acpi_ec_dispatch_gpe()) { + pm_pr_dbg("ACPI non-EC GPE wakeup\n"); + return true; + } + +- /* +- * Cancel the SCI wakeup and process all pending events in case +- * there are any wakeup ones in there. +- * +- * Note that if any non-EC GPEs are active at this point, the +- * SCI will retrigger after the rearming below, so no events +- * should be missed by canceling the wakeup here. +- */ +- pm_system_cancel_wakeup(); + acpi_os_wait_events_complete(); + + /* +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-fix-timer-regression-for-beagleboard-revisio.patch b/queue-5.10/arm-dts-fix-timer-regression-for-beagleboard-revisio.patch new file mode 100644 index 00000000000..c4742b572a3 --- /dev/null +++ b/queue-5.10/arm-dts-fix-timer-regression-for-beagleboard-revisio.patch @@ -0,0 +1,180 @@ +From b1e555bb63aa794613b78b8c2510cc5ba7022966 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Nov 2021 16:48:34 +0200 +Subject: ARM: dts: Fix timer regression for beagleboard revision c + +From: Tony Lindgren + +[ Upstream commit 23885389dbbbbc698986e77a45c1fc44a6e3632e ] + +Commit e428e250fde6 ("ARM: dts: Configure system timers for omap3") +caused a timer regression for beagleboard revision c where the system +clockevent stops working if omap3isp module is unloaded. + +Turns out we still have beagleboard revisions a-b4 capacitor c70 quirks +applied that limit the usable timers for no good reason. This also affects +the power management as we use the system clock instead of the 32k clock +source. + +Let's fix the issue by adding a new omap3-beagle-ab4.dts for the old timer +quirks. This allows us to remove the timer quirks for later beagleboard +revisions. We also need to update the related timer quirk check for the +correct compatible property. + +Fixes: e428e250fde6 ("ARM: dts: Configure system timers for omap3") +Cc: linux-kernel@vger.kernel.org +Cc: Daniel Lezcano +Cc: Thomas Gleixner +Cc: Rob Herring +Reported-by: Jarkko Nikula +Tested-by: Jarkko Nikula +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/arm/omap/omap.txt | 3 ++ + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/omap3-beagle-ab4.dts | 47 +++++++++++++++++++ + arch/arm/boot/dts/omap3-beagle.dts | 33 ------------- + drivers/clocksource/timer-ti-dm-systimer.c | 2 +- + 5 files changed, 52 insertions(+), 34 deletions(-) + create mode 100644 arch/arm/boot/dts/omap3-beagle-ab4.dts + +diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt +index e77635c5422c6..fa8b31660cadd 100644 +--- a/Documentation/devicetree/bindings/arm/omap/omap.txt ++++ b/Documentation/devicetree/bindings/arm/omap/omap.txt +@@ -119,6 +119,9 @@ Boards (incomplete list of examples): + - OMAP3 BeagleBoard : Low cost community board + compatible = "ti,omap3-beagle", "ti,omap3430", "ti,omap3" + ++- OMAP3 BeagleBoard A to B4 : Early BeagleBoard revisions A to B4 with a timer quirk ++ compatible = "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "ti,omap3" ++ + - OMAP3 Tobi with Overo : Commercial expansion board with daughter board + compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap3430", "ti,omap3" + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index ce66ffd5a1bbc..7e8151681597c 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -731,6 +731,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \ + logicpd-som-lv-37xx-devkit.dtb \ + omap3430-sdp.dtb \ + omap3-beagle.dtb \ ++ omap3-beagle-ab4.dtb \ + omap3-beagle-xm.dtb \ + omap3-beagle-xm-ab.dtb \ + omap3-cm-t3517.dtb \ +diff --git a/arch/arm/boot/dts/omap3-beagle-ab4.dts b/arch/arm/boot/dts/omap3-beagle-ab4.dts +new file mode 100644 +index 0000000000000..990ff2d846868 +--- /dev/null ++++ b/arch/arm/boot/dts/omap3-beagle-ab4.dts +@@ -0,0 +1,47 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/dts-v1/; ++ ++#include "omap3-beagle.dts" ++ ++/ { ++ model = "TI OMAP3 BeagleBoard A to B4"; ++ compatible = "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "ti,omap3"; ++}; ++ ++/* ++ * Workaround for capacitor C70 issue, see "Boards revision A and < B5" ++ * section at https://elinux.org/BeagleBoard_Community ++ */ ++ ++/* Unusable as clocksource because of unreliable oscillator */ ++&counter32k { ++ status = "disabled"; ++}; ++ ++/* Unusable as clockevent because of unreliable oscillator, allow to idle */ ++&timer1_target { ++ /delete-property/ti,no-reset-on-init; ++ /delete-property/ti,no-idle; ++ timer@0 { ++ /delete-property/ti,timer-alwon; ++ }; ++}; ++ ++/* Preferred always-on timer for clocksource */ ++&timer12_target { ++ ti,no-reset-on-init; ++ ti,no-idle; ++ timer@0 { ++ /* Always clocked by secure_32k_fck */ ++ }; ++}; ++ ++/* Preferred timer for clockevent */ ++&timer2_target { ++ ti,no-reset-on-init; ++ ti,no-idle; ++ timer@0 { ++ assigned-clocks = <&gpt2_fck>; ++ assigned-clock-parents = <&sys_ck>; ++ }; ++}; +diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts +index f9f34b8458e91..0548b391334fd 100644 +--- a/arch/arm/boot/dts/omap3-beagle.dts ++++ b/arch/arm/boot/dts/omap3-beagle.dts +@@ -304,39 +304,6 @@ &usbhsehci { + phys = <0 &hsusb2_phy>; + }; + +-/* Unusable as clocksource because of unreliable oscillator */ +-&counter32k { +- status = "disabled"; +-}; +- +-/* Unusable as clockevent because if unreliable oscillator, allow to idle */ +-&timer1_target { +- /delete-property/ti,no-reset-on-init; +- /delete-property/ti,no-idle; +- timer@0 { +- /delete-property/ti,timer-alwon; +- }; +-}; +- +-/* Preferred always-on timer for clocksource */ +-&timer12_target { +- ti,no-reset-on-init; +- ti,no-idle; +- timer@0 { +- /* Always clocked by secure_32k_fck */ +- }; +-}; +- +-/* Preferred timer for clockevent */ +-&timer2_target { +- ti,no-reset-on-init; +- ti,no-idle; +- timer@0 { +- assigned-clocks = <&gpt2_fck>; +- assigned-clock-parents = <&sys_ck>; +- }; +-}; +- + &twl_gpio { + ti,use-leds; + /* pullups: BIT(1) */ +diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c +index b6f97960d8ee0..5c40ca1d4740e 100644 +--- a/drivers/clocksource/timer-ti-dm-systimer.c ++++ b/drivers/clocksource/timer-ti-dm-systimer.c +@@ -241,7 +241,7 @@ static void __init dmtimer_systimer_assign_alwon(void) + bool quirk_unreliable_oscillator = false; + + /* Quirk unreliable 32 KiHz oscillator with incomplete dts */ +- if (of_machine_is_compatible("ti,omap3-beagle") || ++ if (of_machine_is_compatible("ti,omap3-beagle-ab4") || + of_machine_is_compatible("timll,omap3-devkit8000")) { + quirk_unreliable_oscillator = true; + counter_32k = -ENODEV; +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-imx6qdl-udoo-properly-describe-the-sd-card-d.patch b/queue-5.10/arm-dts-imx6qdl-udoo-properly-describe-the-sd-card-d.patch new file mode 100644 index 00000000000..f2567663c20 --- /dev/null +++ b/queue-5.10/arm-dts-imx6qdl-udoo-properly-describe-the-sd-card-d.patch @@ -0,0 +1,54 @@ +From 012b2c4c052f9ba40d21d44b2644356632ef9e4a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Dec 2021 19:42:15 -0300 +Subject: ARM: dts: imx6qdl-udoo: Properly describe the SD card detect + +From: Fabio Estevam + +[ Upstream commit 993d66140f8d1c1853a3b58b77b43b681eb64dee ] + +GPIO7_IO00 is used as SD card detect. + +Properly describe this in the devicetree. + +Fixes: 40cdaa542cf0 ("ARM: dts: imx6q-udoo: Add initial board support") +Signed-off-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +index d07d8f83456d2..ccfa8e320be62 100644 +--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +@@ -5,6 +5,8 @@ + * Author: Fabio Estevam + */ + ++#include ++ + / { + aliases { + backlight = &backlight; +@@ -226,6 +228,7 @@ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 + MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 + MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 + MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 ++ MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 + >; + }; + +@@ -304,7 +307,7 @@ &usbotg { + &usdhc3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usdhc3>; +- non-removable; ++ cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; + status = "okay"; + }; + +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-imx7ulp-fix-assigned-clocks-parents-typo.patch b/queue-5.10/arm-dts-imx7ulp-fix-assigned-clocks-parents-typo.patch new file mode 100644 index 00000000000..5387592e3a8 --- /dev/null +++ b/queue-5.10/arm-dts-imx7ulp-fix-assigned-clocks-parents-typo.patch @@ -0,0 +1,37 @@ +From f8d3c033d8ab05675c8fa98c2c74db1576615150 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jan 2022 11:23:55 -0600 +Subject: ARM: dts: imx7ulp: Fix 'assigned-clocks-parents' typo + +From: Rob Herring + +[ Upstream commit 6d58c5e21a3fe355ce6d1808e96d02a610265218 ] + +The correct property name is 'assigned-clock-parents', not +'assigned-clocks-parents'. Though if the platform works with the typo, one +has to wonder if the property is even needed. + +Signed-off-by: Rob Herring +Fixes: 8b8c7d97e2c7 ("ARM: dts: imx7ulp: Add wdog1 node") +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx7ulp.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi +index b7ea37ad4e55c..bcec98b964114 100644 +--- a/arch/arm/boot/dts/imx7ulp.dtsi ++++ b/arch/arm/boot/dts/imx7ulp.dtsi +@@ -259,7 +259,7 @@ wdog1: watchdog@403d0000 { + interrupts = ; + clocks = <&pcc2 IMX7ULP_CLK_WDG1>; + assigned-clocks = <&pcc2 IMX7ULP_CLK_WDG1>; +- assigned-clocks-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; ++ assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; + timeout-sec = <40>; + }; + +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-meson-fix-the-uart-compatible-strings.patch b/queue-5.10/arm-dts-meson-fix-the-uart-compatible-strings.patch new file mode 100644 index 00000000000..cdb0e04c1c6 --- /dev/null +++ b/queue-5.10/arm-dts-meson-fix-the-uart-compatible-strings.patch @@ -0,0 +1,69 @@ +From a5240676cc51b2e9e5a47e30b533b09996d5536b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Dec 2021 19:00:24 +0100 +Subject: ARM: dts: meson: Fix the UART compatible strings + +From: Martin Blumenstingl + +[ Upstream commit 5225e1b87432dcf0d0fc3440824b91d04c1d6cc1 ] + +The dt-bindings for the UART controller only allow the following values +for Meson6 SoCs: +- "amlogic,meson6-uart", "amlogic,meson-ao-uart" +- "amlogic,meson6-uart" + +Use the correct fallback compatible string "amlogic,meson-ao-uart" for +AO UART. Drop the "amlogic,meson-uart" compatible string from the EE +domain UART controllers. + +Fixes: ec9b59162fd831 ("ARM: dts: meson6: use stable UART bindings") +Signed-off-by: Martin Blumenstingl +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20211227180026.4068352-2-martin.blumenstingl@googlemail.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/meson.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi +index 7649dd1e0b9ee..c928ae312e19c 100644 +--- a/arch/arm/boot/dts/meson.dtsi ++++ b/arch/arm/boot/dts/meson.dtsi +@@ -42,14 +42,14 @@ hwrng: rng@8100 { + }; + + uart_A: serial@84c0 { +- compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; ++ compatible = "amlogic,meson6-uart"; + reg = <0x84c0 0x18>; + interrupts = ; + status = "disabled"; + }; + + uart_B: serial@84dc { +- compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; ++ compatible = "amlogic,meson6-uart"; + reg = <0x84dc 0x18>; + interrupts = ; + status = "disabled"; +@@ -87,7 +87,7 @@ saradc: adc@8680 { + }; + + uart_C: serial@8700 { +- compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; ++ compatible = "amlogic,meson6-uart"; + reg = <0x8700 0x18>; + interrupts = ; + status = "disabled"; +@@ -203,7 +203,7 @@ ir_receiver: ir-receiver@480 { + }; + + uart_AO: serial@4c0 { +- compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart", "amlogic,meson-uart"; ++ compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart"; + reg = <0x4c0 0x18>; + interrupts = ; + status = "disabled"; +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-meson8-fix-the-uart-device-tree-schema-valid.patch b/queue-5.10/arm-dts-meson8-fix-the-uart-device-tree-schema-valid.patch new file mode 100644 index 00000000000..855d1a53de7 --- /dev/null +++ b/queue-5.10/arm-dts-meson8-fix-the-uart-device-tree-schema-valid.patch @@ -0,0 +1,77 @@ +From ea8e19b4dca719d8c0d81e5f7ae239b8a4d5f497 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Dec 2021 19:00:25 +0100 +Subject: ARM: dts: meson8: Fix the UART device-tree schema validation + +From: Martin Blumenstingl + +[ Upstream commit 57007bfb5469ba31cacf69d52195e8b75f43e32d ] + +The dt-bindings for the UART controller only allow the following values +for Meson8 SoCs: +- "amlogic,meson8-uart", "amlogic,meson-ao-uart" +- "amlogic,meson8-uart" + +Use the correct fallback compatible string "amlogic,meson-ao-uart" for +AO UART. Drop the "amlogic,meson-uart" compatible string from the EE +domain UART controllers. + +Also update the order of the clocks to match the order defined in the +yaml schema. + +Fixes: 6ca77502050eff ("ARM: dts: meson8: use stable UART bindings with correct gate clock") +Signed-off-by: Martin Blumenstingl +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20211227180026.4068352-3-martin.blumenstingl@googlemail.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/meson8.dtsi | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi +index 740a6c816266c..08533116a39ce 100644 +--- a/arch/arm/boot/dts/meson8.dtsi ++++ b/arch/arm/boot/dts/meson8.dtsi +@@ -598,27 +598,27 @@ &timer_abcde { + }; + + &uart_AO { +- compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8-uart", "amlogic,meson-ao-uart"; ++ clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_A { +- compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_B { +- compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_C { +- compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &usb0 { +-- +2.34.1 + diff --git a/queue-5.10/arm-dts-meson8b-fix-the-uart-device-tree-schema-vali.patch b/queue-5.10/arm-dts-meson8b-fix-the-uart-device-tree-schema-vali.patch new file mode 100644 index 00000000000..588f2567242 --- /dev/null +++ b/queue-5.10/arm-dts-meson8b-fix-the-uart-device-tree-schema-vali.patch @@ -0,0 +1,77 @@ +From dba5341dcfdd49d3e3397e7c2100a79b22604416 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Dec 2021 19:00:26 +0100 +Subject: ARM: dts: meson8b: Fix the UART device-tree schema validation + +From: Martin Blumenstingl + +[ Upstream commit 3375aa77135f6aeb1107ed839a2050a4118444bc ] + +The dt-bindings for the UART controller only allow the following values +for Meson8 SoCs: +- "amlogic,meson8b-uart", "amlogic,meson-ao-uart" +- "amlogic,meson8b-uart" + +Use the correct fallback compatible string "amlogic,meson-ao-uart" for +AO UART. Drop the "amlogic,meson-uart" compatible string from the EE +domain UART controllers. + +Also update the order of the clocks to match the order defined in the +yaml bindings. + +Fixes: b02d6e73f5fc96 ("ARM: dts: meson8b: use stable UART bindings with correct gate clock") +Signed-off-by: Martin Blumenstingl +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20211227180026.4068352-4-martin.blumenstingl@googlemail.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/meson8b.dtsi | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi +index 2401cdf5f7511..f6eb7c803174e 100644 +--- a/arch/arm/boot/dts/meson8b.dtsi ++++ b/arch/arm/boot/dts/meson8b.dtsi +@@ -586,27 +586,27 @@ &timer_abcde { + }; + + &uart_AO { +- compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8b-uart", "amlogic,meson-ao-uart"; ++ clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_A { +- compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8b-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_B { +- compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8b-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &uart_C { +- compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; +- clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; +- clock-names = "baud", "xtal", "pclk"; ++ compatible = "amlogic,meson8b-uart"; ++ clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; ++ clock-names = "xtal", "pclk", "baud"; + }; + + &usb0 { +-- +2.34.1 + diff --git a/queue-5.10/arm64-dts-meson-g12b-odroid-n2-fix-typo-dio2133.patch b/queue-5.10/arm64-dts-meson-g12b-odroid-n2-fix-typo-dio2133.patch new file mode 100644 index 00000000000..bab4e06b410 --- /dev/null +++ b/queue-5.10/arm64-dts-meson-g12b-odroid-n2-fix-typo-dio2133.patch @@ -0,0 +1,47 @@ +From 4dd92e04f15af2c0b6f3a0d3baccc8e252624048 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jan 2022 21:29:25 +0900 +Subject: arm64: dts: meson-g12b-odroid-n2: fix typo 'dio2133' + +From: Dongjin Kim + +[ Upstream commit bc41099f060ea74ac8d02c51bd0f5f46d969bedf ] + +Typo in audio amplifier node, dioo2133 -> dio2133 + +Signed-off-by: Dongjin Kim +Fixes: ef599f5f3e10 ("arm64: dts: meson: convert ODROID-N2 to dtsi") +Fixes: 67d141c1f8e6 ("arm64: dts: meson: odroid-n2: add jack audio output support") +Reviewed-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/YfKQJejh0bfGYvof@anyang +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +index b9b8cd4b5ba9d..87e8e64ad5cae 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +@@ -15,7 +15,7 @@ aliases { + ethernet0 = ðmac; + }; + +- dioo2133: audio-amplifier-0 { ++ dio2133: audio-amplifier-0 { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + VCC-supply = <&vcc_5v>; +@@ -215,7 +215,7 @@ sound { + audio-widgets = "Line", "Lineout"; + audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>, + <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>, +- <&dioo2133>; ++ <&dio2133>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", + "TDMOUT_B IN 2", "FRDDR_C OUT 1", +-- +2.34.1 + diff --git a/queue-5.10/bonding-pair-enable_port-with-slave_arr_updates.patch b/queue-5.10/bonding-pair-enable_port-with-slave_arr_updates.patch new file mode 100644 index 00000000000..14726c88f71 --- /dev/null +++ b/queue-5.10/bonding-pair-enable_port-with-slave_arr_updates.patch @@ -0,0 +1,55 @@ +From 9f0df5aab5a040f5aa428a1b4196a51f2ac0782e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 14:29:01 -0800 +Subject: bonding: pair enable_port with slave_arr_updates + +From: Mahesh Bandewar + +[ Upstream commit 23de0d7b6f0e3f9a6283a882594c479949da1120 ] + +When 803.2ad mode enables a participating port, it should update +the slave-array. I have observed that the member links are participating +and are part of the active aggregator while the traffic is egressing via +only one member link (in a case where two links are participating). Via +kprobes I discovered that slave-arr has only one link added while +the other participating link wasn't part of the slave-arr. + +I couldn't see what caused that situation but the simple code-walk +through provided me hints that the enable_port wasn't always associated +with the slave-array update. + +Fixes: ee6377147409 ("bonding: Simplify the xmit function for modes that use xmit_hash") +Signed-off-by: Mahesh Bandewar +Acked-by: Jay Vosburgh +Link: https://lore.kernel.org/r/20220207222901.1795287-1-maheshb@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/bonding/bond_3ad.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c +index aa001b16765ae..ab8c833411654 100644 +--- a/drivers/net/bonding/bond_3ad.c ++++ b/drivers/net/bonding/bond_3ad.c +@@ -1003,8 +1003,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) + if (port->aggregator && + port->aggregator->is_active && + !__port_is_enabled(port)) { +- + __enable_port(port); ++ *update_slave_arr = true; + } + } + break; +@@ -1760,6 +1760,7 @@ static void ad_agg_selection_logic(struct aggregator *agg, + port = port->next_port_in_aggregator) { + __enable_port(port); + } ++ *update_slave_arr = true; + } + } + +-- +2.34.1 + diff --git a/queue-5.10/dpaa2-eth-unregister-the-netdev-before-disconnecting.patch b/queue-5.10/dpaa2-eth-unregister-the-netdev-before-disconnecting.patch new file mode 100644 index 00000000000..5e70a1224dd --- /dev/null +++ b/queue-5.10/dpaa2-eth-unregister-the-netdev-before-disconnecting.patch @@ -0,0 +1,45 @@ +From 28c39055bd5339d2ef76b8eb446c8cd4f26e2bfe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Feb 2022 17:57:43 +0200 +Subject: dpaa2-eth: unregister the netdev before disconnecting from the PHY + +From: Robert-Ionut Alexa + +[ Upstream commit 9ccc6e0c8959a019bb40f6b18704b142c04b19a8 ] + +The netdev should be unregistered before we are disconnecting from the +MAC/PHY so that the dev_close callback is called and the PHY and the +phylink workqueues are actually stopped before we are disconnecting and +destroying the phylink instance. + +Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") +Signed-off-by: Robert-Ionut Alexa +Signed-off-by: Ioana Ciornei +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +index f06d88c471d0f..f917bc9c87969 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4405,12 +4405,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev) + #ifdef CONFIG_DEBUG_FS + dpaa2_dbg_remove(priv); + #endif ++ ++ unregister_netdev(net_dev); + rtnl_lock(); + dpaa2_eth_disconnect_mac(priv); + rtnl_unlock(); + +- unregister_netdev(net_dev); +- + dpaa2_eth_dl_port_del(priv); + dpaa2_eth_dl_traps_unregister(priv); + dpaa2_eth_dl_unregister(priv); +-- +2.34.1 + diff --git a/queue-5.10/drm-panel-simple-assign-data-from-panel_dpi_probe-co.patch b/queue-5.10/drm-panel-simple-assign-data-from-panel_dpi_probe-co.patch new file mode 100644 index 00000000000..2346def39b5 --- /dev/null +++ b/queue-5.10/drm-panel-simple-assign-data-from-panel_dpi_probe-co.patch @@ -0,0 +1,47 @@ +From e0e58e630bdb68490237eed5c4835c45ccdbf62f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Feb 2022 12:01:53 +0100 +Subject: drm/panel: simple: Assign data from panel_dpi_probe() correctly + +From: Christoph Niedermaier + +[ Upstream commit 6df4432a5eca101b5fd80fbee41d309f3d67928d ] + +In the function panel_simple_probe() the pointer panel->desc is +assigned to the passed pointer desc. If function panel_dpi_probe() +is called panel->desc will be updated, but further on only desc +will be evaluated. So update the desc pointer to be able to use +the data from the function panel_dpi_probe(). + +Fixes: 4a1d0dbc8332 ("drm/panel: simple: add panel-dpi support") + +Signed-off-by: Christoph Niedermaier +Cc: Marek Vasut +Cc: Thierry Reding +Cc: Sam Ravnborg +Cc: David Airlie +Cc: Daniel Vetter +To: dri-devel@lists.freedesktop.org +Reviewed-by: Sam Ravnborg +Signed-off-by: Marek Vasut +Link: https://patchwork.freedesktop.org/patch/msgid/20220201110153.3479-1-cniedermaier@dh-electronics.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-simple.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c +index 204674fccd646..7ffd2a04ab23a 100644 +--- a/drivers/gpu/drm/panel/panel-simple.c ++++ b/drivers/gpu/drm/panel/panel-simple.c +@@ -557,6 +557,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) + err = panel_dpi_probe(dev, panel); + if (err) + goto free_ddc; ++ desc = panel->desc; + } else { + if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) + panel_simple_parse_panel_timing_node(dev, panel, &dt); +-- +2.34.1 + diff --git a/queue-5.10/drm-vc4-hdmi-allow-dblclk-modes-even-if-horz-timing-.patch b/queue-5.10/drm-vc4-hdmi-allow-dblclk-modes-even-if-horz-timing-.patch new file mode 100644 index 00000000000..2224e2fd063 --- /dev/null +++ b/queue-5.10/drm-vc4-hdmi-allow-dblclk-modes-even-if-horz-timing-.patch @@ -0,0 +1,52 @@ +From b5d975547310154a36da5ab0d657f8a82de6576b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jan 2022 14:51:16 +0100 +Subject: drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd. + +From: Dave Stevenson + +[ Upstream commit 1d118965965f89948236ebe23072bb1fca5e7832 ] + +The 2711 pixel valve can't produce odd horizontal timings, and +checks were added to vc4_hdmi_encoder_atomic_check and +vc4_hdmi_encoder_mode_valid to filter out/block selection of +such modes. + +Modes with DRM_MODE_FLAG_DBLCLK double all the horizontal timing +values before programming them into the PV. The PV values, +therefore, can not be odd, and so the modes can be supported. + +Amend the filtering appropriately. + +Fixes: 57fb32e632be ("drm/vc4: hdmi: Block odd horizontal timings") +Signed-off-by: Dave Stevenson +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20220127135116.298278-1-maxime@cerno.tech +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index 5d5c4e9a86218..a308f2d05d173 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -800,6 +800,7 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder, + unsigned long long tmds_rate; + + if (vc4_hdmi->variant->unsupported_odd_h_timings && ++ !(mode->flags & DRM_MODE_FLAG_DBLCLK) && + ((mode->hdisplay % 2) || (mode->hsync_start % 2) || + (mode->hsync_end % 2) || (mode->htotal % 2))) + return -EINVAL; +@@ -834,6 +835,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); + + if (vc4_hdmi->variant->unsupported_odd_h_timings && ++ !(mode->flags & DRM_MODE_FLAG_DBLCLK) && + ((mode->hdisplay % 2) || (mode->hsync_start % 2) || + (mode->hsync_end % 2) || (mode->htotal % 2))) + return MODE_H_ILLEGAL; +-- +2.34.1 + diff --git a/queue-5.10/gpio-aggregator-fix-calling-into-sleeping-gpio-contr.patch b/queue-5.10/gpio-aggregator-fix-calling-into-sleeping-gpio-contr.patch new file mode 100644 index 00000000000..5314ae18a81 --- /dev/null +++ b/queue-5.10/gpio-aggregator-fix-calling-into-sleeping-gpio-contr.patch @@ -0,0 +1,84 @@ +From 09e7140c15b6ceb517cc1c5b8eecb93c47964a81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 31 Jan 2022 11:35:53 +0100 +Subject: gpio: aggregator: Fix calling into sleeping GPIO controllers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +[ Upstream commit 2cba05451a6d0c703bb74f1a250691404f27c4f1 ] + +If the parent GPIO controller is a sleeping controller (e.g. a GPIO +controller connected to I2C), getting or setting a GPIO triggers a +might_sleep() warning. This happens because the GPIO Aggregator takes +the can_sleep flag into account only for its internal locking, not for +calling into the parent GPIO controller. + +Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a +sleeping GPIO controller. + +Reported-by: Mikko Salomäki +Fixes: 828546e24280f721 ("gpio: Add GPIO Aggregator") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Andy Shevchenko +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-aggregator.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c +index dfd8a4876a27a..d5f25246404d9 100644 +--- a/drivers/gpio/gpio-aggregator.c ++++ b/drivers/gpio/gpio-aggregator.c +@@ -330,7 +330,8 @@ static int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset) + { + struct gpiochip_fwd *fwd = gpiochip_get_data(chip); + +- return gpiod_get_value(fwd->descs[offset]); ++ return chip->can_sleep ? gpiod_get_value_cansleep(fwd->descs[offset]) ++ : gpiod_get_value(fwd->descs[offset]); + } + + static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, +@@ -349,7 +350,10 @@ static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, + for_each_set_bit(i, mask, fwd->chip.ngpio) + descs[j++] = fwd->descs[i]; + +- error = gpiod_get_array_value(j, descs, NULL, values); ++ if (fwd->chip.can_sleep) ++ error = gpiod_get_array_value_cansleep(j, descs, NULL, values); ++ else ++ error = gpiod_get_array_value(j, descs, NULL, values); + if (error) + return error; + +@@ -384,7 +388,10 @@ static void gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int value) + { + struct gpiochip_fwd *fwd = gpiochip_get_data(chip); + +- gpiod_set_value(fwd->descs[offset], value); ++ if (chip->can_sleep) ++ gpiod_set_value_cansleep(fwd->descs[offset], value); ++ else ++ gpiod_set_value(fwd->descs[offset], value); + } + + static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, +@@ -403,7 +410,10 @@ static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, + descs[j++] = fwd->descs[i]; + } + +- gpiod_set_array_value(j, descs, NULL, values); ++ if (fwd->chip.can_sleep) ++ gpiod_set_array_value_cansleep(j, descs, NULL, values); ++ else ++ gpiod_set_array_value(j, descs, NULL, values); + } + + static void gpio_fwd_set_multiple_locked(struct gpio_chip *chip, +-- +2.34.1 + diff --git a/queue-5.10/gpio-sifive-use-the-correct-register-to-read-output-.patch b/queue-5.10/gpio-sifive-use-the-correct-register-to-read-output-.patch new file mode 100644 index 00000000000..9991a741e2e --- /dev/null +++ b/queue-5.10/gpio-sifive-use-the-correct-register-to-read-output-.patch @@ -0,0 +1,45 @@ +From 3057d4929183f2ea7867d975e3c3ea3aa16b4c76 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Feb 2022 13:02:25 +0000 +Subject: gpio: sifive: use the correct register to read output values + +From: Niklas Cassel + +[ Upstream commit cc38ef936840ac29204d806deb4d1836ec509594 ] + +Setting the output of a GPIO to 1 using gpiod_set_value(), followed by +reading the same GPIO using gpiod_get_value(), will currently yield an +incorrect result. + +This is because the SiFive GPIO device stores the output values in reg_set, +not reg_dat. + +Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the +generic driver reads the correct register. + +Fixes: 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs") +Signed-off-by: Niklas Cassel +Reviewed-by: Linus Walleij +[Bartosz: added the Fixes tag] +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-sifive.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c +index d5eb9ca119016..4f28fa73450c1 100644 +--- a/drivers/gpio/gpio-sifive.c ++++ b/drivers/gpio/gpio-sifive.c +@@ -206,7 +206,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) + NULL, + chip->base + SIFIVE_GPIO_OUTPUT_EN, + chip->base + SIFIVE_GPIO_INPUT_EN, +- 0); ++ BGPIOF_READ_OUTPUT_REG_SET); + if (ret) { + dev_err(dev, "unable to init generic GPIO\n"); + return ret; +-- +2.34.1 + diff --git a/queue-5.10/ice-fix-an-error-code-in-ice_cfg_phy_fec.patch b/queue-5.10/ice-fix-an-error-code-in-ice_cfg_phy_fec.patch new file mode 100644 index 00000000000..c8c4f4101ee --- /dev/null +++ b/queue-5.10/ice-fix-an-error-code-in-ice_cfg_phy_fec.patch @@ -0,0 +1,38 @@ +From 0c354d44225b22e74d32a9c81fd16b3567919ac9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Jan 2022 11:02:06 +0300 +Subject: ice: fix an error code in ice_cfg_phy_fec() + +From: Dan Carpenter + +[ Upstream commit 21338d58736ef70eaae5fd75d567a358ff7902f9 ] + +Propagate the error code from ice_get_link_default_override() instead +of returning success. + +Fixes: ea78ce4dab05 ("ice: add link lenient and default override support") +Signed-off-by: Dan Carpenter +Tested-by: Gurucharan G +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_common.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c +index 64714757bd4f4..2b0d0373ab2c6 100644 +--- a/drivers/net/ethernet/intel/ice/ice_common.c ++++ b/drivers/net/ethernet/intel/ice/ice_common.c +@@ -3032,7 +3032,8 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, + if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(pi->hw)) { + struct ice_link_default_override_tlv tlv; + +- if (ice_get_link_default_override(&tlv, pi)) ++ status = ice_get_link_default_override(&tlv, pi); ++ if (status) + goto out; + + if (!(tlv.options & ICE_LINK_OVERRIDE_STRICT_MODE) && +-- +2.34.1 + diff --git a/queue-5.10/ice-fix-ipip-and-sit-tso-offload.patch b/queue-5.10/ice-fix-ipip-and-sit-tso-offload.patch new file mode 100644 index 00000000000..a293e36c3ad --- /dev/null +++ b/queue-5.10/ice-fix-ipip-and-sit-tso-offload.patch @@ -0,0 +1,102 @@ +From 8ed477c31eb83c4c500af73665b5b161539ba1ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 Jan 2022 15:38:39 -0800 +Subject: ice: fix IPIP and SIT TSO offload + +From: Jesse Brandeburg + +[ Upstream commit 46b699c50c0304cdbd725d7740073a7f9d5edb10 ] + +The driver was avoiding offload for IPIP (at least) frames due to +parsing the inner header offsets incorrectly when trying to check +lengths. + +This length check works for VXLAN frames but fails on IPIP frames +because skb_transport_offset points to the inner header in IPIP +frames, which meant the subtraction of transport_header from +inner_network_header returns a negative value (-20). + +With the code before this patch, everything continued to work, but GSO +was being used to segment, causing throughputs of 1.5Gb/s per thread. +After this patch, throughput is more like 10Gb/s per thread for IPIP +traffic. + +Fixes: e94d44786693 ("ice: Implement filter sync, NDO operations and bump version") +Signed-off-by: Jesse Brandeburg +Reviewed-by: Paul Menzel +Tested-by: Gurucharan G +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 1 + + drivers/net/ethernet/intel/ice/ice_main.c | 25 +++++++++++++------ + 2 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +index c0ee0541e53fc..847e1ef8e1064 100644 +--- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h ++++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +@@ -507,6 +507,7 @@ struct ice_tx_ctx_desc { + (0x3FFFFULL << ICE_TXD_CTX_QW1_TSO_LEN_S) + + #define ICE_TXD_CTX_QW1_MSS_S 50 ++#define ICE_TXD_CTX_MIN_MSS 64 + + enum ice_tx_ctx_desc_cmd_bits { + ICE_TX_CTX_DESC_TSO = 0x01, +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index 4c7d1720113a0..fb4656902634c 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -6787,6 +6787,7 @@ ice_features_check(struct sk_buff *skb, + struct net_device __always_unused *netdev, + netdev_features_t features) + { ++ bool gso = skb_is_gso(skb); + size_t len; + + /* No point in doing any of this if neither checksum nor GSO are +@@ -6799,24 +6800,32 @@ ice_features_check(struct sk_buff *skb, + /* We cannot support GSO if the MSS is going to be less than + * 64 bytes. If it is then we need to drop support for GSO. + */ +- if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) ++ if (gso && (skb_shinfo(skb)->gso_size < ICE_TXD_CTX_MIN_MSS)) + features &= ~NETIF_F_GSO_MASK; + +- len = skb_network_header(skb) - skb->data; ++ len = skb_network_offset(skb); + if (len > ICE_TXD_MACLEN_MAX || len & 0x1) + goto out_rm_features; + +- len = skb_transport_header(skb) - skb_network_header(skb); ++ len = skb_network_header_len(skb); + if (len > ICE_TXD_IPLEN_MAX || len & 0x1) + goto out_rm_features; + + if (skb->encapsulation) { +- len = skb_inner_network_header(skb) - skb_transport_header(skb); +- if (len > ICE_TXD_L4LEN_MAX || len & 0x1) +- goto out_rm_features; ++ /* this must work for VXLAN frames AND IPIP/SIT frames, and in ++ * the case of IPIP frames, the transport header pointer is ++ * after the inner header! So check to make sure that this ++ * is a GRE or UDP_TUNNEL frame before doing that math. ++ */ ++ if (gso && (skb_shinfo(skb)->gso_type & ++ (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL))) { ++ len = skb_inner_network_header(skb) - ++ skb_transport_header(skb); ++ if (len > ICE_TXD_L4LEN_MAX || len & 0x1) ++ goto out_rm_features; ++ } + +- len = skb_inner_transport_header(skb) - +- skb_inner_network_header(skb); ++ len = skb_inner_network_header_len(skb); + if (len > ICE_TXD_IPLEN_MAX || len & 0x1) + goto out_rm_features; + } +-- +2.34.1 + diff --git a/queue-5.10/ipmr-ip6mr-acquire-rtnl-before-calling-ip-6-mr_free_.patch b/queue-5.10/ipmr-ip6mr-acquire-rtnl-before-calling-ip-6-mr_free_.patch new file mode 100644 index 00000000000..4f815054c33 --- /dev/null +++ b/queue-5.10/ipmr-ip6mr-acquire-rtnl-before-calling-ip-6-mr_free_.patch @@ -0,0 +1,101 @@ +From 03771df7e6ad8010b0c62bedc24f8e7b7344dd35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 21:34:51 -0800 +Subject: ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on + failure path + +From: Eric Dumazet + +[ Upstream commit 5611a00697c8ecc5aad04392bea629e9d6a20463 ] + +ip[6]mr_free_table() can only be called under RTNL lock. + +RTNL: assertion failed at net/core/dev.c (10367) +WARNING: CPU: 1 PID: 5890 at net/core/dev.c:10367 unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367 +Modules linked in: +CPU: 1 PID: 5890 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller-11627-g422ee58dc0ef #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +RIP: 0010:unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367 +Code: 0f 85 9b ee ff ff e8 69 07 4b fa ba 7f 28 00 00 48 c7 c6 00 90 ae 8a 48 c7 c7 40 90 ae 8a c6 05 6d b1 51 06 01 e8 8c 90 d8 01 <0f> 0b e9 70 ee ff ff e8 3e 07 4b fa 4c 89 e7 e8 86 2a 59 fa e9 ee +RSP: 0018:ffffc900046ff6e0 EFLAGS: 00010286 +RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 +RDX: ffff888050f51d00 RSI: ffffffff815fa008 RDI: fffff520008dfece +RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 +R10: ffffffff815f3d6e R11: 0000000000000000 R12: 00000000fffffff4 +R13: dffffc0000000000 R14: ffffc900046ff750 R15: ffff88807b7dc000 +FS: 00007f4ab736e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 00007fee0b4f8990 CR3: 000000001e7d2000 CR4: 00000000003506e0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +Call Trace: + + mroute_clean_tables+0x244/0xb40 net/ipv6/ip6mr.c:1509 + ip6mr_free_table net/ipv6/ip6mr.c:389 [inline] + ip6mr_rules_init net/ipv6/ip6mr.c:246 [inline] + ip6mr_net_init net/ipv6/ip6mr.c:1306 [inline] + ip6mr_net_init+0x3f0/0x4e0 net/ipv6/ip6mr.c:1298 + ops_init+0xaf/0x470 net/core/net_namespace.c:140 + setup_net+0x54f/0xbb0 net/core/net_namespace.c:331 + copy_net_ns+0x318/0x760 net/core/net_namespace.c:475 + create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 + copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 + copy_process+0x2e0c/0x7300 kernel/fork.c:2167 + kernel_clone+0xe7/0xab0 kernel/fork.c:2555 + __do_sys_clone+0xc8/0x110 kernel/fork.c:2672 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x44/0xae +RIP: 0033:0x7f4ab89f9059 +Code: Unable to access opcode bytes at RIP 0x7f4ab89f902f. +RSP: 002b:00007f4ab736e118 EFLAGS: 00000206 ORIG_RAX: 0000000000000038 +RAX: ffffffffffffffda RBX: 00007f4ab8b0bf60 RCX: 00007f4ab89f9059 +RDX: 0000000020000280 RSI: 0000000020000270 RDI: 0000000040200000 +RBP: 00007f4ab8a5308d R08: 0000000020000300 R09: 0000000020000300 +R10: 00000000200002c0 R11: 0000000000000206 R12: 0000000000000000 +R13: 00007ffc3977cc1f R14: 00007f4ab736e300 R15: 0000000000022000 + + +Fixes: f243e5a7859a ("ipmr,ip6mr: call ip6mr_free_table() on failure path") +Signed-off-by: Eric Dumazet +Cc: Cong Wang +Reported-by: syzbot +Link: https://lore.kernel.org/r/20220208053451.2885398-1-eric.dumazet@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/ipmr.c | 2 ++ + net/ipv6/ip6mr.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c +index 939792a388146..be1976536f1c0 100644 +--- a/net/ipv4/ipmr.c ++++ b/net/ipv4/ipmr.c +@@ -261,7 +261,9 @@ static int __net_init ipmr_rules_init(struct net *net) + return 0; + + err2: ++ rtnl_lock(); + ipmr_free_table(mrt); ++ rtnl_unlock(); + err1: + fib_rules_unregister(ops); + return err; +diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c +index 06b0d2c329b94..41cb348a7c3c4 100644 +--- a/net/ipv6/ip6mr.c ++++ b/net/ipv6/ip6mr.c +@@ -248,7 +248,9 @@ static int __net_init ip6mr_rules_init(struct net *net) + return 0; + + err2: ++ rtnl_lock(); + ip6mr_free_table(mrt); ++ rtnl_unlock(); + err1: + fib_rules_unregister(ops); + return err; +-- +2.34.1 + diff --git a/queue-5.10/ixgbevf-require-large-buffers-for-build_skb-on-82599.patch b/queue-5.10/ixgbevf-require-large-buffers-for-build_skb-on-82599.patch new file mode 100644 index 00000000000..bf17b5e201e --- /dev/null +++ b/queue-5.10/ixgbevf-require-large-buffers-for-build_skb-on-82599.patch @@ -0,0 +1,74 @@ +From b07b70372f5657cf0d18ef8a72dcedbb8d7637b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Feb 2022 14:49:16 -0800 +Subject: ixgbevf: Require large buffers for build_skb on 82599VF + +From: Samuel Mendoza-Jonas + +[ Upstream commit fe68195daf34d5dddacd3f93dd3eafc4beca3a0e ] + +From 4.17 onwards the ixgbevf driver uses build_skb() to build an skb +around new data in the page buffer shared with the ixgbe PF. +This uses either a 2K or 3K buffer, and offsets the DMA mapping by +NET_SKB_PAD + NET_IP_ALIGN. When using a smaller buffer RXDCTL is set to +ensure the PF does not write a full 2K bytes into the buffer, which is +actually 2K minus the offset. + +However on the 82599 virtual function, the RXDCTL mechanism is not +available. The driver attempts to work around this by using the SET_LPE +mailbox method to lower the maximm frame size, but the ixgbe PF driver +ignores this in order to keep the PF and all VFs in sync[0]. + +This means the PF will write up to the full 2K set in SRRCTL, causing it +to write NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the buffer. +With 4K pages split into two buffers, this means it either writes +NET_SKB_PAD + NET_IP_ALIGN bytes past the first buffer (and into the +second), or NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the DMA +mapping. + +Avoid this by only enabling build_skb when using "large" buffers (3K). +These are placed in each half of an order-1 page, preventing the PF from +writing past the end of the mapping. + +[0]: Technically it only ever raises the max frame size, see +ixgbe_set_vf_lpe() in ixgbe_sriov.c + +Fixes: f15c5ba5b6cd ("ixgbevf: add support for using order 1 pages to receive large frames") +Signed-off-by: Samuel Mendoza-Jonas +Tested-by: Konrad Jankowski +Signed-off-by: Tony Nguyen +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +index a7d0a459969a2..2d6ac61d7a3e6 100644 +--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c ++++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +@@ -1992,14 +1992,15 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter, + if (adapter->flags & IXGBEVF_FLAGS_LEGACY_RX) + return; + +- set_ring_build_skb_enabled(rx_ring); ++ if (PAGE_SIZE < 8192) ++ if (max_frame > IXGBEVF_MAX_FRAME_BUILD_SKB) ++ set_ring_uses_large_buffer(rx_ring); + +- if (PAGE_SIZE < 8192) { +- if (max_frame <= IXGBEVF_MAX_FRAME_BUILD_SKB) +- return; ++ /* 82599 can't rely on RXDCTL.RLPML to restrict the size of the frame */ ++ if (adapter->hw.mac.type == ixgbe_mac_82599_vf && !ring_uses_large_buffer(rx_ring)) ++ return; + +- set_ring_uses_large_buffer(rx_ring); +- } ++ set_ring_build_skb_enabled(rx_ring); + } + + /** +-- +2.34.1 + diff --git a/queue-5.10/misc-fastrpc-avoid-double-fput-on-failed-usercopy.patch b/queue-5.10/misc-fastrpc-avoid-double-fput-on-failed-usercopy.patch new file mode 100644 index 00000000000..271f785bd83 --- /dev/null +++ b/queue-5.10/misc-fastrpc-avoid-double-fput-on-failed-usercopy.patch @@ -0,0 +1,58 @@ +From f8174217e083399a26978975e7e63e6e77f058c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jan 2022 14:02:18 +0100 +Subject: misc: fastrpc: avoid double fput() on failed usercopy +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mathias Krause + +[ Upstream commit 46963e2e0629cb31c96b1d47ddd89dc3d8990b34 ] + +If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF +ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact, +dma_buf_fd() called fd_install() before, i.e. "consumed" one reference, +leaving us with none. + +Calling dma_buf_put() will therefore put a reference we no longer own, +leading to a valid file descritor table entry for an already released +'file' object which is a straight use-after-free. + +Simply avoid calling dma_buf_put() and rely on the process exit code to +do the necessary cleanup, if needed, i.e. if the file descriptor is +still valid. + +Fixes: 6cffd79504ce ("misc: fastrpc: Add support for dmabuf exporter") +Acked-by: Christian König +Signed-off-by: Mathias Krause +Link: https://lore.kernel.org/r/20220127130218.809261-1-minipli@grsecurity.net +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/fastrpc.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c +index ef49ac8d91019..d0471fec37fbb 100644 +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -1284,7 +1284,14 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) + } + + if (copy_to_user(argp, &bp, sizeof(bp))) { +- dma_buf_put(buf->dmabuf); ++ /* ++ * The usercopy failed, but we can't do much about it, as ++ * dma_buf_fd() already called fd_install() and made the ++ * file descriptor accessible for the current process. It ++ * might already be closed and dmabuf no longer valid when ++ * we reach this point. Therefore "leak" the fd and rely on ++ * the process exit path to do any required cleanup. ++ */ + return -EFAULT; + } + +-- +2.34.1 + diff --git a/queue-5.10/net-amd-xgbe-disable-interrupts-during-pci-removal.patch b/queue-5.10/net-amd-xgbe-disable-interrupts-during-pci-removal.patch new file mode 100644 index 00000000000..1c2837dd6e0 --- /dev/null +++ b/queue-5.10/net-amd-xgbe-disable-interrupts-during-pci-removal.patch @@ -0,0 +1,41 @@ +From 93c7287cadb8467c509ea300a37eff42559b405c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Feb 2022 10:02:01 +0530 +Subject: net: amd-xgbe: disable interrupts during pci removal + +From: Raju Rangoju + +[ Upstream commit 68c2d6af1f1e469544d6cbe9a601d96fb9c00e7f ] + +Hardware interrupts are enabled during the pci probe, however, +they are not disabled during pci removal. + +Disable all hardware interrupts during pci removal to avoid any +issues. + +Fixes: e75377404726 ("amd-xgbe: Update PCI support to use new IRQ functions") +Suggested-by: Selwin Sebastian +Signed-off-by: Raju Rangoju +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +index 90cb55eb54665..014513ce00a14 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +@@ -418,6 +418,9 @@ static void xgbe_pci_remove(struct pci_dev *pdev) + + pci_free_irq_vectors(pdata->pcidev); + ++ /* Disable all interrupts in the hardware */ ++ XP_IOWRITE(pdata, XP_INT_EN, 0x0); ++ + xgbe_free_pdata(pdata); + } + +-- +2.34.1 + diff --git a/queue-5.10/net-do-not-keep-the-dst-cache-when-uncloning-an-skb-.patch b/queue-5.10/net-do-not-keep-the-dst-cache-when-uncloning-an-skb-.patch new file mode 100644 index 00000000000..fccb8ef9ae6 --- /dev/null +++ b/queue-5.10/net-do-not-keep-the-dst-cache-when-uncloning-an-skb-.patch @@ -0,0 +1,65 @@ +From df52a21c9e13e2b403523abf9a25446098c2ba04 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:13:18 +0100 +Subject: net: do not keep the dst cache when uncloning an skb dst and its + metadata + +From: Antoine Tenart + +[ Upstream commit cfc56f85e72f5b9c5c5be26dc2b16518d36a7868 ] + +When uncloning an skb dst and its associated metadata a new dst+metadata +is allocated and the tunnel information from the old metadata is copied +over there. + +The issue is the tunnel metadata has references to cached dst, which are +copied along the way. When a dst+metadata refcount drops to 0 the +metadata is freed including the cached dst entries. As they are also +referenced in the initial dst+metadata, this ends up in UaFs. + +In practice the above did not happen because of another issue, the +dst+metadata was never freed because its refcount never dropped to 0 +(this will be fixed in a subsequent patch). + +Fix this by initializing the dst cache after copying the tunnel +information from the old metadata to also unshare the dst cache. + +Fixes: d71785ffc7e7 ("net: add dst_cache to ovs vxlan lwtunnel") +Cc: Paolo Abeni +Reported-by: Vlad Buslov +Tested-by: Vlad Buslov +Signed-off-by: Antoine Tenart +Acked-by: Paolo Abeni +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + include/net/dst_metadata.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h +index 14efa0ded75dd..b997e0c1e3627 100644 +--- a/include/net/dst_metadata.h ++++ b/include/net/dst_metadata.h +@@ -123,6 +123,19 @@ static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb) + + memcpy(&new_md->u.tun_info, &md_dst->u.tun_info, + sizeof(struct ip_tunnel_info) + md_size); ++#ifdef CONFIG_DST_CACHE ++ /* Unclone the dst cache if there is one */ ++ if (new_md->u.tun_info.dst_cache.cache) { ++ int ret; ++ ++ ret = dst_cache_init(&new_md->u.tun_info.dst_cache, GFP_ATOMIC); ++ if (ret) { ++ metadata_dst_free(new_md); ++ return ERR_PTR(ret); ++ } ++ } ++#endif ++ + skb_dst_drop(skb); + dst_hold(&new_md->dst); + skb_dst_set(skb, &new_md->dst); +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-ar9331-register-the-mdiobus-under-devres.patch b/queue-5.10/net-dsa-ar9331-register-the-mdiobus-under-devres.patch new file mode 100644 index 00000000000..ed527db1d83 --- /dev/null +++ b/queue-5.10/net-dsa-ar9331-register-the-mdiobus-under-devres.patch @@ -0,0 +1,69 @@ +From 0658be6107c731f0ffdd443501879a1b5e009cc6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:15:48 +0200 +Subject: net: dsa: ar9331: register the mdiobus under devres + +From: Vladimir Oltean + +[ Upstream commit 50facd86e9fbc4b93fe02e5fe05776047f45dbfb ] + +As explained in commits: +74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") +5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") + +mdiobus_free() will panic when called from devm_mdiobus_free() <- +devres_release_all() <- __device_release_driver(), and that mdiobus was +not previously unregistered. + +The ar9331 is an MDIO device, so the initial set of constraints that I +thought would cause this (I2C or SPI buses which call ->remove on +->shutdown) do not apply. But there is one more which applies here. + +If the DSA master itself is on a bus that calls ->remove from ->shutdown +(like dpaa2-eth, which is on the fsl-mc bus), there is a device link +between the switch and the DSA master, and device_links_unbind_consumers() +will unbind the ar9331 switch driver on shutdown. + +So the same treatment must be applied to all DSA switch drivers, which +is: either use devres for both the mdiobus allocation and registration, +or don't use devres at all. + +The ar9331 driver doesn't have a complex code structure for mdiobus +removal, so just replace of_mdiobus_register with the devres variant in +order to be all-devres and ensure that we don't free a still-registered +bus. + +Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") +Signed-off-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Tested-by: Oleksij Rempel +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/qca/ar9331.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c +index 661745932a539..c33bdcf7efc58 100644 +--- a/drivers/net/dsa/qca/ar9331.c ++++ b/drivers/net/dsa/qca/ar9331.c +@@ -289,7 +289,7 @@ static int ar9331_sw_mbus_init(struct ar9331_sw_priv *priv) + if (!mnp) + return -ENODEV; + +- ret = of_mdiobus_register(mbus, mnp); ++ ret = devm_of_mdiobus_register(dev, mbus, mnp); + of_node_put(mnp); + if (ret) + return ret; +@@ -856,7 +856,6 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) + struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev); + + irq_domain_remove(priv->irqdomain); +- mdiobus_unregister(priv->mbus); + dsa_unregister_switch(&priv->ds); + + reset_control_assert(priv->sw_reset); +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-bcm_sf2-don-t-use-devres-for-mdiobus.patch b/queue-5.10/net-dsa-bcm_sf2-don-t-use-devres-for-mdiobus.patch new file mode 100644 index 00000000000..715254cf8a5 --- /dev/null +++ b/queue-5.10/net-dsa-bcm_sf2-don-t-use-devres-for-mdiobus.patch @@ -0,0 +1,81 @@ +From ed9c42b974a8d57f58d0d3a5a0c65469d1e84ec2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:15:49 +0200 +Subject: net: dsa: bcm_sf2: don't use devres for mdiobus + +From: Vladimir Oltean + +[ Upstream commit 08f1a20822349004bb9cc1b153ecb516e9f2889d ] + +As explained in commits: +74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") +5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") + +mdiobus_free() will panic when called from devm_mdiobus_free() <- +devres_release_all() <- __device_release_driver(), and that mdiobus was +not previously unregistered. + +The Starfighter 2 is a platform device, so the initial set of +constraints that I thought would cause this (I2C or SPI buses which call +->remove on ->shutdown) do not apply. But there is one more which +applies here. + +If the DSA master itself is on a bus that calls ->remove from ->shutdown +(like dpaa2-eth, which is on the fsl-mc bus), there is a device link +between the switch and the DSA master, and device_links_unbind_consumers() +will unbind the bcm_sf2 switch driver on shutdown. + +So the same treatment must be applied to all DSA switch drivers, which +is: either use devres for both the mdiobus allocation and registration, +or don't use devres at all. + +The bcm_sf2 driver has the code structure in place for orderly mdiobus +removal, so just replace devm_mdiobus_alloc() with the non-devres +variant, and add manual free where necessary, to ensure that we don't +let devres free a still-registered bus. + +Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") +Signed-off-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/bcm_sf2.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c +index 690e9d9495e75..08a675a5328d7 100644 +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -504,7 +504,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) + get_device(&priv->master_mii_bus->dev); + priv->master_mii_dn = dn; + +- priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); ++ priv->slave_mii_bus = mdiobus_alloc(); + if (!priv->slave_mii_bus) { + of_node_put(dn); + return -ENOMEM; +@@ -564,8 +564,10 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) + } + + err = mdiobus_register(priv->slave_mii_bus); +- if (err && dn) ++ if (err && dn) { ++ mdiobus_free(priv->slave_mii_bus); + of_node_put(dn); ++ } + + return err; + } +@@ -573,6 +575,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) + static void bcm_sf2_mdio_unregister(struct bcm_sf2_priv *priv) + { + mdiobus_unregister(priv->slave_mii_bus); ++ mdiobus_free(priv->slave_mii_bus); + of_node_put(priv->master_mii_dn); + } + +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-felix-don-t-use-devres-for-mdiobus.patch b/queue-5.10/net-dsa-felix-don-t-use-devres-for-mdiobus.patch new file mode 100644 index 00000000000..d51f00d2ef4 --- /dev/null +++ b/queue-5.10/net-dsa-felix-don-t-use-devres-for-mdiobus.patch @@ -0,0 +1,77 @@ +From 286abaaa767bfdc77a64de82249948abda35b89f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:15:50 +0200 +Subject: net: dsa: felix: don't use devres for mdiobus + +From: Vladimir Oltean + +[ Upstream commit 209bdb7ec6a28c7cdf580a0a98afbc9fc3b98932 ] + +As explained in commits: +74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") +5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") + +mdiobus_free() will panic when called from devm_mdiobus_free() <- +devres_release_all() <- __device_release_driver(), and that mdiobus was +not previously unregistered. + +The Felix VSC9959 switch is a PCI device, so the initial set of +constraints that I thought would cause this (I2C or SPI buses which call +->remove on ->shutdown) do not apply. But there is one more which +applies here. + +If the DSA master itself is on a bus that calls ->remove from ->shutdown +(like dpaa2-eth, which is on the fsl-mc bus), there is a device link +between the switch and the DSA master, and device_links_unbind_consumers() +will unbind the felix switch driver on shutdown. + +So the same treatment must be applied to all DSA switch drivers, which +is: either use devres for both the mdiobus allocation and registration, +or don't use devres at all. + +The felix driver has the code structure in place for orderly mdiobus +removal, so just replace devm_mdiobus_alloc_size() with the non-devres +variant, and add manual free where necessary, to ensure that we don't +let devres free a still-registered bus. + +Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") +Signed-off-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/ocelot/felix_vsc9959.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c +index 2e5bbdca5ea47..cd8d9b0e0edb3 100644 +--- a/drivers/net/dsa/ocelot/felix_vsc9959.c ++++ b/drivers/net/dsa/ocelot/felix_vsc9959.c +@@ -1050,7 +1050,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) + return PTR_ERR(hw); + } + +- bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); ++ bus = mdiobus_alloc_size(sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + +@@ -1070,6 +1070,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) + rc = mdiobus_register(bus); + if (rc < 0) { + dev_err(dev, "failed to register MDIO bus\n"); ++ mdiobus_free(bus); + return rc; + } + +@@ -1119,6 +1120,7 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocelot) + lynx_pcs_destroy(pcs); + } + mdiobus_unregister(felix->imdio); ++ mdiobus_free(felix->imdio); + } + + static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-lantiq_gswip-don-t-use-devres-for-mdiobus.patch b/queue-5.10/net-dsa-lantiq_gswip-don-t-use-devres-for-mdiobus.patch new file mode 100644 index 00000000000..6bfd081a239 --- /dev/null +++ b/queue-5.10/net-dsa-lantiq_gswip-don-t-use-devres-for-mdiobus.patch @@ -0,0 +1,95 @@ +From ff7d61921056d830808385a8fe181038439b984e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:15:53 +0200 +Subject: net: dsa: lantiq_gswip: don't use devres for mdiobus + +From: Vladimir Oltean + +[ Upstream commit 0d120dfb5d67edc5bcd1804e167dba2b30809afd ] + +As explained in commits: +74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") +5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") + +mdiobus_free() will panic when called from devm_mdiobus_free() <- +devres_release_all() <- __device_release_driver(), and that mdiobus was +not previously unregistered. + +The GSWIP switch is a platform device, so the initial set of constraints +that I thought would cause this (I2C or SPI buses which call ->remove on +->shutdown) do not apply. But there is one more which applies here. + +If the DSA master itself is on a bus that calls ->remove from ->shutdown +(like dpaa2-eth, which is on the fsl-mc bus), there is a device link +between the switch and the DSA master, and device_links_unbind_consumers() +will unbind the GSWIP switch driver on shutdown. + +So the same treatment must be applied to all DSA switch drivers, which +is: either use devres for both the mdiobus allocation and registration, +or don't use devres at all. + +The gswip driver has the code structure in place for orderly mdiobus +removal, so just replace devm_mdiobus_alloc() with the non-devres +variant, and add manual free where necessary, to ensure that we don't +let devres free a still-registered bus. + +Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") +Signed-off-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/lantiq_gswip.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index 4d23a7aba7961..ed517985ca88e 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -495,8 +495,9 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr, int reg) + static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) + { + struct dsa_switch *ds = priv->ds; ++ int err; + +- ds->slave_mii_bus = devm_mdiobus_alloc(priv->dev); ++ ds->slave_mii_bus = mdiobus_alloc(); + if (!ds->slave_mii_bus) + return -ENOMEM; + +@@ -509,7 +510,11 @@ static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) + ds->slave_mii_bus->parent = priv->dev; + ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask; + +- return of_mdiobus_register(ds->slave_mii_bus, mdio_np); ++ err = of_mdiobus_register(ds->slave_mii_bus, mdio_np); ++ if (err) ++ mdiobus_free(ds->slave_mii_bus); ++ ++ return err; + } + + static int gswip_pce_table_entry_read(struct gswip_priv *priv, +@@ -2086,8 +2091,10 @@ static int gswip_probe(struct platform_device *pdev) + gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); + dsa_unregister_switch(priv->ds); + mdio_bus: +- if (mdio_np) ++ if (mdio_np) { + mdiobus_unregister(priv->ds->slave_mii_bus); ++ mdiobus_free(priv->ds->slave_mii_bus); ++ } + put_mdio_node: + of_node_put(mdio_np); + for (i = 0; i < priv->num_gphy_fw; i++) +@@ -2107,6 +2114,7 @@ static int gswip_remove(struct platform_device *pdev) + + if (priv->ds->slave_mii_bus) { + mdiobus_unregister(priv->ds->slave_mii_bus); ++ mdiobus_free(priv->ds->slave_mii_bus); + of_node_put(priv->ds->slave_mii_bus->dev.of_node); + } + +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-mv88e6xxx-don-t-use-devres-for-mdiobus.patch b/queue-5.10/net-dsa-mv88e6xxx-don-t-use-devres-for-mdiobus.patch new file mode 100644 index 00000000000..37e0bc1eab1 --- /dev/null +++ b/queue-5.10/net-dsa-mv88e6xxx-don-t-use-devres-for-mdiobus.patch @@ -0,0 +1,144 @@ +From 136e75be10e98fbcbfa275ed9832f214e1b864a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:15:47 +0200 +Subject: net: dsa: mv88e6xxx: don't use devres for mdiobus + +From: Vladimir Oltean + +[ Upstream commit f53a2ce893b2c7884ef94471f170839170a4eba0 ] + +As explained in commits: +74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") +5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") + +mdiobus_free() will panic when called from devm_mdiobus_free() <- +devres_release_all() <- __device_release_driver(), and that mdiobus was +not previously unregistered. + +The mv88e6xxx is an MDIO device, so the initial set of constraints that +I thought would cause this (I2C or SPI buses which call ->remove on +->shutdown) do not apply. But there is one more which applies here. + +If the DSA master itself is on a bus that calls ->remove from ->shutdown +(like dpaa2-eth, which is on the fsl-mc bus), there is a device link +between the switch and the DSA master, and device_links_unbind_consumers() +will unbind the Marvell switch driver on shutdown. + +systemd-shutdown[1]: Powering off. +mv88e6085 0x0000000008b96000:00 sw_gl0: Link is Down +fsl-mc dpbp.9: Removing from iommu group 7 +fsl-mc dpbp.8: Removing from iommu group 7 +------------[ cut here ]------------ +kernel BUG at drivers/net/phy/mdio_bus.c:677! +Internal error: Oops - BUG: 0 [#1] PREEMPT SMP +Modules linked in: +CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00040-gdc05f73788e5 #15 +pc : mdiobus_free+0x44/0x50 +lr : devm_mdiobus_free+0x10/0x20 +Call trace: + mdiobus_free+0x44/0x50 + devm_mdiobus_free+0x10/0x20 + devres_release_all+0xa0/0x100 + __device_release_driver+0x190/0x220 + device_release_driver_internal+0xac/0xb0 + device_links_unbind_consumers+0xd4/0x100 + __device_release_driver+0x4c/0x220 + device_release_driver_internal+0xac/0xb0 + device_links_unbind_consumers+0xd4/0x100 + __device_release_driver+0x94/0x220 + device_release_driver+0x28/0x40 + bus_remove_device+0x118/0x124 + device_del+0x174/0x420 + fsl_mc_device_remove+0x24/0x40 + __fsl_mc_device_remove+0xc/0x20 + device_for_each_child+0x58/0xa0 + dprc_remove+0x90/0xb0 + fsl_mc_driver_remove+0x20/0x5c + __device_release_driver+0x21c/0x220 + device_release_driver+0x28/0x40 + bus_remove_device+0x118/0x124 + device_del+0x174/0x420 + fsl_mc_bus_remove+0x80/0x100 + fsl_mc_bus_shutdown+0xc/0x1c + platform_shutdown+0x20/0x30 + device_shutdown+0x154/0x330 + kernel_power_off+0x34/0x6c + __do_sys_reboot+0x15c/0x250 + __arm64_sys_reboot+0x20/0x30 + invoke_syscall.constprop.0+0x4c/0xe0 + do_el0_svc+0x4c/0x150 + el0_svc+0x24/0xb0 + el0t_64_sync_handler+0xa8/0xb0 + el0t_64_sync+0x178/0x17c + +So the same treatment must be applied to all DSA switch drivers, which +is: either use devres for both the mdiobus allocation and registration, +or don't use devres at all. + +The Marvell driver already has a good structure for mdiobus removal, so +just plug in mdiobus_free and get rid of devres. + +Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") +Reported-by: Rafael Richter +Signed-off-by: Vladimir Oltean +Tested-by: Daniel Klauer +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mv88e6xxx/chip.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index afc5500ef8ed9..9b451b820d7a6 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -3072,7 +3072,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, + return err; + } + +- bus = devm_mdiobus_alloc_size(chip->dev, sizeof(*mdio_bus)); ++ bus = mdiobus_alloc_size(sizeof(*mdio_bus)); + if (!bus) + return -ENOMEM; + +@@ -3097,14 +3097,14 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, + if (!external) { + err = mv88e6xxx_g2_irq_mdio_setup(chip, bus); + if (err) +- return err; ++ goto out; + } + + err = of_mdiobus_register(bus, np); + if (err) { + dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err); + mv88e6xxx_g2_irq_mdio_free(chip, bus); +- return err; ++ goto out; + } + + if (external) +@@ -3113,6 +3113,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, + list_add(&mdio_bus->list, &chip->mdios); + + return 0; ++ ++out: ++ mdiobus_free(bus); ++ return err; + } + + static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) +@@ -3128,6 +3132,7 @@ static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) + mv88e6xxx_g2_irq_mdio_free(chip, bus); + + mdiobus_unregister(bus); ++ mdiobus_free(bus); + } + } + +-- +2.34.1 + diff --git a/queue-5.10/net-dsa-mv88e6xxx-fix-use-after-free-in-mv88e6xxx_md.patch b/queue-5.10/net-dsa-mv88e6xxx-fix-use-after-free-in-mv88e6xxx_md.patch new file mode 100644 index 00000000000..ede3a877dc2 --- /dev/null +++ b/queue-5.10/net-dsa-mv88e6xxx-fix-use-after-free-in-mv88e6xxx_md.patch @@ -0,0 +1,48 @@ +From 2fca6387daa71fec07bf74b010e352df2e215966 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Feb 2022 19:40:17 +0200 +Subject: net: dsa: mv88e6xxx: fix use-after-free in mv88e6xxx_mdios_unregister + +From: Vladimir Oltean + +[ Upstream commit 51a04ebf21122d5c76a716ecd9bfc33ea44b2b39 ] + +Since struct mv88e6xxx_mdio_bus *mdio_bus is the bus->priv of something +allocated with mdiobus_alloc_size(), this means that mdiobus_free(bus) +will free the memory backing the mdio_bus as well. Therefore, the +mdio_bus->list element is freed memory, but we continue to iterate +through the list of MDIO buses using that list element. + +To fix this, use the proper list iterator that handles element deletion +by keeping a copy of the list element next pointer. + +Fixes: f53a2ce893b2 ("net: dsa: mv88e6xxx: don't use devres for mdiobus") +Reported-by: Rafael Richter +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20220210174017.3271099-1-vladimir.oltean@nxp.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mv88e6xxx/chip.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index 9b451b820d7a6..1992be77522ac 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -3122,10 +3122,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, + static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) + + { +- struct mv88e6xxx_mdio_bus *mdio_bus; ++ struct mv88e6xxx_mdio_bus *mdio_bus, *p; + struct mii_bus *bus; + +- list_for_each_entry(mdio_bus, &chip->mdios, list) { ++ list_for_each_entry_safe(mdio_bus, p, &chip->mdios, list) { + bus = mdio_bus->bus; + + if (!mdio_bus->external) +-- +2.34.1 + diff --git a/queue-5.10/net-fix-a-memleak-when-uncloning-an-skb-dst-and-its-.patch b/queue-5.10/net-fix-a-memleak-when-uncloning-an-skb-dst-and-its-.patch new file mode 100644 index 00000000000..ff5e223cee6 --- /dev/null +++ b/queue-5.10/net-fix-a-memleak-when-uncloning-an-skb-dst-and-its-.patch @@ -0,0 +1,49 @@ +From 3892ffa3151798dadbeca04ba848220fa7651308 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Feb 2022 18:13:19 +0100 +Subject: net: fix a memleak when uncloning an skb dst and its metadata + +From: Antoine Tenart + +[ Upstream commit 9eeabdf17fa0ab75381045c867c370f4cc75a613 ] + +When uncloning an skb dst and its associated metadata, a new +dst+metadata is allocated and later replaces the old one in the skb. +This is helpful to have a non-shared dst+metadata attached to a specific +skb. + +The issue is the uncloned dst+metadata is initialized with a refcount of +1, which is increased to 2 before attaching it to the skb. When +tun_dst_unclone returns, the dst+metadata is only referenced from a +single place (the skb) while its refcount is 2. Its refcount will never +drop to 0 (when the skb is consumed), leading to a memory leak. + +Fix this by removing the call to dst_hold in tun_dst_unclone, as the +dst+metadata refcount is already 1. + +Fixes: fc4099f17240 ("openvswitch: Fix egress tunnel info.") +Cc: Pravin B Shelar +Reported-by: Vlad Buslov +Tested-by: Vlad Buslov +Signed-off-by: Antoine Tenart +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + include/net/dst_metadata.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h +index b997e0c1e3627..adab27ba1ecbf 100644 +--- a/include/net/dst_metadata.h ++++ b/include/net/dst_metadata.h +@@ -137,7 +137,6 @@ static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb) + #endif + + skb_dst_drop(skb); +- dst_hold(&new_md->dst); + skb_dst_set(skb, &new_md->dst); + return new_md; + } +-- +2.34.1 + diff --git a/queue-5.10/net-mdio-aspeed-add-missing-module_device_table.patch b/queue-5.10/net-mdio-aspeed-add-missing-module_device_table.patch new file mode 100644 index 00000000000..d8204f75d86 --- /dev/null +++ b/queue-5.10/net-mdio-aspeed-add-missing-module_device_table.patch @@ -0,0 +1,36 @@ +From 9711b78027dcc1b34f2a97df94938b173fc30e43 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Feb 2022 10:33:59 +1030 +Subject: net: mdio: aspeed: Add missing MODULE_DEVICE_TABLE + +From: Joel Stanley + +[ Upstream commit bc1c3c3b10db4f37c41e6107751a8d450d9c431c ] + +Fix loading of the driver when built as a module. + +Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed") +Signed-off-by: Joel Stanley +Reviewed-by: Andrew Lunn +Acked-by: Andrew Jeffery +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/mdio/mdio-aspeed.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c +index 966c3b4ad59d1..e2273588c75b6 100644 +--- a/drivers/net/mdio/mdio-aspeed.c ++++ b/drivers/net/mdio/mdio-aspeed.c +@@ -148,6 +148,7 @@ static const struct of_device_id aspeed_mdio_of_match[] = { + { .compatible = "aspeed,ast2600-mdio", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, aspeed_mdio_of_match); + + static struct platform_driver aspeed_mdio_driver = { + .driver = { +-- +2.34.1 + diff --git a/queue-5.10/net-mscc-ocelot-fix-mutex-lock-error-during-ethtool-.patch b/queue-5.10/net-mscc-ocelot-fix-mutex-lock-error-during-ethtool-.patch new file mode 100644 index 00000000000..82bc01c64b5 --- /dev/null +++ b/queue-5.10/net-mscc-ocelot-fix-mutex-lock-error-during-ethtool-.patch @@ -0,0 +1,85 @@ +From fa22218507a7640edf0e1c15aae76f726e9573e4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Feb 2022 07:04:51 -0800 +Subject: net: mscc: ocelot: fix mutex lock error during ethtool stats read + +From: Colin Foster + +[ Upstream commit 7fbf6795d127a3b1bb39b0e42579904cf6db1624 ] + +An ongoing workqueue populates the stats buffer. At the same time, a user +might query the statistics. While writing to the buffer is mutex-locked, +reading from the buffer wasn't. This could lead to buggy reads by ethtool. + +This patch fixes the former blamed commit, but the bug was introduced in +the latter. + +Signed-off-by: Colin Foster +Fixes: 1e1caa9735f90 ("ocelot: Clean up stats update deferred work") +Fixes: a556c76adc052 ("net: mscc: Add initial Ocelot switch support") +Reported-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Link: https://lore.kernel.org/all/20220210150451.416845-2-colin.foster@in-advantage.com/ +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mscc/ocelot.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c +index 52401915828a1..a06466ecca12a 100644 +--- a/drivers/net/ethernet/mscc/ocelot.c ++++ b/drivers/net/ethernet/mscc/ocelot.c +@@ -848,12 +848,11 @@ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data) + } + EXPORT_SYMBOL(ocelot_get_strings); + ++/* Caller must hold &ocelot->stats_lock */ + static void ocelot_update_stats(struct ocelot *ocelot) + { + int i, j; + +- mutex_lock(&ocelot->stats_lock); +- + for (i = 0; i < ocelot->num_phys_ports; i++) { + /* Configure the port to read the stats from */ + ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(i), SYS_STAT_CFG); +@@ -872,8 +871,6 @@ static void ocelot_update_stats(struct ocelot *ocelot) + ~(u64)U32_MAX) + val; + } + } +- +- mutex_unlock(&ocelot->stats_lock); + } + + static void ocelot_check_stats_work(struct work_struct *work) +@@ -882,7 +879,9 @@ static void ocelot_check_stats_work(struct work_struct *work) + struct ocelot *ocelot = container_of(del_work, struct ocelot, + stats_work); + ++ mutex_lock(&ocelot->stats_lock); + ocelot_update_stats(ocelot); ++ mutex_unlock(&ocelot->stats_lock); + + queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, + OCELOT_STATS_CHECK_DELAY); +@@ -892,12 +891,16 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data) + { + int i; + ++ mutex_lock(&ocelot->stats_lock); ++ + /* check and update now */ + ocelot_update_stats(ocelot); + + /* Copy all counters */ + for (i = 0; i < ocelot->num_stats; i++) + *data++ = ocelot->stats[port * ocelot->num_stats + i]; ++ ++ mutex_unlock(&ocelot->stats_lock); + } + EXPORT_SYMBOL(ocelot_get_ethtool_stats); + +-- +2.34.1 + diff --git a/queue-5.10/netfilter-ctnetlink-disable-helper-autoassign.patch b/queue-5.10/netfilter-ctnetlink-disable-helper-autoassign.patch new file mode 100644 index 00000000000..917ab01e37b --- /dev/null +++ b/queue-5.10/netfilter-ctnetlink-disable-helper-autoassign.patch @@ -0,0 +1,72 @@ +From 6e18b8978fc67369a98f2e73e4f21cfa7cc9dd61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Feb 2022 12:00:56 +0100 +Subject: netfilter: ctnetlink: disable helper autoassign + +From: Florian Westphal + +[ Upstream commit d1ca60efc53d665cf89ed847a14a510a81770b81 ] + +When userspace, e.g. conntrackd, inserts an entry with a specified helper, +its possible that the helper is lost immediately after its added: + +ctnetlink_create_conntrack + -> nf_ct_helper_ext_add + assign helper + -> ctnetlink_setup_nat + -> ctnetlink_parse_nat_setup + -> parse_nat_setup -> nfnetlink_parse_nat_setup + -> nf_nat_setup_info + -> nf_conntrack_alter_reply + -> __nf_ct_try_assign_helper + +... and __nf_ct_try_assign_helper will zero the helper again. + +Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like +when helper is assigned via ruleset. + +Dropped old 'not strictly necessary' comment, it referred to use of +rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER(). + +NB: Fixes tag intentionally incorrect, this extends the referenced commit, +but this change won't build without IPS_HELPER introduced there. + +Fixes: 6714cf5465d280 ("netfilter: nf_conntrack: fix explicit helper attachment and NAT") +Reported-by: Pham Thanh Tuyen +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- + net/netfilter/nf_conntrack_netlink.c | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h +index 4b3395082d15c..26071021e986f 100644 +--- a/include/uapi/linux/netfilter/nf_conntrack_common.h ++++ b/include/uapi/linux/netfilter/nf_conntrack_common.h +@@ -106,7 +106,7 @@ enum ip_conntrack_status { + IPS_NAT_CLASH = IPS_UNTRACKED, + #endif + +- /* Conntrack got a helper explicitly attached via CT target. */ ++ /* Conntrack got a helper explicitly attached (ruleset, ctnetlink). */ + IPS_HELPER_BIT = 13, + IPS_HELPER = (1 << IPS_HELPER_BIT), + +diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c +index c6bcc28ae3387..eeeaa34b3e7b5 100644 +--- a/net/netfilter/nf_conntrack_netlink.c ++++ b/net/netfilter/nf_conntrack_netlink.c +@@ -2283,7 +2283,8 @@ ctnetlink_create_conntrack(struct net *net, + if (helper->from_nlattr) + helper->from_nlattr(helpinfo, ct); + +- /* not in hash table yet so not strictly necessary */ ++ /* disable helper auto-assignment for this entry */ ++ ct->status |= IPS_HELPER; + RCU_INIT_POINTER(help->helper, helper); + } + } else { +-- +2.34.1 + diff --git a/queue-5.10/nfp-flower-fix-ida_idx-not-being-released.patch b/queue-5.10/nfp-flower-fix-ida_idx-not-being-released.patch new file mode 100644 index 00000000000..4ad9e88e168 --- /dev/null +++ b/queue-5.10/nfp-flower-fix-ida_idx-not-being-released.patch @@ -0,0 +1,82 @@ +From e195fd16802c9c81f9da121601cdf9c5259e8b16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Feb 2022 11:14:53 +0100 +Subject: nfp: flower: fix ida_idx not being released + +From: Louis Peens + +[ Upstream commit 7db788ad627aabff2b74d4f1a3b68516d0fee0d7 ] + +When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT +that gets set if nfp_flower_is_supported_bridge is true is not taken +into account. Consequently the path that should release the ida_index +in cleanup is never triggered, causing messages like: + + nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. + nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. + nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. + +after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to +new tunnel flows not being offloaded. + +Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if +the port is of type OTHER. + +Fixes: 2e0bc7f3cb55 ("nfp: flower: encode mac indexes with pre-tunnel rule check") +Signed-off-by: Louis Peens +Signed-off-by: Simon Horman +Link: https://lore.kernel.org/r/20220208101453.321949-1-simon.horman@corigine.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../net/ethernet/netronome/nfp/flower/tunnel_conf.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +index d19c02e991145..d3d5b663a4a3c 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +@@ -1011,6 +1011,7 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev, + struct nfp_flower_repr_priv *repr_priv; + struct nfp_tun_offloaded_mac *entry; + struct nfp_repr *repr; ++ u16 nfp_mac_idx; + int ida_idx; + + entry = nfp_tunnel_lookup_offloaded_macs(app, mac); +@@ -1029,8 +1030,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev, + entry->bridge_count--; + + if (!entry->bridge_count && entry->ref_count) { +- u16 nfp_mac_idx; +- + nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT; + if (__nfp_tunnel_offload_mac(app, mac, nfp_mac_idx, + false)) { +@@ -1046,7 +1045,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev, + + /* If MAC is now used by 1 repr set the offloaded MAC index to port. */ + if (entry->ref_count == 1 && list_is_singular(&entry->repr_list)) { +- u16 nfp_mac_idx; + int port, err; + + repr_priv = list_first_entry(&entry->repr_list, +@@ -1074,8 +1072,14 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev, + WARN_ON_ONCE(rhashtable_remove_fast(&priv->tun.offloaded_macs, + &entry->ht_node, + offloaded_macs_params)); ++ ++ if (nfp_flower_is_supported_bridge(netdev)) ++ nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT; ++ else ++ nfp_mac_idx = entry->index; ++ + /* If MAC has global ID then extract and free the ida entry. */ +- if (nfp_tunnel_is_mac_idx_global(entry->index)) { ++ if (nfp_tunnel_is_mac_idx_global(nfp_mac_idx)) { + ida_idx = nfp_tunnel_get_ida_from_global_mac_idx(entry->index); + ida_simple_remove(&priv->tun.mac_off_ids, ida_idx); + } +-- +2.34.1 + diff --git a/queue-5.10/phy-xilinx-zynqmp-fix-bus-width-setting-for-sgmii.patch b/queue-5.10/phy-xilinx-zynqmp-fix-bus-width-setting-for-sgmii.patch new file mode 100644 index 00000000000..536b696b0d2 --- /dev/null +++ b/queue-5.10/phy-xilinx-zynqmp-fix-bus-width-setting-for-sgmii.patch @@ -0,0 +1,62 @@ +From 34858495d083139c3bf46b61d51bbc82feec70c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jan 2022 18:16:00 -0600 +Subject: phy: xilinx: zynqmp: Fix bus width setting for SGMII + +From: Robert Hancock + +[ Upstream commit 37291f60d0822f191748c2a54ce63b0bc669020f ] + +TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with +separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was +not preserving the existing register value for other lanes, so enabling +the PHY in SGMII mode on one lane zeroed out the settings for all other +lanes, causing other PS-GTR peripherals such as USB3 to malfunction. + +Use xpsgtr_clr_set to only manipulate the desired bits in the register. + +Fixes: 4a33bea00314 ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver") +Signed-off-by: Robert Hancock +Acked-by: Michal Simek +Reviewed-by: Laurent Pinchart +Link: https://lore.kernel.org/r/20220126001600.1592218-1-robert.hancock@calian.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/xilinx/phy-zynqmp.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c +index 2b0f921b6ee3d..b8ccac6f31467 100644 +--- a/drivers/phy/xilinx/phy-zynqmp.c ++++ b/drivers/phy/xilinx/phy-zynqmp.c +@@ -134,7 +134,8 @@ + #define PROT_BUS_WIDTH_10 0x0 + #define PROT_BUS_WIDTH_20 0x1 + #define PROT_BUS_WIDTH_40 0x2 +-#define PROT_BUS_WIDTH_SHIFT 2 ++#define PROT_BUS_WIDTH_SHIFT(n) ((n) * 2) ++#define PROT_BUS_WIDTH_MASK(n) GENMASK((n) * 2 + 1, (n) * 2) + + /* Number of GT lanes */ + #define NUM_LANES 4 +@@ -443,12 +444,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy) + static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy) + { + struct xpsgtr_dev *gtr_dev = gtr_phy->dev; ++ u32 mask = PROT_BUS_WIDTH_MASK(gtr_phy->lane); ++ u32 val = PROT_BUS_WIDTH_10 << PROT_BUS_WIDTH_SHIFT(gtr_phy->lane); + + /* Set SGMII protocol TX and RX bus width to 10 bits. */ +- xpsgtr_write(gtr_dev, TX_PROT_BUS_WIDTH, +- PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT)); +- xpsgtr_write(gtr_dev, RX_PROT_BUS_WIDTH, +- PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT)); ++ xpsgtr_clr_set(gtr_dev, TX_PROT_BUS_WIDTH, mask, val); ++ xpsgtr_clr_set(gtr_dev, RX_PROT_BUS_WIDTH, mask, val); + + xpsgtr_bypass_scrambler_8b10b(gtr_phy); + } +-- +2.34.1 + diff --git a/queue-5.10/series b/queue-5.10/series index 5f38117e0f0..095bead9a2a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -47,3 +47,40 @@ nvme-tcp-fix-bogus-request-completion-when-failing-to-send-aer.patch acpi-iort-check-node-revision-for-pmcg-resources.patch pm-s2idle-acpi-fix-wakeup-interrupts-handling.patch drm-rockchip-vop-correct-rk3399-vop-register-fields.patch +arm-dts-fix-timer-regression-for-beagleboard-revisio.patch +arm-dts-meson-fix-the-uart-compatible-strings.patch +arm-dts-meson8-fix-the-uart-device-tree-schema-valid.patch +arm-dts-meson8b-fix-the-uart-device-tree-schema-vali.patch +staging-fbtft-fix-error-path-in-fbtft_driver_module_.patch +arm-dts-imx6qdl-udoo-properly-describe-the-sd-card-d.patch +phy-xilinx-zynqmp-fix-bus-width-setting-for-sgmii.patch +arm-dts-imx7ulp-fix-assigned-clocks-parents-typo.patch +usb-f_fs-fix-use-after-free-for-epfile.patch +gpio-aggregator-fix-calling-into-sleeping-gpio-contr.patch +drm-vc4-hdmi-allow-dblclk-modes-even-if-horz-timing-.patch +misc-fastrpc-avoid-double-fput-on-failed-usercopy.patch +netfilter-ctnetlink-disable-helper-autoassign.patch +arm64-dts-meson-g12b-odroid-n2-fix-typo-dio2133.patch +ixgbevf-require-large-buffers-for-build_skb-on-82599.patch +drm-panel-simple-assign-data-from-panel_dpi_probe-co.patch +acpi-pm-s2idle-cancel-wakeup-before-dispatching-ec-g.patch +gpio-sifive-use-the-correct-register-to-read-output-.patch +bonding-pair-enable_port-with-slave_arr_updates.patch +net-dsa-mv88e6xxx-don-t-use-devres-for-mdiobus.patch +net-dsa-ar9331-register-the-mdiobus-under-devres.patch +net-dsa-bcm_sf2-don-t-use-devres-for-mdiobus.patch +net-dsa-felix-don-t-use-devres-for-mdiobus.patch +net-dsa-lantiq_gswip-don-t-use-devres-for-mdiobus.patch +ipmr-ip6mr-acquire-rtnl-before-calling-ip-6-mr_free_.patch +nfp-flower-fix-ida_idx-not-being-released.patch +net-do-not-keep-the-dst-cache-when-uncloning-an-skb-.patch +net-fix-a-memleak-when-uncloning-an-skb-dst-and-its-.patch +veth-fix-races-around-rq-rx_notify_masked.patch +net-mdio-aspeed-add-missing-module_device_table.patch +tipc-rate-limit-warning-for-received-illegal-binding.patch +net-amd-xgbe-disable-interrupts-during-pci-removal.patch +dpaa2-eth-unregister-the-netdev-before-disconnecting.patch +ice-fix-an-error-code-in-ice_cfg_phy_fec.patch +ice-fix-ipip-and-sit-tso-offload.patch +net-mscc-ocelot-fix-mutex-lock-error-during-ethtool-.patch +net-dsa-mv88e6xxx-fix-use-after-free-in-mv88e6xxx_md.patch diff --git a/queue-5.10/staging-fbtft-fix-error-path-in-fbtft_driver_module_.patch b/queue-5.10/staging-fbtft-fix-error-path-in-fbtft_driver_module_.patch new file mode 100644 index 00000000000..f285a15dfa5 --- /dev/null +++ b/queue-5.10/staging-fbtft-fix-error-path-in-fbtft_driver_module_.patch @@ -0,0 +1,43 @@ +From 6a266520d98f083b13dd80467470201260fa9fa8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Jan 2022 19:13:37 +0100 +Subject: staging: fbtft: Fix error path in fbtft_driver_module_init() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 426aca16e903b387a0b0001d62207a745c67cfd3 ] + +If registering the platform driver fails, the function must not return +without undoing the spi driver registration first. + +Fixes: c296d5f9957c ("staging: fbtft: core support") +Signed-off-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/fbtft/fbtft.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h +index 76f8c090a8370..06afaa9d505ba 100644 +--- a/drivers/staging/fbtft/fbtft.h ++++ b/drivers/staging/fbtft/fbtft.h +@@ -332,7 +332,10 @@ static int __init fbtft_driver_module_init(void) \ + ret = spi_register_driver(&fbtft_driver_spi_driver); \ + if (ret < 0) \ + return ret; \ +- return platform_driver_register(&fbtft_driver_platform_driver); \ ++ ret = platform_driver_register(&fbtft_driver_platform_driver); \ ++ if (ret < 0) \ ++ spi_unregister_driver(&fbtft_driver_spi_driver); \ ++ return ret; \ + } \ + \ + static void __exit fbtft_driver_module_exit(void) \ +-- +2.34.1 + diff --git a/queue-5.10/tipc-rate-limit-warning-for-received-illegal-binding.patch b/queue-5.10/tipc-rate-limit-warning-for-received-illegal-binding.patch new file mode 100644 index 00000000000..2b6b5315b38 --- /dev/null +++ b/queue-5.10/tipc-rate-limit-warning-for-received-illegal-binding.patch @@ -0,0 +1,38 @@ +From c850e26a471b13c2810566218a8e4abb6bd68b43 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Feb 2022 22:22:37 -0500 +Subject: tipc: rate limit warning for received illegal binding update + +From: Jon Maloy + +[ Upstream commit c7223d687758462826a20e9735305d55bb874c70 ] + +It would be easy to craft a message containing an illegal binding table +update operation. This is handled correctly by the code, but the +corresponding warning printout is not rate limited as is should be. +We fix this now. + +Fixes: b97bf3fd8f6a ("[TIPC] Initial merge") +Signed-off-by: Jon Maloy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/tipc/name_distr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c +index fe4edce459ad4..a757fe28bcb5f 100644 +--- a/net/tipc/name_distr.c ++++ b/net/tipc/name_distr.c +@@ -315,7 +315,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i, + pr_warn_ratelimited("Failed to remove binding %u,%u from %x\n", + type, lower, node); + } else { +- pr_warn("Unrecognized name table message received\n"); ++ pr_warn_ratelimited("Unknown name table message received\n"); + } + return false; + } +-- +2.34.1 + diff --git a/queue-5.10/usb-f_fs-fix-use-after-free-for-epfile.patch b/queue-5.10/usb-f_fs-fix-use-after-free-for-epfile.patch new file mode 100644 index 00000000000..c4cdad06d3c --- /dev/null +++ b/queue-5.10/usb-f_fs-fix-use-after-free-for-epfile.patch @@ -0,0 +1,163 @@ +From 3230fda1bad022f9a76980c2e9fb5c18c681f76e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jan 2022 09:39:55 +0530 +Subject: usb: f_fs: Fix use-after-free for epfile + +From: Udipto Goswami + +[ Upstream commit ebe2b1add1055b903e2acd86b290a85297edc0b3 ] + +Consider a case where ffs_func_eps_disable is called from +ffs_func_disable as part of composition switch and at the +same time ffs_epfile_release get called from userspace. +ffs_epfile_release will free up the read buffer and call +ffs_data_closed which in turn destroys ffs->epfiles and +mark it as NULL. While this was happening the driver has +already initialized the local epfile in ffs_func_eps_disable +which is now freed and waiting to acquire the spinlock. Once +spinlock is acquired the driver proceeds with the stale value +of epfile and tries to free the already freed read buffer +causing use-after-free. + +Following is the illustration of the race: + + CPU1 CPU2 + + ffs_func_eps_disable + epfiles (local copy) + ffs_epfile_release + ffs_data_closed + if (last file closed) + ffs_data_reset + ffs_data_clear + ffs_epfiles_destroy +spin_lock +dereference epfiles + +Fix this races by taking epfiles local copy & assigning it under +spinlock and if epfiles(local) is null then update it in ffs->epfiles +then finally destroy it. +Extending the scope further from the race, protecting the ep related +structures, and concurrent accesses. + +Fixes: a9e6f83c2df1 ("usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable") +Co-developed-by: Udipto Goswami +Reviewed-by: John Keeping +Signed-off-by: Pratham Pratap +Signed-off-by: Udipto Goswami +Link: https://lore.kernel.org/r/1643256595-10797-1-git-send-email-quic_ugoswami@quicinc.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/f_fs.c | 56 ++++++++++++++++++++++-------- + 1 file changed, 42 insertions(+), 14 deletions(-) + +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c +index d8652321e15e9..bb0d92837f677 100644 +--- a/drivers/usb/gadget/function/f_fs.c ++++ b/drivers/usb/gadget/function/f_fs.c +@@ -1710,16 +1710,24 @@ static void ffs_data_put(struct ffs_data *ffs) + + static void ffs_data_closed(struct ffs_data *ffs) + { ++ struct ffs_epfile *epfiles; ++ unsigned long flags; ++ + ENTER(); + + if (atomic_dec_and_test(&ffs->opened)) { + if (ffs->no_disconnect) { + ffs->state = FFS_DEACTIVATED; +- if (ffs->epfiles) { +- ffs_epfiles_destroy(ffs->epfiles, +- ffs->eps_count); +- ffs->epfiles = NULL; +- } ++ spin_lock_irqsave(&ffs->eps_lock, flags); ++ epfiles = ffs->epfiles; ++ ffs->epfiles = NULL; ++ spin_unlock_irqrestore(&ffs->eps_lock, ++ flags); ++ ++ if (epfiles) ++ ffs_epfiles_destroy(epfiles, ++ ffs->eps_count); ++ + if (ffs->setup_state == FFS_SETUP_PENDING) + __ffs_ep0_stall(ffs); + } else { +@@ -1766,14 +1774,27 @@ static struct ffs_data *ffs_data_new(const char *dev_name) + + static void ffs_data_clear(struct ffs_data *ffs) + { ++ struct ffs_epfile *epfiles; ++ unsigned long flags; ++ + ENTER(); + + ffs_closed(ffs); + + BUG_ON(ffs->gadget); + +- if (ffs->epfiles) { +- ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count); ++ spin_lock_irqsave(&ffs->eps_lock, flags); ++ epfiles = ffs->epfiles; ++ ffs->epfiles = NULL; ++ spin_unlock_irqrestore(&ffs->eps_lock, flags); ++ ++ /* ++ * potential race possible between ffs_func_eps_disable ++ * & ffs_epfile_release therefore maintaining a local ++ * copy of epfile will save us from use-after-free. ++ */ ++ if (epfiles) { ++ ffs_epfiles_destroy(epfiles, ffs->eps_count); + ffs->epfiles = NULL; + } + +@@ -1921,12 +1942,15 @@ static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count) + + static void ffs_func_eps_disable(struct ffs_function *func) + { +- struct ffs_ep *ep = func->eps; +- struct ffs_epfile *epfile = func->ffs->epfiles; +- unsigned count = func->ffs->eps_count; ++ struct ffs_ep *ep; ++ struct ffs_epfile *epfile; ++ unsigned short count; + unsigned long flags; + + spin_lock_irqsave(&func->ffs->eps_lock, flags); ++ count = func->ffs->eps_count; ++ epfile = func->ffs->epfiles; ++ ep = func->eps; + while (count--) { + /* pending requests get nuked */ + if (likely(ep->ep)) +@@ -1944,14 +1968,18 @@ static void ffs_func_eps_disable(struct ffs_function *func) + + static int ffs_func_eps_enable(struct ffs_function *func) + { +- struct ffs_data *ffs = func->ffs; +- struct ffs_ep *ep = func->eps; +- struct ffs_epfile *epfile = ffs->epfiles; +- unsigned count = ffs->eps_count; ++ struct ffs_data *ffs; ++ struct ffs_ep *ep; ++ struct ffs_epfile *epfile; ++ unsigned short count; + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&func->ffs->eps_lock, flags); ++ ffs = func->ffs; ++ ep = func->eps; ++ epfile = ffs->epfiles; ++ count = ffs->eps_count; + while(count--) { + ep->ep->driver_data = ep; + +-- +2.34.1 + diff --git a/queue-5.10/veth-fix-races-around-rq-rx_notify_masked.patch b/queue-5.10/veth-fix-races-around-rq-rx_notify_masked.patch new file mode 100644 index 00000000000..6686c45f09d --- /dev/null +++ b/queue-5.10/veth-fix-races-around-rq-rx_notify_masked.patch @@ -0,0 +1,156 @@ +From 49173fb6c449ab3ae920f42d391c6986901421dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Feb 2022 15:28:22 -0800 +Subject: veth: fix races around rq->rx_notify_masked + +From: Eric Dumazet + +[ Upstream commit 68468d8c4cd4222a4ca1f185ab5a1c14480d078c ] + +veth being NETIF_F_LLTX enabled, we need to be more careful +whenever we read/write rq->rx_notify_masked. + +BUG: KCSAN: data-race in veth_xmit / veth_xmit + +write to 0xffff888133d9a9f8 of 1 bytes by task 23552 on cpu 0: + __veth_xdp_flush drivers/net/veth.c:269 [inline] + veth_xmit+0x307/0x470 drivers/net/veth.c:350 + __netdev_start_xmit include/linux/netdevice.h:4683 [inline] + netdev_start_xmit include/linux/netdevice.h:4697 [inline] + xmit_one+0x105/0x2f0 net/core/dev.c:3473 + dev_hard_start_xmit net/core/dev.c:3489 [inline] + __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 + dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 + br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 + NF_HOOK include/linux/netfilter.h:307 [inline] + br_forward_finish net/bridge/br_forward.c:66 [inline] + NF_HOOK include/linux/netfilter.h:307 [inline] + __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 + br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 + br_dev_xmit+0x8b6/0x960 + __netdev_start_xmit include/linux/netdevice.h:4683 [inline] + netdev_start_xmit include/linux/netdevice.h:4697 [inline] + xmit_one+0x105/0x2f0 net/core/dev.c:3473 + dev_hard_start_xmit net/core/dev.c:3489 [inline] + __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 + dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 + neigh_hh_output include/net/neighbour.h:525 [inline] + neigh_output include/net/neighbour.h:539 [inline] + ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 + ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 + NF_HOOK_COND include/linux/netfilter.h:296 [inline] + ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 + dst_output include/net/dst.h:451 [inline] + ip_local_out net/ipv4/ip_output.c:126 [inline] + ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 + udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 + udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 + inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 + sock_sendmsg_nosec net/socket.c:705 [inline] + sock_sendmsg net/socket.c:725 [inline] + ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 + ___sys_sendmsg net/socket.c:2467 [inline] + __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 + __do_sys_sendmmsg net/socket.c:2582 [inline] + __se_sys_sendmmsg net/socket.c:2579 [inline] + __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x44/0xae + +read to 0xffff888133d9a9f8 of 1 bytes by task 23563 on cpu 1: + __veth_xdp_flush drivers/net/veth.c:268 [inline] + veth_xmit+0x2d6/0x470 drivers/net/veth.c:350 + __netdev_start_xmit include/linux/netdevice.h:4683 [inline] + netdev_start_xmit include/linux/netdevice.h:4697 [inline] + xmit_one+0x105/0x2f0 net/core/dev.c:3473 + dev_hard_start_xmit net/core/dev.c:3489 [inline] + __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 + dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 + br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 + NF_HOOK include/linux/netfilter.h:307 [inline] + br_forward_finish net/bridge/br_forward.c:66 [inline] + NF_HOOK include/linux/netfilter.h:307 [inline] + __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 + br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 + br_dev_xmit+0x8b6/0x960 + __netdev_start_xmit include/linux/netdevice.h:4683 [inline] + netdev_start_xmit include/linux/netdevice.h:4697 [inline] + xmit_one+0x105/0x2f0 net/core/dev.c:3473 + dev_hard_start_xmit net/core/dev.c:3489 [inline] + __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 + dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 + neigh_hh_output include/net/neighbour.h:525 [inline] + neigh_output include/net/neighbour.h:539 [inline] + ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 + ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 + NF_HOOK_COND include/linux/netfilter.h:296 [inline] + ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 + dst_output include/net/dst.h:451 [inline] + ip_local_out net/ipv4/ip_output.c:126 [inline] + ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 + udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 + udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 + inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 + sock_sendmsg_nosec net/socket.c:705 [inline] + sock_sendmsg net/socket.c:725 [inline] + ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 + ___sys_sendmsg net/socket.c:2467 [inline] + __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 + __do_sys_sendmmsg net/socket.c:2582 [inline] + __se_sys_sendmmsg net/socket.c:2579 [inline] + __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x44/0xae + +value changed: 0x00 -> 0x01 + +Reported by Kernel Concurrency Sanitizer on: +CPU: 1 PID: 23563 Comm: syz-executor.5 Not tainted 5.17.0-rc2-syzkaller-00064-gc36c04c2e132 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 + +Fixes: 948d4f214fde ("veth: Add driver XDP") +Signed-off-by: Eric Dumazet +Cc: Toshiaki Makita +Reported-by: syzbot +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/veth.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/veth.c b/drivers/net/veth.c +index aef66f8eecee1..f7e3eb309a26e 100644 +--- a/drivers/net/veth.c ++++ b/drivers/net/veth.c +@@ -256,9 +256,10 @@ static void __veth_xdp_flush(struct veth_rq *rq) + { + /* Write ptr_ring before reading rx_notify_masked */ + smp_mb(); +- if (!rq->rx_notify_masked) { +- rq->rx_notify_masked = true; +- napi_schedule(&rq->xdp_napi); ++ if (!READ_ONCE(rq->rx_notify_masked) && ++ napi_schedule_prep(&rq->xdp_napi)) { ++ WRITE_ONCE(rq->rx_notify_masked, true); ++ __napi_schedule(&rq->xdp_napi); + } + } + +@@ -852,8 +853,10 @@ static int veth_poll(struct napi_struct *napi, int budget) + /* Write rx_notify_masked before reading ptr_ring */ + smp_store_mb(rq->rx_notify_masked, false); + if (unlikely(!__ptr_ring_empty(&rq->xdp_ring))) { +- rq->rx_notify_masked = true; +- napi_schedule(&rq->xdp_napi); ++ if (napi_schedule_prep(&rq->xdp_napi)) { ++ WRITE_ONCE(rq->rx_notify_masked, true); ++ __napi_schedule(&rq->xdp_napi); ++ } + } + } + +-- +2.34.1 +