diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.134-135.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.134-135.patch deleted file mode 100644 index 0bbb0aa28f..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.134-135.patch +++ /dev/null @@ -1,2408 +0,0 @@ -diff --git a/Makefile b/Makefile -index 02ea9378161eb..428ebbd039967 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 134 -+SUBLEVEL = 135 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts -index 811c8cae315b5..126965a34841e 100644 ---- a/arch/arm/boot/dts/am437x-gp-evm.dts -+++ b/arch/arm/boot/dts/am437x-gp-evm.dts -@@ -829,11 +829,14 @@ - status = "okay"; - }; - -+&gpio5_target { -+ ti,no-reset-on-init; -+}; -+ - &gpio5 { - pinctrl-names = "default"; - pinctrl-0 = <&display_mux_pins>; - status = "okay"; -- ti,no-reset-on-init; - - p8 { - /* -diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi -index bbe15775fccd5..6c2949991e297 100644 ---- a/arch/arm/boot/dts/am437x-l4.dtsi -+++ b/arch/arm/boot/dts/am437x-l4.dtsi -@@ -2077,7 +2077,7 @@ - }; - }; - -- target-module@22000 { /* 0x48322000, ap 116 64.0 */ -+ gpio5_target: target-module@22000 { /* 0x48322000, ap 116 64.0 */ - compatible = "ti,sysc-omap2", "ti,sysc"; - ti,hwmods = "gpio6"; - reg = <0x22000 0x4>, -diff --git a/arch/arm/boot/dts/am57xx-cl-som-am57x.dts b/arch/arm/boot/dts/am57xx-cl-som-am57x.dts -index 34ca761aeded2..e86d4795e0244 100644 ---- a/arch/arm/boot/dts/am57xx-cl-som-am57x.dts -+++ b/arch/arm/boot/dts/am57xx-cl-som-am57x.dts -@@ -611,12 +611,11 @@ - >; - }; - --&gpio3 { -- status = "okay"; -+&gpio3_target { - ti,no-reset-on-init; - }; - --&gpio2 { -+&gpio2_target { - status = "okay"; - ti,no-reset-on-init; - }; -diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi -index 1bc45cfd54538..9ca7b4241c972 100644 ---- a/arch/arm/boot/dts/bcm-cygnus.dtsi -+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi -@@ -460,7 +460,7 @@ - status = "disabled"; - }; - -- nand: nand@18046000 { -+ nand_controller: nand-controller@18046000 { - compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1"; - reg = <0x18046000 0x600>, <0xf8105408 0x600>, - <0x18046f00 0x20>; -diff --git a/arch/arm/boot/dts/bcm-hr2.dtsi b/arch/arm/boot/dts/bcm-hr2.dtsi -index dd71ab08136be..30574101471a5 100644 ---- a/arch/arm/boot/dts/bcm-hr2.dtsi -+++ b/arch/arm/boot/dts/bcm-hr2.dtsi -@@ -179,7 +179,7 @@ - status = "disabled"; - }; - -- nand: nand@26000 { -+ nand_controller: nand-controller@26000 { - compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1"; - reg = <0x26000 0x600>, - <0x11b408 0x600>, -diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi -index 8615d89fa4690..43ff85d31dc12 100644 ---- a/arch/arm/boot/dts/bcm-nsp.dtsi -+++ b/arch/arm/boot/dts/bcm-nsp.dtsi -@@ -267,7 +267,7 @@ - dma-coherent; - }; - -- nand: nand@26000 { -+ nand_controller: nand-controller@26000 { - compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1"; - reg = <0x026000 0x600>, - <0x11b408 0x600>, -diff --git a/arch/arm/boot/dts/bcm63138.dtsi b/arch/arm/boot/dts/bcm63138.dtsi -index 9c0325cf9e22e..cca49a2e2d623 100644 ---- a/arch/arm/boot/dts/bcm63138.dtsi -+++ b/arch/arm/boot/dts/bcm63138.dtsi -@@ -203,7 +203,7 @@ - status = "disabled"; - }; - -- nand: nand@2000 { -+ nand_controller: nand-controller@2000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.0", "brcm,brcmnand"; -diff --git a/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts -index 8313b7cad5427..f92d2cf859726 100644 ---- a/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts -+++ b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts -@@ -14,10 +14,10 @@ - }; - }; - --&nand { -+&nand_controller { - status = "okay"; - -- nandcs@1 { -+ nand@1 { - compatible = "brcm,nandcs"; - reg = <1>; - nand-ecc-step-size = <512>; -diff --git a/arch/arm/boot/dts/bcm7445.dtsi b/arch/arm/boot/dts/bcm7445.dtsi -index 58f67c9b830b8..5ac2042515b8f 100644 ---- a/arch/arm/boot/dts/bcm7445.dtsi -+++ b/arch/arm/boot/dts/bcm7445.dtsi -@@ -148,7 +148,7 @@ - reg-names = "aon-ctrl", "aon-sram"; - }; - -- nand: nand@3e2800 { -+ nand_controller: nand-controller@3e2800 { - status = "disabled"; - #address-cells = <1>; - #size-cells = <0>; -diff --git a/arch/arm/boot/dts/bcm911360_entphn.dts b/arch/arm/boot/dts/bcm911360_entphn.dts -index b2d323f4a5aba..a76c74b44bbaf 100644 ---- a/arch/arm/boot/dts/bcm911360_entphn.dts -+++ b/arch/arm/boot/dts/bcm911360_entphn.dts -@@ -82,8 +82,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@1 { -+&nand_controller { -+ nand@1 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958300k.dts b/arch/arm/boot/dts/bcm958300k.dts -index b4a1392bd5a6c..dda3e11b711f6 100644 ---- a/arch/arm/boot/dts/bcm958300k.dts -+++ b/arch/arm/boot/dts/bcm958300k.dts -@@ -60,8 +60,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@1 { -+&nand_controller { -+ nand@1 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958305k.dts b/arch/arm/boot/dts/bcm958305k.dts -index 3378683321d3c..ea3c6b88b313b 100644 ---- a/arch/arm/boot/dts/bcm958305k.dts -+++ b/arch/arm/boot/dts/bcm958305k.dts -@@ -68,8 +68,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@1 { -+&nand_controller { -+ nand@1 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958522er.dts b/arch/arm/boot/dts/bcm958522er.dts -index 8c388eb8a08f8..e9b2d3b37ca45 100644 ---- a/arch/arm/boot/dts/bcm958522er.dts -+++ b/arch/arm/boot/dts/bcm958522er.dts -@@ -70,8 +70,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958525er.dts b/arch/arm/boot/dts/bcm958525er.dts -index c339771bb22e0..dfe145a3d05a2 100644 ---- a/arch/arm/boot/dts/bcm958525er.dts -+++ b/arch/arm/boot/dts/bcm958525er.dts -@@ -70,8 +70,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958525xmc.dts b/arch/arm/boot/dts/bcm958525xmc.dts -index 1c72ec8288de4..17e6a683e678a 100644 ---- a/arch/arm/boot/dts/bcm958525xmc.dts -+++ b/arch/arm/boot/dts/bcm958525xmc.dts -@@ -86,8 +86,8 @@ - }; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958622hr.dts b/arch/arm/boot/dts/bcm958622hr.dts -index 96a021cebd97b..1d1bc8dbb3425 100644 ---- a/arch/arm/boot/dts/bcm958622hr.dts -+++ b/arch/arm/boot/dts/bcm958622hr.dts -@@ -74,8 +74,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958623hr.dts b/arch/arm/boot/dts/bcm958623hr.dts -index b2c7f21d471e6..d5d9a273bb6d1 100644 ---- a/arch/arm/boot/dts/bcm958623hr.dts -+++ b/arch/arm/boot/dts/bcm958623hr.dts -@@ -74,8 +74,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958625hr.dts b/arch/arm/boot/dts/bcm958625hr.dts -index a2c9de35ddfbd..670363bca9173 100644 ---- a/arch/arm/boot/dts/bcm958625hr.dts -+++ b/arch/arm/boot/dts/bcm958625hr.dts -@@ -90,8 +90,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm958625k.dts b/arch/arm/boot/dts/bcm958625k.dts -index 3fcca12d83c2d..f15cd38c849e4 100644 ---- a/arch/arm/boot/dts/bcm958625k.dts -+++ b/arch/arm/boot/dts/bcm958625k.dts -@@ -64,8 +64,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/bcm963138dvt.dts b/arch/arm/boot/dts/bcm963138dvt.dts -index 5b177274f1826..df5c8ab906273 100644 ---- a/arch/arm/boot/dts/bcm963138dvt.dts -+++ b/arch/arm/boot/dts/bcm963138dvt.dts -@@ -31,10 +31,10 @@ - status = "okay"; - }; - --&nand { -+&nand_controller { - status = "okay"; - -- nandcs@0 { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-ecc-strength = <4>; -diff --git a/arch/arm/boot/dts/bcm988312hr.dts b/arch/arm/boot/dts/bcm988312hr.dts -index edd0f630e0251..16b212cc8a2a0 100644 ---- a/arch/arm/boot/dts/bcm988312hr.dts -+++ b/arch/arm/boot/dts/bcm988312hr.dts -@@ -74,8 +74,8 @@ - status = "okay"; - }; - --&nand { -- nandcs@0 { -+&nand_controller { -+ nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-on-flash-bbt; -diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi -index bc702579488b9..3f845a8531f40 100644 ---- a/arch/arm/boot/dts/dra7-l4.dtsi -+++ b/arch/arm/boot/dts/dra7-l4.dtsi -@@ -1326,7 +1326,7 @@ - }; - }; - -- target-module@55000 { /* 0x48055000, ap 13 0e.0 */ -+ gpio2_target: target-module@55000 { /* 0x48055000, ap 13 0e.0 */ - compatible = "ti,sysc-omap2", "ti,sysc"; - reg = <0x55000 0x4>, - <0x55010 0x4>, -@@ -1359,7 +1359,7 @@ - }; - }; - -- target-module@57000 { /* 0x48057000, ap 15 06.0 */ -+ gpio3_target: target-module@57000 { /* 0x48057000, ap 15 06.0 */ - compatible = "ti,sysc-omap2", "ti,sysc"; - reg = <0x57000 0x4>, - <0x57010 0x4>, -diff --git a/arch/arm/boot/dts/gemini-dlink-dns-313.dts b/arch/arm/boot/dts/gemini-dlink-dns-313.dts -index 360642a02a488..d0bbf2b970dfc 100644 ---- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts -+++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts -@@ -140,7 +140,7 @@ - }; - }; - -- mdio0: ethernet-phy { -+ mdio0: mdio { - compatible = "virtual,mdio-gpio"; - /* Uses MDC and MDIO */ - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */ -diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemini-nas4220b.dts -index 521714f38eeda..e1020e07e1366 100644 ---- a/arch/arm/boot/dts/gemini-nas4220b.dts -+++ b/arch/arm/boot/dts/gemini-nas4220b.dts -@@ -62,7 +62,7 @@ - }; - }; - -- mdio0: ethernet-phy { -+ mdio0: mdio { - compatible = "virtual,mdio-gpio"; - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */ - <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */ -diff --git a/arch/arm/boot/dts/gemini-rut1xx.dts b/arch/arm/boot/dts/gemini-rut1xx.dts -index 08091d2a64e15..0ebda4efd9d0f 100644 ---- a/arch/arm/boot/dts/gemini-rut1xx.dts -+++ b/arch/arm/boot/dts/gemini-rut1xx.dts -@@ -56,7 +56,7 @@ - }; - }; - -- mdio0: ethernet-phy { -+ mdio0: mdio { - compatible = "virtual,mdio-gpio"; - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */ - <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */ -diff --git a/arch/arm/boot/dts/gemini-wbd111.dts b/arch/arm/boot/dts/gemini-wbd111.dts -index 3a2761dd460f9..5602ba8f30f2f 100644 ---- a/arch/arm/boot/dts/gemini-wbd111.dts -+++ b/arch/arm/boot/dts/gemini-wbd111.dts -@@ -68,7 +68,7 @@ - }; - }; - -- mdio0: ethernet-phy { -+ mdio0: mdio { - compatible = "virtual,mdio-gpio"; - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */ - <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */ -diff --git a/arch/arm/boot/dts/gemini-wbd222.dts b/arch/arm/boot/dts/gemini-wbd222.dts -index 52b4dbc0c0723..a4a260c36d752 100644 ---- a/arch/arm/boot/dts/gemini-wbd222.dts -+++ b/arch/arm/boot/dts/gemini-wbd222.dts -@@ -67,7 +67,7 @@ - }; - }; - -- mdio0: ethernet-phy { -+ mdio0: mdio { - compatible = "virtual,mdio-gpio"; - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */ - <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */ -diff --git a/arch/arm/boot/dts/gemini.dtsi b/arch/arm/boot/dts/gemini.dtsi -index 8cf67b11751f7..ef4f1c5323bd7 100644 ---- a/arch/arm/boot/dts/gemini.dtsi -+++ b/arch/arm/boot/dts/gemini.dtsi -@@ -286,6 +286,7 @@ - clock-names = "PCLK", "PCICLK"; - pinctrl-names = "default"; - pinctrl-0 = <&pci_default_pins>; -+ device_type = "pci"; - #address-cells = <3>; - #size-cells = <2>; - #interrupt-cells = <1>; -diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -index 6678b97b10076..3617089dbe36d 100644 ---- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -@@ -315,8 +315,8 @@ - fsl,pins = < - MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1 - MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1 -- MX6QDL_PAD_EIM_D30__UART3_RTS_B 0x1b0b1 -- MX6QDL_PAD_EIM_D31__UART3_CTS_B 0x1b0b1 -+ MX6QDL_PAD_EIM_D31__UART3_RTS_B 0x1b0b1 -+ MX6QDL_PAD_EIM_D30__UART3_CTS_B 0x1b0b1 - >; - }; - -@@ -403,6 +403,7 @@ - &uart3 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_uart3>; -+ uart-has-rtscts; - status = "disabled"; - }; - -diff --git a/arch/arm/boot/dts/rk3036-kylin.dts b/arch/arm/boot/dts/rk3036-kylin.dts -index fb3cf005cc902..2ef47ebeb0cbe 100644 ---- a/arch/arm/boot/dts/rk3036-kylin.dts -+++ b/arch/arm/boot/dts/rk3036-kylin.dts -@@ -390,7 +390,7 @@ - }; - }; - -- sleep { -+ suspend { - global_pwroff: global-pwroff { - rockchip,pins = <2 RK_PA7 1 &pcfg_pull_none>; - }; -diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi -index 3d1b02f45ffd6..1ac9deb3bd39a 100644 ---- a/arch/arm/boot/dts/rk3066a.dtsi -+++ b/arch/arm/boot/dts/rk3066a.dtsi -@@ -761,7 +761,7 @@ - #address-cells = <1>; - #size-cells = <0>; - -- pd_vio@RK3066_PD_VIO { -+ power-domain@RK3066_PD_VIO { - reg = ; - clocks = <&cru ACLK_LCDC0>, - <&cru ACLK_LCDC1>, -@@ -788,7 +788,7 @@ - <&qos_rga>; - }; - -- pd_video@RK3066_PD_VIDEO { -+ power-domain@RK3066_PD_VIDEO { - reg = ; - clocks = <&cru ACLK_VDPU>, - <&cru ACLK_VEPU>, -@@ -797,7 +797,7 @@ - pm_qos = <&qos_vpu>; - }; - -- pd_gpu@RK3066_PD_GPU { -+ power-domain@RK3066_PD_GPU { - reg = ; - clocks = <&cru ACLK_GPU>; - pm_qos = <&qos_gpu>; -diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi -index 10ede65d90f38..ee8a24a0e3cb1 100644 ---- a/arch/arm/boot/dts/rk3188.dtsi -+++ b/arch/arm/boot/dts/rk3188.dtsi -@@ -150,16 +150,16 @@ - compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer"; - reg = <0x2000e000 0x20>; - interrupts = ; -- clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>; -- clock-names = "timer", "pclk"; -+ clocks = <&cru PCLK_TIMER3>, <&cru SCLK_TIMER3>; -+ clock-names = "pclk", "timer"; - }; - - timer6: timer@200380a0 { - compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer"; - reg = <0x200380a0 0x20>; - interrupts = ; -- clocks = <&cru SCLK_TIMER6>, <&cru PCLK_TIMER0>; -- clock-names = "timer", "pclk"; -+ clocks = <&cru PCLK_TIMER0>, <&cru SCLK_TIMER6>; -+ clock-names = "pclk", "timer"; - }; - - i2s0: i2s@1011a000 { -@@ -701,7 +701,7 @@ - #address-cells = <1>; - #size-cells = <0>; - -- pd_vio@RK3188_PD_VIO { -+ power-domain@RK3188_PD_VIO { - reg = ; - clocks = <&cru ACLK_LCDC0>, - <&cru ACLK_LCDC1>, -@@ -723,7 +723,7 @@ - <&qos_rga>; - }; - -- pd_video@RK3188_PD_VIDEO { -+ power-domain@RK3188_PD_VIDEO { - reg = ; - clocks = <&cru ACLK_VDPU>, - <&cru ACLK_VEPU>, -@@ -732,7 +732,7 @@ - pm_qos = <&qos_vpu>; - }; - -- pd_gpu@RK3188_PD_GPU { -+ power-domain@RK3188_PD_GPU { - reg = ; - clocks = <&cru ACLK_GPU>; - pm_qos = <&qos_gpu>; -diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi -index 6bb78b19c5554..140e22d74dcfb 100644 ---- a/arch/arm/boot/dts/rk322x.dtsi -+++ b/arch/arm/boot/dts/rk322x.dtsi -@@ -570,10 +570,9 @@ - compatible = "rockchip,iommu"; - reg = <0x20020800 0x100>; - interrupts = ; -- interrupt-names = "vpu_mmu"; - clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; - clock-names = "aclk", "iface"; -- iommu-cells = <0>; -+ #iommu-cells = <0>; - status = "disabled"; - }; - -@@ -581,10 +580,9 @@ - compatible = "rockchip,iommu"; - reg = <0x20030480 0x40>, <0x200304c0 0x40>; - interrupts = ; -- interrupt-names = "vdec_mmu"; - clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>; - clock-names = "aclk", "iface"; -- iommu-cells = <0>; -+ #iommu-cells = <0>; - status = "disabled"; - }; - -@@ -614,7 +612,6 @@ - compatible = "rockchip,iommu"; - reg = <0x20053f00 0x100>; - interrupts = ; -- interrupt-names = "vop_mmu"; - clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>; - clock-names = "aclk", "iface"; - #iommu-cells = <0>; -@@ -625,10 +622,9 @@ - compatible = "rockchip,iommu"; - reg = <0x20070800 0x100>; - interrupts = ; -- interrupt-names = "iep_mmu"; - clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; - clock-names = "aclk", "iface"; -- iommu-cells = <0>; -+ #iommu-cells = <0>; - status = "disabled"; - }; - -diff --git a/arch/arm/boot/dts/rk3288-rock2-som.dtsi b/arch/arm/boot/dts/rk3288-rock2-som.dtsi -index 9f9e2bfd1295e..7b79a21f9bbb2 100644 ---- a/arch/arm/boot/dts/rk3288-rock2-som.dtsi -+++ b/arch/arm/boot/dts/rk3288-rock2-som.dtsi -@@ -218,7 +218,7 @@ - flash0-supply = <&vcc_flash>; - flash1-supply = <&vccio_pmu>; - gpio30-supply = <&vccio_pmu>; -- gpio1830 = <&vcc_io>; -+ gpio1830-supply = <&vcc_io>; - lcdc-supply = <&vcc_io>; - sdcard-supply = <&vccio_sd>; - wifi-supply = <&vcc_18>; -diff --git a/arch/arm/boot/dts/rk3288-vyasa.dts b/arch/arm/boot/dts/rk3288-vyasa.dts -index ba06e9f97ddce..acfb7dc2df560 100644 ---- a/arch/arm/boot/dts/rk3288-vyasa.dts -+++ b/arch/arm/boot/dts/rk3288-vyasa.dts -@@ -357,10 +357,10 @@ - audio-supply = <&vcc_18>; - bb-supply = <&vcc_io>; - dvp-supply = <&vcc_io>; -- flash0-suuply = <&vcc_18>; -+ flash0-supply = <&vcc_18>; - flash1-supply = <&vcc_lan>; - gpio30-supply = <&vcc_io>; -- gpio1830 = <&vcc_io>; -+ gpio1830-supply = <&vcc_io>; - lcdc-supply = <&vcc_io>; - sdcard-supply = <&vccio_sd>; - wifi-supply = <&vcc_18>; -diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index cc893e154fe5a..658ceb96d8bd1 100644 ---- a/arch/arm/boot/dts/rk3288.dtsi -+++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -238,8 +238,8 @@ - compatible = "rockchip,rk3288-timer"; - reg = <0x0 0xff810000 0x0 0x20>; - interrupts = ; -- clocks = <&xin24m>, <&cru PCLK_TIMER>; -- clock-names = "timer", "pclk"; -+ clocks = <&cru PCLK_TIMER>, <&xin24m>; -+ clock-names = "pclk", "timer"; - }; - - display-subsystem { -@@ -771,7 +771,7 @@ - * *_HDMI HDMI - * *_MIPI_* MIPI - */ -- pd_vio@RK3288_PD_VIO { -+ power-domain@RK3288_PD_VIO { - reg = ; - clocks = <&cru ACLK_IEP>, - <&cru ACLK_ISP>, -@@ -813,7 +813,7 @@ - * Note: The following 3 are HEVC(H.265) clocks, - * and on the ACLK_HEVC_NIU (NOC). - */ -- pd_hevc@RK3288_PD_HEVC { -+ power-domain@RK3288_PD_HEVC { - reg = ; - clocks = <&cru ACLK_HEVC>, - <&cru SCLK_HEVC_CABAC>, -@@ -827,7 +827,7 @@ - * (video endecoder & decoder) clocks that on the - * ACLK_VCODEC_NIU and HCLK_VCODEC_NIU (NOC). - */ -- pd_video@RK3288_PD_VIDEO { -+ power-domain@RK3288_PD_VIDEO { - reg = ; - clocks = <&cru ACLK_VCODEC>, - <&cru HCLK_VCODEC>; -@@ -838,7 +838,7 @@ - * Note: ACLK_GPU is the GPU clock, - * and on the ACLK_GPU_NIU (NOC). - */ -- pd_gpu@RK3288_PD_GPU { -+ power-domain@RK3288_PD_GPU { - reg = ; - clocks = <&cru ACLK_GPU>; - pm_qos = <&qos_gpu_r>, -@@ -1575,7 +1575,7 @@ - drive-strength = <12>; - }; - -- sleep { -+ suspend { - global_pwroff: global-pwroff { - rockchip,pins = <0 RK_PA0 1 &pcfg_pull_none>; - }; -diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts -index ba08624c6237d..4f45e71a1e4d3 100644 ---- a/arch/arm/boot/dts/stm32429i-eval.dts -+++ b/arch/arm/boot/dts/stm32429i-eval.dts -@@ -112,17 +112,15 @@ - }; - }; - -- gpio_keys { -+ gpio-keys { - compatible = "gpio-keys"; -- #address-cells = <1>; -- #size-cells = <0>; - autorepeat; -- button@0 { -+ button-0 { - label = "Wake up"; - linux,code = ; - gpios = <&gpioa 0 0>; - }; -- button@1 { -+ button-1 { - label = "Tamper"; - linux,code = ; - gpios = <&gpioc 13 0>; -diff --git a/arch/arm/boot/dts/stm32746g-eval.dts b/arch/arm/boot/dts/stm32746g-eval.dts -index 2b1664884ae7b..8d64b52838c06 100644 ---- a/arch/arm/boot/dts/stm32746g-eval.dts -+++ b/arch/arm/boot/dts/stm32746g-eval.dts -@@ -81,12 +81,10 @@ - }; - }; - -- gpio_keys { -+ gpio-keys { - compatible = "gpio-keys"; -- #address-cells = <1>; -- #size-cells = <0>; - autorepeat; -- button@0 { -+ button-0 { - label = "Wake up"; - linux,code = ; - gpios = <&gpioc 13 0>; -diff --git a/arch/arm/boot/dts/stm32f429-disco.dts b/arch/arm/boot/dts/stm32f429-disco.dts -index e19d0fe7dbdac..49ae2d72afc95 100644 ---- a/arch/arm/boot/dts/stm32f429-disco.dts -+++ b/arch/arm/boot/dts/stm32f429-disco.dts -@@ -79,12 +79,10 @@ - }; - }; - -- gpio_keys { -+ gpio-keys { - compatible = "gpio-keys"; -- #address-cells = <1>; -- #size-cells = <0>; - autorepeat; -- button@0 { -+ button-0 { - label = "User"; - linux,code = ; - gpios = <&gpioa 0 0>; -diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi -index 5c8a826b31958..dd41342ef0175 100644 ---- a/arch/arm/boot/dts/stm32f429.dtsi -+++ b/arch/arm/boot/dts/stm32f429.dtsi -@@ -283,8 +283,6 @@ - }; - - timers13: timers@40001c00 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40001C00 0x400>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM13)>; -@@ -299,8 +297,6 @@ - }; - - timers14: timers@40002000 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40002000 0x400>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM14)>; -@@ -623,8 +619,6 @@ - }; - - timers10: timers@40014400 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40014400 0x400>; - clocks = <&rcc 0 STM32F4_APB2_CLOCK(TIM10)>; -@@ -639,8 +633,6 @@ - }; - - timers11: timers@40014800 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40014800 0x400>; - clocks = <&rcc 0 STM32F4_APB2_CLOCK(TIM11)>; -@@ -696,7 +688,7 @@ - status = "disabled"; - }; - -- rcc: rcc@40023810 { -+ rcc: rcc@40023800 { - #reset-cells = <1>; - #clock-cells = <2>; - compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; -diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts -index c6dc6d1a051b0..0ce450123dda6 100644 ---- a/arch/arm/boot/dts/stm32f469-disco.dts -+++ b/arch/arm/boot/dts/stm32f469-disco.dts -@@ -104,12 +104,10 @@ - }; - }; - -- gpio_keys { -+ gpio-keys { - compatible = "gpio-keys"; -- #address-cells = <1>; -- #size-cells = <0>; - autorepeat; -- button@0 { -+ button-0 { - label = "User"; - linux,code = ; - gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>; -diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi -index d26f93f8b9c2a..60680fcf8eb3d 100644 ---- a/arch/arm/boot/dts/stm32f746.dtsi -+++ b/arch/arm/boot/dts/stm32f746.dtsi -@@ -265,8 +265,6 @@ - }; - - timers13: timers@40001c00 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40001C00 0x400>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM13)>; -@@ -281,8 +279,6 @@ - }; - - timers14: timers@40002000 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40002000 0x400>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM14)>; -@@ -366,9 +362,9 @@ - status = "disabled"; - }; - -- i2c3: i2c@40005C00 { -+ i2c3: i2c@40005c00 { - compatible = "st,stm32f7-i2c"; -- reg = <0x40005C00 0x400>; -+ reg = <0x40005c00 0x400>; - interrupts = <72>, - <73>; - resets = <&rcc STM32F7_APB1_RESET(I2C3)>; -@@ -533,8 +529,6 @@ - }; - - timers10: timers@40014400 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40014400 0x400>; - clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM10)>; -@@ -549,8 +543,6 @@ - }; - - timers11: timers@40014800 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-timers"; - reg = <0x40014800 0x400>; - clocks = <&rcc 0 STM32F7_APB2_CLOCK(TIM11)>; -diff --git a/arch/arm/boot/dts/stm32f769-disco.dts b/arch/arm/boot/dts/stm32f769-disco.dts -index 6f1d0ac8c31c7..a4284b761e7fe 100644 ---- a/arch/arm/boot/dts/stm32f769-disco.dts -+++ b/arch/arm/boot/dts/stm32f769-disco.dts -@@ -75,12 +75,10 @@ - }; - }; - -- gpio_keys { -+ gpio-keys { - compatible = "gpio-keys"; -- #address-cells = <1>; -- #size-cells = <0>; - autorepeat; -- button@0 { -+ button-0 { - label = "User"; - linux,code = ; - gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>; -diff --git a/arch/arm/boot/dts/stm32h743.dtsi b/arch/arm/boot/dts/stm32h743.dtsi -index c065266ee3776..82a234c64b8b9 100644 ---- a/arch/arm/boot/dts/stm32h743.dtsi -+++ b/arch/arm/boot/dts/stm32h743.dtsi -@@ -438,8 +438,6 @@ - }; - - lptimer4: timer@58002c00 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-lptimer"; - reg = <0x58002c00 0x400>; - clocks = <&rcc LPTIM4_CK>; -@@ -454,8 +452,6 @@ - }; - - lptimer5: timer@58003000 { -- #address-cells = <1>; -- #size-cells = <0>; - compatible = "st,stm32-lptimer"; - reg = <0x58003000 0x400>; - clocks = <&rcc LPTIM5_CK>; -diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi -index f98e0370c0bce..eca469a64a977 100644 ---- a/arch/arm/boot/dts/stm32mp157c.dtsi -+++ b/arch/arm/boot/dts/stm32mp157c.dtsi -@@ -1311,12 +1311,6 @@ - status = "disabled"; - }; - -- stmmac_axi_config_0: stmmac-axi-config { -- snps,wr_osr_lmt = <0x7>; -- snps,rd_osr_lmt = <0x7>; -- snps,blen = <0 0 0 0 16 8 4>; -- }; -- - ethernet0: ethernet@5800a000 { - compatible = "st,stm32mp1-dwmac", "snps,dwmac-4.20a"; - reg = <0x5800a000 0x2000>; -@@ -1339,6 +1333,12 @@ - snps,axi-config = <&stmmac_axi_config_0>; - snps,tso; - status = "disabled"; -+ -+ stmmac_axi_config_0: stmmac-axi-config { -+ snps,wr_osr_lmt = <0x7>; -+ snps,rd_osr_lmt = <0x7>; -+ snps,blen = <0 0 0 0 16 8 4>; -+ }; - }; - - usbh_ohci: usbh-ohci@5800c000 { -diff --git a/arch/arm/mach-imx/suspend-imx53.S b/arch/arm/mach-imx/suspend-imx53.S -index 41b8aad653634..46570ec2fbcfe 100644 ---- a/arch/arm/mach-imx/suspend-imx53.S -+++ b/arch/arm/mach-imx/suspend-imx53.S -@@ -28,11 +28,11 @@ - * ^ - * ^ - * imx53_suspend code -- * PM_INFO structure(imx53_suspend_info) -+ * PM_INFO structure(imx5_cpu_suspend_info) - * ======================== low address ======================= - */ - --/* Offsets of members of struct imx53_suspend_info */ -+/* Offsets of members of struct imx5_cpu_suspend_info */ - #define SUSPEND_INFO_MX53_M4IF_V_OFFSET 0x0 - #define SUSPEND_INFO_MX53_IOMUXC_V_OFFSET 0x4 - #define SUSPEND_INFO_MX53_IO_COUNT_OFFSET 0x8 -diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi -index c47f76b01c4b5..65bcdd0fe78ad 100644 ---- a/arch/arm64/boot/dts/arm/juno-base.dtsi -+++ b/arch/arm64/boot/dts/arm/juno-base.dtsi -@@ -537,13 +537,13 @@ - clocks { - compatible = "arm,scpi-clocks"; - -- scpi_dvfs: scpi-dvfs { -+ scpi_dvfs: clocks-0 { - compatible = "arm,scpi-dvfs-clocks"; - #clock-cells = <1>; - clock-indices = <0>, <1>, <2>; - clock-output-names = "atlclk", "aplclk","gpuclk"; - }; -- scpi_clk: scpi-clk { -+ scpi_clk: clocks-1 { - compatible = "arm,scpi-variable-clocks"; - #clock-cells = <1>; - clock-indices = <3>; -@@ -551,7 +551,7 @@ - }; - }; - -- scpi_devpd: scpi-power-domains { -+ scpi_devpd: power-controller { - compatible = "arm,scpi-power-domains"; - num-domains = <2>; - #power-domain-cells = <1>; -diff --git a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi -index 7a0be8eaa84a2..cdb2fa47637da 100644 ---- a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi -+++ b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi -@@ -501,7 +501,6 @@ - clocks = <&clockgen 4 3>; - clock-names = "dspi"; - spi-num-chipselects = <5>; -- bus-num = <0>; - }; - - esdhc: esdhc@2140000 { -diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi -index f1011bcd5ed5a..3dae8d7c76198 100644 ---- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi -+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi -@@ -1056,6 +1056,14 @@ - <&src IMX8MQ_RESET_PCIE_CTRL_APPS_EN>, - <&src IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF>; - reset-names = "pciephy", "apps", "turnoff"; -+ assigned-clocks = <&clk IMX8MQ_CLK_PCIE1_CTRL>, -+ <&clk IMX8MQ_CLK_PCIE1_PHY>, -+ <&clk IMX8MQ_CLK_PCIE1_AUX>; -+ assigned-clock-parents = <&clk IMX8MQ_SYS2_PLL_250M>, -+ <&clk IMX8MQ_SYS2_PLL_100M>, -+ <&clk IMX8MQ_SYS1_PLL_80M>; -+ assigned-clock-rates = <250000000>, <100000000>, -+ <10000000>; - status = "disabled"; - }; - -@@ -1085,6 +1093,14 @@ - <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_EN>, - <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF>; - reset-names = "pciephy", "apps", "turnoff"; -+ assigned-clocks = <&clk IMX8MQ_CLK_PCIE2_CTRL>, -+ <&clk IMX8MQ_CLK_PCIE2_PHY>, -+ <&clk IMX8MQ_CLK_PCIE2_AUX>; -+ assigned-clock-parents = <&clk IMX8MQ_SYS2_PLL_250M>, -+ <&clk IMX8MQ_SYS2_PLL_100M>, -+ <&clk IMX8MQ_SYS1_PLL_80M>; -+ assigned-clock-rates = <250000000>, <100000000>, -+ <10000000>; - status = "disabled"; - }; - -diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -index fad70c2df7bc0..874bc3954c8e6 100644 ---- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -+++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -@@ -106,6 +106,12 @@ - /* enabled by U-Boot if SFP module is present */ - status = "disabled"; - }; -+ -+ firmware { -+ armada-3700-rwtm { -+ compatible = "marvell,armada-3700-rwtm-firmware", "cznic,turris-mox-rwtm"; -+ }; -+ }; - }; - - &i2c0 { -diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi -index 6cb1278613c5e..52767037e0494 100644 ---- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi -+++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi -@@ -500,4 +500,12 @@ - }; - }; - }; -+ -+ firmware { -+ armada-3700-rwtm { -+ compatible = "marvell,armada-3700-rwtm-firmware"; -+ mboxes = <&rwtm 0>; -+ status = "okay"; -+ }; -+ }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi b/arch/arm64/boot/dts/rockchip/px30.dtsi -index 98b014a8f9165..f297601c9f715 100644 ---- a/arch/arm64/boot/dts/rockchip/px30.dtsi -+++ b/arch/arm64/boot/dts/rockchip/px30.dtsi -@@ -213,20 +213,20 @@ - #size-cells = <0>; - - /* These power domains are grouped by VD_LOGIC */ -- pd_usb@PX30_PD_USB { -+ power-domain@PX30_PD_USB { - reg = ; - clocks = <&cru HCLK_HOST>, - <&cru HCLK_OTG>, - <&cru SCLK_OTG_ADP>; - pm_qos = <&qos_usb_host>, <&qos_usb_otg>; - }; -- pd_sdcard@PX30_PD_SDCARD { -+ power-domain@PX30_PD_SDCARD { - reg = ; - clocks = <&cru HCLK_SDMMC>, - <&cru SCLK_SDMMC>; - pm_qos = <&qos_sdmmc>; - }; -- pd_gmac@PX30_PD_GMAC { -+ power-domain@PX30_PD_GMAC { - reg = ; - clocks = <&cru ACLK_GMAC>, - <&cru PCLK_GMAC>, -@@ -234,7 +234,7 @@ - <&cru SCLK_GMAC_RX_TX>; - pm_qos = <&qos_gmac>; - }; -- pd_mmc_nand@PX30_PD_MMC_NAND { -+ power-domain@PX30_PD_MMC_NAND { - reg = ; - clocks = <&cru HCLK_NANDC>, - <&cru HCLK_EMMC>, -@@ -247,14 +247,14 @@ - pm_qos = <&qos_emmc>, <&qos_nand>, - <&qos_sdio>, <&qos_sfc>; - }; -- pd_vpu@PX30_PD_VPU { -+ power-domain@PX30_PD_VPU { - reg = ; - clocks = <&cru ACLK_VPU>, - <&cru HCLK_VPU>, - <&cru SCLK_CORE_VPU>; - pm_qos = <&qos_vpu>, <&qos_vpu_r128>; - }; -- pd_vo@PX30_PD_VO { -+ power-domain@PX30_PD_VO { - reg = ; - clocks = <&cru ACLK_RGA>, - <&cru ACLK_VOPB>, -@@ -270,7 +270,7 @@ - pm_qos = <&qos_rga_rd>, <&qos_rga_wr>, - <&qos_vop_m0>, <&qos_vop_m1>; - }; -- pd_vi@PX30_PD_VI { -+ power-domain@PX30_PD_VI { - reg = ; - clocks = <&cru ACLK_CIF>, - <&cru ACLK_ISP>, -@@ -281,7 +281,7 @@ - <&qos_isp_wr>, <&qos_isp_m1>, - <&qos_vip>; - }; -- pd_gpu@PX30_PD_GPU { -+ power-domain@PX30_PD_GPU { - reg = ; - clocks = <&cru SCLK_GPU>; - pm_qos = <&qos_gpu>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index e0ed323935a4d..44ad744c4710d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -270,13 +270,13 @@ - #address-cells = <1>; - #size-cells = <0>; - -- pd_hevc@RK3328_PD_HEVC { -+ power-domain@RK3328_PD_HEVC { - reg = ; - }; -- pd_video@RK3328_PD_VIDEO { -+ power-domain@RK3328_PD_VIDEO { - reg = ; - }; -- pd_vpu@RK3328_PD_VPU { -+ power-domain@RK3328_PD_VPU { - reg = ; - clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index 9d6ed8cda2c86..750dad0d17400 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -2317,7 +2317,7 @@ - }; - }; - -- sleep { -+ suspend { - ap_pwroff: ap-pwroff { - rockchip,pins = <1 RK_PA5 1 &pcfg_pull_none>; - }; -diff --git a/arch/s390/include/asm/stacktrace.h b/arch/s390/include/asm/stacktrace.h -index 6836532f8d1a6..e192681f83e10 100644 ---- a/arch/s390/include/asm/stacktrace.h -+++ b/arch/s390/include/asm/stacktrace.h -@@ -115,6 +115,103 @@ struct stack_frame { - r2; \ - }) - -+#define CALL_LARGS_0(...) \ -+ long dummy = 0 -+#define CALL_LARGS_1(t1, a1) \ -+ long arg1 = (long)(t1)(a1) -+#define CALL_LARGS_2(t1, a1, t2, a2) \ -+ CALL_LARGS_1(t1, a1); \ -+ long arg2 = (long)(t2)(a2) -+#define CALL_LARGS_3(t1, a1, t2, a2, t3, a3) \ -+ CALL_LARGS_2(t1, a1, t2, a2); \ -+ long arg3 = (long)(t3)(a3) -+#define CALL_LARGS_4(t1, a1, t2, a2, t3, a3, t4, a4) \ -+ CALL_LARGS_3(t1, a1, t2, a2, t3, a3); \ -+ long arg4 = (long)(t4)(a4) -+#define CALL_LARGS_5(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) \ -+ CALL_LARGS_4(t1, a1, t2, a2, t3, a3, t4, a4); \ -+ long arg5 = (long)(t5)(a5) -+ -+#define CALL_REGS_0 \ -+ register long r2 asm("2") = dummy -+#define CALL_REGS_1 \ -+ register long r2 asm("2") = arg1 -+#define CALL_REGS_2 \ -+ CALL_REGS_1; \ -+ register long r3 asm("3") = arg2 -+#define CALL_REGS_3 \ -+ CALL_REGS_2; \ -+ register long r4 asm("4") = arg3 -+#define CALL_REGS_4 \ -+ CALL_REGS_3; \ -+ register long r5 asm("5") = arg4 -+#define CALL_REGS_5 \ -+ CALL_REGS_4; \ -+ register long r6 asm("6") = arg5 -+ -+#define CALL_TYPECHECK_0(...) -+#define CALL_TYPECHECK_1(t, a, ...) \ -+ typecheck(t, a) -+#define CALL_TYPECHECK_2(t, a, ...) \ -+ CALL_TYPECHECK_1(__VA_ARGS__); \ -+ typecheck(t, a) -+#define CALL_TYPECHECK_3(t, a, ...) \ -+ CALL_TYPECHECK_2(__VA_ARGS__); \ -+ typecheck(t, a) -+#define CALL_TYPECHECK_4(t, a, ...) \ -+ CALL_TYPECHECK_3(__VA_ARGS__); \ -+ typecheck(t, a) -+#define CALL_TYPECHECK_5(t, a, ...) \ -+ CALL_TYPECHECK_4(__VA_ARGS__); \ -+ typecheck(t, a) -+ -+#define CALL_PARM_0(...) void -+#define CALL_PARM_1(t, a, ...) t -+#define CALL_PARM_2(t, a, ...) t, CALL_PARM_1(__VA_ARGS__) -+#define CALL_PARM_3(t, a, ...) t, CALL_PARM_2(__VA_ARGS__) -+#define CALL_PARM_4(t, a, ...) t, CALL_PARM_3(__VA_ARGS__) -+#define CALL_PARM_5(t, a, ...) t, CALL_PARM_4(__VA_ARGS__) -+#define CALL_PARM_6(t, a, ...) t, CALL_PARM_5(__VA_ARGS__) -+ -+/* -+ * Use call_on_stack() to call a function switching to a specified -+ * stack. Proper sign and zero extension of function arguments is -+ * done. Usage: -+ * -+ * rc = call_on_stack(nr, stack, rettype, fn, t1, a1, t2, a2, ...) -+ * -+ * - nr specifies the number of function arguments of fn. -+ * - stack specifies the stack to be used. -+ * - fn is the function to be called. -+ * - rettype is the return type of fn. -+ * - t1, a1, ... are pairs, where t1 must match the type of the first -+ * argument of fn, t2 the second, etc. a1 is the corresponding -+ * first function argument (not name), etc. -+ */ -+#define call_on_stack(nr, stack, rettype, fn, ...) \ -+({ \ -+ rettype (*__fn)(CALL_PARM_##nr(__VA_ARGS__)) = fn; \ -+ unsigned long frame = current_frame_address(); \ -+ unsigned long __stack = stack; \ -+ unsigned long prev; \ -+ CALL_LARGS_##nr(__VA_ARGS__); \ -+ CALL_REGS_##nr; \ -+ \ -+ CALL_TYPECHECK_##nr(__VA_ARGS__); \ -+ asm volatile( \ -+ " lgr %[_prev],15\n" \ -+ " lg 15,%[_stack]\n" \ -+ " stg %[_frame],%[_bc](15)\n" \ -+ " brasl 14,%[_fn]\n" \ -+ " lgr 15,%[_prev]\n" \ -+ : [_prev] "=&d" (prev), CALL_FMT_##nr \ -+ : [_stack] "R" (__stack), \ -+ [_bc] "i" (offsetof(struct stack_frame, back_chain)), \ -+ [_frame] "d" (frame), \ -+ [_fn] "X" (__fn) : CALL_CLOBBER_##nr); \ -+ (rettype)r2; \ -+}) -+ - #define CALL_ON_STACK_NORETURN(fn, stack) \ - ({ \ - asm volatile( \ -diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c -index 91185db9a952f..992c15c016dd0 100644 ---- a/drivers/dma-buf/sync_file.c -+++ b/drivers/dma-buf/sync_file.c -@@ -211,8 +211,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, - struct sync_file *b) - { - struct sync_file *sync_file; -- struct dma_fence **fences, **nfences, **a_fences, **b_fences; -- int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; -+ struct dma_fence **fences = NULL, **nfences, **a_fences, **b_fences; -+ int i = 0, i_a, i_b, num_fences, a_num_fences, b_num_fences; - - sync_file = sync_file_alloc(); - if (!sync_file) -@@ -236,7 +236,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, - * If a sync_file can only be created with sync_file_merge - * and sync_file_create, this is a reasonable assumption. - */ -- for (i = i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) { -+ for (i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) { - struct dma_fence *pt_a = a_fences[i_a]; - struct dma_fence *pt_b = b_fences[i_b]; - -@@ -278,15 +278,16 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, - fences = nfences; - } - -- if (sync_file_set_fence(sync_file, fences, i) < 0) { -- kfree(fences); -+ if (sync_file_set_fence(sync_file, fences, i) < 0) - goto err; -- } - - strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name)); - return sync_file; - - err: -+ while (i) -+ dma_fence_put(fences[--i]); -+ kfree(fences); - fput(sync_file->file); - return NULL; - -diff --git a/drivers/firmware/tegra/Makefile b/drivers/firmware/tegra/Makefile -index 49c87e00fafb3..620cf3fdd6074 100644 ---- a/drivers/firmware/tegra/Makefile -+++ b/drivers/firmware/tegra/Makefile -@@ -3,6 +3,7 @@ tegra-bpmp-y = bpmp.o - tegra-bpmp-$(CONFIG_ARCH_TEGRA_210_SOC) += bpmp-tegra210.o - tegra-bpmp-$(CONFIG_ARCH_TEGRA_186_SOC) += bpmp-tegra186.o - tegra-bpmp-$(CONFIG_ARCH_TEGRA_194_SOC) += bpmp-tegra186.o -+tegra-bpmp-$(CONFIG_ARCH_TEGRA_234_SOC) += bpmp-tegra186.o - tegra-bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o - obj-$(CONFIG_TEGRA_BPMP) += tegra-bpmp.o - obj-$(CONFIG_TEGRA_IVC) += ivc.o -diff --git a/drivers/firmware/tegra/bpmp-private.h b/drivers/firmware/tegra/bpmp-private.h -index 54d560c48398e..182bfe3965161 100644 ---- a/drivers/firmware/tegra/bpmp-private.h -+++ b/drivers/firmware/tegra/bpmp-private.h -@@ -24,7 +24,8 @@ struct tegra_bpmp_ops { - }; - - #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || \ -- IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) -+ IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ -+ IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) - extern const struct tegra_bpmp_ops tegra186_bpmp_ops; - #endif - #if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) -diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c -index 19c56133234b3..afde06b313877 100644 ---- a/drivers/firmware/tegra/bpmp.c -+++ b/drivers/firmware/tegra/bpmp.c -@@ -808,7 +808,8 @@ static const struct dev_pm_ops tegra_bpmp_pm_ops = { - }; - - #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || \ -- IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) -+ IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ -+ IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) - static const struct tegra_bpmp_soc tegra186_soc = { - .channels = { - .cpu_tx = { -diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c -index 9a6cf5af27a3d..0779513ac8d4f 100644 ---- a/drivers/firmware/turris-mox-rwtm.c -+++ b/drivers/firmware/turris-mox-rwtm.c -@@ -401,6 +401,7 @@ static int turris_mox_rwtm_remove(struct platform_device *pdev) - - static const struct of_device_id turris_mox_rwtm_match[] = { - { .compatible = "cznic,turris-mox-rwtm", }, -+ { .compatible = "marvell,armada-3700-rwtm-firmware", }, - { }, - }; - -diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c -index 4c2971835d330..ec10fda3f24f4 100644 ---- a/drivers/md/dm-writecache.c -+++ b/drivers/md/dm-writecache.c -@@ -154,6 +154,7 @@ struct dm_writecache { - bool overwrote_committed:1; - bool memory_vmapped:1; - -+ bool start_sector_set:1; - bool high_wm_percent_set:1; - bool low_wm_percent_set:1; - bool max_writeback_jobs_set:1; -@@ -162,6 +163,10 @@ struct dm_writecache { - bool writeback_fua_set:1; - bool flush_on_suspend:1; - -+ unsigned high_wm_percent_value; -+ unsigned low_wm_percent_value; -+ unsigned autocommit_time_value; -+ - unsigned writeback_all; - struct workqueue_struct *writeback_wq; - struct work_struct writeback_work; -@@ -2069,6 +2074,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) - if (sscanf(string, "%llu%c", &start_sector, &dummy) != 1) - goto invalid_optional; - wc->start_sector = start_sector; -+ wc->start_sector_set = true; - if (wc->start_sector != start_sector || - wc->start_sector >= wc->memory_map_size >> SECTOR_SHIFT) - goto invalid_optional; -@@ -2078,6 +2084,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) - goto invalid_optional; - if (high_wm_percent < 0 || high_wm_percent > 100) - goto invalid_optional; -+ wc->high_wm_percent_value = high_wm_percent; - wc->high_wm_percent_set = true; - } else if (!strcasecmp(string, "low_watermark") && opt_params >= 1) { - string = dm_shift_arg(&as), opt_params--; -@@ -2085,6 +2092,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) - goto invalid_optional; - if (low_wm_percent < 0 || low_wm_percent > 100) - goto invalid_optional; -+ wc->low_wm_percent_value = low_wm_percent; - wc->low_wm_percent_set = true; - } else if (!strcasecmp(string, "writeback_jobs") && opt_params >= 1) { - string = dm_shift_arg(&as), opt_params--; -@@ -2104,6 +2112,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) - if (autocommit_msecs > 3600000) - goto invalid_optional; - wc->autocommit_jiffies = msecs_to_jiffies(autocommit_msecs); -+ wc->autocommit_time_value = autocommit_msecs; - wc->autocommit_time_set = true; - } else if (!strcasecmp(string, "fua")) { - if (WC_MODE_PMEM(wc)) { -@@ -2305,7 +2314,6 @@ static void writecache_status(struct dm_target *ti, status_type_t type, - struct dm_writecache *wc = ti->private; - unsigned extra_args; - unsigned sz = 0; -- uint64_t x; - - switch (type) { - case STATUSTYPE_INFO: -@@ -2317,7 +2325,7 @@ static void writecache_status(struct dm_target *ti, status_type_t type, - DMEMIT("%c %s %s %u ", WC_MODE_PMEM(wc) ? 'p' : 's', - wc->dev->name, wc->ssd_dev->name, wc->block_size); - extra_args = 0; -- if (wc->start_sector) -+ if (wc->start_sector_set) - extra_args += 2; - if (wc->high_wm_percent_set) - extra_args += 2; -@@ -2333,26 +2341,18 @@ static void writecache_status(struct dm_target *ti, status_type_t type, - extra_args++; - - DMEMIT("%u", extra_args); -- if (wc->start_sector) -+ if (wc->start_sector_set) - DMEMIT(" start_sector %llu", (unsigned long long)wc->start_sector); -- if (wc->high_wm_percent_set) { -- x = (uint64_t)wc->freelist_high_watermark * 100; -- x += wc->n_blocks / 2; -- do_div(x, (size_t)wc->n_blocks); -- DMEMIT(" high_watermark %u", 100 - (unsigned)x); -- } -- if (wc->low_wm_percent_set) { -- x = (uint64_t)wc->freelist_low_watermark * 100; -- x += wc->n_blocks / 2; -- do_div(x, (size_t)wc->n_blocks); -- DMEMIT(" low_watermark %u", 100 - (unsigned)x); -- } -+ if (wc->high_wm_percent_set) -+ DMEMIT(" high_watermark %u", wc->high_wm_percent_value); -+ if (wc->low_wm_percent_set) -+ DMEMIT(" low_watermark %u", wc->low_wm_percent_value); - if (wc->max_writeback_jobs_set) - DMEMIT(" writeback_jobs %u", wc->max_writeback_jobs); - if (wc->autocommit_blocks_set) - DMEMIT(" autocommit_blocks %u", wc->autocommit_blocks); - if (wc->autocommit_time_set) -- DMEMIT(" autocommit_time %u", jiffies_to_msecs(wc->autocommit_jiffies)); -+ DMEMIT(" autocommit_time %u", wc->autocommit_time_value); - if (wc->writeback_fua_set) - DMEMIT(" %sfua", wc->writeback_fua ? "" : "no"); - break; -diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c -index 446eb06e50b49..8aa8825557a81 100644 ---- a/drivers/net/dsa/mv88e6xxx/chip.c -+++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3715,6 +3715,7 @@ static const struct mv88e6xxx_ops mv88e6250_ops = { - .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, - .port_set_speed = mv88e6250_port_set_speed, - .port_tag_remap = mv88e6095_port_tag_remap, -+ .port_set_policy = mv88e6352_port_set_policy, - .port_set_frame_mode = mv88e6351_port_set_frame_mode, - .port_set_egress_floods = mv88e6352_port_set_egress_floods, - .port_set_ether_type = mv88e6351_port_set_ether_type, -@@ -3916,6 +3917,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { - .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, - .pot_clear = mv88e6xxx_g2_pot_clear, - .reset = mv88e6352_g1_reset, -+ .rmu_disable = mv88e6390_g1_rmu_disable, - .vtu_getnext = mv88e6352_g1_vtu_getnext, - .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, - .serdes_power = mv88e6390_serdes_power, -@@ -3982,6 +3984,7 @@ static const struct mv88e6xxx_ops mv88e6351_ops = { - .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay, - .port_set_speed = mv88e6185_port_set_speed, - .port_tag_remap = mv88e6095_port_tag_remap, -+ .port_set_policy = mv88e6352_port_set_policy, - .port_set_frame_mode = mv88e6351_port_set_frame_mode, - .port_set_egress_floods = mv88e6352_port_set_egress_floods, - .port_set_ether_type = mv88e6351_port_set_ether_type, -@@ -4004,6 +4007,7 @@ static const struct mv88e6xxx_ops mv88e6351_ops = { - .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, - .pot_clear = mv88e6xxx_g2_pot_clear, - .reset = mv88e6352_g1_reset, -+ .rmu_disable = mv88e6390_g1_rmu_disable, - .vtu_getnext = mv88e6352_g1_vtu_getnext, - .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, - .avb_ops = &mv88e6352_avb_ops, -diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -index 21669a42718c8..7bd6d2bf84408 100644 ---- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c -+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -2783,15 +2783,21 @@ static void bcmgenet_set_hw_addr(struct bcmgenet_priv *priv, - /* Returns a reusable dma control register value */ - static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv) - { -+ unsigned int i; - u32 reg; - u32 dma_ctrl; - - /* disable DMA */ - dma_ctrl = 1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT) | DMA_EN; -+ for (i = 0; i < priv->hw_params->tx_queues; i++) -+ dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT)); - reg = bcmgenet_tdma_readl(priv, DMA_CTRL); - reg &= ~dma_ctrl; - bcmgenet_tdma_writel(priv, reg, DMA_CTRL); - -+ dma_ctrl = 1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT) | DMA_EN; -+ for (i = 0; i < priv->hw_params->rx_queues; i++) -+ dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT)); - reg = bcmgenet_rdma_readl(priv, DMA_CTRL); - reg &= ~dma_ctrl; - bcmgenet_rdma_writel(priv, reg, DMA_CTRL); -diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c -index caf7051302725..13714827f4525 100644 ---- a/drivers/net/ethernet/moxa/moxart_ether.c -+++ b/drivers/net/ethernet/moxa/moxart_ether.c -@@ -545,10 +545,8 @@ static int moxart_mac_probe(struct platform_device *pdev) - SET_NETDEV_DEV(ndev, &pdev->dev); - - ret = register_netdev(ndev); -- if (ret) { -- free_netdev(ndev); -+ if (ret) - goto init_fail; -- } - - netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n", - __func__, ndev->irq, ndev->dev_addr); -diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c -index 3eee8df359a12..5c199d2516d47 100644 ---- a/drivers/net/ethernet/qualcomm/emac/emac.c -+++ b/drivers/net/ethernet/qualcomm/emac/emac.c -@@ -745,12 +745,13 @@ static int emac_remove(struct platform_device *pdev) - - put_device(&adpt->phydev->mdio.dev); - mdiobus_unregister(adpt->mii_bus); -- free_netdev(netdev); - - if (adpt->phy.digital) - iounmap(adpt->phy.digital); - iounmap(adpt->phy.base); - -+ free_netdev(netdev); -+ - return 0; - } - -diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c -index a3691bc94b101..a5c7d75497ee6 100644 ---- a/drivers/net/ethernet/ti/tlan.c -+++ b/drivers/net/ethernet/ti/tlan.c -@@ -314,9 +314,8 @@ static void tlan_remove_one(struct pci_dev *pdev) - pci_release_regions(pdev); - #endif - -- free_netdev(dev); -- - cancel_work_sync(&priv->tlan_tqueue); -+ free_netdev(dev); - } - - static void tlan_start(struct net_device *dev) -diff --git a/drivers/net/fddi/defza.c b/drivers/net/fddi/defza.c -index 060712c666bf4..83e4c5192f35f 100644 ---- a/drivers/net/fddi/defza.c -+++ b/drivers/net/fddi/defza.c -@@ -1504,9 +1504,8 @@ err_out_resource: - release_mem_region(start, len); - - err_out_kfree: -- free_netdev(dev); -- - pr_err("%s: initialization failure, aborting!\n", fp->name); -+ free_netdev(dev); - return ret; - } - -diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c -index a2635c21db7f8..ecb8873e3a19b 100644 ---- a/drivers/reset/reset-ti-syscon.c -+++ b/drivers/reset/reset-ti-syscon.c -@@ -58,8 +58,8 @@ struct ti_syscon_reset_data { - unsigned int nr_controls; - }; - --#define to_ti_syscon_reset_data(rcdev) \ -- container_of(rcdev, struct ti_syscon_reset_data, rcdev) -+#define to_ti_syscon_reset_data(_rcdev) \ -+ container_of(_rcdev, struct ti_syscon_reset_data, rcdev) - - /** - * ti_syscon_reset_assert() - assert device reset -diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c -index d5a0e27dd0a08..9e27f5a011975 100644 ---- a/drivers/rtc/rtc-max77686.c -+++ b/drivers/rtc/rtc-max77686.c -@@ -707,8 +707,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) - - add_rtc_irq: - ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq, -- IRQF_TRIGGER_FALLING | IRQF_ONESHOT | -- IRQF_SHARED, 0, info->drv_data->rtc_irq_chip, -+ IRQF_ONESHOT | IRQF_SHARED, -+ 0, info->drv_data->rtc_irq_chip, - &info->rtc_irq_data); - if (ret < 0) { - dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret); -diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c -index 91534560fe2a2..d349cef09cb7c 100644 ---- a/drivers/rtc/rtc-mxc_v2.c -+++ b/drivers/rtc/rtc-mxc_v2.c -@@ -373,6 +373,7 @@ static const struct of_device_id mxc_ids[] = { - { .compatible = "fsl,imx53-rtc", }, - {} - }; -+MODULE_DEVICE_TABLE(of, mxc_ids); - - static struct platform_driver mxc_rtc_driver = { - .driver = { -diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c -index 4190a025381a5..27d85ed82977c 100644 ---- a/drivers/scsi/aic7xxx/aic7xxx_core.c -+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c -@@ -493,7 +493,7 @@ ahc_inq(struct ahc_softc *ahc, u_int port) - return ((ahc_inb(ahc, port)) - | (ahc_inb(ahc, port+1) << 8) - | (ahc_inb(ahc, port+2) << 16) -- | (ahc_inb(ahc, port+3) << 24) -+ | (((uint64_t)ahc_inb(ahc, port+3)) << 24) - | (((uint64_t)ahc_inb(ahc, port+4)) << 32) - | (((uint64_t)ahc_inb(ahc, port+5)) << 40) - | (((uint64_t)ahc_inb(ahc, port+6)) << 48) -diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c -index f5781e31f57c6..b68dfeb952ee8 100644 ---- a/drivers/scsi/aic94xx/aic94xx_init.c -+++ b/drivers/scsi/aic94xx/aic94xx_init.c -@@ -52,6 +52,7 @@ static struct scsi_host_template aic94xx_sht = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .track_queue_depth = 1, -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -index 9f6534bd354bc..1443c803d8f75 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -@@ -1768,6 +1768,7 @@ static struct scsi_host_template sht_v1_hw = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = host_attrs_v1_hw, -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -index 8e96a257e4393..11c75881bd892 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -@@ -3542,6 +3542,7 @@ static struct scsi_host_template sht_v2_hw = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = host_attrs_v2_hw, -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -index 916447f3c6073..13f314fa757e8 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -@@ -3064,6 +3064,7 @@ static struct scsi_host_template sht_v3_hw = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = host_attrs_v3_hw, -diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c -index 1727d0c71b123..c33bcf85fb211 100644 ---- a/drivers/scsi/isci/init.c -+++ b/drivers/scsi/isci/init.c -@@ -166,6 +166,7 @@ static struct scsi_host_template isci_sht = { - .eh_abort_handler = sas_eh_abort_handler, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = isci_host_attrs, -diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c -index 64500417c22ea..326bd609a3d13 100644 ---- a/drivers/scsi/libfc/fc_rport.c -+++ b/drivers/scsi/libfc/fc_rport.c -@@ -1160,6 +1160,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, - resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK); - FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n", - pp->spp.spp_flags, pp->spp.spp_type); -+ - rdata->spp_type = pp->spp.spp_type; - if (resp_code != FC_SPP_RESP_ACK) { - if (resp_code == FC_SPP_RESP_CONF) -@@ -1182,11 +1183,13 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, - /* - * Call prli provider if we should act as a target - */ -- prov = fc_passive_prov[rdata->spp_type]; -- if (prov) { -- memset(&temp_spp, 0, sizeof(temp_spp)); -- prov->prli(rdata, pp->prli.prli_spp_len, -- &pp->spp, &temp_spp); -+ if (rdata->spp_type < FC_FC4_PROV_SIZE) { -+ prov = fc_passive_prov[rdata->spp_type]; -+ if (prov) { -+ memset(&temp_spp, 0, sizeof(temp_spp)); -+ prov->prli(rdata, pp->prli.prli_spp_len, -+ &pp->spp, &temp_spp); -+ } - } - /* - * Check if the image pair could be established -diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c -index bec83eb8ab874..081f3145fe145 100644 ---- a/drivers/scsi/libsas/sas_scsi_host.c -+++ b/drivers/scsi/libsas/sas_scsi_host.c -@@ -911,6 +911,14 @@ void sas_task_abort(struct sas_task *task) - blk_abort_request(sc->request); - } - -+int sas_slave_alloc(struct scsi_device *sdev) -+{ -+ if (dev_is_sata(sdev_to_domain_dev(sdev)) && sdev->lun) -+ return -ENXIO; -+ -+ return 0; -+} -+ - void sas_target_destroy(struct scsi_target *starget) - { - struct domain_device *found_dev = starget->hostdata; -@@ -957,5 +965,6 @@ EXPORT_SYMBOL_GPL(sas_task_abort); - EXPORT_SYMBOL_GPL(sas_phy_reset); - EXPORT_SYMBOL_GPL(sas_eh_device_reset_handler); - EXPORT_SYMBOL_GPL(sas_eh_target_reset_handler); -+EXPORT_SYMBOL_GPL(sas_slave_alloc); - EXPORT_SYMBOL_GPL(sas_target_destroy); - EXPORT_SYMBOL_GPL(sas_ioctl); -diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c -index da719b0694dcc..52405ce58ade8 100644 ---- a/drivers/scsi/mvsas/mv_init.c -+++ b/drivers/scsi/mvsas/mv_init.c -@@ -45,6 +45,7 @@ static struct scsi_host_template mvs_sht = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = mvst_host_attrs, -diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c -index 8882ba33ca87c..1f41537d52a58 100644 ---- a/drivers/scsi/pm8001/pm8001_init.c -+++ b/drivers/scsi/pm8001/pm8001_init.c -@@ -86,6 +86,7 @@ static struct scsi_host_template pm8001_sht = { - .max_sectors = SCSI_DEFAULT_MAX_SECTORS, - .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_target_reset_handler = sas_eh_target_reset_handler, -+ .slave_alloc = sas_slave_alloc, - .target_destroy = sas_target_destroy, - .ioctl = sas_ioctl, - .shost_attrs = pm8001_host_attrs, -diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c -index e749a2dcaad7e..4e8a284e606c0 100644 ---- a/drivers/scsi/qedf/qedf_io.c -+++ b/drivers/scsi/qedf/qedf_io.c -@@ -1504,9 +1504,19 @@ void qedf_process_error_detect(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, - { - int rval; - -+ if (io_req == NULL) { -+ QEDF_INFO(NULL, QEDF_LOG_IO, "io_req is NULL.\n"); -+ return; -+ } -+ -+ if (io_req->fcport == NULL) { -+ QEDF_INFO(NULL, QEDF_LOG_IO, "fcport is NULL.\n"); -+ return; -+ } -+ - if (!cqe) { - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, -- "cqe is NULL for io_req %p\n", io_req); -+ "cqe is NULL for io_req %p\n", io_req); - return; - } - -@@ -1522,6 +1532,16 @@ void qedf_process_error_detect(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, - le32_to_cpu(cqe->cqe_info.err_info.rx_buf_off), - le32_to_cpu(cqe->cqe_info.err_info.rx_id)); - -+ /* When flush is active, let the cmds be flushed out from the cleanup context */ -+ if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &io_req->fcport->flags) || -+ (test_bit(QEDF_RPORT_IN_LUN_RESET, &io_req->fcport->flags) && -+ io_req->sc_cmd->device->lun == (u64)io_req->fcport->lun_reset_lun)) { -+ QEDF_ERR(&qedf->dbg_ctx, -+ "Dropping EQE for xid=0x%x as fcport is flushing", -+ io_req->xid); -+ return; -+ } -+ - if (qedf->stop_io_on_error) { - qedf_stop_all_io(qedf); - return; -diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c -index 9c3ef0a02fd4e..15060c847eccf 100644 ---- a/drivers/soc/tegra/fuse/fuse-tegra30.c -+++ b/drivers/soc/tegra/fuse/fuse-tegra30.c -@@ -36,7 +36,8 @@ - defined(CONFIG_ARCH_TEGRA_132_SOC) || \ - defined(CONFIG_ARCH_TEGRA_210_SOC) || \ - defined(CONFIG_ARCH_TEGRA_186_SOC) || \ -- defined(CONFIG_ARCH_TEGRA_194_SOC) -+ defined(CONFIG_ARCH_TEGRA_194_SOC) || \ -+ defined(CONFIG_ARCH_TEGRA_234_SOC) - static u32 tegra30_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset) - { - if (WARN_ON(!fuse->base)) -diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c -index c28271817e43f..f526ce31f5a2f 100644 ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -1368,7 +1368,7 @@ free_tz: - EXPORT_SYMBOL_GPL(thermal_zone_device_register); - - /** -- * thermal_device_unregister - removes the registered thermal zone device -+ * thermal_zone_device_unregister - removes the registered thermal zone device - * @tz: the thermal zone device to remove - */ - void thermal_zone_device_unregister(struct thermal_zone_device *tz) -diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c -index f32f00c495713..c3bf54cc530f9 100644 ---- a/drivers/usb/cdns3/gadget.c -+++ b/drivers/usb/cdns3/gadget.c -@@ -1531,7 +1531,7 @@ void cdns3_configure_dmult(struct cdns3_device *priv_dev, - else - mask = BIT(priv_ep->num); - -- if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) { -+ if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) { - cdns3_set_register_bit(®s->tdl_from_trb, mask); - cdns3_set_register_bit(®s->tdl_beh, mask); - cdns3_set_register_bit(®s->tdl_beh2, mask); -@@ -1569,15 +1569,13 @@ void cdns3_ep_config(struct cdns3_endpoint *priv_ep) - case USB_ENDPOINT_XFER_INT: - ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT); - -- if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || -- priv_dev->dev_ver > DEV_VER_V2) -+ if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) - ep_cfg |= EP_CFG_TDL_CHK; - break; - case USB_ENDPOINT_XFER_BULK: - ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK); - -- if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || -- priv_dev->dev_ver > DEV_VER_V2) -+ if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) - ep_cfg |= EP_CFG_TDL_CHK; - break; - default: -diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c -index cc3ada12848d9..42125601ebb10 100644 ---- a/fs/cifs/cifs_dfs_ref.c -+++ b/fs/cifs/cifs_dfs_ref.c -@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata, - return ERR_PTR(-EINVAL); - - if (ref) { -+ if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0)) -+ return ERR_PTR(-EINVAL); -+ - if (strlen(fullpath) - ref->path_consumed) { - prepath = fullpath + ref->path_consumed; - /* skip initial delimiter */ -diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c -index 029e693e201cf..3a5360e045cfd 100644 ---- a/fs/f2fs/sysfs.c -+++ b/fs/f2fs/sysfs.c -@@ -499,7 +499,9 @@ F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND); - F2FS_FEATURE_RO_ATTR(verity, FEAT_VERITY); - #endif - F2FS_FEATURE_RO_ATTR(sb_checksum, FEAT_SB_CHECKSUM); -+#ifdef CONFIG_UNICODE - F2FS_FEATURE_RO_ATTR(casefold, FEAT_CASEFOLD); -+#endif - - #define ATTR_LIST(name) (&f2fs_attr_##name.attr) - static struct attribute *f2fs_attrs[] = { -@@ -568,7 +570,9 @@ static struct attribute *f2fs_feat_attrs[] = { - ATTR_LIST(verity), - #endif - ATTR_LIST(sb_checksum), -+#ifdef CONFIG_UNICODE - ATTR_LIST(casefold), -+#endif - NULL, - }; - ATTRIBUTE_GROUPS(f2fs_feat); -diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h -index 56cb3c38569a7..14efa0ded75dd 100644 ---- a/include/net/dst_metadata.h -+++ b/include/net/dst_metadata.h -@@ -45,7 +45,9 @@ skb_tunnel_info(const struct sk_buff *skb) - return &md_dst->u.tun_info; - - dst = skb_dst(skb); -- if (dst && dst->lwtstate) -+ if (dst && dst->lwtstate && -+ (dst->lwtstate->type == LWTUNNEL_ENCAP_IP || -+ dst->lwtstate->type == LWTUNNEL_ENCAP_IP6)) - return lwt_tun_info(dst->lwtstate); - - return NULL; -diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h -index 40602def3fe76..feeecbc80e727 100644 ---- a/include/net/ip6_route.h -+++ b/include/net/ip6_route.h -@@ -261,7 +261,7 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst, - int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, - int (*output)(struct net *, struct sock *, struct sk_buff *)); - --static inline int ip6_skb_dst_mtu(struct sk_buff *skb) -+static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb) - { - int mtu; - -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index d2ba080ea7425..74cb20f32f72f 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -4786,7 +4786,7 @@ static const u64 cfs_bandwidth_slack_period = 5 * NSEC_PER_MSEC; - static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire) - { - struct hrtimer *refresh_timer = &cfs_b->period_timer; -- u64 remaining; -+ s64 remaining; - - /* if the call-back is running a quota refresh is already occurring */ - if (hrtimer_callback_running(refresh_timer)) -@@ -4794,7 +4794,7 @@ static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire) - - /* is a quota refresh about to occur? */ - remaining = ktime_to_ns(hrtimer_expires_remaining(refresh_timer)); -- if (remaining < min_expire) -+ if (remaining < (s64)min_expire) - return 1; - - return 0; -diff --git a/mm/slab_common.c b/mm/slab_common.c -index 636cd496417cf..8f128245b3007 100644 ---- a/mm/slab_common.c -+++ b/mm/slab_common.c -@@ -325,14 +325,6 @@ int slab_unmergeable(struct kmem_cache *s) - if (s->refcount < 0) - return 1; - --#ifdef CONFIG_MEMCG_KMEM -- /* -- * Skip the dying kmem_cache. -- */ -- if (s->memcg_params.dying) -- return 1; --#endif -- - return 0; - } - -@@ -973,6 +965,16 @@ void kmem_cache_destroy(struct kmem_cache *s) - get_online_mems(); - - mutex_lock(&slab_mutex); -+ -+ /* -+ * Another thread referenced it again -+ */ -+ if (READ_ONCE(s->refcount)) { -+ spin_lock_irq(&memcg_kmem_wq_lock); -+ s->memcg_params.dying = false; -+ spin_unlock_irq(&memcg_kmem_wq_lock); -+ goto out_unlock; -+ } - #endif - - err = shutdown_memcg_caches(s); -diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c -index 4fe30b182ee7e..bec20dbf6f603 100644 ---- a/net/bridge/br_if.c -+++ b/net/bridge/br_if.c -@@ -559,7 +559,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, - struct net_bridge_port *p; - int err = 0; - unsigned br_hr, dev_hr; -- bool changed_addr; -+ bool changed_addr, fdb_synced = false; - - /* Don't allow bridging non-ethernet like devices, or DSA-enabled - * master network devices since the bridge layer rx_handler prevents -@@ -635,6 +635,19 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, - list_add_rcu(&p->list, &br->port_list); - - nbp_update_port_count(br); -+ if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) { -+ /* When updating the port count we also update all ports' -+ * promiscuous mode. -+ * A port leaving promiscuous mode normally gets the bridge's -+ * fdb synced to the unicast filter (if supported), however, -+ * `br_port_clear_promisc` does not distinguish between -+ * non-promiscuous ports and *new* ports, so we need to -+ * sync explicitly here. -+ */ -+ fdb_synced = br_fdb_sync_static(br, p) == 0; -+ if (!fdb_synced) -+ netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n"); -+ } - - netdev_update_features(br->dev); - -@@ -684,6 +697,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, - return 0; - - err7: -+ if (fdb_synced) -+ br_fdb_unsync_static(br, p); - list_del_rcu(&p->list); - br_fdb_delete_by_port(br, p, 0, 1); - nbp_update_port_count(br); -diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c -index f64d1743b86d6..eb381a24a8f8d 100644 ---- a/net/ipv4/ip_tunnel.c -+++ b/net/ipv4/ip_tunnel.c -@@ -317,7 +317,7 @@ static int ip_tunnel_bind_dev(struct net_device *dev) - } - - dev->needed_headroom = t_hlen + hlen; -- mtu -= t_hlen; -+ mtu -= t_hlen + (dev->type == ARPHRD_ETHER ? dev->hard_header_len : 0); - - if (mtu < IPV4_MIN_MTU) - mtu = IPV4_MIN_MTU; -@@ -348,6 +348,9 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net, - t_hlen = nt->hlen + sizeof(struct iphdr); - dev->min_mtu = ETH_MIN_MTU; - dev->max_mtu = IP_MAX_MTU - t_hlen; -+ if (dev->type == ARPHRD_ETHER) -+ dev->max_mtu -= dev->hard_header_len; -+ - ip_tunnel_add(itn, nt); - return nt; - -@@ -495,11 +498,14 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, - - tunnel_hlen = md ? tunnel_hlen : tunnel->hlen; - pkt_size = skb->len - tunnel_hlen; -+ pkt_size -= dev->type == ARPHRD_ETHER ? dev->hard_header_len : 0; - -- if (df) -+ if (df) { - mtu = dst_mtu(&rt->dst) - (sizeof(struct iphdr) + tunnel_hlen); -- else -+ mtu -= dev->type == ARPHRD_ETHER ? dev->hard_header_len : 0; -+ } else { - mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; -+ } - - if (skb_valid_dst(skb)) - skb_dst_update_pmtu_no_confirm(skb, mtu); -@@ -965,6 +971,9 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict) - int t_hlen = tunnel->hlen + sizeof(struct iphdr); - int max_mtu = IP_MAX_MTU - t_hlen; - -+ if (dev->type == ARPHRD_ETHER) -+ max_mtu -= dev->hard_header_len; -+ - if (new_mtu < ETH_MIN_MTU) - return -EINVAL; - -@@ -1142,6 +1151,9 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], - if (tb[IFLA_MTU]) { - unsigned int max = IP_MAX_MTU - (nt->hlen + sizeof(struct iphdr)); - -+ if (dev->type == ARPHRD_ETHER) -+ max -= dev->hard_header_len; -+ - mtu = clamp(dev->mtu, (unsigned int)ETH_MIN_MTU, max); - } - -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index 04acdca4bb0d5..91788ff19a5d4 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -343,7 +343,7 @@ void tcp_v4_mtu_reduced(struct sock *sk) - - if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) - return; -- mtu = tcp_sk(sk)->mtu_info; -+ mtu = READ_ONCE(tcp_sk(sk)->mtu_info); - dst = inet_csk_update_pmtu(sk, mtu); - if (!dst) - return; -@@ -512,7 +512,7 @@ int tcp_v4_err(struct sk_buff *icmp_skb, u32 info) - if (sk->sk_state == TCP_LISTEN) - goto out; - -- tp->mtu_info = info; -+ WRITE_ONCE(tp->mtu_info, info); - if (!sock_owned_by_user(sk)) { - tcp_v4_mtu_reduced(sk); - } else { -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index d0774b4e934d6..638d7b49ad716 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -1504,6 +1504,7 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu) - return __tcp_mtu_to_mss(sk, pmtu) - - (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr)); - } -+EXPORT_SYMBOL(tcp_mtu_to_mss); - - /* Inverse of above */ - int tcp_mss_to_mtu(struct sock *sk, int mss) -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index 4644f86c932fc..6f277bd30ea3c 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1043,7 +1043,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - } - - ipcm_init_sk(&ipc, inet); -- ipc.gso_size = up->gso_size; -+ ipc.gso_size = READ_ONCE(up->gso_size); - - if (msg->msg_controllen) { - err = udp_cmsg_send(sk, msg, &ipc.gso_size); -@@ -2590,7 +2590,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, - case UDP_SEGMENT: - if (val < 0 || val > USHRT_MAX) - return -EINVAL; -- up->gso_size = val; -+ WRITE_ONCE(up->gso_size, val); - break; - - case UDP_GRO: -@@ -2692,7 +2692,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, - break; - - case UDP_SEGMENT: -- val = up->gso_size; -+ val = READ_ONCE(up->gso_size); - break; - - case UDP_GRO: -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c -index 2f061a911bc2c..3903cc0ab1883 100644 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -343,11 +343,20 @@ failure: - static void tcp_v6_mtu_reduced(struct sock *sk) - { - struct dst_entry *dst; -+ u32 mtu; - - if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) - return; - -- dst = inet6_csk_update_pmtu(sk, tcp_sk(sk)->mtu_info); -+ mtu = READ_ONCE(tcp_sk(sk)->mtu_info); -+ -+ /* Drop requests trying to increase our current mss. -+ * Check done in __ip6_rt_update_pmtu() is too late. -+ */ -+ if (tcp_mtu_to_mss(sk, mtu) >= tcp_sk(sk)->mss_cache) -+ return; -+ -+ dst = inet6_csk_update_pmtu(sk, mtu); - if (!dst) - return; - -@@ -428,6 +437,8 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - } - - if (type == ICMPV6_PKT_TOOBIG) { -+ u32 mtu = ntohl(info); -+ - /* We are not interested in TCP_LISTEN and open_requests - * (SYN-ACKs send out by Linux are always <576bytes so - * they should go through unfragmented). -@@ -438,7 +449,11 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - if (!ip6_sk_accept_pmtu(sk)) - goto out; - -- tp->mtu_info = ntohl(info); -+ if (mtu < IPV6_MIN_MTU) -+ goto out; -+ -+ WRITE_ONCE(tp->mtu_info, mtu); -+ - if (!sock_owned_by_user(sk)) - tcp_v6_mtu_reduced(sk); - else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED, -@@ -513,8 +528,8 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst, - opt = ireq->ipv6_opt; - if (!opt) - opt = rcu_dereference(np->opt); -- err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt, np->tclass, -- sk->sk_priority); -+ err = ip6_xmit(sk, skb, fl6, skb->mark ? : sk->sk_mark, opt, -+ np->tclass, sk->sk_priority); - rcu_read_unlock(); - err = net_xmit_eval(err); - } -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index 3c94b81bb459a..776427e80efbd 100644 ---- a/net/ipv6/udp.c -+++ b/net/ipv6/udp.c -@@ -1237,7 +1237,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); - - ipcm6_init(&ipc6); -- ipc6.gso_size = up->gso_size; -+ ipc6.gso_size = READ_ONCE(up->gso_size); - ipc6.sockc.tsflags = sk->sk_tsflags; - ipc6.sockc.mark = sk->sk_mark; - -diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c -index cf2a0ce15c1c5..6b0ed6c593e2b 100644 ---- a/net/ipv6/xfrm6_output.c -+++ b/net/ipv6/xfrm6_output.c -@@ -144,7 +144,7 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) - { - struct dst_entry *dst = skb_dst(skb); - struct xfrm_state *x = dst->xfrm; -- int mtu; -+ unsigned int mtu; - bool toobig; - - #ifdef CONFIG_NETFILTER -diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c -index 783af451a8325..bc6f0c8874f81 100644 ---- a/net/netfilter/nf_conntrack_netlink.c -+++ b/net/netfilter/nf_conntrack_netlink.c -@@ -211,6 +211,7 @@ static int ctnetlink_dump_helpinfo(struct sk_buff *skb, - if (!help) - return 0; - -+ rcu_read_lock(); - helper = rcu_dereference(help->helper); - if (!helper) - goto out; -@@ -226,9 +227,11 @@ static int ctnetlink_dump_helpinfo(struct sk_buff *skb, - - nla_nest_end(skb, nest_helper); - out: -+ rcu_read_unlock(); - return 0; - - nla_put_failure: -+ rcu_read_unlock(); - return -1; - } - -diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c -index 16c4cbf6d1f0a..02d4491991b5e 100644 ---- a/net/sched/act_ct.c -+++ b/net/sched/act_ct.c -@@ -474,7 +474,8 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, - /* This will take care of sending queued events - * even if the connection is already confirmed. - */ -- nf_conntrack_confirm(skb); -+ if (nf_conntrack_confirm(skb) != NF_ACCEPT) -+ goto drop; - } - - out_push: -diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include -index 7da10afc92c61..b14a7d4a2f05a 100644 ---- a/scripts/Kbuild.include -+++ b/scripts/Kbuild.include -@@ -182,8 +182,13 @@ clean := -f $(srctree)/scripts/Makefile.clean obj - echo-cmd = $(if $($(quiet)cmd_$(1)),\ - echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) - -+# sink stdout for 'make -s' -+ redirect := -+ quiet_redirect := -+silent_redirect := exec >/dev/null; -+ - # printing commands --cmd = @set -e; $(echo-cmd) $(cmd_$(1)) -+cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1)) - - ### - # if_changed - execute command if any prerequisite is newer than -diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h -index d1d757c6edf4f..06c1e9e3bc38d 100755 ---- a/scripts/mkcompile_h -+++ b/scripts/mkcompile_h -@@ -80,15 +80,23 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" - # Only replace the real compile.h if the new one is different, - # in order to preserve the timestamp and avoid unnecessary - # recompilations. --# We don't consider the file changed if only the date/time changed. -+# We don't consider the file changed if only the date/time changed, -+# unless KBUILD_BUILD_TIMESTAMP was explicitly set (e.g. for -+# reproducible builds with that value referring to a commit timestamp). - # A kernel config change will increase the generation number, thus - # causing compile.h to be updated (including date/time) due to the - # changed comment in the - # first line. - -+if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then -+ IGNORE_PATTERN="UTS_VERSION" -+else -+ IGNORE_PATTERN="NOT_A_PATTERN_TO_BE_MATCHED" -+fi -+ - if [ -r $TARGET ] && \ -- grep -v 'UTS_VERSION' $TARGET > .tmpver.1 && \ -- grep -v 'UTS_VERSION' .tmpcompile > .tmpver.2 && \ -+ grep -v $IGNORE_PATTERN $TARGET > .tmpver.1 && \ -+ grep -v $IGNORE_PATTERN .tmpcompile > .tmpver.2 && \ - cmp -s .tmpver.1 .tmpver.2; then - rm -f .tmpcompile - else -diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c -index bfed711258ced..1711d0b5df3a5 100644 ---- a/tools/bpf/bpftool/jit_disasm.c -+++ b/tools/bpf/bpftool/jit_disasm.c -@@ -44,11 +44,13 @@ static int fprintf_json(void *out, const char *fmt, ...) - { - va_list ap; - char *s; -+ int err; - - va_start(ap, fmt); -- if (vasprintf(&s, fmt, ap) < 0) -- return -1; -+ err = vasprintf(&s, fmt, ap); - va_end(ap); -+ if (err < 0) -+ return -1; - - if (!oper_count) { - int i; -diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c -index 1eb0bffaed6cd..8669bb85e7c7f 100644 ---- a/tools/perf/tests/bpf.c -+++ b/tools/perf/tests/bpf.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - #include - #include -+#include - #include - #include - #include -@@ -282,6 +283,7 @@ static int __test__bpf(int idx) - } - - out: -+ free(obj_buf); - bpf__clear(); - return ret; - } diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.135-136.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.135-136.patch deleted file mode 100644 index eaadbf133e..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.135-136.patch +++ /dev/null @@ -1,3619 +0,0 @@ -diff --git a/Documentation/arm64/tagged-address-abi.rst b/Documentation/arm64/tagged-address-abi.rst -index 4a9d9c794ee5d..7d255249094d0 100644 ---- a/Documentation/arm64/tagged-address-abi.rst -+++ b/Documentation/arm64/tagged-address-abi.rst -@@ -45,14 +45,24 @@ how the user addresses are used by the kernel: - - 1. User addresses not accessed by the kernel but used for address space - management (e.g. ``mprotect()``, ``madvise()``). The use of valid -- tagged pointers in this context is allowed with the exception of -- ``brk()``, ``mmap()`` and the ``new_address`` argument to -- ``mremap()`` as these have the potential to alias with existing -- user addresses. -- -- NOTE: This behaviour changed in v5.6 and so some earlier kernels may -- incorrectly accept valid tagged pointers for the ``brk()``, -- ``mmap()`` and ``mremap()`` system calls. -+ tagged pointers in this context is allowed with these exceptions: -+ -+ - ``brk()``, ``mmap()`` and the ``new_address`` argument to -+ ``mremap()`` as these have the potential to alias with existing -+ user addresses. -+ -+ NOTE: This behaviour changed in v5.6 and so some earlier kernels may -+ incorrectly accept valid tagged pointers for the ``brk()``, -+ ``mmap()`` and ``mremap()`` system calls. -+ -+ - The ``range.start``, ``start`` and ``dst`` arguments to the -+ ``UFFDIO_*`` ``ioctl()``s used on a file descriptor obtained from -+ ``userfaultfd()``, as fault addresses subsequently obtained by reading -+ the file descriptor will be untagged, which may otherwise confuse -+ tag-unaware programs. -+ -+ NOTE: This behaviour changed in v5.14 and so some earlier kernels may -+ incorrectly accept valid tagged pointers for this system call. - - 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI - relaxation is disabled by default and the application thread needs to -diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst -index 8408670d03282..3f3d1b960fe79 100644 ---- a/Documentation/trace/histogram.rst -+++ b/Documentation/trace/histogram.rst -@@ -191,7 +191,7 @@ Documentation written by Tom Zanussi - with the event, in nanoseconds. May be - modified by .usecs to have timestamps - interpreted as microseconds. -- cpu int the cpu on which the event occurred. -+ common_cpu int the cpu on which the event occurred. - ====================== ==== ======================================= - - Extended error information -diff --git a/Makefile b/Makefile -index 428ebbd039967..1c565572bfb24 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 135 -+SUBLEVEL = 136 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h -index dd10854321cac..166842337eb2c 100644 ---- a/arch/mips/include/asm/pgalloc.h -+++ b/arch/mips/include/asm/pgalloc.h -@@ -62,15 +62,11 @@ do { \ - - static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) - { -- pmd_t *pmd = NULL; -- struct page *pg; -+ pmd_t *pmd; - -- pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER); -- if (pg) { -- pgtable_pmd_page_ctor(pg); -- pmd = (pmd_t *)page_address(pg); -+ pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER); -+ if (pmd) - pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); -- } - return pmd; - } - -diff --git a/arch/nds32/mm/mmap.c b/arch/nds32/mm/mmap.c -index c206b31ce07ac..1bdf5e7d1b438 100644 ---- a/arch/nds32/mm/mmap.c -+++ b/arch/nds32/mm/mmap.c -@@ -59,7 +59,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index 9011857c0434d..bba358f134718 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -2306,8 +2306,10 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm, - HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; - if (cpu_has_feature(CPU_FTR_HVMODE)) { - vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); -+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM - if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) - vcpu->arch.hfscr |= HFSCR_TM; -+#endif - } - if (cpu_has_feature(CPU_FTR_TM_COMP)) - vcpu->arch.hfscr |= HFSCR_TM; -diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c -index 66fa2c7590aa0..9906d203d9d39 100644 ---- a/arch/powerpc/kvm/book3s_hv_nested.c -+++ b/arch/powerpc/kvm/book3s_hv_nested.c -@@ -232,6 +232,9 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) - if (vcpu->kvm->arch.l1_ptcr == 0) - return H_NOT_AVAILABLE; - -+ if (MSR_TM_TRANSACTIONAL(vcpu->arch.shregs.msr)) -+ return H_BAD_MODE; -+ - /* copy parameters in */ - hv_ptr = kvmppc_get_gpr(vcpu, 4); - err = kvm_vcpu_read_guest(vcpu, hv_ptr, &l2_hv, -@@ -253,6 +256,23 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) - if (l2_hv.vcpu_token >= NR_CPUS) - return H_PARAMETER; - -+ /* -+ * L1 must have set up a suspended state to enter the L2 in a -+ * transactional state, and only in that case. These have to be -+ * filtered out here to prevent causing a TM Bad Thing in the -+ * host HRFID. We could synthesize a TM Bad Thing back to the L1 -+ * here but there doesn't seem like much point. -+ */ -+ if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) { -+ if (!MSR_TM_ACTIVE(l2_regs.msr)) -+ return H_BAD_MODE; -+ } else { -+ if (l2_regs.msr & MSR_TS_MASK) -+ return H_BAD_MODE; -+ if (WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_TS_MASK)) -+ return H_BAD_MODE; -+ } -+ - /* translate lpid */ - l2 = kvmhv_get_nested(vcpu->kvm, l2_hv.lpid, true); - if (!l2) -diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c -index 26b25994c9697..41137ec727622 100644 ---- a/arch/powerpc/kvm/book3s_rtas.c -+++ b/arch/powerpc/kvm/book3s_rtas.c -@@ -240,6 +240,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) - * value so we can restore it on the way out. - */ - orig_rets = args.rets; -+ if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) { -+ /* -+ * Don't overflow our args array: ensure there is room for -+ * at least rets[0] (even if the call specifies 0 nret). -+ * -+ * Each handler must then check for the correct nargs and nret -+ * values, but they may always return failure in rets[0]. -+ */ -+ rc = -EINVAL; -+ goto fail; -+ } - args.rets = &args.args[be32_to_cpu(args.nargs)]; - - mutex_lock(&vcpu->kvm->arch.rtas_token_lock); -@@ -267,9 +278,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) - fail: - /* - * We only get here if the guest has called RTAS with a bogus -- * args pointer. That means we can't get to the args, and so we -- * can't fail the RTAS call. So fail right out to userspace, -- * which should kill the guest. -+ * args pointer or nargs/nret values that would overflow the -+ * array. That means we can't get to the args, and so we can't -+ * fail the RTAS call. So fail right out to userspace, which -+ * should kill the guest. -+ * -+ * SLOF should actually pass the hcall return value from the -+ * rtas handler call in r3, so enter_rtas could be modified to -+ * return a failure indication in r3 and we could return such -+ * errors to the guest rather than failing to host userspace. -+ * However old guests that don't test for failure could then -+ * continue silently after errors, so for now we won't do this. - */ - return rc; - } -diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c -index e03c064716789..8dd4d2b83677b 100644 ---- a/arch/powerpc/kvm/powerpc.c -+++ b/arch/powerpc/kvm/powerpc.c -@@ -2035,9 +2035,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, - { - struct kvm_enable_cap cap; - r = -EFAULT; -- vcpu_load(vcpu); - if (copy_from_user(&cap, argp, sizeof(cap))) - goto out; -+ vcpu_load(vcpu); - r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); - vcpu_put(vcpu); - break; -@@ -2061,9 +2061,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, - case KVM_DIRTY_TLB: { - struct kvm_dirty_tlb dirty; - r = -EFAULT; -- vcpu_load(vcpu); - if (copy_from_user(&dirty, argp, sizeof(dirty))) - goto out; -+ vcpu_load(vcpu); - r = kvm_vcpu_ioctl_dirty_tlb(vcpu, &dirty); - vcpu_put(vcpu); - break; -diff --git a/arch/s390/boot/text_dma.S b/arch/s390/boot/text_dma.S -index 9715715c4c28d..ea93314f44976 100644 ---- a/arch/s390/boot/text_dma.S -+++ b/arch/s390/boot/text_dma.S -@@ -9,16 +9,6 @@ - #include - #include - --#ifdef CC_USING_EXPOLINE -- .pushsection .dma.text.__s390_indirect_jump_r14,"axG" --__dma__s390_indirect_jump_r14: -- larl %r1,0f -- ex 0,0(%r1) -- j . --0: br %r14 -- .popsection --#endif -- - .section .dma.text,"ax" - /* - * Simplified version of expoline thunk. The normal thunks can not be used here, -@@ -27,11 +17,10 @@ __dma__s390_indirect_jump_r14: - * affects a few functions that are not performance-relevant. - */ - .macro BR_EX_DMA_r14 --#ifdef CC_USING_EXPOLINE -- jg __dma__s390_indirect_jump_r14 --#else -- br %r14 --#endif -+ larl %r1,0f -+ ex 0,0(%r1) -+ j . -+0: br %r14 - .endm - - /* -diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h -index 68d362f8d6c17..c72c179a5aae9 100644 ---- a/arch/s390/include/asm/ftrace.h -+++ b/arch/s390/include/asm/ftrace.h -@@ -27,6 +27,7 @@ void ftrace_caller(void); - - extern char ftrace_graph_caller_end; - extern unsigned long ftrace_plt; -+extern void *ftrace_func; - - struct dyn_arch_ftrace { }; - -diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c -index 1bb85f60c0dd5..7df6b2642ddb0 100644 ---- a/arch/s390/kernel/ftrace.c -+++ b/arch/s390/kernel/ftrace.c -@@ -57,6 +57,7 @@ - * > brasl %r0,ftrace_caller # offset 0 - */ - -+void *ftrace_func __read_mostly = ftrace_stub; - unsigned long ftrace_plt; - - static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn) -@@ -166,6 +167,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) - - int ftrace_update_ftrace_func(ftrace_func_t func) - { -+ ftrace_func = func; - return 0; - } - -diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S -index f942341429b1c..14bad577f5351 100644 ---- a/arch/s390/kernel/mcount.S -+++ b/arch/s390/kernel/mcount.S -@@ -61,13 +61,13 @@ ENTRY(ftrace_caller) - #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES - aghik %r2,%r0,-MCOUNT_INSN_SIZE - lgrl %r4,function_trace_op -- lgrl %r1,ftrace_trace_function -+ lgrl %r1,ftrace_func - #else - lgr %r2,%r0 - aghi %r2,-MCOUNT_INSN_SIZE - larl %r4,function_trace_op - lg %r4,0(%r4) -- larl %r1,ftrace_trace_function -+ larl %r1,ftrace_func - lg %r1,0(%r1) - #endif - lgr %r3,%r14 -diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c -index c8c16b5eed6be..e160f4650f8e4 100644 ---- a/arch/s390/net/bpf_jit_comp.c -+++ b/arch/s390/net/bpf_jit_comp.c -@@ -114,7 +114,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1) - { - u32 r1 = reg2hex[b1]; - -- if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15) -+ if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1]) - jit->seen_reg[r1] = 1; - } - -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index bf2f0373a3b2f..55745d6953f02 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -4239,8 +4239,6 @@ again: - - static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) - { -- bool need_wait; -- - dout("%s rbd_dev %p\n", __func__, rbd_dev); - lockdep_assert_held_write(&rbd_dev->lock_rwsem); - -@@ -4252,11 +4250,11 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) - */ - rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING; - rbd_assert(!completion_done(&rbd_dev->releasing_wait)); -- need_wait = !list_empty(&rbd_dev->running_list); -- downgrade_write(&rbd_dev->lock_rwsem); -- if (need_wait) -- wait_for_completion(&rbd_dev->releasing_wait); -- up_read(&rbd_dev->lock_rwsem); -+ if (list_empty(&rbd_dev->running_list)) -+ return true; -+ -+ up_write(&rbd_dev->lock_rwsem); -+ wait_for_completion(&rbd_dev->releasing_wait); - - down_write(&rbd_dev->lock_rwsem); - if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING) -@@ -4342,15 +4340,11 @@ static void rbd_handle_acquired_lock(struct rbd_device *rbd_dev, u8 struct_v, - if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { - down_write(&rbd_dev->lock_rwsem); - if (rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { -- /* -- * we already know that the remote client is -- * the owner -- */ -- up_write(&rbd_dev->lock_rwsem); -- return; -+ dout("%s rbd_dev %p cid %llu-%llu == owner_cid\n", -+ __func__, rbd_dev, cid.gid, cid.handle); -+ } else { -+ rbd_set_owner_cid(rbd_dev, &cid); - } -- -- rbd_set_owner_cid(rbd_dev, &cid); - downgrade_write(&rbd_dev->lock_rwsem); - } else { - down_read(&rbd_dev->lock_rwsem); -@@ -4375,14 +4369,12 @@ static void rbd_handle_released_lock(struct rbd_device *rbd_dev, u8 struct_v, - if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { - down_write(&rbd_dev->lock_rwsem); - if (!rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { -- dout("%s rbd_dev %p unexpected owner, cid %llu-%llu != owner_cid %llu-%llu\n", -+ dout("%s rbd_dev %p cid %llu-%llu != owner_cid %llu-%llu\n", - __func__, rbd_dev, cid.gid, cid.handle, - rbd_dev->owner_cid.gid, rbd_dev->owner_cid.handle); -- up_write(&rbd_dev->lock_rwsem); -- return; -+ } else { -+ rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); - } -- -- rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); - downgrade_write(&rbd_dev->lock_rwsem); - } else { - down_read(&rbd_dev->lock_rwsem); -diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c -index 3a2b607369151..415d7b3a59f82 100644 ---- a/drivers/firmware/efi/efi.c -+++ b/drivers/firmware/efi/efi.c -@@ -975,6 +975,7 @@ static int __init efi_memreserve_map_root(void) - static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) - { - struct resource *res, *parent; -+ int ret; - - res = kzalloc(sizeof(struct resource), GFP_ATOMIC); - if (!res) -@@ -987,7 +988,17 @@ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) - - /* we expect a conflict with a 'System RAM' region */ - parent = request_resource_conflict(&iomem_resource, res); -- return parent ? request_resource(parent, res) : 0; -+ ret = parent ? request_resource(parent, res) : 0; -+ -+ /* -+ * Given that efi_mem_reserve_iomem() can be called at any -+ * time, only call memblock_reserve() if the architecture -+ * keeps the infrastructure around. -+ */ -+ if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret) -+ memblock_reserve(addr, size); -+ -+ return ret; - } - - int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) -diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c -index c1955d320fecd..8f665678e9e39 100644 ---- a/drivers/firmware/efi/tpm.c -+++ b/drivers/firmware/efi/tpm.c -@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void) - tbl_size = sizeof(*log_tbl) + log_tbl->size; - memblock_reserve(efi.tpm_log, tbl_size); - -- if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR || -- log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { -- pr_warn(FW_BUG "TPM Final Events table missing or invalid\n"); -+ if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) { -+ pr_info("TPM Final Events table not present\n"); -+ goto out; -+ } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { -+ pr_warn(FW_BUG "TPM Final Events table invalid\n"); - goto out; - } - -diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c -index 127f8a5352019..76b6676b0106f 100644 ---- a/drivers/gpu/drm/drm_ioctl.c -+++ b/drivers/gpu/drm/drm_ioctl.c -@@ -826,6 +826,9 @@ long drm_ioctl(struct file *filp, - if (drm_dev_is_unplugged(dev)) - return -ENODEV; - -+ if (DRM_IOCTL_TYPE(cmd) != DRM_IOCTL_BASE) -+ return -ENOTTY; -+ - is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END; - - if (is_driver_ioctl) { -diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c -index 2aa89eaecf6ff..bdb4d59c81277 100644 ---- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c -+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c -@@ -453,7 +453,6 @@ static int rpi_touchscreen_remove(struct i2c_client *i2c) - drm_panel_remove(&ts->base); - - mipi_dsi_device_unregister(ts->dsi); -- kfree(ts->dsi); - - return 0; - } -diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c -index aa301c6063467..acf1cc2bee07b 100644 ---- a/drivers/iio/accel/bma180.c -+++ b/drivers/iio/accel/bma180.c -@@ -47,7 +47,7 @@ struct bma180_part_info { - - u8 int_reset_reg, int_reset_mask; - u8 sleep_reg, sleep_mask; -- u8 bw_reg, bw_mask; -+ u8 bw_reg, bw_mask, bw_offset; - u8 scale_reg, scale_mask; - u8 power_reg, power_mask, lowpower_val; - u8 int_enable_reg, int_enable_mask; -@@ -103,6 +103,7 @@ struct bma180_part_info { - - #define BMA250_RANGE_MASK GENMASK(3, 0) /* Range of accel values */ - #define BMA250_BW_MASK GENMASK(4, 0) /* Accel bandwidth */ -+#define BMA250_BW_OFFSET 8 - #define BMA250_SUSPEND_MASK BIT(7) /* chip will sleep */ - #define BMA250_LOWPOWER_MASK BIT(6) - #define BMA250_DATA_INTEN_MASK BIT(4) -@@ -241,7 +242,8 @@ static int bma180_set_bw(struct bma180_data *data, int val) - for (i = 0; i < data->part_info->num_bw; ++i) { - if (data->part_info->bw_table[i] == val) { - ret = bma180_set_bits(data, data->part_info->bw_reg, -- data->part_info->bw_mask, i); -+ data->part_info->bw_mask, -+ i + data->part_info->bw_offset); - if (ret) { - dev_err(&data->client->dev, - "failed to set bandwidth\n"); -@@ -633,32 +635,53 @@ static const struct iio_chan_spec bma250_channels[] = { - - static const struct bma180_part_info bma180_part_info[] = { - [BMA180] = { -- bma180_channels, ARRAY_SIZE(bma180_channels), -- bma180_scale_table, ARRAY_SIZE(bma180_scale_table), -- bma180_bw_table, ARRAY_SIZE(bma180_bw_table), -- BMA180_CTRL_REG0, BMA180_RESET_INT, -- BMA180_CTRL_REG0, BMA180_SLEEP, -- BMA180_BW_TCS, BMA180_BW, -- BMA180_OFFSET_LSB1, BMA180_RANGE, -- BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER, -- BMA180_CTRL_REG3, BMA180_NEW_DATA_INT, -- BMA180_RESET, -- bma180_chip_config, -- bma180_chip_disable, -+ .channels = bma180_channels, -+ .num_channels = ARRAY_SIZE(bma180_channels), -+ .scale_table = bma180_scale_table, -+ .num_scales = ARRAY_SIZE(bma180_scale_table), -+ .bw_table = bma180_bw_table, -+ .num_bw = ARRAY_SIZE(bma180_bw_table), -+ .int_reset_reg = BMA180_CTRL_REG0, -+ .int_reset_mask = BMA180_RESET_INT, -+ .sleep_reg = BMA180_CTRL_REG0, -+ .sleep_mask = BMA180_SLEEP, -+ .bw_reg = BMA180_BW_TCS, -+ .bw_mask = BMA180_BW, -+ .scale_reg = BMA180_OFFSET_LSB1, -+ .scale_mask = BMA180_RANGE, -+ .power_reg = BMA180_TCO_Z, -+ .power_mask = BMA180_MODE_CONFIG, -+ .lowpower_val = BMA180_LOW_POWER, -+ .int_enable_reg = BMA180_CTRL_REG3, -+ .int_enable_mask = BMA180_NEW_DATA_INT, -+ .softreset_reg = BMA180_RESET, -+ .chip_config = bma180_chip_config, -+ .chip_disable = bma180_chip_disable, - }, - [BMA250] = { -- bma250_channels, ARRAY_SIZE(bma250_channels), -- bma250_scale_table, ARRAY_SIZE(bma250_scale_table), -- bma250_bw_table, ARRAY_SIZE(bma250_bw_table), -- BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK, -- BMA250_POWER_REG, BMA250_SUSPEND_MASK, -- BMA250_BW_REG, BMA250_BW_MASK, -- BMA250_RANGE_REG, BMA250_RANGE_MASK, -- BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1, -- BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK, -- BMA250_RESET_REG, -- bma250_chip_config, -- bma250_chip_disable, -+ .channels = bma250_channels, -+ .num_channels = ARRAY_SIZE(bma250_channels), -+ .scale_table = bma250_scale_table, -+ .num_scales = ARRAY_SIZE(bma250_scale_table), -+ .bw_table = bma250_bw_table, -+ .num_bw = ARRAY_SIZE(bma250_bw_table), -+ .int_reset_reg = BMA250_INT_RESET_REG, -+ .int_reset_mask = BMA250_INT_RESET_MASK, -+ .sleep_reg = BMA250_POWER_REG, -+ .sleep_mask = BMA250_SUSPEND_MASK, -+ .bw_reg = BMA250_BW_REG, -+ .bw_mask = BMA250_BW_MASK, -+ .bw_offset = BMA250_BW_OFFSET, -+ .scale_reg = BMA250_RANGE_REG, -+ .scale_mask = BMA250_RANGE_MASK, -+ .power_reg = BMA250_POWER_REG, -+ .power_mask = BMA250_LOWPOWER_MASK, -+ .lowpower_val = 1, -+ .int_enable_reg = BMA250_INT_ENABLE_REG, -+ .int_enable_mask = BMA250_DATA_INTEN_MASK, -+ .softreset_reg = BMA250_RESET_REG, -+ .chip_config = bma250_chip_config, -+ .chip_disable = bma250_chip_disable, - }, - }; - -diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c -index af15ca1c501bf..919b297e645c5 100644 ---- a/drivers/media/pci/ngene/ngene-core.c -+++ b/drivers/media/pci/ngene/ngene-core.c -@@ -385,7 +385,7 @@ static int ngene_command_config_free_buf(struct ngene *dev, u8 *config) - - com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER; - com.cmd.hdr.Length = 6; -- memcpy(&com.cmd.ConfigureBuffers.config, config, 6); -+ memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6); - com.in_len = 6; - com.out_len = 0; - -diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h -index 84f04e0e0cb9a..3d296f1998a1a 100644 ---- a/drivers/media/pci/ngene/ngene.h -+++ b/drivers/media/pci/ngene/ngene.h -@@ -407,12 +407,14 @@ enum _BUFFER_CONFIGS { - - struct FW_CONFIGURE_FREE_BUFFERS { - struct FW_HEADER hdr; -- u8 UVI1_BufferLength; -- u8 UVI2_BufferLength; -- u8 TVO_BufferLength; -- u8 AUD1_BufferLength; -- u8 AUD2_BufferLength; -- u8 TVA_BufferLength; -+ struct { -+ u8 UVI1_BufferLength; -+ u8 UVI2_BufferLength; -+ u8 TVO_BufferLength; -+ u8 AUD1_BufferLength; -+ u8 AUD2_BufferLength; -+ u8 TVA_BufferLength; -+ } __packed config; - } __attribute__ ((__packed__)); - - struct FW_CONFIGURE_UART { -diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c -index 8aa8825557a81..40b105daaf9e7 100644 ---- a/drivers/net/dsa/mv88e6xxx/chip.c -+++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3192,7 +3192,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { - .port_set_cmode = mv88e6341_port_set_cmode, - .port_setup_message_port = mv88e6xxx_setup_message_port, - .stats_snapshot = mv88e6390_g1_stats_snapshot, -- .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -+ .stats_set_histogram = mv88e6390_g1_stats_set_histogram, - .stats_get_sset_count = mv88e6320_stats_get_sset_count, - .stats_get_strings = mv88e6320_stats_get_strings, - .stats_get_stats = mv88e6390_stats_get_stats, -@@ -3907,7 +3907,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { - .port_set_cmode = mv88e6341_port_set_cmode, - .port_setup_message_port = mv88e6xxx_setup_message_port, - .stats_snapshot = mv88e6390_g1_stats_snapshot, -- .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -+ .stats_set_histogram = mv88e6390_g1_stats_set_histogram, - .stats_get_sset_count = mv88e6320_stats_get_sset_count, - .stats_get_strings = mv88e6320_stats_get_strings, - .stats_get_stats = mv88e6390_stats_get_stats, -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -index d1c3939b0307f..287ea792922a9 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -@@ -9239,6 +9239,12 @@ int bnxt_half_open_nic(struct bnxt *bp) - { - int rc = 0; - -+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { -+ netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n"); -+ rc = -ENODEV; -+ goto half_open_err; -+ } -+ - rc = bnxt_alloc_mem(bp, false); - if (rc) { - netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); -@@ -9987,12 +9993,15 @@ static void bnxt_reset_task(struct bnxt *bp, bool silent) - if (netif_running(bp->dev)) { - int rc; - -- if (!silent) -+ if (silent) { -+ bnxt_close_nic(bp, false, false); -+ bnxt_open_nic(bp, false, false); -+ } else { - bnxt_ulp_stop(bp); -- bnxt_close_nic(bp, false, false); -- rc = bnxt_open_nic(bp, false, false); -- if (!silent && !rc) -- bnxt_ulp_start(bp); -+ bnxt_close_nic(bp, true, false); -+ rc = bnxt_open_nic(bp, true, false); -+ bnxt_ulp_start(bp, rc); -+ } - } - } - -@@ -10732,6 +10741,10 @@ static void bnxt_fw_reset_task(struct work_struct *work) - } - bp->fw_reset_timestamp = jiffies; - rtnl_lock(); -+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { -+ rtnl_unlock(); -+ goto fw_reset_abort; -+ } - bnxt_fw_reset_close(bp); - if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) { - bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN; -@@ -12144,10 +12157,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) - if (!err && netif_running(netdev)) - err = bnxt_open(netdev); - -- if (!err) { -+ if (!err) - result = PCI_ERS_RESULT_RECOVERED; -- bnxt_ulp_start(bp); -- } -+ bnxt_ulp_start(bp, err); - } - - if (result != PCI_ERS_RESULT_RECOVERED) { -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c -index 13ef6a9afaa09..b0ae180df4e6f 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c -@@ -186,7 +186,7 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id) - - edev->ulp_tbl[ulp_id].msix_requested = 0; - edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED; -- if (netif_running(dev)) { -+ if (netif_running(dev) && !(edev->flags & BNXT_EN_FLAG_ULP_STOPPED)) { - bnxt_close_nic(bp, true, false); - bnxt_open_nic(bp, true, false); - } -@@ -274,6 +274,7 @@ void bnxt_ulp_stop(struct bnxt *bp) - if (!edev) - return; - -+ edev->flags |= BNXT_EN_FLAG_ULP_STOPPED; - for (i = 0; i < BNXT_MAX_ULP; i++) { - struct bnxt_ulp *ulp = &edev->ulp_tbl[i]; - -@@ -284,7 +285,7 @@ void bnxt_ulp_stop(struct bnxt *bp) - } - } - --void bnxt_ulp_start(struct bnxt *bp) -+void bnxt_ulp_start(struct bnxt *bp, int err) - { - struct bnxt_en_dev *edev = bp->edev; - struct bnxt_ulp_ops *ops; -@@ -293,6 +294,11 @@ void bnxt_ulp_start(struct bnxt *bp) - if (!edev) - return; - -+ edev->flags &= ~BNXT_EN_FLAG_ULP_STOPPED; -+ -+ if (err) -+ return; -+ - for (i = 0; i < BNXT_MAX_ULP; i++) { - struct bnxt_ulp *ulp = &edev->ulp_tbl[i]; - -@@ -467,13 +473,14 @@ struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev) - if (!edev) - return ERR_PTR(-ENOMEM); - edev->en_ops = &bnxt_en_ops_tbl; -- if (bp->flags & BNXT_FLAG_ROCEV1_CAP) -- edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; -- if (bp->flags & BNXT_FLAG_ROCEV2_CAP) -- edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; - edev->net = dev; - edev->pdev = bp->pdev; - bp->edev = edev; - } -+ edev->flags &= ~BNXT_EN_FLAG_ROCE_CAP; -+ if (bp->flags & BNXT_FLAG_ROCEV1_CAP) -+ edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; -+ if (bp->flags & BNXT_FLAG_ROCEV2_CAP) -+ edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; - return bp->edev; - } -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h -index cd78453d0bf0f..9895406b98308 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h -@@ -64,6 +64,7 @@ struct bnxt_en_dev { - #define BNXT_EN_FLAG_ROCE_CAP (BNXT_EN_FLAG_ROCEV1_CAP | \ - BNXT_EN_FLAG_ROCEV2_CAP) - #define BNXT_EN_FLAG_MSIX_REQUESTED 0x4 -+ #define BNXT_EN_FLAG_ULP_STOPPED 0x8 - const struct bnxt_en_ops *en_ops; - struct bnxt_ulp ulp_tbl[BNXT_MAX_ULP]; - }; -@@ -92,7 +93,7 @@ int bnxt_get_ulp_msix_num(struct bnxt *bp); - int bnxt_get_ulp_msix_base(struct bnxt *bp); - int bnxt_get_ulp_stat_ctxs(struct bnxt *bp); - void bnxt_ulp_stop(struct bnxt *bp); --void bnxt_ulp_start(struct bnxt *bp); -+void bnxt_ulp_start(struct bnxt *bp, int err); - void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs); - void bnxt_ulp_shutdown(struct bnxt *bp); - void bnxt_ulp_irq_stop(struct bnxt *bp); -diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -index 7bd6d2bf84408..c2a1fa75b2147 100644 ---- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c -+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -1187,7 +1187,8 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, - - switch (mode) { - case GENET_POWER_PASSIVE: -- reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS); -+ reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS | -+ EXT_ENERGY_DET_MASK); - if (GENET_IS_V5(priv)) { - reg &= ~(EXT_PWR_DOWN_PHY_EN | - EXT_PWR_DOWN_PHY_RD | -@@ -2901,12 +2902,6 @@ static int bcmgenet_open(struct net_device *dev) - - bcmgenet_set_hw_addr(priv, dev->dev_addr); - -- if (priv->internal_phy) { -- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); -- reg |= EXT_ENERGY_DET_MASK; -- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); -- } -- - /* Disable RX/TX DMA and flush TX queues */ - dma_ctrl = bcmgenet_dma_disable(priv); - -@@ -3623,7 +3618,6 @@ static int bcmgenet_resume(struct device *d) - struct bcmgenet_priv *priv = netdev_priv(dev); - unsigned long dma_ctrl; - int ret; -- u32 reg; - - if (!netif_running(dev)) - return 0; -@@ -3655,12 +3649,6 @@ static int bcmgenet_resume(struct device *d) - - bcmgenet_set_hw_addr(priv, dev->dev_addr); - -- if (priv->internal_phy) { -- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); -- reg |= EXT_ENERGY_DET_MASK; -- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); -- } -- - if (priv->wolopts) - bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC); - -diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c -index a41f82379369a..164988f3b4fab 100644 ---- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c -+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c -@@ -160,12 +160,6 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, - reg |= CMD_RX_EN; - bcmgenet_umac_writel(priv, reg, UMAC_CMD); - -- if (priv->hw_params->flags & GENET_HAS_EXT) { -- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); -- reg &= ~EXT_ENERGY_DET_MASK; -- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); -- } -- - return 0; - } - -diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c -index 4cddd628d41b2..9ed3d1ab2ca58 100644 ---- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c -+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c -@@ -420,7 +420,7 @@ static int cn23xx_pf_setup_global_input_regs(struct octeon_device *oct) - * bits 32:47 indicate the PVF num. - */ - for (q_no = 0; q_no < ern; q_no++) { -- reg_val = oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; -+ reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; - - /* for VF assigned queues. */ - if (q_no < oct->sriov_info.pf_srn) { -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -index deb1c1f301078..21414a34a5b5a 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c -@@ -2245,6 +2245,9 @@ static void detach_ulds(struct adapter *adap) - { - unsigned int i; - -+ if (!is_uld(adap)) -+ return; -+ - mutex_lock(&uld_mutex); - list_del(&adap->list_node); - -@@ -6152,10 +6155,13 @@ static void remove_one(struct pci_dev *pdev) - */ - destroy_workqueue(adapter->workq); - -- if (is_uld(adapter)) { -- detach_ulds(adapter); -- t4_uld_clean_up(adapter); -- } -+ detach_ulds(adapter); -+ -+ for_each_port(adapter, i) -+ if (adapter->port[i]->reg_state == NETREG_REGISTERED) -+ unregister_netdev(adapter->port[i]); -+ -+ t4_uld_clean_up(adapter); - - adap_free_hma_mem(adapter); - -@@ -6163,10 +6169,6 @@ static void remove_one(struct pci_dev *pdev) - - cxgb4_free_mps_ref_entries(adapter); - -- for_each_port(adapter, i) -- if (adapter->port[i]->reg_state == NETREG_REGISTERED) -- unregister_netdev(adapter->port[i]); -- - debugfs_remove_recursive(adapter->debugfs_root); - - if (!is_t4(adapter->params.chip)) -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c -index 86b528d8364c0..971bdd70b6d66 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c -@@ -638,6 +638,9 @@ void t4_uld_clean_up(struct adapter *adap) - { - unsigned int i; - -+ if (!is_uld(adap)) -+ return; -+ - mutex_lock(&uld_mutex); - for (i = 0; i < CXGB4_ULD_MAX; i++) { - if (!adap->uld[i].handle) -diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c -index 1c4b35b1b3590..f8dfa7501f65a 100644 ---- a/drivers/net/ethernet/google/gve/gve_main.c -+++ b/drivers/net/ethernet/google/gve/gve_main.c -@@ -1170,13 +1170,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - - err = register_netdev(dev); - if (err) -- goto abort_with_wq; -+ goto abort_with_gve_init; - - dev_info(&pdev->dev, "GVE version %s\n", gve_version_str); - gve_clear_probe_in_progress(priv); - queue_work(priv->gve_wq, &priv->service_task); - return 0; - -+abort_with_gve_init: -+ gve_teardown_priv_resources(priv); -+ - abort_with_wq: - destroy_workqueue(priv->gve_wq); - -diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c -index 2ffe035e96d6e..b5eae06dd8705 100644 ---- a/drivers/net/ethernet/hisilicon/hip04_eth.c -+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c -@@ -131,7 +131,7 @@ - /* buf unit size is cache_line_size, which is 64, so the shift is 6 */ - #define PPE_BUF_SIZE_SHIFT 6 - #define PPE_TX_BUF_HOLD BIT(31) --#define CACHE_LINE_MASK 0x3F -+#define SOC_CACHE_LINE_MASK 0x3F - #else - #define PPE_CFG_QOS_VMID_GRP_SHIFT 8 - #define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 -@@ -531,8 +531,8 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) - #if defined(CONFIG_HI13X1_GMAC) - desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV - | TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT); -- desc->data_offset = (__force u32)cpu_to_be32(phys & CACHE_LINE_MASK); -- desc->send_addr = (__force u32)cpu_to_be32(phys & ~CACHE_LINE_MASK); -+ desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK); -+ desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK); - #else - desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV); - desc->send_addr = (__force u32)cpu_to_be32(phys); -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index fc275d4f484c5..ea348ebbbf2e9 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -2119,6 +2119,16 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) - - static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev) - { -+ struct hnae3_handle *nic = &hdev->nic; -+ int ret; -+ -+ ret = hclgevf_en_hw_strip_rxvtag(nic, true); -+ if (ret) { -+ dev_err(&hdev->pdev->dev, -+ "failed to enable rx vlan offload, ret = %d\n", ret); -+ return ret; -+ } -+ - return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0, - false); - } -diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c -index a06d514215ede..cbd83bb5c1ac0 100644 ---- a/drivers/net/ethernet/intel/e1000e/netdev.c -+++ b/drivers/net/ethernet/intel/e1000e/netdev.c -@@ -7401,6 +7401,7 @@ err_flashmap: - err_ioremap: - free_netdev(netdev); - err_alloc_etherdev: -+ pci_disable_pcie_error_reporting(pdev); - pci_release_mem_regions(pdev); - err_pci_reg: - err_dma: -diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c -index bb236fa440487..36b016308c62f 100644 ---- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c -+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c -@@ -2230,6 +2230,7 @@ err_sw_init: - err_ioremap: - free_netdev(netdev); - err_alloc_netdev: -+ pci_disable_pcie_error_reporting(pdev); - pci_release_mem_regions(pdev); - err_pci_reg: - err_dma: -diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c -index a97e1f9ca1ede..cda9b9a8392a2 100644 ---- a/drivers/net/ethernet/intel/iavf/iavf_main.c -+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c -@@ -3765,6 +3765,7 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - err_ioremap: - free_netdev(netdev); - err_alloc_etherdev: -+ pci_disable_pcie_error_reporting(pdev); - pci_release_regions(pdev); - err_pci_reg: - err_dma: -diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c -index c37f0590b3a4d..158feb0ab2739 100644 ---- a/drivers/net/ethernet/intel/igb/igb_main.c -+++ b/drivers/net/ethernet/intel/igb/igb_main.c -@@ -940,6 +940,7 @@ static void igb_configure_msix(struct igb_adapter *adapter) - **/ - static int igb_request_msix(struct igb_adapter *adapter) - { -+ unsigned int num_q_vectors = adapter->num_q_vectors; - struct net_device *netdev = adapter->netdev; - int i, err = 0, vector = 0, free_vector = 0; - -@@ -948,7 +949,13 @@ static int igb_request_msix(struct igb_adapter *adapter) - if (err) - goto err_out; - -- for (i = 0; i < adapter->num_q_vectors; i++) { -+ if (num_q_vectors > MAX_Q_VECTORS) { -+ num_q_vectors = MAX_Q_VECTORS; -+ dev_warn(&adapter->pdev->dev, -+ "The number of queue vectors (%d) is higher than max allowed (%d)\n", -+ adapter->num_q_vectors, MAX_Q_VECTORS); -+ } -+ for (i = 0; i < num_q_vectors; i++) { - struct igb_q_vector *q_vector = adapter->q_vector[i]; - - vector++; -@@ -1687,14 +1694,15 @@ static bool is_any_txtime_enabled(struct igb_adapter *adapter) - **/ - static void igb_config_tx_modes(struct igb_adapter *adapter, int queue) - { -- struct igb_ring *ring = adapter->tx_ring[queue]; - struct net_device *netdev = adapter->netdev; - struct e1000_hw *hw = &adapter->hw; -+ struct igb_ring *ring; - u32 tqavcc, tqavctrl; - u16 value; - - WARN_ON(hw->mac.type != e1000_i210); - WARN_ON(queue < 0 || queue > 1); -+ ring = adapter->tx_ring[queue]; - - /* If any of the Qav features is enabled, configure queues as SR and - * with HIGH PRIO. If none is, then configure them with LOW PRIO and -@@ -3469,6 +3477,7 @@ err_sw_init: - err_ioremap: - free_netdev(netdev); - err_alloc_etherdev: -+ pci_disable_pcie_error_reporting(pdev); - pci_release_mem_regions(pdev); - err_pci_reg: - err_dma: -@@ -4657,6 +4666,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring) - DMA_TO_DEVICE); - } - -+ tx_buffer->next_to_watch = NULL; -+ - /* move us one more past the eop_desc for start of next pkt */ - tx_buffer++; - i++; -diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h -index 7e16345d836e1..aec998c82b694 100644 ---- a/drivers/net/ethernet/intel/igc/igc.h -+++ b/drivers/net/ethernet/intel/igc/igc.h -@@ -504,7 +504,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data) - if (hw->phy.ops.read_reg) - return hw->phy.ops.read_reg(hw, offset, data); - -- return 0; -+ return -EOPNOTSUPP; - } - - /* forward declaration */ -diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c -index 6b43e1c5b1c3e..084cf4a4114ad 100644 ---- a/drivers/net/ethernet/intel/igc/igc_main.c -+++ b/drivers/net/ethernet/intel/igc/igc_main.c -@@ -256,6 +256,8 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring) - DMA_TO_DEVICE); - } - -+ tx_buffer->next_to_watch = NULL; -+ - /* move us one more past the eop_desc for start of next pkt */ - tx_buffer++; - i++; -@@ -4310,8 +4312,8 @@ err_sw_init: - err_ioremap: - free_netdev(netdev); - err_alloc_etherdev: -- pci_release_selected_regions(pdev, -- pci_select_bars(pdev, IORESOURCE_MEM)); -+ pci_disable_pcie_error_reporting(pdev); -+ pci_release_mem_regions(pdev); - err_pci_reg: - err_dma: - pci_disable_device(pdev); -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index 1b8e70585c44a..8a894e5d923f0 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -1827,7 +1827,8 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, - struct sk_buff *skb) - { - if (ring_uses_build_skb(rx_ring)) { -- unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK; -+ unsigned long mask = (unsigned long)ixgbe_rx_pg_size(rx_ring) - 1; -+ unsigned long offset = (unsigned long)(skb->data) & mask; - - dma_sync_single_range_for_cpu(rx_ring->dev, - IXGBE_CB(skb)->dma, -@@ -11207,6 +11208,7 @@ err_ioremap: - disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); - free_netdev(netdev); - err_alloc_etherdev: -+ pci_disable_pcie_error_reporting(pdev); - pci_release_mem_regions(pdev); - err_pci_reg: - err_dma: -diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c -index 5969f64169e53..fb51548c57e94 100644 ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -6850,7 +6850,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) - new_bus->priv = tp; - new_bus->parent = &pdev->dev; - new_bus->irq[0] = PHY_IGNORE_INTERRUPT; -- snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); -+ snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", -+ pci_domain_nr(pdev->bus), pci_dev_id(pdev)); - - new_bus->read = r8169_mdio_read_reg; - new_bus->write = r8169_mdio_write_reg; -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 710ab45eb679d..a5b5a2305791d 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -694,7 +694,10 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns, - cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); - cmnd->write_zeroes.length = - cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1); -- cmnd->write_zeroes.control = 0; -+ if (nvme_ns_has_pi(ns)) -+ cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT); -+ else -+ cmnd->write_zeroes.control = 0; - return BLK_STS_OK; - } - -diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c -index 2cb2ead7615b2..af516c35afe6f 100644 ---- a/drivers/nvme/host/pci.c -+++ b/drivers/nvme/host/pci.c -@@ -2590,7 +2590,9 @@ static void nvme_reset_work(struct work_struct *work) - bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); - int result; - -- if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { -+ if (dev->ctrl.state != NVME_CTRL_RESETTING) { -+ dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n", -+ dev->ctrl.state); - result = -ENODEV; - goto out; - } -@@ -2954,7 +2956,6 @@ static void nvme_remove(struct pci_dev *pdev) - if (!pci_device_is_present(pdev)) { - nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD); - nvme_dev_disable(dev, true); -- nvme_dev_remove_admin(dev); - } - - flush_work(&dev->ctrl.reset_work); -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 3fe9a6f61f85c..6c1b936a94fac 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -5312,7 +5312,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); - static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) - { - if ((pdev->device == 0x7312 && pdev->revision != 0x00) || -- (pdev->device == 0x7340 && pdev->revision != 0xc5)) -+ (pdev->device == 0x7340 && pdev->revision != 0xc5) || -+ (pdev->device == 0x7341 && pdev->revision != 0x00)) - return; - - pci_info(pdev, "disabling ATS\n"); -@@ -5327,6 +5328,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats); - /* AMD Navi14 dGPU */ - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats); - #endif /* CONFIG_PCI_ATS */ - - /* Freescale PCIe doesn't support MSI in RC mode */ -diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c -index be23942274231..892d853d48a1a 100644 ---- a/drivers/pwm/pwm-sprd.c -+++ b/drivers/pwm/pwm-sprd.c -@@ -180,13 +180,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, - } - } - -- if (state->period != cstate->period || -- state->duty_cycle != cstate->duty_cycle) { -- ret = sprd_pwm_config(spc, pwm, state->duty_cycle, -- state->period); -- if (ret) -- return ret; -- } -+ ret = sprd_pwm_config(spc, pwm, state->duty_cycle, -+ state->period); -+ if (ret) -+ return ret; - - sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1); - } else if (cstate->enabled) { -diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c -index 5ac3d7c29725a..efc91b03a9bbc 100644 ---- a/drivers/regulator/hi6421-regulator.c -+++ b/drivers/regulator/hi6421-regulator.c -@@ -366,9 +366,8 @@ static struct hi6421_regulator_info - - static int hi6421_regulator_enable(struct regulator_dev *rdev) - { -- struct hi6421_regulator_pdata *pdata; -+ struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev); - -- pdata = dev_get_drvdata(rdev->dev.parent); - /* hi6421 spec requires regulator enablement must be serialized: - * - Because when BUCK, LDO switching from off to on, it will have - * a huge instantaneous current; so you can not turn on two or -@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) - - static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) - { -- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); -- u32 reg_val; -+ struct hi6421_regulator_info *info; -+ unsigned int reg_val; - -+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); - regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val); - if (reg_val & info->mode_mask) - return REGULATOR_MODE_IDLE; -@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) - - static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) - { -- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); -- u32 reg_val; -+ struct hi6421_regulator_info *info; -+ unsigned int reg_val; - -+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); - regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val); - if (reg_val & info->mode_mask) - return REGULATOR_MODE_STANDBY; -@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) - static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, - unsigned int mode) - { -- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); -- u32 new_mode; -+ struct hi6421_regulator_info *info; -+ unsigned int new_mode; - -+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); - switch (mode) { - case REGULATOR_MODE_NORMAL: - new_mode = 0; -@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, - static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, - unsigned int mode) - { -- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); -- u32 new_mode; -+ struct hi6421_regulator_info *info; -+ unsigned int new_mode; - -+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); - switch (mode) { - case REGULATOR_MODE_NORMAL: - new_mode = 0; -@@ -459,7 +462,9 @@ static unsigned int - hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, - int input_uV, int output_uV, int load_uA) - { -- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); -+ struct hi6421_regulator_info *info; -+ -+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); - - if (load_uA > info->eco_microamp) - return REGULATOR_MODE_NORMAL; -@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev) - if (!pdata) - return -ENOMEM; - mutex_init(&pdata->lock); -- platform_set_drvdata(pdev, pdata); - - for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) { - /* assign per-regulator data */ - info = &hi6421_regulator_info[i]; - - config.dev = pdev->dev.parent; -- config.driver_data = info; -+ config.driver_data = pdata; - config.regmap = pmic->regmap; - - rdev = devm_regulator_register(&pdev->dev, &info->desc, -diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c -index 2f1553d0a10ed..77bba91b57147 100644 ---- a/drivers/scsi/scsi_transport_iscsi.c -+++ b/drivers/scsi/scsi_transport_iscsi.c -@@ -432,39 +432,10 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, - struct device *dev = container_of(kobj, struct device, kobj); - struct iscsi_iface *iface = iscsi_dev_to_iface(dev); - struct iscsi_transport *t = iface->transport; -- int param; -- int param_type; -+ int param = -1; - - if (attr == &dev_attr_iface_enabled.attr) - param = ISCSI_NET_PARAM_IFACE_ENABLE; -- else if (attr == &dev_attr_iface_vlan_id.attr) -- param = ISCSI_NET_PARAM_VLAN_ID; -- else if (attr == &dev_attr_iface_vlan_priority.attr) -- param = ISCSI_NET_PARAM_VLAN_PRIORITY; -- else if (attr == &dev_attr_iface_vlan_enabled.attr) -- param = ISCSI_NET_PARAM_VLAN_ENABLED; -- else if (attr == &dev_attr_iface_mtu.attr) -- param = ISCSI_NET_PARAM_MTU; -- else if (attr == &dev_attr_iface_port.attr) -- param = ISCSI_NET_PARAM_PORT; -- else if (attr == &dev_attr_iface_ipaddress_state.attr) -- param = ISCSI_NET_PARAM_IPADDR_STATE; -- else if (attr == &dev_attr_iface_delayed_ack_en.attr) -- param = ISCSI_NET_PARAM_DELAYED_ACK_EN; -- else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) -- param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; -- else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) -- param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; -- else if (attr == &dev_attr_iface_tcp_wsf.attr) -- param = ISCSI_NET_PARAM_TCP_WSF; -- else if (attr == &dev_attr_iface_tcp_timer_scale.attr) -- param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; -- else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) -- param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; -- else if (attr == &dev_attr_iface_cache_id.attr) -- param = ISCSI_NET_PARAM_CACHE_ID; -- else if (attr == &dev_attr_iface_redirect_en.attr) -- param = ISCSI_NET_PARAM_REDIRECT_EN; - else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) - param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; - else if (attr == &dev_attr_iface_header_digest.attr) -@@ -501,6 +472,38 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, - param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN; - else if (attr == &dev_attr_iface_initiator_name.attr) - param = ISCSI_IFACE_PARAM_INITIATOR_NAME; -+ -+ if (param != -1) -+ return t->attr_is_visible(ISCSI_IFACE_PARAM, param); -+ -+ if (attr == &dev_attr_iface_vlan_id.attr) -+ param = ISCSI_NET_PARAM_VLAN_ID; -+ else if (attr == &dev_attr_iface_vlan_priority.attr) -+ param = ISCSI_NET_PARAM_VLAN_PRIORITY; -+ else if (attr == &dev_attr_iface_vlan_enabled.attr) -+ param = ISCSI_NET_PARAM_VLAN_ENABLED; -+ else if (attr == &dev_attr_iface_mtu.attr) -+ param = ISCSI_NET_PARAM_MTU; -+ else if (attr == &dev_attr_iface_port.attr) -+ param = ISCSI_NET_PARAM_PORT; -+ else if (attr == &dev_attr_iface_ipaddress_state.attr) -+ param = ISCSI_NET_PARAM_IPADDR_STATE; -+ else if (attr == &dev_attr_iface_delayed_ack_en.attr) -+ param = ISCSI_NET_PARAM_DELAYED_ACK_EN; -+ else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) -+ param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; -+ else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) -+ param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; -+ else if (attr == &dev_attr_iface_tcp_wsf.attr) -+ param = ISCSI_NET_PARAM_TCP_WSF; -+ else if (attr == &dev_attr_iface_tcp_timer_scale.attr) -+ param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; -+ else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) -+ param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; -+ else if (attr == &dev_attr_iface_cache_id.attr) -+ param = ISCSI_NET_PARAM_CACHE_ID; -+ else if (attr == &dev_attr_iface_redirect_en.attr) -+ param = ISCSI_NET_PARAM_REDIRECT_EN; - else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { - if (attr == &dev_attr_ipv4_iface_ipaddress.attr) - param = ISCSI_NET_PARAM_IPV4_ADDR; -@@ -591,32 +594,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, - return 0; - } - -- switch (param) { -- case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: -- case ISCSI_IFACE_PARAM_HDRDGST_EN: -- case ISCSI_IFACE_PARAM_DATADGST_EN: -- case ISCSI_IFACE_PARAM_IMM_DATA_EN: -- case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: -- case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: -- case ISCSI_IFACE_PARAM_PDU_INORDER_EN: -- case ISCSI_IFACE_PARAM_ERL: -- case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: -- case ISCSI_IFACE_PARAM_FIRST_BURST: -- case ISCSI_IFACE_PARAM_MAX_R2T: -- case ISCSI_IFACE_PARAM_MAX_BURST: -- case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: -- case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: -- case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: -- case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: -- case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: -- case ISCSI_IFACE_PARAM_INITIATOR_NAME: -- param_type = ISCSI_IFACE_PARAM; -- break; -- default: -- param_type = ISCSI_NET_PARAM; -- } -- -- return t->attr_is_visible(param_type, param); -+ return t->attr_is_visible(ISCSI_NET_PARAM, param); - } - - static struct attribute *iscsi_iface_attrs[] = { -diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c -index 1d0c335b0bf88..5ac60d06c674d 100644 ---- a/drivers/spi/spi-cadence.c -+++ b/drivers/spi/spi-cadence.c -@@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev) - goto clk_dis_apb; - } - -+ pm_runtime_use_autosuspend(&pdev->dev); -+ pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); -+ pm_runtime_get_noresume(&pdev->dev); -+ pm_runtime_set_active(&pdev->dev); -+ pm_runtime_enable(&pdev->dev); -+ - ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); - if (ret < 0) - master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; -@@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev) - /* SPI controller initializations */ - cdns_spi_init_hw(xspi); - -- pm_runtime_set_active(&pdev->dev); -- pm_runtime_enable(&pdev->dev); -- pm_runtime_use_autosuspend(&pdev->dev); -- pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); -- - irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - ret = -ENXIO; -@@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev) - - master->bits_per_word_mask = SPI_BPW_MASK(8); - -+ pm_runtime_mark_last_busy(&pdev->dev); -+ pm_runtime_put_autosuspend(&pdev->dev); -+ - ret = spi_register_master(master); - if (ret) { - dev_err(&pdev->dev, "spi_register_master failed\n"); -diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c -index 09c9a1edb2c6d..e237481dbbbbf 100644 ---- a/drivers/spi/spi-imx.c -+++ b/drivers/spi/spi-imx.c -@@ -64,8 +64,7 @@ struct spi_imx_data; - struct spi_imx_devtype_data { - void (*intctrl)(struct spi_imx_data *, int); - int (*prepare_message)(struct spi_imx_data *, struct spi_message *); -- int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *, -- struct spi_transfer *); -+ int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *); - void (*trigger)(struct spi_imx_data *); - int (*rx_available)(struct spi_imx_data *); - void (*reset)(struct spi_imx_data *); -@@ -564,11 +563,10 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, - } - - static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, -- struct spi_device *spi, -- struct spi_transfer *t) -+ struct spi_device *spi) - { - u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); -- u32 clk = t->speed_hz, delay; -+ u32 clk, delay; - - /* Clear BL field and set the right value */ - ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; -@@ -582,7 +580,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, - /* set clock speed */ - ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET | - 0xf << MX51_ECSPI_CTRL_PREDIV_OFFSET); -- ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk); -+ ctrl |= mx51_ecspi_clkdiv(spi_imx, spi_imx->spi_bus_clk, &clk); - spi_imx->spi_bus_clk = clk; - - if (spi_imx->usedma) -@@ -694,13 +692,12 @@ static int mx31_prepare_message(struct spi_imx_data *spi_imx, - } - - static int mx31_prepare_transfer(struct spi_imx_data *spi_imx, -- struct spi_device *spi, -- struct spi_transfer *t) -+ struct spi_device *spi) - { - unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; - unsigned int clk; - -- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) << -+ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) << - MX31_CSPICTRL_DR_SHIFT; - spi_imx->spi_bus_clk = clk; - -@@ -799,14 +796,13 @@ static int mx21_prepare_message(struct spi_imx_data *spi_imx, - } - - static int mx21_prepare_transfer(struct spi_imx_data *spi_imx, -- struct spi_device *spi, -- struct spi_transfer *t) -+ struct spi_device *spi) - { - unsigned int reg = MX21_CSPICTRL_ENABLE | MX21_CSPICTRL_MASTER; - unsigned int max = is_imx27_cspi(spi_imx) ? 16 : 18; - unsigned int clk; - -- reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, t->speed_hz, max, &clk) -+ reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, spi_imx->spi_bus_clk, max, &clk) - << MX21_CSPICTRL_DR_SHIFT; - spi_imx->spi_bus_clk = clk; - -@@ -875,13 +871,12 @@ static int mx1_prepare_message(struct spi_imx_data *spi_imx, - } - - static int mx1_prepare_transfer(struct spi_imx_data *spi_imx, -- struct spi_device *spi, -- struct spi_transfer *t) -+ struct spi_device *spi) - { - unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; - unsigned int clk; - -- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) << -+ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) << - MX1_CSPICTRL_DR_SHIFT; - spi_imx->spi_bus_clk = clk; - -@@ -1199,6 +1194,16 @@ static int spi_imx_setupxfer(struct spi_device *spi, - if (!t) - return 0; - -+ if (!t->speed_hz) { -+ if (!spi->max_speed_hz) { -+ dev_err(&spi->dev, "no speed_hz provided!\n"); -+ return -EINVAL; -+ } -+ dev_dbg(&spi->dev, "using spi->max_speed_hz!\n"); -+ spi_imx->spi_bus_clk = spi->max_speed_hz; -+ } else -+ spi_imx->spi_bus_clk = t->speed_hz; -+ - spi_imx->bits_per_word = t->bits_per_word; - - /* -@@ -1240,7 +1245,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, - spi_imx->slave_burst = t->len; - } - -- spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t); -+ spi_imx->devtype_data->prepare_transfer(spi_imx, spi); - - return 0; - } -diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c -index 8acf24f7c5d40..81eac9fbd08cb 100644 ---- a/drivers/spi/spi-mt65xx.c -+++ b/drivers/spi/spi-mt65xx.c -@@ -427,13 +427,23 @@ static int mtk_spi_fifo_transfer(struct spi_master *master, - mtk_spi_setup_packet(master); - - cnt = xfer->len / 4; -- iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); -+ if (xfer->tx_buf) -+ iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); -+ -+ if (xfer->rx_buf) -+ ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt); - - remainder = xfer->len % 4; - if (remainder > 0) { - reg_val = 0; -- memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder); -- writel(reg_val, mdata->base + SPI_TX_DATA_REG); -+ if (xfer->tx_buf) { -+ memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder); -+ writel(reg_val, mdata->base + SPI_TX_DATA_REG); -+ } -+ if (xfer->rx_buf) { -+ reg_val = readl(mdata->base + SPI_RX_DATA_REG); -+ memcpy(xfer->rx_buf + (cnt * 4), ®_val, remainder); -+ } - } - - mtk_spi_enable_transfer(master); -diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c -index 3af6a5a3a4b29..e9d48e94f5edb 100644 ---- a/drivers/spi/spi-stm32.c -+++ b/drivers/spi/spi-stm32.c -@@ -1908,35 +1908,48 @@ static int stm32_spi_probe(struct platform_device *pdev) - master->transfer_one = stm32_spi_transfer_one; - master->unprepare_message = stm32_spi_unprepare_msg; - -- spi->dma_tx = dma_request_slave_channel(spi->dev, "tx"); -- if (!spi->dma_tx) -+ spi->dma_tx = dma_request_chan(spi->dev, "tx"); -+ if (IS_ERR(spi->dma_tx)) { -+ ret = PTR_ERR(spi->dma_tx); -+ spi->dma_tx = NULL; -+ if (ret == -EPROBE_DEFER) -+ goto err_clk_disable; -+ - dev_warn(&pdev->dev, "failed to request tx dma channel\n"); -- else -+ } else { - master->dma_tx = spi->dma_tx; -+ } -+ -+ spi->dma_rx = dma_request_chan(spi->dev, "rx"); -+ if (IS_ERR(spi->dma_rx)) { -+ ret = PTR_ERR(spi->dma_rx); -+ spi->dma_rx = NULL; -+ if (ret == -EPROBE_DEFER) -+ goto err_dma_release; - -- spi->dma_rx = dma_request_slave_channel(spi->dev, "rx"); -- if (!spi->dma_rx) - dev_warn(&pdev->dev, "failed to request rx dma channel\n"); -- else -+ } else { - master->dma_rx = spi->dma_rx; -+ } - - if (spi->dma_tx || spi->dma_rx) - master->can_dma = stm32_spi_can_dma; - - pm_runtime_set_active(&pdev->dev); -+ pm_runtime_get_noresume(&pdev->dev); - pm_runtime_enable(&pdev->dev); - - ret = spi_register_master(master); - if (ret) { - dev_err(&pdev->dev, "spi master registration failed: %d\n", - ret); -- goto err_dma_release; -+ goto err_pm_disable; - } - - if (!master->cs_gpios) { - dev_err(&pdev->dev, "no CS gpios available\n"); - ret = -EINVAL; -- goto err_dma_release; -+ goto err_pm_disable; - } - - for (i = 0; i < master->num_chipselect; i++) { -@@ -1960,13 +1973,15 @@ static int stm32_spi_probe(struct platform_device *pdev) - - return 0; - -+err_pm_disable: -+ pm_runtime_disable(&pdev->dev); -+ pm_runtime_put_noidle(&pdev->dev); -+ pm_runtime_set_suspended(&pdev->dev); - err_dma_release: - if (spi->dma_tx) - dma_release_channel(spi->dma_tx); - if (spi->dma_rx) - dma_release_channel(spi->dma_rx); -- -- pm_runtime_disable(&pdev->dev); - err_clk_disable: - clk_disable_unprepare(spi->clk); - err_master_put: -@@ -1980,9 +1995,14 @@ static int stm32_spi_remove(struct platform_device *pdev) - struct spi_master *master = platform_get_drvdata(pdev); - struct stm32_spi *spi = spi_master_get_devdata(master); - -+ pm_runtime_get_sync(&pdev->dev); -+ - spi_unregister_master(master); - spi->cfg->disable(spi); - -+ pm_runtime_disable(&pdev->dev); -+ pm_runtime_put_noidle(&pdev->dev); -+ pm_runtime_set_suspended(&pdev->dev); - if (master->dma_tx) - dma_release_channel(master->dma_tx); - if (master->dma_rx) -@@ -1990,7 +2010,6 @@ static int stm32_spi_remove(struct platform_device *pdev) - - clk_disable_unprepare(spi->clk); - -- pm_runtime_disable(&pdev->dev); - - pinctrl_pm_select_sleep_state(&pdev->dev); - -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c -index f1e81886122d0..e63c163dba788 100644 ---- a/drivers/target/target_core_sbc.c -+++ b/drivers/target/target_core_sbc.c -@@ -25,7 +25,7 @@ - #include "target_core_alua.h" - - static sense_reason_t --sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool); -+sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool); - static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd); - - static sense_reason_t -@@ -279,14 +279,14 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb) - } - - static sense_reason_t --sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) -+sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops) - { - struct se_device *dev = cmd->se_dev; - sector_t end_lba = dev->transport->get_blocks(dev) + 1; - unsigned int sectors = sbc_get_write_same_sectors(cmd); - sense_reason_t ret; - -- if ((flags[0] & 0x04) || (flags[0] & 0x02)) { -+ if ((flags & 0x04) || (flags & 0x02)) { - pr_err("WRITE_SAME PBDATA and LBDATA" - " bits not supported for Block Discard" - " Emulation\n"); -@@ -308,7 +308,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o - } - - /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ -- if (flags[0] & 0x10) { -+ if (flags & 0x10) { - pr_warn("WRITE SAME with ANCHOR not supported\n"); - return TCM_INVALID_CDB_FIELD; - } -@@ -316,7 +316,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o - * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting - * translated into block discard requests within backend code. - */ -- if (flags[0] & 0x08) { -+ if (flags & 0x08) { - if (!ops->execute_unmap) - return TCM_UNSUPPORTED_SCSI_OPCODE; - -@@ -331,7 +331,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o - if (!ops->execute_write_same) - return TCM_UNSUPPORTED_SCSI_OPCODE; - -- ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true); -+ ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true); - if (ret) - return ret; - -@@ -686,10 +686,9 @@ sbc_set_prot_op_checks(u8 protect, bool fabric_prot, enum target_prot_type prot_ - } - - static sense_reason_t --sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, -+sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect, - u32 sectors, bool is_write) - { -- u8 protect = cdb[1] >> 5; - int sp_ops = cmd->se_sess->sup_prot_ops; - int pi_prot_type = dev->dev_attrib.pi_prot_type; - bool fabric_prot = false; -@@ -737,7 +736,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, - /* Fallthrough */ - default: - pr_err("Unable to determine pi_prot_type for CDB: 0x%02x " -- "PROTECT: 0x%02x\n", cdb[0], protect); -+ "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect); - return TCM_INVALID_CDB_FIELD; - } - -@@ -812,7 +811,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); - if (ret) - return ret; - -@@ -826,7 +825,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); - if (ret) - return ret; - -@@ -840,7 +839,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); - if (ret) - return ret; - -@@ -861,7 +860,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); - if (ret) - return ret; - -@@ -875,7 +874,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); - if (ret) - return ret; - -@@ -890,7 +889,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - if (sbc_check_dpofua(dev, cmd, cdb)) - return TCM_INVALID_CDB_FIELD; - -- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); -+ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); - if (ret) - return ret; - -@@ -949,7 +948,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - size = sbc_get_size(cmd, 1); - cmd->t_task_lba = get_unaligned_be64(&cdb[12]); - -- ret = sbc_setup_write_same(cmd, &cdb[10], ops); -+ ret = sbc_setup_write_same(cmd, cdb[10], ops); - if (ret) - return ret; - break; -@@ -1048,7 +1047,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - size = sbc_get_size(cmd, 1); - cmd->t_task_lba = get_unaligned_be64(&cdb[2]); - -- ret = sbc_setup_write_same(cmd, &cdb[1], ops); -+ ret = sbc_setup_write_same(cmd, cdb[1], ops); - if (ret) - return ret; - break; -@@ -1066,7 +1065,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - * Follow sbcr26 with WRITE_SAME (10) and check for the existence - * of byte 1 bit 3 UNMAP instead of original reserved field - */ -- ret = sbc_setup_write_same(cmd, &cdb[1], ops); -+ ret = sbc_setup_write_same(cmd, cdb[1], ops); - if (ret) - return ret; - break; -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 3a2d9318604bb..303e8b3c1bdae 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -46,6 +46,7 @@ - - #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ - #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ -+#define USB_PING_RESPONSE_TIME 400 /* ns */ - - /* Protect struct usb_device->state and ->children members - * Note: Both are also protected by ->dev.sem, except that ->state can -@@ -180,8 +181,9 @@ int usb_device_supports_lpm(struct usb_device *udev) - } - - /* -- * Set the Maximum Exit Latency (MEL) for the host to initiate a transition from -- * either U1 or U2. -+ * Set the Maximum Exit Latency (MEL) for the host to wakup up the path from -+ * U1/U2, send a PING to the device and receive a PING_RESPONSE. -+ * See USB 3.1 section C.1.5.2 - */ - static void usb_set_lpm_mel(struct usb_device *udev, - struct usb3_lpm_parameters *udev_lpm_params, -@@ -191,35 +193,37 @@ static void usb_set_lpm_mel(struct usb_device *udev, - unsigned int hub_exit_latency) - { - unsigned int total_mel; -- unsigned int device_mel; -- unsigned int hub_mel; - - /* -- * Calculate the time it takes to transition all links from the roothub -- * to the parent hub into U0. The parent hub must then decode the -- * packet (hub header decode latency) to figure out which port it was -- * bound for. -- * -- * The Hub Header decode latency is expressed in 0.1us intervals (0x1 -- * means 0.1us). Multiply that by 100 to get nanoseconds. -+ * tMEL1. time to transition path from host to device into U0. -+ * MEL for parent already contains the delay up to parent, so only add -+ * the exit latency for the last link (pick the slower exit latency), -+ * and the hub header decode latency. See USB 3.1 section C 2.2.1 -+ * Store MEL in nanoseconds - */ - total_mel = hub_lpm_params->mel + -- (hub->descriptor->u.ss.bHubHdrDecLat * 100); -+ max(udev_exit_latency, hub_exit_latency) * 1000 + -+ hub->descriptor->u.ss.bHubHdrDecLat * 100; - - /* -- * How long will it take to transition the downstream hub's port into -- * U0? The greater of either the hub exit latency or the device exit -- * latency. -- * -- * The BOS U1/U2 exit latencies are expressed in 1us intervals. -- * Multiply that by 1000 to get nanoseconds. -+ * tMEL2. Time to submit PING packet. Sum of tTPTransmissionDelay for -+ * each link + wHubDelay for each hub. Add only for last link. -+ * tMEL4, the time for PING_RESPONSE to traverse upstream is similar. -+ * Multiply by 2 to include it as well. - */ -- device_mel = udev_exit_latency * 1000; -- hub_mel = hub_exit_latency * 1000; -- if (device_mel > hub_mel) -- total_mel += device_mel; -- else -- total_mel += hub_mel; -+ total_mel += (__le16_to_cpu(hub->descriptor->u.ss.wHubDelay) + -+ USB_TP_TRANSMISSION_DELAY) * 2; -+ -+ /* -+ * tMEL3, tPingResponse. Time taken by device to generate PING_RESPONSE -+ * after receiving PING. Also add 2100ns as stated in USB 3.1 C 1.5.2.4 -+ * to cover the delay if the PING_RESPONSE is queued behind a Max Packet -+ * Size DP. -+ * Note these delays should be added only once for the entire path, so -+ * add them to the MEL of the device connected to the roothub. -+ */ -+ if (!hub->hdev->parent) -+ total_mel += USB_PING_RESPONSE_TIME + 2100; - - udev_lpm_params->mel = total_mel; - } -@@ -4022,6 +4026,47 @@ static int usb_set_lpm_timeout(struct usb_device *udev, - return 0; - } - -+/* -+ * Don't allow device intiated U1/U2 if the system exit latency + one bus -+ * interval is greater than the minimum service interval of any active -+ * periodic endpoint. See USB 3.2 section 9.4.9 -+ */ -+static bool usb_device_may_initiate_lpm(struct usb_device *udev, -+ enum usb3_link_state state) -+{ -+ unsigned int sel; /* us */ -+ int i, j; -+ -+ if (state == USB3_LPM_U1) -+ sel = DIV_ROUND_UP(udev->u1_params.sel, 1000); -+ else if (state == USB3_LPM_U2) -+ sel = DIV_ROUND_UP(udev->u2_params.sel, 1000); -+ else -+ return false; -+ -+ for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { -+ struct usb_interface *intf; -+ struct usb_endpoint_descriptor *desc; -+ unsigned int interval; -+ -+ intf = udev->actconfig->interface[i]; -+ if (!intf) -+ continue; -+ -+ for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) { -+ desc = &intf->cur_altsetting->endpoint[j].desc; -+ -+ if (usb_endpoint_xfer_int(desc) || -+ usb_endpoint_xfer_isoc(desc)) { -+ interval = (1 << (desc->bInterval - 1)) * 125; -+ if (sel + 125 > interval) -+ return false; -+ } -+ } -+ } -+ return true; -+} -+ - /* - * Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated - * U1/U2 entry. -@@ -4094,20 +4139,23 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, - * U1/U2_ENABLE - */ - if (udev->actconfig && -- usb_set_device_initiated_lpm(udev, state, true) == 0) { -- if (state == USB3_LPM_U1) -- udev->usb3_lpm_u1_enabled = 1; -- else if (state == USB3_LPM_U2) -- udev->usb3_lpm_u2_enabled = 1; -- } else { -- /* Don't request U1/U2 entry if the device -- * cannot transition to U1/U2. -- */ -- usb_set_lpm_timeout(udev, state, 0); -- hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); -+ usb_device_may_initiate_lpm(udev, state)) { -+ if (usb_set_device_initiated_lpm(udev, state, true)) { -+ /* -+ * Request to enable device initiated U1/U2 failed, -+ * better to turn off lpm in this case. -+ */ -+ usb_set_lpm_timeout(udev, state, 0); -+ hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); -+ return; -+ } - } --} - -+ if (state == USB3_LPM_U1) -+ udev->usb3_lpm_u1_enabled = 1; -+ else if (state == USB3_LPM_U2) -+ udev->usb3_lpm_u2_enabled = 1; -+} - /* - * Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated - * U1/U2 entry. -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index f6a6c54cba35f..d97544fd339b1 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -502,10 +502,6 @@ static const struct usb_device_id usb_quirk_list[] = { - /* DJI CineSSD */ - { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, - -- /* Fibocom L850-GL LTE Modem */ -- { USB_DEVICE(0x2cb7, 0x0007), .driver_info = -- USB_QUIRK_IGNORE_REMOTE_WAKEUP }, -- - /* INTEL VALUE SSD */ - { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, - -diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c -index 566bc1e604af4..66dfcdbd1e03a 100644 ---- a/drivers/usb/dwc2/gadget.c -+++ b/drivers/usb/dwc2/gadget.c -@@ -2748,12 +2748,14 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, - return; - } - -- /* Zlp for all endpoints, for ep0 only in DATA IN stage */ -+ /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ - if (hs_ep->send_zlp) { -- dwc2_hsotg_program_zlp(hsotg, hs_ep); - hs_ep->send_zlp = 0; -- /* transfer will be completed on next complete interrupt */ -- return; -+ if (!using_desc_dma(hsotg)) { -+ dwc2_hsotg_program_zlp(hsotg, hs_ep); -+ /* transfer will be completed on next complete interrupt */ -+ return; -+ } - } - - if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) { -diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c -index 903abdf30b5a0..5ef0747225f6b 100644 ---- a/drivers/usb/host/max3421-hcd.c -+++ b/drivers/usb/host/max3421-hcd.c -@@ -153,8 +153,6 @@ struct max3421_hcd { - */ - struct urb *curr_urb; - enum scheduling_pass sched_pass; -- struct usb_device *loaded_dev; /* dev that's loaded into the chip */ -- int loaded_epnum; /* epnum whose toggles are loaded */ - int urb_done; /* > 0 -> no errors, < 0: errno */ - size_t curr_len; - u8 hien; -@@ -492,39 +490,17 @@ max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev) - * Caller must NOT hold HCD spinlock. - */ - static void --max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, -- int force_toggles) -+max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum) - { -- struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); -- int old_epnum, same_ep, rcvtog, sndtog; -- struct usb_device *old_dev; -+ int rcvtog, sndtog; - u8 hctl; - -- old_dev = max3421_hcd->loaded_dev; -- old_epnum = max3421_hcd->loaded_epnum; -- -- same_ep = (dev == old_dev && epnum == old_epnum); -- if (same_ep && !force_toggles) -- return; -- -- if (old_dev && !same_ep) { -- /* save the old end-points toggles: */ -- u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); -- -- rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; -- sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; -- -- /* no locking: HCD (i.e., we) own toggles, don't we? */ -- usb_settoggle(old_dev, old_epnum, 0, rcvtog); -- usb_settoggle(old_dev, old_epnum, 1, sndtog); -- } - /* setup new endpoint's toggle bits: */ - rcvtog = usb_gettoggle(dev, epnum, 0); - sndtog = usb_gettoggle(dev, epnum, 1); - hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) | - BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT)); - -- max3421_hcd->loaded_epnum = epnum; - spi_wr8(hcd, MAX3421_REG_HCTL, hctl); - - /* -@@ -532,7 +508,6 @@ max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, - * address-assignment so it's best to just always load the - * address whenever the end-point changed/was forced. - */ -- max3421_hcd->loaded_dev = dev; - spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum); - } - -@@ -667,7 +642,7 @@ max3421_select_and_start_urb(struct usb_hcd *hcd) - struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); - struct urb *urb, *curr_urb = NULL; - struct max3421_ep *max3421_ep; -- int epnum, force_toggles = 0; -+ int epnum; - struct usb_host_endpoint *ep; - struct list_head *pos; - unsigned long flags; -@@ -777,7 +752,6 @@ done: - usb_settoggle(urb->dev, epnum, 0, 1); - usb_settoggle(urb->dev, epnum, 1, 1); - max3421_ep->pkt_state = PKT_STATE_SETUP; -- force_toggles = 1; - } else - max3421_ep->pkt_state = PKT_STATE_TRANSFER; - } -@@ -785,7 +759,7 @@ done: - spin_unlock_irqrestore(&max3421_hcd->lock, flags); - - max3421_ep->last_active = max3421_hcd->frame_number; -- max3421_set_address(hcd, urb->dev, epnum, force_toggles); -+ max3421_set_address(hcd, urb->dev, epnum); - max3421_set_speed(hcd, urb->dev); - max3421_next_transfer(hcd, 0); - return 1; -@@ -1380,6 +1354,16 @@ max3421_urb_done(struct usb_hcd *hcd) - status = 0; - urb = max3421_hcd->curr_urb; - if (urb) { -+ /* save the old end-points toggles: */ -+ u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); -+ int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; -+ int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; -+ int epnum = usb_endpoint_num(&urb->ep->desc); -+ -+ /* no locking: HCD (i.e., we) own toggles, don't we? */ -+ usb_settoggle(urb->dev, epnum, 0, rcvtog); -+ usb_settoggle(urb->dev, epnum, 1, sndtog); -+ - max3421_hcd->curr_urb = NULL; - spin_lock_irqsave(&max3421_hcd->lock, flags); - usb_hcd_unlink_urb_from_ep(hcd, urb); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index 1a274f8a5bf11..6358d4e0653ed 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -1546,11 +1546,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) - * Inform the usbcore about resume-in-progress by returning - * a non-zero value even if there are no status changes. - */ -+ spin_lock_irqsave(&xhci->lock, flags); -+ - status = bus_state->resuming_ports; - - mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; - -- spin_lock_irqsave(&xhci->lock, flags); - /* For each port, did anything change? If so, set that bit in buf. */ - for (i = 0; i < max_ports; i++) { - temp = readl(ports[i]->addr); -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index f6b5010deb735..1228b3d92db06 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -440,6 +440,26 @@ void xhci_ring_doorbell_for_active_rings(struct xhci_hcd *xhci, - ring_doorbell_for_active_rings(xhci, slot_id, ep_index); - } - -+static struct xhci_virt_ep *xhci_get_virt_ep(struct xhci_hcd *xhci, -+ unsigned int slot_id, -+ unsigned int ep_index) -+{ -+ if (slot_id == 0 || slot_id >= MAX_HC_SLOTS) { -+ xhci_warn(xhci, "Invalid slot_id %u\n", slot_id); -+ return NULL; -+ } -+ if (ep_index >= EP_CTX_PER_DEV) { -+ xhci_warn(xhci, "Invalid endpoint index %u\n", ep_index); -+ return NULL; -+ } -+ if (!xhci->devs[slot_id]) { -+ xhci_warn(xhci, "No xhci virt device for slot_id %u\n", slot_id); -+ return NULL; -+ } -+ -+ return &xhci->devs[slot_id]->eps[ep_index]; -+} -+ - /* Get the right ring for the given slot_id, ep_index and stream_id. - * If the endpoint supports streams, boundary check the URB's stream ID. - * If the endpoint doesn't support streams, return the singular endpoint ring. -@@ -450,7 +470,10 @@ struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci, - { - struct xhci_virt_ep *ep; - -- ep = &xhci->devs[slot_id]->eps[ep_index]; -+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); -+ if (!ep) -+ return NULL; -+ - /* Common case: no streams */ - if (!(ep->ep_state & EP_HAS_STREAMS)) - return ep->ring; -@@ -743,11 +766,14 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, - memset(&deq_state, 0, sizeof(deq_state)); - ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); - -+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); -+ if (!ep) -+ return; -+ - vdev = xhci->devs[slot_id]; - ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index); - trace_xhci_handle_cmd_stop_ep(ep_ctx); - -- ep = &xhci->devs[slot_id]->eps[ep_index]; - last_unlinked_td = list_last_entry(&ep->cancelled_td_list, - struct xhci_td, cancelled_td_list); - -@@ -1068,9 +1094,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, - - ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); - stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2])); -- dev = xhci->devs[slot_id]; -- ep = &dev->eps[ep_index]; -+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); -+ if (!ep) -+ return; - -+ dev = xhci->devs[slot_id]; - ep_ring = xhci_stream_id_to_ring(dev, ep_index, stream_id); - if (!ep_ring) { - xhci_warn(xhci, "WARN Set TR deq ptr command for freed stream ID %u\n", -@@ -1143,9 +1171,9 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, - } - - cleanup: -- dev->eps[ep_index].ep_state &= ~SET_DEQ_PENDING; -- dev->eps[ep_index].queued_deq_seg = NULL; -- dev->eps[ep_index].queued_deq_ptr = NULL; -+ ep->ep_state &= ~SET_DEQ_PENDING; -+ ep->queued_deq_seg = NULL; -+ ep->queued_deq_ptr = NULL; - /* Restart any rings with pending URBs */ - ring_doorbell_for_active_rings(xhci, slot_id, ep_index); - } -@@ -1154,10 +1182,15 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, - union xhci_trb *trb, u32 cmd_comp_code) - { - struct xhci_virt_device *vdev; -+ struct xhci_virt_ep *ep; - struct xhci_ep_ctx *ep_ctx; - unsigned int ep_index; - - ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); -+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); -+ if (!ep) -+ return; -+ - vdev = xhci->devs[slot_id]; - ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index); - trace_xhci_handle_cmd_reset_ep(ep_ctx); -@@ -1187,7 +1220,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, - xhci_ring_cmd_db(xhci); - } else { - /* Clear our internal halted state */ -- xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; -+ ep->ep_state &= ~EP_HALTED; - } - - /* if this was a soft reset, then restart */ -@@ -2356,14 +2389,13 @@ static int handle_tx_event(struct xhci_hcd *xhci, - trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len)); - ep_trb_dma = le64_to_cpu(event->buffer); - -- xdev = xhci->devs[slot_id]; -- if (!xdev) { -- xhci_err(xhci, "ERROR Transfer event pointed to bad slot %u\n", -- slot_id); -+ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); -+ if (!ep) { -+ xhci_err(xhci, "ERROR Invalid Transfer event\n"); - goto err_out; - } - -- ep = &xdev->eps[ep_index]; -+ xdev = xhci->devs[slot_id]; - ep_ring = xhci_dma_to_transfer_ring(ep, ep_trb_dma); - ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); - -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 8798ed0317864..834f32fe99308 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -993,6 +993,7 @@ struct xhci_interval_bw_table { - unsigned int ss_bw_out; - }; - -+#define EP_CTX_PER_DEV 31 - - struct xhci_virt_device { - struct usb_device *udev; -@@ -1007,7 +1008,7 @@ struct xhci_virt_device { - struct xhci_container_ctx *out_ctx; - /* Used for addressing devices and configuration changes */ - struct xhci_container_ctx *in_ctx; -- struct xhci_virt_ep eps[31]; -+ struct xhci_virt_ep eps[EP_CTX_PER_DEV]; - u8 fake_port; - u8 real_port; - struct xhci_interval_bw_table *bw_table; -diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c -index cfc16943979d5..2010444376314 100644 ---- a/drivers/usb/renesas_usbhs/fifo.c -+++ b/drivers/usb/renesas_usbhs/fifo.c -@@ -101,6 +101,8 @@ static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo, - #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) - #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) - static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); -+static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable); -+static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable); - struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) - { - struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); -@@ -123,6 +125,11 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) - if (chan) { - dmaengine_terminate_all(chan); - usbhsf_dma_unmap(pkt); -+ } else { -+ if (usbhs_pipe_is_dir_in(pipe)) -+ usbhsf_rx_irq_ctrl(pipe, 0); -+ else -+ usbhsf_tx_irq_ctrl(pipe, 0); - } - - usbhs_pipe_clear_without_sequence(pipe, 0, 0); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index db03212d620ad..8e5878ec656d0 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -156,6 +156,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ - { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */ - { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ -+ { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */ - { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ - { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ -@@ -203,8 +204,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */ - { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */ - { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */ -- { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */ -- { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */ -+ { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */ -+ { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */ - { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */ - { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 25d8fb3a7395f..d6d10ba1e1e80 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -238,6 +238,7 @@ static void option_instat_callback(struct urb *urb); - #define QUECTEL_PRODUCT_UC15 0x9090 - /* These u-blox products use Qualcomm's vendor ID */ - #define UBLOX_PRODUCT_R410M 0x90b2 -+#define UBLOX_PRODUCT_R6XX 0x90fa - /* These Yuga products use Qualcomm's vendor ID */ - #define YUGA_PRODUCT_CLM920_NC5 0x9625 - -@@ -1101,6 +1102,8 @@ static const struct usb_device_id option_ids[] = { - /* u-blox products using Qualcomm vendor ID */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), - .driver_info = RSVD(1) | RSVD(3) }, -+ { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX), -+ .driver_info = RSVD(3) }, - /* Quectel products using Quectel vendor ID */ - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), - .driver_info = NUMEP2 }, -diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h -index cb7b15ecb7aba..c7db6c943ba51 100644 ---- a/drivers/usb/storage/unusual_uas.h -+++ b/drivers/usb/storage/unusual_uas.h -@@ -45,6 +45,13 @@ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), - -+/* Reported-by: Julian Sikorski */ -+UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, -+ "LaCie", -+ "Rugged USB3-FW", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_IGNORE_UAS), -+ - /* - * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI - * commands in UAS mode. Observed with the 1.28 firmware; are there others? -diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c -index fc5eb0f893049..c2e82b84c5546 100644 ---- a/fs/afs/cmservice.c -+++ b/fs/afs/cmservice.c -@@ -29,16 +29,11 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *); - - static int afs_deliver_yfs_cb_callback(struct afs_call *); - --#define CM_NAME(name) \ -- char afs_SRXCB##name##_name[] __tracepoint_string = \ -- "CB." #name -- - /* - * CB.CallBack operation type - */ --static CM_NAME(CallBack); - static const struct afs_call_type afs_SRXCBCallBack = { -- .name = afs_SRXCBCallBack_name, -+ .name = "CB.CallBack", - .deliver = afs_deliver_cb_callback, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_CallBack, -@@ -47,9 +42,8 @@ static const struct afs_call_type afs_SRXCBCallBack = { - /* - * CB.InitCallBackState operation type - */ --static CM_NAME(InitCallBackState); - static const struct afs_call_type afs_SRXCBInitCallBackState = { -- .name = afs_SRXCBInitCallBackState_name, -+ .name = "CB.InitCallBackState", - .deliver = afs_deliver_cb_init_call_back_state, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_InitCallBackState, -@@ -58,9 +52,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = { - /* - * CB.InitCallBackState3 operation type - */ --static CM_NAME(InitCallBackState3); - static const struct afs_call_type afs_SRXCBInitCallBackState3 = { -- .name = afs_SRXCBInitCallBackState3_name, -+ .name = "CB.InitCallBackState3", - .deliver = afs_deliver_cb_init_call_back_state3, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_InitCallBackState, -@@ -69,9 +62,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState3 = { - /* - * CB.Probe operation type - */ --static CM_NAME(Probe); - static const struct afs_call_type afs_SRXCBProbe = { -- .name = afs_SRXCBProbe_name, -+ .name = "CB.Probe", - .deliver = afs_deliver_cb_probe, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_Probe, -@@ -80,9 +72,8 @@ static const struct afs_call_type afs_SRXCBProbe = { - /* - * CB.ProbeUuid operation type - */ --static CM_NAME(ProbeUuid); - static const struct afs_call_type afs_SRXCBProbeUuid = { -- .name = afs_SRXCBProbeUuid_name, -+ .name = "CB.ProbeUuid", - .deliver = afs_deliver_cb_probe_uuid, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_ProbeUuid, -@@ -91,9 +82,8 @@ static const struct afs_call_type afs_SRXCBProbeUuid = { - /* - * CB.TellMeAboutYourself operation type - */ --static CM_NAME(TellMeAboutYourself); - static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { -- .name = afs_SRXCBTellMeAboutYourself_name, -+ .name = "CB.TellMeAboutYourself", - .deliver = afs_deliver_cb_tell_me_about_yourself, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_TellMeAboutYourself, -@@ -102,9 +92,8 @@ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { - /* - * YFS CB.CallBack operation type - */ --static CM_NAME(YFS_CallBack); - static const struct afs_call_type afs_SRXYFSCB_CallBack = { -- .name = afs_SRXCBYFS_CallBack_name, -+ .name = "YFSCB.CallBack", - .deliver = afs_deliver_yfs_cb_callback, - .destructor = afs_cm_destructor, - .work = SRXAFSCB_CallBack, -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index 832b40293907f..5273965226534 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -5768,6 +5768,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) - mutex_lock(&fs_info->fs_devices->device_list_mutex); - devices = &fs_info->fs_devices->devices; - list_for_each_entry(device, devices, dev_list) { -+ if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) -+ continue; -+ - ret = btrfs_trim_free_extents(device, &group_trimmed); - if (ret) { - dev_failed++; -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 64dd702a5448c..025b02e9799ff 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -543,7 +543,7 @@ again: - * inode has not been flagged as nocompress. This flag can - * change at any time if we discover bad compression ratios. - */ -- if (inode_need_compress(inode, start, end)) { -+ if (nr_pages > 1 && inode_need_compress(inode, start, end)) { - WARN_ON(pages); - pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); - if (!pages) { -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c -index 50ad3522ce365..358398b1fe0c9 100644 ---- a/fs/hugetlbfs/inode.c -+++ b/fs/hugetlbfs/inode.c -@@ -76,7 +76,7 @@ enum hugetlb_param { - static const struct fs_parameter_spec hugetlb_param_specs[] = { - fsparam_u32 ("gid", Opt_gid), - fsparam_string("min_size", Opt_min_size), -- fsparam_u32 ("mode", Opt_mode), -+ fsparam_u32oct("mode", Opt_mode), - fsparam_string("nr_inodes", Opt_nr_inodes), - fsparam_string("pagesize", Opt_pagesize), - fsparam_string("size", Opt_size), -diff --git a/fs/proc/base.c b/fs/proc/base.c -index 75e786684a4e3..90d2f62a96723 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -836,7 +836,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf, - flags = FOLL_FORCE | (write ? FOLL_WRITE : 0); - - while (count > 0) { -- int this_len = min_t(int, count, PAGE_SIZE); -+ size_t this_len = min_t(size_t, count, PAGE_SIZE); - - if (write && copy_from_user(page, buf, this_len)) { - copied = -EFAULT; -diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c -index d99d166fd8926..2c807283115d7 100644 ---- a/fs/userfaultfd.c -+++ b/fs/userfaultfd.c -@@ -1272,23 +1272,21 @@ static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx, - } - - static __always_inline int validate_range(struct mm_struct *mm, -- __u64 *start, __u64 len) -+ __u64 start, __u64 len) - { - __u64 task_size = mm->task_size; - -- *start = untagged_addr(*start); -- -- if (*start & ~PAGE_MASK) -+ if (start & ~PAGE_MASK) - return -EINVAL; - if (len & ~PAGE_MASK) - return -EINVAL; - if (!len) - return -EINVAL; -- if (*start < mmap_min_addr) -+ if (start < mmap_min_addr) - return -EINVAL; -- if (*start >= task_size) -+ if (start >= task_size) - return -EINVAL; -- if (len > task_size - *start) -+ if (len > task_size - start) - return -EINVAL; - return 0; - } -@@ -1338,7 +1336,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, - goto out; - } - -- ret = validate_range(mm, &uffdio_register.range.start, -+ ret = validate_range(mm, uffdio_register.range.start, - uffdio_register.range.len); - if (ret) - goto out; -@@ -1527,7 +1525,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, - if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) - goto out; - -- ret = validate_range(mm, &uffdio_unregister.start, -+ ret = validate_range(mm, uffdio_unregister.start, - uffdio_unregister.len); - if (ret) - goto out; -@@ -1678,7 +1676,7 @@ static int userfaultfd_wake(struct userfaultfd_ctx *ctx, - if (copy_from_user(&uffdio_wake, buf, sizeof(uffdio_wake))) - goto out; - -- ret = validate_range(ctx->mm, &uffdio_wake.start, uffdio_wake.len); -+ ret = validate_range(ctx->mm, uffdio_wake.start, uffdio_wake.len); - if (ret) - goto out; - -@@ -1718,7 +1716,7 @@ static int userfaultfd_copy(struct userfaultfd_ctx *ctx, - sizeof(uffdio_copy)-sizeof(__s64))) - goto out; - -- ret = validate_range(ctx->mm, &uffdio_copy.dst, uffdio_copy.len); -+ ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len); - if (ret) - goto out; - /* -@@ -1774,7 +1772,7 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx, - sizeof(uffdio_zeropage)-sizeof(__s64))) - goto out; - -- ret = validate_range(ctx->mm, &uffdio_zeropage.range.start, -+ ret = validate_range(ctx->mm, uffdio_zeropage.range.start, - uffdio_zeropage.range.len); - if (ret) - goto out; -diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h -index 10100a4bbe2ad..afb27cb6a7bd8 100644 ---- a/include/drm/drm_ioctl.h -+++ b/include/drm/drm_ioctl.h -@@ -68,6 +68,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, - unsigned long arg); - - #define DRM_IOCTL_NR(n) _IOC_NR(n) -+#define DRM_IOCTL_TYPE(n) _IOC_TYPE(n) - #define DRM_MAJOR 226 - - /** -diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h -index c612cabbc378f..61af4af871190 100644 ---- a/include/trace/events/afs.h -+++ b/include/trace/events/afs.h -@@ -111,6 +111,34 @@ enum afs_vl_operation { - afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */ - }; - -+enum afs_cm_operation { -+ afs_CB_CallBack = 204, /* AFS break callback promises */ -+ afs_CB_InitCallBackState = 205, /* AFS initialise callback state */ -+ afs_CB_Probe = 206, /* AFS probe client */ -+ afs_CB_GetLock = 207, /* AFS get contents of CM lock table */ -+ afs_CB_GetCE = 208, /* AFS get cache file description */ -+ afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */ -+ afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */ -+ afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */ -+ afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */ -+}; -+ -+enum yfs_cm_operation { -+ yfs_CB_Probe = 206, /* YFS probe client */ -+ yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */ -+ yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */ -+ yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */ -+ yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */ -+ yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */ -+ yfs_CB_GetServerPrefs = 215, -+ yfs_CB_GetCellServDV = 216, -+ yfs_CB_GetLocalCell = 217, -+ yfs_CB_GetCacheConfig = 218, -+ yfs_CB_GetCellByNum = 65537, -+ yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */ -+ yfs_CB_CallBack = 64204, -+}; -+ - enum afs_edit_dir_op { - afs_edit_dir_create, - afs_edit_dir_create_error, -@@ -312,6 +340,32 @@ enum afs_cb_break_reason { - EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \ - E_(afs_VL_GetCapabilities, "VL.GetCapabilities") - -+#define afs_cm_operations \ -+ EM(afs_CB_CallBack, "CB.CallBack") \ -+ EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \ -+ EM(afs_CB_Probe, "CB.Probe") \ -+ EM(afs_CB_GetLock, "CB.GetLock") \ -+ EM(afs_CB_GetCE, "CB.GetCE") \ -+ EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \ -+ EM(afs_CB_GetXStats, "CB.GetXStats") \ -+ EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \ -+ E_(afs_CB_ProbeUuid, "CB.ProbeUuid") -+ -+#define yfs_cm_operations \ -+ EM(yfs_CB_Probe, "YFSCB.Probe") \ -+ EM(yfs_CB_GetLock, "YFSCB.GetLock") \ -+ EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \ -+ EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \ -+ EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \ -+ EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \ -+ EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \ -+ EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \ -+ EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \ -+ EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \ -+ EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \ -+ EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \ -+ E_(yfs_CB_CallBack, "YFSCB.CallBack") -+ - #define afs_edit_dir_ops \ - EM(afs_edit_dir_create, "create") \ - EM(afs_edit_dir_create_error, "c_fail") \ -@@ -442,6 +496,8 @@ afs_call_traces; - afs_server_traces; - afs_fs_operations; - afs_vl_operations; -+afs_cm_operations; -+yfs_cm_operations; - afs_edit_dir_ops; - afs_edit_dir_reasons; - afs_eproto_causes; -@@ -522,20 +578,21 @@ TRACE_EVENT(afs_cb_call, - - TP_STRUCT__entry( - __field(unsigned int, call ) -- __field(const char *, name ) - __field(u32, op ) -+ __field(u16, service_id ) - ), - - TP_fast_assign( - __entry->call = call->debug_id; -- __entry->name = call->type->name; - __entry->op = call->operation_ID; -+ __entry->service_id = call->service_id; - ), - -- TP_printk("c=%08x %s o=%u", -+ TP_printk("c=%08x %s", - __entry->call, -- __entry->name, -- __entry->op) -+ __entry->service_id == 2501 ? -+ __print_symbolic(__entry->op, yfs_cm_operations) : -+ __print_symbolic(__entry->op, afs_cm_operations)) - ); - - TRACE_EVENT(afs_call, -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 7283741666538..5e1b9f6e77f31 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -3221,10 +3221,30 @@ static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer) - if (unlikely(!head)) - return true; - -- return reader->read == rb_page_commit(reader) && -- (commit == reader || -- (commit == head && -- head->read == rb_page_commit(commit))); -+ /* Reader should exhaust content in reader page */ -+ if (reader->read != rb_page_commit(reader)) -+ return false; -+ -+ /* -+ * If writers are committing on the reader page, knowing all -+ * committed content has been read, the ring buffer is empty. -+ */ -+ if (commit == reader) -+ return true; -+ -+ /* -+ * If writers are committing on a page other than reader page -+ * and head page, there should always be content to read. -+ */ -+ if (commit != head) -+ return false; -+ -+ /* -+ * Writers are committing on the head page, we just need -+ * to care about there're committed data, and the reader will -+ * swap reader page with head page when it is to read data. -+ */ -+ return rb_page_commit(commit) == 0; - } - - /** -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 002412a1abf91..5240ba9a82db8 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -4975,6 +4975,10 @@ static const char readme_msg[] = - "\t [:name=histname1]\n" - "\t [:.]\n" - "\t [if ]\n\n" -+ "\t Note, special fields can be used as well:\n" -+ "\t common_timestamp - to record current timestamp\n" -+ "\t common_cpu - to record the CPU the event happened on\n" -+ "\n" - "\t When a matching event is hit, an entry is added to a hash\n" - "\t table using the key(s) and value(s) named, and the value of a\n" - "\t sum called 'hitcount' is incremented. Keys and values\n" -diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c -index f136449821bfe..553add1eb457f 100644 ---- a/kernel/trace/trace_events_hist.c -+++ b/kernel/trace/trace_events_hist.c -@@ -2001,7 +2001,7 @@ static const char *hist_field_name(struct hist_field *field, - field->flags & HIST_FIELD_FL_ALIAS) - field_name = hist_field_name(field->operands[0], ++level); - else if (field->flags & HIST_FIELD_FL_CPU) -- field_name = "cpu"; -+ field_name = "common_cpu"; - else if (field->flags & HIST_FIELD_FL_EXPR || - field->flags & HIST_FIELD_FL_VAR_REF) { - if (field->system) { -@@ -2873,14 +2873,24 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, - hist_data->enable_timestamps = true; - if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) - hist_data->attrs->ts_in_usecs = true; -- } else if (strcmp(field_name, "cpu") == 0) -+ } else if (strcmp(field_name, "common_cpu") == 0) - *flags |= HIST_FIELD_FL_CPU; - else { - field = trace_find_event_field(file->event_call, field_name); - if (!field || !field->size) { -- hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name)); -- field = ERR_PTR(-EINVAL); -- goto out; -+ /* -+ * For backward compatibility, if field_name -+ * was "cpu", then we treat this the same as -+ * common_cpu. -+ */ -+ if (strcmp(field_name, "cpu") == 0) { -+ *flags |= HIST_FIELD_FL_CPU; -+ } else { -+ hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, -+ errpos(field_name)); -+ field = ERR_PTR(-EINVAL); -+ goto out; -+ } - } - } - out: -@@ -5641,7 +5651,7 @@ static void hist_field_print(struct seq_file *m, struct hist_field *hist_field) - seq_printf(m, "%s=", hist_field->var.name); - - if (hist_field->flags & HIST_FIELD_FL_CPU) -- seq_puts(m, "cpu"); -+ seq_puts(m, "common_cpu"); - else if (field_name) { - if (hist_field->flags & HIST_FIELD_FL_VAR_REF || - hist_field->flags & HIST_FIELD_FL_ALIAS) -diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c -index ef14da50a9819..8fa98c62c4fcf 100644 ---- a/net/caif/caif_socket.c -+++ b/net/caif/caif_socket.c -@@ -539,7 +539,8 @@ static int caif_seqpkt_sendmsg(struct socket *sock, struct msghdr *msg, - goto err; - - ret = -EINVAL; -- if (unlikely(msg->msg_iter.iov->iov_base == NULL)) -+ if (unlikely(msg->msg_iter.nr_segs == 0) || -+ unlikely(msg->msg_iter.iov->iov_base == NULL)) - goto err; - noblock = msg->msg_flags & MSG_DONTWAIT; - -diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c -index 3349ea81f9016..b9b847dc097cc 100644 ---- a/net/decnet/af_decnet.c -+++ b/net/decnet/af_decnet.c -@@ -815,7 +815,7 @@ static int dn_auto_bind(struct socket *sock) - static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) - { - struct dn_scp *scp = DN_SK(sk); -- DEFINE_WAIT(wait); -+ DEFINE_WAIT_FUNC(wait, woken_wake_function); - int err; - - if (scp->state != DN_CR) -@@ -825,11 +825,11 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) - scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk)); - dn_send_conn_conf(sk, allocation); - -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); -+ add_wait_queue(sk_sleep(sk), &wait); - for(;;) { - release_sock(sk); - if (scp->state == DN_CC) -- *timeo = schedule_timeout(*timeo); -+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); - lock_sock(sk); - err = 0; - if (scp->state == DN_RUN) -@@ -843,9 +843,8 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) - err = -EAGAIN; - if (!*timeo) - break; -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); - } -- finish_wait(sk_sleep(sk), &wait); -+ remove_wait_queue(sk_sleep(sk), &wait); - if (err == 0) { - sk->sk_socket->state = SS_CONNECTED; - } else if (scp->state != DN_CC) { -@@ -857,7 +856,7 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) - static int dn_wait_run(struct sock *sk, long *timeo) - { - struct dn_scp *scp = DN_SK(sk); -- DEFINE_WAIT(wait); -+ DEFINE_WAIT_FUNC(wait, woken_wake_function); - int err = 0; - - if (scp->state == DN_RUN) -@@ -866,11 +865,11 @@ static int dn_wait_run(struct sock *sk, long *timeo) - if (!*timeo) - return -EALREADY; - -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); -+ add_wait_queue(sk_sleep(sk), &wait); - for(;;) { - release_sock(sk); - if (scp->state == DN_CI || scp->state == DN_CC) -- *timeo = schedule_timeout(*timeo); -+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); - lock_sock(sk); - err = 0; - if (scp->state == DN_RUN) -@@ -884,9 +883,8 @@ static int dn_wait_run(struct sock *sk, long *timeo) - err = -ETIMEDOUT; - if (!*timeo) - break; -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); - } -- finish_wait(sk_sleep(sk), &wait); -+ remove_wait_queue(sk_sleep(sk), &wait); - out: - if (err == 0) { - sk->sk_socket->state = SS_CONNECTED; -@@ -1031,16 +1029,16 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) - - static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) - { -- DEFINE_WAIT(wait); -+ DEFINE_WAIT_FUNC(wait, woken_wake_function); - struct sk_buff *skb = NULL; - int err = 0; - -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); -+ add_wait_queue(sk_sleep(sk), &wait); - for(;;) { - release_sock(sk); - skb = skb_dequeue(&sk->sk_receive_queue); - if (skb == NULL) { -- *timeo = schedule_timeout(*timeo); -+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); - skb = skb_dequeue(&sk->sk_receive_queue); - } - lock_sock(sk); -@@ -1055,9 +1053,8 @@ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) - err = -EAGAIN; - if (!*timeo) - break; -- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); - } -- finish_wait(sk_sleep(sk), &wait); -+ remove_wait_queue(sk_sleep(sk), &wait); - - return skb == NULL ? ERR_PTR(err) : skb; - } -diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c -index 819255ee4e42d..6a0c4326d9cf2 100644 ---- a/net/ipv4/tcp_bpf.c -+++ b/net/ipv4/tcp_bpf.c -@@ -636,7 +636,7 @@ static int __init tcp_bpf_v4_build_proto(void) - tcp_bpf_rebuild_protos(tcp_bpf_prots[TCP_BPF_IPV4], &tcp_prot); - return 0; - } --core_initcall(tcp_bpf_v4_build_proto); -+late_initcall(tcp_bpf_v4_build_proto); - - static void tcp_bpf_update_sk_prot(struct sock *sk, struct sk_psock *psock) - { -diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c -index a9971e41f31bb..8af4fefe371f2 100644 ---- a/net/ipv4/tcp_fastopen.c -+++ b/net/ipv4/tcp_fastopen.c -@@ -504,8 +504,15 @@ void tcp_fastopen_active_disable(struct sock *sk) - { - struct net *net = sock_net(sk); - -+ /* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */ -+ WRITE_ONCE(net->ipv4.tfo_active_disable_stamp, jiffies); -+ -+ /* Paired with smp_rmb() in tcp_fastopen_active_should_disable(). -+ * We want net->ipv4.tfo_active_disable_stamp to be updated first. -+ */ -+ smp_mb__before_atomic(); - atomic_inc(&net->ipv4.tfo_active_disable_times); -- net->ipv4.tfo_active_disable_stamp = jiffies; -+ - NET_INC_STATS(net, LINUX_MIB_TCPFASTOPENBLACKHOLE); - } - -@@ -523,10 +530,16 @@ bool tcp_fastopen_active_should_disable(struct sock *sk) - if (!tfo_da_times) - return false; - -+ /* Paired with smp_mb__before_atomic() in tcp_fastopen_active_disable() */ -+ smp_rmb(); -+ - /* Limit timout to max: 2^6 * initial timeout */ - multiplier = 1 << min(tfo_da_times - 1, 6); -- timeout = multiplier * tfo_bh_timeout * HZ; -- if (time_before(jiffies, sock_net(sk)->ipv4.tfo_active_disable_stamp + timeout)) -+ -+ /* Paired with the WRITE_ONCE() in tcp_fastopen_active_disable(). */ -+ timeout = READ_ONCE(sock_net(sk)->ipv4.tfo_active_disable_stamp) + -+ multiplier * tfo_bh_timeout * HZ; -+ if (time_before(jiffies, timeout)) - return true; - - /* Mark check bit so we can check for successful active TFO -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 4dcbb1ccab25f..33444d9856819 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -477,7 +477,9 @@ int ip6_forward(struct sk_buff *skb) - if (skb_warn_if_lro(skb)) - goto drop; - -- if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { -+ if (!net->ipv6.devconf_all->disable_policy && -+ !idev->cnf.disable_policy && -+ !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { - __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); - goto drop; - } -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index b903fe28ce507..d6fc22f7d7a67 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -3655,7 +3655,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, - err = PTR_ERR(rt->fib6_metrics); - /* Do not leave garbage there. */ - rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics; -- goto out; -+ goto out_free; - } - - if (cfg->fc_flags & RTF_ADDRCONF) -diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c -index 9115f8a7dd45b..a8da88db7893f 100644 ---- a/net/netrom/nr_timer.c -+++ b/net/netrom/nr_timer.c -@@ -121,11 +121,9 @@ static void nr_heartbeat_expiry(struct timer_list *t) - is accepted() it isn't 'dead' so doesn't get removed. */ - if (sock_flag(sk, SOCK_DESTROY) || - (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { -- sock_hold(sk); - bh_unlock_sock(sk); - nr_destroy_socket(sk); -- sock_put(sk); -- return; -+ goto out; - } - break; - -@@ -146,6 +144,8 @@ static void nr_heartbeat_expiry(struct timer_list *t) - - nr_start_heartbeat(sk); - bh_unlock_sock(sk); -+out: -+ sock_put(sk); - } - - static void nr_t2timer_expiry(struct timer_list *t) -@@ -159,6 +159,7 @@ static void nr_t2timer_expiry(struct timer_list *t) - nr_enquiry_response(sk); - } - bh_unlock_sock(sk); -+ sock_put(sk); - } - - static void nr_t4timer_expiry(struct timer_list *t) -@@ -169,6 +170,7 @@ static void nr_t4timer_expiry(struct timer_list *t) - bh_lock_sock(sk); - nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY; - bh_unlock_sock(sk); -+ sock_put(sk); - } - - static void nr_idletimer_expiry(struct timer_list *t) -@@ -197,6 +199,7 @@ static void nr_idletimer_expiry(struct timer_list *t) - sock_set_flag(sk, SOCK_DEAD); - } - bh_unlock_sock(sk); -+ sock_put(sk); - } - - static void nr_t1timer_expiry(struct timer_list *t) -@@ -209,8 +212,7 @@ static void nr_t1timer_expiry(struct timer_list *t) - case NR_STATE_1: - if (nr->n2count == nr->n2) { - nr_disconnect(sk, ETIMEDOUT); -- bh_unlock_sock(sk); -- return; -+ goto out; - } else { - nr->n2count++; - nr_write_internal(sk, NR_CONNREQ); -@@ -220,8 +222,7 @@ static void nr_t1timer_expiry(struct timer_list *t) - case NR_STATE_2: - if (nr->n2count == nr->n2) { - nr_disconnect(sk, ETIMEDOUT); -- bh_unlock_sock(sk); -- return; -+ goto out; - } else { - nr->n2count++; - nr_write_internal(sk, NR_DISCREQ); -@@ -231,8 +232,7 @@ static void nr_t1timer_expiry(struct timer_list *t) - case NR_STATE_3: - if (nr->n2count == nr->n2) { - nr_disconnect(sk, ETIMEDOUT); -- bh_unlock_sock(sk); -- return; -+ goto out; - } else { - nr->n2count++; - nr_requeue_frames(sk); -@@ -241,5 +241,7 @@ static void nr_t1timer_expiry(struct timer_list *t) - } - - nr_start_t1timer(sk); -+out: - bh_unlock_sock(sk); -+ sock_put(sk); - } -diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c -index e858a0a9c0457..f60d349542b10 100644 ---- a/net/sched/act_skbmod.c -+++ b/net/sched/act_skbmod.c -@@ -6,6 +6,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -33,6 +34,13 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, - tcf_lastuse_update(&d->tcf_tm); - bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb); - -+ action = READ_ONCE(d->tcf_action); -+ if (unlikely(action == TC_ACT_SHOT)) -+ goto drop; -+ -+ if (!skb->dev || skb->dev->type != ARPHRD_ETHER) -+ return action; -+ - /* XXX: if you are going to edit more fields beyond ethernet header - * (example when you add IP header replacement or vlan swap) - * then MAX_EDIT_LEN needs to change appropriately -@@ -41,10 +49,6 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, - if (unlikely(err)) /* best policy is to drop on the floor */ - goto drop; - -- action = READ_ONCE(d->tcf_action); -- if (unlikely(action == TC_ACT_SHOT)) -- goto drop; -- - p = rcu_dereference_bh(d->skbmod_p); - flags = p->flags; - if (flags & SKBMOD_F_DMAC) -diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c -index 83e5a8aa2fb11..7f20fd37e01e0 100644 ---- a/net/sched/cls_api.c -+++ b/net/sched/cls_api.c -@@ -2866,7 +2866,7 @@ replay: - break; - case RTM_GETCHAIN: - err = tc_chain_notify(chain, skb, n->nlmsg_seq, -- n->nlmsg_seq, n->nlmsg_type, true); -+ n->nlmsg_flags, n->nlmsg_type, true); - if (err < 0) - NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); - break; -diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c -index 3e81f87d0c89f..684187a1fdb91 100644 ---- a/net/sched/cls_tcindex.c -+++ b/net/sched/cls_tcindex.c -@@ -278,6 +278,8 @@ static int tcindex_filter_result_init(struct tcindex_filter_result *r, - TCA_TCINDEX_POLICE); - } - -+static void tcindex_free_perfect_hash(struct tcindex_data *cp); -+ - static void tcindex_partial_destroy_work(struct work_struct *work) - { - struct tcindex_data *p = container_of(to_rcu_work(work), -@@ -285,7 +287,8 @@ static void tcindex_partial_destroy_work(struct work_struct *work) - rwork); - - rtnl_lock(); -- kfree(p->perfect); -+ if (p->perfect) -+ tcindex_free_perfect_hash(p); - kfree(p); - rtnl_unlock(); - } -diff --git a/net/sctp/auth.c b/net/sctp/auth.c -index 1d898ee4018c9..7eced1e523a5e 100644 ---- a/net/sctp/auth.c -+++ b/net/sctp/auth.c -@@ -866,6 +866,8 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, - if (replace) { - list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); -+ if (asoc && asoc->active_key_id == auth_key->sca_keynumber) -+ sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); - } - list_add(&cur_key->key_list, sh_keys); - -diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c -index ef1289cc78a48..30021ab5e0e99 100644 ---- a/sound/isa/sb/sb16_csp.c -+++ b/sound/isa/sb/sb16_csp.c -@@ -814,6 +814,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel - mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); -+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); - - spin_lock(&p->chip->reg_lock); - set_mode_register(p->chip, 0xc0); /* c0 = STOP */ -@@ -853,6 +854,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel - spin_unlock(&p->chip->reg_lock); - - /* restore PCM volume */ -+ spin_lock_irqsave(&p->chip->mixer_lock, flags); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); - spin_unlock_irqrestore(&p->chip->mixer_lock, flags); -@@ -878,6 +880,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p) - mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); -+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); - - spin_lock(&p->chip->reg_lock); - if (p->running & SNDRV_SB_CSP_ST_QSOUND) { -@@ -892,6 +895,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p) - spin_unlock(&p->chip->reg_lock); - - /* restore PCM volume */ -+ spin_lock_irqsave(&p->chip->mixer_lock, flags); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); - snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); - spin_unlock_irqrestore(&p->chip->mixer_lock, flags); -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index f620b402b309f..5128a5df16fd3 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -1820,6 +1820,7 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) - static const struct snd_pci_quirk force_connect_list[] = { - SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), - SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), -+ SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), - {} - }; - -diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c -index f70b9f7e68bba..281957a8fa867 100644 ---- a/sound/soc/codecs/rt5631.c -+++ b/sound/soc/codecs/rt5631.c -@@ -1691,6 +1691,8 @@ static const struct regmap_config rt5631_regmap_config = { - .reg_defaults = rt5631_reg, - .num_reg_defaults = ARRAY_SIZE(rt5631_reg), - .cache_type = REGCACHE_RBTREE, -+ .use_single_read = true, -+ .use_single_write = true, - }; - - static int rt5631_i2c_probe(struct i2c_client *i2c, -diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c -index 22841ed2411e2..67eb1293fa155 100644 ---- a/sound/usb/mixer.c -+++ b/sound/usb/mixer.c -@@ -3242,7 +3242,15 @@ static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, - { - struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); - static const char * const val_types[] = { -- "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32", -+ [USB_MIXER_BOOLEAN] = "BOOLEAN", -+ [USB_MIXER_INV_BOOLEAN] = "INV_BOOLEAN", -+ [USB_MIXER_S8] = "S8", -+ [USB_MIXER_U8] = "U8", -+ [USB_MIXER_S16] = "S16", -+ [USB_MIXER_U16] = "U16", -+ [USB_MIXER_S32] = "S32", -+ [USB_MIXER_U32] = "U32", -+ [USB_MIXER_BESPOKEN] = "BESPOKEN", - }; - snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " - "channels=%i, type=\"%s\"\n", cval->head.id, -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 186e90e3636c7..5b17a5c5785c0 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -1840,6 +1840,9 @@ static const struct registration_quirk registration_quirks[] = { - REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ - REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ - REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ -+ REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ -+ REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ -+ REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ - { 0 } /* terminator */ - }; - -diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c -index 88264abaa738a..a209f53901b8c 100644 ---- a/tools/bpf/bpftool/common.c -+++ b/tools/bpf/bpftool/common.c -@@ -171,6 +171,11 @@ int mount_bpffs_for_pin(const char *name) - int err = 0; - - file = malloc(strlen(name) + 1); -+ if (!file) { -+ p_err("mem alloc failed"); -+ return -1; -+ } -+ - strcpy(file, name); - dir = dirname(file); - -diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c -index 0d524ef3606d7..6b6bb86d62d35 100644 ---- a/tools/perf/builtin-inject.c -+++ b/tools/perf/builtin-inject.c -@@ -836,8 +836,10 @@ int cmd_inject(int argc, const char **argv) - - data.path = inject.input_name; - inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); -- if (IS_ERR(inject.session)) -- return PTR_ERR(inject.session); -+ if (IS_ERR(inject.session)) { -+ ret = PTR_ERR(inject.session); -+ goto out_close_output; -+ } - - if (zstd_init(&(inject.session->zstd_data), 0) < 0) - pr_warning("Decompression initialization failed.\n"); -@@ -874,5 +876,7 @@ int cmd_inject(int argc, const char **argv) - out_delete: - zstd_fini(&(inject.session->zstd_data)); - perf_session__delete(inject.session); -+out_close_output: -+ perf_data__close(&inject.output); - return ret; - } -diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c -index da016f398aa80..f3ff825d9dd33 100644 ---- a/tools/perf/builtin-script.c -+++ b/tools/perf/builtin-script.c -@@ -2474,6 +2474,12 @@ static void perf_script__exit_per_event_dump_stats(struct perf_script *script) - } - } - -+static void perf_script__exit(struct perf_script *script) -+{ -+ perf_thread_map__put(script->threads); -+ perf_cpu_map__put(script->cpus); -+} -+ - static int __cmd_script(struct perf_script *script) - { - int ret; -@@ -3893,6 +3899,7 @@ out_delete: - - perf_evlist__free_stats(session->evlist); - perf_session__delete(session); -+ perf_script__exit(&script); - - if (script_started) - cleanup_scripting(); -diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c -index c727379cf20e1..195b29797acc4 100644 ---- a/tools/perf/tests/event_update.c -+++ b/tools/perf/tests/event_update.c -@@ -119,6 +119,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu - TEST_ASSERT_VAL("failed to synthesize attr update cpus", - !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); - -- perf_cpu_map__put(evsel->core.own_cpus); -+ evlist__delete(evlist); - return 0; - } -diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c -index 22daf2bdf5faf..f4a2c0df09549 100644 ---- a/tools/perf/tests/topology.c -+++ b/tools/perf/tests/topology.c -@@ -52,6 +52,7 @@ static int session_write_header(char *path) - TEST_ASSERT_VAL("failed to write header", - !perf_session__write_header(session, session->evlist, data.file.fd, true)); - -+ evlist__delete(session->evlist); - perf_session__delete(session); - - return 0; -diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c -index 7534455ffc6a6..a3f912615690f 100644 ---- a/tools/perf/util/data.c -+++ b/tools/perf/util/data.c -@@ -20,7 +20,7 @@ - - static void close_dir(struct perf_data_file *files, int nr) - { -- while (--nr >= 1) { -+ while (--nr >= 0) { - close(files[nr].fd); - zfree(&files[nr].path); - } -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index ab2e130dc07a6..7f07a5dc555f8 100644 ---- a/tools/perf/util/dso.c -+++ b/tools/perf/util/dso.c -@@ -1086,8 +1086,10 @@ struct map *dso__new_map(const char *name) - struct map *map = NULL; - struct dso *dso = dso__new(name); - -- if (dso) -+ if (dso) { - map = map__new2(0, dso); -+ dso__put(dso); -+ } - - return map; - } -diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c -index 018ecf7b6da9b..0fafcf264d235 100644 ---- a/tools/perf/util/env.c -+++ b/tools/perf/util/env.c -@@ -175,6 +175,7 @@ void perf_env__exit(struct perf_env *env) - zfree(&env->cpuid); - zfree(&env->cmdline); - zfree(&env->cmdline_argv); -+ zfree(&env->sibling_dies); - zfree(&env->sibling_cores); - zfree(&env->sibling_threads); - zfree(&env->pmu_mappings); -diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c -index 39062df026291..51424cdc3b682 100644 ---- a/tools/perf/util/lzma.c -+++ b/tools/perf/util/lzma.c -@@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) - - if (ferror(infile)) { - pr_err("lzma: read error: %s\n", strerror(errno)); -- goto err_fclose; -+ goto err_lzma_end; - } - - if (feof(infile)) -@@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) - - if (writen(output_fd, buf_out, write_size) != write_size) { - pr_err("lzma: write error: %s\n", strerror(errno)); -- goto err_fclose; -+ goto err_lzma_end; - } - - strm.next_out = buf_out; -@@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd) - break; - - pr_err("lzma: failed %s\n", lzma_strerror(ret)); -- goto err_fclose; -+ goto err_lzma_end; - } - } - - err = 0; -+err_lzma_end: -+ lzma_end(&strm); - err_fclose: - fclose(infile); - return err; -diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c -index 571e99c908a0e..1ae5c51a70359 100644 ---- a/tools/perf/util/map.c -+++ b/tools/perf/util/map.c -@@ -214,6 +214,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, - if (!(prot & PROT_EXEC)) - dso__set_loaded(dso); - } -+ -+ nsinfo__put(dso->nsinfo); - dso->nsinfo = nsi; - dso__put(dso); - } -diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c -index a5cb1a3a10644..6357ac508ad1e 100644 ---- a/tools/perf/util/probe-event.c -+++ b/tools/perf/util/probe-event.c -@@ -175,8 +175,10 @@ struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user) - struct map *map; - - map = dso__new_map(target); -- if (map && map->dso) -+ if (map && map->dso) { -+ nsinfo__put(map->dso->nsinfo); - map->dso->nsinfo = nsinfo__get(nsi); -+ } - return map; - } else { - return kernel_get_module_map(target); -diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c -index f778f8e7e65a3..5558e2adebe4e 100644 ---- a/tools/perf/util/probe-file.c -+++ b/tools/perf/util/probe-file.c -@@ -337,11 +337,11 @@ int probe_file__del_events(int fd, struct strfilter *filter) - - ret = probe_file__get_events(fd, filter, namelist); - if (ret < 0) -- return ret; -+ goto out; - - ret = probe_file__del_strlist(fd, namelist); -+out: - strlist__delete(namelist); -- - return ret; - } - -diff --git a/tools/testing/selftests/net/icmp_redirect.sh b/tools/testing/selftests/net/icmp_redirect.sh -index bf361f30d6ef9..104a7a5f13b1e 100755 ---- a/tools/testing/selftests/net/icmp_redirect.sh -+++ b/tools/testing/selftests/net/icmp_redirect.sh -@@ -309,9 +309,10 @@ check_exception() - fi - log_test $? 0 "IPv4: ${desc}" - -- if [ "$with_redirect" = "yes" ]; then -+ # No PMTU info for test "redirect" and "mtu exception plus redirect" -+ if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then - ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \ -- grep -q "${H2_N2_IP6} from :: via ${R2_LLADDR} dev br0.*${mtu}" -+ grep -v "mtu" | grep -q "${H2_N2_IP6} .*via ${R2_LLADDR} dev br0" - elif [ -n "${mtu}" ]; then - ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \ - grep -q "${mtu}" -diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c -index d3362777a4258..17ac167823a6d 100644 ---- a/tools/testing/selftests/vm/userfaultfd.c -+++ b/tools/testing/selftests/vm/userfaultfd.c -@@ -139,8 +139,10 @@ static int anon_release_pages(char *rel_area) - - static void anon_allocate_area(void **alloc_area) - { -- if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) { -- fprintf(stderr, "out of memory\n"); -+ *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); -+ if (*alloc_area == MAP_FAILED) -+ fprintf(stderr, "mmap of anonymous memory failed"); - *alloc_area = NULL; - } - } diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.136-137.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.136-137.patch deleted file mode 100644 index 535b258530..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.136-137.patch +++ /dev/null @@ -1,692 +0,0 @@ -diff --git a/Makefile b/Makefile -index 1c565572bfb24..7cd8862d854ed 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 136 -+SUBLEVEL = 137 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts -index 37bd41ff8dffa..151c0220047dd 100644 ---- a/arch/arm/boot/dts/versatile-ab.dts -+++ b/arch/arm/boot/dts/versatile-ab.dts -@@ -195,16 +195,15 @@ - #size-cells = <1>; - ranges; - -- vic: intc@10140000 { -+ vic: interrupt-controller@10140000 { - compatible = "arm,versatile-vic"; - interrupt-controller; - #interrupt-cells = <1>; - reg = <0x10140000 0x1000>; -- clear-mask = <0xffffffff>; - valid-mask = <0xffffffff>; - }; - -- sic: intc@10003000 { -+ sic: interrupt-controller@10003000 { - compatible = "arm,versatile-sic"; - interrupt-controller; - #interrupt-cells = <1>; -diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts -index 06a0fdf24026c..e7e751a858d81 100644 ---- a/arch/arm/boot/dts/versatile-pb.dts -+++ b/arch/arm/boot/dts/versatile-pb.dts -@@ -7,7 +7,7 @@ - - amba { - /* The Versatile PB is using more SIC IRQ lines than the AB */ -- sic: intc@10003000 { -+ sic: interrupt-controller@10003000 { - clear-mask = <0xffffffff>; - /* - * Valid interrupt lines mask according to -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 377157656a8b6..5d35b9656b67d 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -475,8 +475,6 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu, - - if (!vcpu->arch.exception.pending && !vcpu->arch.exception.injected) { - queue: -- if (has_error && !is_protmode(vcpu)) -- has_error = false; - if (reinject) { - /* - * On vmentry, vcpu->arch.exception.pending is only -@@ -7592,6 +7590,13 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu) - kvm_x86_ops->update_cr8_intercept(vcpu, tpr, max_irr); - } - -+static void kvm_inject_exception(struct kvm_vcpu *vcpu) -+{ -+ if (vcpu->arch.exception.error_code && !is_protmode(vcpu)) -+ vcpu->arch.exception.error_code = false; -+ kvm_x86_ops->queue_exception(vcpu); -+} -+ - static int inject_pending_event(struct kvm_vcpu *vcpu) - { - int r; -@@ -7599,7 +7604,7 @@ static int inject_pending_event(struct kvm_vcpu *vcpu) - /* try to reinject previous events if any */ - - if (vcpu->arch.exception.injected) -- kvm_x86_ops->queue_exception(vcpu); -+ kvm_inject_exception(vcpu); - /* - * Do not inject an NMI or interrupt if there is a pending - * exception. Exceptions and interrupts are recognized at -@@ -7665,7 +7670,7 @@ static int inject_pending_event(struct kvm_vcpu *vcpu) - } - } - -- kvm_x86_ops->queue_exception(vcpu); -+ kvm_inject_exception(vcpu); - } - - /* Don't consider new event if we re-injected an event */ -diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c -index 7b6903bad4085..48e6e2b489241 100644 ---- a/drivers/firmware/arm_scmi/driver.c -+++ b/drivers/firmware/arm_scmi/driver.c -@@ -54,7 +54,6 @@ enum scmi_error_codes { - SCMI_ERR_GENERIC = -8, /* Generic Error */ - SCMI_ERR_HARDWARE = -9, /* Hardware Error */ - SCMI_ERR_PROTOCOL = -10,/* Protocol Error */ -- SCMI_ERR_MAX - }; - - /* List of all SCMI devices active in system */ -@@ -176,8 +175,10 @@ static const int scmi_linux_errmap[] = { - - static inline int scmi_to_linux_errno(int errno) - { -- if (errno < SCMI_SUCCESS && errno > SCMI_ERR_MAX) -- return scmi_linux_errmap[-errno]; -+ int err_idx = -errno; -+ -+ if (err_idx >= SCMI_SUCCESS && err_idx < ARRAY_SIZE(scmi_linux_errmap)) -+ return scmi_linux_errmap[err_idx]; - return -EIO; - } - -@@ -693,8 +694,9 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) - struct scmi_xfers_info *info = &sinfo->tx_minfo; - - /* Pre-allocated messages, no more than what hdr.seq can support */ -- if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { -- dev_err(dev, "Maximum message of %d exceeds supported %ld\n", -+ if (WARN_ON(!desc->max_msg || desc->max_msg > MSG_TOKEN_MAX)) { -+ dev_err(dev, -+ "Invalid maximum messages %d, not in range [1 - %lu]\n", - desc->max_msg, MSG_TOKEN_MAX); - return -EINVAL; - } -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index bf6b4f71dc58f..defee1d208d22 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -498,8 +498,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, - p = buf; - while (bytes_left >= sizeof(*p)) { - info->speed = le64_to_cpu(p->LinkSpeed); -- info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE); -- info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE); -+ info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0; -+ info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0; - - cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count); - cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed); -diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c -index 4af318fbda774..ef9498a6e88ac 100644 ---- a/fs/hfs/bfind.c -+++ b/fs/hfs/bfind.c -@@ -25,7 +25,19 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) - fd->key = ptr + tree->max_key_len + 2; - hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n", - tree->cnid, __builtin_return_address(0)); -- mutex_lock(&tree->tree_lock); -+ switch (tree->cnid) { -+ case HFS_CAT_CNID: -+ mutex_lock_nested(&tree->tree_lock, CATALOG_BTREE_MUTEX); -+ break; -+ case HFS_EXT_CNID: -+ mutex_lock_nested(&tree->tree_lock, EXTENTS_BTREE_MUTEX); -+ break; -+ case HFS_ATTR_CNID: -+ mutex_lock_nested(&tree->tree_lock, ATTR_BTREE_MUTEX); -+ break; -+ default: -+ return -EINVAL; -+ } - return 0; - } - -diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c -index b63a4df7327b6..c0a73a6ffb28b 100644 ---- a/fs/hfs/bnode.c -+++ b/fs/hfs/bnode.c -@@ -15,16 +15,31 @@ - - #include "btree.h" - --void hfs_bnode_read(struct hfs_bnode *node, void *buf, -- int off, int len) -+void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len) - { - struct page *page; -+ int pagenum; -+ int bytes_read; -+ int bytes_to_read; -+ void *vaddr; - - off += node->page_offset; -- page = node->page[0]; -+ pagenum = off >> PAGE_SHIFT; -+ off &= ~PAGE_MASK; /* compute page offset for the first page */ - -- memcpy(buf, kmap(page) + off, len); -- kunmap(page); -+ for (bytes_read = 0; bytes_read < len; bytes_read += bytes_to_read) { -+ if (pagenum >= node->tree->pages_per_bnode) -+ break; -+ page = node->page[pagenum]; -+ bytes_to_read = min_t(int, len - bytes_read, PAGE_SIZE - off); -+ -+ vaddr = kmap_atomic(page); -+ memcpy(buf + bytes_read, vaddr + off, bytes_to_read); -+ kunmap_atomic(vaddr); -+ -+ pagenum++; -+ off = 0; /* page offset only applies to the first page */ -+ } - } - - u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off) -diff --git a/fs/hfs/btree.h b/fs/hfs/btree.h -index dcc2aab1b2c43..25ac9a8bb57a7 100644 ---- a/fs/hfs/btree.h -+++ b/fs/hfs/btree.h -@@ -13,6 +13,13 @@ typedef int (*btree_keycmp)(const btree_key *, const btree_key *); - - #define NODE_HASH_SIZE 256 - -+/* B-tree mutex nested subclasses */ -+enum hfs_btree_mutex_classes { -+ CATALOG_BTREE_MUTEX, -+ EXTENTS_BTREE_MUTEX, -+ ATTR_BTREE_MUTEX, -+}; -+ - /* A HFS BTree held in memory */ - struct hfs_btree { - struct super_block *sb; -diff --git a/fs/hfs/super.c b/fs/hfs/super.c -index c33324686d89e..bcf820ce0e02e 100644 ---- a/fs/hfs/super.c -+++ b/fs/hfs/super.c -@@ -421,14 +421,12 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) - if (!res) { - if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) { - res = -EIO; -- goto bail; -+ goto bail_hfs_find; - } - hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength); - } -- if (res) { -- hfs_find_exit(&fd); -- goto bail_no_root; -- } -+ if (res) -+ goto bail_hfs_find; - res = -EINVAL; - root_inode = hfs_iget(sb, &fd.search_key->cat, &rec); - hfs_find_exit(&fd); -@@ -444,6 +442,8 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) - /* everything's okay */ - return 0; - -+bail_hfs_find: -+ hfs_find_exit(&fd); - bail_no_root: - pr_err("get root inode failed\n"); - bail: -diff --git a/fs/internal.h b/fs/internal.h -index 7651e8b8ef136..61aed95f83d1e 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -52,7 +52,6 @@ extern void __init chrdev_init(void); - */ - extern const struct fs_context_operations legacy_fs_context_ops; - extern int parse_monolithic_mount_data(struct fs_context *, void *); --extern void fc_drop_locked(struct fs_context *); - extern void vfs_clean_context(struct fs_context *fc); - extern int finish_clean_context(struct fs_context *fc); - -diff --git a/fs/iomap/seek.c b/fs/iomap/seek.c -index c04bad4b2b43f..10c4c1e80124f 100644 ---- a/fs/iomap/seek.c -+++ b/fs/iomap/seek.c -@@ -140,23 +140,20 @@ loff_t - iomap_seek_hole(struct inode *inode, loff_t offset, const struct iomap_ops *ops) - { - loff_t size = i_size_read(inode); -- loff_t length = size - offset; - loff_t ret; - - /* Nothing to be found before or beyond the end of the file. */ - if (offset < 0 || offset >= size) - return -ENXIO; - -- while (length > 0) { -- ret = iomap_apply(inode, offset, length, IOMAP_REPORT, ops, -- &offset, iomap_seek_hole_actor); -+ while (offset < size) { -+ ret = iomap_apply(inode, offset, size - offset, IOMAP_REPORT, -+ ops, &offset, iomap_seek_hole_actor); - if (ret < 0) - return ret; - if (ret == 0) - break; -- - offset += ret; -- length -= ret; - } - - return offset; -@@ -186,27 +183,23 @@ loff_t - iomap_seek_data(struct inode *inode, loff_t offset, const struct iomap_ops *ops) - { - loff_t size = i_size_read(inode); -- loff_t length = size - offset; - loff_t ret; - - /* Nothing to be found before or beyond the end of the file. */ - if (offset < 0 || offset >= size) - return -ENXIO; - -- while (length > 0) { -- ret = iomap_apply(inode, offset, length, IOMAP_REPORT, ops, -- &offset, iomap_seek_data_actor); -+ while (offset < size) { -+ ret = iomap_apply(inode, offset, size - offset, IOMAP_REPORT, -+ ops, &offset, iomap_seek_data_actor); - if (ret < 0) - return ret; - if (ret == 0) -- break; -- -+ return offset; - offset += ret; -- length -= ret; - } - -- if (length <= 0) -- return -ENXIO; -- return offset; -+ /* We've reached the end of the file without finding data */ -+ return -ENXIO; - } - EXPORT_SYMBOL_GPL(iomap_seek_data); -diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h -index e5c14e2c53d35..ba8a58754340d 100644 ---- a/include/linux/fs_context.h -+++ b/include/linux/fs_context.h -@@ -134,6 +134,7 @@ extern int vfs_parse_fs_string(struct fs_context *fc, const char *key, - extern int generic_parse_monolithic(struct fs_context *fc, void *data); - extern int vfs_get_tree(struct fs_context *fc); - extern void put_fs_context(struct fs_context *fc); -+extern void fc_drop_locked(struct fs_context *fc); - - /* - * sget() wrappers to be called from the ->get_tree() op. -diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h -index 86e028388badc..9899b9af7f22f 100644 ---- a/include/net/busy_poll.h -+++ b/include/net/busy_poll.h -@@ -36,7 +36,7 @@ static inline bool net_busy_loop_on(void) - - static inline bool sk_can_busy_loop(const struct sock *sk) - { -- return sk->sk_ll_usec && !signal_pending(current); -+ return READ_ONCE(sk->sk_ll_usec) && !signal_pending(current); - } - - bool sk_busy_loop_end(void *p, unsigned long start_time); -diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h -index 06e1deeef4640..8c6b04f9f6cbe 100644 ---- a/include/net/sctp/constants.h -+++ b/include/net/sctp/constants.h -@@ -328,8 +328,7 @@ enum { - #define SCTP_SCOPE_POLICY_MAX SCTP_SCOPE_POLICY_LINK - - /* Based on IPv4 scoping , -- * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24, -- * 192.88.99.0/24. -+ * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 192.88.99.0/24. - * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP - * addresses. - */ -@@ -337,7 +336,6 @@ enum { - ((htonl(INADDR_BROADCAST) == a) || \ - ipv4_is_multicast(a) || \ - ipv4_is_zeronet(a) || \ -- ipv4_is_test_198(a) || \ - ipv4_is_anycast_6to4(a)) - - /* Flags used for the bind address copy functions. */ -diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c -index 9329f725d22b6..2d0ef613ca070 100644 ---- a/kernel/cgroup/cgroup-v1.c -+++ b/kernel/cgroup/cgroup-v1.c -@@ -1228,9 +1228,7 @@ int cgroup1_get_tree(struct fs_context *fc) - ret = cgroup_do_get_tree(fc); - - if (!ret && percpu_ref_is_dying(&ctx->root->cgrp.self.refcnt)) { -- struct super_block *sb = fc->root->d_sb; -- dput(fc->root); -- deactivate_locked_super(sb); -+ fc_drop_locked(fc); - ret = 1; - } - -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 8f41499d8257d..6aeb53b4e19f8 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -3660,15 +3660,21 @@ static void pwq_unbound_release_workfn(struct work_struct *work) - unbound_release_work); - struct workqueue_struct *wq = pwq->wq; - struct worker_pool *pool = pwq->pool; -- bool is_last; -+ bool is_last = false; - -- if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) -- return; -+ /* -+ * when @pwq is not linked, it doesn't hold any reference to the -+ * @wq, and @wq is invalid to access. -+ */ -+ if (!list_empty(&pwq->pwqs_node)) { -+ if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) -+ return; - -- mutex_lock(&wq->mutex); -- list_del_rcu(&pwq->pwqs_node); -- is_last = list_empty(&wq->pwqs); -- mutex_unlock(&wq->mutex); -+ mutex_lock(&wq->mutex); -+ list_del_rcu(&pwq->pwqs_node); -+ is_last = list_empty(&wq->pwqs); -+ mutex_unlock(&wq->mutex); -+ } - - mutex_lock(&wq_pool_mutex); - put_unbound_pool(pool); -diff --git a/net/802/garp.c b/net/802/garp.c -index 400bd857e5f57..f6012f8e59f00 100644 ---- a/net/802/garp.c -+++ b/net/802/garp.c -@@ -203,6 +203,19 @@ static void garp_attr_destroy(struct garp_applicant *app, struct garp_attr *attr - kfree(attr); - } - -+static void garp_attr_destroy_all(struct garp_applicant *app) -+{ -+ struct rb_node *node, *next; -+ struct garp_attr *attr; -+ -+ for (node = rb_first(&app->gid); -+ next = node ? rb_next(node) : NULL, node != NULL; -+ node = next) { -+ attr = rb_entry(node, struct garp_attr, node); -+ garp_attr_destroy(app, attr); -+ } -+} -+ - static int garp_pdu_init(struct garp_applicant *app) - { - struct sk_buff *skb; -@@ -609,6 +622,7 @@ void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl - - spin_lock_bh(&app->lock); - garp_gid_event(app, GARP_EVENT_TRANSMIT_PDU); -+ garp_attr_destroy_all(app); - garp_pdu_queue(app); - spin_unlock_bh(&app->lock); - -diff --git a/net/802/mrp.c b/net/802/mrp.c -index 2cfdfbfbb2edb..5b804dbe2d08f 100644 ---- a/net/802/mrp.c -+++ b/net/802/mrp.c -@@ -292,6 +292,19 @@ static void mrp_attr_destroy(struct mrp_applicant *app, struct mrp_attr *attr) - kfree(attr); - } - -+static void mrp_attr_destroy_all(struct mrp_applicant *app) -+{ -+ struct rb_node *node, *next; -+ struct mrp_attr *attr; -+ -+ for (node = rb_first(&app->mad); -+ next = node ? rb_next(node) : NULL, node != NULL; -+ node = next) { -+ attr = rb_entry(node, struct mrp_attr, node); -+ mrp_attr_destroy(app, attr); -+ } -+} -+ - static int mrp_pdu_init(struct mrp_applicant *app) - { - struct sk_buff *skb; -@@ -895,6 +908,7 @@ void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *appl) - - spin_lock_bh(&app->lock); - mrp_mad_event(app, MRP_EVENT_TX); -+ mrp_attr_destroy_all(app); - mrp_pdu_queue(app); - spin_unlock_bh(&app->lock); - -diff --git a/net/core/sock.c b/net/core/sock.c -index 68f84fac63e0b..452883b28abab 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -1098,7 +1098,7 @@ set_rcvbuf: - if (val < 0) - ret = -EINVAL; - else -- sk->sk_ll_usec = val; -+ WRITE_ONCE(sk->sk_ll_usec, val); - } - break; - #endif -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 33444d9856819..fc913f09606db 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -59,10 +59,38 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * - { - struct dst_entry *dst = skb_dst(skb); - struct net_device *dev = dst->dev; -+ unsigned int hh_len = LL_RESERVED_SPACE(dev); -+ int delta = hh_len - skb_headroom(skb); - const struct in6_addr *nexthop; - struct neighbour *neigh; - int ret; - -+ /* Be paranoid, rather than too clever. */ -+ if (unlikely(delta > 0) && dev->header_ops) { -+ /* pskb_expand_head() might crash, if skb is shared */ -+ if (skb_shared(skb)) { -+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); -+ -+ if (likely(nskb)) { -+ if (skb->sk) -+ skb_set_owner_w(nskb, skb->sk); -+ consume_skb(skb); -+ } else { -+ kfree_skb(skb); -+ } -+ skb = nskb; -+ } -+ if (skb && -+ pskb_expand_head(skb, SKB_DATA_ALIGN(delta), 0, GFP_ATOMIC)) { -+ kfree_skb(skb); -+ skb = NULL; -+ } -+ if (!skb) { -+ IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); -+ return -ENOMEM; -+ } -+ } -+ - if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { - struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); - -diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c -index 7f8702abc7bfe..bb370a7948f42 100644 ---- a/net/sctp/protocol.c -+++ b/net/sctp/protocol.c -@@ -397,7 +397,8 @@ static enum sctp_scope sctp_v4_scope(union sctp_addr *addr) - retval = SCTP_SCOPE_LINK; - } else if (ipv4_is_private_10(addr->v4.sin_addr.s_addr) || - ipv4_is_private_172(addr->v4.sin_addr.s_addr) || -- ipv4_is_private_192(addr->v4.sin_addr.s_addr)) { -+ ipv4_is_private_192(addr->v4.sin_addr.s_addr) || -+ ipv4_is_test_198(addr->v4.sin_addr.s_addr)) { - retval = SCTP_SCOPE_PRIVATE; - } else { - retval = SCTP_SCOPE_GLOBAL; -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index 9f96826eb3ba0..52ee3a9bb7093 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -1512,6 +1512,53 @@ out: - return err; - } - -+static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb) -+{ -+ scm->fp = scm_fp_dup(UNIXCB(skb).fp); -+ -+ /* -+ * Garbage collection of unix sockets starts by selecting a set of -+ * candidate sockets which have reference only from being in flight -+ * (total_refs == inflight_refs). This condition is checked once during -+ * the candidate collection phase, and candidates are marked as such, so -+ * that non-candidates can later be ignored. While inflight_refs is -+ * protected by unix_gc_lock, total_refs (file count) is not, hence this -+ * is an instantaneous decision. -+ * -+ * Once a candidate, however, the socket must not be reinstalled into a -+ * file descriptor while the garbage collection is in progress. -+ * -+ * If the above conditions are met, then the directed graph of -+ * candidates (*) does not change while unix_gc_lock is held. -+ * -+ * Any operations that changes the file count through file descriptors -+ * (dup, close, sendmsg) does not change the graph since candidates are -+ * not installed in fds. -+ * -+ * Dequeing a candidate via recvmsg would install it into an fd, but -+ * that takes unix_gc_lock to decrement the inflight count, so it's -+ * serialized with garbage collection. -+ * -+ * MSG_PEEK is special in that it does not change the inflight count, -+ * yet does install the socket into an fd. The following lock/unlock -+ * pair is to ensure serialization with garbage collection. It must be -+ * done between incrementing the file count and installing the file into -+ * an fd. -+ * -+ * If garbage collection starts after the barrier provided by the -+ * lock/unlock, then it will see the elevated refcount and not mark this -+ * as a candidate. If a garbage collection is already in progress -+ * before the file count was incremented, then the lock/unlock pair will -+ * ensure that garbage collection is finished before progressing to -+ * installing the fd. -+ * -+ * (*) A -> B where B is on the queue of A or B is on the queue of C -+ * which is on the queue of listening socket A. -+ */ -+ spin_lock(&unix_gc_lock); -+ spin_unlock(&unix_gc_lock); -+} -+ - static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) - { - int err = 0; -@@ -2137,7 +2184,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, - sk_peek_offset_fwd(sk, size); - - if (UNIXCB(skb).fp) -- scm.fp = scm_fp_dup(UNIXCB(skb).fp); -+ unix_peek_fds(&scm, skb); - } - err = (flags & MSG_TRUNC) ? skb->len - skip : size; - -@@ -2378,7 +2425,7 @@ unlock: - /* It is questionable, see note in unix_dgram_recvmsg. - */ - if (UNIXCB(skb).fp) -- scm.fp = scm_fp_dup(UNIXCB(skb).fp); -+ unix_peek_fds(&scm, skb); - - sk_peek_offset_fwd(sk, chunk); - -diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include -index 812fc97bb1a97..add0ef37ba967 100644 ---- a/tools/scripts/Makefile.include -+++ b/tools/scripts/Makefile.include -@@ -39,8 +39,6 @@ EXTRA_WARNINGS += -Wundef - EXTRA_WARNINGS += -Wwrite-strings - EXTRA_WARNINGS += -Wformat - --CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?) -- - # Makefiles suck: This macro sets a default value of $(2) for the - # variable named by $(1), unless the variable has been set by - # environment or command line. This is necessary for CC and AR -@@ -52,12 +50,22 @@ define allow-override - $(eval $(1) = $(2))) - endef - -+ifneq ($(LLVM),) -+$(call allow-override,CC,clang) -+$(call allow-override,AR,llvm-ar) -+$(call allow-override,LD,ld.lld) -+$(call allow-override,CXX,clang++) -+$(call allow-override,STRIP,llvm-strip) -+else - # Allow setting various cross-compile vars or setting CROSS_COMPILE as a prefix. - $(call allow-override,CC,$(CROSS_COMPILE)gcc) - $(call allow-override,AR,$(CROSS_COMPILE)ar) - $(call allow-override,LD,$(CROSS_COMPILE)ld) - $(call allow-override,CXX,$(CROSS_COMPILE)g++) - $(call allow-override,STRIP,$(CROSS_COMPILE)strip) -+endif -+ -+CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?) - - ifneq ($(LLVM),) - HOSTAR ?= llvm-ar -diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c -index 17ac167823a6d..9ba7feffe344b 100644 ---- a/tools/testing/selftests/vm/userfaultfd.c -+++ b/tools/testing/selftests/vm/userfaultfd.c -@@ -141,7 +141,7 @@ static void anon_allocate_area(void **alloc_area) - { - *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); -- if (*alloc_area == MAP_FAILED) -+ if (*alloc_area == MAP_FAILED) { - fprintf(stderr, "mmap of anonymous memory failed"); - *alloc_area = NULL; - } diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.137-138.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.137-138.patch deleted file mode 100644 index 8a554d7de0..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.137-138.patch +++ /dev/null @@ -1,1400 +0,0 @@ -diff --git a/Makefile b/Makefile -index 7cd8862d854ed..5a9d6caef82a0 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 137 -+SUBLEVEL = 138 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c -index ce71235c8b81f..16b744646ea94 100644 ---- a/arch/powerpc/platforms/pseries/setup.c -+++ b/arch/powerpc/platforms/pseries/setup.c -@@ -75,7 +75,7 @@ - #include "../../../../drivers/pci/pci.h" - - DEFINE_STATIC_KEY_FALSE(shared_processor); --EXPORT_SYMBOL_GPL(shared_processor); -+EXPORT_SYMBOL(shared_processor); - - int CMO_PrPSP = -1; - int CMO_SecPSP = -1; -diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h -index 6e81788a30c12..0eaca7a130c9f 100644 ---- a/arch/x86/include/asm/proto.h -+++ b/arch/x86/include/asm/proto.h -@@ -4,6 +4,8 @@ - - #include - -+struct task_struct; -+ - /* misc architecture specific prototypes */ - - void syscall_init(void); -diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c -index 24a6905d60ee2..642031b896f64 100644 ---- a/arch/x86/kvm/ioapic.c -+++ b/arch/x86/kvm/ioapic.c -@@ -91,7 +91,7 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, - static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) - { - ioapic->rtc_status.pending_eoi = 0; -- bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID); -+ bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID + 1); - } - - static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic); -diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h -index ea1a4e0297dae..283f1f489bcac 100644 ---- a/arch/x86/kvm/ioapic.h -+++ b/arch/x86/kvm/ioapic.h -@@ -43,13 +43,13 @@ struct kvm_vcpu; - - struct dest_map { - /* vcpu bitmap where IRQ has been sent */ -- DECLARE_BITMAP(map, KVM_MAX_VCPU_ID); -+ DECLARE_BITMAP(map, KVM_MAX_VCPU_ID + 1); - - /* - * Vector sent to a given vcpu, only valid when - * the vcpu's bit in map is set - */ -- u8 vectors[KVM_MAX_VCPU_ID]; -+ u8 vectors[KVM_MAX_VCPU_ID + 1]; - }; - - -diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c -index 55c57b703ea3c..48ca9a844f06b 100644 ---- a/drivers/acpi/resource.c -+++ b/drivers/acpi/resource.c -@@ -430,13 +430,6 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, - } - } - --static bool irq_is_legacy(struct acpi_resource_irq *irq) --{ -- return irq->triggering == ACPI_EDGE_SENSITIVE && -- irq->polarity == ACPI_ACTIVE_HIGH && -- irq->shareable == ACPI_EXCLUSIVE; --} -- - /** - * acpi_dev_resource_interrupt - Extract ACPI interrupt resource information. - * @ares: Input ACPI resource object. -@@ -475,7 +468,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, - } - acpi_dev_get_irqresource(res, irq->interrupts[index], - irq->triggering, irq->polarity, -- irq->shareable, irq_is_legacy(irq)); -+ irq->shareable, true); - break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - ext_irq = &ares->data.extended_irq; -diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c -index b21cf764afc0d..d5425bc1ad61a 100644 ---- a/drivers/hid/wacom_wac.c -+++ b/drivers/hid/wacom_wac.c -@@ -3829,7 +3829,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, - wacom_wac->shared->touch->product == 0xF6) { - input_dev->evbit[0] |= BIT_MASK(EV_SW); - __set_bit(SW_MUTE_DEVICE, input_dev->swbit); -- wacom_wac->shared->has_mute_touch_switch = true; -+ wacom_wac->has_mute_touch_switch = true; - } - /* fall through */ - -diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c -index 73d48c3b8ded3..7d2315c8cacb1 100644 ---- a/drivers/net/can/spi/hi311x.c -+++ b/drivers/net/can/spi/hi311x.c -@@ -218,7 +218,7 @@ static int hi3110_spi_trans(struct spi_device *spi, int len) - return ret; - } - --static u8 hi3110_cmd(struct spi_device *spi, u8 command) -+static int hi3110_cmd(struct spi_device *spi, u8 command) - { - struct hi3110_priv *priv = spi_get_drvdata(spi); - -diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c -index db9f15f17610b..249d2fba28c7f 100644 ---- a/drivers/net/can/usb/ems_usb.c -+++ b/drivers/net/can/usb/ems_usb.c -@@ -255,6 +255,8 @@ struct ems_usb { - unsigned int free_slots; /* remember number of available slots */ - - struct ems_cpc_msg active_params; /* active controller parameters */ -+ void *rxbuf[MAX_RX_URBS]; -+ dma_addr_t rxbuf_dma[MAX_RX_URBS]; - }; - - static void ems_usb_read_interrupt_callback(struct urb *urb) -@@ -587,6 +589,7 @@ static int ems_usb_start(struct ems_usb *dev) - for (i = 0; i < MAX_RX_URBS; i++) { - struct urb *urb = NULL; - u8 *buf = NULL; -+ dma_addr_t buf_dma; - - /* create a URB, and a buffer for it */ - urb = usb_alloc_urb(0, GFP_KERNEL); -@@ -596,7 +599,7 @@ static int ems_usb_start(struct ems_usb *dev) - } - - buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, -- &urb->transfer_dma); -+ &buf_dma); - if (!buf) { - netdev_err(netdev, "No memory left for USB buffer\n"); - usb_free_urb(urb); -@@ -604,6 +607,8 @@ static int ems_usb_start(struct ems_usb *dev) - break; - } - -+ urb->transfer_dma = buf_dma; -+ - usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), - buf, RX_BUFFER_SIZE, - ems_usb_read_bulk_callback, dev); -@@ -619,6 +624,9 @@ static int ems_usb_start(struct ems_usb *dev) - break; - } - -+ dev->rxbuf[i] = buf; -+ dev->rxbuf_dma[i] = buf_dma; -+ - /* Drop reference, USB core will take care of freeing it */ - usb_free_urb(urb); - } -@@ -684,6 +692,10 @@ static void unlink_all_urbs(struct ems_usb *dev) - - usb_kill_anchored_urbs(&dev->rx_submitted); - -+ for (i = 0; i < MAX_RX_URBS; ++i) -+ usb_free_coherent(dev->udev, RX_BUFFER_SIZE, -+ dev->rxbuf[i], dev->rxbuf_dma[i]); -+ - usb_kill_anchored_urbs(&dev->tx_submitted); - atomic_set(&dev->active_tx_urbs, 0); - -diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c -index b5d7ed21d7d9e..485e20e0dec2c 100644 ---- a/drivers/net/can/usb/esd_usb2.c -+++ b/drivers/net/can/usb/esd_usb2.c -@@ -195,6 +195,8 @@ struct esd_usb2 { - int net_count; - u32 version; - int rxinitdone; -+ void *rxbuf[MAX_RX_URBS]; -+ dma_addr_t rxbuf_dma[MAX_RX_URBS]; - }; - - struct esd_usb2_net_priv { -@@ -544,6 +546,7 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev) - for (i = 0; i < MAX_RX_URBS; i++) { - struct urb *urb = NULL; - u8 *buf = NULL; -+ dma_addr_t buf_dma; - - /* create a URB, and a buffer for it */ - urb = usb_alloc_urb(0, GFP_KERNEL); -@@ -553,7 +556,7 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev) - } - - buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, -- &urb->transfer_dma); -+ &buf_dma); - if (!buf) { - dev_warn(dev->udev->dev.parent, - "No memory left for USB buffer\n"); -@@ -561,6 +564,8 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev) - goto freeurb; - } - -+ urb->transfer_dma = buf_dma; -+ - usb_fill_bulk_urb(urb, dev->udev, - usb_rcvbulkpipe(dev->udev, 1), - buf, RX_BUFFER_SIZE, -@@ -573,8 +578,12 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev) - usb_unanchor_urb(urb); - usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, - urb->transfer_dma); -+ goto freeurb; - } - -+ dev->rxbuf[i] = buf; -+ dev->rxbuf_dma[i] = buf_dma; -+ - freeurb: - /* Drop reference, USB core will take care of freeing it */ - usb_free_urb(urb); -@@ -662,6 +671,11 @@ static void unlink_all_urbs(struct esd_usb2 *dev) - int i, j; - - usb_kill_anchored_urbs(&dev->rx_submitted); -+ -+ for (i = 0; i < MAX_RX_URBS; ++i) -+ usb_free_coherent(dev->udev, RX_BUFFER_SIZE, -+ dev->rxbuf[i], dev->rxbuf_dma[i]); -+ - for (i = 0; i < dev->net_count; i++) { - priv = dev->nets[i]; - if (priv) { -diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c -index c5ed73d45623d..41eee6f0491c6 100644 ---- a/drivers/net/can/usb/mcba_usb.c -+++ b/drivers/net/can/usb/mcba_usb.c -@@ -653,6 +653,8 @@ static int mcba_usb_start(struct mcba_priv *priv) - break; - } - -+ urb->transfer_dma = buf_dma; -+ - usb_fill_bulk_urb(urb, priv->udev, - usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), - buf, MCBA_USB_RX_BUFF_SIZE, -diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c -index 8fa224b28218b..c43e98bb6e2d7 100644 ---- a/drivers/net/can/usb/usb_8dev.c -+++ b/drivers/net/can/usb/usb_8dev.c -@@ -137,7 +137,8 @@ struct usb_8dev_priv { - u8 *cmd_msg_buffer; - - struct mutex usb_8dev_cmd_lock; -- -+ void *rxbuf[MAX_RX_URBS]; -+ dma_addr_t rxbuf_dma[MAX_RX_URBS]; - }; - - /* tx frame */ -@@ -733,6 +734,7 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) - for (i = 0; i < MAX_RX_URBS; i++) { - struct urb *urb = NULL; - u8 *buf; -+ dma_addr_t buf_dma; - - /* create a URB, and a buffer for it */ - urb = usb_alloc_urb(0, GFP_KERNEL); -@@ -742,7 +744,7 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) - } - - buf = usb_alloc_coherent(priv->udev, RX_BUFFER_SIZE, GFP_KERNEL, -- &urb->transfer_dma); -+ &buf_dma); - if (!buf) { - netdev_err(netdev, "No memory left for USB buffer\n"); - usb_free_urb(urb); -@@ -750,6 +752,8 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) - break; - } - -+ urb->transfer_dma = buf_dma; -+ - usb_fill_bulk_urb(urb, priv->udev, - usb_rcvbulkpipe(priv->udev, - USB_8DEV_ENDP_DATA_RX), -@@ -767,6 +771,9 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) - break; - } - -+ priv->rxbuf[i] = buf; -+ priv->rxbuf_dma[i] = buf_dma; -+ - /* Drop reference, USB core will take care of freeing it */ - usb_free_urb(urb); - } -@@ -836,6 +843,10 @@ static void unlink_all_urbs(struct usb_8dev_priv *priv) - - usb_kill_anchored_urbs(&priv->rx_submitted); - -+ for (i = 0; i < MAX_RX_URBS; ++i) -+ usb_free_coherent(priv->udev, RX_BUFFER_SIZE, -+ priv->rxbuf[i], priv->rxbuf_dma[i]); -+ - usb_kill_anchored_urbs(&priv->tx_submitted); - atomic_set(&priv->active_tx_urbs, 0); - -diff --git a/drivers/net/ethernet/dec/tulip/winbond-840.c b/drivers/net/ethernet/dec/tulip/winbond-840.c -index 70cb2d689c2cb..79bdd2a79dbd3 100644 ---- a/drivers/net/ethernet/dec/tulip/winbond-840.c -+++ b/drivers/net/ethernet/dec/tulip/winbond-840.c -@@ -367,7 +367,7 @@ static int w840_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; - void __iomem *ioaddr; - -- i = pci_enable_device(pdev); -+ i = pcim_enable_device(pdev); - if (i) return i; - - pci_set_master(pdev); -@@ -389,7 +389,7 @@ static int w840_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - - ioaddr = pci_iomap(pdev, TULIP_BAR, netdev_res_size); - if (!ioaddr) -- goto err_out_free_res; -+ goto err_out_netdev; - - for (i = 0; i < 3; i++) - ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(eeprom_read(ioaddr, i)); -@@ -468,8 +468,6 @@ static int w840_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - - err_out_cleardev: - pci_iounmap(pdev, ioaddr); --err_out_free_res: -- pci_release_regions(pdev); - err_out_netdev: - free_netdev (dev); - return -ENODEV; -@@ -1535,7 +1533,6 @@ static void w840_remove1(struct pci_dev *pdev) - if (dev) { - struct netdev_private *np = netdev_priv(dev); - unregister_netdev(dev); -- pci_release_regions(pdev); - pci_iounmap(pdev, np->base_addr); - free_netdev(dev); - } -diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -index 2288a3855e522..2cc4f63b1e910 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -@@ -977,7 +977,7 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw, - default: - /* if we got here and link is up something bad is afoot */ - netdev_info(netdev, -- "WARNING: Link is up but PHY type 0x%x is not recognized.\n", -+ "WARNING: Link is up but PHY type 0x%x is not recognized, or incorrect cable is in use\n", - hw_link_info->phy_type); - } - -@@ -5087,6 +5087,10 @@ flags_complete: - dev_warn(&pf->pdev->dev, - "Device configuration forbids SW from starting the LLDP agent.\n"); - return -EINVAL; -+ case I40E_AQ_RC_EAGAIN: -+ dev_warn(&pf->pdev->dev, -+ "Stop FW LLDP agent command is still being processed, please try again in a second.\n"); -+ return -EBUSY; - default: - dev_warn(&pf->pdev->dev, - "Starting FW LLDP agent failed: error: %s, %s\n", -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index 4f4ec1f166ef4..21ab7d2caddf5 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -4403,11 +4403,10 @@ int i40e_control_wait_tx_q(int seid, struct i40e_pf *pf, int pf_q, - } - - /** -- * i40e_vsi_control_tx - Start or stop a VSI's rings -+ * i40e_vsi_enable_tx - Start a VSI's rings - * @vsi: the VSI being configured -- * @enable: start or stop the rings - **/ --static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) -+static int i40e_vsi_enable_tx(struct i40e_vsi *vsi) - { - struct i40e_pf *pf = vsi->back; - int i, pf_q, ret = 0; -@@ -4416,7 +4415,7 @@ static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) - for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { - ret = i40e_control_wait_tx_q(vsi->seid, pf, - pf_q, -- false /*is xdp*/, enable); -+ false /*is xdp*/, true); - if (ret) - break; - -@@ -4425,7 +4424,7 @@ static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) - - ret = i40e_control_wait_tx_q(vsi->seid, pf, - pf_q + vsi->alloc_queue_pairs, -- true /*is xdp*/, enable); -+ true /*is xdp*/, true); - if (ret) - break; - } -@@ -4523,32 +4522,25 @@ int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable) - } - - /** -- * i40e_vsi_control_rx - Start or stop a VSI's rings -+ * i40e_vsi_enable_rx - Start a VSI's rings - * @vsi: the VSI being configured -- * @enable: start or stop the rings - **/ --static int i40e_vsi_control_rx(struct i40e_vsi *vsi, bool enable) -+static int i40e_vsi_enable_rx(struct i40e_vsi *vsi) - { - struct i40e_pf *pf = vsi->back; - int i, pf_q, ret = 0; - - pf_q = vsi->base_queue; - for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { -- ret = i40e_control_wait_rx_q(pf, pf_q, enable); -+ ret = i40e_control_wait_rx_q(pf, pf_q, true); - if (ret) { - dev_info(&pf->pdev->dev, -- "VSI seid %d Rx ring %d %sable timeout\n", -- vsi->seid, pf_q, (enable ? "en" : "dis")); -+ "VSI seid %d Rx ring %d enable timeout\n", -+ vsi->seid, pf_q); - break; - } - } - -- /* Due to HW errata, on Rx disable only, the register can indicate done -- * before it really is. Needs 50ms to be sure -- */ -- if (!enable) -- mdelay(50); -- - return ret; - } - -@@ -4561,29 +4553,47 @@ int i40e_vsi_start_rings(struct i40e_vsi *vsi) - int ret = 0; - - /* do rx first for enable and last for disable */ -- ret = i40e_vsi_control_rx(vsi, true); -+ ret = i40e_vsi_enable_rx(vsi); - if (ret) - return ret; -- ret = i40e_vsi_control_tx(vsi, true); -+ ret = i40e_vsi_enable_tx(vsi); - - return ret; - } - -+#define I40E_DISABLE_TX_GAP_MSEC 50 -+ - /** - * i40e_vsi_stop_rings - Stop a VSI's rings - * @vsi: the VSI being configured - **/ - void i40e_vsi_stop_rings(struct i40e_vsi *vsi) - { -+ struct i40e_pf *pf = vsi->back; -+ int pf_q, err, q_end; -+ - /* When port TX is suspended, don't wait */ - if (test_bit(__I40E_PORT_SUSPENDED, vsi->back->state)) - return i40e_vsi_stop_rings_no_wait(vsi); - -- /* do rx first for enable and last for disable -- * Ignore return value, we need to shutdown whatever we can -- */ -- i40e_vsi_control_tx(vsi, false); -- i40e_vsi_control_rx(vsi, false); -+ q_end = vsi->base_queue + vsi->num_queue_pairs; -+ for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) -+ i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false); -+ -+ for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) { -+ err = i40e_control_wait_rx_q(pf, pf_q, false); -+ if (err) -+ dev_info(&pf->pdev->dev, -+ "VSI seid %d Rx ring %d dissable timeout\n", -+ vsi->seid, pf_q); -+ } -+ -+ msleep(I40E_DISABLE_TX_GAP_MSEC); -+ pf_q = vsi->base_queue; -+ for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) -+ wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); -+ -+ i40e_vsi_wait_queues_disabled(vsi); - } - - /** -@@ -6868,6 +6878,8 @@ static int i40e_validate_mqprio_qopt(struct i40e_vsi *vsi, - } - if (vsi->num_queue_pairs < - (mqprio_qopt->qopt.offset[i] + mqprio_qopt->qopt.count[i])) { -+ dev_err(&vsi->back->pdev->dev, -+ "Failed to create traffic channel, insufficient number of queues.\n"); - return -EINVAL; - } - if (sum_max_rate > i40e_get_link_speed(vsi)) { -@@ -12883,6 +12895,7 @@ static const struct net_device_ops i40e_netdev_ops = { - .ndo_poll_controller = i40e_netpoll, - #endif - .ndo_setup_tc = __i40e_setup_tc, -+ .ndo_select_queue = i40e_lan_select_queue, - .ndo_set_features = i40e_set_features, - .ndo_set_vf_mac = i40e_ndo_set_vf_mac, - .ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan, -diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c -index 68a2fcf4c0bf5..8e38c547b53f9 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c -@@ -3521,6 +3521,56 @@ dma_error: - return -1; - } - -+static u16 i40e_swdcb_skb_tx_hash(struct net_device *dev, -+ const struct sk_buff *skb, -+ u16 num_tx_queues) -+{ -+ u32 jhash_initval_salt = 0xd631614b; -+ u32 hash; -+ -+ if (skb->sk && skb->sk->sk_hash) -+ hash = skb->sk->sk_hash; -+ else -+ hash = (__force u16)skb->protocol ^ skb->hash; -+ -+ hash = jhash_1word(hash, jhash_initval_salt); -+ -+ return (u16)(((u64)hash * num_tx_queues) >> 32); -+} -+ -+u16 i40e_lan_select_queue(struct net_device *netdev, -+ struct sk_buff *skb, -+ struct net_device __always_unused *sb_dev) -+{ -+ struct i40e_netdev_priv *np = netdev_priv(netdev); -+ struct i40e_vsi *vsi = np->vsi; -+ struct i40e_hw *hw; -+ u16 qoffset; -+ u16 qcount; -+ u8 tclass; -+ u16 hash; -+ u8 prio; -+ -+ /* is DCB enabled at all? */ -+ if (vsi->tc_config.numtc == 1) -+ return i40e_swdcb_skb_tx_hash(netdev, skb, -+ netdev->real_num_tx_queues); -+ -+ prio = skb->priority; -+ hw = &vsi->back->hw; -+ tclass = hw->local_dcbx_config.etscfg.prioritytable[prio]; -+ /* sanity check */ -+ if (unlikely(!(vsi->tc_config.enabled_tc & BIT(tclass)))) -+ tclass = 0; -+ -+ /* select a queue assigned for the given TC */ -+ qcount = vsi->tc_config.tc_info[tclass].qcount; -+ hash = i40e_swdcb_skb_tx_hash(netdev, skb, qcount); -+ -+ qoffset = vsi->tc_config.tc_info[tclass].qoffset; -+ return qoffset + hash; -+} -+ - /** - * i40e_xmit_xdp_ring - transmits an XDP buffer to an XDP Tx ring - * @xdp: data to transmit -diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h -index 36d37f31a287e..ba4ce80efeb06 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h -+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h -@@ -481,6 +481,8 @@ static inline unsigned int i40e_rx_pg_order(struct i40e_ring *ring) - - bool i40e_alloc_rx_buffers(struct i40e_ring *rxr, u16 cleaned_count); - netdev_tx_t i40e_lan_xmit_frame(struct sk_buff *skb, struct net_device *netdev); -+u16 i40e_lan_select_queue(struct net_device *netdev, struct sk_buff *skb, -+ struct net_device *sb_dev); - void i40e_clean_tx_ring(struct i40e_ring *tx_ring); - void i40e_clean_rx_ring(struct i40e_ring *rx_ring); - int i40e_setup_tx_descriptors(struct i40e_ring *tx_ring); -diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c -index cb4664a040ab5..35882d6ded8b3 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/main.c -+++ b/drivers/net/ethernet/mellanox/mlx4/main.c -@@ -3526,6 +3526,7 @@ slave_start: - - if (!SRIOV_VALID_STATE(dev->flags)) { - mlx4_err(dev, "Invalid SRIOV state\n"); -+ err = -EINVAL; - goto err_close; - } - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -index 9d26463f3fa5d..5abc15a92cfaa 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -@@ -444,12 +444,32 @@ static void mlx5e_detach_mod_hdr(struct mlx5e_priv *priv, - static - struct mlx5_core_dev *mlx5e_hairpin_get_mdev(struct net *net, int ifindex) - { -+ struct mlx5_core_dev *mdev; - struct net_device *netdev; - struct mlx5e_priv *priv; - -- netdev = __dev_get_by_index(net, ifindex); -+ netdev = dev_get_by_index(net, ifindex); -+ if (!netdev) -+ return ERR_PTR(-ENODEV); -+ - priv = netdev_priv(netdev); -- return priv->mdev; -+ mdev = priv->mdev; -+ dev_put(netdev); -+ -+ /* Mirred tc action holds a refcount on the ifindex net_device (see -+ * net/sched/act_mirred.c:tcf_mirred_get_dev). So, it's okay to continue using mdev -+ * after dev_put(netdev), while we're in the context of adding a tc flow. -+ * -+ * The mdev pointer corresponds to the peer/out net_device of a hairpin. It is then -+ * stored in a hairpin object, which exists until all flows, that refer to it, get -+ * removed. -+ * -+ * On the other hand, after a hairpin object has been created, the peer net_device may -+ * be removed/unbound while there are still some hairpin flows that are using it. This -+ * case is handled by mlx5e_tc_hairpin_update_dead_peer, which is hooked to -+ * NETDEV_UNREGISTER event of the peer net_device. -+ */ -+ return mdev; - } - - static int mlx5e_hairpin_create_transport(struct mlx5e_hairpin *hp) -@@ -648,6 +668,10 @@ mlx5e_hairpin_create(struct mlx5e_priv *priv, struct mlx5_hairpin_params *params - - func_mdev = priv->mdev; - peer_mdev = mlx5e_hairpin_get_mdev(dev_net(priv->netdev), peer_ifindex); -+ if (IS_ERR(peer_mdev)) { -+ err = PTR_ERR(peer_mdev); -+ goto create_pair_err; -+ } - - pair = mlx5_core_hairpin_create(func_mdev, peer_mdev, params); - if (IS_ERR(pair)) { -@@ -786,6 +810,11 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv, - int err; - - peer_mdev = mlx5e_hairpin_get_mdev(dev_net(priv->netdev), peer_ifindex); -+ if (IS_ERR(peer_mdev)) { -+ NL_SET_ERR_MSG_MOD(extack, "invalid ifindex of mirred device"); -+ return PTR_ERR(peer_mdev); -+ } -+ - if (!MLX5_CAP_GEN(priv->mdev, hairpin) || !MLX5_CAP_GEN(peer_mdev, hairpin)) { - NL_SET_ERR_MSG_MOD(extack, "hairpin is not supported"); - return -EOPNOTSUPP; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -index 11e12761b0a6e..739bf5dc5a252 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -@@ -968,17 +968,19 @@ static int connect_fwd_rules(struct mlx5_core_dev *dev, - static int connect_flow_table(struct mlx5_core_dev *dev, struct mlx5_flow_table *ft, - struct fs_prio *prio) - { -- struct mlx5_flow_table *next_ft; -+ struct mlx5_flow_table *next_ft, *first_ft; - int err = 0; - - /* Connect_prev_fts and update_root_ft_create are mutually exclusive */ - -- if (list_empty(&prio->node.children)) { -+ first_ft = list_first_entry_or_null(&prio->node.children, -+ struct mlx5_flow_table, node.list); -+ if (!first_ft || first_ft->level > ft->level) { - err = connect_prev_fts(dev, ft, prio); - if (err) - return err; - -- next_ft = find_next_chained_ft(prio); -+ next_ft = first_ft ? first_ft : find_next_chained_ft(prio); - err = connect_fwd_rules(dev, ft, next_ft); - if (err) - return err; -@@ -2026,7 +2028,7 @@ static int disconnect_flow_table(struct mlx5_flow_table *ft) - node.list) == ft)) - return 0; - -- next_ft = find_next_chained_ft(prio); -+ next_ft = find_next_ft(ft); - err = connect_fwd_rules(dev, next_ft, ft); - if (err) - return err; -diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c -index 44fe2adf0ee0c..30990d7a8e40e 100644 ---- a/drivers/net/ethernet/sis/sis900.c -+++ b/drivers/net/ethernet/sis/sis900.c -@@ -443,7 +443,7 @@ static int sis900_probe(struct pci_dev *pci_dev, - #endif - - /* setup various bits in PCI command register */ -- ret = pci_enable_device(pci_dev); -+ ret = pcim_enable_device(pci_dev); - if(ret) return ret; - - i = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); -@@ -469,7 +469,7 @@ static int sis900_probe(struct pci_dev *pci_dev, - ioaddr = pci_iomap(pci_dev, 0, 0); - if (!ioaddr) { - ret = -ENOMEM; -- goto err_out_cleardev; -+ goto err_out; - } - - sis_priv = netdev_priv(net_dev); -@@ -579,8 +579,6 @@ err_unmap_tx: - sis_priv->tx_ring_dma); - err_out_unmap: - pci_iounmap(pci_dev, ioaddr); --err_out_cleardev: -- pci_release_regions(pci_dev); - err_out: - free_netdev(net_dev); - return ret; -@@ -2489,7 +2487,6 @@ static void sis900_remove(struct pci_dev *pci_dev) - sis_priv->tx_ring_dma); - pci_iounmap(pci_dev, sis_priv->ioaddr); - free_netdev(net_dev); -- pci_release_regions(pci_dev); - } - - #ifdef CONFIG_PM -diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c -index 595f560937a71..70b9a7bfe4ec6 100644 ---- a/drivers/net/ethernet/sun/niu.c -+++ b/drivers/net/ethernet/sun/niu.c -@@ -8191,8 +8191,9 @@ static int niu_pci_vpd_fetch(struct niu *np, u32 start) - err = niu_pci_vpd_scan_props(np, here, end); - if (err < 0) - return err; -+ /* ret == 1 is not an error */ - if (err == 1) -- return -EINVAL; -+ return 0; - } - return 0; - } -diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c -index a9864fcdfba6b..dd27c85190d34 100644 ---- a/drivers/nfc/nfcsim.c -+++ b/drivers/nfc/nfcsim.c -@@ -192,8 +192,7 @@ static void nfcsim_recv_wq(struct work_struct *work) - - if (!IS_ERR(skb)) - dev_kfree_skb(skb); -- -- skb = ERR_PTR(-ENODEV); -+ return; - } - - dev->cb(dev->nfc_digital_dev, dev->arg, skb); -diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c -index d3a0419e42f28..5a2483e125a3f 100644 ---- a/drivers/pci/controller/pci-mvebu.c -+++ b/drivers/pci/controller/pci-mvebu.c -@@ -105,6 +105,7 @@ struct mvebu_pcie_port { - struct mvebu_pcie_window memwin; - struct mvebu_pcie_window iowin; - u32 saved_pcie_stat; -+ struct resource regs; - }; - - static inline void mvebu_writel(struct mvebu_pcie_port *port, u32 val, u32 reg) -@@ -149,7 +150,9 @@ static void mvebu_pcie_set_local_dev_nr(struct mvebu_pcie_port *port, int nr) - - /* - * Setup PCIE BARs and Address Decode Wins: -- * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks -+ * BAR[0] -> internal registers (needed for MSI) -+ * BAR[1] -> covers all DRAM banks -+ * BAR[2] -> Disabled - * WIN[0-3] -> DRAM bank[0-3] - */ - static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) -@@ -203,6 +206,12 @@ static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) - mvebu_writel(port, 0, PCIE_BAR_HI_OFF(1)); - mvebu_writel(port, ((size - 1) & 0xffff0000) | 1, - PCIE_BAR_CTRL_OFF(1)); -+ -+ /* -+ * Point BAR[0] to the device's internal registers. -+ */ -+ mvebu_writel(port, round_down(port->regs.start, SZ_1M), PCIE_BAR_LO_OFF(0)); -+ mvebu_writel(port, 0, PCIE_BAR_HI_OFF(0)); - } - - static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) -@@ -708,14 +717,13 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, - struct device_node *np, - struct mvebu_pcie_port *port) - { -- struct resource regs; - int ret = 0; - -- ret = of_address_to_resource(np, 0, ®s); -+ ret = of_address_to_resource(np, 0, &port->regs); - if (ret) - return ERR_PTR(ret); - -- return devm_ioremap_resource(&pdev->dev, ®s); -+ return devm_ioremap_resource(&pdev->dev, &port->regs); - } - - #define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03) -diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c -index b05b361e20623..28f78e4f2c87a 100644 ---- a/fs/btrfs/compression.c -+++ b/fs/btrfs/compression.c -@@ -273,7 +273,7 @@ static void end_compressed_bio_write(struct bio *bio) - cb->compressed_pages[0]->mapping = cb->inode->i_mapping; - btrfs_writepage_endio_finish_ordered(cb->compressed_pages[0], - cb->start, cb->start + cb->len - 1, -- bio->bi_status == BLK_STS_OK); -+ !cb->errors); - cb->compressed_pages[0]->mapping = NULL; - - end_compressed_writeback(inode, cb); -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index db3b17bca11f5..3e3529c600cb7 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1266,6 +1266,7 @@ again: - if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) { - list_del_init(&device->dev_alloc_list); - clear_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); -+ fs_devices->rw_devices--; - } - list_del_init(&device->dev_list); - fs_devices->num_devices--; -diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c -index c2852d7cc14d4..58d4546a208e6 100644 ---- a/fs/ocfs2/file.c -+++ b/fs/ocfs2/file.c -@@ -1529,6 +1529,45 @@ static void ocfs2_truncate_cluster_pages(struct inode *inode, u64 byte_start, - } - } - -+/* -+ * zero out partial blocks of one cluster. -+ * -+ * start: file offset where zero starts, will be made upper block aligned. -+ * len: it will be trimmed to the end of current cluster if "start + len" -+ * is bigger than it. -+ */ -+static int ocfs2_zeroout_partial_cluster(struct inode *inode, -+ u64 start, u64 len) -+{ -+ int ret; -+ u64 start_block, end_block, nr_blocks; -+ u64 p_block, offset; -+ u32 cluster, p_cluster, nr_clusters; -+ struct super_block *sb = inode->i_sb; -+ u64 end = ocfs2_align_bytes_to_clusters(sb, start); -+ -+ if (start + len < end) -+ end = start + len; -+ -+ start_block = ocfs2_blocks_for_bytes(sb, start); -+ end_block = ocfs2_blocks_for_bytes(sb, end); -+ nr_blocks = end_block - start_block; -+ if (!nr_blocks) -+ return 0; -+ -+ cluster = ocfs2_bytes_to_clusters(sb, start); -+ ret = ocfs2_get_clusters(inode, cluster, &p_cluster, -+ &nr_clusters, NULL); -+ if (ret) -+ return ret; -+ if (!p_cluster) -+ return 0; -+ -+ offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); -+ p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; -+ return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); -+} -+ - static int ocfs2_zero_partial_clusters(struct inode *inode, - u64 start, u64 len) - { -@@ -1538,6 +1577,7 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, - struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); - unsigned int csize = osb->s_clustersize; - handle_t *handle; -+ loff_t isize = i_size_read(inode); - - /* - * The "start" and "end" values are NOT necessarily part of -@@ -1558,6 +1598,26 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, - if ((start & (csize - 1)) == 0 && (end & (csize - 1)) == 0) - goto out; - -+ /* No page cache for EOF blocks, issue zero out to disk. */ -+ if (end > isize) { -+ /* -+ * zeroout eof blocks in last cluster starting from -+ * "isize" even "start" > "isize" because it is -+ * complicated to zeroout just at "start" as "start" -+ * may be not aligned with block size, buffer write -+ * would be required to do that, but out of eof buffer -+ * write is not supported. -+ */ -+ ret = ocfs2_zeroout_partial_cluster(inode, isize, -+ end - isize); -+ if (ret) { -+ mlog_errno(ret); -+ goto out; -+ } -+ if (start >= isize) -+ goto out; -+ end = isize; -+ } - handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); - if (IS_ERR(handle)) { - ret = PTR_ERR(handle); -@@ -1855,45 +1915,6 @@ out: - return ret; - } - --/* -- * zero out partial blocks of one cluster. -- * -- * start: file offset where zero starts, will be made upper block aligned. -- * len: it will be trimmed to the end of current cluster if "start + len" -- * is bigger than it. -- */ --static int ocfs2_zeroout_partial_cluster(struct inode *inode, -- u64 start, u64 len) --{ -- int ret; -- u64 start_block, end_block, nr_blocks; -- u64 p_block, offset; -- u32 cluster, p_cluster, nr_clusters; -- struct super_block *sb = inode->i_sb; -- u64 end = ocfs2_align_bytes_to_clusters(sb, start); -- -- if (start + len < end) -- end = start + len; -- -- start_block = ocfs2_blocks_for_bytes(sb, start); -- end_block = ocfs2_blocks_for_bytes(sb, end); -- nr_blocks = end_block - start_block; -- if (!nr_blocks) -- return 0; -- -- cluster = ocfs2_bytes_to_clusters(sb, start); -- ret = ocfs2_get_clusters(inode, cluster, &p_cluster, -- &nr_clusters, NULL); -- if (ret) -- return ret; -- if (!p_cluster) -- return 0; -- -- offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); -- p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; -- return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); --} -- - /* - * Parts of this function taken from xfs_change_file_space() - */ -@@ -1935,7 +1956,6 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, - goto out_inode_unlock; - } - -- orig_isize = i_size_read(inode); - switch (sr->l_whence) { - case 0: /*SEEK_SET*/ - break; -@@ -1943,7 +1963,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, - sr->l_start += f_pos; - break; - case 2: /*SEEK_END*/ -- sr->l_start += orig_isize; -+ sr->l_start += i_size_read(inode); - break; - default: - ret = -EINVAL; -@@ -1998,6 +2018,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, - ret = -EINVAL; - } - -+ orig_isize = i_size_read(inode); - /* zeroout eof blocks in the cluster. */ - if (!ret && change_size && orig_isize < size) { - ret = ocfs2_zeroout_partial_cluster(inode, orig_isize, -diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h -index c0f0a13ed8183..49aa79c7b278a 100644 ---- a/include/net/llc_pdu.h -+++ b/include/net/llc_pdu.h -@@ -15,9 +15,11 @@ - #include - - /* Lengths of frame formats */ --#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ --#define LLC_PDU_LEN_S 4 --#define LLC_PDU_LEN_U 3 /* header and 1 control byte */ -+#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ -+#define LLC_PDU_LEN_S 4 -+#define LLC_PDU_LEN_U 3 /* header and 1 control byte */ -+/* header and 1 control byte and XID info */ -+#define LLC_PDU_LEN_U_XID (LLC_PDU_LEN_U + sizeof(struct llc_xid_info)) - /* Known SAP addresses */ - #define LLC_GLOBAL_SAP 0xFF - #define LLC_NULL_SAP 0x00 /* not network-layer visible */ -@@ -50,9 +52,10 @@ - #define LLC_PDU_TYPE_U_MASK 0x03 /* 8-bit control field */ - #define LLC_PDU_TYPE_MASK 0x03 - --#define LLC_PDU_TYPE_I 0 /* first bit */ --#define LLC_PDU_TYPE_S 1 /* first two bits */ --#define LLC_PDU_TYPE_U 3 /* first two bits */ -+#define LLC_PDU_TYPE_I 0 /* first bit */ -+#define LLC_PDU_TYPE_S 1 /* first two bits */ -+#define LLC_PDU_TYPE_U 3 /* first two bits */ -+#define LLC_PDU_TYPE_U_XID 4 /* private type for detecting XID commands */ - - #define LLC_PDU_TYPE_IS_I(pdu) \ - ((!(pdu->ctrl_1 & LLC_PDU_TYPE_I_MASK)) ? 1 : 0) -@@ -230,9 +233,18 @@ static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) - static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, - u8 ssap, u8 dsap, u8 cr) - { -- const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; -+ int hlen = 4; /* default value for I and S types */ - struct llc_pdu_un *pdu; - -+ switch (type) { -+ case LLC_PDU_TYPE_U: -+ hlen = 3; -+ break; -+ case LLC_PDU_TYPE_U_XID: -+ hlen = 6; -+ break; -+ } -+ - skb_push(skb, hlen); - skb_reset_network_header(skb); - pdu = llc_pdu_un_hdr(skb); -@@ -374,7 +386,10 @@ static inline void llc_pdu_init_as_xid_cmd(struct sk_buff *skb, - xid_info->fmt_id = LLC_XID_FMT_ID; /* 0x81 */ - xid_info->type = svcs_supported; - xid_info->rw = rx_window << 1; /* size of receive window */ -- skb_put(skb, sizeof(struct llc_xid_info)); -+ -+ /* no need to push/put since llc_pdu_header_init() has already -+ * pushed 3 + 3 bytes -+ */ - } - - /** -diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c -index 5252bbd1617c6..6571895228f01 100644 ---- a/net/can/j1939/transport.c -+++ b/net/can/j1939/transport.c -@@ -1075,11 +1075,16 @@ static bool j1939_session_deactivate_locked(struct j1939_session *session) - - static bool j1939_session_deactivate(struct j1939_session *session) - { -+ struct j1939_priv *priv = session->priv; - bool active; - -- j1939_session_list_lock(session->priv); -+ j1939_session_list_lock(priv); -+ /* This function should be called with a session ref-count of at -+ * least 2. -+ */ -+ WARN_ON_ONCE(kref_read(&session->kref) < 2); - active = j1939_session_deactivate_locked(session); -- j1939_session_list_unlock(session->priv); -+ j1939_session_list_unlock(priv); - - return active; - } -@@ -1869,7 +1874,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session, - if (!session->transmission) - j1939_tp_schedule_txtimer(session, 0); - } else { -- j1939_tp_set_rxtimeout(session, 250); -+ j1939_tp_set_rxtimeout(session, 750); - } - session->last_cmd = 0xff; - consume_skb(se_skb); -diff --git a/net/can/raw.c b/net/can/raw.c -index c968034ed275b..bb837019d1724 100644 ---- a/net/can/raw.c -+++ b/net/can/raw.c -@@ -548,10 +548,18 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, - return -EFAULT; - } - -+ rtnl_lock(); - lock_sock(sk); - -- if (ro->bound && ro->ifindex) -+ if (ro->bound && ro->ifindex) { - dev = dev_get_by_index(sock_net(sk), ro->ifindex); -+ if (!dev) { -+ if (count > 1) -+ kfree(filter); -+ err = -ENODEV; -+ goto out_fil; -+ } -+ } - - if (ro->bound) { - /* (try to) register the new filters */ -@@ -590,6 +598,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, - dev_put(dev); - - release_sock(sk); -+ rtnl_unlock(); - - break; - -@@ -602,10 +611,16 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, - - err_mask &= CAN_ERR_MASK; - -+ rtnl_lock(); - lock_sock(sk); - -- if (ro->bound && ro->ifindex) -+ if (ro->bound && ro->ifindex) { - dev = dev_get_by_index(sock_net(sk), ro->ifindex); -+ if (!dev) { -+ err = -ENODEV; -+ goto out_err; -+ } -+ } - - /* remove current error mask */ - if (ro->bound) { -@@ -629,6 +644,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, - dev_put(dev); - - release_sock(sk); -+ rtnl_unlock(); - - break; - -diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c -index eb381a24a8f8d..38d3095ef9793 100644 ---- a/net/ipv4/ip_tunnel.c -+++ b/net/ipv4/ip_tunnel.c -@@ -391,7 +391,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, - tunnel->i_seqno = ntohl(tpi->seq) + 1; - } - -- skb_reset_network_header(skb); -+ skb_set_network_header(skb, (tunnel->dev->type == ARPHRD_ETHER) ? ETH_HLEN : 0); - - err = IP_ECN_decapsulate(iph, skb); - if (unlikely(err)) { -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c -index fa0f3c1543ba5..0b3adf7594ffe 100644 ---- a/net/llc/af_llc.c -+++ b/net/llc/af_llc.c -@@ -98,8 +98,16 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) - { - u8 rc = LLC_PDU_LEN_U; - -- if (addr->sllc_test || addr->sllc_xid) -+ if (addr->sllc_test) - rc = LLC_PDU_LEN_U; -+ else if (addr->sllc_xid) -+ /* We need to expand header to sizeof(struct llc_xid_info) -+ * since llc_pdu_init_as_xid_cmd() sets 4,5,6 bytes of LLC header -+ * as XID PDU. In llc_ui_sendmsg() we reserved header size and then -+ * filled all other space with user data. If we won't reserve this -+ * bytes, llc_pdu_init_as_xid_cmd() will overwrite user data -+ */ -+ rc = LLC_PDU_LEN_U_XID; - else if (sk->sk_type == SOCK_STREAM) - rc = LLC_PDU_LEN_I; - return rc; -diff --git a/net/llc/llc_s_ac.c b/net/llc/llc_s_ac.c -index 7ae4cc684d3ab..9fa3342c7a829 100644 ---- a/net/llc/llc_s_ac.c -+++ b/net/llc/llc_s_ac.c -@@ -79,7 +79,7 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) - struct llc_sap_state_ev *ev = llc_sap_ev(skb); - int rc; - -- llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, -+ llc_pdu_header_init(skb, LLC_PDU_TYPE_U_XID, ev->saddr.lsap, - ev->daddr.lsap, LLC_PDU_CMD); - llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); - rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index 9a40312b1f161..4a988ce4264cb 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -660,8 +660,13 @@ bool nf_ct_delete(struct nf_conn *ct, u32 portid, int report) - return false; - - tstamp = nf_conn_tstamp_find(ct); -- if (tstamp && tstamp->stop == 0) -+ if (tstamp) { -+ s32 timeout = ct->timeout - nfct_time_stamp; -+ - tstamp->stop = ktime_get_real_ns(); -+ if (timeout < 0) -+ tstamp->stop -= jiffies_to_nsecs(-timeout); -+ } - - if (nf_conntrack_event_report(IPCT_DESTROY, ct, - portid, report) < 0) { -diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c -index 243e8107f456f..17c0f75dfcdb7 100644 ---- a/net/netfilter/nft_nat.c -+++ b/net/netfilter/nft_nat.c -@@ -147,7 +147,9 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, - alen = FIELD_SIZEOF(struct nf_nat_range, min_addr.ip6); - break; - default: -- return -EAFNOSUPPORT; -+ if (tb[NFTA_NAT_REG_ADDR_MIN]) -+ return -EAFNOSUPPORT; -+ break; - } - priv->family = family; - -diff --git a/net/sched/act_api.c b/net/sched/act_api.c -index 17e5cd9ebd89f..75132d0ca8870 100644 ---- a/net/sched/act_api.c -+++ b/net/sched/act_api.c -@@ -231,6 +231,8 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, - index++; - if (index < s_i) - continue; -+ if (IS_ERR(p)) -+ continue; - - if (jiffy_since && - time_after(jiffy_since, -diff --git a/net/sctp/input.c b/net/sctp/input.c -index ab84ebf1af4a6..db4f917aafd90 100644 ---- a/net/sctp/input.c -+++ b/net/sctp/input.c -@@ -1175,7 +1175,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( - if (unlikely(!af)) - return NULL; - -- if (af->from_addr_param(&paddr, param, peer_port, 0)) -+ if (!af->from_addr_param(&paddr, param, peer_port, 0)) - return NULL; - - return __sctp_lookup_association(net, laddr, &paddr, transportp); -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index cdade990fe445..a5922ce9109cf 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -2501,7 +2501,7 @@ static int tipc_listen(struct socket *sock, int len) - static int tipc_wait_for_accept(struct socket *sock, long timeo) - { - struct sock *sk = sock->sk; -- DEFINE_WAIT(wait); -+ DEFINE_WAIT_FUNC(wait, woken_wake_function); - int err; - - /* True wake-one mechanism for incoming connections: only -@@ -2510,12 +2510,12 @@ static int tipc_wait_for_accept(struct socket *sock, long timeo) - * anymore, the common case will execute the loop only once. - */ - for (;;) { -- prepare_to_wait_exclusive(sk_sleep(sk), &wait, -- TASK_INTERRUPTIBLE); - if (timeo && skb_queue_empty(&sk->sk_receive_queue)) { -+ add_wait_queue(sk_sleep(sk), &wait); - release_sock(sk); -- timeo = schedule_timeout(timeo); -+ timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo); - lock_sock(sk); -+ remove_wait_queue(sk_sleep(sk), &wait); - } - err = 0; - if (!skb_queue_empty(&sk->sk_receive_queue)) -@@ -2527,7 +2527,6 @@ static int tipc_wait_for_accept(struct socket *sock, long timeo) - if (signal_pending(current)) - break; - } -- finish_wait(sk_sleep(sk), &wait); - return err; - } - -diff --git a/net/wireless/scan.c b/net/wireless/scan.c -index 83297832744ac..1580535d53f86 100644 ---- a/net/wireless/scan.c -+++ b/net/wireless/scan.c -@@ -1250,16 +1250,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, - * be grouped with this beacon for updates ... - */ - if (!cfg80211_combine_bsses(rdev, new)) { -- kfree(new); -+ bss_ref_put(rdev, new); - goto drop; - } - } - - if (rdev->bss_entries >= bss_entries_limit && - !cfg80211_bss_expire_oldest(rdev)) { -- if (!list_empty(&new->hidden_list)) -- list_del(&new->hidden_list); -- kfree(new); -+ bss_ref_put(rdev, new); - goto drop; - } - -diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c -index 1ae5c51a70359..571e99c908a0e 100644 ---- a/tools/perf/util/map.c -+++ b/tools/perf/util/map.c -@@ -214,8 +214,6 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, - if (!(prot & PROT_EXEC)) - dso__set_loaded(dso); - } -- -- nsinfo__put(dso->nsinfo); - dso->nsinfo = nsi; - dso__put(dso); - } -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index b2287e7d3ba4a..862c0708f58df 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -3570,6 +3570,16 @@ struct compat_kvm_dirty_log { - }; - }; - -+struct compat_kvm_clear_dirty_log { -+ __u32 slot; -+ __u32 num_pages; -+ __u64 first_page; -+ union { -+ compat_uptr_t dirty_bitmap; /* one bit per page */ -+ __u64 padding2; -+ }; -+}; -+ - static long kvm_vm_compat_ioctl(struct file *filp, - unsigned int ioctl, unsigned long arg) - { -@@ -3579,6 +3589,24 @@ static long kvm_vm_compat_ioctl(struct file *filp, - if (kvm->mm != current->mm) - return -EIO; - switch (ioctl) { -+#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT -+ case KVM_CLEAR_DIRTY_LOG: { -+ struct compat_kvm_clear_dirty_log compat_log; -+ struct kvm_clear_dirty_log log; -+ -+ if (copy_from_user(&compat_log, (void __user *)arg, -+ sizeof(compat_log))) -+ return -EFAULT; -+ log.slot = compat_log.slot; -+ log.num_pages = compat_log.num_pages; -+ log.first_page = compat_log.first_page; -+ log.padding2 = compat_log.padding2; -+ log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap); -+ -+ r = kvm_vm_ioctl_clear_dirty_log(kvm, &log); -+ break; -+ } -+#endif - case KVM_GET_DIRTY_LOG: { - struct compat_kvm_dirty_log compat_log; - struct kvm_dirty_log log; diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.138-139.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.138-139.patch deleted file mode 100644 index 04127effdd..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.138-139.patch +++ /dev/null @@ -1,1230 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5a9d6caef82a0..1174536034b38 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 138 -+SUBLEVEL = 139 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c -index 7a30952b463d5..66d445b14e513 100644 ---- a/drivers/firmware/arm_scmi/bus.c -+++ b/drivers/firmware/arm_scmi/bus.c -@@ -100,6 +100,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner, - { - int retval; - -+ if (!driver->probe) -+ return -EINVAL; -+ - driver->driver.bus = &scmi_bus_type; - driver->driver.name = driver->name; - driver->driver.owner = owner; -diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c -index 48e6e2b489241..4e43bdfa041f5 100644 ---- a/drivers/firmware/arm_scmi/driver.c -+++ b/drivers/firmware/arm_scmi/driver.c -@@ -515,8 +515,12 @@ int scmi_do_xfer_with_response(const struct scmi_handle *handle, - xfer->async_done = &async_response; - - ret = scmi_do_xfer(handle, xfer); -- if (!ret && !wait_for_completion_timeout(xfer->async_done, timeout)) -- ret = -ETIMEDOUT; -+ if (!ret) { -+ if (!wait_for_completion_timeout(xfer->async_done, timeout)) -+ ret = -ETIMEDOUT; -+ else if (xfer->hdr.status) -+ ret = scmi_to_linux_errno(xfer->hdr.status); -+ } - - xfer->async_done = NULL; - return ret; -diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -index 9401b49275f0a..5d85ae59bc51e 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -@@ -498,14 +498,18 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, - - spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); - -- if (!qed_mcp_has_pending_cmd(p_hwfn)) -+ if (!qed_mcp_has_pending_cmd(p_hwfn)) { -+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - break; -+ } - - rc = qed_mcp_update_pending_cmd(p_hwfn, p_ptt); -- if (!rc) -+ if (!rc) { -+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - break; -- else if (rc != -EAGAIN) -+ } else if (rc != -EAGAIN) { - goto err; -+ } - - spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - -@@ -522,6 +526,8 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, - return -EAGAIN; - } - -+ spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); -+ - /* Send the mailbox command */ - qed_mcp_reread_offsets(p_hwfn, p_ptt); - seq_num = ++p_hwfn->mcp_info->drv_mb_seq; -@@ -548,14 +554,18 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, - - spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); - -- if (p_cmd_elem->b_is_completed) -+ if (p_cmd_elem->b_is_completed) { -+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - break; -+ } - - rc = qed_mcp_update_pending_cmd(p_hwfn, p_ptt); -- if (!rc) -+ if (!rc) { -+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - break; -- else if (rc != -EAGAIN) -+ } else if (rc != -EAGAIN) { - goto err; -+ } - - spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - } while (++cnt < max_retries); -@@ -576,6 +586,7 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, - return -EAGAIN; - } - -+ spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); - qed_mcp_cmd_del_elem(p_hwfn, p_cmd_elem); - spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); - -diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c -index 24d1246330375..873f288e7ceca 100644 ---- a/drivers/net/usb/r8152.c -+++ b/drivers/net/usb/r8152.c -@@ -4317,9 +4317,10 @@ static int rtl8152_close(struct net_device *netdev) - tp->rtl_ops.down(tp); - - mutex_unlock(&tp->control); -+ } - -+ if (!res) - usb_autopm_put_interface(tp->intf); -- } - - free_all_mem(tp); - -diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h -index daaf700eae799..35bac7a254227 100644 ---- a/drivers/nvme/host/trace.h -+++ b/drivers/nvme/host/trace.h -@@ -56,7 +56,7 @@ TRACE_EVENT(nvme_setup_cmd, - __field(u8, fctype) - __field(u16, cid) - __field(u32, nsid) -- __field(u64, metadata) -+ __field(bool, metadata) - __array(u8, cdw10, 24) - ), - TP_fast_assign( -@@ -66,13 +66,13 @@ TRACE_EVENT(nvme_setup_cmd, - __entry->flags = cmd->common.flags; - __entry->cid = cmd->common.command_id; - __entry->nsid = le32_to_cpu(cmd->common.nsid); -- __entry->metadata = le64_to_cpu(cmd->common.metadata); -+ __entry->metadata = !!blk_integrity_rq(req); - __entry->fctype = cmd->fabrics.fctype; - __assign_disk_name(__entry->disk, req->rq_disk); - memcpy(__entry->cdw10, &cmd->common.cdw10, - sizeof(__entry->cdw10)); - ), -- TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", -+ TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", - __entry->ctrl_id, __print_disk_name(__entry->disk), - __entry->qid, __entry->cid, __entry->nsid, - __entry->flags, __entry->metadata, -diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c -index 81eac9fbd08cb..cafb773f78616 100644 ---- a/drivers/spi/spi-mt65xx.c -+++ b/drivers/spi/spi-mt65xx.c -@@ -426,24 +426,15 @@ static int mtk_spi_fifo_transfer(struct spi_master *master, - mtk_spi_prepare_transfer(master, xfer); - mtk_spi_setup_packet(master); - -- cnt = xfer->len / 4; -- if (xfer->tx_buf) -+ if (xfer->tx_buf) { -+ cnt = xfer->len / 4; - iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); -- -- if (xfer->rx_buf) -- ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt); -- -- remainder = xfer->len % 4; -- if (remainder > 0) { -- reg_val = 0; -- if (xfer->tx_buf) { -+ remainder = xfer->len % 4; -+ if (remainder > 0) { -+ reg_val = 0; - memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder); - writel(reg_val, mdata->base + SPI_TX_DATA_REG); - } -- if (xfer->rx_buf) { -- reg_val = readl(mdata->base + SPI_RX_DATA_REG); -- memcpy(xfer->rx_buf + (cnt * 4), ®_val, remainder); -- } - } - - mtk_spi_enable_transfer(master); -diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c -index e9d48e94f5edb..9ae16092206df 100644 ---- a/drivers/spi/spi-stm32.c -+++ b/drivers/spi/spi-stm32.c -@@ -913,15 +913,18 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) - ier = readl_relaxed(spi->base + STM32H7_SPI_IER); - - mask = ier; -- /* EOTIE is triggered on EOT, SUSP and TXC events. */ -+ /* -+ * EOTIE enables irq from EOT, SUSP and TXC events. We need to set -+ * SUSP to acknowledge it later. TXC is automatically cleared -+ */ -+ - mask |= STM32H7_SPI_SR_SUSP; - /* -- * When TXTF is set, DXPIE and TXPIE are cleared. So in case of -- * Full-Duplex, need to poll RXP event to know if there are remaining -- * data, before disabling SPI. -+ * DXPIE is set in Full-Duplex, one IT will be raised if TXP and RXP -+ * are set. So in case of Full-Duplex, need to poll TXP and RXP event. - */ -- if (spi->rx_buf && !spi->cur_usedma) -- mask |= STM32H7_SPI_SR_RXP; -+ if ((spi->cur_comm == SPI_FULL_DUPLEX) && !spi->cur_usedma) -+ mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP; - - if (!(sr & mask)) { - dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", -diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c -index 08e534fba1bf0..e707c4797f76e 100644 ---- a/drivers/watchdog/iTCO_wdt.c -+++ b/drivers/watchdog/iTCO_wdt.c -@@ -72,8 +72,6 @@ - #define TCOBASE(p) ((p)->tco_res->start) - /* SMI Control and Enable Register */ - #define SMI_EN(p) ((p)->smi_res->start) --#define TCO_EN (1 << 13) --#define GBL_SMI_EN (1 << 0) - - #define TCO_RLD(p) (TCOBASE(p) + 0x00) /* TCO Timer Reload/Curr. Value */ - #define TCOv1_TMR(p) (TCOBASE(p) + 0x01) /* TCOv1 Timer Initial Value*/ -@@ -346,12 +344,8 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) - - tmrval = seconds_to_ticks(p, t); - -- /* -- * If TCO SMIs are off, the timer counts down twice before rebooting. -- * Otherwise, the BIOS generally reboots when the SMI triggers. -- */ -- if (p->smi_res && -- (SMI_EN(p) & (TCO_EN | GBL_SMI_EN)) != (TCO_EN | GBL_SMI_EN)) -+ /* For TCO v1 the timer counts down twice before rebooting */ -+ if (p->iTCO_version == 1) - tmrval /= 2; - - /* from the specs: */ -@@ -516,7 +510,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev) - * Disables TCO logic generating an SMI# - */ - val32 = inl(SMI_EN(p)); -- val32 &= ~TCO_EN; /* Turn off SMI clearing watchdog */ -+ val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ - outl(val32, SMI_EN(p)); - } - -diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c -index a352c1704042d..e98d6ea35ea80 100644 ---- a/fs/btrfs/block-group.c -+++ b/fs/btrfs/block-group.c -@@ -2637,7 +2637,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans) - * finished yet (no block group item in the extent tree - * yet, etc). If this is the case, wait for all free - * space endio workers to finish and retry. This is a -- * a very rare case so no need for a more efficient and -+ * very rare case so no need for a more efficient and - * complex approach. - */ - if (ret == -ENOENT) { -diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c -index ab69e3563b125..dac30b00d14b7 100644 ---- a/fs/btrfs/ctree.c -+++ b/fs/btrfs/ctree.c -@@ -5232,7 +5232,7 @@ again: - slot--; - /* - * check this node pointer against the min_trans parameters. -- * If it is too old, old, skip to the next one. -+ * If it is too old, skip to the next one. - */ - while (slot < nritems) { - u64 gen; -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index e6aa94a583e92..1d28333bb798c 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -2816,7 +2816,7 @@ int open_ctree(struct super_block *sb, - } - - /* -- * Verify the type first, if that or the the checksum value are -+ * Verify the type first, if that or the checksum value are - * corrupted, we'll find out - */ - csum_type = btrfs_super_csum_type((struct btrfs_super_block *)bh->b_data); -diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c -index eca3abc1a7cd9..9108a73423f70 100644 ---- a/fs/btrfs/extent_io.c -+++ b/fs/btrfs/extent_io.c -@@ -3152,7 +3152,7 @@ static int __do_readpage(struct extent_io_tree *tree, - - /* - * If we have a file range that points to a compressed extent -- * and it's followed by a consecutive file range that points to -+ * and it's followed by a consecutive file range that points - * to the same compressed extent (possibly with a different - * offset and/or length, so it either points to the whole extent - * or only part of it), we must make sure we do not submit a -diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c -index 23f59d463e24e..d2d32fed8f2e9 100644 ---- a/fs/btrfs/free-space-cache.c -+++ b/fs/btrfs/free-space-cache.c -@@ -1339,7 +1339,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, - - /* - * at this point the pages are under IO and we're happy, -- * The caller is responsible for waiting on them and updating the -+ * The caller is responsible for waiting on them and updating - * the cache and the inode - */ - io_ctl->entries = entries; -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 025b02e9799ff..8959d011aafa8 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -6992,7 +6992,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, - drop_inode = 1; - } else { - struct dentry *parent = dentry->d_parent; -- int ret; - - err = btrfs_update_inode(trans, root, inode); - if (err) -@@ -7007,12 +7006,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, - goto fail; - } - d_instantiate(dentry, inode); -- ret = btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent, -- true, NULL); -- if (ret == BTRFS_NEED_TRANS_COMMIT) { -- err = btrfs_commit_transaction(trans); -- trans = NULL; -- } -+ btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent); - } - - fail: -@@ -9699,27 +9693,19 @@ static int btrfs_rename_exchange(struct inode *old_dir, - struct inode *new_inode = new_dentry->d_inode; - struct inode *old_inode = old_dentry->d_inode; - struct timespec64 ctime = current_time(old_inode); -- struct dentry *parent; - u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); - u64 new_ino = btrfs_ino(BTRFS_I(new_inode)); - u64 old_idx = 0; - u64 new_idx = 0; - int ret; -+ int ret2; - bool root_log_pinned = false; - bool dest_log_pinned = false; -- struct btrfs_log_ctx ctx_root; -- struct btrfs_log_ctx ctx_dest; -- bool sync_log_root = false; -- bool sync_log_dest = false; -- bool commit_transaction = false; - - /* we only allow rename subvolume link between subvolumes */ - if (old_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest) - return -EXDEV; - -- btrfs_init_log_ctx(&ctx_root, old_inode); -- btrfs_init_log_ctx(&ctx_dest, new_inode); -- - /* close the race window with snapshot create/destroy ioctl */ - if (old_ino == BTRFS_FIRST_FREE_OBJECTID || - new_ino == BTRFS_FIRST_FREE_OBJECTID) -@@ -9861,30 +9847,14 @@ static int btrfs_rename_exchange(struct inode *old_dir, - BTRFS_I(new_inode)->dir_index = new_idx; - - if (root_log_pinned) { -- parent = new_dentry->d_parent; -- ret = btrfs_log_new_name(trans, BTRFS_I(old_inode), -- BTRFS_I(old_dir), parent, -- false, &ctx_root); -- if (ret == BTRFS_NEED_LOG_SYNC) -- sync_log_root = true; -- else if (ret == BTRFS_NEED_TRANS_COMMIT) -- commit_transaction = true; -- ret = 0; -+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), -+ new_dentry->d_parent); - btrfs_end_log_trans(root); - root_log_pinned = false; - } - if (dest_log_pinned) { -- if (!commit_transaction) { -- parent = old_dentry->d_parent; -- ret = btrfs_log_new_name(trans, BTRFS_I(new_inode), -- BTRFS_I(new_dir), parent, -- false, &ctx_dest); -- if (ret == BTRFS_NEED_LOG_SYNC) -- sync_log_dest = true; -- else if (ret == BTRFS_NEED_TRANS_COMMIT) -- commit_transaction = true; -- ret = 0; -- } -+ btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), -+ old_dentry->d_parent); - btrfs_end_log_trans(dest); - dest_log_pinned = false; - } -@@ -9917,46 +9887,13 @@ out_fail: - dest_log_pinned = false; - } - } -- if (!ret && sync_log_root && !commit_transaction) { -- ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, -- &ctx_root); -- if (ret) -- commit_transaction = true; -- } -- if (!ret && sync_log_dest && !commit_transaction) { -- ret = btrfs_sync_log(trans, BTRFS_I(new_inode)->root, -- &ctx_dest); -- if (ret) -- commit_transaction = true; -- } -- if (commit_transaction) { -- /* -- * We may have set commit_transaction when logging the new name -- * in the destination root, in which case we left the source -- * root context in the list of log contextes. So make sure we -- * remove it to avoid invalid memory accesses, since the context -- * was allocated in our stack frame. -- */ -- if (sync_log_root) { -- mutex_lock(&root->log_mutex); -- list_del_init(&ctx_root.list); -- mutex_unlock(&root->log_mutex); -- } -- ret = btrfs_commit_transaction(trans); -- } else { -- int ret2; -- -- ret2 = btrfs_end_transaction(trans); -- ret = ret ? ret : ret2; -- } -+ ret2 = btrfs_end_transaction(trans); -+ ret = ret ? ret : ret2; - out_notrans: - if (new_ino == BTRFS_FIRST_FREE_OBJECTID || - old_ino == BTRFS_FIRST_FREE_OBJECTID) - up_read(&fs_info->subvol_sem); - -- ASSERT(list_empty(&ctx_root.list)); -- ASSERT(list_empty(&ctx_dest.list)); -- - return ret; - } - -@@ -10024,11 +9961,9 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode *old_inode = d_inode(old_dentry); - u64 index = 0; - int ret; -+ int ret2; - u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); - bool log_pinned = false; -- struct btrfs_log_ctx ctx; -- bool sync_log = false; -- bool commit_transaction = false; - - if (btrfs_ino(BTRFS_I(new_dir)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) - return -EPERM; -@@ -10178,17 +10113,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, - BTRFS_I(old_inode)->dir_index = index; - - if (log_pinned) { -- struct dentry *parent = new_dentry->d_parent; -- -- btrfs_init_log_ctx(&ctx, old_inode); -- ret = btrfs_log_new_name(trans, BTRFS_I(old_inode), -- BTRFS_I(old_dir), parent, -- false, &ctx); -- if (ret == BTRFS_NEED_LOG_SYNC) -- sync_log = true; -- else if (ret == BTRFS_NEED_TRANS_COMMIT) -- commit_transaction = true; -- ret = 0; -+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), -+ new_dentry->d_parent); - btrfs_end_log_trans(root); - log_pinned = false; - } -@@ -10225,23 +10151,8 @@ out_fail: - btrfs_end_log_trans(root); - log_pinned = false; - } -- if (!ret && sync_log) { -- ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, &ctx); -- if (ret) -- commit_transaction = true; -- } else if (sync_log) { -- mutex_lock(&root->log_mutex); -- list_del(&ctx.list); -- mutex_unlock(&root->log_mutex); -- } -- if (commit_transaction) { -- ret = btrfs_commit_transaction(trans); -- } else { -- int ret2; -- -- ret2 = btrfs_end_transaction(trans); -- ret = ret ? ret : ret2; -- } -+ ret2 = btrfs_end_transaction(trans); -+ ret = ret ? ret : ret2; - out_notrans: - if (old_ino == BTRFS_FIRST_FREE_OBJECTID) - up_read(&fs_info->subvol_sem); -diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c -index cd8e81c02f63f..837bd5e29c8a0 100644 ---- a/fs/btrfs/qgroup.c -+++ b/fs/btrfs/qgroup.c -@@ -2262,7 +2262,7 @@ static int qgroup_update_refcnt(struct btrfs_fs_info *fs_info, - * Update qgroup rfer/excl counters. - * Rfer update is easy, codes can explain themselves. - * -- * Excl update is tricky, the update is split into 2 part. -+ * Excl update is tricky, the update is split into 2 parts. - * Part 1: Possible exclusive <-> sharing detect: - * | A | !A | - * ------------------------------------- -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index afc6731bb692c..5412361d0c270 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -174,7 +174,7 @@ static int start_log_trans(struct btrfs_trans_handle *trans, - - atomic_inc(&root->log_batch); - atomic_inc(&root->log_writers); -- if (ctx) { -+ if (ctx && !ctx->logging_new_name) { - int index = root->log_transid % 2; - list_add_tail(&ctx->list, &root->log_ctxs[index]); - ctx->log_transid = root->log_transid; -@@ -4923,7 +4923,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, - * Check the inode's logged_trans only instead of - * btrfs_inode_in_log(). This is because the last_log_commit of - * the inode is not updated when we only log that it exists and -- * and it has the full sync bit set (see btrfs_log_inode()). -+ * it has the full sync bit set (see btrfs_log_inode()). - */ - if (BTRFS_I(inode)->logged_trans == trans->transid) { - spin_unlock(&BTRFS_I(inode)->lock); -@@ -5379,19 +5379,34 @@ log_extents: - } - - /* -- * Don't update last_log_commit if we logged that an inode exists after -- * it was loaded to memory (full_sync bit set). -- * This is to prevent data loss when we do a write to the inode, then -- * the inode gets evicted after all delalloc was flushed, then we log -- * it exists (due to a rename for example) and then fsync it. This last -- * fsync would do nothing (not logging the extents previously written). -+ * If we are logging that an ancestor inode exists as part of logging a -+ * new name from a link or rename operation, don't mark the inode as -+ * logged - otherwise if an explicit fsync is made against an ancestor, -+ * the fsync considers the inode in the log and doesn't sync the log, -+ * resulting in the ancestor missing after a power failure unless the -+ * log was synced as part of an fsync against any other unrelated inode. -+ * So keep it simple for this case and just don't flag the ancestors as -+ * logged. - */ -- spin_lock(&inode->lock); -- inode->logged_trans = trans->transid; -- if (inode_only != LOG_INODE_EXISTS || -- !test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags)) -- inode->last_log_commit = inode->last_sub_trans; -- spin_unlock(&inode->lock); -+ if (!ctx || -+ !(S_ISDIR(inode->vfs_inode.i_mode) && ctx->logging_new_name && -+ &inode->vfs_inode != ctx->inode)) { -+ spin_lock(&inode->lock); -+ inode->logged_trans = trans->transid; -+ /* -+ * Don't update last_log_commit if we logged that an inode exists -+ * after it was loaded to memory (full_sync bit set). -+ * This is to prevent data loss when we do a write to the inode, -+ * then the inode gets evicted after all delalloc was flushed, -+ * then we log it exists (due to a rename for example) and then -+ * fsync it. This last fsync would do nothing (not logging the -+ * extents previously written). -+ */ -+ if (inode_only != LOG_INODE_EXISTS || -+ !test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags)) -+ inode->last_log_commit = inode->last_sub_trans; -+ spin_unlock(&inode->lock); -+ } - out_unlock: - mutex_unlock(&inode->log_mutex); - -@@ -6417,26 +6432,12 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, - /* - * Call this after adding a new name for a file and it will properly - * update the log to reflect the new name. -- * -- * @ctx can not be NULL when @sync_log is false, and should be NULL when it's -- * true (because it's not used). -- * -- * Return value depends on whether @sync_log is true or false. -- * When true: returns BTRFS_NEED_TRANS_COMMIT if the transaction needs to be -- * committed by the caller, and BTRFS_DONT_NEED_TRANS_COMMIT -- * otherwise. -- * When false: returns BTRFS_DONT_NEED_LOG_SYNC if the caller does not need to -- * to sync the log, BTRFS_NEED_LOG_SYNC if it needs to sync the log, -- * or BTRFS_NEED_TRANS_COMMIT if the transaction needs to be -- * committed (without attempting to sync the log). - */ --int btrfs_log_new_name(struct btrfs_trans_handle *trans, -+void btrfs_log_new_name(struct btrfs_trans_handle *trans, - struct btrfs_inode *inode, struct btrfs_inode *old_dir, -- struct dentry *parent, -- bool sync_log, struct btrfs_log_ctx *ctx) -+ struct dentry *parent) - { -- struct btrfs_fs_info *fs_info = trans->fs_info; -- int ret; -+ struct btrfs_log_ctx ctx; - - /* - * this will force the logging code to walk the dentry chain -@@ -6449,36 +6450,20 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, - * if this inode hasn't been logged and directory we're renaming it - * from hasn't been logged, we don't need to log it - */ -- if (inode->logged_trans <= fs_info->last_trans_committed && -- (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) -- return sync_log ? BTRFS_DONT_NEED_TRANS_COMMIT : -- BTRFS_DONT_NEED_LOG_SYNC; -- -- if (sync_log) { -- struct btrfs_log_ctx ctx2; -- -- btrfs_init_log_ctx(&ctx2, &inode->vfs_inode); -- ret = btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, -- LOG_INODE_EXISTS, &ctx2); -- if (ret == BTRFS_NO_LOG_SYNC) -- return BTRFS_DONT_NEED_TRANS_COMMIT; -- else if (ret) -- return BTRFS_NEED_TRANS_COMMIT; -- -- ret = btrfs_sync_log(trans, inode->root, &ctx2); -- if (ret) -- return BTRFS_NEED_TRANS_COMMIT; -- return BTRFS_DONT_NEED_TRANS_COMMIT; -- } -- -- ASSERT(ctx); -- ret = btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, -- LOG_INODE_EXISTS, ctx); -- if (ret == BTRFS_NO_LOG_SYNC) -- return BTRFS_DONT_NEED_LOG_SYNC; -- else if (ret) -- return BTRFS_NEED_TRANS_COMMIT; -+ if (!inode_logged(trans, inode) && -+ (!old_dir || !inode_logged(trans, old_dir))) -+ return; - -- return BTRFS_NEED_LOG_SYNC; -+ btrfs_init_log_ctx(&ctx, &inode->vfs_inode); -+ ctx.logging_new_name = true; -+ /* -+ * We don't care about the return value. If we fail to log the new name -+ * then we know the next attempt to sync the log will fallback to a full -+ * transaction commit (due to a call to btrfs_set_log_full_commit()), so -+ * we don't need to worry about getting a log committed that has an -+ * inconsistent state after a rename operation. -+ */ -+ btrfs_log_inode_parent(trans, inode, parent, 0, LLONG_MAX, -+ LOG_INODE_EXISTS, &ctx); - } - -diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h -index 132e43d29034e..ddfc6789d9bf5 100644 ---- a/fs/btrfs/tree-log.h -+++ b/fs/btrfs/tree-log.h -@@ -16,6 +16,7 @@ struct btrfs_log_ctx { - int log_ret; - int log_transid; - bool log_new_dentries; -+ bool logging_new_name; - struct inode *inode; - struct list_head list; - }; -@@ -26,6 +27,7 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx, - ctx->log_ret = 0; - ctx->log_transid = 0; - ctx->log_new_dentries = false; -+ ctx->logging_new_name = false; - ctx->inode = inode; - INIT_LIST_HEAD(&ctx->list); - } -@@ -67,16 +69,8 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans, - int for_rename); - void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans, - struct btrfs_inode *dir); --/* Return values for btrfs_log_new_name() */ --enum { -- BTRFS_DONT_NEED_TRANS_COMMIT, -- BTRFS_NEED_TRANS_COMMIT, -- BTRFS_DONT_NEED_LOG_SYNC, -- BTRFS_NEED_LOG_SYNC, --}; --int btrfs_log_new_name(struct btrfs_trans_handle *trans, -+void btrfs_log_new_name(struct btrfs_trans_handle *trans, - struct btrfs_inode *inode, struct btrfs_inode *old_dir, -- struct dentry *parent, -- bool sync_log, struct btrfs_log_ctx *ctx); -+ struct dentry *parent); - - #endif -diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h -index 4d67a67964fa3..1e5ae3b01eb2b 100644 ---- a/include/acpi/acpi_bus.h -+++ b/include/acpi/acpi_bus.h -@@ -681,7 +681,8 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv); - - static inline void acpi_dev_put(struct acpi_device *adev) - { -- put_device(&adev->dev); -+ if (adev) -+ put_device(&adev->dev); - } - #else /* CONFIG_ACPI */ - -diff --git a/include/linux/mfd/rt5033-private.h b/include/linux/mfd/rt5033-private.h -index f812105c538c8..f2271bfb3273f 100644 ---- a/include/linux/mfd/rt5033-private.h -+++ b/include/linux/mfd/rt5033-private.h -@@ -200,13 +200,13 @@ enum rt5033_reg { - #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U - #define RT5033_REGULATOR_BUCK_VOLTAGE_MAX 3000000U - #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP 100000U --#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 32 -+#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 21 - - /* RT5033 regulator LDO output voltage uV */ - #define RT5033_REGULATOR_LDO_VOLTAGE_MIN 1200000U - #define RT5033_REGULATOR_LDO_VOLTAGE_MAX 3000000U - #define RT5033_REGULATOR_LDO_VOLTAGE_STEP 100000U --#define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 32 -+#define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 19 - - /* RT5033 regulator SAFE LDO output voltage uV */ - #define RT5033_REGULATOR_SAFE_LDO_VOLTAGE 4900000U -diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c -index aefd947947968..52c2b11a0b471 100644 ---- a/kernel/bpf/verifier.c -+++ b/kernel/bpf/verifier.c -@@ -4346,6 +4346,27 @@ struct bpf_sanitize_info { - bool mask_to_left; - }; - -+static struct bpf_verifier_state * -+sanitize_speculative_path(struct bpf_verifier_env *env, -+ const struct bpf_insn *insn, -+ u32 next_idx, u32 curr_idx) -+{ -+ struct bpf_verifier_state *branch; -+ struct bpf_reg_state *regs; -+ -+ branch = push_stack(env, next_idx, curr_idx, true); -+ if (branch && insn) { -+ regs = branch->frame[branch->curframe]->regs; -+ if (BPF_SRC(insn->code) == BPF_K) { -+ mark_reg_unknown(env, regs, insn->dst_reg); -+ } else if (BPF_SRC(insn->code) == BPF_X) { -+ mark_reg_unknown(env, regs, insn->dst_reg); -+ mark_reg_unknown(env, regs, insn->src_reg); -+ } -+ } -+ return branch; -+} -+ - static int sanitize_ptr_alu(struct bpf_verifier_env *env, - struct bpf_insn *insn, - const struct bpf_reg_state *ptr_reg, -@@ -4429,12 +4450,26 @@ do_sim: - tmp = *dst_reg; - *dst_reg = *ptr_reg; - } -- ret = push_stack(env, env->insn_idx + 1, env->insn_idx, true); -+ ret = sanitize_speculative_path(env, NULL, env->insn_idx + 1, -+ env->insn_idx); - if (!ptr_is_dst_reg && ret) - *dst_reg = tmp; - return !ret ? REASON_STACK : 0; - } - -+static void sanitize_mark_insn_seen(struct bpf_verifier_env *env) -+{ -+ struct bpf_verifier_state *vstate = env->cur_state; -+ -+ /* If we simulate paths under speculation, we don't update the -+ * insn as 'seen' such that when we verify unreachable paths in -+ * the non-speculative domain, sanitize_dead_code() can still -+ * rewrite/sanitize them. -+ */ -+ if (!vstate->speculative) -+ env->insn_aux_data[env->insn_idx].seen = true; -+} -+ - static int sanitize_err(struct bpf_verifier_env *env, - const struct bpf_insn *insn, int reason, - const struct bpf_reg_state *off_reg, -@@ -6066,14 +6101,28 @@ static int check_cond_jmp_op(struct bpf_verifier_env *env, - if (err) - return err; - } -+ - if (pred == 1) { -- /* only follow the goto, ignore fall-through */ -+ /* Only follow the goto, ignore fall-through. If needed, push -+ * the fall-through branch for simulation under speculative -+ * execution. -+ */ -+ if (!env->allow_ptr_leaks && -+ !sanitize_speculative_path(env, insn, *insn_idx + 1, -+ *insn_idx)) -+ return -EFAULT; - *insn_idx += insn->off; - return 0; - } else if (pred == 0) { -- /* only follow fall-through branch, since -- * that's where the program will go -+ /* Only follow the fall-through branch, since that's where the -+ * program will go. If needed, push the goto branch for -+ * simulation under speculative execution. - */ -+ if (!env->allow_ptr_leaks && -+ !sanitize_speculative_path(env, insn, -+ *insn_idx + insn->off + 1, -+ *insn_idx)) -+ return -EFAULT; - return 0; - } - -@@ -7790,7 +7839,7 @@ static int do_check(struct bpf_verifier_env *env) - } - - regs = cur_regs(env); -- env->insn_aux_data[env->insn_idx].seen = true; -+ sanitize_mark_insn_seen(env); - prev_insn_idx = env->insn_idx; - - if (class == BPF_ALU || class == BPF_ALU64) { -@@ -8025,7 +8074,7 @@ process_bpf_exit: - return err; - - env->insn_idx++; -- env->insn_aux_data[env->insn_idx].seen = true; -+ sanitize_mark_insn_seen(env); - } else { - verbose(env, "invalid BPF_LD mode\n"); - return -EINVAL; -@@ -8304,6 +8353,7 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env, - { - struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data; - struct bpf_insn *insn = new_prog->insnsi; -+ bool old_seen = old_data[off].seen; - u32 prog_len; - int i; - -@@ -8324,7 +8374,8 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env, - memcpy(new_data + off + cnt - 1, old_data + off, - sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1)); - for (i = off; i < off + cnt - 1; i++) { -- new_data[i].seen = true; -+ /* Expand insni[off]'s seen count to the patched range. */ -+ new_data[i].seen = old_seen; - new_data[i].zext_dst = insn_has_def32(env, insn + i); - } - env->insn_aux_data = new_data; -diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c -index 37b585c9e857f..21a7ea9b70c8a 100644 ---- a/net/bluetooth/hci_core.c -+++ b/net/bluetooth/hci_core.c -@@ -1672,6 +1672,14 @@ int hci_dev_do_close(struct hci_dev *hdev) - - BT_DBG("%s %p", hdev->name, hdev); - -+ if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && -+ !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && -+ test_bit(HCI_UP, &hdev->flags)) { -+ /* Execute vendor specific shutdown routine */ -+ if (hdev->shutdown) -+ hdev->shutdown(hdev); -+ } -+ - cancel_delayed_work(&hdev->power_off); - - hci_request_cancel_all(hdev); -@@ -1745,14 +1753,6 @@ int hci_dev_do_close(struct hci_dev *hdev) - clear_bit(HCI_INIT, &hdev->flags); - } - -- if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && -- !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && -- test_bit(HCI_UP, &hdev->flags)) { -- /* Execute vendor specific shutdown routine */ -- if (hdev->shutdown) -- hdev->shutdown(hdev); -- } -- - /* flush cmd work */ - flush_work(&hdev->cmd_work); - -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 99d6f4d1297ca..7dba091bc8617 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -2921,8 +2921,11 @@ skb_zerocopy_headlen(const struct sk_buff *from) - - if (!from->head_frag || - skb_headlen(from) < L1_CACHE_BYTES || -- skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) -+ skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) { - hlen = skb_headlen(from); -+ if (!hlen) -+ hlen = from->len; -+ } - - if (skb_has_frag_list(from)) - hlen = from->len; -diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h -index cb024955c9784..73c5f6c8ed690 100644 ---- a/sound/soc/codecs/tlv320aic31xx.h -+++ b/sound/soc/codecs/tlv320aic31xx.h -@@ -151,8 +151,8 @@ struct aic31xx_pdata { - #define AIC31XX_WORD_LEN_24BITS 0x02 - #define AIC31XX_WORD_LEN_32BITS 0x03 - #define AIC31XX_IFACE1_MASTER_MASK GENMASK(3, 2) --#define AIC31XX_BCLK_MASTER BIT(2) --#define AIC31XX_WCLK_MASTER BIT(3) -+#define AIC31XX_BCLK_MASTER BIT(3) -+#define AIC31XX_WCLK_MASTER BIT(2) - - /* AIC31XX_DATA_OFFSET */ - #define AIC31XX_DATA_OFFSET_MASK GENMASK(7, 0) -diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c -index d27fd929abb90..43224c5ec1e9b 100644 ---- a/tools/testing/selftests/bpf/test_verifier.c -+++ b/tools/testing/selftests/bpf/test_verifier.c -@@ -980,7 +980,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv, - } - } - -- if (test->insn_processed) { -+ if (!unpriv && test->insn_processed) { - uint32_t insn_processed; - char *proc; - -diff --git a/tools/testing/selftests/bpf/verifier/bounds.c b/tools/testing/selftests/bpf/verifier/bounds.c -index d55f476f2237d..92c02e4a1b626 100644 ---- a/tools/testing/selftests/bpf/verifier/bounds.c -+++ b/tools/testing/selftests/bpf/verifier/bounds.c -@@ -506,3 +506,68 @@ - .errstr = "map_value pointer and 1000000000000", - .result = REJECT - }, -+{ -+ "bounds check mixed 32bit and 64bit arithmatic. test1", -+ .insns = { -+ BPF_MOV64_IMM(BPF_REG_0, 0), -+ BPF_MOV64_IMM(BPF_REG_1, -1), -+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_1, 32), -+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1), -+ /* r1 = 0xffffFFFF00000001 */ -+ BPF_JMP32_IMM(BPF_JGT, BPF_REG_1, 1, 3), -+ /* check ALU64 op keeps 32bit bounds */ -+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1), -+ BPF_JMP32_IMM(BPF_JGT, BPF_REG_1, 2, 1), -+ BPF_JMP_A(1), -+ /* invalid ldx if bounds are lost above */ -+ BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, -1), -+ BPF_EXIT_INSN(), -+ }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, -+ .result = ACCEPT -+}, -+{ -+ "bounds check mixed 32bit and 64bit arithmatic. test2", -+ .insns = { -+ BPF_MOV64_IMM(BPF_REG_0, 0), -+ BPF_MOV64_IMM(BPF_REG_1, -1), -+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_1, 32), -+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1), -+ /* r1 = 0xffffFFFF00000001 */ -+ BPF_MOV64_IMM(BPF_REG_2, 3), -+ /* r1 = 0x2 */ -+ BPF_ALU32_IMM(BPF_ADD, BPF_REG_1, 1), -+ /* check ALU32 op zero extends 64bit bounds */ -+ BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 1), -+ BPF_JMP_A(1), -+ /* invalid ldx if bounds are lost above */ -+ BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, -1), -+ BPF_EXIT_INSN(), -+ }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, -+ .result = ACCEPT -+}, -+{ -+ "assigning 32bit bounds to 64bit for wA = 0, wB = wA", -+ .insns = { -+ BPF_LDX_MEM(BPF_W, BPF_REG_8, BPF_REG_1, -+ offsetof(struct __sk_buff, data_end)), -+ BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_1, -+ offsetof(struct __sk_buff, data)), -+ BPF_MOV32_IMM(BPF_REG_9, 0), -+ BPF_MOV32_REG(BPF_REG_2, BPF_REG_9), -+ BPF_MOV64_REG(BPF_REG_6, BPF_REG_7), -+ BPF_ALU64_REG(BPF_ADD, BPF_REG_6, BPF_REG_2), -+ BPF_MOV64_REG(BPF_REG_3, BPF_REG_6), -+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 8), -+ BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_8, 1), -+ BPF_LDX_MEM(BPF_W, BPF_REG_5, BPF_REG_6, 0), -+ BPF_MOV64_IMM(BPF_REG_0, 0), -+ BPF_EXIT_INSN(), -+ }, -+ .prog_type = BPF_PROG_TYPE_SCHED_CLS, -+ .result = ACCEPT, -+ .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, -+}, -diff --git a/tools/testing/selftests/bpf/verifier/dead_code.c b/tools/testing/selftests/bpf/verifier/dead_code.c -index 50a8a63be4ac9..a7e60a773da60 100644 ---- a/tools/testing/selftests/bpf/verifier/dead_code.c -+++ b/tools/testing/selftests/bpf/verifier/dead_code.c -@@ -8,6 +8,8 @@ - BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, -4), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 7, - }, -diff --git a/tools/testing/selftests/bpf/verifier/jmp32.c b/tools/testing/selftests/bpf/verifier/jmp32.c -index f0961c58581ea..f2fabf6ebc61c 100644 ---- a/tools/testing/selftests/bpf/verifier/jmp32.c -+++ b/tools/testing/selftests/bpf/verifier/jmp32.c -@@ -72,6 +72,8 @@ - BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - }, - { -@@ -135,6 +137,8 @@ - BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - }, - { -@@ -198,6 +202,8 @@ - BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - }, - { -@@ -265,6 +271,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -333,6 +341,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -401,6 +411,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -469,6 +481,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -537,6 +551,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -605,6 +621,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -673,6 +691,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -@@ -741,6 +761,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R0 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 2, - }, -diff --git a/tools/testing/selftests/bpf/verifier/jset.c b/tools/testing/selftests/bpf/verifier/jset.c -index 8dcd4e0383d57..11fc68da735ea 100644 ---- a/tools/testing/selftests/bpf/verifier/jset.c -+++ b/tools/testing/selftests/bpf/verifier/jset.c -@@ -82,8 +82,8 @@ - BPF_EXIT_INSN(), - }, - .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, -- .retval_unpriv = 1, -- .result_unpriv = ACCEPT, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .retval = 1, - .result = ACCEPT, - }, -@@ -141,7 +141,8 @@ - BPF_EXIT_INSN(), - }, - .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, -- .result_unpriv = ACCEPT, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - }, - { -@@ -162,6 +163,7 @@ - BPF_EXIT_INSN(), - }, - .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, -- .result_unpriv = ACCEPT, -+ .errstr_unpriv = "R9 !read_ok", -+ .result_unpriv = REJECT, - .result = ACCEPT, - }, -diff --git a/tools/testing/selftests/bpf/verifier/unpriv.c b/tools/testing/selftests/bpf/verifier/unpriv.c -index c3f6f650deb76..593f5b586e872 100644 ---- a/tools/testing/selftests/bpf/verifier/unpriv.c -+++ b/tools/testing/selftests/bpf/verifier/unpriv.c -@@ -418,6 +418,8 @@ - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_7, 0), - BPF_EXIT_INSN(), - }, -+ .errstr_unpriv = "R7 invalid mem access 'inv'", -+ .result_unpriv = REJECT, - .result = ACCEPT, - .retval = 0, - }, -diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -index 28d44e6aa0b7e..a8dab0f58462e 100644 ---- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -+++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -@@ -120,7 +120,7 @@ - .fixup_map_array_48b = { 1 }, - .result = ACCEPT, - .result_unpriv = REJECT, -- .errstr_unpriv = "R2 tried to add from different maps, paths or scalars", -+ .errstr_unpriv = "R2 pointer comparison prohibited", - .retval = 0, - }, - { -@@ -159,7 +159,8 @@ - BPF_MOV64_IMM(BPF_REG_0, 0), - BPF_EXIT_INSN(), - // fake-dead code; targeted from branch A to -- // prevent dead code sanitization -+ // prevent dead code sanitization, rejected -+ // via branch B however - BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_0, 0), - BPF_MOV64_IMM(BPF_REG_0, 0), - BPF_EXIT_INSN(), -@@ -167,7 +168,7 @@ - .fixup_map_array_48b = { 1 }, - .result = ACCEPT, - .result_unpriv = REJECT, -- .errstr_unpriv = "R2 tried to add from different maps, paths or scalars", -+ .errstr_unpriv = "R0 invalid mem access 'inv'", - .retval = 0, - }, - { diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.139-140.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.139-140.patch deleted file mode 100644 index 356038183f..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.139-140.patch +++ /dev/null @@ -1,2756 +0,0 @@ -diff --git a/Makefile b/Makefile -index 1174536034b38..1cb8f72d4dcea 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 139 -+SUBLEVEL = 140 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c -index 5f90df30be20a..06fd42417aa96 100644 ---- a/arch/alpha/kernel/smp.c -+++ b/arch/alpha/kernel/smp.c -@@ -585,7 +585,7 @@ void - smp_send_stop(void) - { - cpumask_t to_whom; -- cpumask_copy(&to_whom, cpu_possible_mask); -+ cpumask_copy(&to_whom, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &to_whom); - #ifdef DEBUG_IPI_MSG - if (hard_smp_processor_id() != boot_cpu_id) -diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi -index 6c2949991e297..64fdd5079d49b 100644 ---- a/arch/arm/boot/dts/am437x-l4.dtsi -+++ b/arch/arm/boot/dts/am437x-l4.dtsi -@@ -1611,7 +1611,7 @@ - compatible = "ti,am4372-d_can", "ti,am3352-d_can"; - reg = <0x0 0x2000>; - clocks = <&dcan1_fck>; -- clock-name = "fck"; -+ clock-names = "fck"; - syscon-raminit = <&scm_conf 0x644 1>; - interrupts = ; - status = "disabled"; -diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts -index 719ed5ca454af..64faf5b46d92f 100644 ---- a/arch/arm/boot/dts/imx53-m53menlo.dts -+++ b/arch/arm/boot/dts/imx53-m53menlo.dts -@@ -388,13 +388,13 @@ - - pinctrl_power_button: powerbutgrp { - fsl,pins = < -- MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4 -+ MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4 - >; - }; - - pinctrl_power_out: poweroutgrp { - fsl,pins = < -- MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4 -+ MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4 - >; - }; - -diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi -index 6d7f6b9035bc1..f2649241167ec 100644 ---- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi -@@ -54,7 +54,13 @@ - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_microsom_enet_ar8035>; - phy-mode = "rgmii-id"; -- phy-reset-duration = <2>; -+ -+ /* -+ * The PHY seems to require a long-enough reset duration to avoid -+ * some rare issues where the PHY gets stuck in an inconsistent and -+ * non-functional state at boot-up. 10ms proved to be fine . -+ */ -+ phy-reset-duration = <10>; - phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi -index 038d8c90f6dfe..621396884c318 100644 ---- a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi -+++ b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi -@@ -43,6 +43,7 @@ - assigned-clock-rates = <0>, <198000000>; - cap-power-off-card; - keep-power-in-suspend; -+ max-frequency = <25000000>; - mmc-pwrseq = <&wifi_pwrseq>; - no-1-8-v; - non-removable; -diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi -index 68ac04641bdb1..c7bf68c90ea8f 100644 ---- a/arch/arm/boot/dts/omap5-board-common.dtsi -+++ b/arch/arm/boot/dts/omap5-board-common.dtsi -@@ -30,14 +30,6 @@ - regulator-max-microvolt = <5000000>; - }; - -- vdds_1v8_main: fixedregulator-vdds_1v8_main { -- compatible = "regulator-fixed"; -- regulator-name = "vdds_1v8_main"; -- vin-supply = <&smps7_reg>; -- regulator-min-microvolt = <1800000>; -- regulator-max-microvolt = <1800000>; -- }; -- - vmmcsd_fixed: fixedregulator-mmcsd { - compatible = "regulator-fixed"; - regulator-name = "vmmcsd_fixed"; -@@ -487,6 +479,7 @@ - regulator-boot-on; - }; - -+ vdds_1v8_main: - smps7_reg: smps7 { - /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ - regulator-name = "smps7"; -diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c -index 0dfd0ae7a63dd..af12668d0bf51 100644 ---- a/arch/arm/mach-imx/mmdc.c -+++ b/arch/arm/mach-imx/mmdc.c -@@ -103,6 +103,7 @@ struct mmdc_pmu { - struct perf_event *mmdc_events[MMDC_NUM_COUNTERS]; - struct hlist_node node; - struct fsl_mmdc_devtype_data *devtype_data; -+ struct clk *mmdc_ipg_clk; - }; - - /* -@@ -462,11 +463,14 @@ static int imx_mmdc_remove(struct platform_device *pdev) - - cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); - perf_pmu_unregister(&pmu_mmdc->pmu); -+ iounmap(pmu_mmdc->mmdc_base); -+ clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk); - kfree(pmu_mmdc); - return 0; - } - --static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base) -+static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base, -+ struct clk *mmdc_ipg_clk) - { - struct mmdc_pmu *pmu_mmdc; - char *name; -@@ -494,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b - } - - mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev); -+ pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk; - if (mmdc_num == 0) - name = "mmdc"; - else -@@ -529,7 +534,7 @@ pmu_free: - - #else - #define imx_mmdc_remove NULL --#define imx_mmdc_perf_init(pdev, mmdc_base) 0 -+#define imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk) 0 - #endif - - static int imx_mmdc_probe(struct platform_device *pdev) -@@ -567,7 +572,13 @@ static int imx_mmdc_probe(struct platform_device *pdev) - val &= ~(1 << BP_MMDC_MAPSR_PSD); - writel_relaxed(val, reg); - -- return imx_mmdc_perf_init(pdev, mmdc_base); -+ err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk); -+ if (err) { -+ iounmap(mmdc_base); -+ clk_disable_unprepare(mmdc_ipg_clk); -+ } -+ -+ return err; - } - - int imx_mmdc_get_ddr_type(void) -diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -index 5a2a188debd1d..5716ac20bddd1 100644 ---- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -65,7 +65,7 @@ - }; - }; - -- sysclk: clock-sysclk { -+ sysclk: sysclk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <100000000>; -diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -index 874bc3954c8e6..025e02d23da9b 100644 ---- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -+++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts -@@ -118,6 +118,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&i2c1_pins>; - clock-frequency = <100000>; -+ /delete-property/ mrvl,i2c-fast-mode; - status = "okay"; - - rtc@6f { -diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h -index 9f0ec21d6327f..88d20f04c64a5 100644 ---- a/arch/arm64/include/asm/arch_timer.h -+++ b/arch/arm64/include/asm/arch_timer.h -@@ -165,25 +165,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) - isb(); - } - --/* -- * Ensure that reads of the counter are treated the same as memory reads -- * for the purposes of ordering by subsequent memory barriers. -- * -- * This insanity brought to you by speculative system register reads, -- * out-of-order memory accesses, sequence locks and Thomas Gleixner. -- * -- * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html -- */ --#define arch_counter_enforce_ordering(val) do { \ -- u64 tmp, _val = (val); \ -- \ -- asm volatile( \ -- " eor %0, %1, %1\n" \ -- " add %0, sp, %0\n" \ -- " ldr xzr, [%0]" \ -- : "=r" (tmp) : "r" (_val)); \ --} while (0) -- - static __always_inline u64 __arch_counter_get_cntpct_stable(void) - { - u64 cnt; -@@ -224,8 +205,6 @@ static __always_inline u64 __arch_counter_get_cntvct(void) - return cnt; - } - --#undef arch_counter_enforce_ordering -- - static inline int arch_timer_arch_init(void) - { - return 0; -diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h -index e0e2b1946f42b..0fcd854fc95f3 100644 ---- a/arch/arm64/include/asm/barrier.h -+++ b/arch/arm64/include/asm/barrier.h -@@ -57,6 +57,25 @@ static inline unsigned long array_index_mask_nospec(unsigned long idx, - return mask; - } - -+/* -+ * Ensure that reads of the counter are treated the same as memory reads -+ * for the purposes of ordering by subsequent memory barriers. -+ * -+ * This insanity brought to you by speculative system register reads, -+ * out-of-order memory accesses, sequence locks and Thomas Gleixner. -+ * -+ * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html -+ */ -+#define arch_counter_enforce_ordering(val) do { \ -+ u64 tmp, _val = (val); \ -+ \ -+ asm volatile( \ -+ " eor %0, %1, %1\n" \ -+ " add %0, sp, %0\n" \ -+ " ldr xzr, [%0]" \ -+ : "=r" (tmp) : "r" (_val)); \ -+} while (0) -+ - #define __smp_mb() dmb(ish) - #define __smp_rmb() dmb(ishld) - #define __smp_wmb() dmb(ishst) -diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h -index bf57308fcd635..92b2575b01918 100644 ---- a/arch/arm64/include/asm/ptrace.h -+++ b/arch/arm64/include/asm/ptrace.h -@@ -299,7 +299,17 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) - - static inline unsigned long regs_return_value(struct pt_regs *regs) - { -- return regs->regs[0]; -+ unsigned long val = regs->regs[0]; -+ -+ /* -+ * Audit currently uses regs_return_value() instead of -+ * syscall_get_return_value(). Apply the same sign-extension here until -+ * audit is updated to use syscall_get_return_value(). -+ */ -+ if (compat_user_mode(regs)) -+ val = sign_extend64(val, 31); -+ -+ return val; - } - - static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) -diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h -index cfc0672013f67..03e20895453a7 100644 ---- a/arch/arm64/include/asm/syscall.h -+++ b/arch/arm64/include/asm/syscall.h -@@ -29,22 +29,23 @@ static inline void syscall_rollback(struct task_struct *task, - regs->regs[0] = regs->orig_x0; - } - -- --static inline long syscall_get_error(struct task_struct *task, -- struct pt_regs *regs) -+static inline long syscall_get_return_value(struct task_struct *task, -+ struct pt_regs *regs) - { -- unsigned long error = regs->regs[0]; -+ unsigned long val = regs->regs[0]; - - if (is_compat_thread(task_thread_info(task))) -- error = sign_extend64(error, 31); -+ val = sign_extend64(val, 31); - -- return IS_ERR_VALUE(error) ? error : 0; -+ return val; - } - --static inline long syscall_get_return_value(struct task_struct *task, -- struct pt_regs *regs) -+static inline long syscall_get_error(struct task_struct *task, -+ struct pt_regs *regs) - { -- return regs->regs[0]; -+ unsigned long error = syscall_get_return_value(task, regs); -+ -+ return IS_ERR_VALUE(error) ? error : 0; - } - - static inline void syscall_set_return_value(struct task_struct *task, -diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h -index ff83b8b574fc7..d7361faa42dea 100644 ---- a/arch/arm64/include/asm/vdso/gettimeofday.h -+++ b/arch/arm64/include/asm/vdso/gettimeofday.h -@@ -85,11 +85,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) - */ - isb(); - asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); -- /* -- * This isb() is required to prevent that the seq lock is -- * speculated.# -- */ -- isb(); -+ arch_counter_enforce_ordering(res); - - return res; - } -diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c -index 0cfd685774891..8a95a013dfd3c 100644 ---- a/arch/arm64/kernel/ptrace.c -+++ b/arch/arm64/kernel/ptrace.c -@@ -1868,7 +1868,7 @@ void syscall_trace_exit(struct pt_regs *regs) - audit_syscall_exit(regs); - - if (flags & _TIF_SYSCALL_TRACEPOINT) -- trace_sys_exit(regs, regs_return_value(regs)); -+ trace_sys_exit(regs, syscall_get_return_value(current, regs)); - - if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)) - tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT); -diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c -index ddb757b2c3e5b..f6d3278c1a4e0 100644 ---- a/arch/arm64/kernel/signal.c -+++ b/arch/arm64/kernel/signal.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -868,7 +869,7 @@ static void do_signal(struct pt_regs *regs) - retval == -ERESTART_RESTARTBLOCK || - (retval == -ERESTARTSYS && - !(ksig.ka.sa.sa_flags & SA_RESTART)))) { -- regs->regs[0] = -EINTR; -+ syscall_set_return_value(current, regs, -EINTR, 0); - regs->pc = continue_addr; - } - -diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c -index f2d2dbbbfca20..091c11521108a 100644 ---- a/arch/arm64/kernel/syscall.c -+++ b/arch/arm64/kernel/syscall.c -@@ -50,10 +50,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno, - ret = do_ni_syscall(regs, scno); - } - -- if (is_compat_task()) -- ret = lower_32_bits(ret); -- -- regs->regs[0] = ret; -+ syscall_set_return_value(current, regs, 0, ret); - } - - static inline bool has_syscall_work(unsigned long flags) -@@ -108,7 +105,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, - if (has_syscall_work(flags)) { - /* set default errno for user-issued syscall(-1) */ - if (scno == NO_SYSCALL) -- regs->regs[0] = -ENOSYS; -+ syscall_set_return_value(current, regs, -ENOSYS, 0); - scno = syscall_trace_enter(regs); - if (scno == NO_SYSCALL) - goto trace_exit; -diff --git a/arch/mips/Makefile b/arch/mips/Makefile -index 5403a91ce098d..9ff2c70763a0c 100644 ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -320,7 +320,7 @@ KBUILD_LDFLAGS += -m $(ld-emul) - - ifdef CONFIG_MIPS - CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ -- egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ -+ egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ - sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') - endif - -diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c -index 11e9527c6e441..62ffac500eb52 100644 ---- a/arch/mips/mti-malta/malta-platform.c -+++ b/arch/mips/mti-malta/malta-platform.c -@@ -47,7 +47,8 @@ static struct plat_serial8250_port uart8250_data[] = { - .mapbase = 0x1f000900, /* The CBUS UART */ - .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2, - .uartclk = 3686400, /* Twice the usual clk! */ -- .iotype = UPIO_MEM32, -+ .iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ? -+ UPIO_MEM32BE : UPIO_MEM32, - .flags = CBUS_UART_FLAGS, - .regshift = 3, - }, -diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h -index 0ed910237c4d8..834e53e538d44 100644 ---- a/arch/x86/events/perf_event.h -+++ b/arch/x86/events/perf_event.h -@@ -852,9 +852,10 @@ void x86_pmu_stop(struct perf_event *event, int flags); - - static inline void x86_pmu_disable_event(struct perf_event *event) - { -+ u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); - struct hw_perf_event *hwc = &event->hw; - -- wrmsrl(hwc->config_base, hwc->config); -+ wrmsrl(hwc->config_base, hwc->config & ~disable_mask); - } - - void x86_pmu_enable_event(struct perf_event *event); -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c -index b9400087141df..260c64c205b8c 100644 ---- a/arch/x86/kvm/mmu.c -+++ b/arch/x86/kvm/mmu.c -@@ -2143,7 +2143,7 @@ static int is_empty_shadow_page(u64 *spt) - * aggregate version in order to make the slab shrinker - * faster - */ --static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, unsigned long nr) -+static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, long nr) - { - kvm->arch.n_used_mmu_pages += nr; - percpu_counter_add(&kvm_total_used_mmu_pages, nr); -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 5d35b9656b67d..364e96e508d90 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -3638,8 +3638,17 @@ static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu) - - static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) - { -- return kvm_arch_interrupt_allowed(vcpu) && -- kvm_cpu_accept_dm_intr(vcpu); -+ /* -+ * Do not cause an interrupt window exit if an exception -+ * is pending or an event needs reinjection; userspace -+ * might want to inject the interrupt manually using KVM_SET_REGS -+ * or KVM_SET_SREGS. For that to work, we must be at an -+ * instruction boundary and with no events half-injected. -+ */ -+ return (kvm_arch_interrupt_allowed(vcpu) && -+ kvm_cpu_accept_dm_intr(vcpu) && -+ !kvm_event_needs_reinjection(vcpu) && -+ !vcpu->arch.exception.pending); - } - - static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, -diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c -index c128d50cb4107..71a82528d4bfe 100644 ---- a/block/blk-iolatency.c -+++ b/block/blk-iolatency.c -@@ -832,7 +832,11 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, - - enable = iolatency_set_min_lat_nsec(blkg, lat_val); - if (enable) { -- WARN_ON_ONCE(!blk_get_queue(blkg->q)); -+ if (!blk_get_queue(blkg->q)) { -+ ret = -ENODEV; -+ goto out; -+ } -+ - blkg_get(blkg); - } - -diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c -index b7c408ce340c9..663d85e0adba9 100644 ---- a/drivers/acpi/acpica/nsrepair2.c -+++ b/drivers/acpi/acpica/nsrepair2.c -@@ -375,13 +375,6 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, - - (*element_ptr)->common.reference_count = - original_ref_count; -- -- /* -- * The original_element holds a reference from the package object -- * that represents _HID. Since a new element was created by _HID, -- * remove the reference from the _CID package. -- */ -- acpi_ut_remove_reference(original_element); - } - - element_ptr++; -diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c -index 038db94216a91..454f9d7d42fe1 100644 ---- a/drivers/ata/libata-sff.c -+++ b/drivers/ata/libata-sff.c -@@ -641,6 +641,20 @@ unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, unsigned char *buf, - } - EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); - -+static void ata_pio_xfer(struct ata_queued_cmd *qc, struct page *page, -+ unsigned int offset, size_t xfer_size) -+{ -+ bool do_write = (qc->tf.flags & ATA_TFLAG_WRITE); -+ unsigned char *buf; -+ -+ buf = kmap_atomic(page); -+ qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); -+ kunmap_atomic(buf); -+ -+ if (!do_write && !PageSlab(page)) -+ flush_dcache_page(page); -+} -+ - /** - * ata_pio_sector - Transfer a sector of data. - * @qc: Command on going -@@ -652,11 +666,9 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); - */ - static void ata_pio_sector(struct ata_queued_cmd *qc) - { -- int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); - struct ata_port *ap = qc->ap; - struct page *page; - unsigned int offset; -- unsigned char *buf; - - if (!qc->cursg) { - qc->curbytes = qc->nbytes; -@@ -674,13 +686,20 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) - - DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); - -- /* do the actual data transfer */ -- buf = kmap_atomic(page); -- ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, do_write); -- kunmap_atomic(buf); -+ /* -+ * Split the transfer when it splits a page boundary. Note that the -+ * split still has to be dword aligned like all ATA data transfers. -+ */ -+ WARN_ON_ONCE(offset % 4); -+ if (offset + qc->sect_size > PAGE_SIZE) { -+ unsigned int split_len = PAGE_SIZE - offset; - -- if (!do_write && !PageSlab(page)) -- flush_dcache_page(page); -+ ata_pio_xfer(qc, page, offset, split_len); -+ ata_pio_xfer(qc, nth_page(page, 1), 0, -+ qc->sect_size - split_len); -+ } else { -+ ata_pio_xfer(qc, page, offset, qc->sect_size); -+ } - - qc->curbytes += qc->sect_size; - qc->cursg_ofs += qc->sect_size; -diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c -index 70efbb22dfc30..5f3e5d8372590 100644 ---- a/drivers/base/firmware_loader/fallback.c -+++ b/drivers/base/firmware_loader/fallback.c -@@ -86,12 +86,11 @@ static void __fw_load_abort(struct fw_priv *fw_priv) - { - /* - * There is a small window in which user can write to 'loading' -- * between loading done and disappearance of 'loading' -+ * between loading done/aborted and disappearance of 'loading' - */ -- if (fw_sysfs_done(fw_priv)) -+ if (fw_state_is_aborted(fw_priv) || fw_sysfs_done(fw_priv)) - return; - -- list_del_init(&fw_priv->pending_list); - fw_state_aborted(fw_priv); - } - -@@ -277,7 +276,6 @@ static ssize_t firmware_loading_store(struct device *dev, - * Same logic as fw_load_abort, only the DONE bit - * is ignored and we set ABORT only on failure. - */ -- list_del_init(&fw_priv->pending_list); - if (rc) { - fw_state_aborted(fw_priv); - written = rc; -@@ -512,6 +510,11 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, - } - - mutex_lock(&fw_lock); -+ if (fw_state_is_aborted(fw_priv)) { -+ mutex_unlock(&fw_lock); -+ retval = -EINTR; -+ goto out; -+ } - list_add(&fw_priv->pending_list, &pending_fw_head); - mutex_unlock(&fw_lock); - -@@ -534,11 +537,10 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, - if (fw_state_is_aborted(fw_priv)) { - if (retval == -ERESTARTSYS) - retval = -EINTR; -- else -- retval = -EAGAIN; - } else if (fw_priv->is_paged_buf && !fw_priv->data) - retval = -ENOMEM; - -+out: - device_del(f_dev); - err_put_dev: - put_device(f_dev); -diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h -index 9bef6c35f344a..ffb2a2724cc5a 100644 ---- a/drivers/base/firmware_loader/firmware.h -+++ b/drivers/base/firmware_loader/firmware.h -@@ -108,8 +108,16 @@ static inline void __fw_state_set(struct fw_priv *fw_priv, - - WRITE_ONCE(fw_st->status, status); - -- if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED) -+ if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED) { -+#ifdef CONFIG_FW_LOADER_USER_HELPER -+ /* -+ * Doing this here ensures that the fw_priv is deleted from -+ * the pending list in all abort/done paths. -+ */ -+ list_del_init(&fw_priv->pending_list); -+#endif - complete_all(&fw_st->completion); -+ } - } - - static inline void fw_state_aborted(struct fw_priv *fw_priv) -diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c -index 95d21b4af9045..249349f64bfe9 100644 ---- a/drivers/base/firmware_loader/main.c -+++ b/drivers/base/firmware_loader/main.c -@@ -747,8 +747,10 @@ static void fw_abort_batch_reqs(struct firmware *fw) - return; - - fw_priv = fw->priv; -+ mutex_lock(&fw_lock); - if (!fw_state_is_aborted(fw_priv)) - fw_state_aborted(fw_priv); -+ mutex_unlock(&fw_lock); - } - - /* called from request_firmware() and request_firmware_work_func() */ -diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c -index 22bf553ccf9df..69937be2032b1 100644 ---- a/drivers/char/tpm/tpm_ftpm_tee.c -+++ b/drivers/char/tpm/tpm_ftpm_tee.c -@@ -255,11 +255,11 @@ static int ftpm_tee_probe(struct platform_device *pdev) - pvt_data->session = sess_arg.session; - - /* Allocate dynamic shared memory with fTPM TA */ -- pvt_data->shm = tee_shm_alloc(pvt_data->ctx, -- MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE, -- TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); -+ pvt_data->shm = tee_shm_alloc_kernel_buf(pvt_data->ctx, -+ MAX_COMMAND_SIZE + -+ MAX_RESPONSE_SIZE); - if (IS_ERR(pvt_data->shm)) { -- dev_err(dev, "%s: tee_shm_alloc failed\n", __func__); -+ dev_err(dev, "%s: tee_shm_alloc_kernel_buf failed\n", __func__); - rc = -ENOMEM; - goto out_shm_alloc; - } -diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c -index be160764911bf..f9d5b73343417 100644 ---- a/drivers/clk/clk-devres.c -+++ b/drivers/clk/clk-devres.c -@@ -92,13 +92,20 @@ int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, - } - EXPORT_SYMBOL_GPL(devm_clk_bulk_get_optional); - -+static void devm_clk_bulk_release_all(struct device *dev, void *res) -+{ -+ struct clk_bulk_devres *devres = res; -+ -+ clk_bulk_put_all(devres->num_clks, devres->clks); -+} -+ - int __must_check devm_clk_bulk_get_all(struct device *dev, - struct clk_bulk_data **clks) - { - struct clk_bulk_devres *devres; - int ret; - -- devres = devres_alloc(devm_clk_bulk_release, -+ devres = devres_alloc(devm_clk_bulk_release_all, - sizeof(*devres), GFP_KERNEL); - if (!devres) - return -ENOMEM; -diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c -index 18117ce5ff85f..5c75e3d906c20 100644 ---- a/drivers/clk/clk-stm32f4.c -+++ b/drivers/clk/clk-stm32f4.c -@@ -526,7 +526,7 @@ struct stm32f4_pll { - - struct stm32f4_pll_post_div_data { - int idx; -- u8 pll_num; -+ int pll_idx; - const char *name; - const char *parent; - u8 flag; -@@ -557,13 +557,13 @@ static const struct clk_div_table post_divr_table[] = { - - #define MAX_POST_DIV 3 - static const struct stm32f4_pll_post_div_data post_div_data[MAX_POST_DIV] = { -- { CLK_I2SQ_PDIV, PLL_I2S, "plli2s-q-div", "plli2s-q", -+ { CLK_I2SQ_PDIV, PLL_VCO_I2S, "plli2s-q-div", "plli2s-q", - CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 0, 5, 0, NULL}, - -- { CLK_SAIQ_PDIV, PLL_SAI, "pllsai-q-div", "pllsai-q", -+ { CLK_SAIQ_PDIV, PLL_VCO_SAI, "pllsai-q-div", "pllsai-q", - CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 8, 5, 0, NULL }, - -- { NO_IDX, PLL_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT, -+ { NO_IDX, PLL_VCO_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT, - STM32F4_RCC_DCKCFGR, 16, 2, 0, post_divr_table }, - }; - -@@ -1774,7 +1774,7 @@ static void __init stm32f4_rcc_init(struct device_node *np) - post_div->width, - post_div->flag_div, - post_div->div_table, -- clks[post_div->pll_num], -+ clks[post_div->pll_idx], - &stm32f4_clk_lock); - - if (post_div->idx != NO_IDX) -diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c -index 5c0fb3134825f..5265182674eb7 100644 ---- a/drivers/dma/imx-dma.c -+++ b/drivers/dma/imx-dma.c -@@ -832,6 +832,8 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( - dma_length += sg_dma_len(sg); - } - -+ imxdma_config_write(chan, &imxdmac->config, direction); -+ - switch (imxdmac->word_size) { - case DMA_SLAVE_BUSWIDTH_4_BYTES: - if (sg_dma_len(sgl) & 3 || sgl->dma_address & 3) -diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c -index a3109bcaa0ac2..09ca493b36176 100644 ---- a/drivers/gpio/gpio-tqmx86.c -+++ b/drivers/gpio/gpio-tqmx86.c -@@ -235,8 +235,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) - struct resource *res; - int ret, irq; - -- irq = platform_get_irq(pdev, 0); -- if (irq < 0) -+ irq = platform_get_irq_optional(pdev, 0); -+ if (irq < 0 && irq != -ENXIO) - return irq; - - res = platform_get_resource(pdev, IORESOURCE_IO, 0); -@@ -275,7 +275,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) - - pm_runtime_enable(&pdev->dev); - -- if (irq) { -+ if (irq > 0) { - struct irq_chip *irq_chip = &gpio->irq_chip; - u8 irq_status; - -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index a715cb88052c2..e87184645c540 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -452,8 +452,6 @@ static void raid1_end_write_request(struct bio *bio) - /* - * When the device is faulty, it is not necessary to - * handle write error. -- * For failfast, this is the only remaining device, -- * We need to retry the write without FailFast. - */ - if (!test_bit(Faulty, &rdev->flags)) - set_bit(R1BIO_WriteError, &r1_bio->state); -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c -index a195a85cc366a..deddabfb07d79 100644 ---- a/drivers/md/raid10.c -+++ b/drivers/md/raid10.c -@@ -470,12 +470,12 @@ static void raid10_end_write_request(struct bio *bio) - /* - * When the device is faulty, it is not necessary to - * handle write error. -- * For failfast, this is the only remaining device, -- * We need to retry the write without FailFast. - */ - if (!test_bit(Faulty, &rdev->flags)) - set_bit(R10BIO_WriteError, &r10_bio->state); - else { -+ /* Fail the request */ -+ set_bit(R10BIO_Degraded, &r10_bio->state); - r10_bio->devs[slot].bio = NULL; - to_put = bio; - dec_rdev = 1; -diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c -index 4489744fbbd95..13602939906fc 100644 ---- a/drivers/media/common/videobuf2/videobuf2-core.c -+++ b/drivers/media/common/videobuf2/videobuf2-core.c -@@ -1512,6 +1512,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, - struct media_request *req) - { - struct vb2_buffer *vb; -+ enum vb2_buffer_state orig_state; - int ret; - - if (q->error) { -@@ -1611,6 +1612,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, - * Add to the queued buffers list, a buffer will stay on it until - * dequeued in dqbuf. - */ -+ orig_state = vb->state; - list_add_tail(&vb->queued_entry, &q->queued_list); - q->queued_count++; - q->waiting_for_buffers = false; -@@ -1641,8 +1643,17 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, - if (q->streaming && !q->start_streaming_called && - q->queued_count >= q->min_buffers_needed) { - ret = vb2_start_streaming(q); -- if (ret) -+ if (ret) { -+ /* -+ * Since vb2_core_qbuf will return with an error, -+ * we should return it to state DEQUEUED since -+ * the error indicates that the buffer wasn't queued. -+ */ -+ list_del(&vb->queued_entry); -+ q->queued_count--; -+ vb->state = orig_state; - return ret; -+ } - } - - dprintk(2, "qbuf of buffer %d succeeded\n", vb->index); -diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c -index 1a36bda285421..0fe71437601e7 100644 ---- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c -+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c -@@ -37,7 +37,16 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) - } else { - /* read */ - requesttype = (USB_TYPE_VENDOR | USB_DIR_IN); -- pipe = usb_rcvctrlpipe(d->udev, 0); -+ -+ /* -+ * Zero-length transfers must use usb_sndctrlpipe() and -+ * rtl28xxu_identify_state() uses a zero-length i2c read -+ * command to determine the chip type. -+ */ -+ if (req->size) -+ pipe = usb_rcvctrlpipe(d->udev, 0); -+ else -+ pipe = usb_sndctrlpipe(d->udev, 0); - } - - ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value, -diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c -index 034f1b50ab287..a07d8051ec3e8 100644 ---- a/drivers/net/dsa/sja1105/sja1105_main.c -+++ b/drivers/net/dsa/sja1105/sja1105_main.c -@@ -992,10 +992,11 @@ static int sja1105et_is_fdb_entry_in_bin(struct sja1105_private *priv, int bin, - int sja1105et_fdb_add(struct dsa_switch *ds, int port, - const unsigned char *addr, u16 vid) - { -- struct sja1105_l2_lookup_entry l2_lookup = {0}; -+ struct sja1105_l2_lookup_entry l2_lookup = {0}, tmp; - struct sja1105_private *priv = ds->priv; - struct device *dev = ds->dev; - int last_unused = -1; -+ int start, end, i; - int bin, way, rc; - - bin = sja1105et_fdb_hash(priv, addr, vid); -@@ -1007,7 +1008,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, - * mask? If yes, we need to do nothing. If not, we need - * to rewrite the entry by adding this port to it. - */ -- if (l2_lookup.destports & BIT(port)) -+ if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) - return 0; - l2_lookup.destports |= BIT(port); - } else { -@@ -1038,6 +1039,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, - index, NULL, false); - } - } -+ l2_lookup.lockeds = true; - l2_lookup.index = sja1105et_fdb_index(bin, way); - - rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, -@@ -1046,6 +1048,29 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, - if (rc < 0) - return rc; - -+ /* Invalidate a dynamically learned entry if that exists */ -+ start = sja1105et_fdb_index(bin, 0); -+ end = sja1105et_fdb_index(bin, way); -+ -+ for (i = start; i < end; i++) { -+ rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, -+ i, &tmp); -+ if (rc == -ENOENT) -+ continue; -+ if (rc) -+ return rc; -+ -+ if (tmp.macaddr != ether_addr_to_u64(addr) || tmp.vlanid != vid) -+ continue; -+ -+ rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, -+ i, NULL, false); -+ if (rc) -+ return rc; -+ -+ break; -+ } -+ - return sja1105_static_fdb_change(priv, port, &l2_lookup, true); - } - -@@ -1087,7 +1112,7 @@ int sja1105et_fdb_del(struct dsa_switch *ds, int port, - int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, - const unsigned char *addr, u16 vid) - { -- struct sja1105_l2_lookup_entry l2_lookup = {0}; -+ struct sja1105_l2_lookup_entry l2_lookup = {0}, tmp; - struct sja1105_private *priv = ds->priv; - int rc, i; - -@@ -1108,10 +1133,10 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, - rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, - SJA1105_SEARCH, &l2_lookup); - if (rc == 0) { -- /* Found and this port is already in the entry's -+ /* Found a static entry and this port is already in the entry's - * port mask => job done - */ -- if (l2_lookup.destports & BIT(port)) -+ if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) - return 0; - /* l2_lookup.index is populated by the switch in case it - * found something. -@@ -1134,16 +1159,46 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, - dev_err(ds->dev, "FDB is full, cannot add entry.\n"); - return -EINVAL; - } -- l2_lookup.lockeds = true; - l2_lookup.index = i; - - skip_finding_an_index: -+ l2_lookup.lockeds = true; -+ - rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, - l2_lookup.index, &l2_lookup, - true); - if (rc < 0) - return rc; - -+ /* The switch learns dynamic entries and looks up the FDB left to -+ * right. It is possible that our addition was concurrent with the -+ * dynamic learning of the same address, so now that the static entry -+ * has been installed, we are certain that address learning for this -+ * particular address has been turned off, so the dynamic entry either -+ * is in the FDB at an index smaller than the static one, or isn't (it -+ * can also be at a larger index, but in that case it is inactive -+ * because the static FDB entry will match first, and the dynamic one -+ * will eventually age out). Search for a dynamically learned address -+ * prior to our static one and invalidate it. -+ */ -+ tmp = l2_lookup; -+ -+ rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, -+ SJA1105_SEARCH, &tmp); -+ if (rc < 0) { -+ dev_err(ds->dev, -+ "port %d failed to read back entry for %pM vid %d: %pe\n", -+ port, addr, vid, ERR_PTR(rc)); -+ return rc; -+ } -+ -+ if (tmp.index < l2_lookup.index) { -+ rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, -+ tmp.index, NULL, false); -+ if (rc < 0) -+ return rc; -+ } -+ - return sja1105_static_fdb_change(priv, port, &l2_lookup, true); - } - -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -index d10b421ed1f19..9af8afd7ae89d 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c -@@ -2666,7 +2666,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) - } - - /* Allocated memory for FW statistics */ -- if (bnx2x_alloc_fw_stats_mem(bp)) -+ rc = bnx2x_alloc_fw_stats_mem(bp); -+ if (rc) - LOAD_ERROR_EXIT(bp, load_error0); - - /* request pf to initialize status blocks */ -diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c -index b1856552ab813..a53c2d637a971 100644 ---- a/drivers/net/ethernet/freescale/fec_main.c -+++ b/drivers/net/ethernet/freescale/fec_main.c -@@ -3781,13 +3781,13 @@ fec_drv_remove(struct platform_device *pdev) - if (of_phy_is_fixed_link(np)) - of_phy_deregister_fixed_link(np); - of_node_put(fep->phy_node); -- free_netdev(ndev); - - clk_disable_unprepare(fep->clk_ahb); - clk_disable_unprepare(fep->clk_ipg); - pm_runtime_put_noidle(&pdev->dev); - pm_runtime_disable(&pdev->dev); - -+ free_netdev(ndev); - return 0; - } - -diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c -index 1a2634cbbb691..a653502c5d6f9 100644 ---- a/drivers/net/ethernet/natsemi/natsemi.c -+++ b/drivers/net/ethernet/natsemi/natsemi.c -@@ -819,7 +819,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - printk(version); - #endif - -- i = pci_enable_device(pdev); -+ i = pcim_enable_device(pdev); - if (i) return i; - - /* natsemi has a non-standard PM control register -@@ -852,7 +852,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - ioaddr = ioremap(iostart, iosize); - if (!ioaddr) { - i = -ENOMEM; -- goto err_ioremap; -+ goto err_pci_request_regions; - } - - /* Work around the dropped serial bit. */ -@@ -974,9 +974,6 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) - err_register_netdev: - iounmap(ioaddr); - -- err_ioremap: -- pci_release_regions(pdev); -- - err_pci_request_regions: - free_netdev(dev); - return i; -@@ -3242,7 +3239,6 @@ static void natsemi_remove1(struct pci_dev *pdev) - - NATSEMI_REMOVE_FILE(pdev, dspcfg_workaround); - unregister_netdev (dev); -- pci_release_regions (pdev); - iounmap(ioaddr); - free_netdev (dev); - } -diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c -index 1d334f2e0a568..607e2ff272dc0 100644 ---- a/drivers/net/ethernet/neterion/vxge/vxge-main.c -+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c -@@ -3524,13 +3524,13 @@ static void vxge_device_unregister(struct __vxge_hw_device *hldev) - - kfree(vdev->vpaths); - -- /* we are safe to free it now */ -- free_netdev(dev); -- - vxge_debug_init(vdev->level_trace, "%s: ethernet device unregistered", - buf); - vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d Exiting...", buf, - __func__, __LINE__); -+ -+ /* we are safe to free it now */ -+ free_netdev(dev); - } - - /* -diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -index 17b91ed39369c..2354dec994184 100644 ---- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c -@@ -266,6 +266,8 @@ nfp_net_get_link_ksettings(struct net_device *netdev, - - /* Init to unknowns */ - ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE); -+ ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); -+ ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); - cmd->base.port = PORT_OTHER; - cmd->base.speed = SPEED_UNKNOWN; - cmd->base.duplex = DUPLEX_UNKNOWN; -diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c -index 5dc36c51636c4..6ca2216e40585 100644 ---- a/drivers/net/ethernet/qlogic/qla3xxx.c -+++ b/drivers/net/ethernet/qlogic/qla3xxx.c -@@ -155,7 +155,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) - "driver lock acquired\n"); - return 1; - } -- ssleep(1); -+ mdelay(1000); - } while (++i < 10); - - netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); -@@ -3291,7 +3291,7 @@ static int ql_adapter_reset(struct ql3_adapter *qdev) - if ((value & ISP_CONTROL_SR) == 0) - break; - -- ssleep(1); -+ mdelay(1000); - } while ((--max_wait_time)); - - /* -@@ -3327,7 +3327,7 @@ static int ql_adapter_reset(struct ql3_adapter *qdev) - ispControlStatus); - if ((value & ISP_CONTROL_FSR) == 0) - break; -- ssleep(1); -+ mdelay(1000); - } while ((--max_wait_time)); - } - if (max_wait_time == 0) -diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c -index 663c68ed6ef96..910ab2182158d 100644 ---- a/drivers/net/phy/micrel.c -+++ b/drivers/net/phy/micrel.c -@@ -343,11 +343,11 @@ static int ksz8041_config_aneg(struct phy_device *phydev) - } - - static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, -- const u32 ksz_phy_id) -+ const bool ksz_8051) - { - int ret; - -- if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id) -+ if ((phydev->phy_id & MICREL_PHY_ID_MASK) != PHY_ID_KSZ8051) - return 0; - - ret = phy_read(phydev, MII_BMSR); -@@ -360,7 +360,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, - * the switch does not. - */ - ret &= BMSR_ERCAP; -- if (ksz_phy_id == PHY_ID_KSZ8051) -+ if (ksz_8051) - return ret; - else - return !ret; -@@ -368,7 +368,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, - - static int ksz8051_match_phy_device(struct phy_device *phydev) - { -- return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051); -+ return ksz8051_ksz8795_match_phy_device(phydev, true); - } - - static int ksz8081_config_init(struct phy_device *phydev) -@@ -396,7 +396,7 @@ static int ksz8061_config_init(struct phy_device *phydev) - - static int ksz8795_match_phy_device(struct phy_device *phydev) - { -- return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX); -+ return ksz8051_ksz8795_match_phy_device(phydev, false); - } - - static int ksz9021_load_values_from_of(struct phy_device *phydev, -diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c -index f7d117d80cfbb..b744c09346a7c 100644 ---- a/drivers/net/usb/pegasus.c -+++ b/drivers/net/usb/pegasus.c -@@ -747,12 +747,16 @@ static inline void disable_net_traffic(pegasus_t *pegasus) - set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp); - } - --static inline void get_interrupt_interval(pegasus_t *pegasus) -+static inline int get_interrupt_interval(pegasus_t *pegasus) - { - u16 data; - u8 interval; -+ int ret; -+ -+ ret = read_eprom_word(pegasus, 4, &data); -+ if (ret < 0) -+ return ret; - -- read_eprom_word(pegasus, 4, &data); - interval = data >> 8; - if (pegasus->usb->speed != USB_SPEED_HIGH) { - if (interval < 0x80) { -@@ -767,6 +771,8 @@ static inline void get_interrupt_interval(pegasus_t *pegasus) - } - } - pegasus->intr_interval = interval; -+ -+ return 0; - } - - static void set_carrier(struct net_device *net) -@@ -1186,7 +1192,9 @@ static int pegasus_probe(struct usb_interface *intf, - | NETIF_MSG_PROBE | NETIF_MSG_LINK); - - pegasus->features = usb_dev_id[dev_index].private; -- get_interrupt_interval(pegasus); -+ res = get_interrupt_interval(pegasus); -+ if (res) -+ goto out2; - if (reset_mac(pegasus)) { - dev_err(&intf->dev, "can't reset MAC\n"); - res = -EIO; -diff --git a/drivers/net/wireless/virt_wifi.c b/drivers/net/wireless/virt_wifi.c -index 9d04ca53229b5..4e906910f110b 100644 ---- a/drivers/net/wireless/virt_wifi.c -+++ b/drivers/net/wireless/virt_wifi.c -@@ -136,6 +136,29 @@ static struct ieee80211_supported_band band_5ghz = { - /* Assigned at module init. Guaranteed locally-administered and unicast. */ - static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {}; - -+static void virt_wifi_inform_bss(struct wiphy *wiphy) -+{ -+ u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); -+ struct cfg80211_bss *informed_bss; -+ static const struct { -+ u8 tag; -+ u8 len; -+ u8 ssid[8]; -+ } __packed ssid = { -+ .tag = WLAN_EID_SSID, -+ .len = 8, -+ .ssid = "VirtWifi", -+ }; -+ -+ informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, -+ CFG80211_BSS_FTYPE_PRESP, -+ fake_router_bssid, tsf, -+ WLAN_CAPABILITY_ESS, 0, -+ (void *)&ssid, sizeof(ssid), -+ DBM_TO_MBM(-50), GFP_KERNEL); -+ cfg80211_put_bss(wiphy, informed_bss); -+} -+ - /* Called with the rtnl lock held. */ - static int virt_wifi_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -@@ -156,28 +179,13 @@ static int virt_wifi_scan(struct wiphy *wiphy, - /* Acquires and releases the rdev BSS lock. */ - static void virt_wifi_scan_result(struct work_struct *work) - { -- struct { -- u8 tag; -- u8 len; -- u8 ssid[8]; -- } __packed ssid = { -- .tag = WLAN_EID_SSID, .len = 8, .ssid = "VirtWifi", -- }; -- struct cfg80211_bss *informed_bss; - struct virt_wifi_wiphy_priv *priv = - container_of(work, struct virt_wifi_wiphy_priv, - scan_result.work); - struct wiphy *wiphy = priv_to_wiphy(priv); - struct cfg80211_scan_info scan_info = { .aborted = false }; -- u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); - -- informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, -- CFG80211_BSS_FTYPE_PRESP, -- fake_router_bssid, tsf, -- WLAN_CAPABILITY_ESS, 0, -- (void *)&ssid, sizeof(ssid), -- DBM_TO_MBM(-50), GFP_KERNEL); -- cfg80211_put_bss(wiphy, informed_bss); -+ virt_wifi_inform_bss(wiphy); - - /* Schedules work which acquires and releases the rtnl lock. */ - cfg80211_scan_done(priv->scan_request, &scan_info); -@@ -225,10 +233,12 @@ static int virt_wifi_connect(struct wiphy *wiphy, struct net_device *netdev, - if (!could_schedule) - return -EBUSY; - -- if (sme->bssid) -+ if (sme->bssid) { - ether_addr_copy(priv->connect_requested_bss, sme->bssid); -- else -+ } else { -+ virt_wifi_inform_bss(wiphy); - eth_zero_addr(priv->connect_requested_bss); -+ } - - wiphy_debug(wiphy, "connect\n"); - -@@ -241,11 +251,13 @@ static void virt_wifi_connect_complete(struct work_struct *work) - struct virt_wifi_netdev_priv *priv = - container_of(work, struct virt_wifi_netdev_priv, connect.work); - u8 *requested_bss = priv->connect_requested_bss; -- bool has_addr = !is_zero_ether_addr(requested_bss); - bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid); - u16 status = WLAN_STATUS_SUCCESS; - -- if (!priv->is_up || (has_addr && !right_addr)) -+ if (is_zero_ether_addr(requested_bss)) -+ requested_bss = NULL; -+ -+ if (!priv->is_up || (requested_bss && !right_addr)) - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - else - priv->is_connected = true; -diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c -index 245d60189375a..7a43d4ca79292 100644 ---- a/drivers/pcmcia/i82092.c -+++ b/drivers/pcmcia/i82092.c -@@ -106,6 +106,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i - for (i = 0;imedia_event_code == 2) - return DISK_EVENT_MEDIA_CHANGE; - else if (med->media_event_code == 3) -- return DISK_EVENT_EJECT_REQUEST; -+ return DISK_EVENT_MEDIA_CHANGE; - return 0; - } - -diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c -index ec90b44fa0cd3..6065aaab67403 100644 ---- a/drivers/soc/ixp4xx/ixp4xx-npe.c -+++ b/drivers/soc/ixp4xx/ixp4xx-npe.c -@@ -690,8 +690,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) - - if (!(ixp4xx_read_feature_bits() & - (IXP4XX_FEATURE_RESET_NPEA << i))) { -- dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", -- i, res->start, res->end); -+ dev_info(dev, "NPE%d at %pR not available\n", -+ i, res); - continue; /* NPE already disabled or not present */ - } - npe->regs = devm_ioremap_resource(dev, res); -@@ -699,13 +699,12 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) - return PTR_ERR(npe->regs); - - if (npe_reset(npe)) { -- dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", -- i, res->start, res->end); -+ dev_info(dev, "NPE%d at %pR does not reset\n", -+ i, res); - continue; - } - npe->valid = 1; -- dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", -- i, res->start, res->end); -+ dev_info(dev, "NPE%d at %pR registered\n", i, res); - found++; - } - -diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c -index 8c968382cea76..065a800717bd5 100644 ---- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c -+++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c -@@ -145,12 +145,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev) - /* ACK - it may clear any bits so don't rely on it */ - __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]); - -- en_bitmap = qmgr_regs->irqen[0]; -+ en_bitmap = __raw_readl(&qmgr_regs->irqen[0]); - while (en_bitmap) { - i = __fls(en_bitmap); /* number of the last "low" queue */ - en_bitmap &= ~BIT(i); -- src = qmgr_regs->irqsrc[i >> 3]; -- stat = qmgr_regs->stat1[i >> 3]; -+ src = __raw_readl(&qmgr_regs->irqsrc[i >> 3]); -+ stat = __raw_readl(&qmgr_regs->stat1[i >> 3]); - if (src & 4) /* the IRQ condition is inverted */ - stat = ~stat; - if (stat & BIT(src & 3)) { -@@ -170,7 +170,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev) - /* ACK - it may clear any bits so don't rely on it */ - __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]); - -- req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h; -+ req_bitmap = __raw_readl(&qmgr_regs->irqen[1]) & -+ __raw_readl(&qmgr_regs->statne_h); - while (req_bitmap) { - i = __fls(req_bitmap); /* number of the last "high" queue */ - req_bitmap &= ~BIT(i); -diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c -index e237481dbbbbf..474d5a7fa95e3 100644 ---- a/drivers/spi/spi-imx.c -+++ b/drivers/spi/spi-imx.c -@@ -497,8 +497,10 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, - struct spi_message *msg) - { - struct spi_device *spi = msg->spi; -+ struct spi_transfer *xfer; - u32 ctrl = MX51_ECSPI_CTRL_ENABLE; -- u32 testreg; -+ u32 min_speed_hz = ~0U; -+ u32 testreg, delay; - u32 cfg = readl(spi_imx->base + MX51_ECSPI_CONFIG); - - /* set Master or Slave mode */ -@@ -559,6 +561,35 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, - - writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); - -+ /* -+ * Wait until the changes in the configuration register CONFIGREG -+ * propagate into the hardware. It takes exactly one tick of the -+ * SCLK clock, but we will wait two SCLK clock just to be sure. The -+ * effect of the delay it takes for the hardware to apply changes -+ * is noticable if the SCLK clock run very slow. In such a case, if -+ * the polarity of SCLK should be inverted, the GPIO ChipSelect might -+ * be asserted before the SCLK polarity changes, which would disrupt -+ * the SPI communication as the device on the other end would consider -+ * the change of SCLK polarity as a clock tick already. -+ * -+ * Because spi_imx->spi_bus_clk is only set in bitbang prepare_message -+ * callback, iterate over all the transfers in spi_message, find the -+ * one with lowest bus frequency, and use that bus frequency for the -+ * delay calculation. In case all transfers have speed_hz == 0, then -+ * min_speed_hz is ~0 and the resulting delay is zero. -+ */ -+ list_for_each_entry(xfer, &msg->transfers, transfer_list) { -+ if (!xfer->speed_hz) -+ continue; -+ min_speed_hz = min(xfer->speed_hz, min_speed_hz); -+ } -+ -+ delay = (2 * 1000000) / min_speed_hz; -+ if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ -+ udelay(delay); -+ else /* SCLK is _very_ slow */ -+ usleep_range(delay, delay + 10); -+ - return 0; - } - -@@ -566,7 +597,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, - struct spi_device *spi) - { - u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); -- u32 clk, delay; -+ u32 clk; - - /* Clear BL field and set the right value */ - ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; -@@ -588,23 +619,6 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, - - writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); - -- /* -- * Wait until the changes in the configuration register CONFIGREG -- * propagate into the hardware. It takes exactly one tick of the -- * SCLK clock, but we will wait two SCLK clock just to be sure. The -- * effect of the delay it takes for the hardware to apply changes -- * is noticable if the SCLK clock run very slow. In such a case, if -- * the polarity of SCLK should be inverted, the GPIO ChipSelect might -- * be asserted before the SCLK polarity changes, which would disrupt -- * the SPI communication as the device on the other end would consider -- * the change of SCLK polarity as a clock tick already. -- */ -- delay = (2 * 1000000) / clk; -- if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ -- udelay(delay); -- else /* SCLK is _very_ slow */ -- usleep_range(delay, delay + 10); -- - return 0; - } - -diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c -index f3f10443f9e26..3c841ae0a3e91 100644 ---- a/drivers/spi/spi-meson-spicc.c -+++ b/drivers/spi/spi-meson-spicc.c -@@ -597,6 +597,8 @@ static int meson_spicc_remove(struct platform_device *pdev) - - clk_disable_unprepare(spicc->core); - -+ spi_master_put(spicc->master); -+ - return 0; - } - -diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c -index db99129d31695..4305178243891 100644 ---- a/drivers/staging/rtl8712/rtl8712_led.c -+++ b/drivers/staging/rtl8712/rtl8712_led.c -@@ -1820,3 +1820,11 @@ void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction) - break; - } - } -+ -+void r8712_flush_led_works(struct _adapter *padapter) -+{ -+ struct led_priv *pledpriv = &padapter->ledpriv; -+ -+ flush_work(&pledpriv->SwLed0.BlinkWorkItem); -+ flush_work(&pledpriv->SwLed1.BlinkWorkItem); -+} -diff --git a/drivers/staging/rtl8712/rtl871x_led.h b/drivers/staging/rtl8712/rtl871x_led.h -index ee19c873cf010..2f0768132ad8f 100644 ---- a/drivers/staging/rtl8712/rtl871x_led.h -+++ b/drivers/staging/rtl8712/rtl871x_led.h -@@ -112,6 +112,7 @@ struct led_priv { - void r8712_InitSwLeds(struct _adapter *padapter); - void r8712_DeInitSwLeds(struct _adapter *padapter); - void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction); -+void r8712_flush_led_works(struct _adapter *padapter); - - #endif - -diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c -index 23cff43437e21..cd6d9ff0bebca 100644 ---- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c -+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c -@@ -224,3 +224,11 @@ void r8712_unregister_cmd_alive(struct _adapter *padapter) - } - mutex_unlock(&pwrctrl->mutex_lock); - } -+ -+void r8712_flush_rwctrl_works(struct _adapter *padapter) -+{ -+ struct pwrctrl_priv *pwrctrl = &padapter->pwrctrlpriv; -+ -+ flush_work(&pwrctrl->SetPSModeWorkItem); -+ flush_work(&pwrctrl->rpwm_workitem); -+} -diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.h b/drivers/staging/rtl8712/rtl871x_pwrctrl.h -index dd5a79f90b1a6..6eee6f1bdba4d 100644 ---- a/drivers/staging/rtl8712/rtl871x_pwrctrl.h -+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.h -@@ -111,5 +111,6 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter, - void r8712_set_ps_mode(struct _adapter *padapter, uint ps_mode, - uint smart_ps); - void r8712_set_rpwm(struct _adapter *padapter, u8 val8); -+void r8712_flush_rwctrl_works(struct _adapter *padapter); - - #endif /* __RTL871X_PWRCTRL_H_ */ -diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c -index bc421925e84c2..49188ab046123 100644 ---- a/drivers/staging/rtl8712/usb_intf.c -+++ b/drivers/staging/rtl8712/usb_intf.c -@@ -604,7 +604,8 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf) - padapter->surprise_removed = true; - if (pnetdev->reg_state != NETREG_UNINITIALIZED) - unregister_netdev(pnetdev); /* will call netdev_close() */ -- flush_scheduled_work(); -+ r8712_flush_rwctrl_works(padapter); -+ r8712_flush_led_works(padapter); - udelay(1); - /* Stop driver mlme relation timer */ - r8712_stop_drv_timers(padapter); -diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c -index 301d327d06244..e6ca03aa6830d 100644 ---- a/drivers/staging/rtl8723bs/hal/sdio_ops.c -+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c -@@ -1033,6 +1033,8 @@ void sd_int_dpc(struct adapter *adapter) - } else { - rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt); - } -+ } else { -+ kfree(c2h_evt); - } - } else { - /* Error handling for malloc fail */ -diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c -index ea79482ebda46..4b5069f88d786 100644 ---- a/drivers/tee/optee/call.c -+++ b/drivers/tee/optee/call.c -@@ -407,11 +407,13 @@ void optee_enable_shm_cache(struct optee *optee) - } - - /** -- * optee_disable_shm_cache() - Disables caching of some shared memory allocation -- * in OP-TEE -+ * __optee_disable_shm_cache() - Disables caching of some shared memory -+ * allocation in OP-TEE - * @optee: main service struct -+ * @is_mapped: true if the cached shared memory addresses were mapped by this -+ * kernel, are safe to dereference, and should be freed - */ --void optee_disable_shm_cache(struct optee *optee) -+static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped) - { - struct optee_call_waiter w; - -@@ -430,6 +432,13 @@ void optee_disable_shm_cache(struct optee *optee) - if (res.result.status == OPTEE_SMC_RETURN_OK) { - struct tee_shm *shm; - -+ /* -+ * Shared memory references that were not mapped by -+ * this kernel must be ignored to prevent a crash. -+ */ -+ if (!is_mapped) -+ continue; -+ - shm = reg_pair_to_ptr(res.result.shm_upper32, - res.result.shm_lower32); - tee_shm_free(shm); -@@ -440,6 +449,27 @@ void optee_disable_shm_cache(struct optee *optee) - optee_cq_wait_final(&optee->call_queue, &w); - } - -+/** -+ * optee_disable_shm_cache() - Disables caching of mapped shared memory -+ * allocations in OP-TEE -+ * @optee: main service struct -+ */ -+void optee_disable_shm_cache(struct optee *optee) -+{ -+ return __optee_disable_shm_cache(optee, true); -+} -+ -+/** -+ * optee_disable_unmapped_shm_cache() - Disables caching of shared memory -+ * allocations in OP-TEE which are not -+ * currently mapped -+ * @optee: main service struct -+ */ -+void optee_disable_unmapped_shm_cache(struct optee *optee) -+{ -+ return __optee_disable_shm_cache(optee, false); -+} -+ - #define PAGELIST_ENTRIES_PER_PAGE \ - ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1) - -diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c -index ba6cfba589a69..432dd38921dd9 100644 ---- a/drivers/tee/optee/core.c -+++ b/drivers/tee/optee/core.c -@@ -628,6 +628,15 @@ static struct optee *optee_probe(struct device_node *np) - optee->memremaped_shm = memremaped_shm; - optee->pool = pool; - -+ /* -+ * Ensure that there are no pre-existing shm objects before enabling -+ * the shm cache so that there's no chance of receiving an invalid -+ * address during shutdown. This could occur, for example, if we're -+ * kexec booting from an older kernel that did not properly cleanup the -+ * shm cache. -+ */ -+ optee_disable_unmapped_shm_cache(optee); -+ - optee_enable_shm_cache(optee); - - if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) -diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h -index d9c5037b4e03e..3eeaad2a28686 100644 ---- a/drivers/tee/optee/optee_private.h -+++ b/drivers/tee/optee/optee_private.h -@@ -152,6 +152,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session); - - void optee_enable_shm_cache(struct optee *optee); - void optee_disable_shm_cache(struct optee *optee); -+void optee_disable_unmapped_shm_cache(struct optee *optee); - - int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, - struct page **pages, size_t num_pages, -diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c -index d767eebf30bdd..da06ce9b9313e 100644 ---- a/drivers/tee/optee/shm_pool.c -+++ b/drivers/tee/optee/shm_pool.c -@@ -32,8 +32,10 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, - struct page **pages; - - pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL); -- if (!pages) -- return -ENOMEM; -+ if (!pages) { -+ rc = -ENOMEM; -+ goto err; -+ } - - for (i = 0; i < nr_pages; i++) { - pages[i] = page; -@@ -44,8 +46,14 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, - rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, - (unsigned long)shm->kaddr); - kfree(pages); -+ if (rc) -+ goto err; - } - -+ return 0; -+ -+err: -+ __free_pages(page, order); - return rc; - } - -diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c -index 09ddcd06c7152..1b4b4a1ba91d9 100644 ---- a/drivers/tee/tee_shm.c -+++ b/drivers/tee/tee_shm.c -@@ -219,6 +219,24 @@ struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size) - } - EXPORT_SYMBOL_GPL(tee_shm_priv_alloc); - -+/** -+ * tee_shm_alloc_kernel_buf() - Allocate shared memory for kernel buffer -+ * @ctx: Context that allocates the shared memory -+ * @size: Requested size of shared memory -+ * -+ * The returned memory registered in secure world and is suitable to be -+ * passed as a memory buffer in parameter argument to -+ * tee_client_invoke_func(). The memory allocated is later freed with a -+ * call to tee_shm_free(). -+ * -+ * @returns a pointer to 'struct tee_shm' -+ */ -+struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size) -+{ -+ return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); -+} -+EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf); -+ - struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, - size_t length, u32 flags) - { -diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c -index e9eb454c24728..98e68f25a5f34 100644 ---- a/drivers/tty/serial/8250/8250_mtk.c -+++ b/drivers/tty/serial/8250/8250_mtk.c -@@ -92,10 +92,13 @@ static void mtk8250_dma_rx_complete(void *param) - struct dma_tx_state state; - int copied, total, cnt; - unsigned char *ptr; -+ unsigned long flags; - - if (data->rx_status == DMA_RX_SHUTDOWN) - return; - -+ spin_lock_irqsave(&up->port.lock, flags); -+ - dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); - total = dma->rx_size - state.residue; - cnt = total; -@@ -119,6 +122,8 @@ static void mtk8250_dma_rx_complete(void *param) - tty_flip_buffer_push(tty_port); - - mtk8250_rx_dma(up); -+ -+ spin_unlock_irqrestore(&up->port.lock, flags); - } - - static void mtk8250_rx_dma(struct uart_8250_port *up) -diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c -index 51346ca91c45c..43fc5b6a25d35 100644 ---- a/drivers/tty/serial/8250/8250_pci.c -+++ b/drivers/tty/serial/8250/8250_pci.c -@@ -3763,6 +3763,12 @@ static const struct pci_device_id blacklist[] = { - { PCI_VDEVICE(INTEL, 0x0f0c), }, - { PCI_VDEVICE(INTEL, 0x228a), }, - { PCI_VDEVICE(INTEL, 0x228c), }, -+ { PCI_VDEVICE(INTEL, 0x4b96), }, -+ { PCI_VDEVICE(INTEL, 0x4b97), }, -+ { PCI_VDEVICE(INTEL, 0x4b98), }, -+ { PCI_VDEVICE(INTEL, 0x4b99), }, -+ { PCI_VDEVICE(INTEL, 0x4b9a), }, -+ { PCI_VDEVICE(INTEL, 0x4b9b), }, - { PCI_VDEVICE(INTEL, 0x9ce3), }, - { PCI_VDEVICE(INTEL, 0x9ce4), }, - -@@ -3923,6 +3929,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) - if (pci_match_id(pci_use_msi, dev)) { - dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); - pci_set_master(dev); -+ uart.port.flags &= ~UPF_SHARE_IRQ; - rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); - } else { - dev_dbg(&dev->dev, "Using legacy interrupts\n"); -diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 6e93aa3623d9b..8a7c6d65f10ef 100644 ---- a/drivers/tty/serial/8250/8250_port.c -+++ b/drivers/tty/serial/8250/8250_port.c -@@ -314,7 +314,11 @@ static const struct serial8250_config uart_config[] = { - /* Uart divisor latch read */ - static int default_serial_dl_read(struct uart_8250_port *up) - { -- return serial_in(up, UART_DLL) | serial_in(up, UART_DLM) << 8; -+ /* Assign these in pieces to truncate any bits above 7. */ -+ unsigned char dll = serial_in(up, UART_DLL); -+ unsigned char dlm = serial_in(up, UART_DLM); -+ -+ return dll | dlm << 8; - } - - /* Uart divisor latch write */ -@@ -1258,9 +1262,11 @@ static void autoconfig(struct uart_8250_port *up) - serial_out(up, UART_LCR, 0); - - serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); -- scratch = serial_in(up, UART_IIR) >> 6; - -- switch (scratch) { -+ /* Assign this as it is to truncate any bits above 7. */ -+ scratch = serial_in(up, UART_IIR); -+ -+ switch (scratch >> 6) { - case 0: - autoconfig_8250(up); - break; -diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c -index 2007a40feef9d..64f18bf1e694a 100644 ---- a/drivers/tty/serial/serial-tegra.c -+++ b/drivers/tty/serial/serial-tegra.c -@@ -1028,9 +1028,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) - - if (tup->cdata->fifo_mode_enable_status) { - ret = tegra_uart_wait_fifo_mode_enabled(tup); -- dev_err(tup->uport.dev, "FIFO mode not enabled\n"); -- if (ret < 0) -+ if (ret < 0) { -+ dev_err(tup->uport.dev, -+ "Failed to enable FIFO mode: %d\n", ret); - return ret; -+ } - } else { - /* - * For all tegra devices (up to t210), there is a hardware -diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c -index 666cebd9c5f29..390779e2294d9 100644 ---- a/drivers/usb/cdns3/ep0.c -+++ b/drivers/usb/cdns3/ep0.c -@@ -736,6 +736,7 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, - request->actual = 0; - priv_dev->status_completion_no_call = true; - priv_dev->pending_status_request = request; -+ usb_gadget_set_state(&priv_dev->gadget, USB_STATE_CONFIGURED); - spin_unlock_irqrestore(&priv_dev->lock, flags); - - /* -diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c -index dcd7066ffba22..3922a6f8c50a6 100644 ---- a/drivers/usb/class/usbtmc.c -+++ b/drivers/usb/class/usbtmc.c -@@ -2285,17 +2285,10 @@ static void usbtmc_interrupt(struct urb *urb) - dev_err(dev, "overflow with length %d, actual length is %d\n", - data->iin_wMaxPacketSize, urb->actual_length); - /* fall through */ -- case -ECONNRESET: -- case -ENOENT: -- case -ESHUTDOWN: -- case -EILSEQ: -- case -ETIME: -- case -EPIPE: -+ default: - /* urb terminated, clean up */ - dev_dbg(dev, "urb terminated, status: %d\n", status); - return; -- default: -- dev_err(dev, "unknown status received: %d\n", status); - } - exit: - rv = usb_submit_urb(urb, GFP_ATOMIC); -diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c -index 3740cf95560e9..0697fde51d00f 100644 ---- a/drivers/usb/common/usb-otg-fsm.c -+++ b/drivers/usb/common/usb-otg-fsm.c -@@ -193,7 +193,11 @@ static void otg_start_hnp_polling(struct otg_fsm *fsm) - if (!fsm->host_req_flag) - return; - -- INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); -+ if (!fsm->hnp_work_inited) { -+ INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); -+ fsm->hnp_work_inited = true; -+ } -+ - schedule_delayed_work(&fsm->hnp_polling_work, - msecs_to_jiffies(T_HOST_REQ_POLL)); - } -diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c -index 3d540b0d93687..e4d71410a4b1c 100644 ---- a/drivers/usb/gadget/function/f_hid.c -+++ b/drivers/usb/gadget/function/f_hid.c -@@ -41,6 +41,7 @@ struct f_hidg { - unsigned char bInterfaceSubClass; - unsigned char bInterfaceProtocol; - unsigned char protocol; -+ unsigned char idle; - unsigned short report_desc_length; - char *report_desc; - unsigned short report_length; -@@ -344,6 +345,11 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, - - spin_lock_irqsave(&hidg->write_spinlock, flags); - -+ if (!hidg->req) { -+ spin_unlock_irqrestore(&hidg->write_spinlock, flags); -+ return -ESHUTDOWN; -+ } -+ - #define WRITE_COND (!hidg->write_pending) - try_again: - /* write queue */ -@@ -364,8 +370,14 @@ try_again: - count = min_t(unsigned, count, hidg->report_length); - - spin_unlock_irqrestore(&hidg->write_spinlock, flags); -- status = copy_from_user(req->buf, buffer, count); - -+ if (!req) { -+ ERROR(hidg->func.config->cdev, "hidg->req is NULL\n"); -+ status = -ESHUTDOWN; -+ goto release_write_pending; -+ } -+ -+ status = copy_from_user(req->buf, buffer, count); - if (status != 0) { - ERROR(hidg->func.config->cdev, - "copy_from_user error\n"); -@@ -393,14 +405,17 @@ try_again: - - spin_unlock_irqrestore(&hidg->write_spinlock, flags); - -+ if (!hidg->in_ep->enabled) { -+ ERROR(hidg->func.config->cdev, "in_ep is disabled\n"); -+ status = -ESHUTDOWN; -+ goto release_write_pending; -+ } -+ - status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); -- if (status < 0) { -- ERROR(hidg->func.config->cdev, -- "usb_ep_queue error on int endpoint %zd\n", status); -+ if (status < 0) - goto release_write_pending; -- } else { -+ else - status = count; -- } - - return status; - release_write_pending: -@@ -529,6 +544,14 @@ static int hidg_setup(struct usb_function *f, - goto respond; - break; - -+ case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 -+ | HID_REQ_GET_IDLE): -+ VDBG(cdev, "get_idle\n"); -+ length = min_t(unsigned int, length, 1); -+ ((u8 *) req->buf)[0] = hidg->idle; -+ goto respond; -+ break; -+ - case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 - | HID_REQ_SET_REPORT): - VDBG(cdev, "set_report | wLength=%d\n", ctrl->wLength); -@@ -552,6 +575,14 @@ static int hidg_setup(struct usb_function *f, - goto stall; - break; - -+ case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 -+ | HID_REQ_SET_IDLE): -+ VDBG(cdev, "set_idle\n"); -+ length = 0; -+ hidg->idle = value >> 8; -+ goto respond; -+ break; -+ - case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8 - | USB_REQ_GET_DESCRIPTOR): - switch (value >> 8) { -@@ -779,6 +810,7 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) - hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass; - hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol; - hidg->protocol = HID_REPORT_PROTOCOL; -+ hidg->idle = 1; - hidg_ss_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); - hidg_ss_in_comp_desc.wBytesPerInterval = - cpu_to_le16(hidg->report_length); -diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c -index a82ba9cc0c724..e9c39a41faae9 100644 ---- a/drivers/usb/serial/ch341.c -+++ b/drivers/usb/serial/ch341.c -@@ -678,6 +678,7 @@ static struct usb_serial_driver ch341_device = { - .owner = THIS_MODULE, - .name = "ch341-uart", - }, -+ .bulk_in_size = 512, - .id_table = id_table, - .num_ports = 1, - .open = ch341_open, -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 6bd1a2f6cbd0a..1ec623e46214b 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -219,6 +219,7 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, - { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_AUTO_M3_OP_COM_V2_PID) }, - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, - { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index add602bebd820..755858ca20bac 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -159,6 +159,9 @@ - /* Vardaan Enterprises Serial Interface VEUSB422R3 */ - #define FTDI_VARDAAN_PID 0xF070 - -+/* Auto-M3 Ltd. - OP-COM USB V2 - OBD interface Adapter */ -+#define FTDI_AUTO_M3_OP_COM_V2_PID 0x4f50 -+ - /* - * Xsens Technologies BV products (http://www.xsens.com). - */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index d6d10ba1e1e80..793530f241ceb 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -1203,6 +1203,8 @@ static const struct usb_device_id option_ids[] = { - .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff), /* Telit FN980 (PCIe) */ - .driver_info = NCTRL(0) | RSVD(1) }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ -+ .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), - .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 4c37abe768512..9905720df9248 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -2407,7 +2407,7 @@ again: - goto journal_error; - err = ext4_handle_dirty_dx_node(handle, dir, - frame->bh); -- if (err) -+ if (restart || err) - goto journal_error; - } else { - struct dx_root *dxroot; -diff --git a/fs/pipe.c b/fs/pipe.c -index 8a2ab2f974bd4..30a43b1956742 100644 ---- a/fs/pipe.c -+++ b/fs/pipe.c -@@ -30,6 +30,21 @@ - - #include "internal.h" - -+/* -+ * New pipe buffers will be restricted to this size while the user is exceeding -+ * their pipe buffer quota. The general pipe use case needs at least two -+ * buffers: one for data yet to be read, and one for new data. If this is less -+ * than two, then a write to a non-empty pipe may block even if the pipe is not -+ * full. This can occur with GNU make jobserver or similar uses of pipes as -+ * semaphores: multiple processes may be waiting to write tokens back to the -+ * pipe before reading tokens: https://lore.kernel.org/lkml/1628086770.5rn8p04n6j.none@localhost/. -+ * -+ * Users can reduce their pipe buffers with F_SETPIPE_SZ below this at their -+ * own risk, namely: pipe writes to non-full pipes may block until the pipe is -+ * emptied. -+ */ -+#define PIPE_MIN_DEF_BUFFERS 2 -+ - /* - * The max size that a non-root user is allowed to grow the pipe. Can - * be set by root in /proc/sys/fs/pipe-max-size -@@ -666,8 +681,8 @@ struct pipe_inode_info *alloc_pipe_info(void) - user_bufs = account_pipe_buffers(user, 0, pipe_bufs); - - if (too_many_pipe_buffers_soft(user_bufs) && is_unprivileged_user()) { -- user_bufs = account_pipe_buffers(user, pipe_bufs, 1); -- pipe_bufs = 1; -+ user_bufs = account_pipe_buffers(user, pipe_bufs, PIPE_MIN_DEF_BUFFERS); -+ pipe_bufs = PIPE_MIN_DEF_BUFFERS; - } - - if (too_many_pipe_buffers_hard(user_bufs) && is_unprivileged_user()) -diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c -index 9e64e23014e8e..07d787145cc36 100644 ---- a/fs/reiserfs/stree.c -+++ b/fs/reiserfs/stree.c -@@ -387,6 +387,24 @@ void pathrelse(struct treepath *search_path) - search_path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET; - } - -+static int has_valid_deh_location(struct buffer_head *bh, struct item_head *ih) -+{ -+ struct reiserfs_de_head *deh; -+ int i; -+ -+ deh = B_I_DEH(bh, ih); -+ for (i = 0; i < ih_entry_count(ih); i++) { -+ if (deh_location(&deh[i]) > ih_item_len(ih)) { -+ reiserfs_warning(NULL, "reiserfs-5094", -+ "directory entry location seems wrong %h", -+ &deh[i]); -+ return 0; -+ } -+ } -+ -+ return 1; -+} -+ - static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) - { - struct block_head *blkh; -@@ -454,11 +472,14 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) - "(second one): %h", ih); - return 0; - } -- if (is_direntry_le_ih(ih) && (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE))) { -- reiserfs_warning(NULL, "reiserfs-5093", -- "item entry count seems wrong %h", -- ih); -- return 0; -+ if (is_direntry_le_ih(ih)) { -+ if (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE)) { -+ reiserfs_warning(NULL, "reiserfs-5093", -+ "item entry count seems wrong %h", -+ ih); -+ return 0; -+ } -+ return has_valid_deh_location(bh, ih); - } - prev_location = ih_location(ih); - } -diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c -index 1b9c7a387dc71..913f5af9bf248 100644 ---- a/fs/reiserfs/super.c -+++ b/fs/reiserfs/super.c -@@ -2082,6 +2082,14 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) - unlock_new_inode(root_inode); - } - -+ if (!S_ISDIR(root_inode->i_mode) || !inode_get_bytes(root_inode) || -+ !root_inode->i_size) { -+ SWARN(silent, s, "", "corrupt root inode, run fsck"); -+ iput(root_inode); -+ errval = -EUCLEAN; -+ goto error; -+ } -+ - s->s_root = d_make_root(root_inode); - if (!s->s_root) - goto error; -diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h -index 7a03f68fb982d..91677f2fa2e8b 100644 ---- a/include/linux/tee_drv.h -+++ b/include/linux/tee_drv.h -@@ -317,6 +317,7 @@ void *tee_get_drvdata(struct tee_device *teedev); - * @returns a pointer to 'struct tee_shm' - */ - struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags); -+struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size); - - /** - * tee_shm_priv_alloc() - Allocate shared memory privately -diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h -index e78eb577d0fa1..8ef7d148c1493 100644 ---- a/include/linux/usb/otg-fsm.h -+++ b/include/linux/usb/otg-fsm.h -@@ -196,6 +196,7 @@ struct otg_fsm { - struct mutex lock; - u8 *host_req_flag; - struct delayed_work hnp_polling_work; -+ bool hnp_work_inited; - bool state_changed; - }; - -diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h -index 325e8efb5b368..14d00cc10e22e 100644 ---- a/include/net/bluetooth/hci_core.h -+++ b/include/net/bluetooth/hci_core.h -@@ -1056,6 +1056,7 @@ struct hci_dev *hci_alloc_dev(void); - void hci_free_dev(struct hci_dev *hdev); - int hci_register_dev(struct hci_dev *hdev); - void hci_unregister_dev(struct hci_dev *hdev); -+void hci_cleanup_dev(struct hci_dev *hdev); - int hci_suspend_dev(struct hci_dev *hdev); - int hci_resume_dev(struct hci_dev *hdev); - int hci_reset_dev(struct hci_dev *hdev); -diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h -index feeecbc80e727..2c739fc752e1a 100644 ---- a/include/net/ip6_route.h -+++ b/include/net/ip6_route.h -@@ -263,7 +263,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, - - static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb) - { -- int mtu; -+ unsigned int mtu; - - struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ? - inet6_sk(skb->sk) : NULL; -diff --git a/kernel/time/timer.c b/kernel/time/timer.c -index 87fa73cdb90f6..16a2b62f5f74c 100644 ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -1269,8 +1269,10 @@ static inline void timer_base_unlock_expiry(struct timer_base *base) - static void timer_sync_wait_running(struct timer_base *base) - { - if (atomic_read(&base->timer_waiters)) { -+ raw_spin_unlock_irq(&base->lock); - spin_unlock(&base->expiry_lock); - spin_lock(&base->expiry_lock); -+ raw_spin_lock_irq(&base->lock); - } - } - -@@ -1454,14 +1456,14 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head) - if (timer->flags & TIMER_IRQSAFE) { - raw_spin_unlock(&base->lock); - call_timer_fn(timer, fn, baseclk); -- base->running_timer = NULL; - raw_spin_lock(&base->lock); -+ base->running_timer = NULL; - } else { - raw_spin_unlock_irq(&base->lock); - call_timer_fn(timer, fn, baseclk); -+ raw_spin_lock_irq(&base->lock); - base->running_timer = NULL; - timer_sync_wait_running(base); -- raw_spin_lock_irq(&base->lock); - } - } - } -diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c -index 553add1eb457f..db2b10c718ba2 100644 ---- a/kernel/trace/trace_events_hist.c -+++ b/kernel/trace/trace_events_hist.c -@@ -3169,6 +3169,10 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, - - expr->operands[0] = operand1; - expr->operands[1] = operand2; -+ -+ /* The operand sizes should be the same, so just pick one */ -+ expr->size = operand1->size; -+ - expr->operator = field_op; - expr->name = expr_str(expr, 0); - expr->type = kstrdup(operand1->type, GFP_KERNEL); -diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c -index 21a7ea9b70c8a..83a07fca9000f 100644 ---- a/net/bluetooth/hci_core.c -+++ b/net/bluetooth/hci_core.c -@@ -3393,14 +3393,10 @@ EXPORT_SYMBOL(hci_register_dev); - /* Unregister HCI device */ - void hci_unregister_dev(struct hci_dev *hdev) - { -- int id; -- - BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); - - hci_dev_set_flag(hdev, HCI_UNREGISTER); - -- id = hdev->id; -- - write_lock(&hci_dev_list_lock); - list_del(&hdev->list); - write_unlock(&hci_dev_list_lock); -@@ -3429,7 +3425,14 @@ void hci_unregister_dev(struct hci_dev *hdev) - } - - device_del(&hdev->dev); -+ /* Actual cleanup is deferred until hci_cleanup_dev(). */ -+ hci_dev_put(hdev); -+} -+EXPORT_SYMBOL(hci_unregister_dev); - -+/* Cleanup HCI device */ -+void hci_cleanup_dev(struct hci_dev *hdev) -+{ - debugfs_remove_recursive(hdev->debugfs); - kfree_const(hdev->hw_info); - kfree_const(hdev->fw_info); -@@ -3452,11 +3455,8 @@ void hci_unregister_dev(struct hci_dev *hdev) - hci_discovery_filter_clear(hdev); - hci_dev_unlock(hdev); - -- hci_dev_put(hdev); -- -- ida_simple_remove(&hci_index_ida, id); -+ ida_simple_remove(&hci_index_ida, hdev->id); - } --EXPORT_SYMBOL(hci_unregister_dev); - - /* Suspend HCI device */ - int hci_suspend_dev(struct hci_dev *hdev) -diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c -index 8d2c26c4b6d3d..befab857a39be 100644 ---- a/net/bluetooth/hci_sock.c -+++ b/net/bluetooth/hci_sock.c -@@ -59,6 +59,17 @@ struct hci_pinfo { - char comm[TASK_COMM_LEN]; - }; - -+static struct hci_dev *hci_hdev_from_sock(struct sock *sk) -+{ -+ struct hci_dev *hdev = hci_pi(sk)->hdev; -+ -+ if (!hdev) -+ return ERR_PTR(-EBADFD); -+ if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) -+ return ERR_PTR(-EPIPE); -+ return hdev; -+} -+ - void hci_sock_set_flag(struct sock *sk, int nr) - { - set_bit(nr, &hci_pi(sk)->flags); -@@ -752,19 +763,13 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) - if (event == HCI_DEV_UNREG) { - struct sock *sk; - -- /* Detach sockets from device */ -+ /* Wake up sockets using this dead device */ - read_lock(&hci_sk_list.lock); - sk_for_each(sk, &hci_sk_list.head) { -- lock_sock(sk); - if (hci_pi(sk)->hdev == hdev) { -- hci_pi(sk)->hdev = NULL; - sk->sk_err = EPIPE; -- sk->sk_state = BT_OPEN; - sk->sk_state_change(sk); -- -- hci_dev_put(hdev); - } -- release_sock(sk); - } - read_unlock(&hci_sk_list.lock); - } -@@ -923,10 +928,10 @@ static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg) - static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, - unsigned long arg) - { -- struct hci_dev *hdev = hci_pi(sk)->hdev; -+ struct hci_dev *hdev = hci_hdev_from_sock(sk); - -- if (!hdev) -- return -EBADFD; -+ if (IS_ERR(hdev)) -+ return PTR_ERR(hdev); - - if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) - return -EBUSY; -@@ -1080,6 +1085,18 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, - - lock_sock(sk); - -+ /* Allow detaching from dead device and attaching to alive device, if -+ * the caller wants to re-bind (instead of close) this socket in -+ * response to hci_sock_dev_event(HCI_DEV_UNREG) notification. -+ */ -+ hdev = hci_pi(sk)->hdev; -+ if (hdev && hci_dev_test_flag(hdev, HCI_UNREGISTER)) { -+ hci_pi(sk)->hdev = NULL; -+ sk->sk_state = BT_OPEN; -+ hci_dev_put(hdev); -+ } -+ hdev = NULL; -+ - if (sk->sk_state == BT_BOUND) { - err = -EALREADY; - goto done; -@@ -1356,9 +1373,9 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, - - lock_sock(sk); - -- hdev = hci_pi(sk)->hdev; -- if (!hdev) { -- err = -EBADFD; -+ hdev = hci_hdev_from_sock(sk); -+ if (IS_ERR(hdev)) { -+ err = PTR_ERR(hdev); - goto done; - } - -@@ -1718,9 +1735,9 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg, - goto done; - } - -- hdev = hci_pi(sk)->hdev; -- if (!hdev) { -- err = -EBADFD; -+ hdev = hci_hdev_from_sock(sk); -+ if (IS_ERR(hdev)) { -+ err = PTR_ERR(hdev); - goto done; - } - -diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c -index 9874844a95a98..b69d88b88d2e4 100644 ---- a/net/bluetooth/hci_sysfs.c -+++ b/net/bluetooth/hci_sysfs.c -@@ -83,6 +83,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn) - static void bt_host_release(struct device *dev) - { - struct hci_dev *hdev = to_hci_dev(dev); -+ -+ if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) -+ hci_cleanup_dev(hdev); - kfree(hdev); - module_put(THIS_MODULE); - } -diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c -index e09147ac9a990..fc61cd3fea652 100644 ---- a/net/ipv4/tcp_offload.c -+++ b/net/ipv4/tcp_offload.c -@@ -298,6 +298,9 @@ int tcp_gro_complete(struct sk_buff *skb) - if (th->cwr) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; - -+ if (skb->encapsulation) -+ skb->inner_transport_header = skb->transport_header; -+ - return 0; - } - EXPORT_SYMBOL(tcp_gro_complete); -diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c -index c463eebdc8fe2..487a92d75c703 100644 ---- a/net/ipv4/udp_offload.c -+++ b/net/ipv4/udp_offload.c -@@ -501,6 +501,10 @@ static int udp_gro_complete_segment(struct sk_buff *skb) - - skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; - skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_L4; -+ -+ if (skb->encapsulation) -+ skb->inner_transport_header = skb->transport_header; -+ - return 0; - } - -diff --git a/net/sctp/auth.c b/net/sctp/auth.c -index 7eced1e523a5e..3b2d0bd616dd4 100644 ---- a/net/sctp/auth.c -+++ b/net/sctp/auth.c -@@ -863,14 +863,18 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, - memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylength); - cur_key->key = key; - -- if (replace) { -- list_del_init(&shkey->key_list); -- sctp_auth_shkey_release(shkey); -- if (asoc && asoc->active_key_id == auth_key->sca_keynumber) -- sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); -+ if (!replace) { -+ list_add(&cur_key->key_list, sh_keys); -+ return 0; - } -+ -+ list_del_init(&shkey->key_list); -+ sctp_auth_shkey_release(shkey); - list_add(&cur_key->key_list, sh_keys); - -+ if (asoc && asoc->active_key_id == auth_key->sca_keynumber) -+ sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); -+ - return 0; - } - -diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py -index 74f8aadfd4cbc..7011fbe003ff2 100755 ---- a/scripts/tracing/draw_functrace.py -+++ b/scripts/tracing/draw_functrace.py -@@ -17,7 +17,7 @@ Usage: - $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func - Wait some times but not too much, the script is a bit slow. - Break the pipe (Ctrl + Z) -- $ scripts/draw_functrace.py < raw_trace_func > draw_functrace -+ $ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace - Then you have your drawn trace in draw_functrace - """ - -@@ -103,10 +103,10 @@ def parseLine(line): - line = line.strip() - if line.startswith("#"): - raise CommentLineException -- m = re.match("[^]]+?\\] +([0-9.]+): (\\w+) <-(\\w+)", line) -+ m = re.match("[^]]+?\\] +([a-z.]+) +([0-9.]+): (\\w+) <-(\\w+)", line) - if m is None: - raise BrokenLineException -- return (m.group(1), m.group(2), m.group(3)) -+ return (m.group(2), m.group(3), m.group(4)) - - - def main(): -diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c -index 83be6b982a87c..97e8eb38b0961 100644 ---- a/sound/core/seq/seq_ports.c -+++ b/sound/core/seq/seq_ports.c -@@ -514,10 +514,11 @@ static int check_and_subscribe_port(struct snd_seq_client *client, - return err; - } - --static void delete_and_unsubscribe_port(struct snd_seq_client *client, -- struct snd_seq_client_port *port, -- struct snd_seq_subscribers *subs, -- bool is_src, bool ack) -+/* called with grp->list_mutex held */ -+static void __delete_and_unsubscribe_port(struct snd_seq_client *client, -+ struct snd_seq_client_port *port, -+ struct snd_seq_subscribers *subs, -+ bool is_src, bool ack) - { - struct snd_seq_port_subs_info *grp; - struct list_head *list; -@@ -525,7 +526,6 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, - - grp = is_src ? &port->c_src : &port->c_dest; - list = is_src ? &subs->src_list : &subs->dest_list; -- down_write(&grp->list_mutex); - write_lock_irq(&grp->list_lock); - empty = list_empty(list); - if (!empty) -@@ -535,6 +535,18 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, - - if (!empty) - unsubscribe_port(client, port, grp, &subs->info, ack); -+} -+ -+static void delete_and_unsubscribe_port(struct snd_seq_client *client, -+ struct snd_seq_client_port *port, -+ struct snd_seq_subscribers *subs, -+ bool is_src, bool ack) -+{ -+ struct snd_seq_port_subs_info *grp; -+ -+ grp = is_src ? &port->c_src : &port->c_dest; -+ down_write(&grp->list_mutex); -+ __delete_and_unsubscribe_port(client, port, subs, is_src, ack); - up_write(&grp->list_mutex); - } - -@@ -590,27 +602,30 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, - struct snd_seq_client_port *dest_port, - struct snd_seq_port_subscribe *info) - { -- struct snd_seq_port_subs_info *src = &src_port->c_src; -+ struct snd_seq_port_subs_info *dest = &dest_port->c_dest; - struct snd_seq_subscribers *subs; - int err = -ENOENT; - -- down_write(&src->list_mutex); -+ /* always start from deleting the dest port for avoiding concurrent -+ * deletions -+ */ -+ down_write(&dest->list_mutex); - /* look for the connection */ -- list_for_each_entry(subs, &src->list_head, src_list) { -+ list_for_each_entry(subs, &dest->list_head, dest_list) { - if (match_subs_info(info, &subs->info)) { -- atomic_dec(&subs->ref_count); /* mark as not ready */ -+ __delete_and_unsubscribe_port(dest_client, dest_port, -+ subs, false, -+ connector->number != dest_client->number); - err = 0; - break; - } - } -- up_write(&src->list_mutex); -+ up_write(&dest->list_mutex); - if (err < 0) - return err; - - delete_and_unsubscribe_port(src_client, src_port, subs, true, - connector->number != src_client->number); -- delete_and_unsubscribe_port(dest_client, dest_port, subs, false, -- connector->number != dest_client->number); - kfree(subs); - return 0; - } -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index f5606036b6a29..a0d1561eeb532 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -7971,6 +7971,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), - SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), -diff --git a/sound/usb/clock.c b/sound/usb/clock.c -index 6a51b9d20eebf..3d1c0ec117536 100644 ---- a/sound/usb/clock.c -+++ b/sound/usb/clock.c -@@ -319,6 +319,12 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, - selector->baCSourceID[ret - 1], - visited, validate); - if (ret > 0) { -+ /* -+ * For Samsung USBC Headset (AKG), setting clock selector again -+ * will result in incorrect default clock setting problems -+ */ -+ if (chip->usb_id == USB_ID(0x04e8, 0xa051)) -+ return ret; - err = uac_clock_selector_set_val(chip, entity_id, cur); - if (err < 0) - return err; -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 5b17a5c5785c0..4d20f3f45f7e2 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -1842,6 +1842,7 @@ static const struct registration_quirk registration_quirks[] = { - REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ -+ REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ - { 0 } /* terminator */ - }; -diff --git a/tools/testing/selftests/bpf/verifier/stack_ptr.c b/tools/testing/selftests/bpf/verifier/stack_ptr.c -index 7276620ef242a..53d2a5a5ec582 100644 ---- a/tools/testing/selftests/bpf/verifier/stack_ptr.c -+++ b/tools/testing/selftests/bpf/verifier/stack_ptr.c -@@ -291,8 +291,6 @@ - BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), - BPF_EXIT_INSN(), - }, -- .result_unpriv = REJECT, -- .errstr_unpriv = "invalid stack off=0 size=1", - .result = ACCEPT, - .retval = 42, - }, -diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -index a8dab0f58462e..188ac92c56d1b 100644 ---- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -+++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c -@@ -301,8 +301,6 @@ - }, - .fixup_map_array_48b = { 3 }, - .result = ACCEPT, -- .result_unpriv = REJECT, -- .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", - .retval = 1, - }, - { -@@ -372,8 +370,6 @@ - }, - .fixup_map_array_48b = { 3 }, - .result = ACCEPT, -- .result_unpriv = REJECT, -- .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", - .retval = 1, - }, - { -@@ -473,8 +469,6 @@ - }, - .fixup_map_array_48b = { 3 }, - .result = ACCEPT, -- .result_unpriv = REJECT, -- .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", - .retval = 1, - }, - { -@@ -767,8 +761,6 @@ - }, - .fixup_map_array_48b = { 3 }, - .result = ACCEPT, -- .result_unpriv = REJECT, -- .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", - .retval = 1, - }, - { -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index 862c0708f58df..fc48298649c6c 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -635,6 +635,8 @@ static void kvm_destroy_vm_debugfs(struct kvm *kvm) - - static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) - { -+ static DEFINE_MUTEX(kvm_debugfs_lock); -+ struct dentry *dent; - char dir_name[ITOA_MAX_LEN * 2]; - struct kvm_stat_data *stat_data; - struct kvm_stats_debugfs_item *p; -@@ -643,8 +645,20 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) - return 0; - - snprintf(dir_name, sizeof(dir_name), "%d-%d", task_pid_nr(current), fd); -- kvm->debugfs_dentry = debugfs_create_dir(dir_name, kvm_debugfs_dir); -+ mutex_lock(&kvm_debugfs_lock); -+ dent = debugfs_lookup(dir_name, kvm_debugfs_dir); -+ if (dent) { -+ pr_warn_ratelimited("KVM: debugfs: duplicate directory %s\n", dir_name); -+ dput(dent); -+ mutex_unlock(&kvm_debugfs_lock); -+ return 0; -+ } -+ dent = debugfs_create_dir(dir_name, kvm_debugfs_dir); -+ mutex_unlock(&kvm_debugfs_lock); -+ if (IS_ERR(dent)) -+ return 0; - -+ kvm->debugfs_dentry = dent; - kvm->debugfs_stat_data = kcalloc(kvm_debugfs_num_entries, - sizeof(*kvm->debugfs_stat_data), - GFP_KERNEL_ACCOUNT); -@@ -4367,7 +4381,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) - } - add_uevent_var(env, "PID=%d", kvm->userspace_pid); - -- if (!IS_ERR_OR_NULL(kvm->debugfs_dentry)) { -+ if (kvm->debugfs_dentry) { - char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL_ACCOUNT); - - if (p) { diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.140-141.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.140-141.patch deleted file mode 100644 index 4c55cac833..0000000000 --- a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.140-141.patch +++ /dev/null @@ -1,1429 +0,0 @@ -diff --git a/Documentation/virt/kvm/mmu.txt b/Documentation/virt/kvm/mmu.txt -index ec072c6bc03f8..da1ac6a6398f6 100644 ---- a/Documentation/virt/kvm/mmu.txt -+++ b/Documentation/virt/kvm/mmu.txt -@@ -152,8 +152,8 @@ Shadow pages contain the following information: - shadow pages) so role.quadrant takes values in the range 0..3. Each - quadrant maps 1GB virtual address space. - role.access: -- Inherited guest access permissions in the form uwx. Note execute -- permission is positive, not negative. -+ Inherited guest access permissions from the parent ptes in the form uwx. -+ Note execute permission is positive, not negative. - role.invalid: - The page is invalid and should not be used. It is a root page that is - currently pinned (by a cpu hardware register pointing to it); once it is -diff --git a/Makefile b/Makefile -index 1cb8f72d4dcea..2bfa11d0aab36 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 140 -+SUBLEVEL = 141 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h -index a20fc1ba607f3..d4a8ad6c6a4bb 100644 ---- a/arch/x86/kvm/paging_tmpl.h -+++ b/arch/x86/kvm/paging_tmpl.h -@@ -90,8 +90,8 @@ struct guest_walker { - gpa_t pte_gpa[PT_MAX_FULL_LEVELS]; - pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS]; - bool pte_writable[PT_MAX_FULL_LEVELS]; -- unsigned pt_access; -- unsigned pte_access; -+ unsigned int pt_access[PT_MAX_FULL_LEVELS]; -+ unsigned int pte_access; - gfn_t gfn; - struct x86_exception fault; - }; -@@ -406,13 +406,15 @@ retry_walk: - } - - walker->ptes[walker->level - 1] = pte; -+ -+ /* Convert to ACC_*_MASK flags for struct guest_walker. */ -+ walker->pt_access[walker->level - 1] = FNAME(gpte_access)(pt_access ^ walk_nx_mask); - } while (!is_last_gpte(mmu, walker->level, pte)); - - pte_pkey = FNAME(gpte_pkeys)(vcpu, pte); - accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0; - - /* Convert to ACC_*_MASK flags for struct guest_walker. */ -- walker->pt_access = FNAME(gpte_access)(pt_access ^ walk_nx_mask); - walker->pte_access = FNAME(gpte_access)(pte_access ^ walk_nx_mask); - errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access); - if (unlikely(errcode)) -@@ -451,7 +453,8 @@ retry_walk: - } - - pgprintk("%s: pte %llx pte_access %x pt_access %x\n", -- __func__, (u64)pte, walker->pte_access, walker->pt_access); -+ __func__, (u64)pte, walker->pte_access, -+ walker->pt_access[walker->level - 1]); - return 1; - - error: -@@ -620,7 +623,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, - { - struct kvm_mmu_page *sp = NULL; - struct kvm_shadow_walk_iterator it; -- unsigned direct_access, access = gw->pt_access; -+ unsigned int direct_access, access; - int top_level, ret; - gfn_t gfn, base_gfn; - -@@ -652,6 +655,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, - sp = NULL; - if (!is_shadow_present_pte(*it.sptep)) { - table_gfn = gw->table_gfn[it.level - 2]; -+ access = gw->pt_access[it.level - 2]; - sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1, - false, access); - } -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 7341d22ed04f1..2a958dcc80f21 100644 ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -1783,7 +1783,7 @@ static void __sev_asid_free(int asid) - - for_each_possible_cpu(cpu) { - sd = per_cpu(svm_data, cpu); -- sd->sev_vmcbs[pos] = NULL; -+ sd->sev_vmcbs[asid] = NULL; - } - } - -diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c -index 3d6a6306cec77..639dc8d45e603 100644 ---- a/drivers/media/v4l2-core/v4l2-mem2mem.c -+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c -@@ -635,10 +635,8 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *file, - * If the last buffer was dequeued from the capture queue, - * return immediately. DQBUF will return -EPIPE. - */ -- if (dst_q->last_buffer_dequeued) { -- spin_unlock_irqrestore(&dst_q->done_lock, flags); -- return EPOLLIN | EPOLLRDNORM; -- } -+ if (dst_q->last_buffer_dequeued) -+ rc |= EPOLLIN | EPOLLRDNORM; - } - spin_unlock_irqrestore(&dst_q->done_lock, flags); - -diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c -index 0de52e70abcca..53dbf3e28f1ef 100644 ---- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c -+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c -@@ -1191,9 +1191,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev) - } - - dev_info(dev, -- "Xilinx EmacLite at 0x%08X mapped to 0x%08X, irq=%d\n", -- (unsigned int __force)ndev->mem_start, -- (unsigned int __force)lp->base_addr, ndev->irq); -+ "Xilinx EmacLite at 0x%08X mapped to 0x%p, irq=%d\n", -+ (unsigned int __force)ndev->mem_start, lp->base_addr, ndev->irq); - return 0; - - error: -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c -index 61824bbb55887..b7e2b4a0f3c66 100644 ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -283,7 +283,7 @@ static struct channel *ppp_find_channel(struct ppp_net *pn, int unit); - static int ppp_connect_channel(struct channel *pch, int unit); - static int ppp_disconnect_channel(struct channel *pch); - static void ppp_destroy_channel(struct channel *pch); --static int unit_get(struct idr *p, void *ptr); -+static int unit_get(struct idr *p, void *ptr, int min); - static int unit_set(struct idr *p, void *ptr, int n); - static void unit_put(struct idr *p, int n); - static void *unit_find(struct idr *p, int n); -@@ -959,9 +959,20 @@ static int ppp_unit_register(struct ppp *ppp, int unit, bool ifname_is_set) - mutex_lock(&pn->all_ppp_mutex); - - if (unit < 0) { -- ret = unit_get(&pn->units_idr, ppp); -+ ret = unit_get(&pn->units_idr, ppp, 0); - if (ret < 0) - goto err; -+ if (!ifname_is_set) { -+ while (1) { -+ snprintf(ppp->dev->name, IFNAMSIZ, "ppp%i", ret); -+ if (!__dev_get_by_name(ppp->ppp_net, ppp->dev->name)) -+ break; -+ unit_put(&pn->units_idr, ret); -+ ret = unit_get(&pn->units_idr, ppp, ret + 1); -+ if (ret < 0) -+ goto err; -+ } -+ } - } else { - /* Caller asked for a specific unit number. Fail with -EEXIST - * if unavailable. For backward compatibility, return -EEXIST -@@ -3294,9 +3305,9 @@ static int unit_set(struct idr *p, void *ptr, int n) - } - - /* get new free unit number and associate pointer with it */ --static int unit_get(struct idr *p, void *ptr) -+static int unit_get(struct idr *p, void *ptr, int min) - { -- return idr_alloc(p, ptr, 0, 0, GFP_KERNEL); -+ return idr_alloc(p, ptr, min, 0, GFP_KERNEL); - } - - /* put unit number back to a pool */ -diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c -index 4b5069f88d786..3a54455d9ddff 100644 ---- a/drivers/tee/optee/call.c -+++ b/drivers/tee/optee/call.c -@@ -181,7 +181,7 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params, - struct optee_msg_arg *ma; - - shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params), -- TEE_SHM_MAPPED); -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (IS_ERR(shm)) - return shm; - -diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c -index 432dd38921dd9..4bb4c8f28cbd7 100644 ---- a/drivers/tee/optee/core.c -+++ b/drivers/tee/optee/core.c -@@ -254,7 +254,8 @@ static void optee_release(struct tee_context *ctx) - if (!ctxdata) - return; - -- shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED); -+ shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (!IS_ERR(shm)) { - arg = tee_shm_get_va(shm, 0); - /* -diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c -index b4ade54d1f280..aecf62016e7b8 100644 ---- a/drivers/tee/optee/rpc.c -+++ b/drivers/tee/optee/rpc.c -@@ -220,7 +220,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, - shm = cmd_alloc_suppl(ctx, sz); - break; - case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: -- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED); -+ shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV); - break; - default: - arg->ret = TEEC_ERROR_BAD_PARAMETERS; -@@ -405,7 +405,8 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param, - - switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { - case OPTEE_SMC_RPC_FUNC_ALLOC: -- shm = tee_shm_alloc(ctx, param->a1, TEE_SHM_MAPPED); -+ shm = tee_shm_alloc(ctx, param->a1, -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { - reg_pair_from_64(¶m->a1, ¶m->a2, pa); - reg_pair_from_64(¶m->a4, ¶m->a5, -diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c -index da06ce9b9313e..c41a9a501a6e9 100644 ---- a/drivers/tee/optee/shm_pool.c -+++ b/drivers/tee/optee/shm_pool.c -@@ -27,7 +27,11 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, - shm->paddr = page_to_phys(page); - shm->size = PAGE_SIZE << order; - -- if (shm->flags & TEE_SHM_DMA_BUF) { -+ /* -+ * Shared memory private to the OP-TEE driver doesn't need -+ * to be registered with OP-TEE. -+ */ -+ if (!(shm->flags & TEE_SHM_PRIV)) { - unsigned int nr_pages = 1 << order, i; - struct page **pages; - -@@ -60,7 +64,7 @@ err: - static void pool_op_free(struct tee_shm_pool_mgr *poolm, - struct tee_shm *shm) - { -- if (shm->flags & TEE_SHM_DMA_BUF) -+ if (!(shm->flags & TEE_SHM_PRIV)) - optee_shm_unregister(shm->ctx, shm); - - free_pages((unsigned long)shm->kaddr, get_order(shm->size)); -diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c -index 1b4b4a1ba91d9..d6491e973fa4c 100644 ---- a/drivers/tee/tee_shm.c -+++ b/drivers/tee/tee_shm.c -@@ -117,7 +117,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, - return ERR_PTR(-EINVAL); - } - -- if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF))) { -+ if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF | TEE_SHM_PRIV))) { - dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags); - return ERR_PTR(-EINVAL); - } -@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(tee_shm_priv_alloc); - */ - struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size) - { -- return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); -+ return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED); - } - EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf); - -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c -index 03b444f753aa2..4f28122f1bb83 100644 ---- a/drivers/usb/dwc3/ep0.c -+++ b/drivers/usb/dwc3/ep0.c -@@ -197,7 +197,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, - int ret; - - spin_lock_irqsave(&dwc->lock, flags); -- if (!dep->endpoint.desc) { -+ if (!dep->endpoint.desc || !dwc->pullups_connected) { - dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", - dep->name); - ret = -ESHUTDOWN; -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 9cf66636b19d5..8a3752fcf7b46 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -746,8 +746,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) - - trace_dwc3_gadget_ep_disable(dep); - -- dwc3_remove_requests(dwc, dep); -- - /* make sure HW endpoint isn't stalled */ - if (dep->flags & DWC3_EP_STALL) - __dwc3_gadget_ep_set_halt(dep, 0, false); -@@ -756,16 +754,18 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) - reg &= ~DWC3_DALEPENA_EP(dep->number); - dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); - -- dep->stream_capable = false; -- dep->type = 0; -- dep->flags = 0; -- - /* Clear out the ep descriptors for non-ep0 */ - if (dep->number > 1) { - dep->endpoint.comp_desc = NULL; - dep->endpoint.desc = NULL; - } - -+ dwc3_remove_requests(dwc, dep); -+ -+ dep->stream_capable = false; -+ dep->type = 0; -+ dep->flags = 0; -+ - return 0; - } - -@@ -1511,7 +1511,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) - { - struct dwc3 *dwc = dep->dwc; - -- if (!dep->endpoint.desc) { -+ if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) { - dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", - dep->name); - return -ESHUTDOWN; -@@ -1931,6 +1931,21 @@ static int dwc3_gadget_set_selfpowered(struct usb_gadget *g, - return 0; - } - -+static void dwc3_stop_active_transfers(struct dwc3 *dwc) -+{ -+ u32 epnum; -+ -+ for (epnum = 2; epnum < dwc->num_eps; epnum++) { -+ struct dwc3_ep *dep; -+ -+ dep = dwc->eps[epnum]; -+ if (!dep) -+ continue; -+ -+ dwc3_remove_requests(dwc, dep); -+ } -+} -+ - static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) - { - u32 reg; -@@ -1976,6 +1991,10 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) - return 0; - } - -+static void dwc3_gadget_disable_irq(struct dwc3 *dwc); -+static void __dwc3_gadget_stop(struct dwc3 *dwc); -+static int __dwc3_gadget_start(struct dwc3 *dwc); -+ - static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) - { - struct dwc3 *dwc = gadget_to_dwc(g); -@@ -1999,9 +2018,73 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) - } - } - -+ /* -+ * Avoid issuing a runtime resume if the device is already in the -+ * suspended state during gadget disconnect. DWC3 gadget was already -+ * halted/stopped during runtime suspend. -+ */ -+ if (!is_on) { -+ pm_runtime_barrier(dwc->dev); -+ if (pm_runtime_suspended(dwc->dev)) -+ return 0; -+ } -+ -+ /* -+ * Check the return value for successful resume, or error. For a -+ * successful resume, the DWC3 runtime PM resume routine will handle -+ * the run stop sequence, so avoid duplicate operations here. -+ */ -+ ret = pm_runtime_get_sync(dwc->dev); -+ if (!ret || ret < 0) { -+ pm_runtime_put(dwc->dev); -+ return 0; -+ } -+ -+ /* -+ * Synchronize and disable any further event handling while controller -+ * is being enabled/disabled. -+ */ -+ disable_irq(dwc->irq_gadget); -+ - spin_lock_irqsave(&dwc->lock, flags); -+ -+ if (!is_on) { -+ u32 count; -+ -+ dwc->connected = false; -+ /* -+ * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a -+ * Section 4.1.8 Table 4-7, it states that for a device-initiated -+ * disconnect, the SW needs to ensure that it sends "a DEPENDXFER -+ * command for any active transfers" before clearing the RunStop -+ * bit. -+ */ -+ dwc3_stop_active_transfers(dwc); -+ __dwc3_gadget_stop(dwc); -+ -+ /* -+ * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a -+ * Section 1.3.4, it mentions that for the DEVCTRLHLT bit, the -+ * "software needs to acknowledge the events that are generated -+ * (by writing to GEVNTCOUNTn) while it is waiting for this bit -+ * to be set to '1'." -+ */ -+ count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); -+ count &= DWC3_GEVNTCOUNT_MASK; -+ if (count > 0) { -+ dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); -+ dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) % -+ dwc->ev_buf->length; -+ } -+ } else { -+ __dwc3_gadget_start(dwc); -+ } -+ - ret = dwc3_gadget_run_stop(dwc, is_on, false); - spin_unlock_irqrestore(&dwc->lock, flags); -+ enable_irq(dwc->irq_gadget); -+ -+ pm_runtime_put(dwc->dev); - - return ret; - } -@@ -2174,10 +2257,6 @@ static int dwc3_gadget_start(struct usb_gadget *g, - } - - dwc->gadget_driver = driver; -- -- if (pm_runtime_active(dwc->dev)) -- __dwc3_gadget_start(dwc); -- - spin_unlock_irqrestore(&dwc->lock, flags); - - return 0; -@@ -2203,13 +2282,6 @@ static int dwc3_gadget_stop(struct usb_gadget *g) - unsigned long flags; - - spin_lock_irqsave(&dwc->lock, flags); -- -- if (pm_runtime_suspended(dwc->dev)) -- goto out; -- -- __dwc3_gadget_stop(dwc); -- --out: - dwc->gadget_driver = NULL; - spin_unlock_irqrestore(&dwc->lock, flags); - -@@ -2995,8 +3067,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) - { - u32 reg; - -- dwc->connected = true; -- - /* - * Ideally, dwc3_reset_gadget() would trigger the function - * drivers to stop any active transfers through ep disable. -@@ -3038,6 +3108,14 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) - } - - dwc3_reset_gadget(dwc); -+ /* -+ * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a -+ * Section 4.1.2 Table 4-2, it states that during a USB reset, the SW -+ * needs to ensure that it sends "a DEPENDXFER command for any active -+ * transfers." -+ */ -+ dwc3_stop_active_transfers(dwc); -+ dwc->connected = true; - - reg = dwc3_readl(dwc->regs, DWC3_DCTL); - reg &= ~DWC3_DCTL_TSTCTRL_MASK; -diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c -index 66713c2537653..774ccaa5aceea 100644 ---- a/drivers/usb/host/ehci-pci.c -+++ b/drivers/usb/host/ehci-pci.c -@@ -298,6 +298,9 @@ static int ehci_pci_setup(struct usb_hcd *hcd) - if (pdev->vendor == PCI_VENDOR_ID_STMICRO - && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST) - ; /* ConneXT has no sbrn register */ -+ else if (pdev->vendor == PCI_VENDOR_ID_HUAWEI -+ && pdev->device == 0xa239) -+ ; /* HUAWEI Kunpeng920 USB EHCI has no sbrn register */ - else - pci_read_config_byte(pdev, 0x60, &ehci->sbrn); - -diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h -index 7960359dbc700..cd77c0621a555 100644 ---- a/fs/btrfs/ctree.h -+++ b/fs/btrfs/ctree.h -@@ -504,11 +504,6 @@ enum { - * (device replace, resize, device add/delete, balance) - */ - BTRFS_FS_EXCL_OP, -- /* -- * To info transaction_kthread we need an immediate commit so it -- * doesn't need to wait for commit_interval -- */ -- BTRFS_FS_NEED_ASYNC_COMMIT, - /* - * Indicate that balance has been set up from the ioctl and is in the - * main phase. The fs_info::balance_ctl is initialized. -@@ -832,7 +827,10 @@ struct btrfs_fs_info { - */ - struct ulist *qgroup_ulist; - -- /* protect user change for quota operations */ -+ /* -+ * Protect user change for quota operations. If a transaction is needed, -+ * it must be started before locking this lock. -+ */ - struct mutex qgroup_ioctl_lock; - - /* list of dirty qgroups to be written at next commit */ -@@ -945,6 +943,8 @@ enum { - BTRFS_ROOT_DEAD_TREE, - /* The root has a log tree. Used only for subvolume roots. */ - BTRFS_ROOT_HAS_LOG_TREE, -+ /* Qgroup flushing is in progress */ -+ BTRFS_ROOT_QGROUP_FLUSHING, - }; - - /* -@@ -1097,6 +1097,7 @@ struct btrfs_root { - spinlock_t qgroup_meta_rsv_lock; - u64 qgroup_meta_rsv_pertrans; - u64 qgroup_meta_rsv_prealloc; -+ wait_queue_head_t qgroup_flush_wait; - - /* Number of active swapfiles */ - atomic_t nr_swapfiles; -diff --git a/fs/btrfs/delalloc-space.c b/fs/btrfs/delalloc-space.c -index db9f2c58eb4af..f4f531c4aa960 100644 ---- a/fs/btrfs/delalloc-space.c -+++ b/fs/btrfs/delalloc-space.c -@@ -151,7 +151,7 @@ int btrfs_check_data_free_space(struct inode *inode, - return ret; - - /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ -- ret = btrfs_qgroup_reserve_data(inode, reserved, start, len); -+ ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), reserved, start, len); - if (ret < 0) - btrfs_free_reserved_data_space_noquota(inode, start, len); - else -diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c -index 3dccbbe4a6585..e96890475bac7 100644 ---- a/fs/btrfs/delayed-inode.c -+++ b/fs/btrfs/delayed-inode.c -@@ -627,7 +627,8 @@ static int btrfs_delayed_inode_reserve_metadata( - */ - if (!src_rsv || (!trans->bytes_reserved && - src_rsv->type != BTRFS_BLOCK_RSV_DELALLOC)) { -- ret = btrfs_qgroup_reserve_meta_prealloc(root, num_bytes, true); -+ ret = btrfs_qgroup_reserve_meta(root, num_bytes, -+ BTRFS_QGROUP_RSV_META_PREALLOC, true); - if (ret < 0) - return ret; - ret = btrfs_block_rsv_add(root, dst_rsv, num_bytes, -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 1d28333bb798c..dacd67dca43fe 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -1154,6 +1154,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, - mutex_init(&root->log_mutex); - mutex_init(&root->ordered_extent_mutex); - mutex_init(&root->delalloc_mutex); -+ init_waitqueue_head(&root->qgroup_flush_wait); - init_waitqueue_head(&root->log_writer_wait); - init_waitqueue_head(&root->log_commit_wait[0]); - init_waitqueue_head(&root->log_commit_wait[1]); -@@ -1747,8 +1748,7 @@ static int transaction_kthread(void *arg) - } - - now = ktime_get_seconds(); -- if (cur->state < TRANS_STATE_BLOCKED && -- !test_bit(BTRFS_FS_NEED_ASYNC_COMMIT, &fs_info->flags) && -+ if (cur->state < TRANS_STATE_COMMIT_START && - (now < cur->start_time || - now - cur->start_time < fs_info->commit_interval)) { - spin_unlock(&fs_info->trans_lock); -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index f6308a7b761db..400b0717b9d44 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -3149,7 +3149,7 @@ reserve_space: - &cached_state); - if (ret) - goto out; -- ret = btrfs_qgroup_reserve_data(inode, &data_reserved, -+ ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), &data_reserved, - alloc_start, bytes_to_reserve); - if (ret) { - unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, -@@ -3322,8 +3322,9 @@ static long btrfs_fallocate(struct file *file, int mode, - free_extent_map(em); - break; - } -- ret = btrfs_qgroup_reserve_data(inode, &data_reserved, -- cur_offset, last_byte - cur_offset); -+ ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), -+ &data_reserved, cur_offset, -+ last_byte - cur_offset); - if (ret < 0) { - cur_offset = last_byte; - free_extent_map(em); -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 8959d011aafa8..b044b1d910dec 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -6375,7 +6375,7 @@ static int btrfs_dirty_inode(struct inode *inode) - return PTR_ERR(trans); - - ret = btrfs_update_inode(trans, root, inode); -- if (ret && ret == -ENOSPC) { -+ if (ret && (ret == -ENOSPC || ret == -EDQUOT)) { - /* whoops, lets try again with the full transaction */ - btrfs_end_transaction(trans); - trans = btrfs_start_transaction(root, 1); -diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c -index 837bd5e29c8a0..bb034e19a2a8a 100644 ---- a/fs/btrfs/qgroup.c -+++ b/fs/btrfs/qgroup.c -@@ -11,7 +11,6 @@ - #include - #include - #include --#include - - #include "ctree.h" - #include "transaction.h" -@@ -887,6 +886,7 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) - struct btrfs_key found_key; - struct btrfs_qgroup *qgroup = NULL; - struct btrfs_trans_handle *trans = NULL; -+ struct ulist *ulist = NULL; - int ret = 0; - int slot; - -@@ -894,12 +894,27 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) - if (fs_info->quota_root) - goto out; - -- fs_info->qgroup_ulist = ulist_alloc(GFP_KERNEL); -- if (!fs_info->qgroup_ulist) { -+ ulist = ulist_alloc(GFP_KERNEL); -+ if (!ulist) { - ret = -ENOMEM; - goto out; - } - -+ /* -+ * Unlock qgroup_ioctl_lock before starting the transaction. This is to -+ * avoid lock acquisition inversion problems (reported by lockdep) between -+ * qgroup_ioctl_lock and the vfs freeze semaphores, acquired when we -+ * start a transaction. -+ * After we started the transaction lock qgroup_ioctl_lock again and -+ * check if someone else created the quota root in the meanwhile. If so, -+ * just return success and release the transaction handle. -+ * -+ * Also we don't need to worry about someone else calling -+ * btrfs_sysfs_add_qgroups() after we unlock and getting an error because -+ * that function returns 0 (success) when the sysfs entries already exist. -+ */ -+ mutex_unlock(&fs_info->qgroup_ioctl_lock); -+ - /* - * 1 for quota root item - * 1 for BTRFS_QGROUP_STATUS item -@@ -909,12 +924,20 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) - * would be a lot of overkill. - */ - trans = btrfs_start_transaction(tree_root, 2); -+ -+ mutex_lock(&fs_info->qgroup_ioctl_lock); - if (IS_ERR(trans)) { - ret = PTR_ERR(trans); - trans = NULL; - goto out; - } - -+ if (fs_info->quota_root) -+ goto out; -+ -+ fs_info->qgroup_ulist = ulist; -+ ulist = NULL; -+ - /* - * initially create the quota tree - */ -@@ -1047,10 +1070,13 @@ out: - if (ret) { - ulist_free(fs_info->qgroup_ulist); - fs_info->qgroup_ulist = NULL; -- if (trans) -- btrfs_end_transaction(trans); - } - mutex_unlock(&fs_info->qgroup_ioctl_lock); -+ if (ret && trans) -+ btrfs_end_transaction(trans); -+ else if (trans) -+ ret = btrfs_end_transaction(trans); -+ ulist_free(ulist); - return ret; - } - -@@ -1063,19 +1089,29 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) - mutex_lock(&fs_info->qgroup_ioctl_lock); - if (!fs_info->quota_root) - goto out; -+ mutex_unlock(&fs_info->qgroup_ioctl_lock); - - /* - * 1 For the root item - * - * We should also reserve enough items for the quota tree deletion in - * btrfs_clean_quota_tree but this is not done. -+ * -+ * Also, we must always start a transaction without holding the mutex -+ * qgroup_ioctl_lock, see btrfs_quota_enable(). - */ - trans = btrfs_start_transaction(fs_info->tree_root, 1); -+ -+ mutex_lock(&fs_info->qgroup_ioctl_lock); - if (IS_ERR(trans)) { - ret = PTR_ERR(trans); -+ trans = NULL; - goto out; - } - -+ if (!fs_info->quota_root) -+ goto out; -+ - clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); - btrfs_qgroup_wait_for_completion(fs_info, false); - spin_lock(&fs_info->qgroup_lock); -@@ -1089,13 +1125,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) - ret = btrfs_clean_quota_tree(trans, quota_root); - if (ret) { - btrfs_abort_transaction(trans, ret); -- goto end_trans; -+ goto out; - } - - ret = btrfs_del_root(trans, "a_root->root_key); - if (ret) { - btrfs_abort_transaction(trans, ret); -- goto end_trans; -+ goto out; - } - - list_del("a_root->dirty_list); -@@ -1109,10 +1145,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) - free_extent_buffer(quota_root->commit_root); - kfree(quota_root); - --end_trans: -- ret = btrfs_end_transaction(trans); - out: - mutex_unlock(&fs_info->qgroup_ioctl_lock); -+ if (ret && trans) -+ btrfs_end_transaction(trans); -+ else if (trans) -+ ret = btrfs_end_transaction(trans); -+ - return ret; - } - -@@ -2840,20 +2879,8 @@ out: - return ret; - } - --/* -- * Two limits to commit transaction in advance. -- * -- * For RATIO, it will be 1/RATIO of the remaining limit as threshold. -- * For SIZE, it will be in byte unit as threshold. -- */ --#define QGROUP_FREE_RATIO 32 --#define QGROUP_FREE_SIZE SZ_32M --static bool qgroup_check_limits(struct btrfs_fs_info *fs_info, -- const struct btrfs_qgroup *qg, u64 num_bytes) -+static bool qgroup_check_limits(const struct btrfs_qgroup *qg, u64 num_bytes) - { -- u64 free; -- u64 threshold; -- - if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && - qgroup_rsv_total(qg) + (s64)qg->rfer + num_bytes > qg->max_rfer) - return false; -@@ -2862,32 +2889,6 @@ static bool qgroup_check_limits(struct btrfs_fs_info *fs_info, - qgroup_rsv_total(qg) + (s64)qg->excl + num_bytes > qg->max_excl) - return false; - -- /* -- * Even if we passed the check, it's better to check if reservation -- * for meta_pertrans is pushing us near limit. -- * If there is too much pertrans reservation or it's near the limit, -- * let's try commit transaction to free some, using transaction_kthread -- */ -- if ((qg->lim_flags & (BTRFS_QGROUP_LIMIT_MAX_RFER | -- BTRFS_QGROUP_LIMIT_MAX_EXCL))) { -- if (qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) { -- free = qg->max_excl - qgroup_rsv_total(qg) - qg->excl; -- threshold = min_t(u64, qg->max_excl / QGROUP_FREE_RATIO, -- QGROUP_FREE_SIZE); -- } else { -- free = qg->max_rfer - qgroup_rsv_total(qg) - qg->rfer; -- threshold = min_t(u64, qg->max_rfer / QGROUP_FREE_RATIO, -- QGROUP_FREE_SIZE); -- } -- -- /* -- * Use transaction_kthread to commit transaction, so we no -- * longer need to bother nested transaction nor lock context. -- */ -- if (free < threshold) -- btrfs_commit_transaction_locksafe(fs_info); -- } -- - return true; - } - -@@ -2937,7 +2938,7 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce, - - qg = unode_aux_to_qgroup(unode); - -- if (enforce && !qgroup_check_limits(fs_info, qg, num_bytes)) { -+ if (enforce && !qgroup_check_limits(qg, num_bytes)) { - ret = -EDQUOT; - goto out; - } -@@ -3411,28 +3412,150 @@ btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info) - } - } - -+#define rbtree_iterate_from_safe(node, next, start) \ -+ for (node = start; node && ({ next = rb_next(node); 1;}); node = next) -+ -+static int qgroup_unreserve_range(struct btrfs_inode *inode, -+ struct extent_changeset *reserved, u64 start, -+ u64 len) -+{ -+ struct rb_node *node; -+ struct rb_node *next; -+ struct ulist_node *entry = NULL; -+ int ret = 0; -+ -+ node = reserved->range_changed.root.rb_node; -+ while (node) { -+ entry = rb_entry(node, struct ulist_node, rb_node); -+ if (entry->val < start) -+ node = node->rb_right; -+ else if (entry) -+ node = node->rb_left; -+ else -+ break; -+ } -+ -+ /* Empty changeset */ -+ if (!entry) -+ return 0; -+ -+ if (entry->val > start && rb_prev(&entry->rb_node)) -+ entry = rb_entry(rb_prev(&entry->rb_node), struct ulist_node, -+ rb_node); -+ -+ rbtree_iterate_from_safe(node, next, &entry->rb_node) { -+ u64 entry_start; -+ u64 entry_end; -+ u64 entry_len; -+ int clear_ret; -+ -+ entry = rb_entry(node, struct ulist_node, rb_node); -+ entry_start = entry->val; -+ entry_end = entry->aux; -+ entry_len = entry_end - entry_start + 1; -+ -+ if (entry_start >= start + len) -+ break; -+ if (entry_start + entry_len <= start) -+ continue; -+ /* -+ * Now the entry is in [start, start + len), revert the -+ * EXTENT_QGROUP_RESERVED bit. -+ */ -+ clear_ret = clear_extent_bits(&inode->io_tree, entry_start, -+ entry_end, EXTENT_QGROUP_RESERVED); -+ if (!ret && clear_ret < 0) -+ ret = clear_ret; -+ -+ ulist_del(&reserved->range_changed, entry->val, entry->aux); -+ if (likely(reserved->bytes_changed >= entry_len)) { -+ reserved->bytes_changed -= entry_len; -+ } else { -+ WARN_ON(1); -+ reserved->bytes_changed = 0; -+ } -+ } -+ -+ return ret; -+} -+ - /* -- * Reserve qgroup space for range [start, start + len). -+ * Try to free some space for qgroup. - * -- * This function will either reserve space from related qgroups or doing -- * nothing if the range is already reserved. -+ * For qgroup, there are only 3 ways to free qgroup space: -+ * - Flush nodatacow write -+ * Any nodatacow write will free its reserved data space at run_delalloc_range(). -+ * In theory, we should only flush nodatacow inodes, but it's not yet -+ * possible, so we need to flush the whole root. - * -- * Return 0 for successful reserve -- * Return <0 for error (including -EQUOT) -+ * - Wait for ordered extents -+ * When ordered extents are finished, their reserved metadata is finally -+ * converted to per_trans status, which can be freed by later commit -+ * transaction. - * -- * NOTE: this function may sleep for memory allocation. -- * if btrfs_qgroup_reserve_data() is called multiple times with -- * same @reserved, caller must ensure when error happens it's OK -- * to free *ALL* reserved space. -+ * - Commit transaction -+ * This would free the meta_per_trans space. -+ * In theory this shouldn't provide much space, but any more qgroup space -+ * is needed. - */ --int btrfs_qgroup_reserve_data(struct inode *inode, -+static int try_flush_qgroup(struct btrfs_root *root) -+{ -+ struct btrfs_trans_handle *trans; -+ int ret; -+ bool can_commit = true; -+ -+ /* -+ * We don't want to run flush again and again, so if there is a running -+ * one, we won't try to start a new flush, but exit directly. -+ */ -+ if (test_and_set_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)) { -+ wait_event(root->qgroup_flush_wait, -+ !test_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)); -+ return 0; -+ } -+ -+ /* -+ * If current process holds a transaction, we shouldn't flush, as we -+ * assume all space reservation happens before a transaction handle is -+ * held. -+ * -+ * But there are cases like btrfs_delayed_item_reserve_metadata() where -+ * we try to reserve space with one transction handle already held. -+ * In that case we can't commit transaction, but at least try to end it -+ * and hope the started data writes can free some space. -+ */ -+ if (current->journal_info && -+ current->journal_info != BTRFS_SEND_TRANS_STUB) -+ can_commit = false; -+ -+ ret = btrfs_start_delalloc_snapshot(root); -+ if (ret < 0) -+ goto out; -+ btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1); -+ -+ trans = btrfs_join_transaction(root); -+ if (IS_ERR(trans)) { -+ ret = PTR_ERR(trans); -+ goto out; -+ } -+ -+ if (can_commit) -+ ret = btrfs_commit_transaction(trans); -+ else -+ ret = btrfs_end_transaction(trans); -+out: -+ clear_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state); -+ wake_up(&root->qgroup_flush_wait); -+ return ret; -+} -+ -+static int qgroup_reserve_data(struct btrfs_inode *inode, - struct extent_changeset **reserved_ret, u64 start, - u64 len) - { -- struct btrfs_root *root = BTRFS_I(inode)->root; -- struct ulist_node *unode; -- struct ulist_iterator uiter; -+ struct btrfs_root *root = inode->root; - struct extent_changeset *reserved; -+ bool new_reserved = false; - u64 orig_reserved; - u64 to_reserve; - int ret; -@@ -3445,6 +3568,7 @@ int btrfs_qgroup_reserve_data(struct inode *inode, - if (WARN_ON(!reserved_ret)) - return -EINVAL; - if (!*reserved_ret) { -+ new_reserved = true; - *reserved_ret = extent_changeset_alloc(); - if (!*reserved_ret) - return -ENOMEM; -@@ -3452,15 +3576,15 @@ int btrfs_qgroup_reserve_data(struct inode *inode, - reserved = *reserved_ret; - /* Record already reserved space */ - orig_reserved = reserved->bytes_changed; -- ret = set_record_extent_bits(&BTRFS_I(inode)->io_tree, start, -+ ret = set_record_extent_bits(&inode->io_tree, start, - start + len -1, EXTENT_QGROUP_RESERVED, reserved); - - /* Newly reserved space */ - to_reserve = reserved->bytes_changed - orig_reserved; -- trace_btrfs_qgroup_reserve_data(inode, start, len, -+ trace_btrfs_qgroup_reserve_data(&inode->vfs_inode, start, len, - to_reserve, QGROUP_RESERVE); - if (ret < 0) -- goto cleanup; -+ goto out; - ret = qgroup_reserve(root, to_reserve, true, BTRFS_QGROUP_RSV_DATA); - if (ret < 0) - goto cleanup; -@@ -3468,23 +3592,49 @@ int btrfs_qgroup_reserve_data(struct inode *inode, - return ret; - - cleanup: -- /* cleanup *ALL* already reserved ranges */ -- ULIST_ITER_INIT(&uiter); -- while ((unode = ulist_next(&reserved->range_changed, &uiter))) -- clear_extent_bit(&BTRFS_I(inode)->io_tree, unode->val, -- unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL); -- /* Also free data bytes of already reserved one */ -- btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid, -- orig_reserved, BTRFS_QGROUP_RSV_DATA); -- extent_changeset_release(reserved); -+ qgroup_unreserve_range(inode, reserved, start, len); -+out: -+ if (new_reserved) { -+ extent_changeset_release(reserved); -+ kfree(reserved); -+ *reserved_ret = NULL; -+ } - return ret; - } - -+/* -+ * Reserve qgroup space for range [start, start + len). -+ * -+ * This function will either reserve space from related qgroups or do nothing -+ * if the range is already reserved. -+ * -+ * Return 0 for successful reservation -+ * Return <0 for error (including -EQUOT) -+ * -+ * NOTE: This function may sleep for memory allocation, dirty page flushing and -+ * commit transaction. So caller should not hold any dirty page locked. -+ */ -+int btrfs_qgroup_reserve_data(struct btrfs_inode *inode, -+ struct extent_changeset **reserved_ret, u64 start, -+ u64 len) -+{ -+ int ret; -+ -+ ret = qgroup_reserve_data(inode, reserved_ret, start, len); -+ if (ret <= 0 && ret != -EDQUOT) -+ return ret; -+ -+ ret = try_flush_qgroup(inode->root); -+ if (ret < 0) -+ return ret; -+ return qgroup_reserve_data(inode, reserved_ret, start, len); -+} -+ - /* Free ranges specified by @reserved, normally in error path */ --static int qgroup_free_reserved_data(struct inode *inode, -+static int qgroup_free_reserved_data(struct btrfs_inode *inode, - struct extent_changeset *reserved, u64 start, u64 len) - { -- struct btrfs_root *root = BTRFS_I(inode)->root; -+ struct btrfs_root *root = inode->root; - struct ulist_node *unode; - struct ulist_iterator uiter; - struct extent_changeset changeset; -@@ -3520,8 +3670,8 @@ static int qgroup_free_reserved_data(struct inode *inode, - * EXTENT_QGROUP_RESERVED, we won't double free. - * So not need to rush. - */ -- ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree, -- free_start, free_start + free_len - 1, -+ ret = clear_record_extent_bits(&inode->io_tree, free_start, -+ free_start + free_len - 1, - EXTENT_QGROUP_RESERVED, &changeset); - if (ret < 0) - goto out; -@@ -3550,7 +3700,8 @@ static int __btrfs_qgroup_release_data(struct inode *inode, - /* In release case, we shouldn't have @reserved */ - WARN_ON(!free && reserved); - if (free && reserved) -- return qgroup_free_reserved_data(inode, reserved, start, len); -+ return qgroup_free_reserved_data(BTRFS_I(inode), reserved, -+ start, len); - extent_changeset_init(&changeset); - ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree, start, - start + len -1, EXTENT_QGROUP_RESERVED, &changeset); -@@ -3649,8 +3800,8 @@ static int sub_root_meta_rsv(struct btrfs_root *root, int num_bytes, - return num_bytes; - } - --int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, -- enum btrfs_qgroup_rsv_type type, bool enforce) -+int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, -+ enum btrfs_qgroup_rsv_type type, bool enforce) - { - struct btrfs_fs_info *fs_info = root->fs_info; - int ret; -@@ -3676,6 +3827,21 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, - return ret; - } - -+int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, -+ enum btrfs_qgroup_rsv_type type, bool enforce) -+{ -+ int ret; -+ -+ ret = btrfs_qgroup_reserve_meta(root, num_bytes, type, enforce); -+ if (ret <= 0 && ret != -EDQUOT) -+ return ret; -+ -+ ret = try_flush_qgroup(root); -+ if (ret < 0) -+ return ret; -+ return btrfs_qgroup_reserve_meta(root, num_bytes, type, enforce); -+} -+ - void btrfs_qgroup_free_meta_all_pertrans(struct btrfs_root *root) - { - struct btrfs_fs_info *fs_info = root->fs_info; -diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h -index b0420c4f5d0ef..0a2659685ad65 100644 ---- a/fs/btrfs/qgroup.h -+++ b/fs/btrfs/qgroup.h -@@ -344,12 +344,13 @@ int btrfs_verify_qgroup_counts(struct btrfs_fs_info *fs_info, u64 qgroupid, - #endif - - /* New io_tree based accurate qgroup reserve API */ --int btrfs_qgroup_reserve_data(struct inode *inode, -+int btrfs_qgroup_reserve_data(struct btrfs_inode *inode, - struct extent_changeset **reserved, u64 start, u64 len); - int btrfs_qgroup_release_data(struct inode *inode, u64 start, u64 len); - int btrfs_qgroup_free_data(struct inode *inode, - struct extent_changeset *reserved, u64 start, u64 len); -- -+int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, -+ enum btrfs_qgroup_rsv_type type, bool enforce); - int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, - enum btrfs_qgroup_rsv_type type, bool enforce); - /* Reserve metadata space for pertrans and prealloc type */ -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index d8e4e0bf3fc2d..e6cb95b81787f 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -27,7 +27,6 @@ - - static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = { - [TRANS_STATE_RUNNING] = 0U, -- [TRANS_STATE_BLOCKED] = __TRANS_START, - [TRANS_STATE_COMMIT_START] = (__TRANS_START | __TRANS_ATTACH), - [TRANS_STATE_COMMIT_DOING] = (__TRANS_START | - __TRANS_ATTACH | -@@ -388,7 +387,7 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, - - static inline int is_transaction_blocked(struct btrfs_transaction *trans) - { -- return (trans->state >= TRANS_STATE_BLOCKED && -+ return (trans->state >= TRANS_STATE_COMMIT_START && - trans->state < TRANS_STATE_UNBLOCKED && - !TRANS_ABORTED(trans)); - } -@@ -580,7 +579,7 @@ again: - INIT_LIST_HEAD(&h->new_bgs); - - smp_mb(); -- if (cur_trans->state >= TRANS_STATE_BLOCKED && -+ if (cur_trans->state >= TRANS_STATE_COMMIT_START && - may_wait_transaction(fs_info, type)) { - current->journal_info = h; - btrfs_commit_transaction(h); -@@ -797,7 +796,7 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans) - struct btrfs_transaction *cur_trans = trans->transaction; - - smp_mb(); -- if (cur_trans->state >= TRANS_STATE_BLOCKED || -+ if (cur_trans->state >= TRANS_STATE_COMMIT_START || - cur_trans->delayed_refs.flushing) - return 1; - -@@ -830,7 +829,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, - { - struct btrfs_fs_info *info = trans->fs_info; - struct btrfs_transaction *cur_trans = trans->transaction; -- int lock = (trans->type != TRANS_JOIN_NOLOCK); - int err = 0; - - if (refcount_read(&trans->use_count) > 1) { -@@ -846,13 +844,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, - - btrfs_trans_release_chunk_metadata(trans); - -- if (lock && READ_ONCE(cur_trans->state) == TRANS_STATE_BLOCKED) { -- if (throttle) -- return btrfs_commit_transaction(trans); -- else -- wake_up_process(info->transaction_kthread); -- } -- - if (trans->type & __TRANS_FREEZABLE) - sb_end_intwrite(info->sb); - -@@ -2306,7 +2297,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) - */ - cur_trans->state = TRANS_STATE_COMPLETED; - wake_up(&cur_trans->commit_wait); -- clear_bit(BTRFS_FS_NEED_ASYNC_COMMIT, &fs_info->flags); - - spin_lock(&fs_info->trans_lock); - list_del_init(&cur_trans->list); -diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h -index 7291a2a930751..d8a7d460e436a 100644 ---- a/fs/btrfs/transaction.h -+++ b/fs/btrfs/transaction.h -@@ -13,7 +13,6 @@ - - enum btrfs_trans_state { - TRANS_STATE_RUNNING, -- TRANS_STATE_BLOCKED, - TRANS_STATE_COMMIT_START, - TRANS_STATE_COMMIT_DOING, - TRANS_STATE_UNBLOCKED, -@@ -208,20 +207,6 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); - int btrfs_commit_transaction(struct btrfs_trans_handle *trans); - int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, - int wait_for_unblock); -- --/* -- * Try to commit transaction asynchronously, so this is safe to call -- * even holding a spinlock. -- * -- * It's done by informing transaction_kthread to commit transaction without -- * waiting for commit interval. -- */ --static inline void btrfs_commit_transaction_locksafe( -- struct btrfs_fs_info *fs_info) --{ -- set_bit(BTRFS_FS_NEED_ASYNC_COMMIT, &fs_info->flags); -- wake_up_process(fs_info->transaction_kthread); --} - int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans); - int btrfs_should_end_transaction(struct btrfs_trans_handle *trans); - void btrfs_throttle(struct btrfs_fs_info *fs_info); -diff --git a/fs/namespace.c b/fs/namespace.c -index 76ea92994d26d..a092611d89e77 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1861,6 +1861,20 @@ void drop_collected_mounts(struct vfsmount *mnt) - namespace_unlock(); - } - -+static bool has_locked_children(struct mount *mnt, struct dentry *dentry) -+{ -+ struct mount *child; -+ -+ list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { -+ if (!is_subdir(child->mnt_mountpoint, dentry)) -+ continue; -+ -+ if (child->mnt.mnt_flags & MNT_LOCKED) -+ return true; -+ } -+ return false; -+} -+ - /** - * clone_private_mount - create a private clone of a path - * -@@ -1875,14 +1889,27 @@ struct vfsmount *clone_private_mount(const struct path *path) - struct mount *old_mnt = real_mount(path->mnt); - struct mount *new_mnt; - -+ down_read(&namespace_sem); - if (IS_MNT_UNBINDABLE(old_mnt)) -- return ERR_PTR(-EINVAL); -+ goto invalid; -+ -+ if (!check_mnt(old_mnt)) -+ goto invalid; -+ -+ if (has_locked_children(old_mnt, path->dentry)) -+ goto invalid; - - new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); -+ up_read(&namespace_sem); -+ - if (IS_ERR(new_mnt)) - return ERR_CAST(new_mnt); - - return &new_mnt->mnt; -+ -+invalid: -+ up_read(&namespace_sem); -+ return ERR_PTR(-EINVAL); - } - EXPORT_SYMBOL_GPL(clone_private_mount); - -@@ -2234,19 +2261,6 @@ static int do_change_type(struct path *path, int ms_flags) - return err; - } - --static bool has_locked_children(struct mount *mnt, struct dentry *dentry) --{ -- struct mount *child; -- list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { -- if (!is_subdir(child->mnt_mountpoint, dentry)) -- continue; -- -- if (child->mnt.mnt_flags & MNT_LOCKED) -- return true; -- } -- return false; --} -- - static struct mount *__do_loopback(struct path *old_path, int recurse) - { - struct mount *mnt = ERR_PTR(-EINVAL), *old = real_mount(old_path->mnt); -diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h -index 91677f2fa2e8b..cd15c1b7fae06 100644 ---- a/include/linux/tee_drv.h -+++ b/include/linux/tee_drv.h -@@ -26,6 +26,7 @@ - #define TEE_SHM_REGISTER BIT(3) /* Memory registered in secure world */ - #define TEE_SHM_USER_MAPPED BIT(4) /* Memory mapped in user space */ - #define TEE_SHM_POOL BIT(5) /* Memory allocated from pool */ -+#define TEE_SHM_PRIV BIT(7) /* Memory private to TEE driver */ - - struct device; - struct tee_device; -diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c -index db2b10c718ba2..e40712abe089e 100644 ---- a/kernel/trace/trace_events_hist.c -+++ b/kernel/trace/trace_events_hist.c -@@ -66,7 +66,8 @@ - C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \ - C(INVALID_REF_KEY, "Using variable references in keys not supported"), \ - C(VAR_NOT_FOUND, "Couldn't find variable"), \ -- C(FIELD_NOT_FOUND, "Couldn't find field"), -+ C(FIELD_NOT_FOUND, "Couldn't find field"), \ -+ C(INVALID_STR_OPERAND, "String type can not be an operand in expression"), - - #undef C - #define C(a, b) HIST_ERR_##a -@@ -3038,6 +3039,13 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, - ret = PTR_ERR(operand1); - goto free; - } -+ if (operand1->flags & HIST_FIELD_FL_STRING) { -+ /* String type can not be the operand of unary operator. */ -+ hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(str)); -+ destroy_hist_field(operand1, 0); -+ ret = -EINVAL; -+ goto free; -+ } - - expr->flags |= operand1->flags & - (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); -@@ -3139,6 +3147,11 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, - operand1 = NULL; - goto free; - } -+ if (operand1->flags & HIST_FIELD_FL_STRING) { -+ hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(operand1_str)); -+ ret = -EINVAL; -+ goto free; -+ } - - /* rest of string could be another expression e.g. b+c in a+b+c */ - operand_flags = 0; -@@ -3148,6 +3161,11 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, - operand2 = NULL; - goto free; - } -+ if (operand2->flags & HIST_FIELD_FL_STRING) { -+ hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(str)); -+ ret = -EINVAL; -+ goto free; -+ } - - ret = check_expr_operands(file->tr, operand1, operand2); - if (ret) -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index a0d1561eeb532..f486e680aed1d 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -8122,6 +8122,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), - SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), - SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), -+ SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), - SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), - SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), - SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.141-142.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.141-142.patch new file mode 100644 index 0000000000..747069c7a1 --- /dev/null +++ b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.141-142.patch @@ -0,0 +1,1893 @@ +diff --git a/Makefile b/Makefile +index 2bfa11d0aab36..ef3adc6ccb871 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 141 ++SUBLEVEL = 142 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c +index 9b340af02c387..dd01a4abc2582 100644 +--- a/arch/powerpc/kernel/kprobes.c ++++ b/arch/powerpc/kernel/kprobes.c +@@ -264,7 +264,8 @@ int kprobe_handler(struct pt_regs *regs) + if (user_mode(regs)) + return 0; + +- if (!(regs->msr & MSR_IR) || !(regs->msr & MSR_DR)) ++ if (!IS_ENABLED(CONFIG_BOOKE) && ++ (!(regs->msr & MSR_IR) || !(regs->msr & MSR_DR))) + return 0; + + /* +diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h +index 6ece8561ba661..c29d8fb0ffbe2 100644 +--- a/arch/x86/include/asm/svm.h ++++ b/arch/x86/include/asm/svm.h +@@ -119,6 +119,8 @@ struct __attribute__ ((__packed__)) vmcb_control_area { + #define V_IGN_TPR_SHIFT 20 + #define V_IGN_TPR_MASK (1 << V_IGN_TPR_SHIFT) + ++#define V_IRQ_INJECTION_BITS_MASK (V_IRQ_MASK | V_INTR_PRIO_MASK | V_IGN_TPR_MASK) ++ + #define V_INTR_MASKING_SHIFT 24 + #define V_INTR_MASKING_MASK (1 << V_INTR_MASKING_SHIFT) + +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c +index 0edcf69659eee..1622cff009c9a 100644 +--- a/arch/x86/kernel/apic/io_apic.c ++++ b/arch/x86/kernel/apic/io_apic.c +@@ -1961,7 +1961,8 @@ static struct irq_chip ioapic_chip __read_mostly = { + .irq_set_affinity = ioapic_set_affinity, + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_get_irqchip_state = ioapic_irq_get_chip_state, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static struct irq_chip ioapic_ir_chip __read_mostly = { +@@ -1974,7 +1975,8 @@ static struct irq_chip ioapic_ir_chip __read_mostly = { + .irq_set_affinity = ioapic_set_affinity, + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_get_irqchip_state = ioapic_irq_get_chip_state, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static inline void init_IO_APIC_traps(void) +diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c +index a20873bbbed67..f86e10b1d99ce 100644 +--- a/arch/x86/kernel/apic/msi.c ++++ b/arch/x86/kernel/apic/msi.c +@@ -86,11 +86,13 @@ msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force) + * The quirk bit is not set in this case. + * - The new vector is the same as the old vector + * - The old vector is MANAGED_IRQ_SHUTDOWN_VECTOR (interrupt starts up) ++ * - The interrupt is not yet started up + * - The new destination CPU is the same as the old destination CPU + */ + if (!irqd_msi_nomask_quirk(irqd) || + cfg->vector == old_cfg.vector || + old_cfg.vector == MANAGED_IRQ_SHUTDOWN_VECTOR || ++ !irqd_is_started(irqd) || + cfg->dest_apicid == old_cfg.dest_apicid) { + irq_msi_update_msg(irqd, cfg); + return ret; +@@ -178,7 +180,8 @@ static struct irq_chip pci_msi_controller = { + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_compose_msi_msg = irq_msi_compose_msg, + .irq_set_affinity = msi_set_affinity, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +@@ -279,7 +282,8 @@ static struct irq_chip pci_msi_ir_controller = { + .irq_ack = irq_chip_ack_parent, + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_set_vcpu_affinity = irq_chip_set_vcpu_affinity_parent, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static struct msi_domain_info pci_msi_ir_domain_info = { +@@ -322,7 +326,8 @@ static struct irq_chip dmar_msi_controller = { + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_compose_msi_msg = irq_msi_compose_msg, + .irq_write_msi_msg = dmar_msi_write_msg, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info, +@@ -420,7 +425,7 @@ static struct irq_chip hpet_msi_controller __ro_after_init = { + .irq_retrigger = irq_chip_retrigger_hierarchy, + .irq_compose_msi_msg = irq_msi_compose_msg, + .irq_write_msi_msg = hpet_msi_write_msg, +- .flags = IRQCHIP_SKIP_SET_WAKE, ++ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static irq_hw_number_t hpet_msi_get_hwirq(struct msi_domain_info *info, +diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c +index 50f683ecd2c6c..21eb593e0313e 100644 +--- a/arch/x86/kernel/cpu/resctrl/monitor.c ++++ b/arch/x86/kernel/cpu/resctrl/monitor.c +@@ -223,15 +223,14 @@ static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr) + return chunks >>= shift; + } + +-static int __mon_event_count(u32 rmid, struct rmid_read *rr) ++static u64 __mon_event_count(u32 rmid, struct rmid_read *rr) + { + struct mbm_state *m; + u64 chunks, tval; + + tval = __rmid_read(rmid, rr->evtid); + if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) { +- rr->val = tval; +- return -EINVAL; ++ return tval; + } + switch (rr->evtid) { + case QOS_L3_OCCUP_EVENT_ID: +@@ -243,12 +242,6 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr) + case QOS_L3_MBM_LOCAL_EVENT_ID: + m = &rr->d->mbm_local[rmid]; + break; +- default: +- /* +- * Code would never reach here because +- * an invalid event id would fail the __rmid_read. +- */ +- return -EINVAL; + } + + if (rr->first) { +@@ -298,23 +291,29 @@ void mon_event_count(void *info) + struct rdtgroup *rdtgrp, *entry; + struct rmid_read *rr = info; + struct list_head *head; ++ u64 ret_val; + + rdtgrp = rr->rgrp; + +- if (__mon_event_count(rdtgrp->mon.rmid, rr)) +- return; ++ ret_val = __mon_event_count(rdtgrp->mon.rmid, rr); + + /* +- * For Ctrl groups read data from child monitor groups. ++ * For Ctrl groups read data from child monitor groups and ++ * add them together. Count events which are read successfully. ++ * Discard the rmid_read's reporting errors. + */ + head = &rdtgrp->mon.crdtgrp_list; + + if (rdtgrp->type == RDTCTRL_GROUP) { + list_for_each_entry(entry, head, mon.crdtgrp_list) { +- if (__mon_event_count(entry->mon.rmid, rr)) +- return; ++ if (__mon_event_count(entry->mon.rmid, rr) == 0) ++ ret_val = 0; + } + } ++ ++ /* Report error if none of rmid_reads are successful */ ++ if (ret_val) ++ rr->val = ret_val; + } + + /* +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c +index 2a958dcc80f21..425444d080712 100644 +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -516,6 +516,9 @@ static void recalc_intercepts(struct vcpu_svm *svm) + c->intercept_dr = h->intercept_dr | g->intercept_dr; + c->intercept_exceptions = h->intercept_exceptions | g->intercept_exceptions; + c->intercept = h->intercept | g->intercept; ++ ++ c->intercept |= (1ULL << INTERCEPT_VMLOAD); ++ c->intercept |= (1ULL << INTERCEPT_VMSAVE); + } + + static inline struct vmcb *get_host_vmcb(struct vcpu_svm *svm) +@@ -1443,12 +1446,7 @@ static __init int svm_hardware_setup(void) + } + } + +- if (vgif) { +- if (!boot_cpu_has(X86_FEATURE_VGIF)) +- vgif = false; +- else +- pr_info("Virtual GIF supported\n"); +- } ++ vgif = false; /* Disabled for CVE-2021-3653 */ + + return 0; + +@@ -3607,7 +3605,13 @@ static void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa, + svm->nested.intercept = nested_vmcb->control.intercept; + + svm_flush_tlb(&svm->vcpu, true); +- svm->vmcb->control.int_ctl = nested_vmcb->control.int_ctl | V_INTR_MASKING_MASK; ++ ++ svm->vmcb->control.int_ctl &= ++ V_INTR_MASKING_MASK | V_GIF_ENABLE_MASK | V_GIF_MASK; ++ ++ svm->vmcb->control.int_ctl |= nested_vmcb->control.int_ctl & ++ (V_TPR_MASK | V_IRQ_INJECTION_BITS_MASK); ++ + if (nested_vmcb->control.int_ctl & V_INTR_MASKING_MASK) + svm->vcpu.arch.hflags |= HF_VINTR_MASK; + else +diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h +index a1919ec7fd108..55731dd0096f2 100644 +--- a/arch/x86/kvm/vmx/vmx.h ++++ b/arch/x86/kvm/vmx/vmx.h +@@ -512,7 +512,7 @@ static inline void decache_tsc_multiplier(struct vcpu_vmx *vmx) + + static inline bool vmx_has_waitpkg(struct vcpu_vmx *vmx) + { +- return vmx->secondary_exec_control & ++ return secondary_exec_controls_get(vmx) & + SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE; + } + +diff --git a/arch/x86/tools/chkobjdump.awk b/arch/x86/tools/chkobjdump.awk +index fd1ab80be0dec..a4cf678cf5c80 100644 +--- a/arch/x86/tools/chkobjdump.awk ++++ b/arch/x86/tools/chkobjdump.awk +@@ -10,6 +10,7 @@ BEGIN { + + /^GNU objdump/ { + verstr = "" ++ gsub(/\(.*\)/, ""); + for (i = 3; i <= NF; i++) + if (match($(i), "^[0-9]")) { + verstr = $(i); +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c +index 9d78f29cf9967..0fe4f3ed72ca4 100644 +--- a/drivers/acpi/nfit/core.c ++++ b/drivers/acpi/nfit/core.c +@@ -2973,6 +2973,9 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, + struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev; + struct nd_mapping_desc *mapping; + ++ /* range index 0 == unmapped in SPA or invalid-SPA */ ++ if (memdev->range_index == 0 || spa->range_index == 0) ++ continue; + if (memdev->range_index != spa->range_index) + continue; + if (count >= ND_MAX_MAPPINGS) { +diff --git a/drivers/base/core.c b/drivers/base/core.c +index a119479fe3f42..8b651bfc1d88e 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -1722,6 +1722,7 @@ void device_initialize(struct device *dev) + device_pm_init(dev); + set_dev_node(dev, -1); + #ifdef CONFIG_GENERIC_MSI_IRQ ++ raw_spin_lock_init(&dev->msi_lock); + INIT_LIST_HEAD(&dev->msi_list); + #endif + INIT_LIST_HEAD(&dev->links.consumers); +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c +index 839364371f9af..25e81b1a59a54 100644 +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -797,6 +797,10 @@ static bool nbd_clear_req(struct request *req, void *data, bool reserved) + { + struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req); + ++ /* don't abort one completed request */ ++ if (blk_mq_request_completed(req)) ++ return true; ++ + mutex_lock(&cmd->lock); + cmd->status = BLK_STS_IOERR; + mutex_unlock(&cmd->lock); +@@ -2009,15 +2013,19 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd) + { + mutex_lock(&nbd->config_lock); + nbd_disconnect(nbd); +- nbd_clear_sock(nbd); +- mutex_unlock(&nbd->config_lock); ++ sock_shutdown(nbd); + /* + * Make sure recv thread has finished, so it does not drop the last + * config ref and try to destroy the workqueue from inside the work +- * queue. ++ * queue. And this also ensure that we can safely call nbd_clear_que() ++ * to cancel the inflight I/Os. + */ + if (nbd->recv_workq) + flush_workqueue(nbd->recv_workq); ++ nbd_clear_que(nbd); ++ nbd->task_setup = NULL; ++ mutex_unlock(&nbd->config_lock); ++ + if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, + &nbd->config->runtime_flags)) + nbd_config_put(nbd); +diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h +index 05fce48ceee0d..f7da816a5562a 100644 +--- a/drivers/gpu/drm/meson/meson_registers.h ++++ b/drivers/gpu/drm/meson/meson_registers.h +@@ -590,6 +590,11 @@ + #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc + #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd + ++/* osd1 HDR */ ++#define OSD1_HDR2_CTRL 0x38a0 ++#define OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN BIT(13) ++#define OSD1_HDR2_CTRL_REG_ONLY_MAT BIT(16) ++ + /* osd2 scaler */ + #define OSD2_VSC_PHASE_STEP 0x3d00 + #define OSD2_VSC_INI_PHASE 0x3d01 +diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c +index 68cf2c2eca5fe..33698814c022f 100644 +--- a/drivers/gpu/drm/meson/meson_viu.c ++++ b/drivers/gpu/drm/meson/meson_viu.c +@@ -356,9 +356,14 @@ void meson_viu_init(struct meson_drm *priv) + if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) || + meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) + meson_viu_load_matrix(priv); +- else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) ++ else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { + meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff, + true); ++ /* fix green/pink color distortion from vendor u-boot */ ++ writel_bits_relaxed(OSD1_HDR2_CTRL_REG_ONLY_MAT | ++ OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN, 0, ++ priv->io_base + _REG(OSD1_HDR2_CTRL)); ++ } + + /* Initialize OSD1 fifo control register */ + reg = VIU_OSD_DDR_PRIORITY_URGENT | +diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c +index a3fec3df11b68..c9ae1895cd48a 100644 +--- a/drivers/i2c/i2c-dev.c ++++ b/drivers/i2c/i2c-dev.c +@@ -141,7 +141,7 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count, + if (count > 8192) + count = 8192; + +- tmp = kmalloc(count, GFP_KERNEL); ++ tmp = kzalloc(count, GFP_KERNEL); + if (tmp == NULL) + return -ENOMEM; + +@@ -150,7 +150,8 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count, + + ret = i2c_master_recv(client, tmp, count); + if (ret >= 0) +- ret = copy_to_user(buf, tmp, count) ? -EFAULT : ret; ++ if (copy_to_user(buf, tmp, ret)) ++ ret = -EFAULT; + kfree(tmp); + return ret; + } +diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c +index 46e595eb889fa..2bd785e9e42ac 100644 +--- a/drivers/iio/adc/palmas_gpadc.c ++++ b/drivers/iio/adc/palmas_gpadc.c +@@ -656,8 +656,8 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) + + adc_period = adc->auto_conversion_period; + for (i = 0; i < 16; ++i) { +- if (((1000 * (1 << i)) / 32) < adc_period) +- continue; ++ if (((1000 * (1 << i)) / 32) >= adc_period) ++ break; + } + if (i > 0) + i--; +diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c +index 2e66e4d586ff0..7a1a9fe470728 100644 +--- a/drivers/iio/adc/ti-ads7950.c ++++ b/drivers/iio/adc/ti-ads7950.c +@@ -569,7 +569,6 @@ static int ti_ads7950_probe(struct spi_device *spi) + st->ring_xfer.tx_buf = &st->tx_buf[0]; + st->ring_xfer.rx_buf = &st->rx_buf[0]; + /* len will be set later */ +- st->ring_xfer.cs_change = true; + + spi_message_add_tail(&st->ring_xfer, &st->ring_msg); + +diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c +index 7618cdf59efdb..05af6410ca131 100644 +--- a/drivers/iio/humidity/hdc100x.c ++++ b/drivers/iio/humidity/hdc100x.c +@@ -24,6 +24,8 @@ + #include + #include + ++#include ++ + #define HDC100X_REG_TEMP 0x00 + #define HDC100X_REG_HUMIDITY 0x01 + +@@ -165,7 +167,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, + struct iio_chan_spec const *chan) + { + struct i2c_client *client = data->client; +- int delay = data->adc_int_us[chan->address]; ++ int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC; + int ret; + __be16 val; + +@@ -322,7 +324,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p) + struct iio_dev *indio_dev = pf->indio_dev; + struct hdc100x_data *data = iio_priv(indio_dev); + struct i2c_client *client = data->client; +- int delay = data->adc_int_us[0] + data->adc_int_us[1]; ++ int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC; + int ret; + + /* dual read starts at temp register */ +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 953d86ca6d2b2..a2a03df977046 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -1853,7 +1853,7 @@ static inline int guestwidth_to_adjustwidth(int gaw) + static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu, + int guest_width) + { +- int adjust_width, agaw; ++ int adjust_width, agaw, cap_width; + unsigned long sagaw; + int err; + +@@ -1867,8 +1867,9 @@ static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu, + domain_reserve_special_ranges(domain); + + /* calculate AGAW */ +- if (guest_width > cap_mgaw(iommu->cap)) +- guest_width = cap_mgaw(iommu->cap); ++ cap_width = min_t(int, cap_mgaw(iommu->cap), agaw_to_width(iommu->agaw)); ++ if (guest_width > cap_width) ++ guest_width = cap_width; + domain->gaw = guest_width; + adjust_width = guestwidth_to_adjustwidth(guest_width); + agaw = width_to_agaw(adjust_width); +diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c +index bbec86b9418e6..19d1f1c51f97e 100644 +--- a/drivers/net/dsa/lan9303-core.c ++++ b/drivers/net/dsa/lan9303-core.c +@@ -557,12 +557,12 @@ static int lan9303_alr_make_entry_raw(struct lan9303 *chip, u32 dat0, u32 dat1) + return 0; + } + +-typedef void alr_loop_cb_t(struct lan9303 *chip, u32 dat0, u32 dat1, +- int portmap, void *ctx); ++typedef int alr_loop_cb_t(struct lan9303 *chip, u32 dat0, u32 dat1, ++ int portmap, void *ctx); + +-static void lan9303_alr_loop(struct lan9303 *chip, alr_loop_cb_t *cb, void *ctx) ++static int lan9303_alr_loop(struct lan9303 *chip, alr_loop_cb_t *cb, void *ctx) + { +- int i; ++ int ret = 0, i; + + mutex_lock(&chip->alr_mutex); + lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, +@@ -582,13 +582,17 @@ static void lan9303_alr_loop(struct lan9303 *chip, alr_loop_cb_t *cb, void *ctx) + LAN9303_ALR_DAT1_PORT_BITOFFS; + portmap = alrport_2_portmap[alrport]; + +- cb(chip, dat0, dat1, portmap, ctx); ++ ret = cb(chip, dat0, dat1, portmap, ctx); ++ if (ret) ++ break; + + lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, + LAN9303_ALR_CMD_GET_NEXT); + lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, 0); + } + mutex_unlock(&chip->alr_mutex); ++ ++ return ret; + } + + static void alr_reg_to_mac(u32 dat0, u32 dat1, u8 mac[6]) +@@ -606,18 +610,20 @@ struct del_port_learned_ctx { + }; + + /* Clear learned (non-static) entry on given port */ +-static void alr_loop_cb_del_port_learned(struct lan9303 *chip, u32 dat0, +- u32 dat1, int portmap, void *ctx) ++static int alr_loop_cb_del_port_learned(struct lan9303 *chip, u32 dat0, ++ u32 dat1, int portmap, void *ctx) + { + struct del_port_learned_ctx *del_ctx = ctx; + int port = del_ctx->port; + + if (((BIT(port) & portmap) == 0) || (dat1 & LAN9303_ALR_DAT1_STATIC)) +- return; ++ return 0; + + /* learned entries has only one port, we can just delete */ + dat1 &= ~LAN9303_ALR_DAT1_VALID; /* delete entry */ + lan9303_alr_make_entry_raw(chip, dat0, dat1); ++ ++ return 0; + } + + struct port_fdb_dump_ctx { +@@ -626,19 +632,19 @@ struct port_fdb_dump_ctx { + dsa_fdb_dump_cb_t *cb; + }; + +-static void alr_loop_cb_fdb_port_dump(struct lan9303 *chip, u32 dat0, +- u32 dat1, int portmap, void *ctx) ++static int alr_loop_cb_fdb_port_dump(struct lan9303 *chip, u32 dat0, ++ u32 dat1, int portmap, void *ctx) + { + struct port_fdb_dump_ctx *dump_ctx = ctx; + u8 mac[ETH_ALEN]; + bool is_static; + + if ((BIT(dump_ctx->port) & portmap) == 0) +- return; ++ return 0; + + alr_reg_to_mac(dat0, dat1, mac); + is_static = !!(dat1 & LAN9303_ALR_DAT1_STATIC); +- dump_ctx->cb(mac, 0, is_static, dump_ctx->data); ++ return dump_ctx->cb(mac, 0, is_static, dump_ctx->data); + } + + /* Set a static ALR entry. Delete entry if port_map is zero */ +@@ -1210,9 +1216,7 @@ static int lan9303_port_fdb_dump(struct dsa_switch *ds, int port, + }; + + dev_dbg(chip->dev, "%s(%d)\n", __func__, port); +- lan9303_alr_loop(chip, alr_loop_cb_fdb_port_dump, &dump_ctx); +- +- return 0; ++ return lan9303_alr_loop(chip, alr_loop_cb_fdb_port_dump, &dump_ctx); + } + + static int lan9303_port_mdb_prepare(struct dsa_switch *ds, int port, +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index dc75e798dbff8..af3d56636a076 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -1399,11 +1399,17 @@ static int gswip_port_fdb_dump(struct dsa_switch *ds, int port, + addr[1] = mac_bridge.key[2] & 0xff; + addr[0] = (mac_bridge.key[2] >> 8) & 0xff; + if (mac_bridge.val[1] & GSWIP_TABLE_MAC_BRIDGE_STATIC) { +- if (mac_bridge.val[0] & BIT(port)) +- cb(addr, 0, true, data); ++ if (mac_bridge.val[0] & BIT(port)) { ++ err = cb(addr, 0, true, data); ++ if (err) ++ return err; ++ } + } else { +- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) +- cb(addr, 0, false, data); ++ if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) { ++ err = cb(addr, 0, false, data); ++ if (err) ++ return err; ++ } + } + } + return 0; +diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h +index 061142b183cb9..d6013410dc88b 100644 +--- a/drivers/net/dsa/microchip/ksz_common.h ++++ b/drivers/net/dsa/microchip/ksz_common.h +@@ -215,12 +215,8 @@ static inline int ksz_read64(struct ksz_device *dev, u32 reg, u64 *val) + int ret; + + ret = regmap_bulk_read(dev->regmap[2], reg, value, 2); +- if (!ret) { +- /* Ick! ToDo: Add 64bit R/W to regmap on 32bit systems */ +- value[0] = swab32(value[0]); +- value[1] = swab32(value[1]); +- *val = swab64((u64)*value); +- } ++ if (!ret) ++ *val = (u64)value[0] << 32 | value[1]; + + return ret; + } +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index 071e5015bf91d..e1a3c33fdad90 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -45,6 +45,7 @@ static const struct mt7530_mib_desc mt7530_mib[] = { + MIB_DESC(2, 0x48, "TxBytes"), + MIB_DESC(1, 0x60, "RxDrop"), + MIB_DESC(1, 0x64, "RxFiltering"), ++ MIB_DESC(1, 0x68, "RxUnicast"), + MIB_DESC(1, 0x6c, "RxMulticast"), + MIB_DESC(1, 0x70, "RxBroadcast"), + MIB_DESC(1, 0x74, "RxAlignErr"), +diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c +index a07d8051ec3e8..eab861352bf23 100644 +--- a/drivers/net/dsa/sja1105/sja1105_main.c ++++ b/drivers/net/dsa/sja1105/sja1105_main.c +@@ -1312,7 +1312,9 @@ static int sja1105_fdb_dump(struct dsa_switch *ds, int port, + /* We need to hide the dsa_8021q VLANs from the user. */ + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) + l2_lookup.vlanid = 0; +- cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data); ++ rc = cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data); ++ if (rc) ++ return rc; + } + return 0; + } +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index cda9b9a8392a2..dc902e371c2cf 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -1499,11 +1499,6 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter) + set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); + + iavf_map_rings_to_vectors(adapter); +- +- if (RSS_AQ(adapter)) +- adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS; +- else +- err = iavf_init_rss(adapter); + err: + return err; + } +@@ -2179,6 +2174,14 @@ continue_reset: + goto reset_err; + } + ++ if (RSS_AQ(adapter)) { ++ adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS; ++ } else { ++ err = iavf_init_rss(adapter); ++ if (err) ++ goto reset_err; ++ } ++ + adapter->aq_required |= IAVF_FLAG_AQ_GET_CONFIG; + adapter->aq_required |= IAVF_FLAG_AQ_MAP_VECTORS; + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +index eb2e57ff08a60..dc36b0db37222 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +@@ -1017,12 +1017,19 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) + MLX5_NB_INIT(&tracer->nb, fw_tracer_event, DEVICE_TRACER); + mlx5_eq_notifier_register(dev, &tracer->nb); + +- mlx5_fw_tracer_start(tracer); +- ++ err = mlx5_fw_tracer_start(tracer); ++ if (err) { ++ mlx5_core_warn(dev, "FWTracer: Failed to start tracer %d\n", err); ++ goto err_notifier_unregister; ++ } + return 0; + ++err_notifier_unregister: ++ mlx5_eq_notifier_unregister(dev, &tracer->nb); ++ mlx5_core_destroy_mkey(dev, &tracer->buff.mkey); + err_dealloc_pd: + mlx5_core_dealloc_pd(dev, tracer->buff.pdn); ++ cancel_work_sync(&tracer->read_fw_strings_work); + return err; + } + +diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c +index 79d74763cf24a..2a78084aeaedb 100644 +--- a/drivers/net/ieee802154/mac802154_hwsim.c ++++ b/drivers/net/ieee802154/mac802154_hwsim.c +@@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info) + struct hwsim_edge *e; + u32 v0, v1; + +- if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] && ++ if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || + !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) + return -EINVAL; + +@@ -528,14 +528,14 @@ static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info) + u32 v0, v1; + u8 lqi; + +- if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] && ++ if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || + !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) + return -EINVAL; + + if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) + return -EINVAL; + +- if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] && ++ if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] || + !edge_attrs[MAC802154_HWSIM_EDGE_ATTR_LQI]) + return -EINVAL; + +diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c +index 910ab2182158d..f95bd1b0fb965 100644 +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -1184,8 +1184,6 @@ static struct phy_driver ksphy_driver[] = { + .name = "Micrel KSZ87XX Switch", + /* PHY_BASIC_FEATURES */ + .config_init = kszphy_config_init, +- .config_aneg = ksz8873mll_config_aneg, +- .read_status = ksz8873mll_read_status, + .match_phy_device = ksz8795_match_phy_device, + .suspend = genphy_suspend, + .resume = genphy_resume, +diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c +index b7e2b4a0f3c66..c6c41a7836c93 100644 +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -1121,7 +1121,7 @@ static int ppp_nl_newlink(struct net *src_net, struct net_device *dev, + * the PPP unit identifer as suffix (i.e. ppp). This allows + * userspace to infer the device name using to the PPPIOCGUNIT ioctl. + */ +- if (!tb[IFLA_IFNAME]) ++ if (!tb[IFLA_IFNAME] || !nla_len(tb[IFLA_IFNAME]) || !*(char *)nla_data(tb[IFLA_IFNAME])) + conf.ifname_is_set = false; + + err = ppp_dev_configure(src_net, dev, &conf); +diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c +index cca0a3ba1d2c2..e6da7b2b34729 100644 +--- a/drivers/nvdimm/namespace_devs.c ++++ b/drivers/nvdimm/namespace_devs.c +@@ -2486,7 +2486,7 @@ static void deactivate_labels(void *region) + + static int init_active_labels(struct nd_region *nd_region) + { +- int i; ++ int i, rc = 0; + + for (i = 0; i < nd_region->ndr_mappings; i++) { + struct nd_mapping *nd_mapping = &nd_region->mapping[i]; +@@ -2505,13 +2505,14 @@ static int init_active_labels(struct nd_region *nd_region) + else if (test_bit(NDD_ALIASING, &nvdimm->flags)) + /* fail, labels needed to disambiguate dpa */; + else +- return 0; ++ continue; + + dev_err(&nd_region->dev, "%s: is %s, failing probe\n", + dev_name(&nd_mapping->nvdimm->dev), + test_bit(NDD_LOCKED, &nvdimm->flags) + ? "locked" : "disabled"); +- return -ENXIO; ++ rc = -ENXIO; ++ goto out; + } + nd_mapping->ndd = ndd; + atomic_inc(&nvdimm->busy); +@@ -2545,13 +2546,17 @@ static int init_active_labels(struct nd_region *nd_region) + break; + } + +- if (i < nd_region->ndr_mappings) { ++ if (i < nd_region->ndr_mappings) ++ rc = -ENOMEM; ++ ++out: ++ if (rc) { + deactivate_labels(nd_region); +- return -ENOMEM; ++ return rc; + } + + return devm_add_action_or_reset(&nd_region->dev, deactivate_labels, +- nd_region); ++ nd_region); + } + + int nd_region_register_namespaces(struct nd_region *nd_region, int *err) +diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c +index 771041784e645..5bb37671a86ad 100644 +--- a/drivers/pci/msi.c ++++ b/drivers/pci/msi.c +@@ -170,24 +170,25 @@ static inline __attribute_const__ u32 msi_mask(unsigned x) + * reliably as devices without an INTx disable bit will then generate a + * level IRQ which will never be cleared. + */ +-u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) ++void __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) + { +- u32 mask_bits = desc->masked; ++ raw_spinlock_t *lock = &desc->dev->msi_lock; ++ unsigned long flags; + + if (pci_msi_ignore_mask || !desc->msi_attrib.maskbit) +- return 0; ++ return; + +- mask_bits &= ~mask; +- mask_bits |= flag; ++ raw_spin_lock_irqsave(lock, flags); ++ desc->masked &= ~mask; ++ desc->masked |= flag; + pci_write_config_dword(msi_desc_to_pci_dev(desc), desc->mask_pos, +- mask_bits); +- +- return mask_bits; ++ desc->masked); ++ raw_spin_unlock_irqrestore(lock, flags); + } + + static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) + { +- desc->masked = __pci_msi_desc_mask_irq(desc, mask, flag); ++ __pci_msi_desc_mask_irq(desc, mask, flag); + } + + static void __iomem *pci_msix_desc_addr(struct msi_desc *desc) +@@ -316,13 +317,31 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) + /* Don't touch the hardware now */ + } else if (entry->msi_attrib.is_msix) { + void __iomem *base = pci_msix_desc_addr(entry); ++ bool unmasked = !(entry->masked & PCI_MSIX_ENTRY_CTRL_MASKBIT); + + if (!base) + goto skip; + ++ /* ++ * The specification mandates that the entry is masked ++ * when the message is modified: ++ * ++ * "If software changes the Address or Data value of an ++ * entry while the entry is unmasked, the result is ++ * undefined." ++ */ ++ if (unmasked) ++ __pci_msix_desc_mask_irq(entry, PCI_MSIX_ENTRY_CTRL_MASKBIT); ++ + writel(msg->address_lo, base + PCI_MSIX_ENTRY_LOWER_ADDR); + writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR); + writel(msg->data, base + PCI_MSIX_ENTRY_DATA); ++ ++ if (unmasked) ++ __pci_msix_desc_mask_irq(entry, 0); ++ ++ /* Ensure that the writes are visible in the device */ ++ readl(base + PCI_MSIX_ENTRY_DATA); + } else { + int pos = dev->msi_cap; + u16 msgctl; +@@ -343,6 +362,8 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) + pci_write_config_word(dev, pos + PCI_MSI_DATA_32, + msg->data); + } ++ /* Ensure that the writes are visible in the device */ ++ pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); + } + + skip: +@@ -642,21 +663,21 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, + /* Configure MSI capability structure */ + ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); + if (ret) { +- msi_mask_irq(entry, mask, ~mask); ++ msi_mask_irq(entry, mask, 0); + free_msi_irqs(dev); + return ret; + } + + ret = msi_verify_entries(dev); + if (ret) { +- msi_mask_irq(entry, mask, ~mask); ++ msi_mask_irq(entry, mask, 0); + free_msi_irqs(dev); + return ret; + } + + ret = populate_msi_sysfs(dev); + if (ret) { +- msi_mask_irq(entry, mask, ~mask); ++ msi_mask_irq(entry, mask, 0); + free_msi_irqs(dev); + return ret; + } +@@ -697,6 +718,7 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, + { + struct irq_affinity_desc *curmsk, *masks = NULL; + struct msi_desc *entry; ++ void __iomem *addr; + int ret, i; + int vec_count = pci_msix_vec_count(dev); + +@@ -717,6 +739,7 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, + + entry->msi_attrib.is_msix = 1; + entry->msi_attrib.is_64 = 1; ++ + if (entries) + entry->msi_attrib.entry_nr = entries[i].entry; + else +@@ -728,6 +751,10 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, + entry->msi_attrib.default_irq = dev->irq; + entry->mask_base = base; + ++ addr = pci_msix_desc_addr(entry); ++ if (addr) ++ entry->masked = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL); ++ + list_add_tail(&entry->list, dev_to_msi_list(&dev->dev)); + if (masks) + curmsk++; +@@ -738,26 +765,25 @@ out: + return ret; + } + +-static void msix_program_entries(struct pci_dev *dev, +- struct msix_entry *entries) ++static void msix_update_entries(struct pci_dev *dev, struct msix_entry *entries) + { + struct msi_desc *entry; +- int i = 0; +- void __iomem *desc_addr; + + for_each_pci_msi_entry(entry, dev) { +- if (entries) +- entries[i++].vector = entry->irq; ++ if (entries) { ++ entries->vector = entry->irq; ++ entries++; ++ } ++ } ++} + +- desc_addr = pci_msix_desc_addr(entry); +- if (desc_addr) +- entry->masked = readl(desc_addr + +- PCI_MSIX_ENTRY_VECTOR_CTRL); +- else +- entry->masked = 0; ++static void msix_mask_all(void __iomem *base, int tsize) ++{ ++ u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT; ++ int i; + +- msix_mask_irq(entry, 1); +- } ++ for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE) ++ writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL); + } + + /** +@@ -774,22 +800,33 @@ static void msix_program_entries(struct pci_dev *dev, + static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, + int nvec, struct irq_affinity *affd) + { +- int ret; +- u16 control; + void __iomem *base; ++ int ret, tsize; ++ u16 control; + +- /* Ensure MSI-X is disabled while it is set up */ +- pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); ++ /* ++ * Some devices require MSI-X to be enabled before the MSI-X ++ * registers can be accessed. Mask all the vectors to prevent ++ * interrupts coming in before they're fully set up. ++ */ ++ pci_msix_clear_and_set_ctrl(dev, 0, PCI_MSIX_FLAGS_MASKALL | ++ PCI_MSIX_FLAGS_ENABLE); + + pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); + /* Request & Map MSI-X table region */ +- base = msix_map_region(dev, msix_table_size(control)); +- if (!base) +- return -ENOMEM; ++ tsize = msix_table_size(control); ++ base = msix_map_region(dev, tsize); ++ if (!base) { ++ ret = -ENOMEM; ++ goto out_disable; ++ } ++ ++ /* Ensure that all table entries are masked. */ ++ msix_mask_all(base, tsize); + + ret = msix_setup_entries(dev, base, entries, nvec, affd); + if (ret) +- return ret; ++ goto out_disable; + + ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); + if (ret) +@@ -800,15 +837,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, + if (ret) + goto out_free; + +- /* +- * Some devices require MSI-X to be enabled before we can touch the +- * MSI-X registers. We need to mask all the vectors to prevent +- * interrupts coming in before they're fully set up. +- */ +- pci_msix_clear_and_set_ctrl(dev, 0, +- PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE); +- +- msix_program_entries(dev, entries); ++ msix_update_entries(dev, entries); + + ret = populate_msi_sysfs(dev); + if (ret) +@@ -842,6 +871,9 @@ out_avail: + out_free: + free_msi_irqs(dev); + ++out_disable: ++ pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); ++ + return ret; + } + +@@ -929,8 +961,7 @@ static void pci_msi_shutdown(struct pci_dev *dev) + + /* Return the device with MSI unmasked as initial states */ + mask = msi_mask(desc->msi_attrib.multi_cap); +- /* Keep cached state to be restored */ +- __pci_msi_desc_mask_irq(desc, mask, ~mask); ++ msi_mask_irq(desc, mask, 0); + + /* Restore dev->irq to its default pin-assertion IRQ */ + dev->irq = desc->msi_attrib.default_irq; +@@ -1015,10 +1046,8 @@ static void pci_msix_shutdown(struct pci_dev *dev) + } + + /* Return the device with MSI-X masked as initial states */ +- for_each_pci_msi_entry(entry, dev) { +- /* Keep cached states to be restored */ ++ for_each_pci_msi_entry(entry, dev) + __pci_msix_desc_mask_irq(entry, 1); +- } + + pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); + pci_intx_for_msi(dev, 1); +diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c +index c32daf087640a..5db6f7394ef2b 100644 +--- a/drivers/platform/x86/pcengines-apuv2.c ++++ b/drivers/platform/x86/pcengines-apuv2.c +@@ -78,7 +78,6 @@ static const struct gpio_led apu2_leds[] = { + { .name = "apu:green:1" }, + { .name = "apu:green:2" }, + { .name = "apu:green:3" }, +- { .name = "apu:simswap" }, + }; + + static const struct gpio_led_platform_data apu2_leds_pdata = { +@@ -95,8 +94,7 @@ static struct gpiod_lookup_table gpios_led_table = { + NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_LED3, + NULL, 2, GPIO_ACTIVE_LOW), +- GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_SIMSWAP, +- NULL, 3, GPIO_ACTIVE_LOW), ++ {} /* Terminating entry */ + } + }; + +@@ -126,6 +124,7 @@ static struct gpiod_lookup_table gpios_key_table = { + .table = { + GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_MODESW, + NULL, 0, GPIO_ACTIVE_LOW), ++ {} /* Terminating entry */ + } + }; + +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c +index de825df4abf6a..87cfadd70d0db 100644 +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -134,12 +134,12 @@ static void disable_dynirq(struct irq_data *data); + + static DEFINE_PER_CPU(unsigned int, irq_epoch); + +-static void clear_evtchn_to_irq_row(unsigned row) ++static void clear_evtchn_to_irq_row(int *evtchn_row) + { + unsigned col; + + for (col = 0; col < EVTCHN_PER_ROW; col++) +- WRITE_ONCE(evtchn_to_irq[row][col], -1); ++ WRITE_ONCE(evtchn_row[col], -1); + } + + static void clear_evtchn_to_irq_all(void) +@@ -149,7 +149,7 @@ static void clear_evtchn_to_irq_all(void) + for (row = 0; row < EVTCHN_ROW(xen_evtchn_max_channels()); row++) { + if (evtchn_to_irq[row] == NULL) + continue; +- clear_evtchn_to_irq_row(row); ++ clear_evtchn_to_irq_row(evtchn_to_irq[row]); + } + } + +@@ -157,6 +157,7 @@ static int set_evtchn_to_irq(unsigned evtchn, unsigned irq) + { + unsigned row; + unsigned col; ++ int *evtchn_row; + + if (evtchn >= xen_evtchn_max_channels()) + return -EINVAL; +@@ -169,11 +170,18 @@ static int set_evtchn_to_irq(unsigned evtchn, unsigned irq) + if (irq == -1) + return 0; + +- evtchn_to_irq[row] = (int *)get_zeroed_page(GFP_KERNEL); +- if (evtchn_to_irq[row] == NULL) ++ evtchn_row = (int *) __get_free_pages(GFP_KERNEL, 0); ++ if (evtchn_row == NULL) + return -ENOMEM; + +- clear_evtchn_to_irq_row(row); ++ clear_evtchn_to_irq_row(evtchn_row); ++ ++ /* ++ * We've prepared an empty row for the mapping. If a different ++ * thread was faster inserting it, we can drop ours. ++ */ ++ if (cmpxchg(&evtchn_to_irq[row], NULL, evtchn_row) != NULL) ++ free_page((unsigned long) evtchn_row); + } + + WRITE_ONCE(evtchn_to_irq[row][col], irq); +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c +index a6047caf77ecb..a49bf1fbaea82 100644 +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -4053,12 +4053,20 @@ bad: + + /* + * Delayed work handler to process end of delayed cap release LRU list. ++ * ++ * If new caps are added to the list while processing it, these won't get ++ * processed in this run. In this case, the ci->i_hold_caps_max will be ++ * returned so that the work can be scheduled accordingly. + */ +-void ceph_check_delayed_caps(struct ceph_mds_client *mdsc) ++unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc) + { + struct inode *inode; + struct ceph_inode_info *ci; + int flags = CHECK_CAPS_NODELAY; ++ struct ceph_mount_options *opt = mdsc->fsc->mount_options; ++ unsigned long delay_max = opt->caps_wanted_delay_max * HZ; ++ unsigned long loop_start = jiffies; ++ unsigned long delay = 0; + + dout("check_delayed_caps\n"); + while (1) { +@@ -4068,6 +4076,11 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc) + ci = list_first_entry(&mdsc->cap_delay_list, + struct ceph_inode_info, + i_cap_delay_list); ++ if (time_before(loop_start, ci->i_hold_caps_max - delay_max)) { ++ dout("%s caps added recently. Exiting loop", __func__); ++ delay = ci->i_hold_caps_max; ++ break; ++ } + if ((ci->i_ceph_flags & CEPH_I_FLUSH) == 0 && + time_before(jiffies, ci->i_hold_caps_max)) + break; +@@ -4084,6 +4097,8 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc) + } + } + spin_unlock(&mdsc->cap_delay_lock); ++ ++ return delay; + } + + /* +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c +index 0f21073a51a1b..1ef370913c007 100644 +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -4049,22 +4049,29 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc) + } + + /* +- * delayed work -- periodically trim expired leases, renew caps with mds ++ * delayed work -- periodically trim expired leases, renew caps with mds. If ++ * the @delay parameter is set to 0 or if it's more than 5 secs, the default ++ * workqueue delay value of 5 secs will be used. + */ +-static void schedule_delayed(struct ceph_mds_client *mdsc) ++static void schedule_delayed(struct ceph_mds_client *mdsc, unsigned long delay) + { +- int delay = 5; +- unsigned hz = round_jiffies_relative(HZ * delay); +- schedule_delayed_work(&mdsc->delayed_work, hz); ++ unsigned long max_delay = HZ * 5; ++ ++ /* 5 secs default delay */ ++ if (!delay || (delay > max_delay)) ++ delay = max_delay; ++ schedule_delayed_work(&mdsc->delayed_work, ++ round_jiffies_relative(delay)); + } + + static void delayed_work(struct work_struct *work) + { +- int i; + struct ceph_mds_client *mdsc = + container_of(work, struct ceph_mds_client, delayed_work.work); ++ unsigned long delay; + int renew_interval; + int renew_caps; ++ int i; + + dout("mdsc delayed_work\n"); + +@@ -4119,7 +4126,7 @@ static void delayed_work(struct work_struct *work) + } + mutex_unlock(&mdsc->mutex); + +- ceph_check_delayed_caps(mdsc); ++ delay = ceph_check_delayed_caps(mdsc); + + ceph_queue_cap_reclaim_work(mdsc); + +@@ -4127,7 +4134,7 @@ static void delayed_work(struct work_struct *work) + + maybe_recover_session(mdsc); + +- schedule_delayed(mdsc); ++ schedule_delayed(mdsc, delay); + } + + int ceph_mdsc_init(struct ceph_fs_client *fsc) +@@ -4600,7 +4607,7 @@ void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg) + mdsc->mdsmap->m_epoch); + + mutex_unlock(&mdsc->mutex); +- schedule_delayed(mdsc); ++ schedule_delayed(mdsc, 0); + return; + + bad_unlock: +diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c +index 923be9399b21c..e1b9b224fcb28 100644 +--- a/fs/ceph/snap.c ++++ b/fs/ceph/snap.c +@@ -60,24 +60,26 @@ + /* + * increase ref count for the realm + * +- * caller must hold snap_rwsem for write. ++ * caller must hold snap_rwsem. + */ + void ceph_get_snap_realm(struct ceph_mds_client *mdsc, + struct ceph_snap_realm *realm) + { +- dout("get_realm %p %d -> %d\n", realm, +- atomic_read(&realm->nref), atomic_read(&realm->nref)+1); ++ lockdep_assert_held(&mdsc->snap_rwsem); ++ + /* +- * since we _only_ increment realm refs or empty the empty +- * list with snap_rwsem held, adjusting the empty list here is +- * safe. we do need to protect against concurrent empty list +- * additions, however. ++ * The 0->1 and 1->0 transitions must take the snap_empty_lock ++ * atomically with the refcount change. Go ahead and bump the ++ * nref here, unless it's 0, in which case we take the spinlock ++ * and then do the increment and remove it from the list. + */ +- if (atomic_inc_return(&realm->nref) == 1) { +- spin_lock(&mdsc->snap_empty_lock); ++ if (atomic_inc_not_zero(&realm->nref)) ++ return; ++ ++ spin_lock(&mdsc->snap_empty_lock); ++ if (atomic_inc_return(&realm->nref) == 1) + list_del_init(&realm->empty_item); +- spin_unlock(&mdsc->snap_empty_lock); +- } ++ spin_unlock(&mdsc->snap_empty_lock); + } + + static void __insert_snap_realm(struct rb_root *root, +@@ -113,6 +115,8 @@ static struct ceph_snap_realm *ceph_create_snap_realm( + { + struct ceph_snap_realm *realm; + ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ + realm = kzalloc(sizeof(*realm), GFP_NOFS); + if (!realm) + return ERR_PTR(-ENOMEM); +@@ -135,7 +139,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm( + /* + * lookup the realm rooted at @ino. + * +- * caller must hold snap_rwsem for write. ++ * caller must hold snap_rwsem. + */ + static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc, + u64 ino) +@@ -143,6 +147,8 @@ static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc, + struct rb_node *n = mdsc->snap_realms.rb_node; + struct ceph_snap_realm *r; + ++ lockdep_assert_held(&mdsc->snap_rwsem); ++ + while (n) { + r = rb_entry(n, struct ceph_snap_realm, node); + if (ino < r->ino) +@@ -176,6 +182,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc, + static void __destroy_snap_realm(struct ceph_mds_client *mdsc, + struct ceph_snap_realm *realm) + { ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ + dout("__destroy_snap_realm %p %llx\n", realm, realm->ino); + + rb_erase(&realm->node, &mdsc->snap_realms); +@@ -198,28 +206,30 @@ static void __destroy_snap_realm(struct ceph_mds_client *mdsc, + static void __put_snap_realm(struct ceph_mds_client *mdsc, + struct ceph_snap_realm *realm) + { +- dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm, +- atomic_read(&realm->nref), atomic_read(&realm->nref)-1); ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ ++ /* ++ * We do not require the snap_empty_lock here, as any caller that ++ * increments the value must hold the snap_rwsem. ++ */ + if (atomic_dec_and_test(&realm->nref)) + __destroy_snap_realm(mdsc, realm); + } + + /* +- * caller needn't hold any locks ++ * See comments in ceph_get_snap_realm. Caller needn't hold any locks. + */ + void ceph_put_snap_realm(struct ceph_mds_client *mdsc, + struct ceph_snap_realm *realm) + { +- dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm, +- atomic_read(&realm->nref), atomic_read(&realm->nref)-1); +- if (!atomic_dec_and_test(&realm->nref)) ++ if (!atomic_dec_and_lock(&realm->nref, &mdsc->snap_empty_lock)) + return; + + if (down_write_trylock(&mdsc->snap_rwsem)) { ++ spin_unlock(&mdsc->snap_empty_lock); + __destroy_snap_realm(mdsc, realm); + up_write(&mdsc->snap_rwsem); + } else { +- spin_lock(&mdsc->snap_empty_lock); + list_add(&realm->empty_item, &mdsc->snap_empty); + spin_unlock(&mdsc->snap_empty_lock); + } +@@ -236,6 +246,8 @@ static void __cleanup_empty_realms(struct ceph_mds_client *mdsc) + { + struct ceph_snap_realm *realm; + ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ + spin_lock(&mdsc->snap_empty_lock); + while (!list_empty(&mdsc->snap_empty)) { + realm = list_first_entry(&mdsc->snap_empty, +@@ -269,6 +281,8 @@ static int adjust_snap_realm_parent(struct ceph_mds_client *mdsc, + { + struct ceph_snap_realm *parent; + ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ + if (realm->parent_ino == parentino) + return 0; + +@@ -686,6 +700,8 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, + int err = -ENOMEM; + LIST_HEAD(dirty_realms); + ++ lockdep_assert_held_write(&mdsc->snap_rwsem); ++ + dout("update_snap_trace deletion=%d\n", deletion); + more: + ceph_decode_need(&p, e, sizeof(*ri), bad); +diff --git a/fs/ceph/super.h b/fs/ceph/super.h +index bb12c9f3a218d..8ffc8e88dd3d2 100644 +--- a/fs/ceph/super.h ++++ b/fs/ceph/super.h +@@ -1064,7 +1064,7 @@ extern void ceph_flush_snaps(struct ceph_inode_info *ci, + extern bool __ceph_should_report_size(struct ceph_inode_info *ci); + extern void ceph_check_caps(struct ceph_inode_info *ci, int flags, + struct ceph_mds_session *session); +-extern void ceph_check_delayed_caps(struct ceph_mds_client *mdsc); ++extern unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc); + extern void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc); + extern int ceph_drop_caps_for_unlink(struct inode *inode); + extern int ceph_encode_inode_release(void **p, struct inode *inode, +diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h +index 1e037f894804b..8a5ced9cf5273 100644 +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -536,6 +536,7 @@ + NOINSTR_TEXT \ + *(.text..refcount) \ + *(.ref.text) \ ++ *(.text.asan.* .text.tsan.*) \ + MEM_KEEP(init.text*) \ + MEM_KEEP(exit.text*) \ + +diff --git a/include/linux/device.h b/include/linux/device.h +index 297239a08bb77..3414b5a67b466 100644 +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -1260,6 +1260,7 @@ struct device { + struct dev_pin_info *pins; + #endif + #ifdef CONFIG_GENERIC_MSI_IRQ ++ raw_spinlock_t msi_lock; + struct list_head msi_list; + #endif + +diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h +index 3515ca64e638a..b68fca08be27c 100644 +--- a/include/linux/inetdevice.h ++++ b/include/linux/inetdevice.h +@@ -41,7 +41,7 @@ struct in_device { + unsigned long mr_qri; /* Query Response Interval */ + unsigned char mr_qrv; /* Query Robustness Variable */ + unsigned char mr_gq_running; +- unsigned char mr_ifc_count; ++ u32 mr_ifc_count; + struct timer_list mr_gq_timer; /* general query timer */ + struct timer_list mr_ifc_timer; /* interface change timer */ + +diff --git a/include/linux/irq.h b/include/linux/irq.h +index e9e69c511ea92..5655da9eb1fb9 100644 +--- a/include/linux/irq.h ++++ b/include/linux/irq.h +@@ -542,6 +542,7 @@ struct irq_chip { + * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode + * IRQCHIP_SUPPORTS_LEVEL_MSI Chip can provide two doorbells for Level MSIs + * IRQCHIP_SUPPORTS_NMI: Chip can deliver NMIs, only for root irqchips ++ * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup + */ + enum { + IRQCHIP_SET_TYPE_MASKED = (1 << 0), +@@ -553,6 +554,7 @@ enum { + IRQCHIP_EOI_THREADED = (1 << 6), + IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7), + IRQCHIP_SUPPORTS_NMI = (1 << 8), ++ IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10), + }; + + #include +diff --git a/include/linux/msi.h b/include/linux/msi.h +index d695e2eb2092d..758e32f0d4434 100644 +--- a/include/linux/msi.h ++++ b/include/linux/msi.h +@@ -194,7 +194,7 @@ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); + void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); + + u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag); +-u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag); ++void __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag); + void pci_msi_mask_irq(struct irq_data *data); + void pci_msi_unmask_irq(struct irq_data *data); + +diff --git a/include/net/psample.h b/include/net/psample.h +index 68ae16bb0a4a8..20a17551f790f 100644 +--- a/include/net/psample.h ++++ b/include/net/psample.h +@@ -18,6 +18,8 @@ struct psample_group *psample_group_get(struct net *net, u32 group_num); + void psample_group_take(struct psample_group *group); + void psample_group_put(struct psample_group *group); + ++struct sk_buff; ++ + #if IS_ENABLED(CONFIG_PSAMPLE) + + void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, +diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c +index b76703b2c0af2..856f0297dc738 100644 +--- a/kernel/irq/chip.c ++++ b/kernel/irq/chip.c +@@ -265,8 +265,11 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force) + } else { + switch (__irq_startup_managed(desc, aff, force)) { + case IRQ_STARTUP_NORMAL: ++ if (d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP) ++ irq_setup_affinity(desc); + ret = __irq_startup(desc); +- irq_setup_affinity(desc); ++ if (!(d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP)) ++ irq_setup_affinity(desc); + break; + case IRQ_STARTUP_MANAGED: + irq_do_set_affinity(d, aff, false); +diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c +index 5d3da0db092ff..b7e4c5999cc80 100644 +--- a/kernel/irq/msi.c ++++ b/kernel/irq/msi.c +@@ -477,11 +477,6 @@ skip_activate: + return 0; + + cleanup: +- for_each_msi_vector(desc, i, dev) { +- irq_data = irq_domain_get_irq_data(domain, i); +- if (irqd_is_activated(irq_data)) +- irq_domain_deactivate_irq(irq_data); +- } + msi_domain_free_irqs(domain, dev); + return ret; + } +@@ -494,7 +489,15 @@ cleanup: + */ + void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev) + { ++ struct irq_data *irq_data; + struct msi_desc *desc; ++ int i; ++ ++ for_each_msi_vector(desc, i, dev) { ++ irq_data = irq_domain_get_irq_data(domain, i); ++ if (irqd_is_activated(irq_data)) ++ irq_domain_deactivate_irq(irq_data); ++ } + + for_each_msi_entry(desc, dev) { + /* +diff --git a/kernel/irq/timings.c b/kernel/irq/timings.c +index e960d7ce7bcce..b5985da80acf0 100644 +--- a/kernel/irq/timings.c ++++ b/kernel/irq/timings.c +@@ -453,6 +453,11 @@ static __always_inline void __irq_timings_store(int irq, struct irqt_stat *irqs, + */ + index = irq_timings_interval_index(interval); + ++ if (index > PREDICTION_BUFFER_SIZE - 1) { ++ irqs->count = 0; ++ return; ++ } ++ + /* + * Store the index as an element of the pattern in another + * circular array. +diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c +index bec20dbf6f603..e2a999890d05e 100644 +--- a/net/bridge/br_if.c ++++ b/net/bridge/br_if.c +@@ -599,6 +599,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, + + err = dev_set_allmulti(dev, 1); + if (err) { ++ br_multicast_del_port(p); + kfree(p); /* kobject not yet init'd, manually free */ + goto err1; + } +@@ -712,6 +713,7 @@ err4: + err3: + sysfs_remove_link(br->ifobj, p->dev->name); + err2: ++ br_multicast_del_port(p); + kobject_put(&p->kobj); + dev_set_allmulti(dev, -1); + err1: +diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c +index 8d033a75a766e..fdbed31585553 100644 +--- a/net/bridge/netfilter/nf_conntrack_bridge.c ++++ b/net/bridge/netfilter/nf_conntrack_bridge.c +@@ -88,6 +88,12 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, + + skb = ip_fraglist_next(&iter); + } ++ ++ if (!err) ++ return 0; ++ ++ kfree_skb_list(iter.frag); ++ + return err; + } + slow_path: +diff --git a/net/core/link_watch.c b/net/core/link_watch.c +index f153e06018383..35b0e39030daf 100644 +--- a/net/core/link_watch.c ++++ b/net/core/link_watch.c +@@ -150,7 +150,7 @@ static void linkwatch_do_dev(struct net_device *dev) + clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state); + + rfc2863_policy(dev); +- if (dev->flags & IFF_UP && netif_device_present(dev)) { ++ if (dev->flags & IFF_UP) { + if (netif_carrier_ok(dev)) + dev_activate(dev); + else +@@ -196,7 +196,8 @@ static void __linkwatch_run_queue(int urgent_only) + dev = list_first_entry(&wrk, struct net_device, link_watch_list); + list_del_init(&dev->link_watch_list); + +- if (urgent_only && !linkwatch_urgent_event(dev)) { ++ if (!netif_device_present(dev) || ++ (urgent_only && !linkwatch_urgent_event(dev))) { + list_add_tail(&dev->link_watch_list, &lweventlist); + continue; + } +diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c +index d93d4531aa9bc..9a675ba0bf0a8 100644 +--- a/net/ieee802154/socket.c ++++ b/net/ieee802154/socket.c +@@ -992,6 +992,11 @@ static const struct proto_ops ieee802154_dgram_ops = { + #endif + }; + ++static void ieee802154_sock_destruct(struct sock *sk) ++{ ++ skb_queue_purge(&sk->sk_receive_queue); ++} ++ + /* Create a socket. Initialise the socket, blank the addresses + * set the state. + */ +@@ -1032,7 +1037,7 @@ static int ieee802154_create(struct net *net, struct socket *sock, + sock->ops = ops; + + sock_init_data(sock, sk); +- /* FIXME: sk->sk_destruct */ ++ sk->sk_destruct = ieee802154_sock_destruct; + sk->sk_family = PF_IEEE802154; + + /* Checksums on by default */ +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c +index c8cbdc4d5cbc7..d2b1ae83f258d 100644 +--- a/net/ipv4/igmp.c ++++ b/net/ipv4/igmp.c +@@ -805,10 +805,17 @@ static void igmp_gq_timer_expire(struct timer_list *t) + static void igmp_ifc_timer_expire(struct timer_list *t) + { + struct in_device *in_dev = from_timer(in_dev, t, mr_ifc_timer); ++ u32 mr_ifc_count; + + igmpv3_send_cr(in_dev); +- if (in_dev->mr_ifc_count) { +- in_dev->mr_ifc_count--; ++restart: ++ mr_ifc_count = READ_ONCE(in_dev->mr_ifc_count); ++ ++ if (mr_ifc_count) { ++ if (cmpxchg(&in_dev->mr_ifc_count, ++ mr_ifc_count, ++ mr_ifc_count - 1) != mr_ifc_count) ++ goto restart; + igmp_ifc_start_timer(in_dev, + unsolicited_report_interval(in_dev)); + } +@@ -820,7 +827,7 @@ static void igmp_ifc_event(struct in_device *in_dev) + struct net *net = dev_net(in_dev->dev); + if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) + return; +- in_dev->mr_ifc_count = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; ++ WRITE_ONCE(in_dev->mr_ifc_count, in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv); + igmp_ifc_start_timer(in_dev, 1); + } + +@@ -959,7 +966,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, + in_dev->mr_qri; + } + /* cancel the interface change timer */ +- in_dev->mr_ifc_count = 0; ++ WRITE_ONCE(in_dev->mr_ifc_count, 0); + if (del_timer(&in_dev->mr_ifc_timer)) + __in_dev_put(in_dev); + /* clear deleted report items */ +@@ -1726,7 +1733,7 @@ void ip_mc_down(struct in_device *in_dev) + igmp_group_dropped(pmc); + + #ifdef CONFIG_IP_MULTICAST +- in_dev->mr_ifc_count = 0; ++ WRITE_ONCE(in_dev->mr_ifc_count, 0); + if (del_timer(&in_dev->mr_ifc_timer)) + __in_dev_put(in_dev); + in_dev->mr_gq_running = 0; +@@ -1943,7 +1950,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, + pmc->sfmode = MCAST_INCLUDE; + #ifdef CONFIG_IP_MULTICAST + pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; +- in_dev->mr_ifc_count = pmc->crcount; ++ WRITE_ONCE(in_dev->mr_ifc_count, pmc->crcount); + for (psf = pmc->sources; psf; psf = psf->sf_next) + psf->sf_crcount = 0; + igmp_ifc_event(pmc->interface); +@@ -2122,7 +2129,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, + /* else no filters; keep old mode for reports */ + + pmc->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; +- in_dev->mr_ifc_count = pmc->crcount; ++ WRITE_ONCE(in_dev->mr_ifc_count, pmc->crcount); + for (psf = pmc->sources; psf; psf = psf->sf_next) + psf->sf_crcount = 0; + igmp_ifc_event(in_dev); +diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c +index 6ea3dc2e42194..6274462b86b4b 100644 +--- a/net/ipv4/tcp_bbr.c ++++ b/net/ipv4/tcp_bbr.c +@@ -1041,7 +1041,7 @@ static void bbr_init(struct sock *sk) + bbr->prior_cwnd = 0; + tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; + bbr->rtt_cnt = 0; +- bbr->next_rtt_delivered = 0; ++ bbr->next_rtt_delivered = tp->delivered; + bbr->prev_ca_state = TCP_CA_Open; + bbr->packet_conservation = 0; + +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c +index 8327ef9793ef8..e3ff884a48c56 100644 +--- a/net/sched/act_mirred.c ++++ b/net/sched/act_mirred.c +@@ -261,6 +261,9 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, + goto out; + } + ++ /* All mirred/redirected skbs should clear previous ct info */ ++ nf_reset_ct(skb2); ++ + want_ingress = tcf_mirred_act_wants_ingress(m_eaction); + + expects_nh = want_ingress || !m_mac_header_xmit; +diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c +index 5905f0cddc895..7973f98ebd918 100644 +--- a/net/vmw_vsock/virtio_transport.c ++++ b/net/vmw_vsock/virtio_transport.c +@@ -373,11 +373,14 @@ static void virtio_vsock_event_fill(struct virtio_vsock *vsock) + + static void virtio_vsock_reset_sock(struct sock *sk) + { +- lock_sock(sk); ++ /* vmci_transport.c doesn't take sk_lock here either. At least we're ++ * under vsock_table_lock so the sock cannot disappear while we're ++ * executing. ++ */ ++ + sk->sk_state = TCP_CLOSE; + sk->sk_err = ECONNRESET; + sk->sk_error_report(sk); +- release_sock(sk); + } + + static void virtio_vsock_update_guest_cid(struct virtio_vsock *vsock) +diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c +index 5faf8877137ae..6825e874785f2 100644 +--- a/sound/soc/codecs/cs42l42.c ++++ b/sound/soc/codecs/cs42l42.c +@@ -403,7 +403,7 @@ static const struct regmap_config cs42l42_regmap = { + .use_single_write = true, + }; + +-static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); ++static DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 100, true); + static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); + + static const char * const cs42l42_hpf_freq_text[] = { +@@ -423,34 +423,23 @@ static SOC_ENUM_SINGLE_DECL(cs42l42_wnf3_freq_enum, CS42L42_ADC_WNF_HPF_CTL, + CS42L42_ADC_WNF_CF_SHIFT, + cs42l42_wnf3_freq_text); + +-static const char * const cs42l42_wnf05_freq_text[] = { +- "280Hz", "315Hz", "350Hz", "385Hz", +- "420Hz", "455Hz", "490Hz", "525Hz" +-}; +- +-static SOC_ENUM_SINGLE_DECL(cs42l42_wnf05_freq_enum, CS42L42_ADC_WNF_HPF_CTL, +- CS42L42_ADC_WNF_CF_SHIFT, +- cs42l42_wnf05_freq_text); +- + static const struct snd_kcontrol_new cs42l42_snd_controls[] = { + /* ADC Volume and Filter Controls */ + SOC_SINGLE("ADC Notch Switch", CS42L42_ADC_CTL, +- CS42L42_ADC_NOTCH_DIS_SHIFT, true, false), ++ CS42L42_ADC_NOTCH_DIS_SHIFT, true, true), + SOC_SINGLE("ADC Weak Force Switch", CS42L42_ADC_CTL, + CS42L42_ADC_FORCE_WEAK_VCM_SHIFT, true, false), + SOC_SINGLE("ADC Invert Switch", CS42L42_ADC_CTL, + CS42L42_ADC_INV_SHIFT, true, false), + SOC_SINGLE("ADC Boost Switch", CS42L42_ADC_CTL, + CS42L42_ADC_DIG_BOOST_SHIFT, true, false), +- SOC_SINGLE_SX_TLV("ADC Volume", CS42L42_ADC_VOLUME, +- CS42L42_ADC_VOL_SHIFT, 0xA0, 0x6C, adc_tlv), ++ SOC_SINGLE_S8_TLV("ADC Volume", CS42L42_ADC_VOLUME, -97, 12, adc_tlv), + SOC_SINGLE("ADC WNF Switch", CS42L42_ADC_WNF_HPF_CTL, + CS42L42_ADC_WNF_EN_SHIFT, true, false), + SOC_SINGLE("ADC HPF Switch", CS42L42_ADC_WNF_HPF_CTL, + CS42L42_ADC_HPF_EN_SHIFT, true, false), + SOC_ENUM("HPF Corner Freq", cs42l42_hpf_freq_enum), + SOC_ENUM("WNF 3dB Freq", cs42l42_wnf3_freq_enum), +- SOC_ENUM("WNF 05dB Freq", cs42l42_wnf05_freq_enum), + + /* DAC Volume and Filter Controls */ + SOC_SINGLE("DACA Invert Switch", CS42L42_DAC_CTL1, +@@ -669,15 +658,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) + CS42L42_FSYNC_PULSE_WIDTH_MASK, + CS42L42_FRAC1_VAL(fsync - 1) << + CS42L42_FSYNC_PULSE_WIDTH_SHIFT); +- snd_soc_component_update_bits(component, +- CS42L42_ASP_FRM_CFG, +- CS42L42_ASP_5050_MASK, +- CS42L42_ASP_5050_MASK); +- /* Set the frame delay to 1.0 SCLK clocks */ +- snd_soc_component_update_bits(component, CS42L42_ASP_FRM_CFG, +- CS42L42_ASP_FSD_MASK, +- CS42L42_ASP_FSD_1_0 << +- CS42L42_ASP_FSD_SHIFT); + /* Set the sample rates (96k or lower) */ + snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN, + CS42L42_FS_EN_MASK, +@@ -773,7 +753,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) + /* interface format */ + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: +- case SND_SOC_DAIFMT_LEFT_J: ++ /* ++ * 5050 mode, frame starts on falling edge of LRCLK, ++ * frame delayed by 1.0 SCLKs ++ */ ++ snd_soc_component_update_bits(component, ++ CS42L42_ASP_FRM_CFG, ++ CS42L42_ASP_STP_MASK | ++ CS42L42_ASP_5050_MASK | ++ CS42L42_ASP_FSD_MASK, ++ CS42L42_ASP_5050_MASK | ++ (CS42L42_ASP_FSD_1_0 << ++ CS42L42_ASP_FSD_SHIFT)); + break; + default: + return -EINVAL; +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +index c3ff203c3f447..216e88624c5f3 100644 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream, + snd_pcm_uframes_t period_size; + ssize_t periodbytes; + ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream); +- u32 buffer_addr = virt_to_phys(substream->dma_buffer.area); ++ u32 buffer_addr = substream->runtime->dma_addr; + + channels = substream->runtime->channels; + period_size = substream->runtime->period_size; +@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream, + /* set codec params and inform SST driver the same */ + sst_fill_pcm_params(substream, ¶m); + sst_fill_alloc_params(substream, &alloc_params); +- substream->runtime->dma_area = substream->dma_buffer.area; + str_params.sparams = param; + str_params.aparams = alloc_params; + str_params.codec = SST_CODEC_TYPE_PCM; +diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c +index 48970efe7838e..1f15c11782ec4 100644 +--- a/sound/soc/xilinx/xlnx_formatter_pcm.c ++++ b/sound/soc/xilinx/xlnx_formatter_pcm.c +@@ -461,8 +461,8 @@ static int xlnx_formatter_pcm_hw_params(struct snd_pcm_substream *substream, + + stream_data->buffer_size = size; + +- low = lower_32_bits(substream->dma_buffer.addr); +- high = upper_32_bits(substream->dma_buffer.addr); ++ low = lower_32_bits(runtime->dma_addr); ++ high = upper_32_bits(runtime->dma_addr); + writel(low, stream_data->mmio + XLNX_AUD_BUFF_ADDR_LSB); + writel(high, stream_data->mmio + XLNX_AUD_BUFF_ADDR_MSB); +