Contents of /trunk/kernel-alx/patches-4.14/0105-4.14.6-all-fixes.patch
Parent Directory | Revision Log
Revision 3238 -
(show annotations)
(download)
Fri Nov 9 12:14:58 2018 UTC (5 years, 10 months ago) by niro
File size: 151465 byte(s)
Fri Nov 9 12:14:58 2018 UTC (5 years, 10 months ago) by niro
File size: 151465 byte(s)
-added up to patches-4.14.79
1 | diff --git a/Documentation/devicetree/bindings/usb/usb-device.txt b/Documentation/devicetree/bindings/usb/usb-device.txt |
2 | index ce02cebac26a..464ddf7b509a 100644 |
3 | --- a/Documentation/devicetree/bindings/usb/usb-device.txt |
4 | +++ b/Documentation/devicetree/bindings/usb/usb-device.txt |
5 | @@ -11,7 +11,7 @@ Required properties: |
6 | be used, but a device adhering to this binding may leave out all except |
7 | for usbVID,PID. |
8 | - reg: the port number which this device is connecting to, the range |
9 | - is 1-31. |
10 | + is 1-255. |
11 | |
12 | Example: |
13 | |
14 | diff --git a/Makefile b/Makefile |
15 | index 43ac7bdb10ad..eabbd7748a24 100644 |
16 | --- a/Makefile |
17 | +++ b/Makefile |
18 | @@ -1,7 +1,7 @@ |
19 | # SPDX-License-Identifier: GPL-2.0 |
20 | VERSION = 4 |
21 | PATCHLEVEL = 14 |
22 | -SUBLEVEL = 5 |
23 | +SUBLEVEL = 6 |
24 | EXTRAVERSION = |
25 | NAME = Petit Gorille |
26 | |
27 | diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi |
28 | index 8bf0d89cdd35..2e516f4985e4 100644 |
29 | --- a/arch/arm/boot/dts/imx53.dtsi |
30 | +++ b/arch/arm/boot/dts/imx53.dtsi |
31 | @@ -433,15 +433,6 @@ |
32 | clock-names = "ipg", "per"; |
33 | }; |
34 | |
35 | - srtc: srtc@53fa4000 { |
36 | - compatible = "fsl,imx53-rtc", "fsl,imx25-rtc"; |
37 | - reg = <0x53fa4000 0x4000>; |
38 | - interrupts = <24>; |
39 | - interrupt-parent = <&tzic>; |
40 | - clocks = <&clks IMX5_CLK_SRTC_GATE>; |
41 | - clock-names = "ipg"; |
42 | - }; |
43 | - |
44 | iomuxc: iomuxc@53fa8000 { |
45 | compatible = "fsl,imx53-iomuxc"; |
46 | reg = <0x53fa8000 0x4000>; |
47 | diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
48 | index ad301f107dd2..bc8d4bbd82e2 100644 |
49 | --- a/arch/arm/include/asm/assembler.h |
50 | +++ b/arch/arm/include/asm/assembler.h |
51 | @@ -518,4 +518,22 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) |
52 | #endif |
53 | .endm |
54 | |
55 | + .macro bug, msg, line |
56 | +#ifdef CONFIG_THUMB2_KERNEL |
57 | +1: .inst 0xde02 |
58 | +#else |
59 | +1: .inst 0xe7f001f2 |
60 | +#endif |
61 | +#ifdef CONFIG_DEBUG_BUGVERBOSE |
62 | + .pushsection .rodata.str, "aMS", %progbits, 1 |
63 | +2: .asciz "\msg" |
64 | + .popsection |
65 | + .pushsection __bug_table, "aw" |
66 | + .align 2 |
67 | + .word 1b, 2b |
68 | + .hword \line |
69 | + .popsection |
70 | +#endif |
71 | + .endm |
72 | + |
73 | #endif /* __ASM_ASSEMBLER_H__ */ |
74 | diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h |
75 | index c8781450905b..3ab8b3781bfe 100644 |
76 | --- a/arch/arm/include/asm/kvm_arm.h |
77 | +++ b/arch/arm/include/asm/kvm_arm.h |
78 | @@ -161,8 +161,7 @@ |
79 | #else |
80 | #define VTTBR_X (5 - KVM_T0SZ) |
81 | #endif |
82 | -#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) |
83 | -#define VTTBR_BADDR_MASK (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) |
84 | +#define VTTBR_BADDR_MASK (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_X) |
85 | #define VTTBR_VMID_SHIFT _AC(48, ULL) |
86 | #define VTTBR_VMID_MASK(size) (_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT) |
87 | |
88 | diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S |
89 | index d523cd8439a3..0f07579af472 100644 |
90 | --- a/arch/arm/kernel/entry-header.S |
91 | +++ b/arch/arm/kernel/entry-header.S |
92 | @@ -300,6 +300,8 @@ |
93 | mov r2, sp |
94 | ldr r1, [r2, #\offset + S_PSR] @ get calling cpsr |
95 | ldr lr, [r2, #\offset + S_PC]! @ get pc |
96 | + tst r1, #PSR_I_BIT | 0x0f |
97 | + bne 1f |
98 | msr spsr_cxsf, r1 @ save in spsr_svc |
99 | #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) |
100 | @ We must avoid clrex due to Cortex-A15 erratum #830321 |
101 | @@ -314,6 +316,7 @@ |
102 | @ after ldm {}^ |
103 | add sp, sp, #\offset + PT_REGS_SIZE |
104 | movs pc, lr @ return & move spsr_svc into cpsr |
105 | +1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
106 | #elif defined(CONFIG_CPU_V7M) |
107 | @ V7M restore. |
108 | @ Note that we don't need to do clrex here as clearing the local |
109 | @@ -329,6 +332,8 @@ |
110 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
111 | ldr lr, [sp, #\offset + S_PC] @ get pc |
112 | add sp, sp, #\offset + S_SP |
113 | + tst r1, #PSR_I_BIT | 0x0f |
114 | + bne 1f |
115 | msr spsr_cxsf, r1 @ save in spsr_svc |
116 | |
117 | @ We must avoid clrex due to Cortex-A15 erratum #830321 |
118 | @@ -341,6 +346,7 @@ |
119 | .endif |
120 | add sp, sp, #PT_REGS_SIZE - S_SP |
121 | movs pc, lr @ return & move spsr_svc into cpsr |
122 | +1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
123 | #endif /* !CONFIG_THUMB2_KERNEL */ |
124 | .endm |
125 | |
126 | diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h |
127 | index 650344d01124..c4cd5081d78b 100644 |
128 | --- a/arch/arm64/include/asm/efi.h |
129 | +++ b/arch/arm64/include/asm/efi.h |
130 | @@ -132,11 +132,9 @@ static inline void efi_set_pgd(struct mm_struct *mm) |
131 | * Defer the switch to the current thread's TTBR0_EL1 |
132 | * until uaccess_enable(). Restore the current |
133 | * thread's saved ttbr0 corresponding to its active_mm |
134 | - * (if different from init_mm). |
135 | */ |
136 | cpu_set_reserved_ttbr0(); |
137 | - if (current->active_mm != &init_mm) |
138 | - update_saved_ttbr0(current, current->active_mm); |
139 | + update_saved_ttbr0(current, current->active_mm); |
140 | } |
141 | } |
142 | } |
143 | diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h |
144 | index 61d694c2eae5..555d463c0eaa 100644 |
145 | --- a/arch/arm64/include/asm/kvm_arm.h |
146 | +++ b/arch/arm64/include/asm/kvm_arm.h |
147 | @@ -170,8 +170,7 @@ |
148 | #define VTCR_EL2_FLAGS (VTCR_EL2_COMMON_BITS | VTCR_EL2_TGRAN_FLAGS) |
149 | #define VTTBR_X (VTTBR_X_TGRAN_MAGIC - VTCR_EL2_T0SZ_IPA) |
150 | |
151 | -#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) |
152 | -#define VTTBR_BADDR_MASK (((UL(1) << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) |
153 | +#define VTTBR_BADDR_MASK (((UL(1) << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_X) |
154 | #define VTTBR_VMID_SHIFT (UL(48)) |
155 | #define VTTBR_VMID_MASK(size) (_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT) |
156 | |
157 | diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h |
158 | index 3257895a9b5e..9d155fa9a507 100644 |
159 | --- a/arch/arm64/include/asm/mmu_context.h |
160 | +++ b/arch/arm64/include/asm/mmu_context.h |
161 | @@ -156,29 +156,21 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu); |
162 | |
163 | #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.id, 0); 0; }) |
164 | |
165 | -/* |
166 | - * This is called when "tsk" is about to enter lazy TLB mode. |
167 | - * |
168 | - * mm: describes the currently active mm context |
169 | - * tsk: task which is entering lazy tlb |
170 | - * cpu: cpu number which is entering lazy tlb |
171 | - * |
172 | - * tsk->mm will be NULL |
173 | - */ |
174 | -static inline void |
175 | -enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
176 | -{ |
177 | -} |
178 | - |
179 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN |
180 | static inline void update_saved_ttbr0(struct task_struct *tsk, |
181 | struct mm_struct *mm) |
182 | { |
183 | - if (system_uses_ttbr0_pan()) { |
184 | - BUG_ON(mm->pgd == swapper_pg_dir); |
185 | - task_thread_info(tsk)->ttbr0 = |
186 | - virt_to_phys(mm->pgd) | ASID(mm) << 48; |
187 | - } |
188 | + u64 ttbr; |
189 | + |
190 | + if (!system_uses_ttbr0_pan()) |
191 | + return; |
192 | + |
193 | + if (mm == &init_mm) |
194 | + ttbr = __pa_symbol(empty_zero_page); |
195 | + else |
196 | + ttbr = virt_to_phys(mm->pgd) | ASID(mm) << 48; |
197 | + |
198 | + task_thread_info(tsk)->ttbr0 = ttbr; |
199 | } |
200 | #else |
201 | static inline void update_saved_ttbr0(struct task_struct *tsk, |
202 | @@ -187,6 +179,16 @@ static inline void update_saved_ttbr0(struct task_struct *tsk, |
203 | } |
204 | #endif |
205 | |
206 | +static inline void |
207 | +enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
208 | +{ |
209 | + /* |
210 | + * We don't actually care about the ttbr0 mapping, so point it at the |
211 | + * zero page. |
212 | + */ |
213 | + update_saved_ttbr0(tsk, &init_mm); |
214 | +} |
215 | + |
216 | static inline void __switch_mm(struct mm_struct *next) |
217 | { |
218 | unsigned int cpu = smp_processor_id(); |
219 | @@ -214,11 +216,9 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, |
220 | * Update the saved TTBR0_EL1 of the scheduled-in task as the previous |
221 | * value may have not been initialised yet (activate_mm caller) or the |
222 | * ASID has changed since the last run (following the context switch |
223 | - * of another thread of the same process). Avoid setting the reserved |
224 | - * TTBR0_EL1 to swapper_pg_dir (init_mm; e.g. via idle_task_exit). |
225 | + * of another thread of the same process). |
226 | */ |
227 | - if (next != &init_mm) |
228 | - update_saved_ttbr0(tsk, next); |
229 | + update_saved_ttbr0(tsk, next); |
230 | } |
231 | |
232 | #define deactivate_mm(tsk,mm) do { } while (0) |
233 | diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
234 | index 2dc0f8482210..bcd22d7ee590 100644 |
235 | --- a/arch/arm64/kernel/process.c |
236 | +++ b/arch/arm64/kernel/process.c |
237 | @@ -258,6 +258,15 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
238 | |
239 | memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); |
240 | |
241 | + /* |
242 | + * In case p was allocated the same task_struct pointer as some |
243 | + * other recently-exited task, make sure p is disassociated from |
244 | + * any cpu that may have run that now-exited task recently. |
245 | + * Otherwise we could erroneously skip reloading the FPSIMD |
246 | + * registers for p. |
247 | + */ |
248 | + fpsimd_flush_task_state(p); |
249 | + |
250 | if (likely(!(p->flags & PF_KTHREAD))) { |
251 | *childregs = *current_pt_regs(); |
252 | childregs->regs[0] = 0; |
253 | diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h |
254 | index 73b92017b6d7..cd2fc1cc1cc7 100644 |
255 | --- a/arch/powerpc/include/asm/machdep.h |
256 | +++ b/arch/powerpc/include/asm/machdep.h |
257 | @@ -76,6 +76,7 @@ struct machdep_calls { |
258 | |
259 | void __noreturn (*restart)(char *cmd); |
260 | void __noreturn (*halt)(void); |
261 | + void (*panic)(char *str); |
262 | void (*cpu_die)(void); |
263 | |
264 | long (*time_init)(void); /* Optional, may be NULL */ |
265 | diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h |
266 | index 257d23dbf55d..cf00ec26303a 100644 |
267 | --- a/arch/powerpc/include/asm/setup.h |
268 | +++ b/arch/powerpc/include/asm/setup.h |
269 | @@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long); |
270 | |
271 | void check_for_initrd(void); |
272 | void initmem_init(void); |
273 | +void setup_panic(void); |
274 | #define ARCH_PANIC_TIMEOUT 180 |
275 | |
276 | #ifdef CONFIG_PPC_PSERIES |
277 | diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S |
278 | index 610955fe8b81..679bbe714e85 100644 |
279 | --- a/arch/powerpc/kernel/cpu_setup_power.S |
280 | +++ b/arch/powerpc/kernel/cpu_setup_power.S |
281 | @@ -102,6 +102,7 @@ _GLOBAL(__setup_cpu_power9) |
282 | li r0,0 |
283 | mtspr SPRN_PSSCR,r0 |
284 | mtspr SPRN_LPID,r0 |
285 | + mtspr SPRN_PID,r0 |
286 | mfspr r3,SPRN_LPCR |
287 | LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) |
288 | or r3, r3, r4 |
289 | @@ -126,6 +127,7 @@ _GLOBAL(__restore_cpu_power9) |
290 | li r0,0 |
291 | mtspr SPRN_PSSCR,r0 |
292 | mtspr SPRN_LPID,r0 |
293 | + mtspr SPRN_PID,r0 |
294 | mfspr r3,SPRN_LPCR |
295 | LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) |
296 | or r3, r3, r4 |
297 | diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c |
298 | index e1431800bfb9..29d2b6050140 100644 |
299 | --- a/arch/powerpc/kernel/fadump.c |
300 | +++ b/arch/powerpc/kernel/fadump.c |
301 | @@ -1453,25 +1453,6 @@ static void fadump_init_files(void) |
302 | return; |
303 | } |
304 | |
305 | -static int fadump_panic_event(struct notifier_block *this, |
306 | - unsigned long event, void *ptr) |
307 | -{ |
308 | - /* |
309 | - * If firmware-assisted dump has been registered then trigger |
310 | - * firmware-assisted dump and let firmware handle everything |
311 | - * else. If this returns, then fadump was not registered, so |
312 | - * go through the rest of the panic path. |
313 | - */ |
314 | - crash_fadump(NULL, ptr); |
315 | - |
316 | - return NOTIFY_DONE; |
317 | -} |
318 | - |
319 | -static struct notifier_block fadump_panic_block = { |
320 | - .notifier_call = fadump_panic_event, |
321 | - .priority = INT_MIN /* may not return; must be done last */ |
322 | -}; |
323 | - |
324 | /* |
325 | * Prepare for firmware-assisted dump. |
326 | */ |
327 | @@ -1504,9 +1485,6 @@ int __init setup_fadump(void) |
328 | init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start); |
329 | fadump_init_files(); |
330 | |
331 | - atomic_notifier_chain_register(&panic_notifier_list, |
332 | - &fadump_panic_block); |
333 | - |
334 | return 1; |
335 | } |
336 | subsys_initcall(setup_fadump); |
337 | diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c |
338 | index 2e3bc16d02b2..90bc20efb4c7 100644 |
339 | --- a/arch/powerpc/kernel/setup-common.c |
340 | +++ b/arch/powerpc/kernel/setup-common.c |
341 | @@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port) |
342 | } |
343 | EXPORT_SYMBOL(check_legacy_ioport); |
344 | |
345 | +static int ppc_panic_event(struct notifier_block *this, |
346 | + unsigned long event, void *ptr) |
347 | +{ |
348 | + /* |
349 | + * If firmware-assisted dump has been registered then trigger |
350 | + * firmware-assisted dump and let firmware handle everything else. |
351 | + */ |
352 | + crash_fadump(NULL, ptr); |
353 | + ppc_md.panic(ptr); /* May not return */ |
354 | + return NOTIFY_DONE; |
355 | +} |
356 | + |
357 | +static struct notifier_block ppc_panic_block = { |
358 | + .notifier_call = ppc_panic_event, |
359 | + .priority = INT_MIN /* may not return; must be done last */ |
360 | +}; |
361 | + |
362 | +void __init setup_panic(void) |
363 | +{ |
364 | + if (!ppc_md.panic) |
365 | + return; |
366 | + atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); |
367 | +} |
368 | + |
369 | #ifdef CONFIG_CHECK_CACHE_COHERENCY |
370 | /* |
371 | * For platforms that have configurable cache-coherency. This function |
372 | @@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p) |
373 | /* Probe the machine type, establish ppc_md. */ |
374 | probe_machine(); |
375 | |
376 | + /* Setup panic notifier if requested by the platform. */ |
377 | + setup_panic(); |
378 | + |
379 | /* |
380 | * Configure ppc_md.power_save (ppc32 only, 64-bit machines do |
381 | * it from their respective probe() function. |
382 | diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c |
383 | index 21f6531fae20..b150f4deaccf 100644 |
384 | --- a/arch/powerpc/platforms/powernv/opal-imc.c |
385 | +++ b/arch/powerpc/platforms/powernv/opal-imc.c |
386 | @@ -191,8 +191,10 @@ static int opal_imc_counters_probe(struct platform_device *pdev) |
387 | break; |
388 | } |
389 | |
390 | - if (!imc_pmu_create(imc_dev, pmu_count, domain)) |
391 | - pmu_count++; |
392 | + if (!imc_pmu_create(imc_dev, pmu_count, domain)) { |
393 | + if (domain == IMC_DOMAIN_NEST) |
394 | + pmu_count++; |
395 | + } |
396 | } |
397 | |
398 | return 0; |
399 | diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c |
400 | index 9dabea6e1443..6244bc849469 100644 |
401 | --- a/arch/powerpc/platforms/ps3/setup.c |
402 | +++ b/arch/powerpc/platforms/ps3/setup.c |
403 | @@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void) |
404 | ps3_sys_manager_halt(); /* never returns */ |
405 | } |
406 | |
407 | +static void ps3_panic(char *str) |
408 | +{ |
409 | + DBG("%s:%d %s\n", __func__, __LINE__, str); |
410 | + |
411 | + smp_send_stop(); |
412 | + printk("\n"); |
413 | + printk(" System does not reboot automatically.\n"); |
414 | + printk(" Please press POWER button.\n"); |
415 | + printk("\n"); |
416 | + |
417 | + while(1) |
418 | + lv1_pause(1); |
419 | +} |
420 | + |
421 | #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ |
422 | defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) |
423 | static void __init prealloc(struct ps3_prealloc *p) |
424 | @@ -255,6 +269,7 @@ define_machine(ps3) { |
425 | .probe = ps3_probe, |
426 | .setup_arch = ps3_setup_arch, |
427 | .init_IRQ = ps3_init_IRQ, |
428 | + .panic = ps3_panic, |
429 | .get_boot_time = ps3_get_boot_time, |
430 | .set_dabr = ps3_set_dabr, |
431 | .calibrate_decr = ps3_calibrate_decr, |
432 | diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
433 | index 5f1beb8367ac..a8531e012658 100644 |
434 | --- a/arch/powerpc/platforms/pseries/setup.c |
435 | +++ b/arch/powerpc/platforms/pseries/setup.c |
436 | @@ -726,6 +726,7 @@ define_machine(pseries) { |
437 | .pcibios_fixup = pSeries_final_fixup, |
438 | .restart = rtas_restart, |
439 | .halt = rtas_halt, |
440 | + .panic = rtas_os_term, |
441 | .get_boot_time = rtas_get_boot_time, |
442 | .get_rtc_time = rtas_get_rtc_time, |
443 | .set_rtc_time = rtas_set_rtc_time, |
444 | diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h |
445 | index ec7b476c1ac5..c61b2cc1a8a8 100644 |
446 | --- a/arch/s390/include/asm/switch_to.h |
447 | +++ b/arch/s390/include/asm/switch_to.h |
448 | @@ -30,21 +30,20 @@ static inline void restore_access_regs(unsigned int *acrs) |
449 | asm volatile("lam 0,15,%0" : : "Q" (*(acrstype *)acrs)); |
450 | } |
451 | |
452 | -#define switch_to(prev,next,last) do { \ |
453 | - if (prev->mm) { \ |
454 | - save_fpu_regs(); \ |
455 | - save_access_regs(&prev->thread.acrs[0]); \ |
456 | - save_ri_cb(prev->thread.ri_cb); \ |
457 | - save_gs_cb(prev->thread.gs_cb); \ |
458 | - } \ |
459 | +#define switch_to(prev, next, last) do { \ |
460 | + /* save_fpu_regs() sets the CIF_FPU flag, which enforces \ |
461 | + * a restore of the floating point / vector registers as \ |
462 | + * soon as the next task returns to user space \ |
463 | + */ \ |
464 | + save_fpu_regs(); \ |
465 | + save_access_regs(&prev->thread.acrs[0]); \ |
466 | + save_ri_cb(prev->thread.ri_cb); \ |
467 | + save_gs_cb(prev->thread.gs_cb); \ |
468 | update_cr_regs(next); \ |
469 | - if (next->mm) { \ |
470 | - set_cpu_flag(CIF_FPU); \ |
471 | - restore_access_regs(&next->thread.acrs[0]); \ |
472 | - restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \ |
473 | - restore_gs_cb(next->thread.gs_cb); \ |
474 | - } \ |
475 | - prev = __switch_to(prev,next); \ |
476 | + restore_access_regs(&next->thread.acrs[0]); \ |
477 | + restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \ |
478 | + restore_gs_cb(next->thread.gs_cb); \ |
479 | + prev = __switch_to(prev, next); \ |
480 | } while (0) |
481 | |
482 | #endif /* __ASM_SWITCH_TO_H */ |
483 | diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S |
484 | index d39f121e67a9..bc905ae1d5c8 100644 |
485 | --- a/arch/s390/kernel/syscalls.S |
486 | +++ b/arch/s390/kernel/syscalls.S |
487 | @@ -370,10 +370,10 @@ SYSCALL(sys_recvmmsg,compat_sys_recvmmsg) |
488 | SYSCALL(sys_sendmmsg,compat_sys_sendmmsg) |
489 | SYSCALL(sys_socket,sys_socket) |
490 | SYSCALL(sys_socketpair,compat_sys_socketpair) /* 360 */ |
491 | -SYSCALL(sys_bind,sys_bind) |
492 | -SYSCALL(sys_connect,sys_connect) |
493 | +SYSCALL(sys_bind,compat_sys_bind) |
494 | +SYSCALL(sys_connect,compat_sys_connect) |
495 | SYSCALL(sys_listen,sys_listen) |
496 | -SYSCALL(sys_accept4,sys_accept4) |
497 | +SYSCALL(sys_accept4,compat_sys_accept4) |
498 | SYSCALL(sys_getsockopt,compat_sys_getsockopt) /* 365 */ |
499 | SYSCALL(sys_setsockopt,compat_sys_setsockopt) |
500 | SYSCALL(sys_getsockname,compat_sys_getsockname) |
501 | diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c |
502 | index c954ac49eee4..5b25287f449b 100644 |
503 | --- a/arch/s390/kvm/priv.c |
504 | +++ b/arch/s390/kvm/priv.c |
505 | @@ -235,8 +235,6 @@ static int try_handle_skey(struct kvm_vcpu *vcpu) |
506 | VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); |
507 | return -EAGAIN; |
508 | } |
509 | - if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
510 | - return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
511 | return 0; |
512 | } |
513 | |
514 | @@ -247,6 +245,9 @@ static int handle_iske(struct kvm_vcpu *vcpu) |
515 | int reg1, reg2; |
516 | int rc; |
517 | |
518 | + if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
519 | + return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
520 | + |
521 | rc = try_handle_skey(vcpu); |
522 | if (rc) |
523 | return rc != -EAGAIN ? rc : 0; |
524 | @@ -276,6 +277,9 @@ static int handle_rrbe(struct kvm_vcpu *vcpu) |
525 | int reg1, reg2; |
526 | int rc; |
527 | |
528 | + if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
529 | + return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
530 | + |
531 | rc = try_handle_skey(vcpu); |
532 | if (rc) |
533 | return rc != -EAGAIN ? rc : 0; |
534 | @@ -311,6 +315,9 @@ static int handle_sske(struct kvm_vcpu *vcpu) |
535 | int reg1, reg2; |
536 | int rc; |
537 | |
538 | + if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
539 | + return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
540 | + |
541 | rc = try_handle_skey(vcpu); |
542 | if (rc) |
543 | return rc != -EAGAIN ? rc : 0; |
544 | diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c |
545 | index cc2faffa7d6e..334b6d103cbd 100644 |
546 | --- a/arch/s390/mm/pgalloc.c |
547 | +++ b/arch/s390/mm/pgalloc.c |
548 | @@ -85,8 +85,6 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) |
549 | |
550 | /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */ |
551 | VM_BUG_ON(mm->context.asce_limit < _REGION2_SIZE); |
552 | - if (end >= TASK_SIZE_MAX) |
553 | - return -ENOMEM; |
554 | rc = 0; |
555 | notify = 0; |
556 | while (mm->context.asce_limit < end) { |
557 | diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c |
558 | index 61bdc1270d19..a0cc1be767c8 100644 |
559 | --- a/arch/sparc/mm/init_64.c |
560 | +++ b/arch/sparc/mm/init_64.c |
561 | @@ -2540,9 +2540,16 @@ void __init mem_init(void) |
562 | { |
563 | high_memory = __va(last_valid_pfn << PAGE_SHIFT); |
564 | |
565 | - register_page_bootmem_info(); |
566 | free_all_bootmem(); |
567 | |
568 | + /* |
569 | + * Must be done after boot memory is put on freelist, because here we |
570 | + * might set fields in deferred struct pages that have not yet been |
571 | + * initialized, and free_all_bootmem() initializes all the reserved |
572 | + * deferred pages for us. |
573 | + */ |
574 | + register_page_bootmem_info(); |
575 | + |
576 | /* |
577 | * Set up the zero page, mark it reserved, so that page count |
578 | * is not manipulated when freeing the page from user ptes. |
579 | diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
580 | index c73e493adf07..eb38ac9d9a31 100644 |
581 | --- a/arch/x86/include/asm/kvm_host.h |
582 | +++ b/arch/x86/include/asm/kvm_host.h |
583 | @@ -1426,4 +1426,7 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) |
584 | #endif |
585 | } |
586 | |
587 | +void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
588 | + unsigned long start, unsigned long end); |
589 | + |
590 | #endif /* _ASM_X86_KVM_HOST_H */ |
591 | diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
592 | index 65a0ccdc3050..5e0453f18a57 100644 |
593 | --- a/arch/x86/kernel/smpboot.c |
594 | +++ b/arch/x86/kernel/smpboot.c |
595 | @@ -239,7 +239,7 @@ static void notrace start_secondary(void *unused) |
596 | load_cr3(swapper_pg_dir); |
597 | __flush_tlb_all(); |
598 | #endif |
599 | - |
600 | + load_current_idt(); |
601 | cpu_init(); |
602 | x86_cpuinit.early_percpu_clock_init(); |
603 | preempt_disable(); |
604 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
605 | index b21113bcf227..f366e6d3a5e1 100644 |
606 | --- a/arch/x86/kvm/vmx.c |
607 | +++ b/arch/x86/kvm/vmx.c |
608 | @@ -6750,12 +6750,7 @@ static __init int hardware_setup(void) |
609 | memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); |
610 | memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); |
611 | |
612 | - /* |
613 | - * Allow direct access to the PC debug port (it is often used for I/O |
614 | - * delays, but the vmexits simply slow things down). |
615 | - */ |
616 | memset(vmx_io_bitmap_a, 0xff, PAGE_SIZE); |
617 | - clear_bit(0x80, vmx_io_bitmap_a); |
618 | |
619 | memset(vmx_io_bitmap_b, 0xff, PAGE_SIZE); |
620 | |
621 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
622 | index 4195cbcdb310..df62cdc7a258 100644 |
623 | --- a/arch/x86/kvm/x86.c |
624 | +++ b/arch/x86/kvm/x86.c |
625 | @@ -6745,6 +6745,20 @@ static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu) |
626 | kvm_x86_ops->tlb_flush(vcpu); |
627 | } |
628 | |
629 | +void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
630 | + unsigned long start, unsigned long end) |
631 | +{ |
632 | + unsigned long apic_address; |
633 | + |
634 | + /* |
635 | + * The physical address of apic access page is stored in the VMCS. |
636 | + * Update it when it becomes invalid. |
637 | + */ |
638 | + apic_address = gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); |
639 | + if (start <= apic_address && apic_address < end) |
640 | + kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD); |
641 | +} |
642 | + |
643 | void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) |
644 | { |
645 | struct page *page = NULL; |
646 | diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c |
647 | index bb461cfd01ab..526536c81ddc 100644 |
648 | --- a/arch/x86/pci/broadcom_bus.c |
649 | +++ b/arch/x86/pci/broadcom_bus.c |
650 | @@ -97,7 +97,7 @@ static int __init broadcom_postcore_init(void) |
651 | * We should get host bridge information from ACPI unless the BIOS |
652 | * doesn't support it. |
653 | */ |
654 | - if (acpi_os_get_root_pointer()) |
655 | + if (!acpi_disabled && acpi_os_get_root_pointer()) |
656 | return 0; |
657 | #endif |
658 | |
659 | diff --git a/block/blk-core.c b/block/blk-core.c |
660 | index 33ee583cfe45..516ce3174683 100644 |
661 | --- a/block/blk-core.c |
662 | +++ b/block/blk-core.c |
663 | @@ -605,8 +605,8 @@ void blk_set_queue_dying(struct request_queue *q) |
664 | spin_lock_irq(q->queue_lock); |
665 | blk_queue_for_each_rl(rl, q) { |
666 | if (rl->rq_pool) { |
667 | - wake_up(&rl->wait[BLK_RW_SYNC]); |
668 | - wake_up(&rl->wait[BLK_RW_ASYNC]); |
669 | + wake_up_all(&rl->wait[BLK_RW_SYNC]); |
670 | + wake_up_all(&rl->wait[BLK_RW_ASYNC]); |
671 | } |
672 | } |
673 | spin_unlock_irq(q->queue_lock); |
674 | diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c |
675 | index 2d93d9eccb4d..986033e64a83 100644 |
676 | --- a/crypto/asymmetric_keys/pkcs7_verify.c |
677 | +++ b/crypto/asymmetric_keys/pkcs7_verify.c |
678 | @@ -150,7 +150,7 @@ static int pkcs7_find_key(struct pkcs7_message *pkcs7, |
679 | pr_devel("Sig %u: Found cert serial match X.509[%u]\n", |
680 | sinfo->index, certix); |
681 | |
682 | - if (x509->pub->pkey_algo != sinfo->sig->pkey_algo) { |
683 | + if (strcmp(x509->pub->pkey_algo, sinfo->sig->pkey_algo) != 0) { |
684 | pr_warn("Sig %u: X.509 algo and PKCS#7 sig algo don't match\n", |
685 | sinfo->index); |
686 | continue; |
687 | diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c |
688 | index dd03fead1ca3..ce2df8c9c583 100644 |
689 | --- a/crypto/asymmetric_keys/x509_cert_parser.c |
690 | +++ b/crypto/asymmetric_keys/x509_cert_parser.c |
691 | @@ -409,6 +409,8 @@ int x509_extract_key_data(void *context, size_t hdrlen, |
692 | ctx->cert->pub->pkey_algo = "rsa"; |
693 | |
694 | /* Discard the BIT STRING metadata */ |
695 | + if (vlen < 1 || *(const u8 *)value != 0) |
696 | + return -EBADMSG; |
697 | ctx->key = value + 1; |
698 | ctx->key_size = vlen - 1; |
699 | return 0; |
700 | diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c |
701 | index eea71dc9686c..1bd0cf71a22d 100644 |
702 | --- a/crypto/asymmetric_keys/x509_public_key.c |
703 | +++ b/crypto/asymmetric_keys/x509_public_key.c |
704 | @@ -135,7 +135,7 @@ int x509_check_for_self_signed(struct x509_certificate *cert) |
705 | } |
706 | |
707 | ret = -EKEYREJECTED; |
708 | - if (cert->pub->pkey_algo != cert->sig->pkey_algo) |
709 | + if (strcmp(cert->pub->pkey_algo, cert->sig->pkey_algo) != 0) |
710 | goto out; |
711 | |
712 | ret = public_key_verify_signature(cert->pub, cert->sig); |
713 | diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c |
714 | index 7e76b35f422c..e121b8485731 100644 |
715 | --- a/drivers/atm/horizon.c |
716 | +++ b/drivers/atm/horizon.c |
717 | @@ -2803,7 +2803,7 @@ static int hrz_probe(struct pci_dev *pci_dev, |
718 | return err; |
719 | |
720 | out_free_irq: |
721 | - free_irq(dev->irq, dev); |
722 | + free_irq(irq, dev); |
723 | out_free: |
724 | kfree(dev); |
725 | out_release: |
726 | diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig |
727 | index 2f6614c9a229..bdc87907d6a1 100644 |
728 | --- a/drivers/base/Kconfig |
729 | +++ b/drivers/base/Kconfig |
730 | @@ -91,22 +91,23 @@ config FIRMWARE_IN_KERNEL |
731 | depends on FW_LOADER |
732 | default y |
733 | help |
734 | - The kernel source tree includes a number of firmware 'blobs' |
735 | - that are used by various drivers. The recommended way to |
736 | - use these is to run "make firmware_install", which, after |
737 | - converting ihex files to binary, copies all of the needed |
738 | - binary files in firmware/ to /lib/firmware/ on your system so |
739 | - that they can be loaded by userspace helpers on request. |
740 | + Various drivers in the kernel source tree may require firmware, |
741 | + which is generally available in your distribution's linux-firmware |
742 | + package. |
743 | + |
744 | + The linux-firmware package should install firmware into |
745 | + /lib/firmware/ on your system, so they can be loaded by userspace |
746 | + helpers on request. |
747 | |
748 | Enabling this option will build each required firmware blob |
749 | - into the kernel directly, where request_firmware() will find |
750 | - them without having to call out to userspace. This may be |
751 | - useful if your root file system requires a device that uses |
752 | - such firmware and do not wish to use an initrd. |
753 | + specified by EXTRA_FIRMWARE into the kernel directly, where |
754 | + request_firmware() will find them without having to call out to |
755 | + userspace. This may be useful if your root file system requires a |
756 | + device that uses such firmware and you do not wish to use an |
757 | + initrd. |
758 | |
759 | This single option controls the inclusion of firmware for |
760 | - every driver that uses request_firmware() and ships its |
761 | - firmware in the kernel source tree, which avoids a |
762 | + every driver that uses request_firmware(), which avoids a |
763 | proliferation of 'Include firmware for xxx device' options. |
764 | |
765 | Say 'N' and let firmware be loaded from userspace. |
766 | diff --git a/drivers/base/isa.c b/drivers/base/isa.c |
767 | index cd6ccdcf9df0..372d10af2600 100644 |
768 | --- a/drivers/base/isa.c |
769 | +++ b/drivers/base/isa.c |
770 | @@ -39,7 +39,7 @@ static int isa_bus_probe(struct device *dev) |
771 | { |
772 | struct isa_driver *isa_driver = dev->platform_data; |
773 | |
774 | - if (isa_driver->probe) |
775 | + if (isa_driver && isa_driver->probe) |
776 | return isa_driver->probe(dev, to_isa_dev(dev)->id); |
777 | |
778 | return 0; |
779 | @@ -49,7 +49,7 @@ static int isa_bus_remove(struct device *dev) |
780 | { |
781 | struct isa_driver *isa_driver = dev->platform_data; |
782 | |
783 | - if (isa_driver->remove) |
784 | + if (isa_driver && isa_driver->remove) |
785 | return isa_driver->remove(dev, to_isa_dev(dev)->id); |
786 | |
787 | return 0; |
788 | @@ -59,7 +59,7 @@ static void isa_bus_shutdown(struct device *dev) |
789 | { |
790 | struct isa_driver *isa_driver = dev->platform_data; |
791 | |
792 | - if (isa_driver->shutdown) |
793 | + if (isa_driver && isa_driver->shutdown) |
794 | isa_driver->shutdown(dev, to_isa_dev(dev)->id); |
795 | } |
796 | |
797 | @@ -67,7 +67,7 @@ static int isa_bus_suspend(struct device *dev, pm_message_t state) |
798 | { |
799 | struct isa_driver *isa_driver = dev->platform_data; |
800 | |
801 | - if (isa_driver->suspend) |
802 | + if (isa_driver && isa_driver->suspend) |
803 | return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); |
804 | |
805 | return 0; |
806 | @@ -77,7 +77,7 @@ static int isa_bus_resume(struct device *dev) |
807 | { |
808 | struct isa_driver *isa_driver = dev->platform_data; |
809 | |
810 | - if (isa_driver->resume) |
811 | + if (isa_driver && isa_driver->resume) |
812 | return isa_driver->resume(dev, to_isa_dev(dev)->id); |
813 | |
814 | return 0; |
815 | diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c |
816 | index 3c29d36702a8..5426c04fe24b 100644 |
817 | --- a/drivers/bus/arm-cci.c |
818 | +++ b/drivers/bus/arm-cci.c |
819 | @@ -1755,14 +1755,17 @@ static int cci_pmu_probe(struct platform_device *pdev) |
820 | raw_spin_lock_init(&cci_pmu->hw_events.pmu_lock); |
821 | mutex_init(&cci_pmu->reserve_mutex); |
822 | atomic_set(&cci_pmu->active_events, 0); |
823 | - cpumask_set_cpu(smp_processor_id(), &cci_pmu->cpus); |
824 | + cpumask_set_cpu(get_cpu(), &cci_pmu->cpus); |
825 | |
826 | ret = cci_pmu_init(cci_pmu, pdev); |
827 | - if (ret) |
828 | + if (ret) { |
829 | + put_cpu(); |
830 | return ret; |
831 | + } |
832 | |
833 | cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
834 | &cci_pmu->node); |
835 | + put_cpu(); |
836 | pr_info("ARM %s PMU driver probed", cci_pmu->model->name); |
837 | return 0; |
838 | } |
839 | diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c |
840 | index e8c6946fed9d..03d7faf51c2b 100644 |
841 | --- a/drivers/bus/arm-ccn.c |
842 | +++ b/drivers/bus/arm-ccn.c |
843 | @@ -1271,6 +1271,10 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
844 | int len = snprintf(NULL, 0, "ccn_%d", ccn->dt.id); |
845 | |
846 | name = devm_kzalloc(ccn->dev, len + 1, GFP_KERNEL); |
847 | + if (!name) { |
848 | + err = -ENOMEM; |
849 | + goto error_choose_name; |
850 | + } |
851 | snprintf(name, len + 1, "ccn_%d", ccn->dt.id); |
852 | } |
853 | |
854 | @@ -1297,7 +1301,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
855 | } |
856 | |
857 | /* Pick one CPU which we will use to collect data from CCN... */ |
858 | - cpumask_set_cpu(smp_processor_id(), &ccn->dt.cpu); |
859 | + cpumask_set_cpu(get_cpu(), &ccn->dt.cpu); |
860 | |
861 | /* Also make sure that the overflow interrupt is handled by this CPU */ |
862 | if (ccn->irq) { |
863 | @@ -1314,10 +1318,13 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
864 | |
865 | cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE, |
866 | &ccn->dt.node); |
867 | + put_cpu(); |
868 | return 0; |
869 | |
870 | error_pmu_register: |
871 | error_set_affinity: |
872 | + put_cpu(); |
873 | +error_choose_name: |
874 | ida_simple_remove(&arm_ccn_pmu_ida, ccn->dt.id); |
875 | for (i = 0; i < ccn->num_xps; i++) |
876 | writel(0, ccn->xp[i].base + CCN_XP_DT_CONTROL); |
877 | @@ -1580,8 +1587,8 @@ static int __init arm_ccn_init(void) |
878 | |
879 | static void __exit arm_ccn_exit(void) |
880 | { |
881 | - cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE); |
882 | platform_driver_unregister(&arm_ccn_driver); |
883 | + cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE); |
884 | } |
885 | |
886 | module_init(arm_ccn_init); |
887 | diff --git a/drivers/clk/clk-stm32h7.c b/drivers/clk/clk-stm32h7.c |
888 | index a94c3f56c590..61c3e40507d3 100644 |
889 | --- a/drivers/clk/clk-stm32h7.c |
890 | +++ b/drivers/clk/clk-stm32h7.c |
891 | @@ -384,7 +384,7 @@ static void get_cfg_composite_div(const struct composite_clk_gcfg *gcfg, |
892 | mux_ops = div_ops = gate_ops = NULL; |
893 | mux_hw = div_hw = gate_hw = NULL; |
894 | |
895 | - if (gcfg->mux && gcfg->mux) { |
896 | + if (gcfg->mux && cfg->mux) { |
897 | mux = _get_cmux(base + cfg->mux->offset, |
898 | cfg->mux->shift, |
899 | cfg->mux->width, |
900 | @@ -410,7 +410,7 @@ static void get_cfg_composite_div(const struct composite_clk_gcfg *gcfg, |
901 | } |
902 | } |
903 | |
904 | - if (gcfg->gate && gcfg->gate) { |
905 | + if (gcfg->gate && cfg->gate) { |
906 | gate = _get_cgate(base + cfg->gate->offset, |
907 | cfg->gate->bit_idx, |
908 | gcfg->gate->flags, lock); |
909 | diff --git a/drivers/clk/hisilicon/clk-hi3660.c b/drivers/clk/hisilicon/clk-hi3660.c |
910 | index a18258eb89cb..f40419959656 100644 |
911 | --- a/drivers/clk/hisilicon/clk-hi3660.c |
912 | +++ b/drivers/clk/hisilicon/clk-hi3660.c |
913 | @@ -34,7 +34,7 @@ static const struct hisi_fixed_rate_clock hi3660_fixed_rate_clks[] = { |
914 | |
915 | /* crgctrl */ |
916 | static const struct hisi_fixed_factor_clock hi3660_crg_fixed_factor_clks[] = { |
917 | - { HI3660_FACTOR_UART3, "clk_factor_uart3", "iomcu_peri0", 1, 8, 0, }, |
918 | + { HI3660_FACTOR_UART3, "clk_factor_uart3", "iomcu_peri0", 1, 16, 0, }, |
919 | { HI3660_CLK_FACTOR_MMC, "clk_factor_mmc", "clkin_sys", 1, 6, 0, }, |
920 | { HI3660_CLK_GATE_I2C0, "clk_gate_i2c0", "clk_i2c0_iomcu", 1, 4, 0, }, |
921 | { HI3660_CLK_GATE_I2C1, "clk_gate_i2c1", "clk_i2c1_iomcu", 1, 4, 0, }, |
922 | diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c |
923 | index d523991c945f..28ceaf1e9937 100644 |
924 | --- a/drivers/clk/qcom/common.c |
925 | +++ b/drivers/clk/qcom/common.c |
926 | @@ -143,8 +143,10 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path, |
927 | int ret; |
928 | |
929 | clocks_node = of_find_node_by_path("/clocks"); |
930 | - if (clocks_node) |
931 | - node = of_find_node_by_name(clocks_node, path); |
932 | + if (clocks_node) { |
933 | + node = of_get_child_by_name(clocks_node, path); |
934 | + of_node_put(clocks_node); |
935 | + } |
936 | |
937 | if (!node) { |
938 | fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL); |
939 | diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c |
940 | index e43acebdfbcd..f8203115a6bc 100644 |
941 | --- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c |
942 | +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c |
943 | @@ -354,9 +354,9 @@ static SUNXI_CCU_GATE(bus_tdm_clk, "bus-tdm", "apb1", |
944 | static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", |
945 | 0x06c, BIT(0), 0); |
946 | static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", |
947 | - 0x06c, BIT(0), 0); |
948 | + 0x06c, BIT(1), 0); |
949 | static SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", |
950 | - 0x06c, BIT(0), 0); |
951 | + 0x06c, BIT(2), 0); |
952 | static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", |
953 | 0x06c, BIT(16), 0); |
954 | static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", |
955 | diff --git a/drivers/clk/uniphier/clk-uniphier-sys.c b/drivers/clk/uniphier/clk-uniphier-sys.c |
956 | index 07f3b91a7daf..d244e724e198 100644 |
957 | --- a/drivers/clk/uniphier/clk-uniphier-sys.c |
958 | +++ b/drivers/clk/uniphier/clk-uniphier-sys.c |
959 | @@ -123,7 +123,7 @@ const struct uniphier_clk_data uniphier_sld8_sys_clk_data[] = { |
960 | const struct uniphier_clk_data uniphier_pro5_sys_clk_data[] = { |
961 | UNIPHIER_CLK_FACTOR("spll", -1, "ref", 120, 1), /* 2400 MHz */ |
962 | UNIPHIER_CLK_FACTOR("dapll1", -1, "ref", 128, 1), /* 2560 MHz */ |
963 | - UNIPHIER_CLK_FACTOR("dapll2", -1, "ref", 144, 125), /* 2949.12 MHz */ |
964 | + UNIPHIER_CLK_FACTOR("dapll2", -1, "dapll1", 144, 125), /* 2949.12 MHz */ |
965 | UNIPHIER_CLK_FACTOR("uart", 0, "dapll2", 1, 40), |
966 | UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 48), |
967 | UNIPHIER_PRO5_SYS_CLK_NAND(2), |
968 | diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
969 | index dff88838dce7..a19b5d0300a9 100644 |
970 | --- a/drivers/crypto/talitos.c |
971 | +++ b/drivers/crypto/talitos.c |
972 | @@ -1232,12 +1232,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
973 | sg_link_tbl_len += authsize; |
974 | } |
975 | |
976 | - sg_count = talitos_sg_map(dev, areq->src, cryptlen, edesc, |
977 | - &desc->ptr[4], sg_count, areq->assoclen, |
978 | - tbl_off); |
979 | + ret = talitos_sg_map(dev, areq->src, sg_link_tbl_len, edesc, |
980 | + &desc->ptr[4], sg_count, areq->assoclen, tbl_off); |
981 | |
982 | - if (sg_count > 1) { |
983 | - tbl_off += sg_count; |
984 | + if (ret > 1) { |
985 | + tbl_off += ret; |
986 | sync_needed = true; |
987 | } |
988 | |
989 | @@ -1248,14 +1247,15 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
990 | dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); |
991 | } |
992 | |
993 | - sg_count = talitos_sg_map(dev, areq->dst, cryptlen, edesc, |
994 | - &desc->ptr[5], sg_count, areq->assoclen, |
995 | - tbl_off); |
996 | + ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], |
997 | + sg_count, areq->assoclen, tbl_off); |
998 | |
999 | if (desc->hdr & DESC_HDR_TYPE_IPSEC_ESP) |
1000 | to_talitos_ptr_ext_or(&desc->ptr[5], authsize, is_sec1); |
1001 | |
1002 | - if (sg_count > 1) { |
1003 | + /* ICV data */ |
1004 | + if (ret > 1) { |
1005 | + tbl_off += ret; |
1006 | edesc->icv_ool = true; |
1007 | sync_needed = true; |
1008 | |
1009 | @@ -1265,9 +1265,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1010 | sizeof(struct talitos_ptr) + authsize; |
1011 | |
1012 | /* Add an entry to the link table for ICV data */ |
1013 | - tbl_ptr += sg_count - 1; |
1014 | - to_talitos_ptr_ext_set(tbl_ptr, 0, is_sec1); |
1015 | - tbl_ptr++; |
1016 | + to_talitos_ptr_ext_set(tbl_ptr - 1, 0, is_sec1); |
1017 | to_talitos_ptr_ext_set(tbl_ptr, DESC_PTR_LNKTBL_RETURN, |
1018 | is_sec1); |
1019 | to_talitos_ptr_len(tbl_ptr, authsize, is_sec1); |
1020 | @@ -1275,18 +1273,33 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1021 | /* icv data follows link tables */ |
1022 | to_talitos_ptr(tbl_ptr, edesc->dma_link_tbl + offset, |
1023 | is_sec1); |
1024 | + } else { |
1025 | + dma_addr_t addr = edesc->dma_link_tbl; |
1026 | + |
1027 | + if (is_sec1) |
1028 | + addr += areq->assoclen + cryptlen; |
1029 | + else |
1030 | + addr += sizeof(struct talitos_ptr) * tbl_off; |
1031 | + |
1032 | + to_talitos_ptr(&desc->ptr[6], addr, is_sec1); |
1033 | + to_talitos_ptr_len(&desc->ptr[6], authsize, is_sec1); |
1034 | + } |
1035 | + } else if (!(desc->hdr & DESC_HDR_TYPE_IPSEC_ESP)) { |
1036 | + ret = talitos_sg_map(dev, areq->dst, authsize, edesc, |
1037 | + &desc->ptr[6], sg_count, areq->assoclen + |
1038 | + cryptlen, |
1039 | + tbl_off); |
1040 | + if (ret > 1) { |
1041 | + tbl_off += ret; |
1042 | + edesc->icv_ool = true; |
1043 | + sync_needed = true; |
1044 | + } else { |
1045 | + edesc->icv_ool = false; |
1046 | } |
1047 | } else { |
1048 | edesc->icv_ool = false; |
1049 | } |
1050 | |
1051 | - /* ICV data */ |
1052 | - if (!(desc->hdr & DESC_HDR_TYPE_IPSEC_ESP)) { |
1053 | - to_talitos_ptr_len(&desc->ptr[6], authsize, is_sec1); |
1054 | - to_talitos_ptr(&desc->ptr[6], edesc->dma_link_tbl + |
1055 | - areq->assoclen + cryptlen, is_sec1); |
1056 | - } |
1057 | - |
1058 | /* iv out */ |
1059 | if (desc->hdr & DESC_HDR_TYPE_IPSEC_ESP) |
1060 | map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, |
1061 | @@ -1494,12 +1507,20 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, |
1062 | const u8 *key, unsigned int keylen) |
1063 | { |
1064 | struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); |
1065 | + u32 tmp[DES_EXPKEY_WORDS]; |
1066 | |
1067 | if (keylen > TALITOS_MAX_KEY_SIZE) { |
1068 | crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); |
1069 | return -EINVAL; |
1070 | } |
1071 | |
1072 | + if (unlikely(crypto_ablkcipher_get_flags(cipher) & |
1073 | + CRYPTO_TFM_REQ_WEAK_KEY) && |
1074 | + !des_ekey(tmp, key)) { |
1075 | + crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_WEAK_KEY); |
1076 | + return -EINVAL; |
1077 | + } |
1078 | + |
1079 | memcpy(&ctx->key, key, keylen); |
1080 | ctx->keylen = keylen; |
1081 | |
1082 | @@ -2614,7 +2635,7 @@ static struct talitos_alg_template driver_algs[] = { |
1083 | .ivsize = AES_BLOCK_SIZE, |
1084 | } |
1085 | }, |
1086 | - .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | |
1087 | + .desc_hdr_template = DESC_HDR_TYPE_AESU_CTR_NONSNOOP | |
1088 | DESC_HDR_SEL0_AESU | |
1089 | DESC_HDR_MODE0_AESU_CTR, |
1090 | }, |
1091 | @@ -3047,6 +3068,11 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, |
1092 | t_alg->algt.alg.aead.setkey = aead_setkey; |
1093 | t_alg->algt.alg.aead.encrypt = aead_encrypt; |
1094 | t_alg->algt.alg.aead.decrypt = aead_decrypt; |
1095 | + if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) && |
1096 | + !strncmp(alg->cra_name, "authenc(hmac(sha224)", 20)) { |
1097 | + kfree(t_alg); |
1098 | + return ERR_PTR(-ENOTSUPP); |
1099 | + } |
1100 | break; |
1101 | case CRYPTO_ALG_TYPE_AHASH: |
1102 | alg = &t_alg->algt.alg.hash.halg.base; |
1103 | diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
1104 | index f70febf680c3..c3eefa126e3b 100644 |
1105 | --- a/drivers/firmware/efi/efi.c |
1106 | +++ b/drivers/firmware/efi/efi.c |
1107 | @@ -143,8 +143,7 @@ static ssize_t systab_show(struct kobject *kobj, |
1108 | return str - buf; |
1109 | } |
1110 | |
1111 | -static struct kobj_attribute efi_attr_systab = |
1112 | - __ATTR(systab, 0400, systab_show, NULL); |
1113 | +static struct kobj_attribute efi_attr_systab = __ATTR_RO_MODE(systab, 0400); |
1114 | |
1115 | #define EFI_FIELD(var) efi.var |
1116 | |
1117 | diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c |
1118 | index bd7ed3c1148a..c47e0c6ec00f 100644 |
1119 | --- a/drivers/firmware/efi/esrt.c |
1120 | +++ b/drivers/firmware/efi/esrt.c |
1121 | @@ -106,7 +106,7 @@ static const struct sysfs_ops esre_attr_ops = { |
1122 | }; |
1123 | |
1124 | /* Generic ESRT Entry ("ESRE") support. */ |
1125 | -static ssize_t esre_fw_class_show(struct esre_entry *entry, char *buf) |
1126 | +static ssize_t fw_class_show(struct esre_entry *entry, char *buf) |
1127 | { |
1128 | char *str = buf; |
1129 | |
1130 | @@ -117,18 +117,16 @@ static ssize_t esre_fw_class_show(struct esre_entry *entry, char *buf) |
1131 | return str - buf; |
1132 | } |
1133 | |
1134 | -static struct esre_attribute esre_fw_class = __ATTR(fw_class, 0400, |
1135 | - esre_fw_class_show, NULL); |
1136 | +static struct esre_attribute esre_fw_class = __ATTR_RO_MODE(fw_class, 0400); |
1137 | |
1138 | #define esre_attr_decl(name, size, fmt) \ |
1139 | -static ssize_t esre_##name##_show(struct esre_entry *entry, char *buf) \ |
1140 | +static ssize_t name##_show(struct esre_entry *entry, char *buf) \ |
1141 | { \ |
1142 | return sprintf(buf, fmt "\n", \ |
1143 | le##size##_to_cpu(entry->esre.esre1->name)); \ |
1144 | } \ |
1145 | \ |
1146 | -static struct esre_attribute esre_##name = __ATTR(name, 0400, \ |
1147 | - esre_##name##_show, NULL) |
1148 | +static struct esre_attribute esre_##name = __ATTR_RO_MODE(name, 0400) |
1149 | |
1150 | esre_attr_decl(fw_type, 32, "%u"); |
1151 | esre_attr_decl(fw_version, 32, "%u"); |
1152 | @@ -193,14 +191,13 @@ static int esre_create_sysfs_entry(void *esre, int entry_num) |
1153 | |
1154 | /* support for displaying ESRT fields at the top level */ |
1155 | #define esrt_attr_decl(name, size, fmt) \ |
1156 | -static ssize_t esrt_##name##_show(struct kobject *kobj, \ |
1157 | +static ssize_t name##_show(struct kobject *kobj, \ |
1158 | struct kobj_attribute *attr, char *buf)\ |
1159 | { \ |
1160 | return sprintf(buf, fmt "\n", le##size##_to_cpu(esrt->name)); \ |
1161 | } \ |
1162 | \ |
1163 | -static struct kobj_attribute esrt_##name = __ATTR(name, 0400, \ |
1164 | - esrt_##name##_show, NULL) |
1165 | +static struct kobj_attribute esrt_##name = __ATTR_RO_MODE(name, 0400) |
1166 | |
1167 | esrt_attr_decl(fw_resource_count, 32, "%u"); |
1168 | esrt_attr_decl(fw_resource_count_max, 32, "%u"); |
1169 | @@ -431,7 +428,7 @@ static int __init esrt_sysfs_init(void) |
1170 | err_remove_esrt: |
1171 | kobject_put(esrt_kobj); |
1172 | err: |
1173 | - kfree(esrt); |
1174 | + memunmap(esrt); |
1175 | esrt = NULL; |
1176 | return error; |
1177 | } |
1178 | diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c |
1179 | index 8e64b77aeac9..f377609ff141 100644 |
1180 | --- a/drivers/firmware/efi/runtime-map.c |
1181 | +++ b/drivers/firmware/efi/runtime-map.c |
1182 | @@ -63,11 +63,11 @@ static ssize_t map_attr_show(struct kobject *kobj, struct attribute *attr, |
1183 | return map_attr->show(entry, buf); |
1184 | } |
1185 | |
1186 | -static struct map_attribute map_type_attr = __ATTR_RO(type); |
1187 | -static struct map_attribute map_phys_addr_attr = __ATTR_RO(phys_addr); |
1188 | -static struct map_attribute map_virt_addr_attr = __ATTR_RO(virt_addr); |
1189 | -static struct map_attribute map_num_pages_attr = __ATTR_RO(num_pages); |
1190 | -static struct map_attribute map_attribute_attr = __ATTR_RO(attribute); |
1191 | +static struct map_attribute map_type_attr = __ATTR_RO_MODE(type, 0400); |
1192 | +static struct map_attribute map_phys_addr_attr = __ATTR_RO_MODE(phys_addr, 0400); |
1193 | +static struct map_attribute map_virt_addr_attr = __ATTR_RO_MODE(virt_addr, 0400); |
1194 | +static struct map_attribute map_num_pages_attr = __ATTR_RO_MODE(num_pages, 0400); |
1195 | +static struct map_attribute map_attribute_attr = __ATTR_RO_MODE(attribute, 0400); |
1196 | |
1197 | /* |
1198 | * These are default attributes that are added for every memmap entry. |
1199 | diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c |
1200 | index 35e553b3b190..e4b40f2b4627 100644 |
1201 | --- a/drivers/firmware/google/vpd.c |
1202 | +++ b/drivers/firmware/google/vpd.c |
1203 | @@ -295,38 +295,60 @@ static int vpd_probe(struct platform_device *pdev) |
1204 | if (ret) |
1205 | return ret; |
1206 | |
1207 | - return vpd_sections_init(entry.cbmem_addr); |
1208 | + vpd_kobj = kobject_create_and_add("vpd", firmware_kobj); |
1209 | + if (!vpd_kobj) |
1210 | + return -ENOMEM; |
1211 | + |
1212 | + ret = vpd_sections_init(entry.cbmem_addr); |
1213 | + if (ret) { |
1214 | + kobject_put(vpd_kobj); |
1215 | + return ret; |
1216 | + } |
1217 | + |
1218 | + return 0; |
1219 | +} |
1220 | + |
1221 | +static int vpd_remove(struct platform_device *pdev) |
1222 | +{ |
1223 | + vpd_section_destroy(&ro_vpd); |
1224 | + vpd_section_destroy(&rw_vpd); |
1225 | + |
1226 | + kobject_put(vpd_kobj); |
1227 | + |
1228 | + return 0; |
1229 | } |
1230 | |
1231 | static struct platform_driver vpd_driver = { |
1232 | .probe = vpd_probe, |
1233 | + .remove = vpd_remove, |
1234 | .driver = { |
1235 | .name = "vpd", |
1236 | }, |
1237 | }; |
1238 | |
1239 | +static struct platform_device *vpd_pdev; |
1240 | + |
1241 | static int __init vpd_platform_init(void) |
1242 | { |
1243 | - struct platform_device *pdev; |
1244 | - |
1245 | - pdev = platform_device_register_simple("vpd", -1, NULL, 0); |
1246 | - if (IS_ERR(pdev)) |
1247 | - return PTR_ERR(pdev); |
1248 | + int ret; |
1249 | |
1250 | - vpd_kobj = kobject_create_and_add("vpd", firmware_kobj); |
1251 | - if (!vpd_kobj) |
1252 | - return -ENOMEM; |
1253 | + ret = platform_driver_register(&vpd_driver); |
1254 | + if (ret) |
1255 | + return ret; |
1256 | |
1257 | - platform_driver_register(&vpd_driver); |
1258 | + vpd_pdev = platform_device_register_simple("vpd", -1, NULL, 0); |
1259 | + if (IS_ERR(vpd_pdev)) { |
1260 | + platform_driver_unregister(&vpd_driver); |
1261 | + return PTR_ERR(vpd_pdev); |
1262 | + } |
1263 | |
1264 | return 0; |
1265 | } |
1266 | |
1267 | static void __exit vpd_platform_exit(void) |
1268 | { |
1269 | - vpd_section_destroy(&ro_vpd); |
1270 | - vpd_section_destroy(&rw_vpd); |
1271 | - kobject_put(vpd_kobj); |
1272 | + platform_device_unregister(vpd_pdev); |
1273 | + platform_driver_unregister(&vpd_driver); |
1274 | } |
1275 | |
1276 | module_init(vpd_platform_init); |
1277 | diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |
1278 | index 5dd3f1cd074a..a8905049b9da 100644 |
1279 | --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |
1280 | +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |
1281 | @@ -946,7 +946,9 @@ static int analogix_dp_get_modes(struct drm_connector *connector) |
1282 | return 0; |
1283 | } |
1284 | |
1285 | + pm_runtime_get_sync(dp->dev); |
1286 | edid = drm_get_edid(connector, &dp->aux.ddc); |
1287 | + pm_runtime_put(dp->dev); |
1288 | if (edid) { |
1289 | drm_mode_connector_update_edid_property(&dp->connector, |
1290 | edid); |
1291 | diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1292 | index 077de014d610..4400efe3974a 100644 |
1293 | --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1294 | +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1295 | @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, |
1296 | if (IS_ERR(exynos_gem)) |
1297 | return exynos_gem; |
1298 | |
1299 | + if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) { |
1300 | + /* |
1301 | + * when no IOMMU is available, all allocated buffers are |
1302 | + * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag |
1303 | + */ |
1304 | + flags &= ~EXYNOS_BO_NONCONTIG; |
1305 | + DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n"); |
1306 | + } |
1307 | + |
1308 | /* set memory type and cache attribute from user side. */ |
1309 | exynos_gem->flags = flags; |
1310 | |
1311 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1312 | index 5ebdb63330dd..1c73d5542681 100644 |
1313 | --- a/drivers/gpu/drm/i915/intel_display.c |
1314 | +++ b/drivers/gpu/drm/i915/intel_display.c |
1315 | @@ -1000,7 +1000,8 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, |
1316 | return crtc->config->cpu_transcoder; |
1317 | } |
1318 | |
1319 | -static bool pipe_dsl_stopped(struct drm_i915_private *dev_priv, enum pipe pipe) |
1320 | +static bool pipe_scanline_is_moving(struct drm_i915_private *dev_priv, |
1321 | + enum pipe pipe) |
1322 | { |
1323 | i915_reg_t reg = PIPEDSL(pipe); |
1324 | u32 line1, line2; |
1325 | @@ -1015,7 +1016,28 @@ static bool pipe_dsl_stopped(struct drm_i915_private *dev_priv, enum pipe pipe) |
1326 | msleep(5); |
1327 | line2 = I915_READ(reg) & line_mask; |
1328 | |
1329 | - return line1 == line2; |
1330 | + return line1 != line2; |
1331 | +} |
1332 | + |
1333 | +static void wait_for_pipe_scanline_moving(struct intel_crtc *crtc, bool state) |
1334 | +{ |
1335 | + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
1336 | + enum pipe pipe = crtc->pipe; |
1337 | + |
1338 | + /* Wait for the display line to settle/start moving */ |
1339 | + if (wait_for(pipe_scanline_is_moving(dev_priv, pipe) == state, 100)) |
1340 | + DRM_ERROR("pipe %c scanline %s wait timed out\n", |
1341 | + pipe_name(pipe), onoff(state)); |
1342 | +} |
1343 | + |
1344 | +static void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc) |
1345 | +{ |
1346 | + wait_for_pipe_scanline_moving(crtc, false); |
1347 | +} |
1348 | + |
1349 | +static void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc) |
1350 | +{ |
1351 | + wait_for_pipe_scanline_moving(crtc, true); |
1352 | } |
1353 | |
1354 | /* |
1355 | @@ -1038,7 +1060,6 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc) |
1356 | { |
1357 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
1358 | enum transcoder cpu_transcoder = crtc->config->cpu_transcoder; |
1359 | - enum pipe pipe = crtc->pipe; |
1360 | |
1361 | if (INTEL_GEN(dev_priv) >= 4) { |
1362 | i915_reg_t reg = PIPECONF(cpu_transcoder); |
1363 | @@ -1049,9 +1070,7 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc) |
1364 | 100)) |
1365 | WARN(1, "pipe_off wait timed out\n"); |
1366 | } else { |
1367 | - /* Wait for the display line to settle */ |
1368 | - if (wait_for(pipe_dsl_stopped(dev_priv, pipe), 100)) |
1369 | - WARN(1, "pipe_off wait timed out\n"); |
1370 | + intel_wait_for_pipe_scanline_stopped(crtc); |
1371 | } |
1372 | } |
1373 | |
1374 | @@ -1944,15 +1963,14 @@ static void intel_enable_pipe(struct intel_crtc *crtc) |
1375 | POSTING_READ(reg); |
1376 | |
1377 | /* |
1378 | - * Until the pipe starts DSL will read as 0, which would cause |
1379 | - * an apparent vblank timestamp jump, which messes up also the |
1380 | - * frame count when it's derived from the timestamps. So let's |
1381 | - * wait for the pipe to start properly before we call |
1382 | - * drm_crtc_vblank_on() |
1383 | + * Until the pipe starts PIPEDSL reads will return a stale value, |
1384 | + * which causes an apparent vblank timestamp jump when PIPEDSL |
1385 | + * resets to its proper value. That also messes up the frame count |
1386 | + * when it's derived from the timestamps. So let's wait for the |
1387 | + * pipe to start properly before we call drm_crtc_vblank_on() |
1388 | */ |
1389 | - if (dev->max_vblank_count == 0 && |
1390 | - wait_for(intel_get_crtc_scanline(crtc) != crtc->scanline_offset, 50)) |
1391 | - DRM_ERROR("pipe %c didn't start\n", pipe_name(pipe)); |
1392 | + if (dev->max_vblank_count == 0) |
1393 | + intel_wait_for_pipe_scanline_moving(crtc); |
1394 | } |
1395 | |
1396 | /** |
1397 | @@ -14682,6 +14700,8 @@ void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) |
1398 | |
1399 | void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) |
1400 | { |
1401 | + struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
1402 | + |
1403 | DRM_DEBUG_KMS("disabling pipe %c due to force quirk\n", |
1404 | pipe_name(pipe)); |
1405 | |
1406 | @@ -14691,8 +14711,7 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) |
1407 | I915_WRITE(PIPECONF(pipe), 0); |
1408 | POSTING_READ(PIPECONF(pipe)); |
1409 | |
1410 | - if (wait_for(pipe_dsl_stopped(dev_priv, pipe), 100)) |
1411 | - DRM_ERROR("pipe %c off wait timed out\n", pipe_name(pipe)); |
1412 | + intel_wait_for_pipe_scanline_stopped(crtc); |
1413 | |
1414 | I915_WRITE(DPLL(pipe), DPLL_VGA_MODE_DIS); |
1415 | POSTING_READ(DPLL(pipe)); |
1416 | diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c |
1417 | index 894b67ac2cae..05964347008d 100644 |
1418 | --- a/drivers/hv/channel.c |
1419 | +++ b/drivers/hv/channel.c |
1420 | @@ -640,22 +640,28 @@ void vmbus_close(struct vmbus_channel *channel) |
1421 | */ |
1422 | return; |
1423 | } |
1424 | - mutex_lock(&vmbus_connection.channel_mutex); |
1425 | /* |
1426 | * Close all the sub-channels first and then close the |
1427 | * primary channel. |
1428 | */ |
1429 | list_for_each_safe(cur, tmp, &channel->sc_list) { |
1430 | cur_channel = list_entry(cur, struct vmbus_channel, sc_list); |
1431 | - vmbus_close_internal(cur_channel); |
1432 | if (cur_channel->rescind) { |
1433 | + wait_for_completion(&cur_channel->rescind_event); |
1434 | + mutex_lock(&vmbus_connection.channel_mutex); |
1435 | + vmbus_close_internal(cur_channel); |
1436 | hv_process_channel_removal( |
1437 | cur_channel->offermsg.child_relid); |
1438 | + } else { |
1439 | + mutex_lock(&vmbus_connection.channel_mutex); |
1440 | + vmbus_close_internal(cur_channel); |
1441 | } |
1442 | + mutex_unlock(&vmbus_connection.channel_mutex); |
1443 | } |
1444 | /* |
1445 | * Now close the primary. |
1446 | */ |
1447 | + mutex_lock(&vmbus_connection.channel_mutex); |
1448 | vmbus_close_internal(channel); |
1449 | mutex_unlock(&vmbus_connection.channel_mutex); |
1450 | } |
1451 | diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c |
1452 | index 379b0df123be..65c6d6bdce4c 100644 |
1453 | --- a/drivers/hv/channel_mgmt.c |
1454 | +++ b/drivers/hv/channel_mgmt.c |
1455 | @@ -333,6 +333,7 @@ static struct vmbus_channel *alloc_channel(void) |
1456 | return NULL; |
1457 | |
1458 | spin_lock_init(&channel->lock); |
1459 | + init_completion(&channel->rescind_event); |
1460 | |
1461 | INIT_LIST_HEAD(&channel->sc_list); |
1462 | INIT_LIST_HEAD(&channel->percpu_list); |
1463 | @@ -883,6 +884,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) |
1464 | /* |
1465 | * Now wait for offer handling to complete. |
1466 | */ |
1467 | + vmbus_rescind_cleanup(channel); |
1468 | while (READ_ONCE(channel->probe_done) == false) { |
1469 | /* |
1470 | * We wait here until any channel offer is currently |
1471 | @@ -898,7 +900,6 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) |
1472 | if (channel->device_obj) { |
1473 | if (channel->chn_rescind_callback) { |
1474 | channel->chn_rescind_callback(channel); |
1475 | - vmbus_rescind_cleanup(channel); |
1476 | return; |
1477 | } |
1478 | /* |
1479 | @@ -907,7 +908,6 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) |
1480 | */ |
1481 | dev = get_device(&channel->device_obj->device); |
1482 | if (dev) { |
1483 | - vmbus_rescind_cleanup(channel); |
1484 | vmbus_device_unregister(channel->device_obj); |
1485 | put_device(dev); |
1486 | } |
1487 | @@ -921,13 +921,14 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) |
1488 | * 2. Then close the primary channel. |
1489 | */ |
1490 | mutex_lock(&vmbus_connection.channel_mutex); |
1491 | - vmbus_rescind_cleanup(channel); |
1492 | if (channel->state == CHANNEL_OPEN_STATE) { |
1493 | /* |
1494 | * The channel is currently not open; |
1495 | * it is safe for us to cleanup the channel. |
1496 | */ |
1497 | hv_process_channel_removal(rescind->child_relid); |
1498 | + } else { |
1499 | + complete(&channel->rescind_event); |
1500 | } |
1501 | mutex_unlock(&vmbus_connection.channel_mutex); |
1502 | } |
1503 | diff --git a/drivers/iio/adc/cpcap-adc.c b/drivers/iio/adc/cpcap-adc.c |
1504 | index 6e419d5a7c14..f153e02686a0 100644 |
1505 | --- a/drivers/iio/adc/cpcap-adc.c |
1506 | +++ b/drivers/iio/adc/cpcap-adc.c |
1507 | @@ -1012,7 +1012,7 @@ static int cpcap_adc_probe(struct platform_device *pdev) |
1508 | platform_set_drvdata(pdev, indio_dev); |
1509 | |
1510 | ddata->irq = platform_get_irq_byname(pdev, "adcdone"); |
1511 | - if (!ddata->irq) |
1512 | + if (ddata->irq < 0) |
1513 | return -ENODEV; |
1514 | |
1515 | error = devm_request_threaded_irq(&pdev->dev, ddata->irq, NULL, |
1516 | diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c |
1517 | index 2e8dbb89c8c9..7dc7d297a0fc 100644 |
1518 | --- a/drivers/iio/adc/meson_saradc.c |
1519 | +++ b/drivers/iio/adc/meson_saradc.c |
1520 | @@ -221,8 +221,10 @@ enum meson_sar_adc_chan7_mux_sel { |
1521 | |
1522 | struct meson_sar_adc_data { |
1523 | bool has_bl30_integration; |
1524 | + u32 bandgap_reg; |
1525 | unsigned int resolution; |
1526 | const char *name; |
1527 | + const struct regmap_config *regmap_config; |
1528 | }; |
1529 | |
1530 | struct meson_sar_adc_priv { |
1531 | @@ -242,13 +244,20 @@ struct meson_sar_adc_priv { |
1532 | int calibscale; |
1533 | }; |
1534 | |
1535 | -static const struct regmap_config meson_sar_adc_regmap_config = { |
1536 | +static const struct regmap_config meson_sar_adc_regmap_config_gxbb = { |
1537 | .reg_bits = 8, |
1538 | .val_bits = 32, |
1539 | .reg_stride = 4, |
1540 | .max_register = MESON_SAR_ADC_REG13, |
1541 | }; |
1542 | |
1543 | +static const struct regmap_config meson_sar_adc_regmap_config_meson8 = { |
1544 | + .reg_bits = 8, |
1545 | + .val_bits = 32, |
1546 | + .reg_stride = 4, |
1547 | + .max_register = MESON_SAR_ADC_DELTA_10, |
1548 | +}; |
1549 | + |
1550 | static unsigned int meson_sar_adc_get_fifo_count(struct iio_dev *indio_dev) |
1551 | { |
1552 | struct meson_sar_adc_priv *priv = iio_priv(indio_dev); |
1553 | @@ -600,7 +609,7 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev, |
1554 | init.num_parents = 1; |
1555 | |
1556 | priv->clk_gate.reg = base + MESON_SAR_ADC_REG3; |
1557 | - priv->clk_gate.bit_idx = fls(MESON_SAR_ADC_REG3_CLK_EN); |
1558 | + priv->clk_gate.bit_idx = __ffs(MESON_SAR_ADC_REG3_CLK_EN); |
1559 | priv->clk_gate.hw.init = &init; |
1560 | |
1561 | priv->adc_clk = devm_clk_register(&indio_dev->dev, &priv->clk_gate.hw); |
1562 | @@ -685,6 +694,20 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev) |
1563 | return 0; |
1564 | } |
1565 | |
1566 | +static void meson_sar_adc_set_bandgap(struct iio_dev *indio_dev, bool on_off) |
1567 | +{ |
1568 | + struct meson_sar_adc_priv *priv = iio_priv(indio_dev); |
1569 | + u32 enable_mask; |
1570 | + |
1571 | + if (priv->data->bandgap_reg == MESON_SAR_ADC_REG11) |
1572 | + enable_mask = MESON_SAR_ADC_REG11_BANDGAP_EN; |
1573 | + else |
1574 | + enable_mask = MESON_SAR_ADC_DELTA_10_TS_VBG_EN; |
1575 | + |
1576 | + regmap_update_bits(priv->regmap, priv->data->bandgap_reg, enable_mask, |
1577 | + on_off ? enable_mask : 0); |
1578 | +} |
1579 | + |
1580 | static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) |
1581 | { |
1582 | struct meson_sar_adc_priv *priv = iio_priv(indio_dev); |
1583 | @@ -717,9 +740,9 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) |
1584 | regval = FIELD_PREP(MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, 1); |
1585 | regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0, |
1586 | MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, regval); |
1587 | - regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG11, |
1588 | - MESON_SAR_ADC_REG11_BANDGAP_EN, |
1589 | - MESON_SAR_ADC_REG11_BANDGAP_EN); |
1590 | + |
1591 | + meson_sar_adc_set_bandgap(indio_dev, true); |
1592 | + |
1593 | regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3, |
1594 | MESON_SAR_ADC_REG3_ADC_EN, |
1595 | MESON_SAR_ADC_REG3_ADC_EN); |
1596 | @@ -739,8 +762,7 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) |
1597 | err_adc_clk: |
1598 | regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3, |
1599 | MESON_SAR_ADC_REG3_ADC_EN, 0); |
1600 | - regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG11, |
1601 | - MESON_SAR_ADC_REG11_BANDGAP_EN, 0); |
1602 | + meson_sar_adc_set_bandgap(indio_dev, false); |
1603 | clk_disable_unprepare(priv->sana_clk); |
1604 | err_sana_clk: |
1605 | clk_disable_unprepare(priv->core_clk); |
1606 | @@ -765,8 +787,8 @@ static int meson_sar_adc_hw_disable(struct iio_dev *indio_dev) |
1607 | |
1608 | regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3, |
1609 | MESON_SAR_ADC_REG3_ADC_EN, 0); |
1610 | - regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG11, |
1611 | - MESON_SAR_ADC_REG11_BANDGAP_EN, 0); |
1612 | + |
1613 | + meson_sar_adc_set_bandgap(indio_dev, false); |
1614 | |
1615 | clk_disable_unprepare(priv->sana_clk); |
1616 | clk_disable_unprepare(priv->core_clk); |
1617 | @@ -845,30 +867,40 @@ static const struct iio_info meson_sar_adc_iio_info = { |
1618 | |
1619 | static const struct meson_sar_adc_data meson_sar_adc_meson8_data = { |
1620 | .has_bl30_integration = false, |
1621 | + .bandgap_reg = MESON_SAR_ADC_DELTA_10, |
1622 | + .regmap_config = &meson_sar_adc_regmap_config_meson8, |
1623 | .resolution = 10, |
1624 | .name = "meson-meson8-saradc", |
1625 | }; |
1626 | |
1627 | static const struct meson_sar_adc_data meson_sar_adc_meson8b_data = { |
1628 | .has_bl30_integration = false, |
1629 | + .bandgap_reg = MESON_SAR_ADC_DELTA_10, |
1630 | + .regmap_config = &meson_sar_adc_regmap_config_meson8, |
1631 | .resolution = 10, |
1632 | .name = "meson-meson8b-saradc", |
1633 | }; |
1634 | |
1635 | static const struct meson_sar_adc_data meson_sar_adc_gxbb_data = { |
1636 | .has_bl30_integration = true, |
1637 | + .bandgap_reg = MESON_SAR_ADC_REG11, |
1638 | + .regmap_config = &meson_sar_adc_regmap_config_gxbb, |
1639 | .resolution = 10, |
1640 | .name = "meson-gxbb-saradc", |
1641 | }; |
1642 | |
1643 | static const struct meson_sar_adc_data meson_sar_adc_gxl_data = { |
1644 | .has_bl30_integration = true, |
1645 | + .bandgap_reg = MESON_SAR_ADC_REG11, |
1646 | + .regmap_config = &meson_sar_adc_regmap_config_gxbb, |
1647 | .resolution = 12, |
1648 | .name = "meson-gxl-saradc", |
1649 | }; |
1650 | |
1651 | static const struct meson_sar_adc_data meson_sar_adc_gxm_data = { |
1652 | .has_bl30_integration = true, |
1653 | + .bandgap_reg = MESON_SAR_ADC_REG11, |
1654 | + .regmap_config = &meson_sar_adc_regmap_config_gxbb, |
1655 | .resolution = 12, |
1656 | .name = "meson-gxm-saradc", |
1657 | }; |
1658 | @@ -946,7 +978,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev) |
1659 | return ret; |
1660 | |
1661 | priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, |
1662 | - &meson_sar_adc_regmap_config); |
1663 | + priv->data->regmap_config); |
1664 | if (IS_ERR(priv->regmap)) |
1665 | return PTR_ERR(priv->regmap); |
1666 | |
1667 | diff --git a/drivers/iio/health/max30102.c b/drivers/iio/health/max30102.c |
1668 | index 839b875c29b9..9fb4bc73a6bc 100644 |
1669 | --- a/drivers/iio/health/max30102.c |
1670 | +++ b/drivers/iio/health/max30102.c |
1671 | @@ -371,7 +371,7 @@ static int max30102_read_raw(struct iio_dev *indio_dev, |
1672 | mutex_unlock(&indio_dev->mlock); |
1673 | break; |
1674 | case IIO_CHAN_INFO_SCALE: |
1675 | - *val = 1; /* 0.0625 */ |
1676 | + *val = 1000; /* 62.5 */ |
1677 | *val2 = 16; |
1678 | ret = IIO_VAL_FRACTIONAL; |
1679 | break; |
1680 | diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c |
1681 | index 28607bb42d87..a337386652b0 100644 |
1682 | --- a/drivers/infiniband/core/security.c |
1683 | +++ b/drivers/infiniband/core/security.c |
1684 | @@ -417,8 +417,17 @@ void ib_close_shared_qp_security(struct ib_qp_security *sec) |
1685 | |
1686 | int ib_create_qp_security(struct ib_qp *qp, struct ib_device *dev) |
1687 | { |
1688 | + u8 i = rdma_start_port(dev); |
1689 | + bool is_ib = false; |
1690 | int ret; |
1691 | |
1692 | + while (i <= rdma_end_port(dev) && !is_ib) |
1693 | + is_ib = rdma_protocol_ib(dev, i++); |
1694 | + |
1695 | + /* If this isn't an IB device don't create the security context */ |
1696 | + if (!is_ib) |
1697 | + return 0; |
1698 | + |
1699 | qp->qp_sec = kzalloc(sizeof(*qp->qp_sec), GFP_KERNEL); |
1700 | if (!qp->qp_sec) |
1701 | return -ENOMEM; |
1702 | @@ -441,6 +450,10 @@ EXPORT_SYMBOL(ib_create_qp_security); |
1703 | |
1704 | void ib_destroy_qp_security_begin(struct ib_qp_security *sec) |
1705 | { |
1706 | + /* Return if not IB */ |
1707 | + if (!sec) |
1708 | + return; |
1709 | + |
1710 | mutex_lock(&sec->mutex); |
1711 | |
1712 | /* Remove the QP from the lists so it won't get added to |
1713 | @@ -470,6 +483,10 @@ void ib_destroy_qp_security_abort(struct ib_qp_security *sec) |
1714 | int ret; |
1715 | int i; |
1716 | |
1717 | + /* Return if not IB */ |
1718 | + if (!sec) |
1719 | + return; |
1720 | + |
1721 | /* If a concurrent cache update is in progress this |
1722 | * QP security could be marked for an error state |
1723 | * transition. Wait for this to complete. |
1724 | @@ -505,6 +522,10 @@ void ib_destroy_qp_security_end(struct ib_qp_security *sec) |
1725 | { |
1726 | int i; |
1727 | |
1728 | + /* Return if not IB */ |
1729 | + if (!sec) |
1730 | + return; |
1731 | + |
1732 | /* If a concurrent cache update is occurring we must |
1733 | * wait until this QP security structure is processed |
1734 | * in the QP to error flow before destroying it because |
1735 | @@ -557,7 +578,7 @@ int ib_security_modify_qp(struct ib_qp *qp, |
1736 | { |
1737 | int ret = 0; |
1738 | struct ib_ports_pkeys *tmp_pps; |
1739 | - struct ib_ports_pkeys *new_pps; |
1740 | + struct ib_ports_pkeys *new_pps = NULL; |
1741 | struct ib_qp *real_qp = qp->real_qp; |
1742 | bool special_qp = (real_qp->qp_type == IB_QPT_SMI || |
1743 | real_qp->qp_type == IB_QPT_GSI || |
1744 | @@ -565,18 +586,27 @@ int ib_security_modify_qp(struct ib_qp *qp, |
1745 | bool pps_change = ((qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) || |
1746 | (qp_attr_mask & IB_QP_ALT_PATH)); |
1747 | |
1748 | + WARN_ONCE((qp_attr_mask & IB_QP_PORT && |
1749 | + rdma_protocol_ib(real_qp->device, qp_attr->port_num) && |
1750 | + !real_qp->qp_sec), |
1751 | + "%s: QP security is not initialized for IB QP: %d\n", |
1752 | + __func__, real_qp->qp_num); |
1753 | + |
1754 | /* The port/pkey settings are maintained only for the real QP. Open |
1755 | * handles on the real QP will be in the shared_qp_list. When |
1756 | * enforcing security on the real QP all the shared QPs will be |
1757 | * checked as well. |
1758 | */ |
1759 | |
1760 | - if (pps_change && !special_qp) { |
1761 | + if (pps_change && !special_qp && real_qp->qp_sec) { |
1762 | mutex_lock(&real_qp->qp_sec->mutex); |
1763 | new_pps = get_new_pps(real_qp, |
1764 | qp_attr, |
1765 | qp_attr_mask); |
1766 | - |
1767 | + if (!new_pps) { |
1768 | + mutex_unlock(&real_qp->qp_sec->mutex); |
1769 | + return -ENOMEM; |
1770 | + } |
1771 | /* Add this QP to the lists for the new port |
1772 | * and pkey settings before checking for permission |
1773 | * in case there is a concurrent cache update |
1774 | @@ -600,7 +630,7 @@ int ib_security_modify_qp(struct ib_qp *qp, |
1775 | qp_attr_mask, |
1776 | udata); |
1777 | |
1778 | - if (pps_change && !special_qp) { |
1779 | + if (new_pps) { |
1780 | /* Clean up the lists and free the appropriate |
1781 | * ports_pkeys structure. |
1782 | */ |
1783 | @@ -631,6 +661,9 @@ int ib_security_pkey_access(struct ib_device *dev, |
1784 | u16 pkey; |
1785 | int ret; |
1786 | |
1787 | + if (!rdma_protocol_ib(dev, port_num)) |
1788 | + return 0; |
1789 | + |
1790 | ret = ib_get_cached_pkey(dev, port_num, pkey_index, &pkey); |
1791 | if (ret) |
1792 | return ret; |
1793 | @@ -665,6 +698,9 @@ int ib_mad_agent_security_setup(struct ib_mad_agent *agent, |
1794 | { |
1795 | int ret; |
1796 | |
1797 | + if (!rdma_protocol_ib(agent->device, agent->port_num)) |
1798 | + return 0; |
1799 | + |
1800 | ret = security_ib_alloc_security(&agent->security); |
1801 | if (ret) |
1802 | return ret; |
1803 | @@ -690,6 +726,9 @@ int ib_mad_agent_security_setup(struct ib_mad_agent *agent, |
1804 | |
1805 | void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) |
1806 | { |
1807 | + if (!rdma_protocol_ib(agent->device, agent->port_num)) |
1808 | + return; |
1809 | + |
1810 | security_ib_free_security(agent->security); |
1811 | if (agent->lsm_nb_reg) |
1812 | unregister_lsm_notifier(&agent->lsm_nb); |
1813 | @@ -697,20 +736,16 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) |
1814 | |
1815 | int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index) |
1816 | { |
1817 | - int ret; |
1818 | + if (!rdma_protocol_ib(map->agent.device, map->agent.port_num)) |
1819 | + return 0; |
1820 | |
1821 | if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed) |
1822 | return -EACCES; |
1823 | |
1824 | - ret = ib_security_pkey_access(map->agent.device, |
1825 | - map->agent.port_num, |
1826 | - pkey_index, |
1827 | - map->agent.security); |
1828 | - |
1829 | - if (ret) |
1830 | - return ret; |
1831 | - |
1832 | - return 0; |
1833 | + return ib_security_pkey_access(map->agent.device, |
1834 | + map->agent.port_num, |
1835 | + pkey_index, |
1836 | + map->agent.security); |
1837 | } |
1838 | |
1839 | #endif /* CONFIG_SECURITY_INFINIBAND */ |
1840 | diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
1841 | index 0d89621d9fe8..b210495ff33c 100644 |
1842 | --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
1843 | +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
1844 | @@ -394,6 +394,7 @@ int bnxt_re_add_gid(struct ib_device *ibdev, u8 port_num, |
1845 | ctx->idx = tbl_idx; |
1846 | ctx->refcnt = 1; |
1847 | ctx_tbl[tbl_idx] = ctx; |
1848 | + *context = ctx; |
1849 | |
1850 | return rc; |
1851 | } |
1852 | diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c |
1853 | index b6b33d99b0b4..17e44c86577a 100644 |
1854 | --- a/drivers/infiniband/hw/mlx4/qp.c |
1855 | +++ b/drivers/infiniband/hw/mlx4/qp.c |
1856 | @@ -2216,7 +2216,7 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, |
1857 | context->mtu_msgmax = (IB_MTU_4096 << 5) | |
1858 | ilog2(dev->dev->caps.max_gso_sz); |
1859 | else |
1860 | - context->mtu_msgmax = (IB_MTU_4096 << 5) | 12; |
1861 | + context->mtu_msgmax = (IB_MTU_4096 << 5) | 13; |
1862 | } else if (attr_mask & IB_QP_PATH_MTU) { |
1863 | if (attr->path_mtu < IB_MTU_256 || attr->path_mtu > IB_MTU_4096) { |
1864 | pr_err("path MTU (%u) is invalid\n", |
1865 | diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1866 | index 552f7bd4ecc3..5aff1e33d984 100644 |
1867 | --- a/drivers/infiniband/hw/mlx5/main.c |
1868 | +++ b/drivers/infiniband/hw/mlx5/main.c |
1869 | @@ -3097,6 +3097,8 @@ static int create_umr_res(struct mlx5_ib_dev *dev) |
1870 | qp->real_qp = qp; |
1871 | qp->uobject = NULL; |
1872 | qp->qp_type = MLX5_IB_QPT_REG_UMR; |
1873 | + qp->send_cq = init_attr->send_cq; |
1874 | + qp->recv_cq = init_attr->recv_cq; |
1875 | |
1876 | attr->qp_state = IB_QPS_INIT; |
1877 | attr->port_num = 1; |
1878 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
1879 | index 6784a05dd6b2..83f3d4831f94 100644 |
1880 | --- a/drivers/iommu/intel-iommu.c |
1881 | +++ b/drivers/iommu/intel-iommu.c |
1882 | @@ -2254,10 +2254,12 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
1883 | uint64_t tmp; |
1884 | |
1885 | if (!sg_res) { |
1886 | + unsigned int pgoff = sg->offset & ~PAGE_MASK; |
1887 | + |
1888 | sg_res = aligned_nrpages(sg->offset, sg->length); |
1889 | - sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
1890 | + sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + pgoff; |
1891 | sg->dma_length = sg->length; |
1892 | - pteval = page_to_phys(sg_page(sg)) | prot; |
1893 | + pteval = (sg_phys(sg) - pgoff) | prot; |
1894 | phys_pfn = pteval >> VTD_PAGE_SHIFT; |
1895 | } |
1896 | |
1897 | @@ -3790,7 +3792,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, |
1898 | |
1899 | for_each_sg(sglist, sg, nelems, i) { |
1900 | BUG_ON(!sg_page(sg)); |
1901 | - sg->dma_address = page_to_phys(sg_page(sg)) + sg->offset; |
1902 | + sg->dma_address = sg_phys(sg); |
1903 | sg->dma_length = sg->length; |
1904 | } |
1905 | return nelems; |
1906 | diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c |
1907 | index 6aa3ea479214..f31265937439 100644 |
1908 | --- a/drivers/irqchip/qcom-irq-combiner.c |
1909 | +++ b/drivers/irqchip/qcom-irq-combiner.c |
1910 | @@ -238,7 +238,7 @@ static int __init combiner_probe(struct platform_device *pdev) |
1911 | { |
1912 | struct combiner *combiner; |
1913 | size_t alloc_sz; |
1914 | - u32 nregs; |
1915 | + int nregs; |
1916 | int err; |
1917 | |
1918 | nregs = count_registers(pdev); |
1919 | diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c |
1920 | index 97fb956bb6e0..93f3d4d61fa7 100644 |
1921 | --- a/drivers/mailbox/mailbox-test.c |
1922 | +++ b/drivers/mailbox/mailbox-test.c |
1923 | @@ -30,6 +30,7 @@ |
1924 | #define MBOX_HEXDUMP_MAX_LEN (MBOX_HEXDUMP_LINE_LEN * \ |
1925 | (MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE)) |
1926 | |
1927 | +static bool mbox_data_ready; |
1928 | static struct dentry *root_debugfs_dir; |
1929 | |
1930 | struct mbox_test_device { |
1931 | @@ -152,16 +153,14 @@ static ssize_t mbox_test_message_write(struct file *filp, |
1932 | |
1933 | static bool mbox_test_message_data_ready(struct mbox_test_device *tdev) |
1934 | { |
1935 | - unsigned char data; |
1936 | + bool data_ready; |
1937 | unsigned long flags; |
1938 | |
1939 | spin_lock_irqsave(&tdev->lock, flags); |
1940 | - data = tdev->rx_buffer[0]; |
1941 | + data_ready = mbox_data_ready; |
1942 | spin_unlock_irqrestore(&tdev->lock, flags); |
1943 | |
1944 | - if (data != '\0') |
1945 | - return true; |
1946 | - return false; |
1947 | + return data_ready; |
1948 | } |
1949 | |
1950 | static ssize_t mbox_test_message_read(struct file *filp, char __user *userbuf, |
1951 | @@ -223,6 +222,7 @@ static ssize_t mbox_test_message_read(struct file *filp, char __user *userbuf, |
1952 | *(touser + l) = '\0'; |
1953 | |
1954 | memset(tdev->rx_buffer, 0, MBOX_MAX_MSG_LEN); |
1955 | + mbox_data_ready = false; |
1956 | |
1957 | spin_unlock_irqrestore(&tdev->lock, flags); |
1958 | |
1959 | @@ -292,6 +292,7 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message) |
1960 | message, MBOX_MAX_MSG_LEN); |
1961 | memcpy(tdev->rx_buffer, message, MBOX_MAX_MSG_LEN); |
1962 | } |
1963 | + mbox_data_ready = true; |
1964 | spin_unlock_irqrestore(&tdev->lock, flags); |
1965 | |
1966 | wake_up_interruptible(&tdev->waitq); |
1967 | diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c |
1968 | index 0b7406ac8ce1..9a340728b846 100644 |
1969 | --- a/drivers/md/raid5-cache.c |
1970 | +++ b/drivers/md/raid5-cache.c |
1971 | @@ -2571,31 +2571,22 @@ static ssize_t r5c_journal_mode_show(struct mddev *mddev, char *page) |
1972 | int r5c_journal_mode_set(struct mddev *mddev, int mode) |
1973 | { |
1974 | struct r5conf *conf; |
1975 | - int err; |
1976 | |
1977 | if (mode < R5C_JOURNAL_MODE_WRITE_THROUGH || |
1978 | mode > R5C_JOURNAL_MODE_WRITE_BACK) |
1979 | return -EINVAL; |
1980 | |
1981 | - err = mddev_lock(mddev); |
1982 | - if (err) |
1983 | - return err; |
1984 | conf = mddev->private; |
1985 | - if (!conf || !conf->log) { |
1986 | - mddev_unlock(mddev); |
1987 | + if (!conf || !conf->log) |
1988 | return -ENODEV; |
1989 | - } |
1990 | |
1991 | if (raid5_calc_degraded(conf) > 0 && |
1992 | - mode == R5C_JOURNAL_MODE_WRITE_BACK) { |
1993 | - mddev_unlock(mddev); |
1994 | + mode == R5C_JOURNAL_MODE_WRITE_BACK) |
1995 | return -EINVAL; |
1996 | - } |
1997 | |
1998 | mddev_suspend(mddev); |
1999 | conf->log->r5c_journal_mode = mode; |
2000 | mddev_resume(mddev); |
2001 | - mddev_unlock(mddev); |
2002 | |
2003 | pr_debug("md/raid:%s: setting r5c cache mode to %d: %s\n", |
2004 | mdname(mddev), mode, r5c_journal_mode_str[mode]); |
2005 | @@ -2608,6 +2599,7 @@ static ssize_t r5c_journal_mode_store(struct mddev *mddev, |
2006 | { |
2007 | int mode = ARRAY_SIZE(r5c_journal_mode_str); |
2008 | size_t len = length; |
2009 | + int ret; |
2010 | |
2011 | if (len < 2) |
2012 | return -EINVAL; |
2013 | @@ -2619,8 +2611,12 @@ static ssize_t r5c_journal_mode_store(struct mddev *mddev, |
2014 | if (strlen(r5c_journal_mode_str[mode]) == len && |
2015 | !strncmp(page, r5c_journal_mode_str[mode], len)) |
2016 | break; |
2017 | - |
2018 | - return r5c_journal_mode_set(mddev, mode) ?: length; |
2019 | + ret = mddev_lock(mddev); |
2020 | + if (ret) |
2021 | + return ret; |
2022 | + ret = r5c_journal_mode_set(mddev, mode); |
2023 | + mddev_unlock(mddev); |
2024 | + return ret ?: length; |
2025 | } |
2026 | |
2027 | struct md_sysfs_entry |
2028 | diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
2029 | index 981cccd6b988..72f381522cb2 100644 |
2030 | --- a/drivers/media/rc/rc-main.c |
2031 | +++ b/drivers/media/rc/rc-main.c |
2032 | @@ -38,41 +38,41 @@ static const struct { |
2033 | [RC_PROTO_UNKNOWN] = { .name = "unknown", .repeat_period = 250 }, |
2034 | [RC_PROTO_OTHER] = { .name = "other", .repeat_period = 250 }, |
2035 | [RC_PROTO_RC5] = { .name = "rc-5", |
2036 | - .scancode_bits = 0x1f7f, .repeat_period = 164 }, |
2037 | + .scancode_bits = 0x1f7f, .repeat_period = 250 }, |
2038 | [RC_PROTO_RC5X_20] = { .name = "rc-5x-20", |
2039 | - .scancode_bits = 0x1f7f3f, .repeat_period = 164 }, |
2040 | + .scancode_bits = 0x1f7f3f, .repeat_period = 250 }, |
2041 | [RC_PROTO_RC5_SZ] = { .name = "rc-5-sz", |
2042 | - .scancode_bits = 0x2fff, .repeat_period = 164 }, |
2043 | + .scancode_bits = 0x2fff, .repeat_period = 250 }, |
2044 | [RC_PROTO_JVC] = { .name = "jvc", |
2045 | .scancode_bits = 0xffff, .repeat_period = 250 }, |
2046 | [RC_PROTO_SONY12] = { .name = "sony-12", |
2047 | - .scancode_bits = 0x1f007f, .repeat_period = 100 }, |
2048 | + .scancode_bits = 0x1f007f, .repeat_period = 250 }, |
2049 | [RC_PROTO_SONY15] = { .name = "sony-15", |
2050 | - .scancode_bits = 0xff007f, .repeat_period = 100 }, |
2051 | + .scancode_bits = 0xff007f, .repeat_period = 250 }, |
2052 | [RC_PROTO_SONY20] = { .name = "sony-20", |
2053 | - .scancode_bits = 0x1fff7f, .repeat_period = 100 }, |
2054 | + .scancode_bits = 0x1fff7f, .repeat_period = 250 }, |
2055 | [RC_PROTO_NEC] = { .name = "nec", |
2056 | - .scancode_bits = 0xffff, .repeat_period = 160 }, |
2057 | + .scancode_bits = 0xffff, .repeat_period = 250 }, |
2058 | [RC_PROTO_NECX] = { .name = "nec-x", |
2059 | - .scancode_bits = 0xffffff, .repeat_period = 160 }, |
2060 | + .scancode_bits = 0xffffff, .repeat_period = 250 }, |
2061 | [RC_PROTO_NEC32] = { .name = "nec-32", |
2062 | - .scancode_bits = 0xffffffff, .repeat_period = 160 }, |
2063 | + .scancode_bits = 0xffffffff, .repeat_period = 250 }, |
2064 | [RC_PROTO_SANYO] = { .name = "sanyo", |
2065 | .scancode_bits = 0x1fffff, .repeat_period = 250 }, |
2066 | [RC_PROTO_MCIR2_KBD] = { .name = "mcir2-kbd", |
2067 | - .scancode_bits = 0xffff, .repeat_period = 150 }, |
2068 | + .scancode_bits = 0xffff, .repeat_period = 250 }, |
2069 | [RC_PROTO_MCIR2_MSE] = { .name = "mcir2-mse", |
2070 | - .scancode_bits = 0x1fffff, .repeat_period = 150 }, |
2071 | + .scancode_bits = 0x1fffff, .repeat_period = 250 }, |
2072 | [RC_PROTO_RC6_0] = { .name = "rc-6-0", |
2073 | - .scancode_bits = 0xffff, .repeat_period = 164 }, |
2074 | + .scancode_bits = 0xffff, .repeat_period = 250 }, |
2075 | [RC_PROTO_RC6_6A_20] = { .name = "rc-6-6a-20", |
2076 | - .scancode_bits = 0xfffff, .repeat_period = 164 }, |
2077 | + .scancode_bits = 0xfffff, .repeat_period = 250 }, |
2078 | [RC_PROTO_RC6_6A_24] = { .name = "rc-6-6a-24", |
2079 | - .scancode_bits = 0xffffff, .repeat_period = 164 }, |
2080 | + .scancode_bits = 0xffffff, .repeat_period = 250 }, |
2081 | [RC_PROTO_RC6_6A_32] = { .name = "rc-6-6a-32", |
2082 | - .scancode_bits = 0xffffffff, .repeat_period = 164 }, |
2083 | + .scancode_bits = 0xffffffff, .repeat_period = 250 }, |
2084 | [RC_PROTO_RC6_MCE] = { .name = "rc-6-mce", |
2085 | - .scancode_bits = 0xffff7fff, .repeat_period = 164 }, |
2086 | + .scancode_bits = 0xffff7fff, .repeat_period = 250 }, |
2087 | [RC_PROTO_SHARP] = { .name = "sharp", |
2088 | .scancode_bits = 0x1fff, .repeat_period = 250 }, |
2089 | [RC_PROTO_XMP] = { .name = "xmp", .repeat_period = 250 }, |
2090 | diff --git a/drivers/media/rc/sir_ir.c b/drivers/media/rc/sir_ir.c |
2091 | index bc906fb128d5..d59918878eb2 100644 |
2092 | --- a/drivers/media/rc/sir_ir.c |
2093 | +++ b/drivers/media/rc/sir_ir.c |
2094 | @@ -57,7 +57,7 @@ static void add_read_queue(int flag, unsigned long val); |
2095 | static irqreturn_t sir_interrupt(int irq, void *dev_id); |
2096 | static void send_space(unsigned long len); |
2097 | static void send_pulse(unsigned long len); |
2098 | -static void init_hardware(void); |
2099 | +static int init_hardware(void); |
2100 | static void drop_hardware(void); |
2101 | /* Initialisation */ |
2102 | |
2103 | @@ -263,11 +263,36 @@ static void send_pulse(unsigned long len) |
2104 | } |
2105 | } |
2106 | |
2107 | -static void init_hardware(void) |
2108 | +static int init_hardware(void) |
2109 | { |
2110 | + u8 scratch, scratch2, scratch3; |
2111 | unsigned long flags; |
2112 | |
2113 | spin_lock_irqsave(&hardware_lock, flags); |
2114 | + |
2115 | + /* |
2116 | + * This is a simple port existence test, borrowed from the autoconfig |
2117 | + * function in drivers/tty/serial/8250/8250_port.c |
2118 | + */ |
2119 | + scratch = sinp(UART_IER); |
2120 | + soutp(UART_IER, 0); |
2121 | +#ifdef __i386__ |
2122 | + outb(0xff, 0x080); |
2123 | +#endif |
2124 | + scratch2 = sinp(UART_IER) & 0x0f; |
2125 | + soutp(UART_IER, 0x0f); |
2126 | +#ifdef __i386__ |
2127 | + outb(0x00, 0x080); |
2128 | +#endif |
2129 | + scratch3 = sinp(UART_IER) & 0x0f; |
2130 | + soutp(UART_IER, scratch); |
2131 | + if (scratch2 != 0 || scratch3 != 0x0f) { |
2132 | + /* we fail, there's nothing here */ |
2133 | + spin_unlock_irqrestore(&hardware_lock, flags); |
2134 | + pr_err("port existence test failed, cannot continue\n"); |
2135 | + return -ENODEV; |
2136 | + } |
2137 | + |
2138 | /* reset UART */ |
2139 | outb(0, io + UART_MCR); |
2140 | outb(0, io + UART_IER); |
2141 | @@ -285,6 +310,8 @@ static void init_hardware(void) |
2142 | /* turn on UART */ |
2143 | outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2, io + UART_MCR); |
2144 | spin_unlock_irqrestore(&hardware_lock, flags); |
2145 | + |
2146 | + return 0; |
2147 | } |
2148 | |
2149 | static void drop_hardware(void) |
2150 | @@ -334,14 +361,19 @@ static int sir_ir_probe(struct platform_device *dev) |
2151 | pr_err("IRQ %d already in use.\n", irq); |
2152 | return retval; |
2153 | } |
2154 | + |
2155 | + retval = init_hardware(); |
2156 | + if (retval) { |
2157 | + del_timer_sync(&timerlist); |
2158 | + return retval; |
2159 | + } |
2160 | + |
2161 | pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq); |
2162 | |
2163 | retval = devm_rc_register_device(&sir_ir_dev->dev, rcdev); |
2164 | if (retval < 0) |
2165 | return retval; |
2166 | |
2167 | - init_hardware(); |
2168 | - |
2169 | return 0; |
2170 | } |
2171 | |
2172 | diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c |
2173 | index 8207e6900656..bcacb0f22028 100644 |
2174 | --- a/drivers/media/usb/dvb-usb/dibusb-common.c |
2175 | +++ b/drivers/media/usb/dvb-usb/dibusb-common.c |
2176 | @@ -223,8 +223,20 @@ EXPORT_SYMBOL(dibusb_i2c_algo); |
2177 | |
2178 | int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) |
2179 | { |
2180 | - u8 wbuf[1] = { offs }; |
2181 | - return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1); |
2182 | + u8 *buf; |
2183 | + int rc; |
2184 | + |
2185 | + buf = kmalloc(2, GFP_KERNEL); |
2186 | + if (!buf) |
2187 | + return -ENOMEM; |
2188 | + |
2189 | + buf[0] = offs; |
2190 | + |
2191 | + rc = dibusb_i2c_msg(d, 0x50, &buf[0], 1, &buf[1], 1); |
2192 | + *val = buf[1]; |
2193 | + kfree(buf); |
2194 | + |
2195 | + return rc; |
2196 | } |
2197 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); |
2198 | |
2199 | diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c |
2200 | index a13a4896a8bd..c4d1140116ea 100644 |
2201 | --- a/drivers/net/can/flexcan.c |
2202 | +++ b/drivers/net/can/flexcan.c |
2203 | @@ -189,7 +189,7 @@ |
2204 | * MX35 FlexCAN2 03.00.00.00 no no ? no no |
2205 | * MX53 FlexCAN2 03.00.00.00 yes no no no no |
2206 | * MX6s FlexCAN3 10.00.12.00 yes yes no no yes |
2207 | - * VF610 FlexCAN3 ? no yes ? yes yes? |
2208 | + * VF610 FlexCAN3 ? no yes no yes yes? |
2209 | * |
2210 | * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. |
2211 | */ |
2212 | @@ -297,7 +297,8 @@ static const struct flexcan_devtype_data fsl_imx6q_devtype_data = { |
2213 | |
2214 | static const struct flexcan_devtype_data fsl_vf610_devtype_data = { |
2215 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | |
2216 | - FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, |
2217 | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | |
2218 | + FLEXCAN_QUIRK_BROKEN_PERR_STATE, |
2219 | }; |
2220 | |
2221 | static const struct can_bittiming_const flexcan_bittiming_const = { |
2222 | diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c |
2223 | index 85268be0c913..55513411a82e 100644 |
2224 | --- a/drivers/net/can/peak_canfd/peak_canfd.c |
2225 | +++ b/drivers/net/can/peak_canfd/peak_canfd.c |
2226 | @@ -258,21 +258,18 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, |
2227 | /* if this frame is an echo, */ |
2228 | if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) && |
2229 | !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) { |
2230 | - int n; |
2231 | unsigned long flags; |
2232 | |
2233 | spin_lock_irqsave(&priv->echo_lock, flags); |
2234 | - n = can_get_echo_skb(priv->ndev, msg->client); |
2235 | + can_get_echo_skb(priv->ndev, msg->client); |
2236 | spin_unlock_irqrestore(&priv->echo_lock, flags); |
2237 | |
2238 | /* count bytes of the echo instead of skb */ |
2239 | stats->tx_bytes += cf_len; |
2240 | stats->tx_packets++; |
2241 | |
2242 | - if (n) { |
2243 | - /* restart tx queue only if a slot is free */ |
2244 | - netif_wake_queue(priv->ndev); |
2245 | - } |
2246 | + /* restart tx queue (a slot is free) */ |
2247 | + netif_wake_queue(priv->ndev); |
2248 | |
2249 | return 0; |
2250 | } |
2251 | diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2252 | index b4efd711f824..788c3464a3b0 100644 |
2253 | --- a/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2254 | +++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2255 | @@ -825,7 +825,10 @@ static int peak_pciefd_probe(struct pci_dev *pdev, |
2256 | err_disable_pci: |
2257 | pci_disable_device(pdev); |
2258 | |
2259 | - return err; |
2260 | + /* pci_xxx_config_word() return positive PCIBIOS_xxx error codes while |
2261 | + * the probe() function must return a negative errno in case of failure |
2262 | + * (err is unchanged if negative) */ |
2263 | + return pcibios_err_to_errno(err); |
2264 | } |
2265 | |
2266 | /* free the board structure object, as well as its resources: */ |
2267 | diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c |
2268 | index 131026fbc2d7..5adc95c922ee 100644 |
2269 | --- a/drivers/net/can/sja1000/peak_pci.c |
2270 | +++ b/drivers/net/can/sja1000/peak_pci.c |
2271 | @@ -717,7 +717,10 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
2272 | failure_disable_pci: |
2273 | pci_disable_device(pdev); |
2274 | |
2275 | - return err; |
2276 | + /* pci_xxx_config_word() return positive PCIBIOS_xxx error codes while |
2277 | + * the probe() function must return a negative errno in case of failure |
2278 | + * (err is unchanged if negative) */ |
2279 | + return pcibios_err_to_errno(err); |
2280 | } |
2281 | |
2282 | static void peak_pci_remove(struct pci_dev *pdev) |
2283 | diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c |
2284 | index 4d4941469cfc..db6ea936dc3f 100644 |
2285 | --- a/drivers/net/can/ti_hecc.c |
2286 | +++ b/drivers/net/can/ti_hecc.c |
2287 | @@ -637,6 +637,9 @@ static int ti_hecc_rx_poll(struct napi_struct *napi, int quota) |
2288 | mbx_mask = hecc_read(priv, HECC_CANMIM); |
2289 | mbx_mask |= HECC_TX_MBOX_MASK; |
2290 | hecc_write(priv, HECC_CANMIM, mbx_mask); |
2291 | + } else { |
2292 | + /* repoll is done only if whole budget is used */ |
2293 | + num_pkts = quota; |
2294 | } |
2295 | |
2296 | return num_pkts; |
2297 | diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c |
2298 | index b3d02759c226..b00358297424 100644 |
2299 | --- a/drivers/net/can/usb/ems_usb.c |
2300 | +++ b/drivers/net/can/usb/ems_usb.c |
2301 | @@ -288,6 +288,8 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) |
2302 | |
2303 | case -ECONNRESET: /* unlink */ |
2304 | case -ENOENT: |
2305 | + case -EPIPE: |
2306 | + case -EPROTO: |
2307 | case -ESHUTDOWN: |
2308 | return; |
2309 | |
2310 | diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c |
2311 | index 9fdb0f0bfa06..c6dcf93675c0 100644 |
2312 | --- a/drivers/net/can/usb/esd_usb2.c |
2313 | +++ b/drivers/net/can/usb/esd_usb2.c |
2314 | @@ -393,6 +393,8 @@ static void esd_usb2_read_bulk_callback(struct urb *urb) |
2315 | break; |
2316 | |
2317 | case -ENOENT: |
2318 | + case -EPIPE: |
2319 | + case -EPROTO: |
2320 | case -ESHUTDOWN: |
2321 | return; |
2322 | |
2323 | diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c |
2324 | index 9b18d96ef526..63587b8e6825 100644 |
2325 | --- a/drivers/net/can/usb/kvaser_usb.c |
2326 | +++ b/drivers/net/can/usb/kvaser_usb.c |
2327 | @@ -609,8 +609,8 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, |
2328 | } |
2329 | |
2330 | if (pos + tmp->len > actual_len) { |
2331 | - dev_err(dev->udev->dev.parent, |
2332 | - "Format error\n"); |
2333 | + dev_err_ratelimited(dev->udev->dev.parent, |
2334 | + "Format error\n"); |
2335 | break; |
2336 | } |
2337 | |
2338 | @@ -813,6 +813,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, |
2339 | if (err) { |
2340 | netdev_err(netdev, "Error transmitting URB\n"); |
2341 | usb_unanchor_urb(urb); |
2342 | + kfree(buf); |
2343 | usb_free_urb(urb); |
2344 | return err; |
2345 | } |
2346 | @@ -1325,6 +1326,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
2347 | case 0: |
2348 | break; |
2349 | case -ENOENT: |
2350 | + case -EPIPE: |
2351 | + case -EPROTO: |
2352 | case -ESHUTDOWN: |
2353 | return; |
2354 | default: |
2355 | @@ -1333,7 +1336,7 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
2356 | goto resubmit_urb; |
2357 | } |
2358 | |
2359 | - while (pos <= urb->actual_length - MSG_HEADER_LEN) { |
2360 | + while (pos <= (int)(urb->actual_length - MSG_HEADER_LEN)) { |
2361 | msg = urb->transfer_buffer + pos; |
2362 | |
2363 | /* The Kvaser firmware can only read and write messages that |
2364 | @@ -1352,7 +1355,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
2365 | } |
2366 | |
2367 | if (pos + msg->len > urb->actual_length) { |
2368 | - dev_err(dev->udev->dev.parent, "Format error\n"); |
2369 | + dev_err_ratelimited(dev->udev->dev.parent, |
2370 | + "Format error\n"); |
2371 | break; |
2372 | } |
2373 | |
2374 | @@ -1768,6 +1772,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, |
2375 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); |
2376 | |
2377 | usb_unanchor_urb(urb); |
2378 | + kfree(buf); |
2379 | |
2380 | stats->tx_dropped++; |
2381 | |
2382 | diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c |
2383 | index 7f0272558bef..e0c24abce16c 100644 |
2384 | --- a/drivers/net/can/usb/mcba_usb.c |
2385 | +++ b/drivers/net/can/usb/mcba_usb.c |
2386 | @@ -592,6 +592,8 @@ static void mcba_usb_read_bulk_callback(struct urb *urb) |
2387 | break; |
2388 | |
2389 | case -ENOENT: |
2390 | + case -EPIPE: |
2391 | + case -EPROTO: |
2392 | case -ESHUTDOWN: |
2393 | return; |
2394 | |
2395 | diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c |
2396 | index d000cb62d6ae..27861c417c94 100644 |
2397 | --- a/drivers/net/can/usb/usb_8dev.c |
2398 | +++ b/drivers/net/can/usb/usb_8dev.c |
2399 | @@ -524,6 +524,8 @@ static void usb_8dev_read_bulk_callback(struct urb *urb) |
2400 | break; |
2401 | |
2402 | case -ENOENT: |
2403 | + case -EPIPE: |
2404 | + case -EPROTO: |
2405 | case -ESHUTDOWN: |
2406 | return; |
2407 | |
2408 | diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h |
2409 | index c20dd00a1cae..899e7d53e669 100644 |
2410 | --- a/drivers/net/ethernet/netronome/nfp/flower/main.h |
2411 | +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h |
2412 | @@ -52,8 +52,7 @@ struct nfp_app; |
2413 | #define NFP_FLOWER_MASK_ELEMENT_RS 1 |
2414 | #define NFP_FLOWER_MASK_HASH_BITS 10 |
2415 | |
2416 | -#define NFP_FL_META_FLAG_NEW_MASK 128 |
2417 | -#define NFP_FL_META_FLAG_LAST_MASK 1 |
2418 | +#define NFP_FL_META_FLAG_MANAGE_MASK BIT(7) |
2419 | |
2420 | #define NFP_FL_MASK_REUSE_TIME_NS 40000 |
2421 | #define NFP_FL_MASK_ID_LOCATION 1 |
2422 | diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
2423 | index 3226ddc55f99..d9582ccc0025 100644 |
2424 | --- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
2425 | +++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
2426 | @@ -282,7 +282,7 @@ nfp_check_mask_add(struct nfp_app *app, char *mask_data, u32 mask_len, |
2427 | id = nfp_add_mask_table(app, mask_data, mask_len); |
2428 | if (id < 0) |
2429 | return false; |
2430 | - *meta_flags |= NFP_FL_META_FLAG_NEW_MASK; |
2431 | + *meta_flags |= NFP_FL_META_FLAG_MANAGE_MASK; |
2432 | } |
2433 | *mask_id = id; |
2434 | |
2435 | @@ -299,6 +299,9 @@ nfp_check_mask_remove(struct nfp_app *app, char *mask_data, u32 mask_len, |
2436 | if (!mask_entry) |
2437 | return false; |
2438 | |
2439 | + if (meta_flags) |
2440 | + *meta_flags &= ~NFP_FL_META_FLAG_MANAGE_MASK; |
2441 | + |
2442 | *mask_id = mask_entry->mask_id; |
2443 | mask_entry->ref_cnt--; |
2444 | if (!mask_entry->ref_cnt) { |
2445 | @@ -306,7 +309,7 @@ nfp_check_mask_remove(struct nfp_app *app, char *mask_data, u32 mask_len, |
2446 | nfp_release_mask_id(app, *mask_id); |
2447 | kfree(mask_entry); |
2448 | if (meta_flags) |
2449 | - *meta_flags |= NFP_FL_META_FLAG_LAST_MASK; |
2450 | + *meta_flags |= NFP_FL_META_FLAG_MANAGE_MASK; |
2451 | } |
2452 | |
2453 | return true; |
2454 | diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c |
2455 | index d540a9dc77b3..1c43aca8162d 100644 |
2456 | --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c |
2457 | +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c |
2458 | @@ -297,6 +297,8 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, |
2459 | netdev->netdev_ops = &nfp_repr_netdev_ops; |
2460 | netdev->ethtool_ops = &nfp_port_ethtool_ops; |
2461 | |
2462 | + netdev->max_mtu = pf_netdev->max_mtu; |
2463 | + |
2464 | SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops); |
2465 | |
2466 | if (nfp_app_has_tc(app)) { |
2467 | diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
2468 | index ed51018a813e..b9d8d71a6ecc 100644 |
2469 | --- a/drivers/net/geneve.c |
2470 | +++ b/drivers/net/geneve.c |
2471 | @@ -1503,6 +1503,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev) |
2472 | { |
2473 | struct geneve_dev *geneve = netdev_priv(dev); |
2474 | struct ip_tunnel_info *info = &geneve->info; |
2475 | + bool metadata = geneve->collect_md; |
2476 | __u8 tmp_vni[3]; |
2477 | __u32 vni; |
2478 | |
2479 | @@ -1511,32 +1512,24 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev) |
2480 | if (nla_put_u32(skb, IFLA_GENEVE_ID, vni)) |
2481 | goto nla_put_failure; |
2482 | |
2483 | - if (rtnl_dereference(geneve->sock4)) { |
2484 | + if (!metadata && ip_tunnel_info_af(info) == AF_INET) { |
2485 | if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE, |
2486 | info->key.u.ipv4.dst)) |
2487 | goto nla_put_failure; |
2488 | - |
2489 | if (nla_put_u8(skb, IFLA_GENEVE_UDP_CSUM, |
2490 | !!(info->key.tun_flags & TUNNEL_CSUM))) |
2491 | goto nla_put_failure; |
2492 | |
2493 | - } |
2494 | - |
2495 | #if IS_ENABLED(CONFIG_IPV6) |
2496 | - if (rtnl_dereference(geneve->sock6)) { |
2497 | + } else if (!metadata) { |
2498 | if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6, |
2499 | &info->key.u.ipv6.dst)) |
2500 | goto nla_put_failure; |
2501 | - |
2502 | if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, |
2503 | !(info->key.tun_flags & TUNNEL_CSUM))) |
2504 | goto nla_put_failure; |
2505 | - |
2506 | - if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, |
2507 | - !geneve->use_udp6_rx_checksums)) |
2508 | - goto nla_put_failure; |
2509 | - } |
2510 | #endif |
2511 | + } |
2512 | |
2513 | if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) || |
2514 | nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) || |
2515 | @@ -1546,10 +1539,13 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev) |
2516 | if (nla_put_be16(skb, IFLA_GENEVE_PORT, info->key.tp_dst)) |
2517 | goto nla_put_failure; |
2518 | |
2519 | - if (geneve->collect_md) { |
2520 | - if (nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA)) |
2521 | + if (metadata && nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA)) |
2522 | goto nla_put_failure; |
2523 | - } |
2524 | + |
2525 | + if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, |
2526 | + !geneve->use_udp6_rx_checksums)) |
2527 | + goto nla_put_failure; |
2528 | + |
2529 | return 0; |
2530 | |
2531 | nla_put_failure: |
2532 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2533 | index 613caca7dc02..b3fa8ae80465 100644 |
2534 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2535 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2536 | @@ -4096,8 +4096,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, |
2537 | sdio_release_host(sdiodev->func[1]); |
2538 | fail: |
2539 | brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); |
2540 | - device_release_driver(dev); |
2541 | device_release_driver(&sdiodev->func[2]->dev); |
2542 | + device_release_driver(dev); |
2543 | } |
2544 | |
2545 | struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) |
2546 | diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
2547 | index 87b4434224a1..dfa111bb411e 100644 |
2548 | --- a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
2549 | +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
2550 | @@ -68,6 +68,9 @@ |
2551 | * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW |
2552 | * @IWL_MVM_DQA_AUX_QUEUE: a queue reserved for aux frames |
2553 | * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames |
2554 | + * @IWL_MVM_DQA_INJECT_MONITOR_QUEUE: a queue reserved for injection using |
2555 | + * monitor mode. Note this queue is the same as the queue for P2P device |
2556 | + * but we can't have active monitor mode along with P2P device anyway. |
2557 | * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames |
2558 | * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure |
2559 | * that we are never left without the possibility to connect to an AP. |
2560 | @@ -87,6 +90,7 @@ enum iwl_mvm_dqa_txq { |
2561 | IWL_MVM_DQA_CMD_QUEUE = 0, |
2562 | IWL_MVM_DQA_AUX_QUEUE = 1, |
2563 | IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2, |
2564 | + IWL_MVM_DQA_INJECT_MONITOR_QUEUE = 2, |
2565 | IWL_MVM_DQA_GCAST_QUEUE = 3, |
2566 | IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4, |
2567 | IWL_MVM_DQA_MIN_MGMT_QUEUE = 5, |
2568 | diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h |
2569 | index e90abbfba718..ecd5c1df811c 100644 |
2570 | --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h |
2571 | +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h |
2572 | @@ -117,6 +117,7 @@ |
2573 | #define FH_RSCSR_FRAME_INVALID 0x55550000 |
2574 | #define FH_RSCSR_FRAME_ALIGN 0x40 |
2575 | #define FH_RSCSR_RPA_EN BIT(25) |
2576 | +#define FH_RSCSR_RADA_EN BIT(26) |
2577 | #define FH_RSCSR_RXQ_POS 16 |
2578 | #define FH_RSCSR_RXQ_MASK 0x3F0000 |
2579 | |
2580 | @@ -128,7 +129,8 @@ struct iwl_rx_packet { |
2581 | * 31: flag flush RB request |
2582 | * 30: flag ignore TC (terminal counter) request |
2583 | * 29: flag fast IRQ request |
2584 | - * 28-26: Reserved |
2585 | + * 28-27: Reserved |
2586 | + * 26: RADA enabled |
2587 | * 25: Offload enabled |
2588 | * 24: RPF enabled |
2589 | * 23: RSS enabled |
2590 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c |
2591 | index a2bf530eeae4..2f22e14e00fe 100644 |
2592 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c |
2593 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c |
2594 | @@ -787,7 +787,7 @@ static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm, |
2595 | u32 action) |
2596 | { |
2597 | struct iwl_mac_ctx_cmd cmd = {}; |
2598 | - u32 tfd_queue_msk = 0; |
2599 | + u32 tfd_queue_msk = BIT(mvm->snif_queue); |
2600 | int ret; |
2601 | |
2602 | WARN_ON(vif->type != NL80211_IFTYPE_MONITOR); |
2603 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h |
2604 | index 8dcdb522b846..2ec27ceb8af9 100644 |
2605 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h |
2606 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h |
2607 | @@ -954,6 +954,7 @@ struct iwl_mvm { |
2608 | |
2609 | /* Tx queues */ |
2610 | u16 aux_queue; |
2611 | + u16 snif_queue; |
2612 | u16 probe_queue; |
2613 | u16 p2p_dev_queue; |
2614 | |
2615 | @@ -1042,6 +1043,7 @@ struct iwl_mvm { |
2616 | * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running |
2617 | * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done |
2618 | * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running |
2619 | + * @IWL_MVM_STATUS_NEED_FLUSH_P2P: need to flush P2P bcast STA |
2620 | */ |
2621 | enum iwl_mvm_status { |
2622 | IWL_MVM_STATUS_HW_RFKILL, |
2623 | @@ -1053,6 +1055,7 @@ enum iwl_mvm_status { |
2624 | IWL_MVM_STATUS_ROC_AUX_RUNNING, |
2625 | IWL_MVM_STATUS_D3_RECONFIG, |
2626 | IWL_MVM_STATUS_FIRMWARE_RUNNING, |
2627 | + IWL_MVM_STATUS_NEED_FLUSH_P2P, |
2628 | }; |
2629 | |
2630 | /* Keep track of completed init configuration */ |
2631 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
2632 | index 231878969332..9fb40955d5f4 100644 |
2633 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
2634 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
2635 | @@ -622,6 +622,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, |
2636 | mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; |
2637 | |
2638 | mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; |
2639 | + mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; |
2640 | mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; |
2641 | mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; |
2642 | |
2643 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
2644 | index 248699c2c4bf..819e6f66a5b5 100644 |
2645 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
2646 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
2647 | @@ -232,8 +232,8 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm, |
2648 | |
2649 | static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
2650 | struct ieee80211_rx_status *stats, |
2651 | - struct iwl_rx_mpdu_desc *desc, int queue, |
2652 | - u8 *crypt_len) |
2653 | + struct iwl_rx_mpdu_desc *desc, u32 pkt_flags, |
2654 | + int queue, u8 *crypt_len) |
2655 | { |
2656 | u16 status = le16_to_cpu(desc->status); |
2657 | |
2658 | @@ -253,6 +253,8 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
2659 | return -1; |
2660 | |
2661 | stats->flag |= RX_FLAG_DECRYPTED; |
2662 | + if (pkt_flags & FH_RSCSR_RADA_EN) |
2663 | + stats->flag |= RX_FLAG_MIC_STRIPPED; |
2664 | *crypt_len = IEEE80211_CCMP_HDR_LEN; |
2665 | return 0; |
2666 | case IWL_RX_MPDU_STATUS_SEC_TKIP: |
2667 | @@ -270,6 +272,10 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
2668 | if ((status & IWL_RX_MPDU_STATUS_SEC_MASK) == |
2669 | IWL_RX_MPDU_STATUS_SEC_WEP) |
2670 | *crypt_len = IEEE80211_WEP_IV_LEN; |
2671 | + |
2672 | + if (pkt_flags & FH_RSCSR_RADA_EN) |
2673 | + stats->flag |= RX_FLAG_ICV_STRIPPED; |
2674 | + |
2675 | return 0; |
2676 | case IWL_RX_MPDU_STATUS_SEC_EXT_ENC: |
2677 | if (!(status & IWL_RX_MPDU_STATUS_MIC_OK)) |
2678 | @@ -810,7 +816,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
2679 | |
2680 | rx_status = IEEE80211_SKB_RXCB(skb); |
2681 | |
2682 | - if (iwl_mvm_rx_crypto(mvm, hdr, rx_status, desc, queue, &crypt_len)) { |
2683 | + if (iwl_mvm_rx_crypto(mvm, hdr, rx_status, desc, |
2684 | + le32_to_cpu(pkt->len_n_flags), queue, |
2685 | + &crypt_len)) { |
2686 | kfree_skb(skb); |
2687 | return; |
2688 | } |
2689 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
2690 | index c4a343534c5e..0d7929799942 100644 |
2691 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
2692 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
2693 | @@ -1700,29 +1700,29 @@ void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) |
2694 | sta->sta_id = IWL_MVM_INVALID_STA; |
2695 | } |
2696 | |
2697 | -static void iwl_mvm_enable_aux_queue(struct iwl_mvm *mvm) |
2698 | +static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 *queue, |
2699 | + u8 sta_id, u8 fifo) |
2700 | { |
2701 | unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ? |
2702 | mvm->cfg->base_params->wd_timeout : |
2703 | IWL_WATCHDOG_DISABLED; |
2704 | |
2705 | if (iwl_mvm_has_new_tx_api(mvm)) { |
2706 | - int queue = iwl_mvm_tvqm_enable_txq(mvm, mvm->aux_queue, |
2707 | - mvm->aux_sta.sta_id, |
2708 | - IWL_MAX_TID_COUNT, |
2709 | - wdg_timeout); |
2710 | - mvm->aux_queue = queue; |
2711 | + int tvqm_queue = |
2712 | + iwl_mvm_tvqm_enable_txq(mvm, *queue, sta_id, |
2713 | + IWL_MAX_TID_COUNT, |
2714 | + wdg_timeout); |
2715 | + *queue = tvqm_queue; |
2716 | } else { |
2717 | struct iwl_trans_txq_scd_cfg cfg = { |
2718 | - .fifo = IWL_MVM_TX_FIFO_MCAST, |
2719 | - .sta_id = mvm->aux_sta.sta_id, |
2720 | + .fifo = fifo, |
2721 | + .sta_id = sta_id, |
2722 | .tid = IWL_MAX_TID_COUNT, |
2723 | .aggregate = false, |
2724 | .frame_limit = IWL_FRAME_LIMIT, |
2725 | }; |
2726 | |
2727 | - iwl_mvm_enable_txq(mvm, mvm->aux_queue, mvm->aux_queue, 0, &cfg, |
2728 | - wdg_timeout); |
2729 | + iwl_mvm_enable_txq(mvm, *queue, *queue, 0, &cfg, wdg_timeout); |
2730 | } |
2731 | } |
2732 | |
2733 | @@ -1741,7 +1741,9 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) |
2734 | |
2735 | /* Map Aux queue to fifo - needs to happen before adding Aux station */ |
2736 | if (!iwl_mvm_has_new_tx_api(mvm)) |
2737 | - iwl_mvm_enable_aux_queue(mvm); |
2738 | + iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue, |
2739 | + mvm->aux_sta.sta_id, |
2740 | + IWL_MVM_TX_FIFO_MCAST); |
2741 | |
2742 | ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, |
2743 | MAC_INDEX_AUX, 0); |
2744 | @@ -1755,7 +1757,9 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) |
2745 | * to firmware so enable queue here - after the station was added |
2746 | */ |
2747 | if (iwl_mvm_has_new_tx_api(mvm)) |
2748 | - iwl_mvm_enable_aux_queue(mvm); |
2749 | + iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue, |
2750 | + mvm->aux_sta.sta_id, |
2751 | + IWL_MVM_TX_FIFO_MCAST); |
2752 | |
2753 | return 0; |
2754 | } |
2755 | @@ -1763,10 +1767,31 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) |
2756 | int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2757 | { |
2758 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
2759 | + int ret; |
2760 | |
2761 | lockdep_assert_held(&mvm->mutex); |
2762 | - return iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr, |
2763 | + |
2764 | + /* Map snif queue to fifo - must happen before adding snif station */ |
2765 | + if (!iwl_mvm_has_new_tx_api(mvm)) |
2766 | + iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue, |
2767 | + mvm->snif_sta.sta_id, |
2768 | + IWL_MVM_TX_FIFO_BE); |
2769 | + |
2770 | + ret = iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr, |
2771 | mvmvif->id, 0); |
2772 | + if (ret) |
2773 | + return ret; |
2774 | + |
2775 | + /* |
2776 | + * For 22000 firmware and on we cannot add queue to a station unknown |
2777 | + * to firmware so enable queue here - after the station was added |
2778 | + */ |
2779 | + if (iwl_mvm_has_new_tx_api(mvm)) |
2780 | + iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue, |
2781 | + mvm->snif_sta.sta_id, |
2782 | + IWL_MVM_TX_FIFO_BE); |
2783 | + |
2784 | + return 0; |
2785 | } |
2786 | |
2787 | int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2788 | @@ -1775,6 +1800,8 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2789 | |
2790 | lockdep_assert_held(&mvm->mutex); |
2791 | |
2792 | + iwl_mvm_disable_txq(mvm, mvm->snif_queue, mvm->snif_queue, |
2793 | + IWL_MAX_TID_COUNT, 0); |
2794 | ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); |
2795 | if (ret) |
2796 | IWL_WARN(mvm, "Failed sending remove station\n"); |
2797 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c |
2798 | index 4d0314912e94..e25cda9fbf6c 100644 |
2799 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c |
2800 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c |
2801 | @@ -132,6 +132,24 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk) |
2802 | * executed, and a new time event means a new command. |
2803 | */ |
2804 | iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true, CMD_ASYNC); |
2805 | + |
2806 | + /* Do the same for the P2P device queue (STA) */ |
2807 | + if (test_and_clear_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status)) { |
2808 | + struct iwl_mvm_vif *mvmvif; |
2809 | + |
2810 | + /* |
2811 | + * NB: access to this pointer would be racy, but the flush bit |
2812 | + * can only be set when we had a P2P-Device VIF, and we have a |
2813 | + * flush of this work in iwl_mvm_prepare_mac_removal() so it's |
2814 | + * not really racy. |
2815 | + */ |
2816 | + |
2817 | + if (!WARN_ON(!mvm->p2p_device_vif)) { |
2818 | + mvmvif = iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif); |
2819 | + iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true, |
2820 | + CMD_ASYNC); |
2821 | + } |
2822 | + } |
2823 | } |
2824 | |
2825 | static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) |
2826 | @@ -855,10 +873,12 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm) |
2827 | |
2828 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); |
2829 | |
2830 | - if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) |
2831 | + if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { |
2832 | iwl_mvm_remove_time_event(mvm, mvmvif, te_data); |
2833 | - else |
2834 | + set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); |
2835 | + } else { |
2836 | iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data); |
2837 | + } |
2838 | |
2839 | iwl_mvm_roc_finished(mvm); |
2840 | } |
2841 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2842 | index 6f2e2af23219..887a504ce64a 100644 |
2843 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2844 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2845 | @@ -657,7 +657,8 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) |
2846 | if (ap_sta_id != IWL_MVM_INVALID_STA) |
2847 | sta_id = ap_sta_id; |
2848 | } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) { |
2849 | - queue = mvm->aux_queue; |
2850 | + queue = mvm->snif_queue; |
2851 | + sta_id = mvm->snif_sta.sta_id; |
2852 | } |
2853 | } |
2854 | |
2855 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c |
2856 | index 2ea74abad73d..53e269d54050 100644 |
2857 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c |
2858 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c |
2859 | @@ -1143,9 +1143,18 @@ unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, |
2860 | unsigned int default_timeout = |
2861 | cmd_q ? IWL_DEF_WD_TIMEOUT : mvm->cfg->base_params->wd_timeout; |
2862 | |
2863 | - if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) |
2864 | + if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) { |
2865 | + /* |
2866 | + * We can't know when the station is asleep or awake, so we |
2867 | + * must disable the queue hang detection. |
2868 | + */ |
2869 | + if (fw_has_capa(&mvm->fw->ucode_capa, |
2870 | + IWL_UCODE_TLV_CAPA_STA_PM_NOTIF) && |
2871 | + vif && vif->type == NL80211_IFTYPE_AP) |
2872 | + return IWL_WATCHDOG_DISABLED; |
2873 | return iwlmvm_mod_params.tfd_q_hang_detect ? |
2874 | default_timeout : IWL_WATCHDOG_DISABLED; |
2875 | + } |
2876 | |
2877 | trigger = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS); |
2878 | txq_timer = (void *)trigger->data; |
2879 | diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
2880 | index 548e1928430d..0f7bd37bf172 100644 |
2881 | --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
2882 | +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
2883 | @@ -551,6 +551,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
2884 | {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)}, |
2885 | {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)}, |
2886 | {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)}, |
2887 | + {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)}, |
2888 | {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg)}, |
2889 | {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_cfg)}, |
2890 | {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_cfg)}, |
2891 | @@ -662,6 +663,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
2892 | {IWL_PCI_DEVICE(0x2720, 0x0310, iwla000_2ac_cfg_hr_cdb)}, |
2893 | {IWL_PCI_DEVICE(0x40C0, 0x0000, iwla000_2ax_cfg_hr)}, |
2894 | {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwla000_2ax_cfg_hr)}, |
2895 | + {IWL_PCI_DEVICE(0xA0F0, 0x0000, iwla000_2ax_cfg_hr)}, |
2896 | |
2897 | #endif /* CONFIG_IWLMVM */ |
2898 | |
2899 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c |
2900 | index 6467ffac9811..a59b54328c07 100644 |
2901 | --- a/drivers/net/wireless/mac80211_hwsim.c |
2902 | +++ b/drivers/net/wireless/mac80211_hwsim.c |
2903 | @@ -3108,6 +3108,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2904 | { |
2905 | struct hwsim_new_radio_params param = { 0 }; |
2906 | const char *hwname = NULL; |
2907 | + int ret; |
2908 | |
2909 | param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG]; |
2910 | param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE]; |
2911 | @@ -3147,7 +3148,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2912 | param.regd = hwsim_world_regdom_custom[idx]; |
2913 | } |
2914 | |
2915 | - return mac80211_hwsim_new_radio(info, ¶m); |
2916 | + ret = mac80211_hwsim_new_radio(info, ¶m); |
2917 | + kfree(hwname); |
2918 | + return ret; |
2919 | } |
2920 | |
2921 | static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2922 | diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
2923 | index 81df09dd2636..f90c10b3c921 100644 |
2924 | --- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
2925 | +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
2926 | @@ -162,13 +162,13 @@ static int rsi_usb_reg_read(struct usb_device *usbdev, |
2927 | u8 *buf; |
2928 | int status = -ENOMEM; |
2929 | |
2930 | + if (len > RSI_USB_CTRL_BUF_SIZE) |
2931 | + return -EINVAL; |
2932 | + |
2933 | buf = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL); |
2934 | if (!buf) |
2935 | return status; |
2936 | |
2937 | - if (len > RSI_USB_CTRL_BUF_SIZE) |
2938 | - return -EINVAL; |
2939 | - |
2940 | status = usb_control_msg(usbdev, |
2941 | usb_rcvctrlpipe(usbdev, 0), |
2942 | USB_VENDOR_REGISTER_READ, |
2943 | @@ -207,13 +207,13 @@ static int rsi_usb_reg_write(struct usb_device *usbdev, |
2944 | u8 *usb_reg_buf; |
2945 | int status = -ENOMEM; |
2946 | |
2947 | + if (len > RSI_USB_CTRL_BUF_SIZE) |
2948 | + return -EINVAL; |
2949 | + |
2950 | usb_reg_buf = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL); |
2951 | if (!usb_reg_buf) |
2952 | return status; |
2953 | |
2954 | - if (len > RSI_USB_CTRL_BUF_SIZE) |
2955 | - return -EINVAL; |
2956 | - |
2957 | usb_reg_buf[0] = (value & 0x00ff); |
2958 | usb_reg_buf[1] = (value & 0xff00) >> 8; |
2959 | usb_reg_buf[2] = 0x0; |
2960 | diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c |
2961 | index 71b944748304..c5fe7d4a9065 100644 |
2962 | --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c |
2963 | +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c |
2964 | @@ -408,12 +408,21 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, |
2965 | { |
2966 | struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); |
2967 | unsigned int reg = OUTPUT_EN; |
2968 | - unsigned int mask; |
2969 | + unsigned int mask, val, ret; |
2970 | |
2971 | armada_37xx_update_reg(®, offset); |
2972 | mask = BIT(offset); |
2973 | |
2974 | - return regmap_update_bits(info->regmap, reg, mask, mask); |
2975 | + ret = regmap_update_bits(info->regmap, reg, mask, mask); |
2976 | + |
2977 | + if (ret) |
2978 | + return ret; |
2979 | + |
2980 | + reg = OUTPUT_VAL; |
2981 | + val = value ? mask : 0; |
2982 | + regmap_update_bits(info->regmap, reg, mask, val); |
2983 | + |
2984 | + return 0; |
2985 | } |
2986 | |
2987 | static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) |
2988 | diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c |
2989 | index 5beb0c361076..76afe1449cab 100644 |
2990 | --- a/drivers/rapidio/devices/rio_mport_cdev.c |
2991 | +++ b/drivers/rapidio/devices/rio_mport_cdev.c |
2992 | @@ -963,7 +963,8 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, |
2993 | req->sgt.sgl, req->sgt.nents, dir); |
2994 | if (nents == -EFAULT) { |
2995 | rmcd_error("Failed to map SG list"); |
2996 | - return -EFAULT; |
2997 | + ret = -EFAULT; |
2998 | + goto err_pg; |
2999 | } |
3000 | |
3001 | ret = do_dma_request(req, xfer, sync, nents); |
3002 | diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
3003 | index bcc1694cebcd..635cfa1f2ace 100644 |
3004 | --- a/drivers/scsi/scsi_lib.c |
3005 | +++ b/drivers/scsi/scsi_lib.c |
3006 | @@ -2126,11 +2126,13 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) |
3007 | q->limits.cluster = 0; |
3008 | |
3009 | /* |
3010 | - * set a reasonable default alignment on word boundaries: the |
3011 | - * host and device may alter it using |
3012 | - * blk_queue_update_dma_alignment() later. |
3013 | + * Set a reasonable default alignment: The larger of 32-byte (dword), |
3014 | + * which is a common minimum for HBAs, and the minimum DMA alignment, |
3015 | + * which is set by the platform. |
3016 | + * |
3017 | + * Devices that require a bigger alignment can increase it later. |
3018 | */ |
3019 | - blk_queue_dma_alignment(q, 0x03); |
3020 | + blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1); |
3021 | } |
3022 | EXPORT_SYMBOL_GPL(__scsi_init_queue); |
3023 | |
3024 | diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c |
3025 | index 302018d67efa..7f785d77ba7f 100644 |
3026 | --- a/drivers/tty/serdev/serdev-ttyport.c |
3027 | +++ b/drivers/tty/serdev/serdev-ttyport.c |
3028 | @@ -35,23 +35,41 @@ static int ttyport_receive_buf(struct tty_port *port, const unsigned char *cp, |
3029 | { |
3030 | struct serdev_controller *ctrl = port->client_data; |
3031 | struct serport *serport = serdev_controller_get_drvdata(ctrl); |
3032 | + int ret; |
3033 | |
3034 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
3035 | return 0; |
3036 | |
3037 | - return serdev_controller_receive_buf(ctrl, cp, count); |
3038 | + ret = serdev_controller_receive_buf(ctrl, cp, count); |
3039 | + |
3040 | + dev_WARN_ONCE(&ctrl->dev, ret < 0 || ret > count, |
3041 | + "receive_buf returns %d (count = %zu)\n", |
3042 | + ret, count); |
3043 | + if (ret < 0) |
3044 | + return 0; |
3045 | + else if (ret > count) |
3046 | + return count; |
3047 | + |
3048 | + return ret; |
3049 | } |
3050 | |
3051 | static void ttyport_write_wakeup(struct tty_port *port) |
3052 | { |
3053 | struct serdev_controller *ctrl = port->client_data; |
3054 | struct serport *serport = serdev_controller_get_drvdata(ctrl); |
3055 | + struct tty_struct *tty; |
3056 | + |
3057 | + tty = tty_port_tty_get(port); |
3058 | + if (!tty) |
3059 | + return; |
3060 | |
3061 | - if (test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &port->tty->flags) && |
3062 | + if (test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && |
3063 | test_bit(SERPORT_ACTIVE, &serport->flags)) |
3064 | serdev_controller_write_wakeup(ctrl); |
3065 | |
3066 | - wake_up_interruptible_poll(&port->tty->write_wait, POLLOUT); |
3067 | + wake_up_interruptible_poll(&tty->write_wait, POLLOUT); |
3068 | + |
3069 | + tty_kref_put(tty); |
3070 | } |
3071 | |
3072 | static const struct tty_port_client_operations client_ops = { |
3073 | @@ -131,8 +149,10 @@ static void ttyport_close(struct serdev_controller *ctrl) |
3074 | |
3075 | clear_bit(SERPORT_ACTIVE, &serport->flags); |
3076 | |
3077 | + tty_lock(tty); |
3078 | if (tty->ops->close) |
3079 | tty->ops->close(tty, NULL); |
3080 | + tty_unlock(tty); |
3081 | |
3082 | tty_release_struct(tty, serport->tty_idx); |
3083 | } |
3084 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
3085 | index ef8f7d63a8f0..0202e5132fa7 100644 |
3086 | --- a/drivers/usb/gadget/function/f_fs.c |
3087 | +++ b/drivers/usb/gadget/function/f_fs.c |
3088 | @@ -2286,9 +2286,18 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, |
3089 | int i; |
3090 | |
3091 | if (len < sizeof(*d) || |
3092 | - d->bFirstInterfaceNumber >= ffs->interfaces_count || |
3093 | - !d->Reserved1) |
3094 | + d->bFirstInterfaceNumber >= ffs->interfaces_count) |
3095 | return -EINVAL; |
3096 | + if (d->Reserved1 != 1) { |
3097 | + /* |
3098 | + * According to the spec, Reserved1 must be set to 1 |
3099 | + * but older kernels incorrectly rejected non-zero |
3100 | + * values. We fix it here to avoid returning EINVAL |
3101 | + * in response to values we used to accept. |
3102 | + */ |
3103 | + pr_debug("usb_ext_compat_desc::Reserved1 forced to 1\n"); |
3104 | + d->Reserved1 = 1; |
3105 | + } |
3106 | for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) |
3107 | if (d->Reserved2[i]) |
3108 | return -EINVAL; |
3109 | diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c |
3110 | index d41d07aae0ce..def1b05ffca0 100644 |
3111 | --- a/drivers/usb/gadget/udc/core.c |
3112 | +++ b/drivers/usb/gadget/udc/core.c |
3113 | @@ -1080,8 +1080,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc) |
3114 | static inline void usb_gadget_udc_set_speed(struct usb_udc *udc, |
3115 | enum usb_device_speed speed) |
3116 | { |
3117 | - if (udc->gadget->ops->udc_set_speed) |
3118 | - udc->gadget->ops->udc_set_speed(udc->gadget, speed); |
3119 | + if (udc->gadget->ops->udc_set_speed) { |
3120 | + enum usb_device_speed s; |
3121 | + |
3122 | + s = min(speed, udc->gadget->max_speed); |
3123 | + udc->gadget->ops->udc_set_speed(udc->gadget, s); |
3124 | + } |
3125 | } |
3126 | |
3127 | /** |
3128 | diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
3129 | index 63a206122058..6b3e8adb64e6 100644 |
3130 | --- a/drivers/usb/gadget/udc/renesas_usb3.c |
3131 | +++ b/drivers/usb/gadget/udc/renesas_usb3.c |
3132 | @@ -254,7 +254,7 @@ |
3133 | #define USB3_EP0_SS_MAX_PACKET_SIZE 512 |
3134 | #define USB3_EP0_HSFS_MAX_PACKET_SIZE 64 |
3135 | #define USB3_EP0_BUF_SIZE 8 |
3136 | -#define USB3_MAX_NUM_PIPES 30 |
3137 | +#define USB3_MAX_NUM_PIPES 6 /* This includes PIPE 0 */ |
3138 | #define USB3_WAIT_US 3 |
3139 | #define USB3_DMA_NUM_SETTING_AREA 4 |
3140 | /* |
3141 | diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c |
3142 | index 48230a5e12f2..bf7ff3934d7f 100644 |
3143 | --- a/drivers/virtio/virtio.c |
3144 | +++ b/drivers/virtio/virtio.c |
3145 | @@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev) |
3146 | /* device_register() causes the bus infrastructure to look for a |
3147 | * matching driver. */ |
3148 | err = device_register(&dev->dev); |
3149 | + if (err) |
3150 | + ida_simple_remove(&virtio_index_ida, dev->index); |
3151 | out: |
3152 | if (err) |
3153 | virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); |
3154 | diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
3155 | index 782d4d05a53b..c7475867a52b 100644 |
3156 | --- a/fs/afs/cmservice.c |
3157 | +++ b/fs/afs/cmservice.c |
3158 | @@ -127,6 +127,9 @@ bool afs_cm_incoming_call(struct afs_call *call) |
3159 | case CBProbe: |
3160 | call->type = &afs_SRXCBProbe; |
3161 | return true; |
3162 | + case CBProbeUuid: |
3163 | + call->type = &afs_SRXCBProbeUuid; |
3164 | + return true; |
3165 | case CBTellMeAboutYourself: |
3166 | call->type = &afs_SRXCBTellMeAboutYourself; |
3167 | return true; |
3168 | diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
3169 | index 0bf191f0dbaf..9f715c3edcf9 100644 |
3170 | --- a/fs/afs/rxrpc.c |
3171 | +++ b/fs/afs/rxrpc.c |
3172 | @@ -377,8 +377,17 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp, |
3173 | */ |
3174 | tx_total_len = call->request_size; |
3175 | if (call->send_pages) { |
3176 | - tx_total_len += call->last_to - call->first_offset; |
3177 | - tx_total_len += (call->last - call->first) * PAGE_SIZE; |
3178 | + if (call->last == call->first) { |
3179 | + tx_total_len += call->last_to - call->first_offset; |
3180 | + } else { |
3181 | + /* It looks mathematically like you should be able to |
3182 | + * combine the following lines with the ones above, but |
3183 | + * unsigned arithmetic is fun when it wraps... |
3184 | + */ |
3185 | + tx_total_len += PAGE_SIZE - call->first_offset; |
3186 | + tx_total_len += call->last_to; |
3187 | + tx_total_len += (call->last - call->first - 1) * PAGE_SIZE; |
3188 | + } |
3189 | } |
3190 | |
3191 | /* create a call */ |
3192 | diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
3193 | index 6d49db7d86be..e2bb2a065741 100644 |
3194 | --- a/fs/btrfs/ctree.c |
3195 | +++ b/fs/btrfs/ctree.c |
3196 | @@ -1032,14 +1032,17 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, |
3197 | root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && |
3198 | !(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF)) { |
3199 | ret = btrfs_inc_ref(trans, root, buf, 1); |
3200 | - BUG_ON(ret); /* -ENOMEM */ |
3201 | + if (ret) |
3202 | + return ret; |
3203 | |
3204 | if (root->root_key.objectid == |
3205 | BTRFS_TREE_RELOC_OBJECTID) { |
3206 | ret = btrfs_dec_ref(trans, root, buf, 0); |
3207 | - BUG_ON(ret); /* -ENOMEM */ |
3208 | + if (ret) |
3209 | + return ret; |
3210 | ret = btrfs_inc_ref(trans, root, cow, 1); |
3211 | - BUG_ON(ret); /* -ENOMEM */ |
3212 | + if (ret) |
3213 | + return ret; |
3214 | } |
3215 | new_flags |= BTRFS_BLOCK_FLAG_FULL_BACKREF; |
3216 | } else { |
3217 | @@ -1049,7 +1052,8 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, |
3218 | ret = btrfs_inc_ref(trans, root, cow, 1); |
3219 | else |
3220 | ret = btrfs_inc_ref(trans, root, cow, 0); |
3221 | - BUG_ON(ret); /* -ENOMEM */ |
3222 | + if (ret) |
3223 | + return ret; |
3224 | } |
3225 | if (new_flags != 0) { |
3226 | int level = btrfs_header_level(buf); |
3227 | @@ -1068,9 +1072,11 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, |
3228 | ret = btrfs_inc_ref(trans, root, cow, 1); |
3229 | else |
3230 | ret = btrfs_inc_ref(trans, root, cow, 0); |
3231 | - BUG_ON(ret); /* -ENOMEM */ |
3232 | + if (ret) |
3233 | + return ret; |
3234 | ret = btrfs_dec_ref(trans, root, buf, 1); |
3235 | - BUG_ON(ret); /* -ENOMEM */ |
3236 | + if (ret) |
3237 | + return ret; |
3238 | } |
3239 | clean_tree_block(fs_info, buf); |
3240 | *last_ref = 1; |
3241 | diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
3242 | index e4774c02d922..d227d8514b25 100644 |
3243 | --- a/fs/btrfs/extent-tree.c |
3244 | +++ b/fs/btrfs/extent-tree.c |
3245 | @@ -9283,6 +9283,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, |
3246 | ret = btrfs_del_root(trans, fs_info, &root->root_key); |
3247 | if (ret) { |
3248 | btrfs_abort_transaction(trans, ret); |
3249 | + err = ret; |
3250 | goto out_end_trans; |
3251 | } |
3252 | |
3253 | diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
3254 | index 6ce467872376..b8372095ba0a 100644 |
3255 | --- a/fs/f2fs/file.c |
3256 | +++ b/fs/f2fs/file.c |
3257 | @@ -2697,6 +2697,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
3258 | |
3259 | err = f2fs_preallocate_blocks(iocb, from); |
3260 | if (err) { |
3261 | + clear_inode_flag(inode, FI_NO_PREALLOC); |
3262 | inode_unlock(inode); |
3263 | return err; |
3264 | } |
3265 | diff --git a/fs/fcntl.c b/fs/fcntl.c |
3266 | index 8d78ffd7b399..6fd311367efc 100644 |
3267 | --- a/fs/fcntl.c |
3268 | +++ b/fs/fcntl.c |
3269 | @@ -632,9 +632,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, |
3270 | if (err) |
3271 | break; |
3272 | err = fixup_compat_flock(&flock); |
3273 | - if (err) |
3274 | - return err; |
3275 | - err = put_compat_flock(&flock, compat_ptr(arg)); |
3276 | + if (!err) |
3277 | + err = put_compat_flock(&flock, compat_ptr(arg)); |
3278 | break; |
3279 | case F_GETLK64: |
3280 | case F_OFD_GETLK: |
3281 | diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
3282 | index b03b3bc05f96..bf2c43635062 100644 |
3283 | --- a/fs/nfs/dir.c |
3284 | +++ b/fs/nfs/dir.c |
3285 | @@ -2064,7 +2064,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3286 | * should mark the directories for revalidation. |
3287 | */ |
3288 | d_move(old_dentry, new_dentry); |
3289 | - nfs_set_verifier(new_dentry, |
3290 | + nfs_set_verifier(old_dentry, |
3291 | nfs_save_change_attribute(new_dir)); |
3292 | } else if (error == -ENOENT) |
3293 | nfs_dentry_handle_enoent(old_dentry); |
3294 | diff --git a/fs/pipe.c b/fs/pipe.c |
3295 | index 349c9d56d4b3..3909c55ed389 100644 |
3296 | --- a/fs/pipe.c |
3297 | +++ b/fs/pipe.c |
3298 | @@ -1125,7 +1125,7 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, |
3299 | { |
3300 | int ret; |
3301 | |
3302 | - ret = proc_dointvec_minmax(table, write, buf, lenp, ppos); |
3303 | + ret = proc_douintvec_minmax(table, write, buf, lenp, ppos); |
3304 | if (ret < 0 || !write) |
3305 | return ret; |
3306 | |
3307 | diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
3308 | index 4ec5b7f45401..63350906961a 100644 |
3309 | --- a/fs/xfs/xfs_inode.c |
3310 | +++ b/fs/xfs/xfs_inode.c |
3311 | @@ -2378,6 +2378,7 @@ xfs_ifree_cluster( |
3312 | */ |
3313 | if (ip->i_ino != inum + i) { |
3314 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
3315 | + rcu_read_unlock(); |
3316 | continue; |
3317 | } |
3318 | } |
3319 | diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
3320 | index 7653ea66874d..46930f82a988 100644 |
3321 | --- a/include/linux/dma-mapping.h |
3322 | +++ b/include/linux/dma-mapping.h |
3323 | @@ -697,7 +697,6 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size, |
3324 | return ret; |
3325 | } |
3326 | |
3327 | -#ifdef CONFIG_HAS_DMA |
3328 | static inline int dma_get_cache_alignment(void) |
3329 | { |
3330 | #ifdef ARCH_DMA_MINALIGN |
3331 | @@ -705,7 +704,6 @@ static inline int dma_get_cache_alignment(void) |
3332 | #endif |
3333 | return 1; |
3334 | } |
3335 | -#endif |
3336 | |
3337 | /* flags for the coherent memory api */ |
3338 | #define DMA_MEMORY_EXCLUSIVE 0x01 |
3339 | diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h |
3340 | index 6dfec4d638df..872f930f1b06 100644 |
3341 | --- a/include/linux/genalloc.h |
3342 | +++ b/include/linux/genalloc.h |
3343 | @@ -32,6 +32,7 @@ |
3344 | |
3345 | #include <linux/types.h> |
3346 | #include <linux/spinlock_types.h> |
3347 | +#include <linux/atomic.h> |
3348 | |
3349 | struct device; |
3350 | struct device_node; |
3351 | @@ -71,7 +72,7 @@ struct gen_pool { |
3352 | */ |
3353 | struct gen_pool_chunk { |
3354 | struct list_head next_chunk; /* next chunk in pool */ |
3355 | - atomic_t avail; |
3356 | + atomic_long_t avail; |
3357 | phys_addr_t phys_addr; /* physical starting address of memory chunk */ |
3358 | unsigned long start_addr; /* start address of memory chunk */ |
3359 | unsigned long end_addr; /* end address of memory chunk (inclusive) */ |
3360 | diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h |
3361 | index 6431087816ba..ba74eaa8eadf 100644 |
3362 | --- a/include/linux/hyperv.h |
3363 | +++ b/include/linux/hyperv.h |
3364 | @@ -708,6 +708,7 @@ struct vmbus_channel { |
3365 | u8 monitor_bit; |
3366 | |
3367 | bool rescind; /* got rescind msg */ |
3368 | + struct completion rescind_event; |
3369 | |
3370 | u32 ringbuffer_gpadlhandle; |
3371 | |
3372 | diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h |
3373 | index 34d59bfdce2d..464458d20b16 100644 |
3374 | --- a/include/linux/iio/timer/stm32-lptim-trigger.h |
3375 | +++ b/include/linux/iio/timer/stm32-lptim-trigger.h |
3376 | @@ -16,11 +16,14 @@ |
3377 | #define LPTIM2_OUT "lptim2_out" |
3378 | #define LPTIM3_OUT "lptim3_out" |
3379 | |
3380 | -#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER) |
3381 | +#if IS_REACHABLE(CONFIG_IIO_STM32_LPTIMER_TRIGGER) |
3382 | bool is_stm32_lptim_trigger(struct iio_trigger *trig); |
3383 | #else |
3384 | static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig) |
3385 | { |
3386 | +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER) |
3387 | + pr_warn_once("stm32 lptim_trigger not linked in\n"); |
3388 | +#endif |
3389 | return false; |
3390 | } |
3391 | #endif |
3392 | diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h |
3393 | index e32dfe098e82..40839c02d28c 100644 |
3394 | --- a/include/linux/sysfs.h |
3395 | +++ b/include/linux/sysfs.h |
3396 | @@ -117,6 +117,12 @@ struct attribute_group { |
3397 | .show = _name##_show, \ |
3398 | } |
3399 | |
3400 | +#define __ATTR_RO_MODE(_name, _mode) { \ |
3401 | + .attr = { .name = __stringify(_name), \ |
3402 | + .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ |
3403 | + .show = _name##_show, \ |
3404 | +} |
3405 | + |
3406 | #define __ATTR_WO(_name) { \ |
3407 | .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \ |
3408 | .store = _name##_store, \ |
3409 | diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h |
3410 | index 6c0dc6155ee7..a966d281dedc 100644 |
3411 | --- a/include/scsi/libsas.h |
3412 | +++ b/include/scsi/libsas.h |
3413 | @@ -165,11 +165,11 @@ struct expander_device { |
3414 | |
3415 | struct sata_device { |
3416 | unsigned int class; |
3417 | - struct smp_resp rps_resp; /* report_phy_sata_resp */ |
3418 | u8 port_no; /* port number, if this is a PM (Port) */ |
3419 | |
3420 | struct ata_port *ap; |
3421 | struct ata_host ata_host; |
3422 | + struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ |
3423 | u8 fis[ATA_RESP_FIS_SIZE]; |
3424 | }; |
3425 | |
3426 | diff --git a/kernel/bpf/percpu_freelist.c b/kernel/bpf/percpu_freelist.c |
3427 | index 5c51d1985b51..673fa6fe2d73 100644 |
3428 | --- a/kernel/bpf/percpu_freelist.c |
3429 | +++ b/kernel/bpf/percpu_freelist.c |
3430 | @@ -78,8 +78,10 @@ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
3431 | { |
3432 | struct pcpu_freelist_head *head; |
3433 | struct pcpu_freelist_node *node; |
3434 | + unsigned long flags; |
3435 | int orig_cpu, cpu; |
3436 | |
3437 | + local_irq_save(flags); |
3438 | orig_cpu = cpu = raw_smp_processor_id(); |
3439 | while (1) { |
3440 | head = per_cpu_ptr(s->freelist, cpu); |
3441 | @@ -87,14 +89,16 @@ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
3442 | node = head->first; |
3443 | if (node) { |
3444 | head->first = node->next; |
3445 | - raw_spin_unlock(&head->lock); |
3446 | + raw_spin_unlock_irqrestore(&head->lock, flags); |
3447 | return node; |
3448 | } |
3449 | raw_spin_unlock(&head->lock); |
3450 | cpu = cpumask_next(cpu, cpu_possible_mask); |
3451 | if (cpu >= nr_cpu_ids) |
3452 | cpu = 0; |
3453 | - if (cpu == orig_cpu) |
3454 | + if (cpu == orig_cpu) { |
3455 | + local_irq_restore(flags); |
3456 | return NULL; |
3457 | + } |
3458 | } |
3459 | } |
3460 | diff --git a/kernel/cpu.c b/kernel/cpu.c |
3461 | index 04892a82f6ac..7891aecc6aec 100644 |
3462 | --- a/kernel/cpu.c |
3463 | +++ b/kernel/cpu.c |
3464 | @@ -1289,11 +1289,6 @@ static struct cpuhp_step cpuhp_bp_states[] = { |
3465 | .teardown.single = NULL, |
3466 | .cant_stop = true, |
3467 | }, |
3468 | - [CPUHP_AP_SMPCFD_DYING] = { |
3469 | - .name = "smpcfd:dying", |
3470 | - .startup.single = NULL, |
3471 | - .teardown.single = smpcfd_dying_cpu, |
3472 | - }, |
3473 | /* |
3474 | * Handled on controll processor until the plugged processor manages |
3475 | * this itself. |
3476 | @@ -1335,6 +1330,11 @@ static struct cpuhp_step cpuhp_ap_states[] = { |
3477 | .startup.single = NULL, |
3478 | .teardown.single = rcutree_dying_cpu, |
3479 | }, |
3480 | + [CPUHP_AP_SMPCFD_DYING] = { |
3481 | + .name = "smpcfd:dying", |
3482 | + .startup.single = NULL, |
3483 | + .teardown.single = smpcfd_dying_cpu, |
3484 | + }, |
3485 | /* Entry state on starting. Interrupts enabled from here on. Transient |
3486 | * state for synchronsization */ |
3487 | [CPUHP_AP_ONLINE] = { |
3488 | diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c |
3489 | index e74be38245ad..ed5d34925ad0 100644 |
3490 | --- a/kernel/debug/kdb/kdb_io.c |
3491 | +++ b/kernel/debug/kdb/kdb_io.c |
3492 | @@ -350,7 +350,7 @@ static char *kdb_read(char *buffer, size_t bufsize) |
3493 | } |
3494 | kdb_printf("\n"); |
3495 | for (i = 0; i < count; i++) { |
3496 | - if (kallsyms_symbol_next(p_tmp, i) < 0) |
3497 | + if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) |
3498 | break; |
3499 | kdb_printf("%s ", p_tmp); |
3500 | *(p_tmp + len) = '\0'; |
3501 | diff --git a/kernel/jump_label.c b/kernel/jump_label.c |
3502 | index 0bf2e8f5244a..7c3774ac1d51 100644 |
3503 | --- a/kernel/jump_label.c |
3504 | +++ b/kernel/jump_label.c |
3505 | @@ -769,7 +769,7 @@ static __init int jump_label_test(void) |
3506 | |
3507 | return 0; |
3508 | } |
3509 | -late_initcall(jump_label_test); |
3510 | +early_initcall(jump_label_test); |
3511 | #endif /* STATIC_KEYS_SELFTEST */ |
3512 | |
3513 | #endif /* HAVE_JUMP_LABEL */ |
3514 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
3515 | index d9c31bc2eaea..56aca862c4f5 100644 |
3516 | --- a/kernel/sysctl.c |
3517 | +++ b/kernel/sysctl.c |
3518 | @@ -1822,7 +1822,7 @@ static struct ctl_table fs_table[] = { |
3519 | { |
3520 | .procname = "pipe-max-size", |
3521 | .data = &pipe_max_size, |
3522 | - .maxlen = sizeof(int), |
3523 | + .maxlen = sizeof(pipe_max_size), |
3524 | .mode = 0644, |
3525 | .proc_handler = &pipe_proc_fn, |
3526 | .extra1 = &pipe_min_size, |
3527 | diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c |
3528 | index 1ef0cec38d78..dc14beae2c9a 100644 |
3529 | --- a/lib/asn1_decoder.c |
3530 | +++ b/lib/asn1_decoder.c |
3531 | @@ -313,42 +313,47 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder, |
3532 | |
3533 | /* Decide how to handle the operation */ |
3534 | switch (op) { |
3535 | - case ASN1_OP_MATCH_ANY_ACT: |
3536 | - case ASN1_OP_MATCH_ANY_ACT_OR_SKIP: |
3537 | - case ASN1_OP_COND_MATCH_ANY_ACT: |
3538 | - case ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP: |
3539 | - ret = actions[machine[pc + 1]](context, hdr, tag, data + dp, len); |
3540 | - if (ret < 0) |
3541 | - return ret; |
3542 | - goto skip_data; |
3543 | - |
3544 | - case ASN1_OP_MATCH_ACT: |
3545 | - case ASN1_OP_MATCH_ACT_OR_SKIP: |
3546 | - case ASN1_OP_COND_MATCH_ACT_OR_SKIP: |
3547 | - ret = actions[machine[pc + 2]](context, hdr, tag, data + dp, len); |
3548 | - if (ret < 0) |
3549 | - return ret; |
3550 | - goto skip_data; |
3551 | - |
3552 | case ASN1_OP_MATCH: |
3553 | case ASN1_OP_MATCH_OR_SKIP: |
3554 | + case ASN1_OP_MATCH_ACT: |
3555 | + case ASN1_OP_MATCH_ACT_OR_SKIP: |
3556 | case ASN1_OP_MATCH_ANY: |
3557 | case ASN1_OP_MATCH_ANY_OR_SKIP: |
3558 | + case ASN1_OP_MATCH_ANY_ACT: |
3559 | + case ASN1_OP_MATCH_ANY_ACT_OR_SKIP: |
3560 | case ASN1_OP_COND_MATCH_OR_SKIP: |
3561 | + case ASN1_OP_COND_MATCH_ACT_OR_SKIP: |
3562 | case ASN1_OP_COND_MATCH_ANY: |
3563 | case ASN1_OP_COND_MATCH_ANY_OR_SKIP: |
3564 | - skip_data: |
3565 | + case ASN1_OP_COND_MATCH_ANY_ACT: |
3566 | + case ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP: |
3567 | + |
3568 | if (!(flags & FLAG_CONS)) { |
3569 | if (flags & FLAG_INDEFINITE_LENGTH) { |
3570 | + size_t tmp = dp; |
3571 | + |
3572 | ret = asn1_find_indefinite_length( |
3573 | - data, datalen, &dp, &len, &errmsg); |
3574 | + data, datalen, &tmp, &len, &errmsg); |
3575 | if (ret < 0) |
3576 | goto error; |
3577 | - } else { |
3578 | - dp += len; |
3579 | } |
3580 | pr_debug("- LEAF: %zu\n", len); |
3581 | } |
3582 | + |
3583 | + if (op & ASN1_OP_MATCH__ACT) { |
3584 | + unsigned char act; |
3585 | + |
3586 | + if (op & ASN1_OP_MATCH__ANY) |
3587 | + act = machine[pc + 1]; |
3588 | + else |
3589 | + act = machine[pc + 2]; |
3590 | + ret = actions[act](context, hdr, tag, data + dp, len); |
3591 | + if (ret < 0) |
3592 | + return ret; |
3593 | + } |
3594 | + |
3595 | + if (!(flags & FLAG_CONS)) |
3596 | + dp += len; |
3597 | pc += asn1_op_lengths[op]; |
3598 | goto next_op; |
3599 | |
3600 | @@ -434,6 +439,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder, |
3601 | else |
3602 | act = machine[pc + 1]; |
3603 | ret = actions[act](context, hdr, 0, data + tdp, len); |
3604 | + if (ret < 0) |
3605 | + return ret; |
3606 | } |
3607 | pc += asn1_op_lengths[op]; |
3608 | goto next_op; |
3609 | diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
3610 | index da796e2dc4f5..c7c96bc7654a 100644 |
3611 | --- a/lib/dynamic_debug.c |
3612 | +++ b/lib/dynamic_debug.c |
3613 | @@ -360,6 +360,10 @@ static int ddebug_parse_query(char *words[], int nwords, |
3614 | if (parse_lineno(last, &query->last_lineno) < 0) |
3615 | return -EINVAL; |
3616 | |
3617 | + /* special case for last lineno not specified */ |
3618 | + if (query->last_lineno == 0) |
3619 | + query->last_lineno = UINT_MAX; |
3620 | + |
3621 | if (query->last_lineno < query->first_lineno) { |
3622 | pr_err("last-line:%d < 1st-line:%d\n", |
3623 | query->last_lineno, |
3624 | diff --git a/lib/genalloc.c b/lib/genalloc.c |
3625 | index 144fe6b1a03e..ca06adc4f445 100644 |
3626 | --- a/lib/genalloc.c |
3627 | +++ b/lib/genalloc.c |
3628 | @@ -194,7 +194,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy |
3629 | chunk->phys_addr = phys; |
3630 | chunk->start_addr = virt; |
3631 | chunk->end_addr = virt + size - 1; |
3632 | - atomic_set(&chunk->avail, size); |
3633 | + atomic_long_set(&chunk->avail, size); |
3634 | |
3635 | spin_lock(&pool->lock); |
3636 | list_add_rcu(&chunk->next_chunk, &pool->chunks); |
3637 | @@ -304,7 +304,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, |
3638 | nbits = (size + (1UL << order) - 1) >> order; |
3639 | rcu_read_lock(); |
3640 | list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { |
3641 | - if (size > atomic_read(&chunk->avail)) |
3642 | + if (size > atomic_long_read(&chunk->avail)) |
3643 | continue; |
3644 | |
3645 | start_bit = 0; |
3646 | @@ -324,7 +324,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, |
3647 | |
3648 | addr = chunk->start_addr + ((unsigned long)start_bit << order); |
3649 | size = nbits << order; |
3650 | - atomic_sub(size, &chunk->avail); |
3651 | + atomic_long_sub(size, &chunk->avail); |
3652 | break; |
3653 | } |
3654 | rcu_read_unlock(); |
3655 | @@ -390,7 +390,7 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size) |
3656 | remain = bitmap_clear_ll(chunk->bits, start_bit, nbits); |
3657 | BUG_ON(remain); |
3658 | size = nbits << order; |
3659 | - atomic_add(size, &chunk->avail); |
3660 | + atomic_long_add(size, &chunk->avail); |
3661 | rcu_read_unlock(); |
3662 | return; |
3663 | } |
3664 | @@ -464,7 +464,7 @@ size_t gen_pool_avail(struct gen_pool *pool) |
3665 | |
3666 | rcu_read_lock(); |
3667 | list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) |
3668 | - avail += atomic_read(&chunk->avail); |
3669 | + avail += atomic_long_read(&chunk->avail); |
3670 | rcu_read_unlock(); |
3671 | return avail; |
3672 | } |
3673 | diff --git a/mm/slub.c b/mm/slub.c |
3674 | index 1efbb8123037..8e1c027a30f4 100644 |
3675 | --- a/mm/slub.c |
3676 | +++ b/mm/slub.c |
3677 | @@ -5704,6 +5704,10 @@ static int sysfs_slab_add(struct kmem_cache *s) |
3678 | return 0; |
3679 | } |
3680 | |
3681 | + if (!unmergeable && disable_higher_order_debug && |
3682 | + (slub_debug & DEBUG_METADATA_FLAGS)) |
3683 | + unmergeable = 1; |
3684 | + |
3685 | if (unmergeable) { |
3686 | /* |
3687 | * Slabcache can never be merged so we can use the name proper. |
3688 | diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c |
3689 | index 7c38e850a8fc..685049a9048d 100644 |
3690 | --- a/mm/zsmalloc.c |
3691 | +++ b/mm/zsmalloc.c |
3692 | @@ -1349,7 +1349,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, |
3693 | * pools/users, we can't allow mapping in interrupt context |
3694 | * because it can corrupt another users mappings. |
3695 | */ |
3696 | - WARN_ON_ONCE(in_interrupt()); |
3697 | + BUG_ON(in_interrupt()); |
3698 | |
3699 | /* From now on, migration cannot move the object */ |
3700 | pin_tag(handle); |
3701 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
3702 | index 3d9f1c2f81c5..647cfc972bde 100644 |
3703 | --- a/net/ipv4/route.c |
3704 | +++ b/net/ipv4/route.c |
3705 | @@ -651,9 +651,12 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3706 | struct fnhe_hash_bucket *hash; |
3707 | struct fib_nh_exception *fnhe; |
3708 | struct rtable *rt; |
3709 | + u32 genid, hval; |
3710 | unsigned int i; |
3711 | int depth; |
3712 | - u32 hval = fnhe_hashfun(daddr); |
3713 | + |
3714 | + genid = fnhe_genid(dev_net(nh->nh_dev)); |
3715 | + hval = fnhe_hashfun(daddr); |
3716 | |
3717 | spin_lock_bh(&fnhe_lock); |
3718 | |
3719 | @@ -676,12 +679,13 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3720 | } |
3721 | |
3722 | if (fnhe) { |
3723 | + if (fnhe->fnhe_genid != genid) |
3724 | + fnhe->fnhe_genid = genid; |
3725 | if (gw) |
3726 | fnhe->fnhe_gw = gw; |
3727 | - if (pmtu) { |
3728 | + if (pmtu) |
3729 | fnhe->fnhe_pmtu = pmtu; |
3730 | - fnhe->fnhe_expires = max(1UL, expires); |
3731 | - } |
3732 | + fnhe->fnhe_expires = max(1UL, expires); |
3733 | /* Update all cached dsts too */ |
3734 | rt = rcu_dereference(fnhe->fnhe_rth_input); |
3735 | if (rt) |
3736 | @@ -700,7 +704,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3737 | fnhe->fnhe_next = hash->chain; |
3738 | rcu_assign_pointer(hash->chain, fnhe); |
3739 | } |
3740 | - fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev)); |
3741 | + fnhe->fnhe_genid = genid; |
3742 | fnhe->fnhe_daddr = daddr; |
3743 | fnhe->fnhe_gw = gw; |
3744 | fnhe->fnhe_pmtu = pmtu; |
3745 | diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
3746 | index 59c121b932ac..5d6bee070871 100644 |
3747 | --- a/net/ipv6/ip6_gre.c |
3748 | +++ b/net/ipv6/ip6_gre.c |
3749 | @@ -461,7 +461,7 @@ static int ip6gre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi) |
3750 | &ipv6h->saddr, &ipv6h->daddr, tpi->key, |
3751 | tpi->proto); |
3752 | if (tunnel) { |
3753 | - ip6_tnl_rcv(tunnel, skb, tpi, NULL, false); |
3754 | + ip6_tnl_rcv(tunnel, skb, tpi, NULL, log_ecn_error); |
3755 | |
3756 | return PACKET_RCVD; |
3757 | } |
3758 | diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
3759 | index 6f45d1713452..14c28fbfe6b8 100644 |
3760 | --- a/net/sctp/socket.c |
3761 | +++ b/net/sctp/socket.c |
3762 | @@ -83,8 +83,8 @@ |
3763 | /* Forward declarations for internal helper functions. */ |
3764 | static int sctp_writeable(struct sock *sk); |
3765 | static void sctp_wfree(struct sk_buff *skb); |
3766 | -static int sctp_wait_for_sndbuf(struct sctp_association *, long *timeo_p, |
3767 | - size_t msg_len); |
3768 | +static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3769 | + size_t msg_len, struct sock **orig_sk); |
3770 | static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p); |
3771 | static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p); |
3772 | static int sctp_wait_for_accept(struct sock *sk, long timeo); |
3773 | @@ -1962,9 +1962,16 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) |
3774 | |
3775 | timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); |
3776 | if (!sctp_wspace(asoc)) { |
3777 | - err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); |
3778 | - if (err) |
3779 | + /* sk can be changed by peel off when waiting for buf. */ |
3780 | + err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len, &sk); |
3781 | + if (err) { |
3782 | + if (err == -ESRCH) { |
3783 | + /* asoc is already dead. */ |
3784 | + new_asoc = NULL; |
3785 | + err = -EPIPE; |
3786 | + } |
3787 | goto out_free; |
3788 | + } |
3789 | } |
3790 | |
3791 | /* If an address is passed with the sendto/sendmsg call, it is used |
3792 | @@ -4943,12 +4950,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) |
3793 | if (!asoc) |
3794 | return -EINVAL; |
3795 | |
3796 | - /* If there is a thread waiting on more sndbuf space for |
3797 | - * sending on this asoc, it cannot be peeled. |
3798 | - */ |
3799 | - if (waitqueue_active(&asoc->wait)) |
3800 | - return -EBUSY; |
3801 | - |
3802 | /* An association cannot be branched off from an already peeled-off |
3803 | * socket, nor is this supported for tcp style sockets. |
3804 | */ |
3805 | @@ -7822,7 +7823,7 @@ void sctp_sock_rfree(struct sk_buff *skb) |
3806 | |
3807 | /* Helper function to wait for space in the sndbuf. */ |
3808 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3809 | - size_t msg_len) |
3810 | + size_t msg_len, struct sock **orig_sk) |
3811 | { |
3812 | struct sock *sk = asoc->base.sk; |
3813 | int err = 0; |
3814 | @@ -7839,10 +7840,11 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3815 | for (;;) { |
3816 | prepare_to_wait_exclusive(&asoc->wait, &wait, |
3817 | TASK_INTERRUPTIBLE); |
3818 | + if (asoc->base.dead) |
3819 | + goto do_dead; |
3820 | if (!*timeo_p) |
3821 | goto do_nonblock; |
3822 | - if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING || |
3823 | - asoc->base.dead) |
3824 | + if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING) |
3825 | goto do_error; |
3826 | if (signal_pending(current)) |
3827 | goto do_interrupted; |
3828 | @@ -7855,11 +7857,17 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3829 | release_sock(sk); |
3830 | current_timeo = schedule_timeout(current_timeo); |
3831 | lock_sock(sk); |
3832 | + if (sk != asoc->base.sk) { |
3833 | + release_sock(sk); |
3834 | + sk = asoc->base.sk; |
3835 | + lock_sock(sk); |
3836 | + } |
3837 | |
3838 | *timeo_p = current_timeo; |
3839 | } |
3840 | |
3841 | out: |
3842 | + *orig_sk = sk; |
3843 | finish_wait(&asoc->wait, &wait); |
3844 | |
3845 | /* Release the association's refcnt. */ |
3846 | @@ -7867,6 +7875,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3847 | |
3848 | return err; |
3849 | |
3850 | +do_dead: |
3851 | + err = -ESRCH; |
3852 | + goto out; |
3853 | + |
3854 | do_error: |
3855 | err = -EPIPE; |
3856 | goto out; |
3857 | diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
3858 | index 413e3868fbf3..7166e7ecbe86 100644 |
3859 | --- a/net/smc/smc_core.c |
3860 | +++ b/net/smc/smc_core.c |
3861 | @@ -571,7 +571,7 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_rmb) |
3862 | /* use socket send buffer size (w/o overhead) as start value */ |
3863 | sk_buf_size = smc->sk.sk_sndbuf / 2; |
3864 | |
3865 | - for (bufsize_short = smc_compress_bufsize(smc->sk.sk_sndbuf / 2); |
3866 | + for (bufsize_short = smc_compress_bufsize(sk_buf_size); |
3867 | bufsize_short >= 0; bufsize_short--) { |
3868 | |
3869 | if (is_rmb) { |
3870 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
3871 | index 0cc83839c13c..f9db5fe52d36 100644 |
3872 | --- a/net/sunrpc/sched.c |
3873 | +++ b/net/sunrpc/sched.c |
3874 | @@ -274,10 +274,9 @@ static inline void rpc_task_set_debuginfo(struct rpc_task *task) |
3875 | |
3876 | static void rpc_set_active(struct rpc_task *task) |
3877 | { |
3878 | - trace_rpc_task_begin(task->tk_client, task, NULL); |
3879 | - |
3880 | rpc_task_set_debuginfo(task); |
3881 | set_bit(RPC_TASK_ACTIVE, &task->tk_runstate); |
3882 | + trace_rpc_task_begin(task->tk_client, task, NULL); |
3883 | } |
3884 | |
3885 | /* |
3886 | diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c |
3887 | index 7d80040a37b6..f00383a37622 100644 |
3888 | --- a/net/tls/tls_sw.c |
3889 | +++ b/net/tls/tls_sw.c |
3890 | @@ -219,7 +219,7 @@ static int tls_do_encryption(struct tls_context *tls_ctx, |
3891 | struct aead_request *aead_req; |
3892 | int rc; |
3893 | |
3894 | - aead_req = kmalloc(req_size, flags); |
3895 | + aead_req = kzalloc(req_size, flags); |
3896 | if (!aead_req) |
3897 | return -ENOMEM; |
3898 | |
3899 | diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
3900 | index 6eb228a70131..2a6093840e7e 100644 |
3901 | --- a/net/xfrm/xfrm_policy.c |
3902 | +++ b/net/xfrm/xfrm_policy.c |
3903 | @@ -1306,6 +1306,7 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir) |
3904 | newp->xfrm_nr = old->xfrm_nr; |
3905 | newp->index = old->index; |
3906 | newp->type = old->type; |
3907 | + newp->family = old->family; |
3908 | memcpy(newp->xfrm_vec, old->xfrm_vec, |
3909 | newp->xfrm_nr*sizeof(struct xfrm_tmpl)); |
3910 | spin_lock_bh(&net->xfrm.xfrm_policy_lock); |
3911 | diff --git a/scripts/coccicheck b/scripts/coccicheck |
3912 | index 28ad1feff9e1..dda283aba96b 100755 |
3913 | --- a/scripts/coccicheck |
3914 | +++ b/scripts/coccicheck |
3915 | @@ -30,12 +30,6 @@ else |
3916 | VERBOSE=0 |
3917 | fi |
3918 | |
3919 | -if [ -z "$J" ]; then |
3920 | - NPROC=$(getconf _NPROCESSORS_ONLN) |
3921 | -else |
3922 | - NPROC="$J" |
3923 | -fi |
3924 | - |
3925 | FLAGS="--very-quiet" |
3926 | |
3927 | # You can use SPFLAGS to append extra arguments to coccicheck or override any |
3928 | @@ -70,6 +64,9 @@ if [ "$C" = "1" -o "$C" = "2" ]; then |
3929 | # Take only the last argument, which is the C file to test |
3930 | shift $(( $# - 1 )) |
3931 | OPTIONS="$COCCIINCLUDE $1" |
3932 | + |
3933 | + # No need to parallelize Coccinelle since this mode takes one input file. |
3934 | + NPROC=1 |
3935 | else |
3936 | ONLINE=0 |
3937 | if [ "$KBUILD_EXTMOD" = "" ] ; then |
3938 | @@ -77,6 +74,12 @@ else |
3939 | else |
3940 | OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE" |
3941 | fi |
3942 | + |
3943 | + if [ -z "$J" ]; then |
3944 | + NPROC=$(getconf _NPROCESSORS_ONLN) |
3945 | + else |
3946 | + NPROC="$J" |
3947 | + fi |
3948 | fi |
3949 | |
3950 | if [ "$KBUILD_EXTMOD" != "" ] ; then |
3951 | diff --git a/scripts/package/Makefile b/scripts/package/Makefile |
3952 | index 73f9f3192b9f..34de8b953ecf 100644 |
3953 | --- a/scripts/package/Makefile |
3954 | +++ b/scripts/package/Makefile |
3955 | @@ -39,10 +39,9 @@ if test "$(objtree)" != "$(srctree)"; then \ |
3956 | false; \ |
3957 | fi ; \ |
3958 | $(srctree)/scripts/setlocalversion --save-scmversion; \ |
3959 | -ln -sf $(srctree) $(2); \ |
3960 | tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ |
3961 | - $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ |
3962 | -rm -f $(2) $(objtree)/.scmversion |
3963 | + --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ |
3964 | +rm -f $(objtree)/.scmversion |
3965 | |
3966 | # rpm-pkg |
3967 | # --------------------------------------------------------------------------- |
3968 | @@ -50,7 +49,7 @@ rpm-pkg rpm: FORCE |
3969 | $(MAKE) clean |
3970 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec |
3971 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) |
3972 | - rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz |
3973 | + +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz |
3974 | rm $(KERNELPATH).tar.gz kernel.spec |
3975 | |
3976 | # binrpm-pkg |
3977 | @@ -58,7 +57,7 @@ rpm-pkg rpm: FORCE |
3978 | binrpm-pkg: FORCE |
3979 | $(MAKE) KBUILD_SRC= |
3980 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec |
3981 | - rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
3982 | + +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
3983 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
3984 | rm binkernel.spec |
3985 | |
3986 | diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c |
3987 | index 4243b0c3f0e4..586b249d3b46 100644 |
3988 | --- a/security/apparmor/policy.c |
3989 | +++ b/security/apparmor/policy.c |
3990 | @@ -502,7 +502,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat, |
3991 | { |
3992 | struct aa_profile *p, *profile; |
3993 | const char *bname; |
3994 | - char *name; |
3995 | + char *name = NULL; |
3996 | |
3997 | AA_BUG(!parent); |
3998 | |
3999 | @@ -562,6 +562,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat, |
4000 | return profile; |
4001 | |
4002 | fail: |
4003 | + kfree(name); |
4004 | aa_free_profile(profile); |
4005 | return NULL; |
4006 | } |
4007 | diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
4008 | index 76d22f726ae4..1ffe60bb2845 100644 |
4009 | --- a/security/keys/keyctl.c |
4010 | +++ b/security/keys/keyctl.c |
4011 | @@ -1588,9 +1588,8 @@ long keyctl_session_to_parent(void) |
4012 | * The caller must have Setattr permission to change keyring restrictions. |
4013 | * |
4014 | * The requested type name may be a NULL pointer to reject all attempts |
4015 | - * to link to the keyring. If _type is non-NULL, _restriction can be |
4016 | - * NULL or a pointer to a string describing the restriction. If _type is |
4017 | - * NULL, _restriction must also be NULL. |
4018 | + * to link to the keyring. In this case, _restriction must also be NULL. |
4019 | + * Otherwise, both _type and _restriction must be non-NULL. |
4020 | * |
4021 | * Returns 0 if successful. |
4022 | */ |
4023 | @@ -1598,7 +1597,6 @@ long keyctl_restrict_keyring(key_serial_t id, const char __user *_type, |
4024 | const char __user *_restriction) |
4025 | { |
4026 | key_ref_t key_ref; |
4027 | - bool link_reject = !_type; |
4028 | char type[32]; |
4029 | char *restriction = NULL; |
4030 | long ret; |
4031 | @@ -1607,31 +1605,29 @@ long keyctl_restrict_keyring(key_serial_t id, const char __user *_type, |
4032 | if (IS_ERR(key_ref)) |
4033 | return PTR_ERR(key_ref); |
4034 | |
4035 | + ret = -EINVAL; |
4036 | if (_type) { |
4037 | - ret = key_get_type_from_user(type, _type, sizeof(type)); |
4038 | - if (ret < 0) |
4039 | + if (!_restriction) |
4040 | goto error; |
4041 | - } |
4042 | |
4043 | - if (_restriction) { |
4044 | - if (!_type) { |
4045 | - ret = -EINVAL; |
4046 | + ret = key_get_type_from_user(type, _type, sizeof(type)); |
4047 | + if (ret < 0) |
4048 | goto error; |
4049 | - } |
4050 | |
4051 | restriction = strndup_user(_restriction, PAGE_SIZE); |
4052 | if (IS_ERR(restriction)) { |
4053 | ret = PTR_ERR(restriction); |
4054 | goto error; |
4055 | } |
4056 | + } else { |
4057 | + if (_restriction) |
4058 | + goto error; |
4059 | } |
4060 | |
4061 | - ret = keyring_restrict(key_ref, link_reject ? NULL : type, restriction); |
4062 | + ret = keyring_restrict(key_ref, _type ? type : NULL, restriction); |
4063 | kfree(restriction); |
4064 | - |
4065 | error: |
4066 | key_ref_put(key_ref); |
4067 | - |
4068 | return ret; |
4069 | } |
4070 | |
4071 | diff --git a/security/keys/request_key.c b/security/keys/request_key.c |
4072 | index e8036cd0ad54..7dc741382154 100644 |
4073 | --- a/security/keys/request_key.c |
4074 | +++ b/security/keys/request_key.c |
4075 | @@ -251,11 +251,12 @@ static int construct_key(struct key *key, const void *callout_info, |
4076 | * The keyring selected is returned with an extra reference upon it which the |
4077 | * caller must release. |
4078 | */ |
4079 | -static void construct_get_dest_keyring(struct key **_dest_keyring) |
4080 | +static int construct_get_dest_keyring(struct key **_dest_keyring) |
4081 | { |
4082 | struct request_key_auth *rka; |
4083 | const struct cred *cred = current_cred(); |
4084 | struct key *dest_keyring = *_dest_keyring, *authkey; |
4085 | + int ret; |
4086 | |
4087 | kenter("%p", dest_keyring); |
4088 | |
4089 | @@ -264,6 +265,8 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
4090 | /* the caller supplied one */ |
4091 | key_get(dest_keyring); |
4092 | } else { |
4093 | + bool do_perm_check = true; |
4094 | + |
4095 | /* use a default keyring; falling through the cases until we |
4096 | * find one that we actually have */ |
4097 | switch (cred->jit_keyring) { |
4098 | @@ -278,8 +281,10 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
4099 | dest_keyring = |
4100 | key_get(rka->dest_keyring); |
4101 | up_read(&authkey->sem); |
4102 | - if (dest_keyring) |
4103 | + if (dest_keyring) { |
4104 | + do_perm_check = false; |
4105 | break; |
4106 | + } |
4107 | } |
4108 | |
4109 | case KEY_REQKEY_DEFL_THREAD_KEYRING: |
4110 | @@ -314,11 +319,29 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
4111 | default: |
4112 | BUG(); |
4113 | } |
4114 | + |
4115 | + /* |
4116 | + * Require Write permission on the keyring. This is essential |
4117 | + * because the default keyring may be the session keyring, and |
4118 | + * joining a keyring only requires Search permission. |
4119 | + * |
4120 | + * However, this check is skipped for the "requestor keyring" so |
4121 | + * that /sbin/request-key can itself use request_key() to add |
4122 | + * keys to the original requestor's destination keyring. |
4123 | + */ |
4124 | + if (dest_keyring && do_perm_check) { |
4125 | + ret = key_permission(make_key_ref(dest_keyring, 1), |
4126 | + KEY_NEED_WRITE); |
4127 | + if (ret) { |
4128 | + key_put(dest_keyring); |
4129 | + return ret; |
4130 | + } |
4131 | + } |
4132 | } |
4133 | |
4134 | *_dest_keyring = dest_keyring; |
4135 | kleave(" [dk %d]", key_serial(dest_keyring)); |
4136 | - return; |
4137 | + return 0; |
4138 | } |
4139 | |
4140 | /* |
4141 | @@ -444,11 +467,15 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
4142 | if (ctx->index_key.type == &key_type_keyring) |
4143 | return ERR_PTR(-EPERM); |
4144 | |
4145 | - user = key_user_lookup(current_fsuid()); |
4146 | - if (!user) |
4147 | - return ERR_PTR(-ENOMEM); |
4148 | + ret = construct_get_dest_keyring(&dest_keyring); |
4149 | + if (ret) |
4150 | + goto error; |
4151 | |
4152 | - construct_get_dest_keyring(&dest_keyring); |
4153 | + user = key_user_lookup(current_fsuid()); |
4154 | + if (!user) { |
4155 | + ret = -ENOMEM; |
4156 | + goto error_put_dest_keyring; |
4157 | + } |
4158 | |
4159 | ret = construct_alloc_key(ctx, dest_keyring, flags, user, &key); |
4160 | key_user_put(user); |
4161 | @@ -463,7 +490,7 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
4162 | } else if (ret == -EINPROGRESS) { |
4163 | ret = 0; |
4164 | } else { |
4165 | - goto couldnt_alloc_key; |
4166 | + goto error_put_dest_keyring; |
4167 | } |
4168 | |
4169 | key_put(dest_keyring); |
4170 | @@ -473,8 +500,9 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
4171 | construction_failed: |
4172 | key_negate_and_link(key, key_negative_timeout, NULL, NULL); |
4173 | key_put(key); |
4174 | -couldnt_alloc_key: |
4175 | +error_put_dest_keyring: |
4176 | key_put(dest_keyring); |
4177 | +error: |
4178 | kleave(" = %d", ret); |
4179 | return ERR_PTR(ret); |
4180 | } |
4181 | diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
4182 | index 7eadb7fd8074..7fea724d093a 100644 |
4183 | --- a/sound/core/pcm.c |
4184 | +++ b/sound/core/pcm.c |
4185 | @@ -153,7 +153,9 @@ static int snd_pcm_control_ioctl(struct snd_card *card, |
4186 | err = -ENXIO; |
4187 | goto _error; |
4188 | } |
4189 | + mutex_lock(&pcm->open_mutex); |
4190 | err = snd_pcm_info_user(substream, info); |
4191 | + mutex_unlock(&pcm->open_mutex); |
4192 | _error: |
4193 | mutex_unlock(®ister_mutex); |
4194 | return err; |
4195 | diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c |
4196 | index 37d9cfbc29f9..b80985fbc334 100644 |
4197 | --- a/sound/core/seq/seq_timer.c |
4198 | +++ b/sound/core/seq/seq_timer.c |
4199 | @@ -355,7 +355,7 @@ static int initialize_timer(struct snd_seq_timer *tmr) |
4200 | unsigned long freq; |
4201 | |
4202 | t = tmr->timeri->timer; |
4203 | - if (snd_BUG_ON(!t)) |
4204 | + if (!t) |
4205 | return -EINVAL; |
4206 | |
4207 | freq = tmr->preferred_resolution; |
4208 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4209 | index 7c39114d124f..b076386c8952 100644 |
4210 | --- a/sound/pci/hda/patch_realtek.c |
4211 | +++ b/sound/pci/hda/patch_realtek.c |
4212 | @@ -330,6 +330,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
4213 | case 0x10ec0236: |
4214 | case 0x10ec0255: |
4215 | case 0x10ec0256: |
4216 | + case 0x10ec0257: |
4217 | case 0x10ec0282: |
4218 | case 0x10ec0283: |
4219 | case 0x10ec0286: |
4220 | @@ -2749,6 +2750,7 @@ enum { |
4221 | ALC269_TYPE_ALC298, |
4222 | ALC269_TYPE_ALC255, |
4223 | ALC269_TYPE_ALC256, |
4224 | + ALC269_TYPE_ALC257, |
4225 | ALC269_TYPE_ALC215, |
4226 | ALC269_TYPE_ALC225, |
4227 | ALC269_TYPE_ALC294, |
4228 | @@ -2782,6 +2784,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) |
4229 | case ALC269_TYPE_ALC298: |
4230 | case ALC269_TYPE_ALC255: |
4231 | case ALC269_TYPE_ALC256: |
4232 | + case ALC269_TYPE_ALC257: |
4233 | case ALC269_TYPE_ALC215: |
4234 | case ALC269_TYPE_ALC225: |
4235 | case ALC269_TYPE_ALC294: |
4236 | @@ -6839,6 +6842,10 @@ static int patch_alc269(struct hda_codec *codec) |
4237 | spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */ |
4238 | alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/ |
4239 | break; |
4240 | + case 0x10ec0257: |
4241 | + spec->codec_variant = ALC269_TYPE_ALC257; |
4242 | + spec->gen.mixer_nid = 0; |
4243 | + break; |
4244 | case 0x10ec0215: |
4245 | case 0x10ec0285: |
4246 | case 0x10ec0289: |
4247 | @@ -7886,6 +7893,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { |
4248 | HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269), |
4249 | HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269), |
4250 | HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269), |
4251 | + HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269), |
4252 | HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260), |
4253 | HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262), |
4254 | HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268), |
4255 | diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
4256 | index 2b835cca41b1..4fde4f8d4444 100644 |
4257 | --- a/sound/usb/mixer.c |
4258 | +++ b/sound/usb/mixer.c |
4259 | @@ -204,6 +204,10 @@ static int snd_usb_copy_string_desc(struct mixer_build *state, |
4260 | int index, char *buf, int maxlen) |
4261 | { |
4262 | int len = usb_string(state->chip->dev, index, buf, maxlen - 1); |
4263 | + |
4264 | + if (len < 0) |
4265 | + return 0; |
4266 | + |
4267 | buf[len] = 0; |
4268 | return len; |
4269 | } |
4270 | @@ -2174,13 +2178,14 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, |
4271 | if (len) |
4272 | ; |
4273 | else if (nameid) |
4274 | - snd_usb_copy_string_desc(state, nameid, kctl->id.name, |
4275 | + len = snd_usb_copy_string_desc(state, nameid, kctl->id.name, |
4276 | sizeof(kctl->id.name)); |
4277 | - else { |
4278 | + else |
4279 | len = get_term_name(state, &state->oterm, |
4280 | kctl->id.name, sizeof(kctl->id.name), 0); |
4281 | - if (!len) |
4282 | - strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); |
4283 | + |
4284 | + if (!len) { |
4285 | + strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); |
4286 | |
4287 | if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) |
4288 | append_ctl_name(kctl, " Clock Source"); |
4289 | diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
4290 | index eaa3bec273c8..4c99c57736ce 100644 |
4291 | --- a/tools/hv/hv_kvp_daemon.c |
4292 | +++ b/tools/hv/hv_kvp_daemon.c |
4293 | @@ -193,11 +193,14 @@ static void kvp_update_mem_state(int pool) |
4294 | for (;;) { |
4295 | readp = &record[records_read]; |
4296 | records_read += fread(readp, sizeof(struct kvp_record), |
4297 | - ENTRIES_PER_BLOCK * num_blocks, |
4298 | - filep); |
4299 | + ENTRIES_PER_BLOCK * num_blocks - records_read, |
4300 | + filep); |
4301 | |
4302 | if (ferror(filep)) { |
4303 | - syslog(LOG_ERR, "Failed to read file, pool: %d", pool); |
4304 | + syslog(LOG_ERR, |
4305 | + "Failed to read file, pool: %d; error: %d %s", |
4306 | + pool, errno, strerror(errno)); |
4307 | + kvp_release_lock(pool); |
4308 | exit(EXIT_FAILURE); |
4309 | } |
4310 | |
4311 | @@ -210,6 +213,7 @@ static void kvp_update_mem_state(int pool) |
4312 | |
4313 | if (record == NULL) { |
4314 | syslog(LOG_ERR, "malloc failed"); |
4315 | + kvp_release_lock(pool); |
4316 | exit(EXIT_FAILURE); |
4317 | } |
4318 | continue; |
4319 | @@ -224,15 +228,11 @@ static void kvp_update_mem_state(int pool) |
4320 | fclose(filep); |
4321 | kvp_release_lock(pool); |
4322 | } |
4323 | + |
4324 | static int kvp_file_init(void) |
4325 | { |
4326 | int fd; |
4327 | - FILE *filep; |
4328 | - size_t records_read; |
4329 | char *fname; |
4330 | - struct kvp_record *record; |
4331 | - struct kvp_record *readp; |
4332 | - int num_blocks; |
4333 | int i; |
4334 | int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; |
4335 | |
4336 | @@ -246,61 +246,19 @@ static int kvp_file_init(void) |
4337 | |
4338 | for (i = 0; i < KVP_POOL_COUNT; i++) { |
4339 | fname = kvp_file_info[i].fname; |
4340 | - records_read = 0; |
4341 | - num_blocks = 1; |
4342 | sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i); |
4343 | fd = open(fname, O_RDWR | O_CREAT | O_CLOEXEC, 0644 /* rw-r--r-- */); |
4344 | |
4345 | if (fd == -1) |
4346 | return 1; |
4347 | |
4348 | - |
4349 | - filep = fopen(fname, "re"); |
4350 | - if (!filep) { |
4351 | - close(fd); |
4352 | - return 1; |
4353 | - } |
4354 | - |
4355 | - record = malloc(alloc_unit * num_blocks); |
4356 | - if (record == NULL) { |
4357 | - fclose(filep); |
4358 | - close(fd); |
4359 | - return 1; |
4360 | - } |
4361 | - for (;;) { |
4362 | - readp = &record[records_read]; |
4363 | - records_read += fread(readp, sizeof(struct kvp_record), |
4364 | - ENTRIES_PER_BLOCK, |
4365 | - filep); |
4366 | - |
4367 | - if (ferror(filep)) { |
4368 | - syslog(LOG_ERR, "Failed to read file, pool: %d", |
4369 | - i); |
4370 | - exit(EXIT_FAILURE); |
4371 | - } |
4372 | - |
4373 | - if (!feof(filep)) { |
4374 | - /* |
4375 | - * We have more data to read. |
4376 | - */ |
4377 | - num_blocks++; |
4378 | - record = realloc(record, alloc_unit * |
4379 | - num_blocks); |
4380 | - if (record == NULL) { |
4381 | - fclose(filep); |
4382 | - close(fd); |
4383 | - return 1; |
4384 | - } |
4385 | - continue; |
4386 | - } |
4387 | - break; |
4388 | - } |
4389 | kvp_file_info[i].fd = fd; |
4390 | - kvp_file_info[i].num_blocks = num_blocks; |
4391 | - kvp_file_info[i].records = record; |
4392 | - kvp_file_info[i].num_records = records_read; |
4393 | - fclose(filep); |
4394 | - |
4395 | + kvp_file_info[i].num_blocks = 1; |
4396 | + kvp_file_info[i].records = malloc(alloc_unit); |
4397 | + if (kvp_file_info[i].records == NULL) |
4398 | + return 1; |
4399 | + kvp_file_info[i].num_records = 0; |
4400 | + kvp_update_mem_state(i); |
4401 | } |
4402 | |
4403 | return 0; |
4404 | diff --git a/tools/testing/selftests/x86/mpx-hw.h b/tools/testing/selftests/x86/mpx-hw.h |
4405 | index 3f0093911f03..d1b61ab870f8 100644 |
4406 | --- a/tools/testing/selftests/x86/mpx-hw.h |
4407 | +++ b/tools/testing/selftests/x86/mpx-hw.h |
4408 | @@ -52,14 +52,14 @@ |
4409 | struct mpx_bd_entry { |
4410 | union { |
4411 | char x[MPX_BOUNDS_DIR_ENTRY_SIZE_BYTES]; |
4412 | - void *contents[1]; |
4413 | + void *contents[0]; |
4414 | }; |
4415 | } __attribute__((packed)); |
4416 | |
4417 | struct mpx_bt_entry { |
4418 | union { |
4419 | char x[MPX_BOUNDS_TABLE_ENTRY_SIZE_BYTES]; |
4420 | - unsigned long contents[1]; |
4421 | + unsigned long contents[0]; |
4422 | }; |
4423 | } __attribute__((packed)); |
4424 | |
4425 | diff --git a/virt/kvm/arm/hyp/vgic-v2-sr.c b/virt/kvm/arm/hyp/vgic-v2-sr.c |
4426 | index a3f18d362366..d7fd46fe9efb 100644 |
4427 | --- a/virt/kvm/arm/hyp/vgic-v2-sr.c |
4428 | +++ b/virt/kvm/arm/hyp/vgic-v2-sr.c |
4429 | @@ -34,11 +34,7 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base) |
4430 | else |
4431 | elrsr1 = 0; |
4432 | |
4433 | -#ifdef CONFIG_CPU_BIG_ENDIAN |
4434 | - cpu_if->vgic_elrsr = ((u64)elrsr0 << 32) | elrsr1; |
4435 | -#else |
4436 | cpu_if->vgic_elrsr = ((u64)elrsr1 << 32) | elrsr0; |
4437 | -#endif |
4438 | } |
4439 | |
4440 | static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base) |
4441 | diff --git a/virt/kvm/arm/vgic/vgic-irqfd.c b/virt/kvm/arm/vgic/vgic-irqfd.c |
4442 | index b7baf581611a..99e026d2dade 100644 |
4443 | --- a/virt/kvm/arm/vgic/vgic-irqfd.c |
4444 | +++ b/virt/kvm/arm/vgic/vgic-irqfd.c |
4445 | @@ -112,8 +112,7 @@ int kvm_vgic_setup_default_irq_routing(struct kvm *kvm) |
4446 | u32 nr = dist->nr_spis; |
4447 | int i, ret; |
4448 | |
4449 | - entries = kcalloc(nr, sizeof(struct kvm_kernel_irq_routing_entry), |
4450 | - GFP_KERNEL); |
4451 | + entries = kcalloc(nr, sizeof(*entries), GFP_KERNEL); |
4452 | if (!entries) |
4453 | return -ENOMEM; |
4454 | |
4455 | diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c |
4456 | index 547f12dc4d54..3108e07526af 100644 |
4457 | --- a/virt/kvm/arm/vgic/vgic-its.c |
4458 | +++ b/virt/kvm/arm/vgic/vgic-its.c |
4459 | @@ -775,6 +775,8 @@ static int vgic_its_alloc_collection(struct vgic_its *its, |
4460 | return E_ITS_MAPC_COLLECTION_OOR; |
4461 | |
4462 | collection = kzalloc(sizeof(*collection), GFP_KERNEL); |
4463 | + if (!collection) |
4464 | + return -ENOMEM; |
4465 | |
4466 | collection->collection_id = coll_id; |
4467 | collection->target_addr = COLLECTION_NOT_MAPPED; |
4468 | diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c |
4469 | index 96ea597db0e7..502f2100e7bf 100644 |
4470 | --- a/virt/kvm/arm/vgic/vgic-v3.c |
4471 | +++ b/virt/kvm/arm/vgic/vgic-v3.c |
4472 | @@ -324,13 +324,13 @@ int vgic_v3_save_pending_tables(struct kvm *kvm) |
4473 | int last_byte_offset = -1; |
4474 | struct vgic_irq *irq; |
4475 | int ret; |
4476 | + u8 val; |
4477 | |
4478 | list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { |
4479 | int byte_offset, bit_nr; |
4480 | struct kvm_vcpu *vcpu; |
4481 | gpa_t pendbase, ptr; |
4482 | bool stored; |
4483 | - u8 val; |
4484 | |
4485 | vcpu = irq->target_vcpu; |
4486 | if (!vcpu) |
4487 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
4488 | index 9deb5a245b83..484e8820c382 100644 |
4489 | --- a/virt/kvm/kvm_main.c |
4490 | +++ b/virt/kvm/kvm_main.c |
4491 | @@ -136,6 +136,11 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm); |
4492 | static unsigned long long kvm_createvm_count; |
4493 | static unsigned long long kvm_active_vms; |
4494 | |
4495 | +__weak void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
4496 | + unsigned long start, unsigned long end) |
4497 | +{ |
4498 | +} |
4499 | + |
4500 | bool kvm_is_reserved_pfn(kvm_pfn_t pfn) |
4501 | { |
4502 | if (pfn_valid(pfn)) |
4503 | @@ -361,6 +366,9 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, |
4504 | kvm_flush_remote_tlbs(kvm); |
4505 | |
4506 | spin_unlock(&kvm->mmu_lock); |
4507 | + |
4508 | + kvm_arch_mmu_notifier_invalidate_range(kvm, start, end); |
4509 | + |
4510 | srcu_read_unlock(&kvm->srcu, idx); |
4511 | } |
4512 |