1 |
commit: a87b9264e13b01bb71da4838f4fafdc163a1bcc5 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 13 22:06:38 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 13 22:06:38 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a87b9264 |
7 |
|
8 |
proj/linux-patches: Linux patch 4.14.106 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1105_linux-4.14.106.patch | 4923 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4927 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 2892469..cad2a03 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -463,6 +463,10 @@ Patch: 1104_4.14.105.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.105 |
23 |
|
24 |
+Patch: 1105_4.14.106.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.106 |
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/1105_linux-4.14.106.patch b/1105_linux-4.14.106.patch |
33 |
new file mode 100644 |
34 |
index 0000000..fe308ad |
35 |
--- /dev/null |
36 |
+++ b/1105_linux-4.14.106.patch |
37 |
@@ -0,0 +1,4923 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index d5375891a7eb..ecc3a2a82a49 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 105 |
47 |
++SUBLEVEL = 106 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi |
52 |
+index 3ed3d1a0fd40..aa06a02c3ff5 100644 |
53 |
+--- a/arch/arm/boot/dts/exynos3250.dtsi |
54 |
++++ b/arch/arm/boot/dts/exynos3250.dtsi |
55 |
+@@ -172,6 +172,9 @@ |
56 |
+ interrupt-controller; |
57 |
+ #interrupt-cells = <3>; |
58 |
+ interrupt-parent = <&gic>; |
59 |
++ clock-names = "clkout8"; |
60 |
++ clocks = <&cmu CLK_FIN_PLL>; |
61 |
++ #clock-cells = <1>; |
62 |
+ }; |
63 |
+ |
64 |
+ mipi_phy: video-phy { |
65 |
+diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
66 |
+index 102acd78be15..0d516529bf54 100644 |
67 |
+--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
68 |
++++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
69 |
+@@ -60,7 +60,7 @@ |
70 |
+ }; |
71 |
+ |
72 |
+ emmc_pwrseq: pwrseq { |
73 |
+- pinctrl-0 = <&sd1_cd>; |
74 |
++ pinctrl-0 = <&emmc_rstn>; |
75 |
+ pinctrl-names = "default"; |
76 |
+ compatible = "mmc-pwrseq-emmc"; |
77 |
+ reset-gpios = <&gpk1 2 GPIO_ACTIVE_LOW>; |
78 |
+@@ -161,12 +161,6 @@ |
79 |
+ cpu0-supply = <&buck2_reg>; |
80 |
+ }; |
81 |
+ |
82 |
+-/* RSTN signal for eMMC */ |
83 |
+-&sd1_cd { |
84 |
+- samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
85 |
+- samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>; |
86 |
+-}; |
87 |
+- |
88 |
+ &pinctrl_1 { |
89 |
+ gpio_power_key: power_key { |
90 |
+ samsung,pins = "gpx1-3"; |
91 |
+@@ -184,6 +178,11 @@ |
92 |
+ samsung,pins = "gpx3-7"; |
93 |
+ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>; |
94 |
+ }; |
95 |
++ |
96 |
++ emmc_rstn: emmc-rstn { |
97 |
++ samsung,pins = "gpk1-2"; |
98 |
++ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
99 |
++ }; |
100 |
+ }; |
101 |
+ |
102 |
+ &ehci { |
103 |
+diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
104 |
+index 4d61e5b1334a..bcced922b280 100644 |
105 |
+--- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
106 |
++++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
107 |
+@@ -92,7 +92,7 @@ |
108 |
+ interrupts-extended = < |
109 |
+ &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 |
110 |
+ &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 |
111 |
+- &cpcap 48 1 |
112 |
++ &cpcap 48 0 |
113 |
+ >; |
114 |
+ interrupt-names = |
115 |
+ "id_ground", "id_float", "se0conn", "vbusvld", |
116 |
+diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S |
117 |
+index 54c10503d71f..d7dc808a3d15 100644 |
118 |
+--- a/arch/arm/kernel/entry-common.S |
119 |
++++ b/arch/arm/kernel/entry-common.S |
120 |
+@@ -46,6 +46,7 @@ saved_pc .req lr |
121 |
+ * features make this path too inefficient. |
122 |
+ */ |
123 |
+ ret_fast_syscall: |
124 |
++__ret_fast_syscall: |
125 |
+ UNWIND(.fnstart ) |
126 |
+ UNWIND(.cantunwind ) |
127 |
+ disable_irq_notrace @ disable interrupts |
128 |
+@@ -75,6 +76,7 @@ fast_work_pending: |
129 |
+ * r0 first to avoid needing to save registers around each C function call. |
130 |
+ */ |
131 |
+ ret_fast_syscall: |
132 |
++__ret_fast_syscall: |
133 |
+ UNWIND(.fnstart ) |
134 |
+ UNWIND(.cantunwind ) |
135 |
+ str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
136 |
+@@ -241,7 +243,7 @@ local_restart: |
137 |
+ tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? |
138 |
+ bne __sys_trace |
139 |
+ |
140 |
+- invoke_syscall tbl, scno, r10, ret_fast_syscall |
141 |
++ invoke_syscall tbl, scno, r10, __ret_fast_syscall |
142 |
+ |
143 |
+ add r1, sp, #S_OFF |
144 |
+ 2: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE) |
145 |
+diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c |
146 |
+index ba13f793fbce..b92673efffff 100644 |
147 |
+--- a/arch/arm/plat-pxa/ssp.c |
148 |
++++ b/arch/arm/plat-pxa/ssp.c |
149 |
+@@ -237,8 +237,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) |
150 |
+ if (ssp == NULL) |
151 |
+ return -ENODEV; |
152 |
+ |
153 |
+- iounmap(ssp->mmio_base); |
154 |
+- |
155 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
156 |
+ release_mem_region(res->start, resource_size(res)); |
157 |
+ |
158 |
+@@ -248,7 +246,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) |
159 |
+ list_del(&ssp->node); |
160 |
+ mutex_unlock(&ssp_lock); |
161 |
+ |
162 |
+- kfree(ssp); |
163 |
+ return 0; |
164 |
+ } |
165 |
+ |
166 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
167 |
+index 3aee6123d161..6887cc1a743d 100644 |
168 |
+--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
169 |
++++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
170 |
+@@ -118,6 +118,7 @@ |
171 |
+ reset-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; |
172 |
+ clocks = <&pmic>; |
173 |
+ clock-names = "ext_clock"; |
174 |
++ post-power-on-delay-ms = <10>; |
175 |
+ power-off-delay-us = <10>; |
176 |
+ }; |
177 |
+ |
178 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
179 |
+index ab00be277c6f..6f372ec055dd 100644 |
180 |
+--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
181 |
++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
182 |
+@@ -359,7 +359,7 @@ |
183 |
+ }; |
184 |
+ |
185 |
+ intc: interrupt-controller@9bc0000 { |
186 |
+- compatible = "arm,gic-v3"; |
187 |
++ compatible = "qcom,msm8996-gic-v3", "arm,gic-v3"; |
188 |
+ #interrupt-cells = <3>; |
189 |
+ interrupt-controller; |
190 |
+ #redistributor-regions = <1>; |
191 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
192 |
+index 369092e17e34..016b84552a62 100644 |
193 |
+--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
194 |
++++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
195 |
+@@ -937,6 +937,9 @@ |
196 |
+ <&cpg CPG_CORE R8A7796_CLK_S3D1>, |
197 |
+ <&scif_clk>; |
198 |
+ clock-names = "fck", "brg_int", "scif_clk"; |
199 |
++ dmas = <&dmac1 0x13>, <&dmac1 0x12>, |
200 |
++ <&dmac2 0x13>, <&dmac2 0x12>; |
201 |
++ dma-names = "tx", "rx", "tx", "rx"; |
202 |
+ power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; |
203 |
+ resets = <&cpg 310>; |
204 |
+ status = "disabled"; |
205 |
+diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c |
206 |
+index 0417c929d21a..7d8c33279e9f 100644 |
207 |
+--- a/arch/arm64/kernel/probes/kprobes.c |
208 |
++++ b/arch/arm64/kernel/probes/kprobes.c |
209 |
+@@ -554,13 +554,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) |
210 |
+ addr < (unsigned long)__entry_text_end) || |
211 |
+ (addr >= (unsigned long)__idmap_text_start && |
212 |
+ addr < (unsigned long)__idmap_text_end) || |
213 |
++ (addr >= (unsigned long)__hyp_text_start && |
214 |
++ addr < (unsigned long)__hyp_text_end) || |
215 |
+ !!search_exception_tables(addr)) |
216 |
+ return true; |
217 |
+ |
218 |
+ if (!is_kernel_in_hyp_mode()) { |
219 |
+- if ((addr >= (unsigned long)__hyp_text_start && |
220 |
+- addr < (unsigned long)__hyp_text_end) || |
221 |
+- (addr >= (unsigned long)__hyp_idmap_text_start && |
222 |
++ if ((addr >= (unsigned long)__hyp_idmap_text_start && |
223 |
+ addr < (unsigned long)__hyp_idmap_text_end)) |
224 |
+ return true; |
225 |
+ } |
226 |
+diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts |
227 |
+index a4cc52214dbd..dad4aa0ebdd8 100644 |
228 |
+--- a/arch/mips/boot/dts/ingenic/ci20.dts |
229 |
++++ b/arch/mips/boot/dts/ingenic/ci20.dts |
230 |
+@@ -54,7 +54,7 @@ |
231 |
+ status = "okay"; |
232 |
+ |
233 |
+ pinctrl-names = "default"; |
234 |
+- pinctrl-0 = <&pins_uart2>; |
235 |
++ pinctrl-0 = <&pins_uart3>; |
236 |
+ }; |
237 |
+ |
238 |
+ &uart4 { |
239 |
+@@ -174,9 +174,9 @@ |
240 |
+ bias-disable; |
241 |
+ }; |
242 |
+ |
243 |
+- pins_uart2: uart2 { |
244 |
+- function = "uart2"; |
245 |
+- groups = "uart2-data", "uart2-hwflow"; |
246 |
++ pins_uart3: uart3 { |
247 |
++ function = "uart3"; |
248 |
++ groups = "uart3-data", "uart3-hwflow"; |
249 |
+ bias-disable; |
250 |
+ }; |
251 |
+ |
252 |
+diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c |
253 |
+index ba150c755fcc..85b6c60f285d 100644 |
254 |
+--- a/arch/mips/kernel/irq.c |
255 |
++++ b/arch/mips/kernel/irq.c |
256 |
+@@ -52,6 +52,7 @@ asmlinkage void spurious_interrupt(void) |
257 |
+ void __init init_IRQ(void) |
258 |
+ { |
259 |
+ int i; |
260 |
++ unsigned int order = get_order(IRQ_STACK_SIZE); |
261 |
+ |
262 |
+ for (i = 0; i < NR_IRQS; i++) |
263 |
+ irq_set_noprobe(i); |
264 |
+@@ -62,8 +63,7 @@ void __init init_IRQ(void) |
265 |
+ arch_init_irq(); |
266 |
+ |
267 |
+ for_each_possible_cpu(i) { |
268 |
+- int irq_pages = IRQ_STACK_SIZE / PAGE_SIZE; |
269 |
+- void *s = (void *)__get_free_pages(GFP_KERNEL, irq_pages); |
270 |
++ void *s = (void *)__get_free_pages(GFP_KERNEL, order); |
271 |
+ |
272 |
+ irq_stack[i] = s; |
273 |
+ pr_debug("CPU%d IRQ stack at 0x%p - 0x%p\n", i, |
274 |
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
275 |
+index e8b166e9146a..ea563bfea0e1 100644 |
276 |
+--- a/arch/mips/kernel/process.c |
277 |
++++ b/arch/mips/kernel/process.c |
278 |
+@@ -370,7 +370,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size) |
279 |
+ static int get_frame_info(struct mips_frame_info *info) |
280 |
+ { |
281 |
+ bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
282 |
+- union mips_instruction insn, *ip, *ip_end; |
283 |
++ union mips_instruction insn, *ip; |
284 |
+ const unsigned int max_insns = 128; |
285 |
+ unsigned int last_insn_size = 0; |
286 |
+ unsigned int i; |
287 |
+@@ -383,10 +383,9 @@ static int get_frame_info(struct mips_frame_info *info) |
288 |
+ if (!ip) |
289 |
+ goto err; |
290 |
+ |
291 |
+- ip_end = (void *)ip + info->func_size; |
292 |
+- |
293 |
+- for (i = 0; i < max_insns && ip < ip_end; i++) { |
294 |
++ for (i = 0; i < max_insns; i++) { |
295 |
+ ip = (void *)ip + last_insn_size; |
296 |
++ |
297 |
+ if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
298 |
+ insn.word = ip->halfword[0] << 16; |
299 |
+ last_insn_size = 2; |
300 |
+diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c |
301 |
+index e14a39598e8a..65e44f0588e2 100644 |
302 |
+--- a/arch/x86/events/core.c |
303 |
++++ b/arch/x86/events/core.c |
304 |
+@@ -1968,7 +1968,7 @@ static int x86_pmu_commit_txn(struct pmu *pmu) |
305 |
+ */ |
306 |
+ static void free_fake_cpuc(struct cpu_hw_events *cpuc) |
307 |
+ { |
308 |
+- kfree(cpuc->shared_regs); |
309 |
++ intel_cpuc_finish(cpuc); |
310 |
+ kfree(cpuc); |
311 |
+ } |
312 |
+ |
313 |
+@@ -1980,14 +1980,11 @@ static struct cpu_hw_events *allocate_fake_cpuc(void) |
314 |
+ cpuc = kzalloc(sizeof(*cpuc), GFP_KERNEL); |
315 |
+ if (!cpuc) |
316 |
+ return ERR_PTR(-ENOMEM); |
317 |
+- |
318 |
+- /* only needed, if we have extra_regs */ |
319 |
+- if (x86_pmu.extra_regs) { |
320 |
+- cpuc->shared_regs = allocate_shared_regs(cpu); |
321 |
+- if (!cpuc->shared_regs) |
322 |
+- goto error; |
323 |
+- } |
324 |
+ cpuc->is_fake = 1; |
325 |
++ |
326 |
++ if (intel_cpuc_prepare(cpuc, cpu)) |
327 |
++ goto error; |
328 |
++ |
329 |
+ return cpuc; |
330 |
+ error: |
331 |
+ free_fake_cpuc(cpuc); |
332 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
333 |
+index 9f556c94a0b8..65a369a42338 100644 |
334 |
+--- a/arch/x86/events/intel/core.c |
335 |
++++ b/arch/x86/events/intel/core.c |
336 |
+@@ -1995,6 +1995,39 @@ static void intel_pmu_nhm_enable_all(int added) |
337 |
+ intel_pmu_enable_all(added); |
338 |
+ } |
339 |
+ |
340 |
++static void intel_set_tfa(struct cpu_hw_events *cpuc, bool on) |
341 |
++{ |
342 |
++ u64 val = on ? MSR_TFA_RTM_FORCE_ABORT : 0; |
343 |
++ |
344 |
++ if (cpuc->tfa_shadow != val) { |
345 |
++ cpuc->tfa_shadow = val; |
346 |
++ wrmsrl(MSR_TSX_FORCE_ABORT, val); |
347 |
++ } |
348 |
++} |
349 |
++ |
350 |
++static void intel_tfa_commit_scheduling(struct cpu_hw_events *cpuc, int idx, int cntr) |
351 |
++{ |
352 |
++ /* |
353 |
++ * We're going to use PMC3, make sure TFA is set before we touch it. |
354 |
++ */ |
355 |
++ if (cntr == 3 && !cpuc->is_fake) |
356 |
++ intel_set_tfa(cpuc, true); |
357 |
++} |
358 |
++ |
359 |
++static void intel_tfa_pmu_enable_all(int added) |
360 |
++{ |
361 |
++ struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
362 |
++ |
363 |
++ /* |
364 |
++ * If we find PMC3 is no longer used when we enable the PMU, we can |
365 |
++ * clear TFA. |
366 |
++ */ |
367 |
++ if (!test_bit(3, cpuc->active_mask)) |
368 |
++ intel_set_tfa(cpuc, false); |
369 |
++ |
370 |
++ intel_pmu_enable_all(added); |
371 |
++} |
372 |
++ |
373 |
+ static inline u64 intel_pmu_get_status(void) |
374 |
+ { |
375 |
+ u64 status; |
376 |
+@@ -2639,6 +2672,35 @@ intel_stop_scheduling(struct cpu_hw_events *cpuc) |
377 |
+ raw_spin_unlock(&excl_cntrs->lock); |
378 |
+ } |
379 |
+ |
380 |
++static struct event_constraint * |
381 |
++dyn_constraint(struct cpu_hw_events *cpuc, struct event_constraint *c, int idx) |
382 |
++{ |
383 |
++ WARN_ON_ONCE(!cpuc->constraint_list); |
384 |
++ |
385 |
++ if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
386 |
++ struct event_constraint *cx; |
387 |
++ |
388 |
++ /* |
389 |
++ * grab pre-allocated constraint entry |
390 |
++ */ |
391 |
++ cx = &cpuc->constraint_list[idx]; |
392 |
++ |
393 |
++ /* |
394 |
++ * initialize dynamic constraint |
395 |
++ * with static constraint |
396 |
++ */ |
397 |
++ *cx = *c; |
398 |
++ |
399 |
++ /* |
400 |
++ * mark constraint as dynamic |
401 |
++ */ |
402 |
++ cx->flags |= PERF_X86_EVENT_DYNAMIC; |
403 |
++ c = cx; |
404 |
++ } |
405 |
++ |
406 |
++ return c; |
407 |
++} |
408 |
++ |
409 |
+ static struct event_constraint * |
410 |
+ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
411 |
+ int idx, struct event_constraint *c) |
412 |
+@@ -2669,27 +2731,7 @@ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
413 |
+ * only needed when constraint has not yet |
414 |
+ * been cloned (marked dynamic) |
415 |
+ */ |
416 |
+- if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
417 |
+- struct event_constraint *cx; |
418 |
+- |
419 |
+- /* |
420 |
+- * grab pre-allocated constraint entry |
421 |
+- */ |
422 |
+- cx = &cpuc->constraint_list[idx]; |
423 |
+- |
424 |
+- /* |
425 |
+- * initialize dynamic constraint |
426 |
+- * with static constraint |
427 |
+- */ |
428 |
+- *cx = *c; |
429 |
+- |
430 |
+- /* |
431 |
+- * mark constraint as dynamic, so we |
432 |
+- * can free it later on |
433 |
+- */ |
434 |
+- cx->flags |= PERF_X86_EVENT_DYNAMIC; |
435 |
+- c = cx; |
436 |
+- } |
437 |
++ c = dyn_constraint(cpuc, c, idx); |
438 |
+ |
439 |
+ /* |
440 |
+ * From here on, the constraint is dynamic. |
441 |
+@@ -3209,6 +3251,26 @@ glp_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
442 |
+ return c; |
443 |
+ } |
444 |
+ |
445 |
++static bool allow_tsx_force_abort = true; |
446 |
++ |
447 |
++static struct event_constraint * |
448 |
++tfa_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
449 |
++ struct perf_event *event) |
450 |
++{ |
451 |
++ struct event_constraint *c = hsw_get_event_constraints(cpuc, idx, event); |
452 |
++ |
453 |
++ /* |
454 |
++ * Without TFA we must not use PMC3. |
455 |
++ */ |
456 |
++ if (!allow_tsx_force_abort && test_bit(3, c->idxmsk)) { |
457 |
++ c = dyn_constraint(cpuc, c, idx); |
458 |
++ c->idxmsk64 &= ~(1ULL << 3); |
459 |
++ c->weight--; |
460 |
++ } |
461 |
++ |
462 |
++ return c; |
463 |
++} |
464 |
++ |
465 |
+ /* |
466 |
+ * Broadwell: |
467 |
+ * |
468 |
+@@ -3262,7 +3324,7 @@ ssize_t intel_event_sysfs_show(char *page, u64 config) |
469 |
+ return x86_event_sysfs_show(page, config, event); |
470 |
+ } |
471 |
+ |
472 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu) |
473 |
++static struct intel_shared_regs *allocate_shared_regs(int cpu) |
474 |
+ { |
475 |
+ struct intel_shared_regs *regs; |
476 |
+ int i; |
477 |
+@@ -3294,23 +3356,24 @@ static struct intel_excl_cntrs *allocate_excl_cntrs(int cpu) |
478 |
+ return c; |
479 |
+ } |
480 |
+ |
481 |
+-static int intel_pmu_cpu_prepare(int cpu) |
482 |
+-{ |
483 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
484 |
+ |
485 |
++int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu) |
486 |
++{ |
487 |
+ if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) { |
488 |
+ cpuc->shared_regs = allocate_shared_regs(cpu); |
489 |
+ if (!cpuc->shared_regs) |
490 |
+ goto err; |
491 |
+ } |
492 |
+ |
493 |
+- if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
494 |
++ if (x86_pmu.flags & (PMU_FL_EXCL_CNTRS | PMU_FL_TFA)) { |
495 |
+ size_t sz = X86_PMC_IDX_MAX * sizeof(struct event_constraint); |
496 |
+ |
497 |
+- cpuc->constraint_list = kzalloc(sz, GFP_KERNEL); |
498 |
++ cpuc->constraint_list = kzalloc_node(sz, GFP_KERNEL, cpu_to_node(cpu)); |
499 |
+ if (!cpuc->constraint_list) |
500 |
+ goto err_shared_regs; |
501 |
++ } |
502 |
+ |
503 |
++ if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
504 |
+ cpuc->excl_cntrs = allocate_excl_cntrs(cpu); |
505 |
+ if (!cpuc->excl_cntrs) |
506 |
+ goto err_constraint_list; |
507 |
+@@ -3332,6 +3395,11 @@ err: |
508 |
+ return -ENOMEM; |
509 |
+ } |
510 |
+ |
511 |
++static int intel_pmu_cpu_prepare(int cpu) |
512 |
++{ |
513 |
++ return intel_cpuc_prepare(&per_cpu(cpu_hw_events, cpu), cpu); |
514 |
++} |
515 |
++ |
516 |
+ static void flip_smm_bit(void *data) |
517 |
+ { |
518 |
+ unsigned long set = *(unsigned long *)data; |
519 |
+@@ -3403,9 +3471,8 @@ static void intel_pmu_cpu_starting(int cpu) |
520 |
+ } |
521 |
+ } |
522 |
+ |
523 |
+-static void free_excl_cntrs(int cpu) |
524 |
++static void free_excl_cntrs(struct cpu_hw_events *cpuc) |
525 |
+ { |
526 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
527 |
+ struct intel_excl_cntrs *c; |
528 |
+ |
529 |
+ c = cpuc->excl_cntrs; |
530 |
+@@ -3413,9 +3480,10 @@ static void free_excl_cntrs(int cpu) |
531 |
+ if (c->core_id == -1 || --c->refcnt == 0) |
532 |
+ kfree(c); |
533 |
+ cpuc->excl_cntrs = NULL; |
534 |
+- kfree(cpuc->constraint_list); |
535 |
+- cpuc->constraint_list = NULL; |
536 |
+ } |
537 |
++ |
538 |
++ kfree(cpuc->constraint_list); |
539 |
++ cpuc->constraint_list = NULL; |
540 |
+ } |
541 |
+ |
542 |
+ static void intel_pmu_cpu_dying(int cpu) |
543 |
+@@ -3423,9 +3491,8 @@ static void intel_pmu_cpu_dying(int cpu) |
544 |
+ fini_debug_store_on_cpu(cpu); |
545 |
+ } |
546 |
+ |
547 |
+-static void intel_pmu_cpu_dead(int cpu) |
548 |
++void intel_cpuc_finish(struct cpu_hw_events *cpuc) |
549 |
+ { |
550 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
551 |
+ struct intel_shared_regs *pc; |
552 |
+ |
553 |
+ pc = cpuc->shared_regs; |
554 |
+@@ -3435,7 +3502,12 @@ static void intel_pmu_cpu_dead(int cpu) |
555 |
+ cpuc->shared_regs = NULL; |
556 |
+ } |
557 |
+ |
558 |
+- free_excl_cntrs(cpu); |
559 |
++ free_excl_cntrs(cpuc); |
560 |
++} |
561 |
++ |
562 |
++static void intel_pmu_cpu_dead(int cpu) |
563 |
++{ |
564 |
++ intel_cpuc_finish(&per_cpu(cpu_hw_events, cpu)); |
565 |
+ } |
566 |
+ |
567 |
+ static void intel_pmu_sched_task(struct perf_event_context *ctx, |
568 |
+@@ -3896,8 +3968,11 @@ static struct attribute *intel_pmu_caps_attrs[] = { |
569 |
+ NULL |
570 |
+ }; |
571 |
+ |
572 |
++DEVICE_BOOL_ATTR(allow_tsx_force_abort, 0644, allow_tsx_force_abort); |
573 |
++ |
574 |
+ static struct attribute *intel_pmu_attrs[] = { |
575 |
+ &dev_attr_freeze_on_smi.attr, |
576 |
++ NULL, /* &dev_attr_allow_tsx_force_abort.attr.attr */ |
577 |
+ NULL, |
578 |
+ }; |
579 |
+ |
580 |
+@@ -4353,6 +4428,15 @@ __init int intel_pmu_init(void) |
581 |
+ x86_pmu.cpu_events = get_hsw_events_attrs(); |
582 |
+ intel_pmu_pebs_data_source_skl( |
583 |
+ boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); |
584 |
++ |
585 |
++ if (boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)) { |
586 |
++ x86_pmu.flags |= PMU_FL_TFA; |
587 |
++ x86_pmu.get_event_constraints = tfa_get_event_constraints; |
588 |
++ x86_pmu.enable_all = intel_tfa_pmu_enable_all; |
589 |
++ x86_pmu.commit_scheduling = intel_tfa_commit_scheduling; |
590 |
++ intel_pmu_attrs[1] = &dev_attr_allow_tsx_force_abort.attr.attr; |
591 |
++ } |
592 |
++ |
593 |
+ pr_cont("Skylake events, "); |
594 |
+ name = "skylake"; |
595 |
+ break; |
596 |
+@@ -4494,7 +4578,7 @@ static __init int fixup_ht_bug(void) |
597 |
+ hardlockup_detector_perf_restart(); |
598 |
+ |
599 |
+ for_each_online_cpu(c) |
600 |
+- free_excl_cntrs(c); |
601 |
++ free_excl_cntrs(&per_cpu(cpu_hw_events, c)); |
602 |
+ |
603 |
+ cpus_read_unlock(); |
604 |
+ pr_info("PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off\n"); |
605 |
+diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
606 |
+index fbbc10338987..9702f4ed4748 100644 |
607 |
+--- a/arch/x86/events/perf_event.h |
608 |
++++ b/arch/x86/events/perf_event.h |
609 |
+@@ -238,6 +238,11 @@ struct cpu_hw_events { |
610 |
+ struct intel_excl_cntrs *excl_cntrs; |
611 |
+ int excl_thread_id; /* 0 or 1 */ |
612 |
+ |
613 |
++ /* |
614 |
++ * SKL TSX_FORCE_ABORT shadow |
615 |
++ */ |
616 |
++ u64 tfa_shadow; |
617 |
++ |
618 |
+ /* |
619 |
+ * AMD specific bits |
620 |
+ */ |
621 |
+@@ -672,6 +677,7 @@ do { \ |
622 |
+ #define PMU_FL_HAS_RSP_1 0x2 /* has 2 equivalent offcore_rsp regs */ |
623 |
+ #define PMU_FL_EXCL_CNTRS 0x4 /* has exclusive counter requirements */ |
624 |
+ #define PMU_FL_EXCL_ENABLED 0x8 /* exclusive counter active */ |
625 |
++#define PMU_FL_TFA 0x20 /* deal with TSX force abort */ |
626 |
+ |
627 |
+ #define EVENT_VAR(_id) event_attr_##_id |
628 |
+ #define EVENT_PTR(_id) &event_attr_##_id.attr.attr |
629 |
+@@ -880,7 +886,8 @@ struct event_constraint * |
630 |
+ x86_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
631 |
+ struct perf_event *event); |
632 |
+ |
633 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu); |
634 |
++extern int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu); |
635 |
++extern void intel_cpuc_finish(struct cpu_hw_events *cpuc); |
636 |
+ |
637 |
+ int intel_pmu_init(void); |
638 |
+ |
639 |
+@@ -1014,9 +1021,13 @@ static inline int intel_pmu_init(void) |
640 |
+ return 0; |
641 |
+ } |
642 |
+ |
643 |
+-static inline struct intel_shared_regs *allocate_shared_regs(int cpu) |
644 |
++static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu) |
645 |
++{ |
646 |
++ return 0; |
647 |
++} |
648 |
++ |
649 |
++static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc) |
650 |
+ { |
651 |
+- return NULL; |
652 |
+ } |
653 |
+ |
654 |
+ static inline int is_ht_workaround_enabled(void) |
655 |
+diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h |
656 |
+index 7d910827126b..e90940ecb436 100644 |
657 |
+--- a/arch/x86/include/asm/cpufeatures.h |
658 |
++++ b/arch/x86/include/asm/cpufeatures.h |
659 |
+@@ -339,6 +339,7 @@ |
660 |
+ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ |
661 |
+ #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ |
662 |
+ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ |
663 |
++#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ |
664 |
+ #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ |
665 |
+ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
666 |
+ #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ |
667 |
+diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h |
668 |
+index fed3636dce9a..b0df002c60df 100644 |
669 |
+--- a/arch/x86/include/asm/msr-index.h |
670 |
++++ b/arch/x86/include/asm/msr-index.h |
671 |
+@@ -610,6 +610,12 @@ |
672 |
+ |
673 |
+ #define MSR_IA32_TSC_DEADLINE 0x000006E0 |
674 |
+ |
675 |
++ |
676 |
++#define MSR_TSX_FORCE_ABORT 0x0000010F |
677 |
++ |
678 |
++#define MSR_TFA_RTM_FORCE_ABORT_BIT 0 |
679 |
++#define MSR_TFA_RTM_FORCE_ABORT BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT) |
680 |
++ |
681 |
+ /* P4/Xeon+ specific */ |
682 |
+ #define MSR_IA32_MCG_EAX 0x00000180 |
683 |
+ #define MSR_IA32_MCG_EBX 0x00000181 |
684 |
+diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h |
685 |
+index 74d531f6d518..50c8baaca4b0 100644 |
686 |
+--- a/arch/x86/include/asm/page_64_types.h |
687 |
++++ b/arch/x86/include/asm/page_64_types.h |
688 |
+@@ -7,7 +7,11 @@ |
689 |
+ #endif |
690 |
+ |
691 |
+ #ifdef CONFIG_KASAN |
692 |
++#ifdef CONFIG_KASAN_EXTRA |
693 |
++#define KASAN_STACK_ORDER 2 |
694 |
++#else |
695 |
+ #define KASAN_STACK_ORDER 1 |
696 |
++#endif |
697 |
+ #else |
698 |
+ #define KASAN_STACK_ORDER 0 |
699 |
+ #endif |
700 |
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
701 |
+index 7e03515662c0..ecf82859f1c0 100644 |
702 |
+--- a/arch/x86/kernel/cpu/amd.c |
703 |
++++ b/arch/x86/kernel/cpu/amd.c |
704 |
+@@ -791,11 +791,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c) |
705 |
+ static void init_amd_zn(struct cpuinfo_x86 *c) |
706 |
+ { |
707 |
+ set_cpu_cap(c, X86_FEATURE_ZEN); |
708 |
+- /* |
709 |
+- * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects |
710 |
+- * all up to and including B1. |
711 |
+- */ |
712 |
+- if (c->x86_model <= 1 && c->x86_stepping <= 1) |
713 |
++ |
714 |
++ /* Fix erratum 1076: CPB feature bit not being set in CPUID. */ |
715 |
++ if (!cpu_has(c, X86_FEATURE_CPB)) |
716 |
+ set_cpu_cap(c, X86_FEATURE_CPB); |
717 |
+ } |
718 |
+ |
719 |
+diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c |
720 |
+index 9d33dbf2489e..d0a61d3e2fb9 100644 |
721 |
+--- a/arch/x86/kernel/cpu/microcode/amd.c |
722 |
++++ b/arch/x86/kernel/cpu/microcode/amd.c |
723 |
+@@ -707,7 +707,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) |
724 |
+ if (!p) { |
725 |
+ return ret; |
726 |
+ } else { |
727 |
+- if (boot_cpu_data.microcode == p->patch_id) |
728 |
++ if (boot_cpu_data.microcode >= p->patch_id) |
729 |
+ return ret; |
730 |
+ |
731 |
+ ret = UCODE_NEW; |
732 |
+diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c |
733 |
+index 928b0c6083c9..4d948d87f01c 100644 |
734 |
+--- a/arch/x86/kernel/kexec-bzimage64.c |
735 |
++++ b/arch/x86/kernel/kexec-bzimage64.c |
736 |
+@@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, |
737 |
+ struct efi_info *current_ei = &boot_params.efi_info; |
738 |
+ struct efi_info *ei = ¶ms->efi_info; |
739 |
+ |
740 |
++ if (!efi_enabled(EFI_RUNTIME_SERVICES)) |
741 |
++ return 0; |
742 |
++ |
743 |
+ if (!current_ei->efi_memmap_size) |
744 |
+ return 0; |
745 |
+ |
746 |
+diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig |
747 |
+index 14e3ca353ac8..5035b86a2e49 100644 |
748 |
+--- a/arch/xtensa/configs/smp_lx200_defconfig |
749 |
++++ b/arch/xtensa/configs/smp_lx200_defconfig |
750 |
+@@ -34,6 +34,7 @@ CONFIG_SMP=y |
751 |
+ CONFIG_HOTPLUG_CPU=y |
752 |
+ # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set |
753 |
+ # CONFIG_PCI is not set |
754 |
++CONFIG_VECTORS_OFFSET=0x00002000 |
755 |
+ CONFIG_XTENSA_PLATFORM_XTFPGA=y |
756 |
+ CONFIG_CMDLINE_BOOL=y |
757 |
+ CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" |
758 |
+diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S |
759 |
+index 27c8e07ace43..29f445b410b3 100644 |
760 |
+--- a/arch/xtensa/kernel/head.S |
761 |
++++ b/arch/xtensa/kernel/head.S |
762 |
+@@ -281,12 +281,13 @@ should_never_return: |
763 |
+ |
764 |
+ movi a2, cpu_start_ccount |
765 |
+ 1: |
766 |
++ memw |
767 |
+ l32i a3, a2, 0 |
768 |
+ beqi a3, 0, 1b |
769 |
+ movi a3, 0 |
770 |
+ s32i a3, a2, 0 |
771 |
+- memw |
772 |
+ 1: |
773 |
++ memw |
774 |
+ l32i a3, a2, 0 |
775 |
+ beqi a3, 0, 1b |
776 |
+ wsr a3, ccount |
777 |
+@@ -323,11 +324,13 @@ ENTRY(cpu_restart) |
778 |
+ rsr a0, prid |
779 |
+ neg a2, a0 |
780 |
+ movi a3, cpu_start_id |
781 |
++ memw |
782 |
+ s32i a2, a3, 0 |
783 |
+ #if XCHAL_DCACHE_IS_WRITEBACK |
784 |
+ dhwbi a3, 0 |
785 |
+ #endif |
786 |
+ 1: |
787 |
++ memw |
788 |
+ l32i a2, a3, 0 |
789 |
+ dhi a3, 0 |
790 |
+ bne a2, a0, 1b |
791 |
+diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c |
792 |
+index f1c46bc5d465..e48a2137e87a 100644 |
793 |
+--- a/arch/xtensa/kernel/process.c |
794 |
++++ b/arch/xtensa/kernel/process.c |
795 |
+@@ -314,8 +314,8 @@ unsigned long get_wchan(struct task_struct *p) |
796 |
+ |
797 |
+ /* Stack layout: sp-4: ra, sp-3: sp' */ |
798 |
+ |
799 |
+- pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp); |
800 |
+- sp = *(unsigned long *)sp - 3; |
801 |
++ pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp); |
802 |
++ sp = SPILL_SLOT(sp, 1); |
803 |
+ } while (count++ < 16); |
804 |
+ return 0; |
805 |
+ } |
806 |
+diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c |
807 |
+index 932d64689bac..be1f280c322c 100644 |
808 |
+--- a/arch/xtensa/kernel/smp.c |
809 |
++++ b/arch/xtensa/kernel/smp.c |
810 |
+@@ -83,7 +83,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) |
811 |
+ { |
812 |
+ unsigned i; |
813 |
+ |
814 |
+- for (i = 0; i < max_cpus; ++i) |
815 |
++ for_each_possible_cpu(i) |
816 |
+ set_cpu_present(i, true); |
817 |
+ } |
818 |
+ |
819 |
+@@ -96,6 +96,11 @@ void __init smp_init_cpus(void) |
820 |
+ pr_info("%s: Core Count = %d\n", __func__, ncpus); |
821 |
+ pr_info("%s: Core Id = %d\n", __func__, core_id); |
822 |
+ |
823 |
++ if (ncpus > NR_CPUS) { |
824 |
++ ncpus = NR_CPUS; |
825 |
++ pr_info("%s: limiting core count by %d\n", __func__, ncpus); |
826 |
++ } |
827 |
++ |
828 |
+ for (i = 0; i < ncpus; ++i) |
829 |
+ set_cpu_possible(i, true); |
830 |
+ } |
831 |
+@@ -195,9 +200,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) |
832 |
+ int i; |
833 |
+ |
834 |
+ #ifdef CONFIG_HOTPLUG_CPU |
835 |
+- cpu_start_id = cpu; |
836 |
+- system_flush_invalidate_dcache_range( |
837 |
+- (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); |
838 |
++ WRITE_ONCE(cpu_start_id, cpu); |
839 |
++ /* Pairs with the third memw in the cpu_restart */ |
840 |
++ mb(); |
841 |
++ system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id, |
842 |
++ sizeof(cpu_start_id)); |
843 |
+ #endif |
844 |
+ smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); |
845 |
+ |
846 |
+@@ -206,18 +213,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) |
847 |
+ ccount = get_ccount(); |
848 |
+ while (!ccount); |
849 |
+ |
850 |
+- cpu_start_ccount = ccount; |
851 |
++ WRITE_ONCE(cpu_start_ccount, ccount); |
852 |
+ |
853 |
+- while (time_before(jiffies, timeout)) { |
854 |
++ do { |
855 |
++ /* |
856 |
++ * Pairs with the first two memws in the |
857 |
++ * .Lboot_secondary. |
858 |
++ */ |
859 |
+ mb(); |
860 |
+- if (!cpu_start_ccount) |
861 |
+- break; |
862 |
+- } |
863 |
++ ccount = READ_ONCE(cpu_start_ccount); |
864 |
++ } while (ccount && time_before(jiffies, timeout)); |
865 |
+ |
866 |
+- if (cpu_start_ccount) { |
867 |
++ if (ccount) { |
868 |
+ smp_call_function_single(0, mx_cpu_stop, |
869 |
+- (void *)cpu, 1); |
870 |
+- cpu_start_ccount = 0; |
871 |
++ (void *)cpu, 1); |
872 |
++ WRITE_ONCE(cpu_start_ccount, 0); |
873 |
+ return -EIO; |
874 |
+ } |
875 |
+ } |
876 |
+@@ -237,6 +247,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) |
877 |
+ pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", |
878 |
+ __func__, cpu, idle, start_info.stack); |
879 |
+ |
880 |
++ init_completion(&cpu_running); |
881 |
+ ret = boot_secondary(cpu, idle); |
882 |
+ if (ret == 0) { |
883 |
+ wait_for_completion_timeout(&cpu_running, |
884 |
+@@ -298,8 +309,10 @@ void __cpu_die(unsigned int cpu) |
885 |
+ unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
886 |
+ while (time_before(jiffies, timeout)) { |
887 |
+ system_invalidate_dcache_range((unsigned long)&cpu_start_id, |
888 |
+- sizeof(cpu_start_id)); |
889 |
+- if (cpu_start_id == -cpu) { |
890 |
++ sizeof(cpu_start_id)); |
891 |
++ /* Pairs with the second memw in the cpu_restart */ |
892 |
++ mb(); |
893 |
++ if (READ_ONCE(cpu_start_id) == -cpu) { |
894 |
+ platform_cpu_kill(cpu); |
895 |
+ return; |
896 |
+ } |
897 |
+diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c |
898 |
+index fd524a54d2ab..378186b5eb40 100644 |
899 |
+--- a/arch/xtensa/kernel/time.c |
900 |
++++ b/arch/xtensa/kernel/time.c |
901 |
+@@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) |
902 |
+ container_of(evt, struct ccount_timer, evt); |
903 |
+ |
904 |
+ if (timer->irq_enabled) { |
905 |
+- disable_irq(evt->irq); |
906 |
++ disable_irq_nosync(evt->irq); |
907 |
+ timer->irq_enabled = 0; |
908 |
+ } |
909 |
+ return 0; |
910 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
911 |
+index d928cc6d0638..cb3672cfdaaa 100644 |
912 |
+--- a/drivers/base/dd.c |
913 |
++++ b/drivers/base/dd.c |
914 |
+@@ -850,9 +850,9 @@ static void __device_release_driver(struct device *dev, struct device *parent) |
915 |
+ drv->remove(dev); |
916 |
+ |
917 |
+ device_links_driver_cleanup(dev); |
918 |
+- dma_deconfigure(dev); |
919 |
+ |
920 |
+ devres_release_all(dev); |
921 |
++ dma_deconfigure(dev); |
922 |
+ dev->driver = NULL; |
923 |
+ dev_set_drvdata(dev, NULL); |
924 |
+ if (dev->pm_domain && dev->pm_domain->dismiss) |
925 |
+diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c |
926 |
+index c0a5b1f3a986..4ccc39e00ced 100644 |
927 |
+--- a/drivers/char/applicom.c |
928 |
++++ b/drivers/char/applicom.c |
929 |
+@@ -32,6 +32,7 @@ |
930 |
+ #include <linux/wait.h> |
931 |
+ #include <linux/init.h> |
932 |
+ #include <linux/fs.h> |
933 |
++#include <linux/nospec.h> |
934 |
+ |
935 |
+ #include <asm/io.h> |
936 |
+ #include <linux/uaccess.h> |
937 |
+@@ -386,7 +387,11 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, |
938 |
+ TicCard = st_loc.tic_des_from_pc; /* tic number to send */ |
939 |
+ IndexCard = NumCard - 1; |
940 |
+ |
941 |
+- if((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO) |
942 |
++ if (IndexCard >= MAX_BOARD) |
943 |
++ return -EINVAL; |
944 |
++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD); |
945 |
++ |
946 |
++ if (!apbs[IndexCard].RamIO) |
947 |
+ return -EINVAL; |
948 |
+ |
949 |
+ #ifdef DEBUG |
950 |
+@@ -697,6 +702,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
951 |
+ unsigned char IndexCard; |
952 |
+ void __iomem *pmem; |
953 |
+ int ret = 0; |
954 |
++ static int warncount = 10; |
955 |
+ volatile unsigned char byte_reset_it; |
956 |
+ struct st_ram_io *adgl; |
957 |
+ void __user *argp = (void __user *)arg; |
958 |
+@@ -711,16 +717,12 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
959 |
+ mutex_lock(&ac_mutex); |
960 |
+ IndexCard = adgl->num_card-1; |
961 |
+ |
962 |
+- if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { |
963 |
+- static int warncount = 10; |
964 |
+- if (warncount) { |
965 |
+- printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1); |
966 |
+- warncount--; |
967 |
+- } |
968 |
+- kfree(adgl); |
969 |
+- mutex_unlock(&ac_mutex); |
970 |
+- return -EINVAL; |
971 |
+- } |
972 |
++ if (cmd != 6 && IndexCard >= MAX_BOARD) |
973 |
++ goto err; |
974 |
++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD); |
975 |
++ |
976 |
++ if (cmd != 6 && !apbs[IndexCard].RamIO) |
977 |
++ goto err; |
978 |
+ |
979 |
+ switch (cmd) { |
980 |
+ |
981 |
+@@ -838,5 +840,16 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
982 |
+ kfree(adgl); |
983 |
+ mutex_unlock(&ac_mutex); |
984 |
+ return 0; |
985 |
++ |
986 |
++err: |
987 |
++ if (warncount) { |
988 |
++ pr_warn("APPLICOM driver IOCTL, bad board number %d\n", |
989 |
++ (int)IndexCard + 1); |
990 |
++ warncount--; |
991 |
++ } |
992 |
++ kfree(adgl); |
993 |
++ mutex_unlock(&ac_mutex); |
994 |
++ return -EINVAL; |
995 |
++ |
996 |
+ } |
997 |
+ |
998 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
999 |
+index 66c2790dcc5f..9f5c51cd67ad 100644 |
1000 |
+--- a/drivers/cpufreq/cpufreq.c |
1001 |
++++ b/drivers/cpufreq/cpufreq.c |
1002 |
+@@ -554,13 +554,13 @@ EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us); |
1003 |
+ * SYSFS INTERFACE * |
1004 |
+ *********************************************************************/ |
1005 |
+ static ssize_t show_boost(struct kobject *kobj, |
1006 |
+- struct attribute *attr, char *buf) |
1007 |
++ struct kobj_attribute *attr, char *buf) |
1008 |
+ { |
1009 |
+ return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); |
1010 |
+ } |
1011 |
+ |
1012 |
+-static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, |
1013 |
+- const char *buf, size_t count) |
1014 |
++static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr, |
1015 |
++ const char *buf, size_t count) |
1016 |
+ { |
1017 |
+ int ret, enable; |
1018 |
+ |
1019 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
1020 |
+index 114dfe67015b..5ebefa17d195 100644 |
1021 |
+--- a/drivers/cpufreq/intel_pstate.c |
1022 |
++++ b/drivers/cpufreq/intel_pstate.c |
1023 |
+@@ -811,7 +811,7 @@ static void intel_pstate_update_policies(void) |
1024 |
+ /************************** sysfs begin ************************/ |
1025 |
+ #define show_one(file_name, object) \ |
1026 |
+ static ssize_t show_##file_name \ |
1027 |
+- (struct kobject *kobj, struct attribute *attr, char *buf) \ |
1028 |
++ (struct kobject *kobj, struct kobj_attribute *attr, char *buf) \ |
1029 |
+ { \ |
1030 |
+ return sprintf(buf, "%u\n", global.object); \ |
1031 |
+ } |
1032 |
+@@ -820,7 +820,7 @@ static ssize_t intel_pstate_show_status(char *buf); |
1033 |
+ static int intel_pstate_update_status(const char *buf, size_t size); |
1034 |
+ |
1035 |
+ static ssize_t show_status(struct kobject *kobj, |
1036 |
+- struct attribute *attr, char *buf) |
1037 |
++ struct kobj_attribute *attr, char *buf) |
1038 |
+ { |
1039 |
+ ssize_t ret; |
1040 |
+ |
1041 |
+@@ -831,7 +831,7 @@ static ssize_t show_status(struct kobject *kobj, |
1042 |
+ return ret; |
1043 |
+ } |
1044 |
+ |
1045 |
+-static ssize_t store_status(struct kobject *a, struct attribute *b, |
1046 |
++static ssize_t store_status(struct kobject *a, struct kobj_attribute *b, |
1047 |
+ const char *buf, size_t count) |
1048 |
+ { |
1049 |
+ char *p = memchr(buf, '\n', count); |
1050 |
+@@ -845,7 +845,7 @@ static ssize_t store_status(struct kobject *a, struct attribute *b, |
1051 |
+ } |
1052 |
+ |
1053 |
+ static ssize_t show_turbo_pct(struct kobject *kobj, |
1054 |
+- struct attribute *attr, char *buf) |
1055 |
++ struct kobj_attribute *attr, char *buf) |
1056 |
+ { |
1057 |
+ struct cpudata *cpu; |
1058 |
+ int total, no_turbo, turbo_pct; |
1059 |
+@@ -871,7 +871,7 @@ static ssize_t show_turbo_pct(struct kobject *kobj, |
1060 |
+ } |
1061 |
+ |
1062 |
+ static ssize_t show_num_pstates(struct kobject *kobj, |
1063 |
+- struct attribute *attr, char *buf) |
1064 |
++ struct kobj_attribute *attr, char *buf) |
1065 |
+ { |
1066 |
+ struct cpudata *cpu; |
1067 |
+ int total; |
1068 |
+@@ -892,7 +892,7 @@ static ssize_t show_num_pstates(struct kobject *kobj, |
1069 |
+ } |
1070 |
+ |
1071 |
+ static ssize_t show_no_turbo(struct kobject *kobj, |
1072 |
+- struct attribute *attr, char *buf) |
1073 |
++ struct kobj_attribute *attr, char *buf) |
1074 |
+ { |
1075 |
+ ssize_t ret; |
1076 |
+ |
1077 |
+@@ -914,7 +914,7 @@ static ssize_t show_no_turbo(struct kobject *kobj, |
1078 |
+ return ret; |
1079 |
+ } |
1080 |
+ |
1081 |
+-static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, |
1082 |
++static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, |
1083 |
+ const char *buf, size_t count) |
1084 |
+ { |
1085 |
+ unsigned int input; |
1086 |
+@@ -961,7 +961,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, |
1087 |
+ return count; |
1088 |
+ } |
1089 |
+ |
1090 |
+-static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, |
1091 |
++static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b, |
1092 |
+ const char *buf, size_t count) |
1093 |
+ { |
1094 |
+ unsigned int input; |
1095 |
+@@ -991,7 +991,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, |
1096 |
+ return count; |
1097 |
+ } |
1098 |
+ |
1099 |
+-static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, |
1100 |
++static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b, |
1101 |
+ const char *buf, size_t count) |
1102 |
+ { |
1103 |
+ unsigned int input; |
1104 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
1105 |
+index 94236ec9d410..4db2cd1c611d 100644 |
1106 |
+--- a/drivers/dma/at_xdmac.c |
1107 |
++++ b/drivers/dma/at_xdmac.c |
1108 |
+@@ -203,6 +203,7 @@ struct at_xdmac_chan { |
1109 |
+ u32 save_cim; |
1110 |
+ u32 save_cnda; |
1111 |
+ u32 save_cndc; |
1112 |
++ u32 irq_status; |
1113 |
+ unsigned long status; |
1114 |
+ struct tasklet_struct tasklet; |
1115 |
+ struct dma_slave_config sconfig; |
1116 |
+@@ -1580,8 +1581,8 @@ static void at_xdmac_tasklet(unsigned long data) |
1117 |
+ struct at_xdmac_desc *desc; |
1118 |
+ u32 error_mask; |
1119 |
+ |
1120 |
+- dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", |
1121 |
+- __func__, atchan->status); |
1122 |
++ dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
1123 |
++ __func__, atchan->irq_status); |
1124 |
+ |
1125 |
+ error_mask = AT_XDMAC_CIS_RBEIS |
1126 |
+ | AT_XDMAC_CIS_WBEIS |
1127 |
+@@ -1589,15 +1590,15 @@ static void at_xdmac_tasklet(unsigned long data) |
1128 |
+ |
1129 |
+ if (at_xdmac_chan_is_cyclic(atchan)) { |
1130 |
+ at_xdmac_handle_cyclic(atchan); |
1131 |
+- } else if ((atchan->status & AT_XDMAC_CIS_LIS) |
1132 |
+- || (atchan->status & error_mask)) { |
1133 |
++ } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
1134 |
++ || (atchan->irq_status & error_mask)) { |
1135 |
+ struct dma_async_tx_descriptor *txd; |
1136 |
+ |
1137 |
+- if (atchan->status & AT_XDMAC_CIS_RBEIS) |
1138 |
++ if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
1139 |
+ dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
1140 |
+- if (atchan->status & AT_XDMAC_CIS_WBEIS) |
1141 |
++ if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
1142 |
+ dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
1143 |
+- if (atchan->status & AT_XDMAC_CIS_ROIS) |
1144 |
++ if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
1145 |
+ dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
1146 |
+ |
1147 |
+ spin_lock_bh(&atchan->lock); |
1148 |
+@@ -1652,7 +1653,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) |
1149 |
+ atchan = &atxdmac->chan[i]; |
1150 |
+ chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
1151 |
+ chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
1152 |
+- atchan->status = chan_status & chan_imr; |
1153 |
++ atchan->irq_status = chan_status & chan_imr; |
1154 |
+ dev_vdbg(atxdmac->dma.dev, |
1155 |
+ "%s: chan%d: imr=0x%x, status=0x%x\n", |
1156 |
+ __func__, i, chan_imr, chan_status); |
1157 |
+@@ -1666,7 +1667,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) |
1158 |
+ at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
1159 |
+ at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
1160 |
+ |
1161 |
+- if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
1162 |
++ if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
1163 |
+ at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
1164 |
+ |
1165 |
+ tasklet_schedule(&atchan->tasklet); |
1166 |
+diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c |
1167 |
+index 80cc2be6483c..e39336127741 100644 |
1168 |
+--- a/drivers/dma/dmatest.c |
1169 |
++++ b/drivers/dma/dmatest.c |
1170 |
+@@ -626,11 +626,9 @@ static int dmatest_func(void *data) |
1171 |
+ srcs[i] = um->addr[i] + src_off; |
1172 |
+ ret = dma_mapping_error(dev->dev, um->addr[i]); |
1173 |
+ if (ret) { |
1174 |
+- dmaengine_unmap_put(um); |
1175 |
+ result("src mapping error", total_tests, |
1176 |
+ src_off, dst_off, len, ret); |
1177 |
+- failed_tests++; |
1178 |
+- continue; |
1179 |
++ goto error_unmap_continue; |
1180 |
+ } |
1181 |
+ um->to_cnt++; |
1182 |
+ } |
1183 |
+@@ -645,11 +643,9 @@ static int dmatest_func(void *data) |
1184 |
+ DMA_BIDIRECTIONAL); |
1185 |
+ ret = dma_mapping_error(dev->dev, dsts[i]); |
1186 |
+ if (ret) { |
1187 |
+- dmaengine_unmap_put(um); |
1188 |
+ result("dst mapping error", total_tests, |
1189 |
+ src_off, dst_off, len, ret); |
1190 |
+- failed_tests++; |
1191 |
+- continue; |
1192 |
++ goto error_unmap_continue; |
1193 |
+ } |
1194 |
+ um->bidi_cnt++; |
1195 |
+ } |
1196 |
+@@ -679,12 +675,10 @@ static int dmatest_func(void *data) |
1197 |
+ } |
1198 |
+ |
1199 |
+ if (!tx) { |
1200 |
+- dmaengine_unmap_put(um); |
1201 |
+ result("prep error", total_tests, src_off, |
1202 |
+ dst_off, len, ret); |
1203 |
+ msleep(100); |
1204 |
+- failed_tests++; |
1205 |
+- continue; |
1206 |
++ goto error_unmap_continue; |
1207 |
+ } |
1208 |
+ |
1209 |
+ done->done = false; |
1210 |
+@@ -693,12 +687,10 @@ static int dmatest_func(void *data) |
1211 |
+ cookie = tx->tx_submit(tx); |
1212 |
+ |
1213 |
+ if (dma_submit_error(cookie)) { |
1214 |
+- dmaengine_unmap_put(um); |
1215 |
+ result("submit error", total_tests, src_off, |
1216 |
+ dst_off, len, ret); |
1217 |
+ msleep(100); |
1218 |
+- failed_tests++; |
1219 |
+- continue; |
1220 |
++ goto error_unmap_continue; |
1221 |
+ } |
1222 |
+ dma_async_issue_pending(chan); |
1223 |
+ |
1224 |
+@@ -711,16 +703,14 @@ static int dmatest_func(void *data) |
1225 |
+ dmaengine_unmap_put(um); |
1226 |
+ result("test timed out", total_tests, src_off, dst_off, |
1227 |
+ len, 0); |
1228 |
+- failed_tests++; |
1229 |
+- continue; |
1230 |
++ goto error_unmap_continue; |
1231 |
+ } else if (status != DMA_COMPLETE) { |
1232 |
+ dmaengine_unmap_put(um); |
1233 |
+ result(status == DMA_ERROR ? |
1234 |
+ "completion error status" : |
1235 |
+ "completion busy status", total_tests, src_off, |
1236 |
+ dst_off, len, ret); |
1237 |
+- failed_tests++; |
1238 |
+- continue; |
1239 |
++ goto error_unmap_continue; |
1240 |
+ } |
1241 |
+ |
1242 |
+ dmaengine_unmap_put(um); |
1243 |
+@@ -765,6 +755,12 @@ static int dmatest_func(void *data) |
1244 |
+ verbose_result("test passed", total_tests, src_off, |
1245 |
+ dst_off, len, 0); |
1246 |
+ } |
1247 |
++ |
1248 |
++ continue; |
1249 |
++ |
1250 |
++error_unmap_continue: |
1251 |
++ dmaengine_unmap_put(um); |
1252 |
++ failed_tests++; |
1253 |
+ } |
1254 |
+ ktime = ktime_sub(ktime_get(), ktime); |
1255 |
+ ktime = ktime_sub(ktime, comparetime); |
1256 |
+diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c |
1257 |
+index 14042a64bdd5..132b9bae4b6a 100644 |
1258 |
+--- a/drivers/firmware/iscsi_ibft.c |
1259 |
++++ b/drivers/firmware/iscsi_ibft.c |
1260 |
+@@ -542,6 +542,7 @@ static umode_t __init ibft_check_tgt_for(void *data, int type) |
1261 |
+ case ISCSI_BOOT_TGT_NIC_ASSOC: |
1262 |
+ case ISCSI_BOOT_TGT_CHAP_TYPE: |
1263 |
+ rc = S_IRUGO; |
1264 |
++ break; |
1265 |
+ case ISCSI_BOOT_TGT_NAME: |
1266 |
+ if (tgt->tgt_name_len) |
1267 |
+ rc = S_IRUGO; |
1268 |
+diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c |
1269 |
+index cbe9e06861de..1309b444720e 100644 |
1270 |
+--- a/drivers/gpio/gpio-vf610.c |
1271 |
++++ b/drivers/gpio/gpio-vf610.c |
1272 |
+@@ -261,6 +261,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) |
1273 |
+ struct vf610_gpio_port *port; |
1274 |
+ struct resource *iores; |
1275 |
+ struct gpio_chip *gc; |
1276 |
++ int i; |
1277 |
+ int ret; |
1278 |
+ |
1279 |
+ port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
1280 |
+@@ -300,6 +301,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) |
1281 |
+ if (ret < 0) |
1282 |
+ return ret; |
1283 |
+ |
1284 |
++ /* Mask all GPIO interrupts */ |
1285 |
++ for (i = 0; i < gc->ngpio; i++) |
1286 |
++ vf610_gpio_writel(0, port->base + PORT_PCR(i)); |
1287 |
++ |
1288 |
+ /* Clear the interrupt status register for all GPIO's */ |
1289 |
+ vf610_gpio_writel(~0, port->base + PORT_ISFR); |
1290 |
+ |
1291 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1292 |
+index 7b909d814d38..095bd6b4ae80 100644 |
1293 |
+--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1294 |
++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1295 |
+@@ -371,6 +371,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, |
1296 |
+ dev_err(dev, "Couldn't get the TCON channel 0 clock\n"); |
1297 |
+ return PTR_ERR(tcon->sclk0); |
1298 |
+ } |
1299 |
++ clk_prepare_enable(tcon->sclk0); |
1300 |
+ |
1301 |
+ if (tcon->quirks->has_channel_1) { |
1302 |
+ tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); |
1303 |
+@@ -385,6 +386,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, |
1304 |
+ |
1305 |
+ static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) |
1306 |
+ { |
1307 |
++ clk_disable_unprepare(tcon->sclk0); |
1308 |
+ clk_disable_unprepare(tcon->clk); |
1309 |
+ } |
1310 |
+ |
1311 |
+diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c |
1312 |
+index 23c2ea2baedc..12ba183693d6 100644 |
1313 |
+--- a/drivers/i2c/busses/i2c-omap.c |
1314 |
++++ b/drivers/i2c/busses/i2c-omap.c |
1315 |
+@@ -1477,8 +1477,7 @@ static int omap_i2c_remove(struct platform_device *pdev) |
1316 |
+ return 0; |
1317 |
+ } |
1318 |
+ |
1319 |
+-#ifdef CONFIG_PM |
1320 |
+-static int omap_i2c_runtime_suspend(struct device *dev) |
1321 |
++static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) |
1322 |
+ { |
1323 |
+ struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
1324 |
+ |
1325 |
+@@ -1504,7 +1503,7 @@ static int omap_i2c_runtime_suspend(struct device *dev) |
1326 |
+ return 0; |
1327 |
+ } |
1328 |
+ |
1329 |
+-static int omap_i2c_runtime_resume(struct device *dev) |
1330 |
++static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) |
1331 |
+ { |
1332 |
+ struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
1333 |
+ |
1334 |
+@@ -1519,20 +1518,18 @@ static int omap_i2c_runtime_resume(struct device *dev) |
1335 |
+ } |
1336 |
+ |
1337 |
+ static const struct dev_pm_ops omap_i2c_pm_ops = { |
1338 |
++ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1339 |
++ pm_runtime_force_resume) |
1340 |
+ SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, |
1341 |
+ omap_i2c_runtime_resume, NULL) |
1342 |
+ }; |
1343 |
+-#define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) |
1344 |
+-#else |
1345 |
+-#define OMAP_I2C_PM_OPS NULL |
1346 |
+-#endif /* CONFIG_PM */ |
1347 |
+ |
1348 |
+ static struct platform_driver omap_i2c_driver = { |
1349 |
+ .probe = omap_i2c_probe, |
1350 |
+ .remove = omap_i2c_remove, |
1351 |
+ .driver = { |
1352 |
+ .name = "omap_i2c", |
1353 |
+- .pm = OMAP_I2C_PM_OPS, |
1354 |
++ .pm = &omap_i2c_pm_ops, |
1355 |
+ .of_match_table = of_match_ptr(omap_i2c_of_match), |
1356 |
+ }, |
1357 |
+ }; |
1358 |
+diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c |
1359 |
+index 37abd150fad3..74aff88c593d 100644 |
1360 |
+--- a/drivers/infiniband/hw/hfi1/ud.c |
1361 |
++++ b/drivers/infiniband/hw/hfi1/ud.c |
1362 |
+@@ -954,7 +954,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) |
1363 |
+ opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
1364 |
+ wc.ex.imm_data = ohdr->u.ud.imm_data; |
1365 |
+ wc.wc_flags = IB_WC_WITH_IMM; |
1366 |
+- tlen -= sizeof(u32); |
1367 |
+ } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
1368 |
+ wc.ex.imm_data = 0; |
1369 |
+ wc.wc_flags = 0; |
1370 |
+diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c |
1371 |
+index be4907453ac4..5ef144e4a4cb 100644 |
1372 |
+--- a/drivers/infiniband/hw/qib/qib_ud.c |
1373 |
++++ b/drivers/infiniband/hw/qib/qib_ud.c |
1374 |
+@@ -515,7 +515,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, |
1375 |
+ opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
1376 |
+ wc.ex.imm_data = ohdr->u.ud.imm_data; |
1377 |
+ wc.wc_flags = IB_WC_WITH_IMM; |
1378 |
+- tlen -= sizeof(u32); |
1379 |
+ } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
1380 |
+ wc.ex.imm_data = 0; |
1381 |
+ wc.wc_flags = 0; |
1382 |
+diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
1383 |
+index fce70f4ef004..2ce805d31ed1 100644 |
1384 |
+--- a/drivers/input/mouse/elan_i2c_core.c |
1385 |
++++ b/drivers/input/mouse/elan_i2c_core.c |
1386 |
+@@ -1252,6 +1252,7 @@ static const struct acpi_device_id elan_acpi_id[] = { |
1387 |
+ { "ELAN0000", 0 }, |
1388 |
+ { "ELAN0100", 0 }, |
1389 |
+ { "ELAN0600", 0 }, |
1390 |
++ { "ELAN0601", 0 }, |
1391 |
+ { "ELAN0602", 0 }, |
1392 |
+ { "ELAN0605", 0 }, |
1393 |
+ { "ELAN0608", 0 }, |
1394 |
+diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c |
1395 |
+index 38bfaca48eab..150f9eecaca7 100644 |
1396 |
+--- a/drivers/input/tablet/wacom_serial4.c |
1397 |
++++ b/drivers/input/tablet/wacom_serial4.c |
1398 |
+@@ -187,6 +187,7 @@ enum { |
1399 |
+ MODEL_DIGITIZER_II = 0x5544, /* UD */ |
1400 |
+ MODEL_GRAPHIRE = 0x4554, /* ET */ |
1401 |
+ MODEL_PENPARTNER = 0x4354, /* CT */ |
1402 |
++ MODEL_ARTPAD_II = 0x4B54, /* KT */ |
1403 |
+ }; |
1404 |
+ |
1405 |
+ static void wacom_handle_model_response(struct wacom *wacom) |
1406 |
+@@ -245,6 +246,7 @@ static void wacom_handle_model_response(struct wacom *wacom) |
1407 |
+ wacom->flags = F_HAS_STYLUS2 | F_HAS_SCROLLWHEEL; |
1408 |
+ break; |
1409 |
+ |
1410 |
++ case MODEL_ARTPAD_II: |
1411 |
+ case MODEL_DIGITIZER_II: |
1412 |
+ wacom->dev->name = "Wacom Digitizer II"; |
1413 |
+ wacom->dev->id.version = MODEL_DIGITIZER_II; |
1414 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
1415 |
+index 766103ea237e..78b97f31a1f2 100644 |
1416 |
+--- a/drivers/iommu/amd_iommu.c |
1417 |
++++ b/drivers/iommu/amd_iommu.c |
1418 |
+@@ -1919,6 +1919,7 @@ static void do_attach(struct iommu_dev_data *dev_data, |
1419 |
+ |
1420 |
+ static void do_detach(struct iommu_dev_data *dev_data) |
1421 |
+ { |
1422 |
++ struct protection_domain *domain = dev_data->domain; |
1423 |
+ struct amd_iommu *iommu; |
1424 |
+ u16 alias; |
1425 |
+ |
1426 |
+@@ -1934,10 +1935,6 @@ static void do_detach(struct iommu_dev_data *dev_data) |
1427 |
+ iommu = amd_iommu_rlookup_table[dev_data->devid]; |
1428 |
+ alias = dev_data->alias; |
1429 |
+ |
1430 |
+- /* decrease reference counters */ |
1431 |
+- dev_data->domain->dev_iommu[iommu->index] -= 1; |
1432 |
+- dev_data->domain->dev_cnt -= 1; |
1433 |
+- |
1434 |
+ /* Update data structures */ |
1435 |
+ dev_data->domain = NULL; |
1436 |
+ list_del(&dev_data->list); |
1437 |
+@@ -1947,6 +1944,16 @@ static void do_detach(struct iommu_dev_data *dev_data) |
1438 |
+ |
1439 |
+ /* Flush the DTE entry */ |
1440 |
+ device_flush_dte(dev_data); |
1441 |
++ |
1442 |
++ /* Flush IOTLB */ |
1443 |
++ domain_flush_tlb_pde(domain); |
1444 |
++ |
1445 |
++ /* Wait for the flushes to finish */ |
1446 |
++ domain_flush_complete(domain); |
1447 |
++ |
1448 |
++ /* decrease reference counters - needs to happen after the flushes */ |
1449 |
++ domain->dev_iommu[iommu->index] -= 1; |
1450 |
++ domain->dev_cnt -= 1; |
1451 |
+ } |
1452 |
+ |
1453 |
+ /* |
1454 |
+@@ -2560,13 +2567,13 @@ out_unmap: |
1455 |
+ bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
1456 |
+ iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
1457 |
+ |
1458 |
+- if (--mapped_pages) |
1459 |
++ if (--mapped_pages == 0) |
1460 |
+ goto out_free_iova; |
1461 |
+ } |
1462 |
+ } |
1463 |
+ |
1464 |
+ out_free_iova: |
1465 |
+- free_iova_fast(&dma_dom->iovad, address, npages); |
1466 |
++ free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); |
1467 |
+ |
1468 |
+ out_err: |
1469 |
+ return 0; |
1470 |
+diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c |
1471 |
+index 25f32e1d7764..3496b61a312a 100644 |
1472 |
+--- a/drivers/irqchip/irq-mmp.c |
1473 |
++++ b/drivers/irqchip/irq-mmp.c |
1474 |
+@@ -34,6 +34,9 @@ |
1475 |
+ #define SEL_INT_PENDING (1 << 6) |
1476 |
+ #define SEL_INT_NUM_MASK 0x3f |
1477 |
+ |
1478 |
++#define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) |
1479 |
++#define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) |
1480 |
++ |
1481 |
+ struct icu_chip_data { |
1482 |
+ int nr_irqs; |
1483 |
+ unsigned int virq_base; |
1484 |
+@@ -190,7 +193,8 @@ static const struct mmp_intc_conf mmp_conf = { |
1485 |
+ static const struct mmp_intc_conf mmp2_conf = { |
1486 |
+ .conf_enable = 0x20, |
1487 |
+ .conf_disable = 0x0, |
1488 |
+- .conf_mask = 0x7f, |
1489 |
++ .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
1490 |
++ MMP2_ICU_INT_ROUTE_PJ4_FIQ, |
1491 |
+ }; |
1492 |
+ |
1493 |
+ static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
1494 |
+diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c |
1495 |
+index 064d88299adc..c0176f5d8200 100644 |
1496 |
+--- a/drivers/media/usb/uvc/uvc_driver.c |
1497 |
++++ b/drivers/media/usb/uvc/uvc_driver.c |
1498 |
+@@ -1054,11 +1054,19 @@ static int uvc_parse_standard_control(struct uvc_device *dev, |
1499 |
+ return -EINVAL; |
1500 |
+ } |
1501 |
+ |
1502 |
+- /* Make sure the terminal type MSB is not null, otherwise it |
1503 |
+- * could be confused with a unit. |
1504 |
++ /* |
1505 |
++ * Reject invalid terminal types that would cause issues: |
1506 |
++ * |
1507 |
++ * - The high byte must be non-zero, otherwise it would be |
1508 |
++ * confused with a unit. |
1509 |
++ * |
1510 |
++ * - Bit 15 must be 0, as we use it internally as a terminal |
1511 |
++ * direction flag. |
1512 |
++ * |
1513 |
++ * Other unknown types are accepted. |
1514 |
+ */ |
1515 |
+ type = get_unaligned_le16(&buffer[4]); |
1516 |
+- if ((type & 0xff00) == 0) { |
1517 |
++ if ((type & 0x7f00) == 0 || (type & 0x8000) != 0) { |
1518 |
+ uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " |
1519 |
+ "interface %d INPUT_TERMINAL %d has invalid " |
1520 |
+ "type 0x%04x, skipping\n", udev->devnum, |
1521 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
1522 |
+index a3543d637736..4fbc75b73433 100644 |
1523 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
1524 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
1525 |
+@@ -639,7 +639,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
1526 |
+ default: |
1527 |
+ return UINT64_MAX; |
1528 |
+ } |
1529 |
+- value = (((u64)high) << 16) | low; |
1530 |
++ value = (((u64)high) << 32) | low; |
1531 |
+ return value; |
1532 |
+ } |
1533 |
+ |
1534 |
+@@ -2569,7 +2569,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { |
1535 |
+ .port_pause_limit = mv88e6097_port_pause_limit, |
1536 |
+ .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
1537 |
+ .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, |
1538 |
+- .stats_snapshot = mv88e6320_g1_stats_snapshot, |
1539 |
++ .stats_snapshot = mv88e6xxx_g1_stats_snapshot, |
1540 |
+ .stats_get_sset_count = mv88e6095_stats_get_sset_count, |
1541 |
+ .stats_get_strings = mv88e6095_stats_get_strings, |
1542 |
+ .stats_get_stats = mv88e6095_stats_get_stats, |
1543 |
+diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c |
1544 |
+index a7801f6668a5..2cffecfe86e3 100644 |
1545 |
+--- a/drivers/net/dsa/mv88e6xxx/port.c |
1546 |
++++ b/drivers/net/dsa/mv88e6xxx/port.c |
1547 |
+@@ -165,7 +165,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup) |
1548 |
+ /* normal duplex detection */ |
1549 |
+ break; |
1550 |
+ default: |
1551 |
+- return -EINVAL; |
1552 |
++ return -EOPNOTSUPP; |
1553 |
+ } |
1554 |
+ |
1555 |
+ err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg); |
1556 |
+diff --git a/drivers/net/ethernet/altera/altera_msgdma.c b/drivers/net/ethernet/altera/altera_msgdma.c |
1557 |
+index 0fb986ba3290..0ae723f75341 100644 |
1558 |
+--- a/drivers/net/ethernet/altera/altera_msgdma.c |
1559 |
++++ b/drivers/net/ethernet/altera/altera_msgdma.c |
1560 |
+@@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) |
1561 |
+ & 0xffff; |
1562 |
+ |
1563 |
+ if (inuse) { /* Tx FIFO is not empty */ |
1564 |
+- ready = priv->tx_prod - priv->tx_cons - inuse - 1; |
1565 |
++ ready = max_t(int, |
1566 |
++ priv->tx_prod - priv->tx_cons - inuse - 1, 0); |
1567 |
+ } else { |
1568 |
+ /* Check for buffered last packet */ |
1569 |
+ status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
1570 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1571 |
+index da6c73868fa0..15ad247955f7 100644 |
1572 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1573 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1574 |
+@@ -447,6 +447,12 @@ normal_tx: |
1575 |
+ } |
1576 |
+ |
1577 |
+ length >>= 9; |
1578 |
++ if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) { |
1579 |
++ dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n", |
1580 |
++ skb->len); |
1581 |
++ i = 0; |
1582 |
++ goto tx_dma_error; |
1583 |
++ } |
1584 |
+ flags |= bnxt_lhint_arr[length]; |
1585 |
+ txbd->tx_bd_len_flags_type = cpu_to_le32(flags); |
1586 |
+ |
1587 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1588 |
+index 86662a14208e..d30c28fba249 100644 |
1589 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1590 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1591 |
+@@ -2532,6 +2532,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) |
1592 |
+ out_notify_fail: |
1593 |
+ (void)cancel_work_sync(&priv->service_task); |
1594 |
+ out_read_prop_fail: |
1595 |
++ /* safe for ACPI FW */ |
1596 |
++ of_node_put(to_of_node(priv->fwnode)); |
1597 |
+ free_netdev(ndev); |
1598 |
+ return ret; |
1599 |
+ } |
1600 |
+@@ -2561,6 +2563,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) |
1601 |
+ set_bit(NIC_STATE_REMOVING, &priv->state); |
1602 |
+ (void)cancel_work_sync(&priv->service_task); |
1603 |
+ |
1604 |
++ /* safe for ACPI FW */ |
1605 |
++ of_node_put(to_of_node(priv->fwnode)); |
1606 |
++ |
1607 |
+ free_netdev(ndev); |
1608 |
+ return 0; |
1609 |
+ } |
1610 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1611 |
+index c1e947bb852f..14df03f60e05 100644 |
1612 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1613 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1614 |
+@@ -1154,16 +1154,18 @@ static int hns_get_regs_len(struct net_device *net_dev) |
1615 |
+ */ |
1616 |
+ static int hns_nic_nway_reset(struct net_device *netdev) |
1617 |
+ { |
1618 |
+- int ret = 0; |
1619 |
+ struct phy_device *phy = netdev->phydev; |
1620 |
+ |
1621 |
+- if (netif_running(netdev)) { |
1622 |
+- /* if autoneg is disabled, don't restart auto-negotiation */ |
1623 |
+- if (phy && phy->autoneg == AUTONEG_ENABLE) |
1624 |
+- ret = genphy_restart_aneg(phy); |
1625 |
+- } |
1626 |
++ if (!netif_running(netdev)) |
1627 |
++ return 0; |
1628 |
+ |
1629 |
+- return ret; |
1630 |
++ if (!phy) |
1631 |
++ return -EOPNOTSUPP; |
1632 |
++ |
1633 |
++ if (phy->autoneg != AUTONEG_ENABLE) |
1634 |
++ return -EINVAL; |
1635 |
++ |
1636 |
++ return genphy_restart_aneg(phy); |
1637 |
+ } |
1638 |
+ |
1639 |
+ static u32 |
1640 |
+diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c |
1641 |
+index 017e08452d8c..baf5cc251f32 100644 |
1642 |
+--- a/drivers/net/ethernet/hisilicon/hns_mdio.c |
1643 |
++++ b/drivers/net/ethernet/hisilicon/hns_mdio.c |
1644 |
+@@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) |
1645 |
+ } |
1646 |
+ |
1647 |
+ hns_mdio_cmd_write(mdio_dev, is_c45, |
1648 |
+- MDIO_C45_WRITE_ADDR, phy_id, devad); |
1649 |
++ MDIO_C45_READ, phy_id, devad); |
1650 |
+ } |
1651 |
+ |
1652 |
+ /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
1653 |
+diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c |
1654 |
+index 3954bc1d2333..cf6f58889038 100644 |
1655 |
+--- a/drivers/net/ethernet/marvell/sky2.c |
1656 |
++++ b/drivers/net/ethernet/marvell/sky2.c |
1657 |
+@@ -46,6 +46,7 @@ |
1658 |
+ #include <linux/mii.h> |
1659 |
+ #include <linux/of_device.h> |
1660 |
+ #include <linux/of_net.h> |
1661 |
++#include <linux/dmi.h> |
1662 |
+ |
1663 |
+ #include <asm/irq.h> |
1664 |
+ |
1665 |
+@@ -93,7 +94,7 @@ static int copybreak __read_mostly = 128; |
1666 |
+ module_param(copybreak, int, 0); |
1667 |
+ MODULE_PARM_DESC(copybreak, "Receive copy threshold"); |
1668 |
+ |
1669 |
+-static int disable_msi = 0; |
1670 |
++static int disable_msi = -1; |
1671 |
+ module_param(disable_msi, int, 0); |
1672 |
+ MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); |
1673 |
+ |
1674 |
+@@ -4931,6 +4932,24 @@ static const char *sky2_name(u8 chipid, char *buf, int sz) |
1675 |
+ return buf; |
1676 |
+ } |
1677 |
+ |
1678 |
++static const struct dmi_system_id msi_blacklist[] = { |
1679 |
++ { |
1680 |
++ .ident = "Dell Inspiron 1545", |
1681 |
++ .matches = { |
1682 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
1683 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1545"), |
1684 |
++ }, |
1685 |
++ }, |
1686 |
++ { |
1687 |
++ .ident = "Gateway P-79", |
1688 |
++ .matches = { |
1689 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Gateway"), |
1690 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "P-79"), |
1691 |
++ }, |
1692 |
++ }, |
1693 |
++ {} |
1694 |
++}; |
1695 |
++ |
1696 |
+ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1697 |
+ { |
1698 |
+ struct net_device *dev, *dev1; |
1699 |
+@@ -5042,6 +5061,9 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1700 |
+ goto err_out_free_pci; |
1701 |
+ } |
1702 |
+ |
1703 |
++ if (disable_msi == -1) |
1704 |
++ disable_msi = !!dmi_check_system(msi_blacklist); |
1705 |
++ |
1706 |
+ if (!disable_msi && pci_enable_msi(pdev) == 0) { |
1707 |
+ err = sky2_test_msi(hw); |
1708 |
+ if (err) { |
1709 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1710 |
+index 16953c4ebd71..410528e7d927 100644 |
1711 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1712 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1713 |
+@@ -435,19 +435,19 @@ static void qed_init_qm_pq(struct qed_hwfn *p_hwfn, |
1714 |
+ |
1715 |
+ /* get pq index according to PQ_FLAGS */ |
1716 |
+ static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, |
1717 |
+- u32 pq_flags) |
1718 |
++ unsigned long pq_flags) |
1719 |
+ { |
1720 |
+ struct qed_qm_info *qm_info = &p_hwfn->qm_info; |
1721 |
+ |
1722 |
+ /* Can't have multiple flags set here */ |
1723 |
+- if (bitmap_weight((unsigned long *)&pq_flags, |
1724 |
++ if (bitmap_weight(&pq_flags, |
1725 |
+ sizeof(pq_flags) * BITS_PER_BYTE) > 1) { |
1726 |
+- DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); |
1727 |
++ DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); |
1728 |
+ goto err; |
1729 |
+ } |
1730 |
+ |
1731 |
+ if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { |
1732 |
+- DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); |
1733 |
++ DP_ERR(p_hwfn, "pq flag 0x%lx is not set\n", pq_flags); |
1734 |
+ goto err; |
1735 |
+ } |
1736 |
+ |
1737 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c |
1738 |
+index 83c1c4fa102b..62cde3854a5c 100644 |
1739 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c |
1740 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c |
1741 |
+@@ -607,6 +607,10 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, |
1742 |
+ (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && |
1743 |
+ !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); |
1744 |
+ |
1745 |
++ SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, |
1746 |
++ (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && |
1747 |
++ !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); |
1748 |
++ |
1749 |
+ SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, |
1750 |
+ !!(accept_filter & QED_ACCEPT_BCAST)); |
1751 |
+ |
1752 |
+@@ -743,6 +747,11 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
1753 |
+ return rc; |
1754 |
+ } |
1755 |
+ |
1756 |
++ if (p_params->update_ctl_frame_check) { |
1757 |
++ p_cmn->ctl_frame_mac_check_en = p_params->mac_chk_en; |
1758 |
++ p_cmn->ctl_frame_ethtype_check_en = p_params->ethtype_chk_en; |
1759 |
++ } |
1760 |
++ |
1761 |
+ /* Update mcast bins for VFs, PF doesn't use this functionality */ |
1762 |
+ qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); |
1763 |
+ |
1764 |
+@@ -2161,7 +2170,7 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, |
1765 |
+ u16 num_queues = 0; |
1766 |
+ |
1767 |
+ /* Since the feature controls only queue-zones, |
1768 |
+- * make sure we have the contexts [rx, tx, xdp] to |
1769 |
++ * make sure we have the contexts [rx, xdp, tcs] to |
1770 |
+ * match. |
1771 |
+ */ |
1772 |
+ for_each_hwfn(cdev, i) { |
1773 |
+@@ -2171,7 +2180,8 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, |
1774 |
+ u16 cids; |
1775 |
+ |
1776 |
+ cids = hwfn->pf_params.eth_pf_params.num_cons; |
1777 |
+- num_queues += min_t(u16, l2_queues, cids / 3); |
1778 |
++ cids /= (2 + info->num_tc); |
1779 |
++ num_queues += min_t(u16, l2_queues, cids); |
1780 |
+ } |
1781 |
+ |
1782 |
+ /* queues might theoretically be >256, but interrupts' |
1783 |
+@@ -2640,7 +2650,8 @@ static int qed_configure_filter_rx_mode(struct qed_dev *cdev, |
1784 |
+ if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { |
1785 |
+ accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
1786 |
+ QED_ACCEPT_MCAST_UNMATCHED; |
1787 |
+- accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
1788 |
++ accept_flags.tx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
1789 |
++ QED_ACCEPT_MCAST_UNMATCHED; |
1790 |
+ } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { |
1791 |
+ accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
1792 |
+ accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
1793 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.h b/drivers/net/ethernet/qlogic/qed/qed_l2.h |
1794 |
+index 91d383f3a661..7c41142452a3 100644 |
1795 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_l2.h |
1796 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h |
1797 |
+@@ -218,6 +218,9 @@ struct qed_sp_vport_update_params { |
1798 |
+ struct qed_rss_params *rss_params; |
1799 |
+ struct qed_filter_accept_flags accept_flags; |
1800 |
+ struct qed_sge_tpa_params *sge_tpa_params; |
1801 |
++ u8 update_ctl_frame_check; |
1802 |
++ u8 mac_chk_en; |
1803 |
++ u8 ethtype_chk_en; |
1804 |
+ }; |
1805 |
+ |
1806 |
+ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
1807 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c |
1808 |
+index cef619f0ce10..e82adea55ce9 100644 |
1809 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c |
1810 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c |
1811 |
+@@ -2299,19 +2299,24 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb) |
1812 |
+ { |
1813 |
+ struct qed_ll2_tx_pkt_info pkt; |
1814 |
+ const skb_frag_t *frag; |
1815 |
++ u8 flags = 0, nr_frags; |
1816 |
+ int rc = -EINVAL, i; |
1817 |
+ dma_addr_t mapping; |
1818 |
+ u16 vlan = 0; |
1819 |
+- u8 flags = 0; |
1820 |
+ |
1821 |
+ if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { |
1822 |
+ DP_INFO(cdev, "Cannot transmit a checksumed packet\n"); |
1823 |
+ return -EINVAL; |
1824 |
+ } |
1825 |
+ |
1826 |
+- if (1 + skb_shinfo(skb)->nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { |
1827 |
++ /* Cache number of fragments from SKB since SKB may be freed by |
1828 |
++ * the completion routine after calling qed_ll2_prepare_tx_packet() |
1829 |
++ */ |
1830 |
++ nr_frags = skb_shinfo(skb)->nr_frags; |
1831 |
++ |
1832 |
++ if (1 + nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { |
1833 |
+ DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", |
1834 |
+- 1 + skb_shinfo(skb)->nr_frags); |
1835 |
++ 1 + nr_frags); |
1836 |
+ return -EINVAL; |
1837 |
+ } |
1838 |
+ |
1839 |
+@@ -2333,7 +2338,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb) |
1840 |
+ } |
1841 |
+ |
1842 |
+ memset(&pkt, 0, sizeof(pkt)); |
1843 |
+- pkt.num_of_bds = 1 + skb_shinfo(skb)->nr_frags; |
1844 |
++ pkt.num_of_bds = 1 + nr_frags; |
1845 |
+ pkt.vlan = vlan; |
1846 |
+ pkt.bd_flags = flags; |
1847 |
+ pkt.tx_dest = QED_LL2_TX_DEST_NW; |
1848 |
+@@ -2341,12 +2346,17 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb) |
1849 |
+ pkt.first_frag_len = skb->len; |
1850 |
+ pkt.cookie = skb; |
1851 |
+ |
1852 |
++ /* qed_ll2_prepare_tx_packet() may actually send the packet if |
1853 |
++ * there are no fragments in the skb and subsequently the completion |
1854 |
++ * routine may run and free the SKB, so no dereferencing the SKB |
1855 |
++ * beyond this point unless skb has any fragments. |
1856 |
++ */ |
1857 |
+ rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, |
1858 |
+ &pkt, 1); |
1859 |
+ if (rc) |
1860 |
+ goto err; |
1861 |
+ |
1862 |
+- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
1863 |
++ for (i = 0; i < nr_frags; i++) { |
1864 |
+ frag = &skb_shinfo(skb)->frags[i]; |
1865 |
+ |
1866 |
+ mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, |
1867 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1868 |
+index 01a213d4ee9c..e7192f3babc2 100644 |
1869 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1870 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1871 |
+@@ -380,6 +380,7 @@ void qed_consq_setup(struct qed_hwfn *p_hwfn); |
1872 |
+ * @param p_hwfn |
1873 |
+ */ |
1874 |
+ void qed_consq_free(struct qed_hwfn *p_hwfn); |
1875 |
++int qed_spq_pend_post(struct qed_hwfn *p_hwfn); |
1876 |
+ |
1877 |
+ /** |
1878 |
+ * @file |
1879 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1880 |
+index 467755b6dd0b..01f8e2b5cb6c 100644 |
1881 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1882 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1883 |
+@@ -404,6 +404,11 @@ int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie) |
1884 |
+ |
1885 |
+ qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); |
1886 |
+ |
1887 |
++ /* Attempt to post pending requests */ |
1888 |
++ spin_lock_bh(&p_hwfn->p_spq->lock); |
1889 |
++ rc = qed_spq_pend_post(p_hwfn); |
1890 |
++ spin_unlock_bh(&p_hwfn->p_spq->lock); |
1891 |
++ |
1892 |
+ return rc; |
1893 |
+ } |
1894 |
+ |
1895 |
+@@ -747,7 +752,7 @@ static int qed_spq_post_list(struct qed_hwfn *p_hwfn, |
1896 |
+ return 0; |
1897 |
+ } |
1898 |
+ |
1899 |
+-static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) |
1900 |
++int qed_spq_pend_post(struct qed_hwfn *p_hwfn) |
1901 |
+ { |
1902 |
+ struct qed_spq *p_spq = p_hwfn->p_spq; |
1903 |
+ struct qed_spq_entry *p_ent = NULL; |
1904 |
+@@ -879,7 +884,6 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, |
1905 |
+ struct qed_spq_entry *p_ent = NULL; |
1906 |
+ struct qed_spq_entry *tmp; |
1907 |
+ struct qed_spq_entry *found = NULL; |
1908 |
+- int rc; |
1909 |
+ |
1910 |
+ if (!p_hwfn) |
1911 |
+ return -EINVAL; |
1912 |
+@@ -937,12 +941,7 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, |
1913 |
+ */ |
1914 |
+ qed_spq_return_entry(p_hwfn, found); |
1915 |
+ |
1916 |
+- /* Attempt to post pending requests */ |
1917 |
+- spin_lock_bh(&p_spq->lock); |
1918 |
+- rc = qed_spq_pend_post(p_hwfn); |
1919 |
+- spin_unlock_bh(&p_spq->lock); |
1920 |
+- |
1921 |
+- return rc; |
1922 |
++ return 0; |
1923 |
+ } |
1924 |
+ |
1925 |
+ int qed_consq_alloc(struct qed_hwfn *p_hwfn) |
1926 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
1927 |
+index c6411158afd7..65a53d409e77 100644 |
1928 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
1929 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
1930 |
+@@ -1963,7 +1963,9 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn, |
1931 |
+ params.vport_id = vf->vport_id; |
1932 |
+ params.max_buffers_per_cqe = start->max_buffers_per_cqe; |
1933 |
+ params.mtu = vf->mtu; |
1934 |
+- params.check_mac = true; |
1935 |
++ |
1936 |
++ /* Non trusted VFs should enable control frame filtering */ |
1937 |
++ params.check_mac = !vf->p_vf_info.is_trusted_configured; |
1938 |
+ |
1939 |
+ rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); |
1940 |
+ if (rc) { |
1941 |
+@@ -4910,6 +4912,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
1942 |
+ params.opaque_fid = vf->opaque_fid; |
1943 |
+ params.vport_id = vf->vport_id; |
1944 |
+ |
1945 |
++ params.update_ctl_frame_check = 1; |
1946 |
++ params.mac_chk_en = !vf_info->is_trusted_configured; |
1947 |
++ |
1948 |
+ if (vf_info->rx_accept_mode & mask) { |
1949 |
+ flags->update_rx_mode_config = 1; |
1950 |
+ flags->rx_accept_filter = vf_info->rx_accept_mode; |
1951 |
+@@ -4927,7 +4932,8 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
1952 |
+ } |
1953 |
+ |
1954 |
+ if (flags->update_rx_mode_config || |
1955 |
+- flags->update_tx_mode_config) |
1956 |
++ flags->update_tx_mode_config || |
1957 |
++ params.update_ctl_frame_check) |
1958 |
+ qed_sp_vport_update(hwfn, ¶ms, |
1959 |
+ QED_SPQ_MODE_EBLOCK, NULL); |
1960 |
+ } |
1961 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1962 |
+index dd8ebf6d380f..3220086f99de 100644 |
1963 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1964 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1965 |
+@@ -261,6 +261,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) |
1966 |
+ struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
1967 |
+ struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
1968 |
+ struct vf_pf_resc_request *p_resc; |
1969 |
++ u8 retry_cnt = VF_ACQUIRE_THRESH; |
1970 |
+ bool resources_acquired = false; |
1971 |
+ struct vfpf_acquire_tlv *req; |
1972 |
+ int rc = 0, attempts = 0; |
1973 |
+@@ -314,6 +315,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) |
1974 |
+ |
1975 |
+ /* send acquire request */ |
1976 |
+ rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
1977 |
++ |
1978 |
++ /* Re-try acquire in case of vf-pf hw channel timeout */ |
1979 |
++ if (retry_cnt && rc == -EBUSY) { |
1980 |
++ DP_VERBOSE(p_hwfn, QED_MSG_IOV, |
1981 |
++ "VF retrying to acquire due to VPC timeout\n"); |
1982 |
++ retry_cnt--; |
1983 |
++ continue; |
1984 |
++ } |
1985 |
++ |
1986 |
+ if (rc) |
1987 |
+ goto exit; |
1988 |
+ |
1989 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1990 |
+index 13133b30b575..01787344f6e5 100644 |
1991 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1992 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1993 |
+@@ -1284,8 +1284,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) |
1994 |
+ } |
1995 |
+ |
1996 |
+ ret = phy_power_on(bsp_priv, true); |
1997 |
+- if (ret) |
1998 |
++ if (ret) { |
1999 |
++ gmac_clk_enable(bsp_priv, false); |
2000 |
+ return ret; |
2001 |
++ } |
2002 |
+ |
2003 |
+ pm_runtime_enable(dev); |
2004 |
+ pm_runtime_get_sync(dev); |
2005 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
2006 |
+index c3c6335cbe9a..ecddd9948788 100644 |
2007 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
2008 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
2009 |
+@@ -702,8 +702,11 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) |
2010 |
+ { |
2011 |
+ unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
2012 |
+ |
2013 |
+- if (!clk) |
2014 |
+- return 0; |
2015 |
++ if (!clk) { |
2016 |
++ clk = priv->plat->clk_ref_rate; |
2017 |
++ if (!clk) |
2018 |
++ return 0; |
2019 |
++ } |
2020 |
+ |
2021 |
+ return (usec * (clk / 1000000)) / 256; |
2022 |
+ } |
2023 |
+@@ -712,8 +715,11 @@ static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv) |
2024 |
+ { |
2025 |
+ unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
2026 |
+ |
2027 |
+- if (!clk) |
2028 |
+- return 0; |
2029 |
++ if (!clk) { |
2030 |
++ clk = priv->plat->clk_ref_rate; |
2031 |
++ if (!clk) |
2032 |
++ return 0; |
2033 |
++ } |
2034 |
+ |
2035 |
+ return (riwt * 256) / (clk / 1000000); |
2036 |
+ } |
2037 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2038 |
+index 0e66a5082140..0cc83e8417ef 100644 |
2039 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2040 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2041 |
+@@ -3017,10 +3017,22 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2042 |
+ |
2043 |
+ tx_q = &priv->tx_queue[queue]; |
2044 |
+ |
2045 |
++ if (priv->tx_path_in_lpi_mode) |
2046 |
++ stmmac_disable_eee_mode(priv); |
2047 |
++ |
2048 |
+ /* Manage oversized TCP frames for GMAC4 device */ |
2049 |
+ if (skb_is_gso(skb) && priv->tso) { |
2050 |
+- if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) |
2051 |
++ if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { |
2052 |
++ /* |
2053 |
++ * There is no way to determine the number of TSO |
2054 |
++ * capable Queues. Let's use always the Queue 0 |
2055 |
++ * because if TSO is supported then at least this |
2056 |
++ * one will be capable. |
2057 |
++ */ |
2058 |
++ skb_set_queue_mapping(skb, 0); |
2059 |
++ |
2060 |
+ return stmmac_tso_xmit(skb, dev); |
2061 |
++ } |
2062 |
+ } |
2063 |
+ |
2064 |
+ if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) { |
2065 |
+@@ -3035,9 +3047,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2066 |
+ return NETDEV_TX_BUSY; |
2067 |
+ } |
2068 |
+ |
2069 |
+- if (priv->tx_path_in_lpi_mode) |
2070 |
+- stmmac_disable_eee_mode(priv); |
2071 |
+- |
2072 |
+ entry = tx_q->cur_tx; |
2073 |
+ first_entry = entry; |
2074 |
+ |
2075 |
+diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
2076 |
+index cb51448389a1..55c4b295ed0e 100644 |
2077 |
+--- a/drivers/net/geneve.c |
2078 |
++++ b/drivers/net/geneve.c |
2079 |
+@@ -632,15 +632,20 @@ out: |
2080 |
+ static int geneve_open(struct net_device *dev) |
2081 |
+ { |
2082 |
+ struct geneve_dev *geneve = netdev_priv(dev); |
2083 |
+- bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6); |
2084 |
+ bool metadata = geneve->collect_md; |
2085 |
++ bool ipv4, ipv6; |
2086 |
+ int ret = 0; |
2087 |
+ |
2088 |
++ ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata; |
2089 |
++ ipv4 = !ipv6 || metadata; |
2090 |
+ #if IS_ENABLED(CONFIG_IPV6) |
2091 |
+- if (ipv6 || metadata) |
2092 |
++ if (ipv6) { |
2093 |
+ ret = geneve_sock_add(geneve, true); |
2094 |
++ if (ret < 0 && ret != -EAFNOSUPPORT) |
2095 |
++ ipv4 = false; |
2096 |
++ } |
2097 |
+ #endif |
2098 |
+- if (!ret && (!ipv6 || metadata)) |
2099 |
++ if (ipv4) |
2100 |
+ ret = geneve_sock_add(geneve, false); |
2101 |
+ if (ret < 0) |
2102 |
+ geneve_sock_release(geneve); |
2103 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
2104 |
+index 2d90cffae9ff..74b9e51b2b47 100644 |
2105 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
2106 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
2107 |
+@@ -741,6 +741,14 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, |
2108 |
+ schedule_delayed_work(&ndev_ctx->dwork, 0); |
2109 |
+ } |
2110 |
+ |
2111 |
++static void netvsc_comp_ipcsum(struct sk_buff *skb) |
2112 |
++{ |
2113 |
++ struct iphdr *iph = (struct iphdr *)skb->data; |
2114 |
++ |
2115 |
++ iph->check = 0; |
2116 |
++ iph->check = ip_fast_csum(iph, iph->ihl); |
2117 |
++} |
2118 |
++ |
2119 |
+ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, |
2120 |
+ struct napi_struct *napi, |
2121 |
+ const struct ndis_tcp_ip_checksum_info *csum_info, |
2122 |
+@@ -764,9 +772,17 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, |
2123 |
+ /* skb is already created with CHECKSUM_NONE */ |
2124 |
+ skb_checksum_none_assert(skb); |
2125 |
+ |
2126 |
+- /* |
2127 |
+- * In Linux, the IP checksum is always checked. |
2128 |
+- * Do L4 checksum offload if enabled and present. |
2129 |
++ /* Incoming packets may have IP header checksum verified by the host. |
2130 |
++ * They may not have IP header checksum computed after coalescing. |
2131 |
++ * We compute it here if the flags are set, because on Linux, the IP |
2132 |
++ * checksum is always checked. |
2133 |
++ */ |
2134 |
++ if (csum_info && csum_info->receive.ip_checksum_value_invalid && |
2135 |
++ csum_info->receive.ip_checksum_succeeded && |
2136 |
++ skb->protocol == htons(ETH_P_IP)) |
2137 |
++ netvsc_comp_ipcsum(skb); |
2138 |
++ |
2139 |
++ /* Do L4 checksum offload if enabled and present. |
2140 |
+ */ |
2141 |
+ if (csum_info && (net->features & NETIF_F_RXCSUM)) { |
2142 |
+ if (csum_info->receive.tcp_checksum_succeeded || |
2143 |
+diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c |
2144 |
+index 6c45ff650ec7..eb85cf4a381a 100644 |
2145 |
+--- a/drivers/net/phy/micrel.c |
2146 |
++++ b/drivers/net/phy/micrel.c |
2147 |
+@@ -339,6 +339,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev) |
2148 |
+ return genphy_config_aneg(phydev); |
2149 |
+ } |
2150 |
+ |
2151 |
++static int ksz8061_config_init(struct phy_device *phydev) |
2152 |
++{ |
2153 |
++ int ret; |
2154 |
++ |
2155 |
++ ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); |
2156 |
++ if (ret) |
2157 |
++ return ret; |
2158 |
++ |
2159 |
++ return kszphy_config_init(phydev); |
2160 |
++} |
2161 |
++ |
2162 |
+ static int ksz9021_load_values_from_of(struct phy_device *phydev, |
2163 |
+ const struct device_node *of_node, |
2164 |
+ u16 reg, |
2165 |
+@@ -938,7 +949,7 @@ static struct phy_driver ksphy_driver[] = { |
2166 |
+ .phy_id_mask = MICREL_PHY_ID_MASK, |
2167 |
+ .features = PHY_BASIC_FEATURES, |
2168 |
+ .flags = PHY_HAS_INTERRUPT, |
2169 |
+- .config_init = kszphy_config_init, |
2170 |
++ .config_init = ksz8061_config_init, |
2171 |
+ .config_aneg = genphy_config_aneg, |
2172 |
+ .read_status = genphy_read_status, |
2173 |
+ .ack_interrupt = kszphy_ack_interrupt, |
2174 |
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c |
2175 |
+index afe335583832..5bfc961e53c9 100644 |
2176 |
+--- a/drivers/net/phy/phylink.c |
2177 |
++++ b/drivers/net/phy/phylink.c |
2178 |
+@@ -333,6 +333,10 @@ static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state * |
2179 |
+ linkmode_zero(state->lp_advertising); |
2180 |
+ state->interface = pl->link_config.interface; |
2181 |
+ state->an_enabled = pl->link_config.an_enabled; |
2182 |
++ state->speed = SPEED_UNKNOWN; |
2183 |
++ state->duplex = DUPLEX_UNKNOWN; |
2184 |
++ state->pause = MLO_PAUSE_NONE; |
2185 |
++ state->an_complete = 0; |
2186 |
+ state->link = 1; |
2187 |
+ |
2188 |
+ return pl->ops->mac_link_state(ndev, state); |
2189 |
+diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c |
2190 |
+index 1468ddf424cc..bc0890ee9700 100644 |
2191 |
+--- a/drivers/net/team/team_mode_loadbalance.c |
2192 |
++++ b/drivers/net/team/team_mode_loadbalance.c |
2193 |
+@@ -319,6 +319,20 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx) |
2194 |
+ return 0; |
2195 |
+ } |
2196 |
+ |
2197 |
++static void lb_bpf_func_free(struct team *team) |
2198 |
++{ |
2199 |
++ struct lb_priv *lb_priv = get_lb_priv(team); |
2200 |
++ struct bpf_prog *fp; |
2201 |
++ |
2202 |
++ if (!lb_priv->ex->orig_fprog) |
2203 |
++ return; |
2204 |
++ |
2205 |
++ __fprog_destroy(lb_priv->ex->orig_fprog); |
2206 |
++ fp = rcu_dereference_protected(lb_priv->fp, |
2207 |
++ lockdep_is_held(&team->lock)); |
2208 |
++ bpf_prog_destroy(fp); |
2209 |
++} |
2210 |
++ |
2211 |
+ static int lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx) |
2212 |
+ { |
2213 |
+ struct lb_priv *lb_priv = get_lb_priv(team); |
2214 |
+@@ -633,6 +647,7 @@ static void lb_exit(struct team *team) |
2215 |
+ |
2216 |
+ team_options_unregister(team, lb_options, |
2217 |
+ ARRAY_SIZE(lb_options)); |
2218 |
++ lb_bpf_func_free(team); |
2219 |
+ cancel_delayed_work_sync(&lb_priv->ex->stats.refresh_dw); |
2220 |
+ free_percpu(lb_priv->pcpu_stats); |
2221 |
+ kfree(lb_priv->ex); |
2222 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
2223 |
+index 2956bb6cda72..4227ee33ef19 100644 |
2224 |
+--- a/drivers/net/tun.c |
2225 |
++++ b/drivers/net/tun.c |
2226 |
+@@ -1714,9 +1714,9 @@ static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, |
2227 |
+ } |
2228 |
+ |
2229 |
+ add_wait_queue(&tfile->wq.wait, &wait); |
2230 |
+- current->state = TASK_INTERRUPTIBLE; |
2231 |
+ |
2232 |
+ while (1) { |
2233 |
++ set_current_state(TASK_INTERRUPTIBLE); |
2234 |
+ skb = skb_array_consume(&tfile->tx_array); |
2235 |
+ if (skb) |
2236 |
+ break; |
2237 |
+@@ -1732,7 +1732,7 @@ static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, |
2238 |
+ schedule(); |
2239 |
+ } |
2240 |
+ |
2241 |
+- current->state = TASK_RUNNING; |
2242 |
++ __set_current_state(TASK_RUNNING); |
2243 |
+ remove_wait_queue(&tfile->wq.wait, &wait); |
2244 |
+ |
2245 |
+ out: |
2246 |
+diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c |
2247 |
+index bb7936090b91..b8e520fc2870 100644 |
2248 |
+--- a/drivers/net/wireless/ath/ath9k/init.c |
2249 |
++++ b/drivers/net/wireless/ath/ath9k/init.c |
2250 |
+@@ -580,15 +580,15 @@ static int ath9k_of_init(struct ath_softc *sc) |
2251 |
+ ret = ath9k_eeprom_request(sc, eeprom_name); |
2252 |
+ if (ret) |
2253 |
+ return ret; |
2254 |
++ |
2255 |
++ ah->ah_flags &= ~AH_USE_EEPROM; |
2256 |
++ ah->ah_flags |= AH_NO_EEP_SWAP; |
2257 |
+ } |
2258 |
+ |
2259 |
+ mac = of_get_mac_address(np); |
2260 |
+ if (mac) |
2261 |
+ ether_addr_copy(common->macaddr, mac); |
2262 |
+ |
2263 |
+- ah->ah_flags &= ~AH_USE_EEPROM; |
2264 |
+- ah->ah_flags |= AH_NO_EEP_SWAP; |
2265 |
+- |
2266 |
+ return 0; |
2267 |
+ } |
2268 |
+ |
2269 |
+diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c |
2270 |
+index 3b6fb5b3bdb2..6414cc6b9032 100644 |
2271 |
+--- a/drivers/net/xen-netback/hash.c |
2272 |
++++ b/drivers/net/xen-netback/hash.c |
2273 |
+@@ -435,6 +435,8 @@ void xenvif_init_hash(struct xenvif *vif) |
2274 |
+ if (xenvif_hash_cache_size == 0) |
2275 |
+ return; |
2276 |
+ |
2277 |
++ BUG_ON(vif->hash.cache.count); |
2278 |
++ |
2279 |
+ spin_lock_init(&vif->hash.cache.lock); |
2280 |
+ INIT_LIST_HEAD(&vif->hash.cache.list); |
2281 |
+ } |
2282 |
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c |
2283 |
+index 4491ca5aee90..d465071656b5 100644 |
2284 |
+--- a/drivers/net/xen-netback/interface.c |
2285 |
++++ b/drivers/net/xen-netback/interface.c |
2286 |
+@@ -153,6 +153,13 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, |
2287 |
+ { |
2288 |
+ struct xenvif *vif = netdev_priv(dev); |
2289 |
+ unsigned int size = vif->hash.size; |
2290 |
++ unsigned int num_queues; |
2291 |
++ |
2292 |
++ /* If queues are not set up internally - always return 0 |
2293 |
++ * as the packet going to be dropped anyway */ |
2294 |
++ num_queues = READ_ONCE(vif->num_queues); |
2295 |
++ if (num_queues < 1) |
2296 |
++ return 0; |
2297 |
+ |
2298 |
+ if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) |
2299 |
+ return fallback(dev, skb) % dev->real_num_tx_queues; |
2300 |
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c |
2301 |
+index 5042ff8d449a..d09dea77c287 100644 |
2302 |
+--- a/drivers/net/xen-netback/netback.c |
2303 |
++++ b/drivers/net/xen-netback/netback.c |
2304 |
+@@ -1074,11 +1074,6 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s |
2305 |
+ skb_frag_size_set(&frags[i], len); |
2306 |
+ } |
2307 |
+ |
2308 |
+- /* Copied all the bits from the frag list -- free it. */ |
2309 |
+- skb_frag_list_init(skb); |
2310 |
+- xenvif_skb_zerocopy_prepare(queue, nskb); |
2311 |
+- kfree_skb(nskb); |
2312 |
+- |
2313 |
+ /* Release all the original (foreign) frags. */ |
2314 |
+ for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) |
2315 |
+ skb_frag_unref(skb, f); |
2316 |
+@@ -1147,6 +1142,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) |
2317 |
+ xenvif_fill_frags(queue, skb); |
2318 |
+ |
2319 |
+ if (unlikely(skb_has_frag_list(skb))) { |
2320 |
++ struct sk_buff *nskb = skb_shinfo(skb)->frag_list; |
2321 |
++ xenvif_skb_zerocopy_prepare(queue, nskb); |
2322 |
+ if (xenvif_handle_frag_list(queue, skb)) { |
2323 |
+ if (net_ratelimit()) |
2324 |
+ netdev_err(queue->vif->dev, |
2325 |
+@@ -1155,6 +1152,9 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) |
2326 |
+ kfree_skb(skb); |
2327 |
+ continue; |
2328 |
+ } |
2329 |
++ /* Copied all the bits from the frag list -- free it. */ |
2330 |
++ skb_frag_list_init(skb); |
2331 |
++ kfree_skb(nskb); |
2332 |
+ } |
2333 |
+ |
2334 |
+ skb->dev = queue->vif->dev; |
2335 |
+diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig |
2336 |
+index 80b87954f6dd..09035705d0a0 100644 |
2337 |
+--- a/drivers/platform/x86/Kconfig |
2338 |
++++ b/drivers/platform/x86/Kconfig |
2339 |
+@@ -999,6 +999,7 @@ config INTEL_OAKTRAIL |
2340 |
+ config SAMSUNG_Q10 |
2341 |
+ tristate "Samsung Q10 Extras" |
2342 |
+ depends on ACPI |
2343 |
++ depends on BACKLIGHT_LCD_SUPPORT |
2344 |
+ select BACKLIGHT_CLASS_DEVICE |
2345 |
+ ---help--- |
2346 |
+ This driver provides support for backlight control on Samsung Q10 |
2347 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
2348 |
+index 69ef5f4060ed..6566fceef38d 100644 |
2349 |
+--- a/drivers/s390/net/qeth_core_main.c |
2350 |
++++ b/drivers/s390/net/qeth_core_main.c |
2351 |
+@@ -2472,11 +2472,12 @@ out: |
2352 |
+ return rc; |
2353 |
+ } |
2354 |
+ |
2355 |
+-static void qeth_free_qdio_out_buf(struct qeth_qdio_out_q *q) |
2356 |
++static void qeth_free_output_queue(struct qeth_qdio_out_q *q) |
2357 |
+ { |
2358 |
+ if (!q) |
2359 |
+ return; |
2360 |
+ |
2361 |
++ qeth_clear_outq_buffers(q, 1); |
2362 |
+ qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); |
2363 |
+ kfree(q); |
2364 |
+ } |
2365 |
+@@ -2549,10 +2550,8 @@ out_freeoutqbufs: |
2366 |
+ card->qdio.out_qs[i]->bufs[j] = NULL; |
2367 |
+ } |
2368 |
+ out_freeoutq: |
2369 |
+- while (i > 0) { |
2370 |
+- qeth_free_qdio_out_buf(card->qdio.out_qs[--i]); |
2371 |
+- qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); |
2372 |
+- } |
2373 |
++ while (i > 0) |
2374 |
++ qeth_free_output_queue(card->qdio.out_qs[--i]); |
2375 |
+ kfree(card->qdio.out_qs); |
2376 |
+ card->qdio.out_qs = NULL; |
2377 |
+ out_freepool: |
2378 |
+@@ -2585,10 +2584,8 @@ static void qeth_free_qdio_buffers(struct qeth_card *card) |
2379 |
+ qeth_free_buffer_pool(card); |
2380 |
+ /* free outbound qdio_qs */ |
2381 |
+ if (card->qdio.out_qs) { |
2382 |
+- for (i = 0; i < card->qdio.no_out_queues; ++i) { |
2383 |
+- qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); |
2384 |
+- qeth_free_qdio_out_buf(card->qdio.out_qs[i]); |
2385 |
+- } |
2386 |
++ for (i = 0; i < card->qdio.no_out_queues; i++) |
2387 |
++ qeth_free_output_queue(card->qdio.out_qs[i]); |
2388 |
+ kfree(card->qdio.out_qs); |
2389 |
+ card->qdio.out_qs = NULL; |
2390 |
+ } |
2391 |
+diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c |
2392 |
+index 6be77b3aa8a5..ac79f2088b31 100644 |
2393 |
+--- a/drivers/scsi/53c700.c |
2394 |
++++ b/drivers/scsi/53c700.c |
2395 |
+@@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, |
2396 |
+ if(tpnt->sdev_attrs == NULL) |
2397 |
+ tpnt->sdev_attrs = NCR_700_dev_attrs; |
2398 |
+ |
2399 |
+- memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript, |
2400 |
++ memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript, |
2401 |
+ GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); |
2402 |
+ if(memory == NULL) { |
2403 |
+ printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n"); |
2404 |
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c |
2405 |
+index 3e38bae6ecde..a284527999c5 100644 |
2406 |
+--- a/drivers/scsi/aacraid/commsup.c |
2407 |
++++ b/drivers/scsi/aacraid/commsup.c |
2408 |
+@@ -1332,8 +1332,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) |
2409 |
+ ADD : DELETE; |
2410 |
+ break; |
2411 |
+ } |
2412 |
+- case AifBuManagerEvent: |
2413 |
+- aac_handle_aif_bu(dev, aifcmd); |
2414 |
++ break; |
2415 |
++ case AifBuManagerEvent: |
2416 |
++ aac_handle_aif_bu(dev, aifcmd); |
2417 |
+ break; |
2418 |
+ } |
2419 |
+ |
2420 |
+diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c |
2421 |
+index 2fd0ec651170..ca7967e390f1 100644 |
2422 |
+--- a/drivers/scsi/libfc/fc_lport.c |
2423 |
++++ b/drivers/scsi/libfc/fc_lport.c |
2424 |
+@@ -1739,14 +1739,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, |
2425 |
+ fc_frame_payload_op(fp) != ELS_LS_ACC) { |
2426 |
+ FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); |
2427 |
+ fc_lport_error(lport, fp); |
2428 |
+- goto err; |
2429 |
++ goto out; |
2430 |
+ } |
2431 |
+ |
2432 |
+ flp = fc_frame_payload_get(fp, sizeof(*flp)); |
2433 |
+ if (!flp) { |
2434 |
+ FC_LPORT_DBG(lport, "FLOGI bad response\n"); |
2435 |
+ fc_lport_error(lport, fp); |
2436 |
+- goto err; |
2437 |
++ goto out; |
2438 |
+ } |
2439 |
+ |
2440 |
+ mfs = ntohs(flp->fl_csp.sp_bb_data) & |
2441 |
+@@ -1756,7 +1756,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, |
2442 |
+ FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
2443 |
+ "lport->mfs:%hu\n", mfs, lport->mfs); |
2444 |
+ fc_lport_error(lport, fp); |
2445 |
+- goto err; |
2446 |
++ goto out; |
2447 |
+ } |
2448 |
+ |
2449 |
+ if (mfs <= lport->mfs) { |
2450 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
2451 |
+index 7f505c027ce7..37d366696d21 100644 |
2452 |
+--- a/drivers/scsi/scsi_lib.c |
2453 |
++++ b/drivers/scsi/scsi_lib.c |
2454 |
+@@ -734,6 +734,7 @@ static blk_status_t __scsi_error_from_host_byte(struct scsi_cmnd *cmd, |
2455 |
+ set_host_byte(cmd, DID_OK); |
2456 |
+ return BLK_STS_TARGET; |
2457 |
+ case DID_NEXUS_FAILURE: |
2458 |
++ set_host_byte(cmd, DID_OK); |
2459 |
+ return BLK_STS_NEXUS; |
2460 |
+ case DID_ALLOC_FAILURE: |
2461 |
+ set_host_byte(cmd, DID_OK); |
2462 |
+diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c |
2463 |
+index 4f27e95efcdd..90892a360c61 100644 |
2464 |
+--- a/drivers/soc/fsl/qbman/qman.c |
2465 |
++++ b/drivers/soc/fsl/qbman/qman.c |
2466 |
+@@ -1048,18 +1048,19 @@ static void qm_mr_process_task(struct work_struct *work); |
2467 |
+ static irqreturn_t portal_isr(int irq, void *ptr) |
2468 |
+ { |
2469 |
+ struct qman_portal *p = ptr; |
2470 |
+- |
2471 |
+- u32 clear = QM_DQAVAIL_MASK | p->irq_sources; |
2472 |
+ u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; |
2473 |
++ u32 clear = 0; |
2474 |
+ |
2475 |
+ if (unlikely(!is)) |
2476 |
+ return IRQ_NONE; |
2477 |
+ |
2478 |
+ /* DQRR-handling if it's interrupt-driven */ |
2479 |
+- if (is & QM_PIRQ_DQRI) |
2480 |
++ if (is & QM_PIRQ_DQRI) { |
2481 |
+ __poll_portal_fast(p, QMAN_POLL_LIMIT); |
2482 |
++ clear = QM_DQAVAIL_MASK | QM_PIRQ_DQRI; |
2483 |
++ } |
2484 |
+ /* Handling of anything else that's interrupt-driven */ |
2485 |
+- clear |= __poll_portal_slow(p, is); |
2486 |
++ clear |= __poll_portal_slow(p, is) & QM_PIRQ_SLOW; |
2487 |
+ qm_out(&p->p, QM_REG_ISR, clear); |
2488 |
+ return IRQ_HANDLED; |
2489 |
+ } |
2490 |
+diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c |
2491 |
+index b6ece18e6a88..e64db42aeb1e 100644 |
2492 |
+--- a/drivers/staging/android/ion/ion_system_heap.c |
2493 |
++++ b/drivers/staging/android/ion/ion_system_heap.c |
2494 |
+@@ -298,10 +298,10 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools, |
2495 |
+ bool cached) |
2496 |
+ { |
2497 |
+ int i; |
2498 |
+- gfp_t gfp_flags = low_order_gfp_flags; |
2499 |
+ |
2500 |
+ for (i = 0; i < NUM_ORDERS; i++) { |
2501 |
+ struct ion_page_pool *pool; |
2502 |
++ gfp_t gfp_flags = low_order_gfp_flags; |
2503 |
+ |
2504 |
+ if (orders[i] > 4) |
2505 |
+ gfp_flags = high_order_gfp_flags; |
2506 |
+diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c |
2507 |
+index 6aa755ad3953..b3a83f5e3a19 100644 |
2508 |
+--- a/drivers/staging/comedi/drivers/ni_660x.c |
2509 |
++++ b/drivers/staging/comedi/drivers/ni_660x.c |
2510 |
+@@ -611,6 +611,7 @@ static int ni_660x_set_pfi_routing(struct comedi_device *dev, |
2511 |
+ case NI_660X_PFI_OUTPUT_DIO: |
2512 |
+ if (chan > 31) |
2513 |
+ return -EINVAL; |
2514 |
++ break; |
2515 |
+ default: |
2516 |
+ return -EINVAL; |
2517 |
+ } |
2518 |
+diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c |
2519 |
+index 119f3459b5bb..2fc6426c3819 100644 |
2520 |
+--- a/drivers/staging/wilc1000/linux_wlan.c |
2521 |
++++ b/drivers/staging/wilc1000/linux_wlan.c |
2522 |
+@@ -1238,8 +1238,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, |
2523 |
+ vif->wilc = *wilc; |
2524 |
+ vif->ndev = ndev; |
2525 |
+ wl->vif[i] = vif; |
2526 |
+- wl->vif_num = i; |
2527 |
+- vif->idx = wl->vif_num; |
2528 |
++ wl->vif_num = i + 1; |
2529 |
++ vif->idx = i; |
2530 |
+ |
2531 |
+ ndev->netdev_ops = &wilc_netdev_ops; |
2532 |
+ |
2533 |
+diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig |
2534 |
+index aff702c0eb9f..85a92d0813dd 100644 |
2535 |
+--- a/drivers/usb/phy/Kconfig |
2536 |
++++ b/drivers/usb/phy/Kconfig |
2537 |
+@@ -21,7 +21,7 @@ config AB8500_USB |
2538 |
+ |
2539 |
+ config FSL_USB2_OTG |
2540 |
+ bool "Freescale USB OTG Transceiver Driver" |
2541 |
+- depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM |
2542 |
++ depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM |
2543 |
+ depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' |
2544 |
+ select USB_PHY |
2545 |
+ help |
2546 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
2547 |
+index c931ae689a91..d8e6790ccffe 100644 |
2548 |
+--- a/drivers/usb/serial/cp210x.c |
2549 |
++++ b/drivers/usb/serial/cp210x.c |
2550 |
+@@ -64,6 +64,7 @@ static const struct usb_device_id id_table[] = { |
2551 |
+ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ |
2552 |
+ { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ |
2553 |
+ { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ |
2554 |
++ { USB_DEVICE(0x0B00, 0x3070) }, /* Ingenico 3070 */ |
2555 |
+ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ |
2556 |
+ { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ |
2557 |
+ { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
2558 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
2559 |
+index 385f2ae3be24..d45a2c352c98 100644 |
2560 |
+--- a/drivers/usb/serial/ftdi_sio.c |
2561 |
++++ b/drivers/usb/serial/ftdi_sio.c |
2562 |
+@@ -1020,6 +1020,8 @@ static const struct usb_device_id id_table_combined[] = { |
2563 |
+ { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) }, |
2564 |
+ { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) }, |
2565 |
+ { USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) }, |
2566 |
++ /* EZPrototypes devices */ |
2567 |
++ { USB_DEVICE(EZPROTOTYPES_VID, HJELMSLUND_USB485_ISO_PID) }, |
2568 |
+ { } /* Terminating entry */ |
2569 |
+ }; |
2570 |
+ |
2571 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
2572 |
+index 975d02666c5a..b863bedb55a1 100644 |
2573 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
2574 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
2575 |
+@@ -1308,6 +1308,12 @@ |
2576 |
+ #define IONICS_VID 0x1c0c |
2577 |
+ #define IONICS_PLUGCOMPUTER_PID 0x0102 |
2578 |
+ |
2579 |
++/* |
2580 |
++ * EZPrototypes (PID reseller) |
2581 |
++ */ |
2582 |
++#define EZPROTOTYPES_VID 0x1c40 |
2583 |
++#define HJELMSLUND_USB485_ISO_PID 0x0477 |
2584 |
++ |
2585 |
+ /* |
2586 |
+ * Dresden Elektronik Sensor Terminal Board |
2587 |
+ */ |
2588 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2589 |
+index 8cdca3f7acaa..bf72245f1cea 100644 |
2590 |
+--- a/drivers/usb/serial/option.c |
2591 |
++++ b/drivers/usb/serial/option.c |
2592 |
+@@ -1151,6 +1151,8 @@ static const struct usb_device_id option_ids[] = { |
2593 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
2594 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
2595 |
+ .driver_info = NCTRL(0) | RSVD(3) }, |
2596 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */ |
2597 |
++ .driver_info = NCTRL(0) }, |
2598 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
2599 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
2600 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
2601 |
+diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c |
2602 |
+index 57725d4a8c59..141f9bc213a3 100644 |
2603 |
+--- a/fs/autofs4/expire.c |
2604 |
++++ b/fs/autofs4/expire.c |
2605 |
+@@ -567,7 +567,6 @@ int autofs4_expire_run(struct super_block *sb, |
2606 |
+ pkt.len = dentry->d_name.len; |
2607 |
+ memcpy(pkt.name, dentry->d_name.name, pkt.len); |
2608 |
+ pkt.name[pkt.len] = '\0'; |
2609 |
+- dput(dentry); |
2610 |
+ |
2611 |
+ if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) |
2612 |
+ ret = -EFAULT; |
2613 |
+@@ -580,6 +579,8 @@ int autofs4_expire_run(struct super_block *sb, |
2614 |
+ complete_all(&ino->expire_complete); |
2615 |
+ spin_unlock(&sbi->fs_lock); |
2616 |
+ |
2617 |
++ dput(dentry); |
2618 |
++ |
2619 |
+ return ret; |
2620 |
+ } |
2621 |
+ |
2622 |
+diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c |
2623 |
+index 3c7e727612fa..e455388a939c 100644 |
2624 |
+--- a/fs/autofs4/inode.c |
2625 |
++++ b/fs/autofs4/inode.c |
2626 |
+@@ -259,8 +259,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) |
2627 |
+ } |
2628 |
+ root_inode = autofs4_get_inode(s, S_IFDIR | 0755); |
2629 |
+ root = d_make_root(root_inode); |
2630 |
+- if (!root) |
2631 |
++ if (!root) { |
2632 |
++ ret = -ENOMEM; |
2633 |
+ goto fail_ino; |
2634 |
++ } |
2635 |
+ pipe = NULL; |
2636 |
+ |
2637 |
+ root->d_fsdata = ino; |
2638 |
+diff --git a/fs/buffer.c b/fs/buffer.c |
2639 |
+index b96f3b98a6ef..8086cc8ff0bc 100644 |
2640 |
+--- a/fs/buffer.c |
2641 |
++++ b/fs/buffer.c |
2642 |
+@@ -208,6 +208,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) |
2643 |
+ struct buffer_head *head; |
2644 |
+ struct page *page; |
2645 |
+ int all_mapped = 1; |
2646 |
++ static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1); |
2647 |
+ |
2648 |
+ index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); |
2649 |
+ page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); |
2650 |
+@@ -235,15 +236,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) |
2651 |
+ * file io on the block device and getblk. It gets dealt with |
2652 |
+ * elsewhere, don't buffer_error if we had some unmapped buffers |
2653 |
+ */ |
2654 |
+- if (all_mapped) { |
2655 |
+- printk("__find_get_block_slow() failed. " |
2656 |
+- "block=%llu, b_blocknr=%llu\n", |
2657 |
+- (unsigned long long)block, |
2658 |
+- (unsigned long long)bh->b_blocknr); |
2659 |
+- printk("b_state=0x%08lx, b_size=%zu\n", |
2660 |
+- bh->b_state, bh->b_size); |
2661 |
+- printk("device %pg blocksize: %d\n", bdev, |
2662 |
+- 1 << bd_inode->i_blkbits); |
2663 |
++ ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE); |
2664 |
++ if (all_mapped && __ratelimit(&last_warned)) { |
2665 |
++ printk("__find_get_block_slow() failed. block=%llu, " |
2666 |
++ "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, " |
2667 |
++ "device %pg blocksize: %d\n", |
2668 |
++ (unsigned long long)block, |
2669 |
++ (unsigned long long)bh->b_blocknr, |
2670 |
++ bh->b_state, bh->b_size, bdev, |
2671 |
++ 1 << bd_inode->i_blkbits); |
2672 |
+ } |
2673 |
+ out_unlock: |
2674 |
+ spin_unlock(&bd_mapping->private_lock); |
2675 |
+diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h |
2676 |
+index e52454059725..bad458a2b579 100644 |
2677 |
+--- a/fs/cifs/smb2pdu.h |
2678 |
++++ b/fs/cifs/smb2pdu.h |
2679 |
+@@ -84,8 +84,8 @@ |
2680 |
+ |
2681 |
+ #define NUMBER_OF_SMB2_COMMANDS 0x0013 |
2682 |
+ |
2683 |
+-/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */ |
2684 |
+-#define MAX_SMB2_HDR_SIZE 0x00b0 |
2685 |
++/* 52 transform hdr + 64 hdr + 88 create rsp */ |
2686 |
++#define MAX_SMB2_HDR_SIZE 204 |
2687 |
+ |
2688 |
+ #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) |
2689 |
+ #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd) |
2690 |
+diff --git a/fs/drop_caches.c b/fs/drop_caches.c |
2691 |
+index 82377017130f..d31b6c72b476 100644 |
2692 |
+--- a/fs/drop_caches.c |
2693 |
++++ b/fs/drop_caches.c |
2694 |
+@@ -21,8 +21,13 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) |
2695 |
+ spin_lock(&sb->s_inode_list_lock); |
2696 |
+ list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
2697 |
+ spin_lock(&inode->i_lock); |
2698 |
++ /* |
2699 |
++ * We must skip inodes in unusual state. We may also skip |
2700 |
++ * inodes without pages but we deliberately won't in case |
2701 |
++ * we need to reschedule to avoid softlockups. |
2702 |
++ */ |
2703 |
+ if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || |
2704 |
+- (inode->i_mapping->nrpages == 0)) { |
2705 |
++ (inode->i_mapping->nrpages == 0 && !need_resched())) { |
2706 |
+ spin_unlock(&inode->i_lock); |
2707 |
+ continue; |
2708 |
+ } |
2709 |
+@@ -30,6 +35,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) |
2710 |
+ spin_unlock(&inode->i_lock); |
2711 |
+ spin_unlock(&sb->s_inode_list_lock); |
2712 |
+ |
2713 |
++ cond_resched(); |
2714 |
+ invalidate_mapping_pages(inode->i_mapping, 0, -1); |
2715 |
+ iput(toput_inode); |
2716 |
+ toput_inode = inode; |
2717 |
+diff --git a/fs/exec.c b/fs/exec.c |
2718 |
+index 0da4d748b4e6..0936b5a8199a 100644 |
2719 |
+--- a/fs/exec.c |
2720 |
++++ b/fs/exec.c |
2721 |
+@@ -925,7 +925,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size, |
2722 |
+ bytes = kernel_read(file, *buf + pos, i_size - pos, &pos); |
2723 |
+ if (bytes < 0) { |
2724 |
+ ret = bytes; |
2725 |
+- goto out; |
2726 |
++ goto out_free; |
2727 |
+ } |
2728 |
+ |
2729 |
+ if (bytes == 0) |
2730 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
2731 |
+index 11066d8647d2..d5284d0dbdb5 100644 |
2732 |
+--- a/fs/gfs2/glock.c |
2733 |
++++ b/fs/gfs2/glock.c |
2734 |
+@@ -107,7 +107,7 @@ static int glock_wake_function(wait_queue_entry_t *wait, unsigned int mode, |
2735 |
+ |
2736 |
+ static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name) |
2737 |
+ { |
2738 |
+- u32 hash = jhash2((u32 *)name, sizeof(*name) / 4, 0); |
2739 |
++ u32 hash = jhash2((u32 *)name, ht_parms.key_len / 4, 0); |
2740 |
+ |
2741 |
+ return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); |
2742 |
+ } |
2743 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
2744 |
+index 2a6ed036d207..eb6f3de29f69 100644 |
2745 |
+--- a/fs/hugetlbfs/inode.c |
2746 |
++++ b/fs/hugetlbfs/inode.c |
2747 |
+@@ -845,6 +845,18 @@ static int hugetlbfs_migrate_page(struct address_space *mapping, |
2748 |
+ rc = migrate_huge_page_move_mapping(mapping, newpage, page); |
2749 |
+ if (rc != MIGRATEPAGE_SUCCESS) |
2750 |
+ return rc; |
2751 |
++ |
2752 |
++ /* |
2753 |
++ * page_private is subpool pointer in hugetlb pages. Transfer to |
2754 |
++ * new page. PagePrivate is not associated with page_private for |
2755 |
++ * hugetlb pages and can not be set here as only page_huge_active |
2756 |
++ * pages can be migrated. |
2757 |
++ */ |
2758 |
++ if (page_private(page)) { |
2759 |
++ set_page_private(newpage, page_private(page)); |
2760 |
++ set_page_private(page, 0); |
2761 |
++ } |
2762 |
++ |
2763 |
+ if (mode != MIGRATE_SYNC_NO_COPY) |
2764 |
+ migrate_page_copy(newpage, page); |
2765 |
+ else |
2766 |
+diff --git a/fs/nfs/super.c b/fs/nfs/super.c |
2767 |
+index 3c4aeb83e1c4..77d8d03344c8 100644 |
2768 |
+--- a/fs/nfs/super.c |
2769 |
++++ b/fs/nfs/super.c |
2770 |
+@@ -1901,6 +1901,11 @@ static int nfs_parse_devname(const char *dev_name, |
2771 |
+ size_t len; |
2772 |
+ char *end; |
2773 |
+ |
2774 |
++ if (unlikely(!dev_name || !*dev_name)) { |
2775 |
++ dfprintk(MOUNT, "NFS: device name not specified\n"); |
2776 |
++ return -EINVAL; |
2777 |
++ } |
2778 |
++ |
2779 |
+ /* Is the host name protected with square brakcets? */ |
2780 |
+ if (*dev_name == '[') { |
2781 |
+ end = strchr(++dev_name, ']'); |
2782 |
+diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h |
2783 |
+index beab0f0d0cfb..250e2d13c61b 100644 |
2784 |
+--- a/include/drm/drm_cache.h |
2785 |
++++ b/include/drm/drm_cache.h |
2786 |
+@@ -45,6 +45,24 @@ static inline bool drm_arch_can_wc_memory(void) |
2787 |
+ return false; |
2788 |
+ #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) |
2789 |
+ return false; |
2790 |
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) |
2791 |
++ /* |
2792 |
++ * The DRM driver stack is designed to work with cache coherent devices |
2793 |
++ * only, but permits an optimization to be enabled in some cases, where |
2794 |
++ * for some buffers, both the CPU and the GPU use uncached mappings, |
2795 |
++ * removing the need for DMA snooping and allocation in the CPU caches. |
2796 |
++ * |
2797 |
++ * The use of uncached GPU mappings relies on the correct implementation |
2798 |
++ * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU |
2799 |
++ * will use cached mappings nonetheless. On x86 platforms, this does not |
2800 |
++ * seem to matter, as uncached CPU mappings will snoop the caches in any |
2801 |
++ * case. However, on ARM and arm64, enabling this optimization on a |
2802 |
++ * platform where NoSnoop is ignored results in loss of coherency, which |
2803 |
++ * breaks correct operation of the device. Since we have no way of |
2804 |
++ * detecting whether NoSnoop works or not, just disable this |
2805 |
++ * optimization entirely for ARM and arm64. |
2806 |
++ */ |
2807 |
++ return false; |
2808 |
+ #else |
2809 |
+ return true; |
2810 |
+ #endif |
2811 |
+diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h |
2812 |
+index cbf85c4c745f..cad1eb50d668 100644 |
2813 |
+--- a/include/linux/cpufreq.h |
2814 |
++++ b/include/linux/cpufreq.h |
2815 |
+@@ -254,20 +254,12 @@ __ATTR(_name, 0644, show_##_name, store_##_name) |
2816 |
+ static struct freq_attr _name = \ |
2817 |
+ __ATTR(_name, 0200, NULL, store_##_name) |
2818 |
+ |
2819 |
+-struct global_attr { |
2820 |
+- struct attribute attr; |
2821 |
+- ssize_t (*show)(struct kobject *kobj, |
2822 |
+- struct attribute *attr, char *buf); |
2823 |
+- ssize_t (*store)(struct kobject *a, struct attribute *b, |
2824 |
+- const char *c, size_t count); |
2825 |
+-}; |
2826 |
+- |
2827 |
+ #define define_one_global_ro(_name) \ |
2828 |
+-static struct global_attr _name = \ |
2829 |
++static struct kobj_attribute _name = \ |
2830 |
+ __ATTR(_name, 0444, show_##_name, NULL) |
2831 |
+ |
2832 |
+ #define define_one_global_rw(_name) \ |
2833 |
+-static struct global_attr _name = \ |
2834 |
++static struct kobj_attribute _name = \ |
2835 |
+ __ATTR(_name, 0644, show_##_name, store_##_name) |
2836 |
+ |
2837 |
+ |
2838 |
+diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h |
2839 |
+index bacb499c512c..845ff8c51564 100644 |
2840 |
+--- a/include/linux/irqchip/arm-gic-v3.h |
2841 |
++++ b/include/linux/irqchip/arm-gic-v3.h |
2842 |
+@@ -306,7 +306,7 @@ |
2843 |
+ #define GITS_TYPER_PLPIS (1UL << 0) |
2844 |
+ #define GITS_TYPER_VLPIS (1UL << 1) |
2845 |
+ #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 |
2846 |
+-#define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0x1f) + 1) |
2847 |
++#define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0xf) + 1) |
2848 |
+ #define GITS_TYPER_IDBITS_SHIFT 8 |
2849 |
+ #define GITS_TYPER_DEVBITS_SHIFT 13 |
2850 |
+ #define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) |
2851 |
+diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h |
2852 |
+index 32feac5bbd75..5844105a482b 100644 |
2853 |
+--- a/include/linux/stmmac.h |
2854 |
++++ b/include/linux/stmmac.h |
2855 |
+@@ -183,6 +183,7 @@ struct plat_stmmacenet_data { |
2856 |
+ struct clk *pclk; |
2857 |
+ struct clk *clk_ptp_ref; |
2858 |
+ unsigned int clk_ptp_rate; |
2859 |
++ unsigned int clk_ref_rate; |
2860 |
+ struct reset_control *stmmac_rst; |
2861 |
+ struct stmmac_axi *axi; |
2862 |
+ int has_gmac4; |
2863 |
+diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h |
2864 |
+index 020142bb9735..2e1d36b33db7 100644 |
2865 |
+--- a/include/net/bluetooth/bluetooth.h |
2866 |
++++ b/include/net/bluetooth/bluetooth.h |
2867 |
+@@ -273,7 +273,7 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
2868 |
+ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); |
2869 |
+ int bt_sock_wait_ready(struct sock *sk, unsigned long flags); |
2870 |
+ |
2871 |
+-void bt_accept_enqueue(struct sock *parent, struct sock *sk); |
2872 |
++void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh); |
2873 |
+ void bt_accept_unlink(struct sock *sk); |
2874 |
+ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); |
2875 |
+ |
2876 |
+diff --git a/include/net/icmp.h b/include/net/icmp.h |
2877 |
+index 3ef2743a8eec..8665bf24e3b7 100644 |
2878 |
+--- a/include/net/icmp.h |
2879 |
++++ b/include/net/icmp.h |
2880 |
+@@ -22,6 +22,7 @@ |
2881 |
+ |
2882 |
+ #include <net/inet_sock.h> |
2883 |
+ #include <net/snmp.h> |
2884 |
++#include <net/ip.h> |
2885 |
+ |
2886 |
+ struct icmp_err { |
2887 |
+ int errno; |
2888 |
+@@ -39,7 +40,13 @@ struct net_proto_family; |
2889 |
+ struct sk_buff; |
2890 |
+ struct net; |
2891 |
+ |
2892 |
+-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
2893 |
++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
2894 |
++ const struct ip_options *opt); |
2895 |
++static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
2896 |
++{ |
2897 |
++ __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt); |
2898 |
++} |
2899 |
++ |
2900 |
+ int icmp_rcv(struct sk_buff *skb); |
2901 |
+ void icmp_err(struct sk_buff *skb, u32 info); |
2902 |
+ int icmp_init(void); |
2903 |
+diff --git a/include/net/ip.h b/include/net/ip.h |
2904 |
+index 7c430343176a..80575db4e304 100644 |
2905 |
+--- a/include/net/ip.h |
2906 |
++++ b/include/net/ip.h |
2907 |
+@@ -593,6 +593,8 @@ static inline int ip_options_echo(struct net *net, struct ip_options *dopt, |
2908 |
+ } |
2909 |
+ |
2910 |
+ void ip_options_fragment(struct sk_buff *skb); |
2911 |
++int __ip_options_compile(struct net *net, struct ip_options *opt, |
2912 |
++ struct sk_buff *skb, __be32 *info); |
2913 |
+ int ip_options_compile(struct net *net, struct ip_options *opt, |
2914 |
+ struct sk_buff *skb); |
2915 |
+ int ip_options_get(struct net *net, struct ip_options_rcu **optp, |
2916 |
+diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c |
2917 |
+index 3d0ecc273cc6..84237f640789 100644 |
2918 |
+--- a/kernel/bpf/hashtab.c |
2919 |
++++ b/kernel/bpf/hashtab.c |
2920 |
+@@ -655,7 +655,7 @@ static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l) |
2921 |
+ } |
2922 |
+ |
2923 |
+ if (htab_is_prealloc(htab)) { |
2924 |
+- pcpu_freelist_push(&htab->freelist, &l->fnode); |
2925 |
++ __pcpu_freelist_push(&htab->freelist, &l->fnode); |
2926 |
+ } else { |
2927 |
+ atomic_dec(&htab->count); |
2928 |
+ l->htab = htab; |
2929 |
+@@ -717,7 +717,7 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, |
2930 |
+ } else { |
2931 |
+ struct pcpu_freelist_node *l; |
2932 |
+ |
2933 |
+- l = pcpu_freelist_pop(&htab->freelist); |
2934 |
++ l = __pcpu_freelist_pop(&htab->freelist); |
2935 |
+ if (!l) |
2936 |
+ return ERR_PTR(-E2BIG); |
2937 |
+ l_new = container_of(l, struct htab_elem, fnode); |
2938 |
+diff --git a/kernel/bpf/percpu_freelist.c b/kernel/bpf/percpu_freelist.c |
2939 |
+index 673fa6fe2d73..0c1b4ba9e90e 100644 |
2940 |
+--- a/kernel/bpf/percpu_freelist.c |
2941 |
++++ b/kernel/bpf/percpu_freelist.c |
2942 |
+@@ -28,8 +28,8 @@ void pcpu_freelist_destroy(struct pcpu_freelist *s) |
2943 |
+ free_percpu(s->freelist); |
2944 |
+ } |
2945 |
+ |
2946 |
+-static inline void __pcpu_freelist_push(struct pcpu_freelist_head *head, |
2947 |
+- struct pcpu_freelist_node *node) |
2948 |
++static inline void ___pcpu_freelist_push(struct pcpu_freelist_head *head, |
2949 |
++ struct pcpu_freelist_node *node) |
2950 |
+ { |
2951 |
+ raw_spin_lock(&head->lock); |
2952 |
+ node->next = head->first; |
2953 |
+@@ -37,12 +37,22 @@ static inline void __pcpu_freelist_push(struct pcpu_freelist_head *head, |
2954 |
+ raw_spin_unlock(&head->lock); |
2955 |
+ } |
2956 |
+ |
2957 |
+-void pcpu_freelist_push(struct pcpu_freelist *s, |
2958 |
++void __pcpu_freelist_push(struct pcpu_freelist *s, |
2959 |
+ struct pcpu_freelist_node *node) |
2960 |
+ { |
2961 |
+ struct pcpu_freelist_head *head = this_cpu_ptr(s->freelist); |
2962 |
+ |
2963 |
+- __pcpu_freelist_push(head, node); |
2964 |
++ ___pcpu_freelist_push(head, node); |
2965 |
++} |
2966 |
++ |
2967 |
++void pcpu_freelist_push(struct pcpu_freelist *s, |
2968 |
++ struct pcpu_freelist_node *node) |
2969 |
++{ |
2970 |
++ unsigned long flags; |
2971 |
++ |
2972 |
++ local_irq_save(flags); |
2973 |
++ __pcpu_freelist_push(s, node); |
2974 |
++ local_irq_restore(flags); |
2975 |
+ } |
2976 |
+ |
2977 |
+ void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size, |
2978 |
+@@ -63,7 +73,7 @@ void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size, |
2979 |
+ for_each_possible_cpu(cpu) { |
2980 |
+ again: |
2981 |
+ head = per_cpu_ptr(s->freelist, cpu); |
2982 |
+- __pcpu_freelist_push(head, buf); |
2983 |
++ ___pcpu_freelist_push(head, buf); |
2984 |
+ i++; |
2985 |
+ buf += elem_size; |
2986 |
+ if (i == nr_elems) |
2987 |
+@@ -74,14 +84,12 @@ again: |
2988 |
+ local_irq_restore(flags); |
2989 |
+ } |
2990 |
+ |
2991 |
+-struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
2992 |
++struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *s) |
2993 |
+ { |
2994 |
+ struct pcpu_freelist_head *head; |
2995 |
+ struct pcpu_freelist_node *node; |
2996 |
+- unsigned long flags; |
2997 |
+ int orig_cpu, cpu; |
2998 |
+ |
2999 |
+- local_irq_save(flags); |
3000 |
+ orig_cpu = cpu = raw_smp_processor_id(); |
3001 |
+ while (1) { |
3002 |
+ head = per_cpu_ptr(s->freelist, cpu); |
3003 |
+@@ -89,16 +97,25 @@ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
3004 |
+ node = head->first; |
3005 |
+ if (node) { |
3006 |
+ head->first = node->next; |
3007 |
+- raw_spin_unlock_irqrestore(&head->lock, flags); |
3008 |
++ raw_spin_unlock(&head->lock); |
3009 |
+ return node; |
3010 |
+ } |
3011 |
+ raw_spin_unlock(&head->lock); |
3012 |
+ cpu = cpumask_next(cpu, cpu_possible_mask); |
3013 |
+ if (cpu >= nr_cpu_ids) |
3014 |
+ cpu = 0; |
3015 |
+- if (cpu == orig_cpu) { |
3016 |
+- local_irq_restore(flags); |
3017 |
++ if (cpu == orig_cpu) |
3018 |
+ return NULL; |
3019 |
+- } |
3020 |
+ } |
3021 |
+ } |
3022 |
++ |
3023 |
++struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
3024 |
++{ |
3025 |
++ struct pcpu_freelist_node *ret; |
3026 |
++ unsigned long flags; |
3027 |
++ |
3028 |
++ local_irq_save(flags); |
3029 |
++ ret = __pcpu_freelist_pop(s); |
3030 |
++ local_irq_restore(flags); |
3031 |
++ return ret; |
3032 |
++} |
3033 |
+diff --git a/kernel/bpf/percpu_freelist.h b/kernel/bpf/percpu_freelist.h |
3034 |
+index 3049aae8ea1e..c3960118e617 100644 |
3035 |
+--- a/kernel/bpf/percpu_freelist.h |
3036 |
++++ b/kernel/bpf/percpu_freelist.h |
3037 |
+@@ -22,8 +22,12 @@ struct pcpu_freelist_node { |
3038 |
+ struct pcpu_freelist_node *next; |
3039 |
+ }; |
3040 |
+ |
3041 |
++/* pcpu_freelist_* do spin_lock_irqsave. */ |
3042 |
+ void pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *); |
3043 |
+ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *); |
3044 |
++/* __pcpu_freelist_* do spin_lock only. caller must disable irqs. */ |
3045 |
++void __pcpu_freelist_push(struct pcpu_freelist *, struct pcpu_freelist_node *); |
3046 |
++struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *); |
3047 |
+ void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size, |
3048 |
+ u32 nr_elems); |
3049 |
+ int pcpu_freelist_init(struct pcpu_freelist *); |
3050 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
3051 |
+index 17d5d41464c6..92939b5397df 100644 |
3052 |
+--- a/kernel/events/core.c |
3053 |
++++ b/kernel/events/core.c |
3054 |
+@@ -436,18 +436,18 @@ int perf_proc_update_handler(struct ctl_table *table, int write, |
3055 |
+ void __user *buffer, size_t *lenp, |
3056 |
+ loff_t *ppos) |
3057 |
+ { |
3058 |
+- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
3059 |
+- |
3060 |
+- if (ret || !write) |
3061 |
+- return ret; |
3062 |
+- |
3063 |
++ int ret; |
3064 |
++ int perf_cpu = sysctl_perf_cpu_time_max_percent; |
3065 |
+ /* |
3066 |
+ * If throttling is disabled don't allow the write: |
3067 |
+ */ |
3068 |
+- if (sysctl_perf_cpu_time_max_percent == 100 || |
3069 |
+- sysctl_perf_cpu_time_max_percent == 0) |
3070 |
++ if (write && (perf_cpu == 100 || perf_cpu == 0)) |
3071 |
+ return -EINVAL; |
3072 |
+ |
3073 |
++ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
3074 |
++ if (ret || !write) |
3075 |
++ return ret; |
3076 |
++ |
3077 |
+ max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ); |
3078 |
+ perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate; |
3079 |
+ update_perf_cpu_limits(); |
3080 |
+diff --git a/kernel/relay.c b/kernel/relay.c |
3081 |
+index 1537158c67b3..61d37e6da22d 100644 |
3082 |
+--- a/kernel/relay.c |
3083 |
++++ b/kernel/relay.c |
3084 |
+@@ -427,6 +427,8 @@ static struct dentry *relay_create_buf_file(struct rchan *chan, |
3085 |
+ dentry = chan->cb->create_buf_file(tmpname, chan->parent, |
3086 |
+ S_IRUSR, buf, |
3087 |
+ &chan->is_global); |
3088 |
++ if (IS_ERR(dentry)) |
3089 |
++ dentry = NULL; |
3090 |
+ |
3091 |
+ kfree(tmpname); |
3092 |
+ |
3093 |
+@@ -460,7 +462,7 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu) |
3094 |
+ dentry = chan->cb->create_buf_file(NULL, NULL, |
3095 |
+ S_IRUSR, buf, |
3096 |
+ &chan->is_global); |
3097 |
+- if (WARN_ON(dentry)) |
3098 |
++ if (IS_ERR_OR_NULL(dentry)) |
3099 |
+ goto free_buf; |
3100 |
+ } |
3101 |
+ |
3102 |
+diff --git a/lib/test_kmod.c b/lib/test_kmod.c |
3103 |
+index 7abb59ce6613..cf619795a182 100644 |
3104 |
+--- a/lib/test_kmod.c |
3105 |
++++ b/lib/test_kmod.c |
3106 |
+@@ -632,7 +632,7 @@ static void __kmod_config_free(struct test_config *config) |
3107 |
+ config->test_driver = NULL; |
3108 |
+ |
3109 |
+ kfree_const(config->test_fs); |
3110 |
+- config->test_driver = NULL; |
3111 |
++ config->test_fs = NULL; |
3112 |
+ } |
3113 |
+ |
3114 |
+ static void kmod_config_free(struct kmod_test_device *test_dev) |
3115 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
3116 |
+index 224cdd953a79..7f75bd2fb8a7 100644 |
3117 |
+--- a/mm/hugetlb.c |
3118 |
++++ b/mm/hugetlb.c |
3119 |
+@@ -3577,7 +3577,6 @@ retry_avoidcopy: |
3120 |
+ copy_user_huge_page(new_page, old_page, address, vma, |
3121 |
+ pages_per_huge_page(h)); |
3122 |
+ __SetPageUptodate(new_page); |
3123 |
+- set_page_huge_active(new_page); |
3124 |
+ |
3125 |
+ mmun_start = address & huge_page_mask(h); |
3126 |
+ mmun_end = mmun_start + huge_page_size(h); |
3127 |
+@@ -3600,6 +3599,7 @@ retry_avoidcopy: |
3128 |
+ make_huge_pte(vma, new_page, 1)); |
3129 |
+ page_remove_rmap(old_page, true); |
3130 |
+ hugepage_add_new_anon_rmap(new_page, vma, address); |
3131 |
++ set_page_huge_active(new_page); |
3132 |
+ /* Make the old page be freed below */ |
3133 |
+ new_page = old_page; |
3134 |
+ } |
3135 |
+@@ -3682,6 +3682,7 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, |
3136 |
+ struct page *page; |
3137 |
+ pte_t new_pte; |
3138 |
+ spinlock_t *ptl; |
3139 |
++ bool new_page = false; |
3140 |
+ |
3141 |
+ /* |
3142 |
+ * Currently, we are forced to kill the process in the event the |
3143 |
+@@ -3747,7 +3748,7 @@ retry: |
3144 |
+ } |
3145 |
+ clear_huge_page(page, address, pages_per_huge_page(h)); |
3146 |
+ __SetPageUptodate(page); |
3147 |
+- set_page_huge_active(page); |
3148 |
++ new_page = true; |
3149 |
+ |
3150 |
+ if (vma->vm_flags & VM_MAYSHARE) { |
3151 |
+ int err = huge_add_to_page_cache(page, mapping, idx); |
3152 |
+@@ -3818,6 +3819,15 @@ retry: |
3153 |
+ } |
3154 |
+ |
3155 |
+ spin_unlock(ptl); |
3156 |
++ |
3157 |
++ /* |
3158 |
++ * Only make newly allocated pages active. Existing pages found |
3159 |
++ * in the pagecache could be !page_huge_active() if they have been |
3160 |
++ * isolated for migration. |
3161 |
++ */ |
3162 |
++ if (new_page) |
3163 |
++ set_page_huge_active(page); |
3164 |
++ |
3165 |
+ unlock_page(page); |
3166 |
+ out: |
3167 |
+ return ret; |
3168 |
+@@ -4053,7 +4063,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, |
3169 |
+ * the set_pte_at() write. |
3170 |
+ */ |
3171 |
+ __SetPageUptodate(page); |
3172 |
+- set_page_huge_active(page); |
3173 |
+ |
3174 |
+ mapping = dst_vma->vm_file->f_mapping; |
3175 |
+ idx = vma_hugecache_offset(h, dst_vma, dst_addr); |
3176 |
+@@ -4121,6 +4130,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, |
3177 |
+ update_mmu_cache(dst_vma, dst_addr, dst_pte); |
3178 |
+ |
3179 |
+ spin_unlock(ptl); |
3180 |
++ set_page_huge_active(page); |
3181 |
+ if (vm_shared) |
3182 |
+ unlock_page(page); |
3183 |
+ ret = 0; |
3184 |
+diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
3185 |
+index c7c74a927d6f..c9d3a49bd4e2 100644 |
3186 |
+--- a/mm/memory_hotplug.c |
3187 |
++++ b/mm/memory_hotplug.c |
3188 |
+@@ -1256,7 +1256,8 @@ static struct page *next_active_pageblock(struct page *page) |
3189 |
+ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) |
3190 |
+ { |
3191 |
+ struct page *page = pfn_to_page(start_pfn); |
3192 |
+- struct page *end_page = page + nr_pages; |
3193 |
++ unsigned long end_pfn = min(start_pfn + nr_pages, zone_end_pfn(page_zone(page))); |
3194 |
++ struct page *end_page = pfn_to_page(end_pfn); |
3195 |
+ |
3196 |
+ /* Check the starting page of each pageblock within the range */ |
3197 |
+ for (; page < end_page; page = next_active_pageblock(page)) { |
3198 |
+@@ -1296,6 +1297,9 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
3199 |
+ i++; |
3200 |
+ if (i == MAX_ORDER_NR_PAGES || pfn + i >= end_pfn) |
3201 |
+ continue; |
3202 |
++ /* Check if we got outside of the zone */ |
3203 |
++ if (zone && !zone_spans_pfn(zone, pfn + i)) |
3204 |
++ return 0; |
3205 |
+ page = pfn_to_page(pfn + i); |
3206 |
+ if (zone && page_zone(page) != zone) |
3207 |
+ return 0; |
3208 |
+diff --git a/mm/migrate.c b/mm/migrate.c |
3209 |
+index 8c57cdd77ba5..877269339fa7 100644 |
3210 |
+--- a/mm/migrate.c |
3211 |
++++ b/mm/migrate.c |
3212 |
+@@ -1303,6 +1303,16 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
3213 |
+ lock_page(hpage); |
3214 |
+ } |
3215 |
+ |
3216 |
++ /* |
3217 |
++ * Check for pages which are in the process of being freed. Without |
3218 |
++ * page_mapping() set, hugetlbfs specific move page routine will not |
3219 |
++ * be called and we could leak usage counts for subpools. |
3220 |
++ */ |
3221 |
++ if (page_private(hpage) && !page_mapping(hpage)) { |
3222 |
++ rc = -EBUSY; |
3223 |
++ goto out_unlock; |
3224 |
++ } |
3225 |
++ |
3226 |
+ if (PageAnon(hpage)) |
3227 |
+ anon_vma = page_get_anon_vma(hpage); |
3228 |
+ |
3229 |
+@@ -1334,6 +1344,7 @@ put_anon: |
3230 |
+ set_page_owner_migrate_reason(new_hpage, reason); |
3231 |
+ } |
3232 |
+ |
3233 |
++out_unlock: |
3234 |
+ unlock_page(hpage); |
3235 |
+ out: |
3236 |
+ if (rc != -EAGAIN) |
3237 |
+diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c |
3238 |
+index 583951e82cee..b216e697deac 100644 |
3239 |
+--- a/net/bluetooth/af_bluetooth.c |
3240 |
++++ b/net/bluetooth/af_bluetooth.c |
3241 |
+@@ -154,15 +154,25 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk) |
3242 |
+ } |
3243 |
+ EXPORT_SYMBOL(bt_sock_unlink); |
3244 |
+ |
3245 |
+-void bt_accept_enqueue(struct sock *parent, struct sock *sk) |
3246 |
++void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh) |
3247 |
+ { |
3248 |
+ BT_DBG("parent %p, sk %p", parent, sk); |
3249 |
+ |
3250 |
+ sock_hold(sk); |
3251 |
+- lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
3252 |
++ |
3253 |
++ if (bh) |
3254 |
++ bh_lock_sock_nested(sk); |
3255 |
++ else |
3256 |
++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
3257 |
++ |
3258 |
+ list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q); |
3259 |
+ bt_sk(sk)->parent = parent; |
3260 |
+- release_sock(sk); |
3261 |
++ |
3262 |
++ if (bh) |
3263 |
++ bh_unlock_sock(sk); |
3264 |
++ else |
3265 |
++ release_sock(sk); |
3266 |
++ |
3267 |
+ parent->sk_ack_backlog++; |
3268 |
+ } |
3269 |
+ EXPORT_SYMBOL(bt_accept_enqueue); |
3270 |
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c |
3271 |
+index 67a8642f57ea..8c329c549ea6 100644 |
3272 |
+--- a/net/bluetooth/l2cap_sock.c |
3273 |
++++ b/net/bluetooth/l2cap_sock.c |
3274 |
+@@ -1253,7 +1253,7 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan) |
3275 |
+ |
3276 |
+ l2cap_sock_init(sk, parent); |
3277 |
+ |
3278 |
+- bt_accept_enqueue(parent, sk); |
3279 |
++ bt_accept_enqueue(parent, sk, false); |
3280 |
+ |
3281 |
+ release_sock(parent); |
3282 |
+ |
3283 |
+diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c |
3284 |
+index 1aaccf637479..8fcd9130439d 100644 |
3285 |
+--- a/net/bluetooth/rfcomm/sock.c |
3286 |
++++ b/net/bluetooth/rfcomm/sock.c |
3287 |
+@@ -988,7 +988,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * |
3288 |
+ rfcomm_pi(sk)->channel = channel; |
3289 |
+ |
3290 |
+ sk->sk_state = BT_CONFIG; |
3291 |
+- bt_accept_enqueue(parent, sk); |
3292 |
++ bt_accept_enqueue(parent, sk, true); |
3293 |
+ |
3294 |
+ /* Accept connection and return socket DLC */ |
3295 |
+ *d = rfcomm_pi(sk)->dlc; |
3296 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
3297 |
+index 81fe3949c158..2d23b29ce00d 100644 |
3298 |
+--- a/net/bluetooth/sco.c |
3299 |
++++ b/net/bluetooth/sco.c |
3300 |
+@@ -193,7 +193,7 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, |
3301 |
+ conn->sk = sk; |
3302 |
+ |
3303 |
+ if (parent) |
3304 |
+- bt_accept_enqueue(parent, sk); |
3305 |
++ bt_accept_enqueue(parent, sk, true); |
3306 |
+ } |
3307 |
+ |
3308 |
+ static int sco_chan_add(struct sco_conn *conn, struct sock *sk, |
3309 |
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
3310 |
+index 22e4c15a1fc3..53392ac58b38 100644 |
3311 |
+--- a/net/bridge/netfilter/ebtables.c |
3312 |
++++ b/net/bridge/netfilter/ebtables.c |
3313 |
+@@ -2292,9 +2292,12 @@ static int compat_do_replace(struct net *net, void __user *user, |
3314 |
+ |
3315 |
+ xt_compat_lock(NFPROTO_BRIDGE); |
3316 |
+ |
3317 |
+- ret = xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); |
3318 |
+- if (ret < 0) |
3319 |
+- goto out_unlock; |
3320 |
++ if (tmp.nentries) { |
3321 |
++ ret = xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); |
3322 |
++ if (ret < 0) |
3323 |
++ goto out_unlock; |
3324 |
++ } |
3325 |
++ |
3326 |
+ ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); |
3327 |
+ if (ret < 0) |
3328 |
+ goto out_unlock; |
3329 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
3330 |
+index 41ede90fc28f..61396648381e 100644 |
3331 |
+--- a/net/core/filter.c |
3332 |
++++ b/net/core/filter.c |
3333 |
+@@ -3081,10 +3081,12 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, |
3334 |
+ /* Only some socketops are supported */ |
3335 |
+ switch (optname) { |
3336 |
+ case SO_RCVBUF: |
3337 |
++ val = min_t(u32, val, sysctl_rmem_max); |
3338 |
+ sk->sk_userlocks |= SOCK_RCVBUF_LOCK; |
3339 |
+ sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF); |
3340 |
+ break; |
3341 |
+ case SO_SNDBUF: |
3342 |
++ val = min_t(u32, val, sysctl_wmem_max); |
3343 |
+ sk->sk_userlocks |= SOCK_SNDBUF_LOCK; |
3344 |
+ sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); |
3345 |
+ break; |
3346 |
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c |
3347 |
+index 8f17724a173c..c6a2655cc28a 100644 |
3348 |
+--- a/net/core/net-sysfs.c |
3349 |
++++ b/net/core/net-sysfs.c |
3350 |
+@@ -1402,6 +1402,9 @@ static int register_queue_kobjects(struct net_device *dev) |
3351 |
+ error: |
3352 |
+ netdev_queue_update_kobjects(dev, txq, 0); |
3353 |
+ net_rx_queue_update_kobjects(dev, rxq, 0); |
3354 |
++#ifdef CONFIG_SYSFS |
3355 |
++ kset_unregister(dev->queues_kset); |
3356 |
++#endif |
3357 |
+ return error; |
3358 |
+ } |
3359 |
+ |
3360 |
+diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c |
3361 |
+index 777fa3b7fb13..f0165c5f376b 100644 |
3362 |
+--- a/net/ipv4/cipso_ipv4.c |
3363 |
++++ b/net/ipv4/cipso_ipv4.c |
3364 |
+@@ -667,7 +667,8 @@ static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) |
3365 |
+ case CIPSO_V4_MAP_PASS: |
3366 |
+ return 0; |
3367 |
+ case CIPSO_V4_MAP_TRANS: |
3368 |
+- if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL) |
3369 |
++ if ((level < doi_def->map.std->lvl.cipso_size) && |
3370 |
++ (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)) |
3371 |
+ return 0; |
3372 |
+ break; |
3373 |
+ } |
3374 |
+@@ -1735,13 +1736,26 @@ validate_return: |
3375 |
+ */ |
3376 |
+ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway) |
3377 |
+ { |
3378 |
++ unsigned char optbuf[sizeof(struct ip_options) + 40]; |
3379 |
++ struct ip_options *opt = (struct ip_options *)optbuf; |
3380 |
++ |
3381 |
+ if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES) |
3382 |
+ return; |
3383 |
+ |
3384 |
++ /* |
3385 |
++ * We might be called above the IP layer, |
3386 |
++ * so we can not use icmp_send and IPCB here. |
3387 |
++ */ |
3388 |
++ |
3389 |
++ memset(opt, 0, sizeof(struct ip_options)); |
3390 |
++ opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); |
3391 |
++ if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL)) |
3392 |
++ return; |
3393 |
++ |
3394 |
+ if (gateway) |
3395 |
+- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0); |
3396 |
++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt); |
3397 |
+ else |
3398 |
+- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0); |
3399 |
++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt); |
3400 |
+ } |
3401 |
+ |
3402 |
+ /** |
3403 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
3404 |
+index b5317b2b191d..ff499000f6cd 100644 |
3405 |
+--- a/net/ipv4/fib_frontend.c |
3406 |
++++ b/net/ipv4/fib_frontend.c |
3407 |
+@@ -675,6 +675,10 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, |
3408 |
+ case RTA_GATEWAY: |
3409 |
+ cfg->fc_gw = nla_get_be32(attr); |
3410 |
+ break; |
3411 |
++ case RTA_VIA: |
3412 |
++ NL_SET_ERR_MSG(extack, "IPv4 does not support RTA_VIA attribute"); |
3413 |
++ err = -EINVAL; |
3414 |
++ goto errout; |
3415 |
+ case RTA_PRIORITY: |
3416 |
+ cfg->fc_priority = nla_get_u32(attr); |
3417 |
+ break; |
3418 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
3419 |
+index 3c1570d3e22f..f9d790b058d2 100644 |
3420 |
+--- a/net/ipv4/icmp.c |
3421 |
++++ b/net/ipv4/icmp.c |
3422 |
+@@ -573,7 +573,8 @@ relookup_failed: |
3423 |
+ * MUST reply to only the first fragment. |
3424 |
+ */ |
3425 |
+ |
3426 |
+-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
3427 |
++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
3428 |
++ const struct ip_options *opt) |
3429 |
+ { |
3430 |
+ struct iphdr *iph; |
3431 |
+ int room; |
3432 |
+@@ -694,7 +695,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
3433 |
+ iph->tos; |
3434 |
+ mark = IP4_REPLY_MARK(net, skb_in->mark); |
3435 |
+ |
3436 |
+- if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in)) |
3437 |
++ if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt)) |
3438 |
+ goto out_unlock; |
3439 |
+ |
3440 |
+ |
3441 |
+@@ -747,7 +748,7 @@ out_bh_enable: |
3442 |
+ local_bh_enable(); |
3443 |
+ out:; |
3444 |
+ } |
3445 |
+-EXPORT_SYMBOL(icmp_send); |
3446 |
++EXPORT_SYMBOL(__icmp_send); |
3447 |
+ |
3448 |
+ |
3449 |
+ static void icmp_socket_deliver(struct sk_buff *skb, u32 info) |
3450 |
+diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c |
3451 |
+index ed194d46c00e..32a35043c9f5 100644 |
3452 |
+--- a/net/ipv4/ip_options.c |
3453 |
++++ b/net/ipv4/ip_options.c |
3454 |
+@@ -251,8 +251,9 @@ static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb) |
3455 |
+ * If opt == NULL, then skb->data should point to IP header. |
3456 |
+ */ |
3457 |
+ |
3458 |
+-int ip_options_compile(struct net *net, |
3459 |
+- struct ip_options *opt, struct sk_buff *skb) |
3460 |
++int __ip_options_compile(struct net *net, |
3461 |
++ struct ip_options *opt, struct sk_buff *skb, |
3462 |
++ __be32 *info) |
3463 |
+ { |
3464 |
+ __be32 spec_dst = htonl(INADDR_ANY); |
3465 |
+ unsigned char *pp_ptr = NULL; |
3466 |
+@@ -468,11 +469,22 @@ eol: |
3467 |
+ return 0; |
3468 |
+ |
3469 |
+ error: |
3470 |
+- if (skb) { |
3471 |
+- icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24)); |
3472 |
+- } |
3473 |
++ if (info) |
3474 |
++ *info = htonl((pp_ptr-iph)<<24); |
3475 |
+ return -EINVAL; |
3476 |
+ } |
3477 |
++ |
3478 |
++int ip_options_compile(struct net *net, |
3479 |
++ struct ip_options *opt, struct sk_buff *skb) |
3480 |
++{ |
3481 |
++ int ret; |
3482 |
++ __be32 info; |
3483 |
++ |
3484 |
++ ret = __ip_options_compile(net, opt, skb, &info); |
3485 |
++ if (ret != 0 && skb) |
3486 |
++ icmp_send(skb, ICMP_PARAMETERPROB, 0, info); |
3487 |
++ return ret; |
3488 |
++} |
3489 |
+ EXPORT_SYMBOL(ip_options_compile); |
3490 |
+ |
3491 |
+ /* |
3492 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
3493 |
+index 00d4371d4573..306603a7f351 100644 |
3494 |
+--- a/net/ipv4/ip_vti.c |
3495 |
++++ b/net/ipv4/ip_vti.c |
3496 |
+@@ -74,6 +74,33 @@ drop: |
3497 |
+ return 0; |
3498 |
+ } |
3499 |
+ |
3500 |
++static int vti_input_ipip(struct sk_buff *skb, int nexthdr, __be32 spi, |
3501 |
++ int encap_type) |
3502 |
++{ |
3503 |
++ struct ip_tunnel *tunnel; |
3504 |
++ const struct iphdr *iph = ip_hdr(skb); |
3505 |
++ struct net *net = dev_net(skb->dev); |
3506 |
++ struct ip_tunnel_net *itn = net_generic(net, vti_net_id); |
3507 |
++ |
3508 |
++ tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, |
3509 |
++ iph->saddr, iph->daddr, 0); |
3510 |
++ if (tunnel) { |
3511 |
++ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) |
3512 |
++ goto drop; |
3513 |
++ |
3514 |
++ XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; |
3515 |
++ |
3516 |
++ skb->dev = tunnel->dev; |
3517 |
++ |
3518 |
++ return xfrm_input(skb, nexthdr, spi, encap_type); |
3519 |
++ } |
3520 |
++ |
3521 |
++ return -EINVAL; |
3522 |
++drop: |
3523 |
++ kfree_skb(skb); |
3524 |
++ return 0; |
3525 |
++} |
3526 |
++ |
3527 |
+ static int vti_rcv(struct sk_buff *skb) |
3528 |
+ { |
3529 |
+ XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
3530 |
+@@ -82,6 +109,14 @@ static int vti_rcv(struct sk_buff *skb) |
3531 |
+ return vti_input(skb, ip_hdr(skb)->protocol, 0, 0); |
3532 |
+ } |
3533 |
+ |
3534 |
++static int vti_rcv_ipip(struct sk_buff *skb) |
3535 |
++{ |
3536 |
++ XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
3537 |
++ XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); |
3538 |
++ |
3539 |
++ return vti_input_ipip(skb, ip_hdr(skb)->protocol, ip_hdr(skb)->saddr, 0); |
3540 |
++} |
3541 |
++ |
3542 |
+ static int vti_rcv_cb(struct sk_buff *skb, int err) |
3543 |
+ { |
3544 |
+ unsigned short family; |
3545 |
+@@ -439,6 +474,12 @@ static struct xfrm4_protocol vti_ipcomp4_protocol __read_mostly = { |
3546 |
+ .priority = 100, |
3547 |
+ }; |
3548 |
+ |
3549 |
++static struct xfrm_tunnel ipip_handler __read_mostly = { |
3550 |
++ .handler = vti_rcv_ipip, |
3551 |
++ .err_handler = vti4_err, |
3552 |
++ .priority = 0, |
3553 |
++}; |
3554 |
++ |
3555 |
+ static int __net_init vti_init_net(struct net *net) |
3556 |
+ { |
3557 |
+ int err; |
3558 |
+@@ -607,6 +648,13 @@ static int __init vti_init(void) |
3559 |
+ if (err < 0) |
3560 |
+ goto xfrm_proto_comp_failed; |
3561 |
+ |
3562 |
++ msg = "ipip tunnel"; |
3563 |
++ err = xfrm4_tunnel_register(&ipip_handler, AF_INET); |
3564 |
++ if (err < 0) { |
3565 |
++ pr_info("%s: cant't register tunnel\n",__func__); |
3566 |
++ goto xfrm_tunnel_failed; |
3567 |
++ } |
3568 |
++ |
3569 |
+ msg = "netlink interface"; |
3570 |
+ err = rtnl_link_register(&vti_link_ops); |
3571 |
+ if (err < 0) |
3572 |
+@@ -616,6 +664,8 @@ static int __init vti_init(void) |
3573 |
+ |
3574 |
+ rtnl_link_failed: |
3575 |
+ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
3576 |
++xfrm_tunnel_failed: |
3577 |
++ xfrm4_tunnel_deregister(&ipip_handler, AF_INET); |
3578 |
+ xfrm_proto_comp_failed: |
3579 |
+ xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
3580 |
+ xfrm_proto_ah_failed: |
3581 |
+diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c |
3582 |
+index b2fdb3fdd217..459f282d90e1 100644 |
3583 |
+--- a/net/ipv6/ip6mr.c |
3584 |
++++ b/net/ipv6/ip6mr.c |
3585 |
+@@ -2002,10 +2002,10 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) |
3586 |
+ |
3587 |
+ static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct sk_buff *skb) |
3588 |
+ { |
3589 |
+- __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
3590 |
+- IPSTATS_MIB_OUTFORWDATAGRAMS); |
3591 |
+- __IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)), |
3592 |
+- IPSTATS_MIB_OUTOCTETS, skb->len); |
3593 |
++ IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
3594 |
++ IPSTATS_MIB_OUTFORWDATAGRAMS); |
3595 |
++ IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)), |
3596 |
++ IPSTATS_MIB_OUTOCTETS, skb->len); |
3597 |
+ return dst_output(net, sk, skb); |
3598 |
+ } |
3599 |
+ |
3600 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
3601 |
+index 74dd35d6567c..fafecdc06900 100644 |
3602 |
+--- a/net/ipv6/route.c |
3603 |
++++ b/net/ipv6/route.c |
3604 |
+@@ -3024,6 +3024,10 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, |
3605 |
+ cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]); |
3606 |
+ cfg->fc_flags |= RTF_GATEWAY; |
3607 |
+ } |
3608 |
++ if (tb[RTA_VIA]) { |
3609 |
++ NL_SET_ERR_MSG(extack, "IPv6 does not support RTA_VIA attribute"); |
3610 |
++ goto errout; |
3611 |
++ } |
3612 |
+ |
3613 |
+ if (tb[RTA_DST]) { |
3614 |
+ int plen = (rtm->rtm_dst_len + 7) >> 3; |
3615 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
3616 |
+index 2e55f9894548..c5b60190b1db 100644 |
3617 |
+--- a/net/ipv6/sit.c |
3618 |
++++ b/net/ipv6/sit.c |
3619 |
+@@ -1856,6 +1856,7 @@ static int __net_init sit_init_net(struct net *net) |
3620 |
+ |
3621 |
+ err_reg_dev: |
3622 |
+ ipip6_dev_free(sitn->fb_tunnel_dev); |
3623 |
++ free_netdev(sitn->fb_tunnel_dev); |
3624 |
+ err_alloc_dev: |
3625 |
+ return err; |
3626 |
+ } |
3627 |
+diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c |
3628 |
+index aee385eb72e7..9a153f64b8d7 100644 |
3629 |
+--- a/net/mpls/af_mpls.c |
3630 |
++++ b/net/mpls/af_mpls.c |
3631 |
+@@ -1787,6 +1787,9 @@ static int rtm_to_route_config(struct sk_buff *skb, |
3632 |
+ goto errout; |
3633 |
+ break; |
3634 |
+ } |
3635 |
++ case RTA_GATEWAY: |
3636 |
++ NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute"); |
3637 |
++ goto errout; |
3638 |
+ case RTA_VIA: |
3639 |
+ { |
3640 |
+ if (nla_get_via(nla, &cfg->rc_via_alen, |
3641 |
+diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
3642 |
+index 2f45c3ce77ef..dff4ead3d117 100644 |
3643 |
+--- a/net/netfilter/ipvs/ip_vs_ctl.c |
3644 |
++++ b/net/netfilter/ipvs/ip_vs_ctl.c |
3645 |
+@@ -2252,6 +2252,18 @@ static int ip_vs_set_timeout(struct netns_ipvs *ipvs, struct ip_vs_timeout_user |
3646 |
+ u->tcp_fin_timeout, |
3647 |
+ u->udp_timeout); |
3648 |
+ |
3649 |
++#ifdef CONFIG_IP_VS_PROTO_TCP |
3650 |
++ if (u->tcp_timeout < 0 || u->tcp_timeout > (INT_MAX / HZ) || |
3651 |
++ u->tcp_fin_timeout < 0 || u->tcp_fin_timeout > (INT_MAX / HZ)) { |
3652 |
++ return -EINVAL; |
3653 |
++ } |
3654 |
++#endif |
3655 |
++ |
3656 |
++#ifdef CONFIG_IP_VS_PROTO_UDP |
3657 |
++ if (u->udp_timeout < 0 || u->udp_timeout > (INT_MAX / HZ)) |
3658 |
++ return -EINVAL; |
3659 |
++#endif |
3660 |
++ |
3661 |
+ #ifdef CONFIG_IP_VS_PROTO_TCP |
3662 |
+ if (u->tcp_timeout) { |
3663 |
+ pd = ip_vs_proto_data_get(ipvs, IPPROTO_TCP); |
3664 |
+diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
3665 |
+index b793b55d1488..f07357ba9629 100644 |
3666 |
+--- a/net/netfilter/nf_conntrack_core.c |
3667 |
++++ b/net/netfilter/nf_conntrack_core.c |
3668 |
+@@ -869,6 +869,22 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, |
3669 |
+ } |
3670 |
+ |
3671 |
+ if (nf_ct_key_equal(h, tuple, zone, net)) { |
3672 |
++ /* Tuple is taken already, so caller will need to find |
3673 |
++ * a new source port to use. |
3674 |
++ * |
3675 |
++ * Only exception: |
3676 |
++ * If the *original tuples* are identical, then both |
3677 |
++ * conntracks refer to the same flow. |
3678 |
++ * This is a rare situation, it can occur e.g. when |
3679 |
++ * more than one UDP packet is sent from same socket |
3680 |
++ * in different threads. |
3681 |
++ * |
3682 |
++ * Let nf_ct_resolve_clash() deal with this later. |
3683 |
++ */ |
3684 |
++ if (nf_ct_tuple_equal(&ignored_conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple, |
3685 |
++ &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple)) |
3686 |
++ continue; |
3687 |
++ |
3688 |
+ NF_CT_STAT_INC_ATOMIC(net, found); |
3689 |
+ rcu_read_unlock(); |
3690 |
+ return 1; |
3691 |
+diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c |
3692 |
+index ea7c67050792..ee3e5b6471a6 100644 |
3693 |
+--- a/net/netlabel/netlabel_kapi.c |
3694 |
++++ b/net/netlabel/netlabel_kapi.c |
3695 |
+@@ -903,7 +903,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, |
3696 |
+ (state == 0 && (byte & bitmask) == 0)) |
3697 |
+ return bit_spot; |
3698 |
+ |
3699 |
+- bit_spot++; |
3700 |
++ if (++bit_spot >= bitmap_len) |
3701 |
++ return -1; |
3702 |
+ bitmask >>= 1; |
3703 |
+ if (bitmask == 0) { |
3704 |
+ byte = bitmap[++byte_offset]; |
3705 |
+diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c |
3706 |
+index 6a196e438b6c..d1fc019e932e 100644 |
3707 |
+--- a/net/nfc/llcp_commands.c |
3708 |
++++ b/net/nfc/llcp_commands.c |
3709 |
+@@ -419,6 +419,10 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) |
3710 |
+ sock->service_name, |
3711 |
+ sock->service_name_len, |
3712 |
+ &service_name_tlv_length); |
3713 |
++ if (!service_name_tlv) { |
3714 |
++ err = -ENOMEM; |
3715 |
++ goto error_tlv; |
3716 |
++ } |
3717 |
+ size += service_name_tlv_length; |
3718 |
+ } |
3719 |
+ |
3720 |
+@@ -429,9 +433,17 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) |
3721 |
+ |
3722 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, |
3723 |
+ &miux_tlv_length); |
3724 |
++ if (!miux_tlv) { |
3725 |
++ err = -ENOMEM; |
3726 |
++ goto error_tlv; |
3727 |
++ } |
3728 |
+ size += miux_tlv_length; |
3729 |
+ |
3730 |
+ rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length); |
3731 |
++ if (!rw_tlv) { |
3732 |
++ err = -ENOMEM; |
3733 |
++ goto error_tlv; |
3734 |
++ } |
3735 |
+ size += rw_tlv_length; |
3736 |
+ |
3737 |
+ pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len); |
3738 |
+@@ -484,9 +496,17 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) |
3739 |
+ |
3740 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, |
3741 |
+ &miux_tlv_length); |
3742 |
++ if (!miux_tlv) { |
3743 |
++ err = -ENOMEM; |
3744 |
++ goto error_tlv; |
3745 |
++ } |
3746 |
+ size += miux_tlv_length; |
3747 |
+ |
3748 |
+ rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length); |
3749 |
++ if (!rw_tlv) { |
3750 |
++ err = -ENOMEM; |
3751 |
++ goto error_tlv; |
3752 |
++ } |
3753 |
+ size += rw_tlv_length; |
3754 |
+ |
3755 |
+ skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size); |
3756 |
+diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c |
3757 |
+index 02eef5cf3cce..7e619ff8a653 100644 |
3758 |
+--- a/net/nfc/llcp_core.c |
3759 |
++++ b/net/nfc/llcp_core.c |
3760 |
+@@ -532,10 +532,10 @@ static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local) |
3761 |
+ |
3762 |
+ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) |
3763 |
+ { |
3764 |
+- u8 *gb_cur, *version_tlv, version, version_length; |
3765 |
+- u8 *lto_tlv, lto_length; |
3766 |
+- u8 *wks_tlv, wks_length; |
3767 |
+- u8 *miux_tlv, miux_length; |
3768 |
++ u8 *gb_cur, version, version_length; |
3769 |
++ u8 lto_length, wks_length, miux_length; |
3770 |
++ u8 *version_tlv = NULL, *lto_tlv = NULL, |
3771 |
++ *wks_tlv = NULL, *miux_tlv = NULL; |
3772 |
+ __be16 wks = cpu_to_be16(local->local_wks); |
3773 |
+ u8 gb_len = 0; |
3774 |
+ int ret = 0; |
3775 |
+@@ -543,17 +543,33 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) |
3776 |
+ version = LLCP_VERSION_11; |
3777 |
+ version_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &version, |
3778 |
+ 1, &version_length); |
3779 |
++ if (!version_tlv) { |
3780 |
++ ret = -ENOMEM; |
3781 |
++ goto out; |
3782 |
++ } |
3783 |
+ gb_len += version_length; |
3784 |
+ |
3785 |
+ lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &local->lto, 1, <o_length); |
3786 |
++ if (!lto_tlv) { |
3787 |
++ ret = -ENOMEM; |
3788 |
++ goto out; |
3789 |
++ } |
3790 |
+ gb_len += lto_length; |
3791 |
+ |
3792 |
+ pr_debug("Local wks 0x%lx\n", local->local_wks); |
3793 |
+ wks_tlv = nfc_llcp_build_tlv(LLCP_TLV_WKS, (u8 *)&wks, 2, &wks_length); |
3794 |
++ if (!wks_tlv) { |
3795 |
++ ret = -ENOMEM; |
3796 |
++ goto out; |
3797 |
++ } |
3798 |
+ gb_len += wks_length; |
3799 |
+ |
3800 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0, |
3801 |
+ &miux_length); |
3802 |
++ if (!miux_tlv) { |
3803 |
++ ret = -ENOMEM; |
3804 |
++ goto out; |
3805 |
++ } |
3806 |
+ gb_len += miux_length; |
3807 |
+ |
3808 |
+ gb_len += ARRAY_SIZE(llcp_magic); |
3809 |
+diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c |
3810 |
+index 3f4f0b946798..3d5654333d49 100644 |
3811 |
+--- a/net/sched/sch_netem.c |
3812 |
++++ b/net/sched/sch_netem.c |
3813 |
+@@ -435,6 +435,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
3814 |
+ int nb = 0; |
3815 |
+ int count = 1; |
3816 |
+ int rc = NET_XMIT_SUCCESS; |
3817 |
++ int rc_drop = NET_XMIT_DROP; |
3818 |
+ |
3819 |
+ /* Do not fool qdisc_drop_all() */ |
3820 |
+ skb->prev = NULL; |
3821 |
+@@ -474,6 +475,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
3822 |
+ q->duplicate = 0; |
3823 |
+ rootq->enqueue(skb2, rootq, to_free); |
3824 |
+ q->duplicate = dupsave; |
3825 |
++ rc_drop = NET_XMIT_SUCCESS; |
3826 |
+ } |
3827 |
+ |
3828 |
+ /* |
3829 |
+@@ -486,7 +488,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
3830 |
+ if (skb_is_gso(skb)) { |
3831 |
+ segs = netem_segment(skb, sch, to_free); |
3832 |
+ if (!segs) |
3833 |
+- return NET_XMIT_DROP; |
3834 |
++ return rc_drop; |
3835 |
+ } else { |
3836 |
+ segs = skb; |
3837 |
+ } |
3838 |
+@@ -509,8 +511,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
3839 |
+ 1<<(prandom_u32() % 8); |
3840 |
+ } |
3841 |
+ |
3842 |
+- if (unlikely(sch->q.qlen >= sch->limit)) |
3843 |
+- return qdisc_drop_all(skb, sch, to_free); |
3844 |
++ if (unlikely(sch->q.qlen >= sch->limit)) { |
3845 |
++ qdisc_drop_all(skb, sch, to_free); |
3846 |
++ return rc_drop; |
3847 |
++ } |
3848 |
+ |
3849 |
+ qdisc_qstats_backlog_inc(sch, skb); |
3850 |
+ |
3851 |
+diff --git a/net/socket.c b/net/socket.c |
3852 |
+index a401578f3f28..6d8f0c248c7e 100644 |
3853 |
+--- a/net/socket.c |
3854 |
++++ b/net/socket.c |
3855 |
+@@ -600,6 +600,7 @@ static void __sock_release(struct socket *sock, struct inode *inode) |
3856 |
+ if (inode) |
3857 |
+ inode_lock(inode); |
3858 |
+ sock->ops->release(sock); |
3859 |
++ sock->sk = NULL; |
3860 |
+ if (inode) |
3861 |
+ inode_unlock(inode); |
3862 |
+ sock->ops = NULL; |
3863 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
3864 |
+index e5f9f43ff15b..75681845679e 100644 |
3865 |
+--- a/net/tipc/socket.c |
3866 |
++++ b/net/tipc/socket.c |
3867 |
+@@ -943,7 +943,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) |
3868 |
+ |
3869 |
+ if (unlikely(!dest)) { |
3870 |
+ dest = &tsk->peer; |
3871 |
+- if (!syn || dest->family != AF_TIPC) |
3872 |
++ if (!syn && dest->family != AF_TIPC) |
3873 |
+ return -EDESTADDRREQ; |
3874 |
+ } |
3875 |
+ |
3876 |
+diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c |
3877 |
+index fdb294441682..2ff751eba037 100644 |
3878 |
+--- a/net/vmw_vsock/virtio_transport.c |
3879 |
++++ b/net/vmw_vsock/virtio_transport.c |
3880 |
+@@ -75,6 +75,9 @@ static u32 virtio_transport_get_local_cid(void) |
3881 |
+ { |
3882 |
+ struct virtio_vsock *vsock = virtio_vsock_get(); |
3883 |
+ |
3884 |
++ if (!vsock) |
3885 |
++ return VMADDR_CID_ANY; |
3886 |
++ |
3887 |
+ return vsock->guest_cid; |
3888 |
+ } |
3889 |
+ |
3890 |
+@@ -584,10 +587,6 @@ static int virtio_vsock_probe(struct virtio_device *vdev) |
3891 |
+ |
3892 |
+ virtio_vsock_update_guest_cid(vsock); |
3893 |
+ |
3894 |
+- ret = vsock_core_init(&virtio_transport.transport); |
3895 |
+- if (ret < 0) |
3896 |
+- goto out_vqs; |
3897 |
+- |
3898 |
+ vsock->rx_buf_nr = 0; |
3899 |
+ vsock->rx_buf_max_nr = 0; |
3900 |
+ atomic_set(&vsock->queued_replies, 0); |
3901 |
+@@ -618,8 +617,6 @@ static int virtio_vsock_probe(struct virtio_device *vdev) |
3902 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
3903 |
+ return 0; |
3904 |
+ |
3905 |
+-out_vqs: |
3906 |
+- vsock->vdev->config->del_vqs(vsock->vdev); |
3907 |
+ out: |
3908 |
+ kfree(vsock); |
3909 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
3910 |
+@@ -637,6 +634,9 @@ static void virtio_vsock_remove(struct virtio_device *vdev) |
3911 |
+ flush_work(&vsock->event_work); |
3912 |
+ flush_work(&vsock->send_pkt_work); |
3913 |
+ |
3914 |
++ /* Reset all connected sockets when the device disappear */ |
3915 |
++ vsock_for_each_connected_socket(virtio_vsock_reset_sock); |
3916 |
++ |
3917 |
+ vdev->config->reset(vdev); |
3918 |
+ |
3919 |
+ mutex_lock(&vsock->rx_lock); |
3920 |
+@@ -669,7 +669,6 @@ static void virtio_vsock_remove(struct virtio_device *vdev) |
3921 |
+ |
3922 |
+ mutex_lock(&the_virtio_vsock_mutex); |
3923 |
+ the_virtio_vsock = NULL; |
3924 |
+- vsock_core_exit(); |
3925 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
3926 |
+ |
3927 |
+ vdev->config->del_vqs(vdev); |
3928 |
+@@ -702,14 +701,28 @@ static int __init virtio_vsock_init(void) |
3929 |
+ virtio_vsock_workqueue = alloc_workqueue("virtio_vsock", 0, 0); |
3930 |
+ if (!virtio_vsock_workqueue) |
3931 |
+ return -ENOMEM; |
3932 |
++ |
3933 |
+ ret = register_virtio_driver(&virtio_vsock_driver); |
3934 |
+ if (ret) |
3935 |
+- destroy_workqueue(virtio_vsock_workqueue); |
3936 |
++ goto out_wq; |
3937 |
++ |
3938 |
++ ret = vsock_core_init(&virtio_transport.transport); |
3939 |
++ if (ret) |
3940 |
++ goto out_vdr; |
3941 |
++ |
3942 |
++ return 0; |
3943 |
++ |
3944 |
++out_vdr: |
3945 |
++ unregister_virtio_driver(&virtio_vsock_driver); |
3946 |
++out_wq: |
3947 |
++ destroy_workqueue(virtio_vsock_workqueue); |
3948 |
+ return ret; |
3949 |
++ |
3950 |
+ } |
3951 |
+ |
3952 |
+ static void __exit virtio_vsock_exit(void) |
3953 |
+ { |
3954 |
++ vsock_core_exit(); |
3955 |
+ unregister_virtio_driver(&virtio_vsock_driver); |
3956 |
+ destroy_workqueue(virtio_vsock_workqueue); |
3957 |
+ } |
3958 |
+diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
3959 |
+index dd754b7850a8..67bf8b7ee8a2 100644 |
3960 |
+--- a/security/apparmor/domain.c |
3961 |
++++ b/security/apparmor/domain.c |
3962 |
+@@ -1260,7 +1260,10 @@ check: |
3963 |
+ aa_get_label(&profile->label)); |
3964 |
+ if (IS_ERR_OR_NULL(new)) { |
3965 |
+ info = "failed to build target label"; |
3966 |
+- error = PTR_ERR(new); |
3967 |
++ if (!new) |
3968 |
++ error = -ENOMEM; |
3969 |
++ else |
3970 |
++ error = PTR_ERR(new); |
3971 |
+ new = NULL; |
3972 |
+ perms.allow = 0; |
3973 |
+ goto audit; |
3974 |
+diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c |
3975 |
+index 8e3c4ec00017..b224bf3f2b99 100644 |
3976 |
+--- a/tools/perf/builtin-trace.c |
3977 |
++++ b/tools/perf/builtin-trace.c |
3978 |
+@@ -2109,19 +2109,30 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); |
3979 |
+ |
3980 |
+ static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
3981 |
+ { |
3982 |
+- struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); |
3983 |
++ bool found = false; |
3984 |
++ struct perf_evsel *evsel, *tmp; |
3985 |
++ struct parse_events_error err = { .idx = 0, }; |
3986 |
++ int ret = parse_events(evlist, "probe:vfs_getname*", &err); |
3987 |
+ |
3988 |
+- if (IS_ERR(evsel)) |
3989 |
++ if (ret) |
3990 |
+ return false; |
3991 |
+ |
3992 |
+- if (perf_evsel__field(evsel, "pathname") == NULL) { |
3993 |
++ evlist__for_each_entry_safe(evlist, evsel, tmp) { |
3994 |
++ if (!strstarts(perf_evsel__name(evsel), "probe:vfs_getname")) |
3995 |
++ continue; |
3996 |
++ |
3997 |
++ if (perf_evsel__field(evsel, "pathname")) { |
3998 |
++ evsel->handler = trace__vfs_getname; |
3999 |
++ found = true; |
4000 |
++ continue; |
4001 |
++ } |
4002 |
++ |
4003 |
++ list_del_init(&evsel->node); |
4004 |
++ evsel->evlist = NULL; |
4005 |
+ perf_evsel__delete(evsel); |
4006 |
+- return false; |
4007 |
+ } |
4008 |
+ |
4009 |
+- evsel->handler = trace__vfs_getname; |
4010 |
+- perf_evlist__add(evlist, evsel); |
4011 |
+- return true; |
4012 |
++ return found; |
4013 |
+ } |
4014 |
+ |
4015 |
+ static struct perf_evsel *perf_evsel__new_pgfault(u64 config) |
4016 |
+diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c |
4017 |
+index 1ccbd3342069..383674f448fc 100644 |
4018 |
+--- a/tools/perf/util/cpumap.c |
4019 |
++++ b/tools/perf/util/cpumap.c |
4020 |
+@@ -134,7 +134,12 @@ struct cpu_map *cpu_map__new(const char *cpu_list) |
4021 |
+ if (!cpu_list) |
4022 |
+ return cpu_map__read_all_cpu_map(); |
4023 |
+ |
4024 |
+- if (!isdigit(*cpu_list)) |
4025 |
++ /* |
4026 |
++ * must handle the case of empty cpumap to cover |
4027 |
++ * TOPOLOGY header for NUMA nodes with no CPU |
4028 |
++ * ( e.g., because of CPU hotplug) |
4029 |
++ */ |
4030 |
++ if (!isdigit(*cpu_list) && *cpu_list != '\0') |
4031 |
+ goto out; |
4032 |
+ |
4033 |
+ while (isdigit(*cpu_list)) { |
4034 |
+@@ -181,8 +186,10 @@ struct cpu_map *cpu_map__new(const char *cpu_list) |
4035 |
+ |
4036 |
+ if (nr_cpus > 0) |
4037 |
+ cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); |
4038 |
+- else |
4039 |
++ else if (*cpu_list != '\0') |
4040 |
+ cpus = cpu_map__default_new(); |
4041 |
++ else |
4042 |
++ cpus = cpu_map__dummy_new(); |
4043 |
+ invalid: |
4044 |
+ free(tmp_cpus); |
4045 |
+ out: |
4046 |
+diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c |
4047 |
+index 8ad4296de98b..3d39332b3a06 100644 |
4048 |
+--- a/tools/perf/util/symbol-elf.c |
4049 |
++++ b/tools/perf/util/symbol-elf.c |
4050 |
+@@ -87,6 +87,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) |
4051 |
+ return GELF_ST_TYPE(sym->st_info); |
4052 |
+ } |
4053 |
+ |
4054 |
++static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) |
4055 |
++{ |
4056 |
++ return GELF_ST_VISIBILITY(sym->st_other); |
4057 |
++} |
4058 |
++ |
4059 |
+ #ifndef STT_GNU_IFUNC |
4060 |
+ #define STT_GNU_IFUNC 10 |
4061 |
+ #endif |
4062 |
+@@ -111,7 +116,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) |
4063 |
+ return elf_sym__type(sym) == STT_NOTYPE && |
4064 |
+ sym->st_name != 0 && |
4065 |
+ sym->st_shndx != SHN_UNDEF && |
4066 |
+- sym->st_shndx != SHN_ABS; |
4067 |
++ sym->st_shndx != SHN_ABS && |
4068 |
++ elf_sym__visibility(sym) != STV_HIDDEN && |
4069 |
++ elf_sym__visibility(sym) != STV_INTERNAL; |
4070 |
+ } |
4071 |
+ |
4072 |
+ static bool elf_sym__is_a(GElf_Sym *sym, enum map_type type) |
4073 |
+diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h |
4074 |
+index d0811b3d6a6f..4bf720364934 100644 |
4075 |
+--- a/tools/testing/selftests/bpf/bpf_util.h |
4076 |
++++ b/tools/testing/selftests/bpf/bpf_util.h |
4077 |
+@@ -13,7 +13,7 @@ static inline unsigned int bpf_num_possible_cpus(void) |
4078 |
+ unsigned int start, end, possible_cpus = 0; |
4079 |
+ char buff[128]; |
4080 |
+ FILE *fp; |
4081 |
+- int n; |
4082 |
++ int len, n, i, j = 0; |
4083 |
+ |
4084 |
+ fp = fopen(fcpu, "r"); |
4085 |
+ if (!fp) { |
4086 |
+@@ -21,17 +21,27 @@ static inline unsigned int bpf_num_possible_cpus(void) |
4087 |
+ exit(1); |
4088 |
+ } |
4089 |
+ |
4090 |
+- while (fgets(buff, sizeof(buff), fp)) { |
4091 |
+- n = sscanf(buff, "%u-%u", &start, &end); |
4092 |
+- if (n == 0) { |
4093 |
+- printf("Failed to retrieve # possible CPUs!\n"); |
4094 |
+- exit(1); |
4095 |
+- } else if (n == 1) { |
4096 |
+- end = start; |
4097 |
++ if (!fgets(buff, sizeof(buff), fp)) { |
4098 |
++ printf("Failed to read %s!\n", fcpu); |
4099 |
++ exit(1); |
4100 |
++ } |
4101 |
++ |
4102 |
++ len = strlen(buff); |
4103 |
++ for (i = 0; i <= len; i++) { |
4104 |
++ if (buff[i] == ',' || buff[i] == '\0') { |
4105 |
++ buff[i] = '\0'; |
4106 |
++ n = sscanf(&buff[j], "%u-%u", &start, &end); |
4107 |
++ if (n <= 0) { |
4108 |
++ printf("Failed to retrieve # possible CPUs!\n"); |
4109 |
++ exit(1); |
4110 |
++ } else if (n == 1) { |
4111 |
++ end = start; |
4112 |
++ } |
4113 |
++ possible_cpus += end - start + 1; |
4114 |
++ j = i + 1; |
4115 |
+ } |
4116 |
+- possible_cpus = start == 0 ? end + 1 : 0; |
4117 |
+- break; |
4118 |
+ } |
4119 |
++ |
4120 |
+ fclose(fp); |
4121 |
+ |
4122 |
+ return possible_cpus; |
4123 |
+diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh |
4124 |
+index f3a8933c1275..49ccd2293343 100755 |
4125 |
+--- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh |
4126 |
++++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh |
4127 |
+@@ -35,6 +35,10 @@ prerequisite() |
4128 |
+ exit 0 |
4129 |
+ fi |
4130 |
+ |
4131 |
++ present_cpus=`cat $SYSFS/devices/system/cpu/present` |
4132 |
++ present_max=${present_cpus##*-} |
4133 |
++ echo "present_cpus = $present_cpus present_max = $present_max" |
4134 |
++ |
4135 |
+ echo -e "\t Cpus in online state: $online_cpus" |
4136 |
+ |
4137 |
+ offline_cpus=`cat $SYSFS/devices/system/cpu/offline` |
4138 |
+@@ -149,6 +153,8 @@ online_cpus=0 |
4139 |
+ online_max=0 |
4140 |
+ offline_cpus=0 |
4141 |
+ offline_max=0 |
4142 |
++present_cpus=0 |
4143 |
++present_max=0 |
4144 |
+ |
4145 |
+ while getopts e:ahp: opt; do |
4146 |
+ case $opt in |
4147 |
+@@ -188,9 +194,10 @@ if [ $allcpus -eq 0 ]; then |
4148 |
+ online_cpu_expect_success $online_max |
4149 |
+ |
4150 |
+ if [[ $offline_cpus -gt 0 ]]; then |
4151 |
+- echo -e "\t offline to online to offline: cpu $offline_max" |
4152 |
+- online_cpu_expect_success $offline_max |
4153 |
+- offline_cpu_expect_success $offline_max |
4154 |
++ echo -e "\t offline to online to offline: cpu $present_max" |
4155 |
++ online_cpu_expect_success $present_max |
4156 |
++ offline_cpu_expect_success $present_max |
4157 |
++ online_cpu $present_max |
4158 |
+ fi |
4159 |
+ exit 0 |
4160 |
+ else |
4161 |
+diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile |
4162 |
+index 47ed6cef93fb..c9ff2b47bd1c 100644 |
4163 |
+--- a/tools/testing/selftests/netfilter/Makefile |
4164 |
++++ b/tools/testing/selftests/netfilter/Makefile |
4165 |
+@@ -1,6 +1,6 @@ |
4166 |
+ # SPDX-License-Identifier: GPL-2.0 |
4167 |
+ # Makefile for netfilter selftests |
4168 |
+ |
4169 |
+-TEST_PROGS := nft_trans_stress.sh |
4170 |
++TEST_PROGS := nft_trans_stress.sh nft_nat.sh |
4171 |
+ |
4172 |
+ include ../lib.mk |
4173 |
+diff --git a/tools/testing/selftests/netfilter/config b/tools/testing/selftests/netfilter/config |
4174 |
+index 1017313e41a8..59caa8f71cd8 100644 |
4175 |
+--- a/tools/testing/selftests/netfilter/config |
4176 |
++++ b/tools/testing/selftests/netfilter/config |
4177 |
+@@ -1,2 +1,2 @@ |
4178 |
+ CONFIG_NET_NS=y |
4179 |
+-NF_TABLES_INET=y |
4180 |
++CONFIG_NF_TABLES_INET=y |
4181 |
+diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh |
4182 |
+new file mode 100755 |
4183 |
+index 000000000000..8ec76681605c |
4184 |
+--- /dev/null |
4185 |
++++ b/tools/testing/selftests/netfilter/nft_nat.sh |
4186 |
+@@ -0,0 +1,762 @@ |
4187 |
++#!/bin/bash |
4188 |
++# |
4189 |
++# This test is for basic NAT functionality: snat, dnat, redirect, masquerade. |
4190 |
++# |
4191 |
++ |
4192 |
++# Kselftest framework requirement - SKIP code is 4. |
4193 |
++ksft_skip=4 |
4194 |
++ret=0 |
4195 |
++ |
4196 |
++nft --version > /dev/null 2>&1 |
4197 |
++if [ $? -ne 0 ];then |
4198 |
++ echo "SKIP: Could not run test without nft tool" |
4199 |
++ exit $ksft_skip |
4200 |
++fi |
4201 |
++ |
4202 |
++ip -Version > /dev/null 2>&1 |
4203 |
++if [ $? -ne 0 ];then |
4204 |
++ echo "SKIP: Could not run test without ip tool" |
4205 |
++ exit $ksft_skip |
4206 |
++fi |
4207 |
++ |
4208 |
++ip netns add ns0 |
4209 |
++ip netns add ns1 |
4210 |
++ip netns add ns2 |
4211 |
++ |
4212 |
++ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 |
4213 |
++ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 |
4214 |
++ |
4215 |
++ip -net ns0 link set lo up |
4216 |
++ip -net ns0 link set veth0 up |
4217 |
++ip -net ns0 addr add 10.0.1.1/24 dev veth0 |
4218 |
++ip -net ns0 addr add dead:1::1/64 dev veth0 |
4219 |
++ |
4220 |
++ip -net ns0 link set veth1 up |
4221 |
++ip -net ns0 addr add 10.0.2.1/24 dev veth1 |
4222 |
++ip -net ns0 addr add dead:2::1/64 dev veth1 |
4223 |
++ |
4224 |
++for i in 1 2; do |
4225 |
++ ip -net ns$i link set lo up |
4226 |
++ ip -net ns$i link set eth0 up |
4227 |
++ ip -net ns$i addr add 10.0.$i.99/24 dev eth0 |
4228 |
++ ip -net ns$i route add default via 10.0.$i.1 |
4229 |
++ ip -net ns$i addr add dead:$i::99/64 dev eth0 |
4230 |
++ ip -net ns$i route add default via dead:$i::1 |
4231 |
++done |
4232 |
++ |
4233 |
++bad_counter() |
4234 |
++{ |
4235 |
++ local ns=$1 |
4236 |
++ local counter=$2 |
4237 |
++ local expect=$3 |
4238 |
++ |
4239 |
++ echo "ERROR: $counter counter in $ns has unexpected value (expected $expect)" 1>&2 |
4240 |
++ ip netns exec $ns nft list counter inet filter $counter 1>&2 |
4241 |
++} |
4242 |
++ |
4243 |
++check_counters() |
4244 |
++{ |
4245 |
++ ns=$1 |
4246 |
++ local lret=0 |
4247 |
++ |
4248 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0in | grep -q "packets 1 bytes 84") |
4249 |
++ if [ $? -ne 0 ]; then |
4250 |
++ bad_counter $ns ns0in "packets 1 bytes 84" |
4251 |
++ lret=1 |
4252 |
++ fi |
4253 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0out | grep -q "packets 1 bytes 84") |
4254 |
++ if [ $? -ne 0 ]; then |
4255 |
++ bad_counter $ns ns0out "packets 1 bytes 84" |
4256 |
++ lret=1 |
4257 |
++ fi |
4258 |
++ |
4259 |
++ expect="packets 1 bytes 104" |
4260 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0in6 | grep -q "$expect") |
4261 |
++ if [ $? -ne 0 ]; then |
4262 |
++ bad_counter $ns ns0in6 "$expect" |
4263 |
++ lret=1 |
4264 |
++ fi |
4265 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0out6 | grep -q "$expect") |
4266 |
++ if [ $? -ne 0 ]; then |
4267 |
++ bad_counter $ns ns0out6 "$expect" |
4268 |
++ lret=1 |
4269 |
++ fi |
4270 |
++ |
4271 |
++ return $lret |
4272 |
++} |
4273 |
++ |
4274 |
++check_ns0_counters() |
4275 |
++{ |
4276 |
++ local ns=$1 |
4277 |
++ local lret=0 |
4278 |
++ |
4279 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") |
4280 |
++ if [ $? -ne 0 ]; then |
4281 |
++ bad_counter ns0 ns0in "packets 0 bytes 0" |
4282 |
++ lret=1 |
4283 |
++ fi |
4284 |
++ |
4285 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") |
4286 |
++ if [ $? -ne 0 ]; then |
4287 |
++ bad_counter ns0 ns0in6 "packets 0 bytes 0" |
4288 |
++ lret=1 |
4289 |
++ fi |
4290 |
++ |
4291 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") |
4292 |
++ if [ $? -ne 0 ]; then |
4293 |
++ bad_counter ns0 ns0out "packets 0 bytes 0" |
4294 |
++ lret=1 |
4295 |
++ fi |
4296 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") |
4297 |
++ if [ $? -ne 0 ]; then |
4298 |
++ bad_counter ns0 ns0out6 "packets 0 bytes 0" |
4299 |
++ lret=1 |
4300 |
++ fi |
4301 |
++ |
4302 |
++ for dir in "in" "out" ; do |
4303 |
++ expect="packets 1 bytes 84" |
4304 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir} | grep -q "$expect") |
4305 |
++ if [ $? -ne 0 ]; then |
4306 |
++ bad_counter ns0 $ns$dir "$expect" |
4307 |
++ lret=1 |
4308 |
++ fi |
4309 |
++ |
4310 |
++ expect="packets 1 bytes 104" |
4311 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") |
4312 |
++ if [ $? -ne 0 ]; then |
4313 |
++ bad_counter ns0 $ns$dir6 "$expect" |
4314 |
++ lret=1 |
4315 |
++ fi |
4316 |
++ done |
4317 |
++ |
4318 |
++ return $lret |
4319 |
++} |
4320 |
++ |
4321 |
++reset_counters() |
4322 |
++{ |
4323 |
++ for i in 0 1 2;do |
4324 |
++ ip netns exec ns$i nft reset counters inet > /dev/null |
4325 |
++ done |
4326 |
++} |
4327 |
++ |
4328 |
++test_local_dnat6() |
4329 |
++{ |
4330 |
++ local lret=0 |
4331 |
++ip netns exec ns0 nft -f - <<EOF |
4332 |
++table ip6 nat { |
4333 |
++ chain output { |
4334 |
++ type nat hook output priority 0; policy accept; |
4335 |
++ ip6 daddr dead:1::99 dnat to dead:2::99 |
4336 |
++ } |
4337 |
++} |
4338 |
++EOF |
4339 |
++ if [ $? -ne 0 ]; then |
4340 |
++ echo "SKIP: Could not add add ip6 dnat hook" |
4341 |
++ return $ksft_skip |
4342 |
++ fi |
4343 |
++ |
4344 |
++ # ping netns1, expect rewrite to netns2 |
4345 |
++ ip netns exec ns0 ping -q -c 1 dead:1::99 > /dev/null |
4346 |
++ if [ $? -ne 0 ]; then |
4347 |
++ lret=1 |
4348 |
++ echo "ERROR: ping6 failed" |
4349 |
++ return $lret |
4350 |
++ fi |
4351 |
++ |
4352 |
++ expect="packets 0 bytes 0" |
4353 |
++ for dir in "in6" "out6" ; do |
4354 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4355 |
++ if [ $? -ne 0 ]; then |
4356 |
++ bad_counter ns0 ns1$dir "$expect" |
4357 |
++ lret=1 |
4358 |
++ fi |
4359 |
++ done |
4360 |
++ |
4361 |
++ expect="packets 1 bytes 104" |
4362 |
++ for dir in "in6" "out6" ; do |
4363 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4364 |
++ if [ $? -ne 0 ]; then |
4365 |
++ bad_counter ns0 ns2$dir "$expect" |
4366 |
++ lret=1 |
4367 |
++ fi |
4368 |
++ done |
4369 |
++ |
4370 |
++ # expect 0 count in ns1 |
4371 |
++ expect="packets 0 bytes 0" |
4372 |
++ for dir in "in6" "out6" ; do |
4373 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4374 |
++ if [ $? -ne 0 ]; then |
4375 |
++ bad_counter ns1 ns0$dir "$expect" |
4376 |
++ lret=1 |
4377 |
++ fi |
4378 |
++ done |
4379 |
++ |
4380 |
++ # expect 1 packet in ns2 |
4381 |
++ expect="packets 1 bytes 104" |
4382 |
++ for dir in "in6" "out6" ; do |
4383 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4384 |
++ if [ $? -ne 0 ]; then |
4385 |
++ bad_counter ns2 ns0$dir "$expect" |
4386 |
++ lret=1 |
4387 |
++ fi |
4388 |
++ done |
4389 |
++ |
4390 |
++ test $lret -eq 0 && echo "PASS: ipv6 ping to ns1 was NATted to ns2" |
4391 |
++ ip netns exec ns0 nft flush chain ip6 nat output |
4392 |
++ |
4393 |
++ return $lret |
4394 |
++} |
4395 |
++ |
4396 |
++test_local_dnat() |
4397 |
++{ |
4398 |
++ local lret=0 |
4399 |
++ip netns exec ns0 nft -f - <<EOF |
4400 |
++table ip nat { |
4401 |
++ chain output { |
4402 |
++ type nat hook output priority 0; policy accept; |
4403 |
++ ip daddr 10.0.1.99 dnat to 10.0.2.99 |
4404 |
++ } |
4405 |
++} |
4406 |
++EOF |
4407 |
++ # ping netns1, expect rewrite to netns2 |
4408 |
++ ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
4409 |
++ if [ $? -ne 0 ]; then |
4410 |
++ lret=1 |
4411 |
++ echo "ERROR: ping failed" |
4412 |
++ return $lret |
4413 |
++ fi |
4414 |
++ |
4415 |
++ expect="packets 0 bytes 0" |
4416 |
++ for dir in "in" "out" ; do |
4417 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4418 |
++ if [ $? -ne 0 ]; then |
4419 |
++ bad_counter ns0 ns1$dir "$expect" |
4420 |
++ lret=1 |
4421 |
++ fi |
4422 |
++ done |
4423 |
++ |
4424 |
++ expect="packets 1 bytes 84" |
4425 |
++ for dir in "in" "out" ; do |
4426 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4427 |
++ if [ $? -ne 0 ]; then |
4428 |
++ bad_counter ns0 ns2$dir "$expect" |
4429 |
++ lret=1 |
4430 |
++ fi |
4431 |
++ done |
4432 |
++ |
4433 |
++ # expect 0 count in ns1 |
4434 |
++ expect="packets 0 bytes 0" |
4435 |
++ for dir in "in" "out" ; do |
4436 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4437 |
++ if [ $? -ne 0 ]; then |
4438 |
++ bad_counter ns1 ns0$dir "$expect" |
4439 |
++ lret=1 |
4440 |
++ fi |
4441 |
++ done |
4442 |
++ |
4443 |
++ # expect 1 packet in ns2 |
4444 |
++ expect="packets 1 bytes 84" |
4445 |
++ for dir in "in" "out" ; do |
4446 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4447 |
++ if [ $? -ne 0 ]; then |
4448 |
++ bad_counter ns2 ns0$dir "$expect" |
4449 |
++ lret=1 |
4450 |
++ fi |
4451 |
++ done |
4452 |
++ |
4453 |
++ test $lret -eq 0 && echo "PASS: ping to ns1 was NATted to ns2" |
4454 |
++ |
4455 |
++ ip netns exec ns0 nft flush chain ip nat output |
4456 |
++ |
4457 |
++ reset_counters |
4458 |
++ ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
4459 |
++ if [ $? -ne 0 ]; then |
4460 |
++ lret=1 |
4461 |
++ echo "ERROR: ping failed" |
4462 |
++ return $lret |
4463 |
++ fi |
4464 |
++ |
4465 |
++ expect="packets 1 bytes 84" |
4466 |
++ for dir in "in" "out" ; do |
4467 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4468 |
++ if [ $? -ne 0 ]; then |
4469 |
++ bad_counter ns1 ns1$dir "$expect" |
4470 |
++ lret=1 |
4471 |
++ fi |
4472 |
++ done |
4473 |
++ expect="packets 0 bytes 0" |
4474 |
++ for dir in "in" "out" ; do |
4475 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4476 |
++ if [ $? -ne 0 ]; then |
4477 |
++ bad_counter ns0 ns2$dir "$expect" |
4478 |
++ lret=1 |
4479 |
++ fi |
4480 |
++ done |
4481 |
++ |
4482 |
++ # expect 1 count in ns1 |
4483 |
++ expect="packets 1 bytes 84" |
4484 |
++ for dir in "in" "out" ; do |
4485 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4486 |
++ if [ $? -ne 0 ]; then |
4487 |
++ bad_counter ns0 ns0$dir "$expect" |
4488 |
++ lret=1 |
4489 |
++ fi |
4490 |
++ done |
4491 |
++ |
4492 |
++ # expect 0 packet in ns2 |
4493 |
++ expect="packets 0 bytes 0" |
4494 |
++ for dir in "in" "out" ; do |
4495 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4496 |
++ if [ $? -ne 0 ]; then |
4497 |
++ bad_counter ns2 ns2$dir "$expect" |
4498 |
++ lret=1 |
4499 |
++ fi |
4500 |
++ done |
4501 |
++ |
4502 |
++ test $lret -eq 0 && echo "PASS: ping to ns1 OK after nat output chain flush" |
4503 |
++ |
4504 |
++ return $lret |
4505 |
++} |
4506 |
++ |
4507 |
++ |
4508 |
++test_masquerade6() |
4509 |
++{ |
4510 |
++ local lret=0 |
4511 |
++ |
4512 |
++ ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
4513 |
++ |
4514 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
4515 |
++ if [ $? -ne 0 ] ; then |
4516 |
++ echo "ERROR: cannot ping ns1 from ns2 via ipv6" |
4517 |
++ return 1 |
4518 |
++ lret=1 |
4519 |
++ fi |
4520 |
++ |
4521 |
++ expect="packets 1 bytes 104" |
4522 |
++ for dir in "in6" "out6" ; do |
4523 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4524 |
++ if [ $? -ne 0 ]; then |
4525 |
++ bad_counter ns1 ns2$dir "$expect" |
4526 |
++ lret=1 |
4527 |
++ fi |
4528 |
++ |
4529 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4530 |
++ if [ $? -ne 0 ]; then |
4531 |
++ bad_counter ns2 ns1$dir "$expect" |
4532 |
++ lret=1 |
4533 |
++ fi |
4534 |
++ done |
4535 |
++ |
4536 |
++ reset_counters |
4537 |
++ |
4538 |
++# add masquerading rule |
4539 |
++ip netns exec ns0 nft -f - <<EOF |
4540 |
++table ip6 nat { |
4541 |
++ chain postrouting { |
4542 |
++ type nat hook postrouting priority 0; policy accept; |
4543 |
++ meta oif veth0 masquerade |
4544 |
++ } |
4545 |
++} |
4546 |
++EOF |
4547 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
4548 |
++ if [ $? -ne 0 ] ; then |
4549 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerading" |
4550 |
++ lret=1 |
4551 |
++ fi |
4552 |
++ |
4553 |
++ # ns1 should have seen packets from ns0, due to masquerade |
4554 |
++ expect="packets 1 bytes 104" |
4555 |
++ for dir in "in6" "out6" ; do |
4556 |
++ |
4557 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4558 |
++ if [ $? -ne 0 ]; then |
4559 |
++ bad_counter ns1 ns0$dir "$expect" |
4560 |
++ lret=1 |
4561 |
++ fi |
4562 |
++ |
4563 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4564 |
++ if [ $? -ne 0 ]; then |
4565 |
++ bad_counter ns2 ns1$dir "$expect" |
4566 |
++ lret=1 |
4567 |
++ fi |
4568 |
++ done |
4569 |
++ |
4570 |
++ # ns1 should not have seen packets from ns2, due to masquerade |
4571 |
++ expect="packets 0 bytes 0" |
4572 |
++ for dir in "in6" "out6" ; do |
4573 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4574 |
++ if [ $? -ne 0 ]; then |
4575 |
++ bad_counter ns1 ns0$dir "$expect" |
4576 |
++ lret=1 |
4577 |
++ fi |
4578 |
++ |
4579 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4580 |
++ if [ $? -ne 0 ]; then |
4581 |
++ bad_counter ns2 ns1$dir "$expect" |
4582 |
++ lret=1 |
4583 |
++ fi |
4584 |
++ done |
4585 |
++ |
4586 |
++ ip netns exec ns0 nft flush chain ip6 nat postrouting |
4587 |
++ if [ $? -ne 0 ]; then |
4588 |
++ echo "ERROR: Could not flush ip6 nat postrouting" 1>&2 |
4589 |
++ lret=1 |
4590 |
++ fi |
4591 |
++ |
4592 |
++ test $lret -eq 0 && echo "PASS: IPv6 masquerade for ns2" |
4593 |
++ |
4594 |
++ return $lret |
4595 |
++} |
4596 |
++ |
4597 |
++test_masquerade() |
4598 |
++{ |
4599 |
++ local lret=0 |
4600 |
++ |
4601 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
4602 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
4603 |
++ |
4604 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4605 |
++ if [ $? -ne 0 ] ; then |
4606 |
++ echo "ERROR: canot ping ns1 from ns2" |
4607 |
++ lret=1 |
4608 |
++ fi |
4609 |
++ |
4610 |
++ expect="packets 1 bytes 84" |
4611 |
++ for dir in "in" "out" ; do |
4612 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4613 |
++ if [ $? -ne 0 ]; then |
4614 |
++ bad_counter ns1 ns2$dir "$expect" |
4615 |
++ lret=1 |
4616 |
++ fi |
4617 |
++ |
4618 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4619 |
++ if [ $? -ne 0 ]; then |
4620 |
++ bad_counter ns2 ns1$dir "$expect" |
4621 |
++ lret=1 |
4622 |
++ fi |
4623 |
++ done |
4624 |
++ |
4625 |
++ reset_counters |
4626 |
++ |
4627 |
++# add masquerading rule |
4628 |
++ip netns exec ns0 nft -f - <<EOF |
4629 |
++table ip nat { |
4630 |
++ chain postrouting { |
4631 |
++ type nat hook postrouting priority 0; policy accept; |
4632 |
++ meta oif veth0 masquerade |
4633 |
++ } |
4634 |
++} |
4635 |
++EOF |
4636 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4637 |
++ if [ $? -ne 0 ] ; then |
4638 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip masquerading" |
4639 |
++ lret=1 |
4640 |
++ fi |
4641 |
++ |
4642 |
++ # ns1 should have seen packets from ns0, due to masquerade |
4643 |
++ expect="packets 1 bytes 84" |
4644 |
++ for dir in "in" "out" ; do |
4645 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
4646 |
++ if [ $? -ne 0 ]; then |
4647 |
++ bad_counter ns1 ns0$dir "$expect" |
4648 |
++ lret=1 |
4649 |
++ fi |
4650 |
++ |
4651 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4652 |
++ if [ $? -ne 0 ]; then |
4653 |
++ bad_counter ns2 ns1$dir "$expect" |
4654 |
++ lret=1 |
4655 |
++ fi |
4656 |
++ done |
4657 |
++ |
4658 |
++ # ns1 should not have seen packets from ns2, due to masquerade |
4659 |
++ expect="packets 0 bytes 0" |
4660 |
++ for dir in "in" "out" ; do |
4661 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4662 |
++ if [ $? -ne 0 ]; then |
4663 |
++ bad_counter ns1 ns0$dir "$expect" |
4664 |
++ lret=1 |
4665 |
++ fi |
4666 |
++ |
4667 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4668 |
++ if [ $? -ne 0 ]; then |
4669 |
++ bad_counter ns2 ns1$dir "$expect" |
4670 |
++ lret=1 |
4671 |
++ fi |
4672 |
++ done |
4673 |
++ |
4674 |
++ ip netns exec ns0 nft flush chain ip nat postrouting |
4675 |
++ if [ $? -ne 0 ]; then |
4676 |
++ echo "ERROR: Could not flush nat postrouting" 1>&2 |
4677 |
++ lret=1 |
4678 |
++ fi |
4679 |
++ |
4680 |
++ test $lret -eq 0 && echo "PASS: IP masquerade for ns2" |
4681 |
++ |
4682 |
++ return $lret |
4683 |
++} |
4684 |
++ |
4685 |
++test_redirect6() |
4686 |
++{ |
4687 |
++ local lret=0 |
4688 |
++ |
4689 |
++ ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
4690 |
++ |
4691 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
4692 |
++ if [ $? -ne 0 ] ; then |
4693 |
++ echo "ERROR: cannnot ping ns1 from ns2 via ipv6" |
4694 |
++ lret=1 |
4695 |
++ fi |
4696 |
++ |
4697 |
++ expect="packets 1 bytes 104" |
4698 |
++ for dir in "in6" "out6" ; do |
4699 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4700 |
++ if [ $? -ne 0 ]; then |
4701 |
++ bad_counter ns1 ns2$dir "$expect" |
4702 |
++ lret=1 |
4703 |
++ fi |
4704 |
++ |
4705 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4706 |
++ if [ $? -ne 0 ]; then |
4707 |
++ bad_counter ns2 ns1$dir "$expect" |
4708 |
++ lret=1 |
4709 |
++ fi |
4710 |
++ done |
4711 |
++ |
4712 |
++ reset_counters |
4713 |
++ |
4714 |
++# add redirect rule |
4715 |
++ip netns exec ns0 nft -f - <<EOF |
4716 |
++table ip6 nat { |
4717 |
++ chain prerouting { |
4718 |
++ type nat hook prerouting priority 0; policy accept; |
4719 |
++ meta iif veth1 meta l4proto icmpv6 ip6 saddr dead:2::99 ip6 daddr dead:1::99 redirect |
4720 |
++ } |
4721 |
++} |
4722 |
++EOF |
4723 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
4724 |
++ if [ $? -ne 0 ] ; then |
4725 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip6 redirect" |
4726 |
++ lret=1 |
4727 |
++ fi |
4728 |
++ |
4729 |
++ # ns1 should have seen no packets from ns2, due to redirection |
4730 |
++ expect="packets 0 bytes 0" |
4731 |
++ for dir in "in6" "out6" ; do |
4732 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4733 |
++ if [ $? -ne 0 ]; then |
4734 |
++ bad_counter ns1 ns0$dir "$expect" |
4735 |
++ lret=1 |
4736 |
++ fi |
4737 |
++ done |
4738 |
++ |
4739 |
++ # ns0 should have seen packets from ns2, due to masquerade |
4740 |
++ expect="packets 1 bytes 104" |
4741 |
++ for dir in "in6" "out6" ; do |
4742 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4743 |
++ if [ $? -ne 0 ]; then |
4744 |
++ bad_counter ns1 ns0$dir "$expect" |
4745 |
++ lret=1 |
4746 |
++ fi |
4747 |
++ done |
4748 |
++ |
4749 |
++ ip netns exec ns0 nft delete table ip6 nat |
4750 |
++ if [ $? -ne 0 ]; then |
4751 |
++ echo "ERROR: Could not delete ip6 nat table" 1>&2 |
4752 |
++ lret=1 |
4753 |
++ fi |
4754 |
++ |
4755 |
++ test $lret -eq 0 && echo "PASS: IPv6 redirection for ns2" |
4756 |
++ |
4757 |
++ return $lret |
4758 |
++} |
4759 |
++ |
4760 |
++test_redirect() |
4761 |
++{ |
4762 |
++ local lret=0 |
4763 |
++ |
4764 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
4765 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
4766 |
++ |
4767 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4768 |
++ if [ $? -ne 0 ] ; then |
4769 |
++ echo "ERROR: cannot ping ns1 from ns2" |
4770 |
++ lret=1 |
4771 |
++ fi |
4772 |
++ |
4773 |
++ expect="packets 1 bytes 84" |
4774 |
++ for dir in "in" "out" ; do |
4775 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4776 |
++ if [ $? -ne 0 ]; then |
4777 |
++ bad_counter ns1 ns2$dir "$expect" |
4778 |
++ lret=1 |
4779 |
++ fi |
4780 |
++ |
4781 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
4782 |
++ if [ $? -ne 0 ]; then |
4783 |
++ bad_counter ns2 ns1$dir "$expect" |
4784 |
++ lret=1 |
4785 |
++ fi |
4786 |
++ done |
4787 |
++ |
4788 |
++ reset_counters |
4789 |
++ |
4790 |
++# add redirect rule |
4791 |
++ip netns exec ns0 nft -f - <<EOF |
4792 |
++table ip nat { |
4793 |
++ chain prerouting { |
4794 |
++ type nat hook prerouting priority 0; policy accept; |
4795 |
++ meta iif veth1 ip protocol icmp ip saddr 10.0.2.99 ip daddr 10.0.1.99 redirect |
4796 |
++ } |
4797 |
++} |
4798 |
++EOF |
4799 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4800 |
++ if [ $? -ne 0 ] ; then |
4801 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip redirect" |
4802 |
++ lret=1 |
4803 |
++ fi |
4804 |
++ |
4805 |
++ # ns1 should have seen no packets from ns2, due to redirection |
4806 |
++ expect="packets 0 bytes 0" |
4807 |
++ for dir in "in" "out" ; do |
4808 |
++ |
4809 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4810 |
++ if [ $? -ne 0 ]; then |
4811 |
++ bad_counter ns1 ns0$dir "$expect" |
4812 |
++ lret=1 |
4813 |
++ fi |
4814 |
++ done |
4815 |
++ |
4816 |
++ # ns0 should have seen packets from ns2, due to masquerade |
4817 |
++ expect="packets 1 bytes 84" |
4818 |
++ for dir in "in" "out" ; do |
4819 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
4820 |
++ if [ $? -ne 0 ]; then |
4821 |
++ bad_counter ns1 ns0$dir "$expect" |
4822 |
++ lret=1 |
4823 |
++ fi |
4824 |
++ done |
4825 |
++ |
4826 |
++ ip netns exec ns0 nft delete table ip nat |
4827 |
++ if [ $? -ne 0 ]; then |
4828 |
++ echo "ERROR: Could not delete nat table" 1>&2 |
4829 |
++ lret=1 |
4830 |
++ fi |
4831 |
++ |
4832 |
++ test $lret -eq 0 && echo "PASS: IP redirection for ns2" |
4833 |
++ |
4834 |
++ return $lret |
4835 |
++} |
4836 |
++ |
4837 |
++ |
4838 |
++# ip netns exec ns0 ping -c 1 -q 10.0.$i.99 |
4839 |
++for i in 0 1 2; do |
4840 |
++ip netns exec ns$i nft -f - <<EOF |
4841 |
++table inet filter { |
4842 |
++ counter ns0in {} |
4843 |
++ counter ns1in {} |
4844 |
++ counter ns2in {} |
4845 |
++ |
4846 |
++ counter ns0out {} |
4847 |
++ counter ns1out {} |
4848 |
++ counter ns2out {} |
4849 |
++ |
4850 |
++ counter ns0in6 {} |
4851 |
++ counter ns1in6 {} |
4852 |
++ counter ns2in6 {} |
4853 |
++ |
4854 |
++ counter ns0out6 {} |
4855 |
++ counter ns1out6 {} |
4856 |
++ counter ns2out6 {} |
4857 |
++ |
4858 |
++ map nsincounter { |
4859 |
++ type ipv4_addr : counter |
4860 |
++ elements = { 10.0.1.1 : "ns0in", |
4861 |
++ 10.0.2.1 : "ns0in", |
4862 |
++ 10.0.1.99 : "ns1in", |
4863 |
++ 10.0.2.99 : "ns2in" } |
4864 |
++ } |
4865 |
++ |
4866 |
++ map nsincounter6 { |
4867 |
++ type ipv6_addr : counter |
4868 |
++ elements = { dead:1::1 : "ns0in6", |
4869 |
++ dead:2::1 : "ns0in6", |
4870 |
++ dead:1::99 : "ns1in6", |
4871 |
++ dead:2::99 : "ns2in6" } |
4872 |
++ } |
4873 |
++ |
4874 |
++ map nsoutcounter { |
4875 |
++ type ipv4_addr : counter |
4876 |
++ elements = { 10.0.1.1 : "ns0out", |
4877 |
++ 10.0.2.1 : "ns0out", |
4878 |
++ 10.0.1.99: "ns1out", |
4879 |
++ 10.0.2.99: "ns2out" } |
4880 |
++ } |
4881 |
++ |
4882 |
++ map nsoutcounter6 { |
4883 |
++ type ipv6_addr : counter |
4884 |
++ elements = { dead:1::1 : "ns0out6", |
4885 |
++ dead:2::1 : "ns0out6", |
4886 |
++ dead:1::99 : "ns1out6", |
4887 |
++ dead:2::99 : "ns2out6" } |
4888 |
++ } |
4889 |
++ |
4890 |
++ chain input { |
4891 |
++ type filter hook input priority 0; policy accept; |
4892 |
++ counter name ip saddr map @nsincounter |
4893 |
++ icmpv6 type { "echo-request", "echo-reply" } counter name ip6 saddr map @nsincounter6 |
4894 |
++ } |
4895 |
++ chain output { |
4896 |
++ type filter hook output priority 0; policy accept; |
4897 |
++ counter name ip daddr map @nsoutcounter |
4898 |
++ icmpv6 type { "echo-request", "echo-reply" } counter name ip6 daddr map @nsoutcounter6 |
4899 |
++ } |
4900 |
++} |
4901 |
++EOF |
4902 |
++done |
4903 |
++ |
4904 |
++sleep 3 |
4905 |
++# test basic connectivity |
4906 |
++for i in 1 2; do |
4907 |
++ ip netns exec ns0 ping -c 1 -q 10.0.$i.99 > /dev/null |
4908 |
++ if [ $? -ne 0 ];then |
4909 |
++ echo "ERROR: Could not reach other namespace(s)" 1>&2 |
4910 |
++ ret=1 |
4911 |
++ fi |
4912 |
++ |
4913 |
++ ip netns exec ns0 ping -c 1 -q dead:$i::99 > /dev/null |
4914 |
++ if [ $? -ne 0 ];then |
4915 |
++ echo "ERROR: Could not reach other namespace(s) via ipv6" 1>&2 |
4916 |
++ ret=1 |
4917 |
++ fi |
4918 |
++ check_counters ns$i |
4919 |
++ if [ $? -ne 0 ]; then |
4920 |
++ ret=1 |
4921 |
++ fi |
4922 |
++ |
4923 |
++ check_ns0_counters ns$i |
4924 |
++ if [ $? -ne 0 ]; then |
4925 |
++ ret=1 |
4926 |
++ fi |
4927 |
++ reset_counters |
4928 |
++done |
4929 |
++ |
4930 |
++if [ $ret -eq 0 ];then |
4931 |
++ echo "PASS: netns routing/connectivity: ns0 can reach ns1 and ns2" |
4932 |
++fi |
4933 |
++ |
4934 |
++reset_counters |
4935 |
++test_local_dnat |
4936 |
++test_local_dnat6 |
4937 |
++ |
4938 |
++reset_counters |
4939 |
++test_masquerade |
4940 |
++test_masquerade6 |
4941 |
++ |
4942 |
++reset_counters |
4943 |
++test_redirect |
4944 |
++test_redirect6 |
4945 |
++ |
4946 |
++for i in 0 1 2; do ip netns del ns$i;done |
4947 |
++ |
4948 |
++exit $ret |
4949 |
+diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile |
4950 |
+index 3496680981f2..d937e45532d8 100644 |
4951 |
+--- a/tools/testing/selftests/timers/Makefile |
4952 |
++++ b/tools/testing/selftests/timers/Makefile |
4953 |
+@@ -1,6 +1,6 @@ |
4954 |
+ # SPDX-License-Identifier: GPL-2.0 |
4955 |
+ CFLAGS += -O3 -Wl,-no-as-needed -Wall |
4956 |
+-LDFLAGS += -lrt -lpthread -lm |
4957 |
++LDLIBS += -lrt -lpthread -lm |
4958 |
+ |
4959 |
+ # these are all "safe" tests that don't modify |
4960 |
+ # system time or require escalated privileges |