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, 23 Feb 2022 12:38:12
Message-Id: 1645619877.3d7680c8b479e62dc905fdd532f8991b45ec5c37.mpagano@gentoo
1 commit: 3d7680c8b479e62dc905fdd532f8991b45ec5c37
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 23 12:37:57 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 23 12:37:57 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3d7680c8
7
8 Linux patch 5.4.181
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1180_linux-5.4.181.patch | 2733 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2737 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index d666a174..7ddf9a06 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -763,6 +763,10 @@ Patch: 1179_linux-5.4.180.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.180
23
24 +Patch: 1180_linux-5.4.181.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.181
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/1180_linux-5.4.181.patch b/1180_linux-5.4.181.patch
33 new file mode 100644
34 index 00000000..9f5693ce
35 --- /dev/null
36 +++ b/1180_linux-5.4.181.patch
37 @@ -0,0 +1,2733 @@
38 +diff --git a/Makefile b/Makefile
39 +index 6eb6645647147..afe2420bb3de0 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 = 180
47 ++SUBLEVEL = 181
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
52 +index 46012ca812f48..1bd64f6ba8cfe 100644
53 +--- a/arch/arm/mach-omap2/display.c
54 ++++ b/arch/arm/mach-omap2/display.c
55 +@@ -263,9 +263,9 @@ static int __init omapdss_init_of(void)
56 + }
57 +
58 + r = of_platform_populate(node, NULL, NULL, &pdev->dev);
59 ++ put_device(&pdev->dev);
60 + if (r) {
61 + pr_err("Unable to populate DSS submodule devices\n");
62 +- put_device(&pdev->dev);
63 + return r;
64 + }
65 +
66 +diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
67 +index 6289b288d60a6..202b740adee0e 100644
68 +--- a/arch/arm/mach-omap2/omap_hwmod.c
69 ++++ b/arch/arm/mach-omap2/omap_hwmod.c
70 +@@ -782,8 +782,10 @@ static int __init _init_clkctrl_providers(void)
71 +
72 + for_each_matching_node(np, ti_clkctrl_match_table) {
73 + ret = _setup_clkctrl_provider(np);
74 +- if (ret)
75 ++ if (ret) {
76 ++ of_node_put(np);
77 + break;
78 ++ }
79 + }
80 +
81 + return ret;
82 +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
83 +index 9533c85fb0a30..d2d255a988a81 100644
84 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
85 ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
86 +@@ -76,6 +76,12 @@
87 + no-map;
88 + };
89 +
90 ++ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
91 ++ secmon_reserved_bl32: secmon@5300000 {
92 ++ reg = <0x0 0x05300000 0x0 0x2000000>;
93 ++ no-map;
94 ++ };
95 ++
96 + linux,cma {
97 + compatible = "shared-dma-pool";
98 + reusable;
99 +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
100 +index b8d9e92197ac8..c76bf498ee388 100644
101 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
102 ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
103 +@@ -157,14 +157,6 @@
104 + regulator-always-on;
105 + };
106 +
107 +- reserved-memory {
108 +- /* TEE Reserved Memory */
109 +- bl32_reserved: bl32@5000000 {
110 +- reg = <0x0 0x05300000 0x0 0x2000000>;
111 +- no-map;
112 +- };
113 +- };
114 +-
115 + sdio_pwrseq: sdio-pwrseq {
116 + compatible = "mmc-pwrseq-simple";
117 + reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
118 +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
119 +index ce230d6ac35cd..ad7bc0eec6682 100644
120 +--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
121 ++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
122 +@@ -41,6 +41,12 @@
123 + no-map;
124 + };
125 +
126 ++ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
127 ++ secmon_reserved_bl32: secmon@5300000 {
128 ++ reg = <0x0 0x05300000 0x0 0x2000000>;
129 ++ no-map;
130 ++ };
131 ++
132 + linux,cma {
133 + compatible = "shared-dma-pool";
134 + reusable;
135 +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
136 +index 29ac78ddc057e..85fb59060cdff 100644
137 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
138 ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
139 +@@ -164,14 +164,6 @@
140 + regulator-always-on;
141 + };
142 +
143 +- reserved-memory {
144 +- /* TEE Reserved Memory */
145 +- bl32_reserved: bl32@5000000 {
146 +- reg = <0x0 0x05300000 0x0 0x2000000>;
147 +- no-map;
148 +- };
149 +- };
150 +-
151 + sdio_pwrseq: sdio-pwrseq {
152 + compatible = "mmc-pwrseq-simple";
153 + reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
154 +diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
155 +index 06e56b4703153..822718eafdb44 100644
156 +--- a/arch/arm64/kernel/ftrace.c
157 ++++ b/arch/arm64/kernel/ftrace.c
158 +@@ -73,9 +73,21 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
159 +
160 + if (offset < -SZ_128M || offset >= SZ_128M) {
161 + #ifdef CONFIG_ARM64_MODULE_PLTS
162 +- struct plt_entry trampoline, *dst;
163 + struct module *mod;
164 +
165 ++ /*
166 ++ * There is only one ftrace trampoline per module. For now,
167 ++ * this is not a problem since on arm64, all dynamic ftrace
168 ++ * invocations are routed via ftrace_caller(). This will need
169 ++ * to be revisited if support for multiple ftrace entry points
170 ++ * is added in the future, but for now, the pr_err() below
171 ++ * deals with a theoretical issue only.
172 ++ */
173 ++ if (addr != FTRACE_ADDR) {
174 ++ pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n");
175 ++ return -EINVAL;
176 ++ }
177 ++
178 + /*
179 + * On kernels that support module PLTs, the offset between the
180 + * branch instruction and its target may legally exceed the
181 +@@ -93,46 +105,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
182 + if (WARN_ON(!mod))
183 + return -EINVAL;
184 +
185 +- /*
186 +- * There is only one ftrace trampoline per module. For now,
187 +- * this is not a problem since on arm64, all dynamic ftrace
188 +- * invocations are routed via ftrace_caller(). This will need
189 +- * to be revisited if support for multiple ftrace entry points
190 +- * is added in the future, but for now, the pr_err() below
191 +- * deals with a theoretical issue only.
192 +- *
193 +- * Note that PLTs are place relative, and plt_entries_equal()
194 +- * checks whether they point to the same target. Here, we need
195 +- * to check if the actual opcodes are in fact identical,
196 +- * regardless of the offset in memory so use memcmp() instead.
197 +- */
198 +- dst = mod->arch.ftrace_trampoline;
199 +- trampoline = get_plt_entry(addr, dst);
200 +- if (memcmp(dst, &trampoline, sizeof(trampoline))) {
201 +- if (plt_entry_is_initialized(dst)) {
202 +- pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n");
203 +- return -EINVAL;
204 +- }
205 +-
206 +- /* point the trampoline to our ftrace entry point */
207 +- module_disable_ro(mod);
208 +- *dst = trampoline;
209 +- module_enable_ro(mod, true);
210 +-
211 +- /*
212 +- * Ensure updated trampoline is visible to instruction
213 +- * fetch before we patch in the branch. Although the
214 +- * architecture doesn't require an IPI in this case,
215 +- * Neoverse-N1 erratum #1542419 does require one
216 +- * if the TLB maintenance in module_enable_ro() is
217 +- * skipped due to rodata_enabled. It doesn't seem worth
218 +- * it to make it conditional given that this is
219 +- * certainly not a fast-path.
220 +- */
221 +- flush_icache_range((unsigned long)&dst[0],
222 +- (unsigned long)&dst[1]);
223 +- }
224 +- addr = (unsigned long)dst;
225 ++ addr = (unsigned long)mod->arch.ftrace_trampoline;
226 + #else /* CONFIG_ARM64_MODULE_PLTS */
227 + return -EINVAL;
228 + #endif /* CONFIG_ARM64_MODULE_PLTS */
229 +diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
230 +index 03ff15bffbb6d..d0692ecb99bb0 100644
231 +--- a/arch/arm64/kernel/module.c
232 ++++ b/arch/arm64/kernel/module.c
233 +@@ -9,6 +9,7 @@
234 +
235 + #include <linux/bitops.h>
236 + #include <linux/elf.h>
237 ++#include <linux/ftrace.h>
238 + #include <linux/gfp.h>
239 + #include <linux/kasan.h>
240 + #include <linux/kernel.h>
241 +@@ -470,22 +471,48 @@ overflow:
242 + return -ENOEXEC;
243 + }
244 +
245 +-int module_finalize(const Elf_Ehdr *hdr,
246 +- const Elf_Shdr *sechdrs,
247 +- struct module *me)
248 ++static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
249 ++ const Elf_Shdr *sechdrs,
250 ++ const char *name)
251 + {
252 + const Elf_Shdr *s, *se;
253 + const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
254 +
255 + for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) {
256 +- if (strcmp(".altinstructions", secstrs + s->sh_name) == 0)
257 +- apply_alternatives_module((void *)s->sh_addr, s->sh_size);
258 +-#ifdef CONFIG_ARM64_MODULE_PLTS
259 +- if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) &&
260 +- !strcmp(".text.ftrace_trampoline", secstrs + s->sh_name))
261 +- me->arch.ftrace_trampoline = (void *)s->sh_addr;
262 +-#endif
263 ++ if (strcmp(name, secstrs + s->sh_name) == 0)
264 ++ return s;
265 + }
266 +
267 ++ return NULL;
268 ++}
269 ++
270 ++static int module_init_ftrace_plt(const Elf_Ehdr *hdr,
271 ++ const Elf_Shdr *sechdrs,
272 ++ struct module *mod)
273 ++{
274 ++#if defined(CONFIG_ARM64_MODULE_PLTS) && defined(CONFIG_DYNAMIC_FTRACE)
275 ++ const Elf_Shdr *s;
276 ++ struct plt_entry *plt;
277 ++
278 ++ s = find_section(hdr, sechdrs, ".text.ftrace_trampoline");
279 ++ if (!s)
280 ++ return -ENOEXEC;
281 ++
282 ++ plt = (void *)s->sh_addr;
283 ++ *plt = get_plt_entry(FTRACE_ADDR, plt);
284 ++ mod->arch.ftrace_trampoline = plt;
285 ++#endif
286 + return 0;
287 + }
288 ++
289 ++int module_finalize(const Elf_Ehdr *hdr,
290 ++ const Elf_Shdr *sechdrs,
291 ++ struct module *me)
292 ++{
293 ++ const Elf_Shdr *s;
294 ++ s = find_section(hdr, sechdrs, ".altinstructions");
295 ++ if (s)
296 ++ apply_alternatives_module((void *)s->sh_addr, s->sh_size);
297 ++
298 ++ return module_init_ftrace_plt(hdr, sechdrs, me);
299 ++}
300 +diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
301 +index caa90ae0b4acc..04460c2d2f8c1 100644
302 +--- a/arch/parisc/Makefile
303 ++++ b/arch/parisc/Makefile
304 +@@ -65,7 +65,6 @@ KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
305 + -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
306 +
307 + CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
308 +-KBUILD_LDS_MODULE += $(srctree)/arch/parisc/kernel/module.lds
309 + endif
310 +
311 + OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
312 +diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
313 +index ac5f34993b53b..1c50093e2ebee 100644
314 +--- a/arch/parisc/kernel/module.c
315 ++++ b/arch/parisc/kernel/module.c
316 +@@ -43,6 +43,7 @@
317 + #include <linux/elf.h>
318 + #include <linux/vmalloc.h>
319 + #include <linux/fs.h>
320 ++#include <linux/ftrace.h>
321 + #include <linux/string.h>
322 + #include <linux/kernel.h>
323 + #include <linux/bug.h>
324 +@@ -862,7 +863,7 @@ int module_finalize(const Elf_Ehdr *hdr,
325 + const char *strtab = NULL;
326 + const Elf_Shdr *s;
327 + char *secstrings;
328 +- int err, symindex = -1;
329 ++ int symindex = -1;
330 + Elf_Sym *newptr, *oldptr;
331 + Elf_Shdr *symhdr = NULL;
332 + #ifdef DEBUG
333 +@@ -946,11 +947,13 @@ int module_finalize(const Elf_Ehdr *hdr,
334 + /* patch .altinstructions */
335 + apply_alternatives(aseg, aseg + s->sh_size, me->name);
336 +
337 ++#ifdef CONFIG_DYNAMIC_FTRACE
338 + /* For 32 bit kernels we're compiling modules with
339 + * -ffunction-sections so we must relocate the addresses in the
340 +- *__mcount_loc section.
341 ++ * ftrace callsite section.
342 + */
343 +- if (symindex != -1 && !strcmp(secname, "__mcount_loc")) {
344 ++ if (symindex != -1 && !strcmp(secname, FTRACE_CALLSITE_SECTION)) {
345 ++ int err;
346 + if (s->sh_type == SHT_REL)
347 + err = apply_relocate((Elf_Shdr *)sechdrs,
348 + strtab, symindex,
349 +@@ -962,6 +965,7 @@ int module_finalize(const Elf_Ehdr *hdr,
350 + if (err)
351 + return err;
352 + }
353 ++#endif
354 + }
355 + return 0;
356 + }
357 +diff --git a/arch/parisc/kernel/module.lds b/arch/parisc/kernel/module.lds
358 +deleted file mode 100644
359 +index 1a9a92aca5c8a..0000000000000
360 +--- a/arch/parisc/kernel/module.lds
361 ++++ /dev/null
362 +@@ -1,7 +0,0 @@
363 +-/* SPDX-License-Identifier: GPL-2.0 */
364 +-
365 +-SECTIONS {
366 +- __mcount_loc : {
367 +- *(__patchable_function_entries)
368 +- }
369 +-}
370 +diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
371 +index d769d61cde7ca..15b7dae1808db 100644
372 +--- a/arch/parisc/mm/init.c
373 ++++ b/arch/parisc/mm/init.c
374 +@@ -347,9 +347,9 @@ static void __init setup_bootmem(void)
375 +
376 + static bool kernel_set_to_readonly;
377 +
378 +-static void __init map_pages(unsigned long start_vaddr,
379 +- unsigned long start_paddr, unsigned long size,
380 +- pgprot_t pgprot, int force)
381 ++static void __ref map_pages(unsigned long start_vaddr,
382 ++ unsigned long start_paddr, unsigned long size,
383 ++ pgprot_t pgprot, int force)
384 + {
385 + pgd_t *pg_dir;
386 + pmd_t *pmd;
387 +@@ -485,7 +485,7 @@ void __init set_kernel_text_rw(int enable_read_write)
388 + flush_tlb_all();
389 + }
390 +
391 +-void __ref free_initmem(void)
392 ++void free_initmem(void)
393 + {
394 + unsigned long init_begin = (unsigned long)__init_begin;
395 + unsigned long init_end = (unsigned long)__init_end;
396 +@@ -499,7 +499,6 @@ void __ref free_initmem(void)
397 + /* The init text pages are marked R-X. We have to
398 + * flush the icache and mark them RW-
399 + *
400 +- * This is tricky, because map_pages is in the init section.
401 + * Do a dummy remap of the data section first (the data
402 + * section is already PAGE_KERNEL) to pull in the TLB entries
403 + * for map_kernel */
404 +diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
405 +index c077acb983a19..dc6728dacbc6b 100644
406 +--- a/arch/powerpc/lib/sstep.c
407 ++++ b/arch/powerpc/lib/sstep.c
408 +@@ -2787,12 +2787,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op)
409 + case BARRIER_EIEIO:
410 + eieio();
411 + break;
412 ++#ifdef CONFIG_PPC64
413 + case BARRIER_LWSYNC:
414 + asm volatile("lwsync" : : : "memory");
415 + break;
416 + case BARRIER_PTESYNC:
417 + asm volatile("ptesync" : : : "memory");
418 + break;
419 ++#endif
420 + }
421 + break;
422 +
423 +diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
424 +index 46875bbd04198..e0e3776059af4 100644
425 +--- a/arch/x86/kvm/pmu.c
426 ++++ b/arch/x86/kvm/pmu.c
427 +@@ -191,7 +191,7 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
428 + }
429 +
430 + if (type == PERF_TYPE_RAW)
431 +- config = eventsel & X86_RAW_EVENT_MASK;
432 ++ config = eventsel & AMD64_RAW_EVENT_MASK;
433 +
434 + pmc_reprogram_counter(pmc, type, config,
435 + !(eventsel & ARCH_PERFMON_EVENTSEL_USR),
436 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
437 +index 425444d080712..2f84509f28289 100644
438 +--- a/arch/x86/kvm/svm.c
439 ++++ b/arch/x86/kvm/svm.c
440 +@@ -4585,8 +4585,6 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm)
441 + break;
442 + }
443 + case AVIC_IPI_FAILURE_INVALID_TARGET:
444 +- WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n",
445 +- index, svm->vcpu.vcpu_id, icrh, icrl);
446 + break;
447 + case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE:
448 + WARN_ONCE(1, "Invalid backing page\n");
449 +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
450 +index 73bffd7af15c1..1a0c581512f28 100644
451 +--- a/block/bfq-iosched.c
452 ++++ b/block/bfq-iosched.c
453 +@@ -6389,6 +6389,8 @@ static void bfq_exit_queue(struct elevator_queue *e)
454 + spin_unlock_irq(&bfqd->lock);
455 + #endif
456 +
457 ++ wbt_enable_default(bfqd->queue);
458 ++
459 + kfree(bfqd);
460 + }
461 +
462 +diff --git a/block/elevator.c b/block/elevator.c
463 +index 076ba7308e65c..78805c74ea8a4 100644
464 +--- a/block/elevator.c
465 ++++ b/block/elevator.c
466 +@@ -522,8 +522,6 @@ void elv_unregister_queue(struct request_queue *q)
467 + kobject_del(&e->kobj);
468 +
469 + e->registered = 0;
470 +- /* Re-enable throttling in case elevator disabled it */
471 +- wbt_enable_default(q);
472 + }
473 + }
474 +
475 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
476 +index 92fb1f5b240e8..dca1590f295d0 100644
477 +--- a/drivers/ata/libata-core.c
478 ++++ b/drivers/ata/libata-core.c
479 +@@ -4595,6 +4595,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
480 +
481 + /* devices that don't properly handle TRIM commands */
482 + { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
483 ++ { "M88V29*", NULL, ATA_HORKAGE_NOTRIM, },
484 +
485 + /*
486 + * As defined, the DRAT (Deterministic Read After Trim) and RZAT
487 +diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
488 +index f63d141481a3f..9aae6b3da356b 100644
489 +--- a/drivers/dma/at_xdmac.c
490 ++++ b/drivers/dma/at_xdmac.c
491 +@@ -1726,11 +1726,13 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id)
492 + static void at_xdmac_issue_pending(struct dma_chan *chan)
493 + {
494 + struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan);
495 ++ unsigned long flags;
496 +
497 + dev_dbg(chan2dev(&atchan->chan), "%s\n", __func__);
498 +
499 +- if (!at_xdmac_chan_is_cyclic(atchan))
500 +- at_xdmac_advance_work(atchan);
501 ++ spin_lock_irqsave(&atchan->lock, flags);
502 ++ at_xdmac_advance_work(atchan);
503 ++ spin_unlock_irqrestore(&atchan->lock, flags);
504 +
505 + return;
506 + }
507 +diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
508 +index 89eb9ea258149..eba942441e382 100644
509 +--- a/drivers/dma/sh/rcar-dmac.c
510 ++++ b/drivers/dma/sh/rcar-dmac.c
511 +@@ -1825,7 +1825,9 @@ static int rcar_dmac_probe(struct platform_device *pdev)
512 + platform_set_drvdata(pdev, dmac);
513 + dmac->dev->dma_parms = &dmac->parms;
514 + dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
515 +- dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
516 ++ ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
517 ++ if (ret)
518 ++ return ret;
519 +
520 + ret = rcar_dmac_parse_of(&pdev->dev, dmac);
521 + if (ret < 0)
522 +diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
523 +index e73ca303f1a7e..78e4a070896fc 100644
524 +--- a/drivers/edac/edac_mc.c
525 ++++ b/drivers/edac/edac_mc.c
526 +@@ -263,7 +263,7 @@ void *edac_align_ptr(void **p, unsigned int size, int n_elems)
527 + else
528 + return (char *)ptr;
529 +
530 +- r = (unsigned long)p % align;
531 ++ r = (unsigned long)ptr % align;
532 +
533 + if (r == 0)
534 + return (char *)ptr;
535 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
536 +index 58e14d3040f03..870dd78d5a21a 100644
537 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
538 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
539 +@@ -1976,7 +1976,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
540 + unsigned i;
541 + int r;
542 +
543 +- if (direct_submit && !ring->sched.ready) {
544 ++ if (!direct_submit && !ring->sched.ready) {
545 + DRM_ERROR("Trying to move memory with ring turned off.\n");
546 + return -EINVAL;
547 + }
548 +diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
549 +index cc8f32a1b03c6..92ffed5c1d690 100644
550 +--- a/drivers/gpu/drm/radeon/atombios_encoders.c
551 ++++ b/drivers/gpu/drm/radeon/atombios_encoders.c
552 +@@ -197,7 +197,8 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
553 + * so don't register a backlight device
554 + */
555 + if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&
556 +- (rdev->pdev->device == 0x6741))
557 ++ (rdev->pdev->device == 0x6741) &&
558 ++ !dmi_match(DMI_PRODUCT_NAME, "iMac12,1"))
559 + return;
560 +
561 + if (!radeon_encoder->enc_priv)
562 +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
563 +index 906891b03a38d..7805091bac32d 100644
564 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
565 ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
566 +@@ -528,13 +528,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
567 + return ret;
568 + }
569 +
570 +- ret = clk_prepare_enable(hdmi->vpll_clk);
571 +- if (ret) {
572 +- DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
573 +- ret);
574 +- return ret;
575 +- }
576 +-
577 + hdmi->phy = devm_phy_optional_get(dev, "hdmi");
578 + if (IS_ERR(hdmi->phy)) {
579 + ret = PTR_ERR(hdmi->phy);
580 +@@ -543,6 +536,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
581 + return ret;
582 + }
583 +
584 ++ ret = clk_prepare_enable(hdmi->vpll_clk);
585 ++ if (ret) {
586 ++ DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
587 ++ ret);
588 ++ return ret;
589 ++ }
590 ++
591 + drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
592 + drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
593 + DRM_MODE_ENCODER_TMDS, NULL);
594 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
595 +index 26758ea844c92..c587a77d493c1 100644
596 +--- a/drivers/hid/hid-ids.h
597 ++++ b/drivers/hid/hid-ids.h
598 +@@ -1311,6 +1311,7 @@
599 + #define USB_VENDOR_ID_UGTIZER 0x2179
600 + #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053
601 + #define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077
602 ++#define USB_DEVICE_ID_UGTIZER_TABLET_WP5540 0x0004
603 +
604 + #define USB_VENDOR_ID_VIEWSONIC 0x0543
605 + #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621
606 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
607 +index 8a0132c54c312..45eba224cdc77 100644
608 +--- a/drivers/hid/hid-quirks.c
609 ++++ b/drivers/hid/hid-quirks.c
610 +@@ -187,6 +187,7 @@ static const struct hid_device_id hid_quirks[] = {
611 + { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET },
612 + { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT },
613 + { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
614 ++ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_WP5540), HID_QUIRK_MULTI_INPUT },
615 + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT },
616 + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT },
617 + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
618 +diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
619 +index 2d2568dac2a66..6b7ab8f234e87 100644
620 +--- a/drivers/hv/vmbus_drv.c
621 ++++ b/drivers/hv/vmbus_drv.c
622 +@@ -1787,8 +1787,10 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel)
623 + kobj->kset = dev->channels_kset;
624 + ret = kobject_init_and_add(kobj, &vmbus_chan_ktype, NULL,
625 + "%u", relid);
626 +- if (ret)
627 ++ if (ret) {
628 ++ kobject_put(kobj);
629 + return ret;
630 ++ }
631 +
632 + ret = sysfs_create_group(kobj, &vmbus_chan_group);
633 +
634 +@@ -1797,6 +1799,7 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel)
635 + * The calling functions' error handling paths will cleanup the
636 + * empty channel directory.
637 + */
638 ++ kobject_put(kobj);
639 + dev_err(device, "Unable to set up channel sysfs files\n");
640 + return ret;
641 + }
642 +diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
643 +index 5e89cd6b690ce..36b8aceb972fc 100644
644 +--- a/drivers/i2c/busses/i2c-brcmstb.c
645 ++++ b/drivers/i2c/busses/i2c-brcmstb.c
646 +@@ -640,7 +640,7 @@ static int brcmstb_i2c_probe(struct platform_device *pdev)
647 +
648 + /* set the data in/out register size for compatible SoCs */
649 + if (of_device_is_compatible(dev->device->of_node,
650 +- "brcmstb,brcmper-i2c"))
651 ++ "brcm,brcmper-i2c"))
652 + dev->data_regsz = sizeof(u8);
653 + else
654 + dev->data_regsz = sizeof(u32);
655 +diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
656 +index 7cd7b140dfe97..9dad45d928bfe 100644
657 +--- a/drivers/irqchip/irq-sifive-plic.c
658 ++++ b/drivers/irqchip/irq-sifive-plic.c
659 +@@ -313,3 +313,4 @@ out_iounmap:
660 +
661 + IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init);
662 + IRQCHIP_DECLARE(riscv_plic0, "riscv,plic0", plic_init); /* for legacy systems */
663 ++IRQCHIP_DECLARE(thead_c900_plic, "thead,c900-plic", plic_init); /* for firmware driver */
664 +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
665 +index e92f9373e2274..362ad361d5861 100644
666 +--- a/drivers/mmc/core/block.c
667 ++++ b/drivers/mmc/core/block.c
668 +@@ -1671,31 +1671,31 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req)
669 + struct mmc_card *card = mq->card;
670 + struct mmc_host *host = card->host;
671 + blk_status_t error = BLK_STS_OK;
672 +- int retries = 0;
673 +
674 + do {
675 + u32 status;
676 + int err;
677 ++ int retries = 0;
678 +
679 +- mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
680 ++ while (retries++ <= MMC_READ_SINGLE_RETRIES) {
681 ++ mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
682 +
683 +- mmc_wait_for_req(host, mrq);
684 ++ mmc_wait_for_req(host, mrq);
685 +
686 +- err = mmc_send_status(card, &status);
687 +- if (err)
688 +- goto error_exit;
689 +-
690 +- if (!mmc_host_is_spi(host) &&
691 +- !mmc_blk_in_tran_state(status)) {
692 +- err = mmc_blk_fix_state(card, req);
693 ++ err = mmc_send_status(card, &status);
694 + if (err)
695 + goto error_exit;
696 +- }
697 +
698 +- if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES)
699 +- continue;
700 ++ if (!mmc_host_is_spi(host) &&
701 ++ !mmc_blk_in_tran_state(status)) {
702 ++ err = mmc_blk_fix_state(card, req);
703 ++ if (err)
704 ++ goto error_exit;
705 ++ }
706 +
707 +- retries = 0;
708 ++ if (!mrq->cmd->error)
709 ++ break;
710 ++ }
711 +
712 + if (mrq->cmd->error ||
713 + mrq->data->error ||
714 +diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
715 +index 0f3c09fb9c34f..bd9f45edc9a34 100644
716 +--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
717 ++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
718 +@@ -1756,7 +1756,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip,
719 + mtd->oobsize / trans,
720 + host->hwcfg.sector_size_1k);
721 +
722 +- if (!ret) {
723 ++ if (ret != -EBADMSG) {
724 + *err_addr = brcmnand_get_uncorrecc_addr(ctrl);
725 +
726 + if (*err_addr)
727 +diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
728 +index 515094e253dcd..ab2f824abf549 100644
729 +--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
730 ++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
731 +@@ -2442,7 +2442,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
732 + this->hw.must_apply_timings = false;
733 + ret = gpmi_nfc_apply_timings(this);
734 + if (ret)
735 +- return ret;
736 ++ goto out_pm;
737 + }
738 +
739 + dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
740 +@@ -2571,6 +2571,7 @@ unmap:
741 +
742 + this->bch = false;
743 +
744 ++out_pm:
745 + pm_runtime_mark_last_busy(this->dev);
746 + pm_runtime_put_autosuspend(this->dev);
747 +
748 +diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
749 +index c10995ca624a6..5af3bef6c2303 100644
750 +--- a/drivers/mtd/nand/raw/qcom_nandc.c
751 ++++ b/drivers/mtd/nand/raw/qcom_nandc.c
752 +@@ -2,7 +2,6 @@
753 + /*
754 + * Copyright (c) 2016, The Linux Foundation. All rights reserved.
755 + */
756 +-
757 + #include <linux/clk.h>
758 + #include <linux/slab.h>
759 + #include <linux/bitops.h>
760 +@@ -2944,10 +2943,6 @@ static int qcom_nandc_probe(struct platform_device *pdev)
761 + if (!nandc->base_dma)
762 + return -ENXIO;
763 +
764 +- ret = qcom_nandc_alloc(nandc);
765 +- if (ret)
766 +- goto err_nandc_alloc;
767 +-
768 + ret = clk_prepare_enable(nandc->core_clk);
769 + if (ret)
770 + goto err_core_clk;
771 +@@ -2956,6 +2951,10 @@ static int qcom_nandc_probe(struct platform_device *pdev)
772 + if (ret)
773 + goto err_aon_clk;
774 +
775 ++ ret = qcom_nandc_alloc(nandc);
776 ++ if (ret)
777 ++ goto err_nandc_alloc;
778 ++
779 + ret = qcom_nandc_setup(nandc);
780 + if (ret)
781 + goto err_setup;
782 +@@ -2967,15 +2966,14 @@ static int qcom_nandc_probe(struct platform_device *pdev)
783 + return 0;
784 +
785 + err_setup:
786 ++ qcom_nandc_unalloc(nandc);
787 ++err_nandc_alloc:
788 + clk_disable_unprepare(nandc->aon_clk);
789 + err_aon_clk:
790 + clk_disable_unprepare(nandc->core_clk);
791 + err_core_clk:
792 +- qcom_nandc_unalloc(nandc);
793 +-err_nandc_alloc:
794 + dma_unmap_resource(dev, res->start, resource_size(res),
795 + DMA_BIDIRECTIONAL, 0);
796 +-
797 + return ret;
798 + }
799 +
800 +diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
801 +index ed170d803247a..41e58bd2e6069 100644
802 +--- a/drivers/net/bonding/bond_3ad.c
803 ++++ b/drivers/net/bonding/bond_3ad.c
804 +@@ -233,7 +233,7 @@ static inline int __check_agg_selection_timer(struct port *port)
805 + if (bond == NULL)
806 + return 0;
807 +
808 +- return BOND_AD_INFO(bond).agg_select_timer ? 1 : 0;
809 ++ return atomic_read(&BOND_AD_INFO(bond).agg_select_timer) ? 1 : 0;
810 + }
811 +
812 + /**
813 +@@ -1985,7 +1985,7 @@ static void ad_marker_response_received(struct bond_marker *marker,
814 + */
815 + void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout)
816 + {
817 +- BOND_AD_INFO(bond).agg_select_timer = timeout;
818 ++ atomic_set(&BOND_AD_INFO(bond).agg_select_timer, timeout);
819 + }
820 +
821 + /**
822 +@@ -2268,6 +2268,28 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond)
823 + spin_unlock_bh(&bond->mode_lock);
824 + }
825 +
826 ++/**
827 ++ * bond_agg_timer_advance - advance agg_select_timer
828 ++ * @bond: bonding structure
829 ++ *
830 ++ * Return true when agg_select_timer reaches 0.
831 ++ */
832 ++static bool bond_agg_timer_advance(struct bonding *bond)
833 ++{
834 ++ int val, nval;
835 ++
836 ++ while (1) {
837 ++ val = atomic_read(&BOND_AD_INFO(bond).agg_select_timer);
838 ++ if (!val)
839 ++ return false;
840 ++ nval = val - 1;
841 ++ if (atomic_cmpxchg(&BOND_AD_INFO(bond).agg_select_timer,
842 ++ val, nval) == val)
843 ++ break;
844 ++ }
845 ++ return nval == 0;
846 ++}
847 ++
848 + /**
849 + * bond_3ad_state_machine_handler - handle state machines timeout
850 + * @bond: bonding struct to work on
851 +@@ -2303,9 +2325,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
852 + if (!bond_has_slaves(bond))
853 + goto re_arm;
854 +
855 +- /* check if agg_select_timer timer after initialize is timed out */
856 +- if (BOND_AD_INFO(bond).agg_select_timer &&
857 +- !(--BOND_AD_INFO(bond).agg_select_timer)) {
858 ++ if (bond_agg_timer_advance(bond)) {
859 + slave = bond_first_slave_rcu(bond);
860 + port = slave ? &(SLAVE_AD_INFO(slave)->port) : NULL;
861 +
862 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
863 +index ff50ccc7dceb1..d6ecd03b60452 100644
864 +--- a/drivers/net/bonding/bond_main.c
865 ++++ b/drivers/net/bonding/bond_main.c
866 +@@ -1979,10 +1979,9 @@ static int __bond_release_one(struct net_device *bond_dev,
867 + bond_select_active_slave(bond);
868 + }
869 +
870 +- if (!bond_has_slaves(bond)) {
871 +- bond_set_carrier(bond);
872 ++ bond_set_carrier(bond);
873 ++ if (!bond_has_slaves(bond))
874 + eth_hw_addr_random(bond_dev);
875 +- }
876 +
877 + unblock_netpoll_tx();
878 + synchronize_rcu();
879 +diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
880 +index 19d1f1c51f97e..4b9d5b0ce416b 100644
881 +--- a/drivers/net/dsa/lan9303-core.c
882 ++++ b/drivers/net/dsa/lan9303-core.c
883 +@@ -1303,7 +1303,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip,
884 + struct device_node *np)
885 + {
886 + chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
887 +- GPIOD_OUT_LOW);
888 ++ GPIOD_OUT_HIGH);
889 + if (IS_ERR(chip->reset_gpio))
890 + return PTR_ERR(chip->reset_gpio);
891 +
892 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
893 +index ebd0853a6f313..0dc52cf5367e7 100644
894 +--- a/drivers/net/ethernet/cadence/macb_main.c
895 ++++ b/drivers/net/ethernet/cadence/macb_main.c
896 +@@ -4284,7 +4284,7 @@ static int macb_probe(struct platform_device *pdev)
897 +
898 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
899 + if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) {
900 +- dma_set_mask(&pdev->dev, DMA_BIT_MASK(44));
901 ++ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
902 + bp->hw_dma_cap |= HW_DMA_CAP_64B;
903 + }
904 + #endif
905 +diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
906 +index 7d67f41387f55..4f5ef8a9a9a87 100644
907 +--- a/drivers/net/ieee802154/at86rf230.c
908 ++++ b/drivers/net/ieee802154/at86rf230.c
909 +@@ -100,6 +100,7 @@ struct at86rf230_local {
910 + unsigned long cal_timeout;
911 + bool is_tx;
912 + bool is_tx_from_off;
913 ++ bool was_tx;
914 + u8 tx_retry;
915 + struct sk_buff *tx_skb;
916 + struct at86rf230_state_change tx;
917 +@@ -343,7 +344,11 @@ at86rf230_async_error_recover_complete(void *context)
918 + if (ctx->free)
919 + kfree(ctx);
920 +
921 +- ieee802154_wake_queue(lp->hw);
922 ++ if (lp->was_tx) {
923 ++ lp->was_tx = 0;
924 ++ dev_kfree_skb_any(lp->tx_skb);
925 ++ ieee802154_wake_queue(lp->hw);
926 ++ }
927 + }
928 +
929 + static void
930 +@@ -352,7 +357,11 @@ at86rf230_async_error_recover(void *context)
931 + struct at86rf230_state_change *ctx = context;
932 + struct at86rf230_local *lp = ctx->lp;
933 +
934 +- lp->is_tx = 0;
935 ++ if (lp->is_tx) {
936 ++ lp->was_tx = 1;
937 ++ lp->is_tx = 0;
938 ++ }
939 ++
940 + at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,
941 + at86rf230_async_error_recover_complete);
942 + }
943 +diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
944 +index 7c131a423cafa..47959aadbc503 100644
945 +--- a/drivers/net/ieee802154/ca8210.c
946 ++++ b/drivers/net/ieee802154/ca8210.c
947 +@@ -2976,8 +2976,8 @@ static void ca8210_hw_setup(struct ieee802154_hw *ca8210_hw)
948 + ca8210_hw->phy->cca.opt = NL802154_CCA_OPT_ENERGY_CARRIER_AND;
949 + ca8210_hw->phy->cca_ed_level = -9800;
950 + ca8210_hw->phy->symbol_duration = 16;
951 +- ca8210_hw->phy->lifs_period = 40;
952 +- ca8210_hw->phy->sifs_period = 12;
953 ++ ca8210_hw->phy->lifs_period = 40 * ca8210_hw->phy->symbol_duration;
954 ++ ca8210_hw->phy->sifs_period = 12 * ca8210_hw->phy->symbol_duration;
955 + ca8210_hw->flags =
956 + IEEE802154_HW_AFILT |
957 + IEEE802154_HW_OMIT_CKSUM |
958 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
959 +index 6508d70056b3a..566ea48fd6078 100644
960 +--- a/drivers/net/usb/qmi_wwan.c
961 ++++ b/drivers/net/usb/qmi_wwan.c
962 +@@ -1355,6 +1355,8 @@ static const struct usb_device_id products[] = {
963 + {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
964 + {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */
965 + {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
966 ++ {QMI_FIXED_INTF(0x413c, 0x81e4, 0)}, /* Dell Wireless 5829e with eSIM support*/
967 ++ {QMI_FIXED_INTF(0x413c, 0x81e6, 0)}, /* Dell Wireless 5829e */
968 + {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
969 + {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
970 + {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
971 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
972 +index 83cb2ad03451b..1848b957dc5cd 100644
973 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
974 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
975 +@@ -1616,6 +1616,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
976 + out_unbind:
977 + complete(&drv->request_firmware_complete);
978 + device_release_driver(drv->trans->dev);
979 ++ /* drv has just been freed by the release */
980 ++ failure = false;
981 + free:
982 + if (failure)
983 + iwl_dealloc_ucode(drv);
984 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
985 +index ee45e475405a1..fba6fff13349e 100644
986 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
987 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
988 +@@ -292,8 +292,7 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans,
989 + /* This may fail if AMT took ownership of the device */
990 + if (iwl_pcie_prepare_card_hw(trans)) {
991 + IWL_WARN(trans, "Exit HW not ready\n");
992 +- ret = -EIO;
993 +- goto out;
994 ++ return -EIO;
995 + }
996 +
997 + iwl_enable_rfkill_int(trans);
998 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
999 +index 0581f082301e0..8915030030c4c 100644
1000 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1001 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1002 +@@ -1335,8 +1335,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
1003 + /* This may fail if AMT took ownership of the device */
1004 + if (iwl_pcie_prepare_card_hw(trans)) {
1005 + IWL_WARN(trans, "Exit HW not ready\n");
1006 +- ret = -EIO;
1007 +- goto out;
1008 ++ return -EIO;
1009 + }
1010 +
1011 + iwl_enable_rfkill_int(trans);
1012 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
1013 +index a5b5a2305791d..6a9a42809f972 100644
1014 +--- a/drivers/nvme/host/core.c
1015 ++++ b/drivers/nvme/host/core.c
1016 +@@ -3896,7 +3896,14 @@ static void nvme_async_event_work(struct work_struct *work)
1017 + container_of(work, struct nvme_ctrl, async_event_work);
1018 +
1019 + nvme_aen_uevent(ctrl);
1020 +- ctrl->ops->submit_async_event(ctrl);
1021 ++
1022 ++ /*
1023 ++ * The transport drivers must guarantee AER submission here is safe by
1024 ++ * flushing ctrl async_event_work after changing the controller state
1025 ++ * from LIVE and before freeing the admin queue.
1026 ++ */
1027 ++ if (ctrl->state == NVME_CTRL_LIVE)
1028 ++ ctrl->ops->submit_async_event(ctrl);
1029 + }
1030 +
1031 + static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
1032 +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
1033 +index 08a23bb4b8b57..4213c71b02a4b 100644
1034 +--- a/drivers/nvme/host/rdma.c
1035 ++++ b/drivers/nvme/host/rdma.c
1036 +@@ -1110,6 +1110,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
1037 + struct nvme_rdma_ctrl, err_work);
1038 +
1039 + nvme_stop_keep_alive(&ctrl->ctrl);
1040 ++ flush_work(&ctrl->ctrl.async_event_work);
1041 + nvme_rdma_teardown_io_queues(ctrl, false);
1042 + nvme_start_queues(&ctrl->ctrl);
1043 + nvme_rdma_teardown_admin_queue(ctrl, false);
1044 +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
1045 +index 1eef7ed0c3026..4378344f0e7ab 100644
1046 +--- a/drivers/nvme/host/tcp.c
1047 ++++ b/drivers/nvme/host/tcp.c
1048 +@@ -1955,6 +1955,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work)
1049 + struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl;
1050 +
1051 + nvme_stop_keep_alive(ctrl);
1052 ++ flush_work(&ctrl->async_event_work);
1053 + nvme_tcp_teardown_io_queues(ctrl, false);
1054 + /* unquiesce to fail fast pending requests */
1055 + nvme_start_queues(ctrl);
1056 +diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
1057 +index ad290f79983b9..5013568c571e5 100644
1058 +--- a/drivers/parisc/ccio-dma.c
1059 ++++ b/drivers/parisc/ccio-dma.c
1060 +@@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1061 + ioc->usg_calls++;
1062 + #endif
1063 +
1064 +- while(sg_dma_len(sglist) && nents--) {
1065 ++ while (nents && sg_dma_len(sglist)) {
1066 +
1067 + #ifdef CCIO_COLLECT_STATS
1068 + ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
1069 +@@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1070 + ccio_unmap_page(dev, sg_dma_address(sglist),
1071 + sg_dma_len(sglist), direction, 0);
1072 + ++sglist;
1073 ++ nents--;
1074 + }
1075 +
1076 + DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
1077 +diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
1078 +index e410033b6df0c..822e5d19949e4 100644
1079 +--- a/drivers/parisc/sba_iommu.c
1080 ++++ b/drivers/parisc/sba_iommu.c
1081 +@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1082 + spin_unlock_irqrestore(&ioc->res_lock, flags);
1083 + #endif
1084 +
1085 +- while (sg_dma_len(sglist) && nents--) {
1086 ++ while (nents && sg_dma_len(sglist)) {
1087 +
1088 + sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist),
1089 + direction, 0);
1090 +@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
1091 + ioc->usingle_calls--; /* kluge since call is unmap_sg() */
1092 + #endif
1093 + ++sglist;
1094 ++ nents--;
1095 + }
1096 +
1097 + DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
1098 +diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_common.c b/drivers/platform/x86/intel_speed_select_if/isst_if_common.c
1099 +index 3de5a3c66529d..cf7b6dee82191 100644
1100 +--- a/drivers/platform/x86/intel_speed_select_if/isst_if_common.c
1101 ++++ b/drivers/platform/x86/intel_speed_select_if/isst_if_common.c
1102 +@@ -529,7 +529,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
1103 + return ret;
1104 + }
1105 +
1106 +-static DEFINE_MUTEX(punit_misc_dev_lock);
1107 ++/* Lock to prevent module registration when already opened by user space */
1108 ++static DEFINE_MUTEX(punit_misc_dev_open_lock);
1109 ++/* Lock to allow one share misc device for all ISST interace */
1110 ++static DEFINE_MUTEX(punit_misc_dev_reg_lock);
1111 + static int misc_usage_count;
1112 + static int misc_device_ret;
1113 + static int misc_device_open;
1114 +@@ -539,7 +542,7 @@ static int isst_if_open(struct inode *inode, struct file *file)
1115 + int i, ret = 0;
1116 +
1117 + /* Fail open, if a module is going away */
1118 +- mutex_lock(&punit_misc_dev_lock);
1119 ++ mutex_lock(&punit_misc_dev_open_lock);
1120 + for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
1121 + struct isst_if_cmd_cb *cb = &punit_callbacks[i];
1122 +
1123 +@@ -561,7 +564,7 @@ static int isst_if_open(struct inode *inode, struct file *file)
1124 + } else {
1125 + misc_device_open++;
1126 + }
1127 +- mutex_unlock(&punit_misc_dev_lock);
1128 ++ mutex_unlock(&punit_misc_dev_open_lock);
1129 +
1130 + return ret;
1131 + }
1132 +@@ -570,7 +573,7 @@ static int isst_if_relase(struct inode *inode, struct file *f)
1133 + {
1134 + int i;
1135 +
1136 +- mutex_lock(&punit_misc_dev_lock);
1137 ++ mutex_lock(&punit_misc_dev_open_lock);
1138 + misc_device_open--;
1139 + for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
1140 + struct isst_if_cmd_cb *cb = &punit_callbacks[i];
1141 +@@ -578,7 +581,7 @@ static int isst_if_relase(struct inode *inode, struct file *f)
1142 + if (cb->registered)
1143 + module_put(cb->owner);
1144 + }
1145 +- mutex_unlock(&punit_misc_dev_lock);
1146 ++ mutex_unlock(&punit_misc_dev_open_lock);
1147 +
1148 + return 0;
1149 + }
1150 +@@ -595,6 +598,43 @@ static struct miscdevice isst_if_char_driver = {
1151 + .fops = &isst_if_char_driver_ops,
1152 + };
1153 +
1154 ++static int isst_misc_reg(void)
1155 ++{
1156 ++ mutex_lock(&punit_misc_dev_reg_lock);
1157 ++ if (misc_device_ret)
1158 ++ goto unlock_exit;
1159 ++
1160 ++ if (!misc_usage_count) {
1161 ++ misc_device_ret = isst_if_cpu_info_init();
1162 ++ if (misc_device_ret)
1163 ++ goto unlock_exit;
1164 ++
1165 ++ misc_device_ret = misc_register(&isst_if_char_driver);
1166 ++ if (misc_device_ret) {
1167 ++ isst_if_cpu_info_exit();
1168 ++ goto unlock_exit;
1169 ++ }
1170 ++ }
1171 ++ misc_usage_count++;
1172 ++
1173 ++unlock_exit:
1174 ++ mutex_unlock(&punit_misc_dev_reg_lock);
1175 ++
1176 ++ return misc_device_ret;
1177 ++}
1178 ++
1179 ++static void isst_misc_unreg(void)
1180 ++{
1181 ++ mutex_lock(&punit_misc_dev_reg_lock);
1182 ++ if (misc_usage_count)
1183 ++ misc_usage_count--;
1184 ++ if (!misc_usage_count && !misc_device_ret) {
1185 ++ misc_deregister(&isst_if_char_driver);
1186 ++ isst_if_cpu_info_exit();
1187 ++ }
1188 ++ mutex_unlock(&punit_misc_dev_reg_lock);
1189 ++}
1190 ++
1191 + /**
1192 + * isst_if_cdev_register() - Register callback for IOCTL
1193 + * @device_type: The device type this callback handling.
1194 +@@ -612,38 +652,31 @@ static struct miscdevice isst_if_char_driver = {
1195 + */
1196 + int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
1197 + {
1198 +- if (misc_device_ret)
1199 +- return misc_device_ret;
1200 ++ int ret;
1201 +
1202 + if (device_type >= ISST_IF_DEV_MAX)
1203 + return -EINVAL;
1204 +
1205 +- mutex_lock(&punit_misc_dev_lock);
1206 ++ mutex_lock(&punit_misc_dev_open_lock);
1207 ++ /* Device is already open, we don't want to add new callbacks */
1208 + if (misc_device_open) {
1209 +- mutex_unlock(&punit_misc_dev_lock);
1210 ++ mutex_unlock(&punit_misc_dev_open_lock);
1211 + return -EAGAIN;
1212 + }
1213 +- if (!misc_usage_count) {
1214 +- int ret;
1215 +-
1216 +- misc_device_ret = misc_register(&isst_if_char_driver);
1217 +- if (misc_device_ret)
1218 +- goto unlock_exit;
1219 +-
1220 +- ret = isst_if_cpu_info_init();
1221 +- if (ret) {
1222 +- misc_deregister(&isst_if_char_driver);
1223 +- misc_device_ret = ret;
1224 +- goto unlock_exit;
1225 +- }
1226 +- }
1227 + memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
1228 + punit_callbacks[device_type].registered = 1;
1229 +- misc_usage_count++;
1230 +-unlock_exit:
1231 +- mutex_unlock(&punit_misc_dev_lock);
1232 ++ mutex_unlock(&punit_misc_dev_open_lock);
1233 +
1234 +- return misc_device_ret;
1235 ++ ret = isst_misc_reg();
1236 ++ if (ret) {
1237 ++ /*
1238 ++ * No need of mutex as the misc device register failed
1239 ++ * as no one can open device yet. Hence no contention.
1240 ++ */
1241 ++ punit_callbacks[device_type].registered = 0;
1242 ++ return ret;
1243 ++ }
1244 ++ return 0;
1245 + }
1246 + EXPORT_SYMBOL_GPL(isst_if_cdev_register);
1247 +
1248 +@@ -658,16 +691,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register);
1249 + */
1250 + void isst_if_cdev_unregister(int device_type)
1251 + {
1252 +- mutex_lock(&punit_misc_dev_lock);
1253 +- misc_usage_count--;
1254 ++ isst_misc_unreg();
1255 ++ mutex_lock(&punit_misc_dev_open_lock);
1256 + punit_callbacks[device_type].registered = 0;
1257 + if (device_type == ISST_IF_DEV_MBOX)
1258 + isst_delete_hash();
1259 +- if (!misc_usage_count && !misc_device_ret) {
1260 +- misc_deregister(&isst_if_char_driver);
1261 +- isst_if_cpu_info_exit();
1262 +- }
1263 +- mutex_unlock(&punit_misc_dev_lock);
1264 ++ mutex_unlock(&punit_misc_dev_open_lock);
1265 + }
1266 + EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
1267 +
1268 +diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
1269 +index 1bf7a4152b34b..088b764aefa43 100644
1270 +--- a/drivers/scsi/lpfc/lpfc.h
1271 ++++ b/drivers/scsi/lpfc/lpfc.h
1272 +@@ -377,6 +377,7 @@ struct lpfc_vport {
1273 + #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */
1274 + #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */
1275 + #define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/
1276 ++#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */
1277 + #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
1278 + #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
1279 + #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
1280 +diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
1281 +index d034fe78bf93e..1e59c60a9dcc3 100644
1282 +--- a/drivers/scsi/lpfc/lpfc_attr.c
1283 ++++ b/drivers/scsi/lpfc/lpfc_attr.c
1284 +@@ -1145,6 +1145,9 @@ lpfc_issue_lip(struct Scsi_Host *shost)
1285 + pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK;
1286 + pmboxq->u.mb.mbxOwner = OWN_HOST;
1287 +
1288 ++ if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME))
1289 ++ vport->fc_flag &= ~FC_PT2PT_NO_NVME;
1290 ++
1291 + mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2);
1292 +
1293 + if ((mbxstatus == MBX_SUCCESS) &&
1294 +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
1295 +index 2040affa08874..9951d63a8b493 100644
1296 +--- a/drivers/scsi/lpfc/lpfc_els.c
1297 ++++ b/drivers/scsi/lpfc/lpfc_els.c
1298 +@@ -1066,7 +1066,8 @@ stop_rr_fcf_flogi:
1299 +
1300 + /* FLOGI failed, so there is no fabric */
1301 + spin_lock_irq(shost->host_lock);
1302 +- vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
1303 ++ vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP |
1304 ++ FC_PT2PT_NO_NVME);
1305 + spin_unlock_irq(shost->host_lock);
1306 +
1307 + /* If private loop, then allow max outstanding els to be
1308 +@@ -3740,6 +3741,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1309 + /* Added for Vendor specifc support
1310 + * Just keep retrying for these Rsn / Exp codes
1311 + */
1312 ++ if ((vport->fc_flag & FC_PT2PT) &&
1313 ++ cmd == ELS_CMD_NVMEPRLI) {
1314 ++ switch (stat.un.b.lsRjtRsnCode) {
1315 ++ case LSRJT_UNABLE_TPC:
1316 ++ case LSRJT_INVALID_CMD:
1317 ++ case LSRJT_LOGICAL_ERR:
1318 ++ case LSRJT_CMD_UNSUPPORTED:
1319 ++ lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS,
1320 ++ "0168 NVME PRLI LS_RJT "
1321 ++ "reason %x port doesn't "
1322 ++ "support NVME, disabling NVME\n",
1323 ++ stat.un.b.lsRjtRsnCode);
1324 ++ retry = 0;
1325 ++ vport->fc_flag |= FC_PT2PT_NO_NVME;
1326 ++ goto out_retry;
1327 ++ }
1328 ++ }
1329 + switch (stat.un.b.lsRjtRsnCode) {
1330 + case LSRJT_UNABLE_TPC:
1331 + /* The driver has a VALID PLOGI but the rport has
1332 +diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
1333 +index fdd87508c804d..df2f7c3d7f845 100644
1334 +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
1335 ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
1336 +@@ -1987,8 +1987,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
1337 + * is configured try it.
1338 + */
1339 + ndlp->nlp_fc4_type |= NLP_FC4_FCP;
1340 +- if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
1341 +- (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
1342 ++ if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) &&
1343 ++ (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
1344 ++ vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
1345 + ndlp->nlp_fc4_type |= NLP_FC4_NVME;
1346 + /* We need to update the localport also */
1347 + lpfc_nvme_update_localport(vport);
1348 +diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c
1349 +index 0809ae2aa9b14..51cc985216ff3 100644
1350 +--- a/drivers/tty/serial/8250/8250_gsc.c
1351 ++++ b/drivers/tty/serial/8250/8250_gsc.c
1352 +@@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev)
1353 + unsigned long address;
1354 + int err;
1355 +
1356 +-#ifdef CONFIG_64BIT
1357 ++#if defined(CONFIG_64BIT) && defined(CONFIG_IOSAPIC)
1358 + if (!dev->irq && (dev->id.sversion == 0xad))
1359 + dev->irq = iosapic_serial_irq(dev);
1360 + #endif
1361 +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
1362 +index fc688af57c231..e258fc484cea2 100644
1363 +--- a/fs/btrfs/send.c
1364 ++++ b/fs/btrfs/send.c
1365 +@@ -5005,6 +5005,10 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len)
1366 + lock_page(page);
1367 + if (!PageUptodate(page)) {
1368 + unlock_page(page);
1369 ++ btrfs_err(fs_info,
1370 ++ "send: IO error at offset %llu for inode %llu root %llu",
1371 ++ page_offset(page), sctx->cur_ino,
1372 ++ sctx->send_root->root_key.objectid);
1373 + put_page(page);
1374 + ret = -EIO;
1375 + break;
1376 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
1377 +index ae73e67936832..f1bbce4350c47 100644
1378 +--- a/fs/ext4/extents.c
1379 ++++ b/fs/ext4/extents.c
1380 +@@ -133,14 +133,25 @@ static int ext4_ext_truncate_extend_restart(handle_t *handle,
1381 + static int ext4_ext_get_access(handle_t *handle, struct inode *inode,
1382 + struct ext4_ext_path *path)
1383 + {
1384 ++ int err = 0;
1385 ++
1386 + if (path->p_bh) {
1387 + /* path points to block */
1388 + BUFFER_TRACE(path->p_bh, "get_write_access");
1389 +- return ext4_journal_get_write_access(handle, path->p_bh);
1390 ++ err = ext4_journal_get_write_access(handle, path->p_bh);
1391 ++
1392 ++ /*
1393 ++ * The extent buffer's verified bit will be set again in
1394 ++ * __ext4_ext_dirty(). We could leave an inconsistent
1395 ++ * buffer if the extents updating procudure break off du
1396 ++ * to some error happens, force to check it again.
1397 ++ */
1398 ++ if (!err)
1399 ++ clear_buffer_verified(path->p_bh);
1400 + }
1401 + /* path points to leaf/index in inode body */
1402 + /* we use in-core data, no need to protect them */
1403 +- return 0;
1404 ++ return err;
1405 + }
1406 +
1407 + /*
1408 +@@ -160,6 +171,9 @@ int __ext4_ext_dirty(const char *where, unsigned int line, handle_t *handle,
1409 + /* path points to block */
1410 + err = __ext4_handle_dirty_metadata(where, line, handle,
1411 + inode, path->p_bh);
1412 ++ /* Extents updating done, re-set verified flag */
1413 ++ if (!err)
1414 ++ set_buffer_verified(path->p_bh);
1415 + } else {
1416 + /* path points to leaf/index in inode body */
1417 + err = ext4_mark_inode_dirty(handle, inode);
1418 +@@ -390,9 +404,13 @@ static int ext4_valid_extent_idx(struct inode *inode,
1419 +
1420 + static int ext4_valid_extent_entries(struct inode *inode,
1421 + struct ext4_extent_header *eh,
1422 ++ ext4_lblk_t lblk, ext4_fsblk_t *pblk,
1423 + int depth)
1424 + {
1425 + unsigned short entries;
1426 ++ ext4_lblk_t lblock = 0;
1427 ++ ext4_lblk_t prev = 0;
1428 ++
1429 + if (eh->eh_entries == 0)
1430 + return 1;
1431 +
1432 +@@ -403,32 +421,52 @@ static int ext4_valid_extent_entries(struct inode *inode,
1433 + struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
1434 + struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
1435 + ext4_fsblk_t pblock = 0;
1436 +- ext4_lblk_t lblock = 0;
1437 +- ext4_lblk_t prev = 0;
1438 +- int len = 0;
1439 ++
1440 ++ /*
1441 ++ * The logical block in the first entry should equal to
1442 ++ * the number in the index block.
1443 ++ */
1444 ++ if (depth != ext_depth(inode) &&
1445 ++ lblk != le32_to_cpu(ext->ee_block))
1446 ++ return 0;
1447 + while (entries) {
1448 + if (!ext4_valid_extent(inode, ext))
1449 + return 0;
1450 +
1451 + /* Check for overlapping extents */
1452 + lblock = le32_to_cpu(ext->ee_block);
1453 +- len = ext4_ext_get_actual_len(ext);
1454 + if ((lblock <= prev) && prev) {
1455 + pblock = ext4_ext_pblock(ext);
1456 + es->s_last_error_block = cpu_to_le64(pblock);
1457 + return 0;
1458 + }
1459 ++ prev = lblock + ext4_ext_get_actual_len(ext) - 1;
1460 + ext++;
1461 + entries--;
1462 +- prev = lblock + len - 1;
1463 + }
1464 + } else {
1465 + struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
1466 ++
1467 ++ /*
1468 ++ * The logical block in the first entry should equal to
1469 ++ * the number in the parent index block.
1470 ++ */
1471 ++ if (depth != ext_depth(inode) &&
1472 ++ lblk != le32_to_cpu(ext_idx->ei_block))
1473 ++ return 0;
1474 + while (entries) {
1475 + if (!ext4_valid_extent_idx(inode, ext_idx))
1476 + return 0;
1477 ++
1478 ++ /* Check for overlapping index extents */
1479 ++ lblock = le32_to_cpu(ext_idx->ei_block);
1480 ++ if ((lblock <= prev) && prev) {
1481 ++ *pblk = ext4_idx_pblock(ext_idx);
1482 ++ return 0;
1483 ++ }
1484 + ext_idx++;
1485 + entries--;
1486 ++ prev = lblock;
1487 + }
1488 + }
1489 + return 1;
1490 +@@ -436,7 +474,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
1491 +
1492 + static int __ext4_ext_check(const char *function, unsigned int line,
1493 + struct inode *inode, struct ext4_extent_header *eh,
1494 +- int depth, ext4_fsblk_t pblk)
1495 ++ int depth, ext4_fsblk_t pblk, ext4_lblk_t lblk)
1496 + {
1497 + const char *error_msg;
1498 + int max = 0, err = -EFSCORRUPTED;
1499 +@@ -462,7 +500,7 @@ static int __ext4_ext_check(const char *function, unsigned int line,
1500 + error_msg = "invalid eh_entries";
1501 + goto corrupted;
1502 + }
1503 +- if (!ext4_valid_extent_entries(inode, eh, depth)) {
1504 ++ if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) {
1505 + error_msg = "invalid extent entries";
1506 + goto corrupted;
1507 + }
1508 +@@ -491,7 +529,7 @@ corrupted:
1509 + }
1510 +
1511 + #define ext4_ext_check(inode, eh, depth, pblk) \
1512 +- __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk))
1513 ++ __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk), 0)
1514 +
1515 + int ext4_ext_check_inode(struct inode *inode)
1516 + {
1517 +@@ -524,12 +562,14 @@ static void ext4_cache_extents(struct inode *inode,
1518 +
1519 + static struct buffer_head *
1520 + __read_extent_tree_block(const char *function, unsigned int line,
1521 +- struct inode *inode, ext4_fsblk_t pblk, int depth,
1522 +- int flags)
1523 ++ struct inode *inode, struct ext4_extent_idx *idx,
1524 ++ int depth, int flags)
1525 + {
1526 + struct buffer_head *bh;
1527 + int err;
1528 ++ ext4_fsblk_t pblk;
1529 +
1530 ++ pblk = ext4_idx_pblock(idx);
1531 + bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS);
1532 + if (unlikely(!bh))
1533 + return ERR_PTR(-ENOMEM);
1534 +@@ -545,8 +585,8 @@ __read_extent_tree_block(const char *function, unsigned int line,
1535 + if (!ext4_has_feature_journal(inode->i_sb) ||
1536 + (inode->i_ino !=
1537 + le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) {
1538 +- err = __ext4_ext_check(function, line, inode,
1539 +- ext_block_hdr(bh), depth, pblk);
1540 ++ err = __ext4_ext_check(function, line, inode, ext_block_hdr(bh),
1541 ++ depth, pblk, le32_to_cpu(idx->ei_block));
1542 + if (err)
1543 + goto errout;
1544 + }
1545 +@@ -565,8 +605,8 @@ errout:
1546 +
1547 + }
1548 +
1549 +-#define read_extent_tree_block(inode, pblk, depth, flags) \
1550 +- __read_extent_tree_block(__func__, __LINE__, (inode), (pblk), \
1551 ++#define read_extent_tree_block(inode, idx, depth, flags) \
1552 ++ __read_extent_tree_block(__func__, __LINE__, (inode), (idx), \
1553 + (depth), (flags))
1554 +
1555 + /*
1556 +@@ -613,8 +653,7 @@ int ext4_ext_precache(struct inode *inode)
1557 + i--;
1558 + continue;
1559 + }
1560 +- bh = read_extent_tree_block(inode,
1561 +- ext4_idx_pblock(path[i].p_idx++),
1562 ++ bh = read_extent_tree_block(inode, path[i].p_idx++,
1563 + depth - i - 1,
1564 + EXT4_EX_FORCE_CACHE);
1565 + if (IS_ERR(bh)) {
1566 +@@ -917,8 +956,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
1567 + path[ppos].p_depth = i;
1568 + path[ppos].p_ext = NULL;
1569 +
1570 +- bh = read_extent_tree_block(inode, path[ppos].p_block, --i,
1571 +- flags);
1572 ++ bh = read_extent_tree_block(inode, path[ppos].p_idx, --i, flags);
1573 + if (IS_ERR(bh)) {
1574 + ret = PTR_ERR(bh);
1575 + goto err;
1576 +@@ -1517,7 +1555,6 @@ static int ext4_ext_search_right(struct inode *inode,
1577 + struct ext4_extent_header *eh;
1578 + struct ext4_extent_idx *ix;
1579 + struct ext4_extent *ex;
1580 +- ext4_fsblk_t block;
1581 + int depth; /* Note, NOT eh_depth; depth from top of tree */
1582 + int ee_len;
1583 +
1584 +@@ -1584,20 +1621,17 @@ got_index:
1585 + * follow it and find the closest allocated
1586 + * block to the right */
1587 + ix++;
1588 +- block = ext4_idx_pblock(ix);
1589 + while (++depth < path->p_depth) {
1590 + /* subtract from p_depth to get proper eh_depth */
1591 +- bh = read_extent_tree_block(inode, block,
1592 +- path->p_depth - depth, 0);
1593 ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0);
1594 + if (IS_ERR(bh))
1595 + return PTR_ERR(bh);
1596 + eh = ext_block_hdr(bh);
1597 + ix = EXT_FIRST_INDEX(eh);
1598 +- block = ext4_idx_pblock(ix);
1599 + put_bh(bh);
1600 + }
1601 +
1602 +- bh = read_extent_tree_block(inode, block, path->p_depth - depth, 0);
1603 ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0);
1604 + if (IS_ERR(bh))
1605 + return PTR_ERR(bh);
1606 + eh = ext_block_hdr(bh);
1607 +@@ -3119,9 +3153,9 @@ again:
1608 + ext_debug("move to level %d (block %llu)\n",
1609 + i + 1, ext4_idx_pblock(path[i].p_idx));
1610 + memset(path + i + 1, 0, sizeof(*path));
1611 +- bh = read_extent_tree_block(inode,
1612 +- ext4_idx_pblock(path[i].p_idx), depth - i - 1,
1613 +- EXT4_EX_NOCACHE);
1614 ++ bh = read_extent_tree_block(inode, path[i].p_idx,
1615 ++ depth - i - 1,
1616 ++ EXT4_EX_NOCACHE);
1617 + if (IS_ERR(bh)) {
1618 + /* should we reset i_size? */
1619 + err = PTR_ERR(bh);
1620 +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
1621 +index f1c99fe486c4d..28ceee102d0b3 100644
1622 +--- a/fs/nfs/dir.c
1623 ++++ b/fs/nfs/dir.c
1624 +@@ -1641,14 +1641,14 @@ no_open:
1625 + if (!res) {
1626 + inode = d_inode(dentry);
1627 + if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
1628 +- !S_ISDIR(inode->i_mode))
1629 ++ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
1630 + res = ERR_PTR(-ENOTDIR);
1631 + else if (inode && S_ISREG(inode->i_mode))
1632 + res = ERR_PTR(-EOPENSTALE);
1633 + } else if (!IS_ERR(res)) {
1634 + inode = d_inode(res);
1635 + if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
1636 +- !S_ISDIR(inode->i_mode)) {
1637 ++ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
1638 + dput(res);
1639 + res = ERR_PTR(-ENOTDIR);
1640 + } else if (inode && S_ISREG(inode->i_mode)) {
1641 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
1642 +index 209263c0c5377..3bddf5332b6d6 100644
1643 +--- a/fs/nfs/inode.c
1644 ++++ b/fs/nfs/inode.c
1645 +@@ -791,12 +791,9 @@ int nfs_getattr(const struct path *path, struct kstat *stat,
1646 + goto out_no_update;
1647 +
1648 + /* Flush out writes to the server in order to update c/mtime. */
1649 +- if ((request_mask & (STATX_CTIME|STATX_MTIME)) &&
1650 +- S_ISREG(inode->i_mode)) {
1651 +- err = filemap_write_and_wait(inode->i_mapping);
1652 +- if (err)
1653 +- goto out;
1654 +- }
1655 ++ if ((request_mask & (STATX_CTIME | STATX_MTIME)) &&
1656 ++ S_ISREG(inode->i_mode))
1657 ++ filemap_write_and_wait(inode->i_mapping);
1658 +
1659 + /*
1660 + * We may force a getattr if the user cares about atime.
1661 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
1662 +index 7abc3230c21a4..dc5f8654b277d 100644
1663 +--- a/fs/quota/dquot.c
1664 ++++ b/fs/quota/dquot.c
1665 +@@ -693,9 +693,14 @@ int dquot_quota_sync(struct super_block *sb, int type)
1666 + /* This is not very clever (and fast) but currently I don't know about
1667 + * any other simple way of getting quota data to disk and we must get
1668 + * them there for userspace to be visible... */
1669 +- if (sb->s_op->sync_fs)
1670 +- sb->s_op->sync_fs(sb, 1);
1671 +- sync_blockdev(sb->s_bdev);
1672 ++ if (sb->s_op->sync_fs) {
1673 ++ ret = sb->s_op->sync_fs(sb, 1);
1674 ++ if (ret)
1675 ++ return ret;
1676 ++ }
1677 ++ ret = sync_blockdev(sb->s_bdev);
1678 ++ if (ret)
1679 ++ return ret;
1680 +
1681 + /*
1682 + * Now when everything is written we can discard the pagecache so
1683 +diff --git a/fs/super.c b/fs/super.c
1684 +index b289356f302fc..e255c18fa2c88 100644
1685 +--- a/fs/super.c
1686 ++++ b/fs/super.c
1687 +@@ -1691,11 +1691,9 @@ static void lockdep_sb_freeze_acquire(struct super_block *sb)
1688 + percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_);
1689 + }
1690 +
1691 +-static void sb_freeze_unlock(struct super_block *sb)
1692 ++static void sb_freeze_unlock(struct super_block *sb, int level)
1693 + {
1694 +- int level;
1695 +-
1696 +- for (level = SB_FREEZE_LEVELS - 1; level >= 0; level--)
1697 ++ for (level--; level >= 0; level--)
1698 + percpu_up_write(sb->s_writers.rw_sem + level);
1699 + }
1700 +
1701 +@@ -1766,7 +1764,14 @@ int freeze_super(struct super_block *sb)
1702 + sb_wait_write(sb, SB_FREEZE_PAGEFAULT);
1703 +
1704 + /* All writers are done so after syncing there won't be dirty data */
1705 +- sync_filesystem(sb);
1706 ++ ret = sync_filesystem(sb);
1707 ++ if (ret) {
1708 ++ sb->s_writers.frozen = SB_UNFROZEN;
1709 ++ sb_freeze_unlock(sb, SB_FREEZE_PAGEFAULT);
1710 ++ wake_up(&sb->s_writers.wait_unfrozen);
1711 ++ deactivate_locked_super(sb);
1712 ++ return ret;
1713 ++ }
1714 +
1715 + /* Now wait for internal filesystem counter */
1716 + sb->s_writers.frozen = SB_FREEZE_FS;
1717 +@@ -1778,7 +1783,7 @@ int freeze_super(struct super_block *sb)
1718 + printk(KERN_ERR
1719 + "VFS:Filesystem freeze failed\n");
1720 + sb->s_writers.frozen = SB_UNFROZEN;
1721 +- sb_freeze_unlock(sb);
1722 ++ sb_freeze_unlock(sb, SB_FREEZE_FS);
1723 + wake_up(&sb->s_writers.wait_unfrozen);
1724 + deactivate_locked_super(sb);
1725 + return ret;
1726 +@@ -1829,7 +1834,7 @@ static int thaw_super_locked(struct super_block *sb)
1727 + }
1728 +
1729 + sb->s_writers.frozen = SB_UNFROZEN;
1730 +- sb_freeze_unlock(sb);
1731 ++ sb_freeze_unlock(sb, SB_FREEZE_FS);
1732 + out:
1733 + wake_up(&sb->s_writers.wait_unfrozen);
1734 + deactivate_locked_super(sb);
1735 +diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
1736 +index 8a5ced9cf5273..77d4281815579 100644
1737 +--- a/include/asm-generic/vmlinux.lds.h
1738 ++++ b/include/asm-generic/vmlinux.lds.h
1739 +@@ -110,17 +110,17 @@
1740 + #endif
1741 +
1742 + #ifdef CONFIG_FTRACE_MCOUNT_RECORD
1743 +-#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
1744 +-#define MCOUNT_REC() . = ALIGN(8); \
1745 +- __start_mcount_loc = .; \
1746 +- KEEP(*(__patchable_function_entries)) \
1747 +- __stop_mcount_loc = .;
1748 +-#else
1749 ++/*
1750 ++ * The ftrace call sites are logged to a section whose name depends on the
1751 ++ * compiler option used. A given kernel image will only use one, AKA
1752 ++ * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
1753 ++ * dependencies for FTRACE_CALLSITE_SECTION's definition.
1754 ++ */
1755 + #define MCOUNT_REC() . = ALIGN(8); \
1756 + __start_mcount_loc = .; \
1757 + KEEP(*(__mcount_loc)) \
1758 ++ KEEP(*(__patchable_function_entries)) \
1759 + __stop_mcount_loc = .;
1760 +-#endif
1761 + #else
1762 + #define MCOUNT_REC()
1763 + #endif
1764 +diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
1765 +index 8a8cb3c401b26..9141f22632864 100644
1766 +--- a/include/linux/ftrace.h
1767 ++++ b/include/linux/ftrace.h
1768 +@@ -499,7 +499,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
1769 + /**
1770 + * ftrace_make_nop - convert code into nop
1771 + * @mod: module structure if called by module load initialization
1772 +- * @rec: the mcount call site record
1773 ++ * @rec: the call site record (e.g. mcount/fentry)
1774 + * @addr: the address that the call site should be calling
1775 + *
1776 + * This is a very sensitive operation and great care needs
1777 +@@ -520,9 +520,38 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
1778 + extern int ftrace_make_nop(struct module *mod,
1779 + struct dyn_ftrace *rec, unsigned long addr);
1780 +
1781 ++
1782 ++/**
1783 ++ * ftrace_init_nop - initialize a nop call site
1784 ++ * @mod: module structure if called by module load initialization
1785 ++ * @rec: the call site record (e.g. mcount/fentry)
1786 ++ *
1787 ++ * This is a very sensitive operation and great care needs
1788 ++ * to be taken by the arch. The operation should carefully
1789 ++ * read the location, check to see if what is read is indeed
1790 ++ * what we expect it to be, and then on success of the compare,
1791 ++ * it should write to the location.
1792 ++ *
1793 ++ * The code segment at @rec->ip should contain the contents created by
1794 ++ * the compiler
1795 ++ *
1796 ++ * Return must be:
1797 ++ * 0 on success
1798 ++ * -EFAULT on error reading the location
1799 ++ * -EINVAL on a failed compare of the contents
1800 ++ * -EPERM on error writing to the location
1801 ++ * Any other value will be considered a failure.
1802 ++ */
1803 ++#ifndef ftrace_init_nop
1804 ++static inline int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
1805 ++{
1806 ++ return ftrace_make_nop(mod, rec, MCOUNT_ADDR);
1807 ++}
1808 ++#endif
1809 ++
1810 + /**
1811 + * ftrace_make_call - convert a nop call site into a call to addr
1812 +- * @rec: the mcount call site record
1813 ++ * @rec: the call site record (e.g. mcount/fentry)
1814 + * @addr: the address that the call site should call
1815 + *
1816 + * This is a very sensitive operation and great care needs
1817 +@@ -545,7 +574,7 @@ extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
1818 + #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
1819 + /**
1820 + * ftrace_modify_call - convert from one addr to another (no nop)
1821 +- * @rec: the mcount call site record
1822 ++ * @rec: the call site record (e.g. mcount/fentry)
1823 + * @old_addr: the address expected to be currently called to
1824 + * @addr: the address to change to
1825 + *
1826 +@@ -709,6 +738,11 @@ static inline unsigned long get_lock_parent_ip(void)
1827 +
1828 + #ifdef CONFIG_FTRACE_MCOUNT_RECORD
1829 + extern void ftrace_init(void);
1830 ++#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
1831 ++#define FTRACE_CALLSITE_SECTION "__patchable_function_entries"
1832 ++#else
1833 ++#define FTRACE_CALLSITE_SECTION "__mcount_loc"
1834 ++#endif
1835 + #else
1836 + static inline void ftrace_init(void) { }
1837 + #endif
1838 +diff --git a/include/linux/sched.h b/include/linux/sched.h
1839 +index afee5d5eb9458..b341471de9d60 100644
1840 +--- a/include/linux/sched.h
1841 ++++ b/include/linux/sched.h
1842 +@@ -1454,7 +1454,6 @@ extern struct pid *cad_pid;
1843 + #define PF_MEMALLOC 0x00000800 /* Allocating memory */
1844 + #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */
1845 + #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
1846 +-#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */
1847 + #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
1848 + #define PF_FROZEN 0x00010000 /* Frozen for system suspend */
1849 + #define PF_KSWAPD 0x00020000 /* I am kswapd */
1850 +diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
1851 +index c8696a230b7d9..1a28f299a4c61 100644
1852 +--- a/include/net/bond_3ad.h
1853 ++++ b/include/net/bond_3ad.h
1854 +@@ -262,7 +262,7 @@ struct ad_system {
1855 + struct ad_bond_info {
1856 + struct ad_system system; /* 802.3ad system structure */
1857 + struct bond_3ad_stats stats;
1858 +- u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */
1859 ++ atomic_t agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */
1860 + u16 aggregator_identifier;
1861 + };
1862 +
1863 +diff --git a/kernel/async.c b/kernel/async.c
1864 +index 4f9c1d6140168..74660f611b97d 100644
1865 +--- a/kernel/async.c
1866 ++++ b/kernel/async.c
1867 +@@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data,
1868 + atomic_inc(&entry_count);
1869 + spin_unlock_irqrestore(&async_lock, flags);
1870 +
1871 +- /* mark that this task has queued an async job, used by module init */
1872 +- current->flags |= PF_USED_ASYNC;
1873 +-
1874 + /* schedule for execution */
1875 + queue_work_node(node, system_unbound_wq, &entry->work);
1876 +
1877 +diff --git a/kernel/fork.c b/kernel/fork.c
1878 +index cf2cebd214b92..5b4a19682207a 100644
1879 +--- a/kernel/fork.c
1880 ++++ b/kernel/fork.c
1881 +@@ -2182,10 +2182,6 @@ static __latent_entropy struct task_struct *copy_process(
1882 + goto bad_fork_cancel_cgroup;
1883 + }
1884 +
1885 +- /* past the last point of failure */
1886 +- if (pidfile)
1887 +- fd_install(pidfd, pidfile);
1888 +-
1889 + init_task_pid_links(p);
1890 + if (likely(p->pid)) {
1891 + ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
1892 +@@ -2234,6 +2230,9 @@ static __latent_entropy struct task_struct *copy_process(
1893 + syscall_tracepoint_update(p);
1894 + write_unlock_irq(&tasklist_lock);
1895 +
1896 ++ if (pidfile)
1897 ++ fd_install(pidfd, pidfile);
1898 ++
1899 + proc_fork_connector(p);
1900 + cgroup_post_fork(p);
1901 + cgroup_threadgroup_change_end(current);
1902 +diff --git a/kernel/module.c b/kernel/module.c
1903 +index 59d487b8d8dad..7c724356aca31 100644
1904 +--- a/kernel/module.c
1905 ++++ b/kernel/module.c
1906 +@@ -3377,7 +3377,7 @@ static int find_module_sections(struct module *mod, struct load_info *info)
1907 + #endif
1908 + #ifdef CONFIG_FTRACE_MCOUNT_RECORD
1909 + /* sechdrs[0].sh_size is always zero */
1910 +- mod->ftrace_callsites = section_objs(info, "__mcount_loc",
1911 ++ mod->ftrace_callsites = section_objs(info, FTRACE_CALLSITE_SECTION,
1912 + sizeof(*mod->ftrace_callsites),
1913 + &mod->num_ftrace_callsites);
1914 + #endif
1915 +@@ -3711,12 +3711,6 @@ static noinline int do_init_module(struct module *mod)
1916 + }
1917 + freeinit->module_init = mod->init_layout.base;
1918 +
1919 +- /*
1920 +- * We want to find out whether @mod uses async during init. Clear
1921 +- * PF_USED_ASYNC. async_schedule*() will set it.
1922 +- */
1923 +- current->flags &= ~PF_USED_ASYNC;
1924 +-
1925 + do_mod_ctors(mod);
1926 + /* Start the module */
1927 + if (mod->init != NULL)
1928 +@@ -3742,22 +3736,13 @@ static noinline int do_init_module(struct module *mod)
1929 +
1930 + /*
1931 + * We need to finish all async code before the module init sequence
1932 +- * is done. This has potential to deadlock. For example, a newly
1933 +- * detected block device can trigger request_module() of the
1934 +- * default iosched from async probing task. Once userland helper
1935 +- * reaches here, async_synchronize_full() will wait on the async
1936 +- * task waiting on request_module() and deadlock.
1937 +- *
1938 +- * This deadlock is avoided by perfomring async_synchronize_full()
1939 +- * iff module init queued any async jobs. This isn't a full
1940 +- * solution as it will deadlock the same if module loading from
1941 +- * async jobs nests more than once; however, due to the various
1942 +- * constraints, this hack seems to be the best option for now.
1943 +- * Please refer to the following thread for details.
1944 ++ * is done. This has potential to deadlock if synchronous module
1945 ++ * loading is requested from async (which is not allowed!).
1946 + *
1947 +- * http://thread.gmane.org/gmane.linux.kernel/1420814
1948 ++ * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous
1949 ++ * request_module() from async workers") for more details.
1950 + */
1951 +- if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC))
1952 ++ if (!mod->async_probe_requested)
1953 + async_synchronize_full();
1954 +
1955 + ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base +
1956 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1957 +index efc338969b98b..7719d444bda12 100644
1958 +--- a/kernel/trace/ftrace.c
1959 ++++ b/kernel/trace/ftrace.c
1960 +@@ -2520,14 +2520,14 @@ struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter)
1961 + }
1962 +
1963 + static int
1964 +-ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
1965 ++ftrace_nop_initialize(struct module *mod, struct dyn_ftrace *rec)
1966 + {
1967 + int ret;
1968 +
1969 + if (unlikely(ftrace_disabled))
1970 + return 0;
1971 +
1972 +- ret = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
1973 ++ ret = ftrace_init_nop(mod, rec);
1974 + if (ret) {
1975 + ftrace_bug_type = FTRACE_BUG_INIT;
1976 + ftrace_bug(ret, rec);
1977 +@@ -2969,7 +2969,7 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs)
1978 + * to the NOP instructions.
1979 + */
1980 + if (!__is_defined(CC_USING_NOP_MCOUNT) &&
1981 +- !ftrace_code_disable(mod, p))
1982 ++ !ftrace_nop_initialize(mod, p))
1983 + break;
1984 +
1985 + update_cnt++;
1986 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1987 +index 5a4dfb55ba16b..615259d8fa9ad 100644
1988 +--- a/kernel/trace/trace.c
1989 ++++ b/kernel/trace/trace.c
1990 +@@ -236,6 +236,10 @@ __setup("trace_clock=", set_trace_boot_clock);
1991 +
1992 + static int __init set_tracepoint_printk(char *str)
1993 + {
1994 ++ /* Ignore the "tp_printk_stop_on_boot" param */
1995 ++ if (*str == '_')
1996 ++ return 0;
1997 ++
1998 + if ((strcmp(str, "=0") != 0 && strcmp(str, "=off") != 0))
1999 + tracepoint_printk = 1;
2000 + return 1;
2001 +diff --git a/kernel/tsacct.c b/kernel/tsacct.c
2002 +index 7be3e7530841f..33a4093306f9c 100644
2003 +--- a/kernel/tsacct.c
2004 ++++ b/kernel/tsacct.c
2005 +@@ -35,11 +35,10 @@ void bacct_add_tsk(struct user_namespace *user_ns,
2006 + /* Convert to seconds for btime */
2007 + do_div(delta, USEC_PER_SEC);
2008 + stats->ac_btime = get_seconds() - delta;
2009 +- if (thread_group_leader(tsk)) {
2010 ++ if (tsk->flags & PF_EXITING)
2011 + stats->ac_exitcode = tsk->exit_code;
2012 +- if (tsk->flags & PF_FORKNOEXEC)
2013 +- stats->ac_flag |= AFORK;
2014 +- }
2015 ++ if (thread_group_leader(tsk) && (tsk->flags & PF_FORKNOEXEC))
2016 ++ stats->ac_flag |= AFORK;
2017 + if (tsk->flags & PF_SUPERPRIV)
2018 + stats->ac_flag |= ASU;
2019 + if (tsk->flags & PF_DUMPCORE)
2020 +diff --git a/lib/iov_iter.c b/lib/iov_iter.c
2021 +index 957e3e58df652..9d3bda3d49fed 100644
2022 +--- a/lib/iov_iter.c
2023 ++++ b/lib/iov_iter.c
2024 +@@ -398,6 +398,7 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by
2025 + return 0;
2026 + pipe->nrbufs++;
2027 + buf->ops = &page_cache_pipe_buf_ops;
2028 ++ buf->flags = 0;
2029 + get_page(buf->page = page);
2030 + buf->offset = offset;
2031 + buf->len = bytes;
2032 +@@ -524,6 +525,7 @@ static size_t push_pipe(struct iov_iter *i, size_t size,
2033 + break;
2034 + pipe->nrbufs++;
2035 + pipe->bufs[idx].ops = &default_pipe_buf_ops;
2036 ++ pipe->bufs[idx].flags = 0;
2037 + pipe->bufs[idx].page = page;
2038 + pipe->bufs[idx].offset = 0;
2039 + if (left <= PAGE_SIZE) {
2040 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
2041 +index 1f84d41e22c36..184af6da0defc 100644
2042 +--- a/net/ax25/af_ax25.c
2043 ++++ b/net/ax25/af_ax25.c
2044 +@@ -77,6 +77,7 @@ static void ax25_kill_by_device(struct net_device *dev)
2045 + {
2046 + ax25_dev *ax25_dev;
2047 + ax25_cb *s;
2048 ++ struct sock *sk;
2049 +
2050 + if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
2051 + return;
2052 +@@ -85,13 +86,15 @@ static void ax25_kill_by_device(struct net_device *dev)
2053 + again:
2054 + ax25_for_each(s, &ax25_list) {
2055 + if (s->ax25_dev == ax25_dev) {
2056 ++ sk = s->sk;
2057 ++ sock_hold(sk);
2058 + spin_unlock_bh(&ax25_list_lock);
2059 +- lock_sock(s->sk);
2060 ++ lock_sock(sk);
2061 + s->ax25_dev = NULL;
2062 +- release_sock(s->sk);
2063 ++ release_sock(sk);
2064 + ax25_disconnect(s, ENETUNREACH);
2065 + spin_lock_bh(&ax25_list_lock);
2066 +-
2067 ++ sock_put(sk);
2068 + /* The entry could have been deleted from the
2069 + * list meanwhile and thus the next pointer is
2070 + * no longer valid. Play it safe and restart
2071 +diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
2072 +index af0130039f377..e8e8389ddc965 100644
2073 +--- a/net/core/drop_monitor.c
2074 ++++ b/net/core/drop_monitor.c
2075 +@@ -277,13 +277,17 @@ static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi,
2076 +
2077 + rcu_read_lock();
2078 + list_for_each_entry_rcu(new_stat, &hw_stats_list, list) {
2079 ++ struct net_device *dev;
2080 ++
2081 + /*
2082 + * only add a note to our monitor buffer if:
2083 + * 1) this is the dev we received on
2084 + * 2) its after the last_rx delta
2085 + * 3) our rx_dropped count has gone up
2086 + */
2087 +- if ((new_stat->dev == napi->dev) &&
2088 ++ /* Paired with WRITE_ONCE() in dropmon_net_event() */
2089 ++ dev = READ_ONCE(new_stat->dev);
2090 ++ if ((dev == napi->dev) &&
2091 + (time_after(jiffies, new_stat->last_rx + dm_hw_check_delta)) &&
2092 + (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) {
2093 + trace_drop_common(NULL, NULL);
2094 +@@ -1497,7 +1501,10 @@ static int dropmon_net_event(struct notifier_block *ev_block,
2095 + mutex_lock(&net_dm_mutex);
2096 + list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) {
2097 + if (new_stat->dev == dev) {
2098 +- new_stat->dev = NULL;
2099 ++
2100 ++ /* Paired with READ_ONCE() in trace_napi_poll_hit() */
2101 ++ WRITE_ONCE(new_stat->dev, NULL);
2102 ++
2103 + if (trace_state == TRACE_OFF) {
2104 + list_del_rcu(&new_stat->list);
2105 + kfree_rcu(new_stat, rcu);
2106 +diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
2107 +index b0f51c7cc0d90..2a359d0dfe7e8 100644
2108 +--- a/net/ipv4/ping.c
2109 ++++ b/net/ipv4/ping.c
2110 +@@ -172,16 +172,23 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)
2111 + struct sock *sk = NULL;
2112 + struct inet_sock *isk;
2113 + struct hlist_nulls_node *hnode;
2114 +- int dif = skb->dev->ifindex;
2115 ++ int dif, sdif;
2116 +
2117 + if (skb->protocol == htons(ETH_P_IP)) {
2118 ++ dif = inet_iif(skb);
2119 ++ sdif = inet_sdif(skb);
2120 + pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n",
2121 + (int)ident, &ip_hdr(skb)->daddr, dif);
2122 + #if IS_ENABLED(CONFIG_IPV6)
2123 + } else if (skb->protocol == htons(ETH_P_IPV6)) {
2124 ++ dif = inet6_iif(skb);
2125 ++ sdif = inet6_sdif(skb);
2126 + pr_debug("try to find: num = %d, daddr = %pI6c, dif = %d\n",
2127 + (int)ident, &ipv6_hdr(skb)->daddr, dif);
2128 + #endif
2129 ++ } else {
2130 ++ pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol));
2131 ++ return NULL;
2132 + }
2133 +
2134 + read_lock_bh(&ping_table.lock);
2135 +@@ -221,7 +228,7 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)
2136 + }
2137 +
2138 + if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif &&
2139 +- sk->sk_bound_dev_if != inet_sdif(skb))
2140 ++ sk->sk_bound_dev_if != sdif)
2141 + continue;
2142 +
2143 + sock_hold(sk);
2144 +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
2145 +index 810cca24b3990..7626f3e1c70a7 100644
2146 +--- a/net/netfilter/nf_conntrack_proto_sctp.c
2147 ++++ b/net/netfilter/nf_conntrack_proto_sctp.c
2148 +@@ -489,6 +489,15 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
2149 + pr_debug("Setting vtag %x for dir %d\n",
2150 + ih->init_tag, !dir);
2151 + ct->proto.sctp.vtag[!dir] = ih->init_tag;
2152 ++
2153 ++ /* don't renew timeout on init retransmit so
2154 ++ * port reuse by client or NAT middlebox cannot
2155 ++ * keep entry alive indefinitely (incl. nat info).
2156 ++ */
2157 ++ if (new_state == SCTP_CONNTRACK_CLOSED &&
2158 ++ old_state == SCTP_CONNTRACK_CLOSED &&
2159 ++ nf_ct_is_confirmed(ct))
2160 ++ ignore = true;
2161 + }
2162 +
2163 + ct->proto.sctp.state = new_state;
2164 +diff --git a/net/netfilter/nft_synproxy.c b/net/netfilter/nft_synproxy.c
2165 +index e2c1fc6088412..15abb0e496034 100644
2166 +--- a/net/netfilter/nft_synproxy.c
2167 ++++ b/net/netfilter/nft_synproxy.c
2168 +@@ -191,8 +191,10 @@ static int nft_synproxy_do_init(const struct nft_ctx *ctx,
2169 + if (err)
2170 + goto nf_ct_failure;
2171 + err = nf_synproxy_ipv6_init(snet, ctx->net);
2172 +- if (err)
2173 ++ if (err) {
2174 ++ nf_synproxy_ipv4_fini(snet, ctx->net);
2175 + goto nf_ct_failure;
2176 ++ }
2177 + break;
2178 + }
2179 +
2180 +diff --git a/net/sched/act_api.c b/net/sched/act_api.c
2181 +index 75132d0ca8870..ab277ee950322 100644
2182 +--- a/net/sched/act_api.c
2183 ++++ b/net/sched/act_api.c
2184 +@@ -652,15 +652,24 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
2185 + restart_act_graph:
2186 + for (i = 0; i < nr_actions; i++) {
2187 + const struct tc_action *a = actions[i];
2188 ++ int repeat_ttl;
2189 +
2190 + if (jmp_prgcnt > 0) {
2191 + jmp_prgcnt -= 1;
2192 + continue;
2193 + }
2194 ++
2195 ++ repeat_ttl = 32;
2196 + repeat:
2197 + ret = a->ops->act(skb, a, res);
2198 +- if (ret == TC_ACT_REPEAT)
2199 +- goto repeat; /* we need a ttl - JHS */
2200 ++
2201 ++ if (unlikely(ret == TC_ACT_REPEAT)) {
2202 ++ if (--repeat_ttl != 0)
2203 ++ goto repeat;
2204 ++ /* suspicious opcode, stop pipeline */
2205 ++ net_warn_ratelimited("TC_ACT_REPEAT abuse ?\n");
2206 ++ return TC_ACT_OK;
2207 ++ }
2208 +
2209 + if (TC_ACT_EXT_CMP(ret, TC_ACT_JUMP)) {
2210 + jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK;
2211 +diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
2212 +index bc8055f4571bc..d60d7caacbf5d 100644
2213 +--- a/net/vmw_vsock/af_vsock.c
2214 ++++ b/net/vmw_vsock/af_vsock.c
2215 +@@ -1222,6 +1222,7 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
2216 + sk->sk_state = sk->sk_state == TCP_ESTABLISHED ? TCP_CLOSING : TCP_CLOSE;
2217 + sock->state = SS_UNCONNECTED;
2218 + vsock_transport_cancel_pkt(vsk);
2219 ++ vsock_remove_connected(vsk);
2220 + goto out_wait;
2221 + } else if (timeout == 0) {
2222 + err = -ETIMEDOUT;
2223 +diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
2224 +index ca08f2fe7c344..854e2ba9daa29 100644
2225 +--- a/scripts/Makefile.extrawarn
2226 ++++ b/scripts/Makefile.extrawarn
2227 +@@ -49,6 +49,7 @@ KBUILD_CFLAGS += -Wno-format
2228 + KBUILD_CFLAGS += -Wno-sign-compare
2229 + KBUILD_CFLAGS += -Wno-format-zero-length
2230 + KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
2231 ++KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
2232 + endif
2233 +
2234 + endif
2235 +diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
2236 +index 17298239e3633..5c2493c8e9de8 100644
2237 +--- a/scripts/kconfig/confdata.c
2238 ++++ b/scripts/kconfig/confdata.c
2239 +@@ -987,14 +987,19 @@ static int conf_write_dep(const char *name)
2240 +
2241 + static int conf_touch_deps(void)
2242 + {
2243 +- const char *name;
2244 ++ const char *name, *tmp;
2245 + struct symbol *sym;
2246 + int res, i;
2247 +
2248 +- strcpy(depfile_path, "include/config/");
2249 +- depfile_prefix_len = strlen(depfile_path);
2250 +-
2251 + name = conf_get_autoconfig_name();
2252 ++ tmp = strrchr(name, '/');
2253 ++ depfile_prefix_len = tmp ? tmp - name + 1 : 0;
2254 ++ if (depfile_prefix_len + 1 > sizeof(depfile_path))
2255 ++ return -1;
2256 ++
2257 ++ strncpy(depfile_path, name, depfile_prefix_len);
2258 ++ depfile_path[depfile_prefix_len] = 0;
2259 ++
2260 + conf_read_simple(name, S_DEF_AUTO);
2261 + sym_calc_value(modules_sym);
2262 +
2263 +diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
2264 +index 0590f86df6e40..748da578b418c 100644
2265 +--- a/scripts/kconfig/preprocess.c
2266 ++++ b/scripts/kconfig/preprocess.c
2267 +@@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[])
2268 + static char *do_shell(int argc, char *argv[])
2269 + {
2270 + FILE *p;
2271 +- char buf[256];
2272 ++ char buf[4096];
2273 + char *cmd;
2274 + size_t nread;
2275 + int i;
2276 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2277 +index 95d472d433e70..b8fe0ec5d6247 100644
2278 +--- a/sound/pci/hda/hda_intel.c
2279 ++++ b/sound/pci/hda/hda_intel.c
2280 +@@ -1608,6 +1608,7 @@ static struct snd_pci_quirk probe_mask_list[] = {
2281 + /* forced codec slots */
2282 + SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103),
2283 + SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103),
2284 ++ SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105),
2285 + /* WinFast VP200 H (Teradici) user reported broken communication */
2286 + SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101),
2287 + {}
2288 +@@ -1793,8 +1794,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
2289 +
2290 + assign_position_fix(chip, check_position_fix(chip, position_fix[dev]));
2291 +
2292 +- check_probe_mask(chip, dev);
2293 +-
2294 + if (single_cmd < 0) /* allow fallback to single_cmd at errors */
2295 + chip->fallback_to_single_cmd = 1;
2296 + else /* explicitly set to single_cmd or not */
2297 +@@ -1826,6 +1825,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
2298 + chip->bus.needs_damn_long_delay = 1;
2299 + }
2300 +
2301 ++ check_probe_mask(chip, dev);
2302 ++
2303 + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
2304 + if (err < 0) {
2305 + dev_err(card->dev, "Error creating device [card]!\n");
2306 +diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
2307 +index ef8fd331526b0..f5dcd625e4355 100644
2308 +--- a/sound/soc/soc-ops.c
2309 ++++ b/sound/soc/soc-ops.c
2310 +@@ -314,7 +314,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
2311 + unsigned int sign_bit = mc->sign_bit;
2312 + unsigned int mask = (1 << fls(max)) - 1;
2313 + unsigned int invert = mc->invert;
2314 +- int err;
2315 ++ int err, ret;
2316 + bool type_2r = false;
2317 + unsigned int val2 = 0;
2318 + unsigned int val, val_mask;
2319 +@@ -356,12 +356,18 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
2320 + err = snd_soc_component_update_bits(component, reg, val_mask, val);
2321 + if (err < 0)
2322 + return err;
2323 ++ ret = err;
2324 +
2325 +- if (type_2r)
2326 ++ if (type_2r) {
2327 + err = snd_soc_component_update_bits(component, reg2, val_mask,
2328 +- val2);
2329 ++ val2);
2330 ++ /* Don't discard any error code or drop change flag */
2331 ++ if (ret == 0 || err < 0) {
2332 ++ ret = err;
2333 ++ }
2334 ++ }
2335 +
2336 +- return err;
2337 ++ return ret;
2338 + }
2339 + EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
2340 +
2341 +@@ -517,7 +523,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2342 + unsigned int mask = (1 << fls(max)) - 1;
2343 + unsigned int invert = mc->invert;
2344 + unsigned int val, val_mask;
2345 +- int ret;
2346 ++ int err, ret;
2347 +
2348 + if (invert)
2349 + val = (max - ucontrol->value.integer.value[0]) & mask;
2350 +@@ -526,9 +532,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2351 + val_mask = mask << shift;
2352 + val = val << shift;
2353 +
2354 +- ret = snd_soc_component_update_bits(component, reg, val_mask, val);
2355 +- if (ret < 0)
2356 +- return ret;
2357 ++ err = snd_soc_component_update_bits(component, reg, val_mask, val);
2358 ++ if (err < 0)
2359 ++ return err;
2360 ++ ret = err;
2361 +
2362 + if (snd_soc_volsw_is_stereo(mc)) {
2363 + if (invert)
2364 +@@ -538,8 +545,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2365 + val_mask = mask << shift;
2366 + val = val << shift;
2367 +
2368 +- ret = snd_soc_component_update_bits(component, rreg, val_mask,
2369 ++ err = snd_soc_component_update_bits(component, rreg, val_mask,
2370 + val);
2371 ++ /* Don't discard any error code or drop change flag */
2372 ++ if (ret == 0 || err < 0) {
2373 ++ ret = err;
2374 ++ }
2375 + }
2376 +
2377 + return ret;
2378 +diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
2379 +index 794a375dad360..b2aec04fce8f6 100644
2380 +--- a/tools/lib/subcmd/subcmd-util.h
2381 ++++ b/tools/lib/subcmd/subcmd-util.h
2382 +@@ -50,15 +50,8 @@ static NORETURN inline void die(const char *err, ...)
2383 + static inline void *xrealloc(void *ptr, size_t size)
2384 + {
2385 + void *ret = realloc(ptr, size);
2386 +- if (!ret && !size)
2387 +- ret = realloc(ptr, 1);
2388 +- if (!ret) {
2389 +- ret = realloc(ptr, size);
2390 +- if (!ret && !size)
2391 +- ret = realloc(ptr, 1);
2392 +- if (!ret)
2393 +- die("Out of memory, realloc failed");
2394 +- }
2395 ++ if (!ret)
2396 ++ die("Out of memory, realloc failed");
2397 + return ret;
2398 + }
2399 +
2400 +diff --git a/tools/testing/selftests/rtc/settings b/tools/testing/selftests/rtc/settings
2401 +index ba4d85f74cd6b..a953c96aa16e1 100644
2402 +--- a/tools/testing/selftests/rtc/settings
2403 ++++ b/tools/testing/selftests/rtc/settings
2404 +@@ -1 +1 @@
2405 +-timeout=90
2406 ++timeout=180
2407 +diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh
2408 +index 232e958ec4547..b0b91d9b0dc21 100755
2409 +--- a/tools/testing/selftests/zram/zram.sh
2410 ++++ b/tools/testing/selftests/zram/zram.sh
2411 +@@ -2,9 +2,6 @@
2412 + # SPDX-License-Identifier: GPL-2.0
2413 + TCID="zram.sh"
2414 +
2415 +-# Kselftest framework requirement - SKIP code is 4.
2416 +-ksft_skip=4
2417 +-
2418 + . ./zram_lib.sh
2419 +
2420 + run_zram () {
2421 +@@ -18,14 +15,4 @@ echo ""
2422 +
2423 + check_prereqs
2424 +
2425 +-# check zram module exists
2426 +-MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
2427 +-if [ -f $MODULE_PATH ]; then
2428 +- run_zram
2429 +-elif [ -b /dev/zram0 ]; then
2430 +- run_zram
2431 +-else
2432 +- echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
2433 +- echo "$TCID : CONFIG_ZRAM is not set"
2434 +- exit $ksft_skip
2435 +-fi
2436 ++run_zram
2437 +diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh
2438 +index 114863d9fb876..8f4affe34f3e4 100755
2439 +--- a/tools/testing/selftests/zram/zram01.sh
2440 ++++ b/tools/testing/selftests/zram/zram01.sh
2441 +@@ -33,9 +33,7 @@ zram_algs="lzo"
2442 +
2443 + zram_fill_fs()
2444 + {
2445 +- local mem_free0=$(free -m | awk 'NR==2 {print $4}')
2446 +-
2447 +- for i in $(seq 0 $(($dev_num - 1))); do
2448 ++ for i in $(seq $dev_start $dev_end); do
2449 + echo "fill zram$i..."
2450 + local b=0
2451 + while [ true ]; do
2452 +@@ -45,29 +43,17 @@ zram_fill_fs()
2453 + b=$(($b + 1))
2454 + done
2455 + echo "zram$i can be filled with '$b' KB"
2456 +- done
2457 +
2458 +- local mem_free1=$(free -m | awk 'NR==2 {print $4}')
2459 +- local used_mem=$(($mem_free0 - $mem_free1))
2460 ++ local mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"`
2461 ++ local v=$((100 * 1024 * $b / $mem_used_total))
2462 ++ if [ "$v" -lt 100 ]; then
2463 ++ echo "FAIL compression ratio: 0.$v:1"
2464 ++ ERR_CODE=-1
2465 ++ return
2466 ++ fi
2467 +
2468 +- local total_size=0
2469 +- for sm in $zram_sizes; do
2470 +- local s=$(echo $sm | sed 's/M//')
2471 +- total_size=$(($total_size + $s))
2472 ++ echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
2473 + done
2474 +-
2475 +- echo "zram used ${used_mem}M, zram disk sizes ${total_size}M"
2476 +-
2477 +- local v=$((100 * $total_size / $used_mem))
2478 +-
2479 +- if [ "$v" -lt 100 ]; then
2480 +- echo "FAIL compression ratio: 0.$v:1"
2481 +- ERR_CODE=-1
2482 +- zram_cleanup
2483 +- return
2484 +- fi
2485 +-
2486 +- echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
2487 + }
2488 +
2489 + check_prereqs
2490 +@@ -81,7 +67,6 @@ zram_mount
2491 +
2492 + zram_fill_fs
2493 + zram_cleanup
2494 +-zram_unload
2495 +
2496 + if [ $ERR_CODE -ne 0 ]; then
2497 + echo "$TCID : [FAIL]"
2498 +diff --git a/tools/testing/selftests/zram/zram02.sh b/tools/testing/selftests/zram/zram02.sh
2499 +index e83b404807c09..2418b0c4ed136 100755
2500 +--- a/tools/testing/selftests/zram/zram02.sh
2501 ++++ b/tools/testing/selftests/zram/zram02.sh
2502 +@@ -36,7 +36,6 @@ zram_set_memlimit
2503 + zram_makeswap
2504 + zram_swapoff
2505 + zram_cleanup
2506 +-zram_unload
2507 +
2508 + if [ $ERR_CODE -ne 0 ]; then
2509 + echo "$TCID : [FAIL]"
2510 +diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh
2511 +index 6f872f266fd11..21ec1966de76c 100755
2512 +--- a/tools/testing/selftests/zram/zram_lib.sh
2513 ++++ b/tools/testing/selftests/zram/zram_lib.sh
2514 +@@ -5,12 +5,17 @@
2515 + # Author: Alexey Kodanev <alexey.kodanev@××××××.com>
2516 + # Modified: Naresh Kamboju <naresh.kamboju@××××××.org>
2517 +
2518 +-MODULE=0
2519 + dev_makeswap=-1
2520 + dev_mounted=-1
2521 +-
2522 ++dev_start=0
2523 ++dev_end=-1
2524 ++module_load=-1
2525 ++sys_control=-1
2526 + # Kselftest framework requirement - SKIP code is 4.
2527 + ksft_skip=4
2528 ++kernel_version=`uname -r | cut -d'.' -f1,2`
2529 ++kernel_major=${kernel_version%.*}
2530 ++kernel_minor=${kernel_version#*.}
2531 +
2532 + trap INT
2533 +
2534 +@@ -25,68 +30,104 @@ check_prereqs()
2535 + fi
2536 + }
2537 +
2538 ++kernel_gte()
2539 ++{
2540 ++ major=${1%.*}
2541 ++ minor=${1#*.}
2542 ++
2543 ++ if [ $kernel_major -gt $major ]; then
2544 ++ return 0
2545 ++ elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then
2546 ++ return 0
2547 ++ fi
2548 ++
2549 ++ return 1
2550 ++}
2551 ++
2552 + zram_cleanup()
2553 + {
2554 + echo "zram cleanup"
2555 + local i=
2556 +- for i in $(seq 0 $dev_makeswap); do
2557 ++ for i in $(seq $dev_start $dev_makeswap); do
2558 + swapoff /dev/zram$i
2559 + done
2560 +
2561 +- for i in $(seq 0 $dev_mounted); do
2562 ++ for i in $(seq $dev_start $dev_mounted); do
2563 + umount /dev/zram$i
2564 + done
2565 +
2566 +- for i in $(seq 0 $(($dev_num - 1))); do
2567 ++ for i in $(seq $dev_start $dev_end); do
2568 + echo 1 > /sys/block/zram${i}/reset
2569 + rm -rf zram$i
2570 + done
2571 +
2572 +-}
2573 ++ if [ $sys_control -eq 1 ]; then
2574 ++ for i in $(seq $dev_start $dev_end); do
2575 ++ echo $i > /sys/class/zram-control/hot_remove
2576 ++ done
2577 ++ fi
2578 +
2579 +-zram_unload()
2580 +-{
2581 +- if [ $MODULE -ne 0 ] ; then
2582 +- echo "zram rmmod zram"
2583 ++ if [ $module_load -eq 1 ]; then
2584 + rmmod zram > /dev/null 2>&1
2585 + fi
2586 + }
2587 +
2588 + zram_load()
2589 + {
2590 +- # check zram module exists
2591 +- MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
2592 +- if [ -f $MODULE_PATH ]; then
2593 +- MODULE=1
2594 +- echo "create '$dev_num' zram device(s)"
2595 +- modprobe zram num_devices=$dev_num
2596 +- if [ $? -ne 0 ]; then
2597 +- echo "failed to insert zram module"
2598 +- exit 1
2599 +- fi
2600 +-
2601 +- dev_num_created=$(ls /dev/zram* | wc -w)
2602 ++ echo "create '$dev_num' zram device(s)"
2603 ++
2604 ++ # zram module loaded, new kernel
2605 ++ if [ -d "/sys/class/zram-control" ]; then
2606 ++ echo "zram modules already loaded, kernel supports" \
2607 ++ "zram-control interface"
2608 ++ dev_start=$(ls /dev/zram* | wc -w)
2609 ++ dev_end=$(($dev_start + $dev_num - 1))
2610 ++ sys_control=1
2611 ++
2612 ++ for i in $(seq $dev_start $dev_end); do
2613 ++ cat /sys/class/zram-control/hot_add > /dev/null
2614 ++ done
2615 ++
2616 ++ echo "all zram devices (/dev/zram$dev_start~$dev_end" \
2617 ++ "successfully created"
2618 ++ return 0
2619 ++ fi
2620 +
2621 +- if [ "$dev_num_created" -ne "$dev_num" ]; then
2622 +- echo "unexpected num of devices: $dev_num_created"
2623 +- ERR_CODE=-1
2624 ++ # detect old kernel or built-in
2625 ++ modprobe zram num_devices=$dev_num
2626 ++ if [ ! -d "/sys/class/zram-control" ]; then
2627 ++ if grep -q '^zram' /proc/modules; then
2628 ++ rmmod zram > /dev/null 2>&1
2629 ++ if [ $? -ne 0 ]; then
2630 ++ echo "zram module is being used on old kernel" \
2631 ++ "without zram-control interface"
2632 ++ exit $ksft_skip
2633 ++ fi
2634 + else
2635 +- echo "zram load module successful"
2636 ++ echo "test needs CONFIG_ZRAM=m on old kernel without" \
2637 ++ "zram-control interface"
2638 ++ exit $ksft_skip
2639 + fi
2640 +- elif [ -b /dev/zram0 ]; then
2641 +- echo "/dev/zram0 device file found: OK"
2642 +- else
2643 +- echo "ERROR: No zram.ko module or no /dev/zram0 device found"
2644 +- echo "$TCID : CONFIG_ZRAM is not set"
2645 +- exit 1
2646 ++ modprobe zram num_devices=$dev_num
2647 + fi
2648 ++
2649 ++ module_load=1
2650 ++ dev_end=$(($dev_num - 1))
2651 ++ echo "all zram devices (/dev/zram0~$dev_end) successfully created"
2652 + }
2653 +
2654 + zram_max_streams()
2655 + {
2656 + echo "set max_comp_streams to zram device(s)"
2657 +
2658 +- local i=0
2659 ++ kernel_gte 4.7
2660 ++ if [ $? -eq 0 ]; then
2661 ++ echo "The device attribute max_comp_streams was"\
2662 ++ "deprecated in 4.7"
2663 ++ return 0
2664 ++ fi
2665 ++
2666 ++ local i=$dev_start
2667 + for max_s in $zram_max_streams; do
2668 + local sys_path="/sys/block/zram${i}/max_comp_streams"
2669 + echo $max_s > $sys_path || \
2670 +@@ -98,7 +139,7 @@ zram_max_streams()
2671 + echo "FAIL can't set max_streams '$max_s', get $max_stream"
2672 +
2673 + i=$(($i + 1))
2674 +- echo "$sys_path = '$max_streams' ($i/$dev_num)"
2675 ++ echo "$sys_path = '$max_streams'"
2676 + done
2677 +
2678 + echo "zram max streams: OK"
2679 +@@ -108,15 +149,16 @@ zram_compress_alg()
2680 + {
2681 + echo "test that we can set compression algorithm"
2682 +
2683 +- local algs=$(cat /sys/block/zram0/comp_algorithm)
2684 ++ local i=$dev_start
2685 ++ local algs=$(cat /sys/block/zram${i}/comp_algorithm)
2686 + echo "supported algs: $algs"
2687 +- local i=0
2688 ++
2689 + for alg in $zram_algs; do
2690 + local sys_path="/sys/block/zram${i}/comp_algorithm"
2691 + echo "$alg" > $sys_path || \
2692 + echo "FAIL can't set '$alg' to $sys_path"
2693 + i=$(($i + 1))
2694 +- echo "$sys_path = '$alg' ($i/$dev_num)"
2695 ++ echo "$sys_path = '$alg'"
2696 + done
2697 +
2698 + echo "zram set compression algorithm: OK"
2699 +@@ -125,14 +167,14 @@ zram_compress_alg()
2700 + zram_set_disksizes()
2701 + {
2702 + echo "set disk size to zram device(s)"
2703 +- local i=0
2704 ++ local i=$dev_start
2705 + for ds in $zram_sizes; do
2706 + local sys_path="/sys/block/zram${i}/disksize"
2707 + echo "$ds" > $sys_path || \
2708 + echo "FAIL can't set '$ds' to $sys_path"
2709 +
2710 + i=$(($i + 1))
2711 +- echo "$sys_path = '$ds' ($i/$dev_num)"
2712 ++ echo "$sys_path = '$ds'"
2713 + done
2714 +
2715 + echo "zram set disksizes: OK"
2716 +@@ -142,14 +184,14 @@ zram_set_memlimit()
2717 + {
2718 + echo "set memory limit to zram device(s)"
2719 +
2720 +- local i=0
2721 ++ local i=$dev_start
2722 + for ds in $zram_mem_limits; do
2723 + local sys_path="/sys/block/zram${i}/mem_limit"
2724 + echo "$ds" > $sys_path || \
2725 + echo "FAIL can't set '$ds' to $sys_path"
2726 +
2727 + i=$(($i + 1))
2728 +- echo "$sys_path = '$ds' ($i/$dev_num)"
2729 ++ echo "$sys_path = '$ds'"
2730 + done
2731 +
2732 + echo "zram set memory limit: OK"
2733 +@@ -158,8 +200,8 @@ zram_set_memlimit()
2734 + zram_makeswap()
2735 + {
2736 + echo "make swap with zram device(s)"
2737 +- local i=0
2738 +- for i in $(seq 0 $(($dev_num - 1))); do
2739 ++ local i=$dev_start
2740 ++ for i in $(seq $dev_start $dev_end); do
2741 + mkswap /dev/zram$i > err.log 2>&1
2742 + if [ $? -ne 0 ]; then
2743 + cat err.log
2744 +@@ -182,7 +224,7 @@ zram_makeswap()
2745 + zram_swapoff()
2746 + {
2747 + local i=
2748 +- for i in $(seq 0 $dev_makeswap); do
2749 ++ for i in $(seq $dev_start $dev_end); do
2750 + swapoff /dev/zram$i > err.log 2>&1
2751 + if [ $? -ne 0 ]; then
2752 + cat err.log
2753 +@@ -196,7 +238,7 @@ zram_swapoff()
2754 +
2755 + zram_makefs()
2756 + {
2757 +- local i=0
2758 ++ local i=$dev_start
2759 + for fs in $zram_filesystems; do
2760 + # if requested fs not supported default it to ext2
2761 + which mkfs.$fs > /dev/null 2>&1 || fs=ext2
2762 +@@ -215,7 +257,7 @@ zram_makefs()
2763 + zram_mount()
2764 + {
2765 + local i=0
2766 +- for i in $(seq 0 $(($dev_num - 1))); do
2767 ++ for i in $(seq $dev_start $dev_end); do
2768 + echo "mount /dev/zram$i"
2769 + mkdir zram$i
2770 + mount /dev/zram$i zram$i > /dev/null || \