Contents of /trunk/kernel-magellan/patches-4.20/0104-4.20.5-all-fixes.patch
Parent Directory | Revision Log
Revision 3281 -
(show annotations)
(download)
Mon Mar 4 10:35:52 2019 UTC (5 years, 6 months ago) by niro
File size: 184863 byte(s)
Mon Mar 4 10:35:52 2019 UTC (5 years, 6 months ago) by niro
File size: 184863 byte(s)
linux-4.20.5
1 | diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt |
2 | index 12a5e6e693b6..2a4e63f5122c 100644 |
3 | --- a/Documentation/filesystems/proc.txt |
4 | +++ b/Documentation/filesystems/proc.txt |
5 | @@ -496,7 +496,9 @@ manner. The codes are the following: |
6 | |
7 | Note that there is no guarantee that every flag and associated mnemonic will |
8 | be present in all further kernel releases. Things get changed, the flags may |
9 | -be vanished or the reverse -- new added. |
10 | +be vanished or the reverse -- new added. Interpretation of their meaning |
11 | +might change in future as well. So each consumer of these flags has to |
12 | +follow each specific kernel version for the exact semantic. |
13 | |
14 | This file is only present if the CONFIG_MMU kernel configuration option is |
15 | enabled. |
16 | diff --git a/Makefile b/Makefile |
17 | index a056dba5ede0..690f6a9d9f1b 100644 |
18 | --- a/Makefile |
19 | +++ b/Makefile |
20 | @@ -1,7 +1,7 @@ |
21 | # SPDX-License-Identifier: GPL-2.0 |
22 | VERSION = 4 |
23 | PATCHLEVEL = 20 |
24 | -SUBLEVEL = 4 |
25 | +SUBLEVEL = 5 |
26 | EXTRAVERSION = |
27 | NAME = Shy Crocodile |
28 | |
29 | @@ -1035,6 +1035,8 @@ ifdef CONFIG_GDB_SCRIPTS |
30 | endif |
31 | +$(call if_changed,link-vmlinux) |
32 | |
33 | +targets := vmlinux |
34 | + |
35 | # Build samples along the rest of the kernel. This needs headers_install. |
36 | ifdef CONFIG_SAMPLES |
37 | vmlinux-dirs += samples |
38 | @@ -1753,13 +1755,12 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
39 | cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ |
40 | $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) |
41 | |
42 | -# read all saved command lines |
43 | -cmd_files := $(wildcard .*.cmd) |
44 | +# read saved command lines for existing targets |
45 | +existing-targets := $(wildcard $(sort $(targets))) |
46 | |
47 | -ifneq ($(cmd_files),) |
48 | - $(cmd_files): ; # Do not try to update included dependency files |
49 | - include $(cmd_files) |
50 | -endif |
51 | +cmd_files := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
52 | +$(cmd_files): ; # Do not try to update included dependency files |
53 | +-include $(cmd_files) |
54 | |
55 | endif # ifeq ($(config-targets),1) |
56 | endif # ifeq ($(mixed-targets),1) |
57 | diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile |
58 | index 6cb9fc7e9382..8978f60779c4 100644 |
59 | --- a/arch/arm64/Makefile |
60 | +++ b/arch/arm64/Makefile |
61 | @@ -18,7 +18,7 @@ ifeq ($(CONFIG_RELOCATABLE), y) |
62 | # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour |
63 | # for relative relocs, since this leads to better Image compression |
64 | # with the relocation offsets always being zero. |
65 | -LDFLAGS_vmlinux += -pie -shared -Bsymbolic \ |
66 | +LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro \ |
67 | $(call ld-option, --no-apply-dynamic-relocs) |
68 | endif |
69 | |
70 | diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h |
71 | index 6142402c2eb4..08b216c200c9 100644 |
72 | --- a/arch/arm64/include/asm/assembler.h |
73 | +++ b/arch/arm64/include/asm/assembler.h |
74 | @@ -377,27 +377,33 @@ alternative_endif |
75 | * size: size of the region |
76 | * Corrupts: kaddr, size, tmp1, tmp2 |
77 | */ |
78 | + .macro __dcache_op_workaround_clean_cache, op, kaddr |
79 | +alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE |
80 | + dc \op, \kaddr |
81 | +alternative_else |
82 | + dc civac, \kaddr |
83 | +alternative_endif |
84 | + .endm |
85 | + |
86 | .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 |
87 | dcache_line_size \tmp1, \tmp2 |
88 | add \size, \kaddr, \size |
89 | sub \tmp2, \tmp1, #1 |
90 | bic \kaddr, \kaddr, \tmp2 |
91 | 9998: |
92 | - .if (\op == cvau || \op == cvac) |
93 | -alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE |
94 | - dc \op, \kaddr |
95 | -alternative_else |
96 | - dc civac, \kaddr |
97 | -alternative_endif |
98 | - .elseif (\op == cvap) |
99 | -alternative_if ARM64_HAS_DCPOP |
100 | - sys 3, c7, c12, 1, \kaddr // dc cvap |
101 | -alternative_else |
102 | - dc cvac, \kaddr |
103 | -alternative_endif |
104 | + .ifc \op, cvau |
105 | + __dcache_op_workaround_clean_cache \op, \kaddr |
106 | + .else |
107 | + .ifc \op, cvac |
108 | + __dcache_op_workaround_clean_cache \op, \kaddr |
109 | + .else |
110 | + .ifc \op, cvap |
111 | + sys 3, c7, c12, 1, \kaddr // dc cvap |
112 | .else |
113 | dc \op, \kaddr |
114 | .endif |
115 | + .endif |
116 | + .endif |
117 | add \kaddr, \kaddr, \tmp1 |
118 | cmp \kaddr, \size |
119 | b.lo 9998b |
120 | diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h |
121 | index f0a5c9531e8b..778af0b7f7fd 100644 |
122 | --- a/arch/arm64/include/asm/memory.h |
123 | +++ b/arch/arm64/include/asm/memory.h |
124 | @@ -67,12 +67,17 @@ |
125 | /* |
126 | * KASAN requires 1/8th of the kernel virtual address space for the shadow |
127 | * region. KASAN can bloat the stack significantly, so double the (minimum) |
128 | - * stack size when KASAN is in use. |
129 | + * stack size when KASAN is in use, and then double it again if KASAN_EXTRA is |
130 | + * on. |
131 | */ |
132 | #ifdef CONFIG_KASAN |
133 | #define KASAN_SHADOW_SCALE_SHIFT 3 |
134 | #define KASAN_SHADOW_SIZE (UL(1) << (VA_BITS - KASAN_SHADOW_SCALE_SHIFT)) |
135 | +#ifdef CONFIG_KASAN_EXTRA |
136 | +#define KASAN_THREAD_SHIFT 2 |
137 | +#else |
138 | #define KASAN_THREAD_SHIFT 1 |
139 | +#endif /* CONFIG_KASAN_EXTRA */ |
140 | #else |
141 | #define KASAN_SHADOW_SIZE (0) |
142 | #define KASAN_THREAD_SHIFT 0 |
143 | diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
144 | index 6ad715d67df8..99622e5ad21b 100644 |
145 | --- a/arch/arm64/kernel/cpu_errata.c |
146 | +++ b/arch/arm64/kernel/cpu_errata.c |
147 | @@ -135,7 +135,7 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn, |
148 | const char *hyp_vecs_start, |
149 | const char *hyp_vecs_end) |
150 | { |
151 | - static DEFINE_SPINLOCK(bp_lock); |
152 | + static DEFINE_RAW_SPINLOCK(bp_lock); |
153 | int cpu, slot = -1; |
154 | |
155 | /* |
156 | @@ -147,7 +147,7 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn, |
157 | return; |
158 | } |
159 | |
160 | - spin_lock(&bp_lock); |
161 | + raw_spin_lock(&bp_lock); |
162 | for_each_possible_cpu(cpu) { |
163 | if (per_cpu(bp_hardening_data.fn, cpu) == fn) { |
164 | slot = per_cpu(bp_hardening_data.hyp_vectors_slot, cpu); |
165 | @@ -163,7 +163,7 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn, |
166 | |
167 | __this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot); |
168 | __this_cpu_write(bp_hardening_data.fn, fn); |
169 | - spin_unlock(&bp_lock); |
170 | + raw_spin_unlock(&bp_lock); |
171 | } |
172 | #else |
173 | #define __smccc_workaround_1_smc_start NULL |
174 | diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c |
175 | index e213f8e867f6..8a91ac067d44 100644 |
176 | --- a/arch/arm64/kernel/perf_event.c |
177 | +++ b/arch/arm64/kernel/perf_event.c |
178 | @@ -1274,6 +1274,7 @@ static struct platform_driver armv8_pmu_driver = { |
179 | .driver = { |
180 | .name = ARMV8_PMU_PDEV_NAME, |
181 | .of_match_table = armv8_pmu_of_device_ids, |
182 | + .suppress_bind_attrs = true, |
183 | }, |
184 | .probe = armv8_pmu_device_probe, |
185 | }; |
186 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S |
187 | index 03b00007553d..7fa008374907 100644 |
188 | --- a/arch/arm64/kernel/vmlinux.lds.S |
189 | +++ b/arch/arm64/kernel/vmlinux.lds.S |
190 | @@ -99,7 +99,8 @@ SECTIONS |
191 | *(.discard) |
192 | *(.discard.*) |
193 | *(.interp .dynamic) |
194 | - *(.dynsym .dynstr .hash) |
195 | + *(.dynsym .dynstr .hash .gnu.hash) |
196 | + *(.eh_frame) |
197 | } |
198 | |
199 | . = KIMAGE_VADDR + TEXT_OFFSET; |
200 | @@ -192,12 +193,12 @@ SECTIONS |
201 | |
202 | PERCPU_SECTION(L1_CACHE_BYTES) |
203 | |
204 | - .rela : ALIGN(8) { |
205 | + .rela.dyn : ALIGN(8) { |
206 | *(.rela .rela*) |
207 | } |
208 | |
209 | - __rela_offset = ABSOLUTE(ADDR(.rela) - KIMAGE_VADDR); |
210 | - __rela_size = SIZEOF(.rela); |
211 | + __rela_offset = ABSOLUTE(ADDR(.rela.dyn) - KIMAGE_VADDR); |
212 | + __rela_size = SIZEOF(.rela.dyn); |
213 | |
214 | . = ALIGN(SEGMENT_ALIGN); |
215 | __initdata_end = .; |
216 | diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S |
217 | index 0c22ede52f90..a194fd0e837f 100644 |
218 | --- a/arch/arm64/mm/cache.S |
219 | +++ b/arch/arm64/mm/cache.S |
220 | @@ -212,6 +212,9 @@ ENDPROC(__dma_clean_area) |
221 | * - size - size in question |
222 | */ |
223 | ENTRY(__clean_dcache_area_pop) |
224 | + alternative_if_not ARM64_HAS_DCPOP |
225 | + b __clean_dcache_area_poc |
226 | + alternative_else_nop_endif |
227 | dcache_by_line_op cvap, sy, x0, x1, x2, x3 |
228 | ret |
229 | ENDPIPROC(__clean_dcache_area_pop) |
230 | diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c |
231 | index 63527e585aac..fcb2ca30b6f1 100644 |
232 | --- a/arch/arm64/mm/kasan_init.c |
233 | +++ b/arch/arm64/mm/kasan_init.c |
234 | @@ -39,7 +39,7 @@ static phys_addr_t __init kasan_alloc_zeroed_page(int node) |
235 | { |
236 | void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE, |
237 | __pa(MAX_DMA_ADDRESS), |
238 | - MEMBLOCK_ALLOC_ACCESSIBLE, node); |
239 | + MEMBLOCK_ALLOC_KASAN, node); |
240 | return __pa(p); |
241 | } |
242 | |
243 | diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig |
244 | index 6207b41473a0..bfb3d8451c0a 100644 |
245 | --- a/arch/mips/Kconfig |
246 | +++ b/arch/mips/Kconfig |
247 | @@ -794,6 +794,7 @@ config SIBYTE_SWARM |
248 | select SYS_SUPPORTS_HIGHMEM |
249 | select SYS_SUPPORTS_LITTLE_ENDIAN |
250 | select ZONE_DMA32 if 64BIT |
251 | + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI |
252 | |
253 | config SIBYTE_LITTLESUR |
254 | bool "Sibyte BCM91250C2-LittleSur" |
255 | @@ -814,6 +815,7 @@ config SIBYTE_SENTOSA |
256 | select SYS_HAS_CPU_SB1 |
257 | select SYS_SUPPORTS_BIG_ENDIAN |
258 | select SYS_SUPPORTS_LITTLE_ENDIAN |
259 | + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI |
260 | |
261 | config SIBYTE_BIGSUR |
262 | bool "Sibyte BCM91480B-BigSur" |
263 | @@ -826,6 +828,7 @@ config SIBYTE_BIGSUR |
264 | select SYS_SUPPORTS_HIGHMEM |
265 | select SYS_SUPPORTS_LITTLE_ENDIAN |
266 | select ZONE_DMA32 if 64BIT |
267 | + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI |
268 | |
269 | config SNI_RM |
270 | bool "SNI RM200/300/400" |
271 | diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h |
272 | index dacbdb84516a..532b49b1dbb3 100644 |
273 | --- a/arch/mips/include/asm/cpu.h |
274 | +++ b/arch/mips/include/asm/cpu.h |
275 | @@ -248,8 +248,9 @@ |
276 | #define PRID_REV_LOONGSON3A_R1 0x0005 |
277 | #define PRID_REV_LOONGSON3B_R1 0x0006 |
278 | #define PRID_REV_LOONGSON3B_R2 0x0007 |
279 | -#define PRID_REV_LOONGSON3A_R2 0x0008 |
280 | +#define PRID_REV_LOONGSON3A_R2_0 0x0008 |
281 | #define PRID_REV_LOONGSON3A_R3_0 0x0009 |
282 | +#define PRID_REV_LOONGSON3A_R2_1 0x000c |
283 | #define PRID_REV_LOONGSON3A_R3_1 0x000d |
284 | |
285 | /* |
286 | diff --git a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h |
287 | index cbac603ced19..b5e288a12dfe 100644 |
288 | --- a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h |
289 | +++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h |
290 | @@ -31,7 +31,7 @@ |
291 | /* Enable STFill Buffer */ |
292 | mfc0 t0, CP0_PRID |
293 | andi t0, (PRID_IMP_MASK | PRID_REV_MASK) |
294 | - slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2) |
295 | + slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0) |
296 | bnez t0, 1f |
297 | mfc0 t0, CP0_CONFIG6 |
298 | or t0, 0x100 |
299 | @@ -60,7 +60,7 @@ |
300 | /* Enable STFill Buffer */ |
301 | mfc0 t0, CP0_PRID |
302 | andi t0, (PRID_IMP_MASK | PRID_REV_MASK) |
303 | - slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2) |
304 | + slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0) |
305 | bnez t0, 1f |
306 | mfc0 t0, CP0_CONFIG6 |
307 | or t0, 0x100 |
308 | diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c |
309 | index d535fc706a8b..f70cf6447cfb 100644 |
310 | --- a/arch/mips/kernel/cpu-probe.c |
311 | +++ b/arch/mips/kernel/cpu-probe.c |
312 | @@ -1843,7 +1843,8 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) |
313 | switch (c->processor_id & PRID_IMP_MASK) { |
314 | case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ |
315 | switch (c->processor_id & PRID_REV_MASK) { |
316 | - case PRID_REV_LOONGSON3A_R2: |
317 | + case PRID_REV_LOONGSON3A_R2_0: |
318 | + case PRID_REV_LOONGSON3A_R2_1: |
319 | c->cputype = CPU_LOONGSON3; |
320 | __cpu_name[cpu] = "ICT Loongson-3"; |
321 | set_elf_platform(cpu, "loongson3a"); |
322 | diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c |
323 | index 046846999efd..909b7a87c89c 100644 |
324 | --- a/arch/mips/kernel/idle.c |
325 | +++ b/arch/mips/kernel/idle.c |
326 | @@ -183,7 +183,7 @@ void __init check_wait(void) |
327 | cpu_wait = r4k_wait; |
328 | break; |
329 | case CPU_LOONGSON3: |
330 | - if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2) |
331 | + if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2_0) |
332 | cpu_wait = r4k_wait; |
333 | break; |
334 | |
335 | diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c |
336 | index 8f68ee02a8c2..72e5f8fb2b35 100644 |
337 | --- a/arch/mips/loongson64/common/env.c |
338 | +++ b/arch/mips/loongson64/common/env.c |
339 | @@ -197,7 +197,8 @@ void __init prom_init_env(void) |
340 | cpu_clock_freq = 797000000; |
341 | break; |
342 | case PRID_REV_LOONGSON3A_R1: |
343 | - case PRID_REV_LOONGSON3A_R2: |
344 | + case PRID_REV_LOONGSON3A_R2_0: |
345 | + case PRID_REV_LOONGSON3A_R2_1: |
346 | case PRID_REV_LOONGSON3A_R3_0: |
347 | case PRID_REV_LOONGSON3A_R3_1: |
348 | cpu_clock_freq = 900000000; |
349 | diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c |
350 | index b5c1e0aa955e..8fba0aa48bf4 100644 |
351 | --- a/arch/mips/loongson64/loongson-3/smp.c |
352 | +++ b/arch/mips/loongson64/loongson-3/smp.c |
353 | @@ -682,7 +682,8 @@ void play_dead(void) |
354 | play_dead_at_ckseg1 = |
355 | (void *)CKSEG1ADDR((unsigned long)loongson3a_r1_play_dead); |
356 | break; |
357 | - case PRID_REV_LOONGSON3A_R2: |
358 | + case PRID_REV_LOONGSON3A_R2_0: |
359 | + case PRID_REV_LOONGSON3A_R2_1: |
360 | case PRID_REV_LOONGSON3A_R3_0: |
361 | case PRID_REV_LOONGSON3A_R3_1: |
362 | play_dead_at_ckseg1 = |
363 | diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c |
364 | index 2a6ad461286f..96d666a0f4a0 100644 |
365 | --- a/arch/mips/mm/c-r4k.c |
366 | +++ b/arch/mips/mm/c-r4k.c |
367 | @@ -1381,7 +1381,7 @@ static void probe_pcache(void) |
368 | c->dcache.ways * |
369 | c->dcache.linesz; |
370 | c->dcache.waybit = 0; |
371 | - if ((prid & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2) |
372 | + if ((prid & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2_0) |
373 | c->options |= MIPS_CPU_PREFETCH; |
374 | break; |
375 | |
376 | diff --git a/arch/mips/sibyte/common/Makefile b/arch/mips/sibyte/common/Makefile |
377 | index b3d6bf23a662..3ef3fb658136 100644 |
378 | --- a/arch/mips/sibyte/common/Makefile |
379 | +++ b/arch/mips/sibyte/common/Makefile |
380 | @@ -1,4 +1,5 @@ |
381 | obj-y := cfe.o |
382 | +obj-$(CONFIG_SWIOTLB) += dma.o |
383 | obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o |
384 | obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o |
385 | obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o |
386 | diff --git a/arch/mips/sibyte/common/dma.c b/arch/mips/sibyte/common/dma.c |
387 | new file mode 100644 |
388 | index 000000000000..eb47a94f3583 |
389 | --- /dev/null |
390 | +++ b/arch/mips/sibyte/common/dma.c |
391 | @@ -0,0 +1,14 @@ |
392 | +// SPDX-License-Identifier: GPL-2.0+ |
393 | +/* |
394 | + * DMA support for Broadcom SiByte platforms. |
395 | + * |
396 | + * Copyright (c) 2018 Maciej W. Rozycki |
397 | + */ |
398 | + |
399 | +#include <linux/swiotlb.h> |
400 | +#include <asm/bootinfo.h> |
401 | + |
402 | +void __init plat_swiotlb_setup(void) |
403 | +{ |
404 | + swiotlb_init(1); |
405 | +} |
406 | diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c |
407 | index 401d2ecbebc5..f8176ae3a5a7 100644 |
408 | --- a/arch/powerpc/kvm/book3s_hv_nested.c |
409 | +++ b/arch/powerpc/kvm/book3s_hv_nested.c |
410 | @@ -1220,6 +1220,8 @@ static long int __kvmhv_nested_page_fault(struct kvm_vcpu *vcpu, |
411 | return ret; |
412 | shift = kvmppc_radix_level_to_shift(level); |
413 | } |
414 | + /* Align gfn to the start of the page */ |
415 | + gfn = (gpa & ~((1UL << shift) - 1)) >> PAGE_SHIFT; |
416 | |
417 | /* 3. Compute the pte we need to insert for nest_gpa -> host r_addr */ |
418 | |
419 | @@ -1227,6 +1229,9 @@ static long int __kvmhv_nested_page_fault(struct kvm_vcpu *vcpu, |
420 | perm |= gpte.may_read ? 0UL : _PAGE_READ; |
421 | perm |= gpte.may_write ? 0UL : _PAGE_WRITE; |
422 | perm |= gpte.may_execute ? 0UL : _PAGE_EXEC; |
423 | + /* Only set accessed/dirty (rc) bits if set in host and l1 guest ptes */ |
424 | + perm |= (gpte.rc & _PAGE_ACCESSED) ? 0UL : _PAGE_ACCESSED; |
425 | + perm |= ((gpte.rc & _PAGE_DIRTY) && writing) ? 0UL : _PAGE_DIRTY; |
426 | pte = __pte(pte_val(pte) & ~perm); |
427 | |
428 | /* What size pte can we insert? */ |
429 | diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c |
430 | index 36b8dc47a3c3..b566203d09c5 100644 |
431 | --- a/arch/powerpc/xmon/xmon.c |
432 | +++ b/arch/powerpc/xmon/xmon.c |
433 | @@ -75,6 +75,9 @@ static int xmon_gate; |
434 | #define xmon_owner 0 |
435 | #endif /* CONFIG_SMP */ |
436 | |
437 | +#ifdef CONFIG_PPC_PSERIES |
438 | +static int set_indicator_token = RTAS_UNKNOWN_SERVICE; |
439 | +#endif |
440 | static unsigned long in_xmon __read_mostly = 0; |
441 | static int xmon_on = IS_ENABLED(CONFIG_XMON_DEFAULT); |
442 | |
443 | @@ -358,7 +361,6 @@ static inline void disable_surveillance(void) |
444 | #ifdef CONFIG_PPC_PSERIES |
445 | /* Since this can't be a module, args should end up below 4GB. */ |
446 | static struct rtas_args args; |
447 | - int token; |
448 | |
449 | /* |
450 | * At this point we have got all the cpus we can into |
451 | @@ -367,11 +369,11 @@ static inline void disable_surveillance(void) |
452 | * If we did try to take rtas.lock there would be a |
453 | * real possibility of deadlock. |
454 | */ |
455 | - token = rtas_token("set-indicator"); |
456 | - if (token == RTAS_UNKNOWN_SERVICE) |
457 | + if (set_indicator_token == RTAS_UNKNOWN_SERVICE) |
458 | return; |
459 | |
460 | - rtas_call_unlocked(&args, token, 3, 1, NULL, SURVEILLANCE_TOKEN, 0, 0); |
461 | + rtas_call_unlocked(&args, set_indicator_token, 3, 1, NULL, |
462 | + SURVEILLANCE_TOKEN, 0, 0); |
463 | |
464 | #endif /* CONFIG_PPC_PSERIES */ |
465 | } |
466 | @@ -3688,6 +3690,14 @@ static void xmon_init(int enable) |
467 | __debugger_iabr_match = xmon_iabr_match; |
468 | __debugger_break_match = xmon_break_match; |
469 | __debugger_fault_handler = xmon_fault_handler; |
470 | + |
471 | +#ifdef CONFIG_PPC_PSERIES |
472 | + /* |
473 | + * Get the token here to avoid trying to get a lock |
474 | + * during the crash, causing a deadlock. |
475 | + */ |
476 | + set_indicator_token = rtas_token("set-indicator"); |
477 | +#endif |
478 | } else { |
479 | __debugger = NULL; |
480 | __debugger_ipi = NULL; |
481 | diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h |
482 | index 3de69330e6c5..afbc87206886 100644 |
483 | --- a/arch/x86/include/asm/traps.h |
484 | +++ b/arch/x86/include/asm/traps.h |
485 | @@ -104,9 +104,9 @@ extern int panic_on_unrecovered_nmi; |
486 | |
487 | void math_emulate(struct math_emu_info *); |
488 | #ifndef CONFIG_X86_32 |
489 | -asmlinkage void smp_thermal_interrupt(void); |
490 | -asmlinkage void smp_threshold_interrupt(void); |
491 | -asmlinkage void smp_deferred_error_interrupt(void); |
492 | +asmlinkage void smp_thermal_interrupt(struct pt_regs *regs); |
493 | +asmlinkage void smp_threshold_interrupt(struct pt_regs *regs); |
494 | +asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs); |
495 | #endif |
496 | |
497 | extern void ist_enter(struct pt_regs *regs); |
498 | diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c |
499 | index 44272b7107ad..2d0a565fd0bb 100644 |
500 | --- a/arch/x86/kernel/cpu/intel_rdt.c |
501 | +++ b/arch/x86/kernel/cpu/intel_rdt.c |
502 | @@ -421,7 +421,7 @@ struct rdt_domain *rdt_find_domain(struct rdt_resource *r, int id, |
503 | struct list_head *l; |
504 | |
505 | if (id < 0) |
506 | - return ERR_PTR(id); |
507 | + return ERR_PTR(-ENODEV); |
508 | |
509 | list_for_each(l, &r->domains) { |
510 | d = list_entry(l, struct rdt_domain, list); |
511 | diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c |
512 | index efa4a519f5e5..c8b72aff55e0 100644 |
513 | --- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c |
514 | +++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c |
515 | @@ -467,7 +467,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) |
516 | |
517 | r = &rdt_resources_all[resid]; |
518 | d = rdt_find_domain(r, domid, NULL); |
519 | - if (!d) { |
520 | + if (IS_ERR_OR_NULL(d)) { |
521 | ret = -ENOENT; |
522 | goto out; |
523 | } |
524 | diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
525 | index f27b8115ffa2..951c61367688 100644 |
526 | --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
527 | +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
528 | @@ -1029,7 +1029,7 @@ static int rdt_cdp_peer_get(struct rdt_resource *r, struct rdt_domain *d, |
529 | * peer RDT CDP resource. Hence the WARN. |
530 | */ |
531 | _d_cdp = rdt_find_domain(_r_cdp, d->id, NULL); |
532 | - if (WARN_ON(!_d_cdp)) { |
533 | + if (WARN_ON(IS_ERR_OR_NULL(_d_cdp))) { |
534 | _r_cdp = NULL; |
535 | ret = -EINVAL; |
536 | } |
537 | diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c |
538 | index e12454e21b8a..9f915a8791cc 100644 |
539 | --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c |
540 | +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c |
541 | @@ -23,6 +23,7 @@ |
542 | #include <linux/string.h> |
543 | |
544 | #include <asm/amd_nb.h> |
545 | +#include <asm/traps.h> |
546 | #include <asm/apic.h> |
547 | #include <asm/mce.h> |
548 | #include <asm/msr.h> |
549 | @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = |
550 | [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } |
551 | }; |
552 | |
553 | -const char *smca_get_name(enum smca_bank_types t) |
554 | +static const char *smca_get_name(enum smca_bank_types t) |
555 | { |
556 | if (t >= N_SMCA_BANK_TYPES) |
557 | return NULL; |
558 | @@ -824,7 +825,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc) |
559 | mce_log(&m); |
560 | } |
561 | |
562 | -asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(void) |
563 | +asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(struct pt_regs *regs) |
564 | { |
565 | entering_irq(); |
566 | trace_deferred_error_apic_entry(DEFERRED_ERROR_VECTOR); |
567 | diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
568 | index 2da67b70ba98..ee229ceee745 100644 |
569 | --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c |
570 | +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
571 | @@ -25,6 +25,7 @@ |
572 | #include <linux/cpu.h> |
573 | |
574 | #include <asm/processor.h> |
575 | +#include <asm/traps.h> |
576 | #include <asm/apic.h> |
577 | #include <asm/mce.h> |
578 | #include <asm/msr.h> |
579 | @@ -390,7 +391,7 @@ static void unexpected_thermal_interrupt(void) |
580 | |
581 | static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; |
582 | |
583 | -asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) |
584 | +asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *regs) |
585 | { |
586 | entering_irq(); |
587 | trace_thermal_apic_entry(THERMAL_APIC_VECTOR); |
588 | diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c |
589 | index 2b584b319eff..c21e0a1efd0f 100644 |
590 | --- a/arch/x86/kernel/cpu/mcheck/threshold.c |
591 | +++ b/arch/x86/kernel/cpu/mcheck/threshold.c |
592 | @@ -6,6 +6,7 @@ |
593 | #include <linux/kernel.h> |
594 | |
595 | #include <asm/irq_vectors.h> |
596 | +#include <asm/traps.h> |
597 | #include <asm/apic.h> |
598 | #include <asm/mce.h> |
599 | #include <asm/trace/irq_vectors.h> |
600 | @@ -18,7 +19,7 @@ static void default_threshold_interrupt(void) |
601 | |
602 | void (*mce_threshold_vector)(void) = default_threshold_interrupt; |
603 | |
604 | -asmlinkage __visible void __irq_entry smp_threshold_interrupt(void) |
605 | +asmlinkage __visible void __irq_entry smp_threshold_interrupt(struct pt_regs *regs) |
606 | { |
607 | entering_irq(); |
608 | trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR); |
609 | diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
610 | index a9134d1910b9..ccd1f2a8e557 100644 |
611 | --- a/arch/x86/kernel/smpboot.c |
612 | +++ b/arch/x86/kernel/smpboot.c |
613 | @@ -1347,7 +1347,7 @@ void __init calculate_max_logical_packages(void) |
614 | * extrapolate the boot cpu's data to all packages. |
615 | */ |
616 | ncpus = cpu_data(0).booted_cores * topology_max_smt_threads(); |
617 | - __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus); |
618 | + __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus); |
619 | pr_info("Max logical packages: %u\n", __max_logical_packages); |
620 | } |
621 | |
622 | diff --git a/crypto/ecc.c b/crypto/ecc.c |
623 | index 8facafd67802..adcce310f646 100644 |
624 | --- a/crypto/ecc.c |
625 | +++ b/crypto/ecc.c |
626 | @@ -842,15 +842,23 @@ static void xycz_add_c(u64 *x1, u64 *y1, u64 *x2, u64 *y2, u64 *curve_prime, |
627 | |
628 | static void ecc_point_mult(struct ecc_point *result, |
629 | const struct ecc_point *point, const u64 *scalar, |
630 | - u64 *initial_z, u64 *curve_prime, |
631 | + u64 *initial_z, const struct ecc_curve *curve, |
632 | unsigned int ndigits) |
633 | { |
634 | /* R0 and R1 */ |
635 | u64 rx[2][ECC_MAX_DIGITS]; |
636 | u64 ry[2][ECC_MAX_DIGITS]; |
637 | u64 z[ECC_MAX_DIGITS]; |
638 | + u64 sk[2][ECC_MAX_DIGITS]; |
639 | + u64 *curve_prime = curve->p; |
640 | int i, nb; |
641 | - int num_bits = vli_num_bits(scalar, ndigits); |
642 | + int num_bits; |
643 | + int carry; |
644 | + |
645 | + carry = vli_add(sk[0], scalar, curve->n, ndigits); |
646 | + vli_add(sk[1], sk[0], curve->n, ndigits); |
647 | + scalar = sk[!carry]; |
648 | + num_bits = sizeof(u64) * ndigits * 8 + 1; |
649 | |
650 | vli_set(rx[1], point->x, ndigits); |
651 | vli_set(ry[1], point->y, ndigits); |
652 | @@ -1004,7 +1012,7 @@ int ecc_make_pub_key(unsigned int curve_id, unsigned int ndigits, |
653 | goto out; |
654 | } |
655 | |
656 | - ecc_point_mult(pk, &curve->g, priv, NULL, curve->p, ndigits); |
657 | + ecc_point_mult(pk, &curve->g, priv, NULL, curve, ndigits); |
658 | if (ecc_point_is_zero(pk)) { |
659 | ret = -EAGAIN; |
660 | goto err_free_point; |
661 | @@ -1090,7 +1098,7 @@ int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, |
662 | goto err_alloc_product; |
663 | } |
664 | |
665 | - ecc_point_mult(product, pk, priv, rand_z, curve->p, ndigits); |
666 | + ecc_point_mult(product, pk, priv, rand_z, curve, ndigits); |
667 | |
668 | ecc_swap_digits(product->x, secret, ndigits); |
669 | |
670 | diff --git a/drivers/base/bus.c b/drivers/base/bus.c |
671 | index 8bfd27ec73d6..585e2e1c9c8f 100644 |
672 | --- a/drivers/base/bus.c |
673 | +++ b/drivers/base/bus.c |
674 | @@ -31,6 +31,9 @@ static struct kset *system_kset; |
675 | |
676 | #define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr) |
677 | |
678 | +#define DRIVER_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ |
679 | + struct driver_attribute driver_attr_##_name = \ |
680 | + __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) |
681 | |
682 | static int __must_check bus_rescan_devices_helper(struct device *dev, |
683 | void *data); |
684 | @@ -195,7 +198,7 @@ static ssize_t unbind_store(struct device_driver *drv, const char *buf, |
685 | bus_put(bus); |
686 | return err; |
687 | } |
688 | -static DRIVER_ATTR_WO(unbind); |
689 | +static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, S_IWUSR, NULL, unbind_store); |
690 | |
691 | /* |
692 | * Manually attach a device to a driver. |
693 | @@ -231,7 +234,7 @@ static ssize_t bind_store(struct device_driver *drv, const char *buf, |
694 | bus_put(bus); |
695 | return err; |
696 | } |
697 | -static DRIVER_ATTR_WO(bind); |
698 | +static DRIVER_ATTR_IGNORE_LOCKDEP(bind, S_IWUSR, NULL, bind_store); |
699 | |
700 | static ssize_t show_drivers_autoprobe(struct bus_type *bus, char *buf) |
701 | { |
702 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
703 | index 7439a7eb50ac..05c8a7ed859c 100644 |
704 | --- a/drivers/bluetooth/btusb.c |
705 | +++ b/drivers/bluetooth/btusb.c |
706 | @@ -344,6 +344,7 @@ static const struct usb_device_id blacklist_table[] = { |
707 | /* Intel Bluetooth devices */ |
708 | { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW }, |
709 | { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW }, |
710 | + { USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW }, |
711 | { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, |
712 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, |
713 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, |
714 | @@ -2055,6 +2056,35 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb) |
715 | return -EILSEQ; |
716 | } |
717 | |
718 | +static bool btusb_setup_intel_new_get_fw_name(struct intel_version *ver, |
719 | + struct intel_boot_params *params, |
720 | + char *fw_name, size_t len, |
721 | + const char *suffix) |
722 | +{ |
723 | + switch (ver->hw_variant) { |
724 | + case 0x0b: /* SfP */ |
725 | + case 0x0c: /* WsP */ |
726 | + snprintf(fw_name, len, "intel/ibt-%u-%u.%s", |
727 | + le16_to_cpu(ver->hw_variant), |
728 | + le16_to_cpu(params->dev_revid), |
729 | + suffix); |
730 | + break; |
731 | + case 0x11: /* JfP */ |
732 | + case 0x12: /* ThP */ |
733 | + case 0x13: /* HrP */ |
734 | + case 0x14: /* CcP */ |
735 | + snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s", |
736 | + le16_to_cpu(ver->hw_variant), |
737 | + le16_to_cpu(ver->hw_revision), |
738 | + le16_to_cpu(ver->fw_revision), |
739 | + suffix); |
740 | + break; |
741 | + default: |
742 | + return false; |
743 | + } |
744 | + return true; |
745 | +} |
746 | + |
747 | static int btusb_setup_intel_new(struct hci_dev *hdev) |
748 | { |
749 | struct btusb_data *data = hci_get_drvdata(hdev); |
750 | @@ -2106,7 +2136,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) |
751 | case 0x11: /* JfP */ |
752 | case 0x12: /* ThP */ |
753 | case 0x13: /* HrP */ |
754 | - case 0x14: /* QnJ, IcP */ |
755 | + case 0x14: /* CcP */ |
756 | break; |
757 | default: |
758 | bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", |
759 | @@ -2190,23 +2220,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) |
760 | * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. |
761 | * |
762 | */ |
763 | - switch (ver.hw_variant) { |
764 | - case 0x0b: /* SfP */ |
765 | - case 0x0c: /* WsP */ |
766 | - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi", |
767 | - le16_to_cpu(ver.hw_variant), |
768 | - le16_to_cpu(params.dev_revid)); |
769 | - break; |
770 | - case 0x11: /* JfP */ |
771 | - case 0x12: /* ThP */ |
772 | - case 0x13: /* HrP */ |
773 | - case 0x14: /* QnJ, IcP */ |
774 | - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi", |
775 | - le16_to_cpu(ver.hw_variant), |
776 | - le16_to_cpu(ver.hw_revision), |
777 | - le16_to_cpu(ver.fw_revision)); |
778 | - break; |
779 | - default: |
780 | + err = btusb_setup_intel_new_get_fw_name(&ver, ¶ms, fwname, |
781 | + sizeof(fwname), "sfi"); |
782 | + if (!err) { |
783 | bt_dev_err(hdev, "Unsupported Intel firmware naming"); |
784 | return -EINVAL; |
785 | } |
786 | @@ -2222,23 +2238,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) |
787 | /* Save the DDC file name for later use to apply once the firmware |
788 | * downloading is done. |
789 | */ |
790 | - switch (ver.hw_variant) { |
791 | - case 0x0b: /* SfP */ |
792 | - case 0x0c: /* WsP */ |
793 | - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc", |
794 | - le16_to_cpu(ver.hw_variant), |
795 | - le16_to_cpu(params.dev_revid)); |
796 | - break; |
797 | - case 0x11: /* JfP */ |
798 | - case 0x12: /* ThP */ |
799 | - case 0x13: /* HrP */ |
800 | - case 0x14: /* QnJ, IcP */ |
801 | - snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc", |
802 | - le16_to_cpu(ver.hw_variant), |
803 | - le16_to_cpu(ver.hw_revision), |
804 | - le16_to_cpu(ver.fw_revision)); |
805 | - break; |
806 | - default: |
807 | + err = btusb_setup_intel_new_get_fw_name(&ver, ¶ms, fwname, |
808 | + sizeof(fwname), "ddc"); |
809 | + if (!err) { |
810 | bt_dev_err(hdev, "Unsupported Intel firmware naming"); |
811 | return -EINVAL; |
812 | } |
813 | diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
814 | index a74ce885b541..c518659b4d9f 100644 |
815 | --- a/drivers/char/ipmi/ipmi_msghandler.c |
816 | +++ b/drivers/char/ipmi/ipmi_msghandler.c |
817 | @@ -32,6 +32,7 @@ |
818 | #include <linux/moduleparam.h> |
819 | #include <linux/workqueue.h> |
820 | #include <linux/uuid.h> |
821 | +#include <linux/nospec.h> |
822 | |
823 | #define IPMI_DRIVER_VERSION "39.2" |
824 | |
825 | @@ -62,7 +63,8 @@ static void ipmi_debug_msg(const char *title, unsigned char *data, |
826 | { } |
827 | #endif |
828 | |
829 | -static int initialized; |
830 | +static bool initialized; |
831 | +static bool drvregistered; |
832 | |
833 | enum ipmi_panic_event_op { |
834 | IPMI_SEND_PANIC_EVENT_NONE, |
835 | @@ -612,7 +614,7 @@ static DEFINE_MUTEX(ipmidriver_mutex); |
836 | |
837 | static LIST_HEAD(ipmi_interfaces); |
838 | static DEFINE_MUTEX(ipmi_interfaces_mutex); |
839 | -DEFINE_STATIC_SRCU(ipmi_interfaces_srcu); |
840 | +struct srcu_struct ipmi_interfaces_srcu; |
841 | |
842 | /* |
843 | * List of watchers that want to know when smi's are added and deleted. |
844 | @@ -720,7 +722,15 @@ struct watcher_entry { |
845 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) |
846 | { |
847 | struct ipmi_smi *intf; |
848 | - int index; |
849 | + int index, rv; |
850 | + |
851 | + /* |
852 | + * Make sure the driver is actually initialized, this handles |
853 | + * problems with initialization order. |
854 | + */ |
855 | + rv = ipmi_init_msghandler(); |
856 | + if (rv) |
857 | + return rv; |
858 | |
859 | mutex_lock(&smi_watchers_mutex); |
860 | |
861 | @@ -884,7 +894,7 @@ static int deliver_response(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) |
862 | |
863 | if (user) { |
864 | user->handler->ipmi_recv_hndl(msg, user->handler_data); |
865 | - release_ipmi_user(msg->user, index); |
866 | + release_ipmi_user(user, index); |
867 | } else { |
868 | /* User went away, give up. */ |
869 | ipmi_free_recv_msg(msg); |
870 | @@ -1076,7 +1086,7 @@ int ipmi_create_user(unsigned int if_num, |
871 | { |
872 | unsigned long flags; |
873 | struct ipmi_user *new_user; |
874 | - int rv = 0, index; |
875 | + int rv, index; |
876 | struct ipmi_smi *intf; |
877 | |
878 | /* |
879 | @@ -1094,18 +1104,9 @@ int ipmi_create_user(unsigned int if_num, |
880 | * Make sure the driver is actually initialized, this handles |
881 | * problems with initialization order. |
882 | */ |
883 | - if (!initialized) { |
884 | - rv = ipmi_init_msghandler(); |
885 | - if (rv) |
886 | - return rv; |
887 | - |
888 | - /* |
889 | - * The init code doesn't return an error if it was turned |
890 | - * off, but it won't initialize. Check that. |
891 | - */ |
892 | - if (!initialized) |
893 | - return -ENODEV; |
894 | - } |
895 | + rv = ipmi_init_msghandler(); |
896 | + if (rv) |
897 | + return rv; |
898 | |
899 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
900 | if (!new_user) |
901 | @@ -1183,6 +1184,7 @@ EXPORT_SYMBOL(ipmi_get_smi_info); |
902 | static void free_user(struct kref *ref) |
903 | { |
904 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); |
905 | + cleanup_srcu_struct(&user->release_barrier); |
906 | kfree(user); |
907 | } |
908 | |
909 | @@ -1259,7 +1261,6 @@ int ipmi_destroy_user(struct ipmi_user *user) |
910 | { |
911 | _ipmi_destroy_user(user); |
912 | |
913 | - cleanup_srcu_struct(&user->release_barrier); |
914 | kref_put(&user->refcount, free_user); |
915 | |
916 | return 0; |
917 | @@ -1298,10 +1299,12 @@ int ipmi_set_my_address(struct ipmi_user *user, |
918 | if (!user) |
919 | return -ENODEV; |
920 | |
921 | - if (channel >= IPMI_MAX_CHANNELS) |
922 | + if (channel >= IPMI_MAX_CHANNELS) { |
923 | rv = -EINVAL; |
924 | - else |
925 | + } else { |
926 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); |
927 | user->intf->addrinfo[channel].address = address; |
928 | + } |
929 | release_ipmi_user(user, index); |
930 | |
931 | return rv; |
932 | @@ -1318,10 +1321,12 @@ int ipmi_get_my_address(struct ipmi_user *user, |
933 | if (!user) |
934 | return -ENODEV; |
935 | |
936 | - if (channel >= IPMI_MAX_CHANNELS) |
937 | + if (channel >= IPMI_MAX_CHANNELS) { |
938 | rv = -EINVAL; |
939 | - else |
940 | + } else { |
941 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); |
942 | *address = user->intf->addrinfo[channel].address; |
943 | + } |
944 | release_ipmi_user(user, index); |
945 | |
946 | return rv; |
947 | @@ -1338,10 +1343,12 @@ int ipmi_set_my_LUN(struct ipmi_user *user, |
948 | if (!user) |
949 | return -ENODEV; |
950 | |
951 | - if (channel >= IPMI_MAX_CHANNELS) |
952 | + if (channel >= IPMI_MAX_CHANNELS) { |
953 | rv = -EINVAL; |
954 | - else |
955 | + } else { |
956 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); |
957 | user->intf->addrinfo[channel].lun = LUN & 0x3; |
958 | + } |
959 | release_ipmi_user(user, index); |
960 | |
961 | return rv; |
962 | @@ -1358,10 +1365,12 @@ int ipmi_get_my_LUN(struct ipmi_user *user, |
963 | if (!user) |
964 | return -ENODEV; |
965 | |
966 | - if (channel >= IPMI_MAX_CHANNELS) |
967 | + if (channel >= IPMI_MAX_CHANNELS) { |
968 | rv = -EINVAL; |
969 | - else |
970 | + } else { |
971 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); |
972 | *address = user->intf->addrinfo[channel].lun; |
973 | + } |
974 | release_ipmi_user(user, index); |
975 | |
976 | return rv; |
977 | @@ -2184,6 +2193,7 @@ static int check_addr(struct ipmi_smi *intf, |
978 | { |
979 | if (addr->channel >= IPMI_MAX_CHANNELS) |
980 | return -EINVAL; |
981 | + addr->channel = array_index_nospec(addr->channel, IPMI_MAX_CHANNELS); |
982 | *lun = intf->addrinfo[addr->channel].lun; |
983 | *saddr = intf->addrinfo[addr->channel].address; |
984 | return 0; |
985 | @@ -3291,17 +3301,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
986 | * Make sure the driver is actually initialized, this handles |
987 | * problems with initialization order. |
988 | */ |
989 | - if (!initialized) { |
990 | - rv = ipmi_init_msghandler(); |
991 | - if (rv) |
992 | - return rv; |
993 | - /* |
994 | - * The init code doesn't return an error if it was turned |
995 | - * off, but it won't initialize. Check that. |
996 | - */ |
997 | - if (!initialized) |
998 | - return -ENODEV; |
999 | - } |
1000 | + rv = ipmi_init_msghandler(); |
1001 | + if (rv) |
1002 | + return rv; |
1003 | |
1004 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); |
1005 | if (!intf) |
1006 | @@ -5017,6 +5019,22 @@ static int panic_event(struct notifier_block *this, |
1007 | return NOTIFY_DONE; |
1008 | } |
1009 | |
1010 | +/* Must be called with ipmi_interfaces_mutex held. */ |
1011 | +static int ipmi_register_driver(void) |
1012 | +{ |
1013 | + int rv; |
1014 | + |
1015 | + if (drvregistered) |
1016 | + return 0; |
1017 | + |
1018 | + rv = driver_register(&ipmidriver.driver); |
1019 | + if (rv) |
1020 | + pr_err("Could not register IPMI driver\n"); |
1021 | + else |
1022 | + drvregistered = true; |
1023 | + return rv; |
1024 | +} |
1025 | + |
1026 | static struct notifier_block panic_block = { |
1027 | .notifier_call = panic_event, |
1028 | .next = NULL, |
1029 | @@ -5027,66 +5045,75 @@ static int ipmi_init_msghandler(void) |
1030 | { |
1031 | int rv; |
1032 | |
1033 | + mutex_lock(&ipmi_interfaces_mutex); |
1034 | + rv = ipmi_register_driver(); |
1035 | + if (rv) |
1036 | + goto out; |
1037 | if (initialized) |
1038 | - return 0; |
1039 | - |
1040 | - rv = driver_register(&ipmidriver.driver); |
1041 | - if (rv) { |
1042 | - pr_err("Could not register IPMI driver\n"); |
1043 | - return rv; |
1044 | - } |
1045 | + goto out; |
1046 | |
1047 | - pr_info("version " IPMI_DRIVER_VERSION "\n"); |
1048 | + init_srcu_struct(&ipmi_interfaces_srcu); |
1049 | |
1050 | timer_setup(&ipmi_timer, ipmi_timeout, 0); |
1051 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
1052 | |
1053 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
1054 | |
1055 | - initialized = 1; |
1056 | + initialized = true; |
1057 | |
1058 | - return 0; |
1059 | +out: |
1060 | + mutex_unlock(&ipmi_interfaces_mutex); |
1061 | + return rv; |
1062 | } |
1063 | |
1064 | static int __init ipmi_init_msghandler_mod(void) |
1065 | { |
1066 | - ipmi_init_msghandler(); |
1067 | - return 0; |
1068 | + int rv; |
1069 | + |
1070 | + pr_info("version " IPMI_DRIVER_VERSION "\n"); |
1071 | + |
1072 | + mutex_lock(&ipmi_interfaces_mutex); |
1073 | + rv = ipmi_register_driver(); |
1074 | + mutex_unlock(&ipmi_interfaces_mutex); |
1075 | + |
1076 | + return rv; |
1077 | } |
1078 | |
1079 | static void __exit cleanup_ipmi(void) |
1080 | { |
1081 | int count; |
1082 | |
1083 | - if (!initialized) |
1084 | - return; |
1085 | - |
1086 | - atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); |
1087 | + if (initialized) { |
1088 | + atomic_notifier_chain_unregister(&panic_notifier_list, |
1089 | + &panic_block); |
1090 | |
1091 | - /* |
1092 | - * This can't be called if any interfaces exist, so no worry |
1093 | - * about shutting down the interfaces. |
1094 | - */ |
1095 | + /* |
1096 | + * This can't be called if any interfaces exist, so no worry |
1097 | + * about shutting down the interfaces. |
1098 | + */ |
1099 | |
1100 | - /* |
1101 | - * Tell the timer to stop, then wait for it to stop. This |
1102 | - * avoids problems with race conditions removing the timer |
1103 | - * here. |
1104 | - */ |
1105 | - atomic_inc(&stop_operation); |
1106 | - del_timer_sync(&ipmi_timer); |
1107 | + /* |
1108 | + * Tell the timer to stop, then wait for it to stop. This |
1109 | + * avoids problems with race conditions removing the timer |
1110 | + * here. |
1111 | + */ |
1112 | + atomic_inc(&stop_operation); |
1113 | + del_timer_sync(&ipmi_timer); |
1114 | |
1115 | - driver_unregister(&ipmidriver.driver); |
1116 | + initialized = false; |
1117 | |
1118 | - initialized = 0; |
1119 | + /* Check for buffer leaks. */ |
1120 | + count = atomic_read(&smi_msg_inuse_count); |
1121 | + if (count != 0) |
1122 | + pr_warn("SMI message count %d at exit\n", count); |
1123 | + count = atomic_read(&recv_msg_inuse_count); |
1124 | + if (count != 0) |
1125 | + pr_warn("recv message count %d at exit\n", count); |
1126 | |
1127 | - /* Check for buffer leaks. */ |
1128 | - count = atomic_read(&smi_msg_inuse_count); |
1129 | - if (count != 0) |
1130 | - pr_warn("SMI message count %d at exit\n", count); |
1131 | - count = atomic_read(&recv_msg_inuse_count); |
1132 | - if (count != 0) |
1133 | - pr_warn("recv message count %d at exit\n", count); |
1134 | + cleanup_srcu_struct(&ipmi_interfaces_srcu); |
1135 | + } |
1136 | + if (drvregistered) |
1137 | + driver_unregister(&ipmidriver.driver); |
1138 | } |
1139 | module_exit(cleanup_ipmi); |
1140 | |
1141 | diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c |
1142 | index ca9528c4f183..b7a1ae2afaea 100644 |
1143 | --- a/drivers/char/ipmi/ipmi_ssif.c |
1144 | +++ b/drivers/char/ipmi/ipmi_ssif.c |
1145 | @@ -632,8 +632,9 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, |
1146 | |
1147 | /* Remove the multi-part read marker. */ |
1148 | len -= 2; |
1149 | + data += 2; |
1150 | for (i = 0; i < len; i++) |
1151 | - ssif_info->data[i] = data[i+2]; |
1152 | + ssif_info->data[i] = data[i]; |
1153 | ssif_info->multi_len = len; |
1154 | ssif_info->multi_pos = 1; |
1155 | |
1156 | @@ -661,8 +662,19 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, |
1157 | } |
1158 | |
1159 | blocknum = data[0]; |
1160 | + len--; |
1161 | + data++; |
1162 | + |
1163 | + if (blocknum != 0xff && len != 31) { |
1164 | + /* All blocks but the last must have 31 data bytes. */ |
1165 | + result = -EIO; |
1166 | + if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) |
1167 | + pr_info("Received middle message <31\n"); |
1168 | |
1169 | - if (ssif_info->multi_len + len - 1 > IPMI_MAX_MSG_LENGTH) { |
1170 | + goto continue_op; |
1171 | + } |
1172 | + |
1173 | + if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) { |
1174 | /* Received message too big, abort the operation. */ |
1175 | result = -E2BIG; |
1176 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) |
1177 | @@ -671,16 +683,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, |
1178 | goto continue_op; |
1179 | } |
1180 | |
1181 | - /* Remove the blocknum from the data. */ |
1182 | - len--; |
1183 | for (i = 0; i < len; i++) |
1184 | - ssif_info->data[i + ssif_info->multi_len] = data[i + 1]; |
1185 | + ssif_info->data[i + ssif_info->multi_len] = data[i]; |
1186 | ssif_info->multi_len += len; |
1187 | if (blocknum == 0xff) { |
1188 | /* End of read */ |
1189 | len = ssif_info->multi_len; |
1190 | data = ssif_info->data; |
1191 | - } else if (blocknum + 1 != ssif_info->multi_pos) { |
1192 | + } else if (blocknum != ssif_info->multi_pos) { |
1193 | /* |
1194 | * Out of sequence block, just abort. Block |
1195 | * numbers start at zero for the second block, |
1196 | @@ -707,6 +717,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, |
1197 | } |
1198 | } |
1199 | |
1200 | + continue_op: |
1201 | if (result < 0) { |
1202 | ssif_inc_stat(ssif_info, receive_errors); |
1203 | } else { |
1204 | @@ -714,8 +725,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, |
1205 | ssif_inc_stat(ssif_info, received_message_parts); |
1206 | } |
1207 | |
1208 | - |
1209 | - continue_op: |
1210 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) |
1211 | pr_info("DONE 1: state = %d, result=%d\n", |
1212 | ssif_info->ssif_state, result); |
1213 | diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c |
1214 | index 99036527eb0d..e695622c5aa5 100644 |
1215 | --- a/drivers/clk/imx/clk-busy.c |
1216 | +++ b/drivers/clk/imx/clk-busy.c |
1217 | @@ -154,7 +154,7 @@ static const struct clk_ops clk_busy_mux_ops = { |
1218 | |
1219 | struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, |
1220 | u8 width, void __iomem *busy_reg, u8 busy_shift, |
1221 | - const char **parent_names, int num_parents) |
1222 | + const char * const *parent_names, int num_parents) |
1223 | { |
1224 | struct clk_busy_mux *busy; |
1225 | struct clk *clk; |
1226 | diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c |
1227 | index c9b327e0a8dd..44817c1b0b88 100644 |
1228 | --- a/drivers/clk/imx/clk-fixup-mux.c |
1229 | +++ b/drivers/clk/imx/clk-fixup-mux.c |
1230 | @@ -70,7 +70,7 @@ static const struct clk_ops clk_fixup_mux_ops = { |
1231 | }; |
1232 | |
1233 | struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg, |
1234 | - u8 shift, u8 width, const char **parents, |
1235 | + u8 shift, u8 width, const char * const *parents, |
1236 | int num_parents, void (*fixup)(u32 *val)) |
1237 | { |
1238 | struct clk_fixup_mux *fixup_mux; |
1239 | diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c |
1240 | index bbe0c60f4d09..59f6a3e087db 100644 |
1241 | --- a/drivers/clk/imx/clk-imx6q.c |
1242 | +++ b/drivers/clk/imx/clk-imx6q.c |
1243 | @@ -508,8 +508,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) |
1244 | * lvds1_gate and lvds2_gate are pseudo-gates. Both can be |
1245 | * independently configured as clock inputs or outputs. We treat |
1246 | * the "output_enable" bit as a gate, even though it's really just |
1247 | - * enabling clock output. |
1248 | + * enabling clock output. Initially the gate bits are cleared, as |
1249 | + * otherwise the exclusive configuration gets locked in the setup done |
1250 | + * by software running before the clock driver, with no way to change |
1251 | + * it. |
1252 | */ |
1253 | + writel(readl(base + 0x160) & ~0x3c00, base + 0x160); |
1254 | clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate_exclusive("lvds1_gate", "lvds1_sel", base + 0x160, 10, BIT(12)); |
1255 | clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate_exclusive("lvds2_gate", "lvds2_sel", base + 0x160, 11, BIT(13)); |
1256 | |
1257 | diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h |
1258 | index 5895e2237b6c..2c377e188281 100644 |
1259 | --- a/drivers/clk/imx/clk.h |
1260 | +++ b/drivers/clk/imx/clk.h |
1261 | @@ -63,14 +63,14 @@ struct clk *imx_clk_busy_divider(const char *name, const char *parent_name, |
1262 | |
1263 | struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, |
1264 | u8 width, void __iomem *busy_reg, u8 busy_shift, |
1265 | - const char **parent_names, int num_parents); |
1266 | + const char * const *parent_names, int num_parents); |
1267 | |
1268 | struct clk *imx_clk_fixup_divider(const char *name, const char *parent, |
1269 | void __iomem *reg, u8 shift, u8 width, |
1270 | void (*fixup)(u32 *val)); |
1271 | |
1272 | struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg, |
1273 | - u8 shift, u8 width, const char **parents, |
1274 | + u8 shift, u8 width, const char * const *parents, |
1275 | int num_parents, void (*fixup)(u32 *val)); |
1276 | |
1277 | static inline struct clk *imx_clk_fixed(const char *name, int rate) |
1278 | @@ -79,7 +79,8 @@ static inline struct clk *imx_clk_fixed(const char *name, int rate) |
1279 | } |
1280 | |
1281 | static inline struct clk *imx_clk_mux_ldb(const char *name, void __iomem *reg, |
1282 | - u8 shift, u8 width, const char **parents, int num_parents) |
1283 | + u8 shift, u8 width, const char * const *parents, |
1284 | + int num_parents) |
1285 | { |
1286 | return clk_register_mux(NULL, name, parents, num_parents, |
1287 | CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, reg, |
1288 | @@ -199,7 +200,8 @@ static inline struct clk *imx_clk_gate4(const char *name, const char *parent, |
1289 | } |
1290 | |
1291 | static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg, |
1292 | - u8 shift, u8 width, const char **parents, int num_parents) |
1293 | + u8 shift, u8 width, const char * const *parents, |
1294 | + int num_parents) |
1295 | { |
1296 | return clk_register_mux(NULL, name, parents, num_parents, |
1297 | CLK_SET_RATE_NO_REPARENT, reg, shift, |
1298 | @@ -207,7 +209,8 @@ static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg, |
1299 | } |
1300 | |
1301 | static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg, |
1302 | - u8 shift, u8 width, const char **parents, int num_parents) |
1303 | + u8 shift, u8 width, const char * const *parents, |
1304 | + int num_parents) |
1305 | { |
1306 | return clk_register_mux(NULL, name, parents, num_parents, |
1307 | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE, |
1308 | @@ -215,8 +218,9 @@ static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg, |
1309 | } |
1310 | |
1311 | static inline struct clk *imx_clk_mux_flags(const char *name, |
1312 | - void __iomem *reg, u8 shift, u8 width, const char **parents, |
1313 | - int num_parents, unsigned long flags) |
1314 | + void __iomem *reg, u8 shift, u8 width, |
1315 | + const char * const *parents, int num_parents, |
1316 | + unsigned long flags) |
1317 | { |
1318 | return clk_register_mux(NULL, name, parents, num_parents, |
1319 | flags | CLK_SET_RATE_NO_REPARENT, reg, shift, width, 0, |
1320 | diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c |
1321 | index 346b9e165b7a..1d39273d7a04 100644 |
1322 | --- a/drivers/clk/meson/meson8b.c |
1323 | +++ b/drivers/clk/meson/meson8b.c |
1324 | @@ -42,6 +42,11 @@ static const struct pll_params_table sys_pll_params_table[] = { |
1325 | PLL_PARAMS(62, 1), |
1326 | PLL_PARAMS(63, 1), |
1327 | PLL_PARAMS(64, 1), |
1328 | + PLL_PARAMS(65, 1), |
1329 | + PLL_PARAMS(66, 1), |
1330 | + PLL_PARAMS(67, 1), |
1331 | + PLL_PARAMS(68, 1), |
1332 | + PLL_PARAMS(84, 1), |
1333 | { /* sentinel */ }, |
1334 | }; |
1335 | |
1336 | @@ -579,13 +584,14 @@ static struct clk_fixed_factor meson8b_cpu_div3 = { |
1337 | }; |
1338 | |
1339 | static const struct clk_div_table cpu_scale_table[] = { |
1340 | - { .val = 2, .div = 4 }, |
1341 | - { .val = 3, .div = 6 }, |
1342 | - { .val = 4, .div = 8 }, |
1343 | - { .val = 5, .div = 10 }, |
1344 | - { .val = 6, .div = 12 }, |
1345 | - { .val = 7, .div = 14 }, |
1346 | - { .val = 8, .div = 16 }, |
1347 | + { .val = 1, .div = 4 }, |
1348 | + { .val = 2, .div = 6 }, |
1349 | + { .val = 3, .div = 8 }, |
1350 | + { .val = 4, .div = 10 }, |
1351 | + { .val = 5, .div = 12 }, |
1352 | + { .val = 6, .div = 14 }, |
1353 | + { .val = 7, .div = 16 }, |
1354 | + { .val = 8, .div = 18 }, |
1355 | { /* sentinel */ }, |
1356 | }; |
1357 | |
1358 | diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c |
1359 | index 76e526f58620..19fb7de4b928 100644 |
1360 | --- a/drivers/clocksource/timer-integrator-ap.c |
1361 | +++ b/drivers/clocksource/timer-integrator-ap.c |
1362 | @@ -181,8 +181,7 @@ static int __init integrator_ap_timer_init_of(struct device_node *node) |
1363 | int irq; |
1364 | struct clk *clk; |
1365 | unsigned long rate; |
1366 | - struct device_node *pri_node; |
1367 | - struct device_node *sec_node; |
1368 | + struct device_node *alias_node; |
1369 | |
1370 | base = of_io_request_and_map(node, 0, "integrator-timer"); |
1371 | if (IS_ERR(base)) |
1372 | @@ -204,7 +203,18 @@ static int __init integrator_ap_timer_init_of(struct device_node *node) |
1373 | return err; |
1374 | } |
1375 | |
1376 | - pri_node = of_find_node_by_path(path); |
1377 | + alias_node = of_find_node_by_path(path); |
1378 | + |
1379 | + /* |
1380 | + * The pointer is used as an identifier not as a pointer, we |
1381 | + * can drop the refcount on the of__node immediately after |
1382 | + * getting it. |
1383 | + */ |
1384 | + of_node_put(alias_node); |
1385 | + |
1386 | + if (node == alias_node) |
1387 | + /* The primary timer lacks IRQ, use as clocksource */ |
1388 | + return integrator_clocksource_init(rate, base); |
1389 | |
1390 | err = of_property_read_string(of_aliases, |
1391 | "arm,timer-secondary", &path); |
1392 | @@ -213,14 +223,11 @@ static int __init integrator_ap_timer_init_of(struct device_node *node) |
1393 | return err; |
1394 | } |
1395 | |
1396 | + alias_node = of_find_node_by_path(path); |
1397 | |
1398 | - sec_node = of_find_node_by_path(path); |
1399 | - |
1400 | - if (node == pri_node) |
1401 | - /* The primary timer lacks IRQ, use as clocksource */ |
1402 | - return integrator_clocksource_init(rate, base); |
1403 | + of_node_put(alias_node); |
1404 | |
1405 | - if (node == sec_node) { |
1406 | + if (node == alias_node) { |
1407 | /* The secondary timer will drive the clock event */ |
1408 | irq = irq_of_parse_and_map(node, 0); |
1409 | return integrator_clockevent_init(rate, base, irq); |
1410 | diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c |
1411 | index 9e56bc411061..74c247972bb3 100644 |
1412 | --- a/drivers/cpuidle/cpuidle-pseries.c |
1413 | +++ b/drivers/cpuidle/cpuidle-pseries.c |
1414 | @@ -247,7 +247,13 @@ static int pseries_idle_probe(void) |
1415 | return -ENODEV; |
1416 | |
1417 | if (firmware_has_feature(FW_FEATURE_SPLPAR)) { |
1418 | - if (lppaca_shared_proc(get_lppaca())) { |
1419 | + /* |
1420 | + * Use local_paca instead of get_lppaca() since |
1421 | + * preemption is not disabled, and it is not required in |
1422 | + * fact, since lppaca_ptr does not need to be the value |
1423 | + * associated to the current CPU, it can be from any CPU. |
1424 | + */ |
1425 | + if (lppaca_shared_proc(local_paca->lppaca_ptr)) { |
1426 | cpuidle_state_table = shared_states; |
1427 | max_idle_state = ARRAY_SIZE(shared_states); |
1428 | } else { |
1429 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile |
1430 | index c51627660dbb..d9845099635e 100644 |
1431 | --- a/drivers/firmware/efi/libstub/Makefile |
1432 | +++ b/drivers/firmware/efi/libstub/Makefile |
1433 | @@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 |
1434 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
1435 | cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ |
1436 | -fPIC -fno-strict-aliasing -mno-red-zone \ |
1437 | - -mno-mmx -mno-sse -fshort-wchar |
1438 | + -mno-mmx -mno-sse -fshort-wchar \ |
1439 | + -Wno-pointer-sign \ |
1440 | + $(call cc-disable-warning, address-of-packed-member) \ |
1441 | + $(call cc-disable-warning, gnu) |
1442 | |
1443 | # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly |
1444 | # disable the stackleak plugin |
1445 | diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c |
1446 | index 610a1558e0ed..d9fa7d4bf11f 100644 |
1447 | --- a/drivers/fpga/altera-cvp.c |
1448 | +++ b/drivers/fpga/altera-cvp.c |
1449 | @@ -466,14 +466,6 @@ static int altera_cvp_probe(struct pci_dev *pdev, |
1450 | if (ret) |
1451 | goto err_unmap; |
1452 | |
1453 | - ret = driver_create_file(&altera_cvp_driver.driver, |
1454 | - &driver_attr_chkcfg); |
1455 | - if (ret) { |
1456 | - dev_err(&pdev->dev, "Can't create sysfs chkcfg file\n"); |
1457 | - fpga_mgr_unregister(mgr); |
1458 | - goto err_unmap; |
1459 | - } |
1460 | - |
1461 | return 0; |
1462 | |
1463 | err_unmap: |
1464 | @@ -491,7 +483,6 @@ static void altera_cvp_remove(struct pci_dev *pdev) |
1465 | struct altera_cvp_conf *conf = mgr->priv; |
1466 | u16 cmd; |
1467 | |
1468 | - driver_remove_file(&altera_cvp_driver.driver, &driver_attr_chkcfg); |
1469 | fpga_mgr_unregister(mgr); |
1470 | pci_iounmap(pdev, conf->map); |
1471 | pci_release_region(pdev, CVP_BAR); |
1472 | @@ -500,7 +491,30 @@ static void altera_cvp_remove(struct pci_dev *pdev) |
1473 | pci_write_config_word(pdev, PCI_COMMAND, cmd); |
1474 | } |
1475 | |
1476 | -module_pci_driver(altera_cvp_driver); |
1477 | +static int __init altera_cvp_init(void) |
1478 | +{ |
1479 | + int ret; |
1480 | + |
1481 | + ret = pci_register_driver(&altera_cvp_driver); |
1482 | + if (ret) |
1483 | + return ret; |
1484 | + |
1485 | + ret = driver_create_file(&altera_cvp_driver.driver, |
1486 | + &driver_attr_chkcfg); |
1487 | + if (ret) |
1488 | + pr_warn("Can't create sysfs chkcfg file\n"); |
1489 | + |
1490 | + return 0; |
1491 | +} |
1492 | + |
1493 | +static void __exit altera_cvp_exit(void) |
1494 | +{ |
1495 | + driver_remove_file(&altera_cvp_driver.driver, &driver_attr_chkcfg); |
1496 | + pci_unregister_driver(&altera_cvp_driver); |
1497 | +} |
1498 | + |
1499 | +module_init(altera_cvp_init); |
1500 | +module_exit(altera_cvp_exit); |
1501 | |
1502 | MODULE_LICENSE("GPL v2"); |
1503 | MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>"); |
1504 | diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c |
1505 | index 2afd9de84a0d..dc42571e6fdc 100644 |
1506 | --- a/drivers/gpio/gpio-pl061.c |
1507 | +++ b/drivers/gpio/gpio-pl061.c |
1508 | @@ -54,6 +54,7 @@ struct pl061 { |
1509 | |
1510 | void __iomem *base; |
1511 | struct gpio_chip gc; |
1512 | + struct irq_chip irq_chip; |
1513 | int parent_irq; |
1514 | |
1515 | #ifdef CONFIG_PM |
1516 | @@ -281,15 +282,6 @@ static int pl061_irq_set_wake(struct irq_data *d, unsigned int state) |
1517 | return irq_set_irq_wake(pl061->parent_irq, state); |
1518 | } |
1519 | |
1520 | -static struct irq_chip pl061_irqchip = { |
1521 | - .name = "pl061", |
1522 | - .irq_ack = pl061_irq_ack, |
1523 | - .irq_mask = pl061_irq_mask, |
1524 | - .irq_unmask = pl061_irq_unmask, |
1525 | - .irq_set_type = pl061_irq_type, |
1526 | - .irq_set_wake = pl061_irq_set_wake, |
1527 | -}; |
1528 | - |
1529 | static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
1530 | { |
1531 | struct device *dev = &adev->dev; |
1532 | @@ -328,6 +320,13 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
1533 | /* |
1534 | * irq_chip support |
1535 | */ |
1536 | + pl061->irq_chip.name = dev_name(dev); |
1537 | + pl061->irq_chip.irq_ack = pl061_irq_ack; |
1538 | + pl061->irq_chip.irq_mask = pl061_irq_mask; |
1539 | + pl061->irq_chip.irq_unmask = pl061_irq_unmask; |
1540 | + pl061->irq_chip.irq_set_type = pl061_irq_type; |
1541 | + pl061->irq_chip.irq_set_wake = pl061_irq_set_wake; |
1542 | + |
1543 | writeb(0, pl061->base + GPIOIE); /* disable irqs */ |
1544 | irq = adev->irq[0]; |
1545 | if (irq < 0) { |
1546 | @@ -336,14 +335,14 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
1547 | } |
1548 | pl061->parent_irq = irq; |
1549 | |
1550 | - ret = gpiochip_irqchip_add(&pl061->gc, &pl061_irqchip, |
1551 | + ret = gpiochip_irqchip_add(&pl061->gc, &pl061->irq_chip, |
1552 | 0, handle_bad_irq, |
1553 | IRQ_TYPE_NONE); |
1554 | if (ret) { |
1555 | dev_info(&adev->dev, "could not add irqchip\n"); |
1556 | return ret; |
1557 | } |
1558 | - gpiochip_set_chained_irqchip(&pl061->gc, &pl061_irqchip, |
1559 | + gpiochip_set_chained_irqchip(&pl061->gc, &pl061->irq_chip, |
1560 | irq, pl061_irq_handler); |
1561 | |
1562 | amba_set_drvdata(adev, pl061); |
1563 | diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c |
1564 | index 1fc17bf39fed..44ca41837187 100644 |
1565 | --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c |
1566 | +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c |
1567 | @@ -116,16 +116,16 @@ static int uvd_v4_2_sw_init(void *handle) |
1568 | if (r) |
1569 | return r; |
1570 | |
1571 | - r = amdgpu_uvd_resume(adev); |
1572 | - if (r) |
1573 | - return r; |
1574 | - |
1575 | ring = &adev->uvd.inst->ring; |
1576 | sprintf(ring->name, "uvd"); |
1577 | r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0); |
1578 | if (r) |
1579 | return r; |
1580 | |
1581 | + r = amdgpu_uvd_resume(adev); |
1582 | + if (r) |
1583 | + return r; |
1584 | + |
1585 | r = amdgpu_uvd_entity_init(adev); |
1586 | |
1587 | return r; |
1588 | diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c |
1589 | index fde6ad5ac9ab..6bb05ae232b2 100644 |
1590 | --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c |
1591 | +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c |
1592 | @@ -113,16 +113,16 @@ static int uvd_v5_0_sw_init(void *handle) |
1593 | if (r) |
1594 | return r; |
1595 | |
1596 | - r = amdgpu_uvd_resume(adev); |
1597 | - if (r) |
1598 | - return r; |
1599 | - |
1600 | ring = &adev->uvd.inst->ring; |
1601 | sprintf(ring->name, "uvd"); |
1602 | r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0); |
1603 | if (r) |
1604 | return r; |
1605 | |
1606 | + r = amdgpu_uvd_resume(adev); |
1607 | + if (r) |
1608 | + return r; |
1609 | + |
1610 | r = amdgpu_uvd_entity_init(adev); |
1611 | |
1612 | return r; |
1613 | diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c |
1614 | index 7a5b40275e8e..07fd96df4321 100644 |
1615 | --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c |
1616 | +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c |
1617 | @@ -416,16 +416,16 @@ static int uvd_v6_0_sw_init(void *handle) |
1618 | DRM_INFO("UVD ENC is disabled\n"); |
1619 | } |
1620 | |
1621 | - r = amdgpu_uvd_resume(adev); |
1622 | - if (r) |
1623 | - return r; |
1624 | - |
1625 | ring = &adev->uvd.inst->ring; |
1626 | sprintf(ring->name, "uvd"); |
1627 | r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0); |
1628 | if (r) |
1629 | return r; |
1630 | |
1631 | + r = amdgpu_uvd_resume(adev); |
1632 | + if (r) |
1633 | + return r; |
1634 | + |
1635 | if (uvd_v6_0_enc_support(adev)) { |
1636 | for (i = 0; i < adev->uvd.num_enc_rings; ++i) { |
1637 | ring = &adev->uvd.inst->ring_enc[i]; |
1638 | diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c |
1639 | index 58b39afcfb86..1ef023a7b8ec 100644 |
1640 | --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c |
1641 | +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c |
1642 | @@ -447,10 +447,6 @@ static int uvd_v7_0_sw_init(void *handle) |
1643 | DRM_INFO("PSP loading UVD firmware\n"); |
1644 | } |
1645 | |
1646 | - r = amdgpu_uvd_resume(adev); |
1647 | - if (r) |
1648 | - return r; |
1649 | - |
1650 | for (j = 0; j < adev->uvd.num_uvd_inst; j++) { |
1651 | if (adev->uvd.harvest_config & (1 << j)) |
1652 | continue; |
1653 | @@ -482,6 +478,10 @@ static int uvd_v7_0_sw_init(void *handle) |
1654 | } |
1655 | } |
1656 | |
1657 | + r = amdgpu_uvd_resume(adev); |
1658 | + if (r) |
1659 | + return r; |
1660 | + |
1661 | r = amdgpu_uvd_entity_init(adev); |
1662 | if (r) |
1663 | return r; |
1664 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1665 | index e4ded890b1cb..6edaf11d69aa 100644 |
1666 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1667 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1668 | @@ -688,6 +688,7 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) |
1669 | { |
1670 | uint32_t patched_ihre[KFD_MAX_RING_ENTRY_SIZE]; |
1671 | bool is_patched = false; |
1672 | + unsigned long flags; |
1673 | |
1674 | if (!kfd->init_complete) |
1675 | return; |
1676 | @@ -697,7 +698,7 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) |
1677 | return; |
1678 | } |
1679 | |
1680 | - spin_lock(&kfd->interrupt_lock); |
1681 | + spin_lock_irqsave(&kfd->interrupt_lock, flags); |
1682 | |
1683 | if (kfd->interrupts_active |
1684 | && interrupt_is_wanted(kfd, ih_ring_entry, |
1685 | @@ -706,7 +707,7 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) |
1686 | is_patched ? patched_ihre : ih_ring_entry)) |
1687 | queue_work(kfd->ih_wq, &kfd->interrupt_work); |
1688 | |
1689 | - spin_unlock(&kfd->interrupt_lock); |
1690 | + spin_unlock_irqrestore(&kfd->interrupt_lock, flags); |
1691 | } |
1692 | |
1693 | int kgd2kfd_quiesce_mm(struct mm_struct *mm) |
1694 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |
1695 | index 01fc5717b657..f088ac585978 100644 |
1696 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |
1697 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |
1698 | @@ -75,6 +75,11 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) |
1699 | return -EINVAL; |
1700 | } |
1701 | |
1702 | + if (!stream_state) { |
1703 | + DRM_ERROR("No stream state for CRTC%d\n", crtc->index); |
1704 | + return -EINVAL; |
1705 | + } |
1706 | + |
1707 | /* When enabling CRC, we should also disable dithering. */ |
1708 | if (source == AMDGPU_DM_PIPE_CRC_SOURCE_AUTO) { |
1709 | if (dc_stream_configure_crc(stream_state->ctx->dc, |
1710 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c |
1711 | index dcb3c5530236..cd1ebe57ed59 100644 |
1712 | --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c |
1713 | +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c |
1714 | @@ -463,7 +463,7 @@ void dpp1_set_cursor_position( |
1715 | if (src_y_offset >= (int)param->viewport.height) |
1716 | cur_en = 0; /* not visible beyond bottom edge*/ |
1717 | |
1718 | - if (src_y_offset < 0) |
1719 | + if (src_y_offset + (int)height <= 0) |
1720 | cur_en = 0; /* not visible beyond top edge*/ |
1721 | |
1722 | REG_UPDATE(CURSOR0_CONTROL, |
1723 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c |
1724 | index 74132a1f3046..a34f0fdf7be2 100644 |
1725 | --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c |
1726 | +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c |
1727 | @@ -1134,7 +1134,7 @@ void hubp1_cursor_set_position( |
1728 | if (src_y_offset >= (int)param->viewport.height) |
1729 | cur_en = 0; /* not visible beyond bottom edge*/ |
1730 | |
1731 | - if (src_y_offset < 0) //+ (int)hubp->curs_attr.height |
1732 | + if (src_y_offset + (int)hubp->curs_attr.height <= 0) |
1733 | cur_en = 0; /* not visible beyond top edge*/ |
1734 | |
1735 | if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) |
1736 | diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c |
1737 | index d8b526b7932c..b4e292a56046 100644 |
1738 | --- a/drivers/gpu/drm/drm_atomic_helper.c |
1739 | +++ b/drivers/gpu/drm/drm_atomic_helper.c |
1740 | @@ -1445,6 +1445,9 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, |
1741 | DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n", |
1742 | crtc->base.id, crtc->name); |
1743 | } |
1744 | + |
1745 | + if (old_state->fake_commit) |
1746 | + complete_all(&old_state->fake_commit->flip_done); |
1747 | } |
1748 | EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done); |
1749 | |
1750 | diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c |
1751 | index 44fe587aaef9..c5bbbd7cb2de 100644 |
1752 | --- a/drivers/gpu/drm/scheduler/sched_main.c |
1753 | +++ b/drivers/gpu/drm/scheduler/sched_main.c |
1754 | @@ -60,6 +60,8 @@ |
1755 | |
1756 | static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); |
1757 | |
1758 | +static void drm_sched_expel_job_unlocked(struct drm_sched_job *s_job); |
1759 | + |
1760 | /** |
1761 | * drm_sched_rq_init - initialize a given run queue struct |
1762 | * |
1763 | @@ -215,7 +217,7 @@ static void drm_sched_job_finish(struct work_struct *work) |
1764 | |
1765 | spin_lock(&sched->job_list_lock); |
1766 | /* remove job from ring_mirror_list */ |
1767 | - list_del(&s_job->node); |
1768 | + list_del_init(&s_job->node); |
1769 | /* queue TDR for next job */ |
1770 | drm_sched_start_timeout(sched); |
1771 | spin_unlock(&sched->job_list_lock); |
1772 | @@ -378,6 +380,8 @@ void drm_sched_job_recovery(struct drm_gpu_scheduler *sched) |
1773 | r); |
1774 | dma_fence_put(fence); |
1775 | } else { |
1776 | + if (s_fence->finished.error < 0) |
1777 | + drm_sched_expel_job_unlocked(s_job); |
1778 | drm_sched_process_job(NULL, &s_fence->cb); |
1779 | } |
1780 | spin_lock(&sched->job_list_lock); |
1781 | @@ -567,6 +571,8 @@ static int drm_sched_main(void *param) |
1782 | r); |
1783 | dma_fence_put(fence); |
1784 | } else { |
1785 | + if (s_fence->finished.error < 0) |
1786 | + drm_sched_expel_job_unlocked(sched_job); |
1787 | drm_sched_process_job(NULL, &s_fence->cb); |
1788 | } |
1789 | |
1790 | @@ -575,6 +581,15 @@ static int drm_sched_main(void *param) |
1791 | return 0; |
1792 | } |
1793 | |
1794 | +static void drm_sched_expel_job_unlocked(struct drm_sched_job *s_job) |
1795 | +{ |
1796 | + struct drm_gpu_scheduler *sched = s_job->sched; |
1797 | + |
1798 | + spin_lock(&sched->job_list_lock); |
1799 | + list_del_init(&s_job->node); |
1800 | + spin_unlock(&sched->job_list_lock); |
1801 | +} |
1802 | + |
1803 | /** |
1804 | * drm_sched_init - Init a gpu scheduler instance |
1805 | * |
1806 | diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
1807 | index 53fc83b72a49..5864ac55e275 100644 |
1808 | --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
1809 | +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
1810 | @@ -86,7 +86,7 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata) |
1811 | |
1812 | static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) |
1813 | { |
1814 | - coresight_disclaim_device(drvdata); |
1815 | + coresight_disclaim_device(drvdata->base); |
1816 | __tmc_etb_disable_hw(drvdata); |
1817 | } |
1818 | |
1819 | diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
1820 | index 0b91ff36768a..598e23cf01fc 100644 |
1821 | --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
1822 | +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c |
1823 | @@ -336,13 +336,16 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, |
1824 | |
1825 | usnic_dbg("\n"); |
1826 | |
1827 | - mutex_lock(&us_ibdev->usdev_lock); |
1828 | if (ib_get_eth_speed(ibdev, port, &props->active_speed, |
1829 | - &props->active_width)) { |
1830 | - mutex_unlock(&us_ibdev->usdev_lock); |
1831 | + &props->active_width)) |
1832 | return -EINVAL; |
1833 | - } |
1834 | |
1835 | + /* |
1836 | + * usdev_lock is acquired after (and not before) ib_get_eth_speed call |
1837 | + * because acquiring rtnl_lock in ib_get_eth_speed, while holding |
1838 | + * usdev_lock could lead to a deadlock. |
1839 | + */ |
1840 | + mutex_lock(&us_ibdev->usdev_lock); |
1841 | /* props being zeroed by the caller, avoid zeroing it here */ |
1842 | |
1843 | props->lid = 0; |
1844 | diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c |
1845 | index 6c361d70d7cd..46f62f71cd28 100644 |
1846 | --- a/drivers/infiniband/sw/rxe/rxe_req.c |
1847 | +++ b/drivers/infiniband/sw/rxe/rxe_req.c |
1848 | @@ -643,6 +643,7 @@ next_wqe: |
1849 | rmr->access = wqe->wr.wr.reg.access; |
1850 | rmr->lkey = wqe->wr.wr.reg.key; |
1851 | rmr->rkey = wqe->wr.wr.reg.key; |
1852 | + rmr->iova = wqe->wr.wr.reg.mr->iova; |
1853 | wqe->state = wqe_state_done; |
1854 | wqe->status = IB_WC_SUCCESS; |
1855 | } else { |
1856 | diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
1857 | index b8eec515a003..fc7d8b8a654f 100644 |
1858 | --- a/drivers/md/dm-crypt.c |
1859 | +++ b/drivers/md/dm-crypt.c |
1860 | @@ -49,7 +49,7 @@ struct convert_context { |
1861 | struct bio *bio_out; |
1862 | struct bvec_iter iter_in; |
1863 | struct bvec_iter iter_out; |
1864 | - sector_t cc_sector; |
1865 | + u64 cc_sector; |
1866 | atomic_t cc_pending; |
1867 | union { |
1868 | struct skcipher_request *req; |
1869 | @@ -81,7 +81,7 @@ struct dm_crypt_request { |
1870 | struct convert_context *ctx; |
1871 | struct scatterlist sg_in[4]; |
1872 | struct scatterlist sg_out[4]; |
1873 | - sector_t iv_sector; |
1874 | + u64 iv_sector; |
1875 | }; |
1876 | |
1877 | struct crypt_config; |
1878 | @@ -160,7 +160,7 @@ struct crypt_config { |
1879 | struct iv_lmk_private lmk; |
1880 | struct iv_tcw_private tcw; |
1881 | } iv_gen_private; |
1882 | - sector_t iv_offset; |
1883 | + u64 iv_offset; |
1884 | unsigned int iv_size; |
1885 | unsigned short int sector_size; |
1886 | unsigned char sector_shift; |
1887 | @@ -2781,7 +2781,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1888 | } |
1889 | |
1890 | ret = -EINVAL; |
1891 | - if (sscanf(argv[4], "%llu%c", &tmpll, &dummy) != 1) { |
1892 | + if (sscanf(argv[4], "%llu%c", &tmpll, &dummy) != 1 || tmpll != (sector_t)tmpll) { |
1893 | ti->error = "Invalid device sector"; |
1894 | goto bad; |
1895 | } |
1896 | diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c |
1897 | index 2fb7bb4304ad..fddffe251bf6 100644 |
1898 | --- a/drivers/md/dm-delay.c |
1899 | +++ b/drivers/md/dm-delay.c |
1900 | @@ -141,7 +141,7 @@ static int delay_class_ctr(struct dm_target *ti, struct delay_class *c, char **a |
1901 | unsigned long long tmpll; |
1902 | char dummy; |
1903 | |
1904 | - if (sscanf(argv[1], "%llu%c", &tmpll, &dummy) != 1) { |
1905 | + if (sscanf(argv[1], "%llu%c", &tmpll, &dummy) != 1 || tmpll != (sector_t)tmpll) { |
1906 | ti->error = "Invalid device sector"; |
1907 | return -EINVAL; |
1908 | } |
1909 | diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c |
1910 | index 3cb97fa4c11d..8261aa8c7fe1 100644 |
1911 | --- a/drivers/md/dm-flakey.c |
1912 | +++ b/drivers/md/dm-flakey.c |
1913 | @@ -213,7 +213,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1914 | devname = dm_shift_arg(&as); |
1915 | |
1916 | r = -EINVAL; |
1917 | - if (sscanf(dm_shift_arg(&as), "%llu%c", &tmpll, &dummy) != 1) { |
1918 | + if (sscanf(dm_shift_arg(&as), "%llu%c", &tmpll, &dummy) != 1 || tmpll != (sector_t)tmpll) { |
1919 | ti->error = "Invalid device sector"; |
1920 | goto bad; |
1921 | } |
1922 | diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c |
1923 | index 2fc4213e02b5..671c24332802 100644 |
1924 | --- a/drivers/md/dm-kcopyd.c |
1925 | +++ b/drivers/md/dm-kcopyd.c |
1926 | @@ -56,15 +56,17 @@ struct dm_kcopyd_client { |
1927 | atomic_t nr_jobs; |
1928 | |
1929 | /* |
1930 | - * We maintain three lists of jobs: |
1931 | + * We maintain four lists of jobs: |
1932 | * |
1933 | * i) jobs waiting for pages |
1934 | * ii) jobs that have pages, and are waiting for the io to be issued. |
1935 | - * iii) jobs that have completed. |
1936 | + * iii) jobs that don't need to do any IO and just run a callback |
1937 | + * iv) jobs that have completed. |
1938 | * |
1939 | - * All three of these are protected by job_lock. |
1940 | + * All four of these are protected by job_lock. |
1941 | */ |
1942 | spinlock_t job_lock; |
1943 | + struct list_head callback_jobs; |
1944 | struct list_head complete_jobs; |
1945 | struct list_head io_jobs; |
1946 | struct list_head pages_jobs; |
1947 | @@ -625,6 +627,7 @@ static void do_work(struct work_struct *work) |
1948 | struct dm_kcopyd_client *kc = container_of(work, |
1949 | struct dm_kcopyd_client, kcopyd_work); |
1950 | struct blk_plug plug; |
1951 | + unsigned long flags; |
1952 | |
1953 | /* |
1954 | * The order that these are called is *very* important. |
1955 | @@ -633,6 +636,10 @@ static void do_work(struct work_struct *work) |
1956 | * list. io jobs call wake when they complete and it all |
1957 | * starts again. |
1958 | */ |
1959 | + spin_lock_irqsave(&kc->job_lock, flags); |
1960 | + list_splice_tail_init(&kc->callback_jobs, &kc->complete_jobs); |
1961 | + spin_unlock_irqrestore(&kc->job_lock, flags); |
1962 | + |
1963 | blk_start_plug(&plug); |
1964 | process_jobs(&kc->complete_jobs, kc, run_complete_job); |
1965 | process_jobs(&kc->pages_jobs, kc, run_pages_job); |
1966 | @@ -650,7 +657,7 @@ static void dispatch_job(struct kcopyd_job *job) |
1967 | struct dm_kcopyd_client *kc = job->kc; |
1968 | atomic_inc(&kc->nr_jobs); |
1969 | if (unlikely(!job->source.count)) |
1970 | - push(&kc->complete_jobs, job); |
1971 | + push(&kc->callback_jobs, job); |
1972 | else if (job->pages == &zero_page_list) |
1973 | push(&kc->io_jobs, job); |
1974 | else |
1975 | @@ -858,7 +865,7 @@ void dm_kcopyd_do_callback(void *j, int read_err, unsigned long write_err) |
1976 | job->read_err = read_err; |
1977 | job->write_err = write_err; |
1978 | |
1979 | - push(&kc->complete_jobs, job); |
1980 | + push(&kc->callback_jobs, job); |
1981 | wake(kc); |
1982 | } |
1983 | EXPORT_SYMBOL(dm_kcopyd_do_callback); |
1984 | @@ -888,6 +895,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro |
1985 | return ERR_PTR(-ENOMEM); |
1986 | |
1987 | spin_lock_init(&kc->job_lock); |
1988 | + INIT_LIST_HEAD(&kc->callback_jobs); |
1989 | INIT_LIST_HEAD(&kc->complete_jobs); |
1990 | INIT_LIST_HEAD(&kc->io_jobs); |
1991 | INIT_LIST_HEAD(&kc->pages_jobs); |
1992 | @@ -939,6 +947,7 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc) |
1993 | /* Wait for completion of all jobs submitted by this client. */ |
1994 | wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs)); |
1995 | |
1996 | + BUG_ON(!list_empty(&kc->callback_jobs)); |
1997 | BUG_ON(!list_empty(&kc->complete_jobs)); |
1998 | BUG_ON(!list_empty(&kc->io_jobs)); |
1999 | BUG_ON(!list_empty(&kc->pages_jobs)); |
2000 | diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c |
2001 | index 8d7ddee6ac4d..ad980a38fb1e 100644 |
2002 | --- a/drivers/md/dm-linear.c |
2003 | +++ b/drivers/md/dm-linear.c |
2004 | @@ -45,7 +45,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
2005 | } |
2006 | |
2007 | ret = -EINVAL; |
2008 | - if (sscanf(argv[1], "%llu%c", &tmp, &dummy) != 1) { |
2009 | + if (sscanf(argv[1], "%llu%c", &tmp, &dummy) != 1 || tmp != (sector_t)tmp) { |
2010 | ti->error = "Invalid device sector"; |
2011 | goto bad; |
2012 | } |
2013 | diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c |
2014 | index 79eab1071ec2..5a51151f680d 100644 |
2015 | --- a/drivers/md/dm-raid1.c |
2016 | +++ b/drivers/md/dm-raid1.c |
2017 | @@ -943,7 +943,8 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti, |
2018 | char dummy; |
2019 | int ret; |
2020 | |
2021 | - if (sscanf(argv[1], "%llu%c", &offset, &dummy) != 1) { |
2022 | + if (sscanf(argv[1], "%llu%c", &offset, &dummy) != 1 || |
2023 | + offset != (sector_t)offset) { |
2024 | ti->error = "Invalid offset"; |
2025 | return -EINVAL; |
2026 | } |
2027 | diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c |
2028 | index ae4b33d10924..36805b12661e 100644 |
2029 | --- a/drivers/md/dm-snap.c |
2030 | +++ b/drivers/md/dm-snap.c |
2031 | @@ -19,6 +19,7 @@ |
2032 | #include <linux/vmalloc.h> |
2033 | #include <linux/log2.h> |
2034 | #include <linux/dm-kcopyd.h> |
2035 | +#include <linux/semaphore.h> |
2036 | |
2037 | #include "dm.h" |
2038 | |
2039 | @@ -105,6 +106,9 @@ struct dm_snapshot { |
2040 | /* The on disk metadata handler */ |
2041 | struct dm_exception_store *store; |
2042 | |
2043 | + /* Maximum number of in-flight COW jobs. */ |
2044 | + struct semaphore cow_count; |
2045 | + |
2046 | struct dm_kcopyd_client *kcopyd_client; |
2047 | |
2048 | /* Wait for events based on state_bits */ |
2049 | @@ -145,6 +149,19 @@ struct dm_snapshot { |
2050 | #define RUNNING_MERGE 0 |
2051 | #define SHUTDOWN_MERGE 1 |
2052 | |
2053 | +/* |
2054 | + * Maximum number of chunks being copied on write. |
2055 | + * |
2056 | + * The value was decided experimentally as a trade-off between memory |
2057 | + * consumption, stalling the kernel's workqueues and maintaining a high enough |
2058 | + * throughput. |
2059 | + */ |
2060 | +#define DEFAULT_COW_THRESHOLD 2048 |
2061 | + |
2062 | +static int cow_threshold = DEFAULT_COW_THRESHOLD; |
2063 | +module_param_named(snapshot_cow_threshold, cow_threshold, int, 0644); |
2064 | +MODULE_PARM_DESC(snapshot_cow_threshold, "Maximum number of chunks being copied on write"); |
2065 | + |
2066 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, |
2067 | "A percentage of time allocated for copy on write"); |
2068 | |
2069 | @@ -1190,6 +1207,8 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
2070 | goto bad_hash_tables; |
2071 | } |
2072 | |
2073 | + sema_init(&s->cow_count, (cow_threshold > 0) ? cow_threshold : INT_MAX); |
2074 | + |
2075 | s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle); |
2076 | if (IS_ERR(s->kcopyd_client)) { |
2077 | r = PTR_ERR(s->kcopyd_client); |
2078 | @@ -1575,6 +1594,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) |
2079 | rb_link_node(&pe->out_of_order_node, parent, p); |
2080 | rb_insert_color(&pe->out_of_order_node, &s->out_of_order_tree); |
2081 | } |
2082 | + up(&s->cow_count); |
2083 | } |
2084 | |
2085 | /* |
2086 | @@ -1598,6 +1618,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) |
2087 | dest.count = src.count; |
2088 | |
2089 | /* Hand over to kcopyd */ |
2090 | + down(&s->cow_count); |
2091 | dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, copy_callback, pe); |
2092 | } |
2093 | |
2094 | @@ -1617,6 +1638,7 @@ static void start_full_bio(struct dm_snap_pending_exception *pe, |
2095 | pe->full_bio = bio; |
2096 | pe->full_bio_end_io = bio->bi_end_io; |
2097 | |
2098 | + down(&s->cow_count); |
2099 | callback_data = dm_kcopyd_prepare_callback(s->kcopyd_client, |
2100 | copy_callback, pe); |
2101 | |
2102 | diff --git a/drivers/md/dm-unstripe.c b/drivers/md/dm-unstripe.c |
2103 | index 954b7ab4e684..e673dacf6418 100644 |
2104 | --- a/drivers/md/dm-unstripe.c |
2105 | +++ b/drivers/md/dm-unstripe.c |
2106 | @@ -78,7 +78,7 @@ static int unstripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
2107 | goto err; |
2108 | } |
2109 | |
2110 | - if (sscanf(argv[4], "%llu%c", &start, &dummy) != 1) { |
2111 | + if (sscanf(argv[4], "%llu%c", &start, &dummy) != 1 || start != (sector_t)start) { |
2112 | ti->error = "Invalid striped device offset"; |
2113 | goto err; |
2114 | } |
2115 | diff --git a/drivers/media/firewire/firedtv-avc.c b/drivers/media/firewire/firedtv-avc.c |
2116 | index 1c933b2cf760..3ef5df1648d7 100644 |
2117 | --- a/drivers/media/firewire/firedtv-avc.c |
2118 | +++ b/drivers/media/firewire/firedtv-avc.c |
2119 | @@ -968,7 +968,8 @@ static int get_ca_object_length(struct avc_response_frame *r) |
2120 | return r->operand[7]; |
2121 | } |
2122 | |
2123 | -int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len) |
2124 | +int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info, |
2125 | + unsigned int *len) |
2126 | { |
2127 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
2128 | struct avc_response_frame *r = (void *)fdtv->avc_data; |
2129 | @@ -1009,7 +1010,8 @@ out: |
2130 | return ret; |
2131 | } |
2132 | |
2133 | -int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len) |
2134 | +int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info, |
2135 | + unsigned int *len) |
2136 | { |
2137 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
2138 | struct avc_response_frame *r = (void *)fdtv->avc_data; |
2139 | diff --git a/drivers/media/firewire/firedtv.h b/drivers/media/firewire/firedtv.h |
2140 | index 876cdec8329b..009905a19947 100644 |
2141 | --- a/drivers/media/firewire/firedtv.h |
2142 | +++ b/drivers/media/firewire/firedtv.h |
2143 | @@ -124,8 +124,10 @@ int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, |
2144 | struct dvb_diseqc_master_cmd *diseqcmd); |
2145 | void avc_remote_ctrl_work(struct work_struct *work); |
2146 | int avc_register_remote_control(struct firedtv *fdtv); |
2147 | -int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
2148 | -int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
2149 | +int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info, |
2150 | + unsigned int *len); |
2151 | +int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info, |
2152 | + unsigned int *len); |
2153 | int avc_ca_reset(struct firedtv *fdtv); |
2154 | int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length); |
2155 | int avc_ca_get_time_date(struct firedtv *fdtv, int *interval); |
2156 | diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c |
2157 | index bb6add9d340e..5b8350e87e75 100644 |
2158 | --- a/drivers/media/platform/qcom/venus/core.c |
2159 | +++ b/drivers/media/platform/qcom/venus/core.c |
2160 | @@ -264,6 +264,14 @@ static int venus_probe(struct platform_device *pdev) |
2161 | if (ret) |
2162 | return ret; |
2163 | |
2164 | + if (!dev->dma_parms) { |
2165 | + dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), |
2166 | + GFP_KERNEL); |
2167 | + if (!dev->dma_parms) |
2168 | + return -ENOMEM; |
2169 | + } |
2170 | + dma_set_max_seg_size(dev, DMA_BIT_MASK(32)); |
2171 | + |
2172 | INIT_LIST_HEAD(&core->instances); |
2173 | mutex_init(&core->lock); |
2174 | INIT_DELAYED_WORK(&core->work, venus_sys_error_handler); |
2175 | diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c |
2176 | index bc369a0934a3..76dc3ee8ca21 100644 |
2177 | --- a/drivers/media/usb/uvc/uvc_driver.c |
2178 | +++ b/drivers/media/usb/uvc/uvc_driver.c |
2179 | @@ -1824,11 +1824,7 @@ static void uvc_delete(struct kref *kref) |
2180 | usb_put_intf(dev->intf); |
2181 | usb_put_dev(dev->udev); |
2182 | |
2183 | - if (dev->vdev.dev) |
2184 | - v4l2_device_unregister(&dev->vdev); |
2185 | #ifdef CONFIG_MEDIA_CONTROLLER |
2186 | - if (media_devnode_is_registered(dev->mdev.devnode)) |
2187 | - media_device_unregister(&dev->mdev); |
2188 | media_device_cleanup(&dev->mdev); |
2189 | #endif |
2190 | |
2191 | @@ -1885,6 +1881,15 @@ static void uvc_unregister_video(struct uvc_device *dev) |
2192 | |
2193 | uvc_debugfs_cleanup_stream(stream); |
2194 | } |
2195 | + |
2196 | + uvc_status_unregister(dev); |
2197 | + |
2198 | + if (dev->vdev.dev) |
2199 | + v4l2_device_unregister(&dev->vdev); |
2200 | +#ifdef CONFIG_MEDIA_CONTROLLER |
2201 | + if (media_devnode_is_registered(dev->mdev.devnode)) |
2202 | + media_device_unregister(&dev->mdev); |
2203 | +#endif |
2204 | } |
2205 | |
2206 | int uvc_register_video_device(struct uvc_device *dev, |
2207 | diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c |
2208 | index 0722dc684378..883e4cab45e7 100644 |
2209 | --- a/drivers/media/usb/uvc/uvc_status.c |
2210 | +++ b/drivers/media/usb/uvc/uvc_status.c |
2211 | @@ -54,7 +54,7 @@ error: |
2212 | return ret; |
2213 | } |
2214 | |
2215 | -static void uvc_input_cleanup(struct uvc_device *dev) |
2216 | +static void uvc_input_unregister(struct uvc_device *dev) |
2217 | { |
2218 | if (dev->input) |
2219 | input_unregister_device(dev->input); |
2220 | @@ -71,7 +71,7 @@ static void uvc_input_report_key(struct uvc_device *dev, unsigned int code, |
2221 | |
2222 | #else |
2223 | #define uvc_input_init(dev) |
2224 | -#define uvc_input_cleanup(dev) |
2225 | +#define uvc_input_unregister(dev) |
2226 | #define uvc_input_report_key(dev, code, value) |
2227 | #endif /* CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV */ |
2228 | |
2229 | @@ -292,12 +292,16 @@ int uvc_status_init(struct uvc_device *dev) |
2230 | return 0; |
2231 | } |
2232 | |
2233 | -void uvc_status_cleanup(struct uvc_device *dev) |
2234 | +void uvc_status_unregister(struct uvc_device *dev) |
2235 | { |
2236 | usb_kill_urb(dev->int_urb); |
2237 | + uvc_input_unregister(dev); |
2238 | +} |
2239 | + |
2240 | +void uvc_status_cleanup(struct uvc_device *dev) |
2241 | +{ |
2242 | usb_free_urb(dev->int_urb); |
2243 | kfree(dev->status); |
2244 | - uvc_input_cleanup(dev); |
2245 | } |
2246 | |
2247 | int uvc_status_start(struct uvc_device *dev, gfp_t flags) |
2248 | diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h |
2249 | index c0cbd833d0a4..1db6634b2455 100644 |
2250 | --- a/drivers/media/usb/uvc/uvcvideo.h |
2251 | +++ b/drivers/media/usb/uvc/uvcvideo.h |
2252 | @@ -757,6 +757,7 @@ int uvc_register_video_device(struct uvc_device *dev, |
2253 | |
2254 | /* Status */ |
2255 | int uvc_status_init(struct uvc_device *dev); |
2256 | +void uvc_status_unregister(struct uvc_device *dev); |
2257 | void uvc_status_cleanup(struct uvc_device *dev); |
2258 | int uvc_status_start(struct uvc_device *dev, gfp_t flags); |
2259 | void uvc_status_stop(struct uvc_device *dev); |
2260 | diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c |
2261 | index be53044086c7..fbc56ee99682 100644 |
2262 | --- a/drivers/mmc/host/atmel-mci.c |
2263 | +++ b/drivers/mmc/host/atmel-mci.c |
2264 | @@ -1954,13 +1954,14 @@ static void atmci_tasklet_func(unsigned long priv) |
2265 | } |
2266 | |
2267 | atmci_request_end(host, host->mrq); |
2268 | - state = STATE_IDLE; |
2269 | + goto unlock; /* atmci_request_end() sets host->state */ |
2270 | break; |
2271 | } |
2272 | } while (state != prev_state); |
2273 | |
2274 | host->state = state; |
2275 | |
2276 | +unlock: |
2277 | spin_unlock(&host->lock); |
2278 | } |
2279 | |
2280 | diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
2281 | index 24fb6a685039..b2a0e59b6252 100644 |
2282 | --- a/drivers/net/dsa/mv88e6xxx/chip.c |
2283 | +++ b/drivers/net/dsa/mv88e6xxx/chip.c |
2284 | @@ -2403,6 +2403,107 @@ static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) |
2285 | return mv88e6xxx_g1_stats_clear(chip); |
2286 | } |
2287 | |
2288 | +/* The mv88e6390 has some hidden registers used for debug and |
2289 | + * development. The errata also makes use of them. |
2290 | + */ |
2291 | +static int mv88e6390_hidden_write(struct mv88e6xxx_chip *chip, int port, |
2292 | + int reg, u16 val) |
2293 | +{ |
2294 | + u16 ctrl; |
2295 | + int err; |
2296 | + |
2297 | + err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_DATA_PORT, |
2298 | + PORT_RESERVED_1A, val); |
2299 | + if (err) |
2300 | + return err; |
2301 | + |
2302 | + ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_WRITE | |
2303 | + PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | |
2304 | + reg; |
2305 | + |
2306 | + return mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, |
2307 | + PORT_RESERVED_1A, ctrl); |
2308 | +} |
2309 | + |
2310 | +static int mv88e6390_hidden_wait(struct mv88e6xxx_chip *chip) |
2311 | +{ |
2312 | + return mv88e6xxx_wait(chip, PORT_RESERVED_1A_CTRL_PORT, |
2313 | + PORT_RESERVED_1A, PORT_RESERVED_1A_BUSY); |
2314 | +} |
2315 | + |
2316 | + |
2317 | +static int mv88e6390_hidden_read(struct mv88e6xxx_chip *chip, int port, |
2318 | + int reg, u16 *val) |
2319 | +{ |
2320 | + u16 ctrl; |
2321 | + int err; |
2322 | + |
2323 | + ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_READ | |
2324 | + PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | |
2325 | + reg; |
2326 | + |
2327 | + err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, |
2328 | + PORT_RESERVED_1A, ctrl); |
2329 | + if (err) |
2330 | + return err; |
2331 | + |
2332 | + err = mv88e6390_hidden_wait(chip); |
2333 | + if (err) |
2334 | + return err; |
2335 | + |
2336 | + return mv88e6xxx_port_read(chip, PORT_RESERVED_1A_DATA_PORT, |
2337 | + PORT_RESERVED_1A, val); |
2338 | +} |
2339 | + |
2340 | +/* Check if the errata has already been applied. */ |
2341 | +static bool mv88e6390_setup_errata_applied(struct mv88e6xxx_chip *chip) |
2342 | +{ |
2343 | + int port; |
2344 | + int err; |
2345 | + u16 val; |
2346 | + |
2347 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
2348 | + err = mv88e6390_hidden_read(chip, port, 0, &val); |
2349 | + if (err) { |
2350 | + dev_err(chip->dev, |
2351 | + "Error reading hidden register: %d\n", err); |
2352 | + return false; |
2353 | + } |
2354 | + if (val != 0x01c0) |
2355 | + return false; |
2356 | + } |
2357 | + |
2358 | + return true; |
2359 | +} |
2360 | + |
2361 | +/* The 6390 copper ports have an errata which require poking magic |
2362 | + * values into undocumented hidden registers and then performing a |
2363 | + * software reset. |
2364 | + */ |
2365 | +static int mv88e6390_setup_errata(struct mv88e6xxx_chip *chip) |
2366 | +{ |
2367 | + int port; |
2368 | + int err; |
2369 | + |
2370 | + if (mv88e6390_setup_errata_applied(chip)) |
2371 | + return 0; |
2372 | + |
2373 | + /* Set the ports into blocking mode */ |
2374 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
2375 | + err = mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED); |
2376 | + if (err) |
2377 | + return err; |
2378 | + } |
2379 | + |
2380 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { |
2381 | + err = mv88e6390_hidden_write(chip, port, 0, 0x01c0); |
2382 | + if (err) |
2383 | + return err; |
2384 | + } |
2385 | + |
2386 | + return mv88e6xxx_software_reset(chip); |
2387 | +} |
2388 | + |
2389 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
2390 | { |
2391 | struct mv88e6xxx_chip *chip = ds->priv; |
2392 | @@ -2415,6 +2516,12 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) |
2393 | |
2394 | mutex_lock(&chip->reg_lock); |
2395 | |
2396 | + if (chip->info->ops->setup_errata) { |
2397 | + err = chip->info->ops->setup_errata(chip); |
2398 | + if (err) |
2399 | + goto unlock; |
2400 | + } |
2401 | + |
2402 | /* Cache the cmode of each port. */ |
2403 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
2404 | if (chip->info->ops->port_get_cmode) { |
2405 | @@ -3215,6 +3322,7 @@ static const struct mv88e6xxx_ops mv88e6185_ops = { |
2406 | |
2407 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
2408 | /* MV88E6XXX_FAMILY_6390 */ |
2409 | + .setup_errata = mv88e6390_setup_errata, |
2410 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2411 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2412 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2413 | @@ -3257,6 +3365,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = { |
2414 | |
2415 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
2416 | /* MV88E6XXX_FAMILY_6390 */ |
2417 | + .setup_errata = mv88e6390_setup_errata, |
2418 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2419 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2420 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2421 | @@ -3299,6 +3408,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = { |
2422 | |
2423 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
2424 | /* MV88E6XXX_FAMILY_6390 */ |
2425 | + .setup_errata = mv88e6390_setup_errata, |
2426 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2427 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2428 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2429 | @@ -3390,6 +3500,7 @@ static const struct mv88e6xxx_ops mv88e6240_ops = { |
2430 | |
2431 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
2432 | /* MV88E6XXX_FAMILY_6390 */ |
2433 | + .setup_errata = mv88e6390_setup_errata, |
2434 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2435 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2436 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2437 | @@ -3693,6 +3804,7 @@ static const struct mv88e6xxx_ops mv88e6352_ops = { |
2438 | |
2439 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
2440 | /* MV88E6XXX_FAMILY_6390 */ |
2441 | + .setup_errata = mv88e6390_setup_errata, |
2442 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2443 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2444 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2445 | @@ -3740,6 +3852,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = { |
2446 | |
2447 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
2448 | /* MV88E6XXX_FAMILY_6390 */ |
2449 | + .setup_errata = mv88e6390_setup_errata, |
2450 | .irl_init_all = mv88e6390_g2_irl_init_all, |
2451 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
2452 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
2453 | diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h |
2454 | index f9ecb7872d32..546651d8c3e1 100644 |
2455 | --- a/drivers/net/dsa/mv88e6xxx/chip.h |
2456 | +++ b/drivers/net/dsa/mv88e6xxx/chip.h |
2457 | @@ -300,6 +300,11 @@ struct mv88e6xxx_mdio_bus { |
2458 | }; |
2459 | |
2460 | struct mv88e6xxx_ops { |
2461 | + /* Switch Setup Errata, called early in the switch setup to |
2462 | + * allow any errata actions to be performed |
2463 | + */ |
2464 | + int (*setup_errata)(struct mv88e6xxx_chip *chip); |
2465 | + |
2466 | int (*ieee_pri_map)(struct mv88e6xxx_chip *chip); |
2467 | int (*ip_pri_map)(struct mv88e6xxx_chip *chip); |
2468 | |
2469 | diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h |
2470 | index 36904c9bf955..091aa0057f1f 100644 |
2471 | --- a/drivers/net/dsa/mv88e6xxx/port.h |
2472 | +++ b/drivers/net/dsa/mv88e6xxx/port.h |
2473 | @@ -251,6 +251,16 @@ |
2474 | /* Offset 0x19: Port IEEE Priority Remapping Registers (4-7) */ |
2475 | #define MV88E6095_PORT_IEEE_PRIO_REMAP_4567 0x19 |
2476 | |
2477 | +/* Offset 0x1a: Magic undocumented errata register */ |
2478 | +#define PORT_RESERVED_1A 0x1a |
2479 | +#define PORT_RESERVED_1A_BUSY BIT(15) |
2480 | +#define PORT_RESERVED_1A_WRITE BIT(14) |
2481 | +#define PORT_RESERVED_1A_READ 0 |
2482 | +#define PORT_RESERVED_1A_PORT_SHIFT 5 |
2483 | +#define PORT_RESERVED_1A_BLOCK (0xf << 10) |
2484 | +#define PORT_RESERVED_1A_CTRL_PORT 4 |
2485 | +#define PORT_RESERVED_1A_DATA_PORT 5 |
2486 | + |
2487 | int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, |
2488 | u16 *val); |
2489 | int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, |
2490 | diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c |
2491 | index 37c76945ad9b..e1f821edbc21 100644 |
2492 | --- a/drivers/net/ethernet/intel/e1000e/ptp.c |
2493 | +++ b/drivers/net/ethernet/intel/e1000e/ptp.c |
2494 | @@ -173,10 +173,14 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
2495 | struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, |
2496 | ptp_clock_info); |
2497 | unsigned long flags; |
2498 | - u64 ns; |
2499 | + u64 cycles, ns; |
2500 | |
2501 | spin_lock_irqsave(&adapter->systim_lock, flags); |
2502 | - ns = timecounter_read(&adapter->tc); |
2503 | + |
2504 | + /* Use timecounter_cyc2time() to allow non-monotonic SYSTIM readings */ |
2505 | + cycles = adapter->cc.read(&adapter->cc); |
2506 | + ns = timecounter_cyc2time(&adapter->tc, cycles); |
2507 | + |
2508 | spin_unlock_irqrestore(&adapter->systim_lock, flags); |
2509 | |
2510 | *ts = ns_to_timespec64(ns); |
2511 | @@ -232,9 +236,12 @@ static void e1000e_systim_overflow_work(struct work_struct *work) |
2512 | systim_overflow_work.work); |
2513 | struct e1000_hw *hw = &adapter->hw; |
2514 | struct timespec64 ts; |
2515 | + u64 ns; |
2516 | |
2517 | - adapter->ptp_clock_info.gettime64(&adapter->ptp_clock_info, &ts); |
2518 | + /* Update the timecounter */ |
2519 | + ns = timecounter_read(&adapter->tc); |
2520 | |
2521 | + ts = ns_to_timespec64(ns); |
2522 | e_dbg("SYSTIM overflow check at %lld.%09lu\n", |
2523 | (long long) ts.tv_sec, ts.tv_nsec); |
2524 | |
2525 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
2526 | index fd1b0546fd67..4d77f42e035c 100644 |
2527 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
2528 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |
2529 | @@ -4,6 +4,7 @@ |
2530 | #include "ixgbe.h" |
2531 | #include <net/xfrm.h> |
2532 | #include <crypto/aead.h> |
2533 | +#include <linux/if_bridge.h> |
2534 | |
2535 | #define IXGBE_IPSEC_KEY_BITS 160 |
2536 | static const char aes_gcm_name[] = "rfc4106(gcm(aes))"; |
2537 | @@ -693,7 +694,8 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) |
2538 | } else { |
2539 | struct tx_sa tsa; |
2540 | |
2541 | - if (adapter->num_vfs) |
2542 | + if (adapter->num_vfs && |
2543 | + adapter->bridge_mode != BRIDGE_MODE_VEPA) |
2544 | return -EOPNOTSUPP; |
2545 | |
2546 | /* find the first unused index */ |
2547 | diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c |
2548 | index 12db256c8c9f..ee67d1c4281d 100644 |
2549 | --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c |
2550 | +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c |
2551 | @@ -668,7 +668,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2552 | if (!cgx->reg_base) { |
2553 | dev_err(dev, "CGX: Cannot map CSR memory space, aborting\n"); |
2554 | err = -ENOMEM; |
2555 | - goto err_release_regions; |
2556 | + goto err_free_irq_vectors; |
2557 | } |
2558 | |
2559 | nvec = CGX_NVEC; |
2560 | @@ -693,6 +693,8 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2561 | err_release_lmac: |
2562 | cgx_lmac_exit(cgx); |
2563 | list_del(&cgx->cgx_list); |
2564 | +err_free_irq_vectors: |
2565 | + pci_free_irq_vectors(pdev); |
2566 | err_release_regions: |
2567 | pci_release_regions(pdev); |
2568 | err_disable_device: |
2569 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
2570 | index f84b9c02fcc5..124aee09e953 100644 |
2571 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
2572 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
2573 | @@ -4738,12 +4738,15 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, |
2574 | lower_dev, |
2575 | upper_dev); |
2576 | } else if (netif_is_lag_master(upper_dev)) { |
2577 | - if (info->linking) |
2578 | + if (info->linking) { |
2579 | err = mlxsw_sp_port_lag_join(mlxsw_sp_port, |
2580 | upper_dev); |
2581 | - else |
2582 | + } else { |
2583 | + mlxsw_sp_port_lag_tx_en_set(mlxsw_sp_port, |
2584 | + false); |
2585 | mlxsw_sp_port_lag_leave(mlxsw_sp_port, |
2586 | upper_dev); |
2587 | + } |
2588 | } else if (netif_is_ovs_master(upper_dev)) { |
2589 | if (info->linking) |
2590 | err = mlxsw_sp_port_ovs_join(mlxsw_sp_port); |
2591 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2592 | index 50080c60a279..69f556ddb934 100644 |
2593 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2594 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2595 | @@ -1816,7 +1816,7 @@ static void |
2596 | mlxsw_sp_bridge_port_vlan_del(struct mlxsw_sp_port *mlxsw_sp_port, |
2597 | struct mlxsw_sp_bridge_port *bridge_port, u16 vid) |
2598 | { |
2599 | - u16 pvid = mlxsw_sp_port->pvid == vid ? 0 : vid; |
2600 | + u16 pvid = mlxsw_sp_port->pvid == vid ? 0 : mlxsw_sp_port->pvid; |
2601 | struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; |
2602 | |
2603 | mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid); |
2604 | diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c |
2605 | index 78ea9639b622..88e60d6d93dc 100644 |
2606 | --- a/drivers/net/ethernet/realtek/r8169.c |
2607 | +++ b/drivers/net/ethernet/realtek/r8169.c |
2608 | @@ -212,6 +212,8 @@ enum cfg_version { |
2609 | }; |
2610 | |
2611 | static const struct pci_device_id rtl8169_pci_tbl[] = { |
2612 | + { PCI_VDEVICE(REALTEK, 0x2502), RTL_CFG_1 }, |
2613 | + { PCI_VDEVICE(REALTEK, 0x2600), RTL_CFG_1 }, |
2614 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, |
2615 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, |
2616 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 }, |
2617 | diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c |
2618 | index 7c7cd9d94bcc..3d0114ba2bfe 100644 |
2619 | --- a/drivers/net/ethernet/socionext/sni_ave.c |
2620 | +++ b/drivers/net/ethernet/socionext/sni_ave.c |
2621 | @@ -1210,9 +1210,13 @@ static int ave_init(struct net_device *ndev) |
2622 | |
2623 | priv->phydev = phydev; |
2624 | |
2625 | - phy_ethtool_get_wol(phydev, &wol); |
2626 | + ave_ethtool_get_wol(ndev, &wol); |
2627 | device_set_wakeup_capable(&ndev->dev, !!wol.supported); |
2628 | |
2629 | + /* set wol initial state disabled */ |
2630 | + wol.wolopts = 0; |
2631 | + ave_ethtool_set_wol(ndev, &wol); |
2632 | + |
2633 | if (!phy_interface_is_rgmii(phydev)) |
2634 | phy_set_max_speed(phydev, SPEED_100); |
2635 | |
2636 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
2637 | index 774e1ff01c9a..735ad838e2ba 100644 |
2638 | --- a/drivers/net/usb/qmi_wwan.c |
2639 | +++ b/drivers/net/usb/qmi_wwan.c |
2640 | @@ -123,6 +123,7 @@ static void qmimux_setup(struct net_device *dev) |
2641 | dev->addr_len = 0; |
2642 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
2643 | dev->netdev_ops = &qmimux_netdev_ops; |
2644 | + dev->mtu = 1500; |
2645 | dev->needs_free_netdev = true; |
2646 | } |
2647 | |
2648 | diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c |
2649 | index b09cdc699c69..38afbbd9fb44 100644 |
2650 | --- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c |
2651 | +++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c |
2652 | @@ -71,7 +71,7 @@ void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar, u16 peer_id, u8 tid |
2653 | spin_lock_bh(&ar->data_lock); |
2654 | |
2655 | peer = ath10k_peer_find_by_id(ar, peer_id); |
2656 | - if (!peer) |
2657 | + if (!peer || !peer->sta) |
2658 | goto out; |
2659 | |
2660 | arsta = (struct ath10k_sta *)peer->sta->drv_priv; |
2661 | diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c |
2662 | index ffec98f7be50..2c2761d04d01 100644 |
2663 | --- a/drivers/net/wireless/ath/ath10k/htt_rx.c |
2664 | +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c |
2665 | @@ -2832,7 +2832,7 @@ static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, |
2666 | rcu_read_lock(); |
2667 | spin_lock_bh(&ar->data_lock); |
2668 | peer = ath10k_peer_find_by_id(ar, peer_id); |
2669 | - if (!peer) { |
2670 | + if (!peer || !peer->sta) { |
2671 | ath10k_warn(ar, "Invalid peer id %d peer stats buffer\n", |
2672 | peer_id); |
2673 | goto out; |
2674 | @@ -2885,7 +2885,7 @@ static void ath10k_fetch_10_2_tx_stats(struct ath10k *ar, u8 *data) |
2675 | rcu_read_lock(); |
2676 | spin_lock_bh(&ar->data_lock); |
2677 | peer = ath10k_peer_find_by_id(ar, peer_id); |
2678 | - if (!peer) { |
2679 | + if (!peer || !peer->sta) { |
2680 | ath10k_warn(ar, "Invalid peer id %d in peer stats buffer\n", |
2681 | peer_id); |
2682 | goto out; |
2683 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2684 | index bfdc1ad30c13..659e7649fe22 100644 |
2685 | --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2686 | +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2687 | @@ -84,7 +84,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, |
2688 | size_t *var_resp_size) |
2689 | { |
2690 | struct qlink_cmd *cmd; |
2691 | - const struct qlink_resp *resp; |
2692 | + struct qlink_resp *resp = NULL; |
2693 | struct sk_buff *resp_skb = NULL; |
2694 | u16 cmd_id; |
2695 | u8 mac_id; |
2696 | @@ -113,7 +113,12 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, |
2697 | if (ret) |
2698 | goto out; |
2699 | |
2700 | - resp = (const struct qlink_resp *)resp_skb->data; |
2701 | + if (WARN_ON(!resp_skb || !resp_skb->data)) { |
2702 | + ret = -EFAULT; |
2703 | + goto out; |
2704 | + } |
2705 | + |
2706 | + resp = (struct qlink_resp *)resp_skb->data; |
2707 | ret = qtnf_cmd_check_reply_header(resp, cmd_id, mac_id, vif_id, |
2708 | const_resp_size); |
2709 | if (ret) |
2710 | @@ -686,7 +691,7 @@ int qtnf_cmd_get_sta_info(struct qtnf_vif *vif, const u8 *sta_mac, |
2711 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2712 | struct qlink_cmd_get_sta_info *cmd; |
2713 | const struct qlink_resp_get_sta_info *resp; |
2714 | - size_t var_resp_len; |
2715 | + size_t var_resp_len = 0; |
2716 | int ret = 0; |
2717 | |
2718 | cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, |
2719 | @@ -1650,7 +1655,7 @@ int qtnf_cmd_get_mac_info(struct qtnf_wmac *mac) |
2720 | { |
2721 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2722 | const struct qlink_resp_get_mac_info *resp; |
2723 | - size_t var_data_len; |
2724 | + size_t var_data_len = 0; |
2725 | int ret = 0; |
2726 | |
2727 | cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, |
2728 | @@ -1680,8 +1685,8 @@ int qtnf_cmd_get_hw_info(struct qtnf_bus *bus) |
2729 | { |
2730 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2731 | const struct qlink_resp_get_hw_info *resp; |
2732 | + size_t info_len = 0; |
2733 | int ret = 0; |
2734 | - size_t info_len; |
2735 | |
2736 | cmd_skb = qtnf_cmd_alloc_new_cmdskb(QLINK_MACID_RSVD, QLINK_VIFID_RSVD, |
2737 | QLINK_CMD_GET_HW_INFO, |
2738 | @@ -1709,9 +1714,9 @@ int qtnf_cmd_band_info_get(struct qtnf_wmac *mac, |
2739 | struct ieee80211_supported_band *band) |
2740 | { |
2741 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2742 | - size_t info_len; |
2743 | struct qlink_cmd_band_info_get *cmd; |
2744 | struct qlink_resp_band_info_get *resp; |
2745 | + size_t info_len = 0; |
2746 | int ret = 0; |
2747 | u8 qband; |
2748 | |
2749 | @@ -1764,8 +1769,8 @@ out: |
2750 | int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac) |
2751 | { |
2752 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2753 | - size_t response_size; |
2754 | struct qlink_resp_phy_params *resp; |
2755 | + size_t response_size = 0; |
2756 | int ret = 0; |
2757 | |
2758 | cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, 0, |
2759 | @@ -2431,7 +2436,7 @@ int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel, |
2760 | struct sk_buff *cmd_skb, *resp_skb = NULL; |
2761 | struct qlink_cmd_get_chan_stats *cmd; |
2762 | struct qlink_resp_get_chan_stats *resp; |
2763 | - size_t var_data_len; |
2764 | + size_t var_data_len = 0; |
2765 | int ret = 0; |
2766 | |
2767 | cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD, |
2768 | diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c |
2769 | index 42b1f73ac5f6..1e058196f23f 100644 |
2770 | --- a/drivers/of/overlay.c |
2771 | +++ b/drivers/of/overlay.c |
2772 | @@ -378,7 +378,9 @@ static int add_changeset_node(struct overlay_changeset *ovcs, |
2773 | if (ret) |
2774 | return ret; |
2775 | |
2776 | - return build_changeset_next_level(ovcs, tchild, node); |
2777 | + ret = build_changeset_next_level(ovcs, tchild, node); |
2778 | + of_node_put(tchild); |
2779 | + return ret; |
2780 | } |
2781 | |
2782 | if (node->phandle && tchild->phandle) |
2783 | diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c |
2784 | index f66521c7f846..42efcb850722 100644 |
2785 | --- a/drivers/platform/mips/cpu_hwmon.c |
2786 | +++ b/drivers/platform/mips/cpu_hwmon.c |
2787 | @@ -25,9 +25,10 @@ int loongson3_cpu_temp(int cpu) |
2788 | case PRID_REV_LOONGSON3A_R1: |
2789 | reg = (reg >> 8) & 0xff; |
2790 | break; |
2791 | - case PRID_REV_LOONGSON3A_R2: |
2792 | case PRID_REV_LOONGSON3B_R1: |
2793 | case PRID_REV_LOONGSON3B_R2: |
2794 | + case PRID_REV_LOONGSON3A_R2_0: |
2795 | + case PRID_REV_LOONGSON3A_R2_1: |
2796 | reg = ((reg >> 8) & 0xff) - 100; |
2797 | break; |
2798 | case PRID_REV_LOONGSON3A_R3_0: |
2799 | diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c |
2800 | index c285a16675ee..37b5de541270 100644 |
2801 | --- a/drivers/platform/x86/asus-wmi.c |
2802 | +++ b/drivers/platform/x86/asus-wmi.c |
2803 | @@ -2131,7 +2131,8 @@ static int asus_wmi_add(struct platform_device *pdev) |
2804 | err = asus_wmi_backlight_init(asus); |
2805 | if (err && err != -ENODEV) |
2806 | goto fail_backlight; |
2807 | - } |
2808 | + } else |
2809 | + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL); |
2810 | |
2811 | status = wmi_install_notify_handler(asus->driver->event_guid, |
2812 | asus_wmi_notify, asus); |
2813 | diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c |
2814 | index 59ecbb3b53b5..a33628550425 100644 |
2815 | --- a/drivers/scsi/megaraid/megaraid_sas_fp.c |
2816 | +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c |
2817 | @@ -1266,7 +1266,7 @@ void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *drv_map, |
2818 | |
2819 | for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES_EXT; ldCount++) { |
2820 | ld = MR_TargetIdToLdGet(ldCount, drv_map); |
2821 | - if (ld >= MAX_LOGICAL_DRIVES_EXT) { |
2822 | + if (ld >= MAX_LOGICAL_DRIVES_EXT - 1) { |
2823 | lbInfo[ldCount].loadBalanceFlag = 0; |
2824 | continue; |
2825 | } |
2826 | diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
2827 | index f74b5ea24f0f..49eaa87608f6 100644 |
2828 | --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c |
2829 | +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
2830 | @@ -2832,7 +2832,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance, |
2831 | device_id < instance->fw_supported_vd_count)) { |
2832 | |
2833 | ld = MR_TargetIdToLdGet(device_id, local_map_ptr); |
2834 | - if (ld >= instance->fw_supported_vd_count) |
2835 | + if (ld >= instance->fw_supported_vd_count - 1) |
2836 | fp_possible = 0; |
2837 | else { |
2838 | raid = MR_LdRaidGet(ld, local_map_ptr); |
2839 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
2840 | index 2500377d0723..bfd826deabbe 100644 |
2841 | --- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
2842 | +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
2843 | @@ -3319,8 +3319,9 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr, |
2844 | static inline void |
2845 | _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock) |
2846 | { |
2847 | + wmb(); |
2848 | __raw_writeq(b, addr); |
2849 | - mmiowb(); |
2850 | + barrier(); |
2851 | } |
2852 | #else |
2853 | static inline void |
2854 | diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c |
2855 | index 105b0e4d7818..5d7d018dad6e 100644 |
2856 | --- a/drivers/scsi/qedi/qedi_main.c |
2857 | +++ b/drivers/scsi/qedi/qedi_main.c |
2858 | @@ -952,6 +952,9 @@ static int qedi_find_boot_info(struct qedi_ctx *qedi, |
2859 | cls_sess = iscsi_conn_to_session(cls_conn); |
2860 | sess = cls_sess->dd_data; |
2861 | |
2862 | + if (!iscsi_is_session_online(cls_sess)) |
2863 | + continue; |
2864 | + |
2865 | if (pri_ctrl_flags) { |
2866 | if (!strcmp(pri_tgt->iscsi_name, sess->targetname) && |
2867 | !strcmp(pri_tgt->ip_addr, ep_ip_addr)) { |
2868 | diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c |
2869 | index a25a07a0b7f0..6f4cb3be97aa 100644 |
2870 | --- a/drivers/scsi/smartpqi/smartpqi_init.c |
2871 | +++ b/drivers/scsi/smartpqi/smartpqi_init.c |
2872 | @@ -2704,6 +2704,9 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info, |
2873 | switch (response->header.iu_type) { |
2874 | case PQI_RESPONSE_IU_RAID_PATH_IO_SUCCESS: |
2875 | case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS: |
2876 | + if (io_request->scmd) |
2877 | + io_request->scmd->result = 0; |
2878 | + /* fall through */ |
2879 | case PQI_RESPONSE_IU_GENERAL_MANAGEMENT: |
2880 | break; |
2881 | case PQI_RESPONSE_IU_TASK_MANAGEMENT: |
2882 | @@ -6670,6 +6673,7 @@ static void pqi_shutdown(struct pci_dev *pci_dev) |
2883 | * storage. |
2884 | */ |
2885 | rc = pqi_flush_cache(ctrl_info, SHUTDOWN); |
2886 | + pqi_free_interrupts(ctrl_info); |
2887 | pqi_reset(ctrl_info); |
2888 | if (rc == 0) |
2889 | return; |
2890 | diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c |
2891 | index 79d3ba62b298..45e88bada907 100644 |
2892 | --- a/drivers/staging/erofs/unzip_vle.c |
2893 | +++ b/drivers/staging/erofs/unzip_vle.c |
2894 | @@ -717,13 +717,18 @@ static void z_erofs_vle_unzip_kickoff(void *ptr, int bios) |
2895 | struct z_erofs_vle_unzip_io *io = tagptr_unfold_ptr(t); |
2896 | bool background = tagptr_unfold_tags(t); |
2897 | |
2898 | - if (atomic_add_return(bios, &io->pending_bios)) |
2899 | + if (!background) { |
2900 | + unsigned long flags; |
2901 | + |
2902 | + spin_lock_irqsave(&io->u.wait.lock, flags); |
2903 | + if (!atomic_add_return(bios, &io->pending_bios)) |
2904 | + wake_up_locked(&io->u.wait); |
2905 | + spin_unlock_irqrestore(&io->u.wait.lock, flags); |
2906 | return; |
2907 | + } |
2908 | |
2909 | - if (background) |
2910 | + if (!atomic_add_return(bios, &io->pending_bios)) |
2911 | queue_work(z_erofs_workqueue, &io->u.work); |
2912 | - else |
2913 | - wake_up(&io->u.wait); |
2914 | } |
2915 | |
2916 | static inline void z_erofs_vle_read_endio(struct bio *bio) |
2917 | diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c |
2918 | index f459118bc11b..c37dd36ec77d 100644 |
2919 | --- a/drivers/target/target_core_spc.c |
2920 | +++ b/drivers/target/target_core_spc.c |
2921 | @@ -108,12 +108,17 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) |
2922 | |
2923 | buf[7] = 0x2; /* CmdQue=1 */ |
2924 | |
2925 | - memcpy(&buf[8], "LIO-ORG ", 8); |
2926 | - memset(&buf[16], 0x20, 16); |
2927 | + /* |
2928 | + * ASCII data fields described as being left-aligned shall have any |
2929 | + * unused bytes at the end of the field (i.e., highest offset) and the |
2930 | + * unused bytes shall be filled with ASCII space characters (20h). |
2931 | + */ |
2932 | + memset(&buf[8], 0x20, 8 + 16 + 4); |
2933 | + memcpy(&buf[8], "LIO-ORG", sizeof("LIO-ORG") - 1); |
2934 | memcpy(&buf[16], dev->t10_wwn.model, |
2935 | - min_t(size_t, strlen(dev->t10_wwn.model), 16)); |
2936 | + strnlen(dev->t10_wwn.model, 16)); |
2937 | memcpy(&buf[32], dev->t10_wwn.revision, |
2938 | - min_t(size_t, strlen(dev->t10_wwn.revision), 4)); |
2939 | + strnlen(dev->t10_wwn.revision, 4)); |
2940 | buf[4] = 31; /* Set additional length to 31 */ |
2941 | |
2942 | return 0; |
2943 | @@ -251,7 +256,9 @@ check_t10_vend_desc: |
2944 | buf[off] = 0x2; /* ASCII */ |
2945 | buf[off+1] = 0x1; /* T10 Vendor ID */ |
2946 | buf[off+2] = 0x0; |
2947 | - memcpy(&buf[off+4], "LIO-ORG", 8); |
2948 | + /* left align Vendor ID and pad with spaces */ |
2949 | + memset(&buf[off+4], 0x20, 8); |
2950 | + memcpy(&buf[off+4], "LIO-ORG", sizeof("LIO-ORG") - 1); |
2951 | /* Extra Byte for NULL Terminator */ |
2952 | id_len++; |
2953 | /* Identifier Length */ |
2954 | diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
2955 | index 2cfd61d62e97..ffa5b9f771b5 100644 |
2956 | --- a/drivers/target/target_core_transport.c |
2957 | +++ b/drivers/target/target_core_transport.c |
2958 | @@ -224,19 +224,28 @@ void transport_subsystem_check_init(void) |
2959 | sub_api_initialized = 1; |
2960 | } |
2961 | |
2962 | +static void target_release_sess_cmd_refcnt(struct percpu_ref *ref) |
2963 | +{ |
2964 | + struct se_session *sess = container_of(ref, typeof(*sess), cmd_count); |
2965 | + |
2966 | + wake_up(&sess->cmd_list_wq); |
2967 | +} |
2968 | + |
2969 | /** |
2970 | * transport_init_session - initialize a session object |
2971 | * @se_sess: Session object pointer. |
2972 | * |
2973 | * The caller must have zero-initialized @se_sess before calling this function. |
2974 | */ |
2975 | -void transport_init_session(struct se_session *se_sess) |
2976 | +int transport_init_session(struct se_session *se_sess) |
2977 | { |
2978 | INIT_LIST_HEAD(&se_sess->sess_list); |
2979 | INIT_LIST_HEAD(&se_sess->sess_acl_list); |
2980 | INIT_LIST_HEAD(&se_sess->sess_cmd_list); |
2981 | spin_lock_init(&se_sess->sess_cmd_lock); |
2982 | init_waitqueue_head(&se_sess->cmd_list_wq); |
2983 | + return percpu_ref_init(&se_sess->cmd_count, |
2984 | + target_release_sess_cmd_refcnt, 0, GFP_KERNEL); |
2985 | } |
2986 | EXPORT_SYMBOL(transport_init_session); |
2987 | |
2988 | @@ -247,6 +256,7 @@ EXPORT_SYMBOL(transport_init_session); |
2989 | struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) |
2990 | { |
2991 | struct se_session *se_sess; |
2992 | + int ret; |
2993 | |
2994 | se_sess = kmem_cache_zalloc(se_sess_cache, GFP_KERNEL); |
2995 | if (!se_sess) { |
2996 | @@ -254,7 +264,11 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) |
2997 | " se_sess_cache\n"); |
2998 | return ERR_PTR(-ENOMEM); |
2999 | } |
3000 | - transport_init_session(se_sess); |
3001 | + ret = transport_init_session(se_sess); |
3002 | + if (ret < 0) { |
3003 | + kfree(se_sess); |
3004 | + return ERR_PTR(ret); |
3005 | + } |
3006 | se_sess->sup_prot_ops = sup_prot_ops; |
3007 | |
3008 | return se_sess; |
3009 | @@ -581,6 +595,7 @@ void transport_free_session(struct se_session *se_sess) |
3010 | sbitmap_queue_free(&se_sess->sess_tag_pool); |
3011 | kvfree(se_sess->sess_cmd_map); |
3012 | } |
3013 | + percpu_ref_exit(&se_sess->cmd_count); |
3014 | kmem_cache_free(se_sess_cache, se_sess); |
3015 | } |
3016 | EXPORT_SYMBOL(transport_free_session); |
3017 | @@ -2719,6 +2734,7 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) |
3018 | } |
3019 | se_cmd->transport_state |= CMD_T_PRE_EXECUTE; |
3020 | list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); |
3021 | + percpu_ref_get(&se_sess->cmd_count); |
3022 | out: |
3023 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
3024 | |
3025 | @@ -2749,8 +2765,6 @@ static void target_release_cmd_kref(struct kref *kref) |
3026 | if (se_sess) { |
3027 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
3028 | list_del_init(&se_cmd->se_cmd_list); |
3029 | - if (se_sess->sess_tearing_down && list_empty(&se_sess->sess_cmd_list)) |
3030 | - wake_up(&se_sess->cmd_list_wq); |
3031 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
3032 | } |
3033 | |
3034 | @@ -2758,6 +2772,8 @@ static void target_release_cmd_kref(struct kref *kref) |
3035 | se_cmd->se_tfo->release_cmd(se_cmd); |
3036 | if (compl) |
3037 | complete(compl); |
3038 | + |
3039 | + percpu_ref_put(&se_sess->cmd_count); |
3040 | } |
3041 | |
3042 | /** |
3043 | @@ -2886,6 +2902,8 @@ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) |
3044 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
3045 | se_sess->sess_tearing_down = 1; |
3046 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
3047 | + |
3048 | + percpu_ref_kill(&se_sess->cmd_count); |
3049 | } |
3050 | EXPORT_SYMBOL(target_sess_cmd_list_set_waiting); |
3051 | |
3052 | @@ -2900,17 +2918,14 @@ void target_wait_for_sess_cmds(struct se_session *se_sess) |
3053 | |
3054 | WARN_ON_ONCE(!se_sess->sess_tearing_down); |
3055 | |
3056 | - spin_lock_irq(&se_sess->sess_cmd_lock); |
3057 | do { |
3058 | - ret = wait_event_lock_irq_timeout( |
3059 | - se_sess->cmd_list_wq, |
3060 | - list_empty(&se_sess->sess_cmd_list), |
3061 | - se_sess->sess_cmd_lock, 180 * HZ); |
3062 | + ret = wait_event_timeout(se_sess->cmd_list_wq, |
3063 | + percpu_ref_is_zero(&se_sess->cmd_count), |
3064 | + 180 * HZ); |
3065 | list_for_each_entry(cmd, &se_sess->sess_cmd_list, se_cmd_list) |
3066 | target_show_cmd("session shutdown: still waiting for ", |
3067 | cmd); |
3068 | } while (ret <= 0); |
3069 | - spin_unlock_irq(&se_sess->sess_cmd_lock); |
3070 | } |
3071 | EXPORT_SYMBOL(target_wait_for_sess_cmds); |
3072 | |
3073 | diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c |
3074 | index 70adcfdca8d1..124495f953fa 100644 |
3075 | --- a/drivers/target/target_core_xcopy.c |
3076 | +++ b/drivers/target/target_core_xcopy.c |
3077 | @@ -479,6 +479,8 @@ static const struct target_core_fabric_ops xcopy_pt_tfo = { |
3078 | |
3079 | int target_xcopy_setup_pt(void) |
3080 | { |
3081 | + int ret; |
3082 | + |
3083 | xcopy_wq = alloc_workqueue("xcopy_wq", WQ_MEM_RECLAIM, 0); |
3084 | if (!xcopy_wq) { |
3085 | pr_err("Unable to allocate xcopy_wq\n"); |
3086 | @@ -496,7 +498,9 @@ int target_xcopy_setup_pt(void) |
3087 | INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list); |
3088 | INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list); |
3089 | memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); |
3090 | - transport_init_session(&xcopy_pt_sess); |
3091 | + ret = transport_init_session(&xcopy_pt_sess); |
3092 | + if (ret < 0) |
3093 | + return ret; |
3094 | |
3095 | xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; |
3096 | xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess; |
3097 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
3098 | index ebd33c0232e6..89ade213a1a9 100644 |
3099 | --- a/drivers/tty/serial/amba-pl011.c |
3100 | +++ b/drivers/tty/serial/amba-pl011.c |
3101 | @@ -2780,6 +2780,7 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { |
3102 | .name = "sbsa-uart", |
3103 | .of_match_table = of_match_ptr(sbsa_uart_of_match), |
3104 | .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), |
3105 | + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), |
3106 | }, |
3107 | }; |
3108 | |
3109 | @@ -2808,6 +2809,7 @@ static struct amba_driver pl011_driver = { |
3110 | .drv = { |
3111 | .name = "uart-pl011", |
3112 | .pm = &pl011_dev_pm_ops, |
3113 | + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), |
3114 | }, |
3115 | .id_table = pl011_ids, |
3116 | .probe = pl011_probe, |
3117 | diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c |
3118 | index fd80d999308d..0bdf1687983f 100644 |
3119 | --- a/drivers/tty/serial/pic32_uart.c |
3120 | +++ b/drivers/tty/serial/pic32_uart.c |
3121 | @@ -919,6 +919,7 @@ static struct platform_driver pic32_uart_platform_driver = { |
3122 | .driver = { |
3123 | .name = PIC32_DEV_NAME, |
3124 | .of_match_table = of_match_ptr(pic32_serial_dt_ids), |
3125 | + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_PIC32), |
3126 | }, |
3127 | }; |
3128 | |
3129 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
3130 | index c439a5a1e6c0..d4cca5bdaf1c 100644 |
3131 | --- a/drivers/tty/serial/serial_core.c |
3132 | +++ b/drivers/tty/serial/serial_core.c |
3133 | @@ -205,10 +205,15 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, |
3134 | if (!state->xmit.buf) { |
3135 | state->xmit.buf = (unsigned char *) page; |
3136 | uart_circ_clear(&state->xmit); |
3137 | + uart_port_unlock(uport, flags); |
3138 | } else { |
3139 | + uart_port_unlock(uport, flags); |
3140 | + /* |
3141 | + * Do not free() the page under the port lock, see |
3142 | + * uart_shutdown(). |
3143 | + */ |
3144 | free_page(page); |
3145 | } |
3146 | - uart_port_unlock(uport, flags); |
3147 | |
3148 | retval = uport->ops->startup(uport); |
3149 | if (retval == 0) { |
3150 | @@ -268,6 +273,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) |
3151 | struct uart_port *uport = uart_port_check(state); |
3152 | struct tty_port *port = &state->port; |
3153 | unsigned long flags = 0; |
3154 | + char *xmit_buf = NULL; |
3155 | |
3156 | /* |
3157 | * Set the TTY IO error marker |
3158 | @@ -298,14 +304,18 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) |
3159 | tty_port_set_suspended(port, 0); |
3160 | |
3161 | /* |
3162 | - * Free the transmit buffer page. |
3163 | + * Do not free() the transmit buffer page under the port lock since |
3164 | + * this can create various circular locking scenarios. For instance, |
3165 | + * console driver may need to allocate/free a debug object, which |
3166 | + * can endup in printk() recursion. |
3167 | */ |
3168 | uart_port_lock(state, flags); |
3169 | - if (state->xmit.buf) { |
3170 | - free_page((unsigned long)state->xmit.buf); |
3171 | - state->xmit.buf = NULL; |
3172 | - } |
3173 | + xmit_buf = state->xmit.buf; |
3174 | + state->xmit.buf = NULL; |
3175 | uart_port_unlock(uport, flags); |
3176 | + |
3177 | + if (xmit_buf) |
3178 | + free_page((unsigned long)xmit_buf); |
3179 | } |
3180 | |
3181 | /** |
3182 | diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c |
3183 | index 5413a04023f9..6df252648e40 100644 |
3184 | --- a/drivers/tty/serial/xilinx_uartps.c |
3185 | +++ b/drivers/tty/serial/xilinx_uartps.c |
3186 | @@ -1719,6 +1719,7 @@ static struct platform_driver cdns_uart_platform_driver = { |
3187 | .name = CDNS_UART_NAME, |
3188 | .of_match_table = cdns_uart_of_match, |
3189 | .pm = &cdns_uart_dev_pm_ops, |
3190 | + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_XILINX_PS_UART), |
3191 | }, |
3192 | }; |
3193 | |
3194 | diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
3195 | index 2d6d2c8244de..a00a56b4ae79 100644 |
3196 | --- a/drivers/usb/dwc2/gadget.c |
3197 | +++ b/drivers/usb/dwc2/gadget.c |
3198 | @@ -3165,8 +3165,6 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg, |
3199 | dwc2_hsotg_txfifo_flush(hsotg, ep->fifo_index); |
3200 | } |
3201 | |
3202 | -static int dwc2_hsotg_ep_disable(struct usb_ep *ep); |
3203 | - |
3204 | /** |
3205 | * dwc2_hsotg_disconnect - disconnect service |
3206 | * @hsotg: The device state. |
3207 | @@ -3188,9 +3186,11 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg) |
3208 | /* all endpoints should be shutdown */ |
3209 | for (ep = 0; ep < hsotg->num_of_eps; ep++) { |
3210 | if (hsotg->eps_in[ep]) |
3211 | - dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); |
3212 | + kill_all_requests(hsotg, hsotg->eps_in[ep], |
3213 | + -ESHUTDOWN); |
3214 | if (hsotg->eps_out[ep]) |
3215 | - dwc2_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); |
3216 | + kill_all_requests(hsotg, hsotg->eps_out[ep], |
3217 | + -ESHUTDOWN); |
3218 | } |
3219 | |
3220 | call_gadget(hsotg, disconnect); |
3221 | @@ -3234,6 +3234,7 @@ static void dwc2_hsotg_irq_fifoempty(struct dwc2_hsotg *hsotg, bool periodic) |
3222 | GINTSTS_PTXFEMP | \ |
3223 | GINTSTS_RXFLVL) |
3224 | |
3225 | +static int dwc2_hsotg_ep_disable(struct usb_ep *ep); |
3226 | /** |
3227 | * dwc2_hsotg_core_init - issue softreset to the core |
3228 | * @hsotg: The device state |
3229 | @@ -4069,10 +4070,8 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) |
3230 | struct dwc2_hsotg *hsotg = hs_ep->parent; |
3231 | int dir_in = hs_ep->dir_in; |
3232 | int index = hs_ep->index; |
3233 | - unsigned long flags; |
3234 | u32 epctrl_reg; |
3235 | u32 ctrl; |
3236 | - int locked; |
3237 | |
3238 | dev_dbg(hsotg->dev, "%s(ep %p)\n", __func__, ep); |
3239 | |
3240 | @@ -4088,10 +4087,6 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) |
3241 | |
3242 | epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); |
3243 | |
3244 | - locked = spin_is_locked(&hsotg->lock); |
3245 | - if (!locked) |
3246 | - spin_lock_irqsave(&hsotg->lock, flags); |
3247 | - |
3248 | ctrl = dwc2_readl(hsotg, epctrl_reg); |
3249 | |
3250 | if (ctrl & DXEPCTL_EPENA) |
3251 | @@ -4114,12 +4109,22 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) |
3252 | hs_ep->fifo_index = 0; |
3253 | hs_ep->fifo_size = 0; |
3254 | |
3255 | - if (!locked) |
3256 | - spin_unlock_irqrestore(&hsotg->lock, flags); |
3257 | - |
3258 | return 0; |
3259 | } |
3260 | |
3261 | +static int dwc2_hsotg_ep_disable_lock(struct usb_ep *ep) |
3262 | +{ |
3263 | + struct dwc2_hsotg_ep *hs_ep = our_ep(ep); |
3264 | + struct dwc2_hsotg *hsotg = hs_ep->parent; |
3265 | + unsigned long flags; |
3266 | + int ret; |
3267 | + |
3268 | + spin_lock_irqsave(&hsotg->lock, flags); |
3269 | + ret = dwc2_hsotg_ep_disable(ep); |
3270 | + spin_unlock_irqrestore(&hsotg->lock, flags); |
3271 | + return ret; |
3272 | +} |
3273 | + |
3274 | /** |
3275 | * on_list - check request is on the given endpoint |
3276 | * @ep: The endpoint to check. |
3277 | @@ -4267,7 +4272,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) |
3278 | |
3279 | static const struct usb_ep_ops dwc2_hsotg_ep_ops = { |
3280 | .enable = dwc2_hsotg_ep_enable, |
3281 | - .disable = dwc2_hsotg_ep_disable, |
3282 | + .disable = dwc2_hsotg_ep_disable_lock, |
3283 | .alloc_request = dwc2_hsotg_ep_alloc_request, |
3284 | .free_request = dwc2_hsotg_ep_free_request, |
3285 | .queue = dwc2_hsotg_ep_queue_lock, |
3286 | @@ -4407,9 +4412,9 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget) |
3287 | /* all endpoints should be shutdown */ |
3288 | for (ep = 1; ep < hsotg->num_of_eps; ep++) { |
3289 | if (hsotg->eps_in[ep]) |
3290 | - dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); |
3291 | + dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); |
3292 | if (hsotg->eps_out[ep]) |
3293 | - dwc2_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); |
3294 | + dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep); |
3295 | } |
3296 | |
3297 | spin_lock_irqsave(&hsotg->lock, flags); |
3298 | @@ -4857,9 +4862,9 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) |
3299 | |
3300 | for (ep = 0; ep < hsotg->num_of_eps; ep++) { |
3301 | if (hsotg->eps_in[ep]) |
3302 | - dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); |
3303 | + dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); |
3304 | if (hsotg->eps_out[ep]) |
3305 | - dwc2_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); |
3306 | + dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep); |
3307 | } |
3308 | } |
3309 | |
3310 | diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
3311 | index cdffbd1e0316..6e34f9594159 100644 |
3312 | --- a/drivers/usb/gadget/udc/renesas_usb3.c |
3313 | +++ b/drivers/usb/gadget/udc/renesas_usb3.c |
3314 | @@ -358,6 +358,7 @@ struct renesas_usb3 { |
3315 | bool extcon_host; /* check id and set EXTCON_USB_HOST */ |
3316 | bool extcon_usb; /* check vbus and set EXTCON_USB */ |
3317 | bool forced_b_device; |
3318 | + bool start_to_connect; |
3319 | }; |
3320 | |
3321 | #define gadget_to_renesas_usb3(_gadget) \ |
3322 | @@ -476,7 +477,8 @@ static void usb3_init_axi_bridge(struct renesas_usb3 *usb3) |
3323 | static void usb3_init_epc_registers(struct renesas_usb3 *usb3) |
3324 | { |
3325 | usb3_write(usb3, ~0, USB3_USB_INT_STA_1); |
3326 | - usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG); |
3327 | + if (!usb3->workaround_for_vbus) |
3328 | + usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG); |
3329 | } |
3330 | |
3331 | static bool usb3_wakeup_usb2_phy(struct renesas_usb3 *usb3) |
3332 | @@ -700,8 +702,7 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev) |
3333 | usb3_set_mode_by_role_sw(usb3, host); |
3334 | usb3_vbus_out(usb3, a_dev); |
3335 | /* for A-Peripheral or forced B-device mode */ |
3336 | - if ((!host && a_dev) || |
3337 | - (usb3->workaround_for_vbus && usb3->forced_b_device)) |
3338 | + if ((!host && a_dev) || usb3->start_to_connect) |
3339 | usb3_connect(usb3); |
3340 | spin_unlock_irqrestore(&usb3->lock, flags); |
3341 | } |
3342 | @@ -2432,7 +2433,11 @@ static ssize_t renesas_usb3_b_device_write(struct file *file, |
3343 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
3344 | return -EFAULT; |
3345 | |
3346 | - if (!strncmp(buf, "1", 1)) |
3347 | + usb3->start_to_connect = false; |
3348 | + if (usb3->workaround_for_vbus && usb3->forced_b_device && |
3349 | + !strncmp(buf, "2", 1)) |
3350 | + usb3->start_to_connect = true; |
3351 | + else if (!strncmp(buf, "1", 1)) |
3352 | usb3->forced_b_device = true; |
3353 | else |
3354 | usb3->forced_b_device = false; |
3355 | @@ -2440,7 +2445,7 @@ static ssize_t renesas_usb3_b_device_write(struct file *file, |
3356 | if (usb3->workaround_for_vbus) |
3357 | usb3_disconnect(usb3); |
3358 | |
3359 | - /* Let this driver call usb3_connect() anyway */ |
3360 | + /* Let this driver call usb3_connect() if needed */ |
3361 | usb3_check_id(usb3); |
3362 | |
3363 | return count; |
3364 | diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c |
3365 | index dbbd71f754d0..ba6e5cdaed2c 100644 |
3366 | --- a/drivers/usb/typec/tcpm/tcpm.c |
3367 | +++ b/drivers/usb/typec/tcpm/tcpm.c |
3368 | @@ -317,6 +317,9 @@ struct tcpm_port { |
3369 | /* Deadline in jiffies to exit src_try_wait state */ |
3370 | unsigned long max_wait; |
3371 | |
3372 | + /* port belongs to a self powered device */ |
3373 | + bool self_powered; |
3374 | + |
3375 | #ifdef CONFIG_DEBUG_FS |
3376 | struct dentry *dentry; |
3377 | struct mutex logbuffer_lock; /* log buffer access lock */ |
3378 | @@ -3254,7 +3257,8 @@ static void run_state_machine(struct tcpm_port *port) |
3379 | case SRC_HARD_RESET_VBUS_OFF: |
3380 | tcpm_set_vconn(port, true); |
3381 | tcpm_set_vbus(port, false); |
3382 | - tcpm_set_roles(port, false, TYPEC_SOURCE, TYPEC_HOST); |
3383 | + tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, |
3384 | + TYPEC_HOST); |
3385 | tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); |
3386 | break; |
3387 | case SRC_HARD_RESET_VBUS_ON: |
3388 | @@ -3267,7 +3271,8 @@ static void run_state_machine(struct tcpm_port *port) |
3389 | memset(&port->pps_data, 0, sizeof(port->pps_data)); |
3390 | tcpm_set_vconn(port, false); |
3391 | tcpm_set_charge(port, false); |
3392 | - tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE); |
3393 | + tcpm_set_roles(port, port->self_powered, TYPEC_SINK, |
3394 | + TYPEC_DEVICE); |
3395 | /* |
3396 | * VBUS may or may not toggle, depending on the adapter. |
3397 | * If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON |
3398 | @@ -4412,6 +4417,8 @@ sink: |
3399 | return -EINVAL; |
3400 | port->operating_snk_mw = mw / 1000; |
3401 | |
3402 | + port->self_powered = fwnode_property_read_bool(fwnode, "self-powered"); |
3403 | + |
3404 | return 0; |
3405 | } |
3406 | |
3407 | @@ -4720,6 +4727,7 @@ static int tcpm_copy_caps(struct tcpm_port *port, |
3408 | port->typec_caps.prefer_role = tcfg->default_role; |
3409 | port->typec_caps.type = tcfg->type; |
3410 | port->typec_caps.data = tcfg->data; |
3411 | + port->self_powered = port->tcpc->config->self_powered; |
3412 | |
3413 | return 0; |
3414 | } |
3415 | diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c |
3416 | index 329d3afcf304..65e4b8637638 100644 |
3417 | --- a/fs/btrfs/dev-replace.c |
3418 | +++ b/fs/btrfs/dev-replace.c |
3419 | @@ -797,39 +797,58 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) |
3420 | case BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED: |
3421 | result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED; |
3422 | btrfs_dev_replace_write_unlock(dev_replace); |
3423 | - goto leave; |
3424 | + break; |
3425 | case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED: |
3426 | + result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; |
3427 | + tgt_device = dev_replace->tgtdev; |
3428 | + src_device = dev_replace->srcdev; |
3429 | + btrfs_dev_replace_write_unlock(dev_replace); |
3430 | + btrfs_scrub_cancel(fs_info); |
3431 | + /* btrfs_dev_replace_finishing() will handle the cleanup part */ |
3432 | + btrfs_info_in_rcu(fs_info, |
3433 | + "dev_replace from %s (devid %llu) to %s canceled", |
3434 | + btrfs_dev_name(src_device), src_device->devid, |
3435 | + btrfs_dev_name(tgt_device)); |
3436 | + break; |
3437 | case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED: |
3438 | + /* |
3439 | + * Scrub doing the replace isn't running so we need to do the |
3440 | + * cleanup step of btrfs_dev_replace_finishing() here |
3441 | + */ |
3442 | result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; |
3443 | tgt_device = dev_replace->tgtdev; |
3444 | src_device = dev_replace->srcdev; |
3445 | dev_replace->tgtdev = NULL; |
3446 | dev_replace->srcdev = NULL; |
3447 | - break; |
3448 | - } |
3449 | - dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED; |
3450 | - dev_replace->time_stopped = ktime_get_real_seconds(); |
3451 | - dev_replace->item_needs_writeback = 1; |
3452 | - btrfs_dev_replace_write_unlock(dev_replace); |
3453 | - btrfs_scrub_cancel(fs_info); |
3454 | + dev_replace->replace_state = |
3455 | + BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED; |
3456 | + dev_replace->time_stopped = ktime_get_real_seconds(); |
3457 | + dev_replace->item_needs_writeback = 1; |
3458 | |
3459 | - trans = btrfs_start_transaction(root, 0); |
3460 | - if (IS_ERR(trans)) { |
3461 | - mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
3462 | - return PTR_ERR(trans); |
3463 | - } |
3464 | - ret = btrfs_commit_transaction(trans); |
3465 | - WARN_ON(ret); |
3466 | + btrfs_dev_replace_write_unlock(dev_replace); |
3467 | |
3468 | - btrfs_info_in_rcu(fs_info, |
3469 | - "dev_replace from %s (devid %llu) to %s canceled", |
3470 | - btrfs_dev_name(src_device), src_device->devid, |
3471 | - btrfs_dev_name(tgt_device)); |
3472 | + btrfs_scrub_cancel(fs_info); |
3473 | + |
3474 | + trans = btrfs_start_transaction(root, 0); |
3475 | + if (IS_ERR(trans)) { |
3476 | + mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
3477 | + return PTR_ERR(trans); |
3478 | + } |
3479 | + ret = btrfs_commit_transaction(trans); |
3480 | + WARN_ON(ret); |
3481 | |
3482 | - if (tgt_device) |
3483 | - btrfs_destroy_dev_replace_tgtdev(tgt_device); |
3484 | + btrfs_info_in_rcu(fs_info, |
3485 | + "suspended dev_replace from %s (devid %llu) to %s canceled", |
3486 | + btrfs_dev_name(src_device), src_device->devid, |
3487 | + btrfs_dev_name(tgt_device)); |
3488 | + |
3489 | + if (tgt_device) |
3490 | + btrfs_destroy_dev_replace_tgtdev(tgt_device); |
3491 | + break; |
3492 | + default: |
3493 | + result = -EINVAL; |
3494 | + } |
3495 | |
3496 | -leave: |
3497 | mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
3498 | return result; |
3499 | } |
3500 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
3501 | index 02772f8823cf..561bffcb56a0 100644 |
3502 | --- a/fs/btrfs/inode.c |
3503 | +++ b/fs/btrfs/inode.c |
3504 | @@ -6419,14 +6419,19 @@ fail_dir_item: |
3505 | err = btrfs_del_root_ref(trans, key.objectid, |
3506 | root->root_key.objectid, parent_ino, |
3507 | &local_index, name, name_len); |
3508 | - |
3509 | + if (err) |
3510 | + btrfs_abort_transaction(trans, err); |
3511 | } else if (add_backref) { |
3512 | u64 local_index; |
3513 | int err; |
3514 | |
3515 | err = btrfs_del_inode_ref(trans, root, name, name_len, |
3516 | ino, parent_ino, &local_index); |
3517 | + if (err) |
3518 | + btrfs_abort_transaction(trans, err); |
3519 | } |
3520 | + |
3521 | + /* Return the original error code */ |
3522 | return ret; |
3523 | } |
3524 | |
3525 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
3526 | index c872adfc939e..ea5fa9df9405 100644 |
3527 | --- a/fs/btrfs/volumes.c |
3528 | +++ b/fs/btrfs/volumes.c |
3529 | @@ -4775,19 +4775,17 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
3530 | /* |
3531 | * Use the number of data stripes to figure out how big this chunk |
3532 | * is really going to be in terms of logical address space, |
3533 | - * and compare that answer with the max chunk size |
3534 | + * and compare that answer with the max chunk size. If it's higher, |
3535 | + * we try to reduce stripe_size. |
3536 | */ |
3537 | if (stripe_size * data_stripes > max_chunk_size) { |
3538 | - stripe_size = div_u64(max_chunk_size, data_stripes); |
3539 | - |
3540 | - /* bump the answer up to a 16MB boundary */ |
3541 | - stripe_size = round_up(stripe_size, SZ_16M); |
3542 | - |
3543 | /* |
3544 | - * But don't go higher than the limits we found while searching |
3545 | - * for free extents |
3546 | + * Reduce stripe_size, round it up to a 16MB boundary again and |
3547 | + * then use it, unless it ends up being even bigger than the |
3548 | + * previous value we had already. |
3549 | */ |
3550 | - stripe_size = min(devices_info[ndevs - 1].max_avail, |
3551 | + stripe_size = min(round_up(div_u64(max_chunk_size, |
3552 | + data_stripes), SZ_16M), |
3553 | stripe_size); |
3554 | } |
3555 | |
3556 | @@ -7485,6 +7483,8 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info) |
3557 | struct btrfs_path *path; |
3558 | struct btrfs_root *root = fs_info->dev_root; |
3559 | struct btrfs_key key; |
3560 | + u64 prev_devid = 0; |
3561 | + u64 prev_dev_ext_end = 0; |
3562 | int ret = 0; |
3563 | |
3564 | key.objectid = 1; |
3565 | @@ -7529,10 +7529,22 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info) |
3566 | chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dext); |
3567 | physical_len = btrfs_dev_extent_length(leaf, dext); |
3568 | |
3569 | + /* Check if this dev extent overlaps with the previous one */ |
3570 | + if (devid == prev_devid && physical_offset < prev_dev_ext_end) { |
3571 | + btrfs_err(fs_info, |
3572 | +"dev extent devid %llu physical offset %llu overlap with previous dev extent end %llu", |
3573 | + devid, physical_offset, prev_dev_ext_end); |
3574 | + ret = -EUCLEAN; |
3575 | + goto out; |
3576 | + } |
3577 | + |
3578 | ret = verify_one_dev_extent(fs_info, chunk_offset, devid, |
3579 | physical_offset, physical_len); |
3580 | if (ret < 0) |
3581 | goto out; |
3582 | + prev_devid = devid; |
3583 | + prev_dev_ext_end = physical_offset + physical_len; |
3584 | + |
3585 | ret = btrfs_next_item(root, path); |
3586 | if (ret < 0) |
3587 | goto out; |
3588 | diff --git a/fs/iomap.c b/fs/iomap.c |
3589 | index d6bc98ae8d35..ce837d962d47 100644 |
3590 | --- a/fs/iomap.c |
3591 | +++ b/fs/iomap.c |
3592 | @@ -492,16 +492,29 @@ done: |
3593 | } |
3594 | EXPORT_SYMBOL_GPL(iomap_readpages); |
3595 | |
3596 | +/* |
3597 | + * iomap_is_partially_uptodate checks whether blocks within a page are |
3598 | + * uptodate or not. |
3599 | + * |
3600 | + * Returns true if all blocks which correspond to a file portion |
3601 | + * we want to read within the page are uptodate. |
3602 | + */ |
3603 | int |
3604 | iomap_is_partially_uptodate(struct page *page, unsigned long from, |
3605 | unsigned long count) |
3606 | { |
3607 | struct iomap_page *iop = to_iomap_page(page); |
3608 | struct inode *inode = page->mapping->host; |
3609 | - unsigned first = from >> inode->i_blkbits; |
3610 | - unsigned last = (from + count - 1) >> inode->i_blkbits; |
3611 | + unsigned len, first, last; |
3612 | unsigned i; |
3613 | |
3614 | + /* Limit range to one page */ |
3615 | + len = min_t(unsigned, PAGE_SIZE - from, count); |
3616 | + |
3617 | + /* First and last blocks in range within page */ |
3618 | + first = from >> inode->i_blkbits; |
3619 | + last = (from + len - 1) >> inode->i_blkbits; |
3620 | + |
3621 | if (iop) { |
3622 | for (i = first; i <= last; i++) |
3623 | if (!test_bit(i, iop->uptodate)) |
3624 | diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c |
3625 | index 902a7dd10e5c..bb6ae387469f 100644 |
3626 | --- a/fs/jffs2/super.c |
3627 | +++ b/fs/jffs2/super.c |
3628 | @@ -101,7 +101,8 @@ static int jffs2_sync_fs(struct super_block *sb, int wait) |
3629 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); |
3630 | |
3631 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
3632 | - cancel_delayed_work_sync(&c->wbuf_dwork); |
3633 | + if (jffs2_is_writebuffered(c)) |
3634 | + cancel_delayed_work_sync(&c->wbuf_dwork); |
3635 | #endif |
3636 | |
3637 | mutex_lock(&c->alloc_sem); |
3638 | diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c |
3639 | index 7642b6712c39..30208233f65b 100644 |
3640 | --- a/fs/ocfs2/localalloc.c |
3641 | +++ b/fs/ocfs2/localalloc.c |
3642 | @@ -345,13 +345,18 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) |
3643 | if (num_used |
3644 | || alloc->id1.bitmap1.i_used |
3645 | || alloc->id1.bitmap1.i_total |
3646 | - || la->la_bm_off) |
3647 | - mlog(ML_ERROR, "Local alloc hasn't been recovered!\n" |
3648 | + || la->la_bm_off) { |
3649 | + mlog(ML_ERROR, "inconsistent detected, clean journal with" |
3650 | + " unrecovered local alloc, please run fsck.ocfs2!\n" |
3651 | "found = %u, set = %u, taken = %u, off = %u\n", |
3652 | num_used, le32_to_cpu(alloc->id1.bitmap1.i_used), |
3653 | le32_to_cpu(alloc->id1.bitmap1.i_total), |
3654 | OCFS2_LOCAL_ALLOC(alloc)->la_bm_off); |
3655 | |
3656 | + status = -EINVAL; |
3657 | + goto bail; |
3658 | + } |
3659 | + |
3660 | osb->local_alloc_bh = alloc_bh; |
3661 | osb->local_alloc_state = OCFS2_LA_ENABLED; |
3662 | |
3663 | diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c |
3664 | index 12e21f789194..79f0e183f135 100644 |
3665 | --- a/fs/pstore/ram_core.c |
3666 | +++ b/fs/pstore/ram_core.c |
3667 | @@ -497,6 +497,11 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, |
3668 | sig ^= PERSISTENT_RAM_SIG; |
3669 | |
3670 | if (prz->buffer->sig == sig) { |
3671 | + if (buffer_size(prz) == 0) { |
3672 | + pr_debug("found existing empty buffer\n"); |
3673 | + return 0; |
3674 | + } |
3675 | + |
3676 | if (buffer_size(prz) > prz->buffer_size || |
3677 | buffer_start(prz) > buffer_size(prz)) |
3678 | pr_info("found existing invalid buffer, size %zu, start %zu\n", |
3679 | diff --git a/fs/quota/quota.c b/fs/quota/quota.c |
3680 | index f0cbf58ad4da..fd5dd806f1b9 100644 |
3681 | --- a/fs/quota/quota.c |
3682 | +++ b/fs/quota/quota.c |
3683 | @@ -791,7 +791,8 @@ static int quotactl_cmd_write(int cmd) |
3684 | /* Return true if quotactl command is manipulating quota on/off state */ |
3685 | static bool quotactl_cmd_onoff(int cmd) |
3686 | { |
3687 | - return (cmd == Q_QUOTAON) || (cmd == Q_QUOTAOFF); |
3688 | + return (cmd == Q_QUOTAON) || (cmd == Q_QUOTAOFF) || |
3689 | + (cmd == Q_XQUOTAON) || (cmd == Q_XQUOTAOFF); |
3690 | } |
3691 | |
3692 | /* |
3693 | diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c |
3694 | index 7a85e609fc27..d8b8323e80f4 100644 |
3695 | --- a/fs/userfaultfd.c |
3696 | +++ b/fs/userfaultfd.c |
3697 | @@ -736,10 +736,18 @@ void mremap_userfaultfd_prep(struct vm_area_struct *vma, |
3698 | struct userfaultfd_ctx *ctx; |
3699 | |
3700 | ctx = vma->vm_userfaultfd_ctx.ctx; |
3701 | - if (ctx && (ctx->features & UFFD_FEATURE_EVENT_REMAP)) { |
3702 | + |
3703 | + if (!ctx) |
3704 | + return; |
3705 | + |
3706 | + if (ctx->features & UFFD_FEATURE_EVENT_REMAP) { |
3707 | vm_ctx->ctx = ctx; |
3708 | userfaultfd_ctx_get(ctx); |
3709 | WRITE_ONCE(ctx->mmap_changing, true); |
3710 | + } else { |
3711 | + /* Drop uffd context if remap feature not enabled */ |
3712 | + vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; |
3713 | + vma->vm_flags &= ~(VM_UFFD_WP | VM_UFFD_MISSING); |
3714 | } |
3715 | } |
3716 | |
3717 | diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h |
3718 | index 9a6bc0951cfa..c31157135598 100644 |
3719 | --- a/include/linux/backing-dev-defs.h |
3720 | +++ b/include/linux/backing-dev-defs.h |
3721 | @@ -258,6 +258,14 @@ static inline void wb_get(struct bdi_writeback *wb) |
3722 | */ |
3723 | static inline void wb_put(struct bdi_writeback *wb) |
3724 | { |
3725 | + if (WARN_ON_ONCE(!wb->bdi)) { |
3726 | + /* |
3727 | + * A driver bug might cause a file to be removed before bdi was |
3728 | + * initialized. |
3729 | + */ |
3730 | + return; |
3731 | + } |
3732 | + |
3733 | if (wb != &wb->bdi->wb) |
3734 | percpu_ref_put(&wb->refcnt); |
3735 | } |
3736 | diff --git a/include/linux/filter.h b/include/linux/filter.h |
3737 | index a8b9d90a8042..25a556589ae8 100644 |
3738 | --- a/include/linux/filter.h |
3739 | +++ b/include/linux/filter.h |
3740 | @@ -675,24 +675,10 @@ static inline u32 bpf_ctx_off_adjust_machine(u32 size) |
3741 | return size; |
3742 | } |
3743 | |
3744 | -static inline bool bpf_ctx_narrow_align_ok(u32 off, u32 size_access, |
3745 | - u32 size_default) |
3746 | -{ |
3747 | - size_default = bpf_ctx_off_adjust_machine(size_default); |
3748 | - size_access = bpf_ctx_off_adjust_machine(size_access); |
3749 | - |
3750 | -#ifdef __LITTLE_ENDIAN |
3751 | - return (off & (size_default - 1)) == 0; |
3752 | -#else |
3753 | - return (off & (size_default - 1)) + size_access == size_default; |
3754 | -#endif |
3755 | -} |
3756 | - |
3757 | static inline bool |
3758 | bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) |
3759 | { |
3760 | - return bpf_ctx_narrow_align_ok(off, size, size_default) && |
3761 | - size <= size_default && (size & (size - 1)) == 0; |
3762 | + return size <= size_default && (size & (size - 1)) == 0; |
3763 | } |
3764 | |
3765 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
3766 | diff --git a/include/linux/memblock.h b/include/linux/memblock.h |
3767 | index aee299a6aa76..3ef3086ed52f 100644 |
3768 | --- a/include/linux/memblock.h |
3769 | +++ b/include/linux/memblock.h |
3770 | @@ -320,6 +320,7 @@ static inline int memblock_get_region_node(const struct memblock_region *r) |
3771 | /* Flags for memblock allocation APIs */ |
3772 | #define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) |
3773 | #define MEMBLOCK_ALLOC_ACCESSIBLE 0 |
3774 | +#define MEMBLOCK_ALLOC_KASAN 1 |
3775 | |
3776 | /* We are using top down, so it is safe to use 0 here */ |
3777 | #define MEMBLOCK_LOW_LIMIT 0 |
3778 | diff --git a/include/linux/swap.h b/include/linux/swap.h |
3779 | index d8a07a4f171d..3d3630b3f63d 100644 |
3780 | --- a/include/linux/swap.h |
3781 | +++ b/include/linux/swap.h |
3782 | @@ -233,7 +233,6 @@ struct swap_info_struct { |
3783 | unsigned long flags; /* SWP_USED etc: see above */ |
3784 | signed short prio; /* swap priority of this type */ |
3785 | struct plist_node list; /* entry in swap_active_head */ |
3786 | - struct plist_node avail_lists[MAX_NUMNODES];/* entry in swap_avail_heads */ |
3787 | signed char type; /* strange name for an index */ |
3788 | unsigned int max; /* extent of the swap_map */ |
3789 | unsigned char *swap_map; /* vmalloc'ed array of usage counts */ |
3790 | @@ -274,6 +273,16 @@ struct swap_info_struct { |
3791 | */ |
3792 | struct work_struct discard_work; /* discard worker */ |
3793 | struct swap_cluster_list discard_clusters; /* discard clusters list */ |
3794 | + struct plist_node avail_lists[0]; /* |
3795 | + * entries in swap_avail_heads, one |
3796 | + * entry per node. |
3797 | + * Must be last as the number of the |
3798 | + * array is nr_node_ids, which is not |
3799 | + * a fixed value so have to allocate |
3800 | + * dynamically. |
3801 | + * And it has to be an array so that |
3802 | + * plist_for_each_* can work. |
3803 | + */ |
3804 | }; |
3805 | |
3806 | #ifdef CONFIG_64BIT |
3807 | diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h |
3808 | index 7e7fbfb84e8e..50c74a77db55 100644 |
3809 | --- a/include/linux/usb/tcpm.h |
3810 | +++ b/include/linux/usb/tcpm.h |
3811 | @@ -89,6 +89,7 @@ struct tcpc_config { |
3812 | enum typec_port_data data; |
3813 | enum typec_role default_role; |
3814 | bool try_role_hw; /* try.{src,snk} implemented in hardware */ |
3815 | + bool self_powered; /* port belongs to a self powered device */ |
3816 | |
3817 | const struct typec_altmode_desc *alt_modes; |
3818 | }; |
3819 | diff --git a/include/sound/soc.h b/include/sound/soc.h |
3820 | index 70c10a8f3e90..3e0ac310a3df 100644 |
3821 | --- a/include/sound/soc.h |
3822 | +++ b/include/sound/soc.h |
3823 | @@ -553,12 +553,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, |
3824 | } |
3825 | #endif |
3826 | |
3827 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
3828 | struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component); |
3829 | struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, |
3830 | unsigned int id, unsigned int id_mask); |
3831 | void snd_soc_free_ac97_component(struct snd_ac97 *ac97); |
3832 | |
3833 | +#ifdef CONFIG_SND_SOC_AC97_BUS |
3834 | int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); |
3835 | int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, |
3836 | struct platform_device *pdev); |
3837 | diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h |
3838 | index e3bdb0550a59..d9fd4eac58c2 100644 |
3839 | --- a/include/target/target_core_base.h |
3840 | +++ b/include/target/target_core_base.h |
3841 | @@ -601,6 +601,7 @@ struct se_session { |
3842 | struct se_node_acl *se_node_acl; |
3843 | struct se_portal_group *se_tpg; |
3844 | void *fabric_sess_ptr; |
3845 | + struct percpu_ref cmd_count; |
3846 | struct list_head sess_list; |
3847 | struct list_head sess_acl_list; |
3848 | struct list_head sess_cmd_list; |
3849 | diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h |
3850 | index f4147b398431..eb9d0923c55c 100644 |
3851 | --- a/include/target/target_core_fabric.h |
3852 | +++ b/include/target/target_core_fabric.h |
3853 | @@ -116,7 +116,7 @@ struct se_session *target_setup_session(struct se_portal_group *, |
3854 | struct se_session *, void *)); |
3855 | void target_remove_session(struct se_session *); |
3856 | |
3857 | -void transport_init_session(struct se_session *); |
3858 | +int transport_init_session(struct se_session *se_sess); |
3859 | struct se_session *transport_alloc_session(enum target_prot_op); |
3860 | int transport_alloc_session_tags(struct se_session *, unsigned int, |
3861 | unsigned int); |
3862 | diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
3863 | index 51ba84d4d34a..eedc7bd4185d 100644 |
3864 | --- a/kernel/bpf/verifier.c |
3865 | +++ b/kernel/bpf/verifier.c |
3866 | @@ -3571,12 +3571,15 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3867 | return err; |
3868 | |
3869 | if (BPF_SRC(insn->code) == BPF_X) { |
3870 | + struct bpf_reg_state *src_reg = regs + insn->src_reg; |
3871 | + struct bpf_reg_state *dst_reg = regs + insn->dst_reg; |
3872 | + |
3873 | if (BPF_CLASS(insn->code) == BPF_ALU64) { |
3874 | /* case: R1 = R2 |
3875 | * copy register state to dest reg |
3876 | */ |
3877 | - regs[insn->dst_reg] = regs[insn->src_reg]; |
3878 | - regs[insn->dst_reg].live |= REG_LIVE_WRITTEN; |
3879 | + *dst_reg = *src_reg; |
3880 | + dst_reg->live |= REG_LIVE_WRITTEN; |
3881 | } else { |
3882 | /* R1 = (u32) R2 */ |
3883 | if (is_pointer_value(env, insn->src_reg)) { |
3884 | @@ -3584,9 +3587,14 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3885 | "R%d partial copy of pointer\n", |
3886 | insn->src_reg); |
3887 | return -EACCES; |
3888 | + } else if (src_reg->type == SCALAR_VALUE) { |
3889 | + *dst_reg = *src_reg; |
3890 | + dst_reg->live |= REG_LIVE_WRITTEN; |
3891 | + } else { |
3892 | + mark_reg_unknown(env, regs, |
3893 | + insn->dst_reg); |
3894 | } |
3895 | - mark_reg_unknown(env, regs, insn->dst_reg); |
3896 | - coerce_reg_to_size(®s[insn->dst_reg], 4); |
3897 | + coerce_reg_to_size(dst_reg, 4); |
3898 | } |
3899 | } else { |
3900 | /* case: R = imm |
3901 | @@ -5789,10 +5797,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
3902 | int i, cnt, size, ctx_field_size, delta = 0; |
3903 | const int insn_cnt = env->prog->len; |
3904 | struct bpf_insn insn_buf[16], *insn; |
3905 | + u32 target_size, size_default, off; |
3906 | struct bpf_prog *new_prog; |
3907 | enum bpf_access_type type; |
3908 | bool is_narrower_load; |
3909 | - u32 target_size; |
3910 | |
3911 | if (ops->gen_prologue || env->seen_direct_write) { |
3912 | if (!ops->gen_prologue) { |
3913 | @@ -5885,9 +5893,9 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
3914 | * we will apply proper mask to the result. |
3915 | */ |
3916 | is_narrower_load = size < ctx_field_size; |
3917 | + size_default = bpf_ctx_off_adjust_machine(ctx_field_size); |
3918 | + off = insn->off; |
3919 | if (is_narrower_load) { |
3920 | - u32 size_default = bpf_ctx_off_adjust_machine(ctx_field_size); |
3921 | - u32 off = insn->off; |
3922 | u8 size_code; |
3923 | |
3924 | if (type == BPF_WRITE) { |
3925 | @@ -5915,12 +5923,23 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
3926 | } |
3927 | |
3928 | if (is_narrower_load && size < target_size) { |
3929 | - if (ctx_field_size <= 4) |
3930 | + u8 shift = (off & (size_default - 1)) * 8; |
3931 | + |
3932 | + if (ctx_field_size <= 4) { |
3933 | + if (shift) |
3934 | + insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH, |
3935 | + insn->dst_reg, |
3936 | + shift); |
3937 | insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg, |
3938 | (1 << size * 8) - 1); |
3939 | - else |
3940 | + } else { |
3941 | + if (shift) |
3942 | + insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH, |
3943 | + insn->dst_reg, |
3944 | + shift); |
3945 | insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg, |
3946 | (1 << size * 8) - 1); |
3947 | + } |
3948 | } |
3949 | |
3950 | new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); |
3951 | diff --git a/mm/memblock.c b/mm/memblock.c |
3952 | index 81ae63ca78d0..f45a049532fe 100644 |
3953 | --- a/mm/memblock.c |
3954 | +++ b/mm/memblock.c |
3955 | @@ -262,7 +262,8 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, |
3956 | phys_addr_t kernel_end, ret; |
3957 | |
3958 | /* pump up @end */ |
3959 | - if (end == MEMBLOCK_ALLOC_ACCESSIBLE) |
3960 | + if (end == MEMBLOCK_ALLOC_ACCESSIBLE || |
3961 | + end == MEMBLOCK_ALLOC_KASAN) |
3962 | end = memblock.current_limit; |
3963 | |
3964 | /* avoid allocating the first page */ |
3965 | @@ -1412,13 +1413,15 @@ again: |
3966 | done: |
3967 | ptr = phys_to_virt(alloc); |
3968 | |
3969 | - /* |
3970 | - * The min_count is set to 0 so that bootmem allocated blocks |
3971 | - * are never reported as leaks. This is because many of these blocks |
3972 | - * are only referred via the physical address which is not |
3973 | - * looked up by kmemleak. |
3974 | - */ |
3975 | - kmemleak_alloc(ptr, size, 0, 0); |
3976 | + /* Skip kmemleak for kasan_init() due to high volume. */ |
3977 | + if (max_addr != MEMBLOCK_ALLOC_KASAN) |
3978 | + /* |
3979 | + * The min_count is set to 0 so that bootmem allocated |
3980 | + * blocks are never reported as leaks. This is because many |
3981 | + * of these blocks are only referred via the physical |
3982 | + * address which is not looked up by kmemleak. |
3983 | + */ |
3984 | + kmemleak_alloc(ptr, size, 0, 0); |
3985 | |
3986 | return ptr; |
3987 | } |
3988 | diff --git a/mm/page-writeback.c b/mm/page-writeback.c |
3989 | index 3f690bae6b78..7d1010453fb9 100644 |
3990 | --- a/mm/page-writeback.c |
3991 | +++ b/mm/page-writeback.c |
3992 | @@ -2154,6 +2154,7 @@ int write_cache_pages(struct address_space *mapping, |
3993 | { |
3994 | int ret = 0; |
3995 | int done = 0; |
3996 | + int error; |
3997 | struct pagevec pvec; |
3998 | int nr_pages; |
3999 | pgoff_t uninitialized_var(writeback_index); |
4000 | @@ -2227,25 +2228,31 @@ continue_unlock: |
4001 | goto continue_unlock; |
4002 | |
4003 | trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); |
4004 | - ret = (*writepage)(page, wbc, data); |
4005 | - if (unlikely(ret)) { |
4006 | - if (ret == AOP_WRITEPAGE_ACTIVATE) { |
4007 | + error = (*writepage)(page, wbc, data); |
4008 | + if (unlikely(error)) { |
4009 | + /* |
4010 | + * Handle errors according to the type of |
4011 | + * writeback. There's no need to continue for |
4012 | + * background writeback. Just push done_index |
4013 | + * past this page so media errors won't choke |
4014 | + * writeout for the entire file. For integrity |
4015 | + * writeback, we must process the entire dirty |
4016 | + * set regardless of errors because the fs may |
4017 | + * still have state to clear for each page. In |
4018 | + * that case we continue processing and return |
4019 | + * the first error. |
4020 | + */ |
4021 | + if (error == AOP_WRITEPAGE_ACTIVATE) { |
4022 | unlock_page(page); |
4023 | - ret = 0; |
4024 | - } else { |
4025 | - /* |
4026 | - * done_index is set past this page, |
4027 | - * so media errors will not choke |
4028 | - * background writeout for the entire |
4029 | - * file. This has consequences for |
4030 | - * range_cyclic semantics (ie. it may |
4031 | - * not be suitable for data integrity |
4032 | - * writeout). |
4033 | - */ |
4034 | + error = 0; |
4035 | + } else if (wbc->sync_mode != WB_SYNC_ALL) { |
4036 | + ret = error; |
4037 | done_index = page->index + 1; |
4038 | done = 1; |
4039 | break; |
4040 | } |
4041 | + if (!ret) |
4042 | + ret = error; |
4043 | } |
4044 | |
4045 | /* |
4046 | diff --git a/mm/swapfile.c b/mm/swapfile.c |
4047 | index 20d3c0f47a5f..dbac1d49469d 100644 |
4048 | --- a/mm/swapfile.c |
4049 | +++ b/mm/swapfile.c |
4050 | @@ -2813,8 +2813,9 @@ static struct swap_info_struct *alloc_swap_info(void) |
4051 | struct swap_info_struct *p; |
4052 | unsigned int type; |
4053 | int i; |
4054 | + int size = sizeof(*p) + nr_node_ids * sizeof(struct plist_node); |
4055 | |
4056 | - p = kvzalloc(sizeof(*p), GFP_KERNEL); |
4057 | + p = kvzalloc(size, GFP_KERNEL); |
4058 | if (!p) |
4059 | return ERR_PTR(-ENOMEM); |
4060 | |
4061 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
4062 | index ef9928d7b4fb..ac2826ce162b 100644 |
4063 | --- a/net/bluetooth/hci_event.c |
4064 | +++ b/net/bluetooth/hci_event.c |
4065 | @@ -5711,6 +5711,12 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode, |
4066 | return true; |
4067 | } |
4068 | |
4069 | + /* Check if request ended in Command Status - no way to retreive |
4070 | + * any extra parameters in this case. |
4071 | + */ |
4072 | + if (hdr->evt == HCI_EV_CMD_STATUS) |
4073 | + return false; |
4074 | + |
4075 | if (hdr->evt != HCI_EV_CMD_COMPLETE) { |
4076 | bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)", |
4077 | hdr->evt); |
4078 | diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c |
4079 | index 5372e2042adf..2cb8da465b98 100644 |
4080 | --- a/net/bridge/br_forward.c |
4081 | +++ b/net/bridge/br_forward.c |
4082 | @@ -65,6 +65,7 @@ EXPORT_SYMBOL_GPL(br_dev_queue_push_xmit); |
4083 | |
4084 | int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb) |
4085 | { |
4086 | + skb->tstamp = 0; |
4087 | return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING, |
4088 | net, sk, skb, NULL, skb->dev, |
4089 | br_dev_queue_push_xmit); |
4090 | diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
4091 | index a8217e221e19..eebc3106d30e 100644 |
4092 | --- a/net/core/skbuff.c |
4093 | +++ b/net/core/skbuff.c |
4094 | @@ -5202,7 +5202,6 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, |
4095 | unsigned long chunk; |
4096 | struct sk_buff *skb; |
4097 | struct page *page; |
4098 | - gfp_t gfp_head; |
4099 | int i; |
4100 | |
4101 | *errcode = -EMSGSIZE; |
4102 | @@ -5212,12 +5211,8 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, |
4103 | if (npages > MAX_SKB_FRAGS) |
4104 | return NULL; |
4105 | |
4106 | - gfp_head = gfp_mask; |
4107 | - if (gfp_head & __GFP_DIRECT_RECLAIM) |
4108 | - gfp_head |= __GFP_RETRY_MAYFAIL; |
4109 | - |
4110 | *errcode = -ENOBUFS; |
4111 | - skb = alloc_skb(header_len, gfp_head); |
4112 | + skb = alloc_skb(header_len, gfp_mask); |
4113 | if (!skb) |
4114 | return NULL; |
4115 | |
4116 | diff --git a/net/core/sock.c b/net/core/sock.c |
4117 | index 98659fb6e9fb..530583ae92bf 100644 |
4118 | --- a/net/core/sock.c |
4119 | +++ b/net/core/sock.c |
4120 | @@ -698,6 +698,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, |
4121 | break; |
4122 | case SO_DONTROUTE: |
4123 | sock_valbool_flag(sk, SOCK_LOCALROUTE, valbool); |
4124 | + sk_dst_reset(sk); |
4125 | break; |
4126 | case SO_BROADCAST: |
4127 | sock_valbool_flag(sk, SOCK_BROADCAST, valbool); |
4128 | diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c |
4129 | index 608a6f4223fb..fecd0e7672b5 100644 |
4130 | --- a/net/ipv4/devinet.c |
4131 | +++ b/net/ipv4/devinet.c |
4132 | @@ -1826,7 +1826,7 @@ put_tgt_net: |
4133 | if (fillargs.netnsid >= 0) |
4134 | put_net(tgt_net); |
4135 | |
4136 | - return err < 0 ? err : skb->len; |
4137 | + return skb->len ? : err; |
4138 | } |
4139 | |
4140 | static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, |
4141 | diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
4142 | index 2c8d313ae216..fb1e7f237f53 100644 |
4143 | --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c |
4144 | +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
4145 | @@ -57,17 +57,14 @@ struct clusterip_config { |
4146 | enum clusterip_hashmode hash_mode; /* which hashing mode */ |
4147 | u_int32_t hash_initval; /* hash initialization */ |
4148 | struct rcu_head rcu; |
4149 | - |
4150 | + struct net *net; /* netns for pernet list */ |
4151 | char ifname[IFNAMSIZ]; /* device ifname */ |
4152 | - struct notifier_block notifier; /* refresh c->ifindex in it */ |
4153 | }; |
4154 | |
4155 | #ifdef CONFIG_PROC_FS |
4156 | static const struct file_operations clusterip_proc_fops; |
4157 | #endif |
4158 | |
4159 | -static unsigned int clusterip_net_id __read_mostly; |
4160 | - |
4161 | struct clusterip_net { |
4162 | struct list_head configs; |
4163 | /* lock protects the configs list */ |
4164 | @@ -78,16 +75,30 @@ struct clusterip_net { |
4165 | #endif |
4166 | }; |
4167 | |
4168 | +static unsigned int clusterip_net_id __read_mostly; |
4169 | +static inline struct clusterip_net *clusterip_pernet(struct net *net) |
4170 | +{ |
4171 | + return net_generic(net, clusterip_net_id); |
4172 | +} |
4173 | + |
4174 | static inline void |
4175 | clusterip_config_get(struct clusterip_config *c) |
4176 | { |
4177 | refcount_inc(&c->refcount); |
4178 | } |
4179 | |
4180 | - |
4181 | static void clusterip_config_rcu_free(struct rcu_head *head) |
4182 | { |
4183 | - kfree(container_of(head, struct clusterip_config, rcu)); |
4184 | + struct clusterip_config *config; |
4185 | + struct net_device *dev; |
4186 | + |
4187 | + config = container_of(head, struct clusterip_config, rcu); |
4188 | + dev = dev_get_by_name(config->net, config->ifname); |
4189 | + if (dev) { |
4190 | + dev_mc_del(dev, config->clustermac); |
4191 | + dev_put(dev); |
4192 | + } |
4193 | + kfree(config); |
4194 | } |
4195 | |
4196 | static inline void |
4197 | @@ -101,9 +112,9 @@ clusterip_config_put(struct clusterip_config *c) |
4198 | * entry(rule) is removed, remove the config from lists, but don't free it |
4199 | * yet, since proc-files could still be holding references */ |
4200 | static inline void |
4201 | -clusterip_config_entry_put(struct net *net, struct clusterip_config *c) |
4202 | +clusterip_config_entry_put(struct clusterip_config *c) |
4203 | { |
4204 | - struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
4205 | + struct clusterip_net *cn = clusterip_pernet(c->net); |
4206 | |
4207 | local_bh_disable(); |
4208 | if (refcount_dec_and_lock(&c->entries, &cn->lock)) { |
4209 | @@ -118,8 +129,6 @@ clusterip_config_entry_put(struct net *net, struct clusterip_config *c) |
4210 | spin_unlock(&cn->lock); |
4211 | local_bh_enable(); |
4212 | |
4213 | - unregister_netdevice_notifier(&c->notifier); |
4214 | - |
4215 | return; |
4216 | } |
4217 | local_bh_enable(); |
4218 | @@ -129,7 +138,7 @@ static struct clusterip_config * |
4219 | __clusterip_config_find(struct net *net, __be32 clusterip) |
4220 | { |
4221 | struct clusterip_config *c; |
4222 | - struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
4223 | + struct clusterip_net *cn = clusterip_pernet(net); |
4224 | |
4225 | list_for_each_entry_rcu(c, &cn->configs, list) { |
4226 | if (c->clusterip == clusterip) |
4227 | @@ -181,32 +190,37 @@ clusterip_netdev_event(struct notifier_block *this, unsigned long event, |
4228 | void *ptr) |
4229 | { |
4230 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
4231 | + struct net *net = dev_net(dev); |
4232 | + struct clusterip_net *cn = clusterip_pernet(net); |
4233 | struct clusterip_config *c; |
4234 | |
4235 | - c = container_of(this, struct clusterip_config, notifier); |
4236 | - switch (event) { |
4237 | - case NETDEV_REGISTER: |
4238 | - if (!strcmp(dev->name, c->ifname)) { |
4239 | - c->ifindex = dev->ifindex; |
4240 | - dev_mc_add(dev, c->clustermac); |
4241 | - } |
4242 | - break; |
4243 | - case NETDEV_UNREGISTER: |
4244 | - if (dev->ifindex == c->ifindex) { |
4245 | - dev_mc_del(dev, c->clustermac); |
4246 | - c->ifindex = -1; |
4247 | - } |
4248 | - break; |
4249 | - case NETDEV_CHANGENAME: |
4250 | - if (!strcmp(dev->name, c->ifname)) { |
4251 | - c->ifindex = dev->ifindex; |
4252 | - dev_mc_add(dev, c->clustermac); |
4253 | - } else if (dev->ifindex == c->ifindex) { |
4254 | - dev_mc_del(dev, c->clustermac); |
4255 | - c->ifindex = -1; |
4256 | + spin_lock_bh(&cn->lock); |
4257 | + list_for_each_entry_rcu(c, &cn->configs, list) { |
4258 | + switch (event) { |
4259 | + case NETDEV_REGISTER: |
4260 | + if (!strcmp(dev->name, c->ifname)) { |
4261 | + c->ifindex = dev->ifindex; |
4262 | + dev_mc_add(dev, c->clustermac); |
4263 | + } |
4264 | + break; |
4265 | + case NETDEV_UNREGISTER: |
4266 | + if (dev->ifindex == c->ifindex) { |
4267 | + dev_mc_del(dev, c->clustermac); |
4268 | + c->ifindex = -1; |
4269 | + } |
4270 | + break; |
4271 | + case NETDEV_CHANGENAME: |
4272 | + if (!strcmp(dev->name, c->ifname)) { |
4273 | + c->ifindex = dev->ifindex; |
4274 | + dev_mc_add(dev, c->clustermac); |
4275 | + } else if (dev->ifindex == c->ifindex) { |
4276 | + dev_mc_del(dev, c->clustermac); |
4277 | + c->ifindex = -1; |
4278 | + } |
4279 | + break; |
4280 | } |
4281 | - break; |
4282 | } |
4283 | + spin_unlock_bh(&cn->lock); |
4284 | |
4285 | return NOTIFY_DONE; |
4286 | } |
4287 | @@ -215,30 +229,44 @@ static struct clusterip_config * |
4288 | clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i, |
4289 | __be32 ip, const char *iniface) |
4290 | { |
4291 | - struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
4292 | + struct clusterip_net *cn = clusterip_pernet(net); |
4293 | struct clusterip_config *c; |
4294 | + struct net_device *dev; |
4295 | int err; |
4296 | |
4297 | + if (iniface[0] == '\0') { |
4298 | + pr_info("Please specify an interface name\n"); |
4299 | + return ERR_PTR(-EINVAL); |
4300 | + } |
4301 | + |
4302 | c = kzalloc(sizeof(*c), GFP_ATOMIC); |
4303 | if (!c) |
4304 | return ERR_PTR(-ENOMEM); |
4305 | |
4306 | - strcpy(c->ifname, iniface); |
4307 | - c->ifindex = -1; |
4308 | - c->clusterip = ip; |
4309 | + dev = dev_get_by_name(net, iniface); |
4310 | + if (!dev) { |
4311 | + pr_info("no such interface %s\n", iniface); |
4312 | + kfree(c); |
4313 | + return ERR_PTR(-ENOENT); |
4314 | + } |
4315 | + c->ifindex = dev->ifindex; |
4316 | + strcpy(c->ifname, dev->name); |
4317 | memcpy(&c->clustermac, &i->clustermac, ETH_ALEN); |
4318 | + dev_mc_add(dev, c->clustermac); |
4319 | + dev_put(dev); |
4320 | + |
4321 | + c->clusterip = ip; |
4322 | c->num_total_nodes = i->num_total_nodes; |
4323 | clusterip_config_init_nodelist(c, i); |
4324 | c->hash_mode = i->hash_mode; |
4325 | c->hash_initval = i->hash_initval; |
4326 | + c->net = net; |
4327 | refcount_set(&c->refcount, 1); |
4328 | |
4329 | spin_lock_bh(&cn->lock); |
4330 | if (__clusterip_config_find(net, ip)) { |
4331 | - spin_unlock_bh(&cn->lock); |
4332 | - kfree(c); |
4333 | - |
4334 | - return ERR_PTR(-EBUSY); |
4335 | + err = -EBUSY; |
4336 | + goto out_config_put; |
4337 | } |
4338 | |
4339 | list_add_rcu(&c->list, &cn->configs); |
4340 | @@ -260,22 +288,17 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i, |
4341 | } |
4342 | #endif |
4343 | |
4344 | - c->notifier.notifier_call = clusterip_netdev_event; |
4345 | - err = register_netdevice_notifier(&c->notifier); |
4346 | - if (!err) { |
4347 | - refcount_set(&c->entries, 1); |
4348 | - return c; |
4349 | - } |
4350 | + refcount_set(&c->entries, 1); |
4351 | + return c; |
4352 | |
4353 | #ifdef CONFIG_PROC_FS |
4354 | - proc_remove(c->pde); |
4355 | err: |
4356 | #endif |
4357 | spin_lock_bh(&cn->lock); |
4358 | list_del_rcu(&c->list); |
4359 | +out_config_put: |
4360 | spin_unlock_bh(&cn->lock); |
4361 | clusterip_config_put(c); |
4362 | - |
4363 | return ERR_PTR(err); |
4364 | } |
4365 | |
4366 | @@ -475,34 +498,20 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) |
4367 | &e->ip.dst.s_addr); |
4368 | return -EINVAL; |
4369 | } else { |
4370 | - struct net_device *dev; |
4371 | - |
4372 | - if (e->ip.iniface[0] == '\0') { |
4373 | - pr_info("Please specify an interface name\n"); |
4374 | - return -EINVAL; |
4375 | - } |
4376 | - |
4377 | - dev = dev_get_by_name(par->net, e->ip.iniface); |
4378 | - if (!dev) { |
4379 | - pr_info("no such interface %s\n", |
4380 | - e->ip.iniface); |
4381 | - return -ENOENT; |
4382 | - } |
4383 | - dev_put(dev); |
4384 | - |
4385 | config = clusterip_config_init(par->net, cipinfo, |
4386 | e->ip.dst.s_addr, |
4387 | e->ip.iniface); |
4388 | if (IS_ERR(config)) |
4389 | return PTR_ERR(config); |
4390 | } |
4391 | - } |
4392 | + } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) |
4393 | + return -EINVAL; |
4394 | |
4395 | ret = nf_ct_netns_get(par->net, par->family); |
4396 | if (ret < 0) { |
4397 | pr_info("cannot load conntrack support for proto=%u\n", |
4398 | par->family); |
4399 | - clusterip_config_entry_put(par->net, config); |
4400 | + clusterip_config_entry_put(config); |
4401 | clusterip_config_put(config); |
4402 | return ret; |
4403 | } |
4404 | @@ -524,7 +533,7 @@ static void clusterip_tg_destroy(const struct xt_tgdtor_param *par) |
4405 | |
4406 | /* if no more entries are referencing the config, remove it |
4407 | * from the list and destroy the proc entry */ |
4408 | - clusterip_config_entry_put(par->net, cipinfo->config); |
4409 | + clusterip_config_entry_put(cipinfo->config); |
4410 | |
4411 | clusterip_config_put(cipinfo->config); |
4412 | |
4413 | @@ -806,7 +815,7 @@ static const struct file_operations clusterip_proc_fops = { |
4414 | |
4415 | static int clusterip_net_init(struct net *net) |
4416 | { |
4417 | - struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
4418 | + struct clusterip_net *cn = clusterip_pernet(net); |
4419 | int ret; |
4420 | |
4421 | INIT_LIST_HEAD(&cn->configs); |
4422 | @@ -831,13 +840,12 @@ static int clusterip_net_init(struct net *net) |
4423 | |
4424 | static void clusterip_net_exit(struct net *net) |
4425 | { |
4426 | - struct clusterip_net *cn = net_generic(net, clusterip_net_id); |
4427 | + struct clusterip_net *cn = clusterip_pernet(net); |
4428 | #ifdef CONFIG_PROC_FS |
4429 | proc_remove(cn->procdir); |
4430 | cn->procdir = NULL; |
4431 | #endif |
4432 | nf_unregister_net_hook(net, &cip_arp_ops); |
4433 | - WARN_ON_ONCE(!list_empty(&cn->configs)); |
4434 | } |
4435 | |
4436 | static struct pernet_operations clusterip_net_ops = { |
4437 | @@ -847,6 +855,10 @@ static struct pernet_operations clusterip_net_ops = { |
4438 | .size = sizeof(struct clusterip_net), |
4439 | }; |
4440 | |
4441 | +struct notifier_block cip_netdev_notifier = { |
4442 | + .notifier_call = clusterip_netdev_event |
4443 | +}; |
4444 | + |
4445 | static int __init clusterip_tg_init(void) |
4446 | { |
4447 | int ret; |
4448 | @@ -859,11 +871,17 @@ static int __init clusterip_tg_init(void) |
4449 | if (ret < 0) |
4450 | goto cleanup_subsys; |
4451 | |
4452 | + ret = register_netdevice_notifier(&cip_netdev_notifier); |
4453 | + if (ret < 0) |
4454 | + goto unregister_target; |
4455 | + |
4456 | pr_info("ClusterIP Version %s loaded successfully\n", |
4457 | CLUSTERIP_VERSION); |
4458 | |
4459 | return 0; |
4460 | |
4461 | +unregister_target: |
4462 | + xt_unregister_target(&clusterip_tg_reg); |
4463 | cleanup_subsys: |
4464 | unregister_pernet_subsys(&clusterip_net_ops); |
4465 | return ret; |
4466 | @@ -873,6 +891,7 @@ static void __exit clusterip_tg_exit(void) |
4467 | { |
4468 | pr_info("ClusterIP Version %s unloading\n", CLUSTERIP_VERSION); |
4469 | |
4470 | + unregister_netdevice_notifier(&cip_netdev_notifier); |
4471 | xt_unregister_target(&clusterip_tg_reg); |
4472 | unregister_pernet_subsys(&clusterip_net_ops); |
4473 | |
4474 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
4475 | index 045597b9a7c0..e3cb53b0ef67 100644 |
4476 | --- a/net/ipv6/addrconf.c |
4477 | +++ b/net/ipv6/addrconf.c |
4478 | @@ -5154,7 +5154,7 @@ put_tgt_net: |
4479 | if (fillargs.netnsid >= 0) |
4480 | put_net(tgt_net); |
4481 | |
4482 | - return err < 0 ? err : skb->len; |
4483 | + return skb->len ? : err; |
4484 | } |
4485 | |
4486 | static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) |
4487 | diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c |
4488 | index f0cd291034f0..4dc935838184 100644 |
4489 | --- a/net/ipv6/af_inet6.c |
4490 | +++ b/net/ipv6/af_inet6.c |
4491 | @@ -310,6 +310,7 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, |
4492 | |
4493 | /* Check if the address belongs to the host. */ |
4494 | if (addr_type == IPV6_ADDR_MAPPED) { |
4495 | + struct net_device *dev = NULL; |
4496 | int chk_addr_ret; |
4497 | |
4498 | /* Binding to v4-mapped address on a v6-only socket |
4499 | @@ -320,9 +321,20 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, |
4500 | goto out; |
4501 | } |
4502 | |
4503 | + rcu_read_lock(); |
4504 | + if (sk->sk_bound_dev_if) { |
4505 | + dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); |
4506 | + if (!dev) { |
4507 | + err = -ENODEV; |
4508 | + goto out_unlock; |
4509 | + } |
4510 | + } |
4511 | + |
4512 | /* Reproduce AF_INET checks to make the bindings consistent */ |
4513 | v4addr = addr->sin6_addr.s6_addr32[3]; |
4514 | - chk_addr_ret = inet_addr_type(net, v4addr); |
4515 | + chk_addr_ret = inet_addr_type_dev_table(net, dev, v4addr); |
4516 | + rcu_read_unlock(); |
4517 | + |
4518 | if (!inet_can_nonlocal_bind(net, inet) && |
4519 | v4addr != htonl(INADDR_ANY) && |
4520 | chk_addr_ret != RTN_LOCAL && |
4521 | diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
4522 | index ae3786132c23..6613d8dbb0e5 100644 |
4523 | --- a/net/ipv6/ip6_fib.c |
4524 | +++ b/net/ipv6/ip6_fib.c |
4525 | @@ -627,7 +627,11 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) |
4526 | return -ENOENT; |
4527 | } |
4528 | |
4529 | - res = fib6_dump_table(tb, skb, cb); |
4530 | + if (!cb->args[0]) { |
4531 | + res = fib6_dump_table(tb, skb, cb); |
4532 | + if (!res) |
4533 | + cb->args[0] = 1; |
4534 | + } |
4535 | goto out; |
4536 | } |
4537 | |
4538 | diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c |
4539 | index c00b6a2e8e3c..13ade5782847 100644 |
4540 | --- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c |
4541 | +++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c |
4542 | @@ -219,10 +219,6 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, |
4543 | struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); |
4544 | u32 ip; |
4545 | |
4546 | - /* MAC can be src only */ |
4547 | - if (!(opt->flags & IPSET_DIM_TWO_SRC)) |
4548 | - return 0; |
4549 | - |
4550 | ip = ntohl(ip4addr(skb, opt->flags & IPSET_DIM_ONE_SRC)); |
4551 | if (ip < map->first_ip || ip > map->last_ip) |
4552 | return -IPSET_ERR_BITMAP_RANGE; |
4553 | @@ -233,7 +229,11 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, |
4554 | return -EINVAL; |
4555 | |
4556 | e.id = ip_to_id(map, ip); |
4557 | - memcpy(e.ether, eth_hdr(skb)->h_source, ETH_ALEN); |
4558 | + |
4559 | + if (opt->flags & IPSET_DIM_ONE_SRC) |
4560 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_source); |
4561 | + else |
4562 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_dest); |
4563 | |
4564 | return adtfn(set, &e, &ext, &opt->ext, opt->cmdflags); |
4565 | } |
4566 | diff --git a/net/netfilter/ipset/ip_set_hash_ipmac.c b/net/netfilter/ipset/ip_set_hash_ipmac.c |
4567 | index 1ab5ed2f6839..fd87de3ed55b 100644 |
4568 | --- a/net/netfilter/ipset/ip_set_hash_ipmac.c |
4569 | +++ b/net/netfilter/ipset/ip_set_hash_ipmac.c |
4570 | @@ -103,7 +103,11 @@ hash_ipmac4_kadt(struct ip_set *set, const struct sk_buff *skb, |
4571 | (skb_mac_header(skb) + ETH_HLEN) > skb->data) |
4572 | return -EINVAL; |
4573 | |
4574 | - memcpy(e.ether, eth_hdr(skb)->h_source, ETH_ALEN); |
4575 | + if (opt->flags & IPSET_DIM_ONE_SRC) |
4576 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_source); |
4577 | + else |
4578 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_dest); |
4579 | + |
4580 | if (ether_addr_equal(e.ether, invalid_ether)) |
4581 | return -EINVAL; |
4582 | |
4583 | @@ -211,15 +215,15 @@ hash_ipmac6_kadt(struct ip_set *set, const struct sk_buff *skb, |
4584 | }; |
4585 | struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); |
4586 | |
4587 | - /* MAC can be src only */ |
4588 | - if (!(opt->flags & IPSET_DIM_TWO_SRC)) |
4589 | - return 0; |
4590 | - |
4591 | if (skb_mac_header(skb) < skb->head || |
4592 | (skb_mac_header(skb) + ETH_HLEN) > skb->data) |
4593 | return -EINVAL; |
4594 | |
4595 | - memcpy(e.ether, eth_hdr(skb)->h_source, ETH_ALEN); |
4596 | + if (opt->flags & IPSET_DIM_ONE_SRC) |
4597 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_source); |
4598 | + else |
4599 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_dest); |
4600 | + |
4601 | if (ether_addr_equal(e.ether, invalid_ether)) |
4602 | return -EINVAL; |
4603 | |
4604 | diff --git a/net/netfilter/ipset/ip_set_hash_mac.c b/net/netfilter/ipset/ip_set_hash_mac.c |
4605 | index f9d5a2a1e3d0..4fe5f243d0a3 100644 |
4606 | --- a/net/netfilter/ipset/ip_set_hash_mac.c |
4607 | +++ b/net/netfilter/ipset/ip_set_hash_mac.c |
4608 | @@ -81,15 +81,15 @@ hash_mac4_kadt(struct ip_set *set, const struct sk_buff *skb, |
4609 | struct hash_mac4_elem e = { { .foo[0] = 0, .foo[1] = 0 } }; |
4610 | struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); |
4611 | |
4612 | - /* MAC can be src only */ |
4613 | - if (!(opt->flags & IPSET_DIM_ONE_SRC)) |
4614 | - return 0; |
4615 | - |
4616 | if (skb_mac_header(skb) < skb->head || |
4617 | (skb_mac_header(skb) + ETH_HLEN) > skb->data) |
4618 | return -EINVAL; |
4619 | |
4620 | - ether_addr_copy(e.ether, eth_hdr(skb)->h_source); |
4621 | + if (opt->flags & IPSET_DIM_ONE_SRC) |
4622 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_source); |
4623 | + else |
4624 | + ether_addr_copy(e.ether, eth_hdr(skb)->h_dest); |
4625 | + |
4626 | if (is_zero_ether_addr(e.ether)) |
4627 | return -EINVAL; |
4628 | return adtfn(set, &e, &ext, &opt->ext, opt->cmdflags); |
4629 | diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c |
4630 | index 35966da84769..f920a347ee1c 100644 |
4631 | --- a/net/openvswitch/flow.c |
4632 | +++ b/net/openvswitch/flow.c |
4633 | @@ -276,10 +276,12 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key) |
4634 | |
4635 | nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags); |
4636 | if (flags & IP6_FH_F_FRAG) { |
4637 | - if (frag_off) |
4638 | + if (frag_off) { |
4639 | key->ip.frag = OVS_FRAG_TYPE_LATER; |
4640 | - else |
4641 | - key->ip.frag = OVS_FRAG_TYPE_FIRST; |
4642 | + key->ip.proto = nexthdr; |
4643 | + return 0; |
4644 | + } |
4645 | + key->ip.frag = OVS_FRAG_TYPE_FIRST; |
4646 | } else { |
4647 | key->ip.frag = OVS_FRAG_TYPE_NONE; |
4648 | } |
4649 | diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c |
4650 | index e6d7e0fe155b..96783207de4a 100644 |
4651 | --- a/samples/bpf/bpf_load.c |
4652 | +++ b/samples/bpf/bpf_load.c |
4653 | @@ -54,6 +54,23 @@ static int populate_prog_array(const char *event, int prog_fd) |
4654 | return 0; |
4655 | } |
4656 | |
4657 | +static int write_kprobe_events(const char *val) |
4658 | +{ |
4659 | + int fd, ret, flags; |
4660 | + |
4661 | + if ((val != NULL) && (val[0] == '\0')) |
4662 | + flags = O_WRONLY | O_TRUNC; |
4663 | + else |
4664 | + flags = O_WRONLY | O_APPEND; |
4665 | + |
4666 | + fd = open("/sys/kernel/debug/tracing/kprobe_events", flags); |
4667 | + |
4668 | + ret = write(fd, val, strlen(val)); |
4669 | + close(fd); |
4670 | + |
4671 | + return ret; |
4672 | +} |
4673 | + |
4674 | static int load_and_attach(const char *event, struct bpf_insn *prog, int size) |
4675 | { |
4676 | bool is_socket = strncmp(event, "socket", 6) == 0; |
4677 | @@ -165,10 +182,9 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size) |
4678 | |
4679 | #ifdef __x86_64__ |
4680 | if (strncmp(event, "sys_", 4) == 0) { |
4681 | - snprintf(buf, sizeof(buf), |
4682 | - "echo '%c:__x64_%s __x64_%s' >> /sys/kernel/debug/tracing/kprobe_events", |
4683 | - is_kprobe ? 'p' : 'r', event, event); |
4684 | - err = system(buf); |
4685 | + snprintf(buf, sizeof(buf), "%c:__x64_%s __x64_%s", |
4686 | + is_kprobe ? 'p' : 'r', event, event); |
4687 | + err = write_kprobe_events(buf); |
4688 | if (err >= 0) { |
4689 | need_normal_check = false; |
4690 | event_prefix = "__x64_"; |
4691 | @@ -176,10 +192,9 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size) |
4692 | } |
4693 | #endif |
4694 | if (need_normal_check) { |
4695 | - snprintf(buf, sizeof(buf), |
4696 | - "echo '%c:%s %s' >> /sys/kernel/debug/tracing/kprobe_events", |
4697 | - is_kprobe ? 'p' : 'r', event, event); |
4698 | - err = system(buf); |
4699 | + snprintf(buf, sizeof(buf), "%c:%s %s", |
4700 | + is_kprobe ? 'p' : 'r', event, event); |
4701 | + err = write_kprobe_events(buf); |
4702 | if (err < 0) { |
4703 | printf("failed to create kprobe '%s' error '%s'\n", |
4704 | event, strerror(errno)); |
4705 | @@ -519,7 +534,7 @@ static int do_load_bpf_file(const char *path, fixup_map_cb fixup_map) |
4706 | return 1; |
4707 | |
4708 | /* clear all kprobes */ |
4709 | - i = system("echo \"\" > /sys/kernel/debug/tracing/kprobe_events"); |
4710 | + i = write_kprobe_events(""); |
4711 | |
4712 | /* scan over all elf sections to get license and map info */ |
4713 | for (i = 1; i < ehdr.e_shnum; i++) { |
4714 | diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include |
4715 | index 3d09844405c9..b8c866193ae6 100644 |
4716 | --- a/scripts/Kbuild.include |
4717 | +++ b/scripts/Kbuild.include |
4718 | @@ -262,9 +262,8 @@ ifndef CONFIG_TRIM_UNUSED_KSYMS |
4719 | |
4720 | cmd_and_fixdep = \ |
4721 | $(echo-cmd) $(cmd_$(1)); \ |
4722 | - scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ |
4723 | - rm -f $(depfile); \ |
4724 | - mv -f $(dot-target).tmp $(dot-target).cmd; |
4725 | + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ |
4726 | + rm -f $(depfile); |
4727 | |
4728 | else |
4729 | |
4730 | @@ -287,9 +286,8 @@ cmd_and_fixdep = \ |
4731 | $(echo-cmd) $(cmd_$(1)); \ |
4732 | $(ksym_dep_filter) | \ |
4733 | scripts/basic/fixdep -e $(depfile) $@ '$(make-cmd)' \ |
4734 | - > $(dot-target).tmp; \ |
4735 | - rm -f $(depfile); \ |
4736 | - mv -f $(dot-target).tmp $(dot-target).cmd; |
4737 | + > $(dot-target).cmd; \ |
4738 | + rm -f $(depfile); |
4739 | |
4740 | endif |
4741 | |
4742 | diff --git a/scripts/Makefile.build b/scripts/Makefile.build |
4743 | index 6a6be9f440cf..1d56f181b917 100644 |
4744 | --- a/scripts/Makefile.build |
4745 | +++ b/scripts/Makefile.build |
4746 | @@ -527,18 +527,16 @@ FORCE: |
4747 | # optimization, we don't need to read them if the target does not |
4748 | # exist, we will rebuild anyway in that case. |
4749 | |
4750 | -cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) |
4751 | +existing-targets := $(wildcard $(sort $(targets))) |
4752 | |
4753 | -ifneq ($(cmd_files),) |
4754 | - include $(cmd_files) |
4755 | -endif |
4756 | +-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
4757 | |
4758 | ifneq ($(KBUILD_SRC),) |
4759 | # Create directories for object files if they do not exist |
4760 | obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) |
4761 | -# If cmd_files exist, their directories apparently exist. Skip mkdir. |
4762 | -exist-dirs := $(sort $(patsubst %/,%, $(dir $(cmd_files)))) |
4763 | -obj-dirs := $(strip $(filter-out $(exist-dirs), $(obj-dirs))) |
4764 | +# If targets exist, their directories apparently exist. Skip mkdir. |
4765 | +existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets)))) |
4766 | +obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs))) |
4767 | ifneq ($(obj-dirs),) |
4768 | $(shell mkdir -p $(obj-dirs)) |
4769 | endif |
4770 | diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l |
4771 | index 25bd2b89fe3f..c2f577d71964 100644 |
4772 | --- a/scripts/kconfig/zconf.l |
4773 | +++ b/scripts/kconfig/zconf.l |
4774 | @@ -73,7 +73,7 @@ static void warn_ignored_character(char chr) |
4775 | { |
4776 | fprintf(stderr, |
4777 | "%s:%d:warning: ignoring unsupported character '%c'\n", |
4778 | - zconf_curname(), zconf_lineno(), chr); |
4779 | + current_file->name, yylineno, chr); |
4780 | } |
4781 | %} |
4782 | |
4783 | @@ -221,6 +221,8 @@ n [A-Za-z0-9_-] |
4784 | } |
4785 | <<EOF>> { |
4786 | BEGIN(INITIAL); |
4787 | + yylval.string = text; |
4788 | + return T_WORD_QUOTE; |
4789 | } |
4790 | } |
4791 | |
4792 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
4793 | index a67459eb62d5..0f27db6d94a9 100644 |
4794 | --- a/security/selinux/hooks.c |
4795 | +++ b/security/selinux/hooks.c |
4796 | @@ -2934,7 +2934,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) |
4797 | return rc; |
4798 | |
4799 | /* Allow all mounts performed by the kernel */ |
4800 | - if (flags & MS_KERNMOUNT) |
4801 | + if (flags & (MS_KERNMOUNT | MS_SUBMOUNT)) |
4802 | return 0; |
4803 | |
4804 | ad.type = LSM_AUDIT_DATA_DENTRY; |
4805 | diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig |
4806 | index 8a146b039276..44cedb65bb88 100644 |
4807 | --- a/sound/firewire/Kconfig |
4808 | +++ b/sound/firewire/Kconfig |
4809 | @@ -41,6 +41,7 @@ config SND_OXFW |
4810 | * Mackie(Loud) U.420/U.420d |
4811 | * TASCAM FireOne |
4812 | * Stanton Controllers & Systems 1 Deck/Mixer |
4813 | + * APOGEE duet FireWire |
4814 | |
4815 | To compile this driver as a module, choose M here: the module |
4816 | will be called snd-oxfw. |
4817 | diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c |
4818 | index 672d13488454..d91874275d2c 100644 |
4819 | --- a/sound/firewire/bebob/bebob.c |
4820 | +++ b/sound/firewire/bebob/bebob.c |
4821 | @@ -408,7 +408,7 @@ static const struct ieee1394_device_id bebob_id_table[] = { |
4822 | /* Apogee Electronics, DA/AD/DD-16X (X-FireWire card) */ |
4823 | SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x00010048, &spec_normal), |
4824 | /* Apogee Electronics, Ensemble */ |
4825 | - SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x00001eee, &spec_normal), |
4826 | + SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x01eeee, &spec_normal), |
4827 | /* ESI, Quatafire610 */ |
4828 | SND_BEBOB_DEV_ENTRY(VEN_ESI, 0x00010064, &spec_normal), |
4829 | /* AcousticReality, eARMasterOne */ |
4830 | diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c |
4831 | index afb78d90384b..3d27f3378d5d 100644 |
4832 | --- a/sound/firewire/oxfw/oxfw.c |
4833 | +++ b/sound/firewire/oxfw/oxfw.c |
4834 | @@ -20,6 +20,7 @@ |
4835 | #define VENDOR_LACIE 0x00d04b |
4836 | #define VENDOR_TASCAM 0x00022e |
4837 | #define OUI_STANTON 0x001260 |
4838 | +#define OUI_APOGEE 0x0003db |
4839 | |
4840 | #define MODEL_SATELLITE 0x00200f |
4841 | |
4842 | @@ -397,6 +398,13 @@ static const struct ieee1394_device_id oxfw_id_table[] = { |
4843 | .vendor_id = OUI_STANTON, |
4844 | .model_id = 0x002000, |
4845 | }, |
4846 | + // APOGEE, duet FireWire |
4847 | + { |
4848 | + .match_flags = IEEE1394_MATCH_VENDOR_ID | |
4849 | + IEEE1394_MATCH_MODEL_ID, |
4850 | + .vendor_id = OUI_APOGEE, |
4851 | + .model_id = 0x01dddd, |
4852 | + }, |
4853 | { } |
4854 | }; |
4855 | MODULE_DEVICE_TABLE(ieee1394, oxfw_id_table); |
4856 | diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c |
4857 | index cdebab2f8ce5..7ada2c1f4964 100644 |
4858 | --- a/sound/soc/amd/acp-pcm-dma.c |
4859 | +++ b/sound/soc/amd/acp-pcm-dma.c |
4860 | @@ -1151,18 +1151,21 @@ static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) |
4861 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, |
4862 | DRV_NAME); |
4863 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); |
4864 | + struct device *parent = component->dev->parent; |
4865 | |
4866 | switch (adata->asic_type) { |
4867 | case CHIP_STONEY: |
4868 | ret = snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
4869 | SNDRV_DMA_TYPE_DEV, |
4870 | - NULL, ST_MIN_BUFFER, |
4871 | + parent, |
4872 | + ST_MIN_BUFFER, |
4873 | ST_MAX_BUFFER); |
4874 | break; |
4875 | default: |
4876 | ret = snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
4877 | SNDRV_DMA_TYPE_DEV, |
4878 | - NULL, MIN_BUFFER, |
4879 | + parent, |
4880 | + MIN_BUFFER, |
4881 | MAX_BUFFER); |
4882 | break; |
4883 | } |
4884 | diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c |
4885 | index 52cc950c9fd1..445d025e1409 100644 |
4886 | --- a/sound/soc/codecs/pcm3168a.c |
4887 | +++ b/sound/soc/codecs/pcm3168a.c |
4888 | @@ -770,15 +770,22 @@ err_clk: |
4889 | } |
4890 | EXPORT_SYMBOL_GPL(pcm3168a_probe); |
4891 | |
4892 | -void pcm3168a_remove(struct device *dev) |
4893 | +static void pcm3168a_disable(struct device *dev) |
4894 | { |
4895 | struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev); |
4896 | |
4897 | - pm_runtime_disable(dev); |
4898 | regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), |
4899 | - pcm3168a->supplies); |
4900 | + pcm3168a->supplies); |
4901 | clk_disable_unprepare(pcm3168a->scki); |
4902 | } |
4903 | + |
4904 | +void pcm3168a_remove(struct device *dev) |
4905 | +{ |
4906 | + pm_runtime_disable(dev); |
4907 | +#ifndef CONFIG_PM |
4908 | + pcm3168a_disable(dev); |
4909 | +#endif |
4910 | +} |
4911 | EXPORT_SYMBOL_GPL(pcm3168a_remove); |
4912 | |
4913 | #ifdef CONFIG_PM |
4914 | @@ -833,10 +840,7 @@ static int pcm3168a_rt_suspend(struct device *dev) |
4915 | |
4916 | regcache_cache_only(pcm3168a->regmap, true); |
4917 | |
4918 | - regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), |
4919 | - pcm3168a->supplies); |
4920 | - |
4921 | - clk_disable_unprepare(pcm3168a->scki); |
4922 | + pcm3168a_disable(dev); |
4923 | |
4924 | return 0; |
4925 | } |
4926 | diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c |
4927 | index ccdf088461b7..54c306707c02 100644 |
4928 | --- a/sound/soc/codecs/wm9705.c |
4929 | +++ b/sound/soc/codecs/wm9705.c |
4930 | @@ -325,8 +325,7 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
4931 | if (wm9705->mfd_pdata) { |
4932 | wm9705->ac97 = wm9705->mfd_pdata->ac97; |
4933 | regmap = wm9705->mfd_pdata->regmap; |
4934 | - } else { |
4935 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
4936 | + } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
4937 | wm9705->ac97 = snd_soc_new_ac97_component(component, WM9705_VENDOR_ID, |
4938 | WM9705_VENDOR_ID_MASK); |
4939 | if (IS_ERR(wm9705->ac97)) { |
4940 | @@ -339,7 +338,8 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
4941 | snd_soc_free_ac97_component(wm9705->ac97); |
4942 | return PTR_ERR(regmap); |
4943 | } |
4944 | -#endif |
4945 | + } else { |
4946 | + return -ENXIO; |
4947 | } |
4948 | |
4949 | snd_soc_component_set_drvdata(component, wm9705->ac97); |
4950 | @@ -350,14 +350,12 @@ static int wm9705_soc_probe(struct snd_soc_component *component) |
4951 | |
4952 | static void wm9705_soc_remove(struct snd_soc_component *component) |
4953 | { |
4954 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
4955 | struct wm9705_priv *wm9705 = snd_soc_component_get_drvdata(component); |
4956 | |
4957 | - if (!wm9705->mfd_pdata) { |
4958 | + if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9705->mfd_pdata) { |
4959 | snd_soc_component_exit_regmap(component); |
4960 | snd_soc_free_ac97_component(wm9705->ac97); |
4961 | } |
4962 | -#endif |
4963 | } |
4964 | |
4965 | static const struct snd_soc_component_driver soc_component_dev_wm9705 = { |
4966 | diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c |
4967 | index e873baa9e778..01949eaba4fd 100644 |
4968 | --- a/sound/soc/codecs/wm9712.c |
4969 | +++ b/sound/soc/codecs/wm9712.c |
4970 | @@ -642,8 +642,7 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
4971 | if (wm9712->mfd_pdata) { |
4972 | wm9712->ac97 = wm9712->mfd_pdata->ac97; |
4973 | regmap = wm9712->mfd_pdata->regmap; |
4974 | - } else { |
4975 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
4976 | + } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
4977 | int ret; |
4978 | |
4979 | wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID, |
4980 | @@ -660,7 +659,8 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
4981 | snd_soc_free_ac97_component(wm9712->ac97); |
4982 | return PTR_ERR(regmap); |
4983 | } |
4984 | -#endif |
4985 | + } else { |
4986 | + return -ENXIO; |
4987 | } |
4988 | |
4989 | snd_soc_component_init_regmap(component, regmap); |
4990 | @@ -673,14 +673,12 @@ static int wm9712_soc_probe(struct snd_soc_component *component) |
4991 | |
4992 | static void wm9712_soc_remove(struct snd_soc_component *component) |
4993 | { |
4994 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
4995 | struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); |
4996 | |
4997 | - if (!wm9712->mfd_pdata) { |
4998 | + if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9712->mfd_pdata) { |
4999 | snd_soc_component_exit_regmap(component); |
5000 | snd_soc_free_ac97_component(wm9712->ac97); |
5001 | } |
5002 | -#endif |
5003 | } |
5004 | |
5005 | static const struct snd_soc_component_driver soc_component_dev_wm9712 = { |
5006 | diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c |
5007 | index 643863bb32e0..5a2fdf4f69bf 100644 |
5008 | --- a/sound/soc/codecs/wm9713.c |
5009 | +++ b/sound/soc/codecs/wm9713.c |
5010 | @@ -1214,8 +1214,7 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
5011 | if (wm9713->mfd_pdata) { |
5012 | wm9713->ac97 = wm9713->mfd_pdata->ac97; |
5013 | regmap = wm9713->mfd_pdata->regmap; |
5014 | - } else { |
5015 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
5016 | + } else if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) { |
5017 | wm9713->ac97 = snd_soc_new_ac97_component(component, WM9713_VENDOR_ID, |
5018 | WM9713_VENDOR_ID_MASK); |
5019 | if (IS_ERR(wm9713->ac97)) |
5020 | @@ -1225,7 +1224,8 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
5021 | snd_soc_free_ac97_component(wm9713->ac97); |
5022 | return PTR_ERR(regmap); |
5023 | } |
5024 | -#endif |
5025 | + } else { |
5026 | + return -ENXIO; |
5027 | } |
5028 | |
5029 | snd_soc_component_init_regmap(component, regmap); |
5030 | @@ -1238,14 +1238,12 @@ static int wm9713_soc_probe(struct snd_soc_component *component) |
5031 | |
5032 | static void wm9713_soc_remove(struct snd_soc_component *component) |
5033 | { |
5034 | -#ifdef CONFIG_SND_SOC_AC97_BUS |
5035 | struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); |
5036 | |
5037 | - if (!wm9713->mfd_pdata) { |
5038 | + if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9713->mfd_pdata) { |
5039 | snd_soc_component_exit_regmap(component); |
5040 | snd_soc_free_ac97_component(wm9713->ac97); |
5041 | } |
5042 | -#endif |
5043 | } |
5044 | |
5045 | static const struct snd_soc_component_driver soc_component_dev_wm9713 = { |
5046 | diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile |
5047 | index 95563b8e1ad7..ed61fb3a46c0 100644 |
5048 | --- a/tools/lib/subcmd/Makefile |
5049 | +++ b/tools/lib/subcmd/Makefile |
5050 | @@ -36,8 +36,6 @@ endif |
5051 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
5052 | |
5053 | CFLAGS += -I$(srctree)/tools/include/ |
5054 | -CFLAGS += -I$(srctree)/include/uapi |
5055 | -CFLAGS += -I$(srctree)/include |
5056 | |
5057 | SUBCMD_IN := $(OUTPUT)libsubcmd-in.o |
5058 | |
5059 | diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c |
5060 | index 70144b98141c..8ea1a02812b0 100644 |
5061 | --- a/tools/lib/traceevent/event-parse.c |
5062 | +++ b/tools/lib/traceevent/event-parse.c |
5063 | @@ -3498,7 +3498,7 @@ struct tep_event_format * |
5064 | tep_find_event_by_name(struct tep_handle *pevent, |
5065 | const char *sys, const char *name) |
5066 | { |
5067 | - struct tep_event_format *event; |
5068 | + struct tep_event_format *event = NULL; |
5069 | int i; |
5070 | |
5071 | if (pevent->last_event && |
5072 | @@ -4221,7 +4221,7 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s |
5073 | unsigned long long ip, val; |
5074 | char *ptr; |
5075 | void *bptr; |
5076 | - int vsize; |
5077 | + int vsize = 0; |
5078 | |
5079 | field = pevent->bprint_buf_field; |
5080 | ip_field = pevent->bprint_ip_field; |
5081 | @@ -4881,7 +4881,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e |
5082 | char format[32]; |
5083 | int show_func; |
5084 | int len_as_arg; |
5085 | - int len_arg; |
5086 | + int len_arg = 0; |
5087 | int len; |
5088 | int ls; |
5089 | |
5090 | @@ -5147,8 +5147,8 @@ void tep_data_lat_fmt(struct tep_handle *pevent, |
5091 | static int migrate_disable_exists; |
5092 | unsigned int lat_flags; |
5093 | unsigned int pc; |
5094 | - int lock_depth; |
5095 | - int migrate_disable; |
5096 | + int lock_depth = 0; |
5097 | + int migrate_disable = 0; |
5098 | int hardirq; |
5099 | int softirq; |
5100 | void *data = record->data; |
5101 | diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config |
5102 | index a0e8c23f9125..acbb657f7ce2 100644 |
5103 | --- a/tools/perf/Makefile.config |
5104 | +++ b/tools/perf/Makefile.config |
5105 | @@ -294,6 +294,8 @@ ifndef NO_BIONIC |
5106 | $(call feature_check,bionic) |
5107 | ifeq ($(feature-bionic), 1) |
5108 | BIONIC := 1 |
5109 | + CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE |
5110 | + CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE |
5111 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) |
5112 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) |
5113 | endif |
5114 | diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c |
5115 | index db0ba8caf5a2..ba8ecaf52200 100644 |
5116 | --- a/tools/perf/arch/x86/util/intel-pt.c |
5117 | +++ b/tools/perf/arch/x86/util/intel-pt.c |
5118 | @@ -524,10 +524,21 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu, |
5119 | struct perf_evsel *evsel) |
5120 | { |
5121 | int err; |
5122 | + char c; |
5123 | |
5124 | if (!evsel) |
5125 | return 0; |
5126 | |
5127 | + /* |
5128 | + * If supported, force pass-through config term (pt=1) even if user |
5129 | + * sets pt=0, which avoids senseless kernel errors. |
5130 | + */ |
5131 | + if (perf_pmu__scan_file(intel_pt_pmu, "format/pt", "%c", &c) == 1 && |
5132 | + !(evsel->attr.config & 1)) { |
5133 | + pr_warning("pt=0 doesn't make sense, forcing pt=1\n"); |
5134 | + evsel->attr.config |= 1; |
5135 | + } |
5136 | + |
5137 | err = intel_pt_val_config_term(intel_pt_pmu, "caps/cycle_thresholds", |
5138 | "cyc_thresh", "caps/psb_cyc", |
5139 | evsel->attr.config); |
5140 | diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c |
5141 | index a635abfa77b6..1410d66192f7 100644 |
5142 | --- a/tools/perf/builtin-stat.c |
5143 | +++ b/tools/perf/builtin-stat.c |
5144 | @@ -709,7 +709,7 @@ static int parse_metric_groups(const struct option *opt, |
5145 | return metricgroup__parse_groups(opt, str, &stat_config.metric_events); |
5146 | } |
5147 | |
5148 | -static const struct option stat_options[] = { |
5149 | +static struct option stat_options[] = { |
5150 | OPT_BOOLEAN('T', "transaction", &transaction_run, |
5151 | "hardware transaction statistics"), |
5152 | OPT_CALLBACK('e', "event", &evsel_list, "event", |
5153 | @@ -1599,6 +1599,12 @@ int cmd_stat(int argc, const char **argv) |
5154 | return -ENOMEM; |
5155 | |
5156 | parse_events__shrink_config_terms(); |
5157 | + |
5158 | + /* String-parsing callback-based options would segfault when negated */ |
5159 | + set_option_flag(stat_options, 'e', "event", PARSE_OPT_NONEG); |
5160 | + set_option_flag(stat_options, 'M', "metrics", PARSE_OPT_NONEG); |
5161 | + set_option_flag(stat_options, 'G', "cgroup", PARSE_OPT_NONEG); |
5162 | + |
5163 | argc = parse_options_subcommand(argc, argv, stat_options, stat_subcommands, |
5164 | (const char **) stat_usage, |
5165 | PARSE_OPT_STOP_AT_NON_OPTION); |
5166 | diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c |
5167 | index a827919c6263..775b99833e51 100644 |
5168 | --- a/tools/perf/builtin-timechart.c |
5169 | +++ b/tools/perf/builtin-timechart.c |
5170 | @@ -43,6 +43,10 @@ |
5171 | #include "util/data.h" |
5172 | #include "util/debug.h" |
5173 | |
5174 | +#ifdef LACKS_OPEN_MEMSTREAM_PROTOTYPE |
5175 | +FILE *open_memstream(char **ptr, size_t *sizeloc); |
5176 | +#endif |
5177 | + |
5178 | #define SUPPORT_OLD_POWER_EVENTS 1 |
5179 | #define PWR_EVENT_EXIT -1 |
5180 | |
5181 | diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json |
5182 | index 36c903faed0b..71e9737f4614 100644 |
5183 | --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json |
5184 | +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json |
5185 | @@ -73,7 +73,7 @@ |
5186 | }, |
5187 | { |
5188 | "BriefDescription": "Actual Average Latency for L1 data-cache miss demand loads", |
5189 | - "MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS_PS + MEM_LOAD_RETIRED.FB_HIT_PS )", |
5190 | + "MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS + MEM_LOAD_RETIRED.FB_HIT )", |
5191 | "MetricGroup": "Memory_Bound;Memory_Lat", |
5192 | "MetricName": "Load_Miss_Real_Latency" |
5193 | }, |
5194 | diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json |
5195 | index 36c903faed0b..71e9737f4614 100644 |
5196 | --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json |
5197 | +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json |
5198 | @@ -73,7 +73,7 @@ |
5199 | }, |
5200 | { |
5201 | "BriefDescription": "Actual Average Latency for L1 data-cache miss demand loads", |
5202 | - "MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS_PS + MEM_LOAD_RETIRED.FB_HIT_PS )", |
5203 | + "MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS + MEM_LOAD_RETIRED.FB_HIT )", |
5204 | "MetricGroup": "Memory_Bound;Memory_Lat", |
5205 | "MetricName": "Load_Miss_Real_Latency" |
5206 | }, |
5207 | diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c |
5208 | index a467615c5a0e..910e25e64188 100644 |
5209 | --- a/tools/perf/tests/bp_signal.c |
5210 | +++ b/tools/perf/tests/bp_signal.c |
5211 | @@ -291,12 +291,20 @@ int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused |
5212 | |
5213 | bool test__bp_signal_is_supported(void) |
5214 | { |
5215 | -/* |
5216 | - * The powerpc so far does not have support to even create |
5217 | - * instruction breakpoint using the perf event interface. |
5218 | - * Once it's there we can release this. |
5219 | - */ |
5220 | -#if defined(__powerpc__) || defined(__s390x__) |
5221 | + /* |
5222 | + * PowerPC and S390 do not support creation of instruction |
5223 | + * breakpoints using the perf_event interface. |
5224 | + * |
5225 | + * ARM requires explicit rounding down of the instruction |
5226 | + * pointer in Thumb mode, and then requires the single-step |
5227 | + * to be handled explicitly in the overflow handler to avoid |
5228 | + * stepping into the SIGIO handler and getting stuck on the |
5229 | + * breakpointed instruction. |
5230 | + * |
5231 | + * Just disable the test for these architectures until these |
5232 | + * issues are resolved. |
5233 | + */ |
5234 | +#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) |
5235 | return false; |
5236 | #else |
5237 | return true; |
5238 | diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c |
5239 | index 73430b73570d..c2f0c92623f0 100644 |
5240 | --- a/tools/perf/util/cs-etm.c |
5241 | +++ b/tools/perf/util/cs-etm.c |
5242 | @@ -1005,7 +1005,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) |
5243 | } |
5244 | |
5245 | swap_packet: |
5246 | - if (etmq->etm->synth_opts.last_branch) { |
5247 | + if (etm->sample_branches || etm->synth_opts.last_branch) { |
5248 | /* |
5249 | * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for |
5250 | * the next incoming packet. |
5251 | diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c |
5252 | index 668d2a9ef0f4..8a806b0758b0 100644 |
5253 | --- a/tools/perf/util/evlist.c |
5254 | +++ b/tools/perf/util/evlist.c |
5255 | @@ -34,6 +34,10 @@ |
5256 | #include <linux/log2.h> |
5257 | #include <linux/err.h> |
5258 | |
5259 | +#ifdef LACKS_SIGQUEUE_PROTOTYPE |
5260 | +int sigqueue(pid_t pid, int sig, const union sigval value); |
5261 | +#endif |
5262 | + |
5263 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
5264 | #define SID(e, x, y) xyarray__entry(e->sample_id, x, y) |
5265 | |
5266 | diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c |
5267 | index 59be3466d64d..920e1e6551dd 100644 |
5268 | --- a/tools/perf/util/parse-events.c |
5269 | +++ b/tools/perf/util/parse-events.c |
5270 | @@ -2462,7 +2462,7 @@ restart: |
5271 | if (!name_only && strlen(syms->alias)) |
5272 | snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); |
5273 | else |
5274 | - strncpy(name, syms->symbol, MAX_NAME_LEN); |
5275 | + strlcpy(name, syms->symbol, MAX_NAME_LEN); |
5276 | |
5277 | evt_list[evt_i] = strdup(name); |
5278 | if (evt_list[evt_i] == NULL) |
5279 | diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c |
5280 | index 1cbada2dc6be..f735ee038713 100644 |
5281 | --- a/tools/perf/util/svghelper.c |
5282 | +++ b/tools/perf/util/svghelper.c |
5283 | @@ -334,7 +334,7 @@ static char *cpu_model(void) |
5284 | if (file) { |
5285 | while (fgets(buf, 255, file)) { |
5286 | if (strstr(buf, "model name")) { |
5287 | - strncpy(cpu_m, &buf[13], 255); |
5288 | + strlcpy(cpu_m, &buf[13], 255); |
5289 | break; |
5290 | } |
5291 | } |
5292 | diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile |
5293 | index e39dfb4e7970..ecd79b7fb107 100644 |
5294 | --- a/tools/testing/selftests/bpf/Makefile |
5295 | +++ b/tools/testing/selftests/bpf/Makefile |
5296 | @@ -135,6 +135,16 @@ endif |
5297 | endif |
5298 | endif |
5299 | |
5300 | +# Have one program compiled without "-target bpf" to test whether libbpf loads |
5301 | +# it successfully |
5302 | +$(OUTPUT)/test_xdp.o: test_xdp.c |
5303 | + $(CLANG) $(CLANG_FLAGS) \ |
5304 | + -O2 -emit-llvm -c $< -o - | \ |
5305 | + $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@ |
5306 | +ifeq ($(DWARF2BTF),y) |
5307 | + $(BTF_PAHOLE) -J $@ |
5308 | +endif |
5309 | + |
5310 | $(OUTPUT)/%.o: %.c |
5311 | $(CLANG) $(CLANG_FLAGS) \ |
5312 | -O2 -target bpf -emit-llvm -c $< -o - | \ |
5313 | diff --git a/tools/testing/selftests/bpf/test_libbpf.sh b/tools/testing/selftests/bpf/test_libbpf.sh |
5314 | index 156d89f1edcc..2989b2e2d856 100755 |
5315 | --- a/tools/testing/selftests/bpf/test_libbpf.sh |
5316 | +++ b/tools/testing/selftests/bpf/test_libbpf.sh |
5317 | @@ -33,17 +33,11 @@ trap exit_handler 0 2 3 6 9 |
5318 | |
5319 | libbpf_open_file test_l4lb.o |
5320 | |
5321 | -# TODO: fix libbpf to load noinline functions |
5322 | -# [warning] libbpf: incorrect bpf_call opcode |
5323 | -#libbpf_open_file test_l4lb_noinline.o |
5324 | +# Load a program with BPF-to-BPF calls |
5325 | +libbpf_open_file test_l4lb_noinline.o |
5326 | |
5327 | -# TODO: fix test_xdp_meta.c to load with libbpf |
5328 | -# [warning] libbpf: test_xdp_meta.o doesn't provide kernel version |
5329 | -#libbpf_open_file test_xdp_meta.o |
5330 | - |
5331 | -# TODO: fix libbpf to handle .eh_frame |
5332 | -# [warning] libbpf: relocation failed: no section(10) |
5333 | -#libbpf_open_file ../../../../samples/bpf/tracex3_kern.o |
5334 | +# Load a program compiled without the "-target bpf" flag |
5335 | +libbpf_open_file test_xdp.o |
5336 | |
5337 | # Success |
5338 | exit 0 |
5339 | diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c |
5340 | index f8eac4a544f4..444f49176a2d 100644 |
5341 | --- a/tools/testing/selftests/bpf/test_verifier.c |
5342 | +++ b/tools/testing/selftests/bpf/test_verifier.c |
5343 | @@ -2903,6 +2903,19 @@ static struct bpf_test tests[] = { |
5344 | .result_unpriv = REJECT, |
5345 | .result = ACCEPT, |
5346 | }, |
5347 | + { |
5348 | + "alu32: mov u32 const", |
5349 | + .insns = { |
5350 | + BPF_MOV32_IMM(BPF_REG_7, 0), |
5351 | + BPF_ALU32_IMM(BPF_AND, BPF_REG_7, 1), |
5352 | + BPF_MOV32_REG(BPF_REG_0, BPF_REG_7), |
5353 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), |
5354 | + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_7, 0), |
5355 | + BPF_EXIT_INSN(), |
5356 | + }, |
5357 | + .result = ACCEPT, |
5358 | + .retval = 0, |
5359 | + }, |
5360 | { |
5361 | "unpriv: partial copy of pointer", |
5362 | .insns = { |
5363 | diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h |
5364 | index 6ae3730c4ee3..76d654ef3234 100644 |
5365 | --- a/tools/testing/selftests/kselftest_harness.h |
5366 | +++ b/tools/testing/selftests/kselftest_harness.h |
5367 | @@ -354,7 +354,7 @@ |
5368 | * ASSERT_EQ(expected, measured): expected == measured |
5369 | */ |
5370 | #define ASSERT_EQ(expected, seen) \ |
5371 | - __EXPECT(expected, seen, ==, 1) |
5372 | + __EXPECT(expected, #expected, seen, #seen, ==, 1) |
5373 | |
5374 | /** |
5375 | * ASSERT_NE(expected, seen) |
5376 | @@ -365,7 +365,7 @@ |
5377 | * ASSERT_NE(expected, measured): expected != measured |
5378 | */ |
5379 | #define ASSERT_NE(expected, seen) \ |
5380 | - __EXPECT(expected, seen, !=, 1) |
5381 | + __EXPECT(expected, #expected, seen, #seen, !=, 1) |
5382 | |
5383 | /** |
5384 | * ASSERT_LT(expected, seen) |
5385 | @@ -376,7 +376,7 @@ |
5386 | * ASSERT_LT(expected, measured): expected < measured |
5387 | */ |
5388 | #define ASSERT_LT(expected, seen) \ |
5389 | - __EXPECT(expected, seen, <, 1) |
5390 | + __EXPECT(expected, #expected, seen, #seen, <, 1) |
5391 | |
5392 | /** |
5393 | * ASSERT_LE(expected, seen) |
5394 | @@ -387,7 +387,7 @@ |
5395 | * ASSERT_LE(expected, measured): expected <= measured |
5396 | */ |
5397 | #define ASSERT_LE(expected, seen) \ |
5398 | - __EXPECT(expected, seen, <=, 1) |
5399 | + __EXPECT(expected, #expected, seen, #seen, <=, 1) |
5400 | |
5401 | /** |
5402 | * ASSERT_GT(expected, seen) |
5403 | @@ -398,7 +398,7 @@ |
5404 | * ASSERT_GT(expected, measured): expected > measured |
5405 | */ |
5406 | #define ASSERT_GT(expected, seen) \ |
5407 | - __EXPECT(expected, seen, >, 1) |
5408 | + __EXPECT(expected, #expected, seen, #seen, >, 1) |
5409 | |
5410 | /** |
5411 | * ASSERT_GE(expected, seen) |
5412 | @@ -409,7 +409,7 @@ |
5413 | * ASSERT_GE(expected, measured): expected >= measured |
5414 | */ |
5415 | #define ASSERT_GE(expected, seen) \ |
5416 | - __EXPECT(expected, seen, >=, 1) |
5417 | + __EXPECT(expected, #expected, seen, #seen, >=, 1) |
5418 | |
5419 | /** |
5420 | * ASSERT_NULL(seen) |
5421 | @@ -419,7 +419,7 @@ |
5422 | * ASSERT_NULL(measured): NULL == measured |
5423 | */ |
5424 | #define ASSERT_NULL(seen) \ |
5425 | - __EXPECT(NULL, seen, ==, 1) |
5426 | + __EXPECT(NULL, "NULL", seen, #seen, ==, 1) |
5427 | |
5428 | /** |
5429 | * ASSERT_TRUE(seen) |
5430 | @@ -429,7 +429,7 @@ |
5431 | * ASSERT_TRUE(measured): measured != 0 |
5432 | */ |
5433 | #define ASSERT_TRUE(seen) \ |
5434 | - ASSERT_NE(0, seen) |
5435 | + __EXPECT(0, "0", seen, #seen, !=, 1) |
5436 | |
5437 | /** |
5438 | * ASSERT_FALSE(seen) |
5439 | @@ -439,7 +439,7 @@ |
5440 | * ASSERT_FALSE(measured): measured == 0 |
5441 | */ |
5442 | #define ASSERT_FALSE(seen) \ |
5443 | - ASSERT_EQ(0, seen) |
5444 | + __EXPECT(0, "0", seen, #seen, ==, 1) |
5445 | |
5446 | /** |
5447 | * ASSERT_STREQ(expected, seen) |
5448 | @@ -472,7 +472,7 @@ |
5449 | * EXPECT_EQ(expected, measured): expected == measured |
5450 | */ |
5451 | #define EXPECT_EQ(expected, seen) \ |
5452 | - __EXPECT(expected, seen, ==, 0) |
5453 | + __EXPECT(expected, #expected, seen, #seen, ==, 0) |
5454 | |
5455 | /** |
5456 | * EXPECT_NE(expected, seen) |
5457 | @@ -483,7 +483,7 @@ |
5458 | * EXPECT_NE(expected, measured): expected != measured |
5459 | */ |
5460 | #define EXPECT_NE(expected, seen) \ |
5461 | - __EXPECT(expected, seen, !=, 0) |
5462 | + __EXPECT(expected, #expected, seen, #seen, !=, 0) |
5463 | |
5464 | /** |
5465 | * EXPECT_LT(expected, seen) |
5466 | @@ -494,7 +494,7 @@ |
5467 | * EXPECT_LT(expected, measured): expected < measured |
5468 | */ |
5469 | #define EXPECT_LT(expected, seen) \ |
5470 | - __EXPECT(expected, seen, <, 0) |
5471 | + __EXPECT(expected, #expected, seen, #seen, <, 0) |
5472 | |
5473 | /** |
5474 | * EXPECT_LE(expected, seen) |
5475 | @@ -505,7 +505,7 @@ |
5476 | * EXPECT_LE(expected, measured): expected <= measured |
5477 | */ |
5478 | #define EXPECT_LE(expected, seen) \ |
5479 | - __EXPECT(expected, seen, <=, 0) |
5480 | + __EXPECT(expected, #expected, seen, #seen, <=, 0) |
5481 | |
5482 | /** |
5483 | * EXPECT_GT(expected, seen) |
5484 | @@ -516,7 +516,7 @@ |
5485 | * EXPECT_GT(expected, measured): expected > measured |
5486 | */ |
5487 | #define EXPECT_GT(expected, seen) \ |
5488 | - __EXPECT(expected, seen, >, 0) |
5489 | + __EXPECT(expected, #expected, seen, #seen, >, 0) |
5490 | |
5491 | /** |
5492 | * EXPECT_GE(expected, seen) |
5493 | @@ -527,7 +527,7 @@ |
5494 | * EXPECT_GE(expected, measured): expected >= measured |
5495 | */ |
5496 | #define EXPECT_GE(expected, seen) \ |
5497 | - __EXPECT(expected, seen, >=, 0) |
5498 | + __EXPECT(expected, #expected, seen, #seen, >=, 0) |
5499 | |
5500 | /** |
5501 | * EXPECT_NULL(seen) |
5502 | @@ -537,7 +537,7 @@ |
5503 | * EXPECT_NULL(measured): NULL == measured |
5504 | */ |
5505 | #define EXPECT_NULL(seen) \ |
5506 | - __EXPECT(NULL, seen, ==, 0) |
5507 | + __EXPECT(NULL, "NULL", seen, #seen, ==, 0) |
5508 | |
5509 | /** |
5510 | * EXPECT_TRUE(seen) |
5511 | @@ -547,7 +547,7 @@ |
5512 | * EXPECT_TRUE(measured): 0 != measured |
5513 | */ |
5514 | #define EXPECT_TRUE(seen) \ |
5515 | - EXPECT_NE(0, seen) |
5516 | + __EXPECT(0, "0", seen, #seen, !=, 0) |
5517 | |
5518 | /** |
5519 | * EXPECT_FALSE(seen) |
5520 | @@ -557,7 +557,7 @@ |
5521 | * EXPECT_FALSE(measured): 0 == measured |
5522 | */ |
5523 | #define EXPECT_FALSE(seen) \ |
5524 | - EXPECT_EQ(0, seen) |
5525 | + __EXPECT(0, "0", seen, #seen, ==, 0) |
5526 | |
5527 | /** |
5528 | * EXPECT_STREQ(expected, seen) |
5529 | @@ -597,7 +597,7 @@ |
5530 | if (_metadata->passed && _metadata->step < 255) \ |
5531 | _metadata->step++; |
5532 | |
5533 | -#define __EXPECT(_expected, _seen, _t, _assert) do { \ |
5534 | +#define __EXPECT(_expected, _expected_str, _seen, _seen_str, _t, _assert) do { \ |
5535 | /* Avoid multiple evaluation of the cases */ \ |
5536 | __typeof__(_expected) __exp = (_expected); \ |
5537 | __typeof__(_seen) __seen = (_seen); \ |
5538 | @@ -606,8 +606,8 @@ |
5539 | unsigned long long __exp_print = (uintptr_t)__exp; \ |
5540 | unsigned long long __seen_print = (uintptr_t)__seen; \ |
5541 | __TH_LOG("Expected %s (%llu) %s %s (%llu)", \ |
5542 | - #_expected, __exp_print, #_t, \ |
5543 | - #_seen, __seen_print); \ |
5544 | + _expected_str, __exp_print, #_t, \ |
5545 | + _seen_str, __seen_print); \ |
5546 | _metadata->passed = 0; \ |
5547 | /* Ensure the optional handler is triggered */ \ |
5548 | _metadata->trigger = 1; \ |