diff options
author | 2023-11-02 07:09:47 -0400 | |
---|---|---|
committer | 2023-11-02 07:09:47 -0400 | |
commit | e87165447456e2d4f4675c67b3a59b9d5396dc5e (patch) | |
tree | 0db4c5772be94d4692251ce2a45938ba816aac03 | |
parent | Linux patch 6.1.60 (diff) | |
download | linux-patches-e87165447456e2d4f4675c67b3a59b9d5396dc5e.tar.gz linux-patches-e87165447456e2d4f4675c67b3a59b9d5396dc5e.tar.bz2 linux-patches-e87165447456e2d4f4675c67b3a59b9d5396dc5e.zip |
Linux patch 6.1.616.1-68
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1060_linux-6.1.61.patch | 2922 |
2 files changed, 2926 insertions, 0 deletions
diff --git a/0000_README b/0000_README index a3b5d2f0..78a774ef 100644 --- a/0000_README +++ b/0000_README @@ -283,6 +283,10 @@ Patch: 1059_linux-6.1.60.patch From: https://www.kernel.org Desc: Linux 6.1.60 +Patch: 1060_linux-6.1.61.patch +From: https://www.kernel.org +Desc: Linux 6.1.61 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1060_linux-6.1.61.patch b/1060_linux-6.1.61.patch new file mode 100644 index 00000000..a25aac45 --- /dev/null +++ b/1060_linux-6.1.61.patch @@ -0,0 +1,2922 @@ +diff --git a/Makefile b/Makefile +index d47edcd8888e8..635474f38aaa9 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 6 + PATCHLEVEL = 1 +-SUBLEVEL = 60 ++SUBLEVEL = 61 + EXTRAVERSION = + NAME = Curry Ramen + +diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi +index 7ae8b620515c5..59f546a278f87 100644 +--- a/arch/arm/boot/dts/omap4-l4-abe.dtsi ++++ b/arch/arm/boot/dts/omap4-l4-abe.dtsi +@@ -109,6 +109,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49022000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP4_MCBSP1_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +@@ -142,6 +144,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49024000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP4_MCBSP2_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +@@ -175,6 +179,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49026000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP4_MCBSP3_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +diff --git a/arch/arm/boot/dts/omap4-l4.dtsi b/arch/arm/boot/dts/omap4-l4.dtsi +index 46b8f9efd4131..3fcef3080eaec 100644 +--- a/arch/arm/boot/dts/omap4-l4.dtsi ++++ b/arch/arm/boot/dts/omap4-l4.dtsi +@@ -2043,6 +2043,8 @@ + compatible = "ti,omap4-mcbsp"; + reg = <0x0 0xff>; /* L4 Interconnect */ + reg-names = "mpu"; ++ clocks = <&l4_per_clkctrl OMAP4_MCBSP4_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +diff --git a/arch/arm/boot/dts/omap5-l4-abe.dtsi b/arch/arm/boot/dts/omap5-l4-abe.dtsi +index a03bca5a35844..97b0c3b5f573f 100644 +--- a/arch/arm/boot/dts/omap5-l4-abe.dtsi ++++ b/arch/arm/boot/dts/omap5-l4-abe.dtsi +@@ -109,6 +109,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49022000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP5_MCBSP1_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +@@ -142,6 +144,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49024000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP5_MCBSP2_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +@@ -175,6 +179,8 @@ + reg = <0x0 0xff>, /* MPU private access */ + <0x49026000 0xff>; /* L3 Interconnect */ + reg-names = "mpu", "dma"; ++ clocks = <&abe_clkctrl OMAP5_MCBSP3_CLKCTRL 24>; ++ clock-names = "fck"; + interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common"; + ti,buffer-size = <128>; +diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c +index 410d17d1d4431..f618a6df29382 100644 +--- a/arch/arm/mach-omap1/timer32k.c ++++ b/arch/arm/mach-omap1/timer32k.c +@@ -176,17 +176,18 @@ static u64 notrace omap_32k_read_sched_clock(void) + return sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0; + } + ++static struct timespec64 persistent_ts; ++static cycles_t cycles; ++static unsigned int persistent_mult, persistent_shift; ++ + /** + * omap_read_persistent_clock64 - Return time from a persistent clock. ++ * @ts: &struct timespec64 for the returned time + * + * Reads the time from a source which isn't disabled during PM, the + * 32k sync timer. Convert the cycles elapsed since last read into + * nsecs and adds to a monotonically increasing timespec64. + */ +-static struct timespec64 persistent_ts; +-static cycles_t cycles; +-static unsigned int persistent_mult, persistent_shift; +- + static void omap_read_persistent_clock64(struct timespec64 *ts) + { + unsigned long long nsecs; +@@ -206,10 +207,9 @@ static void omap_read_persistent_clock64(struct timespec64 *ts) + /** + * omap_init_clocksource_32k - setup and register counter 32k as a + * kernel clocksource +- * @pbase: base addr of counter_32k module +- * @size: size of counter_32k to map ++ * @vbase: base addr of counter_32k module + * +- * Returns 0 upon success or negative error code upon failure. ++ * Returns: %0 upon success or negative error code upon failure. + * + */ + static int __init omap_init_clocksource_32k(void __iomem *vbase) +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +index 9bdc0b93001f4..b2b3c72a0f87d 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +@@ -493,6 +493,7 @@ + + &i2s0 { + pinctrl-0 = <&i2s0_2ch_bus>; ++ pinctrl-1 = <&i2s0_2ch_bus_bclk_off>; + rockchip,capture-channels = <2>; + rockchip,playback-channels = <2>; + status = "okay"; +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 59858f2dc8b9f..5f3caf01badeb 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -2396,6 +2396,16 @@ + <4 RK_PA0 1 &pcfg_pull_none>; + }; + ++ i2s0_2ch_bus_bclk_off: i2s0-2ch-bus-bclk-off { ++ rockchip,pins = ++ <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>, ++ <3 RK_PD1 1 &pcfg_pull_none>, ++ <3 RK_PD2 1 &pcfg_pull_none>, ++ <3 RK_PD3 1 &pcfg_pull_none>, ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ <4 RK_PA0 1 &pcfg_pull_none>; ++ }; ++ + i2s0_8ch_bus: i2s0-8ch-bus { + rockchip,pins = + <3 RK_PD0 1 &pcfg_pull_none>, +diff --git a/arch/sparc/lib/checksum_32.S b/arch/sparc/lib/checksum_32.S +index 781e39b3c009f..481e94e1f6857 100644 +--- a/arch/sparc/lib/checksum_32.S ++++ b/arch/sparc/lib/checksum_32.S +@@ -453,5 +453,5 @@ ccslow: cmp %g1, 0 + * we only bother with faults on loads... */ + + cc_fault: +- ret ++ retl + clr %o0 +diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h +index 637fa1df35124..c715097e92fd2 100644 +--- a/arch/x86/include/asm/i8259.h ++++ b/arch/x86/include/asm/i8259.h +@@ -69,6 +69,8 @@ struct legacy_pic { + void (*make_irq)(unsigned int irq); + }; + ++void legacy_pic_pcat_compat(void); ++ + extern struct legacy_pic *legacy_pic; + extern struct legacy_pic null_legacy_pic; + +diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h +index b3af2d45bbbb5..5190cc3db771e 100644 +--- a/arch/x86/include/asm/intel-family.h ++++ b/arch/x86/include/asm/intel-family.h +@@ -27,6 +27,7 @@ + * _X - regular server parts + * _D - micro server parts + * _N,_P - other mobile parts ++ * _H - premium mobile parts + * _S - other client parts + * + * Historical OPTDIFFs: +@@ -125,6 +126,7 @@ + + #define INTEL_FAM6_LUNARLAKE_M 0xBD + ++#define INTEL_FAM6_ARROWLAKE_H 0xC5 + #define INTEL_FAM6_ARROWLAKE 0xC6 + + /* "Small Core" Processors (Atom/E-Core) */ +diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c +index 0f762070a5e10..2252340b2133e 100644 +--- a/arch/x86/kernel/acpi/boot.c ++++ b/arch/x86/kernel/acpi/boot.c +@@ -147,6 +147,9 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) + pr_debug("Local APIC address 0x%08x\n", madt->address); + } + ++ if (madt->flags & ACPI_MADT_PCAT_COMPAT) ++ legacy_pic_pcat_compat(); ++ + /* ACPI 6.3 and newer support the online capable bit. */ + if (acpi_gbl_FADT.header.revision > 6 || + (acpi_gbl_FADT.header.revision == 6 && +diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c +index f91e5e31aa4f0..2ac5f488300cf 100644 +--- a/arch/x86/kernel/i8259.c ++++ b/arch/x86/kernel/i8259.c +@@ -32,6 +32,7 @@ + */ + static void init_8259A(int auto_eoi); + ++static bool pcat_compat __ro_after_init; + static int i8259A_auto_eoi; + DEFINE_RAW_SPINLOCK(i8259A_lock); + +@@ -301,15 +302,32 @@ static void unmask_8259A(void) + + static int probe_8259A(void) + { ++ unsigned char new_val, probe_val = ~(1 << PIC_CASCADE_IR); + unsigned long flags; +- unsigned char probe_val = ~(1 << PIC_CASCADE_IR); +- unsigned char new_val; ++ ++ /* ++ * If MADT has the PCAT_COMPAT flag set, then do not bother probing ++ * for the PIC. Some BIOSes leave the PIC uninitialized and probing ++ * fails. ++ * ++ * Right now this causes problems as quite some code depends on ++ * nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly ++ * when the system has an IO/APIC because then PIC is not required ++ * at all, except for really old machines where the timer interrupt ++ * must be routed through the PIC. So just pretend that the PIC is ++ * there and let legacy_pic->init() initialize it for nothing. ++ * ++ * Alternatively this could just try to initialize the PIC and ++ * repeat the probe, but for cases where there is no PIC that's ++ * just pointless. ++ */ ++ if (pcat_compat) ++ return nr_legacy_irqs(); ++ + /* +- * Check to see if we have a PIC. +- * Mask all except the cascade and read +- * back the value we just wrote. If we don't +- * have a PIC, we will read 0xff as opposed to the +- * value we wrote. ++ * Check to see if we have a PIC. Mask all except the cascade and ++ * read back the value we just wrote. If we don't have a PIC, we ++ * will read 0xff as opposed to the value we wrote. + */ + raw_spin_lock_irqsave(&i8259A_lock, flags); + +@@ -431,5 +449,9 @@ static int __init i8259A_init_ops(void) + + return 0; + } +- + device_initcall(i8259A_init_ops); ++ ++void __init legacy_pic_pcat_compat(void) ++{ ++ pcat_compat = true; ++} +diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h +index c976490b75568..3666578b88a00 100644 +--- a/arch/x86/kvm/pmu.h ++++ b/arch/x86/kvm/pmu.h +@@ -63,6 +63,12 @@ static inline u64 pmc_read_counter(struct kvm_pmc *pmc) + return counter & pmc_bitmask(pmc); + } + ++static inline void pmc_write_counter(struct kvm_pmc *pmc, u64 val) ++{ ++ pmc->counter += val - pmc_read_counter(pmc); ++ pmc->counter &= pmc_bitmask(pmc); ++} ++ + static inline void pmc_release_perf_event(struct kvm_pmc *pmc) + { + if (pmc->perf_event) { +diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c +index 9d65cd095691b..1cb2bf9808f57 100644 +--- a/arch/x86/kvm/svm/pmu.c ++++ b/arch/x86/kvm/svm/pmu.c +@@ -149,7 +149,7 @@ static int amd_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) + /* MSR_PERFCTRn */ + pmc = get_gp_pmc_amd(pmu, msr, PMU_TYPE_COUNTER); + if (pmc) { +- pmc->counter += data - pmc_read_counter(pmc); ++ pmc_write_counter(pmc, data); + pmc_update_sample_period(pmc); + return 0; + } +diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c +index 9fabfe71fd879..9a75a0d5deae1 100644 +--- a/arch/x86/kvm/vmx/pmu_intel.c ++++ b/arch/x86/kvm/vmx/pmu_intel.c +@@ -461,11 +461,11 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) + if (!msr_info->host_initiated && + !(msr & MSR_PMC_FULL_WIDTH_BIT)) + data = (s64)(s32)data; +- pmc->counter += data - pmc_read_counter(pmc); ++ pmc_write_counter(pmc, data); + pmc_update_sample_period(pmc); + return 0; + } else if ((pmc = get_fixed_pmc(pmu, msr))) { +- pmc->counter += data - pmc_read_counter(pmc); ++ pmc_write_counter(pmc, data); + pmc_update_sample_period(pmc); + return 0; + } else if ((pmc = get_gp_pmc(pmu, msr, MSR_P6_EVNTSEL0))) { +diff --git a/block/blk-throttle.c b/block/blk-throttle.c +index 1007f80278579..009b0d76bf036 100644 +--- a/block/blk-throttle.c ++++ b/block/blk-throttle.c +@@ -723,6 +723,12 @@ static unsigned int calculate_io_allowed(u32 iops_limit, + + static u64 calculate_bytes_allowed(u64 bps_limit, unsigned long jiffy_elapsed) + { ++ /* ++ * Can result be wider than 64 bits? ++ * We check against 62, not 64, due to ilog2 truncation. ++ */ ++ if (ilog2(bps_limit) + ilog2(jiffy_elapsed) - ilog2(HZ) > 62) ++ return U64_MAX; + return mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed, (u64)HZ); + } + +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c +index 2b9676416b8e8..e614eb3355d39 100644 +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -1084,10 +1084,11 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) + + /* + * Ask the sd driver to issue START STOP UNIT on runtime suspend +- * and resume only. For system level suspend/resume, devices +- * power state is handled directly by libata EH. ++ * and resume and shutdown only. For system level suspend/resume, ++ * devices power state is handled directly by libata EH. + */ + sdev->manage_runtime_start_stop = true; ++ sdev->manage_shutdown = true; + } + + /* +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index e0de6565800d2..33fedbd096f33 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -3340,6 +3340,7 @@ static void possible_parent_show(struct seq_file *s, struct clk_core *core, + unsigned int i, char terminator) + { + struct clk_core *parent; ++ const char *name = NULL; + + /* + * Go through the following options to fetch a parent's name. +@@ -3354,18 +3355,20 @@ static void possible_parent_show(struct seq_file *s, struct clk_core *core, + * registered (yet). + */ + parent = clk_core_get_parent_by_index(core, i); +- if (parent) ++ if (parent) { + seq_puts(s, parent->name); +- else if (core->parents[i].name) ++ } else if (core->parents[i].name) { + seq_puts(s, core->parents[i].name); +- else if (core->parents[i].fw_name) ++ } else if (core->parents[i].fw_name) { + seq_printf(s, "<%s>(fw)", core->parents[i].fw_name); +- else if (core->parents[i].index >= 0) +- seq_puts(s, +- of_clk_get_parent_name(core->of_node, +- core->parents[i].index)); +- else +- seq_puts(s, "(missing)"); ++ } else { ++ if (core->parents[i].index >= 0) ++ name = of_clk_get_parent_name(core->of_node, core->parents[i].index); ++ if (!name) ++ name = "(missing)"; ++ ++ seq_puts(s, name); ++ } + + seq_putc(s, terminator); + } +diff --git a/drivers/clk/ti/clk-44xx.c b/drivers/clk/ti/clk-44xx.c +index 868bc7af21b0b..9b2824ed785b9 100644 +--- a/drivers/clk/ti/clk-44xx.c ++++ b/drivers/clk/ti/clk-44xx.c +@@ -749,9 +749,14 @@ static struct ti_dt_clk omap44xx_clks[] = { + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), ++ DT_CLK("40122000.mcbsp", "prcm_fck", "abe-clkctrl:0028:26"), ++ DT_CLK("40124000.mcbsp", "prcm_fck", "abe-clkctrl:0030:26"), ++ DT_CLK("40126000.mcbsp", "prcm_fck", "abe-clkctrl:0038:26"), + DT_CLK(NULL, "mcbsp4_sync_mux_ck", "l4-per-clkctrl:00c0:26"), ++ DT_CLK("48096000.mcbsp", "prcm_fck", "l4-per-clkctrl:00c0:26"), + DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "l3-init-clkctrl:00c0:8"), + DT_CLK(NULL, "otg_60m_gfclk", "l3-init-clkctrl:0040:24"), ++ DT_CLK(NULL, "pad_fck", "pad_clks_ck"), + DT_CLK(NULL, "per_mcbsp4_gfclk", "l4-per-clkctrl:00c0:24"), + DT_CLK(NULL, "pmd_stm_clock_mux_ck", "emu-sys-clkctrl:0000:20"), + DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu-sys-clkctrl:0000:22"), +diff --git a/drivers/clk/ti/clk-54xx.c b/drivers/clk/ti/clk-54xx.c +index b4aff76eb3735..74dfd5823f835 100644 +--- a/drivers/clk/ti/clk-54xx.c ++++ b/drivers/clk/ti/clk-54xx.c +@@ -565,15 +565,19 @@ static struct ti_dt_clk omap54xx_clks[] = { + DT_CLK(NULL, "gpio8_dbclk", "l4per-clkctrl:00f8:8"), + DT_CLK(NULL, "mcbsp1_gfclk", "abe-clkctrl:0028:24"), + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), ++ DT_CLK("40122000.mcbsp", "prcm_fck", "abe-clkctrl:0028:26"), + DT_CLK(NULL, "mcbsp2_gfclk", "abe-clkctrl:0030:24"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), ++ DT_CLK("40124000.mcbsp", "prcm_fck", "abe-clkctrl:0030:26"), + DT_CLK(NULL, "mcbsp3_gfclk", "abe-clkctrl:0038:24"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), ++ DT_CLK("40126000.mcbsp", "prcm_fck", "abe-clkctrl:0038:26"), + DT_CLK(NULL, "mmc1_32khz_clk", "l3init-clkctrl:0008:8"), + DT_CLK(NULL, "mmc1_fclk", "l3init-clkctrl:0008:25"), + DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"), + DT_CLK(NULL, "mmc2_fclk", "l3init-clkctrl:0010:25"), + DT_CLK(NULL, "mmc2_fclk_mux", "l3init-clkctrl:0010:24"), ++ DT_CLK(NULL, "pad_fck", "pad_clks_ck"), + DT_CLK(NULL, "sata_ref_clk", "l3init-clkctrl:0068:8"), + DT_CLK(NULL, "timer10_gfclk_mux", "l4per-clkctrl:0008:24"), + DT_CLK(NULL, "timer11_gfclk_mux", "l4per-clkctrl:0010:24"), +diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h +index 59a4c02594563..154590e1f7643 100644 +--- a/drivers/crypto/virtio/virtio_crypto_common.h ++++ b/drivers/crypto/virtio/virtio_crypto_common.h +@@ -35,6 +35,9 @@ struct virtio_crypto { + struct virtqueue *ctrl_vq; + struct data_queue *data_vq; + ++ /* Work struct for config space updates */ ++ struct work_struct config_work; ++ + /* To protect the vq operations for the controlq */ + spinlock_t ctrl_lock; + +diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c +index 1198bd3063655..3842915ea7437 100644 +--- a/drivers/crypto/virtio/virtio_crypto_core.c ++++ b/drivers/crypto/virtio/virtio_crypto_core.c +@@ -335,6 +335,14 @@ static void virtcrypto_del_vqs(struct virtio_crypto *vcrypto) + virtcrypto_free_queues(vcrypto); + } + ++static void vcrypto_config_changed_work(struct work_struct *work) ++{ ++ struct virtio_crypto *vcrypto = ++ container_of(work, struct virtio_crypto, config_work); ++ ++ virtcrypto_update_status(vcrypto); ++} ++ + static int virtcrypto_probe(struct virtio_device *vdev) + { + int err = -EFAULT; +@@ -454,6 +462,8 @@ static int virtcrypto_probe(struct virtio_device *vdev) + if (err) + goto free_engines; + ++ INIT_WORK(&vcrypto->config_work, vcrypto_config_changed_work); ++ + return 0; + + free_engines: +@@ -489,6 +499,7 @@ static void virtcrypto_remove(struct virtio_device *vdev) + + dev_info(&vdev->dev, "Start virtcrypto_remove.\n"); + ++ flush_work(&vcrypto->config_work); + if (virtcrypto_dev_started(vcrypto)) + virtcrypto_dev_stop(vcrypto); + virtio_reset_device(vdev); +@@ -503,7 +514,7 @@ static void virtcrypto_config_changed(struct virtio_device *vdev) + { + struct virtio_crypto *vcrypto = vdev->priv; + +- virtcrypto_update_status(vcrypto); ++ schedule_work(&vcrypto->config_work); + } + + #ifdef CONFIG_PM_SLEEP +@@ -511,6 +522,7 @@ static int virtcrypto_freeze(struct virtio_device *vdev) + { + struct virtio_crypto *vcrypto = vdev->priv; + ++ flush_work(&vcrypto->config_work); + virtio_reset_device(vdev); + virtcrypto_free_unused_reqs(vcrypto); + if (virtcrypto_dev_started(vcrypto)) +diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c +index e322a326546b5..7ad2e03afd4e5 100644 +--- a/drivers/firewire/sbp2.c ++++ b/drivers/firewire/sbp2.c +@@ -1521,6 +1521,7 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) + if (sbp2_param_exclusive_login) { + sdev->manage_system_start_stop = true; + sdev->manage_runtime_start_stop = true; ++ sdev->manage_shutdown = true; + } + + if (sdev->type == TYPE_ROM) +diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c +index 1f410809d3ee4..0f656e4191d5c 100644 +--- a/drivers/firmware/imx/imx-dsp.c ++++ b/drivers/firmware/imx/imx-dsp.c +@@ -115,11 +115,11 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) + dsp_chan->idx = i % 2; + dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); + if (IS_ERR(dsp_chan->ch)) { +- kfree(dsp_chan->name); + ret = PTR_ERR(dsp_chan->ch); + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to request mbox chan %s ret %d\n", + chan_name, ret); ++ kfree(dsp_chan->name); + goto out; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c +index 53a3bb7fc9c47..1bfd7b49fe9c3 100644 +--- a/drivers/gpu/drm/amd/amdgpu/vi.c ++++ b/drivers/gpu/drm/amd/amdgpu/vi.c +@@ -1147,7 +1147,7 @@ static void vi_program_aspm(struct amdgpu_device *adev) + bool bL1SS = false; + bool bClkReqSupport = true; + +- if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk()) ++ if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported()) + return; + + if (adev->flags & AMD_IS_APU || +diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c +index f854cb5eafbe7..72b2b171e533e 100644 +--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c +@@ -2574,14 +2574,14 @@ static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper( + struct drm_dp_mst_branch *found_mstb; + struct drm_dp_mst_port *port; + ++ if (!mstb) ++ return NULL; ++ + if (memcmp(mstb->guid, guid, 16) == 0) + return mstb; + + + list_for_each_entry(port, &mstb->ports, next) { +- if (!port->mstb) +- continue; +- + found_mstb = get_mst_branch_device_by_guid_helper(port->mstb, guid); + + if (found_mstb) +diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c +index 958b37123bf12..89eec585880f0 100644 +--- a/drivers/gpu/drm/i915/i915_pmu.c ++++ b/drivers/gpu/drm/i915/i915_pmu.c +@@ -760,9 +760,18 @@ static void i915_pmu_event_start(struct perf_event *event, int flags) + + static void i915_pmu_event_stop(struct perf_event *event, int flags) + { ++ struct drm_i915_private *i915 = ++ container_of(event->pmu, typeof(*i915), pmu.base); ++ struct i915_pmu *pmu = &i915->pmu; ++ ++ if (pmu->closed) ++ goto out; ++ + if (flags & PERF_EF_UPDATE) + i915_pmu_event_read(event); + i915_pmu_disable(event); ++ ++out: + event->hw.state = PERF_HES_STOPPED; + } + +diff --git a/drivers/gpu/drm/logicvc/Kconfig b/drivers/gpu/drm/logicvc/Kconfig +index fa7a883688094..1df22a852a23e 100644 +--- a/drivers/gpu/drm/logicvc/Kconfig ++++ b/drivers/gpu/drm/logicvc/Kconfig +@@ -5,5 +5,7 @@ config DRM_LOGICVC + select DRM_KMS_HELPER + select DRM_KMS_DMA_HELPER + select DRM_GEM_DMA_HELPER ++ select REGMAP ++ select REGMAP_MMIO + help + DRM display driver for the logiCVC programmable logic block from Xylon +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c +index 866c52afb8b0a..6adf3b141316b 100644 +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -749,6 +749,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr) + func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); + func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN; + writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); ++ ++ bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; + } + + static int aspeed_i2c_reg_slave(struct i2c_client *client) +@@ -765,7 +767,6 @@ static int aspeed_i2c_reg_slave(struct i2c_client *client) + __aspeed_i2c_reg_slave(bus, client->addr); + + bus->slave = client; +- bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; + spin_unlock_irqrestore(&bus->lock, flags); + + return 0; +diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c +index d1c59d83a65b9..cb995449ebf3d 100644 +--- a/drivers/i2c/busses/i2c-stm32f7.c ++++ b/drivers/i2c/busses/i2c-stm32f7.c +@@ -1059,9 +1059,10 @@ static int stm32f7_i2c_smbus_xfer_msg(struct stm32f7_i2c_dev *i2c_dev, + /* Configure PEC */ + if ((flags & I2C_CLIENT_PEC) && f7_msg->size != I2C_SMBUS_QUICK) { + cr1 |= STM32F7_I2C_CR1_PECEN; +- cr2 |= STM32F7_I2C_CR2_PECBYTE; +- if (!f7_msg->read_write) ++ if (!f7_msg->read_write) { ++ cr2 |= STM32F7_I2C_CR2_PECBYTE; + f7_msg->count++; ++ } + } else { + cr1 &= ~STM32F7_I2C_CR1_PECEN; + cr2 &= ~STM32F7_I2C_CR2_PECBYTE; +@@ -1149,8 +1150,10 @@ static void stm32f7_i2c_smbus_rep_start(struct stm32f7_i2c_dev *i2c_dev) + f7_msg->stop = true; + + /* Add one byte for PEC if needed */ +- if (cr1 & STM32F7_I2C_CR1_PECEN) ++ if (cr1 & STM32F7_I2C_CR1_PECEN) { ++ cr2 |= STM32F7_I2C_CR2_PECBYTE; + f7_msg->count++; ++ } + + /* Set number of bytes to be transferred */ + cr2 &= ~(STM32F7_I2C_CR2_NBYTES_MASK); +diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c +index 8e8688e8de0fb..45a3f7e7b3f68 100644 +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c +@@ -61,7 +61,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne + if (ret) + goto err; + +- adap = of_find_i2c_adapter_by_node(priv->chan[new_chan].parent_np); ++ adap = of_get_i2c_adapter_by_node(priv->chan[new_chan].parent_np); + if (!adap) { + ret = -ENODEV; + goto err_with_revert; +diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c +index 33024acaac02b..0ebc12575081c 100644 +--- a/drivers/i2c/muxes/i2c-mux-gpmux.c ++++ b/drivers/i2c/muxes/i2c-mux-gpmux.c +@@ -52,7 +52,7 @@ static struct i2c_adapter *mux_parent_adapter(struct device *dev) + dev_err(dev, "Cannot parse i2c-parent\n"); + return ERR_PTR(-ENODEV); + } +- parent = of_find_i2c_adapter_by_node(parent_np); ++ parent = of_get_i2c_adapter_by_node(parent_np); + of_node_put(parent_np); + if (!parent) + return ERR_PTR(-EPROBE_DEFER); +diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c +index d5ad904756fdf..f0bc4f3994817 100644 +--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c ++++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c +@@ -62,7 +62,7 @@ static struct i2c_adapter *i2c_mux_pinctrl_parent_adapter(struct device *dev) + dev_err(dev, "Cannot parse i2c-parent\n"); + return ERR_PTR(-ENODEV); + } +- parent = of_find_i2c_adapter_by_node(parent_np); ++ parent = of_get_i2c_adapter_by_node(parent_np); + of_node_put(parent_np); + if (!parent) + return ERR_PTR(-EPROBE_DEFER); +diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c +index cff1ba57fb16a..43c8af41b4a9d 100644 +--- a/drivers/iio/adc/exynos_adc.c ++++ b/drivers/iio/adc/exynos_adc.c +@@ -826,16 +826,26 @@ static int exynos_adc_probe(struct platform_device *pdev) + } + } + ++ /* leave out any TS related code if unreachable */ ++ if (IS_REACHABLE(CONFIG_INPUT)) { ++ has_ts = of_property_read_bool(pdev->dev.of_node, ++ "has-touchscreen") || pdata; ++ } ++ + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + info->irq = irq; + +- irq = platform_get_irq(pdev, 1); +- if (irq == -EPROBE_DEFER) +- return irq; ++ if (has_ts) { ++ irq = platform_get_irq(pdev, 1); ++ if (irq == -EPROBE_DEFER) ++ return irq; + +- info->tsirq = irq; ++ info->tsirq = irq; ++ } else { ++ info->tsirq = -1; ++ } + + info->dev = &pdev->dev; + +@@ -900,12 +910,6 @@ static int exynos_adc_probe(struct platform_device *pdev) + if (info->data->init_hw) + info->data->init_hw(info); + +- /* leave out any TS related code if unreachable */ +- if (IS_REACHABLE(CONFIG_INPUT)) { +- has_ts = of_property_read_bool(pdev->dev.of_node, +- "has-touchscreen") || pdata; +- } +- + if (pdata) + info->delay = pdata->delay; + else +diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c +index 292f2892d223a..abb8891b9e82d 100644 +--- a/drivers/iio/adc/xilinx-xadc-core.c ++++ b/drivers/iio/adc/xilinx-xadc-core.c +@@ -456,6 +456,9 @@ static const struct xadc_ops xadc_zynq_ops = { + .interrupt_handler = xadc_zynq_interrupt_handler, + .update_alarm = xadc_zynq_update_alarm, + .type = XADC_TYPE_S7, ++ /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ ++ .temp_scale = 503975, ++ .temp_offset = 273150, + }; + + static const unsigned int xadc_axi_reg_offsets[] = { +@@ -566,6 +569,9 @@ static const struct xadc_ops xadc_7s_axi_ops = { + .interrupt_handler = xadc_axi_interrupt_handler, + .flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL, + .type = XADC_TYPE_S7, ++ /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ ++ .temp_scale = 503975, ++ .temp_offset = 273150, + }; + + static const struct xadc_ops xadc_us_axi_ops = { +@@ -577,6 +583,12 @@ static const struct xadc_ops xadc_us_axi_ops = { + .interrupt_handler = xadc_axi_interrupt_handler, + .flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL, + .type = XADC_TYPE_US, ++ /** ++ * Values below are for UltraScale+ (SYSMONE4) using internal reference. ++ * See https://docs.xilinx.com/v/u/en-US/ug580-ultrascale-sysmon ++ */ ++ .temp_scale = 509314, ++ .temp_offset = 280231, + }; + + static int _xadc_update_adc_reg(struct xadc *xadc, unsigned int reg, +@@ -948,8 +960,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, + *val2 = bits; + return IIO_VAL_FRACTIONAL_LOG2; + case IIO_TEMP: +- /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ +- *val = 503975; ++ *val = xadc->ops->temp_scale; + *val2 = bits; + return IIO_VAL_FRACTIONAL_LOG2; + default: +@@ -957,7 +968,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, + } + case IIO_CHAN_INFO_OFFSET: + /* Only the temperature channel has an offset */ +- *val = -((273150 << bits) / 503975); ++ *val = -((xadc->ops->temp_offset << bits) / xadc->ops->temp_scale); + return IIO_VAL_INT; + case IIO_CHAN_INFO_SAMP_FREQ: + ret = xadc_read_samplerate(xadc); +@@ -1426,28 +1437,6 @@ static int xadc_probe(struct platform_device *pdev) + if (ret) + return ret; + +- /* Disable all alarms */ +- ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK, +- XADC_CONF1_ALARM_MASK); +- if (ret) +- return ret; +- +- /* Set thresholds to min/max */ +- for (i = 0; i < 16; i++) { +- /* +- * Set max voltage threshold and both temperature thresholds to +- * 0xffff, min voltage threshold to 0. +- */ +- if (i % 8 < 4 || i == 7) +- xadc->threshold[i] = 0xffff; +- else +- xadc->threshold[i] = 0; +- ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i), +- xadc->threshold[i]); +- if (ret) +- return ret; +- } +- + /* Go to non-buffered mode */ + xadc_postdisable(indio_dev); + +diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h +index 7d78ce6989671..3036f4d613ff5 100644 +--- a/drivers/iio/adc/xilinx-xadc.h ++++ b/drivers/iio/adc/xilinx-xadc.h +@@ -85,6 +85,8 @@ struct xadc_ops { + + unsigned int flags; + enum xadc_type type; ++ int temp_scale; ++ int temp_offset; + }; + + static inline int _xadc_read_adc_reg(struct xadc *xadc, unsigned int reg, +diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c +index 1f280c360701b..56e5913ab82d1 100644 +--- a/drivers/iio/afe/iio-rescale.c ++++ b/drivers/iio/afe/iio-rescale.c +@@ -214,8 +214,18 @@ static int rescale_read_raw(struct iio_dev *indio_dev, + return ret < 0 ? ret : -EOPNOTSUPP; + } + +- ret = iio_read_channel_scale(rescale->source, &scale, &scale2); +- return rescale_process_offset(rescale, ret, scale, scale2, ++ if (iio_channel_has_info(rescale->source->channel, ++ IIO_CHAN_INFO_SCALE)) { ++ ret = iio_read_channel_scale(rescale->source, &scale, &scale2); ++ return rescale_process_offset(rescale, ret, scale, scale2, ++ schan_off, val, val2); ++ } ++ ++ /* ++ * If we get here we have no scale so scale 1:1 but apply ++ * rescaler and offset, if any. ++ */ ++ return rescale_process_offset(rescale, IIO_VAL_FRACTIONAL, 1, 1, + schan_off, val, val2); + default: + return -EINVAL; +@@ -280,8 +290,9 @@ static int rescale_configure_channel(struct device *dev, + chan->type = rescale->cfg->type; + + if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) && +- iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE)) { +- dev_info(dev, "using raw+scale source channel\n"); ++ (iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE) || ++ iio_channel_has_info(schan, IIO_CHAN_INFO_OFFSET))) { ++ dev_info(dev, "using raw+scale/offset source channel\n"); + } else if (iio_channel_has_info(schan, IIO_CHAN_INFO_PROCESSED)) { + dev_info(dev, "using processed channel\n"); + rescale->chan_processed = true; +diff --git a/drivers/mcb/mcb-lpc.c b/drivers/mcb/mcb-lpc.c +index 53decd89876ee..a851e02364642 100644 +--- a/drivers/mcb/mcb-lpc.c ++++ b/drivers/mcb/mcb-lpc.c +@@ -23,7 +23,7 @@ static int mcb_lpc_probe(struct platform_device *pdev) + { + struct resource *res; + struct priv *priv; +- int ret = 0; ++ int ret = 0, table_size; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -58,16 +58,43 @@ static int mcb_lpc_probe(struct platform_device *pdev) + + ret = chameleon_parse_cells(priv->bus, priv->mem->start, priv->base); + if (ret < 0) { +- mcb_release_bus(priv->bus); +- return ret; ++ goto out_mcb_bus; + } + +- dev_dbg(&pdev->dev, "Found %d cells\n", ret); ++ table_size = ret; ++ ++ if (table_size < CHAM_HEADER_SIZE) { ++ /* Release the previous resources */ ++ devm_iounmap(&pdev->dev, priv->base); ++ devm_release_mem_region(&pdev->dev, priv->mem->start, resource_size(priv->mem)); ++ ++ /* Then, allocate it again with the actual chameleon table size */ ++ res = devm_request_mem_region(&pdev->dev, priv->mem->start, ++ table_size, ++ KBUILD_MODNAME); ++ if (!res) { ++ dev_err(&pdev->dev, "Failed to request PCI memory\n"); ++ ret = -EBUSY; ++ goto out_mcb_bus; ++ } ++ ++ priv->base = devm_ioremap(&pdev->dev, priv->mem->start, table_size); ++ if (!priv->base) { ++ dev_err(&pdev->dev, "Cannot ioremap\n"); ++ ret = -ENOMEM; ++ goto out_mcb_bus; ++ } ++ ++ platform_set_drvdata(pdev, priv); ++ } + + mcb_bus_add_devices(priv->bus); + + return 0; + ++out_mcb_bus: ++ mcb_release_bus(priv->bus); ++ return ret; + } + + static int mcb_lpc_remove(struct platform_device *pdev) +diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c +index c41cbacc75a2c..656b6b71c7682 100644 +--- a/drivers/mcb/mcb-parse.c ++++ b/drivers/mcb/mcb-parse.c +@@ -128,7 +128,7 @@ static void chameleon_parse_bar(void __iomem *base, + } + } + +-static int chameleon_get_bar(char __iomem **base, phys_addr_t mapbase, ++static int chameleon_get_bar(void __iomem **base, phys_addr_t mapbase, + struct chameleon_bar **cb) + { + struct chameleon_bar *c; +@@ -177,12 +177,13 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase, + { + struct chameleon_fpga_header *header; + struct chameleon_bar *cb; +- char __iomem *p = base; ++ void __iomem *p = base; + int num_cells = 0; + uint32_t dtype; + int bar_count; + int ret; + u32 hsize; ++ u32 table_size; + + hsize = sizeof(struct chameleon_fpga_header); + +@@ -237,12 +238,16 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase, + num_cells++; + } + +- if (num_cells == 0) +- num_cells = -EINVAL; ++ if (num_cells == 0) { ++ ret = -EINVAL; ++ goto free_bar; ++ } + ++ table_size = p - base; ++ pr_debug("%d cell(s) found. Chameleon table size: 0x%04x bytes\n", num_cells, table_size); + kfree(cb); + kfree(header); +- return num_cells; ++ return table_size; + + free_bar: + kfree(cb); +diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c +index 4c51d216f3d43..cc57cc8204328 100644 +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -903,6 +903,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) + if (err) + return err; + ++ memset(ctx->buf->virt, 0, pkt_size); + rpra = ctx->buf->virt; + list = fastrpc_invoke_buf_start(rpra, ctx->nscalars); + pages = fastrpc_phy_page_start(list, ctx->nscalars); +@@ -1035,6 +1036,7 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx, + } + } + ++ /* Clean up fdlist which is updated by DSP */ + for (i = 0; i < FASTRPC_MAX_FDLIST; i++) { + if (!fdlist[i]) + break; +@@ -1099,11 +1101,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, + if (IS_ERR(ctx)) + return PTR_ERR(ctx); + +- if (ctx->nscalars) { +- err = fastrpc_get_args(kernel, ctx); +- if (err) +- goto bail; +- } ++ err = fastrpc_get_args(kernel, ctx); ++ if (err) ++ goto bail; + + /* make sure that all CPU memory writes are seen by DSP */ + dma_wmb(); +@@ -1119,6 +1119,13 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, + err = wait_for_completion_interruptible(&ctx->work); + } + ++ if (err) ++ goto bail; ++ ++ /* make sure that all memory writes by DSP are seen by CPU */ ++ dma_rmb(); ++ /* populate all the output buffers with results */ ++ err = fastrpc_put_args(ctx, kernel); + if (err) + goto bail; + +@@ -1127,15 +1134,6 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, + if (err) + goto bail; + +- if (ctx->nscalars) { +- /* make sure that all memory writes by DSP are seen by CPU */ +- dma_rmb(); +- /* populate all the output buffers with results */ +- err = fastrpc_put_args(ctx, kernel); +- if (err) +- goto bail; +- } +- + bail: + if (err != -ERESTARTSYS && err != -ETIMEDOUT) { + /* We are done with this compute context */ +@@ -1785,11 +1783,13 @@ static int fastrpc_req_mem_unmap_impl(struct fastrpc_user *fl, struct fastrpc_me + sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_MEM_UNMAP, 1, 0); + err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, + &args[0]); +- fastrpc_map_put(map); +- if (err) ++ if (err) { + dev_err(dev, "unmmap\tpt fd = %d, 0x%09llx error\n", map->fd, map->raddr); ++ return err; ++ } ++ fastrpc_map_put(map); + +- return err; ++ return 0; + } + + static int fastrpc_req_mem_unmap(struct fastrpc_user *fl, char __user *argp) +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c +index cdd7f126d4aea..1fc6767f18782 100644 +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -180,6 +180,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, + int recovery_mode, + struct mmc_queue *mq); + static void mmc_blk_hsq_req_done(struct mmc_request *mrq); ++static int mmc_spi_err_check(struct mmc_card *card); ++static int mmc_blk_busy_cb(void *cb_data, bool *busy); + + static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) + { +@@ -471,6 +473,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, + struct mmc_data data = {}; + struct mmc_request mrq = {}; + struct scatterlist sg; ++ bool r1b_resp; ++ unsigned int busy_timeout_ms; + int err; + unsigned int target_part; + +@@ -559,6 +563,12 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, + (cmd.opcode == MMC_SWITCH)) + return mmc_sanitize(card, idata->ic.cmd_timeout_ms); + ++ /* If it's an R1B response we need some more preparations. */ ++ busy_timeout_ms = idata->ic.cmd_timeout_ms ? : MMC_BLK_TIMEOUT_MS; ++ r1b_resp = (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B; ++ if (r1b_resp) ++ mmc_prepare_busy_cmd(card->host, &cmd, busy_timeout_ms); ++ + mmc_wait_for_req(card->host, &mrq); + memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); + +@@ -610,13 +620,27 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, + if (idata->ic.postsleep_min_us) + usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); + +- if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { +- /* +- * Ensure RPMB/R1B command has completed by polling CMD13 "Send Status". Here we +- * allow to override the default timeout value if a custom timeout is specified. +- */ +- err = mmc_poll_for_busy(card, idata->ic.cmd_timeout_ms ? : MMC_BLK_TIMEOUT_MS, +- false, MMC_BUSY_IO); ++ if (mmc_host_is_spi(card->host)) { ++ if (idata->ic.write_flag || r1b_resp || cmd.flags & MMC_RSP_SPI_BUSY) ++ return mmc_spi_err_check(card); ++ return err; ++ } ++ ++ /* ++ * Ensure RPMB, writes and R1B responses are completed by polling with ++ * CMD13. Note that, usually we don't need to poll when using HW busy ++ * detection, but here it's needed since some commands may indicate the ++ * error through the R1 status bits. ++ */ ++ if (idata->rpmb || idata->ic.write_flag || r1b_resp) { ++ struct mmc_blk_busy_data cb_data = { ++ .card = card, ++ }; ++ ++ err = __mmc_poll_for_busy(card->host, 0, busy_timeout_ms, ++ &mmc_blk_busy_cb, &cb_data); ++ ++ idata->ic.response[0] = cb_data.status; + } + + return err; +diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c +index 81c55bfd6e0c2..3b3adbddf6641 100644 +--- a/drivers/mmc/core/mmc_ops.c ++++ b/drivers/mmc/core/mmc_ops.c +@@ -575,6 +575,7 @@ bool mmc_prepare_busy_cmd(struct mmc_host *host, struct mmc_command *cmd, + cmd->busy_timeout = timeout_ms; + return true; + } ++EXPORT_SYMBOL_GPL(mmc_prepare_busy_cmd); + + /** + * __mmc_switch - modify EXT_CSD register +diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c +index ed2863ed6a5bb..7474afc0e8e73 100644 +--- a/drivers/net/ethernet/adi/adin1110.c ++++ b/drivers/net/ethernet/adi/adin1110.c +@@ -294,7 +294,7 @@ static int adin1110_read_fifo(struct adin1110_port_priv *port_priv) + { + struct adin1110_priv *priv = port_priv->priv; + u32 header_len = ADIN1110_RD_HEADER_LEN; +- struct spi_transfer t; ++ struct spi_transfer t = {0}; + u32 frame_size_no_fcs; + struct sk_buff *rxb; + u32 frame_size; +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index a81f918091ccf..7d4cc4eafd59e 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -580,7 +580,6 @@ struct i40e_pf { + #define I40E_FLAG_DISABLE_FW_LLDP BIT(24) + #define I40E_FLAG_RS_FEC BIT(25) + #define I40E_FLAG_BASE_R_FEC BIT(26) +-#define I40E_FLAG_VF_VLAN_PRUNING BIT(27) + /* TOTAL_PORT_SHUTDOWN + * Allows to physically disable the link on the NIC's port. + * If enabled, (after link down request from the OS) +@@ -603,6 +602,7 @@ struct i40e_pf { + * in abilities field of i40e_aq_set_phy_config structure + */ + #define I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED BIT(27) ++#define I40E_FLAG_VF_VLAN_PRUNING BIT(28) + + struct i40e_client_instance *cinst; + bool stat_offsets_loaded; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +index 494775d65bf28..6d26ee8eefae9 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +@@ -2770,7 +2770,7 @@ tx_only: + return budget; + } + +- if (vsi->back->flags & I40E_TXR_FLAGS_WB_ON_ITR) ++ if (q_vector->tx.ring[0].flags & I40E_TXR_FLAGS_WB_ON_ITR) + q_vector->arm_wb_state = false; + + /* Exit the polling mode, but don't re-enable interrupts if stack might +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index a39f7f0d6ab0b..326bb5fdf5f90 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -1449,9 +1449,9 @@ void iavf_down(struct iavf_adapter *adapter) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; + if (!list_empty(&adapter->adv_rss_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; +- adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES; + } + ++ adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES; + mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0); + } + +@@ -5020,8 +5020,6 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + INIT_WORK(&adapter->finish_config, iavf_finish_config); + INIT_DELAYED_WORK(&adapter->watchdog_task, iavf_watchdog_task); + INIT_DELAYED_WORK(&adapter->client_task, iavf_client_task); +- queue_delayed_work(adapter->wq, &adapter->watchdog_task, +- msecs_to_jiffies(5 * (pdev->devfn & 0x07))); + + /* Setup the wait queue for indicating transition to down status */ + init_waitqueue_head(&adapter->down_waitqueue); +@@ -5032,6 +5030,9 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + /* Setup the wait queue for indicating virtchannel events */ + init_waitqueue_head(&adapter->vc_waitqueue); + ++ queue_delayed_work(adapter->wq, &adapter->watchdog_task, ++ msecs_to_jiffies(5 * (pdev->devfn & 0x07))); ++ /* Initialization goes on in the work. Do not add more of it below. */ + return 0; + + err_ioremap: +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 96fa1c420f910..ceff537d9d22d 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -2978,11 +2978,15 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter, + if (err) + goto err_out_w_lock; + +- igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx); ++ err = igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx); ++ if (err) ++ goto err_out_input_filter; + + spin_unlock(&adapter->nfc_lock); + return 0; + ++err_out_input_filter: ++ igb_erase_filter(adapter, input); + err_out_w_lock: + spin_unlock(&adapter->nfc_lock); + err_out: +diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c +index e23b95edb05ef..81897f7a90a91 100644 +--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c ++++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c +@@ -1817,7 +1817,7 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev, + struct igc_adapter *adapter = netdev_priv(netdev); + struct net_device *dev = adapter->netdev; + struct igc_hw *hw = &adapter->hw; +- u32 advertising; ++ u16 advertised = 0; + + /* When adapter in resetting mode, autoneg/speed/duplex + * cannot be changed +@@ -1842,18 +1842,33 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev, + while (test_and_set_bit(__IGC_RESETTING, &adapter->state)) + usleep_range(1000, 2000); + +- ethtool_convert_link_mode_to_legacy_u32(&advertising, +- cmd->link_modes.advertising); +- /* Converting to legacy u32 drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT. +- * We have to check this and convert it to ADVERTISE_2500_FULL +- * (aka ETHTOOL_LINK_MODE_2500baseX_Full_BIT) explicitly. +- */ +- if (ethtool_link_ksettings_test_link_mode(cmd, advertising, 2500baseT_Full)) +- advertising |= ADVERTISE_2500_FULL; ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 2500baseT_Full)) ++ advertised |= ADVERTISE_2500_FULL; ++ ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 1000baseT_Full)) ++ advertised |= ADVERTISE_1000_FULL; ++ ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 100baseT_Full)) ++ advertised |= ADVERTISE_100_FULL; ++ ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 100baseT_Half)) ++ advertised |= ADVERTISE_100_HALF; ++ ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 10baseT_Full)) ++ advertised |= ADVERTISE_10_FULL; ++ ++ if (ethtool_link_ksettings_test_link_mode(cmd, advertising, ++ 10baseT_Half)) ++ advertised |= ADVERTISE_10_HALF; + + if (cmd->base.autoneg == AUTONEG_ENABLE) { + hw->mac.autoneg = 1; +- hw->phy.autoneg_advertised = advertising; ++ hw->phy.autoneg_advertised = advertised; + if (adapter->fc_autoneg) + hw->fc.requested_mode = igc_fc_default; + } else { +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index a9a0dca0c0305..80b6079b8a8e3 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4343,7 +4343,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp, + unsigned int entry = dirty_tx % NUM_TX_DESC; + u32 status; + +- status = le32_to_cpu(tp->TxDescArray[entry].opts1); ++ status = le32_to_cpu(READ_ONCE(tp->TxDescArray[entry].opts1)); + if (status & DescOwn) + break; + +@@ -4380,7 +4380,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp, + * If skb is NULL then we come here again once a tx irq is + * triggered after the last fragment is marked transmitted. + */ +- if (tp->cur_tx != dirty_tx && skb) ++ if (READ_ONCE(tp->cur_tx) != dirty_tx && skb) + rtl8169_doorbell(tp); + } + } +@@ -4413,7 +4413,7 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, int budget + dma_addr_t addr; + u32 status; + +- status = le32_to_cpu(desc->opts1); ++ status = le32_to_cpu(READ_ONCE(desc->opts1)); + if (status & DescOwn) + break; + +diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +index dc14a66583ff3..44488c153ea25 100644 +--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c ++++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +@@ -1217,7 +1217,7 @@ static int gelic_wl_set_encodeext(struct net_device *netdev, + key_index = wl->current_key; + + if (!enc->length && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { +- /* reques to change default key index */ ++ /* request to change default key index */ + pr_debug("%s: request to change default key to %d\n", + __func__, key_index); + wl->current_key = key_index; +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c +index acb20ad4e37eb..477b4d4f860bd 100644 +--- a/drivers/net/gtp.c ++++ b/drivers/net/gtp.c +@@ -871,8 +871,9 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, + + skb_dst_update_pmtu_no_confirm(skb, mtu); + +- if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && +- mtu < ntohs(iph->tot_len)) { ++ if (iph->frag_off & htons(IP_DF) && ++ ((!skb_is_gso(skb) && skb->len > mtu) || ++ (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)))) { + netdev_dbg(dev, "packet too big, fragmentation needed\n"); + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); +diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c +index 5cf218c674a5a..32d92bdabd234 100644 +--- a/drivers/net/ieee802154/adf7242.c ++++ b/drivers/net/ieee802154/adf7242.c +@@ -1162,9 +1162,10 @@ static int adf7242_stats_show(struct seq_file *file, void *offset) + + static void adf7242_debugfs_init(struct adf7242_local *lp) + { +- char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "adf7242-"; ++ char debugfs_dir_name[DNAME_INLINE_LEN + 1]; + +- strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN); ++ snprintf(debugfs_dir_name, sizeof(debugfs_dir_name), ++ "adf7242-%s", dev_name(&lp->spi->dev)); + + lp->debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL); + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index fc1458f96e170..c34974f7dfd26 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -1211,7 +1211,7 @@ int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) + + ret = usb_control_msg(tp->udev, tp->pipe_ctrl_in, + RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, +- value, index, tmp, size, 500); ++ value, index, tmp, size, USB_CTRL_GET_TIMEOUT); + if (ret < 0) + memset(data, 0xff, size); + else +@@ -1234,7 +1234,7 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) + + ret = usb_control_msg(tp->udev, tp->pipe_ctrl_out, + RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, +- value, index, tmp, size, 500); ++ value, index, tmp, size, USB_CTRL_SET_TIMEOUT); + + kfree(tmp); + +@@ -9549,7 +9549,8 @@ u8 rtl8152_get_version(struct usb_interface *intf) + + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, +- PLA_TCR0, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); ++ PLA_TCR0, MCU_TYPE_PLA, tmp, sizeof(*tmp), ++ USB_CTRL_GET_TIMEOUT); + if (ret > 0) + ocp_data = (__le32_to_cpu(*tmp) >> 16) & VERSION_MASK; + +@@ -9825,6 +9826,10 @@ static int rtl8152_probe(struct usb_interface *intf, + + out1: + tasklet_kill(&tp->tx_tl); ++ cancel_delayed_work_sync(&tp->hw_phy_work); ++ if (tp->rtl_ops.unload) ++ tp->rtl_ops.unload(tp); ++ rtl8152_release_firmware(tp); + usb_set_intfdata(intf, NULL); + out: + free_netdev(netdev); +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 17da42fe605c3..a530f20ee2575 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -95,7 +95,9 @@ static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, + ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN + | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, index, &buf, 4); +- if (ret < 0) { ++ if (ret < 4) { ++ ret = ret < 0 ? ret : -ENODATA; ++ + if (ret != -ENODEV) + netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n", + index, ret); +diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c +index 14284e866f26e..9590a864efd56 100644 +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -506,7 +506,7 @@ static const struct ocotp_params imx6sl_params = { + }; + + static const struct ocotp_params imx6sll_params = { +- .nregs = 128, ++ .nregs = 80, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, +@@ -520,14 +520,14 @@ static const struct ocotp_params imx6sx_params = { + }; + + static const struct ocotp_params imx6ul_params = { +- .nregs = 128, ++ .nregs = 144, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, + }; + + static const struct ocotp_params imx6ull_params = { +- .nregs = 64, ++ .nregs = 80, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, +diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +index a55998ae29fa4..bfcc5c45b8fa5 100644 +--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c ++++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +@@ -24,7 +24,8 @@ struct lpi_pinctrl { + char __iomem *tlmm_base; + char __iomem *slew_base; + struct clk_bulk_data clks[MAX_LPI_NUM_CLKS]; +- struct mutex slew_access_lock; ++ /* Protects from concurrent register updates */ ++ struct mutex lock; + const struct lpi_pinctrl_variant_data *data; + }; + +@@ -94,9 +95,11 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctldev, unsigned int function, + if (WARN_ON(i == g->nfuncs)) + return -EINVAL; + ++ mutex_lock(&pctrl->lock); + val = lpi_gpio_read(pctrl, pin, LPI_GPIO_CFG_REG); + u32p_replace_bits(&val, i, LPI_GPIO_FUNCTION_MASK); + lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); ++ mutex_unlock(&pctrl->lock); + + return 0; + } +@@ -202,14 +205,14 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, + if (slew_offset == LPI_NO_SLEW) + break; + +- mutex_lock(&pctrl->slew_access_lock); ++ mutex_lock(&pctrl->lock); + + sval = ioread32(pctrl->slew_base + LPI_SLEW_RATE_CTL_REG); + sval &= ~(LPI_SLEW_RATE_MASK << slew_offset); + sval |= arg << slew_offset; + iowrite32(sval, pctrl->slew_base + LPI_SLEW_RATE_CTL_REG); + +- mutex_unlock(&pctrl->slew_access_lock); ++ mutex_unlock(&pctrl->lock); + break; + default: + return -EINVAL; +@@ -225,6 +228,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, + lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val); + } + ++ mutex_lock(&pctrl->lock); + val = lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG); + + u32p_replace_bits(&val, pullup, LPI_GPIO_PULL_MASK); +@@ -233,6 +237,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, + u32p_replace_bits(&val, output_enabled, LPI_GPIO_OE_MASK); + + lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val); ++ mutex_unlock(&pctrl->lock); + + return 0; + } +@@ -432,7 +437,7 @@ int lpi_pinctrl_probe(struct platform_device *pdev) + pctrl->chip.of_gpio_n_cells = 2; + pctrl->chip.can_sleep = false; + +- mutex_init(&pctrl->slew_access_lock); ++ mutex_init(&pctrl->lock); + + pctrl->ctrl = devm_pinctrl_register(dev, &pctrl->desc, pctrl); + if (IS_ERR(pctrl->ctrl)) { +@@ -454,7 +459,7 @@ int lpi_pinctrl_probe(struct platform_device *pdev) + return 0; + + err_pinctrl: +- mutex_destroy(&pctrl->slew_access_lock); ++ mutex_destroy(&pctrl->lock); + clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); + + return ret; +@@ -466,7 +471,7 @@ int lpi_pinctrl_remove(struct platform_device *pdev) + struct lpi_pinctrl *pctrl = platform_get_drvdata(pdev); + int i; + +- mutex_destroy(&pctrl->slew_access_lock); ++ mutex_destroy(&pctrl->lock); + clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); + + for (i = 0; i < pctrl->data->npins; i++) +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index e7ece2738de94..3bb60687f2e42 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -4513,6 +4513,79 @@ static const struct dmi_system_id fwbug_list[] __initconst = { + DMI_MATCH(DMI_PRODUCT_NAME, "21A1"), + } + }, ++ /* https://bugzilla.kernel.org/show_bug.cgi?id=218024 */ ++ { ++ .ident = "V14 G4 AMN", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82YT"), ++ } ++ }, ++ { ++ .ident = "V14 G4 AMN", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "83GE"), ++ } ++ }, ++ { ++ .ident = "V15 G4 AMN", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82YU"), ++ } ++ }, ++ { ++ .ident = "V15 G4 AMN", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "83CQ"), ++ } ++ }, ++ { ++ .ident = "IdeaPad 1 14AMN7", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82VF"), ++ } ++ }, ++ { ++ .ident = "IdeaPad 1 15AMN7", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82VG"), ++ } ++ }, ++ { ++ .ident = "IdeaPad 1 15AMN7", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82X5"), ++ } ++ }, ++ { ++ .ident = "IdeaPad Slim 3 14AMN8", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82XN"), ++ } ++ }, ++ { ++ .ident = "IdeaPad Slim 3 15AMN8", ++ .driver_data = &quirk_s2idle_bug, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"), ++ } ++ }, + {} + }; + +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 30184f7b762c1..deed8c909a786 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -221,7 +221,8 @@ manage_start_stop_show(struct device *dev, + + return sysfs_emit(buf, "%u\n", + sdp->manage_system_start_stop && +- sdp->manage_runtime_start_stop); ++ sdp->manage_runtime_start_stop && ++ sdp->manage_shutdown); + } + static DEVICE_ATTR_RO(manage_start_stop); + +@@ -287,6 +288,35 @@ manage_runtime_start_stop_store(struct device *dev, + } + static DEVICE_ATTR_RW(manage_runtime_start_stop); + ++static ssize_t manage_shutdown_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct scsi_disk *sdkp = to_scsi_disk(dev); ++ struct scsi_device *sdp = sdkp->device; ++ ++ return sysfs_emit(buf, "%u\n", sdp->manage_shutdown); ++} ++ ++static ssize_t manage_shutdown_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct scsi_disk *sdkp = to_scsi_disk(dev); ++ struct scsi_device *sdp = sdkp->device; ++ bool v; ++ ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EACCES; ++ ++ if (kstrtobool(buf, &v)) ++ return -EINVAL; ++ ++ sdp->manage_shutdown = v; ++ ++ return count; ++} ++static DEVICE_ATTR_RW(manage_shutdown); ++ + static ssize_t + allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf) + { +@@ -619,6 +649,7 @@ static struct attribute *sd_disk_attrs[] = { + &dev_attr_manage_start_stop.attr, + &dev_attr_manage_system_start_stop.attr, + &dev_attr_manage_runtime_start_stop.attr, ++ &dev_attr_manage_shutdown.attr, + &dev_attr_protection_type.attr, + &dev_attr_protection_mode.attr, + &dev_attr_app_tag_own.attr, +@@ -3700,8 +3731,10 @@ static void sd_shutdown(struct device *dev) + sd_sync_cache(sdkp, NULL); + } + +- if (system_state != SYSTEM_RESTART && +- sdkp->device->manage_system_start_stop) { ++ if ((system_state != SYSTEM_RESTART && ++ sdkp->device->manage_system_start_stop) || ++ (system_state == SYSTEM_POWER_OFF && ++ sdkp->device->manage_shutdown)) { + sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); + sd_start_stop_device(sdkp, 0); + } +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c +index 1a059b028c501..2eea080298812 100644 +--- a/drivers/vhost/vhost.c ++++ b/drivers/vhost/vhost.c +@@ -1176,9 +1176,7 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, + goto done; + } + +- if ((msg.type == VHOST_IOTLB_UPDATE || +- msg.type == VHOST_IOTLB_INVALIDATE) && +- msg.size == 0) { ++ if (msg.type == VHOST_IOTLB_UPDATE && msg.size == 0) { + ret = -EINVAL; + goto done; + } +diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c +index 3f78a3a1eb753..aa90bd0199d7e 100644 +--- a/drivers/virtio/virtio_balloon.c ++++ b/drivers/virtio/virtio_balloon.c +@@ -395,7 +395,11 @@ static inline s64 towards_target(struct virtio_balloon *vb) + virtio_cread_le(vb->vdev, struct virtio_balloon_config, num_pages, + &num_pages); + +- target = num_pages; ++ /* ++ * Aligned up to guest page size to avoid inflating and deflating ++ * balloon endlessly. ++ */ ++ target = ALIGN(num_pages, VIRTIO_BALLOON_PAGES_PER_PAGE); + return target - vb->num_pages; + } + +diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c +index dec3cba884586..de1a081089417 100644 +--- a/drivers/virtio/virtio_mmio.c ++++ b/drivers/virtio/virtio_mmio.c +@@ -614,14 +614,17 @@ static int virtio_mmio_probe(struct platform_device *pdev) + spin_lock_init(&vm_dev->lock); + + vm_dev->base = devm_platform_ioremap_resource(pdev, 0); +- if (IS_ERR(vm_dev->base)) +- return PTR_ERR(vm_dev->base); ++ if (IS_ERR(vm_dev->base)) { ++ rc = PTR_ERR(vm_dev->base); ++ goto free_vm_dev; ++ } + + /* Check magic value */ + magic = readl(vm_dev->base + VIRTIO_MMIO_MAGIC_VALUE); + if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) { + dev_warn(&pdev->dev, "Wrong magic value 0x%08lx!\n", magic); +- return -ENODEV; ++ rc = -ENODEV; ++ goto free_vm_dev; + } + + /* Check device version */ +@@ -629,7 +632,8 @@ static int virtio_mmio_probe(struct platform_device *pdev) + if (vm_dev->version < 1 || vm_dev->version > 2) { + dev_err(&pdev->dev, "Version %ld not supported!\n", + vm_dev->version); +- return -ENXIO; ++ rc = -ENXIO; ++ goto free_vm_dev; + } + + vm_dev->vdev.id.device = readl(vm_dev->base + VIRTIO_MMIO_DEVICE_ID); +@@ -638,7 +642,8 @@ static int virtio_mmio_probe(struct platform_device *pdev) + * virtio-mmio device with an ID 0 is a (dummy) placeholder + * with no function. End probing now with no error reported. + */ +- return -ENODEV; ++ rc = -ENODEV; ++ goto free_vm_dev; + } + vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID); + +@@ -668,6 +673,10 @@ static int virtio_mmio_probe(struct platform_device *pdev) + put_device(&vm_dev->vdev.dev); + + return rc; ++ ++free_vm_dev: ++ kfree(vm_dev); ++ return rc; + } + + static int virtio_mmio_remove(struct platform_device *pdev) +diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c +index 869cb46bef960..ccdd41935ed71 100644 +--- a/drivers/virtio/virtio_pci_modern_dev.c ++++ b/drivers/virtio/virtio_pci_modern_dev.c +@@ -282,7 +282,7 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev) + err = -EINVAL; + mdev->common = vp_modern_map_capability(mdev, common, + sizeof(struct virtio_pci_common_cfg), 4, +- 0, sizeof(struct virtio_pci_common_cfg), ++ 0, sizeof(struct virtio_pci_modern_common_cfg), + NULL, NULL); + if (!mdev->common) + goto err_map_common; +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index 3c8300e08f412..6ea6b7105fe35 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -4022,8 +4022,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, + struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); + struct ext4_super_block *es = sbi->s_es; + int bsbits, max; +- ext4_lblk_t end; +- loff_t size, start_off; ++ loff_t size, start_off, end; + loff_t orig_size __maybe_unused; + ext4_lblk_t start; + struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); +@@ -4052,7 +4051,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, + + /* first, let's learn actual file size + * given current request is allocated */ +- size = ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); ++ size = extent_logical_end(sbi, &ac->ac_o_ex); + size = size << bsbits; + if (size < i_size_read(ac->ac_inode)) + size = i_size_read(ac->ac_inode); +@@ -4131,7 +4130,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, + /* check we don't cross already preallocated blocks */ + rcu_read_lock(); + list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { +- ext4_lblk_t pa_end; ++ loff_t pa_end; + + if (pa->pa_deleted) + continue; +@@ -4141,8 +4140,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, + continue; + } + +- pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb), +- pa->pa_len); ++ pa_end = pa_logical_end(EXT4_SB(ac->ac_sb), pa); + + /* PA must not overlap original request */ + BUG_ON(!(ac->ac_o_ex.fe_logical >= pa_end || +@@ -4171,12 +4169,11 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, + /* XXX: extra loop to check we really don't overlap preallocations */ + rcu_read_lock(); + list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { +- ext4_lblk_t pa_end; ++ loff_t pa_end; + + spin_lock(&pa->pa_lock); + if (pa->pa_deleted == 0) { +- pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb), +- pa->pa_len); ++ pa_end = pa_logical_end(EXT4_SB(ac->ac_sb), pa); + BUG_ON(!(start >= pa_end || end <= pa->pa_lstart)); + } + spin_unlock(&pa->pa_lock); +@@ -4407,8 +4404,7 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) + /* all fields in this condition don't change, + * so we can skip locking for them */ + if (ac->ac_o_ex.fe_logical < pa->pa_lstart || +- ac->ac_o_ex.fe_logical >= (pa->pa_lstart + +- EXT4_C2B(sbi, pa->pa_len))) ++ ac->ac_o_ex.fe_logical >= pa_logical_end(sbi, pa)) + continue; + + /* non-extent files can't have physical blocks past 2^32 */ +@@ -4653,8 +4649,11 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) + pa = ac->ac_pa; + + if (ac->ac_b_ex.fe_len < ac->ac_g_ex.fe_len) { +- int new_bex_start; +- int new_bex_end; ++ struct ext4_free_extent ex = { ++ .fe_logical = ac->ac_g_ex.fe_logical, ++ .fe_len = ac->ac_g_ex.fe_len, ++ }; ++ loff_t orig_goal_end = extent_logical_end(sbi, &ex); + + /* we can't allocate as much as normalizer wants. + * so, found space must get proper lstart +@@ -4673,29 +4672,23 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) + * still cover original start + * 3. Else, keep the best ex at start of original request. + */ +- new_bex_end = ac->ac_g_ex.fe_logical + +- EXT4_C2B(sbi, ac->ac_g_ex.fe_len); +- new_bex_start = new_bex_end - EXT4_C2B(sbi, ac->ac_b_ex.fe_len); +- if (ac->ac_o_ex.fe_logical >= new_bex_start) +- goto adjust_bex; ++ ex.fe_len = ac->ac_b_ex.fe_len; + +- new_bex_start = ac->ac_g_ex.fe_logical; +- new_bex_end = +- new_bex_start + EXT4_C2B(sbi, ac->ac_b_ex.fe_len); +- if (ac->ac_o_ex.fe_logical < new_bex_end) ++ ex.fe_logical = orig_goal_end - EXT4_C2B(sbi, ex.fe_len); ++ if (ac->ac_o_ex.fe_logical >= ex.fe_logical) + goto adjust_bex; + +- new_bex_start = ac->ac_o_ex.fe_logical; +- new_bex_end = +- new_bex_start + EXT4_C2B(sbi, ac->ac_b_ex.fe_len); ++ ex.fe_logical = ac->ac_g_ex.fe_logical; ++ if (ac->ac_o_ex.fe_logical < extent_logical_end(sbi, &ex)) ++ goto adjust_bex; + ++ ex.fe_logical = ac->ac_o_ex.fe_logical; + adjust_bex: +- ac->ac_b_ex.fe_logical = new_bex_start; ++ ac->ac_b_ex.fe_logical = ex.fe_logical; + + BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); + BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); +- BUG_ON(new_bex_end > (ac->ac_g_ex.fe_logical + +- EXT4_C2B(sbi, ac->ac_g_ex.fe_len))); ++ BUG_ON(extent_logical_end(sbi, &ex) > orig_goal_end); + } + + /* preallocation can change ac_b_ex, thus we store actually +@@ -5229,7 +5222,7 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac) + + group_pa_eligible = sbi->s_mb_group_prealloc > 0; + inode_pa_eligible = true; +- size = ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); ++ size = extent_logical_end(sbi, &ac->ac_o_ex); + isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) + >> bsbits; + +diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h +index dcda2a943cee0..00b3898df4a76 100644 +--- a/fs/ext4/mballoc.h ++++ b/fs/ext4/mballoc.h +@@ -218,6 +218,20 @@ static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb, + (fex->fe_start << EXT4_SB(sb)->s_cluster_bits); + } + ++static inline loff_t extent_logical_end(struct ext4_sb_info *sbi, ++ struct ext4_free_extent *fex) ++{ ++ /* Use loff_t to avoid end exceeding ext4_lblk_t max. */ ++ return (loff_t)fex->fe_logical + EXT4_C2B(sbi, fex->fe_len); ++} ++ ++static inline loff_t pa_logical_end(struct ext4_sb_info *sbi, ++ struct ext4_prealloc_space *pa) ++{ ++ /* Use loff_t to avoid end exceeding ext4_lblk_t max. */ ++ return (loff_t)pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len); ++} ++ + typedef int (*ext4_mballoc_query_range_fn)( + struct super_block *sb, + ext4_group_t agno, +diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c +index 4c11046800ab4..eccc6ce55a63a 100644 +--- a/fs/nfsd/vfs.c ++++ b/fs/nfsd/vfs.c +@@ -1659,6 +1659,12 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, + if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen)) + goto out; + ++ err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; ++ if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) ++ goto out; ++ if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) ++ goto out; ++ + retry: + host_err = fh_want_write(ffhp); + if (host_err) { +@@ -1690,12 +1696,6 @@ retry: + if (ndentry == trap) + goto out_dput_new; + +- host_err = -EXDEV; +- if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) +- goto out_dput_new; +- if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) +- goto out_dput_new; +- + if ((ndentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK) && + nfsd_has_cached_files(ndentry)) { + close_cached = true; +diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h +index 58b53d08f2c8e..e46f6b49eb389 100644 +--- a/include/linux/hugetlb.h ++++ b/include/linux/hugetlb.h +@@ -70,6 +70,7 @@ struct resv_map { + long adds_in_progress; + struct list_head region_cache; + long region_cache_count; ++ struct rw_semaphore rw_sema; + #ifdef CONFIG_CGROUP_HUGETLB + /* + * On private mappings, the counter to uncharge reservations is stored +@@ -879,6 +880,11 @@ static inline bool hugepage_migration_supported(struct hstate *h) + return arch_hugetlb_migration_supported(h); + } + ++static inline bool __vma_private_lock(struct vm_area_struct *vma) ++{ ++ return (!(vma->vm_flags & VM_MAYSHARE)) && vma->vm_private_data; ++} ++ + /* + * Movability check is different as compared to migration check. + * It determines whether or not a huge page should be placed on +diff --git a/include/linux/kasan.h b/include/linux/kasan.h +index d811b3d7d2a15..6e6f0238d63cc 100644 +--- a/include/linux/kasan.h ++++ b/include/linux/kasan.h +@@ -471,10 +471,10 @@ static inline void kasan_free_module_shadow(const struct vm_struct *vm) {} + + #endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */ + +-#ifdef CONFIG_KASAN_INLINE ++#ifdef CONFIG_KASAN + void kasan_non_canonical_hook(unsigned long addr); +-#else /* CONFIG_KASAN_INLINE */ ++#else /* CONFIG_KASAN */ + static inline void kasan_non_canonical_hook(unsigned long addr) { } +-#endif /* CONFIG_KASAN_INLINE */ ++#endif /* CONFIG_KASAN */ + + #endif /* LINUX_KASAN_H */ +diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h +index dc2cff18b68bd..5aabc36fb249b 100644 +--- a/include/scsi/scsi_device.h ++++ b/include/scsi/scsi_device.h +@@ -162,8 +162,24 @@ struct scsi_device { + * core. */ + unsigned int eh_timeout; /* Error handling timeout */ + +- bool manage_system_start_stop; /* Let HLD (sd) manage system start/stop */ +- bool manage_runtime_start_stop; /* Let HLD (sd) manage runtime start/stop */ ++ /* ++ * If true, let the high-level device driver (sd) manage the device ++ * power state for system suspend/resume (suspend to RAM and ++ * hibernation) operations. ++ */ ++ bool manage_system_start_stop; ++ ++ /* ++ * If true, let the high-level device driver (sd) manage the device ++ * power state for runtime device suspand and resume operations. ++ */ ++ bool manage_runtime_start_stop; ++ ++ /* ++ * If true, let the high-level device driver (sd) manage the device ++ * power state for system shutdown (power off) operations. ++ */ ++ bool manage_shutdown; + + unsigned removable:1; + unsigned changed:1; /* Data invalid due to media change */ +diff --git a/include/uapi/linux/gtp.h b/include/uapi/linux/gtp.h +index 2f61298a7b779..3dcdb9e33cba2 100644 +--- a/include/uapi/linux/gtp.h ++++ b/include/uapi/linux/gtp.h +@@ -33,6 +33,6 @@ enum gtp_attrs { + GTPA_PAD, + __GTPA_MAX, + }; +-#define GTPA_MAX (__GTPA_MAX + 1) ++#define GTPA_MAX (__GTPA_MAX - 1) + + #endif /* _UAPI_LINUX_GTP_H_ */ +diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c +index 882bd56b01ed0..ea2c2ded4e412 100644 +--- a/io_uring/fdinfo.c ++++ b/io_uring/fdinfo.c +@@ -51,7 +51,6 @@ static __cold int io_uring_show_cred(struct seq_file *m, unsigned int id, + static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, + struct seq_file *m) + { +- struct io_sq_data *sq = NULL; + struct io_overflow_cqe *ocqe; + struct io_rings *r = ctx->rings; + unsigned int sq_mask = ctx->sq_entries - 1, cq_mask = ctx->cq_entries - 1; +@@ -62,6 +61,7 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, + unsigned int cq_shift = 0; + unsigned int sq_shift = 0; + unsigned int sq_entries, cq_entries; ++ int sq_pid = -1, sq_cpu = -1; + bool has_lock; + unsigned int i; + +@@ -139,13 +139,19 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, + has_lock = mutex_trylock(&ctx->uring_lock); + + if (has_lock && (ctx->flags & IORING_SETUP_SQPOLL)) { +- sq = ctx->sq_data; +- if (!sq->thread) +- sq = NULL; ++ struct io_sq_data *sq = ctx->sq_data; ++ ++ if (mutex_trylock(&sq->lock)) { ++ if (sq->thread) { ++ sq_pid = task_pid_nr(sq->thread); ++ sq_cpu = task_cpu(sq->thread); ++ } ++ mutex_unlock(&sq->lock); ++ } + } + +- seq_printf(m, "SqThread:\t%d\n", sq ? task_pid_nr(sq->thread) : -1); +- seq_printf(m, "SqThreadCpu:\t%d\n", sq ? task_cpu(sq->thread) : -1); ++ seq_printf(m, "SqThread:\t%d\n", sq_pid); ++ seq_printf(m, "SqThreadCpu:\t%d\n", sq_cpu); + seq_printf(m, "UserFiles:\t%u\n", ctx->nr_user_files); + for (i = 0; has_lock && i < ctx->nr_user_files; i++) { + struct file *f = io_file_from_index(&ctx->file_table, i); +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 2b8315a948a2c..8f2b9d8b9150e 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -13293,7 +13293,8 @@ static int inherit_group(struct perf_event *parent_event, + !perf_get_aux_event(child_ctr, leader)) + return -EINVAL; + } +- leader->group_generation = parent_event->group_generation; ++ if (leader) ++ leader->group_generation = parent_event->group_generation; + return 0; + } + +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c +index 22852029c6924..56675294d7a3b 100644 +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -989,7 +989,7 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); + * @name: The name of the kprobe event + * @loc: The location of the kprobe event + * @kretprobe: Is this a return probe? +- * @args: Variable number of arg (pairs), one pair for each field ++ * @...: Variable number of arg (pairs), one pair for each field + * + * NOTE: Users normally won't want to call this function directly, but + * rather use the kprobe_event_gen_cmd_start() wrapper, which automatically +@@ -1062,7 +1062,7 @@ EXPORT_SYMBOL_GPL(__kprobe_event_gen_cmd_start); + /** + * __kprobe_event_add_fields - Add probe fields to a kprobe command from arg list + * @cmd: A pointer to the dynevent_cmd struct representing the new event +- * @args: Variable number of arg (pairs), one pair for each field ++ * @...: Variable number of arg (pairs), one pair for each field + * + * NOTE: Users normally won't want to call this function directly, but + * rather use the kprobe_event_add_fields() wrapper, which +diff --git a/lib/maple_tree.c b/lib/maple_tree.c +index 250b4c67fac8f..4976522e3e481 100644 +--- a/lib/maple_tree.c ++++ b/lib/maple_tree.c +@@ -5913,7 +5913,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries) + /* Internal nodes */ + nr_nodes += DIV_ROUND_UP(nr_nodes, nonleaf_cap); + /* Add working room for split (2 nodes) + new parents */ +- mas_node_count(mas, nr_nodes + 3); ++ mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL); + + /* Detect if allocations run out */ + mas->mas_flags |= MA_STATE_PREALLOC; +diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c +index fad668042f3e7..ab9d4461abc9d 100644 +--- a/lib/test_maple_tree.c ++++ b/lib/test_maple_tree.c +@@ -9,6 +9,7 @@ + + #include <linux/maple_tree.h> + #include <linux/module.h> ++#include <linux/rwsem.h> + + #define MTREE_ALLOC_MAX 0x2000000000000Ul + #ifndef CONFIG_DEBUG_MAPLE_TREE +@@ -1678,17 +1679,21 @@ static noinline void __init check_forking(struct maple_tree *mt) + void *val; + MA_STATE(mas, mt, 0, 0); + MA_STATE(newmas, mt, 0, 0); ++ struct rw_semaphore newmt_lock; ++ ++ init_rwsem(&newmt_lock); + + for (i = 0; i <= nr_entries; i++) + mtree_store_range(mt, i*10, i*10 + 5, + xa_mk_value(i), GFP_KERNEL); + + mt_set_non_kernel(99999); +- mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE); ++ mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN); ++ mt_set_external_lock(&newmt, &newmt_lock); + newmas.tree = &newmt; + mas_reset(&newmas); + mas_reset(&mas); +- mas_lock(&newmas); ++ down_write(&newmt_lock); + mas.index = 0; + mas.last = 0; + if (mas_expected_entries(&newmas, nr_entries)) { +@@ -1703,10 +1708,10 @@ static noinline void __init check_forking(struct maple_tree *mt) + } + rcu_read_unlock(); + mas_destroy(&newmas); +- mas_unlock(&newmas); + mt_validate(&newmt); + mt_set_non_kernel(0); +- mtree_destroy(&newmt); ++ __mt_destroy(&newmt); ++ up_write(&newmt_lock); + } + + static noinline void __init check_iteration(struct maple_tree *mt) +@@ -1818,6 +1823,10 @@ static noinline void __init bench_forking(struct maple_tree *mt) + void *val; + MA_STATE(mas, mt, 0, 0); + MA_STATE(newmas, mt, 0, 0); ++ struct rw_semaphore newmt_lock; ++ ++ init_rwsem(&newmt_lock); ++ mt_set_external_lock(&newmt, &newmt_lock); + + for (i = 0; i <= nr_entries; i++) + mtree_store_range(mt, i*10, i*10 + 5, +@@ -1832,7 +1841,7 @@ static noinline void __init bench_forking(struct maple_tree *mt) + mas.index = 0; + mas.last = 0; + rcu_read_lock(); +- mas_lock(&newmas); ++ down_write(&newmt_lock); + if (mas_expected_entries(&newmas, nr_entries)) { + printk("OOM!"); + BUG_ON(1); +@@ -1843,11 +1852,11 @@ static noinline void __init bench_forking(struct maple_tree *mt) + mas_store(&newmas, val); + } + mas_destroy(&newmas); +- mas_unlock(&newmas); + rcu_read_unlock(); + mt_validate(&newmt); + mt_set_non_kernel(0); +- mtree_destroy(&newmt); ++ __mt_destroy(&newmt); ++ up_write(&newmt_lock); + } + } + #endif +@@ -2453,6 +2462,10 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, + void *tmp; + MA_STATE(mas, mt, 0, 0); + MA_STATE(newmas, &newmt, 0, 0); ++ struct rw_semaphore newmt_lock; ++ ++ init_rwsem(&newmt_lock); ++ mt_set_external_lock(&newmt, &newmt_lock); + + if (!zero_start) + i = 1; +@@ -2462,9 +2475,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, + mtree_store_range(mt, i*10, (i+1)*10 - gap, + xa_mk_value(i), GFP_KERNEL); + +- mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE); ++ mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN); + mt_set_non_kernel(99999); +- mas_lock(&newmas); ++ down_write(&newmt_lock); + ret = mas_expected_entries(&newmas, nr_entries); + mt_set_non_kernel(0); + MT_BUG_ON(mt, ret != 0); +@@ -2477,9 +2490,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt, + } + rcu_read_unlock(); + mas_destroy(&newmas); +- mas_unlock(&newmas); + +- mtree_destroy(&newmt); ++ __mt_destroy(&newmt); ++ up_write(&newmt_lock); + } + + /* Duplicate many sizes of trees. Mainly to test expected entry values */ +diff --git a/mm/hugetlb.c b/mm/hugetlb.c +index c38ec6efec0f7..aa4a68dfb3b92 100644 +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -96,6 +96,7 @@ static void hugetlb_vma_lock_alloc(struct vm_area_struct *vma); + static void __hugetlb_vma_unlock_write_free(struct vm_area_struct *vma); + static void hugetlb_unshare_pmds(struct vm_area_struct *vma, + unsigned long start, unsigned long end); ++static struct resv_map *vma_resv_map(struct vm_area_struct *vma); + + static inline bool subpool_is_free(struct hugepage_subpool *spool) + { +@@ -272,6 +273,10 @@ void hugetlb_vma_lock_read(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + down_read(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ down_read(&resv_map->rw_sema); + } + } + +@@ -281,6 +286,10 @@ void hugetlb_vma_unlock_read(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + up_read(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ up_read(&resv_map->rw_sema); + } + } + +@@ -290,6 +299,10 @@ void hugetlb_vma_lock_write(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + down_write(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ down_write(&resv_map->rw_sema); + } + } + +@@ -299,17 +312,27 @@ void hugetlb_vma_unlock_write(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + up_write(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ up_write(&resv_map->rw_sema); + } + } + + int hugetlb_vma_trylock_write(struct vm_area_struct *vma) + { +- struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + +- if (!__vma_shareable_lock(vma)) +- return 1; ++ if (__vma_shareable_lock(vma)) { ++ struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + +- return down_write_trylock(&vma_lock->rw_sema); ++ return down_write_trylock(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ return down_write_trylock(&resv_map->rw_sema); ++ } ++ ++ return 1; + } + + void hugetlb_vma_assert_locked(struct vm_area_struct *vma) +@@ -318,6 +341,10 @@ void hugetlb_vma_assert_locked(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + lockdep_assert_held(&vma_lock->rw_sema); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ lockdep_assert_held(&resv_map->rw_sema); + } + } + +@@ -350,6 +377,11 @@ static void __hugetlb_vma_unlock_write_free(struct vm_area_struct *vma) + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; + + __hugetlb_vma_unlock_write_put(vma_lock); ++ } else if (__vma_private_lock(vma)) { ++ struct resv_map *resv_map = vma_resv_map(vma); ++ ++ /* no free for anon vmas, but still need to unlock */ ++ up_write(&resv_map->rw_sema); + } + } + +@@ -1068,6 +1100,7 @@ struct resv_map *resv_map_alloc(void) + kref_init(&resv_map->refs); + spin_lock_init(&resv_map->lock); + INIT_LIST_HEAD(&resv_map->regions); ++ init_rwsem(&resv_map->rw_sema); + + resv_map->adds_in_progress = 0; + /* +@@ -1138,8 +1171,7 @@ static void set_vma_resv_map(struct vm_area_struct *vma, struct resv_map *map) + VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); + VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); + +- set_vma_private_data(vma, (get_vma_private_data(vma) & +- HPAGE_RESV_MASK) | (unsigned long)map); ++ set_vma_private_data(vma, (unsigned long)map); + } + + static void set_vma_resv_flags(struct vm_area_struct *vma, unsigned long flags) +@@ -6898,8 +6930,10 @@ out_err: + */ + if (chg >= 0 && add < 0) + region_abort(resv_map, from, to, regions_needed); +- if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) ++ if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { + kref_put(&resv_map->refs, resv_map_release); ++ set_vma_resv_map(vma, NULL); ++ } + return false; + } + +diff --git a/mm/kasan/report.c b/mm/kasan/report.c +index cc98dfdd3ed2f..66a37f177d231 100644 +--- a/mm/kasan/report.c ++++ b/mm/kasan/report.c +@@ -523,9 +523,8 @@ void kasan_report_async(void) + } + #endif /* CONFIG_KASAN_HW_TAGS */ + +-#ifdef CONFIG_KASAN_INLINE + /* +- * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high ++ * With CONFIG_KASAN, accesses to bogus pointers (outside the high + * canonical half of the address space) cause out-of-bounds shadow memory reads + * before the actual access. For addresses in the low canonical half of the + * address space, as well as most non-canonical addresses, that out-of-bounds +@@ -561,4 +560,3 @@ void kasan_non_canonical_hook(unsigned long addr) + pr_alert("KASAN: %s in range [0x%016lx-0x%016lx]\n", bug_type, + orig_addr, orig_addr + KASAN_GRANULE_SIZE - 1); + } +-#endif +diff --git a/mm/migrate.c b/mm/migrate.c +index 8d5c0dc618a57..9372a826e6d08 100644 +--- a/mm/migrate.c ++++ b/mm/migrate.c +@@ -1787,6 +1787,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, + const int __user *nodes, + int __user *status, int flags) + { ++ compat_uptr_t __user *compat_pages = (void __user *)pages; + int current_node = NUMA_NO_NODE; + LIST_HEAD(pagelist); + int start, i; +@@ -1800,8 +1801,17 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, + int node; + + err = -EFAULT; +- if (get_user(p, pages + i)) +- goto out_flush; ++ if (in_compat_syscall()) { ++ compat_uptr_t cp; ++ ++ if (get_user(cp, compat_pages + i)) ++ goto out_flush; ++ ++ p = compat_ptr(cp); ++ } else { ++ if (get_user(p, pages + i)) ++ goto out_flush; ++ } + if (get_user(node, nodes + i)) + goto out_flush; + addr = (unsigned long)untagged_addr(p); +diff --git a/mm/mmap.c b/mm/mmap.c +index 41a240bd81df8..8ffe3f87f7ba9 100644 +--- a/mm/mmap.c ++++ b/mm/mmap.c +@@ -3147,13 +3147,13 @@ int vm_brk_flags(unsigned long addr, unsigned long request, unsigned long flags) + if (!len) + return 0; + +- if (mmap_write_lock_killable(mm)) +- return -EINTR; +- + /* Until we need other flags, refuse anything except VM_EXEC. */ + if ((flags & (~VM_EXEC)) != 0) + return -EINVAL; + ++ if (mmap_write_lock_killable(mm)) ++ return -EINTR; ++ + ret = check_brk_limits(addr, len); + if (ret) + goto limits_failed; +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index ca017c6008b7c..4583f8a42d914 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -9638,6 +9638,7 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page, + next_page = page; + current_buddy = page + size; + } ++ page = next_page; + + if (set_page_guard(zone, current_buddy, high, migratetype)) + continue; +@@ -9645,7 +9646,6 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page, + if (current_buddy != target) { + add_to_free_list(current_buddy, zone, high, migratetype); + set_buddy_order(current_buddy, high); +- page = next_page; + } + } + } +diff --git a/net/core/neighbour.c b/net/core/neighbour.c +index b20c9768d9f3f..41daa47d03934 100644 +--- a/net/core/neighbour.c ++++ b/net/core/neighbour.c +@@ -251,7 +251,8 @@ bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl) + + static int neigh_forced_gc(struct neigh_table *tbl) + { +- int max_clean = atomic_read(&tbl->gc_entries) - tbl->gc_thresh2; ++ int max_clean = atomic_read(&tbl->gc_entries) - ++ READ_ONCE(tbl->gc_thresh2); + unsigned long tref = jiffies - 5 * HZ; + struct neighbour *n, *tmp; + int shrunk = 0; +@@ -280,7 +281,7 @@ static int neigh_forced_gc(struct neigh_table *tbl) + } + } + +- tbl->last_flush = jiffies; ++ WRITE_ONCE(tbl->last_flush, jiffies); + + write_unlock_bh(&tbl->lock); + +@@ -464,17 +465,17 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, + { + struct neighbour *n = NULL; + unsigned long now = jiffies; +- int entries; ++ int entries, gc_thresh3; + + if (exempt_from_gc) + goto do_alloc; + + entries = atomic_inc_return(&tbl->gc_entries) - 1; +- if (entries >= tbl->gc_thresh3 || +- (entries >= tbl->gc_thresh2 && +- time_after(now, tbl->last_flush + 5 * HZ))) { +- if (!neigh_forced_gc(tbl) && +- entries >= tbl->gc_thresh3) { ++ gc_thresh3 = READ_ONCE(tbl->gc_thresh3); ++ if (entries >= gc_thresh3 || ++ (entries >= READ_ONCE(tbl->gc_thresh2) && ++ time_after(now, READ_ONCE(tbl->last_flush) + 5 * HZ))) { ++ if (!neigh_forced_gc(tbl) && entries >= gc_thresh3) { + net_info_ratelimited("%s: neighbor table overflow!\n", + tbl->id); + NEIGH_CACHE_STAT_INC(tbl, table_fulls); +@@ -955,13 +956,14 @@ static void neigh_periodic_work(struct work_struct *work) + + if (time_after(jiffies, tbl->last_rand + 300 * HZ)) { + struct neigh_parms *p; +- tbl->last_rand = jiffies; ++ ++ WRITE_ONCE(tbl->last_rand, jiffies); + list_for_each_entry(p, &tbl->parms_list, list) + p->reachable_time = + neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); + } + +- if (atomic_read(&tbl->entries) < tbl->gc_thresh1) ++ if (atomic_read(&tbl->entries) < READ_ONCE(tbl->gc_thresh1)) + goto out; + + for (i = 0 ; i < (1 << nht->hash_shift); i++) { +@@ -2157,15 +2159,16 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, + ndtmsg->ndtm_pad2 = 0; + + if (nla_put_string(skb, NDTA_NAME, tbl->id) || +- nla_put_msecs(skb, NDTA_GC_INTERVAL, tbl->gc_interval, NDTA_PAD) || +- nla_put_u32(skb, NDTA_THRESH1, tbl->gc_thresh1) || +- nla_put_u32(skb, NDTA_THRESH2, tbl->gc_thresh2) || +- nla_put_u32(skb, NDTA_THRESH3, tbl->gc_thresh3)) ++ nla_put_msecs(skb, NDTA_GC_INTERVAL, READ_ONCE(tbl->gc_interval), ++ NDTA_PAD) || ++ nla_put_u32(skb, NDTA_THRESH1, READ_ONCE(tbl->gc_thresh1)) || ++ nla_put_u32(skb, NDTA_THRESH2, READ_ONCE(tbl->gc_thresh2)) || ++ nla_put_u32(skb, NDTA_THRESH3, READ_ONCE(tbl->gc_thresh3))) + goto nla_put_failure; + { + unsigned long now = jiffies; +- long flush_delta = now - tbl->last_flush; +- long rand_delta = now - tbl->last_rand; ++ long flush_delta = now - READ_ONCE(tbl->last_flush); ++ long rand_delta = now - READ_ONCE(tbl->last_rand); + struct neigh_hash_table *nht; + struct ndt_config ndc = { + .ndtc_key_len = tbl->key_len, +@@ -2173,7 +2176,7 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, + .ndtc_entries = atomic_read(&tbl->entries), + .ndtc_last_flush = jiffies_to_msecs(flush_delta), + .ndtc_last_rand = jiffies_to_msecs(rand_delta), +- .ndtc_proxy_qlen = tbl->proxy_queue.qlen, ++ .ndtc_proxy_qlen = READ_ONCE(tbl->proxy_queue.qlen), + }; + + rcu_read_lock(); +@@ -2196,17 +2199,17 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, + struct neigh_statistics *st; + + st = per_cpu_ptr(tbl->stats, cpu); +- ndst.ndts_allocs += st->allocs; +- ndst.ndts_destroys += st->destroys; +- ndst.ndts_hash_grows += st->hash_grows; +- ndst.ndts_res_failed += st->res_failed; +- ndst.ndts_lookups += st->lookups; +- ndst.ndts_hits += st->hits; +- ndst.ndts_rcv_probes_mcast += st->rcv_probes_mcast; +- ndst.ndts_rcv_probes_ucast += st->rcv_probes_ucast; +- ndst.ndts_periodic_gc_runs += st->periodic_gc_runs; +- ndst.ndts_forced_gc_runs += st->forced_gc_runs; +- ndst.ndts_table_fulls += st->table_fulls; ++ ndst.ndts_allocs += READ_ONCE(st->allocs); ++ ndst.ndts_destroys += READ_ONCE(st->destroys); ++ ndst.ndts_hash_grows += READ_ONCE(st->hash_grows); ++ ndst.ndts_res_failed += READ_ONCE(st->res_failed); ++ ndst.ndts_lookups += READ_ONCE(st->lookups); ++ ndst.ndts_hits += READ_ONCE(st->hits); ++ ndst.ndts_rcv_probes_mcast += READ_ONCE(st->rcv_probes_mcast); ++ ndst.ndts_rcv_probes_ucast += READ_ONCE(st->rcv_probes_ucast); ++ ndst.ndts_periodic_gc_runs += READ_ONCE(st->periodic_gc_runs); ++ ndst.ndts_forced_gc_runs += READ_ONCE(st->forced_gc_runs); ++ ndst.ndts_table_fulls += READ_ONCE(st->table_fulls); + } + + if (nla_put_64bit(skb, NDTA_STATS, sizeof(ndst), &ndst, +@@ -2435,16 +2438,16 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, + goto errout_tbl_lock; + + if (tb[NDTA_THRESH1]) +- tbl->gc_thresh1 = nla_get_u32(tb[NDTA_THRESH1]); ++ WRITE_ONCE(tbl->gc_thresh1, nla_get_u32(tb[NDTA_THRESH1])); + + if (tb[NDTA_THRESH2]) +- tbl->gc_thresh2 = nla_get_u32(tb[NDTA_THRESH2]); ++ WRITE_ONCE(tbl->gc_thresh2, nla_get_u32(tb[NDTA_THRESH2])); + + if (tb[NDTA_THRESH3]) +- tbl->gc_thresh3 = nla_get_u32(tb[NDTA_THRESH3]); ++ WRITE_ONCE(tbl->gc_thresh3, nla_get_u32(tb[NDTA_THRESH3])); + + if (tb[NDTA_GC_INTERVAL]) +- tbl->gc_interval = nla_get_msecs(tb[NDTA_GC_INTERVAL]); ++ WRITE_ONCE(tbl->gc_interval, nla_get_msecs(tb[NDTA_GC_INTERVAL])); + + err = 0; + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 068221e742425..d63942202493d 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -2202,16 +2202,17 @@ void tcp_enter_loss(struct sock *sk) + * restore sanity to the SACK scoreboard. If the apparent reneging + * persists until this RTO then we'll clear the SACK scoreboard. + */ +-static bool tcp_check_sack_reneging(struct sock *sk, int flag) ++static bool tcp_check_sack_reneging(struct sock *sk, int *ack_flag) + { +- if (flag & FLAG_SACK_RENEGING && +- flag & FLAG_SND_UNA_ADVANCED) { ++ if (*ack_flag & FLAG_SACK_RENEGING && ++ *ack_flag & FLAG_SND_UNA_ADVANCED) { + struct tcp_sock *tp = tcp_sk(sk); + unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4), + msecs_to_jiffies(10)); + + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + delay, TCP_RTO_MAX); ++ *ack_flag &= ~FLAG_SET_XMIT_TIMER; + return true; + } + return false; +@@ -2981,7 +2982,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, + tp->prior_ssthresh = 0; + + /* B. In all the states check for reneging SACKs. */ +- if (tcp_check_sack_reneging(sk, flag)) ++ if (tcp_check_sack_reneging(sk, ack_flag)) + return; + + /* C. Check consistency of the current state. */ +diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c +index ad64f403536a9..460e7fbb42da3 100644 +--- a/net/vmw_vsock/virtio_transport.c ++++ b/net/vmw_vsock/virtio_transport.c +@@ -590,6 +590,11 @@ static int virtio_vsock_vqs_init(struct virtio_vsock *vsock) + + virtio_device_ready(vdev); + ++ return 0; ++} ++ ++static void virtio_vsock_vqs_start(struct virtio_vsock *vsock) ++{ + mutex_lock(&vsock->tx_lock); + vsock->tx_run = true; + mutex_unlock(&vsock->tx_lock); +@@ -604,7 +609,16 @@ static int virtio_vsock_vqs_init(struct virtio_vsock *vsock) + vsock->event_run = true; + mutex_unlock(&vsock->event_lock); + +- return 0; ++ /* virtio_transport_send_pkt() can queue packets once ++ * the_virtio_vsock is set, but they won't be processed until ++ * vsock->tx_run is set to true. We queue vsock->send_pkt_work ++ * when initialization finishes to send those packets queued ++ * earlier. ++ * We don't need to queue the other workers (rx, event) because ++ * as long as we don't fill the queues with empty buffers, the ++ * host can't send us any notification. ++ */ ++ queue_work(virtio_vsock_workqueue, &vsock->send_pkt_work); + } + + static void virtio_vsock_vqs_del(struct virtio_vsock *vsock) +@@ -707,6 +721,7 @@ static int virtio_vsock_probe(struct virtio_device *vdev) + goto out; + + rcu_assign_pointer(the_virtio_vsock, vsock); ++ virtio_vsock_vqs_start(vsock); + + mutex_unlock(&the_virtio_vsock_mutex); + +@@ -779,6 +794,7 @@ static int virtio_vsock_restore(struct virtio_device *vdev) + goto out; + + rcu_assign_pointer(the_virtio_vsock, vsock); ++ virtio_vsock_vqs_start(vsock); + + out: + mutex_unlock(&the_virtio_vsock_mutex); +diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c +index c3964aa00b288..a2abd1a111612 100644 +--- a/sound/soc/codecs/wcd938x.c ++++ b/sound/soc/codecs/wcd938x.c +@@ -3302,18 +3302,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device + int ret; + + wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); +- if (wcd938x->reset_gpio < 0) { +- dev_err(dev, "Failed to get reset gpio: err = %d\n", +- wcd938x->reset_gpio); +- return wcd938x->reset_gpio; +- } ++ if (wcd938x->reset_gpio < 0) ++ return dev_err_probe(dev, wcd938x->reset_gpio, ++ "Failed to get reset gpio\n"); + + wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", + GPIOD_OUT_LOW); +- if (IS_ERR(wcd938x->us_euro_gpio)) { +- dev_err(dev, "us-euro swap Control GPIO not found\n"); +- return PTR_ERR(wcd938x->us_euro_gpio); +- } ++ if (IS_ERR(wcd938x->us_euro_gpio)) ++ return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio), ++ "us-euro swap Control GPIO not found\n"); + + cfg->swap_gnd_mic = wcd938x_swap_gnd_mic; + +@@ -3323,15 +3320,13 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device + wcd938x->supplies[3].supply = "vdd-mic-bias"; + + ret = regulator_bulk_get(dev, WCD938X_MAX_SUPPLY, wcd938x->supplies); +- if (ret) { +- dev_err(dev, "Failed to get supplies: err = %d\n", ret); +- return ret; +- } ++ if (ret) ++ return dev_err_probe(dev, ret, "Failed to get supplies\n"); + + ret = regulator_bulk_enable(WCD938X_MAX_SUPPLY, wcd938x->supplies); + if (ret) { +- dev_err(dev, "Failed to enable supplies: err = %d\n", ret); +- return ret; ++ regulator_bulk_free(WCD938X_MAX_SUPPLY, wcd938x->supplies); ++ return dev_err_probe(dev, ret, "Failed to enable supplies\n"); + } + + wcd938x_dt_parse_micbias_info(dev, wcd938x); +@@ -3598,13 +3593,13 @@ static int wcd938x_probe(struct platform_device *pdev) + + ret = wcd938x_add_slave_components(wcd938x, dev, &match); + if (ret) +- return ret; ++ goto err_disable_regulators; + + wcd938x_reset(wcd938x); + + ret = component_master_add_with_match(dev, &wcd938x_comp_ops, match); + if (ret) +- return ret; ++ goto err_disable_regulators; + + pm_runtime_set_autosuspend_delay(dev, 1000); + pm_runtime_use_autosuspend(dev); +@@ -3614,13 +3609,27 @@ static int wcd938x_probe(struct platform_device *pdev) + pm_runtime_idle(dev); + + return 0; ++ ++err_disable_regulators: ++ regulator_bulk_disable(WCD938X_MAX_SUPPLY, wcd938x->supplies); ++ regulator_bulk_free(WCD938X_MAX_SUPPLY, wcd938x->supplies); ++ ++ return ret; + } + +-static int wcd938x_remove(struct platform_device *pdev) ++static void wcd938x_remove(struct platform_device *pdev) + { +- component_master_del(&pdev->dev, &wcd938x_comp_ops); ++ struct device *dev = &pdev->dev; ++ struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); + +- return 0; ++ component_master_del(dev, &wcd938x_comp_ops); ++ ++ pm_runtime_disable(dev); ++ pm_runtime_set_suspended(dev); ++ pm_runtime_dont_use_autosuspend(dev); ++ ++ regulator_bulk_disable(WCD938X_MAX_SUPPLY, wcd938x->supplies); ++ regulator_bulk_free(WCD938X_MAX_SUPPLY, wcd938x->supplies); + } + + #if defined(CONFIG_OF) +@@ -3634,7 +3643,7 @@ MODULE_DEVICE_TABLE(of, wcd938x_dt_match); + + static struct platform_driver wcd938x_codec_driver = { + .probe = wcd938x_probe, +- .remove = wcd938x_remove, ++ .remove_new = wcd938x_remove, + .driver = { + .name = "wcd938x_codec", + .of_match_table = of_match_ptr(wcd938x_dt_match), +diff --git a/tools/include/linux/rwsem.h b/tools/include/linux/rwsem.h +new file mode 100644 +index 0000000000000..83971b3cbfced +--- /dev/null ++++ b/tools/include/linux/rwsem.h +@@ -0,0 +1,40 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++#ifndef _TOOLS__RWSEM_H ++#define _TOOLS__RWSEM_H ++ ++#include <pthread.h> ++ ++struct rw_semaphore { ++ pthread_rwlock_t lock; ++}; ++ ++static inline int init_rwsem(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_init(&sem->lock, NULL); ++} ++ ++static inline int exit_rwsem(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_destroy(&sem->lock); ++} ++ ++static inline int down_read(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_rdlock(&sem->lock); ++} ++ ++static inline int up_read(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_unlock(&sem->lock); ++} ++ ++static inline int down_write(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_wrlock(&sem->lock); ++} ++ ++static inline int up_write(struct rw_semaphore *sem) ++{ ++ return pthread_rwlock_unlock(&sem->lock); ++} ++#endif /* _TOOLS_RWSEM_H */ +diff --git a/tools/objtool/check.c b/tools/objtool/check.c +index f8008ab31eef0..cb363b507a329 100644 +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -2478,7 +2478,7 @@ static bool is_special_call(struct instruction *insn) + if (!dest) + return false; + +- if (dest->fentry) ++ if (dest->fentry || dest->embedded_insn) + return true; + } + |