Contents of /trunk/kernel-alx/patches-5.4/0227-5.4.128-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (19 months ago) by niro
File size: 103522 byte(s)
Mon Oct 24 12:40:44 2022 UTC (19 months ago) by niro
File size: 103522 byte(s)
-add missing
1 | diff --git a/Documentation/vm/slub.rst b/Documentation/vm/slub.rst |
2 | index 933ada4368ff3..309c1acb414b7 100644 |
3 | --- a/Documentation/vm/slub.rst |
4 | +++ b/Documentation/vm/slub.rst |
5 | @@ -160,7 +160,7 @@ SLUB Debug output |
6 | Here is a sample of slub debug output:: |
7 | |
8 | ==================================================================== |
9 | - BUG kmalloc-8: Redzone overwritten |
10 | + BUG kmalloc-8: Right Redzone overwritten |
11 | -------------------------------------------------------------------- |
12 | |
13 | INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc |
14 | @@ -168,10 +168,10 @@ Here is a sample of slub debug output:: |
15 | INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58 |
16 | INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554 |
17 | |
18 | - Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ |
19 | - Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 |
20 | - Redzone 0xc90f6d28: 00 cc cc cc . |
21 | - Padding 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ |
22 | + Bytes b4 (0xc90f6d10): 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ |
23 | + Object (0xc90f6d20): 31 30 31 39 2e 30 30 35 1019.005 |
24 | + Redzone (0xc90f6d28): 00 cc cc cc . |
25 | + Padding (0xc90f6d50): 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ |
26 | |
27 | [<c010523d>] dump_trace+0x63/0x1eb |
28 | [<c01053df>] show_trace_log_lvl+0x1a/0x2f |
29 | diff --git a/Makefile b/Makefile |
30 | index ba10c68113427..5db87d8031f1e 100644 |
31 | --- a/Makefile |
32 | +++ b/Makefile |
33 | @@ -1,7 +1,7 @@ |
34 | # SPDX-License-Identifier: GPL-2.0 |
35 | VERSION = 5 |
36 | PATCHLEVEL = 4 |
37 | -SUBLEVEL = 127 |
38 | +SUBLEVEL = 128 |
39 | EXTRAVERSION = |
40 | NAME = Kleptomaniac Octopus |
41 | |
42 | diff --git a/arch/arc/include/uapi/asm/sigcontext.h b/arch/arc/include/uapi/asm/sigcontext.h |
43 | index 95f8a4380e110..7a5449dfcb290 100644 |
44 | --- a/arch/arc/include/uapi/asm/sigcontext.h |
45 | +++ b/arch/arc/include/uapi/asm/sigcontext.h |
46 | @@ -18,6 +18,7 @@ |
47 | */ |
48 | struct sigcontext { |
49 | struct user_regs_struct regs; |
50 | + struct user_regs_arcv2 v2abi; |
51 | }; |
52 | |
53 | #endif /* _ASM_ARC_SIGCONTEXT_H */ |
54 | diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c |
55 | index 4045180510939..8877de0dfe6cf 100644 |
56 | --- a/arch/arc/kernel/signal.c |
57 | +++ b/arch/arc/kernel/signal.c |
58 | @@ -61,6 +61,41 @@ struct rt_sigframe { |
59 | unsigned int sigret_magic; |
60 | }; |
61 | |
62 | +static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) |
63 | +{ |
64 | + int err = 0; |
65 | +#ifndef CONFIG_ISA_ARCOMPACT |
66 | + struct user_regs_arcv2 v2abi; |
67 | + |
68 | + v2abi.r30 = regs->r30; |
69 | +#ifdef CONFIG_ARC_HAS_ACCL_REGS |
70 | + v2abi.r58 = regs->r58; |
71 | + v2abi.r59 = regs->r59; |
72 | +#else |
73 | + v2abi.r58 = v2abi.r59 = 0; |
74 | +#endif |
75 | + err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi)); |
76 | +#endif |
77 | + return err; |
78 | +} |
79 | + |
80 | +static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) |
81 | +{ |
82 | + int err = 0; |
83 | +#ifndef CONFIG_ISA_ARCOMPACT |
84 | + struct user_regs_arcv2 v2abi; |
85 | + |
86 | + err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi)); |
87 | + |
88 | + regs->r30 = v2abi.r30; |
89 | +#ifdef CONFIG_ARC_HAS_ACCL_REGS |
90 | + regs->r58 = v2abi.r58; |
91 | + regs->r59 = v2abi.r59; |
92 | +#endif |
93 | +#endif |
94 | + return err; |
95 | +} |
96 | + |
97 | static int |
98 | stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, |
99 | sigset_t *set) |
100 | @@ -94,6 +129,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, |
101 | |
102 | err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch, |
103 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
104 | + |
105 | + if (is_isa_arcv2()) |
106 | + err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs); |
107 | + |
108 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); |
109 | |
110 | return err ? -EFAULT : 0; |
111 | @@ -109,6 +148,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) |
112 | err |= __copy_from_user(&uregs.scratch, |
113 | &(sf->uc.uc_mcontext.regs.scratch), |
114 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
115 | + |
116 | + if (is_isa_arcv2()) |
117 | + err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs); |
118 | + |
119 | if (err) |
120 | return -EFAULT; |
121 | |
122 | diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi |
123 | index 3ae4f6358da41..bc702579488b9 100644 |
124 | --- a/arch/arm/boot/dts/dra7-l4.dtsi |
125 | +++ b/arch/arm/boot/dts/dra7-l4.dtsi |
126 | @@ -1176,7 +1176,7 @@ |
127 | }; |
128 | }; |
129 | |
130 | - target-module@34000 { /* 0x48034000, ap 7 46.0 */ |
131 | + timer3_target: target-module@34000 { /* 0x48034000, ap 7 46.0 */ |
132 | compatible = "ti,sysc-omap4-timer", "ti,sysc"; |
133 | ti,hwmods = "timer3"; |
134 | reg = <0x34000 0x4>, |
135 | @@ -1204,7 +1204,7 @@ |
136 | }; |
137 | }; |
138 | |
139 | - target-module@36000 { /* 0x48036000, ap 9 4e.0 */ |
140 | + timer4_target: target-module@36000 { /* 0x48036000, ap 9 4e.0 */ |
141 | compatible = "ti,sysc-omap4-timer", "ti,sysc"; |
142 | ti,hwmods = "timer4"; |
143 | reg = <0x36000 0x4>, |
144 | diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi |
145 | index a6ef3d137c7a0..f73324cb31f31 100644 |
146 | --- a/arch/arm/boot/dts/dra7.dtsi |
147 | +++ b/arch/arm/boot/dts/dra7.dtsi |
148 | @@ -46,6 +46,7 @@ |
149 | |
150 | timer { |
151 | compatible = "arm,armv7-timer"; |
152 | + status = "disabled"; /* See ARM architected timer wrap erratum i940 */ |
153 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
154 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
155 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
156 | @@ -766,3 +767,22 @@ |
157 | |
158 | #include "dra7-l4.dtsi" |
159 | #include "dra7xx-clocks.dtsi" |
160 | + |
161 | +/* Local timers, see ARM architected timer wrap erratum i940 */ |
162 | +&timer3_target { |
163 | + ti,no-reset-on-init; |
164 | + ti,no-idle; |
165 | + timer@0 { |
166 | + assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER3_CLKCTRL 24>; |
167 | + assigned-clock-parents = <&timer_sys_clk_div>; |
168 | + }; |
169 | +}; |
170 | + |
171 | +&timer4_target { |
172 | + ti,no-reset-on-init; |
173 | + ti,no-idle; |
174 | + timer@0 { |
175 | + assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER4_CLKCTRL 24>; |
176 | + assigned-clock-parents = <&timer_sys_clk_div>; |
177 | + }; |
178 | +}; |
179 | diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c |
180 | index d068958d6f8a4..2c1e2b32b9b36 100644 |
181 | --- a/arch/arm/mach-omap1/pm.c |
182 | +++ b/arch/arm/mach-omap1/pm.c |
183 | @@ -596,11 +596,6 @@ static irqreturn_t omap_wakeup_interrupt(int irq, void *dev) |
184 | return IRQ_HANDLED; |
185 | } |
186 | |
187 | -static struct irqaction omap_wakeup_irq = { |
188 | - .name = "peripheral wakeup", |
189 | - .handler = omap_wakeup_interrupt |
190 | -}; |
191 | - |
192 | |
193 | |
194 | static const struct platform_suspend_ops omap_pm_ops = { |
195 | @@ -613,6 +608,7 @@ static const struct platform_suspend_ops omap_pm_ops = { |
196 | static int __init omap_pm_init(void) |
197 | { |
198 | int error = 0; |
199 | + int irq; |
200 | |
201 | if (!cpu_class_is_omap1()) |
202 | return -ENODEV; |
203 | @@ -656,9 +652,12 @@ static int __init omap_pm_init(void) |
204 | arm_pm_idle = omap1_pm_idle; |
205 | |
206 | if (cpu_is_omap7xx()) |
207 | - setup_irq(INT_7XX_WAKE_UP_REQ, &omap_wakeup_irq); |
208 | + irq = INT_7XX_WAKE_UP_REQ; |
209 | else if (cpu_is_omap16xx()) |
210 | - setup_irq(INT_1610_WAKE_UP_REQ, &omap_wakeup_irq); |
211 | + irq = INT_1610_WAKE_UP_REQ; |
212 | + if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", |
213 | + NULL)) |
214 | + pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); |
215 | |
216 | /* Program new power ramp-up time |
217 | * (0 for most boards since we don't lower voltage when in deep sleep) |
218 | diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c |
219 | index 524977a31a49c..de590a85a42b3 100644 |
220 | --- a/arch/arm/mach-omap1/time.c |
221 | +++ b/arch/arm/mach-omap1/time.c |
222 | @@ -155,15 +155,11 @@ static irqreturn_t omap_mpu_timer1_interrupt(int irq, void *dev_id) |
223 | return IRQ_HANDLED; |
224 | } |
225 | |
226 | -static struct irqaction omap_mpu_timer1_irq = { |
227 | - .name = "mpu_timer1", |
228 | - .flags = IRQF_TIMER | IRQF_IRQPOLL, |
229 | - .handler = omap_mpu_timer1_interrupt, |
230 | -}; |
231 | - |
232 | static __init void omap_init_mpu_timer(unsigned long rate) |
233 | { |
234 | - setup_irq(INT_TIMER1, &omap_mpu_timer1_irq); |
235 | + if (request_irq(INT_TIMER1, omap_mpu_timer1_interrupt, |
236 | + IRQF_TIMER | IRQF_IRQPOLL, "mpu_timer1", NULL)) |
237 | + pr_err("Failed to request irq %d (mpu_timer1)\n", INT_TIMER1); |
238 | omap_mpu_timer_start(0, (rate / HZ) - 1, 1); |
239 | |
240 | clockevent_mpu_timer1.cpumask = cpumask_of(0); |
241 | diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c |
242 | index 0ae6c52a7d70b..780fdf03c3cee 100644 |
243 | --- a/arch/arm/mach-omap1/timer32k.c |
244 | +++ b/arch/arm/mach-omap1/timer32k.c |
245 | @@ -148,15 +148,11 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id) |
246 | return IRQ_HANDLED; |
247 | } |
248 | |
249 | -static struct irqaction omap_32k_timer_irq = { |
250 | - .name = "32KHz timer", |
251 | - .flags = IRQF_TIMER | IRQF_IRQPOLL, |
252 | - .handler = omap_32k_timer_interrupt, |
253 | -}; |
254 | - |
255 | static __init void omap_init_32k_timer(void) |
256 | { |
257 | - setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); |
258 | + if (request_irq(INT_OS_TIMER, omap_32k_timer_interrupt, |
259 | + IRQF_TIMER | IRQF_IRQPOLL, "32KHz timer", NULL)) |
260 | + pr_err("Failed to request irq %d(32KHz timer)\n", INT_OS_TIMER); |
261 | |
262 | clockevent_32k_timer.cpumask = cpumask_of(0); |
263 | clockevents_config_and_register(&clockevent_32k_timer, |
264 | diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c |
265 | index ff992f8895ee4..ad512f07d5689 100644 |
266 | --- a/arch/arm/mach-omap2/board-generic.c |
267 | +++ b/arch/arm/mach-omap2/board-generic.c |
268 | @@ -327,7 +327,7 @@ DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)") |
269 | .init_late = dra7xx_init_late, |
270 | .init_irq = omap_gic_of_init, |
271 | .init_machine = omap_generic_init, |
272 | - .init_time = omap5_realtime_timer_init, |
273 | + .init_time = omap3_gptimer_timer_init, |
274 | .dt_compat = dra74x_boards_compat, |
275 | .restart = omap44xx_restart, |
276 | MACHINE_END |
277 | @@ -350,7 +350,7 @@ DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)") |
278 | .init_late = dra7xx_init_late, |
279 | .init_irq = omap_gic_of_init, |
280 | .init_machine = omap_generic_init, |
281 | - .init_time = omap5_realtime_timer_init, |
282 | + .init_time = omap3_gptimer_timer_init, |
283 | .dt_compat = dra72x_boards_compat, |
284 | .restart = omap44xx_restart, |
285 | MACHINE_END |
286 | diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c |
287 | index 07bea84c5d6e4..1defb838eae3a 100644 |
288 | --- a/arch/arm/mach-omap2/timer.c |
289 | +++ b/arch/arm/mach-omap2/timer.c |
290 | @@ -42,6 +42,7 @@ |
291 | #include <linux/platform_device.h> |
292 | #include <linux/platform_data/dmtimer-omap.h> |
293 | #include <linux/sched_clock.h> |
294 | +#include <linux/cpu.h> |
295 | |
296 | #include <asm/mach/time.h> |
297 | |
298 | @@ -63,15 +64,28 @@ |
299 | |
300 | /* Clockevent code */ |
301 | |
302 | -static struct omap_dm_timer clkev; |
303 | -static struct clock_event_device clockevent_gpt; |
304 | - |
305 | /* Clockevent hwmod for am335x and am437x suspend */ |
306 | static struct omap_hwmod *clockevent_gpt_hwmod; |
307 | |
308 | /* Clockesource hwmod for am437x suspend */ |
309 | static struct omap_hwmod *clocksource_gpt_hwmod; |
310 | |
311 | +struct dmtimer_clockevent { |
312 | + struct clock_event_device dev; |
313 | + struct omap_dm_timer timer; |
314 | +}; |
315 | + |
316 | +static struct dmtimer_clockevent clockevent; |
317 | + |
318 | +static struct omap_dm_timer *to_dmtimer(struct clock_event_device *clockevent) |
319 | +{ |
320 | + struct dmtimer_clockevent *clkevt = |
321 | + container_of(clockevent, struct dmtimer_clockevent, dev); |
322 | + struct omap_dm_timer *timer = &clkevt->timer; |
323 | + |
324 | + return timer; |
325 | +} |
326 | + |
327 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER |
328 | static unsigned long arch_timer_freq; |
329 | |
330 | @@ -83,24 +97,21 @@ void set_cntfreq(void) |
331 | |
332 | static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) |
333 | { |
334 | - struct clock_event_device *evt = &clockevent_gpt; |
335 | - |
336 | - __omap_dm_timer_write_status(&clkev, OMAP_TIMER_INT_OVERFLOW); |
337 | + struct dmtimer_clockevent *clkevt = dev_id; |
338 | + struct clock_event_device *evt = &clkevt->dev; |
339 | + struct omap_dm_timer *timer = &clkevt->timer; |
340 | |
341 | + __omap_dm_timer_write_status(timer, OMAP_TIMER_INT_OVERFLOW); |
342 | evt->event_handler(evt); |
343 | return IRQ_HANDLED; |
344 | } |
345 | |
346 | -static struct irqaction omap2_gp_timer_irq = { |
347 | - .name = "gp_timer", |
348 | - .flags = IRQF_TIMER | IRQF_IRQPOLL, |
349 | - .handler = omap2_gp_timer_interrupt, |
350 | -}; |
351 | - |
352 | static int omap2_gp_timer_set_next_event(unsigned long cycles, |
353 | struct clock_event_device *evt) |
354 | { |
355 | - __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST, |
356 | + struct omap_dm_timer *timer = to_dmtimer(evt); |
357 | + |
358 | + __omap_dm_timer_load_start(timer, OMAP_TIMER_CTRL_ST, |
359 | 0xffffffff - cycles, OMAP_TIMER_POSTED); |
360 | |
361 | return 0; |
362 | @@ -108,22 +119,26 @@ static int omap2_gp_timer_set_next_event(unsigned long cycles, |
363 | |
364 | static int omap2_gp_timer_shutdown(struct clock_event_device *evt) |
365 | { |
366 | - __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate); |
367 | + struct omap_dm_timer *timer = to_dmtimer(evt); |
368 | + |
369 | + __omap_dm_timer_stop(timer, OMAP_TIMER_POSTED, timer->rate); |
370 | + |
371 | return 0; |
372 | } |
373 | |
374 | static int omap2_gp_timer_set_periodic(struct clock_event_device *evt) |
375 | { |
376 | + struct omap_dm_timer *timer = to_dmtimer(evt); |
377 | u32 period; |
378 | |
379 | - __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate); |
380 | + __omap_dm_timer_stop(timer, OMAP_TIMER_POSTED, timer->rate); |
381 | |
382 | - period = clkev.rate / HZ; |
383 | + period = timer->rate / HZ; |
384 | period -= 1; |
385 | /* Looks like we need to first set the load value separately */ |
386 | - __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 0xffffffff - period, |
387 | + __omap_dm_timer_write(timer, OMAP_TIMER_LOAD_REG, 0xffffffff - period, |
388 | OMAP_TIMER_POSTED); |
389 | - __omap_dm_timer_load_start(&clkev, |
390 | + __omap_dm_timer_load_start(timer, |
391 | OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, |
392 | 0xffffffff - period, OMAP_TIMER_POSTED); |
393 | return 0; |
394 | @@ -137,25 +152,16 @@ static void omap_clkevt_idle(struct clock_event_device *unused) |
395 | omap_hwmod_idle(clockevent_gpt_hwmod); |
396 | } |
397 | |
398 | -static void omap_clkevt_unidle(struct clock_event_device *unused) |
399 | +static void omap_clkevt_unidle(struct clock_event_device *evt) |
400 | { |
401 | + struct omap_dm_timer *timer = to_dmtimer(evt); |
402 | + |
403 | if (!clockevent_gpt_hwmod) |
404 | return; |
405 | |
406 | omap_hwmod_enable(clockevent_gpt_hwmod); |
407 | - __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); |
408 | -} |
409 | - |
410 | -static struct clock_event_device clockevent_gpt = { |
411 | - .features = CLOCK_EVT_FEAT_PERIODIC | |
412 | - CLOCK_EVT_FEAT_ONESHOT, |
413 | - .rating = 300, |
414 | - .set_next_event = omap2_gp_timer_set_next_event, |
415 | - .set_state_shutdown = omap2_gp_timer_shutdown, |
416 | - .set_state_periodic = omap2_gp_timer_set_periodic, |
417 | - .set_state_oneshot = omap2_gp_timer_shutdown, |
418 | - .tick_resume = omap2_gp_timer_shutdown, |
419 | -}; |
420 | + __omap_dm_timer_int_enable(timer, OMAP_TIMER_INT_OVERFLOW); |
421 | +} |
422 | |
423 | static const struct of_device_id omap_timer_match[] __initconst = { |
424 | { .compatible = "ti,omap2420-timer", }, |
425 | @@ -362,47 +368,104 @@ void tick_broadcast(const struct cpumask *mask) |
426 | } |
427 | #endif |
428 | |
429 | -static void __init omap2_gp_clockevent_init(int gptimer_id, |
430 | - const char *fck_source, |
431 | - const char *property) |
432 | +static void __init dmtimer_clkevt_init_common(struct dmtimer_clockevent *clkevt, |
433 | + int gptimer_id, |
434 | + const char *fck_source, |
435 | + unsigned int features, |
436 | + const struct cpumask *cpumask, |
437 | + const char *property, |
438 | + int rating, const char *name) |
439 | { |
440 | + struct omap_dm_timer *timer = &clkevt->timer; |
441 | int res; |
442 | |
443 | - clkev.id = gptimer_id; |
444 | - clkev.errata = omap_dm_timer_get_errata(); |
445 | + timer->id = gptimer_id; |
446 | + timer->errata = omap_dm_timer_get_errata(); |
447 | + clkevt->dev.features = features; |
448 | + clkevt->dev.rating = rating; |
449 | + clkevt->dev.set_next_event = omap2_gp_timer_set_next_event; |
450 | + clkevt->dev.set_state_shutdown = omap2_gp_timer_shutdown; |
451 | + clkevt->dev.set_state_periodic = omap2_gp_timer_set_periodic; |
452 | + clkevt->dev.set_state_oneshot = omap2_gp_timer_shutdown; |
453 | + clkevt->dev.tick_resume = omap2_gp_timer_shutdown; |
454 | |
455 | /* |
456 | * For clock-event timers we never read the timer counter and |
457 | * so we are not impacted by errata i103 and i767. Therefore, |
458 | * we can safely ignore this errata for clock-event timers. |
459 | */ |
460 | - __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); |
461 | + __omap_dm_timer_override_errata(timer, OMAP_TIMER_ERRATA_I103_I767); |
462 | |
463 | - res = omap_dm_timer_init_one(&clkev, fck_source, property, |
464 | - &clockevent_gpt.name, OMAP_TIMER_POSTED); |
465 | + res = omap_dm_timer_init_one(timer, fck_source, property, |
466 | + &clkevt->dev.name, OMAP_TIMER_POSTED); |
467 | BUG_ON(res); |
468 | |
469 | - omap2_gp_timer_irq.dev_id = &clkev; |
470 | - setup_irq(clkev.irq, &omap2_gp_timer_irq); |
471 | + clkevt->dev.cpumask = cpumask; |
472 | + clkevt->dev.irq = omap_dm_timer_get_irq(timer); |
473 | |
474 | - __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); |
475 | + if (request_irq(clkevt->dev.irq, omap2_gp_timer_interrupt, |
476 | + IRQF_TIMER | IRQF_IRQPOLL, name, clkevt)) |
477 | + pr_err("Failed to request irq %d (gp_timer)\n", clkevt->dev.irq); |
478 | |
479 | - clockevent_gpt.cpumask = cpu_possible_mask; |
480 | - clockevent_gpt.irq = omap_dm_timer_get_irq(&clkev); |
481 | - clockevents_config_and_register(&clockevent_gpt, clkev.rate, |
482 | - 3, /* Timer internal resynch latency */ |
483 | - 0xffffffff); |
484 | + __omap_dm_timer_int_enable(timer, OMAP_TIMER_INT_OVERFLOW); |
485 | |
486 | if (soc_is_am33xx() || soc_is_am43xx()) { |
487 | - clockevent_gpt.suspend = omap_clkevt_idle; |
488 | - clockevent_gpt.resume = omap_clkevt_unidle; |
489 | + clkevt->dev.suspend = omap_clkevt_idle; |
490 | + clkevt->dev.resume = omap_clkevt_unidle; |
491 | |
492 | clockevent_gpt_hwmod = |
493 | - omap_hwmod_lookup(clockevent_gpt.name); |
494 | + omap_hwmod_lookup(clkevt->dev.name); |
495 | + } |
496 | + |
497 | + pr_info("OMAP clockevent source: %s at %lu Hz\n", clkevt->dev.name, |
498 | + timer->rate); |
499 | +} |
500 | + |
501 | +static DEFINE_PER_CPU(struct dmtimer_clockevent, dmtimer_percpu_timer); |
502 | + |
503 | +static int omap_gptimer_starting_cpu(unsigned int cpu) |
504 | +{ |
505 | + struct dmtimer_clockevent *clkevt = per_cpu_ptr(&dmtimer_percpu_timer, cpu); |
506 | + struct clock_event_device *dev = &clkevt->dev; |
507 | + struct omap_dm_timer *timer = &clkevt->timer; |
508 | + |
509 | + clockevents_config_and_register(dev, timer->rate, 3, ULONG_MAX); |
510 | + irq_force_affinity(dev->irq, cpumask_of(cpu)); |
511 | + |
512 | + return 0; |
513 | +} |
514 | + |
515 | +static int __init dmtimer_percpu_quirk_init(void) |
516 | +{ |
517 | + struct dmtimer_clockevent *clkevt; |
518 | + struct clock_event_device *dev; |
519 | + struct device_node *arm_timer; |
520 | + struct omap_dm_timer *timer; |
521 | + int cpu = 0; |
522 | + |
523 | + arm_timer = of_find_compatible_node(NULL, NULL, "arm,armv7-timer"); |
524 | + if (of_device_is_available(arm_timer)) { |
525 | + pr_warn_once("ARM architected timer wrap issue i940 detected\n"); |
526 | + return 0; |
527 | + } |
528 | + |
529 | + for_each_possible_cpu(cpu) { |
530 | + clkevt = per_cpu_ptr(&dmtimer_percpu_timer, cpu); |
531 | + dev = &clkevt->dev; |
532 | + timer = &clkevt->timer; |
533 | + |
534 | + dmtimer_clkevt_init_common(clkevt, 0, "timer_sys_ck", |
535 | + CLOCK_EVT_FEAT_ONESHOT, |
536 | + cpumask_of(cpu), |
537 | + "assigned-clock-parents", |
538 | + 500, "percpu timer"); |
539 | } |
540 | |
541 | - pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, |
542 | - clkev.rate); |
543 | + cpuhp_setup_state(CPUHP_AP_OMAP_DM_TIMER_STARTING, |
544 | + "clockevents/omap/gptimer:starting", |
545 | + omap_gptimer_starting_cpu, NULL); |
546 | + |
547 | + return 0; |
548 | } |
549 | |
550 | /* Clocksource code */ |
551 | @@ -542,7 +605,15 @@ static void __init __omap_sync32k_timer_init(int clkev_nr, const char *clkev_src |
552 | { |
553 | omap_clk_init(); |
554 | omap_dmtimer_init(); |
555 | - omap2_gp_clockevent_init(clkev_nr, clkev_src, clkev_prop); |
556 | + dmtimer_clkevt_init_common(&clockevent, clkev_nr, clkev_src, |
557 | + CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
558 | + cpu_possible_mask, clkev_prop, 300, "clockevent"); |
559 | + clockevents_config_and_register(&clockevent.dev, clockevent.timer.rate, |
560 | + 3, /* Timer internal resynch latency */ |
561 | + 0xffffffff); |
562 | + |
563 | + if (soc_is_dra7xx()) |
564 | + dmtimer_percpu_quirk_init(); |
565 | |
566 | /* Enable the use of clocksource="gp_timer" kernel parameter */ |
567 | if (use_gptimer_clksrc || gptimer) |
568 | @@ -571,7 +642,7 @@ void __init omap3_secure_sync32k_timer_init(void) |
569 | #endif /* CONFIG_ARCH_OMAP3 */ |
570 | |
571 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \ |
572 | - defined(CONFIG_SOC_AM43XX) |
573 | + defined(CONFIG_SOC_AM43XX) || defined(CONFIG_SOC_DRA7XX) |
574 | void __init omap3_gptimer_timer_init(void) |
575 | { |
576 | __omap_sync32k_timer_init(2, "timer_sys_ck", NULL, |
577 | diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h |
578 | index 00eac7f1529b0..9f135e5b9cf51 100644 |
579 | --- a/arch/x86/include/asm/fpu/internal.h |
580 | +++ b/arch/x86/include/asm/fpu/internal.h |
581 | @@ -607,10 +607,17 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) |
582 | * PKRU state is switched eagerly because it needs to be valid before we |
583 | * return to userland e.g. for a copy_to_user() operation. |
584 | */ |
585 | - if (current->mm) { |
586 | + if (!(current->flags & PF_KTHREAD)) { |
587 | + /* |
588 | + * If the PKRU bit in xsave.header.xfeatures is not set, |
589 | + * then the PKRU component was in init state, which means |
590 | + * XRSTOR will set PKRU to 0. If the bit is not set then |
591 | + * get_xsave_addr() will return NULL because the PKRU value |
592 | + * in memory is not valid. This means pkru_val has to be |
593 | + * set to 0 and not to init_pkru_value. |
594 | + */ |
595 | pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); |
596 | - if (pk) |
597 | - pkru_val = pk->pkru; |
598 | + pkru_val = pk ? pk->pkru : 0; |
599 | } |
600 | __write_pkru(pkru_val); |
601 | } |
602 | diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c |
603 | index 400a05e1c1c51..ab2f9c2f0683a 100644 |
604 | --- a/arch/x86/kernel/fpu/signal.c |
605 | +++ b/arch/x86/kernel/fpu/signal.c |
606 | @@ -289,13 +289,17 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
607 | return 0; |
608 | } |
609 | |
610 | - if (!access_ok(buf, size)) |
611 | - return -EACCES; |
612 | + if (!access_ok(buf, size)) { |
613 | + ret = -EACCES; |
614 | + goto out; |
615 | + } |
616 | |
617 | - if (!static_cpu_has(X86_FEATURE_FPU)) |
618 | - return fpregs_soft_set(current, NULL, |
619 | - 0, sizeof(struct user_i387_ia32_struct), |
620 | - NULL, buf) != 0; |
621 | + if (!static_cpu_has(X86_FEATURE_FPU)) { |
622 | + ret = fpregs_soft_set(current, NULL, 0, |
623 | + sizeof(struct user_i387_ia32_struct), |
624 | + NULL, buf); |
625 | + goto out; |
626 | + } |
627 | |
628 | if (use_xsave()) { |
629 | struct _fpx_sw_bytes fx_sw_user; |
630 | @@ -333,7 +337,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
631 | if (ia32_fxstate) { |
632 | ret = __copy_from_user(&env, buf, sizeof(env)); |
633 | if (ret) |
634 | - goto err_out; |
635 | + goto out; |
636 | envp = &env; |
637 | } else { |
638 | /* |
639 | @@ -369,7 +373,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
640 | ret = validate_xstate_header(&fpu->state.xsave.header); |
641 | } |
642 | if (ret) |
643 | - goto err_out; |
644 | + goto out; |
645 | |
646 | sanitize_restored_xstate(&fpu->state, envp, xfeatures, fx_only); |
647 | |
648 | @@ -382,7 +386,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
649 | ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size); |
650 | if (ret) { |
651 | ret = -EFAULT; |
652 | - goto err_out; |
653 | + goto out; |
654 | } |
655 | |
656 | sanitize_restored_xstate(&fpu->state, envp, xfeatures, fx_only); |
657 | @@ -397,7 +401,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
658 | } else { |
659 | ret = __copy_from_user(&fpu->state.fsave, buf_fx, state_size); |
660 | if (ret) |
661 | - goto err_out; |
662 | + goto out; |
663 | |
664 | fpregs_lock(); |
665 | ret = copy_kernel_to_fregs_err(&fpu->state.fsave); |
666 | @@ -408,7 +412,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) |
667 | fpregs_deactivate(fpu); |
668 | fpregs_unlock(); |
669 | |
670 | -err_out: |
671 | +out: |
672 | if (ret) |
673 | fpu__clear(fpu); |
674 | return ret; |
675 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
676 | index 3f6b866c644d5..eea2d6f10f59a 100644 |
677 | --- a/arch/x86/kvm/lapic.c |
678 | +++ b/arch/x86/kvm/lapic.c |
679 | @@ -1332,6 +1332,9 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, |
680 | if (!apic_x2apic_mode(apic)) |
681 | valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI); |
682 | |
683 | + if (alignment + len > 4) |
684 | + return 1; |
685 | + |
686 | if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset))) |
687 | return 1; |
688 | |
689 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
690 | index 79b5d0ca44724..4cc052108f156 100644 |
691 | --- a/arch/x86/kvm/x86.c |
692 | +++ b/arch/x86/kvm/x86.c |
693 | @@ -6279,7 +6279,10 @@ static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt) |
694 | |
695 | static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags) |
696 | { |
697 | - emul_to_vcpu(ctxt)->arch.hflags = emul_flags; |
698 | + struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); |
699 | + |
700 | + vcpu->arch.hflags = emul_flags; |
701 | + kvm_mmu_reset_context(vcpu); |
702 | } |
703 | |
704 | static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt, |
705 | diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c |
706 | index 66e4b2b9ec600..04ed6614ee316 100644 |
707 | --- a/drivers/clk/ti/clk-7xx.c |
708 | +++ b/drivers/clk/ti/clk-7xx.c |
709 | @@ -793,6 +793,7 @@ static struct ti_dt_clk dra7xx_clks[] = { |
710 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), |
711 | DT_CLK(NULL, "sys_clkin_ck", "timer_sys_clk_div"), |
712 | DT_CLK(NULL, "sys_clkin", "sys_clkin1"), |
713 | + DT_CLK(NULL, "timer_sys_ck", "timer_sys_clk_div"), |
714 | DT_CLK(NULL, "atl_dpll_clk_mux", "atl-clkctrl:0000:24"), |
715 | DT_CLK(NULL, "atl_gfclk_mux", "atl-clkctrl:0000:26"), |
716 | DT_CLK(NULL, "dcan1_sys_clk_mux", "wkupaon-clkctrl:0068:24"), |
717 | diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig |
718 | index 7af874b69ffb9..a32d0d7152475 100644 |
719 | --- a/drivers/dma/Kconfig |
720 | +++ b/drivers/dma/Kconfig |
721 | @@ -59,6 +59,7 @@ config DMA_OF |
722 | #devices |
723 | config ALTERA_MSGDMA |
724 | tristate "Altera / Intel mSGDMA Engine" |
725 | + depends on HAS_IOMEM |
726 | select DMA_ENGINE |
727 | help |
728 | Enable support for Altera / Intel mSGDMA controller. |
729 | diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
730 | index 57b6555d6d042..9a94d5b9e0590 100644 |
731 | --- a/drivers/dma/pl330.c |
732 | +++ b/drivers/dma/pl330.c |
733 | @@ -2690,13 +2690,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( |
734 | for (i = 0; i < len / period_len; i++) { |
735 | desc = pl330_get_desc(pch); |
736 | if (!desc) { |
737 | + unsigned long iflags; |
738 | + |
739 | dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", |
740 | __func__, __LINE__); |
741 | |
742 | if (!first) |
743 | return NULL; |
744 | |
745 | - spin_lock_irqsave(&pl330->pool_lock, flags); |
746 | + spin_lock_irqsave(&pl330->pool_lock, iflags); |
747 | |
748 | while (!list_empty(&first->node)) { |
749 | desc = list_entry(first->node.next, |
750 | @@ -2706,7 +2708,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( |
751 | |
752 | list_move_tail(&first->node, &pl330->desc_pool); |
753 | |
754 | - spin_unlock_irqrestore(&pl330->pool_lock, flags); |
755 | + spin_unlock_irqrestore(&pl330->pool_lock, iflags); |
756 | |
757 | return NULL; |
758 | } |
759 | diff --git a/drivers/dma/qcom/Kconfig b/drivers/dma/qcom/Kconfig |
760 | index 1d189438aeb0b..bef309ef6a71b 100644 |
761 | --- a/drivers/dma/qcom/Kconfig |
762 | +++ b/drivers/dma/qcom/Kconfig |
763 | @@ -10,6 +10,7 @@ config QCOM_BAM_DMA |
764 | |
765 | config QCOM_HIDMA_MGMT |
766 | tristate "Qualcomm Technologies HIDMA Management support" |
767 | + depends on HAS_IOMEM |
768 | select DMA_ENGINE |
769 | help |
770 | Enable support for the Qualcomm Technologies HIDMA Management. |
771 | diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c |
772 | index de8bfd9a76e9e..6671bfe084895 100644 |
773 | --- a/drivers/dma/ste_dma40.c |
774 | +++ b/drivers/dma/ste_dma40.c |
775 | @@ -3678,6 +3678,9 @@ static int __init d40_probe(struct platform_device *pdev) |
776 | |
777 | kfree(base->lcla_pool.base_unaligned); |
778 | |
779 | + if (base->lcpa_base) |
780 | + iounmap(base->lcpa_base); |
781 | + |
782 | if (base->phy_lcpa) |
783 | release_mem_region(base->phy_lcpa, |
784 | base->lcpa_size); |
785 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
786 | index 1d8739a4fbcad..9964ec0035ede 100644 |
787 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
788 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
789 | @@ -3416,8 +3416,12 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring) |
790 | if (ring->use_doorbell) { |
791 | WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, |
792 | (adev->doorbell_index.kiq * 2) << 2); |
793 | + /* If GC has entered CGPG, ringing doorbell > first page doesn't |
794 | + * wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround |
795 | + * this issue. |
796 | + */ |
797 | WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER, |
798 | - (adev->doorbell_index.userqueue_end * 2) << 2); |
799 | + (adev->doorbell.size - 4)); |
800 | } |
801 | |
802 | WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL, |
803 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
804 | index 06cdc22b5501d..354da41f52def 100644 |
805 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
806 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
807 | @@ -3593,8 +3593,12 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring) |
808 | if (ring->use_doorbell) { |
809 | WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, |
810 | (adev->doorbell_index.kiq * 2) << 2); |
811 | + /* If GC has entered CGPG, ringing doorbell > first page doesn't |
812 | + * wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround |
813 | + * this issue. |
814 | + */ |
815 | WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER, |
816 | - (adev->doorbell_index.userqueue_end * 2) << 2); |
817 | + (adev->doorbell.size - 4)); |
818 | } |
819 | |
820 | WREG32_SOC15_RLC(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL, |
821 | diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c |
822 | index 1ad5c3b86b640..a18bf70a251e4 100644 |
823 | --- a/drivers/gpu/drm/radeon/radeon_uvd.c |
824 | +++ b/drivers/gpu/drm/radeon/radeon_uvd.c |
825 | @@ -286,7 +286,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) |
826 | if (rdev->uvd.vcpu_bo == NULL) |
827 | return -EINVAL; |
828 | |
829 | - memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); |
830 | + memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); |
831 | |
832 | size = radeon_bo_size(rdev->uvd.vcpu_bo); |
833 | size -= rdev->uvd_fw->size; |
834 | @@ -294,7 +294,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) |
835 | ptr = rdev->uvd.cpu_addr; |
836 | ptr += rdev->uvd_fw->size; |
837 | |
838 | - memset(ptr, 0, size); |
839 | + memset_io((void __iomem *)ptr, 0, size); |
840 | |
841 | return 0; |
842 | } |
843 | diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c |
844 | index 25aac40f2764a..919877970ae3b 100644 |
845 | --- a/drivers/hwmon/scpi-hwmon.c |
846 | +++ b/drivers/hwmon/scpi-hwmon.c |
847 | @@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf) |
848 | |
849 | scpi_scale_reading(&value, sensor); |
850 | |
851 | + /* |
852 | + * Temperature sensor values are treated as signed values based on |
853 | + * observation even though that is not explicitly specified, and |
854 | + * because an unsigned u64 temperature does not really make practical |
855 | + * sense especially when the temperature is below zero degrees Celsius. |
856 | + */ |
857 | + if (sensor->info.class == TEMPERATURE) |
858 | + return sprintf(buf, "%lld\n", (s64)value); |
859 | + |
860 | return sprintf(buf, "%llu\n", value); |
861 | } |
862 | |
863 | diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c |
864 | index 8f785c199e220..c5ed73d45623d 100644 |
865 | --- a/drivers/net/can/usb/mcba_usb.c |
866 | +++ b/drivers/net/can/usb/mcba_usb.c |
867 | @@ -82,6 +82,8 @@ struct mcba_priv { |
868 | bool can_ka_first_pass; |
869 | bool can_speed_check; |
870 | atomic_t free_ctx_cnt; |
871 | + void *rxbuf[MCBA_MAX_RX_URBS]; |
872 | + dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS]; |
873 | }; |
874 | |
875 | /* CAN frame */ |
876 | @@ -633,6 +635,7 @@ static int mcba_usb_start(struct mcba_priv *priv) |
877 | for (i = 0; i < MCBA_MAX_RX_URBS; i++) { |
878 | struct urb *urb = NULL; |
879 | u8 *buf; |
880 | + dma_addr_t buf_dma; |
881 | |
882 | /* create a URB, and a buffer for it */ |
883 | urb = usb_alloc_urb(0, GFP_KERNEL); |
884 | @@ -642,7 +645,7 @@ static int mcba_usb_start(struct mcba_priv *priv) |
885 | } |
886 | |
887 | buf = usb_alloc_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, |
888 | - GFP_KERNEL, &urb->transfer_dma); |
889 | + GFP_KERNEL, &buf_dma); |
890 | if (!buf) { |
891 | netdev_err(netdev, "No memory left for USB buffer\n"); |
892 | usb_free_urb(urb); |
893 | @@ -661,11 +664,14 @@ static int mcba_usb_start(struct mcba_priv *priv) |
894 | if (err) { |
895 | usb_unanchor_urb(urb); |
896 | usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, |
897 | - buf, urb->transfer_dma); |
898 | + buf, buf_dma); |
899 | usb_free_urb(urb); |
900 | break; |
901 | } |
902 | |
903 | + priv->rxbuf[i] = buf; |
904 | + priv->rxbuf_dma[i] = buf_dma; |
905 | + |
906 | /* Drop reference, USB core will take care of freeing it */ |
907 | usb_free_urb(urb); |
908 | } |
909 | @@ -708,7 +714,14 @@ static int mcba_usb_open(struct net_device *netdev) |
910 | |
911 | static void mcba_urb_unlink(struct mcba_priv *priv) |
912 | { |
913 | + int i; |
914 | + |
915 | usb_kill_anchored_urbs(&priv->rx_submitted); |
916 | + |
917 | + for (i = 0; i < MCBA_MAX_RX_URBS; ++i) |
918 | + usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, |
919 | + priv->rxbuf[i], priv->rxbuf_dma[i]); |
920 | + |
921 | usb_kill_anchored_urbs(&priv->tx_submitted); |
922 | } |
923 | |
924 | diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c |
925 | index bde8ec75ac4e9..bee62d7caccc4 100644 |
926 | --- a/drivers/net/ethernet/atheros/alx/main.c |
927 | +++ b/drivers/net/ethernet/atheros/alx/main.c |
928 | @@ -1852,6 +1852,7 @@ out_free_netdev: |
929 | free_netdev(netdev); |
930 | out_pci_release: |
931 | pci_release_mem_regions(pdev); |
932 | + pci_disable_pcie_error_reporting(pdev); |
933 | out_pci_disable: |
934 | pci_disable_device(pdev); |
935 | return err; |
936 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
937 | index 00ae7a9a42bfe..d1c3939b0307f 100644 |
938 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
939 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
940 | @@ -10610,6 +10610,8 @@ static void bnxt_fw_init_one_p3(struct bnxt *bp) |
941 | bnxt_hwrm_coal_params_qcaps(bp); |
942 | } |
943 | |
944 | +static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt); |
945 | + |
946 | static int bnxt_fw_init_one(struct bnxt *bp) |
947 | { |
948 | int rc; |
949 | @@ -10624,6 +10626,9 @@ static int bnxt_fw_init_one(struct bnxt *bp) |
950 | netdev_err(bp->dev, "Firmware init phase 2 failed\n"); |
951 | return rc; |
952 | } |
953 | + rc = bnxt_probe_phy(bp, false); |
954 | + if (rc) |
955 | + return rc; |
956 | rc = bnxt_approve_mac(bp, bp->dev->dev_addr, false); |
957 | if (rc) |
958 | return rc; |
959 | @@ -11958,6 +11963,7 @@ init_err_cleanup: |
960 | init_err_pci_clean: |
961 | bnxt_free_hwrm_short_cmd_req(bp); |
962 | bnxt_free_hwrm_resources(bp); |
963 | + bnxt_ethtool_free(bp); |
964 | kfree(bp->fw_health); |
965 | bp->fw_health = NULL; |
966 | bnxt_cleanup_pci(bp); |
967 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
968 | index ccb28182f745b..44f86a33ef624 100644 |
969 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
970 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
971 | @@ -198,7 +198,7 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f, |
972 | WORD_MASK, f->fs.nat_lip[3] | |
973 | f->fs.nat_lip[2] << 8 | |
974 | f->fs.nat_lip[1] << 16 | |
975 | - (u64)f->fs.nat_lip[0] << 25, 1); |
976 | + (u64)f->fs.nat_lip[0] << 24, 1); |
977 | } |
978 | } |
979 | |
980 | diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c |
981 | index 46b0dbab8aadc..7c992172933bc 100644 |
982 | --- a/drivers/net/ethernet/ec_bhf.c |
983 | +++ b/drivers/net/ethernet/ec_bhf.c |
984 | @@ -576,10 +576,12 @@ static void ec_bhf_remove(struct pci_dev *dev) |
985 | struct ec_bhf_priv *priv = netdev_priv(net_dev); |
986 | |
987 | unregister_netdev(net_dev); |
988 | - free_netdev(net_dev); |
989 | |
990 | pci_iounmap(dev, priv->dma_io); |
991 | pci_iounmap(dev, priv->io); |
992 | + |
993 | + free_netdev(net_dev); |
994 | + |
995 | pci_release_regions(dev); |
996 | pci_clear_master(dev); |
997 | pci_disable_device(dev); |
998 | diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c |
999 | index 39eb7d525043d..9aebb121365f5 100644 |
1000 | --- a/drivers/net/ethernet/emulex/benet/be_main.c |
1001 | +++ b/drivers/net/ethernet/emulex/benet/be_main.c |
1002 | @@ -6030,6 +6030,7 @@ drv_cleanup: |
1003 | unmap_bars: |
1004 | be_unmap_pci_bars(adapter); |
1005 | free_netdev: |
1006 | + pci_disable_pcie_error_reporting(pdev); |
1007 | free_netdev(netdev); |
1008 | rel_reg: |
1009 | pci_release_regions(pdev); |
1010 | diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c |
1011 | index 49fad118988bc..3b54a37e780eb 100644 |
1012 | --- a/drivers/net/ethernet/freescale/fec_ptp.c |
1013 | +++ b/drivers/net/ethernet/freescale/fec_ptp.c |
1014 | @@ -220,15 +220,13 @@ static u64 fec_ptp_read(const struct cyclecounter *cc) |
1015 | { |
1016 | struct fec_enet_private *fep = |
1017 | container_of(cc, struct fec_enet_private, cc); |
1018 | - const struct platform_device_id *id_entry = |
1019 | - platform_get_device_id(fep->pdev); |
1020 | u32 tempval; |
1021 | |
1022 | tempval = readl(fep->hwp + FEC_ATIME_CTRL); |
1023 | tempval |= FEC_T_CTRL_CAPTURE; |
1024 | writel(tempval, fep->hwp + FEC_ATIME_CTRL); |
1025 | |
1026 | - if (id_entry->driver_data & FEC_QUIRK_BUG_CAPTURE) |
1027 | + if (fep->quirks & FEC_QUIRK_BUG_CAPTURE) |
1028 | udelay(1); |
1029 | |
1030 | return readl(fep->hwp + FEC_ATIME); |
1031 | @@ -599,6 +597,10 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) |
1032 | fep->ptp_caps.enable = fec_ptp_enable; |
1033 | |
1034 | fep->cycle_speed = clk_get_rate(fep->clk_ptp); |
1035 | + if (!fep->cycle_speed) { |
1036 | + fep->cycle_speed = NSEC_PER_SEC; |
1037 | + dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n"); |
1038 | + } |
1039 | fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed; |
1040 | |
1041 | spin_lock_init(&fep->tmreg_lock); |
1042 | diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c |
1043 | index 6ece99e6b6dde..6e504854571cf 100644 |
1044 | --- a/drivers/net/ethernet/lantiq_xrx200.c |
1045 | +++ b/drivers/net/ethernet/lantiq_xrx200.c |
1046 | @@ -154,6 +154,7 @@ static int xrx200_close(struct net_device *net_dev) |
1047 | |
1048 | static int xrx200_alloc_skb(struct xrx200_chan *ch) |
1049 | { |
1050 | + struct sk_buff *skb = ch->skb[ch->dma.desc]; |
1051 | dma_addr_t mapping; |
1052 | int ret = 0; |
1053 | |
1054 | @@ -168,6 +169,7 @@ static int xrx200_alloc_skb(struct xrx200_chan *ch) |
1055 | XRX200_DMA_DATA_LEN, DMA_FROM_DEVICE); |
1056 | if (unlikely(dma_mapping_error(ch->priv->dev, mapping))) { |
1057 | dev_kfree_skb_any(ch->skb[ch->dma.desc]); |
1058 | + ch->skb[ch->dma.desc] = skb; |
1059 | ret = -ENOMEM; |
1060 | goto skip; |
1061 | } |
1062 | @@ -198,7 +200,6 @@ static int xrx200_hw_receive(struct xrx200_chan *ch) |
1063 | ch->dma.desc %= LTQ_DESC_NUM; |
1064 | |
1065 | if (ret) { |
1066 | - ch->skb[ch->dma.desc] = skb; |
1067 | net_dev->stats.rx_dropped++; |
1068 | netdev_err(net_dev, "failed to allocate new rx buffer\n"); |
1069 | return ret; |
1070 | @@ -351,8 +352,8 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) |
1071 | struct xrx200_chan *ch = ptr; |
1072 | |
1073 | if (napi_schedule_prep(&ch->napi)) { |
1074 | - __napi_schedule(&ch->napi); |
1075 | ltq_dma_disable_irq(&ch->dma); |
1076 | + __napi_schedule(&ch->napi); |
1077 | } |
1078 | |
1079 | ltq_dma_ack_irq(&ch->dma); |
1080 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c |
1081 | index cf58c96379047..c467f5e981f61 100644 |
1082 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c |
1083 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c |
1084 | @@ -515,9 +515,6 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) |
1085 | struct mlx5_core_dev *mdev = priv->mdev; |
1086 | struct net_device *netdev = priv->netdev; |
1087 | |
1088 | - if (!priv->ipsec) |
1089 | - return; |
1090 | - |
1091 | if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_ESP) || |
1092 | !MLX5_CAP_ETH(mdev, swp)) { |
1093 | mlx5_core_dbg(mdev, "mlx5e: ESP and SWP offload not supported\n"); |
1094 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1095 | index 36b9a364ef26b..24c49a84947f3 100644 |
1096 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1097 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1098 | @@ -5007,11 +5007,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) |
1099 | } |
1100 | |
1101 | if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { |
1102 | - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | |
1103 | - NETIF_F_GSO_UDP_TUNNEL_CSUM; |
1104 | - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | |
1105 | - NETIF_F_GSO_UDP_TUNNEL_CSUM; |
1106 | - netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; |
1107 | + netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; |
1108 | + netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; |
1109 | + netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; |
1110 | } |
1111 | |
1112 | if (mlx5e_tunnel_proto_supported(mdev, IPPROTO_GRE)) { |
1113 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1114 | index fe7342e8a043b..9d26463f3fa5d 100644 |
1115 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1116 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1117 | @@ -4079,7 +4079,7 @@ static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv, |
1118 | list_for_each_entry_safe(hpe, tmp, &init_wait_list, dead_peer_wait_list) { |
1119 | wait_for_completion(&hpe->res_ready); |
1120 | if (!IS_ERR_OR_NULL(hpe->hp) && hpe->peer_vhca_id == peer_vhca_id) |
1121 | - hpe->hp->pair->peer_gone = true; |
1122 | + mlx5_core_hairpin_clear_dead_peer(hpe->hp->pair); |
1123 | |
1124 | mlx5e_hairpin_put(priv, hpe); |
1125 | } |
1126 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c |
1127 | index 8e0dddc6383f0..2389239acadc9 100644 |
1128 | --- a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c |
1129 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c |
1130 | @@ -156,6 +156,9 @@ void mlx5_rdma_enable_roce(struct mlx5_core_dev *dev) |
1131 | { |
1132 | int err; |
1133 | |
1134 | + if (!MLX5_CAP_GEN(dev, roce)) |
1135 | + return; |
1136 | + |
1137 | err = mlx5_nic_vport_enable_roce(dev); |
1138 | if (err) { |
1139 | mlx5_core_err(dev, "Failed to enable RoCE: %d\n", err); |
1140 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1141 | index b1068500f1df5..0b5437051a3b2 100644 |
1142 | --- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1143 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1144 | @@ -457,6 +457,15 @@ err_modify_sq: |
1145 | return err; |
1146 | } |
1147 | |
1148 | +static void mlx5_hairpin_unpair_peer_sq(struct mlx5_hairpin *hp) |
1149 | +{ |
1150 | + int i; |
1151 | + |
1152 | + for (i = 0; i < hp->num_channels; i++) |
1153 | + mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, |
1154 | + MLX5_SQC_STATE_RST, 0, 0); |
1155 | +} |
1156 | + |
1157 | static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) |
1158 | { |
1159 | int i; |
1160 | @@ -465,13 +474,9 @@ static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) |
1161 | for (i = 0; i < hp->num_channels; i++) |
1162 | mlx5_hairpin_modify_rq(hp->func_mdev, hp->rqn[i], MLX5_RQC_STATE_RDY, |
1163 | MLX5_RQC_STATE_RST, 0, 0); |
1164 | - |
1165 | /* unset peer SQs */ |
1166 | - if (hp->peer_gone) |
1167 | - return; |
1168 | - for (i = 0; i < hp->num_channels; i++) |
1169 | - mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, |
1170 | - MLX5_SQC_STATE_RST, 0, 0); |
1171 | + if (!hp->peer_gone) |
1172 | + mlx5_hairpin_unpair_peer_sq(hp); |
1173 | } |
1174 | |
1175 | struct mlx5_hairpin * |
1176 | @@ -518,3 +523,16 @@ void mlx5_core_hairpin_destroy(struct mlx5_hairpin *hp) |
1177 | mlx5_hairpin_destroy_queues(hp); |
1178 | kfree(hp); |
1179 | } |
1180 | + |
1181 | +void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp) |
1182 | +{ |
1183 | + int i; |
1184 | + |
1185 | + mlx5_hairpin_unpair_peer_sq(hp); |
1186 | + |
1187 | + /* destroy peer SQ */ |
1188 | + for (i = 0; i < hp->num_channels; i++) |
1189 | + mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]); |
1190 | + |
1191 | + hp->peer_gone = true; |
1192 | +} |
1193 | diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |
1194 | index 25b6f2ee2beb8..1b9867ea43336 100644 |
1195 | --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |
1196 | +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |
1197 | @@ -1602,6 +1602,8 @@ err_out_free_netdev: |
1198 | free_netdev(netdev); |
1199 | |
1200 | err_out_free_res: |
1201 | + if (NX_IS_REVISION_P3(pdev->revision)) |
1202 | + pci_disable_pcie_error_reporting(pdev); |
1203 | pci_release_regions(pdev); |
1204 | |
1205 | err_out_disable_pdev: |
1206 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
1207 | index f2e5f494462b3..3a96fd6deef72 100644 |
1208 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
1209 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
1210 | @@ -2709,6 +2709,7 @@ err_out_free_hw_res: |
1211 | kfree(ahw); |
1212 | |
1213 | err_out_free_res: |
1214 | + pci_disable_pcie_error_reporting(pdev); |
1215 | pci_release_regions(pdev); |
1216 | |
1217 | err_out_disable_pdev: |
1218 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h |
1219 | index b70d44ac09906..3c73453725f94 100644 |
1220 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h |
1221 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h |
1222 | @@ -76,10 +76,10 @@ enum power_event { |
1223 | #define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */ |
1224 | |
1225 | /* GMAC HW ADDR regs */ |
1226 | -#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \ |
1227 | - (reg * 8)) |
1228 | -#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \ |
1229 | - (reg * 8)) |
1230 | +#define GMAC_ADDR_HIGH(reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \ |
1231 | + 0x00000040 + (reg * 8)) |
1232 | +#define GMAC_ADDR_LOW(reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \ |
1233 | + 0x00000044 + (reg * 8)) |
1234 | #define GMAC_MAX_PERFECT_ADDRESSES 1 |
1235 | |
1236 | #define GMAC_PCS_BASE 0x000000c0 /* PCS register base */ |
1237 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
1238 | index 508325cc105d5..678aa2b001e01 100644 |
1239 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
1240 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
1241 | @@ -624,6 +624,8 @@ error_pclk_get: |
1242 | void stmmac_remove_config_dt(struct platform_device *pdev, |
1243 | struct plat_stmmacenet_data *plat) |
1244 | { |
1245 | + clk_disable_unprepare(plat->stmmac_clk); |
1246 | + clk_disable_unprepare(plat->pclk); |
1247 | of_node_put(plat->phy_node); |
1248 | of_node_put(plat->mdio_node); |
1249 | } |
1250 | diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1251 | index 5b8451c58aa4c..9b55fbdc3a7c6 100644 |
1252 | --- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
1253 | +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1254 | @@ -846,7 +846,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1255 | smp_mb(); |
1256 | |
1257 | /* Space might have just been freed - check again */ |
1258 | - if (temac_check_tx_bd_space(lp, num_frag)) |
1259 | + if (temac_check_tx_bd_space(lp, num_frag + 1)) |
1260 | return NETDEV_TX_BUSY; |
1261 | |
1262 | netif_wake_queue(ndev); |
1263 | @@ -873,7 +873,6 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1264 | return NETDEV_TX_OK; |
1265 | } |
1266 | cur_p->phys = cpu_to_be32(skb_dma_addr); |
1267 | - ptr_to_txbd((void *)skb, cur_p); |
1268 | |
1269 | for (ii = 0; ii < num_frag; ii++) { |
1270 | if (++lp->tx_bd_tail >= TX_BD_NUM) |
1271 | @@ -912,6 +911,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1272 | } |
1273 | cur_p->app0 |= cpu_to_be32(STS_CTRL_APP0_EOP); |
1274 | |
1275 | + /* Mark last fragment with skb address, so it can be consumed |
1276 | + * in temac_start_xmit_done() |
1277 | + */ |
1278 | + ptr_to_txbd((void *)skb, cur_p); |
1279 | + |
1280 | tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; |
1281 | lp->tx_bd_tail++; |
1282 | if (lp->tx_bd_tail >= TX_BD_NUM) |
1283 | diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c |
1284 | index deef142151104..352f9e75954ce 100644 |
1285 | --- a/drivers/net/hamradio/mkiss.c |
1286 | +++ b/drivers/net/hamradio/mkiss.c |
1287 | @@ -800,6 +800,7 @@ static void mkiss_close(struct tty_struct *tty) |
1288 | ax->tty = NULL; |
1289 | |
1290 | unregister_netdev(ax->dev); |
1291 | + free_netdev(ax->dev); |
1292 | } |
1293 | |
1294 | /* Perform I/O control on an active ax25 channel. */ |
1295 | diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c |
1296 | index 0eeec80bec311..e4a5703666461 100644 |
1297 | --- a/drivers/net/usb/cdc_eem.c |
1298 | +++ b/drivers/net/usb/cdc_eem.c |
1299 | @@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, |
1300 | } |
1301 | |
1302 | skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags); |
1303 | + dev_kfree_skb_any(skb); |
1304 | if (!skb2) |
1305 | return NULL; |
1306 | |
1307 | - dev_kfree_skb_any(skb); |
1308 | skb = skb2; |
1309 | |
1310 | done: |
1311 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
1312 | index 0646bcd269682..4cff0a6b1098a 100644 |
1313 | --- a/drivers/net/usb/cdc_ncm.c |
1314 | +++ b/drivers/net/usb/cdc_ncm.c |
1315 | @@ -1662,7 +1662,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) |
1316 | static const struct driver_info cdc_ncm_info = { |
1317 | .description = "CDC NCM", |
1318 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET |
1319 | - | FLAG_LINK_INTR, |
1320 | + | FLAG_LINK_INTR | FLAG_ETHER, |
1321 | .bind = cdc_ncm_bind, |
1322 | .unbind = cdc_ncm_unbind, |
1323 | .manage_power = usbnet_manage_power, |
1324 | diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c |
1325 | index d0ae0df34e132..aa848be459ec7 100644 |
1326 | --- a/drivers/net/usb/smsc75xx.c |
1327 | +++ b/drivers/net/usb/smsc75xx.c |
1328 | @@ -1482,7 +1482,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) |
1329 | ret = smsc75xx_wait_ready(dev, 0); |
1330 | if (ret < 0) { |
1331 | netdev_warn(dev->net, "device not ready in smsc75xx_bind\n"); |
1332 | - goto err; |
1333 | + goto free_pdata; |
1334 | } |
1335 | |
1336 | smsc75xx_init_mac_address(dev); |
1337 | @@ -1491,7 +1491,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) |
1338 | ret = smsc75xx_reset(dev); |
1339 | if (ret < 0) { |
1340 | netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret); |
1341 | - goto err; |
1342 | + goto cancel_work; |
1343 | } |
1344 | |
1345 | dev->net->netdev_ops = &smsc75xx_netdev_ops; |
1346 | @@ -1502,8 +1502,11 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) |
1347 | dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE; |
1348 | return 0; |
1349 | |
1350 | -err: |
1351 | +cancel_work: |
1352 | + cancel_work_sync(&pdata->set_multicast); |
1353 | +free_pdata: |
1354 | kfree(pdata); |
1355 | + dev->data[0] = 0; |
1356 | return ret; |
1357 | } |
1358 | |
1359 | @@ -1514,7 +1517,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) |
1360 | cancel_work_sync(&pdata->set_multicast); |
1361 | netif_dbg(dev, ifdown, dev->net, "free pdata\n"); |
1362 | kfree(pdata); |
1363 | - pdata = NULL; |
1364 | dev->data[0] = 0; |
1365 | } |
1366 | } |
1367 | diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c |
1368 | index 14dfb92783456..1267786d2931b 100644 |
1369 | --- a/drivers/net/vrf.c |
1370 | +++ b/drivers/net/vrf.c |
1371 | @@ -908,9 +908,6 @@ static int vrf_dev_init(struct net_device *dev) |
1372 | |
1373 | dev->flags = IFF_MASTER | IFF_NOARP; |
1374 | |
1375 | - /* MTU is irrelevant for VRF device; set to 64k similar to lo */ |
1376 | - dev->mtu = 64 * 1024; |
1377 | - |
1378 | /* similarly, oper state is irrelevant; set to up to avoid confusion */ |
1379 | dev->operstate = IF_OPER_UP; |
1380 | return 0; |
1381 | @@ -1343,7 +1340,8 @@ static void vrf_setup(struct net_device *dev) |
1382 | * which breaks networking. |
1383 | */ |
1384 | dev->min_mtu = IPV6_MIN_MTU; |
1385 | - dev->max_mtu = ETH_MAX_MTU; |
1386 | + dev->max_mtu = IP6_MAX_MTU; |
1387 | + dev->mtu = dev->max_mtu; |
1388 | } |
1389 | |
1390 | static int vrf_validate(struct nlattr *tb[], struct nlattr *data[], |
1391 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
1392 | index d0e60441dc8f2..89cc6980b5964 100644 |
1393 | --- a/drivers/pci/controller/pci-aardvark.c |
1394 | +++ b/drivers/pci/controller/pci-aardvark.c |
1395 | @@ -175,7 +175,8 @@ |
1396 | (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ |
1397 | PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) |
1398 | |
1399 | -#define PIO_TIMEOUT_MS 1 |
1400 | +#define PIO_RETRY_CNT 500 |
1401 | +#define PIO_RETRY_DELAY 2 /* 2 us*/ |
1402 | |
1403 | #define LINK_WAIT_MAX_RETRIES 10 |
1404 | #define LINK_WAIT_USLEEP_MIN 90000 |
1405 | @@ -392,20 +393,19 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) |
1406 | static int advk_pcie_wait_pio(struct advk_pcie *pcie) |
1407 | { |
1408 | struct device *dev = &pcie->pdev->dev; |
1409 | - unsigned long timeout; |
1410 | + int i; |
1411 | |
1412 | - timeout = jiffies + msecs_to_jiffies(PIO_TIMEOUT_MS); |
1413 | - |
1414 | - while (time_before(jiffies, timeout)) { |
1415 | + for (i = 0; i < PIO_RETRY_CNT; i++) { |
1416 | u32 start, isr; |
1417 | |
1418 | start = advk_readl(pcie, PIO_START); |
1419 | isr = advk_readl(pcie, PIO_ISR); |
1420 | if (!start && isr) |
1421 | return 0; |
1422 | + udelay(PIO_RETRY_DELAY); |
1423 | } |
1424 | |
1425 | - dev_err(dev, "config read/write timed out\n"); |
1426 | + dev_err(dev, "PIO read/write transfer time out\n"); |
1427 | return -ETIMEDOUT; |
1428 | } |
1429 | |
1430 | @@ -539,6 +539,35 @@ static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus, |
1431 | return true; |
1432 | } |
1433 | |
1434 | +static bool advk_pcie_pio_is_running(struct advk_pcie *pcie) |
1435 | +{ |
1436 | + struct device *dev = &pcie->pdev->dev; |
1437 | + |
1438 | + /* |
1439 | + * Trying to start a new PIO transfer when previous has not completed |
1440 | + * cause External Abort on CPU which results in kernel panic: |
1441 | + * |
1442 | + * SError Interrupt on CPU0, code 0xbf000002 -- SError |
1443 | + * Kernel panic - not syncing: Asynchronous SError Interrupt |
1444 | + * |
1445 | + * Functions advk_pcie_rd_conf() and advk_pcie_wr_conf() are protected |
1446 | + * by raw_spin_lock_irqsave() at pci_lock_config() level to prevent |
1447 | + * concurrent calls at the same time. But because PIO transfer may take |
1448 | + * about 1.5s when link is down or card is disconnected, it means that |
1449 | + * advk_pcie_wait_pio() does not always have to wait for completion. |
1450 | + * |
1451 | + * Some versions of ARM Trusted Firmware handles this External Abort at |
1452 | + * EL3 level and mask it to prevent kernel panic. Relevant TF-A commit: |
1453 | + * https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50 |
1454 | + */ |
1455 | + if (advk_readl(pcie, PIO_START)) { |
1456 | + dev_err(dev, "Previous PIO read/write transfer is still running\n"); |
1457 | + return true; |
1458 | + } |
1459 | + |
1460 | + return false; |
1461 | +} |
1462 | + |
1463 | static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, |
1464 | int where, int size, u32 *val) |
1465 | { |
1466 | @@ -555,9 +584,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, |
1467 | return pci_bridge_emul_conf_read(&pcie->bridge, where, |
1468 | size, val); |
1469 | |
1470 | - /* Start PIO */ |
1471 | - advk_writel(pcie, 0, PIO_START); |
1472 | - advk_writel(pcie, 1, PIO_ISR); |
1473 | + if (advk_pcie_pio_is_running(pcie)) { |
1474 | + *val = 0xffffffff; |
1475 | + return PCIBIOS_SET_FAILED; |
1476 | + } |
1477 | |
1478 | /* Program the control register */ |
1479 | reg = advk_readl(pcie, PIO_CTRL); |
1480 | @@ -576,7 +606,8 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, |
1481 | /* Program the data strobe */ |
1482 | advk_writel(pcie, 0xf, PIO_WR_DATA_STRB); |
1483 | |
1484 | - /* Start the transfer */ |
1485 | + /* Clear PIO DONE ISR and start the transfer */ |
1486 | + advk_writel(pcie, 1, PIO_ISR); |
1487 | advk_writel(pcie, 1, PIO_START); |
1488 | |
1489 | ret = advk_pcie_wait_pio(pcie); |
1490 | @@ -614,9 +645,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, |
1491 | if (where % size) |
1492 | return PCIBIOS_SET_FAILED; |
1493 | |
1494 | - /* Start PIO */ |
1495 | - advk_writel(pcie, 0, PIO_START); |
1496 | - advk_writel(pcie, 1, PIO_ISR); |
1497 | + if (advk_pcie_pio_is_running(pcie)) |
1498 | + return PCIBIOS_SET_FAILED; |
1499 | |
1500 | /* Program the control register */ |
1501 | reg = advk_readl(pcie, PIO_CTRL); |
1502 | @@ -643,7 +673,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, |
1503 | /* Program the data strobe */ |
1504 | advk_writel(pcie, data_strobe, PIO_WR_DATA_STRB); |
1505 | |
1506 | - /* Start the transfer */ |
1507 | + /* Clear PIO DONE ISR and start the transfer */ |
1508 | + advk_writel(pcie, 1, PIO_ISR); |
1509 | advk_writel(pcie, 1, PIO_START); |
1510 | |
1511 | ret = advk_pcie_wait_pio(pcie); |
1512 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1513 | index 53376bcda1f3f..cd0b13ddd000d 100644 |
1514 | --- a/drivers/pci/quirks.c |
1515 | +++ b/drivers/pci/quirks.c |
1516 | @@ -3557,6 +3557,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev) |
1517 | dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; |
1518 | } |
1519 | |
1520 | +/* |
1521 | + * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be |
1522 | + * prevented for those affected devices. |
1523 | + */ |
1524 | +static void quirk_nvidia_no_bus_reset(struct pci_dev *dev) |
1525 | +{ |
1526 | + if ((dev->device & 0xffc0) == 0x2340) |
1527 | + quirk_no_bus_reset(dev); |
1528 | +} |
1529 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, |
1530 | + quirk_nvidia_no_bus_reset); |
1531 | + |
1532 | /* |
1533 | * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. |
1534 | * The device will throw a Link Down error on AER-capable systems and |
1535 | @@ -3577,6 +3589,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); |
1536 | */ |
1537 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CAVIUM, 0xa100, quirk_no_bus_reset); |
1538 | |
1539 | +/* |
1540 | + * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS |
1541 | + * automatically disables LTSSM when Secondary Bus Reset is received and |
1542 | + * the device stops working. Prevent bus reset for these devices. With |
1543 | + * this change, the device can be assigned to VMs with VFIO, but it will |
1544 | + * leak state between VMs. Reference |
1545 | + * https://e2e.ti.com/support/processors/f/791/t/954382 |
1546 | + */ |
1547 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset); |
1548 | + |
1549 | static void quirk_no_pm_reset(struct pci_dev *dev) |
1550 | { |
1551 | /* |
1552 | @@ -3969,6 +3991,69 @@ static int delay_250ms_after_flr(struct pci_dev *dev, int probe) |
1553 | return 0; |
1554 | } |
1555 | |
1556 | +#define PCI_DEVICE_ID_HINIC_VF 0x375E |
1557 | +#define HINIC_VF_FLR_TYPE 0x1000 |
1558 | +#define HINIC_VF_FLR_CAP_BIT (1UL << 30) |
1559 | +#define HINIC_VF_OP 0xE80 |
1560 | +#define HINIC_VF_FLR_PROC_BIT (1UL << 18) |
1561 | +#define HINIC_OPERATION_TIMEOUT 15000 /* 15 seconds */ |
1562 | + |
1563 | +/* Device-specific reset method for Huawei Intelligent NIC virtual functions */ |
1564 | +static int reset_hinic_vf_dev(struct pci_dev *pdev, int probe) |
1565 | +{ |
1566 | + unsigned long timeout; |
1567 | + void __iomem *bar; |
1568 | + u32 val; |
1569 | + |
1570 | + if (probe) |
1571 | + return 0; |
1572 | + |
1573 | + bar = pci_iomap(pdev, 0, 0); |
1574 | + if (!bar) |
1575 | + return -ENOTTY; |
1576 | + |
1577 | + /* Get and check firmware capabilities */ |
1578 | + val = ioread32be(bar + HINIC_VF_FLR_TYPE); |
1579 | + if (!(val & HINIC_VF_FLR_CAP_BIT)) { |
1580 | + pci_iounmap(pdev, bar); |
1581 | + return -ENOTTY; |
1582 | + } |
1583 | + |
1584 | + /* Set HINIC_VF_FLR_PROC_BIT for the start of FLR */ |
1585 | + val = ioread32be(bar + HINIC_VF_OP); |
1586 | + val = val | HINIC_VF_FLR_PROC_BIT; |
1587 | + iowrite32be(val, bar + HINIC_VF_OP); |
1588 | + |
1589 | + pcie_flr(pdev); |
1590 | + |
1591 | + /* |
1592 | + * The device must recapture its Bus and Device Numbers after FLR |
1593 | + * in order generate Completions. Issue a config write to let the |
1594 | + * device capture this information. |
1595 | + */ |
1596 | + pci_write_config_word(pdev, PCI_VENDOR_ID, 0); |
1597 | + |
1598 | + /* Firmware clears HINIC_VF_FLR_PROC_BIT when reset is complete */ |
1599 | + timeout = jiffies + msecs_to_jiffies(HINIC_OPERATION_TIMEOUT); |
1600 | + do { |
1601 | + val = ioread32be(bar + HINIC_VF_OP); |
1602 | + if (!(val & HINIC_VF_FLR_PROC_BIT)) |
1603 | + goto reset_complete; |
1604 | + msleep(20); |
1605 | + } while (time_before(jiffies, timeout)); |
1606 | + |
1607 | + val = ioread32be(bar + HINIC_VF_OP); |
1608 | + if (!(val & HINIC_VF_FLR_PROC_BIT)) |
1609 | + goto reset_complete; |
1610 | + |
1611 | + pci_warn(pdev, "Reset dev timeout, FLR ack reg: %#010x\n", val); |
1612 | + |
1613 | +reset_complete: |
1614 | + pci_iounmap(pdev, bar); |
1615 | + |
1616 | + return 0; |
1617 | +} |
1618 | + |
1619 | static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { |
1620 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, |
1621 | reset_intel_82599_sfp_virtfn }, |
1622 | @@ -3980,6 +4065,8 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { |
1623 | { PCI_VENDOR_ID_INTEL, 0x0953, delay_250ms_after_flr }, |
1624 | { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, |
1625 | reset_chelsio_generic_dev }, |
1626 | + { PCI_VENDOR_ID_HUAWEI, PCI_DEVICE_ID_HINIC_VF, |
1627 | + reset_hinic_vf_dev }, |
1628 | { 0 } |
1629 | }; |
1630 | |
1631 | @@ -4821,6 +4908,8 @@ static const struct pci_dev_acs_enabled { |
1632 | { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs }, |
1633 | { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs }, |
1634 | { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, |
1635 | + /* Broadcom multi-function device */ |
1636 | + { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, |
1637 | { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, |
1638 | /* Amazon Annapurna Labs */ |
1639 | { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, |
1640 | diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c |
1641 | index b84f16bbd6f24..eedf067ee8e35 100644 |
1642 | --- a/drivers/ptp/ptp_clock.c |
1643 | +++ b/drivers/ptp/ptp_clock.c |
1644 | @@ -63,7 +63,7 @@ static void enqueue_external_timestamp(struct timestamp_event_queue *queue, |
1645 | spin_unlock_irqrestore(&queue->lock, flags); |
1646 | } |
1647 | |
1648 | -s32 scaled_ppm_to_ppb(long ppm) |
1649 | +long scaled_ppm_to_ppb(long ppm) |
1650 | { |
1651 | /* |
1652 | * The 'freq' field in the 'struct timex' is in parts per |
1653 | @@ -80,7 +80,7 @@ s32 scaled_ppm_to_ppb(long ppm) |
1654 | s64 ppb = 1 + ppm; |
1655 | ppb *= 125; |
1656 | ppb >>= 13; |
1657 | - return (s32) ppb; |
1658 | + return (long) ppb; |
1659 | } |
1660 | EXPORT_SYMBOL(scaled_ppm_to_ppb); |
1661 | |
1662 | @@ -138,7 +138,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) |
1663 | delta = ktime_to_ns(kt); |
1664 | err = ops->adjtime(ops, delta); |
1665 | } else if (tx->modes & ADJ_FREQUENCY) { |
1666 | - s32 ppb = scaled_ppm_to_ppb(tx->freq); |
1667 | + long ppb = scaled_ppm_to_ppb(tx->freq); |
1668 | if (ppb > ops->max_adj || ppb < -ops->max_adj) |
1669 | return -ERANGE; |
1670 | if (ops->adjfine) |
1671 | diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c |
1672 | index 4e726929bb4f5..ea77d915216a2 100644 |
1673 | --- a/drivers/spi/spi-stm32-qspi.c |
1674 | +++ b/drivers/spi/spi-stm32-qspi.c |
1675 | @@ -291,7 +291,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, |
1676 | int err = 0; |
1677 | |
1678 | if (!op->data.nbytes) |
1679 | - return stm32_qspi_wait_nobusy(qspi); |
1680 | + goto wait_nobusy; |
1681 | |
1682 | if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) |
1683 | goto out; |
1684 | @@ -312,6 +312,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, |
1685 | out: |
1686 | /* clear flags */ |
1687 | writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR); |
1688 | +wait_nobusy: |
1689 | + if (!err) |
1690 | + err = stm32_qspi_wait_nobusy(qspi); |
1691 | |
1692 | return err; |
1693 | } |
1694 | diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1695 | index d0f06790d38f8..0ba4e4e070a9f 100644 |
1696 | --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1697 | +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1698 | @@ -127,7 +127,7 @@ static int rt2880_pmx_group_enable(struct pinctrl_dev *pctrldev, |
1699 | if (p->groups[group].enabled) { |
1700 | dev_err(p->dev, "%s is already enabled\n", |
1701 | p->groups[group].name); |
1702 | - return -EBUSY; |
1703 | + return 0; |
1704 | } |
1705 | |
1706 | p->groups[group].enabled = 1; |
1707 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
1708 | index 6c89d714adb62..3a2d9318604bb 100644 |
1709 | --- a/drivers/usb/core/hub.c |
1710 | +++ b/drivers/usb/core/hub.c |
1711 | @@ -39,6 +39,8 @@ |
1712 | #define USB_VENDOR_GENESYS_LOGIC 0x05e3 |
1713 | #define USB_VENDOR_SMSC 0x0424 |
1714 | #define USB_PRODUCT_USB5534B 0x5534 |
1715 | +#define USB_VENDOR_CYPRESS 0x04b4 |
1716 | +#define USB_PRODUCT_CY7C65632 0x6570 |
1717 | #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 |
1718 | #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 |
1719 | |
1720 | @@ -5514,6 +5516,11 @@ static const struct usb_device_id hub_id_table[] = { |
1721 | .idProduct = USB_PRODUCT_USB5534B, |
1722 | .bInterfaceClass = USB_CLASS_HUB, |
1723 | .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, |
1724 | + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
1725 | + | USB_DEVICE_ID_MATCH_PRODUCT, |
1726 | + .idVendor = USB_VENDOR_CYPRESS, |
1727 | + .idProduct = USB_PRODUCT_CY7C65632, |
1728 | + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, |
1729 | { .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
1730 | | USB_DEVICE_ID_MATCH_INT_CLASS, |
1731 | .idVendor = USB_VENDOR_GENESYS_LOGIC, |
1732 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
1733 | index 90ec65d31059f..b9d4fc636b329 100644 |
1734 | --- a/drivers/usb/dwc3/core.c |
1735 | +++ b/drivers/usb/dwc3/core.c |
1736 | @@ -1575,8 +1575,8 @@ static int dwc3_remove(struct platform_device *pdev) |
1737 | |
1738 | pm_runtime_get_sync(&pdev->dev); |
1739 | |
1740 | - dwc3_debugfs_exit(dwc); |
1741 | dwc3_core_exit_mode(dwc); |
1742 | + dwc3_debugfs_exit(dwc); |
1743 | |
1744 | dwc3_core_exit(dwc); |
1745 | dwc3_ulpi_exit(dwc); |
1746 | diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h |
1747 | index f2c97058a00b8..e105ddfdf4403 100644 |
1748 | --- a/drivers/usb/dwc3/debug.h |
1749 | +++ b/drivers/usb/dwc3/debug.h |
1750 | @@ -409,9 +409,12 @@ static inline const char *dwc3_gadget_generic_cmd_status_string(int status) |
1751 | |
1752 | |
1753 | #ifdef CONFIG_DEBUG_FS |
1754 | +extern void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep); |
1755 | extern void dwc3_debugfs_init(struct dwc3 *); |
1756 | extern void dwc3_debugfs_exit(struct dwc3 *); |
1757 | #else |
1758 | +static inline void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) |
1759 | +{ } |
1760 | static inline void dwc3_debugfs_init(struct dwc3 *d) |
1761 | { } |
1762 | static inline void dwc3_debugfs_exit(struct dwc3 *d) |
1763 | diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c |
1764 | index 1c792710348f1..9fb519b2efb45 100644 |
1765 | --- a/drivers/usb/dwc3/debugfs.c |
1766 | +++ b/drivers/usb/dwc3/debugfs.c |
1767 | @@ -878,30 +878,14 @@ static void dwc3_debugfs_create_endpoint_files(struct dwc3_ep *dep, |
1768 | } |
1769 | } |
1770 | |
1771 | -static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep, |
1772 | - struct dentry *parent) |
1773 | +void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) |
1774 | { |
1775 | struct dentry *dir; |
1776 | |
1777 | - dir = debugfs_create_dir(dep->name, parent); |
1778 | + dir = debugfs_create_dir(dep->name, dep->dwc->root); |
1779 | dwc3_debugfs_create_endpoint_files(dep, dir); |
1780 | } |
1781 | |
1782 | -static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, |
1783 | - struct dentry *parent) |
1784 | -{ |
1785 | - int i; |
1786 | - |
1787 | - for (i = 0; i < dwc->num_eps; i++) { |
1788 | - struct dwc3_ep *dep = dwc->eps[i]; |
1789 | - |
1790 | - if (!dep) |
1791 | - continue; |
1792 | - |
1793 | - dwc3_debugfs_create_endpoint_dir(dep, parent); |
1794 | - } |
1795 | -} |
1796 | - |
1797 | void dwc3_debugfs_init(struct dwc3 *dwc) |
1798 | { |
1799 | struct dentry *root; |
1800 | @@ -935,7 +919,6 @@ void dwc3_debugfs_init(struct dwc3 *dwc) |
1801 | &dwc3_testmode_fops); |
1802 | debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, dwc, |
1803 | &dwc3_link_state_fops); |
1804 | - dwc3_debugfs_create_endpoint_dirs(dwc, root); |
1805 | } |
1806 | } |
1807 | |
1808 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1809 | index ecd83526f26fe..9cf66636b19d5 100644 |
1810 | --- a/drivers/usb/dwc3/gadget.c |
1811 | +++ b/drivers/usb/dwc3/gadget.c |
1812 | @@ -2483,6 +2483,8 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) |
1813 | INIT_LIST_HEAD(&dep->started_list); |
1814 | INIT_LIST_HEAD(&dep->cancelled_list); |
1815 | |
1816 | + dwc3_debugfs_create_endpoint_dir(dep); |
1817 | + |
1818 | return 0; |
1819 | } |
1820 | |
1821 | @@ -2526,6 +2528,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) |
1822 | list_del(&dep->endpoint.ep_list); |
1823 | } |
1824 | |
1825 | + debugfs_remove_recursive(debugfs_lookup(dep->name, dwc->root)); |
1826 | kfree(dep); |
1827 | } |
1828 | } |
1829 | diff --git a/fs/afs/main.c b/fs/afs/main.c |
1830 | index 5cd26af2464c9..d129a1a49616b 100644 |
1831 | --- a/fs/afs/main.c |
1832 | +++ b/fs/afs/main.c |
1833 | @@ -196,8 +196,8 @@ static int __init afs_init(void) |
1834 | goto error_fs; |
1835 | |
1836 | afs_proc_symlink = proc_symlink("fs/afs", NULL, "../self/net/afs"); |
1837 | - if (IS_ERR(afs_proc_symlink)) { |
1838 | - ret = PTR_ERR(afs_proc_symlink); |
1839 | + if (!afs_proc_symlink) { |
1840 | + ret = -ENOMEM; |
1841 | goto error_proc; |
1842 | } |
1843 | |
1844 | diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h |
1845 | index 2d55cee638fc6..bd1f23536b1b6 100644 |
1846 | --- a/include/linux/cpuhotplug.h |
1847 | +++ b/include/linux/cpuhotplug.h |
1848 | @@ -119,6 +119,7 @@ enum cpuhp_state { |
1849 | CPUHP_AP_ARM_L2X0_STARTING, |
1850 | CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, |
1851 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, |
1852 | + CPUHP_AP_OMAP_DM_TIMER_STARTING, |
1853 | CPUHP_AP_ARM_GLOBAL_TIMER_STARTING, |
1854 | CPUHP_AP_JCORE_TIMER_STARTING, |
1855 | CPUHP_AP_ARM_TWD_STARTING, |
1856 | diff --git a/include/linux/mfd/rohm-bd70528.h b/include/linux/mfd/rohm-bd70528.h |
1857 | index b0109ee6dae29..1c3014d2f28b1 100644 |
1858 | --- a/include/linux/mfd/rohm-bd70528.h |
1859 | +++ b/include/linux/mfd/rohm-bd70528.h |
1860 | @@ -25,9 +25,7 @@ struct bd70528_data { |
1861 | struct mutex rtc_timer_lock; |
1862 | }; |
1863 | |
1864 | -#define BD70528_BUCK_VOLTS 17 |
1865 | -#define BD70528_BUCK_VOLTS 17 |
1866 | -#define BD70528_BUCK_VOLTS 17 |
1867 | +#define BD70528_BUCK_VOLTS 0x10 |
1868 | #define BD70528_LDO_VOLTS 0x20 |
1869 | |
1870 | #define BD70528_REG_BUCK1_EN 0x0F |
1871 | diff --git a/include/linux/mlx5/transobj.h b/include/linux/mlx5/transobj.h |
1872 | index dc6b1e7cb8c42..3abefd40a4d8a 100644 |
1873 | --- a/include/linux/mlx5/transobj.h |
1874 | +++ b/include/linux/mlx5/transobj.h |
1875 | @@ -92,4 +92,5 @@ mlx5_core_hairpin_create(struct mlx5_core_dev *func_mdev, |
1876 | struct mlx5_hairpin_params *params); |
1877 | |
1878 | void mlx5_core_hairpin_destroy(struct mlx5_hairpin *pair); |
1879 | +void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp); |
1880 | #endif /* __TRANSOBJ_H__ */ |
1881 | diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h |
1882 | index 93cc4f1d444ae..874f7e73ed01b 100644 |
1883 | --- a/include/linux/ptp_clock_kernel.h |
1884 | +++ b/include/linux/ptp_clock_kernel.h |
1885 | @@ -218,7 +218,7 @@ extern int ptp_clock_index(struct ptp_clock *ptp); |
1886 | * @ppm: Parts per million, but with a 16 bit binary fractional field |
1887 | */ |
1888 | |
1889 | -extern s32 scaled_ppm_to_ppb(long ppm); |
1890 | +extern long scaled_ppm_to_ppb(long ppm); |
1891 | |
1892 | /** |
1893 | * ptp_find_pin() - obtain the pin index of a given auxiliary function |
1894 | diff --git a/include/linux/socket.h b/include/linux/socket.h |
1895 | index 4049d9755cf19..a465c6a45d6fa 100644 |
1896 | --- a/include/linux/socket.h |
1897 | +++ b/include/linux/socket.h |
1898 | @@ -406,6 +406,4 @@ extern int __sys_getpeername(int fd, struct sockaddr __user *usockaddr, |
1899 | extern int __sys_socketpair(int family, int type, int protocol, |
1900 | int __user *usockvec); |
1901 | extern int __sys_shutdown(int fd, int how); |
1902 | - |
1903 | -extern struct ns_common *get_net_ns(struct ns_common *ns); |
1904 | #endif /* _LINUX_SOCKET_H */ |
1905 | diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h |
1906 | index 0fca98a3d2d3f..167e390ac9d4e 100644 |
1907 | --- a/include/net/net_namespace.h |
1908 | +++ b/include/net/net_namespace.h |
1909 | @@ -195,6 +195,8 @@ struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns, |
1910 | void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid); |
1911 | |
1912 | void net_ns_barrier(void); |
1913 | + |
1914 | +struct ns_common *get_net_ns(struct ns_common *ns); |
1915 | #else /* CONFIG_NET_NS */ |
1916 | #include <linux/sched.h> |
1917 | #include <linux/nsproxy.h> |
1918 | @@ -214,6 +216,11 @@ static inline void net_ns_get_ownership(const struct net *net, |
1919 | } |
1920 | |
1921 | static inline void net_ns_barrier(void) {} |
1922 | + |
1923 | +static inline struct ns_common *get_net_ns(struct ns_common *ns) |
1924 | +{ |
1925 | + return ERR_PTR(-EINVAL); |
1926 | +} |
1927 | #endif /* CONFIG_NET_NS */ |
1928 | |
1929 | |
1930 | diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h |
1931 | index e7ad9d350a283..60e1241d4b77b 100644 |
1932 | --- a/include/uapi/linux/in.h |
1933 | +++ b/include/uapi/linux/in.h |
1934 | @@ -284,6 +284,9 @@ struct sockaddr_in { |
1935 | /* Address indicating an error return. */ |
1936 | #define INADDR_NONE ((unsigned long int) 0xffffffff) |
1937 | |
1938 | +/* Dummy address for src of ICMP replies if no real address is set (RFC7600). */ |
1939 | +#define INADDR_DUMMY ((unsigned long int) 0xc0000008) |
1940 | + |
1941 | /* Network number for local host loopback. */ |
1942 | #define IN_LOOPBACKNET 127 |
1943 | |
1944 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1945 | index 1baa284a27533..37eacfe0d6733 100644 |
1946 | --- a/kernel/trace/trace.c |
1947 | +++ b/kernel/trace/trace.c |
1948 | @@ -1948,9 +1948,6 @@ struct saved_cmdlines_buffer { |
1949 | }; |
1950 | static struct saved_cmdlines_buffer *savedcmd; |
1951 | |
1952 | -/* temporary disable recording */ |
1953 | -static atomic_t trace_record_taskinfo_disabled __read_mostly; |
1954 | - |
1955 | static inline char *get_saved_cmdlines(int idx) |
1956 | { |
1957 | return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN]; |
1958 | @@ -2236,8 +2233,6 @@ static bool tracing_record_taskinfo_skip(int flags) |
1959 | { |
1960 | if (unlikely(!(flags & (TRACE_RECORD_CMDLINE | TRACE_RECORD_TGID)))) |
1961 | return true; |
1962 | - if (atomic_read(&trace_record_taskinfo_disabled) || !tracing_is_on()) |
1963 | - return true; |
1964 | if (!__this_cpu_read(trace_taskinfo_save)) |
1965 | return true; |
1966 | return false; |
1967 | @@ -3460,9 +3455,6 @@ static void *s_start(struct seq_file *m, loff_t *pos) |
1968 | return ERR_PTR(-EBUSY); |
1969 | #endif |
1970 | |
1971 | - if (!iter->snapshot) |
1972 | - atomic_inc(&trace_record_taskinfo_disabled); |
1973 | - |
1974 | if (*pos != iter->pos) { |
1975 | iter->ent = NULL; |
1976 | iter->cpu = 0; |
1977 | @@ -3505,9 +3497,6 @@ static void s_stop(struct seq_file *m, void *p) |
1978 | return; |
1979 | #endif |
1980 | |
1981 | - if (!iter->snapshot) |
1982 | - atomic_dec(&trace_record_taskinfo_disabled); |
1983 | - |
1984 | trace_access_unlock(iter->cpu_file); |
1985 | trace_event_read_unlock(); |
1986 | } |
1987 | diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c |
1988 | index c1637f90c8a38..4702efb00ff21 100644 |
1989 | --- a/kernel/trace/trace_clock.c |
1990 | +++ b/kernel/trace/trace_clock.c |
1991 | @@ -115,9 +115,9 @@ u64 notrace trace_clock_global(void) |
1992 | prev_time = READ_ONCE(trace_clock_struct.prev_time); |
1993 | now = sched_clock_cpu(this_cpu); |
1994 | |
1995 | - /* Make sure that now is always greater than prev_time */ |
1996 | + /* Make sure that now is always greater than or equal to prev_time */ |
1997 | if ((s64)(now - prev_time) < 0) |
1998 | - now = prev_time + 1; |
1999 | + now = prev_time; |
2000 | |
2001 | /* |
2002 | * If in an NMI context then dont risk lockups and simply return |
2003 | @@ -131,7 +131,7 @@ u64 notrace trace_clock_global(void) |
2004 | /* Reread prev_time in case it was already updated */ |
2005 | prev_time = READ_ONCE(trace_clock_struct.prev_time); |
2006 | if ((s64)(now - prev_time) < 0) |
2007 | - now = prev_time + 1; |
2008 | + now = prev_time; |
2009 | |
2010 | trace_clock_struct.prev_time = now; |
2011 | |
2012 | diff --git a/mm/memory-failure.c b/mm/memory-failure.c |
2013 | index d823ec74f3fc7..9030ab0d9d975 100644 |
2014 | --- a/mm/memory-failure.c |
2015 | +++ b/mm/memory-failure.c |
2016 | @@ -1382,7 +1382,12 @@ int memory_failure(unsigned long pfn, int flags) |
2017 | return 0; |
2018 | } |
2019 | |
2020 | - if (!PageTransTail(p) && !PageLRU(p)) |
2021 | + /* |
2022 | + * __munlock_pagevec may clear a writeback page's LRU flag without |
2023 | + * page_lock. We need wait writeback completion for this page or it |
2024 | + * may trigger vfs BUG while evict inode. |
2025 | + */ |
2026 | + if (!PageTransTail(p) && !PageLRU(p) && !PageWriteback(p)) |
2027 | goto identify_page_state; |
2028 | |
2029 | /* |
2030 | diff --git a/mm/slab_common.c b/mm/slab_common.c |
2031 | index e36dd36c7076a..636cd496417cf 100644 |
2032 | --- a/mm/slab_common.c |
2033 | +++ b/mm/slab_common.c |
2034 | @@ -85,8 +85,7 @@ EXPORT_SYMBOL(kmem_cache_size); |
2035 | #ifdef CONFIG_DEBUG_VM |
2036 | static int kmem_cache_sanity_check(const char *name, unsigned int size) |
2037 | { |
2038 | - if (!name || in_interrupt() || size < sizeof(void *) || |
2039 | - size > KMALLOC_MAX_SIZE) { |
2040 | + if (!name || in_interrupt() || size > KMALLOC_MAX_SIZE) { |
2041 | pr_err("kmem_cache_create(%s) integrity check failed\n", name); |
2042 | return -EINVAL; |
2043 | } |
2044 | diff --git a/mm/slub.c b/mm/slub.c |
2045 | index 52ded855b4ed0..ca7143fe25b56 100644 |
2046 | --- a/mm/slub.c |
2047 | +++ b/mm/slub.c |
2048 | @@ -15,6 +15,7 @@ |
2049 | #include <linux/module.h> |
2050 | #include <linux/bit_spinlock.h> |
2051 | #include <linux/interrupt.h> |
2052 | +#include <linux/swab.h> |
2053 | #include <linux/bitops.h> |
2054 | #include <linux/slab.h> |
2055 | #include "slab.h" |
2056 | @@ -688,15 +689,15 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) |
2057 | p, p - addr, get_freepointer(s, p)); |
2058 | |
2059 | if (s->flags & SLAB_RED_ZONE) |
2060 | - print_section(KERN_ERR, "Redzone ", p - s->red_left_pad, |
2061 | + print_section(KERN_ERR, "Redzone ", p - s->red_left_pad, |
2062 | s->red_left_pad); |
2063 | else if (p > addr + 16) |
2064 | print_section(KERN_ERR, "Bytes b4 ", p - 16, 16); |
2065 | |
2066 | - print_section(KERN_ERR, "Object ", p, |
2067 | + print_section(KERN_ERR, "Object ", p, |
2068 | min_t(unsigned int, s->object_size, PAGE_SIZE)); |
2069 | if (s->flags & SLAB_RED_ZONE) |
2070 | - print_section(KERN_ERR, "Redzone ", p + s->object_size, |
2071 | + print_section(KERN_ERR, "Redzone ", p + s->object_size, |
2072 | s->inuse - s->object_size); |
2073 | |
2074 | off = get_info_end(s); |
2075 | @@ -708,7 +709,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) |
2076 | |
2077 | if (off != size_from_object(s)) |
2078 | /* Beginning of the filler is the free pointer */ |
2079 | - print_section(KERN_ERR, "Padding ", p + off, |
2080 | + print_section(KERN_ERR, "Padding ", p + off, |
2081 | size_from_object(s) - off); |
2082 | |
2083 | dump_stack(); |
2084 | @@ -882,11 +883,11 @@ static int check_object(struct kmem_cache *s, struct page *page, |
2085 | u8 *endobject = object + s->object_size; |
2086 | |
2087 | if (s->flags & SLAB_RED_ZONE) { |
2088 | - if (!check_bytes_and_report(s, page, object, "Redzone", |
2089 | + if (!check_bytes_and_report(s, page, object, "Left Redzone", |
2090 | object - s->red_left_pad, val, s->red_left_pad)) |
2091 | return 0; |
2092 | |
2093 | - if (!check_bytes_and_report(s, page, object, "Redzone", |
2094 | + if (!check_bytes_and_report(s, page, object, "Right Redzone", |
2095 | endobject, val, s->inuse - s->object_size)) |
2096 | return 0; |
2097 | } else { |
2098 | @@ -901,7 +902,7 @@ static int check_object(struct kmem_cache *s, struct page *page, |
2099 | if (val != SLUB_RED_ACTIVE && (s->flags & __OBJECT_POISON) && |
2100 | (!check_bytes_and_report(s, page, p, "Poison", p, |
2101 | POISON_FREE, s->object_size - 1) || |
2102 | - !check_bytes_and_report(s, page, p, "Poison", |
2103 | + !check_bytes_and_report(s, page, p, "End Poison", |
2104 | p + s->object_size - 1, POISON_END, 1))) |
2105 | return 0; |
2106 | /* |
2107 | @@ -3586,15 +3587,17 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) |
2108 | */ |
2109 | s->inuse = size; |
2110 | |
2111 | - if (((flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON)) || |
2112 | - s->ctor)) { |
2113 | + if ((flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON)) || |
2114 | + ((flags & SLAB_RED_ZONE) && s->object_size < sizeof(void *)) || |
2115 | + s->ctor) { |
2116 | /* |
2117 | * Relocate free pointer after the object if it is not |
2118 | * permitted to overwrite the first word of the object on |
2119 | * kmem_cache_free. |
2120 | * |
2121 | * This is the case if we do RCU, have a constructor or |
2122 | - * destructor or are poisoning the objects. |
2123 | + * destructor, are poisoning the objects, or are |
2124 | + * redzoning an object smaller than sizeof(void *). |
2125 | * |
2126 | * The assumption that s->offset >= s->inuse means free |
2127 | * pointer is outside of the object is used in the |
2128 | diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c |
2129 | index d88a4de022372..8be8a1feca843 100644 |
2130 | --- a/net/batman-adv/bat_iv_ogm.c |
2131 | +++ b/net/batman-adv/bat_iv_ogm.c |
2132 | @@ -409,8 +409,10 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet) |
2133 | if (WARN_ON(!forw_packet->if_outgoing)) |
2134 | return; |
2135 | |
2136 | - if (WARN_ON(forw_packet->if_outgoing->soft_iface != soft_iface)) |
2137 | + if (forw_packet->if_outgoing->soft_iface != soft_iface) { |
2138 | + pr_warn("%s: soft interface switch for queued OGM\n", __func__); |
2139 | return; |
2140 | + } |
2141 | |
2142 | if (forw_packet->if_incoming->if_status != BATADV_IF_ACTIVE) |
2143 | return; |
2144 | diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h |
2145 | index 7615c2210e0da..c83d3a954b5f3 100644 |
2146 | --- a/net/bridge/br_private.h |
2147 | +++ b/net/bridge/br_private.h |
2148 | @@ -96,8 +96,8 @@ struct br_vlan_stats { |
2149 | }; |
2150 | |
2151 | struct br_tunnel_info { |
2152 | - __be64 tunnel_id; |
2153 | - struct metadata_dst *tunnel_dst; |
2154 | + __be64 tunnel_id; |
2155 | + struct metadata_dst __rcu *tunnel_dst; |
2156 | }; |
2157 | |
2158 | /* private vlan flags */ |
2159 | diff --git a/net/bridge/br_vlan_tunnel.c b/net/bridge/br_vlan_tunnel.c |
2160 | index d13d2080f5277..4d761d943fad2 100644 |
2161 | --- a/net/bridge/br_vlan_tunnel.c |
2162 | +++ b/net/bridge/br_vlan_tunnel.c |
2163 | @@ -41,26 +41,33 @@ static struct net_bridge_vlan *br_vlan_tunnel_lookup(struct rhashtable *tbl, |
2164 | br_vlan_tunnel_rht_params); |
2165 | } |
2166 | |
2167 | +static void vlan_tunnel_info_release(struct net_bridge_vlan *vlan) |
2168 | +{ |
2169 | + struct metadata_dst *tdst = rtnl_dereference(vlan->tinfo.tunnel_dst); |
2170 | + |
2171 | + WRITE_ONCE(vlan->tinfo.tunnel_id, 0); |
2172 | + RCU_INIT_POINTER(vlan->tinfo.tunnel_dst, NULL); |
2173 | + dst_release(&tdst->dst); |
2174 | +} |
2175 | + |
2176 | void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg, |
2177 | struct net_bridge_vlan *vlan) |
2178 | { |
2179 | - if (!vlan->tinfo.tunnel_dst) |
2180 | + if (!rcu_access_pointer(vlan->tinfo.tunnel_dst)) |
2181 | return; |
2182 | rhashtable_remove_fast(&vg->tunnel_hash, &vlan->tnode, |
2183 | br_vlan_tunnel_rht_params); |
2184 | - vlan->tinfo.tunnel_id = 0; |
2185 | - dst_release(&vlan->tinfo.tunnel_dst->dst); |
2186 | - vlan->tinfo.tunnel_dst = NULL; |
2187 | + vlan_tunnel_info_release(vlan); |
2188 | } |
2189 | |
2190 | static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg, |
2191 | struct net_bridge_vlan *vlan, u32 tun_id) |
2192 | { |
2193 | - struct metadata_dst *metadata = NULL; |
2194 | + struct metadata_dst *metadata = rtnl_dereference(vlan->tinfo.tunnel_dst); |
2195 | __be64 key = key32_to_tunnel_id(cpu_to_be32(tun_id)); |
2196 | int err; |
2197 | |
2198 | - if (vlan->tinfo.tunnel_dst) |
2199 | + if (metadata) |
2200 | return -EEXIST; |
2201 | |
2202 | metadata = __ip_tun_set_dst(0, 0, 0, 0, 0, TUNNEL_KEY, |
2203 | @@ -69,8 +76,8 @@ static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg, |
2204 | return -EINVAL; |
2205 | |
2206 | metadata->u.tun_info.mode |= IP_TUNNEL_INFO_TX | IP_TUNNEL_INFO_BRIDGE; |
2207 | - vlan->tinfo.tunnel_dst = metadata; |
2208 | - vlan->tinfo.tunnel_id = key; |
2209 | + rcu_assign_pointer(vlan->tinfo.tunnel_dst, metadata); |
2210 | + WRITE_ONCE(vlan->tinfo.tunnel_id, key); |
2211 | |
2212 | err = rhashtable_lookup_insert_fast(&vg->tunnel_hash, &vlan->tnode, |
2213 | br_vlan_tunnel_rht_params); |
2214 | @@ -79,9 +86,7 @@ static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg, |
2215 | |
2216 | return 0; |
2217 | out: |
2218 | - dst_release(&vlan->tinfo.tunnel_dst->dst); |
2219 | - vlan->tinfo.tunnel_dst = NULL; |
2220 | - vlan->tinfo.tunnel_id = 0; |
2221 | + vlan_tunnel_info_release(vlan); |
2222 | |
2223 | return err; |
2224 | } |
2225 | @@ -181,12 +186,15 @@ int br_handle_ingress_vlan_tunnel(struct sk_buff *skb, |
2226 | int br_handle_egress_vlan_tunnel(struct sk_buff *skb, |
2227 | struct net_bridge_vlan *vlan) |
2228 | { |
2229 | + struct metadata_dst *tunnel_dst; |
2230 | + __be64 tunnel_id; |
2231 | int err; |
2232 | |
2233 | - if (!vlan || !vlan->tinfo.tunnel_id) |
2234 | + if (!vlan) |
2235 | return 0; |
2236 | |
2237 | - if (unlikely(!skb_vlan_tag_present(skb))) |
2238 | + tunnel_id = READ_ONCE(vlan->tinfo.tunnel_id); |
2239 | + if (!tunnel_id || unlikely(!skb_vlan_tag_present(skb))) |
2240 | return 0; |
2241 | |
2242 | skb_dst_drop(skb); |
2243 | @@ -194,7 +202,9 @@ int br_handle_egress_vlan_tunnel(struct sk_buff *skb, |
2244 | if (err) |
2245 | return err; |
2246 | |
2247 | - skb_dst_set(skb, dst_clone(&vlan->tinfo.tunnel_dst->dst)); |
2248 | + tunnel_dst = rcu_dereference(vlan->tinfo.tunnel_dst); |
2249 | + if (tunnel_dst && dst_hold_safe(&tunnel_dst->dst)) |
2250 | + skb_dst_set(skb, &tunnel_dst->dst); |
2251 | |
2252 | return 0; |
2253 | } |
2254 | diff --git a/net/can/bcm.c b/net/can/bcm.c |
2255 | index d3aac6a2479b5..a7abced793765 100644 |
2256 | --- a/net/can/bcm.c |
2257 | +++ b/net/can/bcm.c |
2258 | @@ -127,7 +127,7 @@ struct bcm_sock { |
2259 | struct sock sk; |
2260 | int bound; |
2261 | int ifindex; |
2262 | - struct notifier_block notifier; |
2263 | + struct list_head notifier; |
2264 | struct list_head rx_ops; |
2265 | struct list_head tx_ops; |
2266 | unsigned long dropped_usr_msgs; |
2267 | @@ -135,6 +135,10 @@ struct bcm_sock { |
2268 | char procname [32]; /* inode number in decimal with \0 */ |
2269 | }; |
2270 | |
2271 | +static LIST_HEAD(bcm_notifier_list); |
2272 | +static DEFINE_SPINLOCK(bcm_notifier_lock); |
2273 | +static struct bcm_sock *bcm_busy_notifier; |
2274 | + |
2275 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) |
2276 | { |
2277 | return (struct bcm_sock *)sk; |
2278 | @@ -404,6 +408,7 @@ static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer) |
2279 | if (!op->count && (op->flags & TX_COUNTEVT)) { |
2280 | |
2281 | /* create notification to user */ |
2282 | + memset(&msg_head, 0, sizeof(msg_head)); |
2283 | msg_head.opcode = TX_EXPIRED; |
2284 | msg_head.flags = op->flags; |
2285 | msg_head.count = op->count; |
2286 | @@ -441,6 +446,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data) |
2287 | /* this element is not throttled anymore */ |
2288 | data->flags &= (BCM_CAN_FLAGS_MASK|RX_RECV); |
2289 | |
2290 | + memset(&head, 0, sizeof(head)); |
2291 | head.opcode = RX_CHANGED; |
2292 | head.flags = op->flags; |
2293 | head.count = op->count; |
2294 | @@ -562,6 +568,7 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer) |
2295 | } |
2296 | |
2297 | /* create notification to user */ |
2298 | + memset(&msg_head, 0, sizeof(msg_head)); |
2299 | msg_head.opcode = RX_TIMEOUT; |
2300 | msg_head.flags = op->flags; |
2301 | msg_head.count = op->count; |
2302 | @@ -1380,20 +1387,15 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) |
2303 | /* |
2304 | * notification handler for netdevice status changes |
2305 | */ |
2306 | -static int bcm_notifier(struct notifier_block *nb, unsigned long msg, |
2307 | - void *ptr) |
2308 | +static void bcm_notify(struct bcm_sock *bo, unsigned long msg, |
2309 | + struct net_device *dev) |
2310 | { |
2311 | - struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2312 | - struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier); |
2313 | struct sock *sk = &bo->sk; |
2314 | struct bcm_op *op; |
2315 | int notify_enodev = 0; |
2316 | |
2317 | if (!net_eq(dev_net(dev), sock_net(sk))) |
2318 | - return NOTIFY_DONE; |
2319 | - |
2320 | - if (dev->type != ARPHRD_CAN) |
2321 | - return NOTIFY_DONE; |
2322 | + return; |
2323 | |
2324 | switch (msg) { |
2325 | |
2326 | @@ -1428,7 +1430,28 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg, |
2327 | sk->sk_error_report(sk); |
2328 | } |
2329 | } |
2330 | +} |
2331 | |
2332 | +static int bcm_notifier(struct notifier_block *nb, unsigned long msg, |
2333 | + void *ptr) |
2334 | +{ |
2335 | + struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2336 | + |
2337 | + if (dev->type != ARPHRD_CAN) |
2338 | + return NOTIFY_DONE; |
2339 | + if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN) |
2340 | + return NOTIFY_DONE; |
2341 | + if (unlikely(bcm_busy_notifier)) /* Check for reentrant bug. */ |
2342 | + return NOTIFY_DONE; |
2343 | + |
2344 | + spin_lock(&bcm_notifier_lock); |
2345 | + list_for_each_entry(bcm_busy_notifier, &bcm_notifier_list, notifier) { |
2346 | + spin_unlock(&bcm_notifier_lock); |
2347 | + bcm_notify(bcm_busy_notifier, msg, dev); |
2348 | + spin_lock(&bcm_notifier_lock); |
2349 | + } |
2350 | + bcm_busy_notifier = NULL; |
2351 | + spin_unlock(&bcm_notifier_lock); |
2352 | return NOTIFY_DONE; |
2353 | } |
2354 | |
2355 | @@ -1448,9 +1471,9 @@ static int bcm_init(struct sock *sk) |
2356 | INIT_LIST_HEAD(&bo->rx_ops); |
2357 | |
2358 | /* set notifier */ |
2359 | - bo->notifier.notifier_call = bcm_notifier; |
2360 | - |
2361 | - register_netdevice_notifier(&bo->notifier); |
2362 | + spin_lock(&bcm_notifier_lock); |
2363 | + list_add_tail(&bo->notifier, &bcm_notifier_list); |
2364 | + spin_unlock(&bcm_notifier_lock); |
2365 | |
2366 | return 0; |
2367 | } |
2368 | @@ -1473,7 +1496,14 @@ static int bcm_release(struct socket *sock) |
2369 | |
2370 | /* remove bcm_ops, timer, rx_unregister(), etc. */ |
2371 | |
2372 | - unregister_netdevice_notifier(&bo->notifier); |
2373 | + spin_lock(&bcm_notifier_lock); |
2374 | + while (bcm_busy_notifier == bo) { |
2375 | + spin_unlock(&bcm_notifier_lock); |
2376 | + schedule_timeout_uninterruptible(1); |
2377 | + spin_lock(&bcm_notifier_lock); |
2378 | + } |
2379 | + list_del(&bo->notifier); |
2380 | + spin_unlock(&bcm_notifier_lock); |
2381 | |
2382 | lock_sock(sk); |
2383 | |
2384 | @@ -1696,6 +1726,10 @@ static struct pernet_operations canbcm_pernet_ops __read_mostly = { |
2385 | .exit = canbcm_pernet_exit, |
2386 | }; |
2387 | |
2388 | +static struct notifier_block canbcm_notifier = { |
2389 | + .notifier_call = bcm_notifier |
2390 | +}; |
2391 | + |
2392 | static int __init bcm_module_init(void) |
2393 | { |
2394 | int err; |
2395 | @@ -1709,12 +1743,14 @@ static int __init bcm_module_init(void) |
2396 | } |
2397 | |
2398 | register_pernet_subsys(&canbcm_pernet_ops); |
2399 | + register_netdevice_notifier(&canbcm_notifier); |
2400 | return 0; |
2401 | } |
2402 | |
2403 | static void __exit bcm_module_exit(void) |
2404 | { |
2405 | can_proto_unregister(&bcm_can_proto); |
2406 | + unregister_netdevice_notifier(&canbcm_notifier); |
2407 | unregister_pernet_subsys(&canbcm_pernet_ops); |
2408 | } |
2409 | |
2410 | diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c |
2411 | index 916fdf2464bc2..5252bbd1617c6 100644 |
2412 | --- a/net/can/j1939/transport.c |
2413 | +++ b/net/can/j1939/transport.c |
2414 | @@ -330,6 +330,9 @@ static void j1939_session_skb_drop_old(struct j1939_session *session) |
2415 | |
2416 | if ((do_skcb->offset + do_skb->len) < offset_start) { |
2417 | __skb_unlink(do_skb, &session->skb_queue); |
2418 | + /* drop ref taken in j1939_session_skb_queue() */ |
2419 | + skb_unref(do_skb); |
2420 | + |
2421 | kfree_skb(do_skb); |
2422 | } |
2423 | spin_unlock_irqrestore(&session->skb_queue.lock, flags); |
2424 | @@ -349,12 +352,13 @@ void j1939_session_skb_queue(struct j1939_session *session, |
2425 | |
2426 | skcb->flags |= J1939_ECU_LOCAL_SRC; |
2427 | |
2428 | + skb_get(skb); |
2429 | skb_queue_tail(&session->skb_queue, skb); |
2430 | } |
2431 | |
2432 | static struct |
2433 | -sk_buff *j1939_session_skb_find_by_offset(struct j1939_session *session, |
2434 | - unsigned int offset_start) |
2435 | +sk_buff *j1939_session_skb_get_by_offset(struct j1939_session *session, |
2436 | + unsigned int offset_start) |
2437 | { |
2438 | struct j1939_priv *priv = session->priv; |
2439 | struct j1939_sk_buff_cb *do_skcb; |
2440 | @@ -371,6 +375,10 @@ sk_buff *j1939_session_skb_find_by_offset(struct j1939_session *session, |
2441 | skb = do_skb; |
2442 | } |
2443 | } |
2444 | + |
2445 | + if (skb) |
2446 | + skb_get(skb); |
2447 | + |
2448 | spin_unlock_irqrestore(&session->skb_queue.lock, flags); |
2449 | |
2450 | if (!skb) |
2451 | @@ -381,12 +389,12 @@ sk_buff *j1939_session_skb_find_by_offset(struct j1939_session *session, |
2452 | return skb; |
2453 | } |
2454 | |
2455 | -static struct sk_buff *j1939_session_skb_find(struct j1939_session *session) |
2456 | +static struct sk_buff *j1939_session_skb_get(struct j1939_session *session) |
2457 | { |
2458 | unsigned int offset_start; |
2459 | |
2460 | offset_start = session->pkt.dpo * 7; |
2461 | - return j1939_session_skb_find_by_offset(session, offset_start); |
2462 | + return j1939_session_skb_get_by_offset(session, offset_start); |
2463 | } |
2464 | |
2465 | /* see if we are receiver |
2466 | @@ -776,7 +784,7 @@ static int j1939_session_tx_dat(struct j1939_session *session) |
2467 | int ret = 0; |
2468 | u8 dat[8]; |
2469 | |
2470 | - se_skb = j1939_session_skb_find_by_offset(session, session->pkt.tx * 7); |
2471 | + se_skb = j1939_session_skb_get_by_offset(session, session->pkt.tx * 7); |
2472 | if (!se_skb) |
2473 | return -ENOBUFS; |
2474 | |
2475 | @@ -801,7 +809,8 @@ static int j1939_session_tx_dat(struct j1939_session *session) |
2476 | netdev_err_once(priv->ndev, |
2477 | "%s: 0x%p: requested data outside of queued buffer: offset %i, len %i, pkt.tx: %i\n", |
2478 | __func__, session, skcb->offset, se_skb->len , session->pkt.tx); |
2479 | - return -EOVERFLOW; |
2480 | + ret = -EOVERFLOW; |
2481 | + goto out_free; |
2482 | } |
2483 | |
2484 | if (!len) { |
2485 | @@ -835,6 +844,12 @@ static int j1939_session_tx_dat(struct j1939_session *session) |
2486 | if (pkt_done) |
2487 | j1939_tp_set_rxtimeout(session, 250); |
2488 | |
2489 | + out_free: |
2490 | + if (ret) |
2491 | + kfree_skb(se_skb); |
2492 | + else |
2493 | + consume_skb(se_skb); |
2494 | + |
2495 | return ret; |
2496 | } |
2497 | |
2498 | @@ -1007,7 +1022,7 @@ static int j1939_xtp_txnext_receiver(struct j1939_session *session) |
2499 | static int j1939_simple_txnext(struct j1939_session *session) |
2500 | { |
2501 | struct j1939_priv *priv = session->priv; |
2502 | - struct sk_buff *se_skb = j1939_session_skb_find(session); |
2503 | + struct sk_buff *se_skb = j1939_session_skb_get(session); |
2504 | struct sk_buff *skb; |
2505 | int ret; |
2506 | |
2507 | @@ -1015,8 +1030,10 @@ static int j1939_simple_txnext(struct j1939_session *session) |
2508 | return 0; |
2509 | |
2510 | skb = skb_clone(se_skb, GFP_ATOMIC); |
2511 | - if (!skb) |
2512 | - return -ENOMEM; |
2513 | + if (!skb) { |
2514 | + ret = -ENOMEM; |
2515 | + goto out_free; |
2516 | + } |
2517 | |
2518 | can_skb_set_owner(skb, se_skb->sk); |
2519 | |
2520 | @@ -1024,12 +1041,18 @@ static int j1939_simple_txnext(struct j1939_session *session) |
2521 | |
2522 | ret = j1939_send_one(priv, skb); |
2523 | if (ret) |
2524 | - return ret; |
2525 | + goto out_free; |
2526 | |
2527 | j1939_sk_errqueue(session, J1939_ERRQUEUE_SCHED); |
2528 | j1939_sk_queue_activate_next(session); |
2529 | |
2530 | - return 0; |
2531 | + out_free: |
2532 | + if (ret) |
2533 | + kfree_skb(se_skb); |
2534 | + else |
2535 | + consume_skb(se_skb); |
2536 | + |
2537 | + return ret; |
2538 | } |
2539 | |
2540 | static bool j1939_session_deactivate_locked(struct j1939_session *session) |
2541 | @@ -1170,9 +1193,10 @@ static void j1939_session_completed(struct j1939_session *session) |
2542 | struct sk_buff *skb; |
2543 | |
2544 | if (!session->transmission) { |
2545 | - skb = j1939_session_skb_find(session); |
2546 | + skb = j1939_session_skb_get(session); |
2547 | /* distribute among j1939 receivers */ |
2548 | j1939_sk_recv(session->priv, skb); |
2549 | + consume_skb(skb); |
2550 | } |
2551 | |
2552 | j1939_session_deactivate_activate_next(session); |
2553 | @@ -1744,7 +1768,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session, |
2554 | { |
2555 | struct j1939_priv *priv = session->priv; |
2556 | struct j1939_sk_buff_cb *skcb; |
2557 | - struct sk_buff *se_skb; |
2558 | + struct sk_buff *se_skb = NULL; |
2559 | const u8 *dat; |
2560 | u8 *tpdat; |
2561 | int offset; |
2562 | @@ -1786,7 +1810,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session, |
2563 | goto out_session_cancel; |
2564 | } |
2565 | |
2566 | - se_skb = j1939_session_skb_find_by_offset(session, packet * 7); |
2567 | + se_skb = j1939_session_skb_get_by_offset(session, packet * 7); |
2568 | if (!se_skb) { |
2569 | netdev_warn(priv->ndev, "%s: 0x%p: no skb found\n", __func__, |
2570 | session); |
2571 | @@ -1848,11 +1872,13 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session, |
2572 | j1939_tp_set_rxtimeout(session, 250); |
2573 | } |
2574 | session->last_cmd = 0xff; |
2575 | + consume_skb(se_skb); |
2576 | j1939_session_put(session); |
2577 | |
2578 | return; |
2579 | |
2580 | out_session_cancel: |
2581 | + kfree_skb(se_skb); |
2582 | j1939_session_timers_cancel(session); |
2583 | j1939_session_cancel(session, J1939_XTP_ABORT_FAULT); |
2584 | j1939_session_put(session); |
2585 | diff --git a/net/can/raw.c b/net/can/raw.c |
2586 | index af513d0957c74..c968034ed275b 100644 |
2587 | --- a/net/can/raw.c |
2588 | +++ b/net/can/raw.c |
2589 | @@ -85,7 +85,7 @@ struct raw_sock { |
2590 | struct sock sk; |
2591 | int bound; |
2592 | int ifindex; |
2593 | - struct notifier_block notifier; |
2594 | + struct list_head notifier; |
2595 | int loopback; |
2596 | int recv_own_msgs; |
2597 | int fd_frames; |
2598 | @@ -97,6 +97,10 @@ struct raw_sock { |
2599 | struct uniqframe __percpu *uniq; |
2600 | }; |
2601 | |
2602 | +static LIST_HEAD(raw_notifier_list); |
2603 | +static DEFINE_SPINLOCK(raw_notifier_lock); |
2604 | +static struct raw_sock *raw_busy_notifier; |
2605 | + |
2606 | /* Return pointer to store the extra msg flags for raw_recvmsg(). |
2607 | * We use the space of one unsigned int beyond the 'struct sockaddr_can' |
2608 | * in skb->cb. |
2609 | @@ -265,21 +269,16 @@ static int raw_enable_allfilters(struct net *net, struct net_device *dev, |
2610 | return err; |
2611 | } |
2612 | |
2613 | -static int raw_notifier(struct notifier_block *nb, |
2614 | - unsigned long msg, void *ptr) |
2615 | +static void raw_notify(struct raw_sock *ro, unsigned long msg, |
2616 | + struct net_device *dev) |
2617 | { |
2618 | - struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2619 | - struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); |
2620 | struct sock *sk = &ro->sk; |
2621 | |
2622 | if (!net_eq(dev_net(dev), sock_net(sk))) |
2623 | - return NOTIFY_DONE; |
2624 | - |
2625 | - if (dev->type != ARPHRD_CAN) |
2626 | - return NOTIFY_DONE; |
2627 | + return; |
2628 | |
2629 | if (ro->ifindex != dev->ifindex) |
2630 | - return NOTIFY_DONE; |
2631 | + return; |
2632 | |
2633 | switch (msg) { |
2634 | case NETDEV_UNREGISTER: |
2635 | @@ -307,7 +306,28 @@ static int raw_notifier(struct notifier_block *nb, |
2636 | sk->sk_error_report(sk); |
2637 | break; |
2638 | } |
2639 | +} |
2640 | + |
2641 | +static int raw_notifier(struct notifier_block *nb, unsigned long msg, |
2642 | + void *ptr) |
2643 | +{ |
2644 | + struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2645 | + |
2646 | + if (dev->type != ARPHRD_CAN) |
2647 | + return NOTIFY_DONE; |
2648 | + if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN) |
2649 | + return NOTIFY_DONE; |
2650 | + if (unlikely(raw_busy_notifier)) /* Check for reentrant bug. */ |
2651 | + return NOTIFY_DONE; |
2652 | |
2653 | + spin_lock(&raw_notifier_lock); |
2654 | + list_for_each_entry(raw_busy_notifier, &raw_notifier_list, notifier) { |
2655 | + spin_unlock(&raw_notifier_lock); |
2656 | + raw_notify(raw_busy_notifier, msg, dev); |
2657 | + spin_lock(&raw_notifier_lock); |
2658 | + } |
2659 | + raw_busy_notifier = NULL; |
2660 | + spin_unlock(&raw_notifier_lock); |
2661 | return NOTIFY_DONE; |
2662 | } |
2663 | |
2664 | @@ -336,9 +356,9 @@ static int raw_init(struct sock *sk) |
2665 | return -ENOMEM; |
2666 | |
2667 | /* set notifier */ |
2668 | - ro->notifier.notifier_call = raw_notifier; |
2669 | - |
2670 | - register_netdevice_notifier(&ro->notifier); |
2671 | + spin_lock(&raw_notifier_lock); |
2672 | + list_add_tail(&ro->notifier, &raw_notifier_list); |
2673 | + spin_unlock(&raw_notifier_lock); |
2674 | |
2675 | return 0; |
2676 | } |
2677 | @@ -353,7 +373,14 @@ static int raw_release(struct socket *sock) |
2678 | |
2679 | ro = raw_sk(sk); |
2680 | |
2681 | - unregister_netdevice_notifier(&ro->notifier); |
2682 | + spin_lock(&raw_notifier_lock); |
2683 | + while (raw_busy_notifier == ro) { |
2684 | + spin_unlock(&raw_notifier_lock); |
2685 | + schedule_timeout_uninterruptible(1); |
2686 | + spin_lock(&raw_notifier_lock); |
2687 | + } |
2688 | + list_del(&ro->notifier); |
2689 | + spin_unlock(&raw_notifier_lock); |
2690 | |
2691 | lock_sock(sk); |
2692 | |
2693 | @@ -879,6 +906,10 @@ static const struct can_proto raw_can_proto = { |
2694 | .prot = &raw_proto, |
2695 | }; |
2696 | |
2697 | +static struct notifier_block canraw_notifier = { |
2698 | + .notifier_call = raw_notifier |
2699 | +}; |
2700 | + |
2701 | static __init int raw_module_init(void) |
2702 | { |
2703 | int err; |
2704 | @@ -888,6 +919,8 @@ static __init int raw_module_init(void) |
2705 | err = can_proto_register(&raw_can_proto); |
2706 | if (err < 0) |
2707 | pr_err("can: registration of raw protocol failed\n"); |
2708 | + else |
2709 | + register_netdevice_notifier(&canraw_notifier); |
2710 | |
2711 | return err; |
2712 | } |
2713 | @@ -895,6 +928,7 @@ static __init int raw_module_init(void) |
2714 | static __exit void raw_module_exit(void) |
2715 | { |
2716 | can_proto_unregister(&raw_can_proto); |
2717 | + unregister_netdevice_notifier(&canraw_notifier); |
2718 | } |
2719 | |
2720 | module_init(raw_module_init); |
2721 | diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
2722 | index 39402840025e1..c303873496a34 100644 |
2723 | --- a/net/core/net_namespace.c |
2724 | +++ b/net/core/net_namespace.c |
2725 | @@ -643,6 +643,18 @@ void __put_net(struct net *net) |
2726 | } |
2727 | EXPORT_SYMBOL_GPL(__put_net); |
2728 | |
2729 | +/** |
2730 | + * get_net_ns - increment the refcount of the network namespace |
2731 | + * @ns: common namespace (net) |
2732 | + * |
2733 | + * Returns the net's common namespace. |
2734 | + */ |
2735 | +struct ns_common *get_net_ns(struct ns_common *ns) |
2736 | +{ |
2737 | + return &get_net(container_of(ns, struct net, ns))->ns; |
2738 | +} |
2739 | +EXPORT_SYMBOL_GPL(get_net_ns); |
2740 | + |
2741 | struct net *get_net_ns_by_fd(int fd) |
2742 | { |
2743 | struct file *file; |
2744 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
2745 | index bdeb169a7a999..0bad5db23129a 100644 |
2746 | --- a/net/core/rtnetlink.c |
2747 | +++ b/net/core/rtnetlink.c |
2748 | @@ -4535,10 +4535,12 @@ static int rtnl_bridge_notify(struct net_device *dev) |
2749 | if (err < 0) |
2750 | goto errout; |
2751 | |
2752 | - if (!skb->len) { |
2753 | - err = -EINVAL; |
2754 | + /* Notification info is only filled for bridge ports, not the bridge |
2755 | + * device itself. Therefore, a zero notification length is valid and |
2756 | + * should not result in an error. |
2757 | + */ |
2758 | + if (!skb->len) |
2759 | goto errout; |
2760 | - } |
2761 | |
2762 | rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); |
2763 | return 0; |
2764 | diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c |
2765 | index e290a0c9e9282..c1ac802d6894a 100644 |
2766 | --- a/net/ipv4/cipso_ipv4.c |
2767 | +++ b/net/ipv4/cipso_ipv4.c |
2768 | @@ -472,6 +472,7 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def) |
2769 | kfree(doi_def->map.std->lvl.local); |
2770 | kfree(doi_def->map.std->cat.cipso); |
2771 | kfree(doi_def->map.std->cat.local); |
2772 | + kfree(doi_def->map.std); |
2773 | break; |
2774 | } |
2775 | kfree(doi_def); |
2776 | diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
2777 | index dd8fae89be723..c88612242c89f 100644 |
2778 | --- a/net/ipv4/icmp.c |
2779 | +++ b/net/ipv4/icmp.c |
2780 | @@ -739,6 +739,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
2781 | icmp_param.data_len = room; |
2782 | icmp_param.head_len = sizeof(struct icmphdr); |
2783 | |
2784 | + /* if we don't have a source address at this point, fall back to the |
2785 | + * dummy address instead of sending out a packet with a source address |
2786 | + * of 0.0.0.0 |
2787 | + */ |
2788 | + if (!fl4.saddr) |
2789 | + fl4.saddr = htonl(INADDR_DUMMY); |
2790 | + |
2791 | icmp_push_reply(&icmp_param, &fl4, &ipc, &rt); |
2792 | ende: |
2793 | ip_rt_put(rt); |
2794 | diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
2795 | index 480d0b22db1a6..c8cbdc4d5cbc7 100644 |
2796 | --- a/net/ipv4/igmp.c |
2797 | +++ b/net/ipv4/igmp.c |
2798 | @@ -1803,6 +1803,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev) |
2799 | while ((i = rtnl_dereference(in_dev->mc_list)) != NULL) { |
2800 | in_dev->mc_list = i->next_rcu; |
2801 | in_dev->mc_count--; |
2802 | + ip_mc_clear_src(i); |
2803 | ip_ma_put(i); |
2804 | } |
2805 | } |
2806 | diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
2807 | index 24841a9e99668..4644f86c932fc 100644 |
2808 | --- a/net/ipv4/udp.c |
2809 | +++ b/net/ipv4/udp.c |
2810 | @@ -2511,6 +2511,9 @@ void udp_destroy_sock(struct sock *sk) |
2811 | { |
2812 | struct udp_sock *up = udp_sk(sk); |
2813 | bool slow = lock_sock_fast(sk); |
2814 | + |
2815 | + /* protects from races with udp_abort() */ |
2816 | + sock_set_flag(sk, SOCK_DEAD); |
2817 | udp_flush_pending_frames(sk); |
2818 | unlock_sock_fast(sk, slow); |
2819 | if (static_branch_unlikely(&udp_encap_needed_key)) { |
2820 | @@ -2770,10 +2773,17 @@ int udp_abort(struct sock *sk, int err) |
2821 | { |
2822 | lock_sock(sk); |
2823 | |
2824 | + /* udp{v6}_destroy_sock() sets it under the sk lock, avoid racing |
2825 | + * with close() |
2826 | + */ |
2827 | + if (sock_flag(sk, SOCK_DEAD)) |
2828 | + goto out; |
2829 | + |
2830 | sk->sk_err = err; |
2831 | sk->sk_error_report(sk); |
2832 | __udp_disconnect(sk, 0); |
2833 | |
2834 | +out: |
2835 | release_sock(sk); |
2836 | |
2837 | return 0; |
2838 | diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
2839 | index 6762430280f5e..3c94b81bb459a 100644 |
2840 | --- a/net/ipv6/udp.c |
2841 | +++ b/net/ipv6/udp.c |
2842 | @@ -1539,6 +1539,9 @@ void udpv6_destroy_sock(struct sock *sk) |
2843 | { |
2844 | struct udp_sock *up = udp_sk(sk); |
2845 | lock_sock(sk); |
2846 | + |
2847 | + /* protects from races with udp_abort() */ |
2848 | + sock_set_flag(sk, SOCK_DEAD); |
2849 | udp_v6_flush_pending_frames(sk); |
2850 | release_sock(sk); |
2851 | |
2852 | diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c |
2853 | index 4bb4cfde28b47..c6c0d27caaed3 100644 |
2854 | --- a/net/netfilter/nf_synproxy_core.c |
2855 | +++ b/net/netfilter/nf_synproxy_core.c |
2856 | @@ -31,6 +31,9 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, |
2857 | int length = (th->doff * 4) - sizeof(*th); |
2858 | u8 buf[40], *ptr; |
2859 | |
2860 | + if (unlikely(length < 0)) |
2861 | + return false; |
2862 | + |
2863 | ptr = skb_header_pointer(skb, doff + sizeof(*th), length, buf); |
2864 | if (ptr == NULL) |
2865 | return false; |
2866 | @@ -47,6 +50,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, |
2867 | length--; |
2868 | continue; |
2869 | default: |
2870 | + if (length < 2) |
2871 | + return true; |
2872 | opsize = *ptr++; |
2873 | if (opsize < 2) |
2874 | return true; |
2875 | diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c |
2876 | index 46273a8383615..faea2ce125110 100644 |
2877 | --- a/net/qrtr/qrtr.c |
2878 | +++ b/net/qrtr/qrtr.c |
2879 | @@ -257,7 +257,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) |
2880 | const struct qrtr_hdr_v2 *v2; |
2881 | struct sk_buff *skb; |
2882 | struct qrtr_cb *cb; |
2883 | - unsigned int size; |
2884 | + size_t size; |
2885 | unsigned int ver; |
2886 | size_t hdrlen; |
2887 | |
2888 | diff --git a/net/rds/recv.c b/net/rds/recv.c |
2889 | index aba4afe4dfedc..967d115f97efd 100644 |
2890 | --- a/net/rds/recv.c |
2891 | +++ b/net/rds/recv.c |
2892 | @@ -714,7 +714,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
2893 | |
2894 | if (rds_cmsg_recv(inc, msg, rs)) { |
2895 | ret = -EFAULT; |
2896 | - goto out; |
2897 | + break; |
2898 | } |
2899 | rds_recvmsg_zcookie(rs, msg); |
2900 | |
2901 | diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c |
2902 | index 31eb8eefc8681..16c4cbf6d1f0a 100644 |
2903 | --- a/net/sched/act_ct.c |
2904 | +++ b/net/sched/act_ct.c |
2905 | @@ -361,14 +361,19 @@ static int tcf_ct_act_nat(struct sk_buff *skb, |
2906 | } |
2907 | |
2908 | err = ct_nat_execute(skb, ct, ctinfo, range, maniptype); |
2909 | - if (err == NF_ACCEPT && |
2910 | - ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) { |
2911 | - if (maniptype == NF_NAT_MANIP_SRC) |
2912 | - maniptype = NF_NAT_MANIP_DST; |
2913 | - else |
2914 | - maniptype = NF_NAT_MANIP_SRC; |
2915 | - |
2916 | - err = ct_nat_execute(skb, ct, ctinfo, range, maniptype); |
2917 | + if (err == NF_ACCEPT && ct->status & IPS_DST_NAT) { |
2918 | + if (ct->status & IPS_SRC_NAT) { |
2919 | + if (maniptype == NF_NAT_MANIP_SRC) |
2920 | + maniptype = NF_NAT_MANIP_DST; |
2921 | + else |
2922 | + maniptype = NF_NAT_MANIP_SRC; |
2923 | + |
2924 | + err = ct_nat_execute(skb, ct, ctinfo, range, |
2925 | + maniptype); |
2926 | + } else if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) { |
2927 | + err = ct_nat_execute(skb, ct, ctinfo, NULL, |
2928 | + NF_NAT_MANIP_SRC); |
2929 | + } |
2930 | } |
2931 | return err; |
2932 | #else |
2933 | diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c |
2934 | index 896c0562cb42a..e8eebe40e0ae9 100644 |
2935 | --- a/net/sched/sch_cake.c |
2936 | +++ b/net/sched/sch_cake.c |
2937 | @@ -907,7 +907,7 @@ static struct tcphdr *cake_get_tcphdr(const struct sk_buff *skb, |
2938 | } |
2939 | |
2940 | tcph = skb_header_pointer(skb, offset, sizeof(_tcph), &_tcph); |
2941 | - if (!tcph) |
2942 | + if (!tcph || tcph->doff < 5) |
2943 | return NULL; |
2944 | |
2945 | return skb_header_pointer(skb, offset, |
2946 | @@ -931,6 +931,8 @@ static const void *cake_get_tcpopt(const struct tcphdr *tcph, |
2947 | length--; |
2948 | continue; |
2949 | } |
2950 | + if (length < 2) |
2951 | + break; |
2952 | opsize = *ptr++; |
2953 | if (opsize < 2 || opsize > length) |
2954 | break; |
2955 | @@ -1068,6 +1070,8 @@ static bool cake_tcph_may_drop(const struct tcphdr *tcph, |
2956 | length--; |
2957 | continue; |
2958 | } |
2959 | + if (length < 2) |
2960 | + break; |
2961 | opsize = *ptr++; |
2962 | if (opsize < 2 || opsize > length) |
2963 | break; |
2964 | diff --git a/net/socket.c b/net/socket.c |
2965 | index d1a0264401b7f..b14917dd811ad 100644 |
2966 | --- a/net/socket.c |
2967 | +++ b/net/socket.c |
2968 | @@ -1071,19 +1071,6 @@ static long sock_do_ioctl(struct net *net, struct socket *sock, |
2969 | * what to do with it - that's up to the protocol still. |
2970 | */ |
2971 | |
2972 | -/** |
2973 | - * get_net_ns - increment the refcount of the network namespace |
2974 | - * @ns: common namespace (net) |
2975 | - * |
2976 | - * Returns the net's common namespace. |
2977 | - */ |
2978 | - |
2979 | -struct ns_common *get_net_ns(struct ns_common *ns) |
2980 | -{ |
2981 | - return &get_net(container_of(ns, struct net, ns))->ns; |
2982 | -} |
2983 | -EXPORT_SYMBOL_GPL(get_net_ns); |
2984 | - |
2985 | static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
2986 | { |
2987 | struct socket *sock; |
2988 | diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
2989 | index ecadd9e482c46..9f96826eb3ba0 100644 |
2990 | --- a/net/unix/af_unix.c |
2991 | +++ b/net/unix/af_unix.c |
2992 | @@ -537,12 +537,14 @@ static void unix_release_sock(struct sock *sk, int embrion) |
2993 | u->path.mnt = NULL; |
2994 | state = sk->sk_state; |
2995 | sk->sk_state = TCP_CLOSE; |
2996 | + |
2997 | + skpair = unix_peer(sk); |
2998 | + unix_peer(sk) = NULL; |
2999 | + |
3000 | unix_state_unlock(sk); |
3001 | |
3002 | wake_up_interruptible_all(&u->peer_wait); |
3003 | |
3004 | - skpair = unix_peer(sk); |
3005 | - |
3006 | if (skpair != NULL) { |
3007 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { |
3008 | unix_state_lock(skpair); |
3009 | @@ -557,7 +559,6 @@ static void unix_release_sock(struct sock *sk, int embrion) |
3010 | |
3011 | unix_dgram_peer_wake_disconnect(sk, skpair); |
3012 | sock_put(skpair); /* It may now die */ |
3013 | - unix_peer(sk) = NULL; |
3014 | } |
3015 | |
3016 | /* Try to flush out this socket. Throw out buffers at least */ |
3017 | diff --git a/net/wireless/Makefile b/net/wireless/Makefile |
3018 | index 2eee93985ab0d..af590ae606b69 100644 |
3019 | --- a/net/wireless/Makefile |
3020 | +++ b/net/wireless/Makefile |
3021 | @@ -28,7 +28,7 @@ $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex) |
3022 | @$(kecho) " GEN $@" |
3023 | @(echo '#include "reg.h"'; \ |
3024 | echo 'const u8 shipped_regdb_certs[] = {'; \ |
3025 | - cat $^ ; \ |
3026 | + echo | cat - $^ ; \ |
3027 | echo '};'; \ |
3028 | echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \ |
3029 | ) > $@ |
3030 | diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c |
3031 | index c09fbf09549df..0c7bd1f2c55c0 100644 |
3032 | --- a/net/wireless/pmsr.c |
3033 | +++ b/net/wireless/pmsr.c |
3034 | @@ -293,6 +293,7 @@ void cfg80211_pmsr_complete(struct wireless_dev *wdev, |
3035 | gfp_t gfp) |
3036 | { |
3037 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
3038 | + struct cfg80211_pmsr_request *tmp, *prev, *to_free = NULL; |
3039 | struct sk_buff *msg; |
3040 | void *hdr; |
3041 | |
3042 | @@ -323,9 +324,20 @@ free_msg: |
3043 | nlmsg_free(msg); |
3044 | free_request: |
3045 | spin_lock_bh(&wdev->pmsr_lock); |
3046 | - list_del(&req->list); |
3047 | + /* |
3048 | + * cfg80211_pmsr_process_abort() may have already moved this request |
3049 | + * to the free list, and will free it later. In this case, don't free |
3050 | + * it here. |
3051 | + */ |
3052 | + list_for_each_entry_safe(tmp, prev, &wdev->pmsr_list, list) { |
3053 | + if (tmp == req) { |
3054 | + list_del(&req->list); |
3055 | + to_free = req; |
3056 | + break; |
3057 | + } |
3058 | + } |
3059 | spin_unlock_bh(&wdev->pmsr_lock); |
3060 | - kfree(req); |
3061 | + kfree(to_free); |
3062 | } |
3063 | EXPORT_SYMBOL_GPL(cfg80211_pmsr_complete); |
3064 | |
3065 | diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c |
3066 | index afd61599d94c9..a28afb4800603 100644 |
3067 | --- a/sound/soc/codecs/rt5659.c |
3068 | +++ b/sound/soc/codecs/rt5659.c |
3069 | @@ -2470,13 +2470,18 @@ static int set_dmic_power(struct snd_soc_dapm_widget *w, |
3070 | return 0; |
3071 | } |
3072 | |
3073 | -static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = { |
3074 | +static const struct snd_soc_dapm_widget rt5659_particular_dapm_widgets[] = { |
3075 | SND_SOC_DAPM_SUPPLY("LDO2", RT5659_PWR_ANLG_3, RT5659_PWR_LDO2_BIT, 0, |
3076 | NULL, 0), |
3077 | - SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0, |
3078 | - NULL, 0), |
3079 | + SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT, |
3080 | + 0, NULL, 0), |
3081 | SND_SOC_DAPM_SUPPLY("Mic Det Power", RT5659_PWR_VOL, |
3082 | RT5659_PWR_MIC_DET_BIT, 0, NULL, 0), |
3083 | +}; |
3084 | + |
3085 | +static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = { |
3086 | + SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0, |
3087 | + NULL, 0), |
3088 | SND_SOC_DAPM_SUPPLY("Mono Vref", RT5659_PWR_ANLG_1, |
3089 | RT5659_PWR_VREF3_BIT, 0, NULL, 0), |
3090 | |
3091 | @@ -2501,8 +2506,6 @@ static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = { |
3092 | RT5659_ADC_MONO_R_ASRC_SFT, 0, NULL, 0), |
3093 | |
3094 | /* Input Side */ |
3095 | - SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT, |
3096 | - 0, NULL, 0), |
3097 | SND_SOC_DAPM_SUPPLY("MICBIAS2", RT5659_PWR_ANLG_2, RT5659_PWR_MB2_BIT, |
3098 | 0, NULL, 0), |
3099 | SND_SOC_DAPM_SUPPLY("MICBIAS3", RT5659_PWR_ANLG_2, RT5659_PWR_MB3_BIT, |
3100 | @@ -3697,10 +3700,23 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, |
3101 | |
3102 | static int rt5659_probe(struct snd_soc_component *component) |
3103 | { |
3104 | + struct snd_soc_dapm_context *dapm = |
3105 | + snd_soc_component_get_dapm(component); |
3106 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); |
3107 | |
3108 | rt5659->component = component; |
3109 | |
3110 | + switch (rt5659->pdata.jd_src) { |
3111 | + case RT5659_JD_HDA_HEADER: |
3112 | + break; |
3113 | + |
3114 | + default: |
3115 | + snd_soc_dapm_new_controls(dapm, |
3116 | + rt5659_particular_dapm_widgets, |
3117 | + ARRAY_SIZE(rt5659_particular_dapm_widgets)); |
3118 | + break; |
3119 | + } |
3120 | + |
3121 | return 0; |
3122 | } |
3123 | |
3124 | diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h |
3125 | index e7ad9d350a283..60e1241d4b77b 100644 |
3126 | --- a/tools/include/uapi/linux/in.h |
3127 | +++ b/tools/include/uapi/linux/in.h |
3128 | @@ -284,6 +284,9 @@ struct sockaddr_in { |
3129 | /* Address indicating an error return. */ |
3130 | #define INADDR_NONE ((unsigned long int) 0xffffffff) |
3131 | |
3132 | +/* Dummy address for src of ICMP replies if no real address is set (RFC7600). */ |
3133 | +#define INADDR_DUMMY ((unsigned long int) 0xc0000008) |
3134 | + |
3135 | /* Network number for local host loopback. */ |
3136 | #define IN_LOOPBACKNET 127 |
3137 | |
3138 | diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c b/virt/kvm/arm/vgic/vgic-kvm-device.c |
3139 | index 44419679f91ad..5eaede3e3b5a5 100644 |
3140 | --- a/virt/kvm/arm/vgic/vgic-kvm-device.c |
3141 | +++ b/virt/kvm/arm/vgic/vgic-kvm-device.c |
3142 | @@ -87,8 +87,8 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write) |
3143 | r = vgic_v3_set_redist_base(kvm, 0, *addr, 0); |
3144 | goto out; |
3145 | } |
3146 | - rdreg = list_first_entry(&vgic->rd_regions, |
3147 | - struct vgic_redist_region, list); |
3148 | + rdreg = list_first_entry_or_null(&vgic->rd_regions, |
3149 | + struct vgic_redist_region, list); |
3150 | if (!rdreg) |
3151 | addr_ptr = &undef_value; |
3152 | else |