Contents of /trunk/kernel-alx/patches-4.9/0332-4.9.233-all-fixes.patch
Parent Directory | Revision Log
Revision 3611 -
(show annotations)
(download)
Tue Aug 25 10:56:28 2020 UTC (4 years, 1 month ago) by niro
File size: 195456 byte(s)
Tue Aug 25 10:56:28 2020 UTC (4 years, 1 month ago) by niro
File size: 195456 byte(s)
-linux-4.9.233
1 | diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
2 | index 0406076e44059..743ffbcc6b5f0 100644 |
3 | --- a/Documentation/ABI/testing/sysfs-bus-iio |
4 | +++ b/Documentation/ABI/testing/sysfs-bus-iio |
5 | @@ -1491,7 +1491,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_concentrationX_voc_raw |
6 | KernelVersion: 4.3 |
7 | Contact: linux-iio@vger.kernel.org |
8 | Description: |
9 | - Raw (unscaled no offset etc.) percentage reading of a substance. |
10 | + Raw (unscaled no offset etc.) reading of a substance. Units |
11 | + after application of scale and offset are percents. |
12 | |
13 | What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw |
14 | What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw |
15 | diff --git a/Makefile b/Makefile |
16 | index 934db3609c16f..af68e8c3fb962 100644 |
17 | --- a/Makefile |
18 | +++ b/Makefile |
19 | @@ -1,6 +1,6 @@ |
20 | VERSION = 4 |
21 | PATCHLEVEL = 9 |
22 | -SUBLEVEL = 232 |
23 | +SUBLEVEL = 233 |
24 | EXTRAVERSION = |
25 | NAME = Roaring Lionus |
26 | |
27 | diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h |
28 | index a89b4076cde47..72821b4721add 100644 |
29 | --- a/arch/arm/include/asm/percpu.h |
30 | +++ b/arch/arm/include/asm/percpu.h |
31 | @@ -16,6 +16,8 @@ |
32 | #ifndef _ASM_ARM_PERCPU_H_ |
33 | #define _ASM_ARM_PERCPU_H_ |
34 | |
35 | +#include <asm/thread_info.h> |
36 | + |
37 | /* |
38 | * Same as asm-generic/percpu.h, except that we store the per cpu offset |
39 | * in the TPIDRPRW. TPIDRPRW only exists on V6K and V7 |
40 | diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c |
41 | index 25538a9358741..283084f6286d9 100644 |
42 | --- a/arch/arm/kernel/hw_breakpoint.c |
43 | +++ b/arch/arm/kernel/hw_breakpoint.c |
44 | @@ -688,6 +688,12 @@ static void disable_single_step(struct perf_event *bp) |
45 | arch_install_hw_breakpoint(bp); |
46 | } |
47 | |
48 | +static int watchpoint_fault_on_uaccess(struct pt_regs *regs, |
49 | + struct arch_hw_breakpoint *info) |
50 | +{ |
51 | + return !user_mode(regs) && info->ctrl.privilege == ARM_BREAKPOINT_USER; |
52 | +} |
53 | + |
54 | static void watchpoint_handler(unsigned long addr, unsigned int fsr, |
55 | struct pt_regs *regs) |
56 | { |
57 | @@ -747,16 +753,27 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr, |
58 | } |
59 | |
60 | pr_debug("watchpoint fired: address = 0x%x\n", info->trigger); |
61 | + |
62 | + /* |
63 | + * If we triggered a user watchpoint from a uaccess routine, |
64 | + * then handle the stepping ourselves since userspace really |
65 | + * can't help us with this. |
66 | + */ |
67 | + if (watchpoint_fault_on_uaccess(regs, info)) |
68 | + goto step; |
69 | + |
70 | perf_bp_event(wp, regs); |
71 | |
72 | /* |
73 | - * If no overflow handler is present, insert a temporary |
74 | - * mismatch breakpoint so we can single-step over the |
75 | - * watchpoint trigger. |
76 | + * Defer stepping to the overflow handler if one is installed. |
77 | + * Otherwise, insert a temporary mismatch breakpoint so that |
78 | + * we can single-step over the watchpoint trigger. |
79 | */ |
80 | - if (is_default_overflow_handler(wp)) |
81 | - enable_single_step(wp, instruction_pointer(regs)); |
82 | + if (!is_default_overflow_handler(wp)) |
83 | + goto unlock; |
84 | |
85 | +step: |
86 | + enable_single_step(wp, instruction_pointer(regs)); |
87 | unlock: |
88 | rcu_read_unlock(); |
89 | } |
90 | diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c |
91 | index 92b72375c4c72..6e8a50de40e2b 100644 |
92 | --- a/arch/arm/kernel/stacktrace.c |
93 | +++ b/arch/arm/kernel/stacktrace.c |
94 | @@ -19,6 +19,19 @@ |
95 | * A simple function epilogue looks like this: |
96 | * ldm sp, {fp, sp, pc} |
97 | * |
98 | + * When compiled with clang, pc and sp are not pushed. A simple function |
99 | + * prologue looks like this when built with clang: |
100 | + * |
101 | + * stmdb {..., fp, lr} |
102 | + * add fp, sp, #x |
103 | + * sub sp, sp, #y |
104 | + * |
105 | + * A simple function epilogue looks like this when built with clang: |
106 | + * |
107 | + * sub sp, fp, #x |
108 | + * ldm {..., fp, pc} |
109 | + * |
110 | + * |
111 | * Note that with framepointer enabled, even the leaf functions have the same |
112 | * prologue and epilogue, therefore we can ignore the LR value in this case. |
113 | */ |
114 | @@ -31,6 +44,16 @@ int notrace unwind_frame(struct stackframe *frame) |
115 | low = frame->sp; |
116 | high = ALIGN(low, THREAD_SIZE); |
117 | |
118 | +#ifdef CONFIG_CC_IS_CLANG |
119 | + /* check current frame pointer is within bounds */ |
120 | + if (fp < low + 4 || fp > high - 4) |
121 | + return -EINVAL; |
122 | + |
123 | + frame->sp = frame->fp; |
124 | + frame->fp = *(unsigned long *)(fp); |
125 | + frame->pc = frame->lr; |
126 | + frame->lr = *(unsigned long *)(fp + 4); |
127 | +#else |
128 | /* check current frame pointer is within bounds */ |
129 | if (fp < low + 12 || fp > high - 4) |
130 | return -EINVAL; |
131 | @@ -39,6 +62,7 @@ int notrace unwind_frame(struct stackframe *frame) |
132 | frame->fp = *(unsigned long *)(fp - 12); |
133 | frame->sp = *(unsigned long *)(fp - 8); |
134 | frame->pc = *(unsigned long *)(fp - 4); |
135 | +#endif |
136 | |
137 | return 0; |
138 | } |
139 | diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c |
140 | index 8ba0e2e5ad97c..0efac1404418e 100644 |
141 | --- a/arch/arm/mach-at91/pm.c |
142 | +++ b/arch/arm/mach-at91/pm.c |
143 | @@ -411,13 +411,13 @@ static void __init at91_pm_sram_init(void) |
144 | sram_pool = gen_pool_get(&pdev->dev, NULL); |
145 | if (!sram_pool) { |
146 | pr_warn("%s: sram pool unavailable!\n", __func__); |
147 | - return; |
148 | + goto out_put_device; |
149 | } |
150 | |
151 | sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); |
152 | if (!sram_base) { |
153 | pr_warn("%s: unable to alloc sram!\n", __func__); |
154 | - return; |
155 | + goto out_put_device; |
156 | } |
157 | |
158 | sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); |
159 | @@ -425,12 +425,17 @@ static void __init at91_pm_sram_init(void) |
160 | at91_pm_suspend_in_sram_sz, false); |
161 | if (!at91_suspend_sram_fn) { |
162 | pr_warn("SRAM: Could not map\n"); |
163 | - return; |
164 | + goto out_put_device; |
165 | } |
166 | |
167 | /* Copy the pm suspend handler to SRAM */ |
168 | at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, |
169 | &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); |
170 | + return; |
171 | + |
172 | +out_put_device: |
173 | + put_device(&pdev->dev); |
174 | + return; |
175 | } |
176 | |
177 | static const struct of_device_id atmel_pmc_ids[] __initconst = { |
178 | diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c |
179 | index c378ab0c24317..93f2245c97750 100644 |
180 | --- a/arch/arm/mach-socfpga/pm.c |
181 | +++ b/arch/arm/mach-socfpga/pm.c |
182 | @@ -60,14 +60,14 @@ static int socfpga_setup_ocram_self_refresh(void) |
183 | if (!ocram_pool) { |
184 | pr_warn("%s: ocram pool unavailable!\n", __func__); |
185 | ret = -ENODEV; |
186 | - goto put_node; |
187 | + goto put_device; |
188 | } |
189 | |
190 | ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz); |
191 | if (!ocram_base) { |
192 | pr_warn("%s: unable to alloc ocram!\n", __func__); |
193 | ret = -ENOMEM; |
194 | - goto put_node; |
195 | + goto put_device; |
196 | } |
197 | |
198 | ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); |
199 | @@ -78,7 +78,7 @@ static int socfpga_setup_ocram_self_refresh(void) |
200 | if (!suspend_ocram_base) { |
201 | pr_warn("%s: __arm_ioremap_exec failed!\n", __func__); |
202 | ret = -ENOMEM; |
203 | - goto put_node; |
204 | + goto put_device; |
205 | } |
206 | |
207 | /* Copy the code that puts DDR in self refresh to ocram */ |
208 | @@ -92,6 +92,8 @@ static int socfpga_setup_ocram_self_refresh(void) |
209 | if (!socfpga_sdram_self_refresh_in_ocram) |
210 | ret = -EFAULT; |
211 | |
212 | +put_device: |
213 | + put_device(&pdev->dev); |
214 | put_node: |
215 | of_node_put(np); |
216 | |
217 | diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
218 | index c528dd52ba2d3..2f7d144d556da 100644 |
219 | --- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
220 | +++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
221 | @@ -131,6 +131,7 @@ |
222 | regulator-min-microvolt = <700000>; |
223 | regulator-max-microvolt = <1150000>; |
224 | regulator-enable-ramp-delay = <125>; |
225 | + regulator-always-on; |
226 | }; |
227 | |
228 | ldo8_reg: LDO8 { |
229 | diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
230 | index 10c83e11c272f..fabc0cebe2aa2 100644 |
231 | --- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
232 | +++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
233 | @@ -542,7 +542,7 @@ |
234 | pins = "gpio63", "gpio64", "gpio65", "gpio66", |
235 | "gpio67", "gpio68"; |
236 | drive-strength = <8>; |
237 | - bias-pull-none; |
238 | + bias-disable; |
239 | }; |
240 | }; |
241 | cdc_pdm_lines_sus: pdm_lines_off { |
242 | @@ -571,7 +571,7 @@ |
243 | pins = "gpio113", "gpio114", "gpio115", |
244 | "gpio116"; |
245 | drive-strength = <8>; |
246 | - bias-pull-none; |
247 | + bias-disable; |
248 | }; |
249 | }; |
250 | |
251 | @@ -599,7 +599,7 @@ |
252 | pinconf { |
253 | pins = "gpio110"; |
254 | drive-strength = <8>; |
255 | - bias-pull-none; |
256 | + bias-disable; |
257 | }; |
258 | }; |
259 | |
260 | @@ -625,7 +625,7 @@ |
261 | pinconf { |
262 | pins = "gpio116"; |
263 | drive-strength = <8>; |
264 | - bias-pull-none; |
265 | + bias-disable; |
266 | }; |
267 | }; |
268 | ext_mclk_tlmm_lines_sus: mclk_lines_off { |
269 | @@ -653,7 +653,7 @@ |
270 | pins = "gpio112", "gpio117", "gpio118", |
271 | "gpio119"; |
272 | drive-strength = <8>; |
273 | - bias-pull-none; |
274 | + bias-disable; |
275 | }; |
276 | }; |
277 | ext_sec_tlmm_lines_sus: tlmm_lines_off { |
278 | diff --git a/arch/arm64/include/asm/checksum.h b/arch/arm64/include/asm/checksum.h |
279 | index 09f65339d66df..e6d66c508d81b 100644 |
280 | --- a/arch/arm64/include/asm/checksum.h |
281 | +++ b/arch/arm64/include/asm/checksum.h |
282 | @@ -30,16 +30,17 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) |
283 | { |
284 | __uint128_t tmp; |
285 | u64 sum; |
286 | + int n = ihl; /* we want it signed */ |
287 | |
288 | tmp = *(const __uint128_t *)iph; |
289 | iph += 16; |
290 | - ihl -= 4; |
291 | + n -= 4; |
292 | tmp += ((tmp >> 64) | (tmp << 64)); |
293 | sum = tmp >> 64; |
294 | do { |
295 | sum += *(const u32 *)iph; |
296 | iph += 4; |
297 | - } while (--ihl); |
298 | + } while (--n > 0); |
299 | |
300 | sum += ((sum >> 32) | (sum << 32)); |
301 | return csum_fold(sum >> 32); |
302 | diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c |
303 | index 7990b6f50105b..cb516cacc819b 100644 |
304 | --- a/arch/m68k/mac/iop.c |
305 | +++ b/arch/m68k/mac/iop.c |
306 | @@ -173,7 +173,7 @@ static __inline__ void iop_writeb(volatile struct mac_iop *iop, __u16 addr, __u8 |
307 | |
308 | static __inline__ void iop_stop(volatile struct mac_iop *iop) |
309 | { |
310 | - iop->status_ctrl &= ~IOP_RUN; |
311 | + iop->status_ctrl = IOP_AUTOINC; |
312 | } |
313 | |
314 | static __inline__ void iop_start(volatile struct mac_iop *iop) |
315 | @@ -181,14 +181,9 @@ static __inline__ void iop_start(volatile struct mac_iop *iop) |
316 | iop->status_ctrl = IOP_RUN | IOP_AUTOINC; |
317 | } |
318 | |
319 | -static __inline__ void iop_bypass(volatile struct mac_iop *iop) |
320 | -{ |
321 | - iop->status_ctrl |= IOP_BYPASS; |
322 | -} |
323 | - |
324 | static __inline__ void iop_interrupt(volatile struct mac_iop *iop) |
325 | { |
326 | - iop->status_ctrl |= IOP_IRQ; |
327 | + iop->status_ctrl = IOP_IRQ | IOP_RUN | IOP_AUTOINC; |
328 | } |
329 | |
330 | static int iop_alive(volatile struct mac_iop *iop) |
331 | @@ -239,7 +234,6 @@ void __init iop_preinit(void) |
332 | } else { |
333 | iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_QUADRA; |
334 | } |
335 | - iop_base[IOP_NUM_SCC]->status_ctrl = 0x87; |
336 | iop_scc_present = 1; |
337 | } else { |
338 | iop_base[IOP_NUM_SCC] = NULL; |
339 | @@ -251,7 +245,7 @@ void __init iop_preinit(void) |
340 | } else { |
341 | iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_QUADRA; |
342 | } |
343 | - iop_base[IOP_NUM_ISM]->status_ctrl = 0; |
344 | + iop_stop(iop_base[IOP_NUM_ISM]); |
345 | iop_ism_present = 1; |
346 | } else { |
347 | iop_base[IOP_NUM_ISM] = NULL; |
348 | @@ -416,7 +410,8 @@ static void iop_handle_send(uint iop_num, uint chan) |
349 | iop_free_msg(msg2); |
350 | |
351 | iop_send_queue[iop_num][chan] = msg; |
352 | - if (msg) iop_do_send(msg); |
353 | + if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) |
354 | + iop_do_send(msg); |
355 | } |
356 | |
357 | /* |
358 | @@ -497,16 +492,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, |
359 | |
360 | if (!(q = iop_send_queue[iop_num][chan])) { |
361 | iop_send_queue[iop_num][chan] = msg; |
362 | + iop_do_send(msg); |
363 | } else { |
364 | while (q->next) q = q->next; |
365 | q->next = msg; |
366 | } |
367 | |
368 | - if (iop_readb(iop_base[iop_num], |
369 | - IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) { |
370 | - iop_do_send(msg); |
371 | - } |
372 | - |
373 | return 0; |
374 | } |
375 | |
376 | diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild |
377 | index f2cf414611467..6298280cb2fe0 100644 |
378 | --- a/arch/mips/include/uapi/asm/Kbuild |
379 | +++ b/arch/mips/include/uapi/asm/Kbuild |
380 | @@ -39,3 +39,6 @@ header-y += termbits.h |
381 | header-y += termios.h |
382 | header-y += types.h |
383 | header-y += unistd.h |
384 | +header-y += hwcap.h |
385 | +header-y += reg.h |
386 | +header-y += ucontext.h |
387 | diff --git a/arch/mips/kernel/topology.c b/arch/mips/kernel/topology.c |
388 | index cf3eb61fad121..68da7613874aa 100644 |
389 | --- a/arch/mips/kernel/topology.c |
390 | +++ b/arch/mips/kernel/topology.c |
391 | @@ -19,7 +19,7 @@ static int __init topology_init(void) |
392 | for_each_present_cpu(i) { |
393 | struct cpu *c = &per_cpu(cpu_devices, i); |
394 | |
395 | - c->hotpluggable = 1; |
396 | + c->hotpluggable = !!i; |
397 | ret = register_cpu(c, i); |
398 | if (ret) |
399 | printk(KERN_WARNING "topology_init: register_cpu %d " |
400 | diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h |
401 | index 90253bdc2ee5e..536690a68917c 100644 |
402 | --- a/arch/parisc/include/asm/cmpxchg.h |
403 | +++ b/arch/parisc/include/asm/cmpxchg.h |
404 | @@ -59,6 +59,7 @@ extern void __cmpxchg_called_with_bad_pointer(void); |
405 | extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old, |
406 | unsigned int new_); |
407 | extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_); |
408 | +extern u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new_); |
409 | |
410 | /* don't worry...optimizer will get rid of most of this */ |
411 | static inline unsigned long |
412 | @@ -70,6 +71,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) |
413 | #endif |
414 | case 4: return __cmpxchg_u32((unsigned int *)ptr, |
415 | (unsigned int)old, (unsigned int)new_); |
416 | + case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); |
417 | } |
418 | __cmpxchg_called_with_bad_pointer(); |
419 | return old; |
420 | diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c |
421 | index 8e45b0a97abf6..3284a7adb0a35 100644 |
422 | --- a/arch/parisc/lib/bitops.c |
423 | +++ b/arch/parisc/lib/bitops.c |
424 | @@ -78,3 +78,15 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign |
425 | _atomic_spin_unlock_irqrestore(ptr, flags); |
426 | return (unsigned long)prev; |
427 | } |
428 | + |
429 | +u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new) |
430 | +{ |
431 | + unsigned long flags; |
432 | + u8 prev; |
433 | + |
434 | + _atomic_spin_lock_irqsave(ptr, flags); |
435 | + if ((prev = *ptr) == old) |
436 | + *ptr = new; |
437 | + _atomic_spin_unlock_irqrestore(ptr, flags); |
438 | + return prev; |
439 | +} |
440 | diff --git a/arch/powerpc/include/asm/percpu.h b/arch/powerpc/include/asm/percpu.h |
441 | index 2cedefddba37f..61c78205a1d36 100644 |
442 | --- a/arch/powerpc/include/asm/percpu.h |
443 | +++ b/arch/powerpc/include/asm/percpu.h |
444 | @@ -9,8 +9,6 @@ |
445 | |
446 | #ifdef CONFIG_SMP |
447 | |
448 | -#include <asm/paca.h> |
449 | - |
450 | #define __my_cpu_offset local_paca->data_offset |
451 | |
452 | #endif /* CONFIG_SMP */ |
453 | @@ -18,4 +16,6 @@ |
454 | |
455 | #include <asm-generic/percpu.h> |
456 | |
457 | +#include <asm/paca.h> |
458 | + |
459 | #endif /* _ASM_POWERPC_PERCPU_H_ */ |
460 | diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild |
461 | index dab3717e3ea09..95cff47822180 100644 |
462 | --- a/arch/powerpc/include/uapi/asm/Kbuild |
463 | +++ b/arch/powerpc/include/uapi/asm/Kbuild |
464 | @@ -45,3 +45,4 @@ header-y += tm.h |
465 | header-y += types.h |
466 | header-y += ucontext.h |
467 | header-y += unistd.h |
468 | +header-y += perf_regs.h |
469 | diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c |
470 | index 4111d30badfad..d24aea160352b 100644 |
471 | --- a/arch/powerpc/kernel/vdso.c |
472 | +++ b/arch/powerpc/kernel/vdso.c |
473 | @@ -704,7 +704,7 @@ int vdso_getcpu_init(void) |
474 | node = cpu_to_node(cpu); |
475 | WARN_ON_ONCE(node > 0xffff); |
476 | |
477 | - val = (cpu & 0xfff) | ((node & 0xffff) << 16); |
478 | + val = (cpu & 0xffff) | ((node & 0xffff) << 16); |
479 | mtspr(SPRN_SPRG_VDSO_WRITE, val); |
480 | get_paca()->sprg_vdso = val; |
481 | |
482 | diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c |
483 | index eee45b9220e04..1fd0b684bf5fc 100644 |
484 | --- a/arch/powerpc/platforms/pseries/hotplug-memory.c |
485 | +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c |
486 | @@ -29,7 +29,7 @@ static bool rtas_hp_event; |
487 | unsigned long pseries_memory_block_size(void) |
488 | { |
489 | struct device_node *np; |
490 | - unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE; |
491 | + u64 memblock_size = MIN_MEMORY_BLOCK_SIZE; |
492 | struct resource r; |
493 | |
494 | np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); |
495 | diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c |
496 | index f1147caebacf0..af69fb7fef7c7 100644 |
497 | --- a/arch/sh/boards/mach-landisk/setup.c |
498 | +++ b/arch/sh/boards/mach-landisk/setup.c |
499 | @@ -85,6 +85,9 @@ device_initcall(landisk_devices_setup); |
500 | |
501 | static void __init landisk_setup(char **cmdline_p) |
502 | { |
503 | + /* I/O port identity mapping */ |
504 | + __set_io_port_base(0); |
505 | + |
506 | /* LED ON */ |
507 | __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED); |
508 | |
509 | diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S |
510 | index 28cc61216b649..ed5b758c650d7 100644 |
511 | --- a/arch/sh/kernel/entry-common.S |
512 | +++ b/arch/sh/kernel/entry-common.S |
513 | @@ -203,7 +203,7 @@ syscall_trace_entry: |
514 | mov.l @(OFF_R7,r15), r7 ! arg3 |
515 | mov.l @(OFF_R3,r15), r3 ! syscall_nr |
516 | ! |
517 | - mov.l 2f, r10 ! Number of syscalls |
518 | + mov.l 6f, r10 ! Number of syscalls |
519 | cmp/hs r10, r3 |
520 | bf syscall_call |
521 | mov #-ENOSYS, r0 |
522 | @@ -357,7 +357,7 @@ ENTRY(system_call) |
523 | tst r9, r8 |
524 | bf syscall_trace_entry |
525 | ! |
526 | - mov.l 2f, r8 ! Number of syscalls |
527 | + mov.l 6f, r8 ! Number of syscalls |
528 | cmp/hs r8, r3 |
529 | bt syscall_badsys |
530 | ! |
531 | @@ -396,7 +396,7 @@ syscall_exit: |
532 | #if !defined(CONFIG_CPU_SH2) |
533 | 1: .long TRA |
534 | #endif |
535 | -2: .long NR_syscalls |
536 | +6: .long NR_syscalls |
537 | 3: .long sys_call_table |
538 | 7: .long do_syscall_trace_enter |
539 | 8: .long do_syscall_trace_leave |
540 | diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c |
541 | index 26d5451b6b421..32e459ecff7a9 100644 |
542 | --- a/arch/x86/kernel/i8259.c |
543 | +++ b/arch/x86/kernel/i8259.c |
544 | @@ -205,7 +205,7 @@ spurious_8259A_irq: |
545 | * lets ACK and report it. [once per IRQ] |
546 | */ |
547 | if (!(spurious_irq_mask & irqmask)) { |
548 | - printk(KERN_DEBUG |
549 | + printk_deferred(KERN_DEBUG |
550 | "spurious 8259A interrupt: IRQ%d.\n", irq); |
551 | spurious_irq_mask |= irqmask; |
552 | } |
553 | diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S |
554 | index 097268f85e4ee..a1082dc61bb96 100644 |
555 | --- a/arch/x86/kernel/vmlinux.lds.S |
556 | +++ b/arch/x86/kernel/vmlinux.lds.S |
557 | @@ -329,7 +329,8 @@ SECTIONS |
558 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
559 | __bss_start = .; |
560 | *(.bss..page_aligned) |
561 | - *(.bss) |
562 | + . = ALIGN(PAGE_SIZE); |
563 | + *(BSS_MAIN) |
564 | . = ALIGN(PAGE_SIZE); |
565 | __bss_stop = .; |
566 | } |
567 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
568 | index 3988e26af3b58..bfed29a4c2cec 100644 |
569 | --- a/arch/x86/kvm/lapic.c |
570 | +++ b/arch/x86/kvm/lapic.c |
571 | @@ -1756,7 +1756,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) |
572 | { |
573 | struct kvm_lapic *apic = vcpu->arch.apic; |
574 | |
575 | - if (!lapic_in_kernel(vcpu) || apic_lvtt_oneshot(apic) || |
576 | + if (!kvm_apic_present(vcpu) || apic_lvtt_oneshot(apic) || |
577 | apic_lvtt_period(apic)) |
578 | return; |
579 | |
580 | diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c |
581 | index 0fecc8a2c0b58..f6dd8e148be8c 100644 |
582 | --- a/arch/xtensa/kernel/perf_event.c |
583 | +++ b/arch/xtensa/kernel/perf_event.c |
584 | @@ -404,7 +404,7 @@ static struct pmu xtensa_pmu = { |
585 | .read = xtensa_pmu_read, |
586 | }; |
587 | |
588 | -static int xtensa_pmu_setup(int cpu) |
589 | +static int xtensa_pmu_setup(unsigned int cpu) |
590 | { |
591 | unsigned i; |
592 | |
593 | diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c |
594 | index aed8d34592209..c2c391d5c5a1c 100644 |
595 | --- a/drivers/acpi/acpica/exprep.c |
596 | +++ b/drivers/acpi/acpica/exprep.c |
597 | @@ -507,10 +507,6 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
598 | (u8)access_byte_width; |
599 | } |
600 | } |
601 | - /* An additional reference for the container */ |
602 | - |
603 | - acpi_ut_add_reference(obj_desc->field.region_obj); |
604 | - |
605 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
606 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
607 | obj_desc->field.start_field_bit_offset, |
608 | diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
609 | index 529d6c38ea7ce..03a2282ceb9ca 100644 |
610 | --- a/drivers/acpi/acpica/utdelete.c |
611 | +++ b/drivers/acpi/acpica/utdelete.c |
612 | @@ -591,11 +591,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
613 | next_object = object->buffer_field.buffer_obj; |
614 | break; |
615 | |
616 | - case ACPI_TYPE_LOCAL_REGION_FIELD: |
617 | - |
618 | - next_object = object->field.region_obj; |
619 | - break; |
620 | - |
621 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
622 | |
623 | next_object = object->bank_field.bank_obj; |
624 | @@ -636,6 +631,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
625 | } |
626 | break; |
627 | |
628 | + case ACPI_TYPE_LOCAL_REGION_FIELD: |
629 | case ACPI_TYPE_REGION: |
630 | default: |
631 | |
632 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
633 | index e12288c245b54..f4c0b62959450 100644 |
634 | --- a/drivers/android/binder.c |
635 | +++ b/drivers/android/binder.c |
636 | @@ -1427,6 +1427,10 @@ static void binder_transaction(struct binder_proc *proc, |
637 | return_error = BR_DEAD_REPLY; |
638 | goto err_dead_binder; |
639 | } |
640 | + if (WARN_ON(proc == target_proc)) { |
641 | + return_error = BR_FAILED_REPLY; |
642 | + goto err_invalid_target_handle; |
643 | + } |
644 | if (security_binder_transaction(proc->tsk, |
645 | target_proc->tsk) < 0) { |
646 | return_error = BR_FAILED_REPLY; |
647 | @@ -1830,6 +1834,11 @@ static int binder_thread_write(struct binder_proc *proc, |
648 | ptr += sizeof(uint32_t); |
649 | if (target == 0 && binder_context_mgr_node && |
650 | (cmd == BC_INCREFS || cmd == BC_ACQUIRE)) { |
651 | + if (binder_context_mgr_node->proc == proc) { |
652 | + binder_user_error("%d:%d context manager tried to acquire desc 0\n", |
653 | + proc->pid, thread->pid); |
654 | + return -EINVAL; |
655 | + } |
656 | ref = binder_get_ref_for_node(proc, |
657 | binder_context_mgr_node); |
658 | if (ref->desc != target) { |
659 | diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c |
660 | index 480fa6ffbc090..04fca6db273ef 100644 |
661 | --- a/drivers/atm/atmtcp.c |
662 | +++ b/drivers/atm/atmtcp.c |
663 | @@ -432,9 +432,15 @@ static int atmtcp_remove_persistent(int itf) |
664 | return -EMEDIUMTYPE; |
665 | } |
666 | dev_data = PRIV(dev); |
667 | - if (!dev_data->persist) return 0; |
668 | + if (!dev_data->persist) { |
669 | + atm_dev_put(dev); |
670 | + return 0; |
671 | + } |
672 | dev_data->persist = 0; |
673 | - if (PRIV(dev)->vcc) return 0; |
674 | + if (PRIV(dev)->vcc) { |
675 | + atm_dev_put(dev); |
676 | + return 0; |
677 | + } |
678 | kfree(dev_data); |
679 | atm_dev_put(dev); |
680 | atm_dev_deregister(dev); |
681 | diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
682 | index 871e7f4994e8c..667882e996ecc 100644 |
683 | --- a/drivers/char/agp/intel-gtt.c |
684 | +++ b/drivers/char/agp/intel-gtt.c |
685 | @@ -303,8 +303,10 @@ static int intel_gtt_setup_scratch_page(void) |
686 | if (intel_private.needs_dmar) { |
687 | dma_addr = pci_map_page(intel_private.pcidev, page, 0, |
688 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
689 | - if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) |
690 | + if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) { |
691 | + __free_page(page); |
692 | return -EINVAL; |
693 | + } |
694 | |
695 | intel_private.scratch_page_dma = dma_addr; |
696 | } else |
697 | diff --git a/drivers/char/random.c b/drivers/char/random.c |
698 | index 4cbc73173701d..c417aa19f9962 100644 |
699 | --- a/drivers/char/random.c |
700 | +++ b/drivers/char/random.c |
701 | @@ -1211,6 +1211,7 @@ void add_interrupt_randomness(int irq, int irq_flags) |
702 | |
703 | fast_mix(fast_pool); |
704 | add_interrupt_bench(cycles); |
705 | + this_cpu_add(net_rand_state.s1, fast_pool->pool[cycles & 3]); |
706 | |
707 | if (unlikely(crng_init == 0)) { |
708 | if ((fast_pool->count >= 64) && |
709 | diff --git a/drivers/clk/sirf/clk-atlas6.c b/drivers/clk/sirf/clk-atlas6.c |
710 | index 665fa681b2e1e..1e6bdf22c3b64 100644 |
711 | --- a/drivers/clk/sirf/clk-atlas6.c |
712 | +++ b/drivers/clk/sirf/clk-atlas6.c |
713 | @@ -136,7 +136,7 @@ static void __init atlas6_clk_init(struct device_node *np) |
714 | |
715 | for (i = pll1; i < maxclk; i++) { |
716 | atlas6_clks[i] = clk_register(NULL, atlas6_clk_hw_array[i]); |
717 | - BUG_ON(!atlas6_clks[i]); |
718 | + BUG_ON(IS_ERR(atlas6_clks[i])); |
719 | } |
720 | clk_register_clkdev(atlas6_clks[cpu], NULL, "cpu"); |
721 | clk_register_clkdev(atlas6_clks[io], NULL, "io"); |
722 | diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h |
723 | index cfe21d0337454..56c8c9ba12bcc 100644 |
724 | --- a/drivers/crypto/ccp/ccp-dev.h |
725 | +++ b/drivers/crypto/ccp/ccp-dev.h |
726 | @@ -444,6 +444,7 @@ struct ccp_sg_workarea { |
727 | int nents; |
728 | |
729 | struct scatterlist *dma_sg; |
730 | + struct scatterlist *dma_sg_head; |
731 | struct device *dma_dev; |
732 | unsigned int dma_count; |
733 | enum dma_data_direction dma_dir; |
734 | diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
735 | index 7d4cd518e6022..c3f13d6505e15 100644 |
736 | --- a/drivers/crypto/ccp/ccp-ops.c |
737 | +++ b/drivers/crypto/ccp/ccp-ops.c |
738 | @@ -52,7 +52,7 @@ static u32 ccp_gen_jobid(struct ccp_device *ccp) |
739 | static void ccp_sg_free(struct ccp_sg_workarea *wa) |
740 | { |
741 | if (wa->dma_count) |
742 | - dma_unmap_sg(wa->dma_dev, wa->dma_sg, wa->nents, wa->dma_dir); |
743 | + dma_unmap_sg(wa->dma_dev, wa->dma_sg_head, wa->nents, wa->dma_dir); |
744 | |
745 | wa->dma_count = 0; |
746 | } |
747 | @@ -81,6 +81,7 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
748 | return 0; |
749 | |
750 | wa->dma_sg = sg; |
751 | + wa->dma_sg_head = sg; |
752 | wa->dma_dev = dev; |
753 | wa->dma_dir = dma_dir; |
754 | wa->dma_count = dma_map_sg(dev, sg, wa->nents, dma_dir); |
755 | @@ -93,14 +94,28 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
756 | static void ccp_update_sg_workarea(struct ccp_sg_workarea *wa, unsigned int len) |
757 | { |
758 | unsigned int nbytes = min_t(u64, len, wa->bytes_left); |
759 | + unsigned int sg_combined_len = 0; |
760 | |
761 | if (!wa->sg) |
762 | return; |
763 | |
764 | wa->sg_used += nbytes; |
765 | wa->bytes_left -= nbytes; |
766 | - if (wa->sg_used == wa->sg->length) { |
767 | - wa->sg = sg_next(wa->sg); |
768 | + if (wa->sg_used == sg_dma_len(wa->dma_sg)) { |
769 | + /* Advance to the next DMA scatterlist entry */ |
770 | + wa->dma_sg = sg_next(wa->dma_sg); |
771 | + |
772 | + /* In the case that the DMA mapped scatterlist has entries |
773 | + * that have been merged, the non-DMA mapped scatterlist |
774 | + * must be advanced multiple times for each merged entry. |
775 | + * This ensures that the current non-DMA mapped entry |
776 | + * corresponds to the current DMA mapped entry. |
777 | + */ |
778 | + do { |
779 | + sg_combined_len += wa->sg->length; |
780 | + wa->sg = sg_next(wa->sg); |
781 | + } while (wa->sg_used > sg_combined_len); |
782 | + |
783 | wa->sg_used = 0; |
784 | } |
785 | } |
786 | @@ -298,7 +313,7 @@ static unsigned int ccp_queue_buf(struct ccp_data *data, unsigned int from) |
787 | /* Update the structures and generate the count */ |
788 | buf_count = 0; |
789 | while (sg_wa->bytes_left && (buf_count < dm_wa->length)) { |
790 | - nbytes = min(sg_wa->sg->length - sg_wa->sg_used, |
791 | + nbytes = min(sg_dma_len(sg_wa->dma_sg) - sg_wa->sg_used, |
792 | dm_wa->length - buf_count); |
793 | nbytes = min_t(u64, sg_wa->bytes_left, nbytes); |
794 | |
795 | @@ -330,11 +345,11 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
796 | * and destination. The resulting len values will always be <= UINT_MAX |
797 | * because the dma length is an unsigned int. |
798 | */ |
799 | - sg_src_len = sg_dma_len(src->sg_wa.sg) - src->sg_wa.sg_used; |
800 | + sg_src_len = sg_dma_len(src->sg_wa.dma_sg) - src->sg_wa.sg_used; |
801 | sg_src_len = min_t(u64, src->sg_wa.bytes_left, sg_src_len); |
802 | |
803 | if (dst) { |
804 | - sg_dst_len = sg_dma_len(dst->sg_wa.sg) - dst->sg_wa.sg_used; |
805 | + sg_dst_len = sg_dma_len(dst->sg_wa.dma_sg) - dst->sg_wa.sg_used; |
806 | sg_dst_len = min_t(u64, src->sg_wa.bytes_left, sg_dst_len); |
807 | op_len = min(sg_src_len, sg_dst_len); |
808 | } else { |
809 | @@ -364,7 +379,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
810 | /* Enough data in the sg element, but we need to |
811 | * adjust for any previously copied data |
812 | */ |
813 | - op->src.u.dma.address = sg_dma_address(src->sg_wa.sg); |
814 | + op->src.u.dma.address = sg_dma_address(src->sg_wa.dma_sg); |
815 | op->src.u.dma.offset = src->sg_wa.sg_used; |
816 | op->src.u.dma.length = op_len & ~(block_size - 1); |
817 | |
818 | @@ -385,7 +400,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
819 | /* Enough room in the sg element, but we need to |
820 | * adjust for any previously used area |
821 | */ |
822 | - op->dst.u.dma.address = sg_dma_address(dst->sg_wa.sg); |
823 | + op->dst.u.dma.address = sg_dma_address(dst->sg_wa.dma_sg); |
824 | op->dst.u.dma.offset = dst->sg_wa.sg_used; |
825 | op->dst.u.dma.length = op->src.u.dma.length; |
826 | } |
827 | @@ -1216,8 +1231,9 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
828 | digest_size); |
829 | break; |
830 | default: |
831 | + kfree(hmac_buf); |
832 | ret = -EINVAL; |
833 | - goto e_ctx; |
834 | + goto e_data; |
835 | } |
836 | |
837 | memset(&hmac_cmd, 0, sizeof(hmac_cmd)); |
838 | @@ -1446,7 +1462,7 @@ static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, |
839 | dst.sg_wa.sg_used = 0; |
840 | for (i = 1; i <= src.sg_wa.dma_count; i++) { |
841 | if (!dst.sg_wa.sg || |
842 | - (dst.sg_wa.sg->length < src.sg_wa.sg->length)) { |
843 | + (sg_dma_len(dst.sg_wa.sg) < sg_dma_len(src.sg_wa.sg))) { |
844 | ret = -EINVAL; |
845 | goto e_dst; |
846 | } |
847 | @@ -1472,8 +1488,8 @@ static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, |
848 | goto e_dst; |
849 | } |
850 | |
851 | - dst.sg_wa.sg_used += src.sg_wa.sg->length; |
852 | - if (dst.sg_wa.sg_used == dst.sg_wa.sg->length) { |
853 | + dst.sg_wa.sg_used += sg_dma_len(src.sg_wa.sg); |
854 | + if (dst.sg_wa.sg_used == sg_dma_len(dst.sg_wa.sg)) { |
855 | dst.sg_wa.sg = sg_next(dst.sg_wa.sg); |
856 | dst.sg_wa.sg_used = 0; |
857 | } |
858 | diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c |
859 | index e2454d90d9498..4f1cd83bf56f9 100644 |
860 | --- a/drivers/crypto/qat/qat_common/qat_uclo.c |
861 | +++ b/drivers/crypto/qat/qat_common/qat_uclo.c |
862 | @@ -332,13 +332,18 @@ static int qat_uclo_create_batch_init_list(struct icp_qat_fw_loader_handle |
863 | } |
864 | return 0; |
865 | out_err: |
866 | + /* Do not free the list head unless we allocated it. */ |
867 | + tail_old = tail_old->next; |
868 | + if (flag) { |
869 | + kfree(*init_tab_base); |
870 | + *init_tab_base = NULL; |
871 | + } |
872 | + |
873 | while (tail_old) { |
874 | mem_init = tail_old->next; |
875 | kfree(tail_old); |
876 | tail_old = mem_init; |
877 | } |
878 | - if (flag) |
879 | - kfree(*init_tab_base); |
880 | return -ENOMEM; |
881 | } |
882 | |
883 | diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c |
884 | index 93da1a45c7161..470b02fc2de96 100644 |
885 | --- a/drivers/edac/edac_device_sysfs.c |
886 | +++ b/drivers/edac/edac_device_sysfs.c |
887 | @@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) |
888 | |
889 | /* Error exit stack */ |
890 | err_kobj_reg: |
891 | + kobject_put(&edac_dev->kobj); |
892 | module_put(edac_dev->owner); |
893 | |
894 | err_out: |
895 | diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c |
896 | index 6e3428ba400f3..622d117e25335 100644 |
897 | --- a/drivers/edac/edac_pci_sysfs.c |
898 | +++ b/drivers/edac/edac_pci_sysfs.c |
899 | @@ -386,7 +386,7 @@ static int edac_pci_main_kobj_setup(void) |
900 | |
901 | /* Error unwind statck */ |
902 | kobject_init_and_add_fail: |
903 | - kfree(edac_pci_top_main_kobj); |
904 | + kobject_put(edac_pci_top_main_kobj); |
905 | |
906 | kzalloc_fail: |
907 | module_put(THIS_MODULE); |
908 | diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c |
909 | index b863386be9113..9e40914c09840 100644 |
910 | --- a/drivers/gpio/gpiolib-of.c |
911 | +++ b/drivers/gpio/gpiolib-of.c |
912 | @@ -80,7 +80,7 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, |
913 | &gpiospec); |
914 | if (ret) { |
915 | pr_debug("%s: can't parse '%s' property of node '%s[%d]'\n", |
916 | - __func__, propname, np->full_name, index); |
917 | + __func__, propname, np ? np->full_name : NULL, index); |
918 | return ERR_PTR(ret); |
919 | } |
920 | |
921 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
922 | index 24941a7b659f4..ab5134d920d96 100644 |
923 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
924 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
925 | @@ -452,8 +452,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file |
926 | return n ? -EFAULT : 0; |
927 | } |
928 | case AMDGPU_INFO_DEV_INFO: { |
929 | - struct drm_amdgpu_info_device dev_info = {}; |
930 | + struct drm_amdgpu_info_device dev_info; |
931 | |
932 | + memset(&dev_info, 0, sizeof(dev_info)); |
933 | dev_info.device_id = dev->pdev->device; |
934 | dev_info.chip_rev = adev->rev_id; |
935 | dev_info.external_rev = adev->external_rev_id; |
936 | diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c |
937 | index 1205790ed960c..5ffe4b664cfbf 100644 |
938 | --- a/drivers/gpu/drm/drm_debugfs.c |
939 | +++ b/drivers/gpu/drm/drm_debugfs.c |
940 | @@ -287,13 +287,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf, |
941 | |
942 | buf[len] = '\0'; |
943 | |
944 | - if (!strcmp(buf, "on")) |
945 | + if (sysfs_streq(buf, "on")) |
946 | connector->force = DRM_FORCE_ON; |
947 | - else if (!strcmp(buf, "digital")) |
948 | + else if (sysfs_streq(buf, "digital")) |
949 | connector->force = DRM_FORCE_ON_DIGITAL; |
950 | - else if (!strcmp(buf, "off")) |
951 | + else if (sysfs_streq(buf, "off")) |
952 | connector->force = DRM_FORCE_OFF; |
953 | - else if (!strcmp(buf, "unspecified")) |
954 | + else if (sysfs_streq(buf, "unspecified")) |
955 | connector->force = DRM_FORCE_UNSPECIFIED; |
956 | else |
957 | return -EINVAL; |
958 | diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c |
959 | index ae5c0952a7a3b..3133aa6e89c18 100644 |
960 | --- a/drivers/gpu/drm/drm_gem.c |
961 | +++ b/drivers/gpu/drm/drm_gem.c |
962 | @@ -694,9 +694,6 @@ err: |
963 | * @file_priv: drm file-private structure |
964 | * |
965 | * Open an object using the global name, returning a handle and the size. |
966 | - * |
967 | - * This handle (of course) holds a reference to the object, so the object |
968 | - * will not go away until the handle is deleted. |
969 | */ |
970 | int |
971 | drm_gem_open_ioctl(struct drm_device *dev, void *data, |
972 | @@ -721,14 +718,15 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data, |
973 | |
974 | /* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ |
975 | ret = drm_gem_handle_create_tail(file_priv, obj, &handle); |
976 | - drm_gem_object_unreference_unlocked(obj); |
977 | if (ret) |
978 | - return ret; |
979 | + goto err; |
980 | |
981 | args->handle = handle; |
982 | args->size = obj->size; |
983 | |
984 | - return 0; |
985 | +err: |
986 | + drm_gem_object_unreference_unlocked(obj); |
987 | + return ret; |
988 | } |
989 | |
990 | /** |
991 | diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c |
992 | index 1160a579e0dc0..99415808e9f91 100644 |
993 | --- a/drivers/gpu/drm/drm_mipi_dsi.c |
994 | +++ b/drivers/gpu/drm/drm_mipi_dsi.c |
995 | @@ -1029,11 +1029,11 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); |
996 | */ |
997 | int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline) |
998 | { |
999 | - u8 payload[3] = { MIPI_DCS_SET_TEAR_SCANLINE, scanline >> 8, |
1000 | - scanline & 0xff }; |
1001 | + u8 payload[2] = { scanline >> 8, scanline & 0xff }; |
1002 | ssize_t err; |
1003 | |
1004 | - err = mipi_dsi_generic_write(dsi, payload, sizeof(payload)); |
1005 | + err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_SCANLINE, payload, |
1006 | + sizeof(payload)); |
1007 | if (err < 0) |
1008 | return err; |
1009 | |
1010 | diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c |
1011 | index 89cf0090feaca..9ae515f3171ec 100644 |
1012 | --- a/drivers/gpu/drm/imx/imx-tve.c |
1013 | +++ b/drivers/gpu/drm/imx/imx-tve.c |
1014 | @@ -511,6 +511,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) |
1015 | return 0; |
1016 | } |
1017 | |
1018 | +static void imx_tve_disable_regulator(void *data) |
1019 | +{ |
1020 | + struct imx_tve *tve = data; |
1021 | + |
1022 | + regulator_disable(tve->dac_reg); |
1023 | +} |
1024 | + |
1025 | static bool imx_tve_readable_reg(struct device *dev, unsigned int reg) |
1026 | { |
1027 | return (reg % 4 == 0) && (reg <= 0xdc); |
1028 | @@ -635,6 +642,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
1029 | ret = regulator_enable(tve->dac_reg); |
1030 | if (ret) |
1031 | return ret; |
1032 | + ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve); |
1033 | + if (ret) |
1034 | + return ret; |
1035 | } |
1036 | |
1037 | tve->clk = devm_clk_get(dev, "tve"); |
1038 | @@ -681,18 +691,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
1039 | return 0; |
1040 | } |
1041 | |
1042 | -static void imx_tve_unbind(struct device *dev, struct device *master, |
1043 | - void *data) |
1044 | -{ |
1045 | - struct imx_tve *tve = dev_get_drvdata(dev); |
1046 | - |
1047 | - if (!IS_ERR(tve->dac_reg)) |
1048 | - regulator_disable(tve->dac_reg); |
1049 | -} |
1050 | - |
1051 | static const struct component_ops imx_tve_ops = { |
1052 | .bind = imx_tve_bind, |
1053 | - .unbind = imx_tve_unbind, |
1054 | }; |
1055 | |
1056 | static int imx_tve_probe(struct platform_device *pdev) |
1057 | diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1058 | index 42829a942e33c..4e12d3d59651b 100644 |
1059 | --- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
1060 | +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1061 | @@ -823,8 +823,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) |
1062 | |
1063 | /* need to bring up power immediately if opening device */ |
1064 | ret = pm_runtime_get_sync(dev->dev); |
1065 | - if (ret < 0 && ret != -EACCES) |
1066 | + if (ret < 0 && ret != -EACCES) { |
1067 | + pm_runtime_put_autosuspend(dev->dev); |
1068 | return ret; |
1069 | + } |
1070 | |
1071 | get_task_comm(tmpname, current); |
1072 | snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); |
1073 | @@ -912,8 +914,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1074 | long ret; |
1075 | |
1076 | ret = pm_runtime_get_sync(dev->dev); |
1077 | - if (ret < 0 && ret != -EACCES) |
1078 | + if (ret < 0 && ret != -EACCES) { |
1079 | + pm_runtime_put_autosuspend(dev->dev); |
1080 | return ret; |
1081 | + } |
1082 | |
1083 | switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) { |
1084 | case DRM_NOUVEAU_NVIF: |
1085 | diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
1086 | index 2b79e27dd89c6..275abc424ce25 100644 |
1087 | --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
1088 | +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
1089 | @@ -584,6 +584,7 @@ fini: |
1090 | drm_fb_helper_fini(&fbcon->helper); |
1091 | free: |
1092 | kfree(fbcon); |
1093 | + drm->fbcon = NULL; |
1094 | return ret; |
1095 | } |
1096 | |
1097 | diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c |
1098 | index 505dca48b9f80..be6672da33a65 100644 |
1099 | --- a/drivers/gpu/drm/nouveau/nouveau_gem.c |
1100 | +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c |
1101 | @@ -42,8 +42,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem) |
1102 | int ret; |
1103 | |
1104 | ret = pm_runtime_get_sync(dev); |
1105 | - if (WARN_ON(ret < 0 && ret != -EACCES)) |
1106 | + if (WARN_ON(ret < 0 && ret != -EACCES)) { |
1107 | + pm_runtime_put_autosuspend(dev); |
1108 | return; |
1109 | + } |
1110 | |
1111 | if (gem->import_attach) |
1112 | drm_prime_gem_destroy(gem, nvbo->bo.sg); |
1113 | diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c |
1114 | index 68a2b25deb50d..57f32d1bb3127 100644 |
1115 | --- a/drivers/gpu/drm/panel/panel-simple.c |
1116 | +++ b/drivers/gpu/drm/panel/panel-simple.c |
1117 | @@ -1041,7 +1041,7 @@ static const struct drm_display_mode lg_lb070wv8_mode = { |
1118 | static const struct panel_desc lg_lb070wv8 = { |
1119 | .modes = &lg_lb070wv8_mode, |
1120 | .num_modes = 1, |
1121 | - .bpc = 16, |
1122 | + .bpc = 8, |
1123 | .size = { |
1124 | .width = 151, |
1125 | .height = 91, |
1126 | diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c |
1127 | index be43582811dfc..50bad42527b1c 100644 |
1128 | --- a/drivers/gpu/drm/radeon/ci_dpm.c |
1129 | +++ b/drivers/gpu/drm/radeon/ci_dpm.c |
1130 | @@ -4348,7 +4348,7 @@ static int ci_set_mc_special_registers(struct radeon_device *rdev, |
1131 | table->mc_reg_table_entry[k].mc_data[j] |= 0x100; |
1132 | } |
1133 | j++; |
1134 | - if (j > SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
1135 | + if (j >= SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
1136 | return -EINVAL; |
1137 | |
1138 | if (!pi->mem_gddr5) { |
1139 | diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
1140 | index 432ad7d73cb9b..99e23800cadc7 100644 |
1141 | --- a/drivers/gpu/drm/radeon/radeon_display.c |
1142 | +++ b/drivers/gpu/drm/radeon/radeon_display.c |
1143 | @@ -639,8 +639,10 @@ radeon_crtc_set_config(struct drm_mode_set *set) |
1144 | dev = set->crtc->dev; |
1145 | |
1146 | ret = pm_runtime_get_sync(dev->dev); |
1147 | - if (ret < 0) |
1148 | + if (ret < 0) { |
1149 | + pm_runtime_put_autosuspend(dev->dev); |
1150 | return ret; |
1151 | + } |
1152 | |
1153 | ret = drm_crtc_helper_set_config(set); |
1154 | |
1155 | diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
1156 | index 30bd4a6a9d466..7648fd0d10751 100644 |
1157 | --- a/drivers/gpu/drm/radeon/radeon_drv.c |
1158 | +++ b/drivers/gpu/drm/radeon/radeon_drv.c |
1159 | @@ -496,8 +496,10 @@ long radeon_drm_ioctl(struct file *filp, |
1160 | long ret; |
1161 | dev = file_priv->minor->dev; |
1162 | ret = pm_runtime_get_sync(dev->dev); |
1163 | - if (ret < 0) |
1164 | + if (ret < 0) { |
1165 | + pm_runtime_put_autosuspend(dev->dev); |
1166 | return ret; |
1167 | + } |
1168 | |
1169 | ret = drm_ioctl(filp, cmd, arg); |
1170 | |
1171 | diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
1172 | index 4388ddeec8d24..96d2a564d9a3c 100644 |
1173 | --- a/drivers/gpu/drm/radeon/radeon_kms.c |
1174 | +++ b/drivers/gpu/drm/radeon/radeon_kms.c |
1175 | @@ -634,8 +634,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
1176 | file_priv->driver_priv = NULL; |
1177 | |
1178 | r = pm_runtime_get_sync(dev->dev); |
1179 | - if (r < 0) |
1180 | + if (r < 0) { |
1181 | + pm_runtime_put_autosuspend(dev->dev); |
1182 | return r; |
1183 | + } |
1184 | |
1185 | /* new gpu have virtual address space support */ |
1186 | if (rdev->family >= CHIP_CAYMAN) { |
1187 | diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
1188 | index 2134bb20fbe9d..2836154dbb126 100644 |
1189 | --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
1190 | +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
1191 | @@ -159,12 +159,16 @@ static int panel_connector_get_modes(struct drm_connector *connector) |
1192 | int i; |
1193 | |
1194 | for (i = 0; i < timings->num_timings; i++) { |
1195 | - struct drm_display_mode *mode = drm_mode_create(dev); |
1196 | + struct drm_display_mode *mode; |
1197 | struct videomode vm; |
1198 | |
1199 | if (videomode_from_timings(timings, &vm, i)) |
1200 | break; |
1201 | |
1202 | + mode = drm_mode_create(dev); |
1203 | + if (!mode) |
1204 | + break; |
1205 | + |
1206 | drm_display_mode_from_videomode(&vm, mode); |
1207 | |
1208 | mode->type = DRM_MODE_TYPE_DRIVER; |
1209 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1210 | index 33ca24ab983e1..39ac7566b705b 100644 |
1211 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1212 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1213 | @@ -2109,7 +2109,7 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
1214 | ++i; |
1215 | } |
1216 | |
1217 | - if (i != unit) { |
1218 | + if (&con->head == &dev_priv->dev->mode_config.connector_list) { |
1219 | DRM_ERROR("Could not find initial display unit.\n"); |
1220 | return -EINVAL; |
1221 | } |
1222 | @@ -2131,13 +2131,13 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
1223 | break; |
1224 | } |
1225 | |
1226 | - if (mode->type & DRM_MODE_TYPE_PREFERRED) |
1227 | - *p_mode = mode; |
1228 | - else { |
1229 | + if (&mode->head == &con->modes) { |
1230 | WARN_ONCE(true, "Could not find initial preferred mode.\n"); |
1231 | *p_mode = list_first_entry(&con->modes, |
1232 | struct drm_display_mode, |
1233 | head); |
1234 | + } else { |
1235 | + *p_mode = mode; |
1236 | } |
1237 | |
1238 | return 0; |
1239 | diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c |
1240 | index 50b73f3876fb7..098b86eb26d74 100644 |
1241 | --- a/drivers/gpu/ipu-v3/ipu-image-convert.c |
1242 | +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c |
1243 | @@ -987,9 +987,10 @@ done: |
1244 | return IRQ_WAKE_THREAD; |
1245 | } |
1246 | |
1247 | -static irqreturn_t norotate_irq(int irq, void *data) |
1248 | +static irqreturn_t eof_irq(int irq, void *data) |
1249 | { |
1250 | struct ipu_image_convert_chan *chan = data; |
1251 | + struct ipu_image_convert_priv *priv = chan->priv; |
1252 | struct ipu_image_convert_ctx *ctx; |
1253 | struct ipu_image_convert_run *run; |
1254 | unsigned long flags; |
1255 | @@ -1006,45 +1007,26 @@ static irqreturn_t norotate_irq(int irq, void *data) |
1256 | |
1257 | ctx = run->ctx; |
1258 | |
1259 | - if (ipu_rot_mode_is_irt(ctx->rot_mode)) { |
1260 | - /* this is a rotation operation, just ignore */ |
1261 | - spin_unlock_irqrestore(&chan->irqlock, flags); |
1262 | - return IRQ_HANDLED; |
1263 | - } |
1264 | - |
1265 | - ret = do_irq(run); |
1266 | -out: |
1267 | - spin_unlock_irqrestore(&chan->irqlock, flags); |
1268 | - return ret; |
1269 | -} |
1270 | - |
1271 | -static irqreturn_t rotate_irq(int irq, void *data) |
1272 | -{ |
1273 | - struct ipu_image_convert_chan *chan = data; |
1274 | - struct ipu_image_convert_priv *priv = chan->priv; |
1275 | - struct ipu_image_convert_ctx *ctx; |
1276 | - struct ipu_image_convert_run *run; |
1277 | - unsigned long flags; |
1278 | - irqreturn_t ret; |
1279 | - |
1280 | - spin_lock_irqsave(&chan->irqlock, flags); |
1281 | - |
1282 | - /* get current run and its context */ |
1283 | - run = chan->current_run; |
1284 | - if (!run) { |
1285 | + if (irq == chan->out_eof_irq) { |
1286 | + if (ipu_rot_mode_is_irt(ctx->rot_mode)) { |
1287 | + /* this is a rotation op, just ignore */ |
1288 | + ret = IRQ_HANDLED; |
1289 | + goto out; |
1290 | + } |
1291 | + } else if (irq == chan->rot_out_eof_irq) { |
1292 | + if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { |
1293 | + /* this was NOT a rotation op, shouldn't happen */ |
1294 | + dev_err(priv->ipu->dev, |
1295 | + "Unexpected rotation interrupt\n"); |
1296 | + ret = IRQ_HANDLED; |
1297 | + goto out; |
1298 | + } |
1299 | + } else { |
1300 | + dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq); |
1301 | ret = IRQ_NONE; |
1302 | goto out; |
1303 | } |
1304 | |
1305 | - ctx = run->ctx; |
1306 | - |
1307 | - if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { |
1308 | - /* this was NOT a rotation operation, shouldn't happen */ |
1309 | - dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n"); |
1310 | - spin_unlock_irqrestore(&chan->irqlock, flags); |
1311 | - return IRQ_HANDLED; |
1312 | - } |
1313 | - |
1314 | ret = do_irq(run); |
1315 | out: |
1316 | spin_unlock_irqrestore(&chan->irqlock, flags); |
1317 | @@ -1137,7 +1119,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) |
1318 | chan->out_chan, |
1319 | IPU_IRQ_EOF); |
1320 | |
1321 | - ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh, |
1322 | + ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh, |
1323 | 0, "ipu-ic", chan); |
1324 | if (ret < 0) { |
1325 | dev_err(priv->ipu->dev, "could not acquire irq %d\n", |
1326 | @@ -1150,7 +1132,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) |
1327 | chan->rotation_out_chan, |
1328 | IPU_IRQ_EOF); |
1329 | |
1330 | - ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh, |
1331 | + ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh, |
1332 | 0, "ipu-ic", chan); |
1333 | if (ret < 0) { |
1334 | dev_err(priv->ipu->dev, "could not acquire irq %d\n", |
1335 | diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c |
1336 | index 59c08d5b75d6a..45d6771fac8ce 100644 |
1337 | --- a/drivers/i2c/busses/i2c-cadence.c |
1338 | +++ b/drivers/i2c/busses/i2c-cadence.c |
1339 | @@ -382,10 +382,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) |
1340 | * Check for the message size against FIFO depth and set the |
1341 | * 'hold bus' bit if it is greater than FIFO depth. |
1342 | */ |
1343 | - if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) |
1344 | + if (id->recv_count > CDNS_I2C_FIFO_DEPTH) |
1345 | ctrl_reg |= CDNS_I2C_CR_HOLD; |
1346 | - else |
1347 | - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; |
1348 | |
1349 | cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); |
1350 | |
1351 | @@ -442,11 +440,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id) |
1352 | * Check for the message size against FIFO depth and set the |
1353 | * 'hold bus' bit if it is greater than FIFO depth. |
1354 | */ |
1355 | - if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) |
1356 | + if (id->send_count > CDNS_I2C_FIFO_DEPTH) |
1357 | ctrl_reg |= CDNS_I2C_CR_HOLD; |
1358 | - else |
1359 | - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; |
1360 | - |
1361 | cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); |
1362 | |
1363 | /* Clear the interrupts in interrupt status register. */ |
1364 | diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
1365 | index 93b8069041bb1..4231673435e7b 100644 |
1366 | --- a/drivers/i2c/busses/i2c-rcar.c |
1367 | +++ b/drivers/i2c/busses/i2c-rcar.c |
1368 | @@ -527,13 +527,14 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) |
1369 | rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); |
1370 | } |
1371 | |
1372 | - rcar_i2c_write(priv, ICSSR, ~SAR & 0xff); |
1373 | + /* Clear SSR, too, because of old STOPs to other clients than us */ |
1374 | + rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff); |
1375 | } |
1376 | |
1377 | /* master sent stop */ |
1378 | if (ssr_filtered & SSR) { |
1379 | i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); |
1380 | - rcar_i2c_write(priv, ICSIER, SAR | SSR); |
1381 | + rcar_i2c_write(priv, ICSIER, SAR); |
1382 | rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); |
1383 | } |
1384 | |
1385 | @@ -762,7 +763,7 @@ static int rcar_reg_slave(struct i2c_client *slave) |
1386 | priv->slave = slave; |
1387 | rcar_i2c_write(priv, ICSAR, slave->addr); |
1388 | rcar_i2c_write(priv, ICSSR, 0); |
1389 | - rcar_i2c_write(priv, ICSIER, SAR | SSR); |
1390 | + rcar_i2c_write(priv, ICSIER, SAR); |
1391 | rcar_i2c_write(priv, ICSCR, SIE | SDBS); |
1392 | |
1393 | return 0; |
1394 | diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c |
1395 | index 69bde59098542..5c998ac8c840b 100644 |
1396 | --- a/drivers/iio/dac/ad5592r-base.c |
1397 | +++ b/drivers/iio/dac/ad5592r-base.c |
1398 | @@ -417,7 +417,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev, |
1399 | s64 tmp = *val * (3767897513LL / 25LL); |
1400 | *val = div_s64_rem(tmp, 1000000000LL, val2); |
1401 | |
1402 | - ret = IIO_VAL_INT_PLUS_MICRO; |
1403 | + return IIO_VAL_INT_PLUS_MICRO; |
1404 | } else { |
1405 | int mult; |
1406 | |
1407 | @@ -448,7 +448,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev, |
1408 | ret = IIO_VAL_INT; |
1409 | break; |
1410 | default: |
1411 | - ret = -EINVAL; |
1412 | + return -EINVAL; |
1413 | } |
1414 | |
1415 | unlock: |
1416 | diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c |
1417 | index 11c32ac8234b2..779d0b9341c0d 100644 |
1418 | --- a/drivers/input/mouse/sentelic.c |
1419 | +++ b/drivers/input/mouse/sentelic.c |
1420 | @@ -454,7 +454,7 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, |
1421 | |
1422 | fsp_reg_write_enable(psmouse, false); |
1423 | |
1424 | - return count; |
1425 | + return retval; |
1426 | } |
1427 | |
1428 | PSMOUSE_DEFINE_WO_ATTR(setreg, S_IWUSR, NULL, fsp_attr_set_setreg); |
1429 | diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c |
1430 | index 505548aafeff2..cec33e90e3998 100644 |
1431 | --- a/drivers/iommu/omap-iommu-debug.c |
1432 | +++ b/drivers/iommu/omap-iommu-debug.c |
1433 | @@ -101,8 +101,11 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, |
1434 | mutex_lock(&iommu_debug_lock); |
1435 | |
1436 | bytes = omap_iommu_dump_ctx(obj, p, count); |
1437 | + if (bytes < 0) |
1438 | + goto err; |
1439 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes); |
1440 | |
1441 | +err: |
1442 | mutex_unlock(&iommu_debug_lock); |
1443 | kfree(buf); |
1444 | |
1445 | diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c |
1446 | index aa84e5b375931..7d3f23bad88dd 100644 |
1447 | --- a/drivers/leds/led-class.c |
1448 | +++ b/drivers/leds/led-class.c |
1449 | @@ -110,6 +110,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev) |
1450 | { |
1451 | led_cdev->flags |= LED_SUSPENDED; |
1452 | led_set_brightness_nopm(led_cdev, 0); |
1453 | + flush_work(&led_cdev->set_brightness_work); |
1454 | } |
1455 | EXPORT_SYMBOL_GPL(led_classdev_suspend); |
1456 | |
1457 | diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c |
1458 | index 77a104d2b1243..13f414ff6fd00 100644 |
1459 | --- a/drivers/leds/leds-88pm860x.c |
1460 | +++ b/drivers/leds/leds-88pm860x.c |
1461 | @@ -207,21 +207,33 @@ static int pm860x_led_probe(struct platform_device *pdev) |
1462 | data->cdev.brightness_set_blocking = pm860x_led_set; |
1463 | mutex_init(&data->lock); |
1464 | |
1465 | - ret = devm_led_classdev_register(chip->dev, &data->cdev); |
1466 | + ret = led_classdev_register(chip->dev, &data->cdev); |
1467 | if (ret < 0) { |
1468 | dev_err(&pdev->dev, "Failed to register LED: %d\n", ret); |
1469 | return ret; |
1470 | } |
1471 | pm860x_led_set(&data->cdev, 0); |
1472 | + |
1473 | + platform_set_drvdata(pdev, data); |
1474 | + |
1475 | return 0; |
1476 | } |
1477 | |
1478 | +static int pm860x_led_remove(struct platform_device *pdev) |
1479 | +{ |
1480 | + struct pm860x_led *data = platform_get_drvdata(pdev); |
1481 | + |
1482 | + led_classdev_unregister(&data->cdev); |
1483 | + |
1484 | + return 0; |
1485 | +} |
1486 | |
1487 | static struct platform_driver pm860x_led_driver = { |
1488 | .driver = { |
1489 | .name = "88pm860x-led", |
1490 | }, |
1491 | .probe = pm860x_led_probe, |
1492 | + .remove = pm860x_led_remove, |
1493 | }; |
1494 | |
1495 | module_platform_driver(pm860x_led_driver); |
1496 | diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c |
1497 | index 5ff7d72f73aa4..ecc265bb69a02 100644 |
1498 | --- a/drivers/leds/leds-da903x.c |
1499 | +++ b/drivers/leds/leds-da903x.c |
1500 | @@ -113,12 +113,23 @@ static int da903x_led_probe(struct platform_device *pdev) |
1501 | led->flags = pdata->flags; |
1502 | led->master = pdev->dev.parent; |
1503 | |
1504 | - ret = devm_led_classdev_register(led->master, &led->cdev); |
1505 | + ret = led_classdev_register(led->master, &led->cdev); |
1506 | if (ret) { |
1507 | dev_err(&pdev->dev, "failed to register LED %d\n", id); |
1508 | return ret; |
1509 | } |
1510 | |
1511 | + platform_set_drvdata(pdev, led); |
1512 | + |
1513 | + return 0; |
1514 | +} |
1515 | + |
1516 | +static int da903x_led_remove(struct platform_device *pdev) |
1517 | +{ |
1518 | + struct da903x_led *led = platform_get_drvdata(pdev); |
1519 | + |
1520 | + led_classdev_unregister(&led->cdev); |
1521 | + |
1522 | return 0; |
1523 | } |
1524 | |
1525 | @@ -127,6 +138,7 @@ static struct platform_driver da903x_led_driver = { |
1526 | .name = "da903x-led", |
1527 | }, |
1528 | .probe = da903x_led_probe, |
1529 | + .remove = da903x_led_remove, |
1530 | }; |
1531 | |
1532 | module_platform_driver(da903x_led_driver); |
1533 | diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c |
1534 | index 5b529dc013d29..3d147489fc452 100644 |
1535 | --- a/drivers/leds/leds-lm3533.c |
1536 | +++ b/drivers/leds/leds-lm3533.c |
1537 | @@ -698,7 +698,7 @@ static int lm3533_led_probe(struct platform_device *pdev) |
1538 | |
1539 | platform_set_drvdata(pdev, led); |
1540 | |
1541 | - ret = devm_led_classdev_register(pdev->dev.parent, &led->cdev); |
1542 | + ret = led_classdev_register(pdev->dev.parent, &led->cdev); |
1543 | if (ret) { |
1544 | dev_err(&pdev->dev, "failed to register LED %d\n", pdev->id); |
1545 | return ret; |
1546 | @@ -708,13 +708,18 @@ static int lm3533_led_probe(struct platform_device *pdev) |
1547 | |
1548 | ret = lm3533_led_setup(led, pdata); |
1549 | if (ret) |
1550 | - return ret; |
1551 | + goto err_deregister; |
1552 | |
1553 | ret = lm3533_ctrlbank_enable(&led->cb); |
1554 | if (ret) |
1555 | - return ret; |
1556 | + goto err_deregister; |
1557 | |
1558 | return 0; |
1559 | + |
1560 | +err_deregister: |
1561 | + led_classdev_unregister(&led->cdev); |
1562 | + |
1563 | + return ret; |
1564 | } |
1565 | |
1566 | static int lm3533_led_remove(struct platform_device *pdev) |
1567 | @@ -724,6 +729,7 @@ static int lm3533_led_remove(struct platform_device *pdev) |
1568 | dev_dbg(&pdev->dev, "%s\n", __func__); |
1569 | |
1570 | lm3533_ctrlbank_disable(&led->cb); |
1571 | + led_classdev_unregister(&led->cdev); |
1572 | |
1573 | return 0; |
1574 | } |
1575 | diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c |
1576 | index 6cb94f9a2f3f3..b9c60dd2b1327 100644 |
1577 | --- a/drivers/leds/leds-lm355x.c |
1578 | +++ b/drivers/leds/leds-lm355x.c |
1579 | @@ -168,18 +168,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip) |
1580 | /* input and output pins configuration */ |
1581 | switch (chip->type) { |
1582 | case CHIP_LM3554: |
1583 | - reg_val = pdata->pin_tx2 | pdata->ntc_pin; |
1584 | + reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin; |
1585 | ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val); |
1586 | if (ret < 0) |
1587 | goto out; |
1588 | - reg_val = pdata->pass_mode; |
1589 | + reg_val = (u32)pdata->pass_mode; |
1590 | ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val); |
1591 | if (ret < 0) |
1592 | goto out; |
1593 | break; |
1594 | |
1595 | case CHIP_LM3556: |
1596 | - reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; |
1597 | + reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin | |
1598 | + (u32)pdata->pass_mode; |
1599 | ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val); |
1600 | if (ret < 0) |
1601 | goto out; |
1602 | diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c |
1603 | index be93b20e792a7..4f0ba19c35773 100644 |
1604 | --- a/drivers/leds/leds-wm831x-status.c |
1605 | +++ b/drivers/leds/leds-wm831x-status.c |
1606 | @@ -283,12 +283,23 @@ static int wm831x_status_probe(struct platform_device *pdev) |
1607 | drvdata->cdev.blink_set = wm831x_status_blink_set; |
1608 | drvdata->cdev.groups = wm831x_status_groups; |
1609 | |
1610 | - ret = devm_led_classdev_register(wm831x->dev, &drvdata->cdev); |
1611 | + ret = led_classdev_register(wm831x->dev, &drvdata->cdev); |
1612 | if (ret < 0) { |
1613 | dev_err(&pdev->dev, "Failed to register LED: %d\n", ret); |
1614 | return ret; |
1615 | } |
1616 | |
1617 | + platform_set_drvdata(pdev, drvdata); |
1618 | + |
1619 | + return 0; |
1620 | +} |
1621 | + |
1622 | +static int wm831x_status_remove(struct platform_device *pdev) |
1623 | +{ |
1624 | + struct wm831x_status *drvdata = platform_get_drvdata(pdev); |
1625 | + |
1626 | + led_classdev_unregister(&drvdata->cdev); |
1627 | + |
1628 | return 0; |
1629 | } |
1630 | |
1631 | @@ -297,6 +308,7 @@ static struct platform_driver wm831x_status_driver = { |
1632 | .name = "wm831x-status", |
1633 | }, |
1634 | .probe = wm831x_status_probe, |
1635 | + .remove = wm831x_status_remove, |
1636 | }; |
1637 | |
1638 | module_platform_driver(wm831x_status_driver); |
1639 | diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c |
1640 | index 158eae17031c4..1440436214291 100644 |
1641 | --- a/drivers/md/bcache/bset.c |
1642 | +++ b/drivers/md/bcache/bset.c |
1643 | @@ -317,7 +317,7 @@ int bch_btree_keys_alloc(struct btree_keys *b, unsigned page_order, gfp_t gfp) |
1644 | |
1645 | b->page_order = page_order; |
1646 | |
1647 | - t->data = (void *) __get_free_pages(gfp, b->page_order); |
1648 | + t->data = (void *) __get_free_pages(__GFP_COMP|gfp, b->page_order); |
1649 | if (!t->data) |
1650 | goto err; |
1651 | |
1652 | diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
1653 | index 12849829077dd..764d519a7f1c6 100644 |
1654 | --- a/drivers/md/bcache/btree.c |
1655 | +++ b/drivers/md/bcache/btree.c |
1656 | @@ -790,7 +790,7 @@ int bch_btree_cache_alloc(struct cache_set *c) |
1657 | mutex_init(&c->verify_lock); |
1658 | |
1659 | c->verify_ondisk = (void *) |
1660 | - __get_free_pages(GFP_KERNEL, ilog2(bucket_pages(c))); |
1661 | + __get_free_pages(GFP_KERNEL|__GFP_COMP, ilog2(bucket_pages(c))); |
1662 | |
1663 | c->verify_data = mca_bucket_alloc(c, &ZERO_KEY, GFP_KERNEL); |
1664 | |
1665 | diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c |
1666 | index 6ee5370eb9169..423cb1a310d62 100644 |
1667 | --- a/drivers/md/bcache/journal.c |
1668 | +++ b/drivers/md/bcache/journal.c |
1669 | @@ -839,8 +839,8 @@ int bch_journal_alloc(struct cache_set *c) |
1670 | j->w[1].c = c; |
1671 | |
1672 | if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) || |
1673 | - !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS)) || |
1674 | - !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS))) |
1675 | + !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS)) || |
1676 | + !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS))) |
1677 | return -ENOMEM; |
1678 | |
1679 | return 0; |
1680 | diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
1681 | index 526e9d5a4fb16..95e9a33de06a2 100644 |
1682 | --- a/drivers/md/bcache/super.c |
1683 | +++ b/drivers/md/bcache/super.c |
1684 | @@ -1468,7 +1468,7 @@ void bch_cache_set_unregister(struct cache_set *c) |
1685 | } |
1686 | |
1687 | #define alloc_bucket_pages(gfp, c) \ |
1688 | - ((void *) __get_free_pages(__GFP_ZERO|gfp, ilog2(bucket_pages(c)))) |
1689 | + ((void *) __get_free_pages(__GFP_ZERO|__GFP_COMP|gfp, ilog2(bucket_pages(c)))) |
1690 | |
1691 | struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) |
1692 | { |
1693 | @@ -1778,7 +1778,14 @@ found: |
1694 | sysfs_create_link(&c->kobj, &ca->kobj, buf)) |
1695 | goto err; |
1696 | |
1697 | - if (ca->sb.seq > c->sb.seq) { |
1698 | + /* |
1699 | + * A special case is both ca->sb.seq and c->sb.seq are 0, |
1700 | + * such condition happens on a new created cache device whose |
1701 | + * super block is never flushed yet. In this case c->sb.version |
1702 | + * and other members should be updated too, otherwise we will |
1703 | + * have a mistaken super block version in cache set. |
1704 | + */ |
1705 | + if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { |
1706 | c->sb.version = ca->sb.version; |
1707 | memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16); |
1708 | c->sb.flags = ca->sb.flags; |
1709 | diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
1710 | index e870b09b2c84d..d08c63aaf10bb 100644 |
1711 | --- a/drivers/md/md-cluster.c |
1712 | +++ b/drivers/md/md-cluster.c |
1713 | @@ -1234,6 +1234,7 @@ static void unlock_all_bitmaps(struct mddev *mddev) |
1714 | } |
1715 | } |
1716 | kfree(cinfo->other_bitmap_lockres); |
1717 | + cinfo->other_bitmap_lockres = NULL; |
1718 | } |
1719 | } |
1720 | |
1721 | diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
1722 | index 1143860f00283..30a853b187802 100644 |
1723 | --- a/drivers/md/raid5.c |
1724 | +++ b/drivers/md/raid5.c |
1725 | @@ -3364,6 +3364,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s, |
1726 | * is missing/faulty, then we need to read everything we can. |
1727 | */ |
1728 | if (sh->raid_conf->level != 6 && |
1729 | + sh->raid_conf->rmw_level != PARITY_DISABLE_RMW && |
1730 | sh->sector < sh->raid_conf->mddev->recovery_cp) |
1731 | /* reconstruct-write isn't being forced */ |
1732 | return 0; |
1733 | @@ -4498,7 +4499,7 @@ static void handle_stripe(struct stripe_head *sh) |
1734 | * or to load a block that is being partially written. |
1735 | */ |
1736 | if (s.to_read || s.non_overwrite |
1737 | - || (conf->level == 6 && s.to_write && s.failed) |
1738 | + || (s.to_write && s.failed) |
1739 | || (s.syncing && (s.uptodate + s.compute < disks)) |
1740 | || s.replacing |
1741 | || s.expanding) |
1742 | diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c |
1743 | index 247f0e7cb5f7f..5d634706a7eaa 100644 |
1744 | --- a/drivers/media/firewire/firedtv-fw.c |
1745 | +++ b/drivers/media/firewire/firedtv-fw.c |
1746 | @@ -271,6 +271,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
1747 | |
1748 | name_len = fw_csr_string(unit->directory, CSR_MODEL, |
1749 | name, sizeof(name)); |
1750 | + if (name_len < 0) |
1751 | + return name_len; |
1752 | for (i = ARRAY_SIZE(model_names); --i; ) |
1753 | if (strlen(model_names[i]) <= name_len && |
1754 | strncmp(name, model_names[i], name_len) == 0) |
1755 | diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c |
1756 | index c1aa888af7054..83864a99d3a66 100644 |
1757 | --- a/drivers/media/pci/cx23885/cx23888-ir.c |
1758 | +++ b/drivers/media/pci/cx23885/cx23888-ir.c |
1759 | @@ -1179,8 +1179,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev) |
1760 | return -ENOMEM; |
1761 | |
1762 | spin_lock_init(&state->rx_kfifo_lock); |
1763 | - if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL)) |
1764 | + if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, |
1765 | + GFP_KERNEL)) { |
1766 | + kfree(state); |
1767 | return -ENOMEM; |
1768 | + } |
1769 | |
1770 | state->dev = dev; |
1771 | sd = &state->sd; |
1772 | diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
1773 | index ef6ccb5b89525..cdaf3a8e2555e 100644 |
1774 | --- a/drivers/media/platform/exynos4-is/media-dev.c |
1775 | +++ b/drivers/media/platform/exynos4-is/media-dev.c |
1776 | @@ -1257,6 +1257,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) |
1777 | |
1778 | pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl, |
1779 | PINCTRL_STATE_IDLE); |
1780 | + if (IS_ERR(pctl->state_idle)) |
1781 | + return PTR_ERR(pctl->state_idle); |
1782 | + |
1783 | return 0; |
1784 | } |
1785 | |
1786 | diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c |
1787 | index e981eb2330f18..ac005ae4d21b4 100644 |
1788 | --- a/drivers/media/platform/omap3isp/isppreview.c |
1789 | +++ b/drivers/media/platform/omap3isp/isppreview.c |
1790 | @@ -2290,7 +2290,7 @@ static int preview_init_entities(struct isp_prev_device *prev) |
1791 | me->ops = &preview_media_ops; |
1792 | ret = media_entity_pads_init(me, PREV_PADS_NUM, pads); |
1793 | if (ret < 0) |
1794 | - return ret; |
1795 | + goto error_handler_free; |
1796 | |
1797 | preview_init_formats(sd, NULL); |
1798 | |
1799 | @@ -2323,6 +2323,8 @@ error_video_out: |
1800 | omap3isp_video_cleanup(&prev->video_in); |
1801 | error_video_in: |
1802 | media_entity_cleanup(&prev->subdev.entity); |
1803 | +error_handler_free: |
1804 | + v4l2_ctrl_handler_free(&prev->ctrls); |
1805 | return ret; |
1806 | } |
1807 | |
1808 | diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c |
1809 | index 1f0c2b594654e..3382845d4b67d 100644 |
1810 | --- a/drivers/mfd/arizona-core.c |
1811 | +++ b/drivers/mfd/arizona-core.c |
1812 | @@ -1537,6 +1537,15 @@ err_irq: |
1813 | arizona_irq_exit(arizona); |
1814 | err_pm: |
1815 | pm_runtime_disable(arizona->dev); |
1816 | + |
1817 | + switch (arizona->pdata.clk32k_src) { |
1818 | + case ARIZONA_32KZ_MCLK1: |
1819 | + case ARIZONA_32KZ_MCLK2: |
1820 | + arizona_clk32k_disable(arizona); |
1821 | + break; |
1822 | + default: |
1823 | + break; |
1824 | + } |
1825 | err_reset: |
1826 | arizona_enable_reset(arizona); |
1827 | regulator_disable(arizona->dcvdd); |
1828 | @@ -1558,6 +1567,15 @@ int arizona_dev_exit(struct arizona *arizona) |
1829 | regulator_disable(arizona->dcvdd); |
1830 | regulator_put(arizona->dcvdd); |
1831 | |
1832 | + switch (arizona->pdata.clk32k_src) { |
1833 | + case ARIZONA_32KZ_MCLK1: |
1834 | + case ARIZONA_32KZ_MCLK2: |
1835 | + arizona_clk32k_disable(arizona); |
1836 | + break; |
1837 | + default: |
1838 | + break; |
1839 | + } |
1840 | + |
1841 | mfd_remove_devices(arizona->dev); |
1842 | arizona_free_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, arizona); |
1843 | arizona_free_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, arizona); |
1844 | diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c |
1845 | index 672831d5ee32e..97a69cd6f1278 100644 |
1846 | --- a/drivers/mfd/dln2.c |
1847 | +++ b/drivers/mfd/dln2.c |
1848 | @@ -294,7 +294,11 @@ static void dln2_rx(struct urb *urb) |
1849 | len = urb->actual_length - sizeof(struct dln2_header); |
1850 | |
1851 | if (handle == DLN2_HANDLE_EVENT) { |
1852 | + unsigned long flags; |
1853 | + |
1854 | + spin_lock_irqsave(&dln2->event_cb_lock, flags); |
1855 | dln2_run_event_callbacks(dln2, id, echo, data, len); |
1856 | + spin_unlock_irqrestore(&dln2->event_cb_lock, flags); |
1857 | } else { |
1858 | /* URB will be re-submitted in _dln2_transfer (free_rx_slot) */ |
1859 | if (dln2_transfer_complete(dln2, urb, handle, echo)) |
1860 | diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c |
1861 | index a8b6d6a635e96..e97b3b26805d1 100644 |
1862 | --- a/drivers/misc/cxl/sysfs.c |
1863 | +++ b/drivers/misc/cxl/sysfs.c |
1864 | @@ -598,7 +598,7 @@ static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int c |
1865 | rc = kobject_init_and_add(&cr->kobj, &afu_config_record_type, |
1866 | &afu->dev.kobj, "cr%i", cr->cr); |
1867 | if (rc) |
1868 | - goto err; |
1869 | + goto err1; |
1870 | |
1871 | rc = sysfs_create_bin_file(&cr->kobj, &cr->config_attr); |
1872 | if (rc) |
1873 | diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c |
1874 | index 95b6a6640bca4..331183548bc58 100644 |
1875 | --- a/drivers/mtd/mtdchar.c |
1876 | +++ b/drivers/mtd/mtdchar.c |
1877 | @@ -372,9 +372,6 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, |
1878 | uint32_t retlen; |
1879 | int ret = 0; |
1880 | |
1881 | - if (!(file->f_mode & FMODE_WRITE)) |
1882 | - return -EPERM; |
1883 | - |
1884 | if (length > 4096) |
1885 | return -EINVAL; |
1886 | |
1887 | @@ -681,6 +678,48 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) |
1888 | return -EFAULT; |
1889 | } |
1890 | |
1891 | + /* |
1892 | + * Check the file mode to require "dangerous" commands to have write |
1893 | + * permissions. |
1894 | + */ |
1895 | + switch (cmd) { |
1896 | + /* "safe" commands */ |
1897 | + case MEMGETREGIONCOUNT: |
1898 | + case MEMGETREGIONINFO: |
1899 | + case MEMGETINFO: |
1900 | + case MEMREADOOB: |
1901 | + case MEMREADOOB64: |
1902 | + case MEMLOCK: |
1903 | + case MEMUNLOCK: |
1904 | + case MEMISLOCKED: |
1905 | + case MEMGETOOBSEL: |
1906 | + case MEMGETBADBLOCK: |
1907 | + case MEMSETBADBLOCK: |
1908 | + case OTPSELECT: |
1909 | + case OTPGETREGIONCOUNT: |
1910 | + case OTPGETREGIONINFO: |
1911 | + case OTPLOCK: |
1912 | + case ECCGETLAYOUT: |
1913 | + case ECCGETSTATS: |
1914 | + case MTDFILEMODE: |
1915 | + case BLKPG: |
1916 | + case BLKRRPART: |
1917 | + break; |
1918 | + |
1919 | + /* "dangerous" commands */ |
1920 | + case MEMERASE: |
1921 | + case MEMERASE64: |
1922 | + case MEMWRITEOOB: |
1923 | + case MEMWRITEOOB64: |
1924 | + case MEMWRITE: |
1925 | + if (!(file->f_mode & FMODE_WRITE)) |
1926 | + return -EPERM; |
1927 | + break; |
1928 | + |
1929 | + default: |
1930 | + return -ENOTTY; |
1931 | + } |
1932 | + |
1933 | switch (cmd) { |
1934 | case MEMGETREGIONCOUNT: |
1935 | if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int))) |
1936 | @@ -728,9 +767,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) |
1937 | { |
1938 | struct erase_info *erase; |
1939 | |
1940 | - if(!(file->f_mode & FMODE_WRITE)) |
1941 | - return -EPERM; |
1942 | - |
1943 | erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL); |
1944 | if (!erase) |
1945 | ret = -ENOMEM; |
1946 | @@ -1051,9 +1087,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) |
1947 | ret = 0; |
1948 | break; |
1949 | } |
1950 | - |
1951 | - default: |
1952 | - ret = -ENOTTY; |
1953 | } |
1954 | |
1955 | return ret; |
1956 | @@ -1097,6 +1130,11 @@ static long mtdchar_compat_ioctl(struct file *file, unsigned int cmd, |
1957 | struct mtd_oob_buf32 buf; |
1958 | struct mtd_oob_buf32 __user *buf_user = argp; |
1959 | |
1960 | + if (!(file->f_mode & FMODE_WRITE)) { |
1961 | + ret = -EPERM; |
1962 | + break; |
1963 | + } |
1964 | + |
1965 | if (copy_from_user(&buf, argp, sizeof(buf))) |
1966 | ret = -EFAULT; |
1967 | else |
1968 | diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c |
1969 | index 380c4a2f65161..6a11f9916116c 100644 |
1970 | --- a/drivers/net/ethernet/freescale/fman/fman.c |
1971 | +++ b/drivers/net/ethernet/freescale/fman/fman.c |
1972 | @@ -1446,8 +1446,7 @@ static void enable_time_stamp(struct fman *fman) |
1973 | { |
1974 | struct fman_fpm_regs __iomem *fpm_rg = fman->fpm_regs; |
1975 | u16 fm_clk_freq = fman->state->fm_clk_freq; |
1976 | - u32 tmp, intgr, ts_freq; |
1977 | - u64 frac; |
1978 | + u32 tmp, intgr, ts_freq, frac; |
1979 | |
1980 | ts_freq = (u32)(1 << fman->state->count1_micro_bit); |
1981 | /* configure timestamp so that bit 8 will count 1 microsecond |
1982 | diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
1983 | index 641b916f122ba..332b60f03d225 100644 |
1984 | --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
1985 | +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
1986 | @@ -1095,7 +1095,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
1987 | list_for_each(pos, |
1988 | &dtsec->multicast_addr_hash->lsts[bucket]) { |
1989 | hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
1990 | - if (hash_entry->addr == addr) { |
1991 | + if (hash_entry && hash_entry->addr == addr) { |
1992 | list_del_init(&hash_entry->node); |
1993 | kfree(hash_entry); |
1994 | break; |
1995 | @@ -1108,7 +1108,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
1996 | list_for_each(pos, |
1997 | &dtsec->unicast_addr_hash->lsts[bucket]) { |
1998 | hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
1999 | - if (hash_entry->addr == addr) { |
2000 | + if (hash_entry && hash_entry->addr == addr) { |
2001 | list_del_init(&hash_entry->node); |
2002 | kfree(hash_entry); |
2003 | break; |
2004 | diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h |
2005 | index dd6d0526f6c1f..19f327efdaff3 100644 |
2006 | --- a/drivers/net/ethernet/freescale/fman/fman_mac.h |
2007 | +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h |
2008 | @@ -252,7 +252,7 @@ static inline struct eth_hash_t *alloc_hash_table(u16 size) |
2009 | struct eth_hash_t *hash; |
2010 | |
2011 | /* Allocate address hash table */ |
2012 | - hash = kmalloc_array(size, sizeof(struct eth_hash_t *), GFP_KERNEL); |
2013 | + hash = kmalloc(sizeof(*hash), GFP_KERNEL); |
2014 | if (!hash) |
2015 | return NULL; |
2016 | |
2017 | diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c |
2018 | index c30994a09a7c2..4b0be0cebd199 100644 |
2019 | --- a/drivers/net/ethernet/freescale/fman/fman_memac.c |
2020 | +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c |
2021 | @@ -851,7 +851,6 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, |
2022 | |
2023 | tmp = ioread32be(®s->command_config); |
2024 | tmp &= ~CMD_CFG_PFC_MODE; |
2025 | - priority = 0; |
2026 | |
2027 | iowrite32be(tmp, ®s->command_config); |
2028 | |
2029 | @@ -953,7 +952,7 @@ int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) |
2030 | |
2031 | list_for_each(pos, &memac->multicast_addr_hash->lsts[hash]) { |
2032 | hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
2033 | - if (hash_entry->addr == addr) { |
2034 | + if (hash_entry && hash_entry->addr == addr) { |
2035 | list_del_init(&hash_entry->node); |
2036 | kfree(hash_entry); |
2037 | break; |
2038 | diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c |
2039 | index 9f3bb50a23651..4986f6ba278a3 100644 |
2040 | --- a/drivers/net/ethernet/freescale/fman/fman_port.c |
2041 | +++ b/drivers/net/ethernet/freescale/fman/fman_port.c |
2042 | @@ -1623,6 +1623,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
2043 | struct fman_port *port; |
2044 | struct fman *fman; |
2045 | struct device_node *fm_node, *port_node; |
2046 | + struct platform_device *fm_pdev; |
2047 | struct resource res; |
2048 | struct resource *dev_res; |
2049 | u32 val; |
2050 | @@ -1647,8 +1648,14 @@ static int fman_port_probe(struct platform_device *of_dev) |
2051 | goto return_err; |
2052 | } |
2053 | |
2054 | - fman = dev_get_drvdata(&of_find_device_by_node(fm_node)->dev); |
2055 | + fm_pdev = of_find_device_by_node(fm_node); |
2056 | of_node_put(fm_node); |
2057 | + if (!fm_pdev) { |
2058 | + err = -EINVAL; |
2059 | + goto return_err; |
2060 | + } |
2061 | + |
2062 | + fman = dev_get_drvdata(&fm_pdev->dev); |
2063 | if (!fman) { |
2064 | err = -EINVAL; |
2065 | goto return_err; |
2066 | diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
2067 | index e575259d20f40..c8ad9b8a75f8e 100644 |
2068 | --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c |
2069 | +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
2070 | @@ -585,7 +585,7 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) |
2071 | |
2072 | list_for_each(pos, &tgec->multicast_addr_hash->lsts[hash]) { |
2073 | hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
2074 | - if (hash_entry->addr == addr) { |
2075 | + if (hash_entry && hash_entry->addr == addr) { |
2076 | list_del_init(&hash_entry->node); |
2077 | kfree(hash_entry); |
2078 | break; |
2079 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
2080 | index 20f7ab4aa2f15..d25b76440c114 100644 |
2081 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
2082 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
2083 | @@ -1515,7 +1515,7 @@ req_rx_irq_failed: |
2084 | req_tx_irq_failed: |
2085 | for (j = 0; j < i; j++) { |
2086 | free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]); |
2087 | - irq_dispose_mapping(adapter->rx_scrq[j]->irq); |
2088 | + irq_dispose_mapping(adapter->tx_scrq[j]->irq); |
2089 | } |
2090 | release_sub_crqs_no_irqs(adapter); |
2091 | return rc; |
2092 | diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
2093 | index 90eab0521be12..43fb77c6c51ed 100644 |
2094 | --- a/drivers/net/ethernet/intel/igb/igb_main.c |
2095 | +++ b/drivers/net/ethernet/intel/igb/igb_main.c |
2096 | @@ -5381,9 +5381,18 @@ static void igb_reset_task(struct work_struct *work) |
2097 | struct igb_adapter *adapter; |
2098 | adapter = container_of(work, struct igb_adapter, reset_task); |
2099 | |
2100 | + rtnl_lock(); |
2101 | + /* If we're already down or resetting, just bail */ |
2102 | + if (test_bit(__IGB_DOWN, &adapter->state) || |
2103 | + test_bit(__IGB_RESETTING, &adapter->state)) { |
2104 | + rtnl_unlock(); |
2105 | + return; |
2106 | + } |
2107 | + |
2108 | igb_dump(adapter); |
2109 | netdev_err(adapter->netdev, "Reset adapter\n"); |
2110 | igb_reinit_locked(adapter); |
2111 | + rtnl_unlock(); |
2112 | } |
2113 | |
2114 | /** |
2115 | diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c |
2116 | index 751aac54f2d55..9b6a96074df80 100644 |
2117 | --- a/drivers/net/ethernet/mellanox/mlx4/main.c |
2118 | +++ b/drivers/net/ethernet/mellanox/mlx4/main.c |
2119 | @@ -4176,12 +4176,14 @@ end: |
2120 | static void mlx4_shutdown(struct pci_dev *pdev) |
2121 | { |
2122 | struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev); |
2123 | + struct mlx4_dev *dev = persist->dev; |
2124 | |
2125 | mlx4_info(persist->dev, "mlx4_shutdown was called\n"); |
2126 | mutex_lock(&persist->interface_state_mutex); |
2127 | if (persist->interface_state & MLX4_INTERFACE_STATE_UP) |
2128 | mlx4_unload_one(pdev); |
2129 | mutex_unlock(&persist->interface_state_mutex); |
2130 | + mlx4_pci_disable_device(dev); |
2131 | } |
2132 | |
2133 | static const struct pci_error_handlers mlx4_err_handler = { |
2134 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2135 | index b210c171a3806..f3d3ad25f05e9 100644 |
2136 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2137 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2138 | @@ -139,7 +139,7 @@ int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr) |
2139 | struct mlx5_eswitch_rep *rep = priv->ppriv; |
2140 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
2141 | |
2142 | - if (esw->mode == SRIOV_NONE) |
2143 | + if (esw->mode != SRIOV_OFFLOADS) |
2144 | return -EOPNOTSUPP; |
2145 | |
2146 | switch (attr->id) { |
2147 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c |
2148 | index aa33d58b9f81c..808d924dbe21e 100644 |
2149 | --- a/drivers/net/ethernet/mellanox/mlxsw/core.c |
2150 | +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c |
2151 | @@ -1370,7 +1370,7 @@ static int mlxsw_core_reg_access_emad(struct mlxsw_core *mlxsw_core, |
2152 | err = mlxsw_emad_reg_access(mlxsw_core, reg, payload, type, trans, |
2153 | bulk_list, cb, cb_priv, tid); |
2154 | if (err) { |
2155 | - kfree(trans); |
2156 | + kfree_rcu(trans, rcu); |
2157 | return err; |
2158 | } |
2159 | return 0; |
2160 | @@ -1584,9 +1584,10 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, |
2161 | break; |
2162 | } |
2163 | } |
2164 | - rcu_read_unlock(); |
2165 | - if (!found) |
2166 | + if (!found) { |
2167 | + rcu_read_unlock(); |
2168 | goto drop; |
2169 | + } |
2170 | |
2171 | pcpu_stats = this_cpu_ptr(mlxsw_core->pcpu_stats); |
2172 | u64_stats_update_begin(&pcpu_stats->syncp); |
2173 | @@ -1597,6 +1598,7 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb, |
2174 | u64_stats_update_end(&pcpu_stats->syncp); |
2175 | |
2176 | rxl->func(skb, local_port, rxl_item->priv); |
2177 | + rcu_read_unlock(); |
2178 | return; |
2179 | |
2180 | drop: |
2181 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c |
2182 | index fd19372db2f86..6e1d38041d0ac 100644 |
2183 | --- a/drivers/net/ethernet/qlogic/qed/qed_int.c |
2184 | +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c |
2185 | @@ -2158,7 +2158,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) |
2186 | index, attn_bits, attn_acks, asserted_bits, |
2187 | deasserted_bits, p_sb_attn_sw->known_attn); |
2188 | } else if (asserted_bits == 0x100) { |
2189 | - DP_INFO(p_hwfn, "MFW indication via attention\n"); |
2190 | + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, |
2191 | + "MFW indication via attention\n"); |
2192 | } else { |
2193 | DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, |
2194 | "MFW indication [deassertion]\n"); |
2195 | diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c |
2196 | index 57b35aeac51a0..adc088033c15d 100644 |
2197 | --- a/drivers/net/ethernet/qualcomm/emac/emac.c |
2198 | +++ b/drivers/net/ethernet/qualcomm/emac/emac.c |
2199 | @@ -477,13 +477,24 @@ static int emac_clks_phase1_init(struct platform_device *pdev, |
2200 | |
2201 | ret = clk_prepare_enable(adpt->clk[EMAC_CLK_CFG_AHB]); |
2202 | if (ret) |
2203 | - return ret; |
2204 | + goto disable_clk_axi; |
2205 | |
2206 | ret = clk_set_rate(adpt->clk[EMAC_CLK_HIGH_SPEED], 19200000); |
2207 | if (ret) |
2208 | - return ret; |
2209 | + goto disable_clk_cfg_ahb; |
2210 | + |
2211 | + ret = clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); |
2212 | + if (ret) |
2213 | + goto disable_clk_cfg_ahb; |
2214 | |
2215 | - return clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); |
2216 | + return 0; |
2217 | + |
2218 | +disable_clk_cfg_ahb: |
2219 | + clk_disable_unprepare(adpt->clk[EMAC_CLK_CFG_AHB]); |
2220 | +disable_clk_axi: |
2221 | + clk_disable_unprepare(adpt->clk[EMAC_CLK_AXI]); |
2222 | + |
2223 | + return ret; |
2224 | } |
2225 | |
2226 | /* Enable clocks; needs emac_clks_phase1_init to be called before */ |
2227 | diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c |
2228 | index 545cb6262cffd..93d3152752ff4 100644 |
2229 | --- a/drivers/net/ethernet/renesas/ravb_main.c |
2230 | +++ b/drivers/net/ethernet/renesas/ravb_main.c |
2231 | @@ -1444,6 +1444,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) |
2232 | struct ravb_private *priv = container_of(work, struct ravb_private, |
2233 | work); |
2234 | struct net_device *ndev = priv->ndev; |
2235 | + int error; |
2236 | |
2237 | netif_tx_stop_all_queues(ndev); |
2238 | |
2239 | @@ -1452,15 +1453,36 @@ static void ravb_tx_timeout_work(struct work_struct *work) |
2240 | ravb_ptp_stop(ndev); |
2241 | |
2242 | /* Wait for DMA stopping */ |
2243 | - ravb_stop_dma(ndev); |
2244 | + if (ravb_stop_dma(ndev)) { |
2245 | + /* If ravb_stop_dma() fails, the hardware is still operating |
2246 | + * for TX and/or RX. So, this should not call the following |
2247 | + * functions because ravb_dmac_init() is possible to fail too. |
2248 | + * Also, this should not retry ravb_stop_dma() again and again |
2249 | + * here because it's possible to wait forever. So, this just |
2250 | + * re-enables the TX and RX and skip the following |
2251 | + * re-initialization procedure. |
2252 | + */ |
2253 | + ravb_rcv_snd_enable(ndev); |
2254 | + goto out; |
2255 | + } |
2256 | |
2257 | ravb_ring_free(ndev, RAVB_BE); |
2258 | ravb_ring_free(ndev, RAVB_NC); |
2259 | |
2260 | /* Device init */ |
2261 | - ravb_dmac_init(ndev); |
2262 | + error = ravb_dmac_init(ndev); |
2263 | + if (error) { |
2264 | + /* If ravb_dmac_init() fails, descriptors are freed. So, this |
2265 | + * should return here to avoid re-enabling the TX and RX in |
2266 | + * ravb_emac_init(). |
2267 | + */ |
2268 | + netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n", |
2269 | + __func__, error); |
2270 | + return; |
2271 | + } |
2272 | ravb_emac_init(ndev); |
2273 | |
2274 | +out: |
2275 | /* Initialise PTP Clock driver */ |
2276 | if (priv->chip_id == RCAR_GEN2) |
2277 | ravb_ptp_init(ndev, priv->pdev); |
2278 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
2279 | index bcc5d1e16ce2c..1924788d28da0 100644 |
2280 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
2281 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
2282 | @@ -362,6 +362,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
2283 | plat_dat->has_gmac = true; |
2284 | plat_dat->bsp_priv = gmac; |
2285 | plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed; |
2286 | + plat_dat->multicast_filter_bins = 0; |
2287 | |
2288 | err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
2289 | if (err) |
2290 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
2291 | index 3a2edf9f51e22..bd265eb36e70c 100644 |
2292 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
2293 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
2294 | @@ -172,6 +172,9 @@ static void dwmac1000_set_filter(struct mac_device_info *hw, |
2295 | value = GMAC_FRAME_FILTER_PR; |
2296 | } else if (dev->flags & IFF_ALLMULTI) { |
2297 | value = GMAC_FRAME_FILTER_PM; /* pass all multi */ |
2298 | + } else if (!netdev_mc_empty(dev) && (mcbitslog2 == 0)) { |
2299 | + /* Fall back to all multicast if we've no filter */ |
2300 | + value = GMAC_FRAME_FILTER_PM; |
2301 | } else if (!netdev_mc_empty(dev)) { |
2302 | struct netdev_hw_addr *ha; |
2303 | |
2304 | diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c |
2305 | index 1085987946212..9507ca2e02acd 100644 |
2306 | --- a/drivers/net/ethernet/toshiba/spider_net.c |
2307 | +++ b/drivers/net/ethernet/toshiba/spider_net.c |
2308 | @@ -296,8 +296,8 @@ spider_net_free_chain(struct spider_net_card *card, |
2309 | descr = descr->next; |
2310 | } while (descr != chain->ring); |
2311 | |
2312 | - dma_free_coherent(&card->pdev->dev, chain->num_desc, |
2313 | - chain->hwring, chain->dma_addr); |
2314 | + dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), |
2315 | + chain->hwring, chain->dma_addr); |
2316 | } |
2317 | |
2318 | /** |
2319 | diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c |
2320 | index 8c73b2e771ddd..e6ff731d753d9 100644 |
2321 | --- a/drivers/net/phy/mdio-bcm-unimac.c |
2322 | +++ b/drivers/net/phy/mdio-bcm-unimac.c |
2323 | @@ -177,6 +177,8 @@ static int unimac_mdio_probe(struct platform_device *pdev) |
2324 | return -ENOMEM; |
2325 | |
2326 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2327 | + if (!r) |
2328 | + return -EINVAL; |
2329 | |
2330 | /* Just ioremap, as this MDIO block is usually integrated into an |
2331 | * Ethernet MAC controller register range |
2332 | diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
2333 | index 27fc699d8be5b..c4b4c2c347647 100644 |
2334 | --- a/drivers/net/usb/hso.c |
2335 | +++ b/drivers/net/usb/hso.c |
2336 | @@ -1404,8 +1404,9 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) |
2337 | unsigned long flags; |
2338 | |
2339 | if (old) |
2340 | - hso_dbg(0x16, "Termios called with: cflags new[%d] - old[%d]\n", |
2341 | - tty->termios.c_cflag, old->c_cflag); |
2342 | + hso_dbg(0x16, "Termios called with: cflags new[%u] - old[%u]\n", |
2343 | + (unsigned int)tty->termios.c_cflag, |
2344 | + (unsigned int)old->c_cflag); |
2345 | |
2346 | /* the actual setup */ |
2347 | spin_lock_irqsave(&serial->serial_lock, flags); |
2348 | @@ -2273,12 +2274,14 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, |
2349 | |
2350 | minor = get_free_serial_index(); |
2351 | if (minor < 0) |
2352 | - goto exit; |
2353 | + goto exit2; |
2354 | |
2355 | /* register our minor number */ |
2356 | serial->parent->dev = tty_port_register_device_attr(&serial->port, |
2357 | tty_drv, minor, &serial->parent->interface->dev, |
2358 | serial->parent, hso_serial_dev_groups); |
2359 | + if (IS_ERR(serial->parent->dev)) |
2360 | + goto exit2; |
2361 | dev = serial->parent->dev; |
2362 | |
2363 | /* fill in specific data for later use */ |
2364 | @@ -2324,6 +2327,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, |
2365 | return 0; |
2366 | exit: |
2367 | hso_serial_tty_unregister(serial); |
2368 | +exit2: |
2369 | hso_serial_common_free(serial); |
2370 | return -1; |
2371 | } |
2372 | diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
2373 | index 65e94dffaabc9..bca6237597233 100644 |
2374 | --- a/drivers/net/usb/lan78xx.c |
2375 | +++ b/drivers/net/usb/lan78xx.c |
2376 | @@ -315,10 +315,6 @@ struct lan78xx_net { |
2377 | struct tasklet_struct bh; |
2378 | struct delayed_work wq; |
2379 | |
2380 | - struct usb_host_endpoint *ep_blkin; |
2381 | - struct usb_host_endpoint *ep_blkout; |
2382 | - struct usb_host_endpoint *ep_intr; |
2383 | - |
2384 | int msg_enable; |
2385 | |
2386 | struct urb *urb_intr; |
2387 | @@ -2554,78 +2550,12 @@ lan78xx_start_xmit(struct sk_buff *skb, struct net_device *net) |
2388 | return NETDEV_TX_OK; |
2389 | } |
2390 | |
2391 | -static int |
2392 | -lan78xx_get_endpoints(struct lan78xx_net *dev, struct usb_interface *intf) |
2393 | -{ |
2394 | - int tmp; |
2395 | - struct usb_host_interface *alt = NULL; |
2396 | - struct usb_host_endpoint *in = NULL, *out = NULL; |
2397 | - struct usb_host_endpoint *status = NULL; |
2398 | - |
2399 | - for (tmp = 0; tmp < intf->num_altsetting; tmp++) { |
2400 | - unsigned ep; |
2401 | - |
2402 | - in = NULL; |
2403 | - out = NULL; |
2404 | - status = NULL; |
2405 | - alt = intf->altsetting + tmp; |
2406 | - |
2407 | - for (ep = 0; ep < alt->desc.bNumEndpoints; ep++) { |
2408 | - struct usb_host_endpoint *e; |
2409 | - int intr = 0; |
2410 | - |
2411 | - e = alt->endpoint + ep; |
2412 | - switch (e->desc.bmAttributes) { |
2413 | - case USB_ENDPOINT_XFER_INT: |
2414 | - if (!usb_endpoint_dir_in(&e->desc)) |
2415 | - continue; |
2416 | - intr = 1; |
2417 | - /* FALLTHROUGH */ |
2418 | - case USB_ENDPOINT_XFER_BULK: |
2419 | - break; |
2420 | - default: |
2421 | - continue; |
2422 | - } |
2423 | - if (usb_endpoint_dir_in(&e->desc)) { |
2424 | - if (!intr && !in) |
2425 | - in = e; |
2426 | - else if (intr && !status) |
2427 | - status = e; |
2428 | - } else { |
2429 | - if (!out) |
2430 | - out = e; |
2431 | - } |
2432 | - } |
2433 | - if (in && out) |
2434 | - break; |
2435 | - } |
2436 | - if (!alt || !in || !out) |
2437 | - return -EINVAL; |
2438 | - |
2439 | - dev->pipe_in = usb_rcvbulkpipe(dev->udev, |
2440 | - in->desc.bEndpointAddress & |
2441 | - USB_ENDPOINT_NUMBER_MASK); |
2442 | - dev->pipe_out = usb_sndbulkpipe(dev->udev, |
2443 | - out->desc.bEndpointAddress & |
2444 | - USB_ENDPOINT_NUMBER_MASK); |
2445 | - dev->ep_intr = status; |
2446 | - |
2447 | - return 0; |
2448 | -} |
2449 | - |
2450 | static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) |
2451 | { |
2452 | struct lan78xx_priv *pdata = NULL; |
2453 | int ret; |
2454 | int i; |
2455 | |
2456 | - ret = lan78xx_get_endpoints(dev, intf); |
2457 | - if (ret) { |
2458 | - netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n", |
2459 | - ret); |
2460 | - return ret; |
2461 | - } |
2462 | - |
2463 | dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL); |
2464 | |
2465 | pdata = (struct lan78xx_priv *)(dev->data[0]); |
2466 | @@ -3333,6 +3263,7 @@ static void lan78xx_stat_monitor(unsigned long param) |
2467 | static int lan78xx_probe(struct usb_interface *intf, |
2468 | const struct usb_device_id *id) |
2469 | { |
2470 | + struct usb_host_endpoint *ep_blkin, *ep_blkout, *ep_intr; |
2471 | struct lan78xx_net *dev; |
2472 | struct net_device *netdev; |
2473 | struct usb_device *udev; |
2474 | @@ -3383,6 +3314,34 @@ static int lan78xx_probe(struct usb_interface *intf, |
2475 | |
2476 | mutex_init(&dev->stats.access_lock); |
2477 | |
2478 | + if (intf->cur_altsetting->desc.bNumEndpoints < 3) { |
2479 | + ret = -ENODEV; |
2480 | + goto out2; |
2481 | + } |
2482 | + |
2483 | + dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE); |
2484 | + ep_blkin = usb_pipe_endpoint(udev, dev->pipe_in); |
2485 | + if (!ep_blkin || !usb_endpoint_is_bulk_in(&ep_blkin->desc)) { |
2486 | + ret = -ENODEV; |
2487 | + goto out2; |
2488 | + } |
2489 | + |
2490 | + dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE); |
2491 | + ep_blkout = usb_pipe_endpoint(udev, dev->pipe_out); |
2492 | + if (!ep_blkout || !usb_endpoint_is_bulk_out(&ep_blkout->desc)) { |
2493 | + ret = -ENODEV; |
2494 | + goto out2; |
2495 | + } |
2496 | + |
2497 | + ep_intr = &intf->cur_altsetting->endpoint[2]; |
2498 | + if (!usb_endpoint_is_int_in(&ep_intr->desc)) { |
2499 | + ret = -ENODEV; |
2500 | + goto out2; |
2501 | + } |
2502 | + |
2503 | + dev->pipe_intr = usb_rcvintpipe(dev->udev, |
2504 | + usb_endpoint_num(&ep_intr->desc)); |
2505 | + |
2506 | ret = lan78xx_bind(dev, intf); |
2507 | if (ret < 0) |
2508 | goto out2; |
2509 | @@ -3392,18 +3351,7 @@ static int lan78xx_probe(struct usb_interface *intf, |
2510 | netdev->mtu = dev->hard_mtu - netdev->hard_header_len; |
2511 | netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); |
2512 | |
2513 | - dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; |
2514 | - dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; |
2515 | - dev->ep_intr = (intf->cur_altsetting)->endpoint + 2; |
2516 | - |
2517 | - dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE); |
2518 | - dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE); |
2519 | - |
2520 | - dev->pipe_intr = usb_rcvintpipe(dev->udev, |
2521 | - dev->ep_intr->desc.bEndpointAddress & |
2522 | - USB_ENDPOINT_NUMBER_MASK); |
2523 | - period = dev->ep_intr->desc.bInterval; |
2524 | - |
2525 | + period = ep_intr->desc.bInterval; |
2526 | maxp = usb_maxpacket(dev->udev, dev->pipe_intr, 0); |
2527 | buf = kmalloc(maxp, GFP_KERNEL); |
2528 | if (buf) { |
2529 | @@ -3416,6 +3364,7 @@ static int lan78xx_probe(struct usb_interface *intf, |
2530 | usb_fill_int_urb(dev->urb_intr, dev->udev, |
2531 | dev->pipe_intr, buf, maxp, |
2532 | intr_complete, dev, period); |
2533 | + dev->urb_intr->transfer_flags |= URB_FREE_BUFFER; |
2534 | } |
2535 | } |
2536 | |
2537 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
2538 | index b1470d30d079f..088bb5870ac5b 100644 |
2539 | --- a/drivers/net/vxlan.c |
2540 | +++ b/drivers/net/vxlan.c |
2541 | @@ -889,6 +889,7 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, |
2542 | for (h = 0; h < FDB_HASH_SIZE; ++h) { |
2543 | struct vxlan_fdb *f; |
2544 | |
2545 | + rcu_read_lock(); |
2546 | hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) { |
2547 | struct vxlan_rdst *rd; |
2548 | |
2549 | @@ -901,12 +902,15 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, |
2550 | cb->nlh->nlmsg_seq, |
2551 | RTM_NEWNEIGH, |
2552 | NLM_F_MULTI, rd); |
2553 | - if (err < 0) |
2554 | + if (err < 0) { |
2555 | + rcu_read_unlock(); |
2556 | goto out; |
2557 | + } |
2558 | skip: |
2559 | *idx += 1; |
2560 | } |
2561 | } |
2562 | + rcu_read_unlock(); |
2563 | } |
2564 | out: |
2565 | return err; |
2566 | @@ -2106,7 +2110,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
2567 | else if (info->key.tun_flags & TUNNEL_DONT_FRAGMENT) |
2568 | df = htons(IP_DF); |
2569 | |
2570 | - tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
2571 | + tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
2572 | ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
2573 | err = vxlan_build_skb(skb, &rt->dst, sizeof(struct iphdr), |
2574 | vni, md, flags, udp_sum); |
2575 | @@ -2165,7 +2169,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
2576 | if (!info) |
2577 | udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); |
2578 | |
2579 | - tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
2580 | + tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
2581 | ttl = ttl ? : ip6_dst_hoplimit(ndst); |
2582 | skb_scrub_packet(skb, xnet); |
2583 | err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr), |
2584 | diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c |
2585 | index f5657783fad4e..6eb0f7a85e531 100644 |
2586 | --- a/drivers/net/wan/lapbether.c |
2587 | +++ b/drivers/net/wan/lapbether.c |
2588 | @@ -160,6 +160,12 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, |
2589 | if (!netif_running(dev)) |
2590 | goto drop; |
2591 | |
2592 | + /* There should be a pseudo header of 1 byte added by upper layers. |
2593 | + * Check to make sure it is there before reading it. |
2594 | + */ |
2595 | + if (skb->len < 1) |
2596 | + goto drop; |
2597 | + |
2598 | switch (skb->data[0]) { |
2599 | case X25_IFACE_DATA: |
2600 | break; |
2601 | @@ -308,6 +314,7 @@ static void lapbeth_setup(struct net_device *dev) |
2602 | dev->netdev_ops = &lapbeth_netdev_ops; |
2603 | dev->destructor = free_netdev; |
2604 | dev->type = ARPHRD_X25; |
2605 | + dev->hard_header_len = 0; |
2606 | dev->mtu = 1000; |
2607 | dev->addr_len = 0; |
2608 | } |
2609 | @@ -334,7 +341,8 @@ static int lapbeth_new_device(struct net_device *dev) |
2610 | * then this driver prepends a length field of 2 bytes, |
2611 | * then the underlying Ethernet device prepends its own header. |
2612 | */ |
2613 | - ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len; |
2614 | + ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len |
2615 | + + dev->needed_headroom; |
2616 | |
2617 | lapbeth = netdev_priv(ndev); |
2618 | lapbeth->axdev = ndev; |
2619 | diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c |
2620 | index 257b6ee51e54b..1af216aa5adae 100644 |
2621 | --- a/drivers/net/wireless/ath/ath9k/htc_hst.c |
2622 | +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c |
2623 | @@ -175,6 +175,7 @@ static int htc_config_pipe_credits(struct htc_target *target) |
2624 | time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); |
2625 | if (!time_left) { |
2626 | dev_err(target->dev, "HTC credit config timeout\n"); |
2627 | + kfree_skb(skb); |
2628 | return -ETIMEDOUT; |
2629 | } |
2630 | |
2631 | @@ -211,6 +212,7 @@ static int htc_setup_complete(struct htc_target *target) |
2632 | time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); |
2633 | if (!time_left) { |
2634 | dev_err(target->dev, "HTC start timeout\n"); |
2635 | + kfree_skb(skb); |
2636 | return -ETIMEDOUT; |
2637 | } |
2638 | |
2639 | @@ -284,6 +286,7 @@ int htc_connect_service(struct htc_target *target, |
2640 | if (!time_left) { |
2641 | dev_err(target->dev, "Service connection timeout for: %d\n", |
2642 | service_connreq->service_id); |
2643 | + kfree_skb(skb); |
2644 | return -ETIMEDOUT; |
2645 | } |
2646 | |
2647 | diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c |
2648 | index 8f14897ae5a33..f100533eb7adc 100644 |
2649 | --- a/drivers/net/wireless/ath/ath9k/wmi.c |
2650 | +++ b/drivers/net/wireless/ath/ath9k/wmi.c |
2651 | @@ -340,6 +340,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, |
2652 | ath_dbg(common, WMI, "Timeout waiting for WMI command: %s\n", |
2653 | wmi_cmd_to_name(cmd_id)); |
2654 | mutex_unlock(&wmi->op_mutex); |
2655 | + kfree_skb(skb); |
2656 | return -ETIMEDOUT; |
2657 | } |
2658 | |
2659 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
2660 | index 59013572fbe3f..d6a4a08fd3c44 100644 |
2661 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
2662 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
2663 | @@ -30,7 +30,7 @@ |
2664 | #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 |
2665 | |
2666 | #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ |
2667 | -#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002 |
2668 | +#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0004 |
2669 | |
2670 | #define BRCMF_STA_WME 0x00000002 /* WMM association */ |
2671 | #define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */ |
2672 | diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c |
2673 | index db2373fe8ac32..55573d090503b 100644 |
2674 | --- a/drivers/net/wireless/intel/iwlegacy/common.c |
2675 | +++ b/drivers/net/wireless/intel/iwlegacy/common.c |
2676 | @@ -4302,8 +4302,8 @@ il_apm_init(struct il_priv *il) |
2677 | * power savings, even without L1. |
2678 | */ |
2679 | if (il->cfg->set_l0s) { |
2680 | - pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
2681 | - if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { |
2682 | + ret = pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
2683 | + if (!ret && (lctl & PCI_EXP_LNKCTL_ASPM_L1)) { |
2684 | /* L1-ASPM enabled; disable(!) L0S */ |
2685 | il_set_bit(il, CSR_GIO_REG, |
2686 | CSR_GIO_REG_VAL_L0S_ENABLED); |
2687 | diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
2688 | index 8548027abf71b..1e26936c0d727 100644 |
2689 | --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
2690 | +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
2691 | @@ -586,6 +586,11 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
2692 | { |
2693 | struct host_cmd_ds_802_11_key_material *key = |
2694 | &resp->params.key_material; |
2695 | + int len; |
2696 | + |
2697 | + len = le16_to_cpu(key->key_param_set.key_len); |
2698 | + if (len > sizeof(key->key_param_set.key)) |
2699 | + return -EINVAL; |
2700 | |
2701 | if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { |
2702 | if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { |
2703 | @@ -599,9 +604,8 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
2704 | |
2705 | memset(priv->aes_key.key_param_set.key, 0, |
2706 | sizeof(key->key_param_set.key)); |
2707 | - priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; |
2708 | - memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, |
2709 | - le16_to_cpu(priv->aes_key.key_param_set.key_len)); |
2710 | + priv->aes_key.key_param_set.key_len = cpu_to_le16(len); |
2711 | + memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, len); |
2712 | |
2713 | return 0; |
2714 | } |
2715 | @@ -616,9 +620,14 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
2716 | struct host_cmd_ds_command *resp) |
2717 | { |
2718 | struct host_cmd_ds_802_11_key_material_v2 *key_v2; |
2719 | - __le16 len; |
2720 | + int len; |
2721 | |
2722 | key_v2 = &resp->params.key_material_v2; |
2723 | + |
2724 | + len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len); |
2725 | + if (len > WLAN_KEY_LEN_CCMP) |
2726 | + return -EINVAL; |
2727 | + |
2728 | if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { |
2729 | if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) { |
2730 | mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n"); |
2731 | @@ -634,10 +643,9 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
2732 | memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0, |
2733 | WLAN_KEY_LEN_CCMP); |
2734 | priv->aes_key_v2.key_param_set.key_params.aes.key_len = |
2735 | - key_v2->key_param_set.key_params.aes.key_len; |
2736 | - len = priv->aes_key_v2.key_param_set.key_params.aes.key_len; |
2737 | + cpu_to_le16(len); |
2738 | memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key, |
2739 | - key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len)); |
2740 | + key_v2->key_param_set.key_params.aes.key, len); |
2741 | |
2742 | return 0; |
2743 | } |
2744 | diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c |
2745 | index d0593bc1f1a92..daddeaa66bf4a 100644 |
2746 | --- a/drivers/net/wireless/ti/wl1251/event.c |
2747 | +++ b/drivers/net/wireless/ti/wl1251/event.c |
2748 | @@ -84,7 +84,7 @@ static int wl1251_event_ps_report(struct wl1251 *wl, |
2749 | break; |
2750 | } |
2751 | |
2752 | - return 0; |
2753 | + return ret; |
2754 | } |
2755 | |
2756 | static void wl1251_event_mbox_dump(struct event_mailbox *mbox) |
2757 | diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
2758 | index 6d391a268469f..ceaf6b30d683d 100644 |
2759 | --- a/drivers/net/xen-netfront.c |
2760 | +++ b/drivers/net/xen-netfront.c |
2761 | @@ -62,6 +62,8 @@ module_param_named(max_queues, xennet_max_queues, uint, 0644); |
2762 | MODULE_PARM_DESC(max_queues, |
2763 | "Maximum number of queues per virtual interface"); |
2764 | |
2765 | +#define XENNET_TIMEOUT (5 * HZ) |
2766 | + |
2767 | static const struct ethtool_ops xennet_ethtool_ops; |
2768 | |
2769 | struct netfront_cb { |
2770 | @@ -1355,12 +1357,15 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) |
2771 | |
2772 | netif_carrier_off(netdev); |
2773 | |
2774 | - xenbus_switch_state(dev, XenbusStateInitialising); |
2775 | - wait_event(module_wq, |
2776 | - xenbus_read_driver_state(dev->otherend) != |
2777 | - XenbusStateClosed && |
2778 | - xenbus_read_driver_state(dev->otherend) != |
2779 | - XenbusStateUnknown); |
2780 | + do { |
2781 | + xenbus_switch_state(dev, XenbusStateInitialising); |
2782 | + err = wait_event_timeout(module_wq, |
2783 | + xenbus_read_driver_state(dev->otherend) != |
2784 | + XenbusStateClosed && |
2785 | + xenbus_read_driver_state(dev->otherend) != |
2786 | + XenbusStateUnknown, XENNET_TIMEOUT); |
2787 | + } while (!err); |
2788 | + |
2789 | return netdev; |
2790 | |
2791 | exit: |
2792 | @@ -2172,28 +2177,43 @@ static const struct attribute_group xennet_dev_group = { |
2793 | }; |
2794 | #endif /* CONFIG_SYSFS */ |
2795 | |
2796 | -static int xennet_remove(struct xenbus_device *dev) |
2797 | +static void xennet_bus_close(struct xenbus_device *dev) |
2798 | { |
2799 | - struct netfront_info *info = dev_get_drvdata(&dev->dev); |
2800 | - |
2801 | - dev_dbg(&dev->dev, "%s\n", dev->nodename); |
2802 | + int ret; |
2803 | |
2804 | - if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) { |
2805 | + if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed) |
2806 | + return; |
2807 | + do { |
2808 | xenbus_switch_state(dev, XenbusStateClosing); |
2809 | - wait_event(module_wq, |
2810 | - xenbus_read_driver_state(dev->otherend) == |
2811 | - XenbusStateClosing || |
2812 | - xenbus_read_driver_state(dev->otherend) == |
2813 | - XenbusStateUnknown); |
2814 | + ret = wait_event_timeout(module_wq, |
2815 | + xenbus_read_driver_state(dev->otherend) == |
2816 | + XenbusStateClosing || |
2817 | + xenbus_read_driver_state(dev->otherend) == |
2818 | + XenbusStateClosed || |
2819 | + xenbus_read_driver_state(dev->otherend) == |
2820 | + XenbusStateUnknown, |
2821 | + XENNET_TIMEOUT); |
2822 | + } while (!ret); |
2823 | + |
2824 | + if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed) |
2825 | + return; |
2826 | |
2827 | + do { |
2828 | xenbus_switch_state(dev, XenbusStateClosed); |
2829 | - wait_event(module_wq, |
2830 | - xenbus_read_driver_state(dev->otherend) == |
2831 | - XenbusStateClosed || |
2832 | - xenbus_read_driver_state(dev->otherend) == |
2833 | - XenbusStateUnknown); |
2834 | - } |
2835 | + ret = wait_event_timeout(module_wq, |
2836 | + xenbus_read_driver_state(dev->otherend) == |
2837 | + XenbusStateClosed || |
2838 | + xenbus_read_driver_state(dev->otherend) == |
2839 | + XenbusStateUnknown, |
2840 | + XENNET_TIMEOUT); |
2841 | + } while (!ret); |
2842 | +} |
2843 | + |
2844 | +static int xennet_remove(struct xenbus_device *dev) |
2845 | +{ |
2846 | + struct netfront_info *info = dev_get_drvdata(&dev->dev); |
2847 | |
2848 | + xennet_bus_close(dev); |
2849 | xennet_disconnect_backend(info); |
2850 | |
2851 | if (info->netdev->reg_state == NETREG_REGISTERED) |
2852 | diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c |
2853 | index 9d9c8d57a042d..64b58455e620b 100644 |
2854 | --- a/drivers/nfc/s3fwrn5/core.c |
2855 | +++ b/drivers/nfc/s3fwrn5/core.c |
2856 | @@ -209,6 +209,7 @@ int s3fwrn5_recv_frame(struct nci_dev *ndev, struct sk_buff *skb, |
2857 | case S3FWRN5_MODE_FW: |
2858 | return s3fwrn5_fw_recv_frame(ndev, skb); |
2859 | default: |
2860 | + kfree_skb(skb); |
2861 | return -ENODEV; |
2862 | } |
2863 | } |
2864 | diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c |
2865 | index 188fab57d170e..a7f542e784dd0 100644 |
2866 | --- a/drivers/parisc/sba_iommu.c |
2867 | +++ b/drivers/parisc/sba_iommu.c |
2868 | @@ -1283,7 +1283,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) |
2869 | ** (one that doesn't overlap memory or LMMIO space) in the |
2870 | ** IBASE and IMASK registers. |
2871 | */ |
2872 | - ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE); |
2873 | + ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE) & ~0x1fffffULL; |
2874 | iova_space_size = ~(READ_REG(ioc->ioc_hpa + IOC_IMASK) & 0xFFFFFFFFUL) + 1; |
2875 | |
2876 | if ((ioc->ibase < 0xfed00000UL) && ((ioc->ibase + iova_space_size) > 0xfee00000UL)) { |
2877 | diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
2878 | index 7b5cf6d1181a9..6f2a07567532d 100644 |
2879 | --- a/drivers/pci/access.c |
2880 | +++ b/drivers/pci/access.c |
2881 | @@ -185,17 +185,13 @@ EXPORT_SYMBOL(pci_bus_set_ops); |
2882 | static DECLARE_WAIT_QUEUE_HEAD(pci_cfg_wait); |
2883 | |
2884 | static noinline void pci_wait_cfg(struct pci_dev *dev) |
2885 | + __must_hold(&pci_lock) |
2886 | { |
2887 | - DECLARE_WAITQUEUE(wait, current); |
2888 | - |
2889 | - __add_wait_queue(&pci_cfg_wait, &wait); |
2890 | do { |
2891 | - set_current_state(TASK_UNINTERRUPTIBLE); |
2892 | raw_spin_unlock_irq(&pci_lock); |
2893 | - schedule(); |
2894 | + wait_event(pci_cfg_wait, !dev->block_cfg_access); |
2895 | raw_spin_lock_irq(&pci_lock); |
2896 | } while (dev->block_cfg_access); |
2897 | - __remove_wait_queue(&pci_cfg_wait, &wait); |
2898 | } |
2899 | |
2900 | /* Returns 0 on success, negative values indicate error. */ |
2901 | diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c |
2902 | index d44b55879c673..7f2b9ef185e44 100644 |
2903 | --- a/drivers/pci/hotplug/acpiphp_glue.c |
2904 | +++ b/drivers/pci/hotplug/acpiphp_glue.c |
2905 | @@ -136,13 +136,21 @@ static struct acpiphp_context *acpiphp_grab_context(struct acpi_device *adev) |
2906 | struct acpiphp_context *context; |
2907 | |
2908 | acpi_lock_hp_context(); |
2909 | + |
2910 | context = acpiphp_get_context(adev); |
2911 | - if (!context || context->func.parent->is_going_away) { |
2912 | - acpi_unlock_hp_context(); |
2913 | - return NULL; |
2914 | + if (!context) |
2915 | + goto unlock; |
2916 | + |
2917 | + if (context->func.parent->is_going_away) { |
2918 | + acpiphp_put_context(context); |
2919 | + context = NULL; |
2920 | + goto unlock; |
2921 | } |
2922 | + |
2923 | get_bridge(context->func.parent); |
2924 | acpiphp_put_context(context); |
2925 | + |
2926 | +unlock: |
2927 | acpi_unlock_hp_context(); |
2928 | return context; |
2929 | } |
2930 | diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
2931 | index 75551a781e887..5eae5f35dcc7b 100644 |
2932 | --- a/drivers/pci/pcie/aspm.c |
2933 | +++ b/drivers/pci/pcie/aspm.c |
2934 | @@ -832,6 +832,7 @@ static int pcie_aspm_get_policy(char *buffer, struct kernel_param *kp) |
2935 | cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); |
2936 | else |
2937 | cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); |
2938 | + cnt += sprintf(buffer + cnt, "\n"); |
2939 | return cnt; |
2940 | } |
2941 | |
2942 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
2943 | index 496296bc35816..1fdb1ef5eaaeb 100644 |
2944 | --- a/drivers/pci/quirks.c |
2945 | +++ b/drivers/pci/quirks.c |
2946 | @@ -2046,6 +2046,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s); |
2947 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s); |
2948 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s); |
2949 | |
2950 | +static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev) |
2951 | +{ |
2952 | + pci_info(dev, "Disabling ASPM L0s/L1\n"); |
2953 | + pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); |
2954 | +} |
2955 | + |
2956 | +/* |
2957 | + * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the |
2958 | + * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected; |
2959 | + * disable both L0s and L1 for now to be safe. |
2960 | + */ |
2961 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1); |
2962 | + |
2963 | /* |
2964 | * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain |
2965 | * Link bit cleared after starting the link retrain process to allow this |
2966 | diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c |
2967 | index bfdf720db270d..8769a579ecb13 100644 |
2968 | --- a/drivers/pinctrl/pinctrl-single.c |
2969 | +++ b/drivers/pinctrl/pinctrl-single.c |
2970 | @@ -1078,7 +1078,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
2971 | |
2972 | /* If pinconf isn't supported, don't parse properties in below. */ |
2973 | if (!PCS_HAS_PINCONF) |
2974 | - return 0; |
2975 | + return -ENOTSUPP; |
2976 | |
2977 | /* cacluate how much properties are supported in current node */ |
2978 | for (i = 0; i < ARRAY_SIZE(prop2); i++) { |
2979 | @@ -1090,7 +1090,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
2980 | nconfs++; |
2981 | } |
2982 | if (!nconfs) |
2983 | - return 0; |
2984 | + return -ENOTSUPP; |
2985 | |
2986 | func->conf = devm_kzalloc(pcs->dev, |
2987 | sizeof(struct pcs_conf_vals) * nconfs, |
2988 | @@ -1203,9 +1203,12 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, |
2989 | |
2990 | if (PCS_HAS_PINCONF) { |
2991 | res = pcs_parse_pinconf(pcs, np, function, map); |
2992 | - if (res) |
2993 | + if (res == 0) |
2994 | + *num_maps = 2; |
2995 | + else if (res == -ENOTSUPP) |
2996 | + *num_maps = 1; |
2997 | + else |
2998 | goto free_pingroups; |
2999 | - *num_maps = 2; |
3000 | } else { |
3001 | *num_maps = 1; |
3002 | } |
3003 | diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c |
3004 | index 12dbb50633761..a5c645b9e3f2a 100644 |
3005 | --- a/drivers/platform/x86/intel-hid.c |
3006 | +++ b/drivers/platform/x86/intel-hid.c |
3007 | @@ -264,7 +264,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
3008 | return AE_OK; |
3009 | |
3010 | if (acpi_match_device_ids(dev, ids) == 0) |
3011 | - if (acpi_create_platform_device(dev, NULL)) |
3012 | + if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
3013 | dev_info(&dev->dev, |
3014 | "intel-hid: created platform device\n"); |
3015 | |
3016 | diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
3017 | index a74340dff530e..1cf2a38add5f9 100644 |
3018 | --- a/drivers/platform/x86/intel-vbtn.c |
3019 | +++ b/drivers/platform/x86/intel-vbtn.c |
3020 | @@ -168,7 +168,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
3021 | return AE_OK; |
3022 | |
3023 | if (acpi_match_device_ids(dev, ids) == 0) |
3024 | - if (acpi_create_platform_device(dev, NULL)) |
3025 | + if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
3026 | dev_info(&dev->dev, |
3027 | "intel-vbtn: created platform device\n"); |
3028 | |
3029 | diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c |
3030 | index 63c57dc82ac1d..4eda5065b5bbc 100644 |
3031 | --- a/drivers/power/supply/88pm860x_battery.c |
3032 | +++ b/drivers/power/supply/88pm860x_battery.c |
3033 | @@ -436,7 +436,7 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
3034 | int ret; |
3035 | int data; |
3036 | int bat_remove; |
3037 | - int soc; |
3038 | + int soc = 0; |
3039 | |
3040 | /* measure enable on GPADC1 */ |
3041 | data = MEAS1_GP1; |
3042 | @@ -499,7 +499,9 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
3043 | } |
3044 | mutex_unlock(&info->lock); |
3045 | |
3046 | - calc_soc(info, OCV_MODE_ACTIVE, &soc); |
3047 | + ret = calc_soc(info, OCV_MODE_ACTIVE, &soc); |
3048 | + if (ret < 0) |
3049 | + goto out; |
3050 | |
3051 | data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG); |
3052 | bat_remove = data & BAT_WU_LOG; |
3053 | diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c |
3054 | index 31b01035d0ab3..8cfba3614e601 100644 |
3055 | --- a/drivers/pwm/pwm-bcm-iproc.c |
3056 | +++ b/drivers/pwm/pwm-bcm-iproc.c |
3057 | @@ -85,8 +85,6 @@ static void iproc_pwmc_get_state(struct pwm_chip *chip, struct pwm_device *pwm, |
3058 | u64 tmp, multi, rate; |
3059 | u32 value, prescale; |
3060 | |
3061 | - rate = clk_get_rate(ip->clk); |
3062 | - |
3063 | value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); |
3064 | |
3065 | if (value & BIT(IPROC_PWM_CTRL_EN_SHIFT(pwm->hwpwm))) |
3066 | @@ -99,6 +97,13 @@ static void iproc_pwmc_get_state(struct pwm_chip *chip, struct pwm_device *pwm, |
3067 | else |
3068 | state->polarity = PWM_POLARITY_INVERSED; |
3069 | |
3070 | + rate = clk_get_rate(ip->clk); |
3071 | + if (rate == 0) { |
3072 | + state->period = 0; |
3073 | + state->duty_cycle = 0; |
3074 | + return; |
3075 | + } |
3076 | + |
3077 | value = readl(ip->base + IPROC_PWM_PRESCALE_OFFSET); |
3078 | prescale = value >> IPROC_PWM_PRESCALE_SHIFT(pwm->hwpwm); |
3079 | prescale &= IPROC_PWM_PRESCALE_MAX; |
3080 | diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
3081 | index 51152681aba6e..c878c87966163 100644 |
3082 | --- a/drivers/s390/net/qeth_l2_main.c |
3083 | +++ b/drivers/s390/net/qeth_l2_main.c |
3084 | @@ -1675,6 +1675,10 @@ static void qeth_bridge_state_change(struct qeth_card *card, |
3085 | int extrasize; |
3086 | |
3087 | QETH_CARD_TEXT(card, 2, "brstchng"); |
3088 | + if (qports->num_entries == 0) { |
3089 | + QETH_CARD_TEXT(card, 2, "BPempty"); |
3090 | + return; |
3091 | + } |
3092 | if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { |
3093 | QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); |
3094 | return; |
3095 | diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c |
3096 | index edce5f3cfdba0..93ba83e3148eb 100644 |
3097 | --- a/drivers/scsi/arm/cumana_2.c |
3098 | +++ b/drivers/scsi/arm/cumana_2.c |
3099 | @@ -454,7 +454,7 @@ static int cumanascsi2_probe(struct expansion_card *ec, |
3100 | |
3101 | if (info->info.scsi.dma != NO_DMA) |
3102 | free_dma(info->info.scsi.dma); |
3103 | - free_irq(ec->irq, host); |
3104 | + free_irq(ec->irq, info); |
3105 | |
3106 | out_release: |
3107 | fas216_release(host); |
3108 | diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c |
3109 | index e93e047f43165..65bb34ce93b94 100644 |
3110 | --- a/drivers/scsi/arm/eesox.c |
3111 | +++ b/drivers/scsi/arm/eesox.c |
3112 | @@ -575,7 +575,7 @@ static int eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
3113 | |
3114 | if (info->info.scsi.dma != NO_DMA) |
3115 | free_dma(info->info.scsi.dma); |
3116 | - free_irq(ec->irq, host); |
3117 | + free_irq(ec->irq, info); |
3118 | |
3119 | out_remove: |
3120 | fas216_remove(host); |
3121 | diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c |
3122 | index 79aa88911b7f3..b5e4a25ea1ef3 100644 |
3123 | --- a/drivers/scsi/arm/powertec.c |
3124 | +++ b/drivers/scsi/arm/powertec.c |
3125 | @@ -382,7 +382,7 @@ static int powertecscsi_probe(struct expansion_card *ec, |
3126 | |
3127 | if (info->info.scsi.dma != NO_DMA) |
3128 | free_dma(info->info.scsi.dma); |
3129 | - free_irq(ec->irq, host); |
3130 | + free_irq(ec->irq, info); |
3131 | |
3132 | out_release: |
3133 | fas216_release(host); |
3134 | diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c |
3135 | index 1753e42826dd9..a880abf5abaad 100644 |
3136 | --- a/drivers/scsi/mesh.c |
3137 | +++ b/drivers/scsi/mesh.c |
3138 | @@ -1044,6 +1044,8 @@ static void handle_error(struct mesh_state *ms) |
3139 | while ((in_8(&mr->bus_status1) & BS1_RST) != 0) |
3140 | udelay(1); |
3141 | printk("done\n"); |
3142 | + if (ms->dma_started) |
3143 | + halt_dma(ms); |
3144 | handle_reset(ms); |
3145 | /* request_q is empty, no point in mesh_start() */ |
3146 | return; |
3147 | @@ -1356,7 +1358,8 @@ static void halt_dma(struct mesh_state *ms) |
3148 | ms->conn_tgt, ms->data_ptr, scsi_bufflen(cmd), |
3149 | ms->tgts[ms->conn_tgt].data_goes_out); |
3150 | } |
3151 | - scsi_dma_unmap(cmd); |
3152 | + if (cmd) |
3153 | + scsi_dma_unmap(cmd); |
3154 | ms->dma_started = 0; |
3155 | } |
3156 | |
3157 | @@ -1711,6 +1714,9 @@ static int mesh_host_reset(struct scsi_cmnd *cmd) |
3158 | |
3159 | spin_lock_irqsave(ms->host->host_lock, flags); |
3160 | |
3161 | + if (ms->dma_started) |
3162 | + halt_dma(ms); |
3163 | + |
3164 | /* Reset the controller & dbdma channel */ |
3165 | out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* stop dma */ |
3166 | out_8(&mr->exception, 0xff); /* clear all exception bits */ |
3167 | diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
3168 | index d7118d3767c35..99bfb003be3fc 100644 |
3169 | --- a/drivers/scsi/scsi_debug.c |
3170 | +++ b/drivers/scsi/scsi_debug.c |
3171 | @@ -4986,6 +4986,12 @@ static int __init scsi_debug_init(void) |
3172 | pr_err("submit_queues must be 1 or more\n"); |
3173 | return -EINVAL; |
3174 | } |
3175 | + |
3176 | + if ((sdebug_max_queue > SDEBUG_CANQUEUE) || (sdebug_max_queue < 1)) { |
3177 | + pr_err("max_queue must be in range [1, %d]\n", SDEBUG_CANQUEUE); |
3178 | + return -EINVAL; |
3179 | + } |
3180 | + |
3181 | sdebug_q_arr = kcalloc(submit_queues, sizeof(struct sdebug_queue), |
3182 | GFP_KERNEL); |
3183 | if (sdebug_q_arr == NULL) |
3184 | diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
3185 | index 6ec3790566504..fa4c47c7d2166 100644 |
3186 | --- a/drivers/staging/rtl8192u/r8192U_core.c |
3187 | +++ b/drivers/staging/rtl8192u/r8192U_core.c |
3188 | @@ -2522,7 +2522,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) |
3189 | ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK >> 1)); |
3190 | if (ret < 0) |
3191 | return ret; |
3192 | - priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8; |
3193 | + priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8; |
3194 | } else |
3195 | priv->EEPROMTxPowerLevelCCK = 0x10; |
3196 | RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK); |
3197 | diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c |
3198 | index 38926495c751d..f985315ebd3bd 100644 |
3199 | --- a/drivers/usb/dwc2/platform.c |
3200 | +++ b/drivers/usb/dwc2/platform.c |
3201 | @@ -668,6 +668,7 @@ static int dwc2_driver_probe(struct platform_device *dev) |
3202 | if (hsotg->gadget_enabled) { |
3203 | retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget); |
3204 | if (retval) { |
3205 | + hsotg->gadget.udc = NULL; |
3206 | dwc2_hsotg_remove(hsotg); |
3207 | goto error; |
3208 | } |
3209 | @@ -676,7 +677,8 @@ static int dwc2_driver_probe(struct platform_device *dev) |
3210 | return 0; |
3211 | |
3212 | error: |
3213 | - dwc2_lowlevel_hw_disable(hsotg); |
3214 | + if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) |
3215 | + dwc2_lowlevel_hw_disable(hsotg); |
3216 | return retval; |
3217 | } |
3218 | |
3219 | diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
3220 | index e9bd8d4abca00..f09a74d79c9eb 100644 |
3221 | --- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
3222 | +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
3223 | @@ -286,6 +286,7 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
3224 | * in that case reinit is passed as 1 |
3225 | */ |
3226 | if (reinit) { |
3227 | + int i; |
3228 | /* Enable interrupts */ |
3229 | temp = bdc_readl(bdc->regs, BDC_BDCSC); |
3230 | temp |= BDC_GIE; |
3231 | @@ -295,6 +296,9 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
3232 | /* Initialize SRR to 0 */ |
3233 | memset(bdc->srr.sr_bds, 0, |
3234 | NUM_SR_ENTRIES * sizeof(struct bdc_bd)); |
3235 | + /* clear ep flags to avoid post disconnect stops/deconfigs */ |
3236 | + for (i = 1; i < bdc->num_eps; ++i) |
3237 | + bdc->bdc_ep_array[i]->flags = 0; |
3238 | } else { |
3239 | /* One time initiaization only */ |
3240 | /* Enable status report function pointers */ |
3241 | diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
3242 | index 303735c7990c8..8b1b48fa4ebfc 100644 |
3243 | --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
3244 | +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
3245 | @@ -621,7 +621,6 @@ int bdc_ep_enable(struct bdc_ep *ep) |
3246 | } |
3247 | bdc_dbg_bd_list(bdc, ep); |
3248 | /* only for ep0: config ep is called for ep0 from connect event */ |
3249 | - ep->flags |= BDC_EP_ENABLED; |
3250 | if (ep->ep_num == 1) |
3251 | return ret; |
3252 | |
3253 | @@ -765,10 +764,13 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) |
3254 | __func__, ep->name, start_bdi, end_bdi); |
3255 | dev_dbg(bdc->dev, "ep_dequeue ep=%p ep->desc=%p\n", |
3256 | ep, (void *)ep->usb_ep.desc); |
3257 | - /* Stop the ep to see where the HW is ? */ |
3258 | - ret = bdc_stop_ep(bdc, ep->ep_num); |
3259 | - /* if there is an issue with stopping ep, then no need to go further */ |
3260 | - if (ret) |
3261 | + /* if still connected, stop the ep to see where the HW is ? */ |
3262 | + if (!(bdc_readl(bdc->regs, BDC_USPC) & BDC_PST_MASK)) { |
3263 | + ret = bdc_stop_ep(bdc, ep->ep_num); |
3264 | + /* if there is an issue, then no need to go further */ |
3265 | + if (ret) |
3266 | + return 0; |
3267 | + } else |
3268 | return 0; |
3269 | |
3270 | /* |
3271 | @@ -1917,7 +1919,9 @@ static int bdc_gadget_ep_disable(struct usb_ep *_ep) |
3272 | __func__, ep->name, ep->flags); |
3273 | |
3274 | if (!(ep->flags & BDC_EP_ENABLED)) { |
3275 | - dev_warn(bdc->dev, "%s is already disabled\n", ep->name); |
3276 | + if (bdc->gadget.speed != USB_SPEED_UNKNOWN) |
3277 | + dev_warn(bdc->dev, "%s is already disabled\n", |
3278 | + ep->name); |
3279 | return 0; |
3280 | } |
3281 | spin_lock_irqsave(&bdc->lock, flags); |
3282 | diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
3283 | index dfaed8e8cc524..c8c45264e94cc 100644 |
3284 | --- a/drivers/usb/gadget/udc/net2280.c |
3285 | +++ b/drivers/usb/gadget/udc/net2280.c |
3286 | @@ -3785,8 +3785,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
3287 | return 0; |
3288 | |
3289 | done: |
3290 | - if (dev) |
3291 | + if (dev) { |
3292 | net2280_remove(pdev); |
3293 | + kfree(dev); |
3294 | + } |
3295 | return retval; |
3296 | } |
3297 | |
3298 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
3299 | index 613544d25fadc..abf8a3cac2651 100644 |
3300 | --- a/drivers/usb/serial/cp210x.c |
3301 | +++ b/drivers/usb/serial/cp210x.c |
3302 | @@ -255,6 +255,8 @@ static struct usb_serial_driver cp210x_device = { |
3303 | .break_ctl = cp210x_break_ctl, |
3304 | .set_termios = cp210x_set_termios, |
3305 | .tx_empty = cp210x_tx_empty, |
3306 | + .throttle = usb_serial_generic_throttle, |
3307 | + .unthrottle = usb_serial_generic_unthrottle, |
3308 | .tiocmget = cp210x_tiocmget, |
3309 | .tiocmset = cp210x_tiocmset, |
3310 | .port_probe = cp210x_port_probe, |
3311 | @@ -765,6 +767,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
3312 | u32 baud; |
3313 | u16 bits; |
3314 | u32 ctl_hs; |
3315 | + u32 flow_repl; |
3316 | |
3317 | cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud); |
3318 | |
3319 | @@ -865,6 +868,22 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
3320 | ctl_hs = le32_to_cpu(flow_ctl.ulControlHandshake); |
3321 | if (ctl_hs & CP210X_SERIAL_CTS_HANDSHAKE) { |
3322 | dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); |
3323 | + /* |
3324 | + * When the port is closed, the CP210x hardware disables |
3325 | + * auto-RTS and RTS is deasserted but it leaves auto-CTS when |
3326 | + * in hardware flow control mode. When re-opening the port, if |
3327 | + * auto-CTS is enabled on the cp210x, then auto-RTS must be |
3328 | + * re-enabled in the driver. |
3329 | + */ |
3330 | + flow_repl = le32_to_cpu(flow_ctl.ulFlowReplace); |
3331 | + flow_repl &= ~CP210X_SERIAL_RTS_MASK; |
3332 | + flow_repl |= CP210X_SERIAL_RTS_SHIFT(CP210X_SERIAL_RTS_FLOW_CTL); |
3333 | + flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); |
3334 | + cp210x_write_reg_block(port, |
3335 | + CP210X_SET_FLOW, |
3336 | + &flow_ctl, |
3337 | + sizeof(flow_ctl)); |
3338 | + |
3339 | cflag |= CRTSCTS; |
3340 | } else { |
3341 | dev_dbg(dev, "%s - flow control = NONE\n", __func__); |
3342 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
3343 | index a7cb0968259ee..0c8b24ff44a05 100644 |
3344 | --- a/drivers/usb/serial/ftdi_sio.c |
3345 | +++ b/drivers/usb/serial/ftdi_sio.c |
3346 | @@ -2051,12 +2051,11 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, |
3347 | #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) |
3348 | |
3349 | static int ftdi_process_packet(struct usb_serial_port *port, |
3350 | - struct ftdi_private *priv, char *packet, int len) |
3351 | + struct ftdi_private *priv, unsigned char *buf, int len) |
3352 | { |
3353 | + unsigned char status; |
3354 | int i; |
3355 | - char status; |
3356 | char flag; |
3357 | - char *ch; |
3358 | |
3359 | if (len < 2) { |
3360 | dev_dbg(&port->dev, "malformed packet\n"); |
3361 | @@ -2066,7 +2065,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
3362 | /* Compare new line status to the old one, signal if different/ |
3363 | N.B. packet may be processed more than once, but differences |
3364 | are only processed once. */ |
3365 | - status = packet[0] & FTDI_STATUS_B0_MASK; |
3366 | + status = buf[0] & FTDI_STATUS_B0_MASK; |
3367 | if (status != priv->prev_status) { |
3368 | char diff_status = status ^ priv->prev_status; |
3369 | |
3370 | @@ -2092,13 +2091,12 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
3371 | } |
3372 | |
3373 | /* save if the transmitter is empty or not */ |
3374 | - if (packet[1] & FTDI_RS_TEMT) |
3375 | + if (buf[1] & FTDI_RS_TEMT) |
3376 | priv->transmit_empty = 1; |
3377 | else |
3378 | priv->transmit_empty = 0; |
3379 | |
3380 | - len -= 2; |
3381 | - if (!len) |
3382 | + if (len == 2) |
3383 | return 0; /* status only */ |
3384 | |
3385 | /* |
3386 | @@ -2106,40 +2104,41 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
3387 | * data payload to avoid over-reporting. |
3388 | */ |
3389 | flag = TTY_NORMAL; |
3390 | - if (packet[1] & FTDI_RS_ERR_MASK) { |
3391 | + if (buf[1] & FTDI_RS_ERR_MASK) { |
3392 | /* Break takes precedence over parity, which takes precedence |
3393 | * over framing errors */ |
3394 | - if (packet[1] & FTDI_RS_BI) { |
3395 | + if (buf[1] & FTDI_RS_BI) { |
3396 | flag = TTY_BREAK; |
3397 | port->icount.brk++; |
3398 | usb_serial_handle_break(port); |
3399 | - } else if (packet[1] & FTDI_RS_PE) { |
3400 | + } else if (buf[1] & FTDI_RS_PE) { |
3401 | flag = TTY_PARITY; |
3402 | port->icount.parity++; |
3403 | - } else if (packet[1] & FTDI_RS_FE) { |
3404 | + } else if (buf[1] & FTDI_RS_FE) { |
3405 | flag = TTY_FRAME; |
3406 | port->icount.frame++; |
3407 | } |
3408 | /* Overrun is special, not associated with a char */ |
3409 | - if (packet[1] & FTDI_RS_OE) { |
3410 | + if (buf[1] & FTDI_RS_OE) { |
3411 | port->icount.overrun++; |
3412 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
3413 | } |
3414 | } |
3415 | |
3416 | - port->icount.rx += len; |
3417 | - ch = packet + 2; |
3418 | + port->icount.rx += len - 2; |
3419 | |
3420 | if (port->port.console && port->sysrq) { |
3421 | - for (i = 0; i < len; i++, ch++) { |
3422 | - if (!usb_serial_handle_sysrq_char(port, *ch)) |
3423 | - tty_insert_flip_char(&port->port, *ch, flag); |
3424 | + for (i = 2; i < len; i++) { |
3425 | + if (usb_serial_handle_sysrq_char(port, buf[i])) |
3426 | + continue; |
3427 | + tty_insert_flip_char(&port->port, buf[i], flag); |
3428 | } |
3429 | } else { |
3430 | - tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); |
3431 | + tty_insert_flip_string_fixed_flag(&port->port, buf + 2, flag, |
3432 | + len - 2); |
3433 | } |
3434 | |
3435 | - return len; |
3436 | + return len - 2; |
3437 | } |
3438 | |
3439 | static void ftdi_process_read_urb(struct urb *urb) |
3440 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c |
3441 | index d6ac1f472b779..bdeb2b2489549 100644 |
3442 | --- a/drivers/usb/serial/iuu_phoenix.c |
3443 | +++ b/drivers/usb/serial/iuu_phoenix.c |
3444 | @@ -369,10 +369,11 @@ static void iuu_led_activity_on(struct urb *urb) |
3445 | struct usb_serial_port *port = urb->context; |
3446 | int result; |
3447 | char *buf_ptr = port->write_urb->transfer_buffer; |
3448 | - *buf_ptr++ = IUU_SET_LED; |
3449 | + |
3450 | if (xmas) { |
3451 | - get_random_bytes(buf_ptr, 6); |
3452 | - *(buf_ptr+7) = 1; |
3453 | + buf_ptr[0] = IUU_SET_LED; |
3454 | + get_random_bytes(buf_ptr + 1, 6); |
3455 | + buf_ptr[7] = 1; |
3456 | } else { |
3457 | iuu_rgbf_fill_buffer(buf_ptr, 255, 255, 0, 0, 0, 0, 255); |
3458 | } |
3459 | @@ -390,13 +391,14 @@ static void iuu_led_activity_off(struct urb *urb) |
3460 | struct usb_serial_port *port = urb->context; |
3461 | int result; |
3462 | char *buf_ptr = port->write_urb->transfer_buffer; |
3463 | + |
3464 | if (xmas) { |
3465 | iuu_rxcmd(urb); |
3466 | return; |
3467 | - } else { |
3468 | - *buf_ptr++ = IUU_SET_LED; |
3469 | - iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
3470 | } |
3471 | + |
3472 | + iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
3473 | + |
3474 | usb_fill_bulk_urb(port->write_urb, port->serial->dev, |
3475 | usb_sndbulkpipe(port->serial->dev, |
3476 | port->bulk_out_endpointAddress), |
3477 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
3478 | index c59e6d4a8a612..11fb4d78e2dbc 100644 |
3479 | --- a/drivers/usb/serial/qcserial.c |
3480 | +++ b/drivers/usb/serial/qcserial.c |
3481 | @@ -159,6 +159,7 @@ static const struct usb_device_id id_table[] = { |
3482 | {DEVICE_SWI(0x1199, 0x9056)}, /* Sierra Wireless Modem */ |
3483 | {DEVICE_SWI(0x1199, 0x9060)}, /* Sierra Wireless Modem */ |
3484 | {DEVICE_SWI(0x1199, 0x9061)}, /* Sierra Wireless Modem */ |
3485 | + {DEVICE_SWI(0x1199, 0x9062)}, /* Sierra Wireless EM7305 QDL */ |
3486 | {DEVICE_SWI(0x1199, 0x9063)}, /* Sierra Wireless EM7305 */ |
3487 | {DEVICE_SWI(0x1199, 0x9070)}, /* Sierra Wireless MC74xx */ |
3488 | {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */ |
3489 | diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c |
3490 | index dbfe4eecf12e5..05d1d36a56654 100644 |
3491 | --- a/drivers/video/console/bitblit.c |
3492 | +++ b/drivers/video/console/bitblit.c |
3493 | @@ -216,7 +216,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, |
3494 | region.color = 0; |
3495 | region.rop = ROP_COPY; |
3496 | |
3497 | - if (rw && !bottom_only) { |
3498 | + if ((int) rw > 0 && !bottom_only) { |
3499 | region.dx = info->var.xoffset + rs; |
3500 | region.dy = 0; |
3501 | region.width = rw; |
3502 | @@ -224,7 +224,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, |
3503 | info->fbops->fb_fillrect(info, ®ion); |
3504 | } |
3505 | |
3506 | - if (bh) { |
3507 | + if ((int) bh > 0) { |
3508 | region.dx = info->var.xoffset; |
3509 | region.dy = info->var.yoffset + bs; |
3510 | region.width = rs; |
3511 | diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c |
3512 | index 5a3cbf6dff4d9..34da8bba9273a 100644 |
3513 | --- a/drivers/video/console/fbcon_ccw.c |
3514 | +++ b/drivers/video/console/fbcon_ccw.c |
3515 | @@ -201,7 +201,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, |
3516 | region.color = 0; |
3517 | region.rop = ROP_COPY; |
3518 | |
3519 | - if (rw && !bottom_only) { |
3520 | + if ((int) rw > 0 && !bottom_only) { |
3521 | region.dx = 0; |
3522 | region.dy = info->var.yoffset; |
3523 | region.height = rw; |
3524 | @@ -209,7 +209,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, |
3525 | info->fbops->fb_fillrect(info, ®ion); |
3526 | } |
3527 | |
3528 | - if (bh) { |
3529 | + if ((int) bh > 0) { |
3530 | region.dx = info->var.xoffset + bs; |
3531 | region.dy = 0; |
3532 | region.height = info->var.yres_virtual; |
3533 | diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c |
3534 | index e7ee44db4e98b..0b552b3fc22ab 100644 |
3535 | --- a/drivers/video/console/fbcon_cw.c |
3536 | +++ b/drivers/video/console/fbcon_cw.c |
3537 | @@ -184,7 +184,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, |
3538 | region.color = 0; |
3539 | region.rop = ROP_COPY; |
3540 | |
3541 | - if (rw && !bottom_only) { |
3542 | + if ((int) rw > 0 && !bottom_only) { |
3543 | region.dx = 0; |
3544 | region.dy = info->var.yoffset + rs; |
3545 | region.height = rw; |
3546 | @@ -192,7 +192,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, |
3547 | info->fbops->fb_fillrect(info, ®ion); |
3548 | } |
3549 | |
3550 | - if (bh) { |
3551 | + if ((int) bh > 0) { |
3552 | region.dx = info->var.xoffset; |
3553 | region.dy = info->var.yoffset; |
3554 | region.height = info->var.yres; |
3555 | diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c |
3556 | index 19e3714abfe8f..7f62efe2da526 100644 |
3557 | --- a/drivers/video/console/fbcon_ud.c |
3558 | +++ b/drivers/video/console/fbcon_ud.c |
3559 | @@ -231,7 +231,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, |
3560 | region.color = 0; |
3561 | region.rop = ROP_COPY; |
3562 | |
3563 | - if (rw && !bottom_only) { |
3564 | + if ((int) rw > 0 && !bottom_only) { |
3565 | region.dy = 0; |
3566 | region.dx = info->var.xoffset; |
3567 | region.width = rw; |
3568 | @@ -239,7 +239,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, |
3569 | info->fbops->fb_fillrect(info, ®ion); |
3570 | } |
3571 | |
3572 | - if (bh) { |
3573 | + if ((int) bh > 0) { |
3574 | region.dy = info->var.yoffset; |
3575 | region.dx = info->var.xoffset; |
3576 | region.height = bh; |
3577 | diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c |
3578 | index e3b9521e4ec3e..33bddf3f30406 100644 |
3579 | --- a/drivers/video/console/newport_con.c |
3580 | +++ b/drivers/video/console/newport_con.c |
3581 | @@ -31,6 +31,8 @@ |
3582 | #include <linux/linux_logo.h> |
3583 | #include <linux/font.h> |
3584 | |
3585 | +#define NEWPORT_LEN 0x10000 |
3586 | + |
3587 | #define FONT_DATA ((unsigned char *)font_vga_8x16.data) |
3588 | |
3589 | /* borrowed from fbcon.c */ |
3590 | @@ -42,6 +44,7 @@ |
3591 | static unsigned char *font_data[MAX_NR_CONSOLES]; |
3592 | |
3593 | static struct newport_regs *npregs; |
3594 | +static unsigned long newport_addr; |
3595 | |
3596 | static int logo_active; |
3597 | static int topscan; |
3598 | @@ -701,7 +704,6 @@ const struct consw newport_con = { |
3599 | static int newport_probe(struct gio_device *dev, |
3600 | const struct gio_device_id *id) |
3601 | { |
3602 | - unsigned long newport_addr; |
3603 | int err; |
3604 | |
3605 | if (!dev->resource.start) |
3606 | @@ -711,7 +713,7 @@ static int newport_probe(struct gio_device *dev, |
3607 | return -EBUSY; /* we only support one Newport as console */ |
3608 | |
3609 | newport_addr = dev->resource.start + 0xF0000; |
3610 | - if (!request_mem_region(newport_addr, 0x10000, "Newport")) |
3611 | + if (!request_mem_region(newport_addr, NEWPORT_LEN, "Newport")) |
3612 | return -ENODEV; |
3613 | |
3614 | npregs = (struct newport_regs *)/* ioremap cannot fail */ |
3615 | @@ -719,6 +721,11 @@ static int newport_probe(struct gio_device *dev, |
3616 | console_lock(); |
3617 | err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); |
3618 | console_unlock(); |
3619 | + |
3620 | + if (err) { |
3621 | + iounmap((void *)npregs); |
3622 | + release_mem_region(newport_addr, NEWPORT_LEN); |
3623 | + } |
3624 | return err; |
3625 | } |
3626 | |
3627 | @@ -726,6 +733,7 @@ static void newport_remove(struct gio_device *dev) |
3628 | { |
3629 | give_up_console(&newport_con); |
3630 | iounmap((void *)npregs); |
3631 | + release_mem_region(newport_addr, NEWPORT_LEN); |
3632 | } |
3633 | |
3634 | static struct gio_device_id newport_ids[] = { |
3635 | diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c |
3636 | index 42c0a26646f66..d45ba7317b225 100644 |
3637 | --- a/drivers/video/console/vgacon.c |
3638 | +++ b/drivers/video/console/vgacon.c |
3639 | @@ -219,6 +219,10 @@ static void vgacon_scrollback_update(struct vc_data *c, int t, int count) |
3640 | p = (void *) (c->vc_origin + t * c->vc_size_row); |
3641 | |
3642 | while (count--) { |
3643 | + if ((vgacon_scrollback_tail + c->vc_size_row) > |
3644 | + vgacon_scrollback_size) |
3645 | + vgacon_scrollback_tail = 0; |
3646 | + |
3647 | scr_memcpyw(vgacon_scrollback + vgacon_scrollback_tail, |
3648 | p, c->vc_size_row); |
3649 | vgacon_scrollback_cnt++; |
3650 | diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c |
3651 | index db023a97d1eae..e243254a57214 100644 |
3652 | --- a/drivers/video/fbdev/neofb.c |
3653 | +++ b/drivers/video/fbdev/neofb.c |
3654 | @@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info) |
3655 | #else |
3656 | printk(KERN_ERR |
3657 | "neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n"); |
3658 | + kfree(info->monspecs.modedb); |
3659 | return -1; |
3660 | #endif |
3661 | default: |
3662 | diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
3663 | index 48c6500c24e1f..4429ad37b64cd 100644 |
3664 | --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
3665 | +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
3666 | @@ -843,7 +843,7 @@ static const struct dss_features omap34xx_dss_feats = { |
3667 | }; |
3668 | |
3669 | static const struct dss_features omap3630_dss_feats = { |
3670 | - .fck_div_max = 32, |
3671 | + .fck_div_max = 31, |
3672 | .dss_fck_multiplier = 1, |
3673 | .parent_clk_name = "dpll4_ck", |
3674 | .dpi_select_source = &dss_dpi_select_source_omap2_omap3, |
3675 | diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c |
3676 | index 8503310a38167..7f8b6af29aab4 100644 |
3677 | --- a/drivers/video/fbdev/pxafb.c |
3678 | +++ b/drivers/video/fbdev/pxafb.c |
3679 | @@ -2447,8 +2447,8 @@ static int pxafb_remove(struct platform_device *dev) |
3680 | |
3681 | free_pages_exact(fbi->video_mem, fbi->video_mem_size); |
3682 | |
3683 | - dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
3684 | - fbi->dma_buff_phys); |
3685 | + dma_free_coherent(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
3686 | + fbi->dma_buff_phys); |
3687 | |
3688 | iounmap(fbi->mmio_base); |
3689 | |
3690 | diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
3691 | index 0d92ff366a7b7..17efcdd4dc99b 100644 |
3692 | --- a/drivers/video/fbdev/sm712fb.c |
3693 | +++ b/drivers/video/fbdev/sm712fb.c |
3694 | @@ -1428,6 +1428,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb, |
3695 | static void smtc_unmap_smem(struct smtcfb_info *sfb) |
3696 | { |
3697 | if (sfb && sfb->fb->screen_base) { |
3698 | + if (sfb->chip_id == 0x720) |
3699 | + sfb->fb->screen_base -= 0x00200000; |
3700 | iounmap(sfb->fb->screen_base); |
3701 | sfb->fb->screen_base = NULL; |
3702 | } |
3703 | diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c |
3704 | index 88cd2a52d8d32..ae4974701e5c7 100644 |
3705 | --- a/drivers/watchdog/f71808e_wdt.c |
3706 | +++ b/drivers/watchdog/f71808e_wdt.c |
3707 | @@ -688,9 +688,9 @@ static int __init watchdog_init(int sioaddr) |
3708 | * into the module have been registered yet. |
3709 | */ |
3710 | watchdog.sioaddr = sioaddr; |
3711 | - watchdog.ident.options = WDIOC_SETTIMEOUT |
3712 | - | WDIOF_MAGICCLOSE |
3713 | - | WDIOF_KEEPALIVEPING; |
3714 | + watchdog.ident.options = WDIOF_MAGICCLOSE |
3715 | + | WDIOF_KEEPALIVEPING |
3716 | + | WDIOF_CARDRESET; |
3717 | |
3718 | snprintf(watchdog.ident.identity, |
3719 | sizeof(watchdog.ident.identity), "%s watchdog", |
3720 | @@ -704,6 +704,13 @@ static int __init watchdog_init(int sioaddr) |
3721 | wdt_conf = superio_inb(sioaddr, F71808FG_REG_WDT_CONF); |
3722 | watchdog.caused_reboot = wdt_conf & BIT(F71808FG_FLAG_WDTMOUT_STS); |
3723 | |
3724 | + /* |
3725 | + * We don't want WDTMOUT_STS to stick around till regular reboot. |
3726 | + * Write 1 to the bit to clear it to zero. |
3727 | + */ |
3728 | + superio_outb(sioaddr, F71808FG_REG_WDT_CONF, |
3729 | + wdt_conf | BIT(F71808FG_FLAG_WDTMOUT_STS)); |
3730 | + |
3731 | superio_exit(sioaddr); |
3732 | |
3733 | err = watchdog_set_timeout(timeout); |
3734 | diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
3735 | index 05f9f5983ee17..1b76e8a99c40b 100644 |
3736 | --- a/drivers/xen/balloon.c |
3737 | +++ b/drivers/xen/balloon.c |
3738 | @@ -634,11 +634,13 @@ static int add_ballooned_pages(int nr_pages) |
3739 | if (xen_hotplug_unpopulated) { |
3740 | st = reserve_additional_memory(); |
3741 | if (st != BP_ECANCELED) { |
3742 | + int rc; |
3743 | + |
3744 | mutex_unlock(&balloon_mutex); |
3745 | - wait_event(balloon_wq, |
3746 | + rc = wait_event_interruptible(balloon_wq, |
3747 | !list_empty(&ballooned_pages)); |
3748 | mutex_lock(&balloon_mutex); |
3749 | - return 0; |
3750 | + return rc ? -ENOMEM : 0; |
3751 | } |
3752 | } |
3753 | |
3754 | @@ -694,6 +696,12 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) |
3755 | out_undo: |
3756 | mutex_unlock(&balloon_mutex); |
3757 | free_xenballooned_pages(pgno, pages); |
3758 | + /* |
3759 | + * NB: free_xenballooned_pages will only subtract pgno pages, but since |
3760 | + * target_unpopulated is incremented with nr_pages at the start we need |
3761 | + * to remove the remaining ones also, or accounting will be screwed. |
3762 | + */ |
3763 | + balloon_stats.target_unpopulated -= nr_pages - pgno; |
3764 | return ret; |
3765 | } |
3766 | EXPORT_SYMBOL(alloc_xenballooned_pages); |
3767 | diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c |
3768 | index a8ff430686196..719c737ace262 100644 |
3769 | --- a/fs/9p/v9fs.c |
3770 | +++ b/fs/9p/v9fs.c |
3771 | @@ -457,10 +457,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) |
3772 | } |
3773 | |
3774 | #ifdef CONFIG_9P_FSCACHE |
3775 | - if (v9ses->fscache) { |
3776 | + if (v9ses->fscache) |
3777 | v9fs_cache_session_put_cookie(v9ses); |
3778 | - kfree(v9ses->cachetag); |
3779 | - } |
3780 | + kfree(v9ses->cachetag); |
3781 | #endif |
3782 | kfree(v9ses->uname); |
3783 | kfree(v9ses->aname); |
3784 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
3785 | index 1de0170519280..d9909e2fc4c21 100644 |
3786 | --- a/fs/btrfs/disk-io.c |
3787 | +++ b/fs/btrfs/disk-io.c |
3788 | @@ -1527,9 +1527,16 @@ int btrfs_init_fs_root(struct btrfs_root *root) |
3789 | spin_lock_init(&root->ino_cache_lock); |
3790 | init_waitqueue_head(&root->ino_cache_wait); |
3791 | |
3792 | - ret = get_anon_bdev(&root->anon_dev); |
3793 | - if (ret) |
3794 | - goto fail; |
3795 | + /* |
3796 | + * Don't assign anonymous block device to roots that are not exposed to |
3797 | + * userspace, the id pool is limited to 1M |
3798 | + */ |
3799 | + if (is_fstree(root->root_key.objectid) && |
3800 | + btrfs_root_refs(&root->root_item) > 0) { |
3801 | + ret = get_anon_bdev(&root->anon_dev); |
3802 | + if (ret) |
3803 | + goto fail; |
3804 | + } |
3805 | |
3806 | mutex_lock(&root->objectid_mutex); |
3807 | ret = btrfs_find_highest_objectid(root, |
3808 | diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
3809 | index 8c0ff985c1919..fa22bb29eee6f 100644 |
3810 | --- a/fs/btrfs/extent_io.c |
3811 | +++ b/fs/btrfs/extent_io.c |
3812 | @@ -4340,6 +4340,8 @@ int try_release_extent_mapping(struct extent_map_tree *map, |
3813 | |
3814 | /* once for us */ |
3815 | free_extent_map(em); |
3816 | + |
3817 | + cond_resched(); /* Allow large-extent preemption. */ |
3818 | } |
3819 | } |
3820 | return try_release_extent_state(map, tree, page, mask); |
3821 | diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c |
3822 | index a84a1ceb260af..568ff2ee015be 100644 |
3823 | --- a/fs/btrfs/free-space-cache.c |
3824 | +++ b/fs/btrfs/free-space-cache.c |
3825 | @@ -2152,7 +2152,7 @@ out: |
3826 | static bool try_merge_free_space(struct btrfs_free_space_ctl *ctl, |
3827 | struct btrfs_free_space *info, bool update_stat) |
3828 | { |
3829 | - struct btrfs_free_space *left_info; |
3830 | + struct btrfs_free_space *left_info = NULL; |
3831 | struct btrfs_free_space *right_info; |
3832 | bool merged = false; |
3833 | u64 offset = info->offset; |
3834 | @@ -2167,7 +2167,7 @@ static bool try_merge_free_space(struct btrfs_free_space_ctl *ctl, |
3835 | if (right_info && rb_prev(&right_info->offset_index)) |
3836 | left_info = rb_entry(rb_prev(&right_info->offset_index), |
3837 | struct btrfs_free_space, offset_index); |
3838 | - else |
3839 | + else if (!right_info) |
3840 | left_info = tree_search_offset(ctl, offset - 1, 0, 0); |
3841 | |
3842 | if (right_info && !right_info->bitmap) { |
3843 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
3844 | index f79682937faf4..c28ac9c464251 100644 |
3845 | --- a/fs/btrfs/tree-log.c |
3846 | +++ b/fs/btrfs/tree-log.c |
3847 | @@ -3755,11 +3755,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
3848 | log->fs_info->csum_root, |
3849 | ds + cs, ds + cs + cl - 1, |
3850 | &ordered_sums, 0); |
3851 | - if (ret) { |
3852 | - btrfs_release_path(dst_path); |
3853 | - kfree(ins_data); |
3854 | - return ret; |
3855 | - } |
3856 | + if (ret) |
3857 | + break; |
3858 | } |
3859 | } |
3860 | } |
3861 | @@ -3772,7 +3769,6 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
3862 | * we have to do this after the loop above to avoid changing the |
3863 | * log tree while trying to change the log tree. |
3864 | */ |
3865 | - ret = 0; |
3866 | while (!list_empty(&ordered_sums)) { |
3867 | struct btrfs_ordered_sum *sums = list_entry(ordered_sums.next, |
3868 | struct btrfs_ordered_sum, |
3869 | diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
3870 | index 0a23b6002ff12..cf1a3d2f6ad8b 100644 |
3871 | --- a/fs/cifs/smb2pdu.c |
3872 | +++ b/fs/cifs/smb2pdu.c |
3873 | @@ -776,6 +776,8 @@ SMB2_auth_kerberos(struct SMB2_sess_data *sess_data) |
3874 | spnego_key = cifs_get_spnego_key(ses); |
3875 | if (IS_ERR(spnego_key)) { |
3876 | rc = PTR_ERR(spnego_key); |
3877 | + if (rc == -ENOKEY) |
3878 | + cifs_dbg(VFS, "Verify user has a krb5 ticket and keyutils is installed\n"); |
3879 | spnego_key = NULL; |
3880 | goto out; |
3881 | } |
3882 | diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c |
3883 | index b14bb2c460426..499f54f99891c 100644 |
3884 | --- a/fs/dlm/lockspace.c |
3885 | +++ b/fs/dlm/lockspace.c |
3886 | @@ -626,6 +626,9 @@ static int new_lockspace(const char *name, const char *cluster, |
3887 | wait_event(ls->ls_recover_lock_wait, |
3888 | test_bit(LSFL_RECOVER_LOCK, &ls->ls_flags)); |
3889 | |
3890 | + /* let kobject handle freeing of ls if there's an error */ |
3891 | + do_unreg = 1; |
3892 | + |
3893 | ls->ls_kobj.kset = dlm_kset; |
3894 | error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, |
3895 | "%s", ls->ls_name); |
3896 | @@ -633,9 +636,6 @@ static int new_lockspace(const char *name, const char *cluster, |
3897 | goto out_recoverd; |
3898 | kobject_uevent(&ls->ls_kobj, KOBJ_ADD); |
3899 | |
3900 | - /* let kobject handle freeing of ls if there's an error */ |
3901 | - do_unreg = 1; |
3902 | - |
3903 | /* This uevent triggers dlm_controld in userspace to add us to the |
3904 | group of nodes that are members of this lockspace (managed by the |
3905 | cluster infrastructure.) Once it's done that, it tells us who the |
3906 | diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c |
3907 | index 395fc074c0db8..6e1907cc1741a 100644 |
3908 | --- a/fs/ext2/ialloc.c |
3909 | +++ b/fs/ext2/ialloc.c |
3910 | @@ -79,6 +79,7 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir) |
3911 | if (dir) |
3912 | le16_add_cpu(&desc->bg_used_dirs_count, -1); |
3913 | spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); |
3914 | + percpu_counter_inc(&EXT2_SB(sb)->s_freeinodes_counter); |
3915 | if (dir) |
3916 | percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter); |
3917 | mark_buffer_dirty(bh); |
3918 | @@ -530,7 +531,7 @@ got: |
3919 | goto fail; |
3920 | } |
3921 | |
3922 | - percpu_counter_add(&sbi->s_freeinodes_counter, -1); |
3923 | + percpu_counter_dec(&sbi->s_freeinodes_counter); |
3924 | if (S_ISDIR(mode)) |
3925 | percpu_counter_inc(&sbi->s_dirs_counter); |
3926 | |
3927 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
3928 | index d8780e04aaf00..ccce89de6d7e3 100644 |
3929 | --- a/fs/ext4/inode.c |
3930 | +++ b/fs/ext4/inode.c |
3931 | @@ -3575,6 +3575,11 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) |
3932 | struct address_space *mapping = iocb->ki_filp->f_mapping; |
3933 | struct inode *inode = mapping->host; |
3934 | ssize_t ret; |
3935 | + loff_t offset = iocb->ki_pos; |
3936 | + loff_t size = i_size_read(inode); |
3937 | + |
3938 | + if (offset >= size) |
3939 | + return 0; |
3940 | |
3941 | /* |
3942 | * Shared inode_lock is enough for us - it protects against concurrent |
3943 | diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c |
3944 | index b414892be08b7..9a11b48e55ca2 100644 |
3945 | --- a/fs/f2fs/dir.c |
3946 | +++ b/fs/f2fs/dir.c |
3947 | @@ -843,6 +843,17 @@ bool f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, |
3948 | de_name.name = d->filename[bit_pos]; |
3949 | de_name.len = le16_to_cpu(de->name_len); |
3950 | |
3951 | + /* check memory boundary before moving forward */ |
3952 | + bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); |
3953 | + if (unlikely(bit_pos > d->max || |
3954 | + le16_to_cpu(de->name_len) > F2FS_NAME_LEN)) { |
3955 | + f2fs_msg(F2FS_I_SB(d->inode)->sb, KERN_WARNING, |
3956 | + "%s: corrupted namelen=%d, run fsck to fix.", |
3957 | + __func__, le16_to_cpu(de->name_len)); |
3958 | + set_sbi_flag(F2FS_I_SB(d->inode)->sb->s_fs_info, SBI_NEED_FSCK); |
3959 | + return -EINVAL; |
3960 | + } |
3961 | + |
3962 | if (f2fs_encrypted_inode(d->inode)) { |
3963 | int save_len = fstr->len; |
3964 | int err; |
3965 | @@ -861,7 +872,6 @@ bool f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, |
3966 | le32_to_cpu(de->ino), d_type)) |
3967 | return true; |
3968 | |
3969 | - bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); |
3970 | ctx->pos = start_pos + bit_pos; |
3971 | } |
3972 | return false; |
3973 | diff --git a/fs/minix/inode.c b/fs/minix/inode.c |
3974 | index f975d667c5390..1191f293ef1db 100644 |
3975 | --- a/fs/minix/inode.c |
3976 | +++ b/fs/minix/inode.c |
3977 | @@ -155,6 +155,23 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) |
3978 | return 0; |
3979 | } |
3980 | |
3981 | +static bool minix_check_superblock(struct minix_sb_info *sbi) |
3982 | +{ |
3983 | + if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
3984 | + return false; |
3985 | + |
3986 | + /* |
3987 | + * s_max_size must not exceed the block mapping limitation. This check |
3988 | + * is only needed for V1 filesystems, since V2/V3 support an extra level |
3989 | + * of indirect blocks which places the limit well above U32_MAX. |
3990 | + */ |
3991 | + if (sbi->s_version == MINIX_V1 && |
3992 | + sbi->s_max_size > (7 + 512 + 512*512) * BLOCK_SIZE) |
3993 | + return false; |
3994 | + |
3995 | + return true; |
3996 | +} |
3997 | + |
3998 | static int minix_fill_super(struct super_block *s, void *data, int silent) |
3999 | { |
4000 | struct buffer_head *bh; |
4001 | @@ -233,11 +250,12 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
4002 | } else |
4003 | goto out_no_fs; |
4004 | |
4005 | + if (!minix_check_superblock(sbi)) |
4006 | + goto out_illegal_sb; |
4007 | + |
4008 | /* |
4009 | * Allocate the buffer map to keep the superblock small. |
4010 | */ |
4011 | - if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
4012 | - goto out_illegal_sb; |
4013 | i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh); |
4014 | map = kzalloc(i, GFP_KERNEL); |
4015 | if (!map) |
4016 | @@ -472,6 +490,13 @@ static struct inode *V1_minix_iget(struct inode *inode) |
4017 | iget_failed(inode); |
4018 | return ERR_PTR(-EIO); |
4019 | } |
4020 | + if (raw_inode->i_nlinks == 0) { |
4021 | + printk("MINIX-fs: deleted inode referenced: %lu\n", |
4022 | + inode->i_ino); |
4023 | + brelse(bh); |
4024 | + iget_failed(inode); |
4025 | + return ERR_PTR(-ESTALE); |
4026 | + } |
4027 | inode->i_mode = raw_inode->i_mode; |
4028 | i_uid_write(inode, raw_inode->i_uid); |
4029 | i_gid_write(inode, raw_inode->i_gid); |
4030 | @@ -505,6 +530,13 @@ static struct inode *V2_minix_iget(struct inode *inode) |
4031 | iget_failed(inode); |
4032 | return ERR_PTR(-EIO); |
4033 | } |
4034 | + if (raw_inode->i_nlinks == 0) { |
4035 | + printk("MINIX-fs: deleted inode referenced: %lu\n", |
4036 | + inode->i_ino); |
4037 | + brelse(bh); |
4038 | + iget_failed(inode); |
4039 | + return ERR_PTR(-ESTALE); |
4040 | + } |
4041 | inode->i_mode = raw_inode->i_mode; |
4042 | i_uid_write(inode, raw_inode->i_uid); |
4043 | i_gid_write(inode, raw_inode->i_gid); |
4044 | diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c |
4045 | index 4c57c9af6946f..0417c4c5ebbd8 100644 |
4046 | --- a/fs/minix/itree_common.c |
4047 | +++ b/fs/minix/itree_common.c |
4048 | @@ -74,6 +74,7 @@ static int alloc_branch(struct inode *inode, |
4049 | int n = 0; |
4050 | int i; |
4051 | int parent = minix_new_block(inode); |
4052 | + int err = -ENOSPC; |
4053 | |
4054 | branch[0].key = cpu_to_block(parent); |
4055 | if (parent) for (n = 1; n < num; n++) { |
4056 | @@ -84,6 +85,11 @@ static int alloc_branch(struct inode *inode, |
4057 | break; |
4058 | branch[n].key = cpu_to_block(nr); |
4059 | bh = sb_getblk(inode->i_sb, parent); |
4060 | + if (!bh) { |
4061 | + minix_free_block(inode, nr); |
4062 | + err = -ENOMEM; |
4063 | + break; |
4064 | + } |
4065 | lock_buffer(bh); |
4066 | memset(bh->b_data, 0, bh->b_size); |
4067 | branch[n].bh = bh; |
4068 | @@ -102,7 +108,7 @@ static int alloc_branch(struct inode *inode, |
4069 | bforget(branch[i].bh); |
4070 | for (i = 0; i < n; i++) |
4071 | minix_free_block(inode, block_to_cpu(branch[i].key)); |
4072 | - return -ENOSPC; |
4073 | + return err; |
4074 | } |
4075 | |
4076 | static inline int splice_branch(struct inode *inode, |
4077 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
4078 | index c189722bf9c71..714457bb1440a 100644 |
4079 | --- a/fs/nfs/nfs4proc.c |
4080 | +++ b/fs/nfs/nfs4proc.c |
4081 | @@ -5212,8 +5212,6 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, |
4082 | return ret; |
4083 | if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL)) |
4084 | return -ENOENT; |
4085 | - if (buflen < label.len) |
4086 | - return -ERANGE; |
4087 | return 0; |
4088 | } |
4089 | |
4090 | diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c |
4091 | index d7f8d5ce30e3e..0a7c4e30a385e 100644 |
4092 | --- a/fs/nfs/nfs4xdr.c |
4093 | +++ b/fs/nfs/nfs4xdr.c |
4094 | @@ -4163,7 +4163,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, |
4095 | goto out_overflow; |
4096 | if (len < NFS4_MAXLABELLEN) { |
4097 | if (label) { |
4098 | - memcpy(label->label, p, len); |
4099 | + if (label->len) { |
4100 | + if (label->len < len) |
4101 | + return -ERANGE; |
4102 | + memcpy(label->label, p, len); |
4103 | + } |
4104 | label->len = len; |
4105 | label->pi = pi; |
4106 | label->lfs = lfs; |
4107 | diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h |
4108 | index 594575e380e81..994a8abdd3701 100644 |
4109 | --- a/fs/ocfs2/ocfs2.h |
4110 | +++ b/fs/ocfs2/ocfs2.h |
4111 | @@ -337,8 +337,8 @@ struct ocfs2_super |
4112 | spinlock_t osb_lock; |
4113 | u32 s_next_generation; |
4114 | unsigned long osb_flags; |
4115 | - s16 s_inode_steal_slot; |
4116 | - s16 s_meta_steal_slot; |
4117 | + u16 s_inode_steal_slot; |
4118 | + u16 s_meta_steal_slot; |
4119 | atomic_t s_num_inodes_stolen; |
4120 | atomic_t s_num_meta_stolen; |
4121 | |
4122 | diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c |
4123 | index 00558bc59052e..f8d092b80a49f 100644 |
4124 | --- a/fs/ocfs2/suballoc.c |
4125 | +++ b/fs/ocfs2/suballoc.c |
4126 | @@ -895,9 +895,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type) |
4127 | { |
4128 | spin_lock(&osb->osb_lock); |
4129 | if (type == INODE_ALLOC_SYSTEM_INODE) |
4130 | - osb->s_inode_steal_slot = slot; |
4131 | + osb->s_inode_steal_slot = (u16)slot; |
4132 | else if (type == EXTENT_ALLOC_SYSTEM_INODE) |
4133 | - osb->s_meta_steal_slot = slot; |
4134 | + osb->s_meta_steal_slot = (u16)slot; |
4135 | spin_unlock(&osb->osb_lock); |
4136 | } |
4137 | |
4138 | diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c |
4139 | index 64dfbe5755da5..4d6e99ea37b8e 100644 |
4140 | --- a/fs/ocfs2/super.c |
4141 | +++ b/fs/ocfs2/super.c |
4142 | @@ -91,7 +91,7 @@ struct mount_options |
4143 | unsigned long commit_interval; |
4144 | unsigned long mount_opt; |
4145 | unsigned int atime_quantum; |
4146 | - signed short slot; |
4147 | + unsigned short slot; |
4148 | int localalloc_opt; |
4149 | unsigned int resv_level; |
4150 | int dir_resv_level; |
4151 | @@ -1369,7 +1369,7 @@ static int ocfs2_parse_options(struct super_block *sb, |
4152 | goto bail; |
4153 | } |
4154 | if (option) |
4155 | - mopt->slot = (s16)option; |
4156 | + mopt->slot = (u16)option; |
4157 | break; |
4158 | case Opt_commit: |
4159 | if (match_int(&args[0], &option)) { |
4160 | diff --git a/fs/ufs/super.c b/fs/ufs/super.c |
4161 | index 351162ff1bfd2..e320d824ee4d9 100644 |
4162 | --- a/fs/ufs/super.c |
4163 | +++ b/fs/ufs/super.c |
4164 | @@ -99,7 +99,7 @@ static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 gene |
4165 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
4166 | struct inode *inode; |
4167 | |
4168 | - if (ino < UFS_ROOTINO || ino > uspi->s_ncg * uspi->s_ipg) |
4169 | + if (ino < UFS_ROOTINO || ino > (u64)uspi->s_ncg * uspi->s_ipg) |
4170 | return ERR_PTR(-ESTALE); |
4171 | |
4172 | inode = ufs_iget(sb, ino); |
4173 | diff --git a/fs/xattr.c b/fs/xattr.c |
4174 | index 2f64231823013..c0fd99c95aa15 100644 |
4175 | --- a/fs/xattr.c |
4176 | +++ b/fs/xattr.c |
4177 | @@ -203,10 +203,22 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, |
4178 | return error; |
4179 | } |
4180 | |
4181 | - |
4182 | +/** |
4183 | + * __vfs_setxattr_locked: set an extended attribute while holding the inode |
4184 | + * lock |
4185 | + * |
4186 | + * @dentry - object to perform setxattr on |
4187 | + * @name - xattr name to set |
4188 | + * @value - value to set @name to |
4189 | + * @size - size of @value |
4190 | + * @flags - flags to pass into filesystem operations |
4191 | + * @delegated_inode - on return, will contain an inode pointer that |
4192 | + * a delegation was broken on, NULL if none. |
4193 | + */ |
4194 | int |
4195 | -vfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
4196 | - size_t size, int flags) |
4197 | +__vfs_setxattr_locked(struct dentry *dentry, const char *name, |
4198 | + const void *value, size_t size, int flags, |
4199 | + struct inode **delegated_inode) |
4200 | { |
4201 | struct inode *inode = dentry->d_inode; |
4202 | int error; |
4203 | @@ -215,15 +227,40 @@ vfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
4204 | if (error) |
4205 | return error; |
4206 | |
4207 | - inode_lock(inode); |
4208 | error = security_inode_setxattr(dentry, name, value, size, flags); |
4209 | if (error) |
4210 | goto out; |
4211 | |
4212 | + error = try_break_deleg(inode, delegated_inode); |
4213 | + if (error) |
4214 | + goto out; |
4215 | + |
4216 | error = __vfs_setxattr_noperm(dentry, name, value, size, flags); |
4217 | |
4218 | out: |
4219 | + return error; |
4220 | +} |
4221 | +EXPORT_SYMBOL_GPL(__vfs_setxattr_locked); |
4222 | + |
4223 | +int |
4224 | +vfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
4225 | + size_t size, int flags) |
4226 | +{ |
4227 | + struct inode *inode = dentry->d_inode; |
4228 | + struct inode *delegated_inode = NULL; |
4229 | + int error; |
4230 | + |
4231 | +retry_deleg: |
4232 | + inode_lock(inode); |
4233 | + error = __vfs_setxattr_locked(dentry, name, value, size, flags, |
4234 | + &delegated_inode); |
4235 | inode_unlock(inode); |
4236 | + |
4237 | + if (delegated_inode) { |
4238 | + error = break_deleg_wait(&delegated_inode); |
4239 | + if (!error) |
4240 | + goto retry_deleg; |
4241 | + } |
4242 | return error; |
4243 | } |
4244 | EXPORT_SYMBOL_GPL(vfs_setxattr); |
4245 | @@ -379,8 +416,18 @@ __vfs_removexattr(struct dentry *dentry, const char *name) |
4246 | } |
4247 | EXPORT_SYMBOL(__vfs_removexattr); |
4248 | |
4249 | +/** |
4250 | + * __vfs_removexattr_locked: set an extended attribute while holding the inode |
4251 | + * lock |
4252 | + * |
4253 | + * @dentry - object to perform setxattr on |
4254 | + * @name - name of xattr to remove |
4255 | + * @delegated_inode - on return, will contain an inode pointer that |
4256 | + * a delegation was broken on, NULL if none. |
4257 | + */ |
4258 | int |
4259 | -vfs_removexattr(struct dentry *dentry, const char *name) |
4260 | +__vfs_removexattr_locked(struct dentry *dentry, const char *name, |
4261 | + struct inode **delegated_inode) |
4262 | { |
4263 | struct inode *inode = dentry->d_inode; |
4264 | int error; |
4265 | @@ -389,11 +436,14 @@ vfs_removexattr(struct dentry *dentry, const char *name) |
4266 | if (error) |
4267 | return error; |
4268 | |
4269 | - inode_lock(inode); |
4270 | error = security_inode_removexattr(dentry, name); |
4271 | if (error) |
4272 | goto out; |
4273 | |
4274 | + error = try_break_deleg(inode, delegated_inode); |
4275 | + if (error) |
4276 | + goto out; |
4277 | + |
4278 | error = __vfs_removexattr(dentry, name); |
4279 | |
4280 | if (!error) { |
4281 | @@ -402,12 +452,32 @@ vfs_removexattr(struct dentry *dentry, const char *name) |
4282 | } |
4283 | |
4284 | out: |
4285 | + return error; |
4286 | +} |
4287 | +EXPORT_SYMBOL_GPL(__vfs_removexattr_locked); |
4288 | + |
4289 | +int |
4290 | +vfs_removexattr(struct dentry *dentry, const char *name) |
4291 | +{ |
4292 | + struct inode *inode = dentry->d_inode; |
4293 | + struct inode *delegated_inode = NULL; |
4294 | + int error; |
4295 | + |
4296 | +retry_deleg: |
4297 | + inode_lock(inode); |
4298 | + error = __vfs_removexattr_locked(dentry, name, &delegated_inode); |
4299 | inode_unlock(inode); |
4300 | + |
4301 | + if (delegated_inode) { |
4302 | + error = break_deleg_wait(&delegated_inode); |
4303 | + if (!error) |
4304 | + goto retry_deleg; |
4305 | + } |
4306 | + |
4307 | return error; |
4308 | } |
4309 | EXPORT_SYMBOL_GPL(vfs_removexattr); |
4310 | |
4311 | - |
4312 | /* |
4313 | * Extended attribute SET operations |
4314 | */ |
4315 | diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c |
4316 | index c6c15e5717e42..70da4113c2baf 100644 |
4317 | --- a/fs/xfs/libxfs/xfs_attr_leaf.c |
4318 | +++ b/fs/xfs/libxfs/xfs_attr_leaf.c |
4319 | @@ -785,9 +785,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) |
4320 | ASSERT(blkno == 0); |
4321 | error = xfs_attr3_leaf_create(args, blkno, &bp); |
4322 | if (error) { |
4323 | - error = xfs_da_shrink_inode(args, 0, bp); |
4324 | - bp = NULL; |
4325 | - if (error) |
4326 | + /* xfs_attr3_leaf_create may not have instantiated a block */ |
4327 | + if (bp && (xfs_da_shrink_inode(args, 0, bp) != 0)) |
4328 | goto out; |
4329 | xfs_idata_realloc(dp, size, XFS_ATTR_FORK); /* try to put */ |
4330 | memcpy(ifp->if_u1.if_data, tmpbuffer, size); /* it back */ |
4331 | diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c |
4332 | index 86a4911520cc5..69c112ddb544d 100644 |
4333 | --- a/fs/xfs/xfs_icache.c |
4334 | +++ b/fs/xfs/xfs_icache.c |
4335 | @@ -307,6 +307,46 @@ xfs_reinit_inode( |
4336 | return error; |
4337 | } |
4338 | |
4339 | +/* |
4340 | + * If we are allocating a new inode, then check what was returned is |
4341 | + * actually a free, empty inode. If we are not allocating an inode, |
4342 | + * then check we didn't find a free inode. |
4343 | + * |
4344 | + * Returns: |
4345 | + * 0 if the inode free state matches the lookup context |
4346 | + * -ENOENT if the inode is free and we are not allocating |
4347 | + * -EFSCORRUPTED if there is any state mismatch at all |
4348 | + */ |
4349 | +static int |
4350 | +xfs_iget_check_free_state( |
4351 | + struct xfs_inode *ip, |
4352 | + int flags) |
4353 | +{ |
4354 | + if (flags & XFS_IGET_CREATE) { |
4355 | + /* should be a free inode */ |
4356 | + if (VFS_I(ip)->i_mode != 0) { |
4357 | + xfs_warn(ip->i_mount, |
4358 | +"Corruption detected! Free inode 0x%llx not marked free! (mode 0x%x)", |
4359 | + ip->i_ino, VFS_I(ip)->i_mode); |
4360 | + return -EFSCORRUPTED; |
4361 | + } |
4362 | + |
4363 | + if (ip->i_d.di_nblocks != 0) { |
4364 | + xfs_warn(ip->i_mount, |
4365 | +"Corruption detected! Free inode 0x%llx has blocks allocated!", |
4366 | + ip->i_ino); |
4367 | + return -EFSCORRUPTED; |
4368 | + } |
4369 | + return 0; |
4370 | + } |
4371 | + |
4372 | + /* should be an allocated inode */ |
4373 | + if (VFS_I(ip)->i_mode == 0) |
4374 | + return -ENOENT; |
4375 | + |
4376 | + return 0; |
4377 | +} |
4378 | + |
4379 | /* |
4380 | * Check the validity of the inode we just found it the cache |
4381 | */ |
4382 | @@ -356,12 +396,12 @@ xfs_iget_cache_hit( |
4383 | } |
4384 | |
4385 | /* |
4386 | - * If lookup is racing with unlink return an error immediately. |
4387 | + * Check the inode free state is valid. This also detects lookup |
4388 | + * racing with unlinks. |
4389 | */ |
4390 | - if (VFS_I(ip)->i_mode == 0 && !(flags & XFS_IGET_CREATE)) { |
4391 | - error = -ENOENT; |
4392 | + error = xfs_iget_check_free_state(ip, flags); |
4393 | + if (error) |
4394 | goto out_error; |
4395 | - } |
4396 | |
4397 | /* |
4398 | * If IRECLAIMABLE is set, we've torn down the VFS inode already. |
4399 | @@ -471,10 +511,14 @@ xfs_iget_cache_miss( |
4400 | |
4401 | trace_xfs_iget_miss(ip); |
4402 | |
4403 | - if ((VFS_I(ip)->i_mode == 0) && !(flags & XFS_IGET_CREATE)) { |
4404 | - error = -ENOENT; |
4405 | + |
4406 | + /* |
4407 | + * Check the inode free state is valid. This also detects lookup |
4408 | + * racing with unlinks. |
4409 | + */ |
4410 | + error = xfs_iget_check_free_state(ip, flags); |
4411 | + if (error) |
4412 | goto out_destroy; |
4413 | - } |
4414 | |
4415 | /* |
4416 | * Preload the radix tree so we can insert safely under the |
4417 | diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c |
4418 | index 7bfcd09d446b7..6bc949c63a75d 100644 |
4419 | --- a/fs/xfs/xfs_log.c |
4420 | +++ b/fs/xfs/xfs_log.c |
4421 | @@ -2634,7 +2634,6 @@ xlog_state_do_callback( |
4422 | int funcdidcallbacks; /* flag: function did callbacks */ |
4423 | int repeats; /* for issuing console warnings if |
4424 | * looping too many times */ |
4425 | - int wake = 0; |
4426 | |
4427 | spin_lock(&log->l_icloglock); |
4428 | first_iclog = iclog = log->l_iclog; |
4429 | @@ -2836,11 +2835,9 @@ xlog_state_do_callback( |
4430 | #endif |
4431 | |
4432 | if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR)) |
4433 | - wake = 1; |
4434 | - spin_unlock(&log->l_icloglock); |
4435 | - |
4436 | - if (wake) |
4437 | wake_up_all(&log->l_flush_wait); |
4438 | + |
4439 | + spin_unlock(&log->l_icloglock); |
4440 | } |
4441 | |
4442 | |
4443 | @@ -4002,7 +3999,9 @@ xfs_log_force_umount( |
4444 | * item committed callback functions will do this again under lock to |
4445 | * avoid races. |
4446 | */ |
4447 | + spin_lock(&log->l_cilp->xc_push_lock); |
4448 | wake_up_all(&log->l_cilp->xc_commit_wait); |
4449 | + spin_unlock(&log->l_cilp->xc_push_lock); |
4450 | xlog_state_do_callback(log, XFS_LI_ABORTED, NULL); |
4451 | |
4452 | #ifdef XFSERRORDEBUG |
4453 | diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c |
4454 | index 6b753b969f7b8..aa99711a8ff96 100644 |
4455 | --- a/fs/xfs/xfs_reflink.c |
4456 | +++ b/fs/xfs/xfs_reflink.c |
4457 | @@ -1108,6 +1108,7 @@ xfs_reflink_remap_extent( |
4458 | xfs_filblks_t rlen; |
4459 | xfs_filblks_t unmap_len; |
4460 | xfs_off_t newlen; |
4461 | + int64_t qres; |
4462 | int error; |
4463 | |
4464 | unmap_len = irec->br_startoff + irec->br_blockcount - destoff; |
4465 | @@ -1135,13 +1136,19 @@ xfs_reflink_remap_extent( |
4466 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
4467 | xfs_trans_ijoin(tp, ip, 0); |
4468 | |
4469 | - /* If we're not just clearing space, then do we have enough quota? */ |
4470 | - if (real_extent) { |
4471 | - error = xfs_trans_reserve_quota_nblks(tp, ip, |
4472 | - irec->br_blockcount, 0, XFS_QMOPT_RES_REGBLKS); |
4473 | - if (error) |
4474 | - goto out_cancel; |
4475 | - } |
4476 | + /* |
4477 | + * Reserve quota for this operation. We don't know if the first unmap |
4478 | + * in the dest file will cause a bmap btree split, so we always reserve |
4479 | + * at least enough blocks for that split. If the extent being mapped |
4480 | + * in is written, we need to reserve quota for that too. |
4481 | + */ |
4482 | + qres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); |
4483 | + if (real_extent) |
4484 | + qres += irec->br_blockcount; |
4485 | + error = xfs_trans_reserve_quota_nblks(tp, ip, qres, 0, |
4486 | + XFS_QMOPT_RES_REGBLKS); |
4487 | + if (error) |
4488 | + goto out_cancel; |
4489 | |
4490 | trace_xfs_reflink_remap(ip, irec->br_startoff, |
4491 | irec->br_blockcount, irec->br_startblock); |
4492 | diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h |
4493 | index 1462071a19bf2..4fdb1d9848444 100644 |
4494 | --- a/include/asm-generic/vmlinux.lds.h |
4495 | +++ b/include/asm-generic/vmlinux.lds.h |
4496 | @@ -250,7 +250,8 @@ |
4497 | |
4498 | #define PAGE_ALIGNED_DATA(page_align) \ |
4499 | . = ALIGN(page_align); \ |
4500 | - *(.data..page_aligned) |
4501 | + *(.data..page_aligned) \ |
4502 | + . = ALIGN(page_align); |
4503 | |
4504 | #define READ_MOSTLY_DATA(align) \ |
4505 | . = ALIGN(align); \ |
4506 | @@ -625,7 +626,9 @@ |
4507 | . = ALIGN(bss_align); \ |
4508 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ |
4509 | BSS_FIRST_SECTIONS \ |
4510 | + . = ALIGN(PAGE_SIZE); \ |
4511 | *(.bss..page_aligned) \ |
4512 | + . = ALIGN(PAGE_SIZE); \ |
4513 | *(.dynbss) \ |
4514 | *(BSS_MAIN) \ |
4515 | *(COMMON) \ |
4516 | diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
4517 | index 27dbab59f034c..d86ac620f0aac 100644 |
4518 | --- a/include/linux/intel-iommu.h |
4519 | +++ b/include/linux/intel-iommu.h |
4520 | @@ -317,8 +317,8 @@ enum { |
4521 | |
4522 | #define QI_DEV_EIOTLB_ADDR(a) ((u64)(a) & VTD_PAGE_MASK) |
4523 | #define QI_DEV_EIOTLB_SIZE (((u64)1) << 11) |
4524 | -#define QI_DEV_EIOTLB_GLOB(g) ((u64)g) |
4525 | -#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) |
4526 | +#define QI_DEV_EIOTLB_GLOB(g) ((u64)(g) & 0x1) |
4527 | +#define QI_DEV_EIOTLB_PASID(p) ((u64)((p) & 0xfffff) << 32) |
4528 | #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) |
4529 | #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) |
4530 | #define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ |
4531 | diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
4532 | index e3d7754f25f00..5c7645e156a50 100644 |
4533 | --- a/include/linux/mmzone.h |
4534 | +++ b/include/linux/mmzone.h |
4535 | @@ -756,7 +756,8 @@ static inline bool is_dev_zone(const struct zone *zone) |
4536 | #include <linux/memory_hotplug.h> |
4537 | |
4538 | extern struct mutex zonelists_mutex; |
4539 | -void build_all_zonelists(pg_data_t *pgdat, struct zone *zone); |
4540 | +void build_all_zonelists(pg_data_t *pgdat, struct zone *zone, |
4541 | + bool hotplug_context); |
4542 | void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx); |
4543 | bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, |
4544 | int classzone_idx, unsigned int alloc_flags, |
4545 | diff --git a/include/linux/prandom.h b/include/linux/prandom.h |
4546 | new file mode 100644 |
4547 | index 0000000000000..aa16e6468f91e |
4548 | --- /dev/null |
4549 | +++ b/include/linux/prandom.h |
4550 | @@ -0,0 +1,78 @@ |
4551 | +/* SPDX-License-Identifier: GPL-2.0 */ |
4552 | +/* |
4553 | + * include/linux/prandom.h |
4554 | + * |
4555 | + * Include file for the fast pseudo-random 32-bit |
4556 | + * generation. |
4557 | + */ |
4558 | +#ifndef _LINUX_PRANDOM_H |
4559 | +#define _LINUX_PRANDOM_H |
4560 | + |
4561 | +#include <linux/types.h> |
4562 | +#include <linux/percpu.h> |
4563 | + |
4564 | +u32 prandom_u32(void); |
4565 | +void prandom_bytes(void *buf, size_t nbytes); |
4566 | +void prandom_seed(u32 seed); |
4567 | +void prandom_reseed_late(void); |
4568 | + |
4569 | +struct rnd_state { |
4570 | + __u32 s1, s2, s3, s4; |
4571 | +}; |
4572 | + |
4573 | +DECLARE_PER_CPU(struct rnd_state, net_rand_state); |
4574 | + |
4575 | +u32 prandom_u32_state(struct rnd_state *state); |
4576 | +void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); |
4577 | +void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); |
4578 | + |
4579 | +#define prandom_init_once(pcpu_state) \ |
4580 | + DO_ONCE(prandom_seed_full_state, (pcpu_state)) |
4581 | + |
4582 | +/** |
4583 | + * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) |
4584 | + * @ep_ro: right open interval endpoint |
4585 | + * |
4586 | + * Returns a pseudo-random number that is in interval [0, ep_ro). Note |
4587 | + * that the result depends on PRNG being well distributed in [0, ~0U] |
4588 | + * u32 space. Here we use maximally equidistributed combined Tausworthe |
4589 | + * generator, that is, prandom_u32(). This is useful when requesting a |
4590 | + * random index of an array containing ep_ro elements, for example. |
4591 | + * |
4592 | + * Returns: pseudo-random number in interval [0, ep_ro) |
4593 | + */ |
4594 | +static inline u32 prandom_u32_max(u32 ep_ro) |
4595 | +{ |
4596 | + return (u32)(((u64) prandom_u32() * ep_ro) >> 32); |
4597 | +} |
4598 | + |
4599 | +/* |
4600 | + * Handle minimum values for seeds |
4601 | + */ |
4602 | +static inline u32 __seed(u32 x, u32 m) |
4603 | +{ |
4604 | + return (x < m) ? x + m : x; |
4605 | +} |
4606 | + |
4607 | +/** |
4608 | + * prandom_seed_state - set seed for prandom_u32_state(). |
4609 | + * @state: pointer to state structure to receive the seed. |
4610 | + * @seed: arbitrary 64-bit value to use as a seed. |
4611 | + */ |
4612 | +static inline void prandom_seed_state(struct rnd_state *state, u64 seed) |
4613 | +{ |
4614 | + u32 i = (seed >> 32) ^ (seed << 10) ^ seed; |
4615 | + |
4616 | + state->s1 = __seed(i, 2U); |
4617 | + state->s2 = __seed(i, 8U); |
4618 | + state->s3 = __seed(i, 16U); |
4619 | + state->s4 = __seed(i, 128U); |
4620 | +} |
4621 | + |
4622 | +/* Pseudo random number generator from numerical recipes. */ |
4623 | +static inline u32 next_pseudo_random32(u32 seed) |
4624 | +{ |
4625 | + return seed * 1664525 + 1013904223; |
4626 | +} |
4627 | + |
4628 | +#endif |
4629 | diff --git a/include/linux/random.h b/include/linux/random.h |
4630 | index 16ab429735a78..15cd754544686 100644 |
4631 | --- a/include/linux/random.h |
4632 | +++ b/include/linux/random.h |
4633 | @@ -46,61 +46,12 @@ unsigned int get_random_int(void); |
4634 | unsigned long get_random_long(void); |
4635 | unsigned long randomize_page(unsigned long start, unsigned long range); |
4636 | |
4637 | -u32 prandom_u32(void); |
4638 | -void prandom_bytes(void *buf, size_t nbytes); |
4639 | -void prandom_seed(u32 seed); |
4640 | -void prandom_reseed_late(void); |
4641 | - |
4642 | -struct rnd_state { |
4643 | - __u32 s1, s2, s3, s4; |
4644 | -}; |
4645 | - |
4646 | -u32 prandom_u32_state(struct rnd_state *state); |
4647 | -void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); |
4648 | -void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); |
4649 | - |
4650 | -#define prandom_init_once(pcpu_state) \ |
4651 | - DO_ONCE(prandom_seed_full_state, (pcpu_state)) |
4652 | - |
4653 | -/** |
4654 | - * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) |
4655 | - * @ep_ro: right open interval endpoint |
4656 | - * |
4657 | - * Returns a pseudo-random number that is in interval [0, ep_ro). Note |
4658 | - * that the result depends on PRNG being well distributed in [0, ~0U] |
4659 | - * u32 space. Here we use maximally equidistributed combined Tausworthe |
4660 | - * generator, that is, prandom_u32(). This is useful when requesting a |
4661 | - * random index of an array containing ep_ro elements, for example. |
4662 | - * |
4663 | - * Returns: pseudo-random number in interval [0, ep_ro) |
4664 | - */ |
4665 | -static inline u32 prandom_u32_max(u32 ep_ro) |
4666 | -{ |
4667 | - return (u32)(((u64) prandom_u32() * ep_ro) >> 32); |
4668 | -} |
4669 | - |
4670 | /* |
4671 | - * Handle minimum values for seeds |
4672 | + * This is designed to be standalone for just prandom |
4673 | + * users, but for now we include it from <linux/random.h> |
4674 | + * for legacy reasons. |
4675 | */ |
4676 | -static inline u32 __seed(u32 x, u32 m) |
4677 | -{ |
4678 | - return (x < m) ? x + m : x; |
4679 | -} |
4680 | - |
4681 | -/** |
4682 | - * prandom_seed_state - set seed for prandom_u32_state(). |
4683 | - * @state: pointer to state structure to receive the seed. |
4684 | - * @seed: arbitrary 64-bit value to use as a seed. |
4685 | - */ |
4686 | -static inline void prandom_seed_state(struct rnd_state *state, u64 seed) |
4687 | -{ |
4688 | - u32 i = (seed >> 32) ^ (seed << 10) ^ seed; |
4689 | - |
4690 | - state->s1 = __seed(i, 2U); |
4691 | - state->s2 = __seed(i, 8U); |
4692 | - state->s3 = __seed(i, 16U); |
4693 | - state->s4 = __seed(i, 128U); |
4694 | -} |
4695 | +#include <linux/prandom.h> |
4696 | |
4697 | #ifdef CONFIG_ARCH_RANDOM |
4698 | # include <asm/archrandom.h> |
4699 | @@ -131,10 +82,4 @@ static inline bool arch_has_random_seed(void) |
4700 | } |
4701 | #endif |
4702 | |
4703 | -/* Pseudo random number generator from numerical recipes. */ |
4704 | -static inline u32 next_pseudo_random32(u32 seed) |
4705 | -{ |
4706 | - return seed * 1664525 + 1013904223; |
4707 | -} |
4708 | - |
4709 | #endif /* _LINUX_RANDOM_H */ |
4710 | diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h |
4711 | index be586c632a0c0..f261114e2758a 100644 |
4712 | --- a/include/linux/tracepoint.h |
4713 | +++ b/include/linux/tracepoint.h |
4714 | @@ -314,7 +314,7 @@ extern void syscall_unregfunc(void); |
4715 | static const char *___tp_str __tracepoint_string = str; \ |
4716 | ___tp_str; \ |
4717 | }) |
4718 | -#define __tracepoint_string __attribute__((section("__tracepoint_str"))) |
4719 | +#define __tracepoint_string __attribute__((section("__tracepoint_str"), used)) |
4720 | #else |
4721 | /* |
4722 | * tracepoint_string() is used to save the string address for userspace |
4723 | diff --git a/include/linux/xattr.h b/include/linux/xattr.h |
4724 | index e77605a0c8da3..1b1c9bfd24e99 100644 |
4725 | --- a/include/linux/xattr.h |
4726 | +++ b/include/linux/xattr.h |
4727 | @@ -51,8 +51,10 @@ ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); |
4728 | ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); |
4729 | int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int); |
4730 | int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int); |
4731 | +int __vfs_setxattr_locked(struct dentry *, const char *, const void *, size_t, int, struct inode **); |
4732 | int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); |
4733 | int __vfs_removexattr(struct dentry *, const char *); |
4734 | +int __vfs_removexattr_locked(struct dentry *, const char *, struct inode **); |
4735 | int vfs_removexattr(struct dentry *, const char *); |
4736 | |
4737 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); |
4738 | diff --git a/include/net/addrconf.h b/include/net/addrconf.h |
4739 | index 019b06c035a84..34ea021df0083 100644 |
4740 | --- a/include/net/addrconf.h |
4741 | +++ b/include/net/addrconf.h |
4742 | @@ -253,6 +253,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, |
4743 | const struct in6_addr *addr); |
4744 | int ipv6_sock_ac_drop(struct sock *sk, int ifindex, |
4745 | const struct in6_addr *addr); |
4746 | +void __ipv6_sock_ac_close(struct sock *sk); |
4747 | void ipv6_sock_ac_close(struct sock *sk); |
4748 | |
4749 | int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr); |
4750 | diff --git a/include/net/sock.h b/include/net/sock.h |
4751 | index db68c72126d54..d0e18917d8be8 100644 |
4752 | --- a/include/net/sock.h |
4753 | +++ b/include/net/sock.h |
4754 | @@ -784,6 +784,8 @@ static inline int sk_memalloc_socks(void) |
4755 | { |
4756 | return static_key_false(&memalloc_socks); |
4757 | } |
4758 | + |
4759 | +void __receive_sock(struct file *file); |
4760 | #else |
4761 | |
4762 | static inline int sk_memalloc_socks(void) |
4763 | @@ -791,6 +793,8 @@ static inline int sk_memalloc_socks(void) |
4764 | return 0; |
4765 | } |
4766 | |
4767 | +static inline void __receive_sock(struct file *file) |
4768 | +{ } |
4769 | #endif |
4770 | |
4771 | static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask) |
4772 | diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild |
4773 | index 9355dd8eff3ba..489b093580dd0 100644 |
4774 | --- a/include/uapi/drm/Kbuild |
4775 | +++ b/include/uapi/drm/Kbuild |
4776 | @@ -20,3 +20,6 @@ header-y += vmwgfx_drm.h |
4777 | header-y += msm_drm.h |
4778 | header-y += vc4_drm.h |
4779 | header-y += virtgpu_drm.h |
4780 | +header-y += armada_drm.h |
4781 | +header-y += etnaviv_drm.h |
4782 | +header-y += vgem_drm.h |
4783 | diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild |
4784 | index cd2be1c8e9fb6..39bf68b36332e 100644 |
4785 | --- a/include/uapi/linux/Kbuild |
4786 | +++ b/include/uapi/linux/Kbuild |
4787 | @@ -475,3 +475,23 @@ header-y += xilinx-v4l2-controls.h |
4788 | header-y += zorro.h |
4789 | header-y += zorro_ids.h |
4790 | header-y += userfaultfd.h |
4791 | +header-y += auto_dev-ioctl.h |
4792 | +header-y += bcache.h |
4793 | +header-y += btrfs_tree.h |
4794 | +header-y += coresight-stm.h |
4795 | +header-y += cryptouser.h |
4796 | +header-y += hash_info.h |
4797 | +header-y += kcm.h |
4798 | +header-y += kcov.h |
4799 | +header-y += kfd_ioctl.h |
4800 | +header-y += lightnvm.h |
4801 | +header-y += module.h |
4802 | +header-y += nilfs2_api.h |
4803 | +header-y += nilfs2_ondisk.h |
4804 | +header-y += nsfs.h |
4805 | +header-y += pr.h |
4806 | +header-y += qrtr.h |
4807 | +header-y += stm.h |
4808 | +header-y += wil6210_uapi.h |
4809 | +header-y += cifs/ |
4810 | +header-y += genwqe/ |
4811 | diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h |
4812 | index 8562b1cb776b7..3b92610502ca8 100644 |
4813 | --- a/include/uapi/linux/bcache.h |
4814 | +++ b/include/uapi/linux/bcache.h |
4815 | @@ -5,7 +5,7 @@ |
4816 | * Bcache on disk data structures |
4817 | */ |
4818 | |
4819 | -#include <asm/types.h> |
4820 | +#include <linux/types.h> |
4821 | |
4822 | #define BITMASK(name, type, field, offset, size) \ |
4823 | static inline __u64 name(const type *k) \ |
4824 | diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h |
4825 | index a1ded2a1bf1da..2abf660e9f65c 100644 |
4826 | --- a/include/uapi/linux/btrfs_tree.h |
4827 | +++ b/include/uapi/linux/btrfs_tree.h |
4828 | @@ -1,6 +1,8 @@ |
4829 | #ifndef _BTRFS_CTREE_H_ |
4830 | #define _BTRFS_CTREE_H_ |
4831 | |
4832 | +#include <linux/types.h> |
4833 | + |
4834 | /* |
4835 | * This header contains the structure definitions and constants used |
4836 | * by file system objects that can be retrieved using |
4837 | diff --git a/include/uapi/linux/cifs/Kbuild b/include/uapi/linux/cifs/Kbuild |
4838 | new file mode 100644 |
4839 | index 0000000000000..829f5d44f5be4 |
4840 | --- /dev/null |
4841 | +++ b/include/uapi/linux/cifs/Kbuild |
4842 | @@ -0,0 +1 @@ |
4843 | +header-y += cifs_mount.h |
4844 | diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h |
4845 | index 79b5ded2001a3..3d0aa2bc69f32 100644 |
4846 | --- a/include/uapi/linux/cryptouser.h |
4847 | +++ b/include/uapi/linux/cryptouser.h |
4848 | @@ -18,6 +18,8 @@ |
4849 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
4850 | */ |
4851 | |
4852 | +#include <linux/types.h> |
4853 | + |
4854 | /* Netlink configuration messages. */ |
4855 | enum { |
4856 | CRYPTO_MSG_BASE = 0x10, |
4857 | diff --git a/include/uapi/linux/genwqe/Kbuild b/include/uapi/linux/genwqe/Kbuild |
4858 | new file mode 100644 |
4859 | index 0000000000000..027f11d24ca31 |
4860 | --- /dev/null |
4861 | +++ b/include/uapi/linux/genwqe/Kbuild |
4862 | @@ -0,0 +1 @@ |
4863 | +header-y += genwqe_card.h |
4864 | diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h |
4865 | index 57d7c0f916b6f..645ef3cf3dd08 100644 |
4866 | --- a/include/uapi/linux/pr.h |
4867 | +++ b/include/uapi/linux/pr.h |
4868 | @@ -1,6 +1,8 @@ |
4869 | #ifndef _UAPI_PR_H |
4870 | #define _UAPI_PR_H |
4871 | |
4872 | +#include <linux/types.h> |
4873 | + |
4874 | enum pr_type { |
4875 | PR_WRITE_EXCLUSIVE = 1, |
4876 | PR_EXCLUSIVE_ACCESS = 2, |
4877 | diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h |
4878 | index 66c0748d26e2b..9d76c566f66e8 100644 |
4879 | --- a/include/uapi/linux/qrtr.h |
4880 | +++ b/include/uapi/linux/qrtr.h |
4881 | @@ -2,6 +2,7 @@ |
4882 | #define _LINUX_QRTR_H |
4883 | |
4884 | #include <linux/socket.h> |
4885 | +#include <linux/types.h> |
4886 | |
4887 | struct sockaddr_qrtr { |
4888 | __kernel_sa_family_t sq_family; |
4889 | diff --git a/init/main.c b/init/main.c |
4890 | index d47860dbe8969..7ad08957dd180 100644 |
4891 | --- a/init/main.c |
4892 | +++ b/init/main.c |
4893 | @@ -512,7 +512,7 @@ asmlinkage __visible void __init start_kernel(void) |
4894 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ |
4895 | boot_cpu_hotplug_init(); |
4896 | |
4897 | - build_all_zonelists(NULL, NULL); |
4898 | + build_all_zonelists(NULL, NULL, false); |
4899 | page_alloc_init(); |
4900 | |
4901 | pr_notice("Kernel command line: %s\n", boot_command_line); |
4902 | diff --git a/kernel/cgroup.c b/kernel/cgroup.c |
4903 | index f047c73189f36..684d02f343b4c 100644 |
4904 | --- a/kernel/cgroup.c |
4905 | +++ b/kernel/cgroup.c |
4906 | @@ -6355,6 +6355,8 @@ void cgroup_sk_clone(struct sock_cgroup_data *skcd) |
4907 | { |
4908 | /* Socket clone path */ |
4909 | if (skcd->val) { |
4910 | + if (skcd->no_refcnt) |
4911 | + return; |
4912 | /* |
4913 | * We might be cloning a socket which is left in an empty |
4914 | * cgroup and the cgroup might have already been rmdir'd. |
4915 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
4916 | index a864e94ecb6b6..9aa2dbe6a4568 100644 |
4917 | --- a/kernel/kprobes.c |
4918 | +++ b/kernel/kprobes.c |
4919 | @@ -2029,6 +2029,13 @@ static void kill_kprobe(struct kprobe *p) |
4920 | * the original probed function (which will be freed soon) any more. |
4921 | */ |
4922 | arch_remove_kprobe(p); |
4923 | + |
4924 | + /* |
4925 | + * The module is going away. We should disarm the kprobe which |
4926 | + * is using ftrace. |
4927 | + */ |
4928 | + if (kprobe_ftrace(p)) |
4929 | + disarm_kprobe_ftrace(p); |
4930 | } |
4931 | |
4932 | /* Disable one kprobe */ |
4933 | diff --git a/kernel/time/timer.c b/kernel/time/timer.c |
4934 | index 88c2c597f61c4..d2e4698d43fec 100644 |
4935 | --- a/kernel/time/timer.c |
4936 | +++ b/kernel/time/timer.c |
4937 | @@ -42,6 +42,7 @@ |
4938 | #include <linux/sched/sysctl.h> |
4939 | #include <linux/slab.h> |
4940 | #include <linux/compat.h> |
4941 | +#include <linux/random.h> |
4942 | |
4943 | #include <asm/uaccess.h> |
4944 | #include <asm/unistd.h> |
4945 | @@ -1635,6 +1636,13 @@ void update_process_times(int user_tick) |
4946 | #endif |
4947 | scheduler_tick(); |
4948 | run_posix_cpu_timers(p); |
4949 | + |
4950 | + /* The current CPU might make use of net randoms without receiving IRQs |
4951 | + * to renew them often enough. Let's update the net_rand_state from a |
4952 | + * non-constant value that's not affine to the number of calls to make |
4953 | + * sure it's updated when there's some activity (we don't care in idle). |
4954 | + */ |
4955 | + this_cpu_add(net_rand_state.s1, rol32(jiffies, 24) + user_tick); |
4956 | } |
4957 | |
4958 | /** |
4959 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
4960 | index 2ae98f8bce81b..4d1be82e7011a 100644 |
4961 | --- a/kernel/trace/ftrace.c |
4962 | +++ b/kernel/trace/ftrace.c |
4963 | @@ -4987,8 +4987,11 @@ static int referenced_filters(struct dyn_ftrace *rec) |
4964 | int cnt = 0; |
4965 | |
4966 | for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { |
4967 | - if (ops_references_rec(ops, rec)) |
4968 | - cnt++; |
4969 | + if (ops_references_rec(ops, rec)) { |
4970 | + cnt++; |
4971 | + if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) |
4972 | + rec->flags |= FTRACE_FL_REGS; |
4973 | + } |
4974 | } |
4975 | |
4976 | return cnt; |
4977 | @@ -5084,8 +5087,8 @@ void ftrace_module_enable(struct module *mod) |
4978 | if (ftrace_start_up) |
4979 | cnt += referenced_filters(rec); |
4980 | |
4981 | - /* This clears FTRACE_FL_DISABLED */ |
4982 | - rec->flags = cnt; |
4983 | + rec->flags &= ~FTRACE_FL_DISABLED; |
4984 | + rec->flags += cnt; |
4985 | |
4986 | if (ftrace_start_up && cnt) { |
4987 | int failed = __ftrace_replace_code(rec, 1); |
4988 | diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
4989 | index c7c96bc7654af..91c451e0f4741 100644 |
4990 | --- a/lib/dynamic_debug.c |
4991 | +++ b/lib/dynamic_debug.c |
4992 | @@ -85,22 +85,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = { |
4993 | { _DPRINTK_FLAGS_NONE, '_' }, |
4994 | }; |
4995 | |
4996 | +struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; }; |
4997 | + |
4998 | /* format a string into buf[] which describes the _ddebug's flags */ |
4999 | -static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, |
5000 | - size_t maxlen) |
5001 | +static char *ddebug_describe_flags(unsigned int flags, struct flagsbuf *fb) |
5002 | { |
5003 | - char *p = buf; |
5004 | + char *p = fb->buf; |
5005 | int i; |
5006 | |
5007 | - BUG_ON(maxlen < 6); |
5008 | for (i = 0; i < ARRAY_SIZE(opt_array); ++i) |
5009 | - if (dp->flags & opt_array[i].flag) |
5010 | + if (flags & opt_array[i].flag) |
5011 | *p++ = opt_array[i].opt_char; |
5012 | - if (p == buf) |
5013 | + if (p == fb->buf) |
5014 | *p++ = '_'; |
5015 | *p = '\0'; |
5016 | |
5017 | - return buf; |
5018 | + return fb->buf; |
5019 | } |
5020 | |
5021 | #define vpr_info(fmt, ...) \ |
5022 | @@ -142,7 +142,7 @@ static int ddebug_change(const struct ddebug_query *query, |
5023 | struct ddebug_table *dt; |
5024 | unsigned int newflags; |
5025 | unsigned int nfound = 0; |
5026 | - char flagbuf[10]; |
5027 | + struct flagsbuf fbuf; |
5028 | |
5029 | /* search for matching ddebugs */ |
5030 | mutex_lock(&ddebug_lock); |
5031 | @@ -199,8 +199,7 @@ static int ddebug_change(const struct ddebug_query *query, |
5032 | vpr_info("changed %s:%d [%s]%s =%s\n", |
5033 | trim_prefix(dp->filename), dp->lineno, |
5034 | dt->mod_name, dp->function, |
5035 | - ddebug_describe_flags(dp, flagbuf, |
5036 | - sizeof(flagbuf))); |
5037 | + ddebug_describe_flags(dp->flags, &fbuf)); |
5038 | } |
5039 | } |
5040 | mutex_unlock(&ddebug_lock); |
5041 | @@ -779,7 +778,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
5042 | { |
5043 | struct ddebug_iter *iter = m->private; |
5044 | struct _ddebug *dp = p; |
5045 | - char flagsbuf[10]; |
5046 | + struct flagsbuf flags; |
5047 | |
5048 | vpr_info("called m=%p p=%p\n", m, p); |
5049 | |
5050 | @@ -792,7 +791,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
5051 | seq_printf(m, "%s:%u [%s]%s =%s \"", |
5052 | trim_prefix(dp->filename), dp->lineno, |
5053 | iter->table->mod_name, dp->function, |
5054 | - ddebug_describe_flags(dp, flagsbuf, sizeof(flagsbuf))); |
5055 | + ddebug_describe_flags(dp->flags, &flags)); |
5056 | seq_escape(m, dp->format, "\t\r\n\""); |
5057 | seq_puts(m, "\"\n"); |
5058 | |
5059 | diff --git a/lib/random32.c b/lib/random32.c |
5060 | index fa594b1140e64..889dab44bd747 100644 |
5061 | --- a/lib/random32.c |
5062 | +++ b/lib/random32.c |
5063 | @@ -47,7 +47,7 @@ static inline void prandom_state_selftest(void) |
5064 | } |
5065 | #endif |
5066 | |
5067 | -static DEFINE_PER_CPU(struct rnd_state, net_rand_state) __latent_entropy; |
5068 | +DEFINE_PER_CPU(struct rnd_state, net_rand_state); |
5069 | |
5070 | /** |
5071 | * prandom_u32_state - seeded pseudo-random number generator. |
5072 | diff --git a/mm/khugepaged.c b/mm/khugepaged.c |
5073 | index 8217ee5d66ef2..3080c6415493c 100644 |
5074 | --- a/mm/khugepaged.c |
5075 | +++ b/mm/khugepaged.c |
5076 | @@ -1250,6 +1250,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot) |
5077 | static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
5078 | { |
5079 | struct vm_area_struct *vma; |
5080 | + struct mm_struct *mm; |
5081 | unsigned long addr; |
5082 | pmd_t *pmd, _pmd; |
5083 | |
5084 | @@ -1263,7 +1264,8 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
5085 | continue; |
5086 | if (vma->vm_end < addr + HPAGE_PMD_SIZE) |
5087 | continue; |
5088 | - pmd = mm_find_pmd(vma->vm_mm, addr); |
5089 | + mm = vma->vm_mm; |
5090 | + pmd = mm_find_pmd(mm, addr); |
5091 | if (!pmd) |
5092 | continue; |
5093 | /* |
5094 | @@ -1272,14 +1274,16 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
5095 | * re-fault. Not ideal, but it's more important to not disturb |
5096 | * the system too much. |
5097 | */ |
5098 | - if (down_write_trylock(&vma->vm_mm->mmap_sem)) { |
5099 | - spinlock_t *ptl = pmd_lock(vma->vm_mm, pmd); |
5100 | - /* assume page table is clear */ |
5101 | - _pmd = pmdp_collapse_flush(vma, addr, pmd); |
5102 | - spin_unlock(ptl); |
5103 | - up_write(&vma->vm_mm->mmap_sem); |
5104 | - atomic_long_dec(&vma->vm_mm->nr_ptes); |
5105 | - pte_free(vma->vm_mm, pmd_pgtable(_pmd)); |
5106 | + if (down_write_trylock(&mm->mmap_sem)) { |
5107 | + if (!khugepaged_test_exit(mm)) { |
5108 | + spinlock_t *ptl = pmd_lock(mm, pmd); |
5109 | + /* assume page table is clear */ |
5110 | + _pmd = pmdp_collapse_flush(vma, addr, pmd); |
5111 | + spin_unlock(ptl); |
5112 | + atomic_long_dec(&mm->nr_ptes); |
5113 | + pte_free(mm, pmd_pgtable(_pmd)); |
5114 | + } |
5115 | + up_write(&mm->mmap_sem); |
5116 | } |
5117 | } |
5118 | i_mmap_unlock_write(mapping); |
5119 | diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
5120 | index 449999657c0bb..a4ffe59963176 100644 |
5121 | --- a/mm/memory_hotplug.c |
5122 | +++ b/mm/memory_hotplug.c |
5123 | @@ -1125,7 +1125,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ |
5124 | mutex_lock(&zonelists_mutex); |
5125 | if (!populated_zone(zone)) { |
5126 | need_zonelists_rebuild = 1; |
5127 | - build_all_zonelists(NULL, zone); |
5128 | + build_all_zonelists(NULL, zone, true); |
5129 | } |
5130 | |
5131 | ret = walk_system_ram_range(pfn, nr_pages, &onlined_pages, |
5132 | @@ -1146,7 +1146,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ |
5133 | if (onlined_pages) { |
5134 | node_states_set_node(nid, &arg); |
5135 | if (need_zonelists_rebuild) |
5136 | - build_all_zonelists(NULL, NULL); |
5137 | + build_all_zonelists(NULL, NULL, true); |
5138 | else |
5139 | zone_pcp_update(zone); |
5140 | } |
5141 | @@ -1220,7 +1220,7 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) |
5142 | * to access not-initialized zonelist, build here. |
5143 | */ |
5144 | mutex_lock(&zonelists_mutex); |
5145 | - build_all_zonelists(pgdat, NULL); |
5146 | + build_all_zonelists(pgdat, NULL, true); |
5147 | mutex_unlock(&zonelists_mutex); |
5148 | |
5149 | /* |
5150 | @@ -1276,7 +1276,7 @@ int try_online_node(int nid) |
5151 | |
5152 | if (pgdat->node_zonelists->_zonerefs->zone == NULL) { |
5153 | mutex_lock(&zonelists_mutex); |
5154 | - build_all_zonelists(NULL, NULL); |
5155 | + build_all_zonelists(NULL, NULL, true); |
5156 | mutex_unlock(&zonelists_mutex); |
5157 | } |
5158 | |
5159 | @@ -2016,7 +2016,7 @@ repeat: |
5160 | if (!populated_zone(zone)) { |
5161 | zone_pcp_reset(zone); |
5162 | mutex_lock(&zonelists_mutex); |
5163 | - build_all_zonelists(NULL, NULL); |
5164 | + build_all_zonelists(NULL, NULL, true); |
5165 | mutex_unlock(&zonelists_mutex); |
5166 | } else |
5167 | zone_pcp_update(zone); |
5168 | diff --git a/mm/mmap.c b/mm/mmap.c |
5169 | index d221266d100f4..7109f886e739e 100644 |
5170 | --- a/mm/mmap.c |
5171 | +++ b/mm/mmap.c |
5172 | @@ -3018,6 +3018,7 @@ void exit_mmap(struct mm_struct *mm) |
5173 | if (vma->vm_flags & VM_ACCOUNT) |
5174 | nr_accounted += vma_pages(vma); |
5175 | vma = remove_vma(vma); |
5176 | + cond_resched(); |
5177 | } |
5178 | vm_unacct_memory(nr_accounted); |
5179 | } |
5180 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
5181 | index de00e0fec4845..f394dd87fa033 100644 |
5182 | --- a/mm/page_alloc.c |
5183 | +++ b/mm/page_alloc.c |
5184 | @@ -4608,7 +4608,7 @@ int numa_zonelist_order_handler(struct ctl_table *table, int write, |
5185 | user_zonelist_order = oldval; |
5186 | } else if (oldval != user_zonelist_order) { |
5187 | mutex_lock(&zonelists_mutex); |
5188 | - build_all_zonelists(NULL, NULL); |
5189 | + build_all_zonelists(NULL, NULL, false); |
5190 | mutex_unlock(&zonelists_mutex); |
5191 | } |
5192 | } |
5193 | @@ -4988,11 +4988,12 @@ build_all_zonelists_init(void) |
5194 | * (2) call of __init annotated helper build_all_zonelists_init |
5195 | * [protected by SYSTEM_BOOTING]. |
5196 | */ |
5197 | -void __ref build_all_zonelists(pg_data_t *pgdat, struct zone *zone) |
5198 | +void __ref build_all_zonelists(pg_data_t *pgdat, struct zone *zone, |
5199 | + bool hotplug_context) |
5200 | { |
5201 | set_zonelist_order(); |
5202 | |
5203 | - if (system_state == SYSTEM_BOOTING) { |
5204 | + if (system_state == SYSTEM_BOOTING && !hotplug_context) { |
5205 | build_all_zonelists_init(); |
5206 | } else { |
5207 | #ifdef CONFIG_MEMORY_HOTPLUG |
5208 | diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c |
5209 | index aa4586672cee9..bad27b0ec65d6 100644 |
5210 | --- a/net/9p/trans_fd.c |
5211 | +++ b/net/9p/trans_fd.c |
5212 | @@ -295,7 +295,6 @@ static void p9_read_work(struct work_struct *work) |
5213 | { |
5214 | int n, err; |
5215 | struct p9_conn *m; |
5216 | - int status = REQ_STATUS_ERROR; |
5217 | |
5218 | m = container_of(work, struct p9_conn, rq); |
5219 | |
5220 | @@ -375,11 +374,21 @@ static void p9_read_work(struct work_struct *work) |
5221 | if ((m->req) && (m->rc.offset == m->rc.capacity)) { |
5222 | p9_debug(P9_DEBUG_TRANS, "got new packet\n"); |
5223 | spin_lock(&m->client->lock); |
5224 | - if (m->req->status != REQ_STATUS_ERROR) |
5225 | - status = REQ_STATUS_RCVD; |
5226 | - list_del(&m->req->req_list); |
5227 | - /* update req->status while holding client->lock */ |
5228 | - p9_client_cb(m->client, m->req, status); |
5229 | + if (m->req->status == REQ_STATUS_SENT) { |
5230 | + list_del(&m->req->req_list); |
5231 | + p9_client_cb(m->client, m->req, REQ_STATUS_RCVD); |
5232 | + } else if (m->req->status == REQ_STATUS_FLSHD) { |
5233 | + /* Ignore replies associated with a cancelled request. */ |
5234 | + p9_debug(P9_DEBUG_TRANS, |
5235 | + "Ignore replies associated with a cancelled request\n"); |
5236 | + } else { |
5237 | + spin_unlock(&m->client->lock); |
5238 | + p9_debug(P9_DEBUG_ERROR, |
5239 | + "Request tag %d errored out while we were reading the reply\n", |
5240 | + m->rc.tag); |
5241 | + err = -EIO; |
5242 | + goto error; |
5243 | + } |
5244 | spin_unlock(&m->client->lock); |
5245 | m->rc.sdata = NULL; |
5246 | m->rc.offset = 0; |
5247 | @@ -712,11 +721,20 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req) |
5248 | { |
5249 | p9_debug(P9_DEBUG_TRANS, "client %p req %p\n", client, req); |
5250 | |
5251 | + spin_lock(&client->lock); |
5252 | + /* Ignore cancelled request if message has been received |
5253 | + * before lock. |
5254 | + */ |
5255 | + if (req->status == REQ_STATUS_RCVD) { |
5256 | + spin_unlock(&client->lock); |
5257 | + return 0; |
5258 | + } |
5259 | + |
5260 | /* we haven't received a response for oldreq, |
5261 | * remove it from the list. |
5262 | */ |
5263 | - spin_lock(&client->lock); |
5264 | list_del(&req->req_list); |
5265 | + req->status = REQ_STATUS_FLSHD; |
5266 | spin_unlock(&client->lock); |
5267 | |
5268 | return 0; |
5269 | @@ -797,20 +815,28 @@ static int p9_fd_open(struct p9_client *client, int rfd, int wfd) |
5270 | return -ENOMEM; |
5271 | |
5272 | ts->rd = fget(rfd); |
5273 | + if (!ts->rd) |
5274 | + goto out_free_ts; |
5275 | + if (!(ts->rd->f_mode & FMODE_READ)) |
5276 | + goto out_put_rd; |
5277 | ts->wr = fget(wfd); |
5278 | - if (!ts->rd || !ts->wr) { |
5279 | - if (ts->rd) |
5280 | - fput(ts->rd); |
5281 | - if (ts->wr) |
5282 | - fput(ts->wr); |
5283 | - kfree(ts); |
5284 | - return -EIO; |
5285 | - } |
5286 | + if (!ts->wr) |
5287 | + goto out_put_rd; |
5288 | + if (!(ts->wr->f_mode & FMODE_WRITE)) |
5289 | + goto out_put_wr; |
5290 | |
5291 | client->trans = ts; |
5292 | client->status = Connected; |
5293 | |
5294 | return 0; |
5295 | + |
5296 | +out_put_wr: |
5297 | + fput(ts->wr); |
5298 | +out_put_rd: |
5299 | + fput(ts->rd); |
5300 | +out_free_ts: |
5301 | + kfree(ts); |
5302 | + return -EIO; |
5303 | } |
5304 | |
5305 | static int p9_socket_open(struct p9_client *client, struct socket *csocket) |
5306 | diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c |
5307 | index 21096c8822231..3bfd747aa515b 100644 |
5308 | --- a/net/bluetooth/6lowpan.c |
5309 | +++ b/net/bluetooth/6lowpan.c |
5310 | @@ -57,6 +57,7 @@ static bool enable_6lowpan; |
5311 | /* We are listening incoming connections via this channel |
5312 | */ |
5313 | static struct l2cap_chan *listen_chan; |
5314 | +static DEFINE_MUTEX(set_lock); |
5315 | |
5316 | struct lowpan_peer { |
5317 | struct list_head list; |
5318 | @@ -1187,12 +1188,14 @@ static void do_enable_set(struct work_struct *work) |
5319 | |
5320 | enable_6lowpan = set_enable->flag; |
5321 | |
5322 | + mutex_lock(&set_lock); |
5323 | if (listen_chan) { |
5324 | l2cap_chan_close(listen_chan, 0); |
5325 | l2cap_chan_put(listen_chan); |
5326 | } |
5327 | |
5328 | listen_chan = bt_6lowpan_listen(); |
5329 | + mutex_unlock(&set_lock); |
5330 | |
5331 | kfree(set_enable); |
5332 | } |
5333 | @@ -1244,11 +1247,13 @@ static ssize_t lowpan_control_write(struct file *fp, |
5334 | if (ret == -EINVAL) |
5335 | return ret; |
5336 | |
5337 | + mutex_lock(&set_lock); |
5338 | if (listen_chan) { |
5339 | l2cap_chan_close(listen_chan, 0); |
5340 | l2cap_chan_put(listen_chan); |
5341 | listen_chan = NULL; |
5342 | } |
5343 | + mutex_unlock(&set_lock); |
5344 | |
5345 | if (conn) { |
5346 | struct lowpan_peer *peer; |
5347 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
5348 | index a8aa3f29f2d61..757977c54d9ef 100644 |
5349 | --- a/net/bluetooth/hci_event.c |
5350 | +++ b/net/bluetooth/hci_event.c |
5351 | @@ -2094,7 +2094,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) |
5352 | |
5353 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); |
5354 | |
5355 | - if (!num_rsp) |
5356 | + if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1) |
5357 | return; |
5358 | |
5359 | if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) |
5360 | @@ -3623,6 +3623,9 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, |
5361 | struct inquiry_info_with_rssi_and_pscan_mode *info; |
5362 | info = (void *) (skb->data + 1); |
5363 | |
5364 | + if (skb->len < num_rsp * sizeof(*info) + 1) |
5365 | + goto unlock; |
5366 | + |
5367 | for (; num_rsp; num_rsp--, info++) { |
5368 | u32 flags; |
5369 | |
5370 | @@ -3644,6 +3647,9 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, |
5371 | } else { |
5372 | struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); |
5373 | |
5374 | + if (skb->len < num_rsp * sizeof(*info) + 1) |
5375 | + goto unlock; |
5376 | + |
5377 | for (; num_rsp; num_rsp--, info++) { |
5378 | u32 flags; |
5379 | |
5380 | @@ -3664,6 +3670,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, |
5381 | } |
5382 | } |
5383 | |
5384 | +unlock: |
5385 | hci_dev_unlock(hdev); |
5386 | } |
5387 | |
5388 | @@ -3826,7 +3833,7 @@ static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, |
5389 | |
5390 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); |
5391 | |
5392 | - if (!num_rsp) |
5393 | + if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1) |
5394 | return; |
5395 | |
5396 | if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) |
5397 | diff --git a/net/compat.c b/net/compat.c |
5398 | index 633fcf6ee3697..ce851cf4d0f9d 100644 |
5399 | --- a/net/compat.c |
5400 | +++ b/net/compat.c |
5401 | @@ -284,6 +284,7 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) |
5402 | break; |
5403 | } |
5404 | /* Bump the usage count and install the file. */ |
5405 | + __receive_sock(fp[i]); |
5406 | fd_install(new_fd, get_file(fp[i])); |
5407 | } |
5408 | |
5409 | diff --git a/net/core/sock.c b/net/core/sock.c |
5410 | index 3be209f749654..d468ffb5a31c6 100644 |
5411 | --- a/net/core/sock.c |
5412 | +++ b/net/core/sock.c |
5413 | @@ -2323,6 +2323,27 @@ int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct * |
5414 | } |
5415 | EXPORT_SYMBOL(sock_no_mmap); |
5416 | |
5417 | +/* |
5418 | + * When a file is received (via SCM_RIGHTS, etc), we must bump the |
5419 | + * various sock-based usage counts. |
5420 | + */ |
5421 | +void __receive_sock(struct file *file) |
5422 | +{ |
5423 | + struct socket *sock; |
5424 | + int error; |
5425 | + |
5426 | + /* |
5427 | + * The resulting value of "error" is ignored here since we only |
5428 | + * need to take action when the file is a socket and testing |
5429 | + * "sock" for NULL is sufficient. |
5430 | + */ |
5431 | + sock = sock_from_file(file, &error); |
5432 | + if (sock) { |
5433 | + sock_update_netprioidx(&sock->sk->sk_cgrp_data); |
5434 | + sock_update_classid(&sock->sk->sk_cgrp_data); |
5435 | + } |
5436 | +} |
5437 | + |
5438 | ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) |
5439 | { |
5440 | ssize_t res; |
5441 | diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c |
5442 | index a1a7ed6fc8dda..88e357b5fc0f8 100644 |
5443 | --- a/net/ipv4/fib_trie.c |
5444 | +++ b/net/ipv4/fib_trie.c |
5445 | @@ -1719,7 +1719,7 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb) |
5446 | while ((l = leaf_walk_rcu(&tp, key)) != NULL) { |
5447 | struct key_vector *local_l = NULL, *local_tp; |
5448 | |
5449 | - hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { |
5450 | + hlist_for_each_entry(fa, &l->leaf, fa_list) { |
5451 | struct fib_alias *new_fa; |
5452 | |
5453 | if (local_tb->tb_id != fa->tb_id) |
5454 | diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c |
5455 | index 514ac259f5433..b831e9b2e9063 100644 |
5456 | --- a/net/ipv6/anycast.c |
5457 | +++ b/net/ipv6/anycast.c |
5458 | @@ -170,7 +170,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) |
5459 | return 0; |
5460 | } |
5461 | |
5462 | -void ipv6_sock_ac_close(struct sock *sk) |
5463 | +void __ipv6_sock_ac_close(struct sock *sk) |
5464 | { |
5465 | struct ipv6_pinfo *np = inet6_sk(sk); |
5466 | struct net_device *dev = NULL; |
5467 | @@ -178,10 +178,7 @@ void ipv6_sock_ac_close(struct sock *sk) |
5468 | struct net *net = sock_net(sk); |
5469 | int prev_index; |
5470 | |
5471 | - if (!np->ipv6_ac_list) |
5472 | - return; |
5473 | - |
5474 | - rtnl_lock(); |
5475 | + ASSERT_RTNL(); |
5476 | pac = np->ipv6_ac_list; |
5477 | np->ipv6_ac_list = NULL; |
5478 | |
5479 | @@ -198,6 +195,16 @@ void ipv6_sock_ac_close(struct sock *sk) |
5480 | sock_kfree_s(sk, pac, sizeof(*pac)); |
5481 | pac = next; |
5482 | } |
5483 | +} |
5484 | + |
5485 | +void ipv6_sock_ac_close(struct sock *sk) |
5486 | +{ |
5487 | + struct ipv6_pinfo *np = inet6_sk(sk); |
5488 | + |
5489 | + if (!np->ipv6_ac_list) |
5490 | + return; |
5491 | + rtnl_lock(); |
5492 | + __ipv6_sock_ac_close(sk); |
5493 | rtnl_unlock(); |
5494 | } |
5495 | |
5496 | diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c |
5497 | index 2c770bba212cf..622063438953b 100644 |
5498 | --- a/net/ipv6/ipv6_sockglue.c |
5499 | +++ b/net/ipv6/ipv6_sockglue.c |
5500 | @@ -206,6 +206,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
5501 | |
5502 | fl6_free_socklist(sk); |
5503 | __ipv6_sock_mc_close(sk); |
5504 | + __ipv6_sock_ac_close(sk); |
5505 | |
5506 | /* |
5507 | * Sock is moving from IPv6 to IPv4 (sk_prot), so |
5508 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
5509 | index 88dd5d218fe30..1a13715b9a591 100644 |
5510 | --- a/net/mac80211/cfg.c |
5511 | +++ b/net/mac80211/cfg.c |
5512 | @@ -1964,6 +1964,7 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) |
5513 | ieee80211_stop_mesh(sdata); |
5514 | mutex_lock(&sdata->local->mtx); |
5515 | ieee80211_vif_release_channel(sdata); |
5516 | + kfree(sdata->u.mesh.ie); |
5517 | mutex_unlock(&sdata->local->mtx); |
5518 | |
5519 | return 0; |
5520 | diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c |
5521 | index 8c17d498df301..7c409ba1ddc74 100644 |
5522 | --- a/net/mac80211/mesh_pathtbl.c |
5523 | +++ b/net/mac80211/mesh_pathtbl.c |
5524 | @@ -555,6 +555,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl, |
5525 | del_timer_sync(&mpath->timer); |
5526 | atomic_dec(&sdata->u.mesh.mpaths); |
5527 | atomic_dec(&tbl->entries); |
5528 | + mesh_path_flush_pending(mpath); |
5529 | kfree_rcu(mpath, rcu); |
5530 | } |
5531 | |
5532 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
5533 | index 4f7061c3b7706..fef8d7758dae9 100644 |
5534 | --- a/net/mac80211/sta_info.c |
5535 | +++ b/net/mac80211/sta_info.c |
5536 | @@ -946,7 +946,7 @@ static void __sta_info_destroy_part2(struct sta_info *sta) |
5537 | might_sleep(); |
5538 | lockdep_assert_held(&local->sta_mtx); |
5539 | |
5540 | - while (sta->sta_state == IEEE80211_STA_AUTHORIZED) { |
5541 | + if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { |
5542 | ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); |
5543 | WARN_ON_ONCE(ret); |
5544 | } |
5545 | diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
5546 | index e386e6c90b179..574af981806fa 100644 |
5547 | --- a/net/nfc/rawsock.c |
5548 | +++ b/net/nfc/rawsock.c |
5549 | @@ -344,10 +344,13 @@ static int rawsock_create(struct net *net, struct socket *sock, |
5550 | if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW)) |
5551 | return -ESOCKTNOSUPPORT; |
5552 | |
5553 | - if (sock->type == SOCK_RAW) |
5554 | + if (sock->type == SOCK_RAW) { |
5555 | + if (!capable(CAP_NET_RAW)) |
5556 | + return -EPERM; |
5557 | sock->ops = &rawsock_raw_ops; |
5558 | - else |
5559 | + } else { |
5560 | sock->ops = &rawsock_ops; |
5561 | + } |
5562 | |
5563 | sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern); |
5564 | if (!sk) |
5565 | diff --git a/net/rds/recv.c b/net/rds/recv.c |
5566 | index f16ee1b13b8d6..488a198be3e1f 100644 |
5567 | --- a/net/rds/recv.c |
5568 | +++ b/net/rds/recv.c |
5569 | @@ -405,12 +405,13 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, |
5570 | int rds_notify_queue_get(struct rds_sock *rs, struct msghdr *msghdr) |
5571 | { |
5572 | struct rds_notifier *notifier; |
5573 | - struct rds_rdma_notify cmsg = { 0 }; /* fill holes with zero */ |
5574 | + struct rds_rdma_notify cmsg; |
5575 | unsigned int count = 0, max_messages = ~0U; |
5576 | unsigned long flags; |
5577 | LIST_HEAD(copy); |
5578 | int err = 0; |
5579 | |
5580 | + memset(&cmsg, 0, sizeof(cmsg)); /* fill holes with zero */ |
5581 | |
5582 | /* put_cmsg copies to user space and thus may sleep. We can't do this |
5583 | * with rs_lock held, so first grab as many notifications as we can stuff |
5584 | diff --git a/net/socket.c b/net/socket.c |
5585 | index 88abc72df2a69..ab64ae80ca2cd 100644 |
5586 | --- a/net/socket.c |
5587 | +++ b/net/socket.c |
5588 | @@ -498,7 +498,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
5589 | if (f.file) { |
5590 | sock = sock_from_file(f.file, err); |
5591 | if (likely(sock)) { |
5592 | - *fput_needed = f.flags; |
5593 | + *fput_needed = f.flags & FDPUT_FPUT; |
5594 | return sock; |
5595 | } |
5596 | fdput(f); |
5597 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
5598 | index 0048f90944ddf..e107754e29a77 100644 |
5599 | --- a/net/wireless/nl80211.c |
5600 | +++ b/net/wireless/nl80211.c |
5601 | @@ -11317,13 +11317,13 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info) |
5602 | if (!wdev->netdev && !wdev->p2p_started) |
5603 | return -ENETDOWN; |
5604 | } |
5605 | - |
5606 | - if (!vcmd->doit) |
5607 | - return -EOPNOTSUPP; |
5608 | } else { |
5609 | wdev = NULL; |
5610 | } |
5611 | |
5612 | + if (!vcmd->doit) |
5613 | + return -EOPNOTSUPP; |
5614 | + |
5615 | if (info->attrs[NL80211_ATTR_VENDOR_DATA]) { |
5616 | data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]); |
5617 | len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]); |
5618 | diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c |
5619 | index 6b5af65f491fb..a3163645b5bd3 100644 |
5620 | --- a/net/x25/x25_subr.c |
5621 | +++ b/net/x25/x25_subr.c |
5622 | @@ -368,6 +368,12 @@ void x25_disconnect(struct sock *sk, int reason, unsigned char cause, |
5623 | sk->sk_state_change(sk); |
5624 | sock_set_flag(sk, SOCK_DEAD); |
5625 | } |
5626 | + if (x25->neighbour) { |
5627 | + read_lock_bh(&x25_list_lock); |
5628 | + x25_neigh_put(x25->neighbour); |
5629 | + x25->neighbour = NULL; |
5630 | + read_unlock_bh(&x25_list_lock); |
5631 | + } |
5632 | } |
5633 | |
5634 | /* |
5635 | diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c |
5636 | index 3397b216bc6ca..4aecdc8f74b2a 100644 |
5637 | --- a/security/smack/smackfs.c |
5638 | +++ b/security/smack/smackfs.c |
5639 | @@ -907,7 +907,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
5640 | } |
5641 | |
5642 | ret = sscanf(rule, "%d", &maplevel); |
5643 | - if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) |
5644 | + if (ret != 1 || maplevel < 0 || maplevel > SMACK_CIPSO_MAXLEVEL) |
5645 | goto out; |
5646 | |
5647 | rule += SMK_DIGITLEN; |
5648 | @@ -928,6 +928,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
5649 | |
5650 | for (i = 0; i < catlen; i++) { |
5651 | rule += SMK_DIGITLEN; |
5652 | + if (rule > data + count) { |
5653 | + rc = -EOVERFLOW; |
5654 | + goto out; |
5655 | + } |
5656 | ret = sscanf(rule, "%u", &cat); |
5657 | if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM) |
5658 | goto out; |
5659 | @@ -2741,7 +2745,6 @@ static int smk_open_relabel_self(struct inode *inode, struct file *file) |
5660 | static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf, |
5661 | size_t count, loff_t *ppos) |
5662 | { |
5663 | - struct task_smack *tsp = current_security(); |
5664 | char *data; |
5665 | int rc; |
5666 | LIST_HEAD(list_tmp); |
5667 | @@ -2766,11 +2769,21 @@ static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf, |
5668 | kfree(data); |
5669 | |
5670 | if (!rc || (rc == -EINVAL && list_empty(&list_tmp))) { |
5671 | + struct cred *new; |
5672 | + struct task_smack *tsp; |
5673 | + |
5674 | + new = prepare_creds(); |
5675 | + if (!new) { |
5676 | + rc = -ENOMEM; |
5677 | + goto out; |
5678 | + } |
5679 | + tsp = new->security; |
5680 | smk_destroy_label_list(&tsp->smk_relabel); |
5681 | list_splice(&list_tmp, &tsp->smk_relabel); |
5682 | + commit_creds(new); |
5683 | return count; |
5684 | } |
5685 | - |
5686 | +out: |
5687 | smk_destroy_label_list(&list_tmp); |
5688 | return rc; |
5689 | } |
5690 | diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c |
5691 | index 8cdf489df80e0..4b78979599131 100644 |
5692 | --- a/sound/core/seq/oss/seq_oss.c |
5693 | +++ b/sound/core/seq/oss/seq_oss.c |
5694 | @@ -181,10 +181,16 @@ static long |
5695 | odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
5696 | { |
5697 | struct seq_oss_devinfo *dp; |
5698 | + long rc; |
5699 | + |
5700 | dp = file->private_data; |
5701 | if (snd_BUG_ON(!dp)) |
5702 | return -ENXIO; |
5703 | - return snd_seq_oss_ioctl(dp, cmd, arg); |
5704 | + |
5705 | + mutex_lock(®ister_mutex); |
5706 | + rc = snd_seq_oss_ioctl(dp, cmd, arg); |
5707 | + mutex_unlock(®ister_mutex); |
5708 | + return rc; |
5709 | } |
5710 | |
5711 | #ifdef CONFIG_COMPAT |
5712 | diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c |
5713 | index d73ee11a32bd0..db14ee43e461a 100644 |
5714 | --- a/sound/pci/echoaudio/echoaudio.c |
5715 | +++ b/sound/pci/echoaudio/echoaudio.c |
5716 | @@ -2215,7 +2215,6 @@ static int snd_echo_resume(struct device *dev) |
5717 | if (err < 0) { |
5718 | kfree(commpage_bak); |
5719 | dev_err(dev, "resume init_hw err=%d\n", err); |
5720 | - snd_echo_free(chip); |
5721 | return err; |
5722 | } |
5723 | |
5724 | @@ -2242,7 +2241,6 @@ static int snd_echo_resume(struct device *dev) |
5725 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, |
5726 | KBUILD_MODNAME, chip)) { |
5727 | dev_err(chip->card->dev, "cannot grab irq\n"); |
5728 | - snd_echo_free(chip); |
5729 | return -EBUSY; |
5730 | } |
5731 | chip->irq = pci->irq; |
5732 | diff --git a/sound/usb/card.h b/sound/usb/card.h |
5733 | index 111b0f009afa4..f1a517ac49b28 100644 |
5734 | --- a/sound/usb/card.h |
5735 | +++ b/sound/usb/card.h |
5736 | @@ -125,6 +125,7 @@ struct snd_usb_substream { |
5737 | unsigned int tx_length_quirk:1; /* add length specifier to transfers */ |
5738 | unsigned int fmt_type; /* USB audio format type (1-3) */ |
5739 | unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */ |
5740 | + unsigned int stream_offset_adj; /* Bytes to drop from beginning of stream (for non-compliant devices) */ |
5741 | |
5742 | unsigned int running: 1; /* running status */ |
5743 | |
5744 | diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
5745 | index 198515f86fcc2..1f2c69e599d9c 100644 |
5746 | --- a/sound/usb/mixer_quirks.c |
5747 | +++ b/sound/usb/mixer_quirks.c |
5748 | @@ -195,6 +195,7 @@ static const struct rc_config { |
5749 | { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ |
5750 | { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
5751 | { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
5752 | + { USB_ID(0x041e, 0x3263), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
5753 | { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ |
5754 | }; |
5755 | |
5756 | diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
5757 | index 9bc995f9b4e17..ec7bea45c852c 100644 |
5758 | --- a/sound/usb/pcm.c |
5759 | +++ b/sound/usb/pcm.c |
5760 | @@ -1312,6 +1312,12 @@ static void retire_capture_urb(struct snd_usb_substream *subs, |
5761 | // continue; |
5762 | } |
5763 | bytes = urb->iso_frame_desc[i].actual_length; |
5764 | + if (subs->stream_offset_adj > 0) { |
5765 | + unsigned int adj = min(subs->stream_offset_adj, bytes); |
5766 | + cp += adj; |
5767 | + bytes -= adj; |
5768 | + subs->stream_offset_adj -= adj; |
5769 | + } |
5770 | frames = bytes / stride; |
5771 | if (!subs->txfr_quirk) |
5772 | bytes = frames * stride; |
5773 | diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
5774 | index ec56ce3820619..689fd3103e5b6 100644 |
5775 | --- a/sound/usb/quirks-table.h |
5776 | +++ b/sound/usb/quirks-table.h |
5777 | @@ -3335,7 +3335,13 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
5778 | * with. |
5779 | */ |
5780 | { |
5781 | - USB_DEVICE(0x534d, 0x2109), |
5782 | + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | |
5783 | + USB_DEVICE_ID_MATCH_INT_CLASS | |
5784 | + USB_DEVICE_ID_MATCH_INT_SUBCLASS, |
5785 | + .idVendor = 0x534d, |
5786 | + .idProduct = 0x2109, |
5787 | + .bInterfaceClass = USB_CLASS_AUDIO, |
5788 | + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, |
5789 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
5790 | .vendor_name = "MacroSilicon", |
5791 | .product_name = "MS2109", |
5792 | @@ -3374,5 +3380,61 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
5793 | } |
5794 | } |
5795 | }, |
5796 | +{ |
5797 | + /* |
5798 | + * PIONEER DJ DDJ-RB |
5799 | + * PCM is 4 channels out, 2 dummy channels in @ 44.1 fixed |
5800 | + * The feedback for the output is the dummy input. |
5801 | + */ |
5802 | + USB_DEVICE_VENDOR_SPEC(0x2b73, 0x000e), |
5803 | + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
5804 | + .ifnum = QUIRK_ANY_INTERFACE, |
5805 | + .type = QUIRK_COMPOSITE, |
5806 | + .data = (const struct snd_usb_audio_quirk[]) { |
5807 | + { |
5808 | + .ifnum = 0, |
5809 | + .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
5810 | + .data = &(const struct audioformat) { |
5811 | + .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
5812 | + .channels = 4, |
5813 | + .iface = 0, |
5814 | + .altsetting = 1, |
5815 | + .altset_idx = 1, |
5816 | + .endpoint = 0x01, |
5817 | + .ep_attr = USB_ENDPOINT_XFER_ISOC| |
5818 | + USB_ENDPOINT_SYNC_ASYNC, |
5819 | + .rates = SNDRV_PCM_RATE_44100, |
5820 | + .rate_min = 44100, |
5821 | + .rate_max = 44100, |
5822 | + .nr_rates = 1, |
5823 | + .rate_table = (unsigned int[]) { 44100 } |
5824 | + } |
5825 | + }, |
5826 | + { |
5827 | + .ifnum = 0, |
5828 | + .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
5829 | + .data = &(const struct audioformat) { |
5830 | + .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
5831 | + .channels = 2, |
5832 | + .iface = 0, |
5833 | + .altsetting = 1, |
5834 | + .altset_idx = 1, |
5835 | + .endpoint = 0x82, |
5836 | + .ep_attr = USB_ENDPOINT_XFER_ISOC| |
5837 | + USB_ENDPOINT_SYNC_ASYNC| |
5838 | + USB_ENDPOINT_USAGE_IMPLICIT_FB, |
5839 | + .rates = SNDRV_PCM_RATE_44100, |
5840 | + .rate_min = 44100, |
5841 | + .rate_max = 44100, |
5842 | + .nr_rates = 1, |
5843 | + .rate_table = (unsigned int[]) { 44100 } |
5844 | + } |
5845 | + }, |
5846 | + { |
5847 | + .ifnum = -1 |
5848 | + } |
5849 | + } |
5850 | + } |
5851 | +}, |
5852 | |
5853 | #undef USB_DEVICE_VENDOR_SPEC |
5854 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
5855 | index 486d27129ac39..08e1af85af384 100644 |
5856 | --- a/sound/usb/quirks.c |
5857 | +++ b/sound/usb/quirks.c |
5858 | @@ -1121,6 +1121,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, |
5859 | case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ |
5860 | set_format_emu_quirk(subs, fmt); |
5861 | break; |
5862 | + case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ |
5863 | + subs->stream_offset_adj = 2; |
5864 | + break; |
5865 | } |
5866 | } |
5867 | |
5868 | diff --git a/sound/usb/stream.c b/sound/usb/stream.c |
5869 | index 8e9548bc1f1a9..499f8def98de8 100644 |
5870 | --- a/sound/usb/stream.c |
5871 | +++ b/sound/usb/stream.c |
5872 | @@ -95,6 +95,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, |
5873 | subs->tx_length_quirk = as->chip->tx_length_quirk; |
5874 | subs->speed = snd_usb_get_speed(subs->dev); |
5875 | subs->pkt_offset_adj = 0; |
5876 | + subs->stream_offset_adj = 0; |
5877 | |
5878 | snd_usb_set_pcm_ops(as->pcm, stream); |
5879 | |
5880 | diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c |
5881 | index 62f4cacf253ab..b9db8739487dc 100644 |
5882 | --- a/tools/lib/traceevent/event-parse.c |
5883 | +++ b/tools/lib/traceevent/event-parse.c |
5884 | @@ -2764,6 +2764,7 @@ process_dynamic_array_len(struct event_format *event, struct print_arg *arg, |
5885 | if (read_expected(EVENT_DELIM, ")") < 0) |
5886 | goto out_err; |
5887 | |
5888 | + free_token(token); |
5889 | type = read_token(&token); |
5890 | *tok = token; |
5891 | |
5892 | diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
5893 | index a36883ad48a45..4b4d2ce912566 100644 |
5894 | --- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
5895 | +++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
5896 | @@ -22,6 +22,7 @@ |
5897 | #include <limits.h> |
5898 | #include <sys/time.h> |
5899 | #include <sys/syscall.h> |
5900 | +#include <sys/sysinfo.h> |
5901 | #include <sys/types.h> |
5902 | #include <sys/shm.h> |
5903 | #include <linux/futex.h> |
5904 | @@ -97,8 +98,9 @@ static void start_thread_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
5905 | |
5906 | static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
5907 | { |
5908 | - int pid; |
5909 | - cpu_set_t cpuset; |
5910 | + int pid, ncpus; |
5911 | + cpu_set_t *cpuset; |
5912 | + size_t size; |
5913 | |
5914 | pid = fork(); |
5915 | if (pid == -1) { |
5916 | @@ -109,14 +111,23 @@ static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
5917 | if (pid) |
5918 | return; |
5919 | |
5920 | - CPU_ZERO(&cpuset); |
5921 | - CPU_SET(cpu, &cpuset); |
5922 | + ncpus = get_nprocs(); |
5923 | + size = CPU_ALLOC_SIZE(ncpus); |
5924 | + cpuset = CPU_ALLOC(ncpus); |
5925 | + if (!cpuset) { |
5926 | + perror("malloc"); |
5927 | + exit(1); |
5928 | + } |
5929 | + CPU_ZERO_S(size, cpuset); |
5930 | + CPU_SET_S(cpu, size, cpuset); |
5931 | |
5932 | - if (sched_setaffinity(0, sizeof(cpuset), &cpuset)) { |
5933 | + if (sched_setaffinity(0, size, cpuset)) { |
5934 | perror("sched_setaffinity"); |
5935 | + CPU_FREE(cpuset); |
5936 | exit(1); |
5937 | } |
5938 | |
5939 | + CPU_FREE(cpuset); |
5940 | fn(arg); |
5941 | |
5942 | exit(0); |
5943 | diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c |
5944 | index dcf74184bfd0a..bafb70d0ee264 100644 |
5945 | --- a/tools/testing/selftests/powerpc/utils.c |
5946 | +++ b/tools/testing/selftests/powerpc/utils.c |
5947 | @@ -12,6 +12,7 @@ |
5948 | #include <sched.h> |
5949 | #include <stdio.h> |
5950 | #include <sys/stat.h> |
5951 | +#include <sys/sysinfo.h> |
5952 | #include <sys/types.h> |
5953 | #include <unistd.h> |
5954 | |
5955 | @@ -62,26 +63,38 @@ out: |
5956 | |
5957 | int pick_online_cpu(void) |
5958 | { |
5959 | - cpu_set_t mask; |
5960 | - int cpu; |
5961 | + int ncpus, cpu = -1; |
5962 | + cpu_set_t *mask; |
5963 | + size_t size; |
5964 | + |
5965 | + ncpus = get_nprocs_conf(); |
5966 | + size = CPU_ALLOC_SIZE(ncpus); |
5967 | + mask = CPU_ALLOC(ncpus); |
5968 | + if (!mask) { |
5969 | + perror("malloc"); |
5970 | + return -1; |
5971 | + } |
5972 | |
5973 | - CPU_ZERO(&mask); |
5974 | + CPU_ZERO_S(size, mask); |
5975 | |
5976 | - if (sched_getaffinity(0, sizeof(mask), &mask)) { |
5977 | + if (sched_getaffinity(0, size, mask)) { |
5978 | perror("sched_getaffinity"); |
5979 | - return -1; |
5980 | + goto done; |
5981 | } |
5982 | |
5983 | /* We prefer a primary thread, but skip 0 */ |
5984 | - for (cpu = 8; cpu < CPU_SETSIZE; cpu += 8) |
5985 | - if (CPU_ISSET(cpu, &mask)) |
5986 | - return cpu; |
5987 | + for (cpu = 8; cpu < ncpus; cpu += 8) |
5988 | + if (CPU_ISSET_S(cpu, size, mask)) |
5989 | + goto done; |
5990 | |
5991 | /* Search for anything, but in reverse */ |
5992 | - for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--) |
5993 | - if (CPU_ISSET(cpu, &mask)) |
5994 | - return cpu; |
5995 | + for (cpu = ncpus - 1; cpu >= 0; cpu--) |
5996 | + if (CPU_ISSET_S(cpu, size, mask)) |
5997 | + goto done; |
5998 | |
5999 | printf("No cpus in affinity mask?!\n"); |
6000 | - return -1; |
6001 | + |
6002 | +done: |
6003 | + CPU_FREE(mask); |
6004 | + return cpu; |
6005 | } |