1 |
commit: 87583f9e386eb687f2ebb5dcd54ebeee1a152485 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 13 22:04:52 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 13 22:04:52 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=87583f9e |
7 |
|
8 |
proj/linux-patches: Linux patch 4.9.163 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1162_linux-4.9.163.patch | 3813 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3817 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 44fb51a..6d74c9a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -691,6 +691,10 @@ Patch: 1161_linux-4.9.162.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.162 |
23 |
|
24 |
+Patch: 1162_linux-4.9.163.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.163 |
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/1162_linux-4.9.163.patch b/1162_linux-4.9.163.patch |
33 |
new file mode 100644 |
34 |
index 0000000..f992152 |
35 |
--- /dev/null |
36 |
+++ b/1162_linux-4.9.163.patch |
37 |
@@ -0,0 +1,3813 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index fce163d09139..8a5330e279ad 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 9 |
45 |
+-SUBLEVEL = 162 |
46 |
++SUBLEVEL = 163 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Roaring Lionus |
49 |
+ |
50 |
+diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi |
51 |
+index 2a531beef4c7..51dbd8cb91cb 100644 |
52 |
+--- a/arch/arm/boot/dts/exynos3250.dtsi |
53 |
++++ b/arch/arm/boot/dts/exynos3250.dtsi |
54 |
+@@ -170,6 +170,9 @@ |
55 |
+ interrupt-controller; |
56 |
+ #interrupt-cells = <3>; |
57 |
+ interrupt-parent = <&gic>; |
58 |
++ clock-names = "clkout8"; |
59 |
++ clocks = <&cmu CLK_FIN_PLL>; |
60 |
++ #clock-cells = <1>; |
61 |
+ }; |
62 |
+ |
63 |
+ mipi_phy: video-phy { |
64 |
+diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
65 |
+index 5282d69e55bd..2d83cbf672b2 100644 |
66 |
+--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
67 |
++++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
68 |
+@@ -70,7 +70,7 @@ |
69 |
+ }; |
70 |
+ |
71 |
+ emmc_pwrseq: pwrseq { |
72 |
+- pinctrl-0 = <&sd1_cd>; |
73 |
++ pinctrl-0 = <&emmc_rstn>; |
74 |
+ pinctrl-names = "default"; |
75 |
+ compatible = "mmc-pwrseq-emmc"; |
76 |
+ reset-gpios = <&gpk1 2 GPIO_ACTIVE_LOW>; |
77 |
+@@ -161,12 +161,6 @@ |
78 |
+ cpu0-supply = <&buck2_reg>; |
79 |
+ }; |
80 |
+ |
81 |
+-/* RSTN signal for eMMC */ |
82 |
+-&sd1_cd { |
83 |
+- samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
84 |
+- samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>; |
85 |
+-}; |
86 |
+- |
87 |
+ &pinctrl_1 { |
88 |
+ gpio_power_key: power_key { |
89 |
+ samsung,pins = "gpx1-3"; |
90 |
+@@ -184,6 +178,11 @@ |
91 |
+ samsung,pins = "gpx3-7"; |
92 |
+ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>; |
93 |
+ }; |
94 |
++ |
95 |
++ emmc_rstn: emmc-rstn { |
96 |
++ samsung,pins = "gpk1-2"; |
97 |
++ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
98 |
++ }; |
99 |
+ }; |
100 |
+ |
101 |
+ &ehci { |
102 |
+diff --git a/arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi b/arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi |
103 |
+new file mode 100644 |
104 |
+index 000000000000..c8771c660550 |
105 |
+--- /dev/null |
106 |
++++ b/arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi |
107 |
+@@ -0,0 +1,25 @@ |
108 |
++/* |
109 |
++ * Device tree sources for Exynos5420 TMU sensor configuration |
110 |
++ * |
111 |
++ * Copyright (c) 2014 Lukasz Majewski <l.majewski@×××××××.com> |
112 |
++ * Copyright (c) 2017 Krzysztof Kozlowski <krzk@××××××.org> |
113 |
++ * |
114 |
++ * This program is free software; you can redistribute it and/or modify |
115 |
++ * it under the terms of the GNU General Public License version 2 as |
116 |
++ * published by the Free Software Foundation. |
117 |
++ * |
118 |
++ */ |
119 |
++ |
120 |
++#include <dt-bindings/thermal/thermal_exynos.h> |
121 |
++ |
122 |
++#thermal-sensor-cells = <0>; |
123 |
++samsung,tmu_gain = <8>; |
124 |
++samsung,tmu_reference_voltage = <16>; |
125 |
++samsung,tmu_noise_cancel_mode = <4>; |
126 |
++samsung,tmu_efuse_value = <55>; |
127 |
++samsung,tmu_min_efuse_value = <0>; |
128 |
++samsung,tmu_max_efuse_value = <100>; |
129 |
++samsung,tmu_first_point_trim = <25>; |
130 |
++samsung,tmu_second_point_trim = <85>; |
131 |
++samsung,tmu_default_temp_offset = <50>; |
132 |
++samsung,tmu_cal_type = <TYPE_ONE_POINT_TRIMMING>; |
133 |
+diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi |
134 |
+index 00c4cfa54839..52f3d911f67f 100644 |
135 |
+--- a/arch/arm/boot/dts/exynos5420.dtsi |
136 |
++++ b/arch/arm/boot/dts/exynos5420.dtsi |
137 |
+@@ -694,7 +694,7 @@ |
138 |
+ interrupts = <0 65 0>; |
139 |
+ clocks = <&clock CLK_TMU>; |
140 |
+ clock-names = "tmu_apbif"; |
141 |
+- #include "exynos4412-tmu-sensor-conf.dtsi" |
142 |
++ #include "exynos5420-tmu-sensor-conf.dtsi" |
143 |
+ }; |
144 |
+ |
145 |
+ tmu_cpu1: tmu@10064000 { |
146 |
+@@ -703,7 +703,7 @@ |
147 |
+ interrupts = <0 183 0>; |
148 |
+ clocks = <&clock CLK_TMU>; |
149 |
+ clock-names = "tmu_apbif"; |
150 |
+- #include "exynos4412-tmu-sensor-conf.dtsi" |
151 |
++ #include "exynos5420-tmu-sensor-conf.dtsi" |
152 |
+ }; |
153 |
+ |
154 |
+ tmu_cpu2: tmu@10068000 { |
155 |
+@@ -712,7 +712,7 @@ |
156 |
+ interrupts = <0 184 0>; |
157 |
+ clocks = <&clock CLK_TMU>, <&clock CLK_TMU>; |
158 |
+ clock-names = "tmu_apbif", "tmu_triminfo_apbif"; |
159 |
+- #include "exynos4412-tmu-sensor-conf.dtsi" |
160 |
++ #include "exynos5420-tmu-sensor-conf.dtsi" |
161 |
+ }; |
162 |
+ |
163 |
+ tmu_cpu3: tmu@1006c000 { |
164 |
+@@ -721,7 +721,7 @@ |
165 |
+ interrupts = <0 185 0>; |
166 |
+ clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>; |
167 |
+ clock-names = "tmu_apbif", "tmu_triminfo_apbif"; |
168 |
+- #include "exynos4412-tmu-sensor-conf.dtsi" |
169 |
++ #include "exynos5420-tmu-sensor-conf.dtsi" |
170 |
+ }; |
171 |
+ |
172 |
+ tmu_gpu: tmu@100a0000 { |
173 |
+@@ -730,7 +730,7 @@ |
174 |
+ interrupts = <0 215 0>; |
175 |
+ clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>; |
176 |
+ clock-names = "tmu_apbif", "tmu_triminfo_apbif"; |
177 |
+- #include "exynos4412-tmu-sensor-conf.dtsi" |
178 |
++ #include "exynos5420-tmu-sensor-conf.dtsi" |
179 |
+ }; |
180 |
+ |
181 |
+ sysmmu_g2dr: sysmmu@0x10A60000 { |
182 |
+diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S |
183 |
+index 56be67ecf0fa..d69adfb3d79e 100644 |
184 |
+--- a/arch/arm/kernel/entry-common.S |
185 |
++++ b/arch/arm/kernel/entry-common.S |
186 |
+@@ -32,6 +32,7 @@ |
187 |
+ * features make this path too inefficient. |
188 |
+ */ |
189 |
+ ret_fast_syscall: |
190 |
++__ret_fast_syscall: |
191 |
+ UNWIND(.fnstart ) |
192 |
+ UNWIND(.cantunwind ) |
193 |
+ disable_irq_notrace @ disable interrupts |
194 |
+@@ -57,6 +58,7 @@ fast_work_pending: |
195 |
+ * r0 first to avoid needing to save registers around each C function call. |
196 |
+ */ |
197 |
+ ret_fast_syscall: |
198 |
++__ret_fast_syscall: |
199 |
+ UNWIND(.fnstart ) |
200 |
+ UNWIND(.cantunwind ) |
201 |
+ str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
202 |
+@@ -223,7 +225,7 @@ local_restart: |
203 |
+ tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? |
204 |
+ bne __sys_trace |
205 |
+ |
206 |
+- invoke_syscall tbl, scno, r10, ret_fast_syscall |
207 |
++ invoke_syscall tbl, scno, r10, __ret_fast_syscall |
208 |
+ |
209 |
+ add r1, sp, #S_OFF |
210 |
+ 2: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE) |
211 |
+diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c |
212 |
+index ba13f793fbce..b92673efffff 100644 |
213 |
+--- a/arch/arm/plat-pxa/ssp.c |
214 |
++++ b/arch/arm/plat-pxa/ssp.c |
215 |
+@@ -237,8 +237,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) |
216 |
+ if (ssp == NULL) |
217 |
+ return -ENODEV; |
218 |
+ |
219 |
+- iounmap(ssp->mmio_base); |
220 |
+- |
221 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
222 |
+ release_mem_region(res->start, resource_size(res)); |
223 |
+ |
224 |
+@@ -248,7 +246,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) |
225 |
+ list_del(&ssp->node); |
226 |
+ mutex_unlock(&ssp_lock); |
227 |
+ |
228 |
+- kfree(ssp); |
229 |
+ return 0; |
230 |
+ } |
231 |
+ |
232 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
233 |
+index 2c93de7fffe5..bdea2d6fde94 100644 |
234 |
+--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
235 |
++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
236 |
+@@ -219,7 +219,7 @@ |
237 |
+ compatible = "simple-bus"; |
238 |
+ |
239 |
+ intc: interrupt-controller@9bc0000 { |
240 |
+- compatible = "arm,gic-v3"; |
241 |
++ compatible = "qcom,msm8996-gic-v3", "arm,gic-v3"; |
242 |
+ #interrupt-cells = <3>; |
243 |
+ interrupt-controller; |
244 |
+ #redistributor-regions = <1>; |
245 |
+diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c |
246 |
+index 30bcae0aef2a..d2b1b624ddc3 100644 |
247 |
+--- a/arch/arm64/kernel/probes/kprobes.c |
248 |
++++ b/arch/arm64/kernel/probes/kprobes.c |
249 |
+@@ -546,13 +546,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) |
250 |
+ addr < (unsigned long)__entry_text_end) || |
251 |
+ (addr >= (unsigned long)__idmap_text_start && |
252 |
+ addr < (unsigned long)__idmap_text_end) || |
253 |
++ (addr >= (unsigned long)__hyp_text_start && |
254 |
++ addr < (unsigned long)__hyp_text_end) || |
255 |
+ !!search_exception_tables(addr)) |
256 |
+ return true; |
257 |
+ |
258 |
+ if (!is_kernel_in_hyp_mode()) { |
259 |
+- if ((addr >= (unsigned long)__hyp_text_start && |
260 |
+- addr < (unsigned long)__hyp_text_end) || |
261 |
+- (addr >= (unsigned long)__hyp_idmap_text_start && |
262 |
++ if ((addr >= (unsigned long)__hyp_idmap_text_start && |
263 |
+ addr < (unsigned long)__hyp_idmap_text_end)) |
264 |
+ return true; |
265 |
+ } |
266 |
+diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c |
267 |
+index 2b0a371b42af..24444ed456c8 100644 |
268 |
+--- a/arch/mips/kernel/irq.c |
269 |
++++ b/arch/mips/kernel/irq.c |
270 |
+@@ -52,6 +52,7 @@ asmlinkage void spurious_interrupt(void) |
271 |
+ void __init init_IRQ(void) |
272 |
+ { |
273 |
+ int i; |
274 |
++ unsigned int order = get_order(IRQ_STACK_SIZE); |
275 |
+ |
276 |
+ for (i = 0; i < NR_IRQS; i++) |
277 |
+ irq_set_noprobe(i); |
278 |
+@@ -62,8 +63,7 @@ void __init init_IRQ(void) |
279 |
+ arch_init_irq(); |
280 |
+ |
281 |
+ for_each_possible_cpu(i) { |
282 |
+- int irq_pages = IRQ_STACK_SIZE / PAGE_SIZE; |
283 |
+- void *s = (void *)__get_free_pages(GFP_KERNEL, irq_pages); |
284 |
++ void *s = (void *)__get_free_pages(GFP_KERNEL, order); |
285 |
+ |
286 |
+ irq_stack[i] = s; |
287 |
+ pr_debug("CPU%d IRQ stack at 0x%p - 0x%p\n", i, |
288 |
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
289 |
+index 1cc133e7026f..fffd031dc6b6 100644 |
290 |
+--- a/arch/mips/kernel/process.c |
291 |
++++ b/arch/mips/kernel/process.c |
292 |
+@@ -344,7 +344,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip) |
293 |
+ static int get_frame_info(struct mips_frame_info *info) |
294 |
+ { |
295 |
+ bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
296 |
+- union mips_instruction insn, *ip, *ip_end; |
297 |
++ union mips_instruction insn, *ip; |
298 |
+ const unsigned int max_insns = 128; |
299 |
+ unsigned int last_insn_size = 0; |
300 |
+ unsigned int i; |
301 |
+@@ -356,10 +356,9 @@ static int get_frame_info(struct mips_frame_info *info) |
302 |
+ if (!ip) |
303 |
+ goto err; |
304 |
+ |
305 |
+- ip_end = (void *)ip + info->func_size; |
306 |
+- |
307 |
+- for (i = 0; i < max_insns && ip < ip_end; i++) { |
308 |
++ for (i = 0; i < max_insns; i++) { |
309 |
+ ip = (void *)ip + last_insn_size; |
310 |
++ |
311 |
+ if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
312 |
+ insn.halfword[0] = 0; |
313 |
+ insn.halfword[1] = ip->halfword[0]; |
314 |
+diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c |
315 |
+index ab04751a12b6..1e9f610d36a4 100644 |
316 |
+--- a/arch/x86/events/core.c |
317 |
++++ b/arch/x86/events/core.c |
318 |
+@@ -1942,7 +1942,7 @@ static int x86_pmu_commit_txn(struct pmu *pmu) |
319 |
+ */ |
320 |
+ static void free_fake_cpuc(struct cpu_hw_events *cpuc) |
321 |
+ { |
322 |
+- kfree(cpuc->shared_regs); |
323 |
++ intel_cpuc_finish(cpuc); |
324 |
+ kfree(cpuc); |
325 |
+ } |
326 |
+ |
327 |
+@@ -1954,14 +1954,11 @@ static struct cpu_hw_events *allocate_fake_cpuc(void) |
328 |
+ cpuc = kzalloc(sizeof(*cpuc), GFP_KERNEL); |
329 |
+ if (!cpuc) |
330 |
+ return ERR_PTR(-ENOMEM); |
331 |
+- |
332 |
+- /* only needed, if we have extra_regs */ |
333 |
+- if (x86_pmu.extra_regs) { |
334 |
+- cpuc->shared_regs = allocate_shared_regs(cpu); |
335 |
+- if (!cpuc->shared_regs) |
336 |
+- goto error; |
337 |
+- } |
338 |
+ cpuc->is_fake = 1; |
339 |
++ |
340 |
++ if (intel_cpuc_prepare(cpuc, cpu)) |
341 |
++ goto error; |
342 |
++ |
343 |
+ return cpuc; |
344 |
+ error: |
345 |
+ free_fake_cpuc(cpuc); |
346 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
347 |
+index f0639c8ebcb6..098ab775135f 100644 |
348 |
+--- a/arch/x86/events/intel/core.c |
349 |
++++ b/arch/x86/events/intel/core.c |
350 |
+@@ -2492,6 +2492,35 @@ intel_stop_scheduling(struct cpu_hw_events *cpuc) |
351 |
+ raw_spin_unlock(&excl_cntrs->lock); |
352 |
+ } |
353 |
+ |
354 |
++static struct event_constraint * |
355 |
++dyn_constraint(struct cpu_hw_events *cpuc, struct event_constraint *c, int idx) |
356 |
++{ |
357 |
++ WARN_ON_ONCE(!cpuc->constraint_list); |
358 |
++ |
359 |
++ if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
360 |
++ struct event_constraint *cx; |
361 |
++ |
362 |
++ /* |
363 |
++ * grab pre-allocated constraint entry |
364 |
++ */ |
365 |
++ cx = &cpuc->constraint_list[idx]; |
366 |
++ |
367 |
++ /* |
368 |
++ * initialize dynamic constraint |
369 |
++ * with static constraint |
370 |
++ */ |
371 |
++ *cx = *c; |
372 |
++ |
373 |
++ /* |
374 |
++ * mark constraint as dynamic |
375 |
++ */ |
376 |
++ cx->flags |= PERF_X86_EVENT_DYNAMIC; |
377 |
++ c = cx; |
378 |
++ } |
379 |
++ |
380 |
++ return c; |
381 |
++} |
382 |
++ |
383 |
+ static struct event_constraint * |
384 |
+ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
385 |
+ int idx, struct event_constraint *c) |
386 |
+@@ -2522,27 +2551,7 @@ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
387 |
+ * only needed when constraint has not yet |
388 |
+ * been cloned (marked dynamic) |
389 |
+ */ |
390 |
+- if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
391 |
+- struct event_constraint *cx; |
392 |
+- |
393 |
+- /* |
394 |
+- * grab pre-allocated constraint entry |
395 |
+- */ |
396 |
+- cx = &cpuc->constraint_list[idx]; |
397 |
+- |
398 |
+- /* |
399 |
+- * initialize dynamic constraint |
400 |
+- * with static constraint |
401 |
+- */ |
402 |
+- *cx = *c; |
403 |
+- |
404 |
+- /* |
405 |
+- * mark constraint as dynamic, so we |
406 |
+- * can free it later on |
407 |
+- */ |
408 |
+- cx->flags |= PERF_X86_EVENT_DYNAMIC; |
409 |
+- c = cx; |
410 |
+- } |
411 |
++ c = dyn_constraint(cpuc, c, idx); |
412 |
+ |
413 |
+ /* |
414 |
+ * From here on, the constraint is dynamic. |
415 |
+@@ -3093,7 +3102,7 @@ ssize_t intel_event_sysfs_show(char *page, u64 config) |
416 |
+ return x86_event_sysfs_show(page, config, event); |
417 |
+ } |
418 |
+ |
419 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu) |
420 |
++static struct intel_shared_regs *allocate_shared_regs(int cpu) |
421 |
+ { |
422 |
+ struct intel_shared_regs *regs; |
423 |
+ int i; |
424 |
+@@ -3125,10 +3134,9 @@ static struct intel_excl_cntrs *allocate_excl_cntrs(int cpu) |
425 |
+ return c; |
426 |
+ } |
427 |
+ |
428 |
+-static int intel_pmu_cpu_prepare(int cpu) |
429 |
+-{ |
430 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
431 |
+ |
432 |
++int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu) |
433 |
++{ |
434 |
+ if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) { |
435 |
+ cpuc->shared_regs = allocate_shared_regs(cpu); |
436 |
+ if (!cpuc->shared_regs) |
437 |
+@@ -3138,7 +3146,7 @@ static int intel_pmu_cpu_prepare(int cpu) |
438 |
+ if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
439 |
+ size_t sz = X86_PMC_IDX_MAX * sizeof(struct event_constraint); |
440 |
+ |
441 |
+- cpuc->constraint_list = kzalloc(sz, GFP_KERNEL); |
442 |
++ cpuc->constraint_list = kzalloc_node(sz, GFP_KERNEL, cpu_to_node(cpu)); |
443 |
+ if (!cpuc->constraint_list) |
444 |
+ goto err_shared_regs; |
445 |
+ |
446 |
+@@ -3163,6 +3171,11 @@ err: |
447 |
+ return -ENOMEM; |
448 |
+ } |
449 |
+ |
450 |
++static int intel_pmu_cpu_prepare(int cpu) |
451 |
++{ |
452 |
++ return intel_cpuc_prepare(&per_cpu(cpu_hw_events, cpu), cpu); |
453 |
++} |
454 |
++ |
455 |
+ static void intel_pmu_cpu_starting(int cpu) |
456 |
+ { |
457 |
+ struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
458 |
+@@ -3218,9 +3231,8 @@ static void intel_pmu_cpu_starting(int cpu) |
459 |
+ } |
460 |
+ } |
461 |
+ |
462 |
+-static void free_excl_cntrs(int cpu) |
463 |
++static void free_excl_cntrs(struct cpu_hw_events *cpuc) |
464 |
+ { |
465 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
466 |
+ struct intel_excl_cntrs *c; |
467 |
+ |
468 |
+ c = cpuc->excl_cntrs; |
469 |
+@@ -3238,9 +3250,8 @@ static void intel_pmu_cpu_dying(int cpu) |
470 |
+ fini_debug_store_on_cpu(cpu); |
471 |
+ } |
472 |
+ |
473 |
+-static void intel_pmu_cpu_dead(int cpu) |
474 |
++void intel_cpuc_finish(struct cpu_hw_events *cpuc) |
475 |
+ { |
476 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
477 |
+ struct intel_shared_regs *pc; |
478 |
+ |
479 |
+ pc = cpuc->shared_regs; |
480 |
+@@ -3250,7 +3261,12 @@ static void intel_pmu_cpu_dead(int cpu) |
481 |
+ cpuc->shared_regs = NULL; |
482 |
+ } |
483 |
+ |
484 |
+- free_excl_cntrs(cpu); |
485 |
++ free_excl_cntrs(cpuc); |
486 |
++} |
487 |
++ |
488 |
++static void intel_pmu_cpu_dead(int cpu) |
489 |
++{ |
490 |
++ intel_cpuc_finish(&per_cpu(cpu_hw_events, cpu)); |
491 |
+ } |
492 |
+ |
493 |
+ static void intel_pmu_sched_task(struct perf_event_context *ctx, |
494 |
+@@ -4132,7 +4148,7 @@ static __init int fixup_ht_bug(void) |
495 |
+ get_online_cpus(); |
496 |
+ |
497 |
+ for_each_online_cpu(c) { |
498 |
+- free_excl_cntrs(c); |
499 |
++ free_excl_cntrs(&per_cpu(cpu_hw_events, c)); |
500 |
+ } |
501 |
+ |
502 |
+ put_online_cpus(); |
503 |
+diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
504 |
+index 5c21680b0a69..1ce6ae35f6a2 100644 |
505 |
+--- a/arch/x86/events/perf_event.h |
506 |
++++ b/arch/x86/events/perf_event.h |
507 |
+@@ -865,7 +865,8 @@ struct event_constraint * |
508 |
+ x86_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
509 |
+ struct perf_event *event); |
510 |
+ |
511 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu); |
512 |
++extern int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu); |
513 |
++extern void intel_cpuc_finish(struct cpu_hw_events *cpuc); |
514 |
+ |
515 |
+ int intel_pmu_init(void); |
516 |
+ |
517 |
+@@ -995,9 +996,13 @@ static inline int intel_pmu_init(void) |
518 |
+ return 0; |
519 |
+ } |
520 |
+ |
521 |
+-static inline struct intel_shared_regs *allocate_shared_regs(int cpu) |
522 |
++static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu) |
523 |
++{ |
524 |
++ return 0; |
525 |
++} |
526 |
++ |
527 |
++static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc) |
528 |
+ { |
529 |
+- return NULL; |
530 |
+ } |
531 |
+ |
532 |
+ static inline int is_ht_workaround_enabled(void) |
533 |
+diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h |
534 |
+index c56c24347f15..98444b77fbe3 100644 |
535 |
+--- a/arch/x86/include/asm/cpufeatures.h |
536 |
++++ b/arch/x86/include/asm/cpufeatures.h |
537 |
+@@ -314,6 +314,7 @@ |
538 |
+ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ |
539 |
+ #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ |
540 |
+ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ |
541 |
++#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ |
542 |
+ #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ |
543 |
+ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
544 |
+ #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ |
545 |
+diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h |
546 |
+index bbbb9b14ade1..9963e21ac443 100644 |
547 |
+--- a/arch/x86/include/asm/msr-index.h |
548 |
++++ b/arch/x86/include/asm/msr-index.h |
549 |
+@@ -575,6 +575,12 @@ |
550 |
+ |
551 |
+ #define MSR_IA32_TSC_DEADLINE 0x000006E0 |
552 |
+ |
553 |
++ |
554 |
++#define MSR_TSX_FORCE_ABORT 0x0000010F |
555 |
++ |
556 |
++#define MSR_TFA_RTM_FORCE_ABORT_BIT 0 |
557 |
++#define MSR_TFA_RTM_FORCE_ABORT BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT) |
558 |
++ |
559 |
+ /* P4/Xeon+ specific */ |
560 |
+ #define MSR_IA32_MCG_EAX 0x00000180 |
561 |
+ #define MSR_IA32_MCG_EBX 0x00000181 |
562 |
+diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h |
563 |
+index 9215e0527647..390fdd39e0e2 100644 |
564 |
+--- a/arch/x86/include/asm/page_64_types.h |
565 |
++++ b/arch/x86/include/asm/page_64_types.h |
566 |
+@@ -6,7 +6,11 @@ |
567 |
+ #endif |
568 |
+ |
569 |
+ #ifdef CONFIG_KASAN |
570 |
++#ifdef CONFIG_KASAN_EXTRA |
571 |
++#define KASAN_STACK_ORDER 2 |
572 |
++#else |
573 |
+ #define KASAN_STACK_ORDER 1 |
574 |
++#endif |
575 |
+ #else |
576 |
+ #define KASAN_STACK_ORDER 0 |
577 |
+ #endif |
578 |
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
579 |
+index 4c2648b96c9a..be6d0543e626 100644 |
580 |
+--- a/arch/x86/kernel/cpu/amd.c |
581 |
++++ b/arch/x86/kernel/cpu/amd.c |
582 |
+@@ -765,11 +765,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c) |
583 |
+ static void init_amd_zn(struct cpuinfo_x86 *c) |
584 |
+ { |
585 |
+ set_cpu_cap(c, X86_FEATURE_ZEN); |
586 |
+- /* |
587 |
+- * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects |
588 |
+- * all up to and including B1. |
589 |
+- */ |
590 |
+- if (c->x86_model <= 1 && c->x86_stepping <= 1) |
591 |
++ |
592 |
++ /* Fix erratum 1076: CPB feature bit not being set in CPUID. */ |
593 |
++ if (!cpu_has(c, X86_FEATURE_CPB)) |
594 |
+ set_cpu_cap(c, X86_FEATURE_CPB); |
595 |
+ } |
596 |
+ |
597 |
+diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c |
598 |
+index 490f9be3fda2..167ecc270ca5 100644 |
599 |
+--- a/arch/x86/kernel/kexec-bzimage64.c |
600 |
++++ b/arch/x86/kernel/kexec-bzimage64.c |
601 |
+@@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, |
602 |
+ struct efi_info *current_ei = &boot_params.efi_info; |
603 |
+ struct efi_info *ei = ¶ms->efi_info; |
604 |
+ |
605 |
++ if (!efi_enabled(EFI_RUNTIME_SERVICES)) |
606 |
++ return 0; |
607 |
++ |
608 |
+ if (!current_ei->efi_memmap_size) |
609 |
+ return 0; |
610 |
+ |
611 |
+diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig |
612 |
+index 14e3ca353ac8..5035b86a2e49 100644 |
613 |
+--- a/arch/xtensa/configs/smp_lx200_defconfig |
614 |
++++ b/arch/xtensa/configs/smp_lx200_defconfig |
615 |
+@@ -34,6 +34,7 @@ CONFIG_SMP=y |
616 |
+ CONFIG_HOTPLUG_CPU=y |
617 |
+ # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set |
618 |
+ # CONFIG_PCI is not set |
619 |
++CONFIG_VECTORS_OFFSET=0x00002000 |
620 |
+ CONFIG_XTENSA_PLATFORM_XTFPGA=y |
621 |
+ CONFIG_CMDLINE_BOOL=y |
622 |
+ CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" |
623 |
+diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S |
624 |
+index 27c8e07ace43..29f445b410b3 100644 |
625 |
+--- a/arch/xtensa/kernel/head.S |
626 |
++++ b/arch/xtensa/kernel/head.S |
627 |
+@@ -281,12 +281,13 @@ should_never_return: |
628 |
+ |
629 |
+ movi a2, cpu_start_ccount |
630 |
+ 1: |
631 |
++ memw |
632 |
+ l32i a3, a2, 0 |
633 |
+ beqi a3, 0, 1b |
634 |
+ movi a3, 0 |
635 |
+ s32i a3, a2, 0 |
636 |
+- memw |
637 |
+ 1: |
638 |
++ memw |
639 |
+ l32i a3, a2, 0 |
640 |
+ beqi a3, 0, 1b |
641 |
+ wsr a3, ccount |
642 |
+@@ -323,11 +324,13 @@ ENTRY(cpu_restart) |
643 |
+ rsr a0, prid |
644 |
+ neg a2, a0 |
645 |
+ movi a3, cpu_start_id |
646 |
++ memw |
647 |
+ s32i a2, a3, 0 |
648 |
+ #if XCHAL_DCACHE_IS_WRITEBACK |
649 |
+ dhwbi a3, 0 |
650 |
+ #endif |
651 |
+ 1: |
652 |
++ memw |
653 |
+ l32i a2, a3, 0 |
654 |
+ dhi a3, 0 |
655 |
+ bne a2, a0, 1b |
656 |
+diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c |
657 |
+index fc4ad21a5ed4..44805673a250 100644 |
658 |
+--- a/arch/xtensa/kernel/smp.c |
659 |
++++ b/arch/xtensa/kernel/smp.c |
660 |
+@@ -80,7 +80,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) |
661 |
+ { |
662 |
+ unsigned i; |
663 |
+ |
664 |
+- for (i = 0; i < max_cpus; ++i) |
665 |
++ for_each_possible_cpu(i) |
666 |
+ set_cpu_present(i, true); |
667 |
+ } |
668 |
+ |
669 |
+@@ -93,6 +93,11 @@ void __init smp_init_cpus(void) |
670 |
+ pr_info("%s: Core Count = %d\n", __func__, ncpus); |
671 |
+ pr_info("%s: Core Id = %d\n", __func__, core_id); |
672 |
+ |
673 |
++ if (ncpus > NR_CPUS) { |
674 |
++ ncpus = NR_CPUS; |
675 |
++ pr_info("%s: limiting core count by %d\n", __func__, ncpus); |
676 |
++ } |
677 |
++ |
678 |
+ for (i = 0; i < ncpus; ++i) |
679 |
+ set_cpu_possible(i, true); |
680 |
+ } |
681 |
+@@ -192,9 +197,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) |
682 |
+ int i; |
683 |
+ |
684 |
+ #ifdef CONFIG_HOTPLUG_CPU |
685 |
+- cpu_start_id = cpu; |
686 |
+- system_flush_invalidate_dcache_range( |
687 |
+- (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); |
688 |
++ WRITE_ONCE(cpu_start_id, cpu); |
689 |
++ /* Pairs with the third memw in the cpu_restart */ |
690 |
++ mb(); |
691 |
++ system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id, |
692 |
++ sizeof(cpu_start_id)); |
693 |
+ #endif |
694 |
+ smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); |
695 |
+ |
696 |
+@@ -203,18 +210,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) |
697 |
+ ccount = get_ccount(); |
698 |
+ while (!ccount); |
699 |
+ |
700 |
+- cpu_start_ccount = ccount; |
701 |
++ WRITE_ONCE(cpu_start_ccount, ccount); |
702 |
+ |
703 |
+- while (time_before(jiffies, timeout)) { |
704 |
++ do { |
705 |
++ /* |
706 |
++ * Pairs with the first two memws in the |
707 |
++ * .Lboot_secondary. |
708 |
++ */ |
709 |
+ mb(); |
710 |
+- if (!cpu_start_ccount) |
711 |
+- break; |
712 |
+- } |
713 |
++ ccount = READ_ONCE(cpu_start_ccount); |
714 |
++ } while (ccount && time_before(jiffies, timeout)); |
715 |
+ |
716 |
+- if (cpu_start_ccount) { |
717 |
++ if (ccount) { |
718 |
+ smp_call_function_single(0, mx_cpu_stop, |
719 |
+- (void *)cpu, 1); |
720 |
+- cpu_start_ccount = 0; |
721 |
++ (void *)cpu, 1); |
722 |
++ WRITE_ONCE(cpu_start_ccount, 0); |
723 |
+ return -EIO; |
724 |
+ } |
725 |
+ } |
726 |
+@@ -234,6 +244,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) |
727 |
+ pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", |
728 |
+ __func__, cpu, idle, start_info.stack); |
729 |
+ |
730 |
++ init_completion(&cpu_running); |
731 |
+ ret = boot_secondary(cpu, idle); |
732 |
+ if (ret == 0) { |
733 |
+ wait_for_completion_timeout(&cpu_running, |
734 |
+@@ -295,8 +306,10 @@ void __cpu_die(unsigned int cpu) |
735 |
+ unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
736 |
+ while (time_before(jiffies, timeout)) { |
737 |
+ system_invalidate_dcache_range((unsigned long)&cpu_start_id, |
738 |
+- sizeof(cpu_start_id)); |
739 |
+- if (cpu_start_id == -cpu) { |
740 |
++ sizeof(cpu_start_id)); |
741 |
++ /* Pairs with the second memw in the cpu_restart */ |
742 |
++ mb(); |
743 |
++ if (READ_ONCE(cpu_start_id) == -cpu) { |
744 |
+ platform_cpu_kill(cpu); |
745 |
+ return; |
746 |
+ } |
747 |
+diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c |
748 |
+index be81e69b25bc..2251a6e0973a 100644 |
749 |
+--- a/arch/xtensa/kernel/time.c |
750 |
++++ b/arch/xtensa/kernel/time.c |
751 |
+@@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) |
752 |
+ container_of(evt, struct ccount_timer, evt); |
753 |
+ |
754 |
+ if (timer->irq_enabled) { |
755 |
+- disable_irq(evt->irq); |
756 |
++ disable_irq_nosync(evt->irq); |
757 |
+ timer->irq_enabled = 0; |
758 |
+ } |
759 |
+ return 0; |
760 |
+diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c |
761 |
+index 14790304b84b..9fcd51095d13 100644 |
762 |
+--- a/drivers/char/applicom.c |
763 |
++++ b/drivers/char/applicom.c |
764 |
+@@ -32,6 +32,7 @@ |
765 |
+ #include <linux/wait.h> |
766 |
+ #include <linux/init.h> |
767 |
+ #include <linux/fs.h> |
768 |
++#include <linux/nospec.h> |
769 |
+ |
770 |
+ #include <asm/io.h> |
771 |
+ #include <asm/uaccess.h> |
772 |
+@@ -386,7 +387,11 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, |
773 |
+ TicCard = st_loc.tic_des_from_pc; /* tic number to send */ |
774 |
+ IndexCard = NumCard - 1; |
775 |
+ |
776 |
+- if((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO) |
777 |
++ if (IndexCard >= MAX_BOARD) |
778 |
++ return -EINVAL; |
779 |
++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD); |
780 |
++ |
781 |
++ if (!apbs[IndexCard].RamIO) |
782 |
+ return -EINVAL; |
783 |
+ |
784 |
+ #ifdef DEBUG |
785 |
+@@ -697,6 +702,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
786 |
+ unsigned char IndexCard; |
787 |
+ void __iomem *pmem; |
788 |
+ int ret = 0; |
789 |
++ static int warncount = 10; |
790 |
+ volatile unsigned char byte_reset_it; |
791 |
+ struct st_ram_io *adgl; |
792 |
+ void __user *argp = (void __user *)arg; |
793 |
+@@ -711,16 +717,12 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
794 |
+ mutex_lock(&ac_mutex); |
795 |
+ IndexCard = adgl->num_card-1; |
796 |
+ |
797 |
+- if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { |
798 |
+- static int warncount = 10; |
799 |
+- if (warncount) { |
800 |
+- printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1); |
801 |
+- warncount--; |
802 |
+- } |
803 |
+- kfree(adgl); |
804 |
+- mutex_unlock(&ac_mutex); |
805 |
+- return -EINVAL; |
806 |
+- } |
807 |
++ if (cmd != 6 && IndexCard >= MAX_BOARD) |
808 |
++ goto err; |
809 |
++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD); |
810 |
++ |
811 |
++ if (cmd != 6 && !apbs[IndexCard].RamIO) |
812 |
++ goto err; |
813 |
+ |
814 |
+ switch (cmd) { |
815 |
+ |
816 |
+@@ -838,5 +840,16 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
817 |
+ kfree(adgl); |
818 |
+ mutex_unlock(&ac_mutex); |
819 |
+ return 0; |
820 |
++ |
821 |
++err: |
822 |
++ if (warncount) { |
823 |
++ pr_warn("APPLICOM driver IOCTL, bad board number %d\n", |
824 |
++ (int)IndexCard + 1); |
825 |
++ warncount--; |
826 |
++ } |
827 |
++ kfree(adgl); |
828 |
++ mutex_unlock(&ac_mutex); |
829 |
++ return -EINVAL; |
830 |
++ |
831 |
+ } |
832 |
+ |
833 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
834 |
+index 61fe4bbc6dc0..a38a23f0b3f4 100644 |
835 |
+--- a/drivers/cpufreq/cpufreq.c |
836 |
++++ b/drivers/cpufreq/cpufreq.c |
837 |
+@@ -528,13 +528,13 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq); |
838 |
+ * SYSFS INTERFACE * |
839 |
+ *********************************************************************/ |
840 |
+ static ssize_t show_boost(struct kobject *kobj, |
841 |
+- struct attribute *attr, char *buf) |
842 |
++ struct kobj_attribute *attr, char *buf) |
843 |
+ { |
844 |
+ return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); |
845 |
+ } |
846 |
+ |
847 |
+-static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, |
848 |
+- const char *buf, size_t count) |
849 |
++static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr, |
850 |
++ const char *buf, size_t count) |
851 |
+ { |
852 |
+ int ret, enable; |
853 |
+ |
854 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
855 |
+index a59ae8e24d3d..f690085b1ad9 100644 |
856 |
+--- a/drivers/cpufreq/intel_pstate.c |
857 |
++++ b/drivers/cpufreq/intel_pstate.c |
858 |
+@@ -659,13 +659,13 @@ static void __init intel_pstate_debug_expose_params(void) |
859 |
+ /************************** sysfs begin ************************/ |
860 |
+ #define show_one(file_name, object) \ |
861 |
+ static ssize_t show_##file_name \ |
862 |
+- (struct kobject *kobj, struct attribute *attr, char *buf) \ |
863 |
++ (struct kobject *kobj, struct kobj_attribute *attr, char *buf) \ |
864 |
+ { \ |
865 |
+ return sprintf(buf, "%u\n", limits->object); \ |
866 |
+ } |
867 |
+ |
868 |
+ static ssize_t show_turbo_pct(struct kobject *kobj, |
869 |
+- struct attribute *attr, char *buf) |
870 |
++ struct kobj_attribute *attr, char *buf) |
871 |
+ { |
872 |
+ struct cpudata *cpu; |
873 |
+ int total, no_turbo, turbo_pct; |
874 |
+@@ -681,7 +681,7 @@ static ssize_t show_turbo_pct(struct kobject *kobj, |
875 |
+ } |
876 |
+ |
877 |
+ static ssize_t show_num_pstates(struct kobject *kobj, |
878 |
+- struct attribute *attr, char *buf) |
879 |
++ struct kobj_attribute *attr, char *buf) |
880 |
+ { |
881 |
+ struct cpudata *cpu; |
882 |
+ int total; |
883 |
+@@ -692,7 +692,7 @@ static ssize_t show_num_pstates(struct kobject *kobj, |
884 |
+ } |
885 |
+ |
886 |
+ static ssize_t show_no_turbo(struct kobject *kobj, |
887 |
+- struct attribute *attr, char *buf) |
888 |
++ struct kobj_attribute *attr, char *buf) |
889 |
+ { |
890 |
+ ssize_t ret; |
891 |
+ |
892 |
+@@ -705,7 +705,7 @@ static ssize_t show_no_turbo(struct kobject *kobj, |
893 |
+ return ret; |
894 |
+ } |
895 |
+ |
896 |
+-static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, |
897 |
++static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, |
898 |
+ const char *buf, size_t count) |
899 |
+ { |
900 |
+ unsigned int input; |
901 |
+@@ -729,7 +729,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, |
902 |
+ return count; |
903 |
+ } |
904 |
+ |
905 |
+-static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, |
906 |
++static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b, |
907 |
+ const char *buf, size_t count) |
908 |
+ { |
909 |
+ unsigned int input; |
910 |
+@@ -753,7 +753,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, |
911 |
+ return count; |
912 |
+ } |
913 |
+ |
914 |
+-static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, |
915 |
++static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b, |
916 |
+ const char *buf, size_t count) |
917 |
+ { |
918 |
+ unsigned int input; |
919 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
920 |
+index ee7b48d5243c..b222dd7afe8e 100644 |
921 |
+--- a/drivers/dma/at_xdmac.c |
922 |
++++ b/drivers/dma/at_xdmac.c |
923 |
+@@ -203,6 +203,7 @@ struct at_xdmac_chan { |
924 |
+ u32 save_cim; |
925 |
+ u32 save_cnda; |
926 |
+ u32 save_cndc; |
927 |
++ u32 irq_status; |
928 |
+ unsigned long status; |
929 |
+ struct tasklet_struct tasklet; |
930 |
+ struct dma_slave_config sconfig; |
931 |
+@@ -1582,8 +1583,8 @@ static void at_xdmac_tasklet(unsigned long data) |
932 |
+ struct at_xdmac_desc *desc; |
933 |
+ u32 error_mask; |
934 |
+ |
935 |
+- dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", |
936 |
+- __func__, atchan->status); |
937 |
++ dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
938 |
++ __func__, atchan->irq_status); |
939 |
+ |
940 |
+ error_mask = AT_XDMAC_CIS_RBEIS |
941 |
+ | AT_XDMAC_CIS_WBEIS |
942 |
+@@ -1591,15 +1592,15 @@ static void at_xdmac_tasklet(unsigned long data) |
943 |
+ |
944 |
+ if (at_xdmac_chan_is_cyclic(atchan)) { |
945 |
+ at_xdmac_handle_cyclic(atchan); |
946 |
+- } else if ((atchan->status & AT_XDMAC_CIS_LIS) |
947 |
+- || (atchan->status & error_mask)) { |
948 |
++ } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
949 |
++ || (atchan->irq_status & error_mask)) { |
950 |
+ struct dma_async_tx_descriptor *txd; |
951 |
+ |
952 |
+- if (atchan->status & AT_XDMAC_CIS_RBEIS) |
953 |
++ if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
954 |
+ dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
955 |
+- if (atchan->status & AT_XDMAC_CIS_WBEIS) |
956 |
++ if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
957 |
+ dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
958 |
+- if (atchan->status & AT_XDMAC_CIS_ROIS) |
959 |
++ if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
960 |
+ dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
961 |
+ |
962 |
+ spin_lock_bh(&atchan->lock); |
963 |
+@@ -1654,7 +1655,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) |
964 |
+ atchan = &atxdmac->chan[i]; |
965 |
+ chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
966 |
+ chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
967 |
+- atchan->status = chan_status & chan_imr; |
968 |
++ atchan->irq_status = chan_status & chan_imr; |
969 |
+ dev_vdbg(atxdmac->dma.dev, |
970 |
+ "%s: chan%d: imr=0x%x, status=0x%x\n", |
971 |
+ __func__, i, chan_imr, chan_status); |
972 |
+@@ -1668,7 +1669,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) |
973 |
+ at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
974 |
+ at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
975 |
+ |
976 |
+- if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
977 |
++ if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
978 |
+ at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
979 |
+ |
980 |
+ tasklet_schedule(&atchan->tasklet); |
981 |
+diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c |
982 |
+index ebe72a466587..7dd46cf5ed84 100644 |
983 |
+--- a/drivers/dma/dmatest.c |
984 |
++++ b/drivers/dma/dmatest.c |
985 |
+@@ -583,11 +583,9 @@ static int dmatest_func(void *data) |
986 |
+ srcs[i] = um->addr[i] + src_off; |
987 |
+ ret = dma_mapping_error(dev->dev, um->addr[i]); |
988 |
+ if (ret) { |
989 |
+- dmaengine_unmap_put(um); |
990 |
+ result("src mapping error", total_tests, |
991 |
+ src_off, dst_off, len, ret); |
992 |
+- failed_tests++; |
993 |
+- continue; |
994 |
++ goto error_unmap_continue; |
995 |
+ } |
996 |
+ um->to_cnt++; |
997 |
+ } |
998 |
+@@ -602,11 +600,9 @@ static int dmatest_func(void *data) |
999 |
+ DMA_BIDIRECTIONAL); |
1000 |
+ ret = dma_mapping_error(dev->dev, dsts[i]); |
1001 |
+ if (ret) { |
1002 |
+- dmaengine_unmap_put(um); |
1003 |
+ result("dst mapping error", total_tests, |
1004 |
+ src_off, dst_off, len, ret); |
1005 |
+- failed_tests++; |
1006 |
+- continue; |
1007 |
++ goto error_unmap_continue; |
1008 |
+ } |
1009 |
+ um->bidi_cnt++; |
1010 |
+ } |
1011 |
+@@ -643,12 +639,10 @@ static int dmatest_func(void *data) |
1012 |
+ } |
1013 |
+ |
1014 |
+ if (!tx) { |
1015 |
+- dmaengine_unmap_put(um); |
1016 |
+ result("prep error", total_tests, src_off, |
1017 |
+ dst_off, len, ret); |
1018 |
+ msleep(100); |
1019 |
+- failed_tests++; |
1020 |
+- continue; |
1021 |
++ goto error_unmap_continue; |
1022 |
+ } |
1023 |
+ |
1024 |
+ done->done = false; |
1025 |
+@@ -657,12 +651,10 @@ static int dmatest_func(void *data) |
1026 |
+ cookie = tx->tx_submit(tx); |
1027 |
+ |
1028 |
+ if (dma_submit_error(cookie)) { |
1029 |
+- dmaengine_unmap_put(um); |
1030 |
+ result("submit error", total_tests, src_off, |
1031 |
+ dst_off, len, ret); |
1032 |
+ msleep(100); |
1033 |
+- failed_tests++; |
1034 |
+- continue; |
1035 |
++ goto error_unmap_continue; |
1036 |
+ } |
1037 |
+ dma_async_issue_pending(chan); |
1038 |
+ |
1039 |
+@@ -675,16 +667,14 @@ static int dmatest_func(void *data) |
1040 |
+ dmaengine_unmap_put(um); |
1041 |
+ result("test timed out", total_tests, src_off, dst_off, |
1042 |
+ len, 0); |
1043 |
+- failed_tests++; |
1044 |
+- continue; |
1045 |
++ goto error_unmap_continue; |
1046 |
+ } else if (status != DMA_COMPLETE) { |
1047 |
+ dmaengine_unmap_put(um); |
1048 |
+ result(status == DMA_ERROR ? |
1049 |
+ "completion error status" : |
1050 |
+ "completion busy status", total_tests, src_off, |
1051 |
+ dst_off, len, ret); |
1052 |
+- failed_tests++; |
1053 |
+- continue; |
1054 |
++ goto error_unmap_continue; |
1055 |
+ } |
1056 |
+ |
1057 |
+ dmaengine_unmap_put(um); |
1058 |
+@@ -727,6 +717,12 @@ static int dmatest_func(void *data) |
1059 |
+ verbose_result("test passed", total_tests, src_off, |
1060 |
+ dst_off, len, 0); |
1061 |
+ } |
1062 |
++ |
1063 |
++ continue; |
1064 |
++ |
1065 |
++error_unmap_continue: |
1066 |
++ dmaengine_unmap_put(um); |
1067 |
++ failed_tests++; |
1068 |
+ } |
1069 |
+ ktime = ktime_sub(ktime_get(), ktime); |
1070 |
+ ktime = ktime_sub(ktime, comparetime); |
1071 |
+diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c |
1072 |
+index 14042a64bdd5..132b9bae4b6a 100644 |
1073 |
+--- a/drivers/firmware/iscsi_ibft.c |
1074 |
++++ b/drivers/firmware/iscsi_ibft.c |
1075 |
+@@ -542,6 +542,7 @@ static umode_t __init ibft_check_tgt_for(void *data, int type) |
1076 |
+ case ISCSI_BOOT_TGT_NIC_ASSOC: |
1077 |
+ case ISCSI_BOOT_TGT_CHAP_TYPE: |
1078 |
+ rc = S_IRUGO; |
1079 |
++ break; |
1080 |
+ case ISCSI_BOOT_TGT_NAME: |
1081 |
+ if (tgt->tgt_name_len) |
1082 |
+ rc = S_IRUGO; |
1083 |
+diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c |
1084 |
+index 3edb09cb9ee0..1f599bc08237 100644 |
1085 |
+--- a/drivers/gpio/gpio-vf610.c |
1086 |
++++ b/drivers/gpio/gpio-vf610.c |
1087 |
+@@ -221,6 +221,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) |
1088 |
+ struct vf610_gpio_port *port; |
1089 |
+ struct resource *iores; |
1090 |
+ struct gpio_chip *gc; |
1091 |
++ int i; |
1092 |
+ int ret; |
1093 |
+ |
1094 |
+ port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
1095 |
+@@ -259,6 +260,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) |
1096 |
+ if (ret < 0) |
1097 |
+ return ret; |
1098 |
+ |
1099 |
++ /* Mask all GPIO interrupts */ |
1100 |
++ for (i = 0; i < gc->ngpio; i++) |
1101 |
++ vf610_gpio_writel(0, port->base + PORT_PCR(i)); |
1102 |
++ |
1103 |
+ /* Clear the interrupt status register for all GPIO's */ |
1104 |
+ vf610_gpio_writel(~0, port->base + PORT_ISFR); |
1105 |
+ |
1106 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1107 |
+index f2975a1525be..2796fea70a42 100644 |
1108 |
+--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1109 |
++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1110 |
+@@ -327,6 +327,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, |
1111 |
+ dev_err(dev, "Couldn't get the TCON channel 0 clock\n"); |
1112 |
+ return PTR_ERR(tcon->sclk0); |
1113 |
+ } |
1114 |
++ clk_prepare_enable(tcon->sclk0); |
1115 |
+ |
1116 |
+ if (tcon->quirks->has_channel_1) { |
1117 |
+ tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); |
1118 |
+@@ -341,6 +342,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, |
1119 |
+ |
1120 |
+ static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) |
1121 |
+ { |
1122 |
++ clk_disable_unprepare(tcon->sclk0); |
1123 |
+ clk_disable_unprepare(tcon->clk); |
1124 |
+ } |
1125 |
+ |
1126 |
+diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c |
1127 |
+index 1a7ce1d740ce..292d7b6a0536 100644 |
1128 |
+--- a/drivers/infiniband/hw/hfi1/ud.c |
1129 |
++++ b/drivers/infiniband/hw/hfi1/ud.c |
1130 |
+@@ -772,7 +772,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) |
1131 |
+ opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
1132 |
+ wc.ex.imm_data = ohdr->u.ud.imm_data; |
1133 |
+ wc.wc_flags = IB_WC_WITH_IMM; |
1134 |
+- tlen -= sizeof(u32); |
1135 |
+ } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
1136 |
+ wc.ex.imm_data = 0; |
1137 |
+ wc.wc_flags = 0; |
1138 |
+diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c |
1139 |
+index f45cad1198b0..93012fba287d 100644 |
1140 |
+--- a/drivers/infiniband/hw/qib/qib_ud.c |
1141 |
++++ b/drivers/infiniband/hw/qib/qib_ud.c |
1142 |
+@@ -525,7 +525,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, |
1143 |
+ opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
1144 |
+ wc.ex.imm_data = ohdr->u.ud.imm_data; |
1145 |
+ wc.wc_flags = IB_WC_WITH_IMM; |
1146 |
+- tlen -= sizeof(u32); |
1147 |
+ } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
1148 |
+ wc.ex.imm_data = 0; |
1149 |
+ wc.wc_flags = 0; |
1150 |
+diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
1151 |
+index 25ce9047b682..16f5d5660053 100644 |
1152 |
+--- a/drivers/input/mouse/elan_i2c_core.c |
1153 |
++++ b/drivers/input/mouse/elan_i2c_core.c |
1154 |
+@@ -1241,6 +1241,7 @@ static const struct acpi_device_id elan_acpi_id[] = { |
1155 |
+ { "ELAN0000", 0 }, |
1156 |
+ { "ELAN0100", 0 }, |
1157 |
+ { "ELAN0600", 0 }, |
1158 |
++ { "ELAN0601", 0 }, |
1159 |
+ { "ELAN0602", 0 }, |
1160 |
+ { "ELAN0605", 0 }, |
1161 |
+ { "ELAN0608", 0 }, |
1162 |
+diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c |
1163 |
+index 20ab802461e7..1d46b763aae6 100644 |
1164 |
+--- a/drivers/input/tablet/wacom_serial4.c |
1165 |
++++ b/drivers/input/tablet/wacom_serial4.c |
1166 |
+@@ -187,6 +187,7 @@ enum { |
1167 |
+ MODEL_DIGITIZER_II = 0x5544, /* UD */ |
1168 |
+ MODEL_GRAPHIRE = 0x4554, /* ET */ |
1169 |
+ MODEL_PENPARTNER = 0x4354, /* CT */ |
1170 |
++ MODEL_ARTPAD_II = 0x4B54, /* KT */ |
1171 |
+ }; |
1172 |
+ |
1173 |
+ static void wacom_handle_model_response(struct wacom *wacom) |
1174 |
+@@ -245,6 +246,7 @@ static void wacom_handle_model_response(struct wacom *wacom) |
1175 |
+ wacom->flags = F_HAS_STYLUS2 | F_HAS_SCROLLWHEEL; |
1176 |
+ break; |
1177 |
+ |
1178 |
++ case MODEL_ARTPAD_II: |
1179 |
+ case MODEL_DIGITIZER_II: |
1180 |
+ wacom->dev->name = "Wacom Digitizer II"; |
1181 |
+ wacom->dev->id.version = MODEL_DIGITIZER_II; |
1182 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
1183 |
+index e984418ffa2a..ca22483d253f 100644 |
1184 |
+--- a/drivers/iommu/amd_iommu.c |
1185 |
++++ b/drivers/iommu/amd_iommu.c |
1186 |
+@@ -1896,6 +1896,7 @@ static void do_attach(struct iommu_dev_data *dev_data, |
1187 |
+ |
1188 |
+ static void do_detach(struct iommu_dev_data *dev_data) |
1189 |
+ { |
1190 |
++ struct protection_domain *domain = dev_data->domain; |
1191 |
+ struct amd_iommu *iommu; |
1192 |
+ u16 alias; |
1193 |
+ |
1194 |
+@@ -1911,10 +1912,6 @@ static void do_detach(struct iommu_dev_data *dev_data) |
1195 |
+ iommu = amd_iommu_rlookup_table[dev_data->devid]; |
1196 |
+ alias = dev_data->alias; |
1197 |
+ |
1198 |
+- /* decrease reference counters */ |
1199 |
+- dev_data->domain->dev_iommu[iommu->index] -= 1; |
1200 |
+- dev_data->domain->dev_cnt -= 1; |
1201 |
+- |
1202 |
+ /* Update data structures */ |
1203 |
+ dev_data->domain = NULL; |
1204 |
+ list_del(&dev_data->list); |
1205 |
+@@ -1924,6 +1921,16 @@ static void do_detach(struct iommu_dev_data *dev_data) |
1206 |
+ |
1207 |
+ /* Flush the DTE entry */ |
1208 |
+ device_flush_dte(dev_data); |
1209 |
++ |
1210 |
++ /* Flush IOTLB */ |
1211 |
++ domain_flush_tlb_pde(domain); |
1212 |
++ |
1213 |
++ /* Wait for the flushes to finish */ |
1214 |
++ domain_flush_complete(domain); |
1215 |
++ |
1216 |
++ /* decrease reference counters - needs to happen after the flushes */ |
1217 |
++ domain->dev_iommu[iommu->index] -= 1; |
1218 |
++ domain->dev_cnt -= 1; |
1219 |
+ } |
1220 |
+ |
1221 |
+ /* |
1222 |
+@@ -2611,13 +2618,13 @@ out_unmap: |
1223 |
+ bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
1224 |
+ iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
1225 |
+ |
1226 |
+- if (--mapped_pages) |
1227 |
++ if (--mapped_pages == 0) |
1228 |
+ goto out_free_iova; |
1229 |
+ } |
1230 |
+ } |
1231 |
+ |
1232 |
+ out_free_iova: |
1233 |
+- free_iova_fast(&dma_dom->iovad, address, npages); |
1234 |
++ free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); |
1235 |
+ |
1236 |
+ out_err: |
1237 |
+ return 0; |
1238 |
+diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c |
1239 |
+index 013fc9659a84..2fe2bcb63a71 100644 |
1240 |
+--- a/drivers/irqchip/irq-mmp.c |
1241 |
++++ b/drivers/irqchip/irq-mmp.c |
1242 |
+@@ -34,6 +34,9 @@ |
1243 |
+ #define SEL_INT_PENDING (1 << 6) |
1244 |
+ #define SEL_INT_NUM_MASK 0x3f |
1245 |
+ |
1246 |
++#define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) |
1247 |
++#define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) |
1248 |
++ |
1249 |
+ struct icu_chip_data { |
1250 |
+ int nr_irqs; |
1251 |
+ unsigned int virq_base; |
1252 |
+@@ -190,7 +193,8 @@ static struct mmp_intc_conf mmp_conf = { |
1253 |
+ static struct mmp_intc_conf mmp2_conf = { |
1254 |
+ .conf_enable = 0x20, |
1255 |
+ .conf_disable = 0x0, |
1256 |
+- .conf_mask = 0x7f, |
1257 |
++ .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
1258 |
++ MMP2_ICU_INT_ROUTE_PJ4_FIQ, |
1259 |
+ }; |
1260 |
+ |
1261 |
+ static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
1262 |
+diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c |
1263 |
+index d4e0d1602c80..6b7eed722e43 100644 |
1264 |
+--- a/drivers/isdn/i4l/isdn_tty.c |
1265 |
++++ b/drivers/isdn/i4l/isdn_tty.c |
1266 |
+@@ -786,7 +786,7 @@ isdn_tty_suspend(char *id, modem_info *info, atemu *m) |
1267 |
+ cmd.parm.cmsg.para[3] = 4; /* 16 bit 0x0004 Suspend */ |
1268 |
+ cmd.parm.cmsg.para[4] = 0; |
1269 |
+ cmd.parm.cmsg.para[5] = l; |
1270 |
+- strncpy(&cmd.parm.cmsg.para[6], id, l); |
1271 |
++ strscpy(&cmd.parm.cmsg.para[6], id, l); |
1272 |
+ cmd.command = CAPI_PUT_MESSAGE; |
1273 |
+ cmd.driver = info->isdn_driver; |
1274 |
+ cmd.arg = info->isdn_channel; |
1275 |
+diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c |
1276 |
+index cde43b63c3da..c630a9f8e356 100644 |
1277 |
+--- a/drivers/media/usb/uvc/uvc_driver.c |
1278 |
++++ b/drivers/media/usb/uvc/uvc_driver.c |
1279 |
+@@ -1019,11 +1019,19 @@ static int uvc_parse_standard_control(struct uvc_device *dev, |
1280 |
+ return -EINVAL; |
1281 |
+ } |
1282 |
+ |
1283 |
+- /* Make sure the terminal type MSB is not null, otherwise it |
1284 |
+- * could be confused with a unit. |
1285 |
++ /* |
1286 |
++ * Reject invalid terminal types that would cause issues: |
1287 |
++ * |
1288 |
++ * - The high byte must be non-zero, otherwise it would be |
1289 |
++ * confused with a unit. |
1290 |
++ * |
1291 |
++ * - Bit 15 must be 0, as we use it internally as a terminal |
1292 |
++ * direction flag. |
1293 |
++ * |
1294 |
++ * Other unknown types are accepted. |
1295 |
+ */ |
1296 |
+ type = get_unaligned_le16(&buffer[4]); |
1297 |
+- if ((type & 0xff00) == 0) { |
1298 |
++ if ((type & 0x7f00) == 0 || (type & 0x8000) != 0) { |
1299 |
+ uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " |
1300 |
+ "interface %d INPUT_TERMINAL %d has invalid " |
1301 |
+ "type 0x%04x, skipping\n", udev->devnum, |
1302 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
1303 |
+index 883fd9809dd2..7cee3e5db56c 100644 |
1304 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
1305 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
1306 |
+@@ -798,7 +798,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
1307 |
+ if (s->sizeof_stat == 8) |
1308 |
+ _mv88e6xxx_stats_read(chip, s->reg + 1, &high); |
1309 |
+ } |
1310 |
+- value = (((u64)high) << 16) | low; |
1311 |
++ value = (((u64)high) << 32) | low; |
1312 |
+ return value; |
1313 |
+ } |
1314 |
+ |
1315 |
+diff --git a/drivers/net/ethernet/altera/altera_msgdma.c b/drivers/net/ethernet/altera/altera_msgdma.c |
1316 |
+index 0fb986ba3290..0ae723f75341 100644 |
1317 |
+--- a/drivers/net/ethernet/altera/altera_msgdma.c |
1318 |
++++ b/drivers/net/ethernet/altera/altera_msgdma.c |
1319 |
+@@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) |
1320 |
+ & 0xffff; |
1321 |
+ |
1322 |
+ if (inuse) { /* Tx FIFO is not empty */ |
1323 |
+- ready = priv->tx_prod - priv->tx_cons - inuse - 1; |
1324 |
++ ready = max_t(int, |
1325 |
++ priv->tx_prod - priv->tx_cons - inuse - 1, 0); |
1326 |
+ } else { |
1327 |
+ /* Check for buffered last packet */ |
1328 |
+ status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
1329 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1330 |
+index a036f7039d76..737f0f6f4075 100644 |
1331 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1332 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1333 |
+@@ -428,6 +428,12 @@ normal_tx: |
1334 |
+ } |
1335 |
+ |
1336 |
+ length >>= 9; |
1337 |
++ if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) { |
1338 |
++ dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n", |
1339 |
++ skb->len); |
1340 |
++ i = 0; |
1341 |
++ goto tx_dma_error; |
1342 |
++ } |
1343 |
+ flags |= bnxt_lhint_arr[length]; |
1344 |
+ txbd->tx_bd_len_flags_type = cpu_to_le32(flags); |
1345 |
+ |
1346 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1347 |
+index a2f7d0834071..ad8681cf5ef0 100644 |
1348 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1349 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1350 |
+@@ -2078,6 +2078,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) |
1351 |
+ out_notify_fail: |
1352 |
+ (void)cancel_work_sync(&priv->service_task); |
1353 |
+ out_read_prop_fail: |
1354 |
++ /* safe for ACPI FW */ |
1355 |
++ of_node_put(to_of_node(priv->fwnode)); |
1356 |
+ free_netdev(ndev); |
1357 |
+ return ret; |
1358 |
+ } |
1359 |
+@@ -2107,6 +2109,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) |
1360 |
+ set_bit(NIC_STATE_REMOVING, &priv->state); |
1361 |
+ (void)cancel_work_sync(&priv->service_task); |
1362 |
+ |
1363 |
++ /* safe for ACPI FW */ |
1364 |
++ of_node_put(to_of_node(priv->fwnode)); |
1365 |
++ |
1366 |
+ free_netdev(ndev); |
1367 |
+ return 0; |
1368 |
+ } |
1369 |
+diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c |
1370 |
+index 501eb2090ca6..de23a0ead5d7 100644 |
1371 |
+--- a/drivers/net/ethernet/hisilicon/hns_mdio.c |
1372 |
++++ b/drivers/net/ethernet/hisilicon/hns_mdio.c |
1373 |
+@@ -329,7 +329,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) |
1374 |
+ } |
1375 |
+ |
1376 |
+ hns_mdio_cmd_write(mdio_dev, is_c45, |
1377 |
+- MDIO_C45_WRITE_ADDR, phy_id, devad); |
1378 |
++ MDIO_C45_READ, phy_id, devad); |
1379 |
+ } |
1380 |
+ |
1381 |
+ /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
1382 |
+diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c |
1383 |
+index af11781fe5f9..4ac023a37936 100644 |
1384 |
+--- a/drivers/net/ethernet/marvell/sky2.c |
1385 |
++++ b/drivers/net/ethernet/marvell/sky2.c |
1386 |
+@@ -46,6 +46,7 @@ |
1387 |
+ #include <linux/mii.h> |
1388 |
+ #include <linux/of_device.h> |
1389 |
+ #include <linux/of_net.h> |
1390 |
++#include <linux/dmi.h> |
1391 |
+ |
1392 |
+ #include <asm/irq.h> |
1393 |
+ |
1394 |
+@@ -93,7 +94,7 @@ static int copybreak __read_mostly = 128; |
1395 |
+ module_param(copybreak, int, 0); |
1396 |
+ MODULE_PARM_DESC(copybreak, "Receive copy threshold"); |
1397 |
+ |
1398 |
+-static int disable_msi = 0; |
1399 |
++static int disable_msi = -1; |
1400 |
+ module_param(disable_msi, int, 0); |
1401 |
+ MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); |
1402 |
+ |
1403 |
+@@ -4923,6 +4924,24 @@ static const char *sky2_name(u8 chipid, char *buf, int sz) |
1404 |
+ return buf; |
1405 |
+ } |
1406 |
+ |
1407 |
++static const struct dmi_system_id msi_blacklist[] = { |
1408 |
++ { |
1409 |
++ .ident = "Dell Inspiron 1545", |
1410 |
++ .matches = { |
1411 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
1412 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1545"), |
1413 |
++ }, |
1414 |
++ }, |
1415 |
++ { |
1416 |
++ .ident = "Gateway P-79", |
1417 |
++ .matches = { |
1418 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Gateway"), |
1419 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "P-79"), |
1420 |
++ }, |
1421 |
++ }, |
1422 |
++ {} |
1423 |
++}; |
1424 |
++ |
1425 |
+ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1426 |
+ { |
1427 |
+ struct net_device *dev, *dev1; |
1428 |
+@@ -5034,6 +5053,9 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1429 |
+ goto err_out_free_pci; |
1430 |
+ } |
1431 |
+ |
1432 |
++ if (disable_msi == -1) |
1433 |
++ disable_msi = !!dmi_check_system(msi_blacklist); |
1434 |
++ |
1435 |
+ if (!disable_msi && pci_enable_msi(pdev) == 0) { |
1436 |
+ err = sky2_test_msi(hw); |
1437 |
+ if (err) { |
1438 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1439 |
+index 9cc02b94328a..cf34908ec8e1 100644 |
1440 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1441 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
1442 |
+@@ -158,6 +158,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) |
1443 |
+ struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
1444 |
+ struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
1445 |
+ struct vf_pf_resc_request *p_resc; |
1446 |
++ u8 retry_cnt = VF_ACQUIRE_THRESH; |
1447 |
+ bool resources_acquired = false; |
1448 |
+ struct vfpf_acquire_tlv *req; |
1449 |
+ int rc = 0, attempts = 0; |
1450 |
+@@ -203,6 +204,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) |
1451 |
+ |
1452 |
+ /* send acquire request */ |
1453 |
+ rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
1454 |
++ |
1455 |
++ /* Re-try acquire in case of vf-pf hw channel timeout */ |
1456 |
++ if (retry_cnt && rc == -EBUSY) { |
1457 |
++ DP_VERBOSE(p_hwfn, QED_MSG_IOV, |
1458 |
++ "VF retrying to acquire due to VPC timeout\n"); |
1459 |
++ retry_cnt--; |
1460 |
++ continue; |
1461 |
++ } |
1462 |
++ |
1463 |
+ if (rc) |
1464 |
+ goto exit; |
1465 |
+ |
1466 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1467 |
+index d80c88bd2bba..6e61bccc90b3 100644 |
1468 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1469 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
1470 |
+@@ -877,8 +877,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) |
1471 |
+ } |
1472 |
+ |
1473 |
+ ret = phy_power_on(bsp_priv, true); |
1474 |
+- if (ret) |
1475 |
++ if (ret) { |
1476 |
++ gmac_clk_enable(bsp_priv, false); |
1477 |
+ return ret; |
1478 |
++ } |
1479 |
+ |
1480 |
+ ret = gmac_clk_enable(bsp_priv, true); |
1481 |
+ if (ret) |
1482 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
1483 |
+index 53602fdf5b47..06f77ec44a15 100644 |
1484 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
1485 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
1486 |
+@@ -593,6 +593,14 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, |
1487 |
+ schedule_delayed_work(&ndev_ctx->dwork, 0); |
1488 |
+ } |
1489 |
+ |
1490 |
++static void netvsc_comp_ipcsum(struct sk_buff *skb) |
1491 |
++{ |
1492 |
++ struct iphdr *iph = (struct iphdr *)skb->data; |
1493 |
++ |
1494 |
++ iph->check = 0; |
1495 |
++ iph->check = ip_fast_csum(iph, iph->ihl); |
1496 |
++} |
1497 |
++ |
1498 |
+ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, |
1499 |
+ struct hv_netvsc_packet *packet, |
1500 |
+ struct ndis_tcp_ip_checksum_info *csum_info, |
1501 |
+@@ -616,9 +624,17 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, |
1502 |
+ /* skb is already created with CHECKSUM_NONE */ |
1503 |
+ skb_checksum_none_assert(skb); |
1504 |
+ |
1505 |
+- /* |
1506 |
+- * In Linux, the IP checksum is always checked. |
1507 |
+- * Do L4 checksum offload if enabled and present. |
1508 |
++ /* Incoming packets may have IP header checksum verified by the host. |
1509 |
++ * They may not have IP header checksum computed after coalescing. |
1510 |
++ * We compute it here if the flags are set, because on Linux, the IP |
1511 |
++ * checksum is always checked. |
1512 |
++ */ |
1513 |
++ if (csum_info && csum_info->receive.ip_checksum_value_invalid && |
1514 |
++ csum_info->receive.ip_checksum_succeeded && |
1515 |
++ skb->protocol == htons(ETH_P_IP)) |
1516 |
++ netvsc_comp_ipcsum(skb); |
1517 |
++ |
1518 |
++ /* Do L4 checksum offload if enabled and present. |
1519 |
+ */ |
1520 |
+ if (csum_info && (net->features & NETIF_F_RXCSUM)) { |
1521 |
+ if (csum_info->receive.tcp_checksum_succeeded || |
1522 |
+diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c |
1523 |
+index 707190d3ada0..16f074408813 100644 |
1524 |
+--- a/drivers/net/phy/micrel.c |
1525 |
++++ b/drivers/net/phy/micrel.c |
1526 |
+@@ -341,6 +341,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev) |
1527 |
+ return genphy_config_aneg(phydev); |
1528 |
+ } |
1529 |
+ |
1530 |
++static int ksz8061_config_init(struct phy_device *phydev) |
1531 |
++{ |
1532 |
++ int ret; |
1533 |
++ |
1534 |
++ ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); |
1535 |
++ if (ret) |
1536 |
++ return ret; |
1537 |
++ |
1538 |
++ return kszphy_config_init(phydev); |
1539 |
++} |
1540 |
++ |
1541 |
+ static int ksz9021_load_values_from_of(struct phy_device *phydev, |
1542 |
+ const struct device_node *of_node, |
1543 |
+ u16 reg, |
1544 |
+@@ -940,7 +951,7 @@ static struct phy_driver ksphy_driver[] = { |
1545 |
+ .phy_id_mask = MICREL_PHY_ID_MASK, |
1546 |
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
1547 |
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
1548 |
+- .config_init = kszphy_config_init, |
1549 |
++ .config_init = ksz8061_config_init, |
1550 |
+ .config_aneg = genphy_config_aneg, |
1551 |
+ .read_status = genphy_read_status, |
1552 |
+ .ack_interrupt = kszphy_ack_interrupt, |
1553 |
+diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c |
1554 |
+index b228bea7931f..de2530830d93 100644 |
1555 |
+--- a/drivers/net/team/team_mode_loadbalance.c |
1556 |
++++ b/drivers/net/team/team_mode_loadbalance.c |
1557 |
+@@ -319,6 +319,20 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx) |
1558 |
+ return 0; |
1559 |
+ } |
1560 |
+ |
1561 |
++static void lb_bpf_func_free(struct team *team) |
1562 |
++{ |
1563 |
++ struct lb_priv *lb_priv = get_lb_priv(team); |
1564 |
++ struct bpf_prog *fp; |
1565 |
++ |
1566 |
++ if (!lb_priv->ex->orig_fprog) |
1567 |
++ return; |
1568 |
++ |
1569 |
++ __fprog_destroy(lb_priv->ex->orig_fprog); |
1570 |
++ fp = rcu_dereference_protected(lb_priv->fp, |
1571 |
++ lockdep_is_held(&team->lock)); |
1572 |
++ bpf_prog_destroy(fp); |
1573 |
++} |
1574 |
++ |
1575 |
+ static int lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx) |
1576 |
+ { |
1577 |
+ struct lb_priv *lb_priv = get_lb_priv(team); |
1578 |
+@@ -633,6 +647,7 @@ static void lb_exit(struct team *team) |
1579 |
+ |
1580 |
+ team_options_unregister(team, lb_options, |
1581 |
+ ARRAY_SIZE(lb_options)); |
1582 |
++ lb_bpf_func_free(team); |
1583 |
+ cancel_delayed_work_sync(&lb_priv->ex->stats.refresh_dw); |
1584 |
+ free_percpu(lb_priv->pcpu_stats); |
1585 |
+ kfree(lb_priv->ex); |
1586 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
1587 |
+index 7a0d5e928bec..24cc94453d38 100644 |
1588 |
+--- a/drivers/net/tun.c |
1589 |
++++ b/drivers/net/tun.c |
1590 |
+@@ -1471,9 +1471,9 @@ static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, |
1591 |
+ } |
1592 |
+ |
1593 |
+ add_wait_queue(&tfile->wq.wait, &wait); |
1594 |
+- current->state = TASK_INTERRUPTIBLE; |
1595 |
+ |
1596 |
+ while (1) { |
1597 |
++ set_current_state(TASK_INTERRUPTIBLE); |
1598 |
+ skb = skb_array_consume(&tfile->tx_array); |
1599 |
+ if (skb) |
1600 |
+ break; |
1601 |
+@@ -1489,7 +1489,7 @@ static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, |
1602 |
+ schedule(); |
1603 |
+ } |
1604 |
+ |
1605 |
+- current->state = TASK_RUNNING; |
1606 |
++ __set_current_state(TASK_RUNNING); |
1607 |
+ remove_wait_queue(&tfile->wq.wait, &wait); |
1608 |
+ |
1609 |
+ out: |
1610 |
+diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c |
1611 |
+index 3b6fb5b3bdb2..6414cc6b9032 100644 |
1612 |
+--- a/drivers/net/xen-netback/hash.c |
1613 |
++++ b/drivers/net/xen-netback/hash.c |
1614 |
+@@ -435,6 +435,8 @@ void xenvif_init_hash(struct xenvif *vif) |
1615 |
+ if (xenvif_hash_cache_size == 0) |
1616 |
+ return; |
1617 |
+ |
1618 |
++ BUG_ON(vif->hash.cache.count); |
1619 |
++ |
1620 |
+ spin_lock_init(&vif->hash.cache.lock); |
1621 |
+ INIT_LIST_HEAD(&vif->hash.cache.list); |
1622 |
+ } |
1623 |
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c |
1624 |
+index 618013e7f87b..cae691486105 100644 |
1625 |
+--- a/drivers/net/xen-netback/interface.c |
1626 |
++++ b/drivers/net/xen-netback/interface.c |
1627 |
+@@ -152,6 +152,13 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, |
1628 |
+ { |
1629 |
+ struct xenvif *vif = netdev_priv(dev); |
1630 |
+ unsigned int size = vif->hash.size; |
1631 |
++ unsigned int num_queues; |
1632 |
++ |
1633 |
++ /* If queues are not set up internally - always return 0 |
1634 |
++ * as the packet going to be dropped anyway */ |
1635 |
++ num_queues = READ_ONCE(vif->num_queues); |
1636 |
++ if (num_queues < 1) |
1637 |
++ return 0; |
1638 |
+ |
1639 |
+ if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) |
1640 |
+ return fallback(dev, skb) % dev->real_num_tx_queues; |
1641 |
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c |
1642 |
+index a7bdb1ffac2e..f57815befc90 100644 |
1643 |
+--- a/drivers/net/xen-netback/netback.c |
1644 |
++++ b/drivers/net/xen-netback/netback.c |
1645 |
+@@ -1074,11 +1074,6 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s |
1646 |
+ skb_frag_size_set(&frags[i], len); |
1647 |
+ } |
1648 |
+ |
1649 |
+- /* Copied all the bits from the frag list -- free it. */ |
1650 |
+- skb_frag_list_init(skb); |
1651 |
+- xenvif_skb_zerocopy_prepare(queue, nskb); |
1652 |
+- kfree_skb(nskb); |
1653 |
+- |
1654 |
+ /* Release all the original (foreign) frags. */ |
1655 |
+ for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) |
1656 |
+ skb_frag_unref(skb, f); |
1657 |
+@@ -1147,6 +1142,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) |
1658 |
+ xenvif_fill_frags(queue, skb); |
1659 |
+ |
1660 |
+ if (unlikely(skb_has_frag_list(skb))) { |
1661 |
++ struct sk_buff *nskb = skb_shinfo(skb)->frag_list; |
1662 |
++ xenvif_skb_zerocopy_prepare(queue, nskb); |
1663 |
+ if (xenvif_handle_frag_list(queue, skb)) { |
1664 |
+ if (net_ratelimit()) |
1665 |
+ netdev_err(queue->vif->dev, |
1666 |
+@@ -1155,6 +1152,9 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) |
1667 |
+ kfree_skb(skb); |
1668 |
+ continue; |
1669 |
+ } |
1670 |
++ /* Copied all the bits from the frag list -- free it. */ |
1671 |
++ skb_frag_list_init(skb); |
1672 |
++ kfree_skb(nskb); |
1673 |
+ } |
1674 |
+ |
1675 |
+ skb->dev = queue->vif->dev; |
1676 |
+diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig |
1677 |
+index b8a21d7b25d4..1d81149c9ea4 100644 |
1678 |
+--- a/drivers/platform/x86/Kconfig |
1679 |
++++ b/drivers/platform/x86/Kconfig |
1680 |
+@@ -945,6 +945,7 @@ config INTEL_OAKTRAIL |
1681 |
+ config SAMSUNG_Q10 |
1682 |
+ tristate "Samsung Q10 Extras" |
1683 |
+ depends on ACPI |
1684 |
++ depends on BACKLIGHT_LCD_SUPPORT |
1685 |
+ select BACKLIGHT_CLASS_DEVICE |
1686 |
+ ---help--- |
1687 |
+ This driver provides support for backlight control on Samsung Q10 |
1688 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
1689 |
+index 8f77fc0630ce..86a02592b982 100644 |
1690 |
+--- a/drivers/s390/net/qeth_core_main.c |
1691 |
++++ b/drivers/s390/net/qeth_core_main.c |
1692 |
+@@ -2449,11 +2449,12 @@ out: |
1693 |
+ return rc; |
1694 |
+ } |
1695 |
+ |
1696 |
+-static void qeth_free_qdio_out_buf(struct qeth_qdio_out_q *q) |
1697 |
++static void qeth_free_output_queue(struct qeth_qdio_out_q *q) |
1698 |
+ { |
1699 |
+ if (!q) |
1700 |
+ return; |
1701 |
+ |
1702 |
++ qeth_clear_outq_buffers(q, 1); |
1703 |
+ qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); |
1704 |
+ kfree(q); |
1705 |
+ } |
1706 |
+@@ -2526,10 +2527,8 @@ out_freeoutqbufs: |
1707 |
+ card->qdio.out_qs[i]->bufs[j] = NULL; |
1708 |
+ } |
1709 |
+ out_freeoutq: |
1710 |
+- while (i > 0) { |
1711 |
+- qeth_free_qdio_out_buf(card->qdio.out_qs[--i]); |
1712 |
+- qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); |
1713 |
+- } |
1714 |
++ while (i > 0) |
1715 |
++ qeth_free_output_queue(card->qdio.out_qs[--i]); |
1716 |
+ kfree(card->qdio.out_qs); |
1717 |
+ card->qdio.out_qs = NULL; |
1718 |
+ out_freepool: |
1719 |
+@@ -2562,10 +2561,8 @@ static void qeth_free_qdio_buffers(struct qeth_card *card) |
1720 |
+ qeth_free_buffer_pool(card); |
1721 |
+ /* free outbound qdio_qs */ |
1722 |
+ if (card->qdio.out_qs) { |
1723 |
+- for (i = 0; i < card->qdio.no_out_queues; ++i) { |
1724 |
+- qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); |
1725 |
+- qeth_free_qdio_out_buf(card->qdio.out_qs[i]); |
1726 |
+- } |
1727 |
++ for (i = 0; i < card->qdio.no_out_queues; i++) |
1728 |
++ qeth_free_output_queue(card->qdio.out_qs[i]); |
1729 |
+ kfree(card->qdio.out_qs); |
1730 |
+ card->qdio.out_qs = NULL; |
1731 |
+ } |
1732 |
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c |
1733 |
+index fe670b696251..2d9696b3d432 100644 |
1734 |
+--- a/drivers/scsi/aacraid/commsup.c |
1735 |
++++ b/drivers/scsi/aacraid/commsup.c |
1736 |
+@@ -1179,8 +1179,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) |
1737 |
+ ADD : DELETE; |
1738 |
+ break; |
1739 |
+ } |
1740 |
+- case AifBuManagerEvent: |
1741 |
+- aac_handle_aif_bu(dev, aifcmd); |
1742 |
++ break; |
1743 |
++ case AifBuManagerEvent: |
1744 |
++ aac_handle_aif_bu(dev, aifcmd); |
1745 |
+ break; |
1746 |
+ } |
1747 |
+ |
1748 |
+diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c |
1749 |
+index 50c71678a156..ae93f45f9cd8 100644 |
1750 |
+--- a/drivers/scsi/libfc/fc_lport.c |
1751 |
++++ b/drivers/scsi/libfc/fc_lport.c |
1752 |
+@@ -1736,14 +1736,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, |
1753 |
+ fc_frame_payload_op(fp) != ELS_LS_ACC) { |
1754 |
+ FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); |
1755 |
+ fc_lport_error(lport, fp); |
1756 |
+- goto err; |
1757 |
++ goto out; |
1758 |
+ } |
1759 |
+ |
1760 |
+ flp = fc_frame_payload_get(fp, sizeof(*flp)); |
1761 |
+ if (!flp) { |
1762 |
+ FC_LPORT_DBG(lport, "FLOGI bad response\n"); |
1763 |
+ fc_lport_error(lport, fp); |
1764 |
+- goto err; |
1765 |
++ goto out; |
1766 |
+ } |
1767 |
+ |
1768 |
+ mfs = ntohs(flp->fl_csp.sp_bb_data) & |
1769 |
+@@ -1753,7 +1753,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, |
1770 |
+ FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
1771 |
+ "lport->mfs:%hu\n", mfs, lport->mfs); |
1772 |
+ fc_lport_error(lport, fp); |
1773 |
+- goto err; |
1774 |
++ goto out; |
1775 |
+ } |
1776 |
+ |
1777 |
+ if (mfs <= lport->mfs) { |
1778 |
+diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c |
1779 |
+index 2cc82ed6433a..91f5c951850f 100644 |
1780 |
+--- a/drivers/soc/fsl/qbman/qman.c |
1781 |
++++ b/drivers/soc/fsl/qbman/qman.c |
1782 |
+@@ -1073,18 +1073,19 @@ static void qm_mr_process_task(struct work_struct *work); |
1783 |
+ static irqreturn_t portal_isr(int irq, void *ptr) |
1784 |
+ { |
1785 |
+ struct qman_portal *p = ptr; |
1786 |
+- |
1787 |
+- u32 clear = QM_DQAVAIL_MASK | p->irq_sources; |
1788 |
+ u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; |
1789 |
++ u32 clear = 0; |
1790 |
+ |
1791 |
+ if (unlikely(!is)) |
1792 |
+ return IRQ_NONE; |
1793 |
+ |
1794 |
+ /* DQRR-handling if it's interrupt-driven */ |
1795 |
+- if (is & QM_PIRQ_DQRI) |
1796 |
++ if (is & QM_PIRQ_DQRI) { |
1797 |
+ __poll_portal_fast(p, QMAN_POLL_LIMIT); |
1798 |
++ clear = QM_DQAVAIL_MASK | QM_PIRQ_DQRI; |
1799 |
++ } |
1800 |
+ /* Handling of anything else that's interrupt-driven */ |
1801 |
+- clear |= __poll_portal_slow(p, is); |
1802 |
++ clear |= __poll_portal_slow(p, is) & QM_PIRQ_SLOW; |
1803 |
+ qm_out(&p->p, QM_REG_ISR, clear); |
1804 |
+ return IRQ_HANDLED; |
1805 |
+ } |
1806 |
+diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c |
1807 |
+index d270a424ecac..22c481f2ae4f 100644 |
1808 |
+--- a/drivers/staging/android/ion/ion_system_heap.c |
1809 |
++++ b/drivers/staging/android/ion/ion_system_heap.c |
1810 |
+@@ -307,10 +307,10 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools, |
1811 |
+ bool cached) |
1812 |
+ { |
1813 |
+ int i; |
1814 |
+- gfp_t gfp_flags = low_order_gfp_flags; |
1815 |
+ |
1816 |
+ for (i = 0; i < NUM_ORDERS; i++) { |
1817 |
+ struct ion_page_pool *pool; |
1818 |
++ gfp_t gfp_flags = low_order_gfp_flags; |
1819 |
+ |
1820 |
+ if (orders[i] > 4) |
1821 |
+ gfp_flags = high_order_gfp_flags; |
1822 |
+diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c |
1823 |
+index 0dcb826a9f1f..723bdd2c2c74 100644 |
1824 |
+--- a/drivers/staging/comedi/drivers/ni_660x.c |
1825 |
++++ b/drivers/staging/comedi/drivers/ni_660x.c |
1826 |
+@@ -606,6 +606,7 @@ static int ni_660x_set_pfi_routing(struct comedi_device *dev, |
1827 |
+ case NI_660X_PFI_OUTPUT_DIO: |
1828 |
+ if (chan > 31) |
1829 |
+ return -EINVAL; |
1830 |
++ break; |
1831 |
+ default: |
1832 |
+ return -EINVAL; |
1833 |
+ } |
1834 |
+diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c |
1835 |
+index 2e5e3b368532..b7203867ea9d 100644 |
1836 |
+--- a/drivers/staging/wilc1000/linux_wlan.c |
1837 |
++++ b/drivers/staging/wilc1000/linux_wlan.c |
1838 |
+@@ -1263,8 +1263,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, |
1839 |
+ vif->wilc = *wilc; |
1840 |
+ vif->ndev = ndev; |
1841 |
+ wl->vif[i] = vif; |
1842 |
+- wl->vif_num = i; |
1843 |
+- vif->idx = wl->vif_num; |
1844 |
++ wl->vif_num = i + 1; |
1845 |
++ vif->idx = i; |
1846 |
+ |
1847 |
+ ndev->netdev_ops = &wilc_netdev_ops; |
1848 |
+ |
1849 |
+diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig |
1850 |
+index 125cea1c3c8d..19ce615455c1 100644 |
1851 |
+--- a/drivers/usb/phy/Kconfig |
1852 |
++++ b/drivers/usb/phy/Kconfig |
1853 |
+@@ -20,7 +20,7 @@ config AB8500_USB |
1854 |
+ |
1855 |
+ config FSL_USB2_OTG |
1856 |
+ bool "Freescale USB OTG Transceiver Driver" |
1857 |
+- depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM |
1858 |
++ depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM |
1859 |
+ depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' |
1860 |
+ select USB_PHY |
1861 |
+ help |
1862 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1863 |
+index c2b120021443..7bbf2ca73f68 100644 |
1864 |
+--- a/drivers/usb/serial/cp210x.c |
1865 |
++++ b/drivers/usb/serial/cp210x.c |
1866 |
+@@ -58,6 +58,7 @@ static const struct usb_device_id id_table[] = { |
1867 |
+ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ |
1868 |
+ { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ |
1869 |
+ { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ |
1870 |
++ { USB_DEVICE(0x0B00, 0x3070) }, /* Ingenico 3070 */ |
1871 |
+ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ |
1872 |
+ { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ |
1873 |
+ { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
1874 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1875 |
+index 2e2f736384ab..b88a72220acd 100644 |
1876 |
+--- a/drivers/usb/serial/ftdi_sio.c |
1877 |
++++ b/drivers/usb/serial/ftdi_sio.c |
1878 |
+@@ -1020,6 +1020,8 @@ static const struct usb_device_id id_table_combined[] = { |
1879 |
+ { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) }, |
1880 |
+ { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) }, |
1881 |
+ { USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) }, |
1882 |
++ /* EZPrototypes devices */ |
1883 |
++ { USB_DEVICE(EZPROTOTYPES_VID, HJELMSLUND_USB485_ISO_PID) }, |
1884 |
+ { } /* Terminating entry */ |
1885 |
+ }; |
1886 |
+ |
1887 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
1888 |
+index 76a10b222ff9..ddf5ab983dc9 100644 |
1889 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
1890 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
1891 |
+@@ -1307,6 +1307,12 @@ |
1892 |
+ #define IONICS_VID 0x1c0c |
1893 |
+ #define IONICS_PLUGCOMPUTER_PID 0x0102 |
1894 |
+ |
1895 |
++/* |
1896 |
++ * EZPrototypes (PID reseller) |
1897 |
++ */ |
1898 |
++#define EZPROTOTYPES_VID 0x1c40 |
1899 |
++#define HJELMSLUND_USB485_ISO_PID 0x0477 |
1900 |
++ |
1901 |
+ /* |
1902 |
+ * Dresden Elektronik Sensor Terminal Board |
1903 |
+ */ |
1904 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1905 |
+index 7bc2c9fef605..b2b7c12e5c86 100644 |
1906 |
+--- a/drivers/usb/serial/option.c |
1907 |
++++ b/drivers/usb/serial/option.c |
1908 |
+@@ -1147,6 +1147,8 @@ static const struct usb_device_id option_ids[] = { |
1909 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
1910 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
1911 |
+ .driver_info = NCTRL(0) | RSVD(3) }, |
1912 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */ |
1913 |
++ .driver_info = NCTRL(0) }, |
1914 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
1915 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
1916 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
1917 |
+diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c |
1918 |
+index d8e6d421c27f..2e1f50e467f1 100644 |
1919 |
+--- a/fs/autofs4/expire.c |
1920 |
++++ b/fs/autofs4/expire.c |
1921 |
+@@ -563,7 +563,6 @@ int autofs4_expire_run(struct super_block *sb, |
1922 |
+ pkt.len = dentry->d_name.len; |
1923 |
+ memcpy(pkt.name, dentry->d_name.name, pkt.len); |
1924 |
+ pkt.name[pkt.len] = '\0'; |
1925 |
+- dput(dentry); |
1926 |
+ |
1927 |
+ if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) |
1928 |
+ ret = -EFAULT; |
1929 |
+@@ -576,6 +575,8 @@ int autofs4_expire_run(struct super_block *sb, |
1930 |
+ complete_all(&ino->expire_complete); |
1931 |
+ spin_unlock(&sbi->fs_lock); |
1932 |
+ |
1933 |
++ dput(dentry); |
1934 |
++ |
1935 |
+ return ret; |
1936 |
+ } |
1937 |
+ |
1938 |
+diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c |
1939 |
+index ce0c6ea96a87..d9a3264909d0 100644 |
1940 |
+--- a/fs/autofs4/inode.c |
1941 |
++++ b/fs/autofs4/inode.c |
1942 |
+@@ -259,8 +259,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) |
1943 |
+ } |
1944 |
+ root_inode = autofs4_get_inode(s, S_IFDIR | 0755); |
1945 |
+ root = d_make_root(root_inode); |
1946 |
+- if (!root) |
1947 |
++ if (!root) { |
1948 |
++ ret = -ENOMEM; |
1949 |
+ goto fail_ino; |
1950 |
++ } |
1951 |
+ pipe = NULL; |
1952 |
+ |
1953 |
+ root->d_fsdata = ino; |
1954 |
+diff --git a/fs/buffer.c b/fs/buffer.c |
1955 |
+index 5d8f496d624e..e0d46d47e358 100644 |
1956 |
+--- a/fs/buffer.c |
1957 |
++++ b/fs/buffer.c |
1958 |
+@@ -207,6 +207,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) |
1959 |
+ struct buffer_head *head; |
1960 |
+ struct page *page; |
1961 |
+ int all_mapped = 1; |
1962 |
++ static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1); |
1963 |
+ |
1964 |
+ index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); |
1965 |
+ page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); |
1966 |
+@@ -234,15 +235,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) |
1967 |
+ * file io on the block device and getblk. It gets dealt with |
1968 |
+ * elsewhere, don't buffer_error if we had some unmapped buffers |
1969 |
+ */ |
1970 |
+- if (all_mapped) { |
1971 |
+- printk("__find_get_block_slow() failed. " |
1972 |
+- "block=%llu, b_blocknr=%llu\n", |
1973 |
+- (unsigned long long)block, |
1974 |
+- (unsigned long long)bh->b_blocknr); |
1975 |
+- printk("b_state=0x%08lx, b_size=%zu\n", |
1976 |
+- bh->b_state, bh->b_size); |
1977 |
+- printk("device %pg blocksize: %d\n", bdev, |
1978 |
+- 1 << bd_inode->i_blkbits); |
1979 |
++ ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE); |
1980 |
++ if (all_mapped && __ratelimit(&last_warned)) { |
1981 |
++ printk("__find_get_block_slow() failed. block=%llu, " |
1982 |
++ "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, " |
1983 |
++ "device %pg blocksize: %d\n", |
1984 |
++ (unsigned long long)block, |
1985 |
++ (unsigned long long)bh->b_blocknr, |
1986 |
++ bh->b_state, bh->b_size, bdev, |
1987 |
++ 1 << bd_inode->i_blkbits); |
1988 |
+ } |
1989 |
+ out_unlock: |
1990 |
+ spin_unlock(&bd_mapping->private_lock); |
1991 |
+diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h |
1992 |
+index 1e1449ad00e8..1af7afae3ad1 100644 |
1993 |
+--- a/fs/cifs/smb2pdu.h |
1994 |
++++ b/fs/cifs/smb2pdu.h |
1995 |
+@@ -84,8 +84,8 @@ |
1996 |
+ |
1997 |
+ #define NUMBER_OF_SMB2_COMMANDS 0x0013 |
1998 |
+ |
1999 |
+-/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */ |
2000 |
+-#define MAX_SMB2_HDR_SIZE 0x00b0 |
2001 |
++/* 52 transform hdr + 64 hdr + 88 create rsp */ |
2002 |
++#define MAX_SMB2_HDR_SIZE 204 |
2003 |
+ |
2004 |
+ #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) |
2005 |
+ #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd) |
2006 |
+diff --git a/fs/drop_caches.c b/fs/drop_caches.c |
2007 |
+index d72d52b90433..280460fef066 100644 |
2008 |
+--- a/fs/drop_caches.c |
2009 |
++++ b/fs/drop_caches.c |
2010 |
+@@ -20,8 +20,13 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) |
2011 |
+ spin_lock(&sb->s_inode_list_lock); |
2012 |
+ list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
2013 |
+ spin_lock(&inode->i_lock); |
2014 |
++ /* |
2015 |
++ * We must skip inodes in unusual state. We may also skip |
2016 |
++ * inodes without pages but we deliberately won't in case |
2017 |
++ * we need to reschedule to avoid softlockups. |
2018 |
++ */ |
2019 |
+ if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || |
2020 |
+- (inode->i_mapping->nrpages == 0)) { |
2021 |
++ (inode->i_mapping->nrpages == 0 && !need_resched())) { |
2022 |
+ spin_unlock(&inode->i_lock); |
2023 |
+ continue; |
2024 |
+ } |
2025 |
+@@ -29,6 +34,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) |
2026 |
+ spin_unlock(&inode->i_lock); |
2027 |
+ spin_unlock(&sb->s_inode_list_lock); |
2028 |
+ |
2029 |
++ cond_resched(); |
2030 |
+ invalidate_mapping_pages(inode->i_mapping, 0, -1); |
2031 |
+ iput(toput_inode); |
2032 |
+ toput_inode = inode; |
2033 |
+diff --git a/fs/exec.c b/fs/exec.c |
2034 |
+index fcd8642ef2d2..81477116035d 100644 |
2035 |
+--- a/fs/exec.c |
2036 |
++++ b/fs/exec.c |
2037 |
+@@ -938,7 +938,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size, |
2038 |
+ i_size - pos); |
2039 |
+ if (bytes < 0) { |
2040 |
+ ret = bytes; |
2041 |
+- goto out; |
2042 |
++ goto out_free; |
2043 |
+ } |
2044 |
+ |
2045 |
+ if (bytes == 0) |
2046 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
2047 |
+index f53c139c312e..001487b230b5 100644 |
2048 |
+--- a/fs/hugetlbfs/inode.c |
2049 |
++++ b/fs/hugetlbfs/inode.c |
2050 |
+@@ -861,6 +861,18 @@ static int hugetlbfs_migrate_page(struct address_space *mapping, |
2051 |
+ rc = migrate_huge_page_move_mapping(mapping, newpage, page); |
2052 |
+ if (rc != MIGRATEPAGE_SUCCESS) |
2053 |
+ return rc; |
2054 |
++ |
2055 |
++ /* |
2056 |
++ * page_private is subpool pointer in hugetlb pages. Transfer to |
2057 |
++ * new page. PagePrivate is not associated with page_private for |
2058 |
++ * hugetlb pages and can not be set here as only page_huge_active |
2059 |
++ * pages can be migrated. |
2060 |
++ */ |
2061 |
++ if (page_private(page)) { |
2062 |
++ set_page_private(newpage, page_private(page)); |
2063 |
++ set_page_private(page, 0); |
2064 |
++ } |
2065 |
++ |
2066 |
+ migrate_page_copy(newpage, page); |
2067 |
+ |
2068 |
+ return MIGRATEPAGE_SUCCESS; |
2069 |
+diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c |
2070 |
+index 0a3f9b594602..37779ed3f790 100644 |
2071 |
+--- a/fs/ncpfs/ioctl.c |
2072 |
++++ b/fs/ncpfs/ioctl.c |
2073 |
+@@ -233,7 +233,7 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg) |
2074 |
+ len = strlen(server->nls_vol->charset); |
2075 |
+ if (len > NCP_IOCSNAME_LEN) |
2076 |
+ len = NCP_IOCSNAME_LEN; |
2077 |
+- strncpy(user.codepage, server->nls_vol->charset, len); |
2078 |
++ strscpy(user.codepage, server->nls_vol->charset, NCP_IOCSNAME_LEN); |
2079 |
+ user.codepage[len] = 0; |
2080 |
+ } |
2081 |
+ |
2082 |
+@@ -243,7 +243,7 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg) |
2083 |
+ len = strlen(server->nls_io->charset); |
2084 |
+ if (len > NCP_IOCSNAME_LEN) |
2085 |
+ len = NCP_IOCSNAME_LEN; |
2086 |
+- strncpy(user.iocharset, server->nls_io->charset, len); |
2087 |
++ strscpy(user.iocharset, server->nls_io->charset, NCP_IOCSNAME_LEN); |
2088 |
+ user.iocharset[len] = 0; |
2089 |
+ } |
2090 |
+ mutex_unlock(&server->root_setup_lock); |
2091 |
+diff --git a/fs/nfs/super.c b/fs/nfs/super.c |
2092 |
+index 35aef192a13f..659ad12e33ba 100644 |
2093 |
+--- a/fs/nfs/super.c |
2094 |
++++ b/fs/nfs/super.c |
2095 |
+@@ -1904,6 +1904,11 @@ static int nfs_parse_devname(const char *dev_name, |
2096 |
+ size_t len; |
2097 |
+ char *end; |
2098 |
+ |
2099 |
++ if (unlikely(!dev_name || !*dev_name)) { |
2100 |
++ dfprintk(MOUNT, "NFS: device name not specified\n"); |
2101 |
++ return -EINVAL; |
2102 |
++ } |
2103 |
++ |
2104 |
+ /* Is the host name protected with square brakcets? */ |
2105 |
+ if (*dev_name == '[') { |
2106 |
+ end = strchr(++dev_name, ']'); |
2107 |
+diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h |
2108 |
+index cebecff536a3..c5fb6f871930 100644 |
2109 |
+--- a/include/drm/drm_cache.h |
2110 |
++++ b/include/drm/drm_cache.h |
2111 |
+@@ -41,6 +41,24 @@ static inline bool drm_arch_can_wc_memory(void) |
2112 |
+ return false; |
2113 |
+ #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) |
2114 |
+ return false; |
2115 |
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) |
2116 |
++ /* |
2117 |
++ * The DRM driver stack is designed to work with cache coherent devices |
2118 |
++ * only, but permits an optimization to be enabled in some cases, where |
2119 |
++ * for some buffers, both the CPU and the GPU use uncached mappings, |
2120 |
++ * removing the need for DMA snooping and allocation in the CPU caches. |
2121 |
++ * |
2122 |
++ * The use of uncached GPU mappings relies on the correct implementation |
2123 |
++ * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU |
2124 |
++ * will use cached mappings nonetheless. On x86 platforms, this does not |
2125 |
++ * seem to matter, as uncached CPU mappings will snoop the caches in any |
2126 |
++ * case. However, on ARM and arm64, enabling this optimization on a |
2127 |
++ * platform where NoSnoop is ignored results in loss of coherency, which |
2128 |
++ * breaks correct operation of the device. Since we have no way of |
2129 |
++ * detecting whether NoSnoop works or not, just disable this |
2130 |
++ * optimization entirely for ARM and arm64. |
2131 |
++ */ |
2132 |
++ return false; |
2133 |
+ #else |
2134 |
+ return true; |
2135 |
+ #endif |
2136 |
+diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h |
2137 |
+index 32dc0cbd51ca..9d9e0b54f831 100644 |
2138 |
+--- a/include/linux/cpufreq.h |
2139 |
++++ b/include/linux/cpufreq.h |
2140 |
+@@ -234,20 +234,12 @@ __ATTR(_name, _perm, show_##_name, NULL) |
2141 |
+ static struct freq_attr _name = \ |
2142 |
+ __ATTR(_name, 0644, show_##_name, store_##_name) |
2143 |
+ |
2144 |
+-struct global_attr { |
2145 |
+- struct attribute attr; |
2146 |
+- ssize_t (*show)(struct kobject *kobj, |
2147 |
+- struct attribute *attr, char *buf); |
2148 |
+- ssize_t (*store)(struct kobject *a, struct attribute *b, |
2149 |
+- const char *c, size_t count); |
2150 |
+-}; |
2151 |
+- |
2152 |
+ #define define_one_global_ro(_name) \ |
2153 |
+-static struct global_attr _name = \ |
2154 |
++static struct kobj_attribute _name = \ |
2155 |
+ __ATTR(_name, 0444, show_##_name, NULL) |
2156 |
+ |
2157 |
+ #define define_one_global_rw(_name) \ |
2158 |
+-static struct global_attr _name = \ |
2159 |
++static struct kobj_attribute _name = \ |
2160 |
+ __ATTR(_name, 0644, show_##_name, store_##_name) |
2161 |
+ |
2162 |
+ |
2163 |
+diff --git a/include/net/icmp.h b/include/net/icmp.h |
2164 |
+index 3ef2743a8eec..8665bf24e3b7 100644 |
2165 |
+--- a/include/net/icmp.h |
2166 |
++++ b/include/net/icmp.h |
2167 |
+@@ -22,6 +22,7 @@ |
2168 |
+ |
2169 |
+ #include <net/inet_sock.h> |
2170 |
+ #include <net/snmp.h> |
2171 |
++#include <net/ip.h> |
2172 |
+ |
2173 |
+ struct icmp_err { |
2174 |
+ int errno; |
2175 |
+@@ -39,7 +40,13 @@ struct net_proto_family; |
2176 |
+ struct sk_buff; |
2177 |
+ struct net; |
2178 |
+ |
2179 |
+-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
2180 |
++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
2181 |
++ const struct ip_options *opt); |
2182 |
++static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
2183 |
++{ |
2184 |
++ __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt); |
2185 |
++} |
2186 |
++ |
2187 |
+ int icmp_rcv(struct sk_buff *skb); |
2188 |
+ void icmp_err(struct sk_buff *skb, u32 info); |
2189 |
+ int icmp_init(void); |
2190 |
+diff --git a/include/net/ip.h b/include/net/ip.h |
2191 |
+index 8646da034851..f06cd30bb44c 100644 |
2192 |
+--- a/include/net/ip.h |
2193 |
++++ b/include/net/ip.h |
2194 |
+@@ -570,6 +570,8 @@ static inline int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb) |
2195 |
+ } |
2196 |
+ |
2197 |
+ void ip_options_fragment(struct sk_buff *skb); |
2198 |
++int __ip_options_compile(struct net *net, struct ip_options *opt, |
2199 |
++ struct sk_buff *skb, __be32 *info); |
2200 |
+ int ip_options_compile(struct net *net, struct ip_options *opt, |
2201 |
+ struct sk_buff *skb); |
2202 |
+ int ip_options_get(struct net *net, struct ip_options_rcu **optp, |
2203 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
2204 |
+index 17339506f9f8..5cbb2eda80b5 100644 |
2205 |
+--- a/kernel/events/core.c |
2206 |
++++ b/kernel/events/core.c |
2207 |
+@@ -428,18 +428,18 @@ int perf_proc_update_handler(struct ctl_table *table, int write, |
2208 |
+ void __user *buffer, size_t *lenp, |
2209 |
+ loff_t *ppos) |
2210 |
+ { |
2211 |
+- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
2212 |
+- |
2213 |
+- if (ret || !write) |
2214 |
+- return ret; |
2215 |
+- |
2216 |
++ int ret; |
2217 |
++ int perf_cpu = sysctl_perf_cpu_time_max_percent; |
2218 |
+ /* |
2219 |
+ * If throttling is disabled don't allow the write: |
2220 |
+ */ |
2221 |
+- if (sysctl_perf_cpu_time_max_percent == 100 || |
2222 |
+- sysctl_perf_cpu_time_max_percent == 0) |
2223 |
++ if (write && (perf_cpu == 100 || perf_cpu == 0)) |
2224 |
+ return -EINVAL; |
2225 |
+ |
2226 |
++ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
2227 |
++ if (ret || !write) |
2228 |
++ return ret; |
2229 |
++ |
2230 |
+ max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ); |
2231 |
+ perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate; |
2232 |
+ update_perf_cpu_limits(); |
2233 |
+diff --git a/kernel/futex.c b/kernel/futex.c |
2234 |
+index 053d7be08be5..30fe0432c46d 100644 |
2235 |
+--- a/kernel/futex.c |
2236 |
++++ b/kernel/futex.c |
2237 |
+@@ -2966,10 +2966,13 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, |
2238 |
+ */ |
2239 |
+ WARN_ON(!q.pi_state); |
2240 |
+ pi_mutex = &q.pi_state->pi_mutex; |
2241 |
+- ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter); |
2242 |
+- debug_rt_mutex_free_waiter(&rt_waiter); |
2243 |
++ ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); |
2244 |
+ |
2245 |
+ spin_lock(q.lock_ptr); |
2246 |
++ if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) |
2247 |
++ ret = 0; |
2248 |
++ |
2249 |
++ debug_rt_mutex_free_waiter(&rt_waiter); |
2250 |
+ /* |
2251 |
+ * Fixup the pi_state owner and possibly acquire the lock if we |
2252 |
+ * haven't already. |
2253 |
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
2254 |
+index 196cc460e38d..7615e7722258 100644 |
2255 |
+--- a/kernel/locking/rtmutex.c |
2256 |
++++ b/kernel/locking/rtmutex.c |
2257 |
+@@ -1746,21 +1746,23 @@ struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock) |
2258 |
+ } |
2259 |
+ |
2260 |
+ /** |
2261 |
+- * rt_mutex_finish_proxy_lock() - Complete lock acquisition |
2262 |
++ * rt_mutex_wait_proxy_lock() - Wait for lock acquisition |
2263 |
+ * @lock: the rt_mutex we were woken on |
2264 |
+ * @to: the timeout, null if none. hrtimer should already have |
2265 |
+ * been started. |
2266 |
+ * @waiter: the pre-initialized rt_mutex_waiter |
2267 |
+ * |
2268 |
+- * Complete the lock acquisition started our behalf by another thread. |
2269 |
++ * Wait for the the lock acquisition started on our behalf by |
2270 |
++ * rt_mutex_start_proxy_lock(). Upon failure, the caller must call |
2271 |
++ * rt_mutex_cleanup_proxy_lock(). |
2272 |
+ * |
2273 |
+ * Returns: |
2274 |
+ * 0 - success |
2275 |
+ * <0 - error, one of -EINTR, -ETIMEDOUT |
2276 |
+ * |
2277 |
+- * Special API call for PI-futex requeue support |
2278 |
++ * Special API call for PI-futex support |
2279 |
+ */ |
2280 |
+-int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, |
2281 |
++int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, |
2282 |
+ struct hrtimer_sleeper *to, |
2283 |
+ struct rt_mutex_waiter *waiter) |
2284 |
+ { |
2285 |
+@@ -1773,9 +1775,6 @@ int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, |
2286 |
+ /* sleep on the mutex */ |
2287 |
+ ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter); |
2288 |
+ |
2289 |
+- if (unlikely(ret)) |
2290 |
+- remove_waiter(lock, waiter); |
2291 |
+- |
2292 |
+ /* |
2293 |
+ * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might |
2294 |
+ * have to fix that up. |
2295 |
+@@ -1786,3 +1785,42 @@ int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, |
2296 |
+ |
2297 |
+ return ret; |
2298 |
+ } |
2299 |
++ |
2300 |
++/** |
2301 |
++ * rt_mutex_cleanup_proxy_lock() - Cleanup failed lock acquisition |
2302 |
++ * @lock: the rt_mutex we were woken on |
2303 |
++ * @waiter: the pre-initialized rt_mutex_waiter |
2304 |
++ * |
2305 |
++ * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). |
2306 |
++ * |
2307 |
++ * Unless we acquired the lock; we're still enqueued on the wait-list and can |
2308 |
++ * in fact still be granted ownership until we're removed. Therefore we can |
2309 |
++ * find we are in fact the owner and must disregard the |
2310 |
++ * rt_mutex_wait_proxy_lock() failure. |
2311 |
++ * |
2312 |
++ * Returns: |
2313 |
++ * true - did the cleanup, we done. |
2314 |
++ * false - we acquired the lock after rt_mutex_wait_proxy_lock() returned, |
2315 |
++ * caller should disregards its return value. |
2316 |
++ * |
2317 |
++ * Special API call for PI-futex support |
2318 |
++ */ |
2319 |
++bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, |
2320 |
++ struct rt_mutex_waiter *waiter) |
2321 |
++{ |
2322 |
++ bool cleanup = false; |
2323 |
++ |
2324 |
++ raw_spin_lock_irq(&lock->wait_lock); |
2325 |
++ /* |
2326 |
++ * Unless we're the owner; we're still enqueued on the wait_list. |
2327 |
++ * So check if we became owner, if not, take us off the wait_list. |
2328 |
++ */ |
2329 |
++ if (rt_mutex_owner(lock) != current) { |
2330 |
++ remove_waiter(lock, waiter); |
2331 |
++ fixup_rt_mutex_waiters(lock); |
2332 |
++ cleanup = true; |
2333 |
++ } |
2334 |
++ raw_spin_unlock_irq(&lock->wait_lock); |
2335 |
++ |
2336 |
++ return cleanup; |
2337 |
++} |
2338 |
+diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h |
2339 |
+index 50848b460851..14cbafed0014 100644 |
2340 |
+--- a/kernel/locking/rtmutex_common.h |
2341 |
++++ b/kernel/locking/rtmutex_common.h |
2342 |
+@@ -107,9 +107,11 @@ extern void rt_mutex_proxy_unlock(struct rt_mutex *lock, |
2343 |
+ extern int rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
2344 |
+ struct rt_mutex_waiter *waiter, |
2345 |
+ struct task_struct *task); |
2346 |
+-extern int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, |
2347 |
+- struct hrtimer_sleeper *to, |
2348 |
+- struct rt_mutex_waiter *waiter); |
2349 |
++extern int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, |
2350 |
++ struct hrtimer_sleeper *to, |
2351 |
++ struct rt_mutex_waiter *waiter); |
2352 |
++extern bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, |
2353 |
++ struct rt_mutex_waiter *waiter); |
2354 |
+ extern int rt_mutex_timed_futex_lock(struct rt_mutex *l, struct hrtimer_sleeper *to); |
2355 |
+ extern bool rt_mutex_futex_unlock(struct rt_mutex *lock, |
2356 |
+ struct wake_q_head *wqh); |
2357 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
2358 |
+index 3e50fcfe6ad8..8b682da98d95 100644 |
2359 |
+--- a/mm/hugetlb.c |
2360 |
++++ b/mm/hugetlb.c |
2361 |
+@@ -3579,7 +3579,6 @@ retry_avoidcopy: |
2362 |
+ copy_user_huge_page(new_page, old_page, address, vma, |
2363 |
+ pages_per_huge_page(h)); |
2364 |
+ __SetPageUptodate(new_page); |
2365 |
+- set_page_huge_active(new_page); |
2366 |
+ |
2367 |
+ mmun_start = address & huge_page_mask(h); |
2368 |
+ mmun_end = mmun_start + huge_page_size(h); |
2369 |
+@@ -3601,6 +3600,7 @@ retry_avoidcopy: |
2370 |
+ make_huge_pte(vma, new_page, 1)); |
2371 |
+ page_remove_rmap(old_page, true); |
2372 |
+ hugepage_add_new_anon_rmap(new_page, vma, address); |
2373 |
++ set_page_huge_active(new_page); |
2374 |
+ /* Make the old page be freed below */ |
2375 |
+ new_page = old_page; |
2376 |
+ } |
2377 |
+@@ -3683,6 +3683,7 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, |
2378 |
+ struct page *page; |
2379 |
+ pte_t new_pte; |
2380 |
+ spinlock_t *ptl; |
2381 |
++ bool new_page = false; |
2382 |
+ |
2383 |
+ /* |
2384 |
+ * Currently, we are forced to kill the process in the event the |
2385 |
+@@ -3716,7 +3717,7 @@ retry: |
2386 |
+ } |
2387 |
+ clear_huge_page(page, address, pages_per_huge_page(h)); |
2388 |
+ __SetPageUptodate(page); |
2389 |
+- set_page_huge_active(page); |
2390 |
++ new_page = true; |
2391 |
+ |
2392 |
+ if (vma->vm_flags & VM_MAYSHARE) { |
2393 |
+ int err = huge_add_to_page_cache(page, mapping, idx); |
2394 |
+@@ -3788,6 +3789,15 @@ retry: |
2395 |
+ } |
2396 |
+ |
2397 |
+ spin_unlock(ptl); |
2398 |
++ |
2399 |
++ /* |
2400 |
++ * Only make newly allocated pages active. Existing pages found |
2401 |
++ * in the pagecache could be !page_huge_active() if they have been |
2402 |
++ * isolated for migration. |
2403 |
++ */ |
2404 |
++ if (new_page) |
2405 |
++ set_page_huge_active(page); |
2406 |
++ |
2407 |
+ unlock_page(page); |
2408 |
+ out: |
2409 |
+ return ret; |
2410 |
+diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
2411 |
+index e4c271298074..b4c8d7b9ab82 100644 |
2412 |
+--- a/mm/memory_hotplug.c |
2413 |
++++ b/mm/memory_hotplug.c |
2414 |
+@@ -1471,7 +1471,8 @@ static struct page *next_active_pageblock(struct page *page) |
2415 |
+ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) |
2416 |
+ { |
2417 |
+ struct page *page = pfn_to_page(start_pfn); |
2418 |
+- struct page *end_page = page + nr_pages; |
2419 |
++ unsigned long end_pfn = min(start_pfn + nr_pages, zone_end_pfn(page_zone(page))); |
2420 |
++ struct page *end_page = pfn_to_page(end_pfn); |
2421 |
+ |
2422 |
+ /* Check the starting page of each pageblock within the range */ |
2423 |
+ for (; page < end_page; page = next_active_pageblock(page)) { |
2424 |
+@@ -1511,6 +1512,9 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
2425 |
+ i++; |
2426 |
+ if (i == MAX_ORDER_NR_PAGES || pfn + i >= end_pfn) |
2427 |
+ continue; |
2428 |
++ /* Check if we got outside of the zone */ |
2429 |
++ if (zone && !zone_spans_pfn(zone, pfn + i)) |
2430 |
++ return 0; |
2431 |
+ page = pfn_to_page(pfn + i); |
2432 |
+ if (zone && page_zone(page) != zone) |
2433 |
+ return 0; |
2434 |
+diff --git a/mm/migrate.c b/mm/migrate.c |
2435 |
+index b08c1a4a1c22..b810ac1359f0 100644 |
2436 |
+--- a/mm/migrate.c |
2437 |
++++ b/mm/migrate.c |
2438 |
+@@ -1234,6 +1234,16 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
2439 |
+ lock_page(hpage); |
2440 |
+ } |
2441 |
+ |
2442 |
++ /* |
2443 |
++ * Check for pages which are in the process of being freed. Without |
2444 |
++ * page_mapping() set, hugetlbfs specific move page routine will not |
2445 |
++ * be called and we could leak usage counts for subpools. |
2446 |
++ */ |
2447 |
++ if (page_private(hpage) && !page_mapping(hpage)) { |
2448 |
++ rc = -EBUSY; |
2449 |
++ goto out_unlock; |
2450 |
++ } |
2451 |
++ |
2452 |
+ if (PageAnon(hpage)) |
2453 |
+ anon_vma = page_get_anon_vma(hpage); |
2454 |
+ |
2455 |
+@@ -1265,6 +1275,7 @@ put_anon: |
2456 |
+ set_page_owner_migrate_reason(new_hpage, reason); |
2457 |
+ } |
2458 |
+ |
2459 |
++out_unlock: |
2460 |
+ unlock_page(hpage); |
2461 |
+ out: |
2462 |
+ if (rc != -EAGAIN) |
2463 |
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c |
2464 |
+index 6e4f34721080..3333693d8052 100644 |
2465 |
+--- a/net/core/net-sysfs.c |
2466 |
++++ b/net/core/net-sysfs.c |
2467 |
+@@ -1380,6 +1380,9 @@ static int register_queue_kobjects(struct net_device *dev) |
2468 |
+ error: |
2469 |
+ netdev_queue_update_kobjects(dev, txq, 0); |
2470 |
+ net_rx_queue_update_kobjects(dev, rxq, 0); |
2471 |
++#ifdef CONFIG_SYSFS |
2472 |
++ kset_unregister(dev->queues_kset); |
2473 |
++#endif |
2474 |
+ return error; |
2475 |
+ } |
2476 |
+ |
2477 |
+diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c |
2478 |
+index 571d079e262f..71bcab94c5c7 100644 |
2479 |
+--- a/net/ipv4/cipso_ipv4.c |
2480 |
++++ b/net/ipv4/cipso_ipv4.c |
2481 |
+@@ -667,7 +667,8 @@ static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) |
2482 |
+ case CIPSO_V4_MAP_PASS: |
2483 |
+ return 0; |
2484 |
+ case CIPSO_V4_MAP_TRANS: |
2485 |
+- if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL) |
2486 |
++ if ((level < doi_def->map.std->lvl.cipso_size) && |
2487 |
++ (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)) |
2488 |
+ return 0; |
2489 |
+ break; |
2490 |
+ } |
2491 |
+@@ -1735,13 +1736,26 @@ validate_return: |
2492 |
+ */ |
2493 |
+ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway) |
2494 |
+ { |
2495 |
++ unsigned char optbuf[sizeof(struct ip_options) + 40]; |
2496 |
++ struct ip_options *opt = (struct ip_options *)optbuf; |
2497 |
++ |
2498 |
+ if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES) |
2499 |
+ return; |
2500 |
+ |
2501 |
++ /* |
2502 |
++ * We might be called above the IP layer, |
2503 |
++ * so we can not use icmp_send and IPCB here. |
2504 |
++ */ |
2505 |
++ |
2506 |
++ memset(opt, 0, sizeof(struct ip_options)); |
2507 |
++ opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); |
2508 |
++ if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL)) |
2509 |
++ return; |
2510 |
++ |
2511 |
+ if (gateway) |
2512 |
+- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0); |
2513 |
++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt); |
2514 |
+ else |
2515 |
+- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0); |
2516 |
++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt); |
2517 |
+ } |
2518 |
+ |
2519 |
+ /** |
2520 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
2521 |
+index 31f17f0bbd1c..172d3dfed0c4 100644 |
2522 |
+--- a/net/ipv4/icmp.c |
2523 |
++++ b/net/ipv4/icmp.c |
2524 |
+@@ -565,7 +565,8 @@ relookup_failed: |
2525 |
+ * MUST reply to only the first fragment. |
2526 |
+ */ |
2527 |
+ |
2528 |
+-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
2529 |
++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
2530 |
++ const struct ip_options *opt) |
2531 |
+ { |
2532 |
+ struct iphdr *iph; |
2533 |
+ int room; |
2534 |
+@@ -679,7 +680,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
2535 |
+ iph->tos; |
2536 |
+ mark = IP4_REPLY_MARK(net, skb_in->mark); |
2537 |
+ |
2538 |
+- if (ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in)) |
2539 |
++ if (__ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in, opt)) |
2540 |
+ goto out_unlock; |
2541 |
+ |
2542 |
+ |
2543 |
+@@ -731,7 +732,7 @@ out_free: |
2544 |
+ kfree(icmp_param); |
2545 |
+ out:; |
2546 |
+ } |
2547 |
+-EXPORT_SYMBOL(icmp_send); |
2548 |
++EXPORT_SYMBOL(__icmp_send); |
2549 |
+ |
2550 |
+ |
2551 |
+ static void icmp_socket_deliver(struct sk_buff *skb, u32 info) |
2552 |
+diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c |
2553 |
+index 4d158ff1def1..4cd3b5ad9cee 100644 |
2554 |
+--- a/net/ipv4/ip_options.c |
2555 |
++++ b/net/ipv4/ip_options.c |
2556 |
+@@ -253,8 +253,9 @@ static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb) |
2557 |
+ * If opt == NULL, then skb->data should point to IP header. |
2558 |
+ */ |
2559 |
+ |
2560 |
+-int ip_options_compile(struct net *net, |
2561 |
+- struct ip_options *opt, struct sk_buff *skb) |
2562 |
++int __ip_options_compile(struct net *net, |
2563 |
++ struct ip_options *opt, struct sk_buff *skb, |
2564 |
++ __be32 *info) |
2565 |
+ { |
2566 |
+ __be32 spec_dst = htonl(INADDR_ANY); |
2567 |
+ unsigned char *pp_ptr = NULL; |
2568 |
+@@ -470,11 +471,22 @@ eol: |
2569 |
+ return 0; |
2570 |
+ |
2571 |
+ error: |
2572 |
+- if (skb) { |
2573 |
+- icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24)); |
2574 |
+- } |
2575 |
++ if (info) |
2576 |
++ *info = htonl((pp_ptr-iph)<<24); |
2577 |
+ return -EINVAL; |
2578 |
+ } |
2579 |
++ |
2580 |
++int ip_options_compile(struct net *net, |
2581 |
++ struct ip_options *opt, struct sk_buff *skb) |
2582 |
++{ |
2583 |
++ int ret; |
2584 |
++ __be32 info; |
2585 |
++ |
2586 |
++ ret = __ip_options_compile(net, opt, skb, &info); |
2587 |
++ if (ret != 0 && skb) |
2588 |
++ icmp_send(skb, ICMP_PARAMETERPROB, 0, info); |
2589 |
++ return ret; |
2590 |
++} |
2591 |
+ EXPORT_SYMBOL(ip_options_compile); |
2592 |
+ |
2593 |
+ /* |
2594 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
2595 |
+index cbff0d6ff1ac..270e79f4d40e 100644 |
2596 |
+--- a/net/ipv4/ip_vti.c |
2597 |
++++ b/net/ipv4/ip_vti.c |
2598 |
+@@ -74,6 +74,33 @@ drop: |
2599 |
+ return 0; |
2600 |
+ } |
2601 |
+ |
2602 |
++static int vti_input_ipip(struct sk_buff *skb, int nexthdr, __be32 spi, |
2603 |
++ int encap_type) |
2604 |
++{ |
2605 |
++ struct ip_tunnel *tunnel; |
2606 |
++ const struct iphdr *iph = ip_hdr(skb); |
2607 |
++ struct net *net = dev_net(skb->dev); |
2608 |
++ struct ip_tunnel_net *itn = net_generic(net, vti_net_id); |
2609 |
++ |
2610 |
++ tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, |
2611 |
++ iph->saddr, iph->daddr, 0); |
2612 |
++ if (tunnel) { |
2613 |
++ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) |
2614 |
++ goto drop; |
2615 |
++ |
2616 |
++ XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; |
2617 |
++ |
2618 |
++ skb->dev = tunnel->dev; |
2619 |
++ |
2620 |
++ return xfrm_input(skb, nexthdr, spi, encap_type); |
2621 |
++ } |
2622 |
++ |
2623 |
++ return -EINVAL; |
2624 |
++drop: |
2625 |
++ kfree_skb(skb); |
2626 |
++ return 0; |
2627 |
++} |
2628 |
++ |
2629 |
+ static int vti_rcv(struct sk_buff *skb) |
2630 |
+ { |
2631 |
+ XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
2632 |
+@@ -82,6 +109,14 @@ static int vti_rcv(struct sk_buff *skb) |
2633 |
+ return vti_input(skb, ip_hdr(skb)->protocol, 0, 0); |
2634 |
+ } |
2635 |
+ |
2636 |
++static int vti_rcv_ipip(struct sk_buff *skb) |
2637 |
++{ |
2638 |
++ XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
2639 |
++ XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); |
2640 |
++ |
2641 |
++ return vti_input_ipip(skb, ip_hdr(skb)->protocol, ip_hdr(skb)->saddr, 0); |
2642 |
++} |
2643 |
++ |
2644 |
+ static int vti_rcv_cb(struct sk_buff *skb, int err) |
2645 |
+ { |
2646 |
+ unsigned short family; |
2647 |
+@@ -439,6 +474,12 @@ static struct xfrm4_protocol vti_ipcomp4_protocol __read_mostly = { |
2648 |
+ .priority = 100, |
2649 |
+ }; |
2650 |
+ |
2651 |
++static struct xfrm_tunnel ipip_handler __read_mostly = { |
2652 |
++ .handler = vti_rcv_ipip, |
2653 |
++ .err_handler = vti4_err, |
2654 |
++ .priority = 0, |
2655 |
++}; |
2656 |
++ |
2657 |
+ static int __net_init vti_init_net(struct net *net) |
2658 |
+ { |
2659 |
+ int err; |
2660 |
+@@ -622,6 +663,13 @@ static int __init vti_init(void) |
2661 |
+ if (err < 0) |
2662 |
+ goto xfrm_proto_comp_failed; |
2663 |
+ |
2664 |
++ msg = "ipip tunnel"; |
2665 |
++ err = xfrm4_tunnel_register(&ipip_handler, AF_INET); |
2666 |
++ if (err < 0) { |
2667 |
++ pr_info("%s: cant't register tunnel\n",__func__); |
2668 |
++ goto xfrm_tunnel_failed; |
2669 |
++ } |
2670 |
++ |
2671 |
+ msg = "netlink interface"; |
2672 |
+ err = rtnl_link_register(&vti_link_ops); |
2673 |
+ if (err < 0) |
2674 |
+@@ -631,6 +679,8 @@ static int __init vti_init(void) |
2675 |
+ |
2676 |
+ rtnl_link_failed: |
2677 |
+ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
2678 |
++xfrm_tunnel_failed: |
2679 |
++ xfrm4_tunnel_deregister(&ipip_handler, AF_INET); |
2680 |
+ xfrm_proto_comp_failed: |
2681 |
+ xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
2682 |
+ xfrm_proto_ah_failed: |
2683 |
+diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c |
2684 |
+index ad597b4b22a0..41f67629ae59 100644 |
2685 |
+--- a/net/ipv6/ip6mr.c |
2686 |
++++ b/net/ipv6/ip6mr.c |
2687 |
+@@ -1992,10 +1992,10 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) |
2688 |
+ |
2689 |
+ static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct sk_buff *skb) |
2690 |
+ { |
2691 |
+- __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
2692 |
+- IPSTATS_MIB_OUTFORWDATAGRAMS); |
2693 |
+- __IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)), |
2694 |
+- IPSTATS_MIB_OUTOCTETS, skb->len); |
2695 |
++ IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
2696 |
++ IPSTATS_MIB_OUTFORWDATAGRAMS); |
2697 |
++ IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)), |
2698 |
++ IPSTATS_MIB_OUTOCTETS, skb->len); |
2699 |
+ return dst_output(net, sk, skb); |
2700 |
+ } |
2701 |
+ |
2702 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
2703 |
+index 4381ea53fa91..75de3dd8b862 100644 |
2704 |
+--- a/net/ipv6/sit.c |
2705 |
++++ b/net/ipv6/sit.c |
2706 |
+@@ -1851,6 +1851,7 @@ static int __net_init sit_init_net(struct net *net) |
2707 |
+ |
2708 |
+ err_reg_dev: |
2709 |
+ ipip6_dev_free(sitn->fb_tunnel_dev); |
2710 |
++ free_netdev(sitn->fb_tunnel_dev); |
2711 |
+ err_alloc_dev: |
2712 |
+ return err; |
2713 |
+ } |
2714 |
+diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
2715 |
+index 8382b7880b24..8037b25ddb76 100644 |
2716 |
+--- a/net/netfilter/ipvs/ip_vs_ctl.c |
2717 |
++++ b/net/netfilter/ipvs/ip_vs_ctl.c |
2718 |
+@@ -2258,6 +2258,18 @@ static int ip_vs_set_timeout(struct netns_ipvs *ipvs, struct ip_vs_timeout_user |
2719 |
+ u->tcp_fin_timeout, |
2720 |
+ u->udp_timeout); |
2721 |
+ |
2722 |
++#ifdef CONFIG_IP_VS_PROTO_TCP |
2723 |
++ if (u->tcp_timeout < 0 || u->tcp_timeout > (INT_MAX / HZ) || |
2724 |
++ u->tcp_fin_timeout < 0 || u->tcp_fin_timeout > (INT_MAX / HZ)) { |
2725 |
++ return -EINVAL; |
2726 |
++ } |
2727 |
++#endif |
2728 |
++ |
2729 |
++#ifdef CONFIG_IP_VS_PROTO_UDP |
2730 |
++ if (u->udp_timeout < 0 || u->udp_timeout > (INT_MAX / HZ)) |
2731 |
++ return -EINVAL; |
2732 |
++#endif |
2733 |
++ |
2734 |
+ #ifdef CONFIG_IP_VS_PROTO_TCP |
2735 |
+ if (u->tcp_timeout) { |
2736 |
+ pd = ip_vs_proto_data_get(ipvs, IPPROTO_TCP); |
2737 |
+diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
2738 |
+index 19b3f4fbea52..df1d5618b008 100644 |
2739 |
+--- a/net/netfilter/nf_conntrack_core.c |
2740 |
++++ b/net/netfilter/nf_conntrack_core.c |
2741 |
+@@ -855,6 +855,22 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, |
2742 |
+ } |
2743 |
+ |
2744 |
+ if (nf_ct_key_equal(h, tuple, zone, net)) { |
2745 |
++ /* Tuple is taken already, so caller will need to find |
2746 |
++ * a new source port to use. |
2747 |
++ * |
2748 |
++ * Only exception: |
2749 |
++ * If the *original tuples* are identical, then both |
2750 |
++ * conntracks refer to the same flow. |
2751 |
++ * This is a rare situation, it can occur e.g. when |
2752 |
++ * more than one UDP packet is sent from same socket |
2753 |
++ * in different threads. |
2754 |
++ * |
2755 |
++ * Let nf_ct_resolve_clash() deal with this later. |
2756 |
++ */ |
2757 |
++ if (nf_ct_tuple_equal(&ignored_conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple, |
2758 |
++ &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple)) |
2759 |
++ continue; |
2760 |
++ |
2761 |
+ NF_CT_STAT_INC_ATOMIC(net, found); |
2762 |
+ rcu_read_unlock(); |
2763 |
+ return 1; |
2764 |
+diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c |
2765 |
+index 28c56b95fb7f..cb9d1d1210cb 100644 |
2766 |
+--- a/net/netlabel/netlabel_kapi.c |
2767 |
++++ b/net/netlabel/netlabel_kapi.c |
2768 |
+@@ -903,7 +903,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, |
2769 |
+ (state == 0 && (byte & bitmask) == 0)) |
2770 |
+ return bit_spot; |
2771 |
+ |
2772 |
+- bit_spot++; |
2773 |
++ if (++bit_spot >= bitmap_len) |
2774 |
++ return -1; |
2775 |
+ bitmask >>= 1; |
2776 |
+ if (bitmask == 0) { |
2777 |
+ byte = bitmap[++byte_offset]; |
2778 |
+diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c |
2779 |
+index 04759a0c3273..6ba829f2df91 100644 |
2780 |
+--- a/net/nfc/llcp_commands.c |
2781 |
++++ b/net/nfc/llcp_commands.c |
2782 |
+@@ -419,6 +419,10 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) |
2783 |
+ sock->service_name, |
2784 |
+ sock->service_name_len, |
2785 |
+ &service_name_tlv_length); |
2786 |
++ if (!service_name_tlv) { |
2787 |
++ err = -ENOMEM; |
2788 |
++ goto error_tlv; |
2789 |
++ } |
2790 |
+ size += service_name_tlv_length; |
2791 |
+ } |
2792 |
+ |
2793 |
+@@ -429,9 +433,17 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) |
2794 |
+ |
2795 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, |
2796 |
+ &miux_tlv_length); |
2797 |
++ if (!miux_tlv) { |
2798 |
++ err = -ENOMEM; |
2799 |
++ goto error_tlv; |
2800 |
++ } |
2801 |
+ size += miux_tlv_length; |
2802 |
+ |
2803 |
+ rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length); |
2804 |
++ if (!rw_tlv) { |
2805 |
++ err = -ENOMEM; |
2806 |
++ goto error_tlv; |
2807 |
++ } |
2808 |
+ size += rw_tlv_length; |
2809 |
+ |
2810 |
+ pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len); |
2811 |
+@@ -484,9 +496,17 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) |
2812 |
+ |
2813 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0, |
2814 |
+ &miux_tlv_length); |
2815 |
++ if (!miux_tlv) { |
2816 |
++ err = -ENOMEM; |
2817 |
++ goto error_tlv; |
2818 |
++ } |
2819 |
+ size += miux_tlv_length; |
2820 |
+ |
2821 |
+ rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length); |
2822 |
++ if (!rw_tlv) { |
2823 |
++ err = -ENOMEM; |
2824 |
++ goto error_tlv; |
2825 |
++ } |
2826 |
+ size += rw_tlv_length; |
2827 |
+ |
2828 |
+ skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size); |
2829 |
+diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c |
2830 |
+index e69786c6804c..a121d796fa51 100644 |
2831 |
+--- a/net/nfc/llcp_core.c |
2832 |
++++ b/net/nfc/llcp_core.c |
2833 |
+@@ -532,10 +532,10 @@ static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local) |
2834 |
+ |
2835 |
+ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) |
2836 |
+ { |
2837 |
+- u8 *gb_cur, *version_tlv, version, version_length; |
2838 |
+- u8 *lto_tlv, lto_length; |
2839 |
+- u8 *wks_tlv, wks_length; |
2840 |
+- u8 *miux_tlv, miux_length; |
2841 |
++ u8 *gb_cur, version, version_length; |
2842 |
++ u8 lto_length, wks_length, miux_length; |
2843 |
++ u8 *version_tlv = NULL, *lto_tlv = NULL, |
2844 |
++ *wks_tlv = NULL, *miux_tlv = NULL; |
2845 |
+ __be16 wks = cpu_to_be16(local->local_wks); |
2846 |
+ u8 gb_len = 0; |
2847 |
+ int ret = 0; |
2848 |
+@@ -543,17 +543,33 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) |
2849 |
+ version = LLCP_VERSION_11; |
2850 |
+ version_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &version, |
2851 |
+ 1, &version_length); |
2852 |
++ if (!version_tlv) { |
2853 |
++ ret = -ENOMEM; |
2854 |
++ goto out; |
2855 |
++ } |
2856 |
+ gb_len += version_length; |
2857 |
+ |
2858 |
+ lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &local->lto, 1, <o_length); |
2859 |
++ if (!lto_tlv) { |
2860 |
++ ret = -ENOMEM; |
2861 |
++ goto out; |
2862 |
++ } |
2863 |
+ gb_len += lto_length; |
2864 |
+ |
2865 |
+ pr_debug("Local wks 0x%lx\n", local->local_wks); |
2866 |
+ wks_tlv = nfc_llcp_build_tlv(LLCP_TLV_WKS, (u8 *)&wks, 2, &wks_length); |
2867 |
++ if (!wks_tlv) { |
2868 |
++ ret = -ENOMEM; |
2869 |
++ goto out; |
2870 |
++ } |
2871 |
+ gb_len += wks_length; |
2872 |
+ |
2873 |
+ miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0, |
2874 |
+ &miux_length); |
2875 |
++ if (!miux_tlv) { |
2876 |
++ ret = -ENOMEM; |
2877 |
++ goto out; |
2878 |
++ } |
2879 |
+ gb_len += miux_length; |
2880 |
+ |
2881 |
+ gb_len += ARRAY_SIZE(llcp_magic); |
2882 |
+diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c |
2883 |
+index 2e417c907a28..e9812e21dbc9 100644 |
2884 |
+--- a/net/sched/sch_netem.c |
2885 |
++++ b/net/sched/sch_netem.c |
2886 |
+@@ -441,6 +441,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2887 |
+ int nb = 0; |
2888 |
+ int count = 1; |
2889 |
+ int rc = NET_XMIT_SUCCESS; |
2890 |
++ int rc_drop = NET_XMIT_DROP; |
2891 |
+ |
2892 |
+ /* Do not fool qdisc_drop_all() */ |
2893 |
+ skb->prev = NULL; |
2894 |
+@@ -480,6 +481,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2895 |
+ q->duplicate = 0; |
2896 |
+ rootq->enqueue(skb2, rootq, to_free); |
2897 |
+ q->duplicate = dupsave; |
2898 |
++ rc_drop = NET_XMIT_SUCCESS; |
2899 |
+ } |
2900 |
+ |
2901 |
+ /* |
2902 |
+@@ -492,7 +494,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2903 |
+ if (skb_is_gso(skb)) { |
2904 |
+ segs = netem_segment(skb, sch, to_free); |
2905 |
+ if (!segs) |
2906 |
+- return NET_XMIT_DROP; |
2907 |
++ return rc_drop; |
2908 |
+ } else { |
2909 |
+ segs = skb; |
2910 |
+ } |
2911 |
+@@ -515,8 +517,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2912 |
+ 1<<(prandom_u32() % 8); |
2913 |
+ } |
2914 |
+ |
2915 |
+- if (unlikely(sch->q.qlen >= sch->limit)) |
2916 |
+- return qdisc_drop_all(skb, sch, to_free); |
2917 |
++ if (unlikely(sch->q.qlen >= sch->limit)) { |
2918 |
++ qdisc_drop_all(skb, sch, to_free); |
2919 |
++ return rc_drop; |
2920 |
++ } |
2921 |
+ |
2922 |
+ qdisc_qstats_backlog_inc(sch, skb); |
2923 |
+ |
2924 |
+diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c |
2925 |
+index 936d7eee62d0..f66a6010ae07 100644 |
2926 |
+--- a/net/vmw_vsock/virtio_transport.c |
2927 |
++++ b/net/vmw_vsock/virtio_transport.c |
2928 |
+@@ -71,6 +71,9 @@ static u32 virtio_transport_get_local_cid(void) |
2929 |
+ { |
2930 |
+ struct virtio_vsock *vsock = virtio_vsock_get(); |
2931 |
+ |
2932 |
++ if (!vsock) |
2933 |
++ return VMADDR_CID_ANY; |
2934 |
++ |
2935 |
+ return vsock->guest_cid; |
2936 |
+ } |
2937 |
+ |
2938 |
+@@ -495,10 +498,6 @@ static int virtio_vsock_probe(struct virtio_device *vdev) |
2939 |
+ |
2940 |
+ virtio_vsock_update_guest_cid(vsock); |
2941 |
+ |
2942 |
+- ret = vsock_core_init(&virtio_transport.transport); |
2943 |
+- if (ret < 0) |
2944 |
+- goto out_vqs; |
2945 |
+- |
2946 |
+ vsock->rx_buf_nr = 0; |
2947 |
+ vsock->rx_buf_max_nr = 0; |
2948 |
+ atomic_set(&vsock->queued_replies, 0); |
2949 |
+@@ -526,8 +525,6 @@ static int virtio_vsock_probe(struct virtio_device *vdev) |
2950 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
2951 |
+ return 0; |
2952 |
+ |
2953 |
+-out_vqs: |
2954 |
+- vsock->vdev->config->del_vqs(vsock->vdev); |
2955 |
+ out: |
2956 |
+ kfree(vsock); |
2957 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
2958 |
+@@ -544,6 +541,9 @@ static void virtio_vsock_remove(struct virtio_device *vdev) |
2959 |
+ flush_work(&vsock->event_work); |
2960 |
+ flush_work(&vsock->send_pkt_work); |
2961 |
+ |
2962 |
++ /* Reset all connected sockets when the device disappear */ |
2963 |
++ vsock_for_each_connected_socket(virtio_vsock_reset_sock); |
2964 |
++ |
2965 |
+ vdev->config->reset(vdev); |
2966 |
+ |
2967 |
+ mutex_lock(&vsock->rx_lock); |
2968 |
+@@ -567,7 +567,6 @@ static void virtio_vsock_remove(struct virtio_device *vdev) |
2969 |
+ |
2970 |
+ mutex_lock(&the_virtio_vsock_mutex); |
2971 |
+ the_virtio_vsock = NULL; |
2972 |
+- vsock_core_exit(); |
2973 |
+ mutex_unlock(&the_virtio_vsock_mutex); |
2974 |
+ |
2975 |
+ vdev->config->del_vqs(vdev); |
2976 |
+@@ -600,14 +599,28 @@ static int __init virtio_vsock_init(void) |
2977 |
+ virtio_vsock_workqueue = alloc_workqueue("virtio_vsock", 0, 0); |
2978 |
+ if (!virtio_vsock_workqueue) |
2979 |
+ return -ENOMEM; |
2980 |
++ |
2981 |
+ ret = register_virtio_driver(&virtio_vsock_driver); |
2982 |
+ if (ret) |
2983 |
+- destroy_workqueue(virtio_vsock_workqueue); |
2984 |
++ goto out_wq; |
2985 |
++ |
2986 |
++ ret = vsock_core_init(&virtio_transport.transport); |
2987 |
++ if (ret) |
2988 |
++ goto out_vdr; |
2989 |
++ |
2990 |
++ return 0; |
2991 |
++ |
2992 |
++out_vdr: |
2993 |
++ unregister_virtio_driver(&virtio_vsock_driver); |
2994 |
++out_wq: |
2995 |
++ destroy_workqueue(virtio_vsock_workqueue); |
2996 |
+ return ret; |
2997 |
++ |
2998 |
+ } |
2999 |
+ |
3000 |
+ static void __exit virtio_vsock_exit(void) |
3001 |
+ { |
3002 |
++ vsock_core_exit(); |
3003 |
+ unregister_virtio_driver(&virtio_vsock_driver); |
3004 |
+ destroy_workqueue(virtio_vsock_workqueue); |
3005 |
+ } |
3006 |
+diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c |
3007 |
+index 2c0b52264a46..a625cb1500f9 100644 |
3008 |
+--- a/tools/perf/util/cpumap.c |
3009 |
++++ b/tools/perf/util/cpumap.c |
3010 |
+@@ -129,7 +129,12 @@ struct cpu_map *cpu_map__new(const char *cpu_list) |
3011 |
+ if (!cpu_list) |
3012 |
+ return cpu_map__read_all_cpu_map(); |
3013 |
+ |
3014 |
+- if (!isdigit(*cpu_list)) |
3015 |
++ /* |
3016 |
++ * must handle the case of empty cpumap to cover |
3017 |
++ * TOPOLOGY header for NUMA nodes with no CPU |
3018 |
++ * ( e.g., because of CPU hotplug) |
3019 |
++ */ |
3020 |
++ if (!isdigit(*cpu_list) && *cpu_list != '\0') |
3021 |
+ goto out; |
3022 |
+ |
3023 |
+ while (isdigit(*cpu_list)) { |
3024 |
+@@ -176,8 +181,10 @@ struct cpu_map *cpu_map__new(const char *cpu_list) |
3025 |
+ |
3026 |
+ if (nr_cpus > 0) |
3027 |
+ cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); |
3028 |
+- else |
3029 |
++ else if (*cpu_list != '\0') |
3030 |
+ cpus = cpu_map__default_new(); |
3031 |
++ else |
3032 |
++ cpus = cpu_map__dummy_new(); |
3033 |
+ invalid: |
3034 |
+ free(tmp_cpus); |
3035 |
+ out: |
3036 |
+diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c |
3037 |
+index adbc6c02c3aa..20ba5a9aeae4 100644 |
3038 |
+--- a/tools/perf/util/symbol-elf.c |
3039 |
++++ b/tools/perf/util/symbol-elf.c |
3040 |
+@@ -85,6 +85,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) |
3041 |
+ return GELF_ST_TYPE(sym->st_info); |
3042 |
+ } |
3043 |
+ |
3044 |
++static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) |
3045 |
++{ |
3046 |
++ return GELF_ST_VISIBILITY(sym->st_other); |
3047 |
++} |
3048 |
++ |
3049 |
+ #ifndef STT_GNU_IFUNC |
3050 |
+ #define STT_GNU_IFUNC 10 |
3051 |
+ #endif |
3052 |
+@@ -109,7 +114,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) |
3053 |
+ return elf_sym__type(sym) == STT_NOTYPE && |
3054 |
+ sym->st_name != 0 && |
3055 |
+ sym->st_shndx != SHN_UNDEF && |
3056 |
+- sym->st_shndx != SHN_ABS; |
3057 |
++ sym->st_shndx != SHN_ABS && |
3058 |
++ elf_sym__visibility(sym) != STV_HIDDEN && |
3059 |
++ elf_sym__visibility(sym) != STV_INTERNAL; |
3060 |
+ } |
3061 |
+ |
3062 |
+ static bool elf_sym__is_a(GElf_Sym *sym, enum map_type type) |
3063 |
+diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile |
3064 |
+index 47ed6cef93fb..c9ff2b47bd1c 100644 |
3065 |
+--- a/tools/testing/selftests/netfilter/Makefile |
3066 |
++++ b/tools/testing/selftests/netfilter/Makefile |
3067 |
+@@ -1,6 +1,6 @@ |
3068 |
+ # SPDX-License-Identifier: GPL-2.0 |
3069 |
+ # Makefile for netfilter selftests |
3070 |
+ |
3071 |
+-TEST_PROGS := nft_trans_stress.sh |
3072 |
++TEST_PROGS := nft_trans_stress.sh nft_nat.sh |
3073 |
+ |
3074 |
+ include ../lib.mk |
3075 |
+diff --git a/tools/testing/selftests/netfilter/config b/tools/testing/selftests/netfilter/config |
3076 |
+index 1017313e41a8..59caa8f71cd8 100644 |
3077 |
+--- a/tools/testing/selftests/netfilter/config |
3078 |
++++ b/tools/testing/selftests/netfilter/config |
3079 |
+@@ -1,2 +1,2 @@ |
3080 |
+ CONFIG_NET_NS=y |
3081 |
+-NF_TABLES_INET=y |
3082 |
++CONFIG_NF_TABLES_INET=y |
3083 |
+diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh |
3084 |
+new file mode 100755 |
3085 |
+index 000000000000..8ec76681605c |
3086 |
+--- /dev/null |
3087 |
++++ b/tools/testing/selftests/netfilter/nft_nat.sh |
3088 |
+@@ -0,0 +1,762 @@ |
3089 |
++#!/bin/bash |
3090 |
++# |
3091 |
++# This test is for basic NAT functionality: snat, dnat, redirect, masquerade. |
3092 |
++# |
3093 |
++ |
3094 |
++# Kselftest framework requirement - SKIP code is 4. |
3095 |
++ksft_skip=4 |
3096 |
++ret=0 |
3097 |
++ |
3098 |
++nft --version > /dev/null 2>&1 |
3099 |
++if [ $? -ne 0 ];then |
3100 |
++ echo "SKIP: Could not run test without nft tool" |
3101 |
++ exit $ksft_skip |
3102 |
++fi |
3103 |
++ |
3104 |
++ip -Version > /dev/null 2>&1 |
3105 |
++if [ $? -ne 0 ];then |
3106 |
++ echo "SKIP: Could not run test without ip tool" |
3107 |
++ exit $ksft_skip |
3108 |
++fi |
3109 |
++ |
3110 |
++ip netns add ns0 |
3111 |
++ip netns add ns1 |
3112 |
++ip netns add ns2 |
3113 |
++ |
3114 |
++ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 |
3115 |
++ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 |
3116 |
++ |
3117 |
++ip -net ns0 link set lo up |
3118 |
++ip -net ns0 link set veth0 up |
3119 |
++ip -net ns0 addr add 10.0.1.1/24 dev veth0 |
3120 |
++ip -net ns0 addr add dead:1::1/64 dev veth0 |
3121 |
++ |
3122 |
++ip -net ns0 link set veth1 up |
3123 |
++ip -net ns0 addr add 10.0.2.1/24 dev veth1 |
3124 |
++ip -net ns0 addr add dead:2::1/64 dev veth1 |
3125 |
++ |
3126 |
++for i in 1 2; do |
3127 |
++ ip -net ns$i link set lo up |
3128 |
++ ip -net ns$i link set eth0 up |
3129 |
++ ip -net ns$i addr add 10.0.$i.99/24 dev eth0 |
3130 |
++ ip -net ns$i route add default via 10.0.$i.1 |
3131 |
++ ip -net ns$i addr add dead:$i::99/64 dev eth0 |
3132 |
++ ip -net ns$i route add default via dead:$i::1 |
3133 |
++done |
3134 |
++ |
3135 |
++bad_counter() |
3136 |
++{ |
3137 |
++ local ns=$1 |
3138 |
++ local counter=$2 |
3139 |
++ local expect=$3 |
3140 |
++ |
3141 |
++ echo "ERROR: $counter counter in $ns has unexpected value (expected $expect)" 1>&2 |
3142 |
++ ip netns exec $ns nft list counter inet filter $counter 1>&2 |
3143 |
++} |
3144 |
++ |
3145 |
++check_counters() |
3146 |
++{ |
3147 |
++ ns=$1 |
3148 |
++ local lret=0 |
3149 |
++ |
3150 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0in | grep -q "packets 1 bytes 84") |
3151 |
++ if [ $? -ne 0 ]; then |
3152 |
++ bad_counter $ns ns0in "packets 1 bytes 84" |
3153 |
++ lret=1 |
3154 |
++ fi |
3155 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0out | grep -q "packets 1 bytes 84") |
3156 |
++ if [ $? -ne 0 ]; then |
3157 |
++ bad_counter $ns ns0out "packets 1 bytes 84" |
3158 |
++ lret=1 |
3159 |
++ fi |
3160 |
++ |
3161 |
++ expect="packets 1 bytes 104" |
3162 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0in6 | grep -q "$expect") |
3163 |
++ if [ $? -ne 0 ]; then |
3164 |
++ bad_counter $ns ns0in6 "$expect" |
3165 |
++ lret=1 |
3166 |
++ fi |
3167 |
++ cnt=$(ip netns exec $ns nft list counter inet filter ns0out6 | grep -q "$expect") |
3168 |
++ if [ $? -ne 0 ]; then |
3169 |
++ bad_counter $ns ns0out6 "$expect" |
3170 |
++ lret=1 |
3171 |
++ fi |
3172 |
++ |
3173 |
++ return $lret |
3174 |
++} |
3175 |
++ |
3176 |
++check_ns0_counters() |
3177 |
++{ |
3178 |
++ local ns=$1 |
3179 |
++ local lret=0 |
3180 |
++ |
3181 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") |
3182 |
++ if [ $? -ne 0 ]; then |
3183 |
++ bad_counter ns0 ns0in "packets 0 bytes 0" |
3184 |
++ lret=1 |
3185 |
++ fi |
3186 |
++ |
3187 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") |
3188 |
++ if [ $? -ne 0 ]; then |
3189 |
++ bad_counter ns0 ns0in6 "packets 0 bytes 0" |
3190 |
++ lret=1 |
3191 |
++ fi |
3192 |
++ |
3193 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") |
3194 |
++ if [ $? -ne 0 ]; then |
3195 |
++ bad_counter ns0 ns0out "packets 0 bytes 0" |
3196 |
++ lret=1 |
3197 |
++ fi |
3198 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") |
3199 |
++ if [ $? -ne 0 ]; then |
3200 |
++ bad_counter ns0 ns0out6 "packets 0 bytes 0" |
3201 |
++ lret=1 |
3202 |
++ fi |
3203 |
++ |
3204 |
++ for dir in "in" "out" ; do |
3205 |
++ expect="packets 1 bytes 84" |
3206 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir} | grep -q "$expect") |
3207 |
++ if [ $? -ne 0 ]; then |
3208 |
++ bad_counter ns0 $ns$dir "$expect" |
3209 |
++ lret=1 |
3210 |
++ fi |
3211 |
++ |
3212 |
++ expect="packets 1 bytes 104" |
3213 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") |
3214 |
++ if [ $? -ne 0 ]; then |
3215 |
++ bad_counter ns0 $ns$dir6 "$expect" |
3216 |
++ lret=1 |
3217 |
++ fi |
3218 |
++ done |
3219 |
++ |
3220 |
++ return $lret |
3221 |
++} |
3222 |
++ |
3223 |
++reset_counters() |
3224 |
++{ |
3225 |
++ for i in 0 1 2;do |
3226 |
++ ip netns exec ns$i nft reset counters inet > /dev/null |
3227 |
++ done |
3228 |
++} |
3229 |
++ |
3230 |
++test_local_dnat6() |
3231 |
++{ |
3232 |
++ local lret=0 |
3233 |
++ip netns exec ns0 nft -f - <<EOF |
3234 |
++table ip6 nat { |
3235 |
++ chain output { |
3236 |
++ type nat hook output priority 0; policy accept; |
3237 |
++ ip6 daddr dead:1::99 dnat to dead:2::99 |
3238 |
++ } |
3239 |
++} |
3240 |
++EOF |
3241 |
++ if [ $? -ne 0 ]; then |
3242 |
++ echo "SKIP: Could not add add ip6 dnat hook" |
3243 |
++ return $ksft_skip |
3244 |
++ fi |
3245 |
++ |
3246 |
++ # ping netns1, expect rewrite to netns2 |
3247 |
++ ip netns exec ns0 ping -q -c 1 dead:1::99 > /dev/null |
3248 |
++ if [ $? -ne 0 ]; then |
3249 |
++ lret=1 |
3250 |
++ echo "ERROR: ping6 failed" |
3251 |
++ return $lret |
3252 |
++ fi |
3253 |
++ |
3254 |
++ expect="packets 0 bytes 0" |
3255 |
++ for dir in "in6" "out6" ; do |
3256 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3257 |
++ if [ $? -ne 0 ]; then |
3258 |
++ bad_counter ns0 ns1$dir "$expect" |
3259 |
++ lret=1 |
3260 |
++ fi |
3261 |
++ done |
3262 |
++ |
3263 |
++ expect="packets 1 bytes 104" |
3264 |
++ for dir in "in6" "out6" ; do |
3265 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3266 |
++ if [ $? -ne 0 ]; then |
3267 |
++ bad_counter ns0 ns2$dir "$expect" |
3268 |
++ lret=1 |
3269 |
++ fi |
3270 |
++ done |
3271 |
++ |
3272 |
++ # expect 0 count in ns1 |
3273 |
++ expect="packets 0 bytes 0" |
3274 |
++ for dir in "in6" "out6" ; do |
3275 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3276 |
++ if [ $? -ne 0 ]; then |
3277 |
++ bad_counter ns1 ns0$dir "$expect" |
3278 |
++ lret=1 |
3279 |
++ fi |
3280 |
++ done |
3281 |
++ |
3282 |
++ # expect 1 packet in ns2 |
3283 |
++ expect="packets 1 bytes 104" |
3284 |
++ for dir in "in6" "out6" ; do |
3285 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3286 |
++ if [ $? -ne 0 ]; then |
3287 |
++ bad_counter ns2 ns0$dir "$expect" |
3288 |
++ lret=1 |
3289 |
++ fi |
3290 |
++ done |
3291 |
++ |
3292 |
++ test $lret -eq 0 && echo "PASS: ipv6 ping to ns1 was NATted to ns2" |
3293 |
++ ip netns exec ns0 nft flush chain ip6 nat output |
3294 |
++ |
3295 |
++ return $lret |
3296 |
++} |
3297 |
++ |
3298 |
++test_local_dnat() |
3299 |
++{ |
3300 |
++ local lret=0 |
3301 |
++ip netns exec ns0 nft -f - <<EOF |
3302 |
++table ip nat { |
3303 |
++ chain output { |
3304 |
++ type nat hook output priority 0; policy accept; |
3305 |
++ ip daddr 10.0.1.99 dnat to 10.0.2.99 |
3306 |
++ } |
3307 |
++} |
3308 |
++EOF |
3309 |
++ # ping netns1, expect rewrite to netns2 |
3310 |
++ ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
3311 |
++ if [ $? -ne 0 ]; then |
3312 |
++ lret=1 |
3313 |
++ echo "ERROR: ping failed" |
3314 |
++ return $lret |
3315 |
++ fi |
3316 |
++ |
3317 |
++ expect="packets 0 bytes 0" |
3318 |
++ for dir in "in" "out" ; do |
3319 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3320 |
++ if [ $? -ne 0 ]; then |
3321 |
++ bad_counter ns0 ns1$dir "$expect" |
3322 |
++ lret=1 |
3323 |
++ fi |
3324 |
++ done |
3325 |
++ |
3326 |
++ expect="packets 1 bytes 84" |
3327 |
++ for dir in "in" "out" ; do |
3328 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3329 |
++ if [ $? -ne 0 ]; then |
3330 |
++ bad_counter ns0 ns2$dir "$expect" |
3331 |
++ lret=1 |
3332 |
++ fi |
3333 |
++ done |
3334 |
++ |
3335 |
++ # expect 0 count in ns1 |
3336 |
++ expect="packets 0 bytes 0" |
3337 |
++ for dir in "in" "out" ; do |
3338 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3339 |
++ if [ $? -ne 0 ]; then |
3340 |
++ bad_counter ns1 ns0$dir "$expect" |
3341 |
++ lret=1 |
3342 |
++ fi |
3343 |
++ done |
3344 |
++ |
3345 |
++ # expect 1 packet in ns2 |
3346 |
++ expect="packets 1 bytes 84" |
3347 |
++ for dir in "in" "out" ; do |
3348 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3349 |
++ if [ $? -ne 0 ]; then |
3350 |
++ bad_counter ns2 ns0$dir "$expect" |
3351 |
++ lret=1 |
3352 |
++ fi |
3353 |
++ done |
3354 |
++ |
3355 |
++ test $lret -eq 0 && echo "PASS: ping to ns1 was NATted to ns2" |
3356 |
++ |
3357 |
++ ip netns exec ns0 nft flush chain ip nat output |
3358 |
++ |
3359 |
++ reset_counters |
3360 |
++ ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
3361 |
++ if [ $? -ne 0 ]; then |
3362 |
++ lret=1 |
3363 |
++ echo "ERROR: ping failed" |
3364 |
++ return $lret |
3365 |
++ fi |
3366 |
++ |
3367 |
++ expect="packets 1 bytes 84" |
3368 |
++ for dir in "in" "out" ; do |
3369 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3370 |
++ if [ $? -ne 0 ]; then |
3371 |
++ bad_counter ns1 ns1$dir "$expect" |
3372 |
++ lret=1 |
3373 |
++ fi |
3374 |
++ done |
3375 |
++ expect="packets 0 bytes 0" |
3376 |
++ for dir in "in" "out" ; do |
3377 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3378 |
++ if [ $? -ne 0 ]; then |
3379 |
++ bad_counter ns0 ns2$dir "$expect" |
3380 |
++ lret=1 |
3381 |
++ fi |
3382 |
++ done |
3383 |
++ |
3384 |
++ # expect 1 count in ns1 |
3385 |
++ expect="packets 1 bytes 84" |
3386 |
++ for dir in "in" "out" ; do |
3387 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3388 |
++ if [ $? -ne 0 ]; then |
3389 |
++ bad_counter ns0 ns0$dir "$expect" |
3390 |
++ lret=1 |
3391 |
++ fi |
3392 |
++ done |
3393 |
++ |
3394 |
++ # expect 0 packet in ns2 |
3395 |
++ expect="packets 0 bytes 0" |
3396 |
++ for dir in "in" "out" ; do |
3397 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3398 |
++ if [ $? -ne 0 ]; then |
3399 |
++ bad_counter ns2 ns2$dir "$expect" |
3400 |
++ lret=1 |
3401 |
++ fi |
3402 |
++ done |
3403 |
++ |
3404 |
++ test $lret -eq 0 && echo "PASS: ping to ns1 OK after nat output chain flush" |
3405 |
++ |
3406 |
++ return $lret |
3407 |
++} |
3408 |
++ |
3409 |
++ |
3410 |
++test_masquerade6() |
3411 |
++{ |
3412 |
++ local lret=0 |
3413 |
++ |
3414 |
++ ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
3415 |
++ |
3416 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
3417 |
++ if [ $? -ne 0 ] ; then |
3418 |
++ echo "ERROR: cannot ping ns1 from ns2 via ipv6" |
3419 |
++ return 1 |
3420 |
++ lret=1 |
3421 |
++ fi |
3422 |
++ |
3423 |
++ expect="packets 1 bytes 104" |
3424 |
++ for dir in "in6" "out6" ; do |
3425 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3426 |
++ if [ $? -ne 0 ]; then |
3427 |
++ bad_counter ns1 ns2$dir "$expect" |
3428 |
++ lret=1 |
3429 |
++ fi |
3430 |
++ |
3431 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3432 |
++ if [ $? -ne 0 ]; then |
3433 |
++ bad_counter ns2 ns1$dir "$expect" |
3434 |
++ lret=1 |
3435 |
++ fi |
3436 |
++ done |
3437 |
++ |
3438 |
++ reset_counters |
3439 |
++ |
3440 |
++# add masquerading rule |
3441 |
++ip netns exec ns0 nft -f - <<EOF |
3442 |
++table ip6 nat { |
3443 |
++ chain postrouting { |
3444 |
++ type nat hook postrouting priority 0; policy accept; |
3445 |
++ meta oif veth0 masquerade |
3446 |
++ } |
3447 |
++} |
3448 |
++EOF |
3449 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
3450 |
++ if [ $? -ne 0 ] ; then |
3451 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerading" |
3452 |
++ lret=1 |
3453 |
++ fi |
3454 |
++ |
3455 |
++ # ns1 should have seen packets from ns0, due to masquerade |
3456 |
++ expect="packets 1 bytes 104" |
3457 |
++ for dir in "in6" "out6" ; do |
3458 |
++ |
3459 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3460 |
++ if [ $? -ne 0 ]; then |
3461 |
++ bad_counter ns1 ns0$dir "$expect" |
3462 |
++ lret=1 |
3463 |
++ fi |
3464 |
++ |
3465 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3466 |
++ if [ $? -ne 0 ]; then |
3467 |
++ bad_counter ns2 ns1$dir "$expect" |
3468 |
++ lret=1 |
3469 |
++ fi |
3470 |
++ done |
3471 |
++ |
3472 |
++ # ns1 should not have seen packets from ns2, due to masquerade |
3473 |
++ expect="packets 0 bytes 0" |
3474 |
++ for dir in "in6" "out6" ; do |
3475 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3476 |
++ if [ $? -ne 0 ]; then |
3477 |
++ bad_counter ns1 ns0$dir "$expect" |
3478 |
++ lret=1 |
3479 |
++ fi |
3480 |
++ |
3481 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3482 |
++ if [ $? -ne 0 ]; then |
3483 |
++ bad_counter ns2 ns1$dir "$expect" |
3484 |
++ lret=1 |
3485 |
++ fi |
3486 |
++ done |
3487 |
++ |
3488 |
++ ip netns exec ns0 nft flush chain ip6 nat postrouting |
3489 |
++ if [ $? -ne 0 ]; then |
3490 |
++ echo "ERROR: Could not flush ip6 nat postrouting" 1>&2 |
3491 |
++ lret=1 |
3492 |
++ fi |
3493 |
++ |
3494 |
++ test $lret -eq 0 && echo "PASS: IPv6 masquerade for ns2" |
3495 |
++ |
3496 |
++ return $lret |
3497 |
++} |
3498 |
++ |
3499 |
++test_masquerade() |
3500 |
++{ |
3501 |
++ local lret=0 |
3502 |
++ |
3503 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
3504 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
3505 |
++ |
3506 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
3507 |
++ if [ $? -ne 0 ] ; then |
3508 |
++ echo "ERROR: canot ping ns1 from ns2" |
3509 |
++ lret=1 |
3510 |
++ fi |
3511 |
++ |
3512 |
++ expect="packets 1 bytes 84" |
3513 |
++ for dir in "in" "out" ; do |
3514 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3515 |
++ if [ $? -ne 0 ]; then |
3516 |
++ bad_counter ns1 ns2$dir "$expect" |
3517 |
++ lret=1 |
3518 |
++ fi |
3519 |
++ |
3520 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3521 |
++ if [ $? -ne 0 ]; then |
3522 |
++ bad_counter ns2 ns1$dir "$expect" |
3523 |
++ lret=1 |
3524 |
++ fi |
3525 |
++ done |
3526 |
++ |
3527 |
++ reset_counters |
3528 |
++ |
3529 |
++# add masquerading rule |
3530 |
++ip netns exec ns0 nft -f - <<EOF |
3531 |
++table ip nat { |
3532 |
++ chain postrouting { |
3533 |
++ type nat hook postrouting priority 0; policy accept; |
3534 |
++ meta oif veth0 masquerade |
3535 |
++ } |
3536 |
++} |
3537 |
++EOF |
3538 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
3539 |
++ if [ $? -ne 0 ] ; then |
3540 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip masquerading" |
3541 |
++ lret=1 |
3542 |
++ fi |
3543 |
++ |
3544 |
++ # ns1 should have seen packets from ns0, due to masquerade |
3545 |
++ expect="packets 1 bytes 84" |
3546 |
++ for dir in "in" "out" ; do |
3547 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
3548 |
++ if [ $? -ne 0 ]; then |
3549 |
++ bad_counter ns1 ns0$dir "$expect" |
3550 |
++ lret=1 |
3551 |
++ fi |
3552 |
++ |
3553 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3554 |
++ if [ $? -ne 0 ]; then |
3555 |
++ bad_counter ns2 ns1$dir "$expect" |
3556 |
++ lret=1 |
3557 |
++ fi |
3558 |
++ done |
3559 |
++ |
3560 |
++ # ns1 should not have seen packets from ns2, due to masquerade |
3561 |
++ expect="packets 0 bytes 0" |
3562 |
++ for dir in "in" "out" ; do |
3563 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3564 |
++ if [ $? -ne 0 ]; then |
3565 |
++ bad_counter ns1 ns0$dir "$expect" |
3566 |
++ lret=1 |
3567 |
++ fi |
3568 |
++ |
3569 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3570 |
++ if [ $? -ne 0 ]; then |
3571 |
++ bad_counter ns2 ns1$dir "$expect" |
3572 |
++ lret=1 |
3573 |
++ fi |
3574 |
++ done |
3575 |
++ |
3576 |
++ ip netns exec ns0 nft flush chain ip nat postrouting |
3577 |
++ if [ $? -ne 0 ]; then |
3578 |
++ echo "ERROR: Could not flush nat postrouting" 1>&2 |
3579 |
++ lret=1 |
3580 |
++ fi |
3581 |
++ |
3582 |
++ test $lret -eq 0 && echo "PASS: IP masquerade for ns2" |
3583 |
++ |
3584 |
++ return $lret |
3585 |
++} |
3586 |
++ |
3587 |
++test_redirect6() |
3588 |
++{ |
3589 |
++ local lret=0 |
3590 |
++ |
3591 |
++ ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
3592 |
++ |
3593 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
3594 |
++ if [ $? -ne 0 ] ; then |
3595 |
++ echo "ERROR: cannnot ping ns1 from ns2 via ipv6" |
3596 |
++ lret=1 |
3597 |
++ fi |
3598 |
++ |
3599 |
++ expect="packets 1 bytes 104" |
3600 |
++ for dir in "in6" "out6" ; do |
3601 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3602 |
++ if [ $? -ne 0 ]; then |
3603 |
++ bad_counter ns1 ns2$dir "$expect" |
3604 |
++ lret=1 |
3605 |
++ fi |
3606 |
++ |
3607 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3608 |
++ if [ $? -ne 0 ]; then |
3609 |
++ bad_counter ns2 ns1$dir "$expect" |
3610 |
++ lret=1 |
3611 |
++ fi |
3612 |
++ done |
3613 |
++ |
3614 |
++ reset_counters |
3615 |
++ |
3616 |
++# add redirect rule |
3617 |
++ip netns exec ns0 nft -f - <<EOF |
3618 |
++table ip6 nat { |
3619 |
++ chain prerouting { |
3620 |
++ type nat hook prerouting priority 0; policy accept; |
3621 |
++ meta iif veth1 meta l4proto icmpv6 ip6 saddr dead:2::99 ip6 daddr dead:1::99 redirect |
3622 |
++ } |
3623 |
++} |
3624 |
++EOF |
3625 |
++ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
3626 |
++ if [ $? -ne 0 ] ; then |
3627 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip6 redirect" |
3628 |
++ lret=1 |
3629 |
++ fi |
3630 |
++ |
3631 |
++ # ns1 should have seen no packets from ns2, due to redirection |
3632 |
++ expect="packets 0 bytes 0" |
3633 |
++ for dir in "in6" "out6" ; do |
3634 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3635 |
++ if [ $? -ne 0 ]; then |
3636 |
++ bad_counter ns1 ns0$dir "$expect" |
3637 |
++ lret=1 |
3638 |
++ fi |
3639 |
++ done |
3640 |
++ |
3641 |
++ # ns0 should have seen packets from ns2, due to masquerade |
3642 |
++ expect="packets 1 bytes 104" |
3643 |
++ for dir in "in6" "out6" ; do |
3644 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3645 |
++ if [ $? -ne 0 ]; then |
3646 |
++ bad_counter ns1 ns0$dir "$expect" |
3647 |
++ lret=1 |
3648 |
++ fi |
3649 |
++ done |
3650 |
++ |
3651 |
++ ip netns exec ns0 nft delete table ip6 nat |
3652 |
++ if [ $? -ne 0 ]; then |
3653 |
++ echo "ERROR: Could not delete ip6 nat table" 1>&2 |
3654 |
++ lret=1 |
3655 |
++ fi |
3656 |
++ |
3657 |
++ test $lret -eq 0 && echo "PASS: IPv6 redirection for ns2" |
3658 |
++ |
3659 |
++ return $lret |
3660 |
++} |
3661 |
++ |
3662 |
++test_redirect() |
3663 |
++{ |
3664 |
++ local lret=0 |
3665 |
++ |
3666 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
3667 |
++ ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
3668 |
++ |
3669 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
3670 |
++ if [ $? -ne 0 ] ; then |
3671 |
++ echo "ERROR: cannot ping ns1 from ns2" |
3672 |
++ lret=1 |
3673 |
++ fi |
3674 |
++ |
3675 |
++ expect="packets 1 bytes 84" |
3676 |
++ for dir in "in" "out" ; do |
3677 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3678 |
++ if [ $? -ne 0 ]; then |
3679 |
++ bad_counter ns1 ns2$dir "$expect" |
3680 |
++ lret=1 |
3681 |
++ fi |
3682 |
++ |
3683 |
++ cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
3684 |
++ if [ $? -ne 0 ]; then |
3685 |
++ bad_counter ns2 ns1$dir "$expect" |
3686 |
++ lret=1 |
3687 |
++ fi |
3688 |
++ done |
3689 |
++ |
3690 |
++ reset_counters |
3691 |
++ |
3692 |
++# add redirect rule |
3693 |
++ip netns exec ns0 nft -f - <<EOF |
3694 |
++table ip nat { |
3695 |
++ chain prerouting { |
3696 |
++ type nat hook prerouting priority 0; policy accept; |
3697 |
++ meta iif veth1 ip protocol icmp ip saddr 10.0.2.99 ip daddr 10.0.1.99 redirect |
3698 |
++ } |
3699 |
++} |
3700 |
++EOF |
3701 |
++ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
3702 |
++ if [ $? -ne 0 ] ; then |
3703 |
++ echo "ERROR: cannot ping ns1 from ns2 with active ip redirect" |
3704 |
++ lret=1 |
3705 |
++ fi |
3706 |
++ |
3707 |
++ # ns1 should have seen no packets from ns2, due to redirection |
3708 |
++ expect="packets 0 bytes 0" |
3709 |
++ for dir in "in" "out" ; do |
3710 |
++ |
3711 |
++ cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3712 |
++ if [ $? -ne 0 ]; then |
3713 |
++ bad_counter ns1 ns0$dir "$expect" |
3714 |
++ lret=1 |
3715 |
++ fi |
3716 |
++ done |
3717 |
++ |
3718 |
++ # ns0 should have seen packets from ns2, due to masquerade |
3719 |
++ expect="packets 1 bytes 84" |
3720 |
++ for dir in "in" "out" ; do |
3721 |
++ cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
3722 |
++ if [ $? -ne 0 ]; then |
3723 |
++ bad_counter ns1 ns0$dir "$expect" |
3724 |
++ lret=1 |
3725 |
++ fi |
3726 |
++ done |
3727 |
++ |
3728 |
++ ip netns exec ns0 nft delete table ip nat |
3729 |
++ if [ $? -ne 0 ]; then |
3730 |
++ echo "ERROR: Could not delete nat table" 1>&2 |
3731 |
++ lret=1 |
3732 |
++ fi |
3733 |
++ |
3734 |
++ test $lret -eq 0 && echo "PASS: IP redirection for ns2" |
3735 |
++ |
3736 |
++ return $lret |
3737 |
++} |
3738 |
++ |
3739 |
++ |
3740 |
++# ip netns exec ns0 ping -c 1 -q 10.0.$i.99 |
3741 |
++for i in 0 1 2; do |
3742 |
++ip netns exec ns$i nft -f - <<EOF |
3743 |
++table inet filter { |
3744 |
++ counter ns0in {} |
3745 |
++ counter ns1in {} |
3746 |
++ counter ns2in {} |
3747 |
++ |
3748 |
++ counter ns0out {} |
3749 |
++ counter ns1out {} |
3750 |
++ counter ns2out {} |
3751 |
++ |
3752 |
++ counter ns0in6 {} |
3753 |
++ counter ns1in6 {} |
3754 |
++ counter ns2in6 {} |
3755 |
++ |
3756 |
++ counter ns0out6 {} |
3757 |
++ counter ns1out6 {} |
3758 |
++ counter ns2out6 {} |
3759 |
++ |
3760 |
++ map nsincounter { |
3761 |
++ type ipv4_addr : counter |
3762 |
++ elements = { 10.0.1.1 : "ns0in", |
3763 |
++ 10.0.2.1 : "ns0in", |
3764 |
++ 10.0.1.99 : "ns1in", |
3765 |
++ 10.0.2.99 : "ns2in" } |
3766 |
++ } |
3767 |
++ |
3768 |
++ map nsincounter6 { |
3769 |
++ type ipv6_addr : counter |
3770 |
++ elements = { dead:1::1 : "ns0in6", |
3771 |
++ dead:2::1 : "ns0in6", |
3772 |
++ dead:1::99 : "ns1in6", |
3773 |
++ dead:2::99 : "ns2in6" } |
3774 |
++ } |
3775 |
++ |
3776 |
++ map nsoutcounter { |
3777 |
++ type ipv4_addr : counter |
3778 |
++ elements = { 10.0.1.1 : "ns0out", |
3779 |
++ 10.0.2.1 : "ns0out", |
3780 |
++ 10.0.1.99: "ns1out", |
3781 |
++ 10.0.2.99: "ns2out" } |
3782 |
++ } |
3783 |
++ |
3784 |
++ map nsoutcounter6 { |
3785 |
++ type ipv6_addr : counter |
3786 |
++ elements = { dead:1::1 : "ns0out6", |
3787 |
++ dead:2::1 : "ns0out6", |
3788 |
++ dead:1::99 : "ns1out6", |
3789 |
++ dead:2::99 : "ns2out6" } |
3790 |
++ } |
3791 |
++ |
3792 |
++ chain input { |
3793 |
++ type filter hook input priority 0; policy accept; |
3794 |
++ counter name ip saddr map @nsincounter |
3795 |
++ icmpv6 type { "echo-request", "echo-reply" } counter name ip6 saddr map @nsincounter6 |
3796 |
++ } |
3797 |
++ chain output { |
3798 |
++ type filter hook output priority 0; policy accept; |
3799 |
++ counter name ip daddr map @nsoutcounter |
3800 |
++ icmpv6 type { "echo-request", "echo-reply" } counter name ip6 daddr map @nsoutcounter6 |
3801 |
++ } |
3802 |
++} |
3803 |
++EOF |
3804 |
++done |
3805 |
++ |
3806 |
++sleep 3 |
3807 |
++# test basic connectivity |
3808 |
++for i in 1 2; do |
3809 |
++ ip netns exec ns0 ping -c 1 -q 10.0.$i.99 > /dev/null |
3810 |
++ if [ $? -ne 0 ];then |
3811 |
++ echo "ERROR: Could not reach other namespace(s)" 1>&2 |
3812 |
++ ret=1 |
3813 |
++ fi |
3814 |
++ |
3815 |
++ ip netns exec ns0 ping -c 1 -q dead:$i::99 > /dev/null |
3816 |
++ if [ $? -ne 0 ];then |
3817 |
++ echo "ERROR: Could not reach other namespace(s) via ipv6" 1>&2 |
3818 |
++ ret=1 |
3819 |
++ fi |
3820 |
++ check_counters ns$i |
3821 |
++ if [ $? -ne 0 ]; then |
3822 |
++ ret=1 |
3823 |
++ fi |
3824 |
++ |
3825 |
++ check_ns0_counters ns$i |
3826 |
++ if [ $? -ne 0 ]; then |
3827 |
++ ret=1 |
3828 |
++ fi |
3829 |
++ reset_counters |
3830 |
++done |
3831 |
++ |
3832 |
++if [ $ret -eq 0 ];then |
3833 |
++ echo "PASS: netns routing/connectivity: ns0 can reach ns1 and ns2" |
3834 |
++fi |
3835 |
++ |
3836 |
++reset_counters |
3837 |
++test_local_dnat |
3838 |
++test_local_dnat6 |
3839 |
++ |
3840 |
++reset_counters |
3841 |
++test_masquerade |
3842 |
++test_masquerade6 |
3843 |
++ |
3844 |
++reset_counters |
3845 |
++test_redirect |
3846 |
++test_redirect6 |
3847 |
++ |
3848 |
++for i in 0 1 2; do ip netns del ns$i;done |
3849 |
++ |
3850 |
++exit $ret |