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