Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Wed, 01 Jul 2020 12:23:55
Message-Id: 1593606211.1a30be9cb355f0f6354741ba6332f32f43a24022.mpagano@gentoo
1 commit: 1a30be9cb355f0f6354741ba6332f32f43a24022
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 1 12:23:31 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 1 12:23:31 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1a30be9c
7
8 Linux patch 5.4.50
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1049_linux-5.4.50.patch | 5377 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 5381 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 92c9456..6d3ad3e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -239,6 +239,10 @@ Patch: 1048_linux-5.4.49.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.49
23
24 +Patch: 1049_linux-5.4.50.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.50
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1049_linux-5.4.50.patch b/1049_linux-5.4.50.patch
33 new file mode 100644
34 index 0000000..e333238
35 --- /dev/null
36 +++ b/1049_linux-5.4.50.patch
37 @@ -0,0 +1,5377 @@
38 +diff --git a/Makefile b/Makefile
39 +index 72230ad23299..380e398b2995 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 4
46 +-SUBLEVEL = 49
47 ++SUBLEVEL = 50
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arm/boot/dts/am335x-pocketbeagle.dts b/arch/arm/boot/dts/am335x-pocketbeagle.dts
52 +index ff4f919d22f6..abf2badce53d 100644
53 +--- a/arch/arm/boot/dts/am335x-pocketbeagle.dts
54 ++++ b/arch/arm/boot/dts/am335x-pocketbeagle.dts
55 +@@ -88,7 +88,6 @@
56 + AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
57 + AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
58 + AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
59 +- AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT, MUX_MODE4) /* (B12) mcasp0_aclkr.mmc0_sdwp */
60 + >;
61 + };
62 +
63 +diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
64 +index da6d70f09ef1..418e6b97cb2e 100644
65 +--- a/arch/arm/boot/dts/bcm-nsp.dtsi
66 ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi
67 +@@ -257,10 +257,10 @@
68 + status = "disabled";
69 + };
70 +
71 +- mailbox: mailbox@25000 {
72 ++ mailbox: mailbox@25c00 {
73 + compatible = "brcm,iproc-fa2-mbox";
74 +- reg = <0x25000 0x445>;
75 +- interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
76 ++ reg = <0x25c00 0x400>;
77 ++ interrupts = <GIC_SPI 151 IRQ_TYPE_LEVEL_HIGH>;
78 + #mbox-cells = <1>;
79 + brcm,rx-status-len = <32>;
80 + brcm,use-bcm-hdr;
81 +diff --git a/arch/arm/boot/dts/omap4-duovero-parlor.dts b/arch/arm/boot/dts/omap4-duovero-parlor.dts
82 +index 8047e8cdb3af..4548d87534e3 100644
83 +--- a/arch/arm/boot/dts/omap4-duovero-parlor.dts
84 ++++ b/arch/arm/boot/dts/omap4-duovero-parlor.dts
85 +@@ -139,7 +139,7 @@
86 + ethernet@gpmc {
87 + reg = <5 0 0xff>;
88 + interrupt-parent = <&gpio2>;
89 +- interrupts = <12 IRQ_TYPE_EDGE_FALLING>; /* gpio_44 */
90 ++ interrupts = <12 IRQ_TYPE_LEVEL_LOW>; /* gpio_44 */
91 +
92 + phy-mode = "mii";
93 +
94 +diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
95 +index f057df813f83..e9962b48e30c 100644
96 +--- a/arch/arm/mach-imx/pm-imx5.c
97 ++++ b/arch/arm/mach-imx/pm-imx5.c
98 +@@ -295,14 +295,14 @@ static int __init imx_suspend_alloc_ocram(
99 + if (!ocram_pool) {
100 + pr_warn("%s: ocram pool unavailable!\n", __func__);
101 + ret = -ENODEV;
102 +- goto put_node;
103 ++ goto put_device;
104 + }
105 +
106 + ocram_base = gen_pool_alloc(ocram_pool, size);
107 + if (!ocram_base) {
108 + pr_warn("%s: unable to alloc ocram!\n", __func__);
109 + ret = -ENOMEM;
110 +- goto put_node;
111 ++ goto put_device;
112 + }
113 +
114 + phys = gen_pool_virt_to_phys(ocram_pool, ocram_base);
115 +@@ -312,6 +312,8 @@ static int __init imx_suspend_alloc_ocram(
116 + if (virt_out)
117 + *virt_out = virt;
118 +
119 ++put_device:
120 ++ put_device(&pdev->dev);
121 + put_node:
122 + of_node_put(node);
123 +
124 +diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
125 +index 203664c40d3d..eb74aa182661 100644
126 +--- a/arch/arm/mach-omap2/omap_hwmod.c
127 ++++ b/arch/arm/mach-omap2/omap_hwmod.c
128 +@@ -3535,7 +3535,7 @@ static const struct omap_hwmod_reset dra7_reset_quirks[] = {
129 + };
130 +
131 + static const struct omap_hwmod_reset omap_reset_quirks[] = {
132 +- { .match = "dss", .len = 3, .reset = omap_dss_reset, },
133 ++ { .match = "dss_core", .len = 8, .reset = omap_dss_reset, },
134 + { .match = "hdq1w", .len = 5, .reset = omap_hdq1w_reset, },
135 + { .match = "i2c", .len = 3, .reset = omap_i2c_reset, },
136 + { .match = "wd_timer", .len = 8, .reset = omap2_wd_timer_reset, },
137 +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
138 +index 13137451b438..b9f8b7aac8ff 100644
139 +--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
140 ++++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
141 +@@ -231,7 +231,7 @@
142 +
143 + ldo1_reg: LDO1 {
144 + regulator-name = "LDO1";
145 +- regulator-min-microvolt = <3000000>;
146 ++ regulator-min-microvolt = <1600000>;
147 + regulator-max-microvolt = <3300000>;
148 + regulator-boot-on;
149 + regulator-always-on;
150 +@@ -239,7 +239,7 @@
151 +
152 + ldo2_reg: LDO2 {
153 + regulator-name = "LDO2";
154 +- regulator-min-microvolt = <900000>;
155 ++ regulator-min-microvolt = <800000>;
156 + regulator-max-microvolt = <900000>;
157 + regulator-boot-on;
158 + regulator-always-on;
159 +diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
160 +index 11c705d225d0..9ad1d43b8ce7 100644
161 +--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
162 ++++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
163 +@@ -268,7 +268,7 @@
164 +
165 + ldo1_reg: LDO1 {
166 + regulator-name = "LDO1";
167 +- regulator-min-microvolt = <3000000>;
168 ++ regulator-min-microvolt = <1600000>;
169 + regulator-max-microvolt = <3300000>;
170 + regulator-boot-on;
171 + regulator-always-on;
172 +@@ -276,7 +276,7 @@
173 +
174 + ldo2_reg: LDO2 {
175 + regulator-name = "LDO2";
176 +- regulator-min-microvolt = <900000>;
177 ++ regulator-min-microvolt = <800000>;
178 + regulator-max-microvolt = <900000>;
179 + regulator-boot-on;
180 + regulator-always-on;
181 +diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
182 +index 1765e5284994..04b982a2799e 100644
183 +--- a/arch/arm64/kernel/fpsimd.c
184 ++++ b/arch/arm64/kernel/fpsimd.c
185 +@@ -338,7 +338,7 @@ static unsigned int find_supported_vector_length(unsigned int vl)
186 + return sve_vl_from_vq(__bit_to_vq(bit));
187 + }
188 +
189 +-#ifdef CONFIG_SYSCTL
190 ++#if defined(CONFIG_ARM64_SVE) && defined(CONFIG_SYSCTL)
191 +
192 + static int sve_proc_do_default_vl(struct ctl_table *table, int write,
193 + void __user *buffer, size_t *lenp,
194 +@@ -384,9 +384,9 @@ static int __init sve_sysctl_init(void)
195 + return 0;
196 + }
197 +
198 +-#else /* ! CONFIG_SYSCTL */
199 ++#else /* ! (CONFIG_ARM64_SVE && CONFIG_SYSCTL) */
200 + static int __init sve_sysctl_init(void) { return 0; }
201 +-#endif /* ! CONFIG_SYSCTL */
202 ++#endif /* ! (CONFIG_ARM64_SVE && CONFIG_SYSCTL) */
203 +
204 + #define ZREG(sve_state, vq, n) ((char *)(sve_state) + \
205 + (SVE_SIG_ZREG_OFFSET(vq, n) - SVE_SIG_REGS_OFFSET))
206 +diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
207 +index 0bbac612146e..666b225aeb3a 100644
208 +--- a/arch/arm64/kernel/perf_regs.c
209 ++++ b/arch/arm64/kernel/perf_regs.c
210 +@@ -15,15 +15,34 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
211 + return 0;
212 +
213 + /*
214 +- * Compat (i.e. 32 bit) mode:
215 +- * - PC has been set in the pt_regs struct in kernel_entry,
216 +- * - Handle SP and LR here.
217 ++ * Our handling of compat tasks (PERF_SAMPLE_REGS_ABI_32) is weird, but
218 ++ * we're stuck with it for ABI compatability reasons.
219 ++ *
220 ++ * For a 32-bit consumer inspecting a 32-bit task, then it will look at
221 ++ * the first 16 registers (see arch/arm/include/uapi/asm/perf_regs.h).
222 ++ * These correspond directly to a prefix of the registers saved in our
223 ++ * 'struct pt_regs', with the exception of the PC, so we copy that down
224 ++ * (x15 corresponds to SP_hyp in the architecture).
225 ++ *
226 ++ * So far, so good.
227 ++ *
228 ++ * The oddity arises when a 64-bit consumer looks at a 32-bit task and
229 ++ * asks for registers beyond PERF_REG_ARM_MAX. In this case, we return
230 ++ * SP_usr, LR_usr and PC in the positions where the AArch64 SP, LR and
231 ++ * PC registers would normally live. The initial idea was to allow a
232 ++ * 64-bit unwinder to unwind a 32-bit task and, although it's not clear
233 ++ * how well that works in practice, somebody might be relying on it.
234 ++ *
235 ++ * At the time we make a sample, we don't know whether the consumer is
236 ++ * 32-bit or 64-bit, so we have to cater for both possibilities.
237 + */
238 + if (compat_user_mode(regs)) {
239 + if ((u32)idx == PERF_REG_ARM64_SP)
240 + return regs->compat_sp;
241 + if ((u32)idx == PERF_REG_ARM64_LR)
242 + return regs->compat_lr;
243 ++ if (idx == 15)
244 ++ return regs->pc;
245 + }
246 +
247 + if ((u32)idx == PERF_REG_ARM64_SP)
248 +diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h
249 +index d969bab4a26b..262e5bbb2776 100644
250 +--- a/arch/riscv/include/asm/cmpxchg.h
251 ++++ b/arch/riscv/include/asm/cmpxchg.h
252 +@@ -179,7 +179,7 @@
253 + " bnez %1, 0b\n" \
254 + "1:\n" \
255 + : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \
256 +- : "rJ" (__old), "rJ" (__new) \
257 ++ : "rJ" ((long)__old), "rJ" (__new) \
258 + : "memory"); \
259 + break; \
260 + case 8: \
261 +@@ -224,7 +224,7 @@
262 + RISCV_ACQUIRE_BARRIER \
263 + "1:\n" \
264 + : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \
265 +- : "rJ" (__old), "rJ" (__new) \
266 ++ : "rJ" ((long)__old), "rJ" (__new) \
267 + : "memory"); \
268 + break; \
269 + case 8: \
270 +@@ -270,7 +270,7 @@
271 + " bnez %1, 0b\n" \
272 + "1:\n" \
273 + : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \
274 +- : "rJ" (__old), "rJ" (__new) \
275 ++ : "rJ" ((long)__old), "rJ" (__new) \
276 + : "memory"); \
277 + break; \
278 + case 8: \
279 +@@ -316,7 +316,7 @@
280 + " fence rw, rw\n" \
281 + "1:\n" \
282 + : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \
283 +- : "rJ" (__old), "rJ" (__new) \
284 ++ : "rJ" ((long)__old), "rJ" (__new) \
285 + : "memory"); \
286 + break; \
287 + case 8: \
288 +diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c
289 +index f3619f59d85c..12f8a7fce78b 100644
290 +--- a/arch/riscv/kernel/sys_riscv.c
291 ++++ b/arch/riscv/kernel/sys_riscv.c
292 +@@ -8,6 +8,7 @@
293 + #include <linux/syscalls.h>
294 + #include <asm/unistd.h>
295 + #include <asm/cacheflush.h>
296 ++#include <asm-generic/mman-common.h>
297 +
298 + static long riscv_sys_mmap(unsigned long addr, unsigned long len,
299 + unsigned long prot, unsigned long flags,
300 +@@ -16,6 +17,11 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,
301 + {
302 + if (unlikely(offset & (~PAGE_MASK >> page_shift_offset)))
303 + return -EINVAL;
304 ++
305 ++ if ((prot & PROT_WRITE) && (prot & PROT_EXEC))
306 ++ if (unlikely(!(prot & PROT_READ)))
307 ++ return -EINVAL;
308 ++
309 + return ksys_mmap_pgoff(addr, len, prot, flags, fd,
310 + offset >> (PAGE_SHIFT - page_shift_offset));
311 + }
312 +diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h
313 +index 169d7604eb80..f3ba84fa9bd1 100644
314 +--- a/arch/s390/include/asm/vdso.h
315 ++++ b/arch/s390/include/asm/vdso.h
316 +@@ -36,6 +36,7 @@ struct vdso_data {
317 + __u32 tk_shift; /* Shift used for xtime_nsec 0x60 */
318 + __u32 ts_dir; /* TOD steering direction 0x64 */
319 + __u64 ts_end; /* TOD steering end 0x68 */
320 ++ __u32 hrtimer_res; /* hrtimer resolution 0x70 */
321 + };
322 +
323 + struct vdso_per_cpu_data {
324 +diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
325 +index b6628586ab70..a65cb4924bdb 100644
326 +--- a/arch/s390/kernel/asm-offsets.c
327 ++++ b/arch/s390/kernel/asm-offsets.c
328 +@@ -76,6 +76,7 @@ int main(void)
329 + OFFSET(__VDSO_TK_SHIFT, vdso_data, tk_shift);
330 + OFFSET(__VDSO_TS_DIR, vdso_data, ts_dir);
331 + OFFSET(__VDSO_TS_END, vdso_data, ts_end);
332 ++ OFFSET(__VDSO_CLOCK_REALTIME_RES, vdso_data, hrtimer_res);
333 + OFFSET(__VDSO_ECTG_BASE, vdso_per_cpu_data, ectg_timer_base);
334 + OFFSET(__VDSO_ECTG_USER, vdso_per_cpu_data, ectg_user_time);
335 + OFFSET(__VDSO_CPU_NR, vdso_per_cpu_data, cpu_nr);
336 +@@ -87,7 +88,6 @@ int main(void)
337 + DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
338 + DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
339 + DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
340 +- DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
341 + DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
342 + BLANK();
343 + /* idle data offsets */
344 +diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
345 +index bc85987727f0..c544b7a11ebb 100644
346 +--- a/arch/s390/kernel/entry.S
347 ++++ b/arch/s390/kernel/entry.S
348 +@@ -368,9 +368,9 @@ ENTRY(system_call)
349 + jnz .Lsysc_nr_ok
350 + # svc 0: system call number in %r1
351 + llgfr %r1,%r1 # clear high word in r1
352 ++ sth %r1,__PT_INT_CODE+2(%r11)
353 + cghi %r1,NR_syscalls
354 + jnl .Lsysc_nr_ok
355 +- sth %r1,__PT_INT_CODE+2(%r11)
356 + slag %r8,%r1,3
357 + .Lsysc_nr_ok:
358 + xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
359 +diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
360 +index ad71132374f0..5aa786063eb3 100644
361 +--- a/arch/s390/kernel/ptrace.c
362 ++++ b/arch/s390/kernel/ptrace.c
363 +@@ -324,6 +324,25 @@ static inline void __poke_user_per(struct task_struct *child,
364 + child->thread.per_user.end = data;
365 + }
366 +
367 ++static void fixup_int_code(struct task_struct *child, addr_t data)
368 ++{
369 ++ struct pt_regs *regs = task_pt_regs(child);
370 ++ int ilc = regs->int_code >> 16;
371 ++ u16 insn;
372 ++
373 ++ if (ilc > 6)
374 ++ return;
375 ++
376 ++ if (ptrace_access_vm(child, regs->psw.addr - (regs->int_code >> 16),
377 ++ &insn, sizeof(insn), FOLL_FORCE) != sizeof(insn))
378 ++ return;
379 ++
380 ++ /* double check that tracee stopped on svc instruction */
381 ++ if ((insn >> 8) != 0xa)
382 ++ return;
383 ++
384 ++ regs->int_code = 0x20000 | (data & 0xffff);
385 ++}
386 + /*
387 + * Write a word to the user area of a process at location addr. This
388 + * operation does have an additional problem compared to peek_user.
389 +@@ -335,7 +354,9 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
390 + struct user *dummy = NULL;
391 + addr_t offset;
392 +
393 ++
394 + if (addr < (addr_t) &dummy->regs.acrs) {
395 ++ struct pt_regs *regs = task_pt_regs(child);
396 + /*
397 + * psw and gprs are stored on the stack
398 + */
399 +@@ -353,7 +374,11 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
400 + /* Invalid addressing mode bits */
401 + return -EINVAL;
402 + }
403 +- *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
404 ++
405 ++ if (test_pt_regs_flag(regs, PIF_SYSCALL) &&
406 ++ addr == offsetof(struct user, regs.gprs[2]))
407 ++ fixup_int_code(child, data);
408 ++ *(addr_t *)((addr_t) &regs->psw + addr) = data;
409 +
410 + } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
411 + /*
412 +@@ -719,6 +744,10 @@ static int __poke_user_compat(struct task_struct *child,
413 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) |
414 + (__u64)(tmp & PSW32_ADDR_AMODE);
415 + } else {
416 ++
417 ++ if (test_pt_regs_flag(regs, PIF_SYSCALL) &&
418 ++ addr == offsetof(struct compat_user, regs.gprs[2]))
419 ++ fixup_int_code(child, data);
420 + /* gpr 0-15 */
421 + *(__u32*)((addr_t) &regs->psw + addr*2 + 4) = tmp;
422 + }
423 +@@ -844,11 +873,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
424 + * call number to gprs[2].
425 + */
426 + if (test_thread_flag(TIF_SYSCALL_TRACE) &&
427 +- (tracehook_report_syscall_entry(regs) ||
428 +- regs->gprs[2] >= NR_syscalls)) {
429 ++ tracehook_report_syscall_entry(regs)) {
430 + /*
431 +- * Tracing decided this syscall should not happen or the
432 +- * debugger stored an invalid system call number. Skip
433 ++ * Tracing decided this syscall should not happen. Skip
434 + * the system call and the system call restart handling.
435 + */
436 + clear_pt_regs_flag(regs, PIF_SYSCALL);
437 +diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
438 +index e8766beee5ad..8ea9db599d38 100644
439 +--- a/arch/s390/kernel/time.c
440 ++++ b/arch/s390/kernel/time.c
441 +@@ -310,6 +310,7 @@ void update_vsyscall(struct timekeeper *tk)
442 +
443 + vdso_data->tk_mult = tk->tkr_mono.mult;
444 + vdso_data->tk_shift = tk->tkr_mono.shift;
445 ++ vdso_data->hrtimer_res = hrtimer_resolution;
446 + smp_wmb();
447 + ++vdso_data->tb_update_count;
448 + }
449 +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
450 +index bec19e7e6e1c..4a66a1cb919b 100644
451 +--- a/arch/s390/kernel/vdso64/Makefile
452 ++++ b/arch/s390/kernel/vdso64/Makefile
453 +@@ -18,8 +18,8 @@ KBUILD_AFLAGS_64 += -m64 -s
454 +
455 + KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
456 + KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
457 +-KBUILD_CFLAGS_64 += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
458 +- -Wl,--hash-style=both
459 ++ldflags-y := -fPIC -shared -nostdlib -soname=linux-vdso64.so.1 \
460 ++ --hash-style=both --build-id -T
461 +
462 + $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
463 + $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64)
464 +@@ -37,8 +37,8 @@ KASAN_SANITIZE := n
465 + $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
466 +
467 + # link rule for the .so file, .lds has to be first
468 +-$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE
469 +- $(call if_changed,vdso64ld)
470 ++$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) FORCE
471 ++ $(call if_changed,ld)
472 +
473 + # strip rule for the .so file
474 + $(obj)/%.so: OBJCOPYFLAGS := -S
475 +@@ -50,8 +50,6 @@ $(obj-vdso64): %.o: %.S FORCE
476 + $(call if_changed_dep,vdso64as)
477 +
478 + # actual build commands
479 +-quiet_cmd_vdso64ld = VDSO64L $@
480 +- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
481 + quiet_cmd_vdso64as = VDSO64A $@
482 + cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
483 +
484 +diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S
485 +index 081435398e0a..0c79caa32b59 100644
486 +--- a/arch/s390/kernel/vdso64/clock_getres.S
487 ++++ b/arch/s390/kernel/vdso64/clock_getres.S
488 +@@ -17,12 +17,14 @@
489 + .type __kernel_clock_getres,@function
490 + __kernel_clock_getres:
491 + CFI_STARTPROC
492 +- larl %r1,4f
493 ++ larl %r1,3f
494 ++ lg %r0,0(%r1)
495 + cghi %r2,__CLOCK_REALTIME_COARSE
496 + je 0f
497 + cghi %r2,__CLOCK_MONOTONIC_COARSE
498 + je 0f
499 +- larl %r1,3f
500 ++ larl %r1,_vdso_data
501 ++ llgf %r0,__VDSO_CLOCK_REALTIME_RES(%r1)
502 + cghi %r2,__CLOCK_REALTIME
503 + je 0f
504 + cghi %r2,__CLOCK_MONOTONIC
505 +@@ -36,7 +38,6 @@ __kernel_clock_getres:
506 + jz 2f
507 + 0: ltgr %r3,%r3
508 + jz 1f /* res == NULL */
509 +- lg %r0,0(%r1)
510 + xc 0(8,%r3),0(%r3) /* set tp->tv_sec to zero */
511 + stg %r0,8(%r3) /* store tp->tv_usec */
512 + 1: lghi %r2,0
513 +@@ -45,6 +46,5 @@ __kernel_clock_getres:
514 + svc 0
515 + br %r14
516 + CFI_ENDPROC
517 +-3: .quad __CLOCK_REALTIME_RES
518 +-4: .quad __CLOCK_COARSE_RES
519 ++3: .quad __CLOCK_COARSE_RES
520 + .size __kernel_clock_getres,.-__kernel_clock_getres
521 +diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
522 +index 60f7205ebe40..646dd58169ec 100644
523 +--- a/arch/sparc/kernel/ptrace_32.c
524 ++++ b/arch/sparc/kernel/ptrace_32.c
525 +@@ -168,12 +168,17 @@ static int genregs32_set(struct task_struct *target,
526 + if (ret || !count)
527 + return ret;
528 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
529 +- &regs->y,
530 ++ &regs->npc,
531 + 34 * sizeof(u32), 35 * sizeof(u32));
532 + if (ret || !count)
533 + return ret;
534 ++ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
535 ++ &regs->y,
536 ++ 35 * sizeof(u32), 36 * sizeof(u32));
537 ++ if (ret || !count)
538 ++ return ret;
539 + return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
540 +- 35 * sizeof(u32), 38 * sizeof(u32));
541 ++ 36 * sizeof(u32), 38 * sizeof(u32));
542 + }
543 +
544 + static int fpregs32_get(struct task_struct *target,
545 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
546 +index 7d91a3f5b26a..742de9d97ba1 100644
547 +--- a/arch/x86/include/asm/kvm_host.h
548 ++++ b/arch/x86/include/asm/kvm_host.h
549 +@@ -1160,7 +1160,7 @@ struct kvm_x86_ops {
550 + void (*enable_log_dirty_pt_masked)(struct kvm *kvm,
551 + struct kvm_memory_slot *slot,
552 + gfn_t offset, unsigned long mask);
553 +- int (*write_log_dirty)(struct kvm_vcpu *vcpu);
554 ++ int (*write_log_dirty)(struct kvm_vcpu *vcpu, gpa_t l2_gpa);
555 +
556 + /* pmu operations of sub-arch */
557 + const struct kvm_pmu_ops *pmu_ops;
558 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
559 +index 650df6d21049..9b3f25e14608 100644
560 +--- a/arch/x86/kernel/cpu/common.c
561 ++++ b/arch/x86/kernel/cpu/common.c
562 +@@ -366,6 +366,9 @@ out:
563 + cr4_clear_bits(X86_CR4_UMIP);
564 + }
565 +
566 ++/* These bits should not change their value after CPU init is finished. */
567 ++static const unsigned long cr4_pinned_mask =
568 ++ X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | X86_CR4_FSGSBASE;
569 + static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
570 + static unsigned long cr4_pinned_bits __ro_after_init;
571 +
572 +@@ -390,20 +393,20 @@ EXPORT_SYMBOL(native_write_cr0);
573 +
574 + void native_write_cr4(unsigned long val)
575 + {
576 +- unsigned long bits_missing = 0;
577 ++ unsigned long bits_changed = 0;
578 +
579 + set_register:
580 + asm volatile("mov %0,%%cr4": "+r" (val), "+m" (cr4_pinned_bits));
581 +
582 + if (static_branch_likely(&cr_pinning)) {
583 +- if (unlikely((val & cr4_pinned_bits) != cr4_pinned_bits)) {
584 +- bits_missing = ~val & cr4_pinned_bits;
585 +- val |= bits_missing;
586 ++ if (unlikely((val & cr4_pinned_mask) != cr4_pinned_bits)) {
587 ++ bits_changed = (val & cr4_pinned_mask) ^ cr4_pinned_bits;
588 ++ val = (val & ~cr4_pinned_mask) | cr4_pinned_bits;
589 + goto set_register;
590 + }
591 +- /* Warn after we've set the missing bits. */
592 +- WARN_ONCE(bits_missing, "CR4 bits went missing: %lx!?\n",
593 +- bits_missing);
594 ++ /* Warn after we've corrected the changed bits. */
595 ++ WARN_ONCE(bits_changed, "pinned CR4 bits changed: 0x%lx!?\n",
596 ++ bits_changed);
597 + }
598 + }
599 + EXPORT_SYMBOL(native_write_cr4);
600 +@@ -415,7 +418,7 @@ void cr4_init(void)
601 + if (boot_cpu_has(X86_FEATURE_PCID))
602 + cr4 |= X86_CR4_PCIDE;
603 + if (static_branch_likely(&cr_pinning))
604 +- cr4 |= cr4_pinned_bits;
605 ++ cr4 = (cr4 & ~cr4_pinned_mask) | cr4_pinned_bits;
606 +
607 + __write_cr4(cr4);
608 +
609 +@@ -430,10 +433,7 @@ void cr4_init(void)
610 + */
611 + static void __init setup_cr_pinning(void)
612 + {
613 +- unsigned long mask;
614 +-
615 +- mask = (X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP);
616 +- cr4_pinned_bits = this_cpu_read(cpu_tlbstate.cr4) & mask;
617 ++ cr4_pinned_bits = this_cpu_read(cpu_tlbstate.cr4) & cr4_pinned_mask;
618 + static_key_enable(&cr_pinning.key);
619 + }
620 +
621 +diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
622 +index 20856d80dce3..54b711bc0607 100644
623 +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
624 ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
625 +@@ -1027,6 +1027,7 @@ static int rdt_cdp_peer_get(struct rdt_resource *r, struct rdt_domain *d,
626 + _d_cdp = rdt_find_domain(_r_cdp, d->id, NULL);
627 + if (WARN_ON(IS_ERR_OR_NULL(_d_cdp))) {
628 + _r_cdp = NULL;
629 ++ _d_cdp = NULL;
630 + ret = -EINVAL;
631 + }
632 +
633 +diff --git a/arch/x86/kernel/cpu/umwait.c b/arch/x86/kernel/cpu/umwait.c
634 +index c222f283b456..32b4dc9030aa 100644
635 +--- a/arch/x86/kernel/cpu/umwait.c
636 ++++ b/arch/x86/kernel/cpu/umwait.c
637 +@@ -17,12 +17,6 @@
638 + */
639 + static u32 umwait_control_cached = UMWAIT_CTRL_VAL(100000, UMWAIT_C02_ENABLE);
640 +
641 +-u32 get_umwait_control_msr(void)
642 +-{
643 +- return umwait_control_cached;
644 +-}
645 +-EXPORT_SYMBOL_GPL(get_umwait_control_msr);
646 +-
647 + /*
648 + * Cache the original IA32_UMWAIT_CONTROL MSR value which is configured by
649 + * hardware or BIOS before kernel boot.
650 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
651 +index a3824ae9a634..aab02ea2d2cb 100644
652 +--- a/arch/x86/kvm/mmu.c
653 ++++ b/arch/x86/kvm/mmu.c
654 +@@ -1819,10 +1819,10 @@ void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
655 + * Emulate arch specific page modification logging for the
656 + * nested hypervisor
657 + */
658 +-int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu)
659 ++int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu, gpa_t l2_gpa)
660 + {
661 + if (kvm_x86_ops->write_log_dirty)
662 +- return kvm_x86_ops->write_log_dirty(vcpu);
663 ++ return kvm_x86_ops->write_log_dirty(vcpu, l2_gpa);
664 +
665 + return 0;
666 + }
667 +diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
668 +index d55674f44a18..6f2208cf30df 100644
669 +--- a/arch/x86/kvm/mmu.h
670 ++++ b/arch/x86/kvm/mmu.h
671 +@@ -209,7 +209,7 @@ void kvm_mmu_gfn_disallow_lpage(struct kvm_memory_slot *slot, gfn_t gfn);
672 + void kvm_mmu_gfn_allow_lpage(struct kvm_memory_slot *slot, gfn_t gfn);
673 + bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm,
674 + struct kvm_memory_slot *slot, u64 gfn);
675 +-int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu);
676 ++int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu, gpa_t l2_gpa);
677 +
678 + int kvm_mmu_post_init_vm(struct kvm *kvm);
679 + void kvm_mmu_pre_destroy_vm(struct kvm *kvm);
680 +diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
681 +index 4e3f137ffa8c..a20fc1ba607f 100644
682 +--- a/arch/x86/kvm/paging_tmpl.h
683 ++++ b/arch/x86/kvm/paging_tmpl.h
684 +@@ -220,7 +220,7 @@ static inline unsigned FNAME(gpte_access)(u64 gpte)
685 + static int FNAME(update_accessed_dirty_bits)(struct kvm_vcpu *vcpu,
686 + struct kvm_mmu *mmu,
687 + struct guest_walker *walker,
688 +- int write_fault)
689 ++ gpa_t addr, int write_fault)
690 + {
691 + unsigned level, index;
692 + pt_element_t pte, orig_pte;
693 +@@ -245,7 +245,7 @@ static int FNAME(update_accessed_dirty_bits)(struct kvm_vcpu *vcpu,
694 + !(pte & PT_GUEST_DIRTY_MASK)) {
695 + trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
696 + #if PTTYPE == PTTYPE_EPT
697 +- if (kvm_arch_write_log_dirty(vcpu))
698 ++ if (kvm_arch_write_log_dirty(vcpu, addr))
699 + return -EINVAL;
700 + #endif
701 + pte |= PT_GUEST_DIRTY_MASK;
702 +@@ -442,7 +442,8 @@ retry_walk:
703 + (PT_GUEST_DIRTY_SHIFT - PT_GUEST_ACCESSED_SHIFT);
704 +
705 + if (unlikely(!accessed_dirty)) {
706 +- ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker, write_fault);
707 ++ ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker,
708 ++ addr, write_fault);
709 + if (unlikely(ret < 0))
710 + goto error;
711 + else if (ret)
712 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
713 +index 5fac01865a2d..10e6471896cd 100644
714 +--- a/arch/x86/kvm/vmx/vmx.c
715 ++++ b/arch/x86/kvm/vmx/vmx.c
716 +@@ -6427,23 +6427,6 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx)
717 + msrs[i].host, false);
718 + }
719 +
720 +-static void atomic_switch_umwait_control_msr(struct vcpu_vmx *vmx)
721 +-{
722 +- u32 host_umwait_control;
723 +-
724 +- if (!vmx_has_waitpkg(vmx))
725 +- return;
726 +-
727 +- host_umwait_control = get_umwait_control_msr();
728 +-
729 +- if (vmx->msr_ia32_umwait_control != host_umwait_control)
730 +- add_atomic_switch_msr(vmx, MSR_IA32_UMWAIT_CONTROL,
731 +- vmx->msr_ia32_umwait_control,
732 +- host_umwait_control, false);
733 +- else
734 +- clear_atomic_switch_msr(vmx, MSR_IA32_UMWAIT_CONTROL);
735 +-}
736 +-
737 + static void vmx_update_hv_timer(struct kvm_vcpu *vcpu)
738 + {
739 + struct vcpu_vmx *vmx = to_vmx(vcpu);
740 +@@ -6533,7 +6516,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
741 + pt_guest_enter(vmx);
742 +
743 + atomic_switch_perf_msrs(vmx);
744 +- atomic_switch_umwait_control_msr(vmx);
745 +
746 + if (enable_preemption_timer)
747 + vmx_update_hv_timer(vcpu);
748 +@@ -7272,11 +7254,11 @@ static void vmx_flush_log_dirty(struct kvm *kvm)
749 + kvm_flush_pml_buffers(kvm);
750 + }
751 +
752 +-static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu)
753 ++static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu, gpa_t gpa)
754 + {
755 + struct vmcs12 *vmcs12;
756 + struct vcpu_vmx *vmx = to_vmx(vcpu);
757 +- gpa_t gpa, dst;
758 ++ gpa_t dst;
759 +
760 + if (is_guest_mode(vcpu)) {
761 + WARN_ON_ONCE(vmx->nested.pml_full);
762 +@@ -7295,7 +7277,7 @@ static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu)
763 + return 1;
764 + }
765 +
766 +- gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS) & ~0xFFFull;
767 ++ gpa &= ~0xFFFull;
768 + dst = vmcs12->pml_address + sizeof(u64) * vmcs12->guest_pml_index;
769 +
770 + if (kvm_write_guest_page(vcpu->kvm, gpa_to_gfn(dst), &gpa,
771 +diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
772 +index 295c5f83842e..a1919ec7fd10 100644
773 +--- a/arch/x86/kvm/vmx/vmx.h
774 ++++ b/arch/x86/kvm/vmx/vmx.h
775 +@@ -14,8 +14,6 @@
776 + extern const u32 vmx_msr_index[];
777 + extern u64 host_efer;
778 +
779 +-extern u32 get_umwait_control_msr(void);
780 +-
781 + #define MSR_TYPE_R 1
782 + #define MSR_TYPE_W 2
783 + #define MSR_TYPE_RW 3
784 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
785 +index fff279fb173b..eed1866ae4d3 100644
786 +--- a/arch/x86/kvm/x86.c
787 ++++ b/arch/x86/kvm/x86.c
788 +@@ -2753,7 +2753,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
789 + return kvm_mtrr_set_msr(vcpu, msr, data);
790 + case MSR_IA32_APICBASE:
791 + return kvm_set_apic_base(vcpu, msr_info);
792 +- case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
793 ++ case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
794 + return kvm_x2apic_msr_write(vcpu, msr, data);
795 + case MSR_IA32_TSCDEADLINE:
796 + kvm_set_lapic_tscdeadline_msr(vcpu, data);
797 +@@ -3057,7 +3057,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
798 + case MSR_IA32_APICBASE:
799 + msr_info->data = kvm_get_apic_base(vcpu);
800 + break;
801 +- case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
802 ++ case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
803 + return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data);
804 + break;
805 + case MSR_IA32_TSCDEADLINE:
806 +diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
807 +index fff28c6f73a2..b0dfac3d3df7 100644
808 +--- a/arch/x86/lib/usercopy_64.c
809 ++++ b/arch/x86/lib/usercopy_64.c
810 +@@ -24,6 +24,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
811 + asm volatile(
812 + " testq %[size8],%[size8]\n"
813 + " jz 4f\n"
814 ++ " .align 16\n"
815 + "0: movq $0,(%[dst])\n"
816 + " addq $8,%[dst]\n"
817 + " decl %%ecx ; jnz 0b\n"
818 +diff --git a/block/bio-integrity.c b/block/bio-integrity.c
819 +index bf62c25cde8f..ae07dd78e951 100644
820 +--- a/block/bio-integrity.c
821 ++++ b/block/bio-integrity.c
822 +@@ -278,7 +278,6 @@ bool bio_integrity_prep(struct bio *bio)
823 +
824 + if (ret == 0) {
825 + printk(KERN_ERR "could not attach integrity payload\n");
826 +- kfree(buf);
827 + status = BLK_STS_RESOURCE;
828 + goto err_end_io;
829 + }
830 +diff --git a/block/blk-mq.c b/block/blk-mq.c
831 +index 0550366e25d8..f1b930a300a3 100644
832 +--- a/block/blk-mq.c
833 ++++ b/block/blk-mq.c
834 +@@ -3279,7 +3279,9 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
835 +
836 + if (set->nr_maps == 1 && nr_hw_queues > nr_cpu_ids)
837 + nr_hw_queues = nr_cpu_ids;
838 +- if (nr_hw_queues < 1 || nr_hw_queues == set->nr_hw_queues)
839 ++ if (nr_hw_queues < 1)
840 ++ return;
841 ++ if (set->nr_maps == 1 && nr_hw_queues == set->nr_hw_queues)
842 + return;
843 +
844 + list_for_each_entry(q, &set->tag_list, tag_set_list)
845 +diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
846 +index 57d9d574d4dd..01738d8e888e 100644
847 +--- a/drivers/acpi/acpi_configfs.c
848 ++++ b/drivers/acpi/acpi_configfs.c
849 +@@ -11,6 +11,7 @@
850 + #include <linux/module.h>
851 + #include <linux/configfs.h>
852 + #include <linux/acpi.h>
853 ++#include <linux/security.h>
854 +
855 + #include "acpica/accommon.h"
856 + #include "acpica/actables.h"
857 +@@ -28,7 +29,10 @@ static ssize_t acpi_table_aml_write(struct config_item *cfg,
858 + {
859 + const struct acpi_table_header *header = data;
860 + struct acpi_table *table;
861 +- int ret;
862 ++ int ret = security_locked_down(LOCKDOWN_ACPI_TABLES);
863 ++
864 ++ if (ret)
865 ++ return ret;
866 +
867 + table = container_of(cfg, struct acpi_table, cfg);
868 +
869 +diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
870 +index 3a89909b50a6..76c668c05fa0 100644
871 +--- a/drivers/acpi/sysfs.c
872 ++++ b/drivers/acpi/sysfs.c
873 +@@ -938,13 +938,13 @@ static void __exit interrupt_stats_exit(void)
874 + }
875 +
876 + static ssize_t
877 +-acpi_show_profile(struct device *dev, struct device_attribute *attr,
878 ++acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr,
879 + char *buf)
880 + {
881 + return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
882 + }
883 +
884 +-static const struct device_attribute pm_profile_attr =
885 ++static const struct kobj_attribute pm_profile_attr =
886 + __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
887 +
888 + static ssize_t hotplug_enabled_show(struct kobject *kobj,
889 +diff --git a/drivers/android/binder.c b/drivers/android/binder.c
890 +index 34a6de65aa7e..5e6586af21b7 100644
891 +--- a/drivers/android/binder.c
892 ++++ b/drivers/android/binder.c
893 +@@ -4688,8 +4688,15 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc)
894 +
895 + static void binder_free_proc(struct binder_proc *proc)
896 + {
897 ++ struct binder_device *device;
898 ++
899 + BUG_ON(!list_empty(&proc->todo));
900 + BUG_ON(!list_empty(&proc->delivered_death));
901 ++ device = container_of(proc->context, struct binder_device, context);
902 ++ if (refcount_dec_and_test(&device->ref)) {
903 ++ kfree(proc->context->name);
904 ++ kfree(device);
905 ++ }
906 + binder_alloc_deferred_release(&proc->alloc);
907 + put_task_struct(proc->tsk);
908 + binder_stats_deleted(BINDER_STAT_PROC);
909 +@@ -5408,7 +5415,6 @@ static int binder_node_release(struct binder_node *node, int refs)
910 + static void binder_deferred_release(struct binder_proc *proc)
911 + {
912 + struct binder_context *context = proc->context;
913 +- struct binder_device *device;
914 + struct rb_node *n;
915 + int threads, nodes, incoming_refs, outgoing_refs, active_transactions;
916 +
917 +@@ -5425,12 +5431,6 @@ static void binder_deferred_release(struct binder_proc *proc)
918 + context->binder_context_mgr_node = NULL;
919 + }
920 + mutex_unlock(&context->context_mgr_node_lock);
921 +- device = container_of(proc->context, struct binder_device, context);
922 +- if (refcount_dec_and_test(&device->ref)) {
923 +- kfree(context->name);
924 +- kfree(device);
925 +- }
926 +- proc->context = NULL;
927 + binder_inner_proc_lock(proc);
928 + /*
929 + * Make sure proc stays alive after we
930 +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
931 +index 5af34a3201ed..5596c9b6ebf2 100644
932 +--- a/drivers/ata/libata-scsi.c
933 ++++ b/drivers/ata/libata-scsi.c
934 +@@ -3978,12 +3978,13 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
935 + {
936 + struct scsi_cmnd *scmd = qc->scsicmd;
937 + const u8 *cdb = scmd->cmnd;
938 +- const u8 *p;
939 + u8 pg, spg;
940 + unsigned six_byte, pg_len, hdr_len, bd_len;
941 + int len;
942 + u16 fp = (u16)-1;
943 + u8 bp = 0xff;
944 ++ u8 buffer[64];
945 ++ const u8 *p = buffer;
946 +
947 + VPRINTK("ENTER\n");
948 +
949 +@@ -4017,12 +4018,14 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
950 + if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len)
951 + goto invalid_param_len;
952 +
953 +- p = page_address(sg_page(scsi_sglist(scmd)));
954 +-
955 + /* Move past header and block descriptors. */
956 + if (len < hdr_len)
957 + goto invalid_param_len;
958 +
959 ++ if (!sg_copy_to_buffer(scsi_sglist(scmd), scsi_sg_count(scmd),
960 ++ buffer, sizeof(buffer)))
961 ++ goto invalid_param_len;
962 ++
963 + if (six_byte)
964 + bd_len = p[3];
965 + else
966 +diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
967 +index 3495e1733a8e..c35b7b993133 100644
968 +--- a/drivers/ata/sata_rcar.c
969 ++++ b/drivers/ata/sata_rcar.c
970 +@@ -905,7 +905,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
971 + pm_runtime_enable(dev);
972 + ret = pm_runtime_get_sync(dev);
973 + if (ret < 0)
974 +- goto err_pm_disable;
975 ++ goto err_pm_put;
976 +
977 + host = ata_host_alloc(dev, 1);
978 + if (!host) {
979 +@@ -935,7 +935,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
980 +
981 + err_pm_put:
982 + pm_runtime_put(dev);
983 +-err_pm_disable:
984 + pm_runtime_disable(dev);
985 + return ret;
986 + }
987 +@@ -989,8 +988,10 @@ static int sata_rcar_resume(struct device *dev)
988 + int ret;
989 +
990 + ret = pm_runtime_get_sync(dev);
991 +- if (ret < 0)
992 ++ if (ret < 0) {
993 ++ pm_runtime_put(dev);
994 + return ret;
995 ++ }
996 +
997 + if (priv->type == RCAR_GEN3_SATA) {
998 + sata_rcar_init_module(priv);
999 +@@ -1015,8 +1016,10 @@ static int sata_rcar_restore(struct device *dev)
1000 + int ret;
1001 +
1002 + ret = pm_runtime_get_sync(dev);
1003 +- if (ret < 0)
1004 ++ if (ret < 0) {
1005 ++ pm_runtime_put(dev);
1006 + return ret;
1007 ++ }
1008 +
1009 + sata_rcar_setup_port(host);
1010 +
1011 +diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
1012 +index 59f911e57719..508bbd6ea439 100644
1013 +--- a/drivers/base/regmap/regmap.c
1014 ++++ b/drivers/base/regmap/regmap.c
1015 +@@ -1356,6 +1356,7 @@ void regmap_exit(struct regmap *map)
1016 + if (map->hwlock)
1017 + hwspin_lock_free(map->hwlock);
1018 + kfree_const(map->name);
1019 ++ kfree(map->patch);
1020 + kfree(map);
1021 + }
1022 + EXPORT_SYMBOL_GPL(regmap_exit);
1023 +diff --git a/drivers/block/loop.c b/drivers/block/loop.c
1024 +index 57ed6b70d295..565e35e69f24 100644
1025 +--- a/drivers/block/loop.c
1026 ++++ b/drivers/block/loop.c
1027 +@@ -1284,7 +1284,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
1028 + if (lo->lo_offset != info->lo_offset ||
1029 + lo->lo_sizelimit != info->lo_sizelimit) {
1030 + sync_blockdev(lo->lo_device);
1031 +- kill_bdev(lo->lo_device);
1032 ++ invalidate_bdev(lo->lo_device);
1033 + }
1034 +
1035 + /* I/O need to be drained during transfer transition */
1036 +@@ -1558,12 +1558,12 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
1037 +
1038 + if (lo->lo_queue->limits.logical_block_size != arg) {
1039 + sync_blockdev(lo->lo_device);
1040 +- kill_bdev(lo->lo_device);
1041 ++ invalidate_bdev(lo->lo_device);
1042 + }
1043 +
1044 + blk_mq_freeze_queue(lo->lo_queue);
1045 +
1046 +- /* kill_bdev should have truncated all the pages */
1047 ++ /* invalidate_bdev should have truncated all the pages */
1048 + if (lo->lo_queue->limits.logical_block_size != arg &&
1049 + lo->lo_device->bd_inode->i_mapping->nrpages) {
1050 + err = -EAGAIN;
1051 +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
1052 +index f0bc0841cbc4..553c0e279621 100644
1053 +--- a/drivers/bus/ti-sysc.c
1054 ++++ b/drivers/bus/ti-sysc.c
1055 +@@ -880,10 +880,13 @@ static int sysc_enable_module(struct device *dev)
1056 + regbits = ddata->cap->regbits;
1057 + reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
1058 +
1059 +- /* Set CLOCKACTIVITY, we only use it for ick */
1060 ++ /*
1061 ++ * Set CLOCKACTIVITY, we only use it for ick. And we only configure it
1062 ++ * based on the SYSC_QUIRK_USE_CLOCKACT flag, not based on the hardware
1063 ++ * capabilities. See the old HWMOD_SET_DEFAULT_CLOCKACT flag.
1064 ++ */
1065 + if (regbits->clkact_shift >= 0 &&
1066 +- (ddata->cfg.quirks & SYSC_QUIRK_USE_CLOCKACT ||
1067 +- ddata->cfg.sysc_val & BIT(regbits->clkact_shift)))
1068 ++ (ddata->cfg.quirks & SYSC_QUIRK_USE_CLOCKACT))
1069 + reg |= SYSC_CLOCACT_ICK << regbits->clkact_shift;
1070 +
1071 + /* Set SIDLE mode */
1072 +@@ -938,6 +941,9 @@ set_autoidle:
1073 + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
1074 + }
1075 +
1076 ++ /* Flush posted write */
1077 ++ sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
1078 ++
1079 + if (ddata->module_enable_quirk)
1080 + ddata->module_enable_quirk(ddata);
1081 +
1082 +@@ -1018,6 +1024,9 @@ set_sidle:
1083 + reg |= 1 << regbits->autoidle_shift;
1084 + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
1085 +
1086 ++ /* Flush posted write */
1087 ++ sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
1088 ++
1089 + return 0;
1090 + }
1091 +
1092 +diff --git a/drivers/char/hw_random/ks-sa-rng.c b/drivers/char/hw_random/ks-sa-rng.c
1093 +index a67430010aa6..5c7d3dfcfdd0 100644
1094 +--- a/drivers/char/hw_random/ks-sa-rng.c
1095 ++++ b/drivers/char/hw_random/ks-sa-rng.c
1096 +@@ -208,6 +208,7 @@ static int ks_sa_rng_probe(struct platform_device *pdev)
1097 + ret = pm_runtime_get_sync(dev);
1098 + if (ret < 0) {
1099 + dev_err(dev, "Failed to enable SA power-domain\n");
1100 ++ pm_runtime_put_noidle(dev);
1101 + pm_runtime_disable(dev);
1102 + return ret;
1103 + }
1104 +diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
1105 +index 6282ee2f361c..a8901f90a61a 100644
1106 +--- a/drivers/clk/sifive/fu540-prci.c
1107 ++++ b/drivers/clk/sifive/fu540-prci.c
1108 +@@ -586,7 +586,10 @@ static int sifive_fu540_prci_probe(struct platform_device *pdev)
1109 + struct __prci_data *pd;
1110 + int r;
1111 +
1112 +- pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
1113 ++ pd = devm_kzalloc(dev,
1114 ++ struct_size(pd, hw_clks.hws,
1115 ++ ARRAY_SIZE(__prci_init_clocks)),
1116 ++ GFP_KERNEL);
1117 + if (!pd)
1118 + return -ENOMEM;
1119 +
1120 +diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
1121 +index d6dd5f503fa2..e8f71a50ba89 100644
1122 +--- a/drivers/firmware/efi/esrt.c
1123 ++++ b/drivers/firmware/efi/esrt.c
1124 +@@ -181,7 +181,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
1125 + rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
1126 + "entry%d", entry_num);
1127 + if (rc) {
1128 +- kfree(entry);
1129 ++ kobject_put(&entry->kobj);
1130 + return rc;
1131 + }
1132 + }
1133 +diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
1134 +index bd715012185c..23fc16dc92b4 100644
1135 +--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
1136 ++++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
1137 +@@ -1273,8 +1273,12 @@ static int sdma_v5_0_sw_fini(void *handle)
1138 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1139 + int i;
1140 +
1141 +- for (i = 0; i < adev->sdma.num_instances; i++)
1142 ++ for (i = 0; i < adev->sdma.num_instances; i++) {
1143 ++ if (adev->sdma.instance[i].fw != NULL)
1144 ++ release_firmware(adev->sdma.instance[i].fw);
1145 ++
1146 + amdgpu_ring_fini(&adev->sdma.instance[i].ring);
1147 ++ }
1148 +
1149 + return 0;
1150 + }
1151 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
1152 +index 40e3fc0c6942..aa0a617b8d44 100644
1153 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
1154 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
1155 +@@ -312,6 +312,7 @@ struct kfd_process *kfd_create_process(struct file *filep)
1156 + (int)process->lead_thread->pid);
1157 + if (ret) {
1158 + pr_warn("Creating procfs pid directory failed");
1159 ++ kobject_put(process->kobj);
1160 + goto out;
1161 + }
1162 +
1163 +diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
1164 +index 207435fa4f2c..51d07a4561ce 100644
1165 +--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
1166 ++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
1167 +@@ -1862,7 +1862,7 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
1168 +
1169 + kfree(rgb_regamma);
1170 + rgb_regamma_alloc_fail:
1171 +- kvfree(rgb_user);
1172 ++ kfree(rgb_user);
1173 + rgb_user_alloc_fail:
1174 + return ret;
1175 + }
1176 +diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
1177 +index d9e62ca65ab8..bd2e577c701f 100644
1178 +--- a/drivers/gpu/drm/radeon/ni_dpm.c
1179 ++++ b/drivers/gpu/drm/radeon/ni_dpm.c
1180 +@@ -2128,7 +2128,7 @@ static int ni_init_smc_spll_table(struct radeon_device *rdev)
1181 + if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
1182 + ret = -EINVAL;
1183 +
1184 +- if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
1185 ++ if (fb_div & ~(SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT))
1186 + ret = -EINVAL;
1187 +
1188 + if (clk_v & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT))
1189 +diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
1190 +index 1529849e217e..7cdba77b1420 100644
1191 +--- a/drivers/gpu/drm/rcar-du/Kconfig
1192 ++++ b/drivers/gpu/drm/rcar-du/Kconfig
1193 +@@ -23,6 +23,7 @@ config DRM_RCAR_DW_HDMI
1194 + config DRM_RCAR_LVDS
1195 + tristate "R-Car DU LVDS Encoder Support"
1196 + depends on DRM && DRM_BRIDGE && OF
1197 ++ select DRM_KMS_HELPER
1198 + select DRM_PANEL
1199 + select OF_FLATTREE
1200 + select OF_OVERLAY
1201 +diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
1202 +index e0c256922d4f..977d6f524649 100644
1203 +--- a/drivers/i2c/busses/i2c-fsi.c
1204 ++++ b/drivers/i2c/busses/i2c-fsi.c
1205 +@@ -98,7 +98,7 @@
1206 + #define I2C_STAT_DAT_REQ BIT(25)
1207 + #define I2C_STAT_CMD_COMP BIT(24)
1208 + #define I2C_STAT_STOP_ERR BIT(23)
1209 +-#define I2C_STAT_MAX_PORT GENMASK(19, 16)
1210 ++#define I2C_STAT_MAX_PORT GENMASK(22, 16)
1211 + #define I2C_STAT_ANY_INT BIT(15)
1212 + #define I2C_STAT_SCL_IN BIT(11)
1213 + #define I2C_STAT_SDA_IN BIT(10)
1214 +diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
1215 +index dbc43cfec19d..331f7cca9bab 100644
1216 +--- a/drivers/i2c/busses/i2c-tegra.c
1217 ++++ b/drivers/i2c/busses/i2c-tegra.c
1218 +@@ -1719,14 +1719,9 @@ static int tegra_i2c_remove(struct platform_device *pdev)
1219 + static int __maybe_unused tegra_i2c_suspend(struct device *dev)
1220 + {
1221 + struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev);
1222 +- int err;
1223 +
1224 + i2c_mark_adapter_suspended(&i2c_dev->adapter);
1225 +
1226 +- err = pm_runtime_force_suspend(dev);
1227 +- if (err < 0)
1228 +- return err;
1229 +-
1230 + return 0;
1231 + }
1232 +
1233 +@@ -1747,10 +1742,6 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev)
1234 + if (err)
1235 + return err;
1236 +
1237 +- err = pm_runtime_force_resume(dev);
1238 +- if (err < 0)
1239 +- return err;
1240 +-
1241 + i2c_mark_adapter_resumed(&i2c_dev->adapter);
1242 +
1243 + return 0;
1244 +diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c
1245 +index 3ac426a8ab5a..c2ae8c8cd429 100644
1246 +--- a/drivers/i2c/i2c-core-smbus.c
1247 ++++ b/drivers/i2c/i2c-core-smbus.c
1248 +@@ -495,6 +495,13 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
1249 + break;
1250 + case I2C_SMBUS_BLOCK_DATA:
1251 + case I2C_SMBUS_BLOCK_PROC_CALL:
1252 ++ if (msg[1].buf[0] > I2C_SMBUS_BLOCK_MAX) {
1253 ++ dev_err(&adapter->dev,
1254 ++ "Invalid block size returned: %d\n",
1255 ++ msg[1].buf[0]);
1256 ++ status = -EPROTO;
1257 ++ goto cleanup;
1258 ++ }
1259 + for (i = 0; i < msg[1].buf[0] + 1; i++)
1260 + data->block[i] = msg[1].buf[i];
1261 + break;
1262 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
1263 +index 8f776b7de45e..e3cd9d2b0dd2 100644
1264 +--- a/drivers/infiniband/core/cma.c
1265 ++++ b/drivers/infiniband/core/cma.c
1266 +@@ -1631,6 +1631,8 @@ static struct rdma_id_private *cma_find_listener(
1267 + {
1268 + struct rdma_id_private *id_priv, *id_priv_dev;
1269 +
1270 ++ lockdep_assert_held(&lock);
1271 ++
1272 + if (!bind_list)
1273 + return ERR_PTR(-EINVAL);
1274 +
1275 +@@ -1677,6 +1679,7 @@ cma_ib_id_from_event(struct ib_cm_id *cm_id,
1276 + }
1277 + }
1278 +
1279 ++ mutex_lock(&lock);
1280 + /*
1281 + * Net namespace might be getting deleted while route lookup,
1282 + * cm_id lookup is in progress. Therefore, perform netdevice
1283 +@@ -1718,6 +1721,7 @@ cma_ib_id_from_event(struct ib_cm_id *cm_id,
1284 + id_priv = cma_find_listener(bind_list, cm_id, ib_event, req, *net_dev);
1285 + err:
1286 + rcu_read_unlock();
1287 ++ mutex_unlock(&lock);
1288 + if (IS_ERR(id_priv) && *net_dev) {
1289 + dev_put(*net_dev);
1290 + *net_dev = NULL;
1291 +@@ -2473,6 +2477,8 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv,
1292 + struct net *net = id_priv->id.route.addr.dev_addr.net;
1293 + int ret;
1294 +
1295 ++ lockdep_assert_held(&lock);
1296 ++
1297 + if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1))
1298 + return;
1299 +
1300 +@@ -3245,6 +3251,8 @@ static void cma_bind_port(struct rdma_bind_list *bind_list,
1301 + u64 sid, mask;
1302 + __be16 port;
1303 +
1304 ++ lockdep_assert_held(&lock);
1305 ++
1306 + addr = cma_src_addr(id_priv);
1307 + port = htons(bind_list->port);
1308 +
1309 +@@ -3273,6 +3281,8 @@ static int cma_alloc_port(enum rdma_ucm_port_space ps,
1310 + struct rdma_bind_list *bind_list;
1311 + int ret;
1312 +
1313 ++ lockdep_assert_held(&lock);
1314 ++
1315 + bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL);
1316 + if (!bind_list)
1317 + return -ENOMEM;
1318 +@@ -3299,6 +3309,8 @@ static int cma_port_is_unique(struct rdma_bind_list *bind_list,
1319 + struct sockaddr *saddr = cma_src_addr(id_priv);
1320 + __be16 dport = cma_port(daddr);
1321 +
1322 ++ lockdep_assert_held(&lock);
1323 ++
1324 + hlist_for_each_entry(cur_id, &bind_list->owners, node) {
1325 + struct sockaddr *cur_daddr = cma_dst_addr(cur_id);
1326 + struct sockaddr *cur_saddr = cma_src_addr(cur_id);
1327 +@@ -3338,6 +3350,8 @@ static int cma_alloc_any_port(enum rdma_ucm_port_space ps,
1328 + unsigned int rover;
1329 + struct net *net = id_priv->id.route.addr.dev_addr.net;
1330 +
1331 ++ lockdep_assert_held(&lock);
1332 ++
1333 + inet_get_local_port_range(net, &low, &high);
1334 + remaining = (high - low) + 1;
1335 + rover = prandom_u32() % remaining + low;
1336 +@@ -3385,6 +3399,8 @@ static int cma_check_port(struct rdma_bind_list *bind_list,
1337 + struct rdma_id_private *cur_id;
1338 + struct sockaddr *addr, *cur_addr;
1339 +
1340 ++ lockdep_assert_held(&lock);
1341 ++
1342 + addr = cma_src_addr(id_priv);
1343 + hlist_for_each_entry(cur_id, &bind_list->owners, node) {
1344 + if (id_priv == cur_id)
1345 +@@ -3415,6 +3431,8 @@ static int cma_use_port(enum rdma_ucm_port_space ps,
1346 + unsigned short snum;
1347 + int ret;
1348 +
1349 ++ lockdep_assert_held(&lock);
1350 ++
1351 + snum = ntohs(cma_port(cma_src_addr(id_priv)));
1352 + if (snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))
1353 + return -EACCES;
1354 +diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
1355 +index 9947d16edef2..2284930b5f91 100644
1356 +--- a/drivers/infiniband/core/mad.c
1357 ++++ b/drivers/infiniband/core/mad.c
1358 +@@ -639,10 +639,10 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
1359 + xa_erase(&ib_mad_clients, mad_agent_priv->agent.hi_tid);
1360 +
1361 + flush_workqueue(port_priv->wq);
1362 +- ib_cancel_rmpp_recvs(mad_agent_priv);
1363 +
1364 + deref_mad_agent(mad_agent_priv);
1365 + wait_for_completion(&mad_agent_priv->comp);
1366 ++ ib_cancel_rmpp_recvs(mad_agent_priv);
1367 +
1368 + ib_mad_agent_security_cleanup(&mad_agent_priv->agent);
1369 +
1370 +@@ -2960,6 +2960,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
1371 + DMA_FROM_DEVICE);
1372 + if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device,
1373 + sg_list.addr))) {
1374 ++ kfree(mad_priv);
1375 + ret = -ENOMEM;
1376 + break;
1377 + }
1378 +diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c
1379 +index d268bf9c42ee..c29da2f4e339 100644
1380 +--- a/drivers/infiniband/hw/hfi1/debugfs.c
1381 ++++ b/drivers/infiniband/hw/hfi1/debugfs.c
1382 +@@ -985,15 +985,10 @@ static ssize_t qsfp2_debugfs_read(struct file *file, char __user *buf,
1383 + static int __i2c_debugfs_open(struct inode *in, struct file *fp, u32 target)
1384 + {
1385 + struct hfi1_pportdata *ppd;
1386 +- int ret;
1387 +
1388 + ppd = private2ppd(fp);
1389 +
1390 +- ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
1391 +- if (ret) /* failed - release the module */
1392 +- module_put(THIS_MODULE);
1393 +-
1394 +- return ret;
1395 ++ return acquire_chip_resource(ppd->dd, i2c_target(target), 0);
1396 + }
1397 +
1398 + static int i2c1_debugfs_open(struct inode *in, struct file *fp)
1399 +@@ -1013,7 +1008,6 @@ static int __i2c_debugfs_release(struct inode *in, struct file *fp, u32 target)
1400 + ppd = private2ppd(fp);
1401 +
1402 + release_chip_resource(ppd->dd, i2c_target(target));
1403 +- module_put(THIS_MODULE);
1404 +
1405 + return 0;
1406 + }
1407 +@@ -1031,18 +1025,10 @@ static int i2c2_debugfs_release(struct inode *in, struct file *fp)
1408 + static int __qsfp_debugfs_open(struct inode *in, struct file *fp, u32 target)
1409 + {
1410 + struct hfi1_pportdata *ppd;
1411 +- int ret;
1412 +-
1413 +- if (!try_module_get(THIS_MODULE))
1414 +- return -ENODEV;
1415 +
1416 + ppd = private2ppd(fp);
1417 +
1418 +- ret = acquire_chip_resource(ppd->dd, i2c_target(target), 0);
1419 +- if (ret) /* failed - release the module */
1420 +- module_put(THIS_MODULE);
1421 +-
1422 +- return ret;
1423 ++ return acquire_chip_resource(ppd->dd, i2c_target(target), 0);
1424 + }
1425 +
1426 + static int qsfp1_debugfs_open(struct inode *in, struct file *fp)
1427 +@@ -1062,7 +1048,6 @@ static int __qsfp_debugfs_release(struct inode *in, struct file *fp, u32 target)
1428 + ppd = private2ppd(fp);
1429 +
1430 + release_chip_resource(ppd->dd, i2c_target(target));
1431 +- module_put(THIS_MODULE);
1432 +
1433 + return 0;
1434 + }
1435 +diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
1436 +index 5e9732990be5..a7a926b7b562 100644
1437 +--- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
1438 ++++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
1439 +@@ -150,8 +150,17 @@ qedr_iw_issue_event(void *context,
1440 + if (params->cm_info) {
1441 + event.ird = params->cm_info->ird;
1442 + event.ord = params->cm_info->ord;
1443 +- event.private_data_len = params->cm_info->private_data_len;
1444 +- event.private_data = (void *)params->cm_info->private_data;
1445 ++ /* Only connect_request and reply have valid private data
1446 ++ * the rest of the events this may be left overs from
1447 ++ * connection establishment. CONNECT_REQUEST is issued via
1448 ++ * qedr_iw_mpa_request
1449 ++ */
1450 ++ if (event_type == IW_CM_EVENT_CONNECT_REPLY) {
1451 ++ event.private_data_len =
1452 ++ params->cm_info->private_data_len;
1453 ++ event.private_data =
1454 ++ (void *)params->cm_info->private_data;
1455 ++ }
1456 + }
1457 +
1458 + if (ep->cm_id)
1459 +diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
1460 +index d35465389357..19556c62c7ea 100644
1461 +--- a/drivers/infiniband/sw/rdmavt/qp.c
1462 ++++ b/drivers/infiniband/sw/rdmavt/qp.c
1463 +@@ -1196,7 +1196,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
1464 + err = alloc_ud_wq_attr(qp, rdi->dparms.node);
1465 + if (err) {
1466 + ret = (ERR_PTR(err));
1467 +- goto bail_driver_priv;
1468 ++ goto bail_rq_rvt;
1469 + }
1470 +
1471 + err = alloc_qpn(rdi, &rdi->qp_dev->qpn_table,
1472 +@@ -1300,9 +1300,11 @@ bail_qpn:
1473 + rvt_free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);
1474 +
1475 + bail_rq_wq:
1476 +- rvt_free_rq(&qp->r_rq);
1477 + free_ud_wq_attr(qp);
1478 +
1479 ++bail_rq_rvt:
1480 ++ rvt_free_rq(&qp->r_rq);
1481 ++
1482 + bail_driver_priv:
1483 + rdi->driver_f.qp_priv_free(rdi, qp);
1484 +
1485 +diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c
1486 +index c0a887240325..0520e70084f9 100644
1487 +--- a/drivers/infiniband/sw/siw/siw_qp_rx.c
1488 ++++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
1489 +@@ -139,7 +139,8 @@ static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx,
1490 + break;
1491 +
1492 + bytes = min(bytes, len);
1493 +- if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
1494 ++ if (siw_rx_kva(srx, (void *)(uintptr_t)buf_addr, bytes) ==
1495 ++ bytes) {
1496 + copied += bytes;
1497 + offset += bytes;
1498 + len -= bytes;
1499 +diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
1500 +index 9e393b9c5091..30ac0ba55864 100644
1501 +--- a/drivers/iommu/dmar.c
1502 ++++ b/drivers/iommu/dmar.c
1503 +@@ -898,7 +898,8 @@ int __init detect_intel_iommu(void)
1504 + if (!ret)
1505 + ret = dmar_walk_dmar_table((struct acpi_table_dmar *)dmar_tbl,
1506 + &validate_drhd_cb);
1507 +- if (!ret && !no_iommu && !iommu_detected && !dmar_disabled) {
1508 ++ if (!ret && !no_iommu && !iommu_detected &&
1509 ++ (!dmar_disabled || dmar_platform_optin())) {
1510 + iommu_detected = 1;
1511 + /* Make sure ACS will be enabled */
1512 + pci_request_acs();
1513 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
1514 +index 773ac2b0d606..6366b5fbb3a4 100644
1515 +--- a/drivers/iommu/intel-iommu.c
1516 ++++ b/drivers/iommu/intel-iommu.c
1517 +@@ -611,6 +611,12 @@ struct intel_iommu *domain_get_iommu(struct dmar_domain *domain)
1518 + return g_iommus[iommu_id];
1519 + }
1520 +
1521 ++static inline bool iommu_paging_structure_coherency(struct intel_iommu *iommu)
1522 ++{
1523 ++ return sm_supported(iommu) ?
1524 ++ ecap_smpwc(iommu->ecap) : ecap_coherent(iommu->ecap);
1525 ++}
1526 ++
1527 + static void domain_update_iommu_coherency(struct dmar_domain *domain)
1528 + {
1529 + struct dmar_drhd_unit *drhd;
1530 +@@ -622,7 +628,7 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain)
1531 +
1532 + for_each_domain_iommu(i, domain) {
1533 + found = true;
1534 +- if (!ecap_coherent(g_iommus[i]->ecap)) {
1535 ++ if (!iommu_paging_structure_coherency(g_iommus[i])) {
1536 + domain->iommu_coherency = 0;
1537 + break;
1538 + }
1539 +@@ -633,7 +639,7 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain)
1540 + /* No hardware attached; use lowest common denominator */
1541 + rcu_read_lock();
1542 + for_each_active_iommu(iommu, drhd) {
1543 +- if (!ecap_coherent(iommu->ecap)) {
1544 ++ if (!iommu_paging_structure_coherency(iommu)) {
1545 + domain->iommu_coherency = 0;
1546 + break;
1547 + }
1548 +@@ -2090,7 +2096,8 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
1549 +
1550 + context_set_fault_enable(context);
1551 + context_set_present(context);
1552 +- domain_flush_cache(domain, context, sizeof(*context));
1553 ++ if (!ecap_coherent(iommu->ecap))
1554 ++ clflush_cache_range(context, sizeof(*context));
1555 +
1556 + /*
1557 + * It's a non-present to present mapping. If hardware doesn't cache
1558 +diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
1559 +index 0d6ca723257f..67eb4e972cc3 100644
1560 +--- a/drivers/md/dm-writecache.c
1561 ++++ b/drivers/md/dm-writecache.c
1562 +@@ -279,6 +279,8 @@ static int persistent_memory_claim(struct dm_writecache *wc)
1563 + while (daa-- && i < p) {
1564 + pages[i++] = pfn_t_to_page(pfn);
1565 + pfn.val++;
1566 ++ if (!(i & 15))
1567 ++ cond_resched();
1568 + }
1569 + } while (i < p);
1570 + wc->memory_map = vmap(pages, p, VM_MAP, PAGE_KERNEL);
1571 +@@ -805,6 +807,8 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
1572 + writecache_wait_for_ios(wc, WRITE);
1573 + discarded_something = true;
1574 + }
1575 ++ if (!writecache_entry_is_committed(wc, e))
1576 ++ wc->uncommitted_blocks--;
1577 + writecache_free_entry(wc, e);
1578 + }
1579 +
1580 +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
1581 +index d4bbcdfd691a..aa693c8e285a 100644
1582 +--- a/drivers/net/ethernet/atheros/alx/main.c
1583 ++++ b/drivers/net/ethernet/atheros/alx/main.c
1584 +@@ -1249,8 +1249,12 @@ out_disable_adv_intr:
1585 +
1586 + static void __alx_stop(struct alx_priv *alx)
1587 + {
1588 +- alx_halt(alx);
1589 + alx_free_irq(alx);
1590 ++
1591 ++ cancel_work_sync(&alx->link_check_wk);
1592 ++ cancel_work_sync(&alx->reset_wk);
1593 ++
1594 ++ alx_halt(alx);
1595 + alx_free_rings(alx);
1596 + alx_free_napis(alx);
1597 + }
1598 +@@ -1858,9 +1862,6 @@ static void alx_remove(struct pci_dev *pdev)
1599 + struct alx_priv *alx = pci_get_drvdata(pdev);
1600 + struct alx_hw *hw = &alx->hw;
1601 +
1602 +- cancel_work_sync(&alx->link_check_wk);
1603 +- cancel_work_sync(&alx->reset_wk);
1604 +-
1605 + /* restore permanent mac address */
1606 + alx_set_macaddr(hw, hw->perm_addr);
1607 +
1608 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1609 +index 3d3b1005d076..03f82786c0b9 100644
1610 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1611 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1612 +@@ -1591,11 +1591,6 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
1613 + goto out;
1614 + }
1615 +
1616 +- if (skb_padto(skb, ETH_ZLEN)) {
1617 +- ret = NETDEV_TX_OK;
1618 +- goto out;
1619 +- }
1620 +-
1621 + /* Retain how many bytes will be sent on the wire, without TSB inserted
1622 + * by transmit checksum offload
1623 + */
1624 +@@ -1644,6 +1639,9 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
1625 + len_stat = (size << DMA_BUFLENGTH_SHIFT) |
1626 + (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT);
1627 +
1628 ++ /* Note: if we ever change from DMA_TX_APPEND_CRC below we
1629 ++ * will need to restore software padding of "runt" packets
1630 ++ */
1631 + if (!i) {
1632 + len_stat |= DMA_TX_APPEND_CRC | DMA_SOP;
1633 + if (skb->ip_summed == CHECKSUM_PARTIAL)
1634 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
1635 +index ca3aa1250dd1..e12ba81288e6 100644
1636 +--- a/drivers/net/ethernet/broadcom/tg3.c
1637 ++++ b/drivers/net/ethernet/broadcom/tg3.c
1638 +@@ -18176,8 +18176,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
1639 +
1640 + rtnl_lock();
1641 +
1642 +- /* We probably don't have netdev yet */
1643 +- if (!netdev || !netif_running(netdev))
1644 ++ /* Could be second call or maybe we don't have netdev yet */
1645 ++ if (!netdev || tp->pcierr_recovery || !netif_running(netdev))
1646 + goto done;
1647 +
1648 + /* We needn't recover from permanent error */
1649 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1650 +index e6fe2870137b..a440c1cf0b61 100644
1651 +--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1652 ++++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
1653 +@@ -506,41 +506,20 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
1654 + }
1655 + EXPORT_SYMBOL(cxgb4_select_ntuple);
1656 +
1657 +-/*
1658 +- * Called when address resolution fails for an L2T entry to handle packets
1659 +- * on the arpq head. If a packet specifies a failure handler it is invoked,
1660 +- * otherwise the packet is sent to the device.
1661 +- */
1662 +-static void handle_failed_resolution(struct adapter *adap, struct l2t_entry *e)
1663 +-{
1664 +- struct sk_buff *skb;
1665 +-
1666 +- while ((skb = __skb_dequeue(&e->arpq)) != NULL) {
1667 +- const struct l2t_skb_cb *cb = L2T_SKB_CB(skb);
1668 +-
1669 +- spin_unlock(&e->lock);
1670 +- if (cb->arp_err_handler)
1671 +- cb->arp_err_handler(cb->handle, skb);
1672 +- else
1673 +- t4_ofld_send(adap, skb);
1674 +- spin_lock(&e->lock);
1675 +- }
1676 +-}
1677 +-
1678 + /*
1679 + * Called when the host's neighbor layer makes a change to some entry that is
1680 + * loaded into the HW L2 table.
1681 + */
1682 + void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
1683 + {
1684 +- struct l2t_entry *e;
1685 +- struct sk_buff_head *arpq = NULL;
1686 +- struct l2t_data *d = adap->l2t;
1687 + unsigned int addr_len = neigh->tbl->key_len;
1688 + u32 *addr = (u32 *) neigh->primary_key;
1689 +- int ifidx = neigh->dev->ifindex;
1690 +- int hash = addr_hash(d, addr, addr_len, ifidx);
1691 ++ int hash, ifidx = neigh->dev->ifindex;
1692 ++ struct sk_buff_head *arpq = NULL;
1693 ++ struct l2t_data *d = adap->l2t;
1694 ++ struct l2t_entry *e;
1695 +
1696 ++ hash = addr_hash(d, addr, addr_len, ifidx);
1697 + read_lock_bh(&d->lock);
1698 + for (e = d->l2tab[hash].first; e; e = e->next)
1699 + if (!addreq(e, addr) && e->ifindex == ifidx) {
1700 +@@ -573,8 +552,25 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
1701 + write_l2e(adap, e, 0);
1702 + }
1703 +
1704 +- if (arpq)
1705 +- handle_failed_resolution(adap, e);
1706 ++ if (arpq) {
1707 ++ struct sk_buff *skb;
1708 ++
1709 ++ /* Called when address resolution fails for an L2T
1710 ++ * entry to handle packets on the arpq head. If a
1711 ++ * packet specifies a failure handler it is invoked,
1712 ++ * otherwise the packet is sent to the device.
1713 ++ */
1714 ++ while ((skb = __skb_dequeue(&e->arpq)) != NULL) {
1715 ++ const struct l2t_skb_cb *cb = L2T_SKB_CB(skb);
1716 ++
1717 ++ spin_unlock(&e->lock);
1718 ++ if (cb->arp_err_handler)
1719 ++ cb->arp_err_handler(cb->handle, skb);
1720 ++ else
1721 ++ t4_ofld_send(adap, skb);
1722 ++ spin_lock(&e->lock);
1723 ++ }
1724 ++ }
1725 + spin_unlock_bh(&e->lock);
1726 + }
1727 +
1728 +diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
1729 +index b6ff89307409..4ef4d41b0d8d 100644
1730 +--- a/drivers/net/ethernet/freescale/enetc/enetc.c
1731 ++++ b/drivers/net/ethernet/freescale/enetc/enetc.c
1732 +@@ -254,7 +254,7 @@ static irqreturn_t enetc_msix(int irq, void *data)
1733 + /* disable interrupts */
1734 + enetc_wr_reg(v->rbier, 0);
1735 +
1736 +- for_each_set_bit(i, &v->tx_rings_map, v->count_tx_rings)
1737 ++ for_each_set_bit(i, &v->tx_rings_map, ENETC_MAX_NUM_TXQS)
1738 + enetc_wr_reg(v->tbier_base + ENETC_BDR_OFF(i), 0);
1739 +
1740 + napi_schedule_irqoff(&v->napi);
1741 +@@ -290,7 +290,7 @@ static int enetc_poll(struct napi_struct *napi, int budget)
1742 + /* enable interrupts */
1743 + enetc_wr_reg(v->rbier, ENETC_RBIER_RXTIE);
1744 +
1745 +- for_each_set_bit(i, &v->tx_rings_map, v->count_tx_rings)
1746 ++ for_each_set_bit(i, &v->tx_rings_map, ENETC_MAX_NUM_TXQS)
1747 + enetc_wr_reg(v->tbier_base + ENETC_BDR_OFF(i),
1748 + ENETC_TBIER_TXTIE);
1749 +
1750 +diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
1751 +index c5be4ebd8437..aa32a5b04112 100644
1752 +--- a/drivers/net/ethernet/ibm/ibmveth.c
1753 ++++ b/drivers/net/ethernet/ibm/ibmveth.c
1754 +@@ -1682,7 +1682,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
1755 + }
1756 +
1757 + netdev->min_mtu = IBMVETH_MIN_MTU;
1758 +- netdev->max_mtu = ETH_MAX_MTU;
1759 ++ netdev->max_mtu = ETH_MAX_MTU - IBMVETH_BUFF_OH;
1760 +
1761 + memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
1762 +
1763 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1764 +index 5a42ddeecfe5..4f503b9a674c 100644
1765 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
1766 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
1767 +@@ -779,12 +779,13 @@ static int ibmvnic_login(struct net_device *netdev)
1768 + struct ibmvnic_adapter *adapter = netdev_priv(netdev);
1769 + unsigned long timeout = msecs_to_jiffies(30000);
1770 + int retry_count = 0;
1771 ++ int retries = 10;
1772 + bool retry;
1773 + int rc;
1774 +
1775 + do {
1776 + retry = false;
1777 +- if (retry_count > IBMVNIC_MAX_QUEUES) {
1778 ++ if (retry_count > retries) {
1779 + netdev_warn(netdev, "Login attempts exceeded\n");
1780 + return -1;
1781 + }
1782 +@@ -799,11 +800,23 @@ static int ibmvnic_login(struct net_device *netdev)
1783 +
1784 + if (!wait_for_completion_timeout(&adapter->init_done,
1785 + timeout)) {
1786 +- netdev_warn(netdev, "Login timed out\n");
1787 +- return -1;
1788 ++ netdev_warn(netdev, "Login timed out, retrying...\n");
1789 ++ retry = true;
1790 ++ adapter->init_done_rc = 0;
1791 ++ retry_count++;
1792 ++ continue;
1793 + }
1794 +
1795 +- if (adapter->init_done_rc == PARTIALSUCCESS) {
1796 ++ if (adapter->init_done_rc == ABORTED) {
1797 ++ netdev_warn(netdev, "Login aborted, retrying...\n");
1798 ++ retry = true;
1799 ++ adapter->init_done_rc = 0;
1800 ++ retry_count++;
1801 ++ /* FW or device may be busy, so
1802 ++ * wait a bit before retrying login
1803 ++ */
1804 ++ msleep(500);
1805 ++ } else if (adapter->init_done_rc == PARTIALSUCCESS) {
1806 + retry_count++;
1807 + release_sub_crqs(adapter, 1);
1808 +
1809 +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1810 +index cf5d447af7db..0f136f1af5d1 100644
1811 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1812 ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
1813 +@@ -1541,7 +1541,7 @@ static void mvpp2_read_stats(struct mvpp2_port *port)
1814 + for (q = 0; q < port->ntxqs; q++)
1815 + for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_txq_regs); i++)
1816 + *pstats++ += mvpp2_read_index(port->priv,
1817 +- MVPP22_CTRS_TX_CTR(port->id, i),
1818 ++ MVPP22_CTRS_TX_CTR(port->id, q),
1819 + mvpp2_ethtool_txq_regs[i].offset);
1820 +
1821 + /* Rxqs are numbered from 0 from the user standpoint, but not from the
1822 +@@ -1550,7 +1550,7 @@ static void mvpp2_read_stats(struct mvpp2_port *port)
1823 + for (q = 0; q < port->nrxqs; q++)
1824 + for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_rxq_regs); i++)
1825 + *pstats++ += mvpp2_read_index(port->priv,
1826 +- port->first_rxq + i,
1827 ++ port->first_rxq + q,
1828 + mvpp2_ethtool_rxq_regs[i].offset);
1829 + }
1830 +
1831 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
1832 +index 8e1bdf58b9e7..1d6dfba0c034 100644
1833 +--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
1834 ++++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
1835 +@@ -396,7 +396,7 @@ static void qed_cxt_qm_iids(struct qed_hwfn *p_hwfn,
1836 + vf_tids += segs[NUM_TASK_PF_SEGMENTS].count;
1837 + }
1838 +
1839 +- iids->vf_cids += vf_cids * p_mngr->vf_count;
1840 ++ iids->vf_cids = vf_cids;
1841 + iids->tids += vf_tids * p_mngr->vf_count;
1842 +
1843 + DP_VERBOSE(p_hwfn, QED_MSG_ILT,
1844 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
1845 +index 0bf91df80d47..ecd14474a603 100644
1846 +--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
1847 ++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
1848 +@@ -1368,6 +1368,8 @@ static void qed_dbg_user_data_free(struct qed_hwfn *p_hwfn)
1849 +
1850 + void qed_resc_free(struct qed_dev *cdev)
1851 + {
1852 ++ struct qed_rdma_info *rdma_info;
1853 ++ struct qed_hwfn *p_hwfn;
1854 + int i;
1855 +
1856 + if (IS_VF(cdev)) {
1857 +@@ -1385,7 +1387,8 @@ void qed_resc_free(struct qed_dev *cdev)
1858 + qed_llh_free(cdev);
1859 +
1860 + for_each_hwfn(cdev, i) {
1861 +- struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
1862 ++ p_hwfn = cdev->hwfns + i;
1863 ++ rdma_info = p_hwfn->p_rdma_info;
1864 +
1865 + qed_cxt_mngr_free(p_hwfn);
1866 + qed_qm_info_free(p_hwfn);
1867 +@@ -1404,8 +1407,10 @@ void qed_resc_free(struct qed_dev *cdev)
1868 + qed_ooo_free(p_hwfn);
1869 + }
1870 +
1871 +- if (QED_IS_RDMA_PERSONALITY(p_hwfn))
1872 ++ if (QED_IS_RDMA_PERSONALITY(p_hwfn) && rdma_info) {
1873 ++ qed_spq_unregister_async_cb(p_hwfn, rdma_info->proto);
1874 + qed_rdma_info_free(p_hwfn);
1875 ++ }
1876 +
1877 + qed_iov_free(p_hwfn);
1878 + qed_l2_free(p_hwfn);
1879 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1880 +index 65ec16a31658..2b3102a2fe5c 100644
1881 +--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1882 ++++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1883 +@@ -2832,8 +2832,6 @@ int qed_iwarp_stop(struct qed_hwfn *p_hwfn)
1884 + if (rc)
1885 + return rc;
1886 +
1887 +- qed_spq_unregister_async_cb(p_hwfn, PROTOCOLID_IWARP);
1888 +-
1889 + return qed_iwarp_ll2_stop(p_hwfn);
1890 + }
1891 +
1892 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
1893 +index e49fada85410..83817bb50e9f 100644
1894 +--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
1895 ++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
1896 +@@ -113,7 +113,6 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn)
1897 + break;
1898 + }
1899 + }
1900 +- qed_spq_unregister_async_cb(p_hwfn, PROTOCOLID_ROCE);
1901 + }
1902 +
1903 + static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
1904 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
1905 +index 856051f50eb7..adc2c8f3d48e 100644
1906 +--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
1907 ++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
1908 +@@ -81,12 +81,17 @@ static void qed_vf_pf_req_end(struct qed_hwfn *p_hwfn, int req_status)
1909 + mutex_unlock(&(p_hwfn->vf_iov_info->mutex));
1910 + }
1911 +
1912 ++#define QED_VF_CHANNEL_USLEEP_ITERATIONS 90
1913 ++#define QED_VF_CHANNEL_USLEEP_DELAY 100
1914 ++#define QED_VF_CHANNEL_MSLEEP_ITERATIONS 10
1915 ++#define QED_VF_CHANNEL_MSLEEP_DELAY 25
1916 ++
1917 + static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size)
1918 + {
1919 + union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request;
1920 + struct ustorm_trigger_vf_zone trigger;
1921 + struct ustorm_vf_zone *zone_data;
1922 +- int rc = 0, time = 100;
1923 ++ int iter, rc = 0;
1924 +
1925 + zone_data = (struct ustorm_vf_zone *)PXP_VF_BAR0_START_USDM_ZONE_B;
1926 +
1927 +@@ -126,11 +131,19 @@ static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size)
1928 + REG_WR(p_hwfn, (uintptr_t)&zone_data->trigger, *((u32 *)&trigger));
1929 +
1930 + /* When PF would be done with the response, it would write back to the
1931 +- * `done' address. Poll until then.
1932 ++ * `done' address from a coherent DMA zone. Poll until then.
1933 + */
1934 +- while ((!*done) && time) {
1935 +- msleep(25);
1936 +- time--;
1937 ++
1938 ++ iter = QED_VF_CHANNEL_USLEEP_ITERATIONS;
1939 ++ while (!*done && iter--) {
1940 ++ udelay(QED_VF_CHANNEL_USLEEP_DELAY);
1941 ++ dma_rmb();
1942 ++ }
1943 ++
1944 ++ iter = QED_VF_CHANNEL_MSLEEP_ITERATIONS;
1945 ++ while (!*done && iter--) {
1946 ++ msleep(QED_VF_CHANNEL_MSLEEP_DELAY);
1947 ++ dma_rmb();
1948 + }
1949 +
1950 + if (!*done) {
1951 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
1952 +index 1da6b5bda80a..2c3d654c8454 100644
1953 +--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
1954 ++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
1955 +@@ -1158,7 +1158,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
1956 +
1957 + /* PTP not supported on VFs */
1958 + if (!is_vf)
1959 +- qede_ptp_enable(edev, (mode == QEDE_PROBE_NORMAL));
1960 ++ qede_ptp_enable(edev);
1961 +
1962 + edev->ops->register_ops(cdev, &qede_ll_ops, edev);
1963 +
1964 +@@ -1247,6 +1247,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
1965 + if (system_state == SYSTEM_POWER_OFF)
1966 + return;
1967 + qed_ops->common->remove(cdev);
1968 ++ edev->cdev = NULL;
1969 +
1970 + /* Since this can happen out-of-sync with other flows,
1971 + * don't release the netdevice until after slowpath stop
1972 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_ptp.c b/drivers/net/ethernet/qlogic/qede/qede_ptp.c
1973 +index f815435cf106..2d3b2fa92df5 100644
1974 +--- a/drivers/net/ethernet/qlogic/qede/qede_ptp.c
1975 ++++ b/drivers/net/ethernet/qlogic/qede/qede_ptp.c
1976 +@@ -411,6 +411,7 @@ void qede_ptp_disable(struct qede_dev *edev)
1977 + if (ptp->tx_skb) {
1978 + dev_kfree_skb_any(ptp->tx_skb);
1979 + ptp->tx_skb = NULL;
1980 ++ clear_bit_unlock(QEDE_FLAGS_PTP_TX_IN_PRORGESS, &edev->flags);
1981 + }
1982 +
1983 + /* Disable PTP in HW */
1984 +@@ -422,7 +423,7 @@ void qede_ptp_disable(struct qede_dev *edev)
1985 + edev->ptp = NULL;
1986 + }
1987 +
1988 +-static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
1989 ++static int qede_ptp_init(struct qede_dev *edev)
1990 + {
1991 + struct qede_ptp *ptp;
1992 + int rc;
1993 +@@ -443,25 +444,19 @@ static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
1994 + /* Init work queue for Tx timestamping */
1995 + INIT_WORK(&ptp->work, qede_ptp_task);
1996 +
1997 +- /* Init cyclecounter and timecounter. This is done only in the first
1998 +- * load. If done in every load, PTP application will fail when doing
1999 +- * unload / load (e.g. MTU change) while it is running.
2000 +- */
2001 +- if (init_tc) {
2002 +- memset(&ptp->cc, 0, sizeof(ptp->cc));
2003 +- ptp->cc.read = qede_ptp_read_cc;
2004 +- ptp->cc.mask = CYCLECOUNTER_MASK(64);
2005 +- ptp->cc.shift = 0;
2006 +- ptp->cc.mult = 1;
2007 +-
2008 +- timecounter_init(&ptp->tc, &ptp->cc,
2009 +- ktime_to_ns(ktime_get_real()));
2010 +- }
2011 ++ /* Init cyclecounter and timecounter */
2012 ++ memset(&ptp->cc, 0, sizeof(ptp->cc));
2013 ++ ptp->cc.read = qede_ptp_read_cc;
2014 ++ ptp->cc.mask = CYCLECOUNTER_MASK(64);
2015 ++ ptp->cc.shift = 0;
2016 ++ ptp->cc.mult = 1;
2017 +
2018 +- return rc;
2019 ++ timecounter_init(&ptp->tc, &ptp->cc, ktime_to_ns(ktime_get_real()));
2020 ++
2021 ++ return 0;
2022 + }
2023 +
2024 +-int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
2025 ++int qede_ptp_enable(struct qede_dev *edev)
2026 + {
2027 + struct qede_ptp *ptp;
2028 + int rc;
2029 +@@ -482,7 +477,7 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
2030 +
2031 + edev->ptp = ptp;
2032 +
2033 +- rc = qede_ptp_init(edev, init_tc);
2034 ++ rc = qede_ptp_init(edev);
2035 + if (rc)
2036 + goto err1;
2037 +
2038 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_ptp.h b/drivers/net/ethernet/qlogic/qede/qede_ptp.h
2039 +index 691a14c4b2c5..89c7f3cf3ee2 100644
2040 +--- a/drivers/net/ethernet/qlogic/qede/qede_ptp.h
2041 ++++ b/drivers/net/ethernet/qlogic/qede/qede_ptp.h
2042 +@@ -41,7 +41,7 @@ void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);
2043 + void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
2044 + int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
2045 + void qede_ptp_disable(struct qede_dev *edev);
2046 +-int qede_ptp_enable(struct qede_dev *edev, bool init_tc);
2047 ++int qede_ptp_enable(struct qede_dev *edev);
2048 + int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
2049 +
2050 + static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
2051 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2052 +index 2d873ae8a234..668ccc9d49f8 100644
2053 +--- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2054 ++++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2055 +@@ -105,6 +105,7 @@ static void qede_rdma_destroy_wq(struct qede_dev *edev)
2056 +
2057 + qede_rdma_cleanup_event(edev);
2058 + destroy_workqueue(edev->rdma_info.rdma_wq);
2059 ++ edev->rdma_info.rdma_wq = NULL;
2060 + }
2061 +
2062 + int qede_rdma_dev_add(struct qede_dev *edev, bool recovery)
2063 +@@ -325,7 +326,7 @@ static void qede_rdma_add_event(struct qede_dev *edev,
2064 + if (edev->rdma_info.exp_recovery)
2065 + return;
2066 +
2067 +- if (!edev->rdma_info.qedr_dev)
2068 ++ if (!edev->rdma_info.qedr_dev || !edev->rdma_info.rdma_wq)
2069 + return;
2070 +
2071 + /* We don't want the cleanup flow to start while we're allocating and
2072 +diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
2073 +index 786b158bd305..5abb3f9684ff 100644
2074 +--- a/drivers/net/ethernet/rocker/rocker_main.c
2075 ++++ b/drivers/net/ethernet/rocker/rocker_main.c
2076 +@@ -647,10 +647,10 @@ static int rocker_dma_rings_init(struct rocker *rocker)
2077 + err_dma_event_ring_bufs_alloc:
2078 + rocker_dma_ring_destroy(rocker, &rocker->event_ring);
2079 + err_dma_event_ring_create:
2080 ++ rocker_dma_cmd_ring_waits_free(rocker);
2081 ++err_dma_cmd_ring_waits_alloc:
2082 + rocker_dma_ring_bufs_free(rocker, &rocker->cmd_ring,
2083 + PCI_DMA_BIDIRECTIONAL);
2084 +-err_dma_cmd_ring_waits_alloc:
2085 +- rocker_dma_cmd_ring_waits_free(rocker);
2086 + err_dma_cmd_ring_bufs_alloc:
2087 + rocker_dma_ring_destroy(rocker, &rocker->cmd_ring);
2088 + return err;
2089 +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
2090 +index cac75c7d1d01..19d9d78a6df2 100644
2091 +--- a/drivers/net/geneve.c
2092 ++++ b/drivers/net/geneve.c
2093 +@@ -1649,6 +1649,7 @@ static int geneve_changelink(struct net_device *dev, struct nlattr *tb[],
2094 + geneve->collect_md = metadata;
2095 + geneve->use_udp6_rx_checksums = use_udp6_rx_checksums;
2096 + geneve->ttl_inherit = ttl_inherit;
2097 ++ geneve->df = df;
2098 + geneve_unquiesce(geneve, gs4, gs6);
2099 +
2100 + return 0;
2101 +diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
2102 +index 0907c3d8d94a..dba52a5c378a 100644
2103 +--- a/drivers/net/phy/phy_device.c
2104 ++++ b/drivers/net/phy/phy_device.c
2105 +@@ -797,8 +797,10 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,
2106 +
2107 + /* Grab the bits from PHYIR2, and put them in the lower half */
2108 + phy_reg = mdiobus_read(bus, addr, MII_PHYSID2);
2109 +- if (phy_reg < 0)
2110 +- return -EIO;
2111 ++ if (phy_reg < 0) {
2112 ++ /* returning -ENODEV doesn't stop bus scanning */
2113 ++ return (phy_reg == -EIO || phy_reg == -ENODEV) ? -ENODEV : -EIO;
2114 ++ }
2115 +
2116 + *phy_id |= phy_reg;
2117 +
2118 +diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
2119 +index daa54486ab09..df2f7cc6dc03 100644
2120 +--- a/drivers/net/usb/ax88179_178a.c
2121 ++++ b/drivers/net/usb/ax88179_178a.c
2122 +@@ -1387,10 +1387,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
2123 + }
2124 +
2125 + if (pkt_cnt == 0) {
2126 +- /* Skip IP alignment psudo header */
2127 +- skb_pull(skb, 2);
2128 + skb->len = pkt_len;
2129 +- skb_set_tail_pointer(skb, pkt_len);
2130 ++ /* Skip IP alignment pseudo header */
2131 ++ skb_pull(skb, 2);
2132 ++ skb_set_tail_pointer(skb, skb->len);
2133 + skb->truesize = pkt_len + sizeof(struct sk_buff);
2134 + ax88179_rx_checksum(skb, pkt_hdr);
2135 + return 1;
2136 +@@ -1399,8 +1399,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
2137 + ax_skb = skb_clone(skb, GFP_ATOMIC);
2138 + if (ax_skb) {
2139 + ax_skb->len = pkt_len;
2140 +- ax_skb->data = skb->data + 2;
2141 +- skb_set_tail_pointer(ax_skb, pkt_len);
2142 ++ /* Skip IP alignment pseudo header */
2143 ++ skb_pull(ax_skb, 2);
2144 ++ skb_set_tail_pointer(ax_skb, ax_skb->len);
2145 + ax_skb->truesize = pkt_len + sizeof(struct sk_buff);
2146 + ax88179_rx_checksum(ax_skb, pkt_hdr);
2147 + usbnet_skb_return(dev, ax_skb);
2148 +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
2149 +index 56caddeabb5e..772eb05e57af 100644
2150 +--- a/drivers/nvme/host/multipath.c
2151 ++++ b/drivers/nvme/host/multipath.c
2152 +@@ -413,11 +413,10 @@ static void nvme_mpath_set_live(struct nvme_ns *ns)
2153 + {
2154 + struct nvme_ns_head *head = ns->head;
2155 +
2156 +- lockdep_assert_held(&ns->head->lock);
2157 +-
2158 + if (!head->disk)
2159 + return;
2160 +
2161 ++ mutex_lock(&head->lock);
2162 + if (!(head->disk->flags & GENHD_FL_UP))
2163 + device_add_disk(&head->subsys->dev, head->disk,
2164 + nvme_ns_id_attr_groups);
2165 +@@ -430,9 +429,10 @@ static void nvme_mpath_set_live(struct nvme_ns *ns)
2166 + __nvme_find_path(head, node);
2167 + srcu_read_unlock(&head->srcu, srcu_idx);
2168 + }
2169 ++ mutex_unlock(&head->lock);
2170 +
2171 +- synchronize_srcu(&ns->head->srcu);
2172 +- kblockd_schedule_work(&ns->head->requeue_work);
2173 ++ synchronize_srcu(&head->srcu);
2174 ++ kblockd_schedule_work(&head->requeue_work);
2175 + }
2176 +
2177 + static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data,
2178 +@@ -483,14 +483,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state)
2179 + static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
2180 + struct nvme_ns *ns)
2181 + {
2182 +- mutex_lock(&ns->head->lock);
2183 + ns->ana_grpid = le32_to_cpu(desc->grpid);
2184 + ns->ana_state = desc->state;
2185 + clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
2186 +
2187 + if (nvme_state_is_live(ns->ana_state))
2188 + nvme_mpath_set_live(ns);
2189 +- mutex_unlock(&ns->head->lock);
2190 + }
2191 +
2192 + static int nvme_update_ana_state(struct nvme_ctrl *ctrl,
2193 +@@ -661,10 +659,8 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
2194 + nvme_parse_ana_log(ns->ctrl, ns, nvme_set_ns_ana_state);
2195 + mutex_unlock(&ns->ctrl->ana_lock);
2196 + } else {
2197 +- mutex_lock(&ns->head->lock);
2198 + ns->ana_state = NVME_ANA_OPTIMIZED;
2199 + nvme_mpath_set_live(ns);
2200 +- mutex_unlock(&ns->head->lock);
2201 + }
2202 + }
2203 +
2204 +diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2205 +index f1fece5b9c06..3769ad08eadf 100644
2206 +--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2207 ++++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2208 +@@ -170,6 +170,7 @@ struct pmic_gpio_state {
2209 + struct regmap *map;
2210 + struct pinctrl_dev *ctrl;
2211 + struct gpio_chip chip;
2212 ++ struct irq_chip irq;
2213 + };
2214 +
2215 + static const struct pinconf_generic_params pmic_gpio_bindings[] = {
2216 +@@ -917,16 +918,6 @@ static int pmic_gpio_populate(struct pmic_gpio_state *state,
2217 + return 0;
2218 + }
2219 +
2220 +-static struct irq_chip pmic_gpio_irq_chip = {
2221 +- .name = "spmi-gpio",
2222 +- .irq_ack = irq_chip_ack_parent,
2223 +- .irq_mask = irq_chip_mask_parent,
2224 +- .irq_unmask = irq_chip_unmask_parent,
2225 +- .irq_set_type = irq_chip_set_type_parent,
2226 +- .irq_set_wake = irq_chip_set_wake_parent,
2227 +- .flags = IRQCHIP_MASK_ON_SUSPEND,
2228 +-};
2229 +-
2230 + static int pmic_gpio_domain_translate(struct irq_domain *domain,
2231 + struct irq_fwspec *fwspec,
2232 + unsigned long *hwirq,
2233 +@@ -1053,8 +1044,16 @@ static int pmic_gpio_probe(struct platform_device *pdev)
2234 + if (!parent_domain)
2235 + return -ENXIO;
2236 +
2237 ++ state->irq.name = "spmi-gpio",
2238 ++ state->irq.irq_ack = irq_chip_ack_parent,
2239 ++ state->irq.irq_mask = irq_chip_mask_parent,
2240 ++ state->irq.irq_unmask = irq_chip_unmask_parent,
2241 ++ state->irq.irq_set_type = irq_chip_set_type_parent,
2242 ++ state->irq.irq_set_wake = irq_chip_set_wake_parent,
2243 ++ state->irq.flags = IRQCHIP_MASK_ON_SUSPEND,
2244 ++
2245 + girq = &state->chip.irq;
2246 +- girq->chip = &pmic_gpio_irq_chip;
2247 ++ girq->chip = &state->irq;
2248 + girq->default_type = IRQ_TYPE_NONE;
2249 + girq->handler = handle_level_irq;
2250 + girq->fwnode = of_node_to_fwnode(state->dev->of_node);
2251 +diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
2252 +index e9a7cbb9aa33..01bcef2c01bc 100644
2253 +--- a/drivers/pinctrl/tegra/pinctrl-tegra.c
2254 ++++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
2255 +@@ -685,8 +685,8 @@ static int tegra_pinctrl_resume(struct device *dev)
2256 + }
2257 +
2258 + const struct dev_pm_ops tegra_pinctrl_pm = {
2259 +- .suspend = &tegra_pinctrl_suspend,
2260 +- .resume = &tegra_pinctrl_resume
2261 ++ .suspend_noirq = &tegra_pinctrl_suspend,
2262 ++ .resume_noirq = &tegra_pinctrl_resume
2263 + };
2264 +
2265 + static bool gpio_node_has_range(const char *compatible)
2266 +diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
2267 +index 689537927f6f..4c8e8b472287 100644
2268 +--- a/drivers/regulator/pfuze100-regulator.c
2269 ++++ b/drivers/regulator/pfuze100-regulator.c
2270 +@@ -209,6 +209,19 @@ static const struct regulator_ops pfuze100_swb_regulator_ops = {
2271 +
2272 + };
2273 +
2274 ++static const struct regulator_ops pfuze3000_sw_regulator_ops = {
2275 ++ .enable = regulator_enable_regmap,
2276 ++ .disable = regulator_disable_regmap,
2277 ++ .is_enabled = regulator_is_enabled_regmap,
2278 ++ .list_voltage = regulator_list_voltage_table,
2279 ++ .map_voltage = regulator_map_voltage_ascend,
2280 ++ .set_voltage_sel = regulator_set_voltage_sel_regmap,
2281 ++ .get_voltage_sel = regulator_get_voltage_sel_regmap,
2282 ++ .set_voltage_time_sel = regulator_set_voltage_time_sel,
2283 ++ .set_ramp_delay = pfuze100_set_ramp_delay,
2284 ++
2285 ++};
2286 ++
2287 + #define PFUZE100_FIXED_REG(_chip, _name, base, voltage) \
2288 + [_chip ## _ ## _name] = { \
2289 + .desc = { \
2290 +@@ -318,23 +331,28 @@ static const struct regulator_ops pfuze100_swb_regulator_ops = {
2291 + .stby_mask = 0x20, \
2292 + }
2293 +
2294 +-
2295 +-#define PFUZE3000_SW2_REG(_chip, _name, base, min, max, step) { \
2296 +- .desc = { \
2297 +- .name = #_name,\
2298 +- .n_voltages = ((max) - (min)) / (step) + 1, \
2299 +- .ops = &pfuze100_sw_regulator_ops, \
2300 +- .type = REGULATOR_VOLTAGE, \
2301 +- .id = _chip ## _ ## _name, \
2302 +- .owner = THIS_MODULE, \
2303 +- .min_uV = (min), \
2304 +- .uV_step = (step), \
2305 +- .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \
2306 +- .vsel_mask = 0x7, \
2307 +- }, \
2308 +- .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \
2309 +- .stby_mask = 0x7, \
2310 +-}
2311 ++/* No linar case for the some switches of PFUZE3000 */
2312 ++#define PFUZE3000_SW_REG(_chip, _name, base, mask, voltages) \
2313 ++ [_chip ## _ ## _name] = { \
2314 ++ .desc = { \
2315 ++ .name = #_name, \
2316 ++ .n_voltages = ARRAY_SIZE(voltages), \
2317 ++ .ops = &pfuze3000_sw_regulator_ops, \
2318 ++ .type = REGULATOR_VOLTAGE, \
2319 ++ .id = _chip ## _ ## _name, \
2320 ++ .owner = THIS_MODULE, \
2321 ++ .volt_table = voltages, \
2322 ++ .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \
2323 ++ .vsel_mask = (mask), \
2324 ++ .enable_reg = (base) + PFUZE100_MODE_OFFSET, \
2325 ++ .enable_mask = 0xf, \
2326 ++ .enable_val = 0x8, \
2327 ++ .enable_time = 500, \
2328 ++ }, \
2329 ++ .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \
2330 ++ .stby_mask = (mask), \
2331 ++ .sw_reg = true, \
2332 ++ }
2333 +
2334 + #define PFUZE3000_SW3_REG(_chip, _name, base, min, max, step) { \
2335 + .desc = { \
2336 +@@ -391,9 +409,9 @@ static struct pfuze_regulator pfuze200_regulators[] = {
2337 + };
2338 +
2339 + static struct pfuze_regulator pfuze3000_regulators[] = {
2340 +- PFUZE100_SWB_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
2341 ++ PFUZE3000_SW_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
2342 + PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000),
2343 +- PFUZE100_SWB_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
2344 ++ PFUZE3000_SW_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
2345 + PFUZE3000_SW3_REG(PFUZE3000, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000),
2346 + PFUZE100_SWB_REG(PFUZE3000, SWBST, PFUZE100_SWBSTCON1, 0x3, pfuze100_swbst),
2347 + PFUZE100_SWB_REG(PFUZE3000, VSNVS, PFUZE100_VSNVSVOL, 0x7, pfuze100_vsnvs),
2348 +@@ -407,8 +425,8 @@ static struct pfuze_regulator pfuze3000_regulators[] = {
2349 + };
2350 +
2351 + static struct pfuze_regulator pfuze3001_regulators[] = {
2352 +- PFUZE100_SWB_REG(PFUZE3001, SW1, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
2353 +- PFUZE100_SWB_REG(PFUZE3001, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
2354 ++ PFUZE3000_SW_REG(PFUZE3001, SW1, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a),
2355 ++ PFUZE3000_SW_REG(PFUZE3001, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo),
2356 + PFUZE3000_SW3_REG(PFUZE3001, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000),
2357 + PFUZE100_SWB_REG(PFUZE3001, VSNVS, PFUZE100_VSNVSVOL, 0x7, pfuze100_vsnvs),
2358 + PFUZE100_VGEN_REG(PFUZE3001, VLDO1, PFUZE100_VGEN1VOL, 1800000, 3300000, 100000),
2359 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
2360 +index fe70e9875bde..5043f0fcf399 100644
2361 +--- a/drivers/s390/net/qeth_core_main.c
2362 ++++ b/drivers/s390/net/qeth_core_main.c
2363 +@@ -4163,9 +4163,6 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
2364 + int fallback = *(int *)reply->param;
2365 +
2366 + QETH_CARD_TEXT(card, 4, "setaccb");
2367 +- if (cmd->hdr.return_code)
2368 +- return -EIO;
2369 +- qeth_setadpparms_inspect_rc(cmd);
2370 +
2371 + access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;
2372 + QETH_CARD_TEXT_(card, 2, "rc=%d",
2373 +@@ -4175,7 +4172,7 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
2374 + QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%#x) on device %x: %#x\n",
2375 + access_ctrl_req->subcmd_code, CARD_DEVID(card),
2376 + cmd->data.setadapterparms.hdr.return_code);
2377 +- switch (cmd->data.setadapterparms.hdr.return_code) {
2378 ++ switch (qeth_setadpparms_inspect_rc(cmd)) {
2379 + case SET_ACCESS_CTRL_RC_SUCCESS:
2380 + if (card->options.isolation == ISOLATION_MODE_NONE) {
2381 + dev_info(&card->gdev->dev,
2382 +diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
2383 +index cb84125ab80d..08dc2efb7d8a 100644
2384 +--- a/drivers/s390/scsi/zfcp_erp.c
2385 ++++ b/drivers/s390/scsi/zfcp_erp.c
2386 +@@ -576,7 +576,10 @@ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
2387 + ZFCP_STATUS_ERP_TIMEDOUT)) {
2388 + req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
2389 + zfcp_dbf_rec_run("erscf_1", act);
2390 +- req->erp_action = NULL;
2391 ++ /* lock-free concurrent access with
2392 ++ * zfcp_erp_timeout_handler()
2393 ++ */
2394 ++ WRITE_ONCE(req->erp_action, NULL);
2395 + }
2396 + if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
2397 + zfcp_dbf_rec_run("erscf_2", act);
2398 +@@ -612,8 +615,14 @@ void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask)
2399 + void zfcp_erp_timeout_handler(struct timer_list *t)
2400 + {
2401 + struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
2402 +- struct zfcp_erp_action *act = fsf_req->erp_action;
2403 ++ struct zfcp_erp_action *act;
2404 +
2405 ++ if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
2406 ++ return;
2407 ++ /* lock-free concurrent access with zfcp_erp_strategy_check_fsfreq() */
2408 ++ act = READ_ONCE(fsf_req->erp_action);
2409 ++ if (!act)
2410 ++ return;
2411 + zfcp_erp_notify(act, ZFCP_STATUS_ERP_TIMEDOUT);
2412 + }
2413 +
2414 +diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
2415 +index 14d9f41977f1..95abffd9ad10 100644
2416 +--- a/drivers/scsi/lpfc/lpfc_init.c
2417 ++++ b/drivers/scsi/lpfc/lpfc_init.c
2418 +@@ -11542,7 +11542,8 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba)
2419 + lpfc_sli4_xri_exchange_busy_wait(phba);
2420 +
2421 + /* per-phba callback de-registration for hotplug event */
2422 +- lpfc_cpuhp_remove(phba);
2423 ++ if (phba->pport)
2424 ++ lpfc_cpuhp_remove(phba);
2425 +
2426 + /* Disable PCI subsystem interrupt */
2427 + lpfc_sli4_disable_intr(phba);
2428 +diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
2429 +index 84bb4a048016..a44de4c5dcf6 100644
2430 +--- a/drivers/scsi/qla2xxx/qla_gs.c
2431 ++++ b/drivers/scsi/qla2xxx/qla_gs.c
2432 +@@ -3638,7 +3638,9 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
2433 + qla2x00_clear_loop_id(fcport);
2434 + fcport->flags |= FCF_FABRIC_DEVICE;
2435 + } else if (fcport->d_id.b24 != rp->id.b24 ||
2436 +- fcport->scan_needed) {
2437 ++ (fcport->scan_needed &&
2438 ++ fcport->port_type != FCT_INITIATOR &&
2439 ++ fcport->port_type != FCT_NVME_INITIATOR)) {
2440 + qlt_schedule_sess_for_deletion(fcport);
2441 + }
2442 + fcport->d_id.b24 = rp->id.b24;
2443 +diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
2444 +index ea3ea2a6b314..f6678ba6d4bc 100644
2445 +--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
2446 ++++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
2447 +@@ -1845,12 +1845,14 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
2448 + pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
2449 + if (!pIE)
2450 + return _FAIL;
2451 ++ if (ie_len > sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates))
2452 ++ return _FAIL;
2453 +
2454 + memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len);
2455 + supportRateNum = ie_len;
2456 +
2457 + pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, _EXT_SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
2458 +- if (pIE)
2459 ++ if (pIE && (ie_len <= sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates) - supportRateNum))
2460 + memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + supportRateNum), pIE->data, ie_len);
2461 +
2462 + return _SUCCESS;
2463 +diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
2464 +index f8e43a6faea9..cdcc64ea2554 100644
2465 +--- a/drivers/tty/hvc/hvc_console.c
2466 ++++ b/drivers/tty/hvc/hvc_console.c
2467 +@@ -75,8 +75,6 @@ static LIST_HEAD(hvc_structs);
2468 + */
2469 + static DEFINE_MUTEX(hvc_structs_mutex);
2470 +
2471 +-/* Mutex to serialize hvc_open */
2472 +-static DEFINE_MUTEX(hvc_open_mutex);
2473 + /*
2474 + * This value is used to assign a tty->index value to a hvc_struct based
2475 + * upon order of exposure via hvc_probe(), when we can not match it to
2476 +@@ -348,24 +346,16 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)
2477 + */
2478 + static int hvc_open(struct tty_struct *tty, struct file * filp)
2479 + {
2480 +- struct hvc_struct *hp;
2481 ++ struct hvc_struct *hp = tty->driver_data;
2482 + unsigned long flags;
2483 + int rc = 0;
2484 +
2485 +- mutex_lock(&hvc_open_mutex);
2486 +-
2487 +- hp = tty->driver_data;
2488 +- if (!hp) {
2489 +- rc = -EIO;
2490 +- goto out;
2491 +- }
2492 +-
2493 + spin_lock_irqsave(&hp->port.lock, flags);
2494 + /* Check and then increment for fast path open. */
2495 + if (hp->port.count++ > 0) {
2496 + spin_unlock_irqrestore(&hp->port.lock, flags);
2497 + hvc_kick();
2498 +- goto out;
2499 ++ return 0;
2500 + } /* else count == 0 */
2501 + spin_unlock_irqrestore(&hp->port.lock, flags);
2502 +
2503 +@@ -393,8 +383,6 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
2504 + /* Force wakeup of the polling thread */
2505 + hvc_kick();
2506 +
2507 +-out:
2508 +- mutex_unlock(&hvc_open_mutex);
2509 + return rc;
2510 + }
2511 +
2512 +diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
2513 +index e71240b386b4..da4c5eb03d7e 100644
2514 +--- a/drivers/usb/cdns3/ep0.c
2515 ++++ b/drivers/usb/cdns3/ep0.c
2516 +@@ -327,7 +327,8 @@ static int cdns3_ep0_feature_handle_device(struct cdns3_device *priv_dev,
2517 + if (!set || (tmode & 0xff) != 0)
2518 + return -EINVAL;
2519 +
2520 +- switch (tmode >> 8) {
2521 ++ tmode >>= 8;
2522 ++ switch (tmode) {
2523 + case TEST_J:
2524 + case TEST_K:
2525 + case TEST_SE0_NAK:
2526 +@@ -711,15 +712,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,
2527 + int ret = 0;
2528 + u8 zlp = 0;
2529 +
2530 ++ spin_lock_irqsave(&priv_dev->lock, flags);
2531 + trace_cdns3_ep0_queue(priv_dev, request);
2532 +
2533 + /* cancel the request if controller receive new SETUP packet. */
2534 +- if (cdns3_check_new_setup(priv_dev))
2535 ++ if (cdns3_check_new_setup(priv_dev)) {
2536 ++ spin_unlock_irqrestore(&priv_dev->lock, flags);
2537 + return -ECONNRESET;
2538 ++ }
2539 +
2540 + /* send STATUS stage. Should be called only for SET_CONFIGURATION */
2541 + if (priv_dev->ep0_stage == CDNS3_STATUS_STAGE) {
2542 +- spin_lock_irqsave(&priv_dev->lock, flags);
2543 + cdns3_select_ep(priv_dev, 0x00);
2544 +
2545 + erdy_sent = !priv_dev->hw_configured_flag;
2546 +@@ -744,7 +747,6 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,
2547 + return 0;
2548 + }
2549 +
2550 +- spin_lock_irqsave(&priv_dev->lock, flags);
2551 + if (!list_empty(&priv_ep->pending_req_list)) {
2552 + dev_err(priv_dev->dev,
2553 + "can't handle multiple requests for ep0\n");
2554 +diff --git a/drivers/usb/cdns3/trace.h b/drivers/usb/cdns3/trace.h
2555 +index e92348c9b4d7..7cc8bebaa07d 100644
2556 +--- a/drivers/usb/cdns3/trace.h
2557 ++++ b/drivers/usb/cdns3/trace.h
2558 +@@ -150,7 +150,7 @@ DECLARE_EVENT_CLASS(cdns3_log_ep0_irq,
2559 + __dynamic_array(char, str, CDNS3_MSG_MAX)
2560 + ),
2561 + TP_fast_assign(
2562 +- __entry->ep_dir = priv_dev->ep0_data_dir;
2563 ++ __entry->ep_dir = priv_dev->selected_ep;
2564 + __entry->ep_sts = ep_sts;
2565 + ),
2566 + TP_printk("%s", cdns3_decode_ep0_irq(__get_str(str),
2567 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
2568 +index f67088bb8218..d5187b50fc82 100644
2569 +--- a/drivers/usb/class/cdc-acm.c
2570 ++++ b/drivers/usb/class/cdc-acm.c
2571 +@@ -1689,6 +1689,8 @@ static int acm_pre_reset(struct usb_interface *intf)
2572 +
2573 + static const struct usb_device_id acm_ids[] = {
2574 + /* quirky and broken devices */
2575 ++ { USB_DEVICE(0x0424, 0x274e), /* Microchip Technology, Inc. (formerly SMSC) */
2576 ++ .driver_info = DISABLE_ECHO, }, /* DISABLE ECHO in termios flag */
2577 + { USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
2578 + .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
2579 + { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
2580 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
2581 +index 3e8efe759c3e..e0b77674869c 100644
2582 +--- a/drivers/usb/core/quirks.c
2583 ++++ b/drivers/usb/core/quirks.c
2584 +@@ -218,11 +218,12 @@ static const struct usb_device_id usb_quirk_list[] = {
2585 + /* Logitech HD Webcam C270 */
2586 + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
2587 +
2588 +- /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */
2589 ++ /* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */
2590 + { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
2591 + { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
2592 + { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
2593 + { USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT },
2594 ++ { USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT },
2595 +
2596 + /* Logitech ConferenceCam CC3000e */
2597 + { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
2598 +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
2599 +index 7fd0900a9cb0..f7528f732b2a 100644
2600 +--- a/drivers/usb/dwc2/gadget.c
2601 ++++ b/drivers/usb/dwc2/gadget.c
2602 +@@ -4886,12 +4886,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg)
2603 + epnum, 0);
2604 + }
2605 +
2606 +- ret = usb_add_gadget_udc(dev, &hsotg->gadget);
2607 +- if (ret) {
2608 +- dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep,
2609 +- hsotg->ctrl_req);
2610 +- return ret;
2611 +- }
2612 + dwc2_hsotg_dump(hsotg);
2613 +
2614 + return 0;
2615 +diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
2616 +index 3c6ce09a6db5..15e55808cf4e 100644
2617 +--- a/drivers/usb/dwc2/platform.c
2618 ++++ b/drivers/usb/dwc2/platform.c
2619 +@@ -507,6 +507,17 @@ static int dwc2_driver_probe(struct platform_device *dev)
2620 + if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)
2621 + dwc2_lowlevel_hw_disable(hsotg);
2622 +
2623 ++#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
2624 ++ IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
2625 ++ /* Postponed adding a new gadget to the udc class driver list */
2626 ++ if (hsotg->gadget_enabled) {
2627 ++ retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget);
2628 ++ if (retval) {
2629 ++ dwc2_hsotg_remove(hsotg);
2630 ++ goto error;
2631 ++ }
2632 ++ }
2633 ++#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
2634 + return 0;
2635 +
2636 + error:
2637 +diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
2638 +index cafde053788b..80a1b52c656e 100644
2639 +--- a/drivers/usb/gadget/udc/mv_udc_core.c
2640 ++++ b/drivers/usb/gadget/udc/mv_udc_core.c
2641 +@@ -2313,7 +2313,8 @@ static int mv_udc_probe(struct platform_device *pdev)
2642 + return 0;
2643 +
2644 + err_create_workqueue:
2645 +- destroy_workqueue(udc->qwork);
2646 ++ if (udc->qwork)
2647 ++ destroy_workqueue(udc->qwork);
2648 + err_destroy_dma:
2649 + dma_pool_destroy(udc->dtd_pool);
2650 + err_free_dma:
2651 +diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
2652 +index 01debfd03d4a..84d59a611511 100644
2653 +--- a/drivers/usb/host/ehci-exynos.c
2654 ++++ b/drivers/usb/host/ehci-exynos.c
2655 +@@ -203,9 +203,8 @@ static int exynos_ehci_probe(struct platform_device *pdev)
2656 + hcd->rsrc_len = resource_size(res);
2657 +
2658 + irq = platform_get_irq(pdev, 0);
2659 +- if (!irq) {
2660 +- dev_err(&pdev->dev, "Failed to get IRQ\n");
2661 +- err = -ENODEV;
2662 ++ if (irq < 0) {
2663 ++ err = irq;
2664 + goto fail_io;
2665 + }
2666 +
2667 +diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
2668 +index b0882c13a1d1..66713c253765 100644
2669 +--- a/drivers/usb/host/ehci-pci.c
2670 ++++ b/drivers/usb/host/ehci-pci.c
2671 +@@ -216,6 +216,13 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
2672 + ehci_info(ehci, "applying MosChip frame-index workaround\n");
2673 + ehci->frame_index_bug = 1;
2674 + break;
2675 ++ case PCI_VENDOR_ID_HUAWEI:
2676 ++ /* Synopsys HC bug */
2677 ++ if (pdev->device == 0xa239) {
2678 ++ ehci_info(ehci, "applying Synopsys HC workaround\n");
2679 ++ ehci->has_synopsys_hc_bug = 1;
2680 ++ }
2681 ++ break;
2682 + }
2683 +
2684 + /* optional debug port, normally in the first BAR */
2685 +diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
2686 +index cff965240327..b91d50da6127 100644
2687 +--- a/drivers/usb/host/ohci-sm501.c
2688 ++++ b/drivers/usb/host/ohci-sm501.c
2689 +@@ -191,6 +191,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
2690 + struct resource *mem;
2691 +
2692 + usb_remove_hcd(hcd);
2693 ++ iounmap(hcd->regs);
2694 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
2695 + usb_put_hcd(hcd);
2696 + mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
2697 +diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
2698 +index b18a6baef204..85f1ff0399a9 100644
2699 +--- a/drivers/usb/host/xhci-mtk.c
2700 ++++ b/drivers/usb/host/xhci-mtk.c
2701 +@@ -592,6 +592,9 @@ static int xhci_mtk_remove(struct platform_device *dev)
2702 + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
2703 + struct usb_hcd *shared_hcd = xhci->shared_hcd;
2704 +
2705 ++ pm_runtime_put_noidle(&dev->dev);
2706 ++ pm_runtime_disable(&dev->dev);
2707 ++
2708 + usb_remove_hcd(shared_hcd);
2709 + xhci->shared_hcd = NULL;
2710 + device_init_wakeup(&dev->dev, false);
2711 +@@ -602,8 +605,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
2712 + xhci_mtk_sch_exit(mtk);
2713 + xhci_mtk_clks_disable(mtk);
2714 + xhci_mtk_ldos_disable(mtk);
2715 +- pm_runtime_put_sync(&dev->dev);
2716 +- pm_runtime_disable(&dev->dev);
2717 +
2718 + return 0;
2719 + }
2720 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
2721 +index 81b54a3d2910..11a65854d3f0 100644
2722 +--- a/drivers/usb/host/xhci.c
2723 ++++ b/drivers/usb/host/xhci.c
2724 +@@ -1430,6 +1430,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
2725 + xhci->devs[slot_id]->out_ctx, ep_index);
2726 +
2727 + ep_ctx = xhci_get_ep_ctx(xhci, command->in_ctx, ep_index);
2728 ++ ep_ctx->ep_info &= cpu_to_le32(~EP_STATE_MASK);/* must clear */
2729 + ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK);
2730 + ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));
2731 +
2732 +@@ -4390,6 +4391,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
2733 + int hird, exit_latency;
2734 + int ret;
2735 +
2736 ++ if (xhci->quirks & XHCI_HW_LPM_DISABLE)
2737 ++ return -EPERM;
2738 ++
2739 + if (hcd->speed >= HCD_USB3 || !xhci->hw_lpm_support ||
2740 + !udev->lpm_capable)
2741 + return -EPERM;
2742 +@@ -4412,7 +4416,7 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
2743 + xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
2744 + enable ? "enable" : "disable", port_num + 1);
2745 +
2746 +- if (enable && !(xhci->quirks & XHCI_HW_LPM_DISABLE)) {
2747 ++ if (enable) {
2748 + /* Host supports BESL timeout instead of HIRD */
2749 + if (udev->usb2_hw_lpm_besl_capable) {
2750 + /* if device doesn't have a preferred BESL value use a
2751 +@@ -4471,6 +4475,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
2752 + mutex_lock(hcd->bandwidth_mutex);
2753 + xhci_change_max_exit_latency(xhci, udev, 0);
2754 + mutex_unlock(hcd->bandwidth_mutex);
2755 ++ readl_poll_timeout(ports[port_num]->addr, pm_val,
2756 ++ (pm_val & PORT_PLS_MASK) == XDEV_U0,
2757 ++ 100, 10000);
2758 + return 0;
2759 + }
2760 + }
2761 +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
2762 +index 23a1abdc2b43..c656b41b57b5 100644
2763 +--- a/drivers/usb/host/xhci.h
2764 ++++ b/drivers/usb/host/xhci.h
2765 +@@ -716,7 +716,7 @@ struct xhci_ep_ctx {
2766 + * 4 - TRB error
2767 + * 5-7 - reserved
2768 + */
2769 +-#define EP_STATE_MASK (0xf)
2770 ++#define EP_STATE_MASK (0x7)
2771 + #define EP_STATE_DISABLED 0
2772 + #define EP_STATE_RUNNING 1
2773 + #define EP_STATE_HALTED 2
2774 +diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
2775 +index 86637cd066cf..05cdad13933b 100644
2776 +--- a/drivers/usb/renesas_usbhs/fifo.c
2777 ++++ b/drivers/usb/renesas_usbhs/fifo.c
2778 +@@ -803,7 +803,8 @@ static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
2779 + return info->dma_map_ctrl(chan->device->dev, pkt, map);
2780 + }
2781 +
2782 +-static void usbhsf_dma_complete(void *arg);
2783 ++static void usbhsf_dma_complete(void *arg,
2784 ++ const struct dmaengine_result *result);
2785 + static void usbhsf_dma_xfer_preparing(struct usbhs_pkt *pkt)
2786 + {
2787 + struct usbhs_pipe *pipe = pkt->pipe;
2788 +@@ -813,6 +814,7 @@ static void usbhsf_dma_xfer_preparing(struct usbhs_pkt *pkt)
2789 + struct dma_chan *chan;
2790 + struct device *dev = usbhs_priv_to_dev(priv);
2791 + enum dma_transfer_direction dir;
2792 ++ dma_cookie_t cookie;
2793 +
2794 + fifo = usbhs_pipe_to_fifo(pipe);
2795 + if (!fifo)
2796 +@@ -827,11 +829,11 @@ static void usbhsf_dma_xfer_preparing(struct usbhs_pkt *pkt)
2797 + if (!desc)
2798 + return;
2799 +
2800 +- desc->callback = usbhsf_dma_complete;
2801 +- desc->callback_param = pipe;
2802 ++ desc->callback_result = usbhsf_dma_complete;
2803 ++ desc->callback_param = pkt;
2804 +
2805 +- pkt->cookie = dmaengine_submit(desc);
2806 +- if (pkt->cookie < 0) {
2807 ++ cookie = dmaengine_submit(desc);
2808 ++ if (cookie < 0) {
2809 + dev_err(dev, "Failed to submit dma descriptor\n");
2810 + return;
2811 + }
2812 +@@ -1152,12 +1154,10 @@ static size_t usbhs_dma_calc_received_size(struct usbhs_pkt *pkt,
2813 + struct dma_chan *chan, int dtln)
2814 + {
2815 + struct usbhs_pipe *pipe = pkt->pipe;
2816 +- struct dma_tx_state state;
2817 + size_t received_size;
2818 + int maxp = usbhs_pipe_get_maxpacket(pipe);
2819 +
2820 +- dmaengine_tx_status(chan, pkt->cookie, &state);
2821 +- received_size = pkt->length - state.residue;
2822 ++ received_size = pkt->length - pkt->dma_result->residue;
2823 +
2824 + if (dtln) {
2825 + received_size -= USBHS_USB_DMAC_XFER_SIZE;
2826 +@@ -1363,13 +1363,16 @@ static int usbhsf_irq_ready(struct usbhs_priv *priv,
2827 + return 0;
2828 + }
2829 +
2830 +-static void usbhsf_dma_complete(void *arg)
2831 ++static void usbhsf_dma_complete(void *arg,
2832 ++ const struct dmaengine_result *result)
2833 + {
2834 +- struct usbhs_pipe *pipe = arg;
2835 ++ struct usbhs_pkt *pkt = arg;
2836 ++ struct usbhs_pipe *pipe = pkt->pipe;
2837 + struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
2838 + struct device *dev = usbhs_priv_to_dev(priv);
2839 + int ret;
2840 +
2841 ++ pkt->dma_result = result;
2842 + ret = usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE);
2843 + if (ret < 0)
2844 + dev_err(dev, "dma_complete run_error %d : %d\n",
2845 +diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h
2846 +index c3d3cc35cee0..4a7dc23ce3d3 100644
2847 +--- a/drivers/usb/renesas_usbhs/fifo.h
2848 ++++ b/drivers/usb/renesas_usbhs/fifo.h
2849 +@@ -50,7 +50,7 @@ struct usbhs_pkt {
2850 + struct usbhs_pkt *pkt);
2851 + struct work_struct work;
2852 + dma_addr_t dma;
2853 +- dma_cookie_t cookie;
2854 ++ const struct dmaengine_result *dma_result;
2855 + void *buf;
2856 + int length;
2857 + int trans;
2858 +diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
2859 +index 017389021b96..b56a0880a044 100644
2860 +--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
2861 ++++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
2862 +@@ -179,26 +179,6 @@ out:
2863 + return tcpci_irq(chip->tcpci);
2864 + }
2865 +
2866 +-static int rt1711h_init_alert(struct rt1711h_chip *chip,
2867 +- struct i2c_client *client)
2868 +-{
2869 +- int ret;
2870 +-
2871 +- /* Disable chip interrupts before requesting irq */
2872 +- ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
2873 +- if (ret < 0)
2874 +- return ret;
2875 +-
2876 +- ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
2877 +- rt1711h_irq,
2878 +- IRQF_ONESHOT | IRQF_TRIGGER_LOW,
2879 +- dev_name(chip->dev), chip);
2880 +- if (ret < 0)
2881 +- return ret;
2882 +- enable_irq_wake(client->irq);
2883 +- return 0;
2884 +-}
2885 +-
2886 + static int rt1711h_sw_reset(struct rt1711h_chip *chip)
2887 + {
2888 + int ret;
2889 +@@ -260,7 +240,8 @@ static int rt1711h_probe(struct i2c_client *client,
2890 + if (ret < 0)
2891 + return ret;
2892 +
2893 +- ret = rt1711h_init_alert(chip, client);
2894 ++ /* Disable chip interrupts before requesting irq */
2895 ++ ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
2896 + if (ret < 0)
2897 + return ret;
2898 +
2899 +@@ -271,6 +252,14 @@ static int rt1711h_probe(struct i2c_client *client,
2900 + if (IS_ERR_OR_NULL(chip->tcpci))
2901 + return PTR_ERR(chip->tcpci);
2902 +
2903 ++ ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
2904 ++ rt1711h_irq,
2905 ++ IRQF_ONESHOT | IRQF_TRIGGER_LOW,
2906 ++ dev_name(chip->dev), chip);
2907 ++ if (ret < 0)
2908 ++ return ret;
2909 ++ enable_irq_wake(client->irq);
2910 ++
2911 + return 0;
2912 + }
2913 +
2914 +diff --git a/fs/afs/cell.c b/fs/afs/cell.c
2915 +index 78ba5f932287..296b489861a9 100644
2916 +--- a/fs/afs/cell.c
2917 ++++ b/fs/afs/cell.c
2918 +@@ -154,10 +154,17 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
2919 + return ERR_PTR(-ENOMEM);
2920 + }
2921 +
2922 ++ cell->name = kmalloc(namelen + 1, GFP_KERNEL);
2923 ++ if (!cell->name) {
2924 ++ kfree(cell);
2925 ++ return ERR_PTR(-ENOMEM);
2926 ++ }
2927 ++
2928 + cell->net = net;
2929 + cell->name_len = namelen;
2930 + for (i = 0; i < namelen; i++)
2931 + cell->name[i] = tolower(name[i]);
2932 ++ cell->name[i] = 0;
2933 +
2934 + atomic_set(&cell->usage, 2);
2935 + INIT_WORK(&cell->manager, afs_manage_cell);
2936 +@@ -203,6 +210,7 @@ parse_failed:
2937 + if (ret == -EINVAL)
2938 + printk(KERN_ERR "kAFS: bad VL server IP address\n");
2939 + error:
2940 ++ kfree(cell->name);
2941 + kfree(cell);
2942 + _leave(" = %d", ret);
2943 + return ERR_PTR(ret);
2944 +@@ -483,6 +491,7 @@ static void afs_cell_destroy(struct rcu_head *rcu)
2945 +
2946 + afs_put_vlserverlist(cell->net, rcu_access_pointer(cell->vl_servers));
2947 + key_put(cell->anonymous_key);
2948 ++ kfree(cell->name);
2949 + kfree(cell);
2950 +
2951 + _leave(" [destroyed]");
2952 +diff --git a/fs/afs/internal.h b/fs/afs/internal.h
2953 +index 555ad7c9afcb..7fe88d918b23 100644
2954 +--- a/fs/afs/internal.h
2955 ++++ b/fs/afs/internal.h
2956 +@@ -397,7 +397,7 @@ struct afs_cell {
2957 + struct afs_vlserver_list __rcu *vl_servers;
2958 +
2959 + u8 name_len; /* Length of name */
2960 +- char name[64 + 1]; /* Cell name, case-flattened and NUL-padded */
2961 ++ char *name; /* Cell name, case-flattened and NUL-padded */
2962 + };
2963 +
2964 + /*
2965 +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
2966 +index c2dd94e1b274..42d69e77f89d 100644
2967 +--- a/fs/btrfs/block-group.c
2968 ++++ b/fs/btrfs/block-group.c
2969 +@@ -910,7 +910,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
2970 + path = btrfs_alloc_path();
2971 + if (!path) {
2972 + ret = -ENOMEM;
2973 +- goto out_put_group;
2974 ++ goto out;
2975 + }
2976 +
2977 + /*
2978 +@@ -948,7 +948,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
2979 + ret = btrfs_orphan_add(trans, BTRFS_I(inode));
2980 + if (ret) {
2981 + btrfs_add_delayed_iput(inode);
2982 +- goto out_put_group;
2983 ++ goto out;
2984 + }
2985 + clear_nlink(inode);
2986 + /* One for the block groups ref */
2987 +@@ -971,13 +971,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
2988 +
2989 + ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
2990 + if (ret < 0)
2991 +- goto out_put_group;
2992 ++ goto out;
2993 + if (ret > 0)
2994 + btrfs_release_path(path);
2995 + if (ret == 0) {
2996 + ret = btrfs_del_item(trans, tree_root, path);
2997 + if (ret)
2998 +- goto out_put_group;
2999 ++ goto out;
3000 + btrfs_release_path(path);
3001 + }
3002 +
3003 +@@ -986,6 +986,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
3004 + &fs_info->block_group_cache_tree);
3005 + RB_CLEAR_NODE(&block_group->cache_node);
3006 +
3007 ++ /* Once for the block groups rbtree */
3008 ++ btrfs_put_block_group(block_group);
3009 ++
3010 + if (fs_info->first_logical_byte == block_group->key.objectid)
3011 + fs_info->first_logical_byte = (u64)-1;
3012 + spin_unlock(&fs_info->block_group_cache_lock);
3013 +@@ -1094,10 +1097,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
3014 +
3015 + ret = remove_block_group_free_space(trans, block_group);
3016 + if (ret)
3017 +- goto out_put_group;
3018 +-
3019 +- /* Once for the block groups rbtree */
3020 +- btrfs_put_block_group(block_group);
3021 ++ goto out;
3022 +
3023 + ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
3024 + if (ret > 0)
3025 +@@ -1120,10 +1120,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
3026 + free_extent_map(em);
3027 + }
3028 +
3029 +-out_put_group:
3030 ++out:
3031 + /* Once for the lookup reference */
3032 + btrfs_put_block_group(block_group);
3033 +-out:
3034 + if (remove_rsv)
3035 + btrfs_delayed_refs_rsv_release(fs_info, 1);
3036 + btrfs_free_path(path);
3037 +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
3038 +index 6d2c277c6e0a..36cd210ee2ef 100644
3039 +--- a/fs/btrfs/ctree.h
3040 ++++ b/fs/btrfs/ctree.h
3041 +@@ -940,6 +940,8 @@ enum {
3042 + BTRFS_ROOT_DEAD_RELOC_TREE,
3043 + /* Mark dead root stored on device whose cleanup needs to be resumed */
3044 + BTRFS_ROOT_DEAD_TREE,
3045 ++ /* The root has a log tree. Used only for subvolume roots. */
3046 ++ BTRFS_ROOT_HAS_LOG_TREE,
3047 + };
3048 +
3049 + /*
3050 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
3051 +index 127cdecbe872..280c45c91ddc 100644
3052 +--- a/fs/btrfs/inode.c
3053 ++++ b/fs/btrfs/inode.c
3054 +@@ -975,6 +975,7 @@ static noinline int cow_file_range(struct inode *inode,
3055 + u64 num_bytes;
3056 + unsigned long ram_size;
3057 + u64 cur_alloc_size = 0;
3058 ++ u64 min_alloc_size;
3059 + u64 blocksize = fs_info->sectorsize;
3060 + struct btrfs_key ins;
3061 + struct extent_map *em;
3062 +@@ -1025,10 +1026,26 @@ static noinline int cow_file_range(struct inode *inode,
3063 + btrfs_drop_extent_cache(BTRFS_I(inode), start,
3064 + start + num_bytes - 1, 0);
3065 +
3066 ++ /*
3067 ++ * Relocation relies on the relocated extents to have exactly the same
3068 ++ * size as the original extents. Normally writeback for relocation data
3069 ++ * extents follows a NOCOW path because relocation preallocates the
3070 ++ * extents. However, due to an operation such as scrub turning a block
3071 ++ * group to RO mode, it may fallback to COW mode, so we must make sure
3072 ++ * an extent allocated during COW has exactly the requested size and can
3073 ++ * not be split into smaller extents, otherwise relocation breaks and
3074 ++ * fails during the stage where it updates the bytenr of file extent
3075 ++ * items.
3076 ++ */
3077 ++ if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID)
3078 ++ min_alloc_size = num_bytes;
3079 ++ else
3080 ++ min_alloc_size = fs_info->sectorsize;
3081 ++
3082 + while (num_bytes > 0) {
3083 + cur_alloc_size = num_bytes;
3084 + ret = btrfs_reserve_extent(root, cur_alloc_size, cur_alloc_size,
3085 +- fs_info->sectorsize, 0, alloc_hint,
3086 ++ min_alloc_size, 0, alloc_hint,
3087 + &ins, 1, 1);
3088 + if (ret < 0)
3089 + goto out_unlock;
3090 +@@ -1328,6 +1345,8 @@ static int fallback_to_cow(struct inode *inode, struct page *locked_page,
3091 + int *page_started, unsigned long *nr_written)
3092 + {
3093 + const bool is_space_ino = btrfs_is_free_space_inode(BTRFS_I(inode));
3094 ++ const bool is_reloc_ino = (BTRFS_I(inode)->root->root_key.objectid ==
3095 ++ BTRFS_DATA_RELOC_TREE_OBJECTID);
3096 + const u64 range_bytes = end + 1 - start;
3097 + struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
3098 + u64 range_start = start;
3099 +@@ -1358,18 +1377,23 @@ static int fallback_to_cow(struct inode *inode, struct page *locked_page,
3100 + * data space info, which we incremented in the step above.
3101 + *
3102 + * If we need to fallback to cow and the inode corresponds to a free
3103 +- * space cache inode, we must also increment bytes_may_use of the data
3104 +- * space_info for the same reason. Space caches always get a prealloc
3105 ++ * space cache inode or an inode of the data relocation tree, we must
3106 ++ * also increment bytes_may_use of the data space_info for the same
3107 ++ * reason. Space caches and relocated data extents always get a prealloc
3108 + * extent for them, however scrub or balance may have set the block
3109 +- * group that contains that extent to RO mode.
3110 ++ * group that contains that extent to RO mode and therefore force COW
3111 ++ * when starting writeback.
3112 + */
3113 + count = count_range_bits(io_tree, &range_start, end, range_bytes,
3114 + EXTENT_NORESERVE, 0);
3115 +- if (count > 0 || is_space_ino) {
3116 +- const u64 bytes = is_space_ino ? range_bytes : count;
3117 ++ if (count > 0 || is_space_ino || is_reloc_ino) {
3118 ++ u64 bytes = count;
3119 + struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
3120 + struct btrfs_space_info *sinfo = fs_info->data_sinfo;
3121 +
3122 ++ if (is_space_ino || is_reloc_ino)
3123 ++ bytes = range_bytes;
3124 ++
3125 + spin_lock(&sinfo->lock);
3126 + btrfs_space_info_update_bytes_may_use(fs_info, sinfo, bytes);
3127 + spin_unlock(&sinfo->lock);
3128 +@@ -8833,9 +8857,6 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
3129 + dio_data.overwrite = 1;
3130 + inode_unlock(inode);
3131 + relock = true;
3132 +- } else if (iocb->ki_flags & IOCB_NOWAIT) {
3133 +- ret = -EAGAIN;
3134 +- goto out;
3135 + }
3136 + ret = btrfs_delalloc_reserve_space(inode, &data_reserved,
3137 + offset, count);
3138 +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
3139 +index 7d464b049507..f46afbff668e 100644
3140 +--- a/fs/btrfs/tree-log.c
3141 ++++ b/fs/btrfs/tree-log.c
3142 +@@ -167,6 +167,7 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
3143 + if (ret)
3144 + goto out;
3145 +
3146 ++ set_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state);
3147 + clear_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state);
3148 + root->log_start_pid = current->pid;
3149 + }
3150 +@@ -193,6 +194,9 @@ static int join_running_log_trans(struct btrfs_root *root)
3151 + {
3152 + int ret = -ENOENT;
3153 +
3154 ++ if (!test_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state))
3155 ++ return ret;
3156 ++
3157 + mutex_lock(&root->log_mutex);
3158 + if (root->log_root) {
3159 + ret = 0;
3160 +@@ -3327,6 +3331,7 @@ int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root)
3161 + if (root->log_root) {
3162 + free_log_tree(trans, root->log_root);
3163 + root->log_root = NULL;
3164 ++ clear_bit(BTRFS_ROOT_HAS_LOG_TREE, &root->state);
3165 + }
3166 + return 0;
3167 + }
3168 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
3169 +index 58915d882285..7ccbfc656478 100644
3170 +--- a/fs/cifs/smb2ops.c
3171 ++++ b/fs/cifs/smb2ops.c
3172 +@@ -736,6 +736,7 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid)
3173 + /* close extra handle outside of crit sec */
3174 + SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
3175 + }
3176 ++ rc = 0;
3177 + goto oshr_free;
3178 + }
3179 +
3180 +@@ -2969,6 +2970,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
3181 + trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid,
3182 + ses->Suid, offset, len);
3183 +
3184 ++ /*
3185 ++ * We zero the range through ioctl, so we need remove the page caches
3186 ++ * first, otherwise the data may be inconsistent with the server.
3187 ++ */
3188 ++ truncate_pagecache_range(inode, offset, offset + len - 1);
3189 +
3190 + /* if file not oplocked can't be sure whether asking to extend size */
3191 + if (!CIFS_CACHE_READ(cifsi))
3192 +@@ -3035,6 +3041,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
3193 + return rc;
3194 + }
3195 +
3196 ++ /*
3197 ++ * We implement the punch hole through ioctl, so we need remove the page
3198 ++ * caches first, otherwise the data may be inconsistent with the server.
3199 ++ */
3200 ++ truncate_pagecache_range(inode, offset, offset + len - 1);
3201 ++
3202 + cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len);
3203 +
3204 + fsctl_buf.FileOffset = cpu_to_le64(offset);
3205 +diff --git a/fs/erofs/zdata.h b/fs/erofs/zdata.h
3206 +index faf950189bd7..568d5a493876 100644
3207 +--- a/fs/erofs/zdata.h
3208 ++++ b/fs/erofs/zdata.h
3209 +@@ -148,22 +148,22 @@ static inline void z_erofs_onlinepage_init(struct page *page)
3210 + static inline void z_erofs_onlinepage_fixup(struct page *page,
3211 + uintptr_t index, bool down)
3212 + {
3213 +- unsigned long *p, o, v, id;
3214 +-repeat:
3215 +- p = &page_private(page);
3216 +- o = READ_ONCE(*p);
3217 ++ union z_erofs_onlinepage_converter u = { .v = &page_private(page) };
3218 ++ int orig, orig_index, val;
3219 +
3220 +- id = o >> Z_EROFS_ONLINEPAGE_INDEX_SHIFT;
3221 +- if (id) {
3222 ++repeat:
3223 ++ orig = atomic_read(u.o);
3224 ++ orig_index = orig >> Z_EROFS_ONLINEPAGE_INDEX_SHIFT;
3225 ++ if (orig_index) {
3226 + if (!index)
3227 + return;
3228 +
3229 +- DBG_BUGON(id != index);
3230 ++ DBG_BUGON(orig_index != index);
3231 + }
3232 +
3233 +- v = (index << Z_EROFS_ONLINEPAGE_INDEX_SHIFT) |
3234 +- ((o & Z_EROFS_ONLINEPAGE_COUNT_MASK) + (unsigned int)down);
3235 +- if (cmpxchg(p, o, v) != o)
3236 ++ val = (index << Z_EROFS_ONLINEPAGE_INDEX_SHIFT) |
3237 ++ ((orig & Z_EROFS_ONLINEPAGE_COUNT_MASK) + (unsigned int)down);
3238 ++ if (atomic_cmpxchg(u.o, orig, val) != orig)
3239 + goto repeat;
3240 + }
3241 +
3242 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
3243 +index 6b0bf4ebd812..70cf8c5760c7 100644
3244 +--- a/fs/nfs/direct.c
3245 ++++ b/fs/nfs/direct.c
3246 +@@ -367,8 +367,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
3247 + {
3248 + struct inode *inode = dreq->inode;
3249 +
3250 +- inode_dio_end(inode);
3251 +-
3252 + if (dreq->iocb) {
3253 + long res = (long) dreq->error;
3254 + if (dreq->count != 0) {
3255 +@@ -380,7 +378,10 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
3256 +
3257 + complete(&dreq->completion);
3258 +
3259 ++ igrab(inode);
3260 + nfs_direct_req_release(dreq);
3261 ++ inode_dio_end(inode);
3262 ++ iput(inode);
3263 + }
3264 +
3265 + static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
3266 +@@ -510,8 +511,10 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
3267 + * generic layer handle the completion.
3268 + */
3269 + if (requested_bytes == 0) {
3270 +- inode_dio_end(inode);
3271 ++ igrab(inode);
3272 + nfs_direct_req_release(dreq);
3273 ++ inode_dio_end(inode);
3274 ++ iput(inode);
3275 + return result < 0 ? result : -EIO;
3276 + }
3277 +
3278 +@@ -923,8 +926,10 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
3279 + * generic layer handle the completion.
3280 + */
3281 + if (requested_bytes == 0) {
3282 +- inode_dio_end(inode);
3283 ++ igrab(inode);
3284 + nfs_direct_req_release(dreq);
3285 ++ inode_dio_end(inode);
3286 ++ iput(inode);
3287 + return result < 0 ? result : -EIO;
3288 + }
3289 +
3290 +diff --git a/fs/nfs/file.c b/fs/nfs/file.c
3291 +index 95dc90570786..7b3136753205 100644
3292 +--- a/fs/nfs/file.c
3293 ++++ b/fs/nfs/file.c
3294 +@@ -83,6 +83,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
3295 + dprintk("NFS: release(%pD2)\n", filp);
3296 +
3297 + nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
3298 ++ inode_dio_wait(inode);
3299 + nfs_file_clear_open_context(filp);
3300 + return 0;
3301 + }
3302 +diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
3303 +index 5657b7f2611f..1741d902b0d8 100644
3304 +--- a/fs/nfs/flexfilelayout/flexfilelayout.c
3305 ++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
3306 +@@ -984,9 +984,8 @@ retry:
3307 + goto out_mds;
3308 +
3309 + /* Use a direct mapping of ds_idx to pgio mirror_idx */
3310 +- if (WARN_ON_ONCE(pgio->pg_mirror_count !=
3311 +- FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
3312 +- goto out_mds;
3313 ++ if (pgio->pg_mirror_count != FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))
3314 ++ goto out_eagain;
3315 +
3316 + for (i = 0; i < pgio->pg_mirror_count; i++) {
3317 + mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
3318 +@@ -1008,7 +1007,10 @@ retry:
3319 + (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR))
3320 + pgio->pg_maxretrans = io_maxretrans;
3321 + return;
3322 +-
3323 ++out_eagain:
3324 ++ pnfs_generic_pg_cleanup(pgio);
3325 ++ pgio->pg_error = -EAGAIN;
3326 ++ return;
3327 + out_mds:
3328 + trace_pnfs_mds_fallback_pg_init_write(pgio->pg_inode,
3329 + 0, NFS4_MAX_UINT64, IOMODE_RW,
3330 +@@ -1018,6 +1020,7 @@ out_mds:
3331 + pgio->pg_lseg = NULL;
3332 + pgio->pg_maxretrans = 0;
3333 + nfs_pageio_reset_write_mds(pgio);
3334 ++ pgio->pg_error = -EAGAIN;
3335 + }
3336 +
3337 + static unsigned int
3338 +diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
3339 +index 8a2e284ccfcd..e2c34c704185 100644
3340 +--- a/fs/ocfs2/dlmglue.c
3341 ++++ b/fs/ocfs2/dlmglue.c
3342 +@@ -689,6 +689,12 @@ static void ocfs2_nfs_sync_lock_res_init(struct ocfs2_lock_res *res,
3343 + &ocfs2_nfs_sync_lops, osb);
3344 + }
3345 +
3346 ++static void ocfs2_nfs_sync_lock_init(struct ocfs2_super *osb)
3347 ++{
3348 ++ ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
3349 ++ init_rwsem(&osb->nfs_sync_rwlock);
3350 ++}
3351 ++
3352 + void ocfs2_trim_fs_lock_res_init(struct ocfs2_super *osb)
3353 + {
3354 + struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres;
3355 +@@ -2855,6 +2861,11 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex)
3356 + if (ocfs2_is_hard_readonly(osb))
3357 + return -EROFS;
3358 +
3359 ++ if (ex)
3360 ++ down_write(&osb->nfs_sync_rwlock);
3361 ++ else
3362 ++ down_read(&osb->nfs_sync_rwlock);
3363 ++
3364 + if (ocfs2_mount_local(osb))
3365 + return 0;
3366 +
3367 +@@ -2873,6 +2884,10 @@ void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex)
3368 + if (!ocfs2_mount_local(osb))
3369 + ocfs2_cluster_unlock(osb, lockres,
3370 + ex ? LKM_EXMODE : LKM_PRMODE);
3371 ++ if (ex)
3372 ++ up_write(&osb->nfs_sync_rwlock);
3373 ++ else
3374 ++ up_read(&osb->nfs_sync_rwlock);
3375 + }
3376 +
3377 + int ocfs2_trim_fs_lock(struct ocfs2_super *osb,
3378 +@@ -3340,7 +3355,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
3379 + local:
3380 + ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb);
3381 + ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
3382 +- ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb);
3383 ++ ocfs2_nfs_sync_lock_init(osb);
3384 + ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb);
3385 +
3386 + osb->cconn = conn;
3387 +diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
3388 +index 9150cfa4df7d..9461bd3e1c0c 100644
3389 +--- a/fs/ocfs2/ocfs2.h
3390 ++++ b/fs/ocfs2/ocfs2.h
3391 +@@ -394,6 +394,7 @@ struct ocfs2_super
3392 + struct ocfs2_lock_res osb_super_lockres;
3393 + struct ocfs2_lock_res osb_rename_lockres;
3394 + struct ocfs2_lock_res osb_nfs_sync_lockres;
3395 ++ struct rw_semaphore nfs_sync_rwlock;
3396 + struct ocfs2_lock_res osb_trim_fs_lockres;
3397 + struct mutex obs_trim_fs_mutex;
3398 + struct ocfs2_dlm_debug *osb_dlm_debug;
3399 +diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
3400 +index 0db4a7ec58a2..dcef83c8796d 100644
3401 +--- a/fs/ocfs2/ocfs2_fs.h
3402 ++++ b/fs/ocfs2/ocfs2_fs.h
3403 +@@ -290,7 +290,7 @@
3404 + #define OCFS2_MAX_SLOTS 255
3405 +
3406 + /* Slot map indicator for an empty slot */
3407 +-#define OCFS2_INVALID_SLOT -1
3408 ++#define OCFS2_INVALID_SLOT ((u16)-1)
3409 +
3410 + #define OCFS2_VOL_UUID_LEN 16
3411 + #define OCFS2_MAX_VOL_LABEL_LEN 64
3412 +@@ -326,8 +326,8 @@ struct ocfs2_system_inode_info {
3413 + enum {
3414 + BAD_BLOCK_SYSTEM_INODE = 0,
3415 + GLOBAL_INODE_ALLOC_SYSTEM_INODE,
3416 ++#define OCFS2_FIRST_ONLINE_SYSTEM_INODE GLOBAL_INODE_ALLOC_SYSTEM_INODE
3417 + SLOT_MAP_SYSTEM_INODE,
3418 +-#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
3419 + HEARTBEAT_SYSTEM_INODE,
3420 + GLOBAL_BITMAP_SYSTEM_INODE,
3421 + USER_QUOTA_SYSTEM_INODE,
3422 +diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
3423 +index 69c21a3843af..503e724d39f5 100644
3424 +--- a/fs/ocfs2/suballoc.c
3425 ++++ b/fs/ocfs2/suballoc.c
3426 +@@ -2827,9 +2827,12 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
3427 + goto bail;
3428 + }
3429 +
3430 +- inode_alloc_inode =
3431 +- ocfs2_get_system_file_inode(osb, INODE_ALLOC_SYSTEM_INODE,
3432 +- suballoc_slot);
3433 ++ if (suballoc_slot == (u16)OCFS2_INVALID_SLOT)
3434 ++ inode_alloc_inode = ocfs2_get_system_file_inode(osb,
3435 ++ GLOBAL_INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
3436 ++ else
3437 ++ inode_alloc_inode = ocfs2_get_system_file_inode(osb,
3438 ++ INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
3439 + if (!inode_alloc_inode) {
3440 + /* the error code could be inaccurate, but we are not able to
3441 + * get the correct one. */
3442 +diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
3443 +index 533b04aaf6f6..0a36f532cf86 100644
3444 +--- a/fs/xfs/libxfs/xfs_alloc.c
3445 ++++ b/fs/xfs/libxfs/xfs_alloc.c
3446 +@@ -2598,6 +2598,13 @@ xfs_agf_verify(
3447 + be32_to_cpu(agf->agf_flcount) <= xfs_agfl_size(mp)))
3448 + return __this_address;
3449 +
3450 ++ if (be32_to_cpu(agf->agf_length) > mp->m_sb.sb_dblocks)
3451 ++ return __this_address;
3452 ++
3453 ++ if (be32_to_cpu(agf->agf_freeblks) < be32_to_cpu(agf->agf_longest) ||
3454 ++ be32_to_cpu(agf->agf_freeblks) > be32_to_cpu(agf->agf_length))
3455 ++ return __this_address;
3456 ++
3457 + if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 ||
3458 + be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 ||
3459 + be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > XFS_BTREE_MAXLEVELS ||
3460 +@@ -2609,6 +2616,10 @@ xfs_agf_verify(
3461 + be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > XFS_BTREE_MAXLEVELS))
3462 + return __this_address;
3463 +
3464 ++ if (xfs_sb_version_hasrmapbt(&mp->m_sb) &&
3465 ++ be32_to_cpu(agf->agf_rmap_blocks) > be32_to_cpu(agf->agf_length))
3466 ++ return __this_address;
3467 ++
3468 + /*
3469 + * during growfs operations, the perag is not fully initialised,
3470 + * so we can't use it for any useful checking. growfs ensures we can't
3471 +@@ -2622,6 +2633,11 @@ xfs_agf_verify(
3472 + be32_to_cpu(agf->agf_btreeblks) > be32_to_cpu(agf->agf_length))
3473 + return __this_address;
3474 +
3475 ++ if (xfs_sb_version_hasreflink(&mp->m_sb) &&
3476 ++ be32_to_cpu(agf->agf_refcount_blocks) >
3477 ++ be32_to_cpu(agf->agf_length))
3478 ++ return __this_address;
3479 ++
3480 + if (xfs_sb_version_hasreflink(&mp->m_sb) &&
3481 + (be32_to_cpu(agf->agf_refcount_level) < 1 ||
3482 + be32_to_cpu(agf->agf_refcount_level) > XFS_BTREE_MAXLEVELS))
3483 +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
3484 +index b580a35f50ea..ec3081ab04c0 100644
3485 +--- a/include/linux/netdevice.h
3486 ++++ b/include/linux/netdevice.h
3487 +@@ -3043,7 +3043,7 @@ static inline int dev_recursion_level(void)
3488 + return this_cpu_read(softnet_data.xmit.recursion);
3489 + }
3490 +
3491 +-#define XMIT_RECURSION_LIMIT 10
3492 ++#define XMIT_RECURSION_LIMIT 8
3493 + static inline bool dev_xmit_recursion(void)
3494 + {
3495 + return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
3496 +diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h
3497 +index 733fad7dfbed..6d15040c642c 100644
3498 +--- a/include/linux/qed/qed_chain.h
3499 ++++ b/include/linux/qed/qed_chain.h
3500 +@@ -207,28 +207,34 @@ static inline u32 qed_chain_get_cons_idx_u32(struct qed_chain *p_chain)
3501 +
3502 + static inline u16 qed_chain_get_elem_left(struct qed_chain *p_chain)
3503 + {
3504 ++ u16 elem_per_page = p_chain->elem_per_page;
3505 ++ u32 prod = p_chain->u.chain16.prod_idx;
3506 ++ u32 cons = p_chain->u.chain16.cons_idx;
3507 + u16 used;
3508 +
3509 +- used = (u16) (((u32)0x10000 +
3510 +- (u32)p_chain->u.chain16.prod_idx) -
3511 +- (u32)p_chain->u.chain16.cons_idx);
3512 ++ if (prod < cons)
3513 ++ prod += (u32)U16_MAX + 1;
3514 ++
3515 ++ used = (u16)(prod - cons);
3516 + if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR)
3517 +- used -= p_chain->u.chain16.prod_idx / p_chain->elem_per_page -
3518 +- p_chain->u.chain16.cons_idx / p_chain->elem_per_page;
3519 ++ used -= prod / elem_per_page - cons / elem_per_page;
3520 +
3521 + return (u16)(p_chain->capacity - used);
3522 + }
3523 +
3524 + static inline u32 qed_chain_get_elem_left_u32(struct qed_chain *p_chain)
3525 + {
3526 ++ u16 elem_per_page = p_chain->elem_per_page;
3527 ++ u64 prod = p_chain->u.chain32.prod_idx;
3528 ++ u64 cons = p_chain->u.chain32.cons_idx;
3529 + u32 used;
3530 +
3531 +- used = (u32) (((u64)0x100000000ULL +
3532 +- (u64)p_chain->u.chain32.prod_idx) -
3533 +- (u64)p_chain->u.chain32.cons_idx);
3534 ++ if (prod < cons)
3535 ++ prod += (u64)U32_MAX + 1;
3536 ++
3537 ++ used = (u32)(prod - cons);
3538 + if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR)
3539 +- used -= p_chain->u.chain32.prod_idx / p_chain->elem_per_page -
3540 +- p_chain->u.chain32.cons_idx / p_chain->elem_per_page;
3541 ++ used -= (u32)(prod / elem_per_page - cons / elem_per_page);
3542 +
3543 + return p_chain->capacity - used;
3544 + }
3545 +diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
3546 +index 131ea1bad458..eccfd3a4e4c8 100644
3547 +--- a/include/linux/tpm_eventlog.h
3548 ++++ b/include/linux/tpm_eventlog.h
3549 +@@ -81,6 +81,8 @@ struct tcg_efi_specid_event_algs {
3550 + u16 digest_size;
3551 + } __packed;
3552 +
3553 ++#define TCG_SPECID_SIG "Spec ID Event03"
3554 ++
3555 + struct tcg_efi_specid_event_head {
3556 + u8 signature[16];
3557 + u32 platform_class;
3558 +@@ -171,6 +173,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
3559 + int i;
3560 + int j;
3561 + u32 count, event_type;
3562 ++ const u8 zero_digest[sizeof(event_header->digest)] = {0};
3563 +
3564 + marker = event;
3565 + marker_start = marker;
3566 +@@ -198,10 +201,19 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
3567 + count = READ_ONCE(event->count);
3568 + event_type = READ_ONCE(event->event_type);
3569 +
3570 ++ /* Verify that it's the log header */
3571 ++ if (event_header->pcr_idx != 0 ||
3572 ++ event_header->event_type != NO_ACTION ||
3573 ++ memcmp(event_header->digest, zero_digest, sizeof(zero_digest))) {
3574 ++ size = 0;
3575 ++ goto out;
3576 ++ }
3577 ++
3578 + efispecid = (struct tcg_efi_specid_event_head *)event_header->event;
3579 +
3580 + /* Check if event is malformed. */
3581 +- if (count > efispecid->num_algs) {
3582 ++ if (memcmp(efispecid->signature, TCG_SPECID_SIG,
3583 ++ sizeof(TCG_SPECID_SIG)) || count > efispecid->num_algs) {
3584 + size = 0;
3585 + goto out;
3586 + }
3587 +diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
3588 +index 823afc42a3aa..06e1deeef464 100644
3589 +--- a/include/net/sctp/constants.h
3590 ++++ b/include/net/sctp/constants.h
3591 +@@ -341,11 +341,13 @@ enum {
3592 + ipv4_is_anycast_6to4(a))
3593 +
3594 + /* Flags used for the bind address copy functions. */
3595 +-#define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by
3596 ++#define SCTP_ADDR4_ALLOWED 0x00000001 /* IPv4 address is allowed by
3597 + local sock family */
3598 +-#define SCTP_ADDR4_PEERSUPP 0x00000002 /* IPv4 address is supported by
3599 ++#define SCTP_ADDR6_ALLOWED 0x00000002 /* IPv6 address is allowed by
3600 ++ local sock family */
3601 ++#define SCTP_ADDR4_PEERSUPP 0x00000004 /* IPv4 address is supported by
3602 + peer */
3603 +-#define SCTP_ADDR6_PEERSUPP 0x00000004 /* IPv6 address is supported by
3604 ++#define SCTP_ADDR6_PEERSUPP 0x00000008 /* IPv6 address is supported by
3605 + peer */
3606 +
3607 + /* Reasons to retransmit. */
3608 +diff --git a/include/net/sock.h b/include/net/sock.h
3609 +index 6c5a3809483e..8263bbf756a2 100644
3610 +--- a/include/net/sock.h
3611 ++++ b/include/net/sock.h
3612 +@@ -1803,7 +1803,6 @@ static inline int sk_rx_queue_get(const struct sock *sk)
3613 +
3614 + static inline void sk_set_socket(struct sock *sk, struct socket *sock)
3615 + {
3616 +- sk_tx_queue_clear(sk);
3617 + sk->sk_socket = sock;
3618 + }
3619 +
3620 +diff --git a/include/net/xfrm.h b/include/net/xfrm.h
3621 +index aa08a7a5f6ac..fb391c00c19a 100644
3622 +--- a/include/net/xfrm.h
3623 ++++ b/include/net/xfrm.h
3624 +@@ -1012,6 +1012,7 @@ struct xfrm_offload {
3625 + #define XFRM_GRO 32
3626 + #define XFRM_ESP_NO_TRAILER 64
3627 + #define XFRM_DEV_RESUME 128
3628 ++#define XFRM_XMIT 256
3629 +
3630 + __u32 status;
3631 + #define CRYPTO_SUCCESS 1
3632 +diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
3633 +index 869e2e1860e8..b701af27a779 100644
3634 +--- a/kernel/bpf/cgroup.c
3635 ++++ b/kernel/bpf/cgroup.c
3636 +@@ -966,16 +966,23 @@ static bool __cgroup_bpf_prog_array_is_empty(struct cgroup *cgrp,
3637 +
3638 + static int sockopt_alloc_buf(struct bpf_sockopt_kern *ctx, int max_optlen)
3639 + {
3640 +- if (unlikely(max_optlen > PAGE_SIZE) || max_optlen < 0)
3641 ++ if (unlikely(max_optlen < 0))
3642 + return -EINVAL;
3643 +
3644 ++ if (unlikely(max_optlen > PAGE_SIZE)) {
3645 ++ /* We don't expose optvals that are greater than PAGE_SIZE
3646 ++ * to the BPF program.
3647 ++ */
3648 ++ max_optlen = PAGE_SIZE;
3649 ++ }
3650 ++
3651 + ctx->optval = kzalloc(max_optlen, GFP_USER);
3652 + if (!ctx->optval)
3653 + return -ENOMEM;
3654 +
3655 + ctx->optval_end = ctx->optval + max_optlen;
3656 +
3657 +- return 0;
3658 ++ return max_optlen;
3659 + }
3660 +
3661 + static void sockopt_free_buf(struct bpf_sockopt_kern *ctx)
3662 +@@ -1009,13 +1016,13 @@ int __cgroup_bpf_run_filter_setsockopt(struct sock *sk, int *level,
3663 + */
3664 + max_optlen = max_t(int, 16, *optlen);
3665 +
3666 +- ret = sockopt_alloc_buf(&ctx, max_optlen);
3667 +- if (ret)
3668 +- return ret;
3669 ++ max_optlen = sockopt_alloc_buf(&ctx, max_optlen);
3670 ++ if (max_optlen < 0)
3671 ++ return max_optlen;
3672 +
3673 + ctx.optlen = *optlen;
3674 +
3675 +- if (copy_from_user(ctx.optval, optval, *optlen) != 0) {
3676 ++ if (copy_from_user(ctx.optval, optval, min(*optlen, max_optlen)) != 0) {
3677 + ret = -EFAULT;
3678 + goto out;
3679 + }
3680 +@@ -1043,8 +1050,14 @@ int __cgroup_bpf_run_filter_setsockopt(struct sock *sk, int *level,
3681 + /* export any potential modifications */
3682 + *level = ctx.level;
3683 + *optname = ctx.optname;
3684 +- *optlen = ctx.optlen;
3685 +- *kernel_optval = ctx.optval;
3686 ++
3687 ++ /* optlen == 0 from BPF indicates that we should
3688 ++ * use original userspace data.
3689 ++ */
3690 ++ if (ctx.optlen != 0) {
3691 ++ *optlen = ctx.optlen;
3692 ++ *kernel_optval = ctx.optval;
3693 ++ }
3694 + }
3695 +
3696 + out:
3697 +@@ -1076,12 +1089,12 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
3698 + __cgroup_bpf_prog_array_is_empty(cgrp, BPF_CGROUP_GETSOCKOPT))
3699 + return retval;
3700 +
3701 +- ret = sockopt_alloc_buf(&ctx, max_optlen);
3702 +- if (ret)
3703 +- return ret;
3704 +-
3705 + ctx.optlen = max_optlen;
3706 +
3707 ++ max_optlen = sockopt_alloc_buf(&ctx, max_optlen);
3708 ++ if (max_optlen < 0)
3709 ++ return max_optlen;
3710 ++
3711 + if (!retval) {
3712 + /* If kernel getsockopt finished successfully,
3713 + * copy whatever was returned to the user back
3714 +@@ -1095,10 +1108,8 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
3715 + goto out;
3716 + }
3717 +
3718 +- if (ctx.optlen > max_optlen)
3719 +- ctx.optlen = max_optlen;
3720 +-
3721 +- if (copy_from_user(ctx.optval, optval, ctx.optlen) != 0) {
3722 ++ if (copy_from_user(ctx.optval, optval,
3723 ++ min(ctx.optlen, max_optlen)) != 0) {
3724 + ret = -EFAULT;
3725 + goto out;
3726 + }
3727 +@@ -1127,10 +1138,12 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
3728 + goto out;
3729 + }
3730 +
3731 +- if (copy_to_user(optval, ctx.optval, ctx.optlen) ||
3732 +- put_user(ctx.optlen, optlen)) {
3733 +- ret = -EFAULT;
3734 +- goto out;
3735 ++ if (ctx.optlen != 0) {
3736 ++ if (copy_to_user(optval, ctx.optval, ctx.optlen) ||
3737 ++ put_user(ctx.optlen, optlen)) {
3738 ++ ret = -EFAULT;
3739 ++ goto out;
3740 ++ }
3741 + }
3742 +
3743 + ret = ctx.retval;
3744 +diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
3745 +index b4b6b77f309c..6684696fa457 100644
3746 +--- a/kernel/bpf/devmap.c
3747 ++++ b/kernel/bpf/devmap.c
3748 +@@ -88,12 +88,13 @@ struct bpf_dtab {
3749 + static DEFINE_SPINLOCK(dev_map_lock);
3750 + static LIST_HEAD(dev_map_list);
3751 +
3752 +-static struct hlist_head *dev_map_create_hash(unsigned int entries)
3753 ++static struct hlist_head *dev_map_create_hash(unsigned int entries,
3754 ++ int numa_node)
3755 + {
3756 + int i;
3757 + struct hlist_head *hash;
3758 +
3759 +- hash = kmalloc_array(entries, sizeof(*hash), GFP_KERNEL);
3760 ++ hash = bpf_map_area_alloc(entries * sizeof(*hash), numa_node);
3761 + if (hash != NULL)
3762 + for (i = 0; i < entries; i++)
3763 + INIT_HLIST_HEAD(&hash[i]);
3764 +@@ -151,7 +152,8 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)
3765 + INIT_LIST_HEAD(per_cpu_ptr(dtab->flush_list, cpu));
3766 +
3767 + if (attr->map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
3768 +- dtab->dev_index_head = dev_map_create_hash(dtab->n_buckets);
3769 ++ dtab->dev_index_head = dev_map_create_hash(dtab->n_buckets,
3770 ++ dtab->map.numa_node);
3771 + if (!dtab->dev_index_head)
3772 + goto free_percpu;
3773 +
3774 +@@ -249,7 +251,7 @@ static void dev_map_free(struct bpf_map *map)
3775 + }
3776 + }
3777 +
3778 +- kfree(dtab->dev_index_head);
3779 ++ bpf_map_area_free(dtab->dev_index_head);
3780 + } else {
3781 + for (i = 0; i < dtab->map.max_entries; i++) {
3782 + struct bpf_dtab_netdev *dev;
3783 +diff --git a/kernel/kprobes.c b/kernel/kprobes.c
3784 +index 195ecb955fcc..950a5cfd262c 100644
3785 +--- a/kernel/kprobes.c
3786 ++++ b/kernel/kprobes.c
3787 +@@ -326,7 +326,8 @@ struct kprobe *get_kprobe(void *addr)
3788 + struct kprobe *p;
3789 +
3790 + head = &kprobe_table[hash_ptr(addr, KPROBE_HASH_BITS)];
3791 +- hlist_for_each_entry_rcu(p, head, hlist) {
3792 ++ hlist_for_each_entry_rcu(p, head, hlist,
3793 ++ lockdep_is_held(&kprobe_mutex)) {
3794 + if (p->addr == addr)
3795 + return p;
3796 + }
3797 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3798 +index 361cbc2dc966..7238ef445daf 100644
3799 +--- a/kernel/sched/core.c
3800 ++++ b/kernel/sched/core.c
3801 +@@ -4447,7 +4447,8 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
3802 + */
3803 + if (dl_prio(prio)) {
3804 + if (!dl_prio(p->normal_prio) ||
3805 +- (pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) {
3806 ++ (pi_task && dl_prio(pi_task->prio) &&
3807 ++ dl_entity_preempt(&pi_task->dl, &p->dl))) {
3808 + p->dl.dl_boosted = 1;
3809 + queue_flag |= ENQUEUE_REPLENISH;
3810 + } else
3811 +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
3812 +index 08bdee0480b3..4cb00538a207 100644
3813 +--- a/kernel/sched/deadline.c
3814 ++++ b/kernel/sched/deadline.c
3815 +@@ -2693,6 +2693,7 @@ void __dl_clear_params(struct task_struct *p)
3816 + dl_se->dl_bw = 0;
3817 + dl_se->dl_density = 0;
3818 +
3819 ++ dl_se->dl_boosted = 0;
3820 + dl_se->dl_throttled = 0;
3821 + dl_se->dl_yielded = 0;
3822 + dl_se->dl_non_contending = 0;
3823 +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
3824 +index a677aa84ccb6..eaee960153e1 100644
3825 +--- a/kernel/trace/blktrace.c
3826 ++++ b/kernel/trace/blktrace.c
3827 +@@ -3,6 +3,9 @@
3828 + * Copyright (C) 2006 Jens Axboe <axboe@××××××.dk>
3829 + *
3830 + */
3831 ++
3832 ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3833 ++
3834 + #include <linux/kernel.h>
3835 + #include <linux/blkdev.h>
3836 + #include <linux/blktrace_api.h>
3837 +@@ -495,6 +498,16 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
3838 + */
3839 + strreplace(buts->name, '/', '_');
3840 +
3841 ++ /*
3842 ++ * bdev can be NULL, as with scsi-generic, this is a helpful as
3843 ++ * we can be.
3844 ++ */
3845 ++ if (q->blk_trace) {
3846 ++ pr_warn("Concurrent blktraces are not allowed on %s\n",
3847 ++ buts->name);
3848 ++ return -EBUSY;
3849 ++ }
3850 ++
3851 + bt = kzalloc(sizeof(*bt), GFP_KERNEL);
3852 + if (!bt)
3853 + return -ENOMEM;
3854 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
3855 +index 4bf050fcfe3b..9a2581fe7ed5 100644
3856 +--- a/kernel/trace/ring_buffer.c
3857 ++++ b/kernel/trace/ring_buffer.c
3858 +@@ -2358,7 +2358,7 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer,
3859 + if (unlikely(info->add_timestamp)) {
3860 + bool abs = ring_buffer_time_stamp_abs(cpu_buffer->buffer);
3861 +
3862 +- event = rb_add_time_stamp(event, info->delta, abs);
3863 ++ event = rb_add_time_stamp(event, abs ? info->delta : delta, abs);
3864 + length -= RB_LEN_TIME_EXTEND;
3865 + delta = 0;
3866 + }
3867 +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
3868 +index de840de87a18..e913d41a4194 100644
3869 +--- a/kernel/trace/trace_events_trigger.c
3870 ++++ b/kernel/trace/trace_events_trigger.c
3871 +@@ -216,11 +216,17 @@ static int event_trigger_regex_open(struct inode *inode, struct file *file)
3872 +
3873 + static int trigger_process_regex(struct trace_event_file *file, char *buff)
3874 + {
3875 +- char *command, *next = buff;
3876 ++ char *command, *next;
3877 + struct event_command *p;
3878 + int ret = -EINVAL;
3879 +
3880 ++ next = buff = skip_spaces(buff);
3881 + command = strsep(&next, ": \t");
3882 ++ if (next) {
3883 ++ next = skip_spaces(next);
3884 ++ if (!*next)
3885 ++ next = NULL;
3886 ++ }
3887 + command = (command[0] != '!') ? command : command + 1;
3888 +
3889 + mutex_lock(&trigger_cmd_mutex);
3890 +@@ -630,8 +636,14 @@ event_trigger_callback(struct event_command *cmd_ops,
3891 + int ret;
3892 +
3893 + /* separate the trigger from the filter (t:n [if filter]) */
3894 +- if (param && isdigit(param[0]))
3895 ++ if (param && isdigit(param[0])) {
3896 + trigger = strsep(&param, " \t");
3897 ++ if (param) {
3898 ++ param = skip_spaces(param);
3899 ++ if (!*param)
3900 ++ param = NULL;
3901 ++ }
3902 ++ }
3903 +
3904 + trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
3905 +
3906 +@@ -1368,6 +1380,11 @@ int event_enable_trigger_func(struct event_command *cmd_ops,
3907 + trigger = strsep(&param, " \t");
3908 + if (!trigger)
3909 + return -EINVAL;
3910 ++ if (param) {
3911 ++ param = skip_spaces(param);
3912 ++ if (!*param)
3913 ++ param = NULL;
3914 ++ }
3915 +
3916 + system = strsep(&trigger, ":");
3917 + if (!trigger)
3918 +diff --git a/lib/test_objagg.c b/lib/test_objagg.c
3919 +index 72c1abfa154d..da137939a410 100644
3920 +--- a/lib/test_objagg.c
3921 ++++ b/lib/test_objagg.c
3922 +@@ -979,10 +979,10 @@ err_check_expect_stats2:
3923 + err_world2_obj_get:
3924 + for (i--; i >= 0; i--)
3925 + world_obj_put(&world2, objagg, hints_case->key_ids[i]);
3926 +- objagg_hints_put(hints);
3927 +- objagg_destroy(objagg2);
3928 + i = hints_case->key_ids_count;
3929 ++ objagg_destroy(objagg2);
3930 + err_check_expect_hints_stats:
3931 ++ objagg_hints_put(hints);
3932 + err_hints_get:
3933 + err_check_expect_stats:
3934 + err_world_obj_get:
3935 +diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3936 +index 0d6f3ea86738..a3f4c35bb5fa 100644
3937 +--- a/mm/memcontrol.c
3938 ++++ b/mm/memcontrol.c
3939 +@@ -2895,8 +2895,10 @@ static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
3940 + return;
3941 +
3942 + cw = kmalloc(sizeof(*cw), GFP_NOWAIT | __GFP_NOWARN);
3943 +- if (!cw)
3944 ++ if (!cw) {
3945 ++ css_put(&memcg->css);
3946 + return;
3947 ++ }
3948 +
3949 + cw->memcg = memcg;
3950 + cw->cachep = cachep;
3951 +diff --git a/mm/slab_common.c b/mm/slab_common.c
3952 +index ade6c257d4b4..8c1ffbf7de45 100644
3953 +--- a/mm/slab_common.c
3954 ++++ b/mm/slab_common.c
3955 +@@ -1740,7 +1740,7 @@ void kzfree(const void *p)
3956 + if (unlikely(ZERO_OR_NULL_PTR(mem)))
3957 + return;
3958 + ks = ksize(mem);
3959 +- memset(mem, 0, ks);
3960 ++ memzero_explicit(mem, ks);
3961 + kfree(mem);
3962 + }
3963 + EXPORT_SYMBOL(kzfree);
3964 +diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
3965 +index ce2ab14ee605..cecb4223440e 100644
3966 +--- a/net/bridge/br_private.h
3967 ++++ b/net/bridge/br_private.h
3968 +@@ -208,8 +208,8 @@ struct net_bridge_port_group {
3969 + struct rcu_head rcu;
3970 + struct timer_list timer;
3971 + struct br_ip addr;
3972 ++ unsigned char eth_addr[ETH_ALEN] __aligned(2);
3973 + unsigned char flags;
3974 +- unsigned char eth_addr[ETH_ALEN];
3975 + };
3976 +
3977 + struct net_bridge_mdb_entry {
3978 +diff --git a/net/core/dev.c b/net/core/dev.c
3979 +index 204d87e7c9b1..727965565d31 100644
3980 +--- a/net/core/dev.c
3981 ++++ b/net/core/dev.c
3982 +@@ -3832,10 +3832,12 @@ int dev_direct_xmit(struct sk_buff *skb, u16 queue_id)
3983 +
3984 + local_bh_disable();
3985 +
3986 ++ dev_xmit_recursion_inc();
3987 + HARD_TX_LOCK(dev, txq, smp_processor_id());
3988 + if (!netif_xmit_frozen_or_drv_stopped(txq))
3989 + ret = netdev_start_xmit(skb, dev, txq, false);
3990 + HARD_TX_UNLOCK(dev, txq);
3991 ++ dev_xmit_recursion_dec();
3992 +
3993 + local_bh_enable();
3994 +
3995 +@@ -9114,6 +9116,13 @@ int register_netdevice(struct net_device *dev)
3996 + rcu_barrier();
3997 +
3998 + dev->reg_state = NETREG_UNREGISTERED;
3999 ++ /* We should put the kobject that hold in
4000 ++ * netdev_unregister_kobject(), otherwise
4001 ++ * the net device cannot be freed when
4002 ++ * driver calls free_netdev(), because the
4003 ++ * kobject is being hold.
4004 ++ */
4005 ++ kobject_put(&dev->dev.kobj);
4006 + }
4007 + /*
4008 + * Prevent userspace races by waiting until the network
4009 +diff --git a/net/core/sock.c b/net/core/sock.c
4010 +index 0adf7a9e5a90..078791a6649a 100644
4011 +--- a/net/core/sock.c
4012 ++++ b/net/core/sock.c
4013 +@@ -709,7 +709,7 @@ bool sk_mc_loop(struct sock *sk)
4014 + return inet6_sk(sk)->mc_loop;
4015 + #endif
4016 + }
4017 +- WARN_ON(1);
4018 ++ WARN_ON_ONCE(1);
4019 + return true;
4020 + }
4021 + EXPORT_SYMBOL(sk_mc_loop);
4022 +@@ -1679,6 +1679,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
4023 + cgroup_sk_alloc(&sk->sk_cgrp_data);
4024 + sock_update_classid(&sk->sk_cgrp_data);
4025 + sock_update_netprioidx(&sk->sk_cgrp_data);
4026 ++ sk_tx_queue_clear(sk);
4027 + }
4028 +
4029 + return sk;
4030 +@@ -1895,6 +1896,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
4031 + */
4032 + sk_refcnt_debug_inc(newsk);
4033 + sk_set_socket(newsk, NULL);
4034 ++ sk_tx_queue_clear(newsk);
4035 + RCU_INIT_POINTER(newsk->sk_wq, NULL);
4036 +
4037 + if (newsk->sk_prot->sockets_allocated)
4038 +diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
4039 +index 01588eef0cee..b1b3220917ca 100644
4040 +--- a/net/ipv4/fib_semantics.c
4041 ++++ b/net/ipv4/fib_semantics.c
4042 +@@ -1100,7 +1100,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,
4043 + if (fl4.flowi4_scope < RT_SCOPE_LINK)
4044 + fl4.flowi4_scope = RT_SCOPE_LINK;
4045 +
4046 +- if (table)
4047 ++ if (table && table != RT_TABLE_MAIN)
4048 + tbl = fib_get_table(net, table);
4049 +
4050 + if (tbl)
4051 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
4052 +index cd4b84310d92..a0b4dc54f8a6 100644
4053 +--- a/net/ipv4/ip_tunnel.c
4054 ++++ b/net/ipv4/ip_tunnel.c
4055 +@@ -85,9 +85,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
4056 + __be32 remote, __be32 local,
4057 + __be32 key)
4058 + {
4059 +- unsigned int hash;
4060 + struct ip_tunnel *t, *cand = NULL;
4061 + struct hlist_head *head;
4062 ++ struct net_device *ndev;
4063 ++ unsigned int hash;
4064 +
4065 + hash = ip_tunnel_hash(key, remote);
4066 + head = &itn->tunnels[hash];
4067 +@@ -162,8 +163,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
4068 + if (t && t->dev->flags & IFF_UP)
4069 + return t;
4070 +
4071 +- if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP)
4072 +- return netdev_priv(itn->fb_tunnel_dev);
4073 ++ ndev = READ_ONCE(itn->fb_tunnel_dev);
4074 ++ if (ndev && ndev->flags & IFF_UP)
4075 ++ return netdev_priv(ndev);
4076 +
4077 + return NULL;
4078 + }
4079 +@@ -1245,9 +1247,9 @@ void ip_tunnel_uninit(struct net_device *dev)
4080 + struct ip_tunnel_net *itn;
4081 +
4082 + itn = net_generic(net, tunnel->ip_tnl_net_id);
4083 +- /* fb_tunnel_dev will be unregisted in net-exit call. */
4084 +- if (itn->fb_tunnel_dev != dev)
4085 +- ip_tunnel_del(itn, netdev_priv(dev));
4086 ++ ip_tunnel_del(itn, netdev_priv(dev));
4087 ++ if (itn->fb_tunnel_dev == dev)
4088 ++ WRITE_ONCE(itn->fb_tunnel_dev, NULL);
4089 +
4090 + dst_cache_reset(&tunnel->dst_cache);
4091 + }
4092 +diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
4093 +index 1b3d032a4df2..ee6c38a73325 100644
4094 +--- a/net/ipv4/tcp_cubic.c
4095 ++++ b/net/ipv4/tcp_cubic.c
4096 +@@ -404,6 +404,8 @@ static void hystart_update(struct sock *sk, u32 delay)
4097 +
4098 + if (hystart_detect & HYSTART_DELAY) {
4099 + /* obtain the minimum delay of more than sampling packets */
4100 ++ if (ca->curr_rtt > delay)
4101 ++ ca->curr_rtt = delay;
4102 + if (ca->sample_cnt < HYSTART_MIN_SAMPLES) {
4103 + if (ca->curr_rtt == 0 || ca->curr_rtt > delay)
4104 + ca->curr_rtt = delay;
4105 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
4106 +index 677facbeed26..3e63dc9c3eba 100644
4107 +--- a/net/ipv4/tcp_input.c
4108 ++++ b/net/ipv4/tcp_input.c
4109 +@@ -260,7 +260,8 @@ static void tcp_ecn_accept_cwr(struct sock *sk, const struct sk_buff *skb)
4110 + * cwnd may be very low (even just 1 packet), so we should ACK
4111 + * immediately.
4112 + */
4113 +- inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW;
4114 ++ if (TCP_SKB_CB(skb)->seq != TCP_SKB_CB(skb)->end_seq)
4115 ++ inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW;
4116 + }
4117 + }
4118 +
4119 +@@ -3682,6 +3683,15 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
4120 + tcp_in_ack_event(sk, ack_ev_flags);
4121 + }
4122 +
4123 ++ /* This is a deviation from RFC3168 since it states that:
4124 ++ * "When the TCP data sender is ready to set the CWR bit after reducing
4125 ++ * the congestion window, it SHOULD set the CWR bit only on the first
4126 ++ * new data packet that it transmits."
4127 ++ * We accept CWR on pure ACKs to be more robust
4128 ++ * with widely-deployed TCP implementations that do this.
4129 ++ */
4130 ++ tcp_ecn_accept_cwr(sk, skb);
4131 ++
4132 + /* We passed data and got it acked, remove any soft error
4133 + * log. Something worked...
4134 + */
4135 +@@ -4587,7 +4597,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
4136 + if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb,
4137 + skb, &fragstolen)) {
4138 + coalesce_done:
4139 +- tcp_grow_window(sk, skb);
4140 ++ /* For non sack flows, do not grow window to force DUPACK
4141 ++ * and trigger fast retransmit.
4142 ++ */
4143 ++ if (tcp_is_sack(tp))
4144 ++ tcp_grow_window(sk, skb);
4145 + kfree_skb_partial(skb, fragstolen);
4146 + skb = NULL;
4147 + goto add_sack;
4148 +@@ -4671,7 +4685,11 @@ add_sack:
4149 + tcp_sack_new_ofo_skb(sk, seq, end_seq);
4150 + end:
4151 + if (skb) {
4152 +- tcp_grow_window(sk, skb);
4153 ++ /* For non sack flows, do not grow window to force DUPACK
4154 ++ * and trigger fast retransmit.
4155 ++ */
4156 ++ if (tcp_is_sack(tp))
4157 ++ tcp_grow_window(sk, skb);
4158 + skb_condense(skb);
4159 + skb_set_owner_r(skb, sk);
4160 + }
4161 +@@ -4771,8 +4789,6 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
4162 + skb_dst_drop(skb);
4163 + __skb_pull(skb, tcp_hdr(skb)->doff * 4);
4164 +
4165 +- tcp_ecn_accept_cwr(sk, skb);
4166 +-
4167 + tp->rx_opt.dsack = 0;
4168 +
4169 + /* Queue data for delivery to the user.
4170 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
4171 +index 9ec05a1df5e1..04d76f043e18 100644
4172 +--- a/net/ipv6/ip6_gre.c
4173 ++++ b/net/ipv6/ip6_gre.c
4174 +@@ -127,6 +127,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
4175 + gre_proto == htons(ETH_P_ERSPAN2)) ?
4176 + ARPHRD_ETHER : ARPHRD_IP6GRE;
4177 + int score, cand_score = 4;
4178 ++ struct net_device *ndev;
4179 +
4180 + for_each_ip_tunnel_rcu(t, ign->tunnels_r_l[h0 ^ h1]) {
4181 + if (!ipv6_addr_equal(local, &t->parms.laddr) ||
4182 +@@ -238,9 +239,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
4183 + if (t && t->dev->flags & IFF_UP)
4184 + return t;
4185 +
4186 +- dev = ign->fb_tunnel_dev;
4187 +- if (dev && dev->flags & IFF_UP)
4188 +- return netdev_priv(dev);
4189 ++ ndev = READ_ONCE(ign->fb_tunnel_dev);
4190 ++ if (ndev && ndev->flags & IFF_UP)
4191 ++ return netdev_priv(ndev);
4192 +
4193 + return NULL;
4194 + }
4195 +@@ -413,6 +414,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)
4196 +
4197 + ip6gre_tunnel_unlink_md(ign, t);
4198 + ip6gre_tunnel_unlink(ign, t);
4199 ++ if (ign->fb_tunnel_dev == dev)
4200 ++ WRITE_ONCE(ign->fb_tunnel_dev, NULL);
4201 + dst_cache_reset(&t->dst_cache);
4202 + dev_put(dev);
4203 + }
4204 +diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
4205 +index eaa4c2cc2fbb..c875c9b6edbe 100644
4206 +--- a/net/ipv6/mcast.c
4207 ++++ b/net/ipv6/mcast.c
4208 +@@ -2618,6 +2618,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev)
4209 + idev->mc_list = i->next;
4210 +
4211 + write_unlock_bh(&idev->lock);
4212 ++ ip6_mc_clear_src(i);
4213 + ma_put(i);
4214 + write_lock_bh(&idev->lock);
4215 + }
4216 +diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
4217 +index 75da200aa5d8..133a3f1b6f56 100644
4218 +--- a/net/netfilter/ipset/ip_set_core.c
4219 ++++ b/net/netfilter/ipset/ip_set_core.c
4220 +@@ -382,6 +382,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len,
4221 + for (id = 0; id < IPSET_EXT_ID_MAX; id++) {
4222 + if (!add_extension(id, cadt_flags, tb))
4223 + continue;
4224 ++ if (align < ip_set_extensions[id].align)
4225 ++ align = ip_set_extensions[id].align;
4226 + len = ALIGN(len, ip_set_extensions[id].align);
4227 + set->offset[id] = len;
4228 + set->extensions |= ip_set_extensions[id].type;
4229 +diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
4230 +index 99352f09deaa..3d96dab10449 100644
4231 +--- a/net/openvswitch/actions.c
4232 ++++ b/net/openvswitch/actions.c
4233 +@@ -1146,9 +1146,10 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb,
4234 + struct sw_flow_key *key,
4235 + const struct nlattr *attr, bool last)
4236 + {
4237 ++ struct ovs_skb_cb *ovs_cb = OVS_CB(skb);
4238 + const struct nlattr *actions, *cpl_arg;
4239 ++ int len, max_len, rem = nla_len(attr);
4240 + const struct check_pkt_len_arg *arg;
4241 +- int rem = nla_len(attr);
4242 + bool clone_flow_key;
4243 +
4244 + /* The first netlink attribute in 'attr' is always
4245 +@@ -1157,7 +1158,11 @@ static int execute_check_pkt_len(struct datapath *dp, struct sk_buff *skb,
4246 + cpl_arg = nla_data(attr);
4247 + arg = nla_data(cpl_arg);
4248 +
4249 +- if (skb->len <= arg->pkt_len) {
4250 ++ len = ovs_cb->mru ? ovs_cb->mru + skb->mac_len : skb->len;
4251 ++ max_len = arg->pkt_len;
4252 ++
4253 ++ if ((skb_is_gso(skb) && skb_gso_validate_mac_len(skb, max_len)) ||
4254 ++ len <= max_len) {
4255 + /* Second netlink attribute in 'attr' is always
4256 + * 'OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL'.
4257 + */
4258 +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
4259 +index b7611cc159e5..032ed76c0166 100644
4260 +--- a/net/rxrpc/call_accept.c
4261 ++++ b/net/rxrpc/call_accept.c
4262 +@@ -22,6 +22,11 @@
4263 + #include <net/ip.h>
4264 + #include "ar-internal.h"
4265 +
4266 ++static void rxrpc_dummy_notify(struct sock *sk, struct rxrpc_call *call,
4267 ++ unsigned long user_call_ID)
4268 ++{
4269 ++}
4270 ++
4271 + /*
4272 + * Preallocate a single service call, connection and peer and, if possible,
4273 + * give them a user ID and attach the user's side of the ID to them.
4274 +@@ -228,6 +233,8 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)
4275 + if (rx->discard_new_call) {
4276 + _debug("discard %lx", call->user_call_ID);
4277 + rx->discard_new_call(call, call->user_call_ID);
4278 ++ if (call->notify_rx)
4279 ++ call->notify_rx = rxrpc_dummy_notify;
4280 + rxrpc_put_call(call, rxrpc_call_put_kernel);
4281 + }
4282 + rxrpc_call_completed(call);
4283 +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
4284 +index 3be4177baf70..22dec6049e1b 100644
4285 +--- a/net/rxrpc/input.c
4286 ++++ b/net/rxrpc/input.c
4287 +@@ -723,13 +723,12 @@ static void rxrpc_input_ackinfo(struct rxrpc_call *call, struct sk_buff *skb,
4288 + ntohl(ackinfo->rxMTU), ntohl(ackinfo->maxMTU),
4289 + rwind, ntohl(ackinfo->jumbo_max));
4290 +
4291 ++ if (rwind > RXRPC_RXTX_BUFF_SIZE - 1)
4292 ++ rwind = RXRPC_RXTX_BUFF_SIZE - 1;
4293 + if (call->tx_winsize != rwind) {
4294 +- if (rwind > RXRPC_RXTX_BUFF_SIZE - 1)
4295 +- rwind = RXRPC_RXTX_BUFF_SIZE - 1;
4296 + if (rwind > call->tx_winsize)
4297 + wake = true;
4298 +- trace_rxrpc_rx_rwind_change(call, sp->hdr.serial,
4299 +- ntohl(ackinfo->rwind), wake);
4300 ++ trace_rxrpc_rx_rwind_change(call, sp->hdr.serial, rwind, wake);
4301 + call->tx_winsize = rwind;
4302 + }
4303 +
4304 +diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
4305 +index 2277369feae5..5d605bab9afc 100644
4306 +--- a/net/sched/sch_cake.c
4307 ++++ b/net/sched/sch_cake.c
4308 +@@ -1515,32 +1515,51 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
4309 + return idx + (tin << 16);
4310 + }
4311 +
4312 +-static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash)
4313 ++static u8 cake_handle_diffserv(struct sk_buff *skb, bool wash)
4314 + {
4315 +- int wlen = skb_network_offset(skb);
4316 ++ const int offset = skb_network_offset(skb);
4317 ++ u16 *buf, buf_;
4318 + u8 dscp;
4319 +
4320 + switch (tc_skb_protocol(skb)) {
4321 + case htons(ETH_P_IP):
4322 +- wlen += sizeof(struct iphdr);
4323 +- if (!pskb_may_pull(skb, wlen) ||
4324 +- skb_try_make_writable(skb, wlen))
4325 ++ buf = skb_header_pointer(skb, offset, sizeof(buf_), &buf_);
4326 ++ if (unlikely(!buf))
4327 + return 0;
4328 +
4329 +- dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2;
4330 +- if (wash && dscp)
4331 ++ /* ToS is in the second byte of iphdr */
4332 ++ dscp = ipv4_get_dsfield((struct iphdr *)buf) >> 2;
4333 ++
4334 ++ if (wash && dscp) {
4335 ++ const int wlen = offset + sizeof(struct iphdr);
4336 ++
4337 ++ if (!pskb_may_pull(skb, wlen) ||
4338 ++ skb_try_make_writable(skb, wlen))
4339 ++ return 0;
4340 ++
4341 + ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, 0);
4342 ++ }
4343 ++
4344 + return dscp;
4345 +
4346 + case htons(ETH_P_IPV6):
4347 +- wlen += sizeof(struct ipv6hdr);
4348 +- if (!pskb_may_pull(skb, wlen) ||
4349 +- skb_try_make_writable(skb, wlen))
4350 ++ buf = skb_header_pointer(skb, offset, sizeof(buf_), &buf_);
4351 ++ if (unlikely(!buf))
4352 + return 0;
4353 +
4354 +- dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
4355 +- if (wash && dscp)
4356 ++ /* Traffic class is in the first and second bytes of ipv6hdr */
4357 ++ dscp = ipv6_get_dsfield((struct ipv6hdr *)buf) >> 2;
4358 ++
4359 ++ if (wash && dscp) {
4360 ++ const int wlen = offset + sizeof(struct ipv6hdr);
4361 ++
4362 ++ if (!pskb_may_pull(skb, wlen) ||
4363 ++ skb_try_make_writable(skb, wlen))
4364 ++ return 0;
4365 ++
4366 + ipv6_change_dsfield(ipv6_hdr(skb), INET_ECN_MASK, 0);
4367 ++ }
4368 ++
4369 + return dscp;
4370 +
4371 + case htons(ETH_P_ARP):
4372 +@@ -1557,14 +1576,17 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch,
4373 + {
4374 + struct cake_sched_data *q = qdisc_priv(sch);
4375 + u32 tin, mark;
4376 ++ bool wash;
4377 + u8 dscp;
4378 +
4379 + /* Tin selection: Default to diffserv-based selection, allow overriding
4380 +- * using firewall marks or skb->priority.
4381 ++ * using firewall marks or skb->priority. Call DSCP parsing early if
4382 ++ * wash is enabled, otherwise defer to below to skip unneeded parsing.
4383 + */
4384 +- dscp = cake_handle_diffserv(skb,
4385 +- q->rate_flags & CAKE_FLAG_WASH);
4386 + mark = (skb->mark & q->fwmark_mask) >> q->fwmark_shft;
4387 ++ wash = !!(q->rate_flags & CAKE_FLAG_WASH);
4388 ++ if (wash)
4389 ++ dscp = cake_handle_diffserv(skb, wash);
4390 +
4391 + if (q->tin_mode == CAKE_DIFFSERV_BESTEFFORT)
4392 + tin = 0;
4393 +@@ -1578,6 +1600,8 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch,
4394 + tin = q->tin_order[TC_H_MIN(skb->priority) - 1];
4395 +
4396 + else {
4397 ++ if (!wash)
4398 ++ dscp = cake_handle_diffserv(skb, wash);
4399 + tin = q->tin_index[dscp];
4400 +
4401 + if (unlikely(tin >= q->tin_cnt))
4402 +@@ -2679,7 +2703,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt,
4403 + qdisc_watchdog_init(&q->watchdog, sch);
4404 +
4405 + if (opt) {
4406 +- int err = cake_change(sch, opt, extack);
4407 ++ err = cake_change(sch, opt, extack);
4408 +
4409 + if (err)
4410 + return err;
4411 +@@ -2996,7 +3020,7 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,
4412 + PUT_STAT_S32(BLUE_TIMER_US,
4413 + ktime_to_us(
4414 + ktime_sub(now,
4415 +- flow->cvars.blue_timer)));
4416 ++ flow->cvars.blue_timer)));
4417 + }
4418 + if (flow->cvars.dropping) {
4419 + PUT_STAT_S32(DROP_NEXT_US,
4420 +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
4421 +index 7c3c5fdb82a9..896c9037155a 100644
4422 +--- a/net/sched/sch_generic.c
4423 ++++ b/net/sched/sch_generic.c
4424 +@@ -469,6 +469,7 @@ void __netdev_watchdog_up(struct net_device *dev)
4425 + dev_hold(dev);
4426 + }
4427 + }
4428 ++EXPORT_SYMBOL_GPL(__netdev_watchdog_up);
4429 +
4430 + static void dev_watchdog_up(struct net_device *dev)
4431 + {
4432 +diff --git a/net/sctp/associola.c b/net/sctp/associola.c
4433 +index 41839b85c268..fb6f62264e87 100644
4434 +--- a/net/sctp/associola.c
4435 ++++ b/net/sctp/associola.c
4436 +@@ -1569,12 +1569,15 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
4437 + int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
4438 + enum sctp_scope scope, gfp_t gfp)
4439 + {
4440 ++ struct sock *sk = asoc->base.sk;
4441 + int flags;
4442 +
4443 + /* Use scoping rules to determine the subset of addresses from
4444 + * the endpoint.
4445 + */
4446 +- flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
4447 ++ flags = (PF_INET6 == sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
4448 ++ if (!inet_v6_ipv6only(sk))
4449 ++ flags |= SCTP_ADDR4_ALLOWED;
4450 + if (asoc->peer.ipv4_address)
4451 + flags |= SCTP_ADDR4_PEERSUPP;
4452 + if (asoc->peer.ipv6_address)
4453 +diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
4454 +index 53bc61537f44..701c5a4e441d 100644
4455 +--- a/net/sctp/bind_addr.c
4456 ++++ b/net/sctp/bind_addr.c
4457 +@@ -461,6 +461,7 @@ static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,
4458 + * well as the remote peer.
4459 + */
4460 + if ((((AF_INET == addr->sa.sa_family) &&
4461 ++ (flags & SCTP_ADDR4_ALLOWED) &&
4462 + (flags & SCTP_ADDR4_PEERSUPP))) ||
4463 + (((AF_INET6 == addr->sa.sa_family) &&
4464 + (flags & SCTP_ADDR6_ALLOWED) &&
4465 +diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
4466 +index 237c88eeb538..981c7cbca46a 100644
4467 +--- a/net/sctp/protocol.c
4468 ++++ b/net/sctp/protocol.c
4469 +@@ -148,7 +148,8 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp,
4470 + * sock as well as the remote peer.
4471 + */
4472 + if (addr->a.sa.sa_family == AF_INET &&
4473 +- !(copy_flags & SCTP_ADDR4_PEERSUPP))
4474 ++ (!(copy_flags & SCTP_ADDR4_ALLOWED) ||
4475 ++ !(copy_flags & SCTP_ADDR4_PEERSUPP)))
4476 + continue;
4477 + if (addr->a.sa.sa_family == AF_INET6 &&
4478 + (!(copy_flags & SCTP_ADDR6_ALLOWED) ||
4479 +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
4480 +index b71a39ded930..37792675ed57 100644
4481 +--- a/net/sunrpc/rpc_pipe.c
4482 ++++ b/net/sunrpc/rpc_pipe.c
4483 +@@ -1317,6 +1317,7 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
4484 + q.len = strlen(gssd_dummy_clnt_dir[0].name);
4485 + clnt_dentry = d_hash_and_lookup(gssd_dentry, &q);
4486 + if (!clnt_dentry) {
4487 ++ __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
4488 + pipe_dentry = ERR_PTR(-ENOENT);
4489 + goto out;
4490 + }
4491 +diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
4492 +index 451ca7ec321c..7ef37054071f 100644
4493 +--- a/net/sunrpc/xdr.c
4494 ++++ b/net/sunrpc/xdr.c
4495 +@@ -1118,6 +1118,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
4496 + base = 0;
4497 + } else {
4498 + base -= buf->head[0].iov_len;
4499 ++ subbuf->head[0].iov_base = buf->head[0].iov_base;
4500 + subbuf->head[0].iov_len = 0;
4501 + }
4502 +
4503 +@@ -1130,6 +1131,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
4504 + base = 0;
4505 + } else {
4506 + base -= buf->page_len;
4507 ++ subbuf->pages = buf->pages;
4508 ++ subbuf->page_base = 0;
4509 + subbuf->page_len = 0;
4510 + }
4511 +
4512 +@@ -1141,6 +1144,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
4513 + base = 0;
4514 + } else {
4515 + base -= buf->tail[0].iov_len;
4516 ++ subbuf->tail[0].iov_base = buf->tail[0].iov_base;
4517 + subbuf->tail[0].iov_len = 0;
4518 + }
4519 +
4520 +diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
4521 +index ef5102b60589..c56e6cfc4a62 100644
4522 +--- a/net/sunrpc/xprtrdma/rpc_rdma.c
4523 ++++ b/net/sunrpc/xprtrdma/rpc_rdma.c
4524 +@@ -1246,8 +1246,7 @@ rpcrdma_decode_error(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,
4525 + be32_to_cpup(p), be32_to_cpu(rep->rr_xid));
4526 + }
4527 +
4528 +- r_xprt->rx_stats.bad_reply_count++;
4529 +- return -EREMOTEIO;
4530 ++ return -EIO;
4531 + }
4532 +
4533 + /* Perform XID lookup, reconstruction of the RPC reply, and
4534 +@@ -1284,13 +1283,11 @@ out:
4535 + spin_unlock(&xprt->queue_lock);
4536 + return;
4537 +
4538 +-/* If the incoming reply terminated a pending RPC, the next
4539 +- * RPC call will post a replacement receive buffer as it is
4540 +- * being marshaled.
4541 +- */
4542 + out_badheader:
4543 + trace_xprtrdma_reply_hdr(rep);
4544 + r_xprt->rx_stats.bad_reply_count++;
4545 ++ rqst->rq_task->tk_status = status;
4546 ++ status = 0;
4547 + goto out;
4548 + }
4549 +
4550 +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
4551 +index c365b918be35..bb2292b5260c 100644
4552 +--- a/net/xfrm/xfrm_device.c
4553 ++++ b/net/xfrm/xfrm_device.c
4554 +@@ -82,7 +82,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
4555 + struct xfrm_offload *xo = xfrm_offload(skb);
4556 + struct sec_path *sp;
4557 +
4558 +- if (!xo)
4559 ++ if (!xo || (xo->flags & XFRM_XMIT))
4560 + return skb;
4561 +
4562 + if (!(features & NETIF_F_HW_ESP))
4563 +@@ -103,6 +103,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
4564 + return skb;
4565 + }
4566 +
4567 ++ xo->flags |= XFRM_XMIT;
4568 ++
4569 + if (skb_is_gso(skb)) {
4570 + struct net_device *dev = skb->dev;
4571 +
4572 +diff --git a/samples/bpf/xdp_monitor_user.c b/samples/bpf/xdp_monitor_user.c
4573 +index dd558cbb2309..ef53b93db573 100644
4574 +--- a/samples/bpf/xdp_monitor_user.c
4575 ++++ b/samples/bpf/xdp_monitor_user.c
4576 +@@ -509,11 +509,8 @@ static void *alloc_rec_per_cpu(int record_size)
4577 + {
4578 + unsigned int nr_cpus = bpf_num_possible_cpus();
4579 + void *array;
4580 +- size_t size;
4581 +
4582 +- size = record_size * nr_cpus;
4583 +- array = malloc(size);
4584 +- memset(array, 0, size);
4585 ++ array = calloc(nr_cpus, record_size);
4586 + if (!array) {
4587 + fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
4588 + exit(EXIT_FAIL_MEM);
4589 +@@ -528,8 +525,7 @@ static struct stats_record *alloc_stats_record(void)
4590 + int i;
4591 +
4592 + /* Alloc main stats_record structure */
4593 +- rec = malloc(sizeof(*rec));
4594 +- memset(rec, 0, sizeof(*rec));
4595 ++ rec = calloc(1, sizeof(*rec));
4596 + if (!rec) {
4597 + fprintf(stderr, "Mem alloc error\n");
4598 + exit(EXIT_FAIL_MEM);
4599 +diff --git a/samples/bpf/xdp_redirect_cpu_kern.c b/samples/bpf/xdp_redirect_cpu_kern.c
4600 +index cfcc31e51197..d94a999b4b4b 100644
4601 +--- a/samples/bpf/xdp_redirect_cpu_kern.c
4602 ++++ b/samples/bpf/xdp_redirect_cpu_kern.c
4603 +@@ -15,7 +15,7 @@
4604 + #include "bpf_helpers.h"
4605 + #include "hash_func01.h"
4606 +
4607 +-#define MAX_CPUS 64 /* WARNING - sync with _user.c */
4608 ++#define MAX_CPUS NR_CPUS
4609 +
4610 + /* Special map type that can XDP_REDIRECT frames to another CPU */
4611 + struct {
4612 +diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
4613 +index 8b862a7a6c6a..0a7672556822 100644
4614 +--- a/samples/bpf/xdp_redirect_cpu_user.c
4615 ++++ b/samples/bpf/xdp_redirect_cpu_user.c
4616 +@@ -13,6 +13,7 @@ static const char *__doc__ =
4617 + #include <unistd.h>
4618 + #include <locale.h>
4619 + #include <sys/resource.h>
4620 ++#include <sys/sysinfo.h>
4621 + #include <getopt.h>
4622 + #include <net/if.h>
4623 + #include <time.h>
4624 +@@ -24,8 +25,6 @@ static const char *__doc__ =
4625 + #include <arpa/inet.h>
4626 + #include <linux/if_link.h>
4627 +
4628 +-#define MAX_CPUS 64 /* WARNING - sync with _kern.c */
4629 +-
4630 + /* How many xdp_progs are defined in _kern.c */
4631 + #define MAX_PROG 6
4632 +
4633 +@@ -40,6 +39,7 @@ static char *ifname;
4634 + static __u32 prog_id;
4635 +
4636 + static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
4637 ++static int n_cpus;
4638 + static int cpu_map_fd;
4639 + static int rx_cnt_map_fd;
4640 + static int redirect_err_cnt_map_fd;
4641 +@@ -170,7 +170,7 @@ struct stats_record {
4642 + struct record redir_err;
4643 + struct record kthread;
4644 + struct record exception;
4645 +- struct record enq[MAX_CPUS];
4646 ++ struct record enq[];
4647 + };
4648 +
4649 + static bool map_collect_percpu(int fd, __u32 key, struct record *rec)
4650 +@@ -210,11 +210,8 @@ static struct datarec *alloc_record_per_cpu(void)
4651 + {
4652 + unsigned int nr_cpus = bpf_num_possible_cpus();
4653 + struct datarec *array;
4654 +- size_t size;
4655 +
4656 +- size = sizeof(struct datarec) * nr_cpus;
4657 +- array = malloc(size);
4658 +- memset(array, 0, size);
4659 ++ array = calloc(nr_cpus, sizeof(struct datarec));
4660 + if (!array) {
4661 + fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
4662 + exit(EXIT_FAIL_MEM);
4663 +@@ -225,19 +222,20 @@ static struct datarec *alloc_record_per_cpu(void)
4664 + static struct stats_record *alloc_stats_record(void)
4665 + {
4666 + struct stats_record *rec;
4667 +- int i;
4668 ++ int i, size;
4669 +
4670 +- rec = malloc(sizeof(*rec));
4671 +- memset(rec, 0, sizeof(*rec));
4672 ++ size = sizeof(*rec) + n_cpus * sizeof(struct record);
4673 ++ rec = malloc(size);
4674 + if (!rec) {
4675 + fprintf(stderr, "Mem alloc error\n");
4676 + exit(EXIT_FAIL_MEM);
4677 + }
4678 ++ memset(rec, 0, size);
4679 + rec->rx_cnt.cpu = alloc_record_per_cpu();
4680 + rec->redir_err.cpu = alloc_record_per_cpu();
4681 + rec->kthread.cpu = alloc_record_per_cpu();
4682 + rec->exception.cpu = alloc_record_per_cpu();
4683 +- for (i = 0; i < MAX_CPUS; i++)
4684 ++ for (i = 0; i < n_cpus; i++)
4685 + rec->enq[i].cpu = alloc_record_per_cpu();
4686 +
4687 + return rec;
4688 +@@ -247,7 +245,7 @@ static void free_stats_record(struct stats_record *r)
4689 + {
4690 + int i;
4691 +
4692 +- for (i = 0; i < MAX_CPUS; i++)
4693 ++ for (i = 0; i < n_cpus; i++)
4694 + free(r->enq[i].cpu);
4695 + free(r->exception.cpu);
4696 + free(r->kthread.cpu);
4697 +@@ -350,7 +348,7 @@ static void stats_print(struct stats_record *stats_rec,
4698 + }
4699 +
4700 + /* cpumap enqueue stats */
4701 +- for (to_cpu = 0; to_cpu < MAX_CPUS; to_cpu++) {
4702 ++ for (to_cpu = 0; to_cpu < n_cpus; to_cpu++) {
4703 + char *fmt = "%-15s %3d:%-3d %'-14.0f %'-11.0f %'-10.2f %s\n";
4704 + char *fm2 = "%-15s %3s:%-3d %'-14.0f %'-11.0f %'-10.2f %s\n";
4705 + char *errstr = "";
4706 +@@ -475,7 +473,7 @@ static void stats_collect(struct stats_record *rec)
4707 + map_collect_percpu(fd, 1, &rec->redir_err);
4708 +
4709 + fd = cpumap_enqueue_cnt_map_fd;
4710 +- for (i = 0; i < MAX_CPUS; i++)
4711 ++ for (i = 0; i < n_cpus; i++)
4712 + map_collect_percpu(fd, i, &rec->enq[i]);
4713 +
4714 + fd = cpumap_kthread_cnt_map_fd;
4715 +@@ -549,10 +547,10 @@ static int create_cpu_entry(__u32 cpu, __u32 queue_size,
4716 + */
4717 + static void mark_cpus_unavailable(void)
4718 + {
4719 +- __u32 invalid_cpu = MAX_CPUS;
4720 ++ __u32 invalid_cpu = n_cpus;
4721 + int ret, i;
4722 +
4723 +- for (i = 0; i < MAX_CPUS; i++) {
4724 ++ for (i = 0; i < n_cpus; i++) {
4725 + ret = bpf_map_update_elem(cpus_available_map_fd, &i,
4726 + &invalid_cpu, 0);
4727 + if (ret) {
4728 +@@ -688,6 +686,8 @@ int main(int argc, char **argv)
4729 + int prog_fd;
4730 + __u32 qsize;
4731 +
4732 ++ n_cpus = get_nprocs_conf();
4733 ++
4734 + /* Notice: choosing he queue size is very important with the
4735 + * ixgbe driver, because it's driver page recycling trick is
4736 + * dependend on pages being returned quickly. The number of
4737 +@@ -757,7 +757,7 @@ int main(int argc, char **argv)
4738 + case 'c':
4739 + /* Add multiple CPUs */
4740 + add_cpu = strtoul(optarg, NULL, 0);
4741 +- if (add_cpu >= MAX_CPUS) {
4742 ++ if (add_cpu >= n_cpus) {
4743 + fprintf(stderr,
4744 + "--cpu nr too large for cpumap err(%d):%s\n",
4745 + errno, strerror(errno));
4746 +diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
4747 +index b88df17853b8..21d6e5067a83 100644
4748 +--- a/samples/bpf/xdp_rxq_info_user.c
4749 ++++ b/samples/bpf/xdp_rxq_info_user.c
4750 +@@ -198,11 +198,8 @@ static struct datarec *alloc_record_per_cpu(void)
4751 + {
4752 + unsigned int nr_cpus = bpf_num_possible_cpus();
4753 + struct datarec *array;
4754 +- size_t size;
4755 +
4756 +- size = sizeof(struct datarec) * nr_cpus;
4757 +- array = malloc(size);
4758 +- memset(array, 0, size);
4759 ++ array = calloc(nr_cpus, sizeof(struct datarec));
4760 + if (!array) {
4761 + fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
4762 + exit(EXIT_FAIL_MEM);
4763 +@@ -214,11 +211,8 @@ static struct record *alloc_record_per_rxq(void)
4764 + {
4765 + unsigned int nr_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
4766 + struct record *array;
4767 +- size_t size;
4768 +
4769 +- size = sizeof(struct record) * nr_rxqs;
4770 +- array = malloc(size);
4771 +- memset(array, 0, size);
4772 ++ array = calloc(nr_rxqs, sizeof(struct record));
4773 + if (!array) {
4774 + fprintf(stderr, "Mem alloc error (nr_rxqs:%u)\n", nr_rxqs);
4775 + exit(EXIT_FAIL_MEM);
4776 +@@ -232,8 +226,7 @@ static struct stats_record *alloc_stats_record(void)
4777 + struct stats_record *rec;
4778 + int i;
4779 +
4780 +- rec = malloc(sizeof(*rec));
4781 +- memset(rec, 0, sizeof(*rec));
4782 ++ rec = calloc(1, sizeof(struct stats_record));
4783 + if (!rec) {
4784 + fprintf(stderr, "Mem alloc error\n");
4785 + exit(EXIT_FAIL_MEM);
4786 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
4787 +index d1dd4a6b6adb..7da10afc92c6 100644
4788 +--- a/scripts/Kbuild.include
4789 ++++ b/scripts/Kbuild.include
4790 +@@ -82,20 +82,21 @@ cc-cross-prefix = $(firstword $(foreach c, $(1), \
4791 + $(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
4792 +
4793 + # output directory for tests below
4794 +-TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
4795 ++TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
4796 +
4797 + # try-run
4798 + # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
4799 + # Exit code chooses option. "$$TMP" serves as a temporary file and is
4800 + # automatically cleaned up.
4801 + try-run = $(shell set -e; \
4802 +- TMP="$(TMPOUT).$$$$.tmp"; \
4803 +- TMPO="$(TMPOUT).$$$$.o"; \
4804 ++ TMP=$(TMPOUT)/tmp; \
4805 ++ TMPO=$(TMPOUT)/tmp.o; \
4806 ++ mkdir -p $(TMPOUT); \
4807 ++ trap "rm -rf $(TMPOUT)" EXIT; \
4808 + if ($(1)) >/dev/null 2>&1; \
4809 + then echo "$(2)"; \
4810 + else echo "$(3)"; \
4811 +- fi; \
4812 +- rm -f "$$TMP" "$$TMPO")
4813 ++ fi)
4814 +
4815 + # as-option
4816 + # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
4817 +diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
4818 +index 74eab03e31d4..f9b19524da11 100644
4819 +--- a/scripts/recordmcount.h
4820 ++++ b/scripts/recordmcount.h
4821 +@@ -29,6 +29,11 @@
4822 + #undef has_rel_mcount
4823 + #undef tot_relsize
4824 + #undef get_mcountsym
4825 ++#undef find_symtab
4826 ++#undef get_shnum
4827 ++#undef set_shnum
4828 ++#undef get_shstrndx
4829 ++#undef get_symindex
4830 + #undef get_sym_str_and_relp
4831 + #undef do_func
4832 + #undef Elf_Addr
4833 +@@ -58,6 +63,11 @@
4834 + # define __has_rel_mcount __has64_rel_mcount
4835 + # define has_rel_mcount has64_rel_mcount
4836 + # define tot_relsize tot64_relsize
4837 ++# define find_symtab find_symtab64
4838 ++# define get_shnum get_shnum64
4839 ++# define set_shnum set_shnum64
4840 ++# define get_shstrndx get_shstrndx64
4841 ++# define get_symindex get_symindex64
4842 + # define get_sym_str_and_relp get_sym_str_and_relp_64
4843 + # define do_func do64
4844 + # define get_mcountsym get_mcountsym_64
4845 +@@ -91,6 +101,11 @@
4846 + # define __has_rel_mcount __has32_rel_mcount
4847 + # define has_rel_mcount has32_rel_mcount
4848 + # define tot_relsize tot32_relsize
4849 ++# define find_symtab find_symtab32
4850 ++# define get_shnum get_shnum32
4851 ++# define set_shnum set_shnum32
4852 ++# define get_shstrndx get_shstrndx32
4853 ++# define get_symindex get_symindex32
4854 + # define get_sym_str_and_relp get_sym_str_and_relp_32
4855 + # define do_func do32
4856 + # define get_mcountsym get_mcountsym_32
4857 +@@ -173,6 +188,67 @@ static int MIPS_is_fake_mcount(Elf_Rel const *rp)
4858 + return is_fake;
4859 + }
4860 +
4861 ++static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab,
4862 ++ Elf32_Word const *symtab_shndx)
4863 ++{
4864 ++ unsigned long offset;
4865 ++ int index;
4866 ++
4867 ++ if (sym->st_shndx != SHN_XINDEX)
4868 ++ return w2(sym->st_shndx);
4869 ++
4870 ++ offset = (unsigned long)sym - (unsigned long)symtab;
4871 ++ index = offset / sizeof(*sym);
4872 ++
4873 ++ return w(symtab_shndx[index]);
4874 ++}
4875 ++
4876 ++static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0)
4877 ++{
4878 ++ if (shdr0 && !ehdr->e_shnum)
4879 ++ return w(shdr0->sh_size);
4880 ++
4881 ++ return w2(ehdr->e_shnum);
4882 ++}
4883 ++
4884 ++static void set_shnum(Elf_Ehdr *ehdr, Elf_Shdr *shdr0, unsigned int new_shnum)
4885 ++{
4886 ++ if (new_shnum >= SHN_LORESERVE) {
4887 ++ ehdr->e_shnum = 0;
4888 ++ shdr0->sh_size = w(new_shnum);
4889 ++ } else
4890 ++ ehdr->e_shnum = w2(new_shnum);
4891 ++}
4892 ++
4893 ++static int get_shstrndx(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0)
4894 ++{
4895 ++ if (ehdr->e_shstrndx != SHN_XINDEX)
4896 ++ return w2(ehdr->e_shstrndx);
4897 ++
4898 ++ return w(shdr0->sh_link);
4899 ++}
4900 ++
4901 ++static void find_symtab(Elf_Ehdr *const ehdr, Elf_Shdr const *shdr0,
4902 ++ unsigned const nhdr, Elf32_Word **symtab,
4903 ++ Elf32_Word **symtab_shndx)
4904 ++{
4905 ++ Elf_Shdr const *relhdr;
4906 ++ unsigned k;
4907 ++
4908 ++ *symtab = NULL;
4909 ++ *symtab_shndx = NULL;
4910 ++
4911 ++ for (relhdr = shdr0, k = nhdr; k; --k, ++relhdr) {
4912 ++ if (relhdr->sh_type == SHT_SYMTAB)
4913 ++ *symtab = (void *)ehdr + relhdr->sh_offset;
4914 ++ else if (relhdr->sh_type == SHT_SYMTAB_SHNDX)
4915 ++ *symtab_shndx = (void *)ehdr + relhdr->sh_offset;
4916 ++
4917 ++ if (*symtab && *symtab_shndx)
4918 ++ break;
4919 ++ }
4920 ++}
4921 ++
4922 + /* Append the new shstrtab, Elf_Shdr[], __mcount_loc and its relocations. */
4923 + static int append_func(Elf_Ehdr *const ehdr,
4924 + Elf_Shdr *const shstr,
4925 +@@ -188,10 +264,12 @@ static int append_func(Elf_Ehdr *const ehdr,
4926 + char const *mc_name = (sizeof(Elf_Rela) == rel_entsize)
4927 + ? ".rela__mcount_loc"
4928 + : ".rel__mcount_loc";
4929 +- unsigned const old_shnum = w2(ehdr->e_shnum);
4930 + uint_t const old_shoff = _w(ehdr->e_shoff);
4931 + uint_t const old_shstr_sh_size = _w(shstr->sh_size);
4932 + uint_t const old_shstr_sh_offset = _w(shstr->sh_offset);
4933 ++ Elf_Shdr *const shdr0 = (Elf_Shdr *)(old_shoff + (void *)ehdr);
4934 ++ unsigned int const old_shnum = get_shnum(ehdr, shdr0);
4935 ++ unsigned int const new_shnum = 2 + old_shnum; /* {.rel,}__mcount_loc */
4936 + uint_t t = 1 + strlen(mc_name) + _w(shstr->sh_size);
4937 + uint_t new_e_shoff;
4938 +
4939 +@@ -201,6 +279,8 @@ static int append_func(Elf_Ehdr *const ehdr,
4940 + t += (_align & -t); /* word-byte align */
4941 + new_e_shoff = t;
4942 +
4943 ++ set_shnum(ehdr, shdr0, new_shnum);
4944 ++
4945 + /* body for new shstrtab */
4946 + if (ulseek(sb.st_size, SEEK_SET) < 0)
4947 + return -1;
4948 +@@ -255,7 +335,6 @@ static int append_func(Elf_Ehdr *const ehdr,
4949 + return -1;
4950 +
4951 + ehdr->e_shoff = _w(new_e_shoff);
4952 +- ehdr->e_shnum = w2(2 + w2(ehdr->e_shnum)); /* {.rel,}__mcount_loc */
4953 + if (ulseek(0, SEEK_SET) < 0)
4954 + return -1;
4955 + if (uwrite(ehdr, sizeof(*ehdr)) < 0)
4956 +@@ -434,6 +513,8 @@ static int find_secsym_ndx(unsigned const txtndx,
4957 + uint_t *const recvalp,
4958 + unsigned int *sym_index,
4959 + Elf_Shdr const *const symhdr,
4960 ++ Elf32_Word const *symtab,
4961 ++ Elf32_Word const *symtab_shndx,
4962 + Elf_Ehdr const *const ehdr)
4963 + {
4964 + Elf_Sym const *const sym0 = (Elf_Sym const *)(_w(symhdr->sh_offset)
4965 +@@ -445,7 +526,7 @@ static int find_secsym_ndx(unsigned const txtndx,
4966 + for (symp = sym0, t = nsym; t; --t, ++symp) {
4967 + unsigned int const st_bind = ELF_ST_BIND(symp->st_info);
4968 +
4969 +- if (txtndx == w2(symp->st_shndx)
4970 ++ if (txtndx == get_symindex(symp, symtab, symtab_shndx)
4971 + /* avoid STB_WEAK */
4972 + && (STB_LOCAL == st_bind || STB_GLOBAL == st_bind)) {
4973 + /* function symbols on ARM have quirks, avoid them */
4974 +@@ -516,21 +597,23 @@ static unsigned tot_relsize(Elf_Shdr const *const shdr0,
4975 + return totrelsz;
4976 + }
4977 +
4978 +-
4979 + /* Overall supervision for Elf32 ET_REL file. */
4980 + static int do_func(Elf_Ehdr *const ehdr, char const *const fname,
4981 + unsigned const reltype)
4982 + {
4983 + Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff)
4984 + + (void *)ehdr);
4985 +- unsigned const nhdr = w2(ehdr->e_shnum);
4986 +- Elf_Shdr *const shstr = &shdr0[w2(ehdr->e_shstrndx)];
4987 ++ unsigned const nhdr = get_shnum(ehdr, shdr0);
4988 ++ Elf_Shdr *const shstr = &shdr0[get_shstrndx(ehdr, shdr0)];
4989 + char const *const shstrtab = (char const *)(_w(shstr->sh_offset)
4990 + + (void *)ehdr);
4991 +
4992 + Elf_Shdr const *relhdr;
4993 + unsigned k;
4994 +
4995 ++ Elf32_Word *symtab;
4996 ++ Elf32_Word *symtab_shndx;
4997 ++
4998 + /* Upper bound on space: assume all relevant relocs are for mcount. */
4999 + unsigned totrelsz;
5000 +
5001 +@@ -561,6 +644,8 @@ static int do_func(Elf_Ehdr *const ehdr, char const *const fname,
5002 + return -1;
5003 + }
5004 +
5005 ++ find_symtab(ehdr, shdr0, nhdr, &symtab, &symtab_shndx);
5006 ++
5007 + for (relhdr = shdr0, k = nhdr; k; --k, ++relhdr) {
5008 + char const *const txtname = has_rel_mcount(relhdr, shdr0,
5009 + shstrtab, fname);
5010 +@@ -577,6 +662,7 @@ static int do_func(Elf_Ehdr *const ehdr, char const *const fname,
5011 + result = find_secsym_ndx(w(relhdr->sh_info), txtname,
5012 + &recval, &recsym,
5013 + &shdr0[symsec_sh_link],
5014 ++ symtab, symtab_shndx,
5015 + ehdr);
5016 + if (result)
5017 + goto out;
5018 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
5019 +index d41c91468ab3..e78c4367b6c8 100644
5020 +--- a/sound/pci/hda/patch_hdmi.c
5021 ++++ b/sound/pci/hda/patch_hdmi.c
5022 +@@ -4146,6 +4146,11 @@ HDA_CODEC_ENTRY(0x10de0095, "GPU 95 HDMI/DP", patch_nvhdmi),
5023 + HDA_CODEC_ENTRY(0x10de0097, "GPU 97 HDMI/DP", patch_nvhdmi),
5024 + HDA_CODEC_ENTRY(0x10de0098, "GPU 98 HDMI/DP", patch_nvhdmi),
5025 + HDA_CODEC_ENTRY(0x10de0099, "GPU 99 HDMI/DP", patch_nvhdmi),
5026 ++HDA_CODEC_ENTRY(0x10de009a, "GPU 9a HDMI/DP", patch_nvhdmi),
5027 ++HDA_CODEC_ENTRY(0x10de009d, "GPU 9d HDMI/DP", patch_nvhdmi),
5028 ++HDA_CODEC_ENTRY(0x10de009e, "GPU 9e HDMI/DP", patch_nvhdmi),
5029 ++HDA_CODEC_ENTRY(0x10de009f, "GPU 9f HDMI/DP", patch_nvhdmi),
5030 ++HDA_CODEC_ENTRY(0x10de00a0, "GPU a0 HDMI/DP", patch_nvhdmi),
5031 + HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI", patch_nvhdmi_2ch),
5032 + HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI", patch_nvhdmi_2ch),
5033 + HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP", patch_via_hdmi),
5034 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
5035 +index 459a7d61326e..34868459104d 100644
5036 +--- a/sound/pci/hda/patch_realtek.c
5037 ++++ b/sound/pci/hda/patch_realtek.c
5038 +@@ -2460,6 +2460,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5039 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
5040 + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
5041 + SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
5042 ++ SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
5043 + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
5044 + SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
5045 + SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
5046 +@@ -7435,6 +7436,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5047 + SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5048 + SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5049 + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5050 ++ SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
5051 ++ SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
5052 + SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED),
5053 + SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
5054 + SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
5055 +diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
5056 +index 537dc69256f0..a4ebd6ddaba1 100644
5057 +--- a/sound/soc/fsl/fsl_ssi.c
5058 ++++ b/sound/soc/fsl/fsl_ssi.c
5059 +@@ -678,8 +678,9 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
5060 + struct regmap *regs = ssi->regs;
5061 + u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
5062 + unsigned long clkrate, baudrate, tmprate;
5063 +- unsigned int slots = params_channels(hw_params);
5064 +- unsigned int slot_width = 32;
5065 ++ unsigned int channels = params_channels(hw_params);
5066 ++ unsigned int slot_width = params_width(hw_params);
5067 ++ unsigned int slots = 2;
5068 + u64 sub, savesub = 100000;
5069 + unsigned int freq;
5070 + bool baudclk_is_used;
5071 +@@ -688,10 +689,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
5072 + /* Override slots and slot_width if being specifically set... */
5073 + if (ssi->slots)
5074 + slots = ssi->slots;
5075 +- /* ...but keep 32 bits if slots is 2 -- I2S Master mode */
5076 +- if (ssi->slot_width && slots != 2)
5077 ++ if (ssi->slot_width)
5078 + slot_width = ssi->slot_width;
5079 +
5080 ++ /* ...but force 32 bits for stereo audio using I2S Master Mode */
5081 ++ if (channels == 2 &&
5082 ++ (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) == SSI_SCR_I2S_MODE_MASTER)
5083 ++ slot_width = 32;
5084 ++
5085 + /* Generate bit clock based on the slot number and slot width */
5086 + freq = slots * slot_width * params_rate(hw_params);
5087 +
5088 +diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
5089 +index 6c20bdd850f3..8ada4ecba847 100644
5090 +--- a/sound/soc/qcom/common.c
5091 ++++ b/sound/soc/qcom/common.c
5092 +@@ -4,6 +4,7 @@
5093 +
5094 + #include <linux/module.h>
5095 + #include "common.h"
5096 ++#include "qdsp6/q6afe.h"
5097 +
5098 + int qcom_snd_parse_of(struct snd_soc_card *card)
5099 + {
5100 +@@ -101,6 +102,15 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
5101 + }
5102 + link->no_pcm = 1;
5103 + link->ignore_pmdown_time = 1;
5104 ++
5105 ++ if (q6afe_is_rx_port(link->id)) {
5106 ++ link->dpcm_playback = 1;
5107 ++ link->dpcm_capture = 0;
5108 ++ } else {
5109 ++ link->dpcm_playback = 0;
5110 ++ link->dpcm_capture = 1;
5111 ++ }
5112 ++
5113 + } else {
5114 + dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
5115 + if (!dlc)
5116 +@@ -113,12 +123,12 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
5117 + link->codecs->dai_name = "snd-soc-dummy-dai";
5118 + link->codecs->name = "snd-soc-dummy";
5119 + link->dynamic = 1;
5120 ++ link->dpcm_playback = 1;
5121 ++ link->dpcm_capture = 1;
5122 + }
5123 +
5124 + link->ignore_suspend = 1;
5125 + link->nonatomic = 1;
5126 +- link->dpcm_playback = 1;
5127 +- link->dpcm_capture = 1;
5128 + link->stream_name = link->name;
5129 + link++;
5130 +
5131 +diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
5132 +index e0945f7a58c8..0ce4eb60f984 100644
5133 +--- a/sound/soc/qcom/qdsp6/q6afe.c
5134 ++++ b/sound/soc/qcom/qdsp6/q6afe.c
5135 +@@ -800,6 +800,14 @@ int q6afe_get_port_id(int index)
5136 + }
5137 + EXPORT_SYMBOL_GPL(q6afe_get_port_id);
5138 +
5139 ++int q6afe_is_rx_port(int index)
5140 ++{
5141 ++ if (index < 0 || index >= AFE_PORT_MAX)
5142 ++ return -EINVAL;
5143 ++
5144 ++ return port_maps[index].is_rx;
5145 ++}
5146 ++EXPORT_SYMBOL_GPL(q6afe_is_rx_port);
5147 + static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt,
5148 + struct q6afe_port *port)
5149 + {
5150 +diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h
5151 +index c7ed5422baff..1a0f80a14afe 100644
5152 +--- a/sound/soc/qcom/qdsp6/q6afe.h
5153 ++++ b/sound/soc/qcom/qdsp6/q6afe.h
5154 +@@ -198,6 +198,7 @@ int q6afe_port_start(struct q6afe_port *port);
5155 + int q6afe_port_stop(struct q6afe_port *port);
5156 + void q6afe_port_put(struct q6afe_port *port);
5157 + int q6afe_get_port_id(int index);
5158 ++int q6afe_is_rx_port(int index);
5159 + void q6afe_hdmi_port_prepare(struct q6afe_port *port,
5160 + struct q6afe_hdmi_cfg *cfg);
5161 + void q6afe_slim_port_prepare(struct q6afe_port *port,
5162 +diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
5163 +index e8141a33a55e..835ac98a789c 100644
5164 +--- a/sound/soc/qcom/qdsp6/q6asm.c
5165 ++++ b/sound/soc/qcom/qdsp6/q6asm.c
5166 +@@ -25,6 +25,7 @@
5167 + #define ASM_STREAM_CMD_FLUSH 0x00010BCE
5168 + #define ASM_SESSION_CMD_PAUSE 0x00010BD3
5169 + #define ASM_DATA_CMD_EOS 0x00010BDB
5170 ++#define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
5171 + #define ASM_NULL_POPP_TOPOLOGY 0x00010C68
5172 + #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
5173 + #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
5174 +@@ -546,9 +547,6 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
5175 + case ASM_SESSION_CMD_SUSPEND:
5176 + client_event = ASM_CLIENT_EVENT_CMD_SUSPEND_DONE;
5177 + break;
5178 +- case ASM_DATA_CMD_EOS:
5179 +- client_event = ASM_CLIENT_EVENT_CMD_EOS_DONE;
5180 +- break;
5181 + case ASM_STREAM_CMD_FLUSH:
5182 + client_event = ASM_CLIENT_EVENT_CMD_FLUSH_DONE;
5183 + break;
5184 +@@ -651,6 +649,9 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
5185 + spin_unlock_irqrestore(&ac->lock, flags);
5186 + }
5187 +
5188 ++ break;
5189 ++ case ASM_DATA_EVENT_RENDERED_EOS:
5190 ++ client_event = ASM_CLIENT_EVENT_CMD_EOS_DONE;
5191 + break;
5192 + }
5193 +
5194 +diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
5195 +index 7cd42fcfcf38..1707414cfa92 100644
5196 +--- a/sound/soc/rockchip/rockchip_pdm.c
5197 ++++ b/sound/soc/rockchip/rockchip_pdm.c
5198 +@@ -590,8 +590,10 @@ static int rockchip_pdm_resume(struct device *dev)
5199 + int ret;
5200 +
5201 + ret = pm_runtime_get_sync(dev);
5202 +- if (ret < 0)
5203 ++ if (ret < 0) {
5204 ++ pm_runtime_put(dev);
5205 + return ret;
5206 ++ }
5207 +
5208 + ret = regcache_sync(pdm->regmap);
5209 +
5210 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
5211 +index f55afe3a98e3..9079c380228f 100644
5212 +--- a/sound/usb/mixer.c
5213 ++++ b/sound/usb/mixer.c
5214 +@@ -576,8 +576,9 @@ static int check_matrix_bitmap(unsigned char *bmap,
5215 + * if failed, give up and free the control instance.
5216 + */
5217 +
5218 +-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
5219 +- struct snd_kcontrol *kctl)
5220 ++int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
5221 ++ struct snd_kcontrol *kctl,
5222 ++ bool is_std_info)
5223 + {
5224 + struct usb_mixer_interface *mixer = list->mixer;
5225 + int err;
5226 +@@ -591,6 +592,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
5227 + return err;
5228 + }
5229 + list->kctl = kctl;
5230 ++ list->is_std_info = is_std_info;
5231 + list->next_id_elem = mixer->id_elems[list->id];
5232 + mixer->id_elems[list->id] = list;
5233 + return 0;
5234 +@@ -3213,8 +3215,11 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
5235 + unitid = delegate_notify(mixer, unitid, NULL, NULL);
5236 +
5237 + for_each_mixer_elem(list, mixer, unitid) {
5238 +- struct usb_mixer_elem_info *info =
5239 +- mixer_elem_list_to_info(list);
5240 ++ struct usb_mixer_elem_info *info;
5241 ++
5242 ++ if (!list->is_std_info)
5243 ++ continue;
5244 ++ info = mixer_elem_list_to_info(list);
5245 + /* invalidate cache, so the value is read from the device */
5246 + info->cached = 0;
5247 + snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
5248 +@@ -3294,6 +3299,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
5249 +
5250 + if (!list->kctl)
5251 + continue;
5252 ++ if (!list->is_std_info)
5253 ++ continue;
5254 +
5255 + info = mixer_elem_list_to_info(list);
5256 + if (count > 1 && info->control != control)
5257 +diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
5258 +index 8e0fb7fdf1a0..01b5e5cc2221 100644
5259 +--- a/sound/usb/mixer.h
5260 ++++ b/sound/usb/mixer.h
5261 +@@ -66,6 +66,7 @@ struct usb_mixer_elem_list {
5262 + struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
5263 + struct snd_kcontrol *kctl;
5264 + unsigned int id;
5265 ++ bool is_std_info;
5266 + usb_mixer_elem_dump_func_t dump;
5267 + usb_mixer_elem_resume_func_t resume;
5268 + };
5269 +@@ -103,8 +104,12 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
5270 + int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
5271 + int request, int validx, int value_set);
5272 +
5273 +-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
5274 +- struct snd_kcontrol *kctl);
5275 ++int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
5276 ++ struct snd_kcontrol *kctl,
5277 ++ bool is_std_info);
5278 ++
5279 ++#define snd_usb_mixer_add_control(list, kctl) \
5280 ++ snd_usb_mixer_add_list(list, kctl, true)
5281 +
5282 + void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
5283 + struct usb_mixer_interface *mixer,
5284 +diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
5285 +index dc181066c799..d39bf5b648d1 100644
5286 +--- a/sound/usb/mixer_quirks.c
5287 ++++ b/sound/usb/mixer_quirks.c
5288 +@@ -157,7 +157,8 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,
5289 + return -ENOMEM;
5290 + }
5291 + kctl->private_free = snd_usb_mixer_elem_free;
5292 +- return snd_usb_mixer_add_control(list, kctl);
5293 ++ /* don't use snd_usb_mixer_add_control() here, this is a special list element */
5294 ++ return snd_usb_mixer_add_list(list, kctl, false);
5295 + }
5296 +
5297 + /*
5298 +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
5299 +index 6c391e5fad2a..b971d9aaa64a 100644
5300 +--- a/sound/usb/pcm.c
5301 ++++ b/sound/usb/pcm.c
5302 +@@ -349,6 +349,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
5303 + ifnum = 0;
5304 + goto add_sync_ep_from_ifnum;
5305 + case USB_ID(0x07fd, 0x0008): /* MOTU M Series */
5306 ++ case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */
5307 + ep = 0x81;
5308 + ifnum = 2;
5309 + goto add_sync_ep_from_ifnum;
5310 +@@ -1778,6 +1779,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
5311 + return 0;
5312 + case SNDRV_PCM_TRIGGER_STOP:
5313 + stop_endpoints(subs, false);
5314 ++ subs->data_endpoint->retire_data_urb = NULL;
5315 + subs->running = 0;
5316 + return 0;
5317 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
5318 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
5319 +index 092720ce2c55..bf5083a20b6d 100644
5320 +--- a/sound/usb/quirks.c
5321 ++++ b/sound/usb/quirks.c
5322 +@@ -1461,6 +1461,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
5323 + static bool is_itf_usb_dsd_dac(unsigned int id)
5324 + {
5325 + switch (id) {
5326 ++ case USB_ID(0x154e, 0x1002): /* Denon DCD-1500RE */
5327 + case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */
5328 + case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */
5329 + case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */
5330 +@@ -1602,6 +1603,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
5331 + chip->usb_id == USB_ID(0x0951, 0x16ad)) &&
5332 + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
5333 + usleep_range(1000, 2000);
5334 ++
5335 ++ /*
5336 ++ * Samsung USBC Headset (AKG) need a tiny delay after each
5337 ++ * class compliant request. (Model number: AAM625R or AAM627R)
5338 ++ */
5339 ++ if (chip->usb_id == USB_ID(0x04e8, 0xa051) &&
5340 ++ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
5341 ++ usleep_range(5000, 6000);
5342 + }
5343 +
5344 + /*
5345 +diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selftests/net/so_txtime.c
5346 +index 383bac05ac32..ceaad78e9667 100644
5347 +--- a/tools/testing/selftests/net/so_txtime.c
5348 ++++ b/tools/testing/selftests/net/so_txtime.c
5349 +@@ -15,8 +15,9 @@
5350 + #include <inttypes.h>
5351 + #include <linux/net_tstamp.h>
5352 + #include <linux/errqueue.h>
5353 ++#include <linux/if_ether.h>
5354 + #include <linux/ipv6.h>
5355 +-#include <linux/tcp.h>
5356 ++#include <linux/udp.h>
5357 + #include <stdbool.h>
5358 + #include <stdlib.h>
5359 + #include <stdio.h>
5360 +@@ -140,8 +141,8 @@ static void do_recv_errqueue_timeout(int fdt)
5361 + {
5362 + char control[CMSG_SPACE(sizeof(struct sock_extended_err)) +
5363 + CMSG_SPACE(sizeof(struct sockaddr_in6))] = {0};
5364 +- char data[sizeof(struct ipv6hdr) +
5365 +- sizeof(struct tcphdr) + 1];
5366 ++ char data[sizeof(struct ethhdr) + sizeof(struct ipv6hdr) +
5367 ++ sizeof(struct udphdr) + 1];
5368 + struct sock_extended_err *err;
5369 + struct msghdr msg = {0};
5370 + struct iovec iov = {0};
5371 +@@ -159,6 +160,8 @@ static void do_recv_errqueue_timeout(int fdt)
5372 + msg.msg_controllen = sizeof(control);
5373 +
5374 + while (1) {
5375 ++ const char *reason;
5376 ++
5377 + ret = recvmsg(fdt, &msg, MSG_ERRQUEUE);
5378 + if (ret == -1 && errno == EAGAIN)
5379 + break;
5380 +@@ -176,14 +179,30 @@ static void do_recv_errqueue_timeout(int fdt)
5381 + err = (struct sock_extended_err *)CMSG_DATA(cm);
5382 + if (err->ee_origin != SO_EE_ORIGIN_TXTIME)
5383 + error(1, 0, "errqueue: origin 0x%x\n", err->ee_origin);
5384 +- if (err->ee_code != ECANCELED)
5385 +- error(1, 0, "errqueue: code 0x%x\n", err->ee_code);
5386 ++
5387 ++ switch (err->ee_errno) {
5388 ++ case ECANCELED:
5389 ++ if (err->ee_code != SO_EE_CODE_TXTIME_MISSED)
5390 ++ error(1, 0, "errqueue: unknown ECANCELED %u\n",
5391 ++ err->ee_code);
5392 ++ reason = "missed txtime";
5393 ++ break;
5394 ++ case EINVAL:
5395 ++ if (err->ee_code != SO_EE_CODE_TXTIME_INVALID_PARAM)
5396 ++ error(1, 0, "errqueue: unknown EINVAL %u\n",
5397 ++ err->ee_code);
5398 ++ reason = "invalid txtime";
5399 ++ break;
5400 ++ default:
5401 ++ error(1, 0, "errqueue: errno %u code %u\n",
5402 ++ err->ee_errno, err->ee_code);
5403 ++ };
5404 +
5405 + tstamp = ((int64_t) err->ee_data) << 32 | err->ee_info;
5406 + tstamp -= (int64_t) glob_tstart;
5407 + tstamp /= 1000 * 1000;
5408 +- fprintf(stderr, "send: pkt %c at %" PRId64 "ms dropped\n",
5409 +- data[ret - 1], tstamp);
5410 ++ fprintf(stderr, "send: pkt %c at %" PRId64 "ms dropped: %s\n",
5411 ++ data[ret - 1], tstamp, reason);
5412 +
5413 + msg.msg_flags = 0;
5414 + msg.msg_controllen = sizeof(control);