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