1 |
commit: e611a1958ebdf6e895280efce1cfa08b17c5b4d9 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 12 15:01:02 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 12 15:01:02 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e611a195 |
7 |
|
8 |
Linux patch 5.4.11 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1010_linux-5.4.11.patch | 5959 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 5963 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index f39e13c..940c66a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -83,6 +83,10 @@ Patch: 1009_linux-5.4.10.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.10 |
23 |
|
24 |
+Patch: 1010_linux-5.4.11.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.11 |
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/1010_linux-5.4.11.patch b/1010_linux-5.4.11.patch |
33 |
new file mode 100644 |
34 |
index 0000000..28d7a5b |
35 |
--- /dev/null |
36 |
+++ b/1010_linux-5.4.11.patch |
37 |
@@ -0,0 +1,5959 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 726bb3dacd5b..e8963f623568 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 10 |
47 |
++SUBLEVEL = 11 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/am335x-sancloud-bbe.dts b/arch/arm/boot/dts/am335x-sancloud-bbe.dts |
52 |
+index 8678e6e35493..e5fdb7abb0d5 100644 |
53 |
+--- a/arch/arm/boot/dts/am335x-sancloud-bbe.dts |
54 |
++++ b/arch/arm/boot/dts/am335x-sancloud-bbe.dts |
55 |
+@@ -108,7 +108,7 @@ |
56 |
+ |
57 |
+ &cpsw_emac0 { |
58 |
+ phy-handle = <ðphy0>; |
59 |
+- phy-mode = "rgmii-txid"; |
60 |
++ phy-mode = "rgmii-id"; |
61 |
+ }; |
62 |
+ |
63 |
+ &i2c0 { |
64 |
+diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts |
65 |
+index cae4500194fe..811c8cae315b 100644 |
66 |
+--- a/arch/arm/boot/dts/am437x-gp-evm.dts |
67 |
++++ b/arch/arm/boot/dts/am437x-gp-evm.dts |
68 |
+@@ -86,7 +86,7 @@ |
69 |
+ }; |
70 |
+ |
71 |
+ lcd0: display { |
72 |
+- compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; |
73 |
++ compatible = "osddisplays,osd070t1718-19ts", "panel-dpi"; |
74 |
+ label = "lcd"; |
75 |
+ |
76 |
+ backlight = <&lcd_bl>; |
77 |
+diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts |
78 |
+index 95314121d111..078cb473fa7d 100644 |
79 |
+--- a/arch/arm/boot/dts/am43x-epos-evm.dts |
80 |
++++ b/arch/arm/boot/dts/am43x-epos-evm.dts |
81 |
+@@ -42,7 +42,7 @@ |
82 |
+ }; |
83 |
+ |
84 |
+ lcd0: display { |
85 |
+- compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; |
86 |
++ compatible = "osddisplays,osd070t1718-19ts", "panel-dpi"; |
87 |
+ label = "lcd"; |
88 |
+ |
89 |
+ backlight = <&lcd_bl>; |
90 |
+diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi |
91 |
+index 2dac3efc7640..1bc45cfd5453 100644 |
92 |
+--- a/arch/arm/boot/dts/bcm-cygnus.dtsi |
93 |
++++ b/arch/arm/boot/dts/bcm-cygnus.dtsi |
94 |
+@@ -174,8 +174,8 @@ |
95 |
+ mdio: mdio@18002000 { |
96 |
+ compatible = "brcm,iproc-mdio"; |
97 |
+ reg = <0x18002000 0x8>; |
98 |
+- #size-cells = <1>; |
99 |
+- #address-cells = <0>; |
100 |
++ #size-cells = <0>; |
101 |
++ #address-cells = <1>; |
102 |
+ status = "disabled"; |
103 |
+ |
104 |
+ gphy0: ethernet-phy@0 { |
105 |
+diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi |
106 |
+index 2d191fcbc2cc..90125ce19a1b 100644 |
107 |
+--- a/arch/arm/boot/dts/bcm283x.dtsi |
108 |
++++ b/arch/arm/boot/dts/bcm283x.dtsi |
109 |
+@@ -40,7 +40,7 @@ |
110 |
+ |
111 |
+ trips { |
112 |
+ cpu-crit { |
113 |
+- temperature = <80000>; |
114 |
++ temperature = <90000>; |
115 |
+ hysteresis = <0>; |
116 |
+ type = "critical"; |
117 |
+ }; |
118 |
+diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi |
119 |
+index 372dc1eb88a0..2d9b4dd05830 100644 |
120 |
+--- a/arch/arm/boot/dts/bcm5301x.dtsi |
121 |
++++ b/arch/arm/boot/dts/bcm5301x.dtsi |
122 |
+@@ -353,8 +353,8 @@ |
123 |
+ mdio: mdio@18003000 { |
124 |
+ compatible = "brcm,iproc-mdio"; |
125 |
+ reg = <0x18003000 0x8>; |
126 |
+- #size-cells = <1>; |
127 |
+- #address-cells = <0>; |
128 |
++ #size-cells = <0>; |
129 |
++ #address-cells = <1>; |
130 |
+ }; |
131 |
+ |
132 |
+ mdio-bus-mux@18003000 { |
133 |
+diff --git a/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi b/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi |
134 |
+index c2a9dd57e56a..aa86341adaaa 100644 |
135 |
+--- a/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi |
136 |
++++ b/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi |
137 |
+@@ -215,7 +215,7 @@ |
138 |
+ flash0: n25q256a@0 { |
139 |
+ #address-cells = <1>; |
140 |
+ #size-cells = <1>; |
141 |
+- compatible = "micron,n25q256a"; |
142 |
++ compatible = "micron,n25q256a", "jedec,spi-nor"; |
143 |
+ spi-max-frequency = <29000000>; |
144 |
+ spi-rx-bus-width = <4>; |
145 |
+ spi-tx-bus-width = <4>; |
146 |
+diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig |
147 |
+index 08db1c83eb2d..736ed7a7bcf8 100644 |
148 |
+--- a/arch/arm/configs/exynos_defconfig |
149 |
++++ b/arch/arm/configs/exynos_defconfig |
150 |
+@@ -348,6 +348,7 @@ CONFIG_PRINTK_TIME=y |
151 |
+ CONFIG_DYNAMIC_DEBUG=y |
152 |
+ CONFIG_DEBUG_INFO=y |
153 |
+ CONFIG_MAGIC_SYSRQ=y |
154 |
++CONFIG_DEBUG_FS=y |
155 |
+ CONFIG_DEBUG_KERNEL=y |
156 |
+ CONFIG_SOFTLOCKUP_DETECTOR=y |
157 |
+ # CONFIG_DETECT_HUNG_TASK is not set |
158 |
+diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig |
159 |
+index 0f7381ee0c37..dabb80453249 100644 |
160 |
+--- a/arch/arm/configs/imx_v6_v7_defconfig |
161 |
++++ b/arch/arm/configs/imx_v6_v7_defconfig |
162 |
+@@ -460,6 +460,7 @@ CONFIG_FONT_8x8=y |
163 |
+ CONFIG_FONT_8x16=y |
164 |
+ CONFIG_PRINTK_TIME=y |
165 |
+ CONFIG_MAGIC_SYSRQ=y |
166 |
++CONFIG_DEBUG_FS=y |
167 |
+ # CONFIG_SCHED_DEBUG is not set |
168 |
+ CONFIG_PROVE_LOCKING=y |
169 |
+ # CONFIG_DEBUG_BUGVERBOSE is not set |
170 |
+diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig |
171 |
+index 40d7f1a4fc45..4ec69fb8a698 100644 |
172 |
+--- a/arch/arm/configs/omap2plus_defconfig |
173 |
++++ b/arch/arm/configs/omap2plus_defconfig |
174 |
+@@ -552,5 +552,6 @@ CONFIG_DEBUG_INFO=y |
175 |
+ CONFIG_DEBUG_INFO_SPLIT=y |
176 |
+ CONFIG_DEBUG_INFO_DWARF4=y |
177 |
+ CONFIG_MAGIC_SYSRQ=y |
178 |
++CONFIG_DEBUG_FS=y |
179 |
+ CONFIG_SCHEDSTATS=y |
180 |
+ # CONFIG_DEBUG_BUGVERBOSE is not set |
181 |
+diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c |
182 |
+index 354e0e7025ae..1da11bdb1dfb 100644 |
183 |
+--- a/arch/arm/mach-vexpress/spc.c |
184 |
++++ b/arch/arm/mach-vexpress/spc.c |
185 |
+@@ -551,8 +551,9 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) |
186 |
+ |
187 |
+ static int __init ve_spc_clk_init(void) |
188 |
+ { |
189 |
+- int cpu; |
190 |
++ int cpu, cluster; |
191 |
+ struct clk *clk; |
192 |
++ bool init_opp_table[MAX_CLUSTERS] = { false }; |
193 |
+ |
194 |
+ if (!info) |
195 |
+ return 0; /* Continue only if SPC is initialised */ |
196 |
+@@ -578,8 +579,17 @@ static int __init ve_spc_clk_init(void) |
197 |
+ continue; |
198 |
+ } |
199 |
+ |
200 |
++ cluster = topology_physical_package_id(cpu_dev->id); |
201 |
++ if (init_opp_table[cluster]) |
202 |
++ continue; |
203 |
++ |
204 |
+ if (ve_init_opp_table(cpu_dev)) |
205 |
+ pr_warn("failed to initialise cpu%d opp table\n", cpu); |
206 |
++ else if (dev_pm_opp_set_sharing_cpus(cpu_dev, |
207 |
++ topology_core_cpumask(cpu_dev->id))) |
208 |
++ pr_warn("failed to mark OPPs shared for cpu%d\n", cpu); |
209 |
++ else |
210 |
++ init_opp_table[cluster] = true; |
211 |
+ } |
212 |
+ |
213 |
+ platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0); |
214 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
215 |
+index 72b9a75976a1..bb960fe2bb64 100644 |
216 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
217 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
218 |
+@@ -102,7 +102,7 @@ |
219 |
+ |
220 |
+ reboot { |
221 |
+ compatible ="syscon-reboot"; |
222 |
+- regmap = <&dcfg>; |
223 |
++ regmap = <&rst>; |
224 |
+ offset = <0xb0>; |
225 |
+ mask = <0x02>; |
226 |
+ }; |
227 |
+@@ -161,6 +161,12 @@ |
228 |
+ big-endian; |
229 |
+ }; |
230 |
+ |
231 |
++ rst: syscon@1e60000 { |
232 |
++ compatible = "syscon"; |
233 |
++ reg = <0x0 0x1e60000 0x0 0x10000>; |
234 |
++ little-endian; |
235 |
++ }; |
236 |
++ |
237 |
+ scfg: syscon@1fc0000 { |
238 |
+ compatible = "fsl,ls1028a-scfg", "syscon"; |
239 |
+ reg = <0x0 0x1fc0000 0x0 0x10000>; |
240 |
+@@ -567,7 +573,7 @@ |
241 |
+ 0x00010004 0x0000003d |
242 |
+ 0x00010005 0x00000045 |
243 |
+ 0x00010006 0x0000004d |
244 |
+- 0x00010007 0x00000045 |
245 |
++ 0x00010007 0x00000055 |
246 |
+ 0x00010008 0x0000005e |
247 |
+ 0x00010009 0x00000066 |
248 |
+ 0x0001000a 0x0000006e |
249 |
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
250 |
+index 93f34b4eca25..96f576e9ea46 100644 |
251 |
+--- a/arch/arm64/kernel/cpu_errata.c |
252 |
++++ b/arch/arm64/kernel/cpu_errata.c |
253 |
+@@ -575,6 +575,7 @@ static const struct midr_range spectre_v2_safe_list[] = { |
254 |
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A53), |
255 |
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), |
256 |
+ MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53), |
257 |
++ MIDR_ALL_VERSIONS(MIDR_HISI_TSV110), |
258 |
+ { /* sentinel */ } |
259 |
+ }; |
260 |
+ |
261 |
+diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c |
262 |
+index a2405d5f7d1e..561154cbcc40 100644 |
263 |
+--- a/arch/mips/net/ebpf_jit.c |
264 |
++++ b/arch/mips/net/ebpf_jit.c |
265 |
+@@ -604,6 +604,7 @@ static void emit_const_to_reg(struct jit_ctx *ctx, int dst, u64 value) |
266 |
+ static int emit_bpf_tail_call(struct jit_ctx *ctx, int this_idx) |
267 |
+ { |
268 |
+ int off, b_off; |
269 |
++ int tcc_reg; |
270 |
+ |
271 |
+ ctx->flags |= EBPF_SEEN_TC; |
272 |
+ /* |
273 |
+@@ -616,14 +617,14 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx, int this_idx) |
274 |
+ b_off = b_imm(this_idx + 1, ctx); |
275 |
+ emit_instr(ctx, bne, MIPS_R_AT, MIPS_R_ZERO, b_off); |
276 |
+ /* |
277 |
+- * if (--TCC < 0) |
278 |
++ * if (TCC-- < 0) |
279 |
+ * goto out; |
280 |
+ */ |
281 |
+ /* Delay slot */ |
282 |
+- emit_instr(ctx, daddiu, MIPS_R_T5, |
283 |
+- (ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4, -1); |
284 |
++ tcc_reg = (ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4; |
285 |
++ emit_instr(ctx, daddiu, MIPS_R_T5, tcc_reg, -1); |
286 |
+ b_off = b_imm(this_idx + 1, ctx); |
287 |
+- emit_instr(ctx, bltz, MIPS_R_T5, b_off); |
288 |
++ emit_instr(ctx, bltz, tcc_reg, b_off); |
289 |
+ /* |
290 |
+ * prog = array->ptrs[index]; |
291 |
+ * if (prog == NULL) |
292 |
+diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h |
293 |
+index f627c37dad9c..ab5c215cf46c 100644 |
294 |
+--- a/arch/parisc/include/asm/cmpxchg.h |
295 |
++++ b/arch/parisc/include/asm/cmpxchg.h |
296 |
+@@ -44,8 +44,14 @@ __xchg(unsigned long x, __volatile__ void *ptr, int size) |
297 |
+ ** if (((unsigned long)p & 0xf) == 0) |
298 |
+ ** return __ldcw(p); |
299 |
+ */ |
300 |
+-#define xchg(ptr, x) \ |
301 |
+- ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) |
302 |
++#define xchg(ptr, x) \ |
303 |
++({ \ |
304 |
++ __typeof__(*(ptr)) __ret; \ |
305 |
++ __typeof__(*(ptr)) _x_ = (x); \ |
306 |
++ __ret = (__typeof__(*(ptr))) \ |
307 |
++ __xchg((unsigned long)_x_, (ptr), sizeof(*(ptr))); \ |
308 |
++ __ret; \ |
309 |
++}) |
310 |
+ |
311 |
+ /* bug catcher for when unsupported size is used - won't link */ |
312 |
+ extern void __cmpxchg_called_with_bad_pointer(void); |
313 |
+diff --git a/arch/parisc/include/asm/kexec.h b/arch/parisc/include/asm/kexec.h |
314 |
+index a99ea747d7ed..87e174006995 100644 |
315 |
+--- a/arch/parisc/include/asm/kexec.h |
316 |
++++ b/arch/parisc/include/asm/kexec.h |
317 |
+@@ -2,8 +2,6 @@ |
318 |
+ #ifndef _ASM_PARISC_KEXEC_H |
319 |
+ #define _ASM_PARISC_KEXEC_H |
320 |
+ |
321 |
+-#ifdef CONFIG_KEXEC |
322 |
+- |
323 |
+ /* Maximum physical address we can use pages from */ |
324 |
+ #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) |
325 |
+ /* Maximum address we can reach in physical address mode */ |
326 |
+@@ -32,6 +30,4 @@ static inline void crash_setup_regs(struct pt_regs *newregs, |
327 |
+ |
328 |
+ #endif /* __ASSEMBLY__ */ |
329 |
+ |
330 |
+-#endif /* CONFIG_KEXEC */ |
331 |
+- |
332 |
+ #endif /* _ASM_PARISC_KEXEC_H */ |
333 |
+diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile |
334 |
+index 2663c8f8be11..068d90950d93 100644 |
335 |
+--- a/arch/parisc/kernel/Makefile |
336 |
++++ b/arch/parisc/kernel/Makefile |
337 |
+@@ -37,5 +37,5 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o |
338 |
+ obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
339 |
+ obj-$(CONFIG_KGDB) += kgdb.o |
340 |
+ obj-$(CONFIG_KPROBES) += kprobes.o |
341 |
+-obj-$(CONFIG_KEXEC) += kexec.o relocate_kernel.o |
342 |
++obj-$(CONFIG_KEXEC_CORE) += kexec.o relocate_kernel.o |
343 |
+ obj-$(CONFIG_KEXEC_FILE) += kexec_file.o |
344 |
+diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c |
345 |
+index 3b330e58a4f0..a6c9f49c6612 100644 |
346 |
+--- a/arch/parisc/kernel/drivers.c |
347 |
++++ b/arch/parisc/kernel/drivers.c |
348 |
+@@ -810,7 +810,7 @@ EXPORT_SYMBOL(device_to_hwpath); |
349 |
+ static void walk_native_bus(unsigned long io_io_low, unsigned long io_io_high, |
350 |
+ struct device *parent); |
351 |
+ |
352 |
+-static void walk_lower_bus(struct parisc_device *dev) |
353 |
++static void __init walk_lower_bus(struct parisc_device *dev) |
354 |
+ { |
355 |
+ unsigned long io_io_low, io_io_high; |
356 |
+ |
357 |
+diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h |
358 |
+index e9a960e28f3c..d6102e34eb21 100644 |
359 |
+--- a/arch/powerpc/include/asm/spinlock.h |
360 |
++++ b/arch/powerpc/include/asm/spinlock.h |
361 |
+@@ -15,6 +15,7 @@ |
362 |
+ * |
363 |
+ * (the type definitions are in asm/spinlock_types.h) |
364 |
+ */ |
365 |
++#include <linux/jump_label.h> |
366 |
+ #include <linux/irqflags.h> |
367 |
+ #ifdef CONFIG_PPC64 |
368 |
+ #include <asm/paca.h> |
369 |
+@@ -36,10 +37,12 @@ |
370 |
+ #endif |
371 |
+ |
372 |
+ #ifdef CONFIG_PPC_PSERIES |
373 |
++DECLARE_STATIC_KEY_FALSE(shared_processor); |
374 |
++ |
375 |
+ #define vcpu_is_preempted vcpu_is_preempted |
376 |
+ static inline bool vcpu_is_preempted(int cpu) |
377 |
+ { |
378 |
+- if (!firmware_has_feature(FW_FEATURE_SPLPAR)) |
379 |
++ if (!static_branch_unlikely(&shared_processor)) |
380 |
+ return false; |
381 |
+ return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1); |
382 |
+ } |
383 |
+diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c |
384 |
+index d30a2e6e68b4..9f5b32163bda 100644 |
385 |
+--- a/arch/powerpc/mm/mem.c |
386 |
++++ b/arch/powerpc/mm/mem.c |
387 |
+@@ -282,6 +282,14 @@ void __init mem_init(void) |
388 |
+ BUILD_BUG_ON(MMU_PAGE_COUNT > 16); |
389 |
+ |
390 |
+ #ifdef CONFIG_SWIOTLB |
391 |
++ /* |
392 |
++ * Some platforms (e.g. 85xx) limit DMA-able memory way below |
393 |
++ * 4G. We force memblock to bottom-up mode to ensure that the |
394 |
++ * memory allocated in swiotlb_init() is DMA-able. |
395 |
++ * As it's the last memblock allocation, no need to reset it |
396 |
++ * back to to-down. |
397 |
++ */ |
398 |
++ memblock_set_bottom_up(true); |
399 |
+ swiotlb_init(0); |
400 |
+ #endif |
401 |
+ |
402 |
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
403 |
+index 0a40201f315f..0c8421dd01ab 100644 |
404 |
+--- a/arch/powerpc/platforms/pseries/setup.c |
405 |
++++ b/arch/powerpc/platforms/pseries/setup.c |
406 |
+@@ -74,6 +74,9 @@ |
407 |
+ #include "pseries.h" |
408 |
+ #include "../../../../drivers/pci/pci.h" |
409 |
+ |
410 |
++DEFINE_STATIC_KEY_FALSE(shared_processor); |
411 |
++EXPORT_SYMBOL_GPL(shared_processor); |
412 |
++ |
413 |
+ int CMO_PrPSP = -1; |
414 |
+ int CMO_SecPSP = -1; |
415 |
+ unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K); |
416 |
+@@ -758,6 +761,10 @@ static void __init pSeries_setup_arch(void) |
417 |
+ |
418 |
+ if (firmware_has_feature(FW_FEATURE_LPAR)) { |
419 |
+ vpa_init(boot_cpuid); |
420 |
++ |
421 |
++ if (lppaca_shared_proc(get_lppaca())) |
422 |
++ static_branch_enable(&shared_processor); |
423 |
++ |
424 |
+ ppc_md.power_save = pseries_lpar_idle; |
425 |
+ ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; |
426 |
+ #ifdef CONFIG_PCI_IOV |
427 |
+diff --git a/arch/riscv/net/bpf_jit_comp.c b/arch/riscv/net/bpf_jit_comp.c |
428 |
+index 5451ef3845f2..7fbf56aab661 100644 |
429 |
+--- a/arch/riscv/net/bpf_jit_comp.c |
430 |
++++ b/arch/riscv/net/bpf_jit_comp.c |
431 |
+@@ -631,14 +631,14 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_context *ctx) |
432 |
+ return -1; |
433 |
+ emit(rv_bgeu(RV_REG_A2, RV_REG_T1, off >> 1), ctx); |
434 |
+ |
435 |
+- /* if (--TCC < 0) |
436 |
++ /* if (TCC-- < 0) |
437 |
+ * goto out; |
438 |
+ */ |
439 |
+ emit(rv_addi(RV_REG_T1, tcc, -1), ctx); |
440 |
+ off = (tc_ninsn - (ctx->ninsns - start_insn)) << 2; |
441 |
+ if (is_13b_check(off, insn)) |
442 |
+ return -1; |
443 |
+- emit(rv_blt(RV_REG_T1, RV_REG_ZERO, off >> 1), ctx); |
444 |
++ emit(rv_blt(tcc, RV_REG_ZERO, off >> 1), ctx); |
445 |
+ |
446 |
+ /* prog = array->ptrs[index]; |
447 |
+ * if (!prog) |
448 |
+diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile |
449 |
+index bc0d7a0d0394..9de56065f28c 100644 |
450 |
+--- a/arch/s390/purgatory/Makefile |
451 |
++++ b/arch/s390/purgatory/Makefile |
452 |
+@@ -15,8 +15,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
453 |
+ $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE |
454 |
+ $(call if_changed_rule,as_o_S) |
455 |
+ |
456 |
+-$(obj)/string.o: $(srctree)/arch/s390/lib/string.c FORCE |
457 |
+- $(call if_changed_rule,cc_o_c) |
458 |
++KCOV_INSTRUMENT := n |
459 |
++GCOV_PROFILE := n |
460 |
++UBSAN_SANITIZE := n |
461 |
++KASAN_SANITIZE := n |
462 |
+ |
463 |
+ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes |
464 |
+ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare |
465 |
+diff --git a/arch/s390/purgatory/string.c b/arch/s390/purgatory/string.c |
466 |
+new file mode 100644 |
467 |
+index 000000000000..c98c22a72db7 |
468 |
+--- /dev/null |
469 |
++++ b/arch/s390/purgatory/string.c |
470 |
+@@ -0,0 +1,3 @@ |
471 |
++// SPDX-License-Identifier: GPL-2.0 |
472 |
++#define __HAVE_ARCH_MEMCMP /* arch function */ |
473 |
++#include "../lib/string.c" |
474 |
+diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c |
475 |
+index 7b21455d7504..e622158f5659 100644 |
476 |
+--- a/arch/x86/events/core.c |
477 |
++++ b/arch/x86/events/core.c |
478 |
+@@ -375,7 +375,7 @@ int x86_add_exclusive(unsigned int what) |
479 |
+ * LBR and BTS are still mutually exclusive. |
480 |
+ */ |
481 |
+ if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt) |
482 |
+- return 0; |
483 |
++ goto out; |
484 |
+ |
485 |
+ if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) { |
486 |
+ mutex_lock(&pmc_reserve_mutex); |
487 |
+@@ -387,6 +387,7 @@ int x86_add_exclusive(unsigned int what) |
488 |
+ mutex_unlock(&pmc_reserve_mutex); |
489 |
+ } |
490 |
+ |
491 |
++out: |
492 |
+ atomic_inc(&active_events); |
493 |
+ return 0; |
494 |
+ |
495 |
+@@ -397,11 +398,15 @@ fail_unlock: |
496 |
+ |
497 |
+ void x86_del_exclusive(unsigned int what) |
498 |
+ { |
499 |
++ atomic_dec(&active_events); |
500 |
++ |
501 |
++ /* |
502 |
++ * See the comment in x86_add_exclusive(). |
503 |
++ */ |
504 |
+ if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt) |
505 |
+ return; |
506 |
+ |
507 |
+ atomic_dec(&x86_pmu.lbr_exclusive[what]); |
508 |
+- atomic_dec(&active_events); |
509 |
+ } |
510 |
+ |
511 |
+ int x86_setup_perfctr(struct perf_event *event) |
512 |
+@@ -1641,9 +1646,12 @@ static struct attribute_group x86_pmu_format_group __ro_after_init = { |
513 |
+ |
514 |
+ ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, char *page) |
515 |
+ { |
516 |
+- struct perf_pmu_events_attr *pmu_attr = \ |
517 |
++ struct perf_pmu_events_attr *pmu_attr = |
518 |
+ container_of(attr, struct perf_pmu_events_attr, attr); |
519 |
+- u64 config = x86_pmu.event_map(pmu_attr->id); |
520 |
++ u64 config = 0; |
521 |
++ |
522 |
++ if (pmu_attr->id < x86_pmu.max_events) |
523 |
++ config = x86_pmu.event_map(pmu_attr->id); |
524 |
+ |
525 |
+ /* string trumps id */ |
526 |
+ if (pmu_attr->event_str) |
527 |
+@@ -1712,6 +1720,9 @@ is_visible(struct kobject *kobj, struct attribute *attr, int idx) |
528 |
+ { |
529 |
+ struct perf_pmu_events_attr *pmu_attr; |
530 |
+ |
531 |
++ if (idx >= x86_pmu.max_events) |
532 |
++ return 0; |
533 |
++ |
534 |
+ pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr.attr); |
535 |
+ /* str trumps id */ |
536 |
+ return pmu_attr->event_str || x86_pmu.event_map(idx) ? attr->mode : 0; |
537 |
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c |
538 |
+index 606711f5ebf8..2f9ec14be3b1 100644 |
539 |
+--- a/arch/x86/kernel/early-quirks.c |
540 |
++++ b/arch/x86/kernel/early-quirks.c |
541 |
+@@ -714,6 +714,8 @@ static struct chipset early_qrk[] __initdata = { |
542 |
+ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
543 |
+ { PCI_VENDOR_ID_INTEL, 0x3ec4, |
544 |
+ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
545 |
++ { PCI_VENDOR_ID_INTEL, 0x8a12, |
546 |
++ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
547 |
+ { PCI_VENDOR_ID_BROADCOM, 0x4331, |
548 |
+ PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset}, |
549 |
+ {} |
550 |
+diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c |
551 |
+index 3b9fd679cea9..aefe845dff59 100644 |
552 |
+--- a/arch/x86/platform/efi/quirks.c |
553 |
++++ b/arch/x86/platform/efi/quirks.c |
554 |
+@@ -260,10 +260,6 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) |
555 |
+ return; |
556 |
+ } |
557 |
+ |
558 |
+- /* No need to reserve regions that will never be freed. */ |
559 |
+- if (md.attribute & EFI_MEMORY_RUNTIME) |
560 |
+- return; |
561 |
+- |
562 |
+ size += addr % EFI_PAGE_SIZE; |
563 |
+ size = round_up(size, EFI_PAGE_SIZE); |
564 |
+ addr = round_down(addr, EFI_PAGE_SIZE); |
565 |
+@@ -293,6 +289,8 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) |
566 |
+ early_memunmap(new, new_size); |
567 |
+ |
568 |
+ efi_memmap_install(new_phys, num_entries); |
569 |
++ e820__range_update(addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED); |
570 |
++ e820__update_table(e820_table); |
571 |
+ } |
572 |
+ |
573 |
+ /* |
574 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
575 |
+index d5e668ec751b..1075aaff606d 100644 |
576 |
+--- a/block/blk-core.c |
577 |
++++ b/block/blk-core.c |
578 |
+@@ -886,11 +886,14 @@ generic_make_request_checks(struct bio *bio) |
579 |
+ } |
580 |
+ |
581 |
+ /* |
582 |
+- * For a REQ_NOWAIT based request, return -EOPNOTSUPP |
583 |
+- * if queue is not a request based queue. |
584 |
++ * Non-mq queues do not honor REQ_NOWAIT, so complete a bio |
585 |
++ * with BLK_STS_AGAIN status in order to catch -EAGAIN and |
586 |
++ * to give a chance to the caller to repeat request gracefully. |
587 |
+ */ |
588 |
+- if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) |
589 |
+- goto not_supported; |
590 |
++ if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) { |
591 |
++ status = BLK_STS_AGAIN; |
592 |
++ goto end_io; |
593 |
++ } |
594 |
+ |
595 |
+ if (should_fail_bio(bio)) |
596 |
+ goto end_io; |
597 |
+diff --git a/block/blk-flush.c b/block/blk-flush.c |
598 |
+index 1eec9cbe5a0a..b1f0a1ac505c 100644 |
599 |
+--- a/block/blk-flush.c |
600 |
++++ b/block/blk-flush.c |
601 |
+@@ -69,6 +69,7 @@ |
602 |
+ #include <linux/blkdev.h> |
603 |
+ #include <linux/gfp.h> |
604 |
+ #include <linux/blk-mq.h> |
605 |
++#include <linux/lockdep.h> |
606 |
+ |
607 |
+ #include "blk.h" |
608 |
+ #include "blk-mq.h" |
609 |
+@@ -492,6 +493,9 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q, |
610 |
+ INIT_LIST_HEAD(&fq->flush_queue[1]); |
611 |
+ INIT_LIST_HEAD(&fq->flush_data_in_flight); |
612 |
+ |
613 |
++ lockdep_register_key(&fq->key); |
614 |
++ lockdep_set_class(&fq->mq_flush_lock, &fq->key); |
615 |
++ |
616 |
+ return fq; |
617 |
+ |
618 |
+ fail_rq: |
619 |
+@@ -506,6 +510,7 @@ void blk_free_flush_queue(struct blk_flush_queue *fq) |
620 |
+ if (!fq) |
621 |
+ return; |
622 |
+ |
623 |
++ lockdep_unregister_key(&fq->key); |
624 |
+ kfree(fq->flush_rq); |
625 |
+ kfree(fq); |
626 |
+ } |
627 |
+diff --git a/block/blk-map.c b/block/blk-map.c |
628 |
+index 3a62e471d81b..b0790268ed9d 100644 |
629 |
+--- a/block/blk-map.c |
630 |
++++ b/block/blk-map.c |
631 |
+@@ -151,7 +151,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, |
632 |
+ return 0; |
633 |
+ |
634 |
+ unmap_rq: |
635 |
+- __blk_rq_unmap_user(bio); |
636 |
++ blk_rq_unmap_user(bio); |
637 |
+ fail: |
638 |
+ rq->bio = NULL; |
639 |
+ return ret; |
640 |
+diff --git a/block/blk.h b/block/blk.h |
641 |
+index 47fba9362e60..ffea1691470e 100644 |
642 |
+--- a/block/blk.h |
643 |
++++ b/block/blk.h |
644 |
+@@ -30,6 +30,7 @@ struct blk_flush_queue { |
645 |
+ * at the same time |
646 |
+ */ |
647 |
+ struct request *orig_rq; |
648 |
++ struct lock_class_key key; |
649 |
+ spinlock_t mq_flush_lock; |
650 |
+ }; |
651 |
+ |
652 |
+diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
653 |
+index 2b6670daf7fc..34bd9bf4e68a 100644 |
654 |
+--- a/drivers/bus/ti-sysc.c |
655 |
++++ b/drivers/bus/ti-sysc.c |
656 |
+@@ -1594,6 +1594,10 @@ static int sysc_reset(struct sysc *ddata) |
657 |
+ sysc_val |= sysc_mask; |
658 |
+ sysc_write(ddata, sysc_offset, sysc_val); |
659 |
+ |
660 |
++ if (ddata->cfg.srst_udelay) |
661 |
++ usleep_range(ddata->cfg.srst_udelay, |
662 |
++ ddata->cfg.srst_udelay * 2); |
663 |
++ |
664 |
+ if (ddata->clk_enable_quirk) |
665 |
+ ddata->clk_enable_quirk(ddata); |
666 |
+ |
667 |
+diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c |
668 |
+index 6640a14dbe48..22bf553ccf9d 100644 |
669 |
+--- a/drivers/char/tpm/tpm_ftpm_tee.c |
670 |
++++ b/drivers/char/tpm/tpm_ftpm_tee.c |
671 |
+@@ -32,7 +32,7 @@ static const uuid_t ftpm_ta_uuid = |
672 |
+ 0x82, 0xCB, 0x34, 0x3F, 0xB7, 0xF3, 0x78, 0x96); |
673 |
+ |
674 |
+ /** |
675 |
+- * ftpm_tee_tpm_op_recv - retrieve fTPM response. |
676 |
++ * ftpm_tee_tpm_op_recv() - retrieve fTPM response. |
677 |
+ * @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h. |
678 |
+ * @buf: the buffer to store data. |
679 |
+ * @count: the number of bytes to read. |
680 |
+@@ -61,7 +61,7 @@ static int ftpm_tee_tpm_op_recv(struct tpm_chip *chip, u8 *buf, size_t count) |
681 |
+ } |
682 |
+ |
683 |
+ /** |
684 |
+- * ftpm_tee_tpm_op_send - send TPM commands through the TEE shared memory. |
685 |
++ * ftpm_tee_tpm_op_send() - send TPM commands through the TEE shared memory. |
686 |
+ * @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h |
687 |
+ * @buf: the buffer to send. |
688 |
+ * @len: the number of bytes to send. |
689 |
+@@ -208,7 +208,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data) |
690 |
+ } |
691 |
+ |
692 |
+ /** |
693 |
+- * ftpm_tee_probe - initialize the fTPM |
694 |
++ * ftpm_tee_probe() - initialize the fTPM |
695 |
+ * @pdev: the platform_device description. |
696 |
+ * |
697 |
+ * Return: |
698 |
+@@ -298,7 +298,7 @@ out_tee_session: |
699 |
+ } |
700 |
+ |
701 |
+ /** |
702 |
+- * ftpm_tee_remove - remove the TPM device |
703 |
++ * ftpm_tee_remove() - remove the TPM device |
704 |
+ * @pdev: the platform_device description. |
705 |
+ * |
706 |
+ * Return: |
707 |
+@@ -328,6 +328,19 @@ static int ftpm_tee_remove(struct platform_device *pdev) |
708 |
+ return 0; |
709 |
+ } |
710 |
+ |
711 |
++/** |
712 |
++ * ftpm_tee_shutdown() - shutdown the TPM device |
713 |
++ * @pdev: the platform_device description. |
714 |
++ */ |
715 |
++static void ftpm_tee_shutdown(struct platform_device *pdev) |
716 |
++{ |
717 |
++ struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev); |
718 |
++ |
719 |
++ tee_shm_free(pvt_data->shm); |
720 |
++ tee_client_close_session(pvt_data->ctx, pvt_data->session); |
721 |
++ tee_client_close_context(pvt_data->ctx); |
722 |
++} |
723 |
++ |
724 |
+ static const struct of_device_id of_ftpm_tee_ids[] = { |
725 |
+ { .compatible = "microsoft,ftpm" }, |
726 |
+ { } |
727 |
+@@ -341,6 +354,7 @@ static struct platform_driver ftpm_tee_driver = { |
728 |
+ }, |
729 |
+ .probe = ftpm_tee_probe, |
730 |
+ .remove = ftpm_tee_remove, |
731 |
++ .shutdown = ftpm_tee_shutdown, |
732 |
+ }; |
733 |
+ |
734 |
+ module_platform_driver(ftpm_tee_driver); |
735 |
+diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c |
736 |
+index 0aabe49aed09..a9d4234758d7 100644 |
737 |
+--- a/drivers/clk/at91/at91sam9260.c |
738 |
++++ b/drivers/clk/at91/at91sam9260.c |
739 |
+@@ -348,7 +348,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, |
740 |
+ return; |
741 |
+ mainxtal_name = of_clk_get_parent_name(np, i); |
742 |
+ |
743 |
+- regmap = syscon_node_to_regmap(np); |
744 |
++ regmap = device_node_to_regmap(np); |
745 |
+ if (IS_ERR(regmap)) |
746 |
+ return; |
747 |
+ |
748 |
+diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c |
749 |
+index 0ac34cdaa106..77fe83a73bf4 100644 |
750 |
+--- a/drivers/clk/at91/at91sam9rl.c |
751 |
++++ b/drivers/clk/at91/at91sam9rl.c |
752 |
+@@ -83,7 +83,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) |
753 |
+ return; |
754 |
+ mainxtal_name = of_clk_get_parent_name(np, i); |
755 |
+ |
756 |
+- regmap = syscon_node_to_regmap(np); |
757 |
++ regmap = device_node_to_regmap(np); |
758 |
+ if (IS_ERR(regmap)) |
759 |
+ return; |
760 |
+ |
761 |
+diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c |
762 |
+index 0855f3a80cc7..086cf0b4955c 100644 |
763 |
+--- a/drivers/clk/at91/at91sam9x5.c |
764 |
++++ b/drivers/clk/at91/at91sam9x5.c |
765 |
+@@ -146,7 +146,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, |
766 |
+ return; |
767 |
+ mainxtal_name = of_clk_get_parent_name(np, i); |
768 |
+ |
769 |
+- regmap = syscon_node_to_regmap(np); |
770 |
++ regmap = device_node_to_regmap(np); |
771 |
+ if (IS_ERR(regmap)) |
772 |
+ return; |
773 |
+ |
774 |
+diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c |
775 |
+index 0b03cfae3a9d..b71515acdec1 100644 |
776 |
+--- a/drivers/clk/at91/pmc.c |
777 |
++++ b/drivers/clk/at91/pmc.c |
778 |
+@@ -275,7 +275,7 @@ static int __init pmc_register_ops(void) |
779 |
+ |
780 |
+ np = of_find_matching_node(NULL, sama5d2_pmc_dt_ids); |
781 |
+ |
782 |
+- pmcreg = syscon_node_to_regmap(np); |
783 |
++ pmcreg = device_node_to_regmap(np); |
784 |
+ if (IS_ERR(pmcreg)) |
785 |
+ return PTR_ERR(pmcreg); |
786 |
+ |
787 |
+diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c |
788 |
+index 0de1108737db..ff7e3f727082 100644 |
789 |
+--- a/drivers/clk/at91/sama5d2.c |
790 |
++++ b/drivers/clk/at91/sama5d2.c |
791 |
+@@ -162,7 +162,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) |
792 |
+ return; |
793 |
+ mainxtal_name = of_clk_get_parent_name(np, i); |
794 |
+ |
795 |
+- regmap = syscon_node_to_regmap(np); |
796 |
++ regmap = device_node_to_regmap(np); |
797 |
+ if (IS_ERR(regmap)) |
798 |
+ return; |
799 |
+ |
800 |
+diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c |
801 |
+index 25b156d4e645..a6dee4a3b6e4 100644 |
802 |
+--- a/drivers/clk/at91/sama5d4.c |
803 |
++++ b/drivers/clk/at91/sama5d4.c |
804 |
+@@ -136,7 +136,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) |
805 |
+ return; |
806 |
+ mainxtal_name = of_clk_get_parent_name(np, i); |
807 |
+ |
808 |
+- regmap = syscon_node_to_regmap(np); |
809 |
++ regmap = device_node_to_regmap(np); |
810 |
+ if (IS_ERR(regmap)) |
811 |
+ return; |
812 |
+ |
813 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
814 |
+index 1c677d7f7f53..27a95c86a80b 100644 |
815 |
+--- a/drivers/clk/clk.c |
816 |
++++ b/drivers/clk/clk.c |
817 |
+@@ -3231,6 +3231,34 @@ static inline void clk_debug_unregister(struct clk_core *core) |
818 |
+ } |
819 |
+ #endif |
820 |
+ |
821 |
++static void clk_core_reparent_orphans_nolock(void) |
822 |
++{ |
823 |
++ struct clk_core *orphan; |
824 |
++ struct hlist_node *tmp2; |
825 |
++ |
826 |
++ /* |
827 |
++ * walk the list of orphan clocks and reparent any that newly finds a |
828 |
++ * parent. |
829 |
++ */ |
830 |
++ hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { |
831 |
++ struct clk_core *parent = __clk_init_parent(orphan); |
832 |
++ |
833 |
++ /* |
834 |
++ * We need to use __clk_set_parent_before() and _after() to |
835 |
++ * to properly migrate any prepare/enable count of the orphan |
836 |
++ * clock. This is important for CLK_IS_CRITICAL clocks, which |
837 |
++ * are enabled during init but might not have a parent yet. |
838 |
++ */ |
839 |
++ if (parent) { |
840 |
++ /* update the clk tree topology */ |
841 |
++ __clk_set_parent_before(orphan, parent); |
842 |
++ __clk_set_parent_after(orphan, parent, NULL); |
843 |
++ __clk_recalc_accuracies(orphan); |
844 |
++ __clk_recalc_rates(orphan, 0); |
845 |
++ } |
846 |
++ } |
847 |
++} |
848 |
++ |
849 |
+ /** |
850 |
+ * __clk_core_init - initialize the data structures in a struct clk_core |
851 |
+ * @core: clk_core being initialized |
852 |
+@@ -3241,8 +3269,6 @@ static inline void clk_debug_unregister(struct clk_core *core) |
853 |
+ static int __clk_core_init(struct clk_core *core) |
854 |
+ { |
855 |
+ int ret; |
856 |
+- struct clk_core *orphan; |
857 |
+- struct hlist_node *tmp2; |
858 |
+ unsigned long rate; |
859 |
+ |
860 |
+ if (!core) |
861 |
+@@ -3389,27 +3415,8 @@ static int __clk_core_init(struct clk_core *core) |
862 |
+ clk_enable_unlock(flags); |
863 |
+ } |
864 |
+ |
865 |
+- /* |
866 |
+- * walk the list of orphan clocks and reparent any that newly finds a |
867 |
+- * parent. |
868 |
+- */ |
869 |
+- hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { |
870 |
+- struct clk_core *parent = __clk_init_parent(orphan); |
871 |
++ clk_core_reparent_orphans_nolock(); |
872 |
+ |
873 |
+- /* |
874 |
+- * We need to use __clk_set_parent_before() and _after() to |
875 |
+- * to properly migrate any prepare/enable count of the orphan |
876 |
+- * clock. This is important for CLK_IS_CRITICAL clocks, which |
877 |
+- * are enabled during init but might not have a parent yet. |
878 |
+- */ |
879 |
+- if (parent) { |
880 |
+- /* update the clk tree topology */ |
881 |
+- __clk_set_parent_before(orphan, parent); |
882 |
+- __clk_set_parent_after(orphan, parent, NULL); |
883 |
+- __clk_recalc_accuracies(orphan); |
884 |
+- __clk_recalc_rates(orphan, 0); |
885 |
+- } |
886 |
+- } |
887 |
+ |
888 |
+ kref_init(&core->ref); |
889 |
+ out: |
890 |
+@@ -4160,6 +4167,13 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) |
891 |
+ EXPORT_SYMBOL_GPL(clk_notifier_unregister); |
892 |
+ |
893 |
+ #ifdef CONFIG_OF |
894 |
++static void clk_core_reparent_orphans(void) |
895 |
++{ |
896 |
++ clk_prepare_lock(); |
897 |
++ clk_core_reparent_orphans_nolock(); |
898 |
++ clk_prepare_unlock(); |
899 |
++} |
900 |
++ |
901 |
+ /** |
902 |
+ * struct of_clk_provider - Clock provider registration structure |
903 |
+ * @link: Entry in global list of clock providers |
904 |
+@@ -4255,6 +4269,8 @@ int of_clk_add_provider(struct device_node *np, |
905 |
+ mutex_unlock(&of_clk_mutex); |
906 |
+ pr_debug("Added clock from %pOF\n", np); |
907 |
+ |
908 |
++ clk_core_reparent_orphans(); |
909 |
++ |
910 |
+ ret = of_clk_set_defaults(np, true); |
911 |
+ if (ret < 0) |
912 |
+ of_clk_del_provider(np); |
913 |
+@@ -4290,6 +4306,8 @@ int of_clk_add_hw_provider(struct device_node *np, |
914 |
+ mutex_unlock(&of_clk_mutex); |
915 |
+ pr_debug("Added clk_hw provider from %pOF\n", np); |
916 |
+ |
917 |
++ clk_core_reparent_orphans(); |
918 |
++ |
919 |
+ ret = of_clk_set_defaults(np, true); |
920 |
+ if (ret < 0) |
921 |
+ of_clk_del_provider(np); |
922 |
+diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c |
923 |
+index c9a0efca17b0..d4077db6dc97 100644 |
924 |
+--- a/drivers/firmware/efi/earlycon.c |
925 |
++++ b/drivers/firmware/efi/earlycon.c |
926 |
+@@ -13,18 +13,57 @@ |
927 |
+ |
928 |
+ #include <asm/early_ioremap.h> |
929 |
+ |
930 |
++static const struct console *earlycon_console __initdata; |
931 |
+ static const struct font_desc *font; |
932 |
+ static u32 efi_x, efi_y; |
933 |
+ static u64 fb_base; |
934 |
+ static pgprot_t fb_prot; |
935 |
++static void *efi_fb; |
936 |
++ |
937 |
++/* |
938 |
++ * EFI earlycon needs to use early_memremap() to map the framebuffer. |
939 |
++ * But early_memremap() is not usable for 'earlycon=efifb keep_bootcon', |
940 |
++ * memremap() should be used instead. memremap() will be available after |
941 |
++ * paging_init() which is earlier than initcall callbacks. Thus adding this |
942 |
++ * early initcall function early_efi_map_fb() to map the whole EFI framebuffer. |
943 |
++ */ |
944 |
++static int __init efi_earlycon_remap_fb(void) |
945 |
++{ |
946 |
++ /* bail if there is no bootconsole or it has been disabled already */ |
947 |
++ if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED)) |
948 |
++ return 0; |
949 |
++ |
950 |
++ if (pgprot_val(fb_prot) == pgprot_val(PAGE_KERNEL)) |
951 |
++ efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WB); |
952 |
++ else |
953 |
++ efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WC); |
954 |
++ |
955 |
++ return efi_fb ? 0 : -ENOMEM; |
956 |
++} |
957 |
++early_initcall(efi_earlycon_remap_fb); |
958 |
++ |
959 |
++static int __init efi_earlycon_unmap_fb(void) |
960 |
++{ |
961 |
++ /* unmap the bootconsole fb unless keep_bootcon has left it enabled */ |
962 |
++ if (efi_fb && !(earlycon_console->flags & CON_ENABLED)) |
963 |
++ memunmap(efi_fb); |
964 |
++ return 0; |
965 |
++} |
966 |
++late_initcall(efi_earlycon_unmap_fb); |
967 |
+ |
968 |
+ static __ref void *efi_earlycon_map(unsigned long start, unsigned long len) |
969 |
+ { |
970 |
++ if (efi_fb) |
971 |
++ return efi_fb + start; |
972 |
++ |
973 |
+ return early_memremap_prot(fb_base + start, len, pgprot_val(fb_prot)); |
974 |
+ } |
975 |
+ |
976 |
+ static __ref void efi_earlycon_unmap(void *addr, unsigned long len) |
977 |
+ { |
978 |
++ if (efi_fb) |
979 |
++ return; |
980 |
++ |
981 |
+ early_memunmap(addr, len); |
982 |
+ } |
983 |
+ |
984 |
+@@ -201,6 +240,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device, |
985 |
+ efi_earlycon_scroll_up(); |
986 |
+ |
987 |
+ device->con->write = efi_earlycon_write; |
988 |
++ earlycon_console = device->con; |
989 |
+ return 0; |
990 |
+ } |
991 |
+ EARLYCON_DECLARE(efifb, efi_earlycon_setup); |
992 |
+diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c |
993 |
+index 0101ca4c13b1..b7bf1e993b8b 100644 |
994 |
+--- a/drivers/firmware/efi/libstub/gop.c |
995 |
++++ b/drivers/firmware/efi/libstub/gop.c |
996 |
+@@ -83,30 +83,6 @@ setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line, |
997 |
+ } |
998 |
+ } |
999 |
+ |
1000 |
+-static efi_status_t |
1001 |
+-__gop_query32(efi_system_table_t *sys_table_arg, |
1002 |
+- struct efi_graphics_output_protocol_32 *gop32, |
1003 |
+- struct efi_graphics_output_mode_info **info, |
1004 |
+- unsigned long *size, u64 *fb_base) |
1005 |
+-{ |
1006 |
+- struct efi_graphics_output_protocol_mode_32 *mode; |
1007 |
+- efi_graphics_output_protocol_query_mode query_mode; |
1008 |
+- efi_status_t status; |
1009 |
+- unsigned long m; |
1010 |
+- |
1011 |
+- m = gop32->mode; |
1012 |
+- mode = (struct efi_graphics_output_protocol_mode_32 *)m; |
1013 |
+- query_mode = (void *)(unsigned long)gop32->query_mode; |
1014 |
+- |
1015 |
+- status = __efi_call_early(query_mode, (void *)gop32, mode->mode, size, |
1016 |
+- info); |
1017 |
+- if (status != EFI_SUCCESS) |
1018 |
+- return status; |
1019 |
+- |
1020 |
+- *fb_base = mode->frame_buffer_base; |
1021 |
+- return status; |
1022 |
+-} |
1023 |
+- |
1024 |
+ static efi_status_t |
1025 |
+ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1026 |
+ efi_guid_t *proto, unsigned long size, void **gop_handle) |
1027 |
+@@ -119,7 +95,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1028 |
+ u64 fb_base; |
1029 |
+ struct efi_pixel_bitmask pixel_info; |
1030 |
+ int pixel_format; |
1031 |
+- efi_status_t status = EFI_NOT_FOUND; |
1032 |
++ efi_status_t status; |
1033 |
+ u32 *handles = (u32 *)(unsigned long)gop_handle; |
1034 |
+ int i; |
1035 |
+ |
1036 |
+@@ -128,6 +104,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1037 |
+ |
1038 |
+ nr_gops = size / sizeof(u32); |
1039 |
+ for (i = 0; i < nr_gops; i++) { |
1040 |
++ struct efi_graphics_output_protocol_mode_32 *mode; |
1041 |
+ struct efi_graphics_output_mode_info *info = NULL; |
1042 |
+ efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID; |
1043 |
+ bool conout_found = false; |
1044 |
+@@ -145,9 +122,11 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1045 |
+ if (status == EFI_SUCCESS) |
1046 |
+ conout_found = true; |
1047 |
+ |
1048 |
+- status = __gop_query32(sys_table_arg, gop32, &info, &size, |
1049 |
+- ¤t_fb_base); |
1050 |
+- if (status == EFI_SUCCESS && (!first_gop || conout_found) && |
1051 |
++ mode = (void *)(unsigned long)gop32->mode; |
1052 |
++ info = (void *)(unsigned long)mode->info; |
1053 |
++ current_fb_base = mode->frame_buffer_base; |
1054 |
++ |
1055 |
++ if ((!first_gop || conout_found) && |
1056 |
+ info->pixel_format != PIXEL_BLT_ONLY) { |
1057 |
+ /* |
1058 |
+ * Systems that use the UEFI Console Splitter may |
1059 |
+@@ -175,7 +154,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1060 |
+ |
1061 |
+ /* Did we find any GOPs? */ |
1062 |
+ if (!first_gop) |
1063 |
+- goto out; |
1064 |
++ return EFI_NOT_FOUND; |
1065 |
+ |
1066 |
+ /* EFI framebuffer */ |
1067 |
+ si->orig_video_isVGA = VIDEO_TYPE_EFI; |
1068 |
+@@ -197,32 +176,8 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1069 |
+ si->lfb_size = si->lfb_linelength * si->lfb_height; |
1070 |
+ |
1071 |
+ si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; |
1072 |
+-out: |
1073 |
+- return status; |
1074 |
+-} |
1075 |
+- |
1076 |
+-static efi_status_t |
1077 |
+-__gop_query64(efi_system_table_t *sys_table_arg, |
1078 |
+- struct efi_graphics_output_protocol_64 *gop64, |
1079 |
+- struct efi_graphics_output_mode_info **info, |
1080 |
+- unsigned long *size, u64 *fb_base) |
1081 |
+-{ |
1082 |
+- struct efi_graphics_output_protocol_mode_64 *mode; |
1083 |
+- efi_graphics_output_protocol_query_mode query_mode; |
1084 |
+- efi_status_t status; |
1085 |
+- unsigned long m; |
1086 |
+- |
1087 |
+- m = gop64->mode; |
1088 |
+- mode = (struct efi_graphics_output_protocol_mode_64 *)m; |
1089 |
+- query_mode = (void *)(unsigned long)gop64->query_mode; |
1090 |
+- |
1091 |
+- status = __efi_call_early(query_mode, (void *)gop64, mode->mode, size, |
1092 |
+- info); |
1093 |
+- if (status != EFI_SUCCESS) |
1094 |
+- return status; |
1095 |
+ |
1096 |
+- *fb_base = mode->frame_buffer_base; |
1097 |
+- return status; |
1098 |
++ return EFI_SUCCESS; |
1099 |
+ } |
1100 |
+ |
1101 |
+ static efi_status_t |
1102 |
+@@ -237,7 +192,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1103 |
+ u64 fb_base; |
1104 |
+ struct efi_pixel_bitmask pixel_info; |
1105 |
+ int pixel_format; |
1106 |
+- efi_status_t status = EFI_NOT_FOUND; |
1107 |
++ efi_status_t status; |
1108 |
+ u64 *handles = (u64 *)(unsigned long)gop_handle; |
1109 |
+ int i; |
1110 |
+ |
1111 |
+@@ -246,6 +201,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1112 |
+ |
1113 |
+ nr_gops = size / sizeof(u64); |
1114 |
+ for (i = 0; i < nr_gops; i++) { |
1115 |
++ struct efi_graphics_output_protocol_mode_64 *mode; |
1116 |
+ struct efi_graphics_output_mode_info *info = NULL; |
1117 |
+ efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID; |
1118 |
+ bool conout_found = false; |
1119 |
+@@ -263,9 +219,11 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1120 |
+ if (status == EFI_SUCCESS) |
1121 |
+ conout_found = true; |
1122 |
+ |
1123 |
+- status = __gop_query64(sys_table_arg, gop64, &info, &size, |
1124 |
+- ¤t_fb_base); |
1125 |
+- if (status == EFI_SUCCESS && (!first_gop || conout_found) && |
1126 |
++ mode = (void *)(unsigned long)gop64->mode; |
1127 |
++ info = (void *)(unsigned long)mode->info; |
1128 |
++ current_fb_base = mode->frame_buffer_base; |
1129 |
++ |
1130 |
++ if ((!first_gop || conout_found) && |
1131 |
+ info->pixel_format != PIXEL_BLT_ONLY) { |
1132 |
+ /* |
1133 |
+ * Systems that use the UEFI Console Splitter may |
1134 |
+@@ -293,7 +251,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1135 |
+ |
1136 |
+ /* Did we find any GOPs? */ |
1137 |
+ if (!first_gop) |
1138 |
+- goto out; |
1139 |
++ return EFI_NOT_FOUND; |
1140 |
+ |
1141 |
+ /* EFI framebuffer */ |
1142 |
+ si->orig_video_isVGA = VIDEO_TYPE_EFI; |
1143 |
+@@ -315,8 +273,8 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, |
1144 |
+ si->lfb_size = si->lfb_linelength * si->lfb_height; |
1145 |
+ |
1146 |
+ si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; |
1147 |
+-out: |
1148 |
+- return status; |
1149 |
++ |
1150 |
++ return EFI_SUCCESS; |
1151 |
+ } |
1152 |
+ |
1153 |
+ /* |
1154 |
+diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c |
1155 |
+index 80ea49f570f4..43ffec3a6fbb 100644 |
1156 |
+--- a/drivers/gpio/gpiolib-of.c |
1157 |
++++ b/drivers/gpio/gpiolib-of.c |
1158 |
+@@ -23,6 +23,29 @@ |
1159 |
+ #include "gpiolib.h" |
1160 |
+ #include "gpiolib-of.h" |
1161 |
+ |
1162 |
++/** |
1163 |
++ * of_gpio_spi_cs_get_count() - special GPIO counting for SPI |
1164 |
++ * Some elder GPIO controllers need special quirks. Currently we handle |
1165 |
++ * the Freescale GPIO controller with bindings that doesn't use the |
1166 |
++ * established "cs-gpios" for chip selects but instead rely on |
1167 |
++ * "gpios" for the chip select lines. If we detect this, we redirect |
1168 |
++ * the counting of "cs-gpios" to count "gpios" transparent to the |
1169 |
++ * driver. |
1170 |
++ */ |
1171 |
++int of_gpio_spi_cs_get_count(struct device *dev, const char *con_id) |
1172 |
++{ |
1173 |
++ struct device_node *np = dev->of_node; |
1174 |
++ |
1175 |
++ if (!IS_ENABLED(CONFIG_SPI_MASTER)) |
1176 |
++ return 0; |
1177 |
++ if (!con_id || strcmp(con_id, "cs")) |
1178 |
++ return 0; |
1179 |
++ if (!of_device_is_compatible(np, "fsl,spi") && |
1180 |
++ !of_device_is_compatible(np, "aeroflexgaisler,spictrl")) |
1181 |
++ return 0; |
1182 |
++ return of_gpio_named_count(np, "gpios"); |
1183 |
++} |
1184 |
++ |
1185 |
+ /* |
1186 |
+ * This is used by external users of of_gpio_count() from <linux/of_gpio.h> |
1187 |
+ * |
1188 |
+@@ -35,6 +58,10 @@ int of_gpio_get_count(struct device *dev, const char *con_id) |
1189 |
+ char propname[32]; |
1190 |
+ unsigned int i; |
1191 |
+ |
1192 |
++ ret = of_gpio_spi_cs_get_count(dev, con_id); |
1193 |
++ if (ret > 0) |
1194 |
++ return ret; |
1195 |
++ |
1196 |
+ for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) { |
1197 |
+ if (con_id) |
1198 |
+ snprintf(propname, sizeof(propname), "%s-%s", |
1199 |
+diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c |
1200 |
+index 7ae087b0504d..88b6fcaa20be 100644 |
1201 |
+--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c |
1202 |
++++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c |
1203 |
+@@ -1313,6 +1313,7 @@ static int gsc_remove(struct platform_device *pdev) |
1204 |
+ { |
1205 |
+ struct device *dev = &pdev->dev; |
1206 |
+ |
1207 |
++ component_del(dev, &gsc_component_ops); |
1208 |
+ pm_runtime_dont_use_autosuspend(dev); |
1209 |
+ pm_runtime_disable(dev); |
1210 |
+ |
1211 |
+diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c |
1212 |
+index f321279baf9e..51456e7f264f 100644 |
1213 |
+--- a/drivers/iommu/dma-iommu.c |
1214 |
++++ b/drivers/iommu/dma-iommu.c |
1215 |
+@@ -19,6 +19,7 @@ |
1216 |
+ #include <linux/iova.h> |
1217 |
+ #include <linux/irq.h> |
1218 |
+ #include <linux/mm.h> |
1219 |
++#include <linux/mutex.h> |
1220 |
+ #include <linux/pci.h> |
1221 |
+ #include <linux/scatterlist.h> |
1222 |
+ #include <linux/vmalloc.h> |
1223 |
+@@ -43,7 +44,6 @@ struct iommu_dma_cookie { |
1224 |
+ dma_addr_t msi_iova; |
1225 |
+ }; |
1226 |
+ struct list_head msi_page_list; |
1227 |
+- spinlock_t msi_lock; |
1228 |
+ |
1229 |
+ /* Domain for flush queue callback; NULL if flush queue not in use */ |
1230 |
+ struct iommu_domain *fq_domain; |
1231 |
+@@ -62,7 +62,6 @@ static struct iommu_dma_cookie *cookie_alloc(enum iommu_dma_cookie_type type) |
1232 |
+ |
1233 |
+ cookie = kzalloc(sizeof(*cookie), GFP_KERNEL); |
1234 |
+ if (cookie) { |
1235 |
+- spin_lock_init(&cookie->msi_lock); |
1236 |
+ INIT_LIST_HEAD(&cookie->msi_page_list); |
1237 |
+ cookie->type = type; |
1238 |
+ } |
1239 |
+@@ -1150,7 +1149,7 @@ static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev, |
1240 |
+ if (msi_page->phys == msi_addr) |
1241 |
+ return msi_page; |
1242 |
+ |
1243 |
+- msi_page = kzalloc(sizeof(*msi_page), GFP_ATOMIC); |
1244 |
++ msi_page = kzalloc(sizeof(*msi_page), GFP_KERNEL); |
1245 |
+ if (!msi_page) |
1246 |
+ return NULL; |
1247 |
+ |
1248 |
+@@ -1180,7 +1179,7 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) |
1249 |
+ struct iommu_domain *domain = iommu_get_domain_for_dev(dev); |
1250 |
+ struct iommu_dma_cookie *cookie; |
1251 |
+ struct iommu_dma_msi_page *msi_page; |
1252 |
+- unsigned long flags; |
1253 |
++ static DEFINE_MUTEX(msi_prepare_lock); /* see below */ |
1254 |
+ |
1255 |
+ if (!domain || !domain->iova_cookie) { |
1256 |
+ desc->iommu_cookie = NULL; |
1257 |
+@@ -1190,13 +1189,13 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) |
1258 |
+ cookie = domain->iova_cookie; |
1259 |
+ |
1260 |
+ /* |
1261 |
+- * We disable IRQs to rule out a possible inversion against |
1262 |
+- * irq_desc_lock if, say, someone tries to retarget the affinity |
1263 |
+- * of an MSI from within an IPI handler. |
1264 |
++ * In fact the whole prepare operation should already be serialised by |
1265 |
++ * irq_domain_mutex further up the callchain, but that's pretty subtle |
1266 |
++ * on its own, so consider this locking as failsafe documentation... |
1267 |
+ */ |
1268 |
+- spin_lock_irqsave(&cookie->msi_lock, flags); |
1269 |
++ mutex_lock(&msi_prepare_lock); |
1270 |
+ msi_page = iommu_dma_get_msi_page(dev, msi_addr, domain); |
1271 |
+- spin_unlock_irqrestore(&cookie->msi_lock, flags); |
1272 |
++ mutex_unlock(&msi_prepare_lock); |
1273 |
+ |
1274 |
+ msi_desc_set_iommu_cookie(desc, msi_page); |
1275 |
+ |
1276 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
1277 |
+index 41c605b0058f..c7a914b9bbbc 100644 |
1278 |
+--- a/drivers/iommu/iova.c |
1279 |
++++ b/drivers/iommu/iova.c |
1280 |
+@@ -233,7 +233,7 @@ static DEFINE_MUTEX(iova_cache_mutex); |
1281 |
+ |
1282 |
+ struct iova *alloc_iova_mem(void) |
1283 |
+ { |
1284 |
+- return kmem_cache_alloc(iova_cache, GFP_ATOMIC); |
1285 |
++ return kmem_cache_zalloc(iova_cache, GFP_ATOMIC); |
1286 |
+ } |
1287 |
+ EXPORT_SYMBOL(alloc_iova_mem); |
1288 |
+ |
1289 |
+diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs/command_submission.c |
1290 |
+index a9ac045dcfde..447f307ef4d6 100644 |
1291 |
+--- a/drivers/misc/habanalabs/command_submission.c |
1292 |
++++ b/drivers/misc/habanalabs/command_submission.c |
1293 |
+@@ -777,8 +777,9 @@ int hl_cs_wait_ioctl(struct hl_fpriv *hpriv, void *data) |
1294 |
+ memset(args, 0, sizeof(*args)); |
1295 |
+ |
1296 |
+ if (rc < 0) { |
1297 |
+- dev_err(hdev->dev, "Error %ld on waiting for CS handle %llu\n", |
1298 |
+- rc, seq); |
1299 |
++ dev_err_ratelimited(hdev->dev, |
1300 |
++ "Error %ld on waiting for CS handle %llu\n", |
1301 |
++ rc, seq); |
1302 |
+ if (rc == -ERESTARTSYS) { |
1303 |
+ args->out.status = HL_WAIT_CS_STATUS_INTERRUPTED; |
1304 |
+ rc = -EINTR; |
1305 |
+diff --git a/drivers/misc/habanalabs/context.c b/drivers/misc/habanalabs/context.c |
1306 |
+index 17db7b3dfb4c..2df6fb87e7ff 100644 |
1307 |
+--- a/drivers/misc/habanalabs/context.c |
1308 |
++++ b/drivers/misc/habanalabs/context.c |
1309 |
+@@ -176,7 +176,7 @@ struct dma_fence *hl_ctx_get_fence(struct hl_ctx *ctx, u64 seq) |
1310 |
+ spin_lock(&ctx->cs_lock); |
1311 |
+ |
1312 |
+ if (seq >= ctx->cs_sequence) { |
1313 |
+- dev_notice(hdev->dev, |
1314 |
++ dev_notice_ratelimited(hdev->dev, |
1315 |
+ "Can't wait on seq %llu because current CS is at seq %llu\n", |
1316 |
+ seq, ctx->cs_sequence); |
1317 |
+ spin_unlock(&ctx->cs_lock); |
1318 |
+diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c |
1319 |
+index 6fba14b81f90..fe3574a83b7c 100644 |
1320 |
+--- a/drivers/misc/habanalabs/goya/goya.c |
1321 |
++++ b/drivers/misc/habanalabs/goya/goya.c |
1322 |
+@@ -2171,7 +2171,7 @@ static int goya_push_linux_to_device(struct hl_device *hdev) |
1323 |
+ |
1324 |
+ static int goya_pldm_init_cpu(struct hl_device *hdev) |
1325 |
+ { |
1326 |
+- u32 val, unit_rst_val; |
1327 |
++ u32 unit_rst_val; |
1328 |
+ int rc; |
1329 |
+ |
1330 |
+ /* Must initialize SRAM scrambler before pushing u-boot to SRAM */ |
1331 |
+@@ -2179,14 +2179,14 @@ static int goya_pldm_init_cpu(struct hl_device *hdev) |
1332 |
+ |
1333 |
+ /* Put ARM cores into reset */ |
1334 |
+ WREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL, CPU_RESET_ASSERT); |
1335 |
+- val = RREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL); |
1336 |
++ RREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL); |
1337 |
+ |
1338 |
+ /* Reset the CA53 MACRO */ |
1339 |
+ unit_rst_val = RREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N); |
1340 |
+ WREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N, CA53_RESET); |
1341 |
+- val = RREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N); |
1342 |
++ RREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N); |
1343 |
+ WREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N, unit_rst_val); |
1344 |
+- val = RREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N); |
1345 |
++ RREG32(mmPSOC_GLOBAL_CONF_UNIT_RST_N); |
1346 |
+ |
1347 |
+ rc = goya_push_uboot_to_device(hdev); |
1348 |
+ if (rc) |
1349 |
+@@ -2207,7 +2207,7 @@ static int goya_pldm_init_cpu(struct hl_device *hdev) |
1350 |
+ /* Release ARM core 0 from reset */ |
1351 |
+ WREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL, |
1352 |
+ CPU_RESET_CORE0_DEASSERT); |
1353 |
+- val = RREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL); |
1354 |
++ RREG32(mmCPU_CA53_CFG_ARM_RST_CONTROL); |
1355 |
+ |
1356 |
+ return 0; |
1357 |
+ } |
1358 |
+@@ -2475,13 +2475,12 @@ err: |
1359 |
+ static int goya_hw_init(struct hl_device *hdev) |
1360 |
+ { |
1361 |
+ struct asic_fixed_properties *prop = &hdev->asic_prop; |
1362 |
+- u32 val; |
1363 |
+ int rc; |
1364 |
+ |
1365 |
+ dev_info(hdev->dev, "Starting initialization of H/W\n"); |
1366 |
+ |
1367 |
+ /* Perform read from the device to make sure device is up */ |
1368 |
+- val = RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG); |
1369 |
++ RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG); |
1370 |
+ |
1371 |
+ /* |
1372 |
+ * Let's mark in the H/W that we have reached this point. We check |
1373 |
+@@ -2533,7 +2532,7 @@ static int goya_hw_init(struct hl_device *hdev) |
1374 |
+ goto disable_queues; |
1375 |
+ |
1376 |
+ /* Perform read from the device to flush all MSI-X configuration */ |
1377 |
+- val = RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG); |
1378 |
++ RREG32(mmPCIE_DBI_DEVICE_ID_VENDOR_ID_REG); |
1379 |
+ |
1380 |
+ return 0; |
1381 |
+ |
1382 |
+diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c |
1383 |
+index 994563a078eb..de8a66b9d76b 100644 |
1384 |
+--- a/drivers/misc/ocxl/context.c |
1385 |
++++ b/drivers/misc/ocxl/context.c |
1386 |
+@@ -10,18 +10,17 @@ int ocxl_context_alloc(struct ocxl_context **context, struct ocxl_afu *afu, |
1387 |
+ int pasid; |
1388 |
+ struct ocxl_context *ctx; |
1389 |
+ |
1390 |
+- *context = kzalloc(sizeof(struct ocxl_context), GFP_KERNEL); |
1391 |
+- if (!*context) |
1392 |
++ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
1393 |
++ if (!ctx) |
1394 |
+ return -ENOMEM; |
1395 |
+ |
1396 |
+- ctx = *context; |
1397 |
+- |
1398 |
+ ctx->afu = afu; |
1399 |
+ mutex_lock(&afu->contexts_lock); |
1400 |
+ pasid = idr_alloc(&afu->contexts_idr, ctx, afu->pasid_base, |
1401 |
+ afu->pasid_base + afu->pasid_max, GFP_KERNEL); |
1402 |
+ if (pasid < 0) { |
1403 |
+ mutex_unlock(&afu->contexts_lock); |
1404 |
++ kfree(ctx); |
1405 |
+ return pasid; |
1406 |
+ } |
1407 |
+ afu->pasid_count++; |
1408 |
+@@ -43,6 +42,7 @@ int ocxl_context_alloc(struct ocxl_context **context, struct ocxl_afu *afu, |
1409 |
+ * duration of the life of the context |
1410 |
+ */ |
1411 |
+ ocxl_afu_get(afu); |
1412 |
++ *context = ctx; |
1413 |
+ return 0; |
1414 |
+ } |
1415 |
+ EXPORT_SYMBOL_GPL(ocxl_context_alloc); |
1416 |
+diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c |
1417 |
+index 25ec4c0ac589..8a903624fdd7 100644 |
1418 |
+--- a/drivers/net/dsa/mv88e6xxx/global1.c |
1419 |
++++ b/drivers/net/dsa/mv88e6xxx/global1.c |
1420 |
+@@ -332,6 +332,11 @@ int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port) |
1421 |
+ { |
1422 |
+ u16 ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST; |
1423 |
+ |
1424 |
++ /* Use the default high priority for management frames sent to |
1425 |
++ * the CPU. |
1426 |
++ */ |
1427 |
++ port |= MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI; |
1428 |
++ |
1429 |
+ return mv88e6390_g1_monitor_write(chip, ptr, port); |
1430 |
+ } |
1431 |
+ |
1432 |
+diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h |
1433 |
+index 0870fcc8bfc8..0ae96a1e919b 100644 |
1434 |
+--- a/drivers/net/dsa/mv88e6xxx/global1.h |
1435 |
++++ b/drivers/net/dsa/mv88e6xxx/global1.h |
1436 |
+@@ -210,6 +210,7 @@ |
1437 |
+ #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST 0x2000 |
1438 |
+ #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST 0x2100 |
1439 |
+ #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST 0x3000 |
1440 |
++#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI 0x00e0 |
1441 |
+ #define MV88E6390_G1_MONITOR_MGMT_CTL_DATA_MASK 0x00ff |
1442 |
+ |
1443 |
+ /* Offset 0x1C: Global Control 2 */ |
1444 |
+diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c |
1445 |
+index 15ef81654b67..330c41e87171 100644 |
1446 |
+--- a/drivers/net/dsa/mv88e6xxx/port.c |
1447 |
++++ b/drivers/net/dsa/mv88e6xxx/port.c |
1448 |
+@@ -393,7 +393,7 @@ phy_interface_t mv88e6390x_port_max_speed_mode(int port) |
1449 |
+ } |
1450 |
+ |
1451 |
+ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1452 |
+- phy_interface_t mode) |
1453 |
++ phy_interface_t mode, bool force) |
1454 |
+ { |
1455 |
+ u8 lane; |
1456 |
+ u16 cmode; |
1457 |
+@@ -427,8 +427,8 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1458 |
+ cmode = 0; |
1459 |
+ } |
1460 |
+ |
1461 |
+- /* cmode doesn't change, nothing to do for us */ |
1462 |
+- if (cmode == chip->ports[port].cmode) |
1463 |
++ /* cmode doesn't change, nothing to do for us unless forced */ |
1464 |
++ if (cmode == chip->ports[port].cmode && !force) |
1465 |
+ return 0; |
1466 |
+ |
1467 |
+ lane = mv88e6xxx_serdes_get_lane(chip, port); |
1468 |
+@@ -484,7 +484,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1469 |
+ if (port != 9 && port != 10) |
1470 |
+ return -EOPNOTSUPP; |
1471 |
+ |
1472 |
+- return mv88e6xxx_port_set_cmode(chip, port, mode); |
1473 |
++ return mv88e6xxx_port_set_cmode(chip, port, mode, false); |
1474 |
+ } |
1475 |
+ |
1476 |
+ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1477 |
+@@ -504,7 +504,7 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1478 |
+ break; |
1479 |
+ } |
1480 |
+ |
1481 |
+- return mv88e6xxx_port_set_cmode(chip, port, mode); |
1482 |
++ return mv88e6xxx_port_set_cmode(chip, port, mode, false); |
1483 |
+ } |
1484 |
+ |
1485 |
+ static int mv88e6341_port_set_cmode_writable(struct mv88e6xxx_chip *chip, |
1486 |
+@@ -555,7 +555,7 @@ int mv88e6341_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
1487 |
+ if (err) |
1488 |
+ return err; |
1489 |
+ |
1490 |
+- return mv88e6xxx_port_set_cmode(chip, port, mode); |
1491 |
++ return mv88e6xxx_port_set_cmode(chip, port, mode, true); |
1492 |
+ } |
1493 |
+ |
1494 |
+ int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode) |
1495 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |
1496 |
+index 8b08cb18e363..3f63ffd7561b 100644 |
1497 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |
1498 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |
1499 |
+@@ -1109,7 +1109,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp) |
1500 |
+ for (i = 0; i < E1H_FUNC_MAX / 2; i++) { |
1501 |
+ u32 func_config = |
1502 |
+ MF_CFG_RD(bp, |
1503 |
+- func_mf_config[BP_PORT(bp) + 2 * i]. |
1504 |
++ func_mf_config[BP_PATH(bp) + 2 * i]. |
1505 |
+ config); |
1506 |
+ func_num += |
1507 |
+ ((func_config & FUNC_MF_CFG_FUNC_HIDE) ? 0 : 1); |
1508 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1509 |
+index 192ff8d5da32..cff64e43bdd8 100644 |
1510 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1511 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1512 |
+@@ -9976,10 +9976,18 @@ static void bnx2x_recovery_failed(struct bnx2x *bp) |
1513 |
+ */ |
1514 |
+ static void bnx2x_parity_recover(struct bnx2x *bp) |
1515 |
+ { |
1516 |
+- bool global = false; |
1517 |
+ u32 error_recovered, error_unrecovered; |
1518 |
+- bool is_parity; |
1519 |
++ bool is_parity, global = false; |
1520 |
++#ifdef CONFIG_BNX2X_SRIOV |
1521 |
++ int vf_idx; |
1522 |
++ |
1523 |
++ for (vf_idx = 0; vf_idx < bp->requested_nr_virtfn; vf_idx++) { |
1524 |
++ struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); |
1525 |
+ |
1526 |
++ if (vf) |
1527 |
++ vf->state = VF_LOST; |
1528 |
++ } |
1529 |
++#endif |
1530 |
+ DP(NETIF_MSG_HW, "Handling parity\n"); |
1531 |
+ while (1) { |
1532 |
+ switch (bp->recovery_state) { |
1533 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1534 |
+index b6ebd92ec565..3a716c015415 100644 |
1535 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1536 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1537 |
+@@ -139,6 +139,7 @@ struct bnx2x_virtf { |
1538 |
+ #define VF_ACQUIRED 1 /* VF acquired, but not initialized */ |
1539 |
+ #define VF_ENABLED 2 /* VF Enabled */ |
1540 |
+ #define VF_RESET 3 /* VF FLR'd, pending cleanup */ |
1541 |
++#define VF_LOST 4 /* Recovery while VFs are loaded */ |
1542 |
+ |
1543 |
+ bool flr_clnup_stage; /* true during flr cleanup */ |
1544 |
+ bool malicious; /* true if FW indicated so, until FLR */ |
1545 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1546 |
+index 0752b7fa4d9c..ea0e9394f898 100644 |
1547 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1548 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1549 |
+@@ -2107,6 +2107,18 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, |
1550 |
+ { |
1551 |
+ int i; |
1552 |
+ |
1553 |
++ if (vf->state == VF_LOST) { |
1554 |
++ /* Just ack the FW and return if VFs are lost |
1555 |
++ * in case of parity error. VFs are supposed to be timedout |
1556 |
++ * on waiting for PF response. |
1557 |
++ */ |
1558 |
++ DP(BNX2X_MSG_IOV, |
1559 |
++ "VF 0x%x lost, not handling the request\n", vf->abs_vfid); |
1560 |
++ |
1561 |
++ storm_memset_vf_mbx_ack(bp, vf->abs_vfid); |
1562 |
++ return; |
1563 |
++ } |
1564 |
++ |
1565 |
+ /* check if tlv type is known */ |
1566 |
+ if (bnx2x_tlv_supported(mbx->first_tlv.tl.type)) { |
1567 |
+ /* Lock the per vf op mutex and note the locker's identity. |
1568 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
1569 |
+index 0f10a272827c..f496b248bda3 100644 |
1570 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
1571 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
1572 |
+@@ -4027,7 +4027,7 @@ static int fu540_c000_clk_init(struct platform_device *pdev, struct clk **pclk, |
1573 |
+ mgmt->rate = 0; |
1574 |
+ mgmt->hw.init = &init; |
1575 |
+ |
1576 |
+- *tx_clk = clk_register(NULL, &mgmt->hw); |
1577 |
++ *tx_clk = devm_clk_register(&pdev->dev, &mgmt->hw); |
1578 |
+ if (IS_ERR(*tx_clk)) |
1579 |
+ return PTR_ERR(*tx_clk); |
1580 |
+ |
1581 |
+@@ -4361,7 +4361,6 @@ err_out_free_netdev: |
1582 |
+ |
1583 |
+ err_disable_clocks: |
1584 |
+ clk_disable_unprepare(tx_clk); |
1585 |
+- clk_unregister(tx_clk); |
1586 |
+ clk_disable_unprepare(hclk); |
1587 |
+ clk_disable_unprepare(pclk); |
1588 |
+ clk_disable_unprepare(rx_clk); |
1589 |
+@@ -4397,7 +4396,6 @@ static int macb_remove(struct platform_device *pdev) |
1590 |
+ pm_runtime_dont_use_autosuspend(&pdev->dev); |
1591 |
+ if (!pm_runtime_suspended(&pdev->dev)) { |
1592 |
+ clk_disable_unprepare(bp->tx_clk); |
1593 |
+- clk_unregister(bp->tx_clk); |
1594 |
+ clk_disable_unprepare(bp->hclk); |
1595 |
+ clk_disable_unprepare(bp->pclk); |
1596 |
+ clk_disable_unprepare(bp->rx_clk); |
1597 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c |
1598 |
+index ae6a47dd7dc9..fb8ade9a05a9 100644 |
1599 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c |
1600 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c |
1601 |
+@@ -2996,6 +2996,9 @@ static int sge_queue_entries(const struct adapter *adap) |
1602 |
+ int tot_uld_entries = 0; |
1603 |
+ int i; |
1604 |
+ |
1605 |
++ if (!is_uld(adap)) |
1606 |
++ goto lld_only; |
1607 |
++ |
1608 |
+ mutex_lock(&uld_mutex); |
1609 |
+ for (i = 0; i < CXGB4_TX_MAX; i++) |
1610 |
+ tot_uld_entries += sge_qinfo_uld_txq_entries(adap, i); |
1611 |
+@@ -3006,6 +3009,7 @@ static int sge_queue_entries(const struct adapter *adap) |
1612 |
+ } |
1613 |
+ mutex_unlock(&uld_mutex); |
1614 |
+ |
1615 |
++lld_only: |
1616 |
+ return DIV_ROUND_UP(adap->sge.ethqsets, 4) + |
1617 |
+ tot_uld_entries + |
1618 |
+ DIV_ROUND_UP(MAX_CTRL_QUEUES, 4) + 1; |
1619 |
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
1620 |
+index 4bb30761abfc..8336f4cbaf95 100644 |
1621 |
+--- a/drivers/net/ethernet/freescale/fec_main.c |
1622 |
++++ b/drivers/net/ethernet/freescale/fec_main.c |
1623 |
+@@ -2199,8 +2199,14 @@ static void fec_enet_get_regs(struct net_device *ndev, |
1624 |
+ { |
1625 |
+ struct fec_enet_private *fep = netdev_priv(ndev); |
1626 |
+ u32 __iomem *theregs = (u32 __iomem *)fep->hwp; |
1627 |
++ struct device *dev = &fep->pdev->dev; |
1628 |
+ u32 *buf = (u32 *)regbuf; |
1629 |
+ u32 i, off; |
1630 |
++ int ret; |
1631 |
++ |
1632 |
++ ret = pm_runtime_get_sync(dev); |
1633 |
++ if (ret < 0) |
1634 |
++ return; |
1635 |
+ |
1636 |
+ regs->version = fec_enet_register_version; |
1637 |
+ |
1638 |
+@@ -2216,6 +2222,9 @@ static void fec_enet_get_regs(struct net_device *ndev, |
1639 |
+ off >>= 2; |
1640 |
+ buf[off] = readl(&theregs[off]); |
1641 |
+ } |
1642 |
++ |
1643 |
++ pm_runtime_mark_last_busy(dev); |
1644 |
++ pm_runtime_put_autosuspend(dev); |
1645 |
+ } |
1646 |
+ |
1647 |
+ static int fec_enet_get_ts_info(struct net_device *ndev, |
1648 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h |
1649 |
+index 2af9f6308f84..401304d4d553 100644 |
1650 |
+--- a/drivers/net/ethernet/intel/i40e/i40e.h |
1651 |
++++ b/drivers/net/ethernet/intel/i40e/i40e.h |
1652 |
+@@ -1151,7 +1151,7 @@ void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags); |
1653 |
+ |
1654 |
+ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) |
1655 |
+ { |
1656 |
+- return !!vsi->xdp_prog; |
1657 |
++ return !!READ_ONCE(vsi->xdp_prog); |
1658 |
+ } |
1659 |
+ |
1660 |
+ int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch); |
1661 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1662 |
+index 339925af0206..4960c9c3e773 100644 |
1663 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
1664 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1665 |
+@@ -6804,8 +6804,8 @@ void i40e_down(struct i40e_vsi *vsi) |
1666 |
+ for (i = 0; i < vsi->num_queue_pairs; i++) { |
1667 |
+ i40e_clean_tx_ring(vsi->tx_rings[i]); |
1668 |
+ if (i40e_enabled_xdp_vsi(vsi)) { |
1669 |
+- /* Make sure that in-progress ndo_xdp_xmit |
1670 |
+- * calls are completed. |
1671 |
++ /* Make sure that in-progress ndo_xdp_xmit and |
1672 |
++ * ndo_xsk_wakeup calls are completed. |
1673 |
+ */ |
1674 |
+ synchronize_rcu(); |
1675 |
+ i40e_clean_tx_ring(vsi->xdp_rings[i]); |
1676 |
+@@ -12526,8 +12526,12 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, |
1677 |
+ |
1678 |
+ old_prog = xchg(&vsi->xdp_prog, prog); |
1679 |
+ |
1680 |
+- if (need_reset) |
1681 |
++ if (need_reset) { |
1682 |
++ if (!prog) |
1683 |
++ /* Wait until ndo_xsk_wakeup completes. */ |
1684 |
++ synchronize_rcu(); |
1685 |
+ i40e_reset_and_rebuild(pf, true, true); |
1686 |
++ } |
1687 |
+ |
1688 |
+ for (i = 0; i < vsi->num_queue_pairs; i++) |
1689 |
+ WRITE_ONCE(vsi->rx_rings[i]->xdp_prog, vsi->xdp_prog); |
1690 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
1691 |
+index d07e1a890428..f73cd917c44f 100644 |
1692 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
1693 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
1694 |
+@@ -787,8 +787,12 @@ int i40e_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags) |
1695 |
+ { |
1696 |
+ struct i40e_netdev_priv *np = netdev_priv(dev); |
1697 |
+ struct i40e_vsi *vsi = np->vsi; |
1698 |
++ struct i40e_pf *pf = vsi->back; |
1699 |
+ struct i40e_ring *ring; |
1700 |
+ |
1701 |
++ if (test_bit(__I40E_CONFIG_BUSY, pf->state)) |
1702 |
++ return -ENETDOWN; |
1703 |
++ |
1704 |
+ if (test_bit(__I40E_VSI_DOWN, vsi->state)) |
1705 |
+ return -ENETDOWN; |
1706 |
+ |
1707 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1708 |
+index 1a7203fede12..c6404abf2dd1 100644 |
1709 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1710 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1711 |
+@@ -10248,7 +10248,12 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) |
1712 |
+ |
1713 |
+ /* If transitioning XDP modes reconfigure rings */ |
1714 |
+ if (need_reset) { |
1715 |
+- int err = ixgbe_setup_tc(dev, adapter->hw_tcs); |
1716 |
++ int err; |
1717 |
++ |
1718 |
++ if (!prog) |
1719 |
++ /* Wait until ndo_xsk_wakeup completes. */ |
1720 |
++ synchronize_rcu(); |
1721 |
++ err = ixgbe_setup_tc(dev, adapter->hw_tcs); |
1722 |
+ |
1723 |
+ if (err) { |
1724 |
+ rcu_assign_pointer(adapter->xdp_prog, old_prog); |
1725 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
1726 |
+index d6feaacfbf89..b43be9f14105 100644 |
1727 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
1728 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
1729 |
+@@ -709,10 +709,14 @@ int ixgbe_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) |
1730 |
+ if (qid >= adapter->num_xdp_queues) |
1731 |
+ return -ENXIO; |
1732 |
+ |
1733 |
+- if (!adapter->xdp_ring[qid]->xsk_umem) |
1734 |
++ ring = adapter->xdp_ring[qid]; |
1735 |
++ |
1736 |
++ if (test_bit(__IXGBE_TX_DISABLED, &ring->state)) |
1737 |
++ return -ENETDOWN; |
1738 |
++ |
1739 |
++ if (!ring->xsk_umem) |
1740 |
+ return -ENXIO; |
1741 |
+ |
1742 |
+- ring = adapter->xdp_ring[qid]; |
1743 |
+ if (!napi_if_scheduled_mark_missed(&ring->q_vector->napi)) { |
1744 |
+ u64 eics = BIT_ULL(ring->q_vector->v_idx); |
1745 |
+ |
1746 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1747 |
+index 2c16add0b642..9c8427698238 100644 |
1748 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1749 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1750 |
+@@ -760,7 +760,7 @@ enum { |
1751 |
+ MLX5E_STATE_OPENED, |
1752 |
+ MLX5E_STATE_DESTROYING, |
1753 |
+ MLX5E_STATE_XDP_TX_ENABLED, |
1754 |
+- MLX5E_STATE_XDP_OPEN, |
1755 |
++ MLX5E_STATE_XDP_ACTIVE, |
1756 |
+ }; |
1757 |
+ |
1758 |
+ struct mlx5e_rqt { |
1759 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1760 |
+index 68d593074f6c..d48292ccda29 100644 |
1761 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1762 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1763 |
+@@ -122,6 +122,22 @@ enum { |
1764 |
+ #endif |
1765 |
+ }; |
1766 |
+ |
1767 |
++#define MLX5E_TTC_NUM_GROUPS 3 |
1768 |
++#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT) |
1769 |
++#define MLX5E_TTC_GROUP2_SIZE BIT(1) |
1770 |
++#define MLX5E_TTC_GROUP3_SIZE BIT(0) |
1771 |
++#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\ |
1772 |
++ MLX5E_TTC_GROUP2_SIZE +\ |
1773 |
++ MLX5E_TTC_GROUP3_SIZE) |
1774 |
++ |
1775 |
++#define MLX5E_INNER_TTC_NUM_GROUPS 3 |
1776 |
++#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3) |
1777 |
++#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1) |
1778 |
++#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0) |
1779 |
++#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\ |
1780 |
++ MLX5E_INNER_TTC_GROUP2_SIZE +\ |
1781 |
++ MLX5E_INNER_TTC_GROUP3_SIZE) |
1782 |
++ |
1783 |
+ #ifdef CONFIG_MLX5_EN_RXNFC |
1784 |
+ |
1785 |
+ struct mlx5e_ethtool_table { |
1786 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/health.c b/drivers/net/ethernet/mellanox/mlx5/core/en/health.c |
1787 |
+index 1d6b58860da6..3a975641f902 100644 |
1788 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/health.c |
1789 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/health.c |
1790 |
+@@ -197,9 +197,10 @@ int mlx5e_health_report(struct mlx5e_priv *priv, |
1791 |
+ struct devlink_health_reporter *reporter, char *err_str, |
1792 |
+ struct mlx5e_err_ctx *err_ctx) |
1793 |
+ { |
1794 |
+- if (!reporter) { |
1795 |
+- netdev_err(priv->netdev, err_str); |
1796 |
++ netdev_err(priv->netdev, err_str); |
1797 |
++ |
1798 |
++ if (!reporter) |
1799 |
+ return err_ctx->recover(&err_ctx->ctx); |
1800 |
+- } |
1801 |
++ |
1802 |
+ return devlink_health_report(reporter, err_str, err_ctx); |
1803 |
+ } |
1804 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h |
1805 |
+index 36ac1e3816b9..d7587f40ecae 100644 |
1806 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h |
1807 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h |
1808 |
+@@ -75,12 +75,18 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, |
1809 |
+ static inline void mlx5e_xdp_tx_enable(struct mlx5e_priv *priv) |
1810 |
+ { |
1811 |
+ set_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); |
1812 |
++ |
1813 |
++ if (priv->channels.params.xdp_prog) |
1814 |
++ set_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); |
1815 |
+ } |
1816 |
+ |
1817 |
+ static inline void mlx5e_xdp_tx_disable(struct mlx5e_priv *priv) |
1818 |
+ { |
1819 |
++ if (priv->channels.params.xdp_prog) |
1820 |
++ clear_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); |
1821 |
++ |
1822 |
+ clear_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); |
1823 |
+- /* let other device's napi(s) see our new state */ |
1824 |
++ /* Let other device's napi(s) and XSK wakeups see our new state. */ |
1825 |
+ synchronize_rcu(); |
1826 |
+ } |
1827 |
+ |
1828 |
+@@ -89,19 +95,9 @@ static inline bool mlx5e_xdp_tx_is_enabled(struct mlx5e_priv *priv) |
1829 |
+ return test_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); |
1830 |
+ } |
1831 |
+ |
1832 |
+-static inline void mlx5e_xdp_set_open(struct mlx5e_priv *priv) |
1833 |
+-{ |
1834 |
+- set_bit(MLX5E_STATE_XDP_OPEN, &priv->state); |
1835 |
+-} |
1836 |
+- |
1837 |
+-static inline void mlx5e_xdp_set_closed(struct mlx5e_priv *priv) |
1838 |
+-{ |
1839 |
+- clear_bit(MLX5E_STATE_XDP_OPEN, &priv->state); |
1840 |
+-} |
1841 |
+- |
1842 |
+-static inline bool mlx5e_xdp_is_open(struct mlx5e_priv *priv) |
1843 |
++static inline bool mlx5e_xdp_is_active(struct mlx5e_priv *priv) |
1844 |
+ { |
1845 |
+- return test_bit(MLX5E_STATE_XDP_OPEN, &priv->state); |
1846 |
++ return test_bit(MLX5E_STATE_XDP_ACTIVE, &priv->state); |
1847 |
+ } |
1848 |
+ |
1849 |
+ static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_xdpsq *sq) |
1850 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c |
1851 |
+index 631af8dee517..c28cbae42331 100644 |
1852 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c |
1853 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c |
1854 |
+@@ -144,6 +144,7 @@ void mlx5e_close_xsk(struct mlx5e_channel *c) |
1855 |
+ { |
1856 |
+ clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state); |
1857 |
+ napi_synchronize(&c->napi); |
1858 |
++ synchronize_rcu(); /* Sync with the XSK wakeup. */ |
1859 |
+ |
1860 |
+ mlx5e_close_rq(&c->xskrq); |
1861 |
+ mlx5e_close_cq(&c->xskrq.cq); |
1862 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1863 |
+index 87827477d38c..fe2d596cb361 100644 |
1864 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1865 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1866 |
+@@ -14,7 +14,7 @@ int mlx5e_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) |
1867 |
+ struct mlx5e_channel *c; |
1868 |
+ u16 ix; |
1869 |
+ |
1870 |
+- if (unlikely(!mlx5e_xdp_is_open(priv))) |
1871 |
++ if (unlikely(!mlx5e_xdp_is_active(priv))) |
1872 |
+ return -ENETDOWN; |
1873 |
+ |
1874 |
+ if (unlikely(!mlx5e_qid_get_ch_if_in_group(params, qid, MLX5E_RQ_GROUP_XSK, &ix))) |
1875 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1876 |
+index 15b7f0f1427c..73d3dc07331f 100644 |
1877 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1878 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1879 |
+@@ -904,22 +904,6 @@ del_rules: |
1880 |
+ return err; |
1881 |
+ } |
1882 |
+ |
1883 |
+-#define MLX5E_TTC_NUM_GROUPS 3 |
1884 |
+-#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT) |
1885 |
+-#define MLX5E_TTC_GROUP2_SIZE BIT(1) |
1886 |
+-#define MLX5E_TTC_GROUP3_SIZE BIT(0) |
1887 |
+-#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\ |
1888 |
+- MLX5E_TTC_GROUP2_SIZE +\ |
1889 |
+- MLX5E_TTC_GROUP3_SIZE) |
1890 |
+- |
1891 |
+-#define MLX5E_INNER_TTC_NUM_GROUPS 3 |
1892 |
+-#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3) |
1893 |
+-#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1) |
1894 |
+-#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0) |
1895 |
+-#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\ |
1896 |
+- MLX5E_INNER_TTC_GROUP2_SIZE +\ |
1897 |
+- MLX5E_INNER_TTC_GROUP3_SIZE) |
1898 |
+- |
1899 |
+ static int mlx5e_create_ttc_table_groups(struct mlx5e_ttc_table *ttc, |
1900 |
+ bool use_ipv) |
1901 |
+ { |
1902 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1903 |
+index 6abd4ed5b69b..29a5a8c894e3 100644 |
1904 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1905 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1906 |
+@@ -3002,12 +3002,9 @@ void mlx5e_timestamp_init(struct mlx5e_priv *priv) |
1907 |
+ int mlx5e_open_locked(struct net_device *netdev) |
1908 |
+ { |
1909 |
+ struct mlx5e_priv *priv = netdev_priv(netdev); |
1910 |
+- bool is_xdp = priv->channels.params.xdp_prog; |
1911 |
+ int err; |
1912 |
+ |
1913 |
+ set_bit(MLX5E_STATE_OPENED, &priv->state); |
1914 |
+- if (is_xdp) |
1915 |
+- mlx5e_xdp_set_open(priv); |
1916 |
+ |
1917 |
+ err = mlx5e_open_channels(priv, &priv->channels); |
1918 |
+ if (err) |
1919 |
+@@ -3022,8 +3019,6 @@ int mlx5e_open_locked(struct net_device *netdev) |
1920 |
+ return 0; |
1921 |
+ |
1922 |
+ err_clear_state_opened_flag: |
1923 |
+- if (is_xdp) |
1924 |
+- mlx5e_xdp_set_closed(priv); |
1925 |
+ clear_bit(MLX5E_STATE_OPENED, &priv->state); |
1926 |
+ return err; |
1927 |
+ } |
1928 |
+@@ -3055,8 +3050,6 @@ int mlx5e_close_locked(struct net_device *netdev) |
1929 |
+ if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) |
1930 |
+ return 0; |
1931 |
+ |
1932 |
+- if (priv->channels.params.xdp_prog) |
1933 |
+- mlx5e_xdp_set_closed(priv); |
1934 |
+ clear_bit(MLX5E_STATE_OPENED, &priv->state); |
1935 |
+ |
1936 |
+ netif_carrier_off(priv->netdev); |
1937 |
+@@ -4373,16 +4366,6 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog) |
1938 |
+ return 0; |
1939 |
+ } |
1940 |
+ |
1941 |
+-static int mlx5e_xdp_update_state(struct mlx5e_priv *priv) |
1942 |
+-{ |
1943 |
+- if (priv->channels.params.xdp_prog) |
1944 |
+- mlx5e_xdp_set_open(priv); |
1945 |
+- else |
1946 |
+- mlx5e_xdp_set_closed(priv); |
1947 |
+- |
1948 |
+- return 0; |
1949 |
+-} |
1950 |
+- |
1951 |
+ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) |
1952 |
+ { |
1953 |
+ struct mlx5e_priv *priv = netdev_priv(netdev); |
1954 |
+@@ -4422,7 +4405,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) |
1955 |
+ mlx5e_set_rq_type(priv->mdev, &new_channels.params); |
1956 |
+ old_prog = priv->channels.params.xdp_prog; |
1957 |
+ |
1958 |
+- err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_xdp_update_state); |
1959 |
++ err = mlx5e_safe_switch_channels(priv, &new_channels, NULL); |
1960 |
+ if (err) |
1961 |
+ goto unlock; |
1962 |
+ } else { |
1963 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1964 |
+index 814a4ba4e7fa..947122c68493 100644 |
1965 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1966 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1967 |
+@@ -586,7 +586,7 @@ static void mlx5e_hairpin_set_ttc_params(struct mlx5e_hairpin *hp, |
1968 |
+ for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) |
1969 |
+ ttc_params->indir_tirn[tt] = hp->indir_tirn[tt]; |
1970 |
+ |
1971 |
+- ft_attr->max_fte = MLX5E_NUM_TT; |
1972 |
++ ft_attr->max_fte = MLX5E_TTC_TABLE_SIZE; |
1973 |
+ ft_attr->level = MLX5E_TC_TTC_FT_LEVEL; |
1974 |
+ ft_attr->prio = MLX5E_TC_PRIO; |
1975 |
+ } |
1976 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1977 |
+index 50ab88d80033..051ab845b501 100644 |
1978 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1979 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1980 |
+@@ -1197,6 +1197,12 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) |
1981 |
+ if (err) |
1982 |
+ goto err_load; |
1983 |
+ |
1984 |
++ if (boot) { |
1985 |
++ err = mlx5_devlink_register(priv_to_devlink(dev), dev->device); |
1986 |
++ if (err) |
1987 |
++ goto err_devlink_reg; |
1988 |
++ } |
1989 |
++ |
1990 |
+ if (mlx5_device_registered(dev)) { |
1991 |
+ mlx5_attach_device(dev); |
1992 |
+ } else { |
1993 |
+@@ -1214,6 +1220,9 @@ out: |
1994 |
+ return err; |
1995 |
+ |
1996 |
+ err_reg_dev: |
1997 |
++ if (boot) |
1998 |
++ mlx5_devlink_unregister(priv_to_devlink(dev)); |
1999 |
++err_devlink_reg: |
2000 |
+ mlx5_unload(dev); |
2001 |
+ err_load: |
2002 |
+ if (boot) |
2003 |
+@@ -1353,10 +1362,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
2004 |
+ |
2005 |
+ request_module_nowait(MLX5_IB_MOD); |
2006 |
+ |
2007 |
+- err = mlx5_devlink_register(devlink, &pdev->dev); |
2008 |
+- if (err) |
2009 |
+- goto clean_load; |
2010 |
+- |
2011 |
+ err = mlx5_crdump_enable(dev); |
2012 |
+ if (err) |
2013 |
+ dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err); |
2014 |
+@@ -1364,9 +1369,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
2015 |
+ pci_save_state(pdev); |
2016 |
+ return 0; |
2017 |
+ |
2018 |
+-clean_load: |
2019 |
+- mlx5_unload_one(dev, true); |
2020 |
+- |
2021 |
+ err_load_one: |
2022 |
+ mlx5_pci_close(dev); |
2023 |
+ pci_init_err: |
2024 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c |
2025 |
+index bd1699e62142..e1a647dde978 100644 |
2026 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c |
2027 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c |
2028 |
+@@ -209,7 +209,7 @@ static void dr_rule_rehash_copy_ste_ctrl(struct mlx5dr_matcher *matcher, |
2029 |
+ /* We need to copy the refcount since this ste |
2030 |
+ * may have been traversed several times |
2031 |
+ */ |
2032 |
+- refcount_set(&new_ste->refcount, refcount_read(&cur_ste->refcount)); |
2033 |
++ new_ste->refcount = cur_ste->refcount; |
2034 |
+ |
2035 |
+ /* Link old STEs rule_mem list to the new ste */ |
2036 |
+ mlx5dr_rule_update_rule_member(cur_ste, new_ste); |
2037 |
+@@ -638,6 +638,9 @@ static int dr_rule_add_member(struct mlx5dr_rule_rx_tx *nic_rule, |
2038 |
+ if (!rule_mem) |
2039 |
+ return -ENOMEM; |
2040 |
+ |
2041 |
++ INIT_LIST_HEAD(&rule_mem->list); |
2042 |
++ INIT_LIST_HEAD(&rule_mem->use_ste_list); |
2043 |
++ |
2044 |
+ rule_mem->ste = ste; |
2045 |
+ list_add_tail(&rule_mem->list, &nic_rule->rule_members_list); |
2046 |
+ |
2047 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c |
2048 |
+index 3cbf74b44d1f..2739ed2a2911 100644 |
2049 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c |
2050 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c |
2051 |
+@@ -340,7 +340,7 @@ static void dr_ste_replace(struct mlx5dr_ste *dst, struct mlx5dr_ste *src) |
2052 |
+ if (dst->next_htbl) |
2053 |
+ dst->next_htbl->pointing_ste = dst; |
2054 |
+ |
2055 |
+- refcount_set(&dst->refcount, refcount_read(&src->refcount)); |
2056 |
++ dst->refcount = src->refcount; |
2057 |
+ |
2058 |
+ INIT_LIST_HEAD(&dst->rule_list); |
2059 |
+ list_splice_tail_init(&src->rule_list, &dst->rule_list); |
2060 |
+@@ -557,7 +557,7 @@ bool mlx5dr_ste_is_not_valid_entry(u8 *p_hw_ste) |
2061 |
+ |
2062 |
+ bool mlx5dr_ste_not_used_ste(struct mlx5dr_ste *ste) |
2063 |
+ { |
2064 |
+- return !refcount_read(&ste->refcount); |
2065 |
++ return !ste->refcount; |
2066 |
+ } |
2067 |
+ |
2068 |
+ /* Init one ste as a pattern for ste data array */ |
2069 |
+@@ -681,14 +681,14 @@ struct mlx5dr_ste_htbl *mlx5dr_ste_htbl_alloc(struct mlx5dr_icm_pool *pool, |
2070 |
+ htbl->ste_arr = chunk->ste_arr; |
2071 |
+ htbl->hw_ste_arr = chunk->hw_ste_arr; |
2072 |
+ htbl->miss_list = chunk->miss_list; |
2073 |
+- refcount_set(&htbl->refcount, 0); |
2074 |
++ htbl->refcount = 0; |
2075 |
+ |
2076 |
+ for (i = 0; i < chunk->num_of_entries; i++) { |
2077 |
+ struct mlx5dr_ste *ste = &htbl->ste_arr[i]; |
2078 |
+ |
2079 |
+ ste->hw_ste = htbl->hw_ste_arr + i * DR_STE_SIZE_REDUCED; |
2080 |
+ ste->htbl = htbl; |
2081 |
+- refcount_set(&ste->refcount, 0); |
2082 |
++ ste->refcount = 0; |
2083 |
+ INIT_LIST_HEAD(&ste->miss_list_node); |
2084 |
+ INIT_LIST_HEAD(&htbl->miss_list[i]); |
2085 |
+ INIT_LIST_HEAD(&ste->rule_list); |
2086 |
+@@ -705,7 +705,7 @@ out_free_htbl: |
2087 |
+ |
2088 |
+ int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl) |
2089 |
+ { |
2090 |
+- if (refcount_read(&htbl->refcount)) |
2091 |
++ if (htbl->refcount) |
2092 |
+ return -EBUSY; |
2093 |
+ |
2094 |
+ mlx5dr_icm_free_chunk(htbl->chunk); |
2095 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h |
2096 |
+index 1cb3769d4e3c..31737dfca4ea 100644 |
2097 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h |
2098 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h |
2099 |
+@@ -117,7 +117,7 @@ struct mlx5dr_matcher_rx_tx; |
2100 |
+ struct mlx5dr_ste { |
2101 |
+ u8 *hw_ste; |
2102 |
+ /* refcount: indicates the num of rules that using this ste */ |
2103 |
+- refcount_t refcount; |
2104 |
++ u32 refcount; |
2105 |
+ |
2106 |
+ /* attached to the miss_list head at each htbl entry */ |
2107 |
+ struct list_head miss_list_node; |
2108 |
+@@ -149,7 +149,7 @@ struct mlx5dr_ste_htbl_ctrl { |
2109 |
+ struct mlx5dr_ste_htbl { |
2110 |
+ u8 lu_type; |
2111 |
+ u16 byte_mask; |
2112 |
+- refcount_t refcount; |
2113 |
++ u32 refcount; |
2114 |
+ struct mlx5dr_icm_chunk *chunk; |
2115 |
+ struct mlx5dr_ste *ste_arr; |
2116 |
+ u8 *hw_ste_arr; |
2117 |
+@@ -200,13 +200,14 @@ int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl); |
2118 |
+ |
2119 |
+ static inline void mlx5dr_htbl_put(struct mlx5dr_ste_htbl *htbl) |
2120 |
+ { |
2121 |
+- if (refcount_dec_and_test(&htbl->refcount)) |
2122 |
++ htbl->refcount--; |
2123 |
++ if (!htbl->refcount) |
2124 |
+ mlx5dr_ste_htbl_free(htbl); |
2125 |
+ } |
2126 |
+ |
2127 |
+ static inline void mlx5dr_htbl_get(struct mlx5dr_ste_htbl *htbl) |
2128 |
+ { |
2129 |
+- refcount_inc(&htbl->refcount); |
2130 |
++ htbl->refcount++; |
2131 |
+ } |
2132 |
+ |
2133 |
+ /* STE utils */ |
2134 |
+@@ -248,14 +249,15 @@ static inline void mlx5dr_ste_put(struct mlx5dr_ste *ste, |
2135 |
+ struct mlx5dr_matcher *matcher, |
2136 |
+ struct mlx5dr_matcher_rx_tx *nic_matcher) |
2137 |
+ { |
2138 |
+- if (refcount_dec_and_test(&ste->refcount)) |
2139 |
++ ste->refcount--; |
2140 |
++ if (!ste->refcount) |
2141 |
+ mlx5dr_ste_free(ste, matcher, nic_matcher); |
2142 |
+ } |
2143 |
+ |
2144 |
+ /* initial as 0, increased only when ste appears in a new rule */ |
2145 |
+ static inline void mlx5dr_ste_get(struct mlx5dr_ste *ste) |
2146 |
+ { |
2147 |
+- refcount_inc(&ste->refcount); |
2148 |
++ ste->refcount++; |
2149 |
+ } |
2150 |
+ |
2151 |
+ void mlx5dr_ste_set_hit_addr_by_next_htbl(u8 *hw_ste, |
2152 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c |
2153 |
+index bdf53cf350f6..720514b5c006 100644 |
2154 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c |
2155 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c |
2156 |
+@@ -650,6 +650,13 @@ mlxsw_sp_qdisc_prio_graft(struct mlxsw_sp_port *mlxsw_sp_port, |
2157 |
+ mlxsw_sp_port->tclass_qdiscs[tclass_num].handle == p->child_handle) |
2158 |
+ return 0; |
2159 |
+ |
2160 |
++ if (!p->child_handle) { |
2161 |
++ /* This is an invisible FIFO replacing the original Qdisc. |
2162 |
++ * Ignore it--the original Qdisc's destroy will follow. |
2163 |
++ */ |
2164 |
++ return 0; |
2165 |
++ } |
2166 |
++ |
2167 |
+ /* See if the grafted qdisc is already offloaded on any tclass. If so, |
2168 |
+ * unoffload it. |
2169 |
+ */ |
2170 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
2171 |
+index 6e47be63a43c..e9e0867ec139 100644 |
2172 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
2173 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
2174 |
+@@ -957,6 +957,9 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv) |
2175 |
+ /* default */ |
2176 |
+ break; |
2177 |
+ case PHY_INTERFACE_MODE_RGMII: |
2178 |
++ case PHY_INTERFACE_MODE_RGMII_ID: |
2179 |
++ case PHY_INTERFACE_MODE_RGMII_RXID: |
2180 |
++ case PHY_INTERFACE_MODE_RGMII_TXID: |
2181 |
+ reg |= SYSCON_EPIT | SYSCON_ETCS_INT_GMII; |
2182 |
+ break; |
2183 |
+ case PHY_INTERFACE_MODE_RMII: |
2184 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
2185 |
+index a299da3971b4..102d637bc84a 100644 |
2186 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
2187 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
2188 |
+@@ -44,7 +44,7 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) |
2189 |
+ * rate, which then uses the auto-reparenting feature of the |
2190 |
+ * clock driver, and enabling/disabling the clock. |
2191 |
+ */ |
2192 |
+- if (gmac->interface == PHY_INTERFACE_MODE_RGMII) { |
2193 |
++ if (phy_interface_mode_is_rgmii(gmac->interface)) { |
2194 |
+ clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); |
2195 |
+ clk_prepare_enable(gmac->tx_clk); |
2196 |
+ gmac->clk_enabled = 1; |
2197 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h |
2198 |
+index 9d08a934fe4f..ff751ab3d765 100644 |
2199 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h |
2200 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h |
2201 |
+@@ -343,6 +343,8 @@ |
2202 |
+ #define XGMAC_DMA_CH_RX_CONTROL(x) (0x00003108 + (0x80 * (x))) |
2203 |
+ #define XGMAC_RxPBL GENMASK(21, 16) |
2204 |
+ #define XGMAC_RxPBL_SHIFT 16 |
2205 |
++#define XGMAC_RBSZ GENMASK(14, 1) |
2206 |
++#define XGMAC_RBSZ_SHIFT 1 |
2207 |
+ #define XGMAC_RXST BIT(0) |
2208 |
+ #define XGMAC_DMA_CH_TxDESC_HADDR(x) (0x00003110 + (0x80 * (x))) |
2209 |
+ #define XGMAC_DMA_CH_TxDESC_LADDR(x) (0x00003114 + (0x80 * (x))) |
2210 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2211 |
+index f70ca5300b82..4af7271cea56 100644 |
2212 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2213 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2214 |
+@@ -489,7 +489,8 @@ static void dwxgmac2_set_bfsize(void __iomem *ioaddr, int bfsize, u32 chan) |
2215 |
+ u32 value; |
2216 |
+ |
2217 |
+ value = readl(ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan)); |
2218 |
+- value |= bfsize << 1; |
2219 |
++ value &= ~XGMAC_RBSZ; |
2220 |
++ value |= bfsize << XGMAC_RBSZ_SHIFT; |
2221 |
+ writel(value, ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan)); |
2222 |
+ } |
2223 |
+ |
2224 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2225 |
+index 271a00f24f45..903c5d8a226e 100644 |
2226 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2227 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2228 |
+@@ -45,7 +45,7 @@ |
2229 |
+ #include "dwxgmac2.h" |
2230 |
+ #include "hwif.h" |
2231 |
+ |
2232 |
+-#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) |
2233 |
++#define STMMAC_ALIGN(x) ALIGN(ALIGN(x, SMP_CACHE_BYTES), 16) |
2234 |
+ #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) |
2235 |
+ |
2236 |
+ /* Module parameters */ |
2237 |
+@@ -1292,19 +1292,9 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) |
2238 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2239 |
+ u32 rx_count = priv->plat->rx_queues_to_use; |
2240 |
+ int ret = -ENOMEM; |
2241 |
+- int bfsize = 0; |
2242 |
+ int queue; |
2243 |
+ int i; |
2244 |
+ |
2245 |
+- bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu); |
2246 |
+- if (bfsize < 0) |
2247 |
+- bfsize = 0; |
2248 |
+- |
2249 |
+- if (bfsize < BUF_SIZE_16KiB) |
2250 |
+- bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); |
2251 |
+- |
2252 |
+- priv->dma_buf_sz = bfsize; |
2253 |
+- |
2254 |
+ /* RX INITIALIZATION */ |
2255 |
+ netif_dbg(priv, probe, priv->dev, |
2256 |
+ "SKB addresses:\nskb\t\tskb data\tdma data\n"); |
2257 |
+@@ -1346,8 +1336,6 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) |
2258 |
+ } |
2259 |
+ } |
2260 |
+ |
2261 |
+- buf_sz = bfsize; |
2262 |
+- |
2263 |
+ return 0; |
2264 |
+ |
2265 |
+ err_init_rx_buffers: |
2266 |
+@@ -2654,6 +2642,7 @@ static void stmmac_hw_teardown(struct net_device *dev) |
2267 |
+ static int stmmac_open(struct net_device *dev) |
2268 |
+ { |
2269 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2270 |
++ int bfsize = 0; |
2271 |
+ u32 chan; |
2272 |
+ int ret; |
2273 |
+ |
2274 |
+@@ -2673,7 +2662,16 @@ static int stmmac_open(struct net_device *dev) |
2275 |
+ memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); |
2276 |
+ priv->xstats.threshold = tc; |
2277 |
+ |
2278 |
+- priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); |
2279 |
++ bfsize = stmmac_set_16kib_bfsize(priv, dev->mtu); |
2280 |
++ if (bfsize < 0) |
2281 |
++ bfsize = 0; |
2282 |
++ |
2283 |
++ if (bfsize < BUF_SIZE_16KiB) |
2284 |
++ bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); |
2285 |
++ |
2286 |
++ priv->dma_buf_sz = bfsize; |
2287 |
++ buf_sz = bfsize; |
2288 |
++ |
2289 |
+ priv->rx_copybreak = STMMAC_RX_COPYBREAK; |
2290 |
+ |
2291 |
+ ret = alloc_dma_desc_resources(priv); |
2292 |
+@@ -3103,6 +3101,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) |
2293 |
+ |
2294 |
+ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2295 |
+ stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); |
2296 |
++ stmmac_tx_timer_arm(priv, queue); |
2297 |
+ |
2298 |
+ return NETDEV_TX_OK; |
2299 |
+ |
2300 |
+@@ -3330,6 +3329,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2301 |
+ |
2302 |
+ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2303 |
+ stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); |
2304 |
++ stmmac_tx_timer_arm(priv, queue); |
2305 |
+ |
2306 |
+ return NETDEV_TX_OK; |
2307 |
+ |
2308 |
+@@ -3747,12 +3747,24 @@ static void stmmac_set_rx_mode(struct net_device *dev) |
2309 |
+ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) |
2310 |
+ { |
2311 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2312 |
++ int txfifosz = priv->plat->tx_fifo_size; |
2313 |
++ |
2314 |
++ if (txfifosz == 0) |
2315 |
++ txfifosz = priv->dma_cap.tx_fifo_size; |
2316 |
++ |
2317 |
++ txfifosz /= priv->plat->tx_queues_to_use; |
2318 |
+ |
2319 |
+ if (netif_running(dev)) { |
2320 |
+ netdev_err(priv->dev, "must be stopped to change its MTU\n"); |
2321 |
+ return -EBUSY; |
2322 |
+ } |
2323 |
+ |
2324 |
++ new_mtu = STMMAC_ALIGN(new_mtu); |
2325 |
++ |
2326 |
++ /* If condition true, FIFO is too small or MTU too large */ |
2327 |
++ if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) |
2328 |
++ return -EINVAL; |
2329 |
++ |
2330 |
+ dev->mtu = new_mtu; |
2331 |
+ |
2332 |
+ netdev_update_features(dev); |
2333 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2334 |
+index 1f230bd854c4..5150551c28be 100644 |
2335 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2336 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2337 |
+@@ -320,7 +320,7 @@ out: |
2338 |
+ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, |
2339 |
+ struct device_node *np, struct device *dev) |
2340 |
+ { |
2341 |
+- bool mdio = false; |
2342 |
++ bool mdio = !of_phy_is_fixed_link(np); |
2343 |
+ static const struct of_device_id need_mdio_ids[] = { |
2344 |
+ { .compatible = "snps,dwc-qos-ethernet-4.10" }, |
2345 |
+ {}, |
2346 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c |
2347 |
+index ac3f658105c0..a0513deab1a0 100644 |
2348 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c |
2349 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c |
2350 |
+@@ -624,6 +624,8 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) |
2351 |
+ return -EOPNOTSUPP; |
2352 |
+ if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries) |
2353 |
+ return -EOPNOTSUPP; |
2354 |
++ if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) |
2355 |
++ return -EOPNOTSUPP; |
2356 |
+ |
2357 |
+ while (--tries) { |
2358 |
+ /* We only need to check the mc_addr for collisions */ |
2359 |
+@@ -666,6 +668,8 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) |
2360 |
+ |
2361 |
+ if (stmmac_filter_check(priv)) |
2362 |
+ return -EOPNOTSUPP; |
2363 |
++ if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries) |
2364 |
++ return -EOPNOTSUPP; |
2365 |
+ if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) |
2366 |
+ return -EOPNOTSUPP; |
2367 |
+ |
2368 |
+diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c |
2369 |
+index fca471e27f39..f6222ada6818 100644 |
2370 |
+--- a/drivers/net/gtp.c |
2371 |
++++ b/drivers/net/gtp.c |
2372 |
+@@ -813,7 +813,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, |
2373 |
+ lock_sock(sock->sk); |
2374 |
+ if (sock->sk->sk_user_data) { |
2375 |
+ sk = ERR_PTR(-EBUSY); |
2376 |
+- goto out_sock; |
2377 |
++ goto out_rel_sock; |
2378 |
+ } |
2379 |
+ |
2380 |
+ sk = sock->sk; |
2381 |
+@@ -826,8 +826,9 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, |
2382 |
+ |
2383 |
+ setup_udp_tunnel_sock(sock_net(sock->sk), sock, &tuncfg); |
2384 |
+ |
2385 |
+-out_sock: |
2386 |
++out_rel_sock: |
2387 |
+ release_sock(sock->sk); |
2388 |
++out_sock: |
2389 |
+ sockfd_put(sock); |
2390 |
+ return sk; |
2391 |
+ } |
2392 |
+diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
2393 |
+index fb547f37af1e..e74f2d1def80 100644 |
2394 |
+--- a/drivers/net/hyperv/hyperv_net.h |
2395 |
++++ b/drivers/net/hyperv/hyperv_net.h |
2396 |
+@@ -169,7 +169,6 @@ struct rndis_device { |
2397 |
+ |
2398 |
+ u8 hw_mac_adr[ETH_ALEN]; |
2399 |
+ u8 rss_key[NETVSC_HASH_KEYLEN]; |
2400 |
+- u16 rx_table[ITAB_NUM]; |
2401 |
+ }; |
2402 |
+ |
2403 |
+ |
2404 |
+@@ -938,6 +937,8 @@ struct net_device_context { |
2405 |
+ |
2406 |
+ u32 tx_table[VRSS_SEND_TAB_SIZE]; |
2407 |
+ |
2408 |
++ u16 rx_table[ITAB_NUM]; |
2409 |
++ |
2410 |
+ /* Ethtool settings */ |
2411 |
+ u8 duplex; |
2412 |
+ u32 speed; |
2413 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
2414 |
+index 963509add611..78e3e689a733 100644 |
2415 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
2416 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
2417 |
+@@ -1659,7 +1659,7 @@ static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, |
2418 |
+ rndis_dev = ndev->extension; |
2419 |
+ if (indir) { |
2420 |
+ for (i = 0; i < ITAB_NUM; i++) |
2421 |
+- indir[i] = rndis_dev->rx_table[i]; |
2422 |
++ indir[i] = ndc->rx_table[i]; |
2423 |
+ } |
2424 |
+ |
2425 |
+ if (key) |
2426 |
+@@ -1689,7 +1689,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir, |
2427 |
+ return -EINVAL; |
2428 |
+ |
2429 |
+ for (i = 0; i < ITAB_NUM; i++) |
2430 |
+- rndis_dev->rx_table[i] = indir[i]; |
2431 |
++ ndc->rx_table[i] = indir[i]; |
2432 |
+ } |
2433 |
+ |
2434 |
+ if (!key) { |
2435 |
+diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c |
2436 |
+index e3d3c9097ff1..f81e58267a6e 100644 |
2437 |
+--- a/drivers/net/hyperv/rndis_filter.c |
2438 |
++++ b/drivers/net/hyperv/rndis_filter.c |
2439 |
+@@ -767,6 +767,7 @@ static int rndis_set_rss_param_msg(struct rndis_device *rdev, |
2440 |
+ const u8 *rss_key, u16 flag) |
2441 |
+ { |
2442 |
+ struct net_device *ndev = rdev->ndev; |
2443 |
++ struct net_device_context *ndc = netdev_priv(ndev); |
2444 |
+ struct rndis_request *request; |
2445 |
+ struct rndis_set_request *set; |
2446 |
+ struct rndis_set_complete *set_complete; |
2447 |
+@@ -806,7 +807,7 @@ static int rndis_set_rss_param_msg(struct rndis_device *rdev, |
2448 |
+ /* Set indirection table entries */ |
2449 |
+ itab = (u32 *)(rssp + 1); |
2450 |
+ for (i = 0; i < ITAB_NUM; i++) |
2451 |
+- itab[i] = rdev->rx_table[i]; |
2452 |
++ itab[i] = ndc->rx_table[i]; |
2453 |
+ |
2454 |
+ /* Set hask key values */ |
2455 |
+ keyp = (u8 *)((unsigned long)rssp + rssp->hashkey_offset); |
2456 |
+@@ -1305,6 +1306,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, |
2457 |
+ struct netvsc_device_info *device_info) |
2458 |
+ { |
2459 |
+ struct net_device *net = hv_get_drvdata(dev); |
2460 |
++ struct net_device_context *ndc = netdev_priv(net); |
2461 |
+ struct netvsc_device *net_device; |
2462 |
+ struct rndis_device *rndis_device; |
2463 |
+ struct ndis_recv_scale_cap rsscap; |
2464 |
+@@ -1391,9 +1393,11 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, |
2465 |
+ /* We will use the given number of channels if available. */ |
2466 |
+ net_device->num_chn = min(net_device->max_chn, device_info->num_chn); |
2467 |
+ |
2468 |
+- for (i = 0; i < ITAB_NUM; i++) |
2469 |
+- rndis_device->rx_table[i] = ethtool_rxfh_indir_default( |
2470 |
++ if (!netif_is_rxfh_configured(net)) { |
2471 |
++ for (i = 0; i < ITAB_NUM; i++) |
2472 |
++ ndc->rx_table[i] = ethtool_rxfh_indir_default( |
2473 |
+ i, net_device->num_chn); |
2474 |
++ } |
2475 |
+ |
2476 |
+ atomic_set(&net_device->open_chn, 1); |
2477 |
+ vmbus_set_sc_create_callback(dev->channel, netvsc_sc_open); |
2478 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
2479 |
+index 05631d97eeb4..747c0542a53c 100644 |
2480 |
+--- a/drivers/net/macvlan.c |
2481 |
++++ b/drivers/net/macvlan.c |
2482 |
+@@ -259,7 +259,7 @@ static void macvlan_broadcast(struct sk_buff *skb, |
2483 |
+ struct net_device *src, |
2484 |
+ enum macvlan_mode mode) |
2485 |
+ { |
2486 |
+- const struct ethhdr *eth = eth_hdr(skb); |
2487 |
++ const struct ethhdr *eth = skb_eth_hdr(skb); |
2488 |
+ const struct macvlan_dev *vlan; |
2489 |
+ struct sk_buff *nskb; |
2490 |
+ unsigned int i; |
2491 |
+diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
2492 |
+index 0becc79fd431..3e5f2f7a155e 100644 |
2493 |
+--- a/drivers/net/usb/lan78xx.c |
2494 |
++++ b/drivers/net/usb/lan78xx.c |
2495 |
+@@ -511,7 +511,7 @@ static int lan78xx_read_stats(struct lan78xx_net *dev, |
2496 |
+ } |
2497 |
+ } else { |
2498 |
+ netdev_warn(dev->net, |
2499 |
+- "Failed to read stat ret = 0x%x", ret); |
2500 |
++ "Failed to read stat ret = %d", ret); |
2501 |
+ } |
2502 |
+ |
2503 |
+ kfree(stats); |
2504 |
+@@ -2724,11 +2724,6 @@ static int lan78xx_stop(struct net_device *net) |
2505 |
+ return 0; |
2506 |
+ } |
2507 |
+ |
2508 |
+-static int lan78xx_linearize(struct sk_buff *skb) |
2509 |
+-{ |
2510 |
+- return skb_linearize(skb); |
2511 |
+-} |
2512 |
+- |
2513 |
+ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, |
2514 |
+ struct sk_buff *skb, gfp_t flags) |
2515 |
+ { |
2516 |
+@@ -2740,8 +2735,10 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, |
2517 |
+ return NULL; |
2518 |
+ } |
2519 |
+ |
2520 |
+- if (lan78xx_linearize(skb) < 0) |
2521 |
++ if (skb_linearize(skb)) { |
2522 |
++ dev_kfree_skb_any(skb); |
2523 |
+ return NULL; |
2524 |
++ } |
2525 |
+ |
2526 |
+ tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_; |
2527 |
+ |
2528 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
2529 |
+index 404ac3a0d1c3..283dfeb406ad 100644 |
2530 |
+--- a/drivers/net/vxlan.c |
2531 |
++++ b/drivers/net/vxlan.c |
2532 |
+@@ -2542,7 +2542,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
2533 |
+ ndst = &rt->dst; |
2534 |
+ skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM); |
2535 |
+ |
2536 |
+- tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
2537 |
++ tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
2538 |
+ ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
2539 |
+ err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr), |
2540 |
+ vni, md, flags, udp_sum); |
2541 |
+@@ -2582,7 +2582,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
2542 |
+ |
2543 |
+ skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM); |
2544 |
+ |
2545 |
+- tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
2546 |
++ tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
2547 |
+ ttl = ttl ? : ip6_dst_hoplimit(ndst); |
2548 |
+ skb_scrub_packet(skb, xnet); |
2549 |
+ err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr), |
2550 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c |
2551 |
+index 09313047beed..7caf1d26124a 100644 |
2552 |
+--- a/drivers/net/wireless/marvell/mwifiex/tdls.c |
2553 |
++++ b/drivers/net/wireless/marvell/mwifiex/tdls.c |
2554 |
+@@ -953,59 +953,117 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv, |
2555 |
+ |
2556 |
+ switch (*pos) { |
2557 |
+ case WLAN_EID_SUPP_RATES: |
2558 |
++ if (pos[1] > 32) |
2559 |
++ return; |
2560 |
+ sta_ptr->tdls_cap.rates_len = pos[1]; |
2561 |
+ for (i = 0; i < pos[1]; i++) |
2562 |
+ sta_ptr->tdls_cap.rates[i] = pos[i + 2]; |
2563 |
+ break; |
2564 |
+ |
2565 |
+ case WLAN_EID_EXT_SUPP_RATES: |
2566 |
++ if (pos[1] > 32) |
2567 |
++ return; |
2568 |
+ basic = sta_ptr->tdls_cap.rates_len; |
2569 |
++ if (pos[1] > 32 - basic) |
2570 |
++ return; |
2571 |
+ for (i = 0; i < pos[1]; i++) |
2572 |
+ sta_ptr->tdls_cap.rates[basic + i] = pos[i + 2]; |
2573 |
+ sta_ptr->tdls_cap.rates_len += pos[1]; |
2574 |
+ break; |
2575 |
+ case WLAN_EID_HT_CAPABILITY: |
2576 |
+- memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos, |
2577 |
++ if (pos > end - sizeof(struct ieee80211_ht_cap) - 2) |
2578 |
++ return; |
2579 |
++ if (pos[1] != sizeof(struct ieee80211_ht_cap)) |
2580 |
++ return; |
2581 |
++ /* copy the ie's value into ht_capb*/ |
2582 |
++ memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos + 2, |
2583 |
+ sizeof(struct ieee80211_ht_cap)); |
2584 |
+ sta_ptr->is_11n_enabled = 1; |
2585 |
+ break; |
2586 |
+ case WLAN_EID_HT_OPERATION: |
2587 |
+- memcpy(&sta_ptr->tdls_cap.ht_oper, pos, |
2588 |
++ if (pos > end - |
2589 |
++ sizeof(struct ieee80211_ht_operation) - 2) |
2590 |
++ return; |
2591 |
++ if (pos[1] != sizeof(struct ieee80211_ht_operation)) |
2592 |
++ return; |
2593 |
++ /* copy the ie's value into ht_oper*/ |
2594 |
++ memcpy(&sta_ptr->tdls_cap.ht_oper, pos + 2, |
2595 |
+ sizeof(struct ieee80211_ht_operation)); |
2596 |
+ break; |
2597 |
+ case WLAN_EID_BSS_COEX_2040: |
2598 |
++ if (pos > end - 3) |
2599 |
++ return; |
2600 |
++ if (pos[1] != 1) |
2601 |
++ return; |
2602 |
+ sta_ptr->tdls_cap.coex_2040 = pos[2]; |
2603 |
+ break; |
2604 |
+ case WLAN_EID_EXT_CAPABILITY: |
2605 |
++ if (pos > end - sizeof(struct ieee_types_header)) |
2606 |
++ return; |
2607 |
++ if (pos[1] < sizeof(struct ieee_types_header)) |
2608 |
++ return; |
2609 |
++ if (pos[1] > 8) |
2610 |
++ return; |
2611 |
+ memcpy((u8 *)&sta_ptr->tdls_cap.extcap, pos, |
2612 |
+ sizeof(struct ieee_types_header) + |
2613 |
+ min_t(u8, pos[1], 8)); |
2614 |
+ break; |
2615 |
+ case WLAN_EID_RSN: |
2616 |
++ if (pos > end - sizeof(struct ieee_types_header)) |
2617 |
++ return; |
2618 |
++ if (pos[1] < sizeof(struct ieee_types_header)) |
2619 |
++ return; |
2620 |
++ if (pos[1] > IEEE_MAX_IE_SIZE - |
2621 |
++ sizeof(struct ieee_types_header)) |
2622 |
++ return; |
2623 |
+ memcpy((u8 *)&sta_ptr->tdls_cap.rsn_ie, pos, |
2624 |
+ sizeof(struct ieee_types_header) + |
2625 |
+ min_t(u8, pos[1], IEEE_MAX_IE_SIZE - |
2626 |
+ sizeof(struct ieee_types_header))); |
2627 |
+ break; |
2628 |
+ case WLAN_EID_QOS_CAPA: |
2629 |
++ if (pos > end - 3) |
2630 |
++ return; |
2631 |
++ if (pos[1] != 1) |
2632 |
++ return; |
2633 |
+ sta_ptr->tdls_cap.qos_info = pos[2]; |
2634 |
+ break; |
2635 |
+ case WLAN_EID_VHT_OPERATION: |
2636 |
+- if (priv->adapter->is_hw_11ac_capable) |
2637 |
+- memcpy(&sta_ptr->tdls_cap.vhtoper, pos, |
2638 |
++ if (priv->adapter->is_hw_11ac_capable) { |
2639 |
++ if (pos > end - |
2640 |
++ sizeof(struct ieee80211_vht_operation) - 2) |
2641 |
++ return; |
2642 |
++ if (pos[1] != |
2643 |
++ sizeof(struct ieee80211_vht_operation)) |
2644 |
++ return; |
2645 |
++ /* copy the ie's value into vhtoper*/ |
2646 |
++ memcpy(&sta_ptr->tdls_cap.vhtoper, pos + 2, |
2647 |
+ sizeof(struct ieee80211_vht_operation)); |
2648 |
++ } |
2649 |
+ break; |
2650 |
+ case WLAN_EID_VHT_CAPABILITY: |
2651 |
+ if (priv->adapter->is_hw_11ac_capable) { |
2652 |
+- memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos, |
2653 |
++ if (pos > end - |
2654 |
++ sizeof(struct ieee80211_vht_cap) - 2) |
2655 |
++ return; |
2656 |
++ if (pos[1] != sizeof(struct ieee80211_vht_cap)) |
2657 |
++ return; |
2658 |
++ /* copy the ie's value into vhtcap*/ |
2659 |
++ memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos + 2, |
2660 |
+ sizeof(struct ieee80211_vht_cap)); |
2661 |
+ sta_ptr->is_11ac_enabled = 1; |
2662 |
+ } |
2663 |
+ break; |
2664 |
+ case WLAN_EID_AID: |
2665 |
+- if (priv->adapter->is_hw_11ac_capable) |
2666 |
++ if (priv->adapter->is_hw_11ac_capable) { |
2667 |
++ if (pos > end - 4) |
2668 |
++ return; |
2669 |
++ if (pos[1] != 2) |
2670 |
++ return; |
2671 |
+ sta_ptr->tdls_cap.aid = |
2672 |
+ get_unaligned_le16((pos + 2)); |
2673 |
++ } |
2674 |
++ break; |
2675 |
+ default: |
2676 |
+ break; |
2677 |
+ } |
2678 |
+diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c |
2679 |
+index abcf54f7d19c..191f410cf35c 100644 |
2680 |
+--- a/drivers/perf/arm_smmuv3_pmu.c |
2681 |
++++ b/drivers/perf/arm_smmuv3_pmu.c |
2682 |
+@@ -815,7 +815,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) |
2683 |
+ if (err) { |
2684 |
+ dev_err(dev, "Error %d registering hotplug, PMU @%pa\n", |
2685 |
+ err, &res_0->start); |
2686 |
+- goto out_cpuhp_err; |
2687 |
++ return err; |
2688 |
+ } |
2689 |
+ |
2690 |
+ err = perf_pmu_register(&smmu_pmu->pmu, name, -1); |
2691 |
+@@ -834,8 +834,6 @@ static int smmu_pmu_probe(struct platform_device *pdev) |
2692 |
+ |
2693 |
+ out_unregister: |
2694 |
+ cpuhp_state_remove_instance_nocalls(cpuhp_state_num, &smmu_pmu->node); |
2695 |
+-out_cpuhp_err: |
2696 |
+- put_cpu(); |
2697 |
+ return err; |
2698 |
+ } |
2699 |
+ |
2700 |
+diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c |
2701 |
+index c6800d220920..bb07024d22ed 100644 |
2702 |
+--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c |
2703 |
++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c |
2704 |
+@@ -1088,60 +1088,52 @@ SSSF_PIN_DECL(AF15, GPIOV7, LPCSMI, SIG_DESC_SET(SCU434, 15)); |
2705 |
+ |
2706 |
+ #define AB7 176 |
2707 |
+ SIG_EXPR_LIST_DECL_SESG(AB7, LAD0, LPC, SIG_DESC_SET(SCU434, 16), |
2708 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2709 |
+-SIG_EXPR_LIST_DECL_SESG(AB7, ESPID0, ESPI, SIG_DESC_SET(SCU434, 16), |
2710 |
+ SIG_DESC_SET(SCU510, 6)); |
2711 |
++SIG_EXPR_LIST_DECL_SESG(AB7, ESPID0, ESPI, SIG_DESC_SET(SCU434, 16)); |
2712 |
+ PIN_DECL_2(AB7, GPIOW0, LAD0, ESPID0); |
2713 |
+ |
2714 |
+ #define AB8 177 |
2715 |
+ SIG_EXPR_LIST_DECL_SESG(AB8, LAD1, LPC, SIG_DESC_SET(SCU434, 17), |
2716 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2717 |
+-SIG_EXPR_LIST_DECL_SESG(AB8, ESPID1, ESPI, SIG_DESC_SET(SCU434, 17), |
2718 |
+ SIG_DESC_SET(SCU510, 6)); |
2719 |
++SIG_EXPR_LIST_DECL_SESG(AB8, ESPID1, ESPI, SIG_DESC_SET(SCU434, 17)); |
2720 |
+ PIN_DECL_2(AB8, GPIOW1, LAD1, ESPID1); |
2721 |
+ |
2722 |
+ #define AC8 178 |
2723 |
+ SIG_EXPR_LIST_DECL_SESG(AC8, LAD2, LPC, SIG_DESC_SET(SCU434, 18), |
2724 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2725 |
+-SIG_EXPR_LIST_DECL_SESG(AC8, ESPID2, ESPI, SIG_DESC_SET(SCU434, 18), |
2726 |
+ SIG_DESC_SET(SCU510, 6)); |
2727 |
++SIG_EXPR_LIST_DECL_SESG(AC8, ESPID2, ESPI, SIG_DESC_SET(SCU434, 18)); |
2728 |
+ PIN_DECL_2(AC8, GPIOW2, LAD2, ESPID2); |
2729 |
+ |
2730 |
+ #define AC7 179 |
2731 |
+ SIG_EXPR_LIST_DECL_SESG(AC7, LAD3, LPC, SIG_DESC_SET(SCU434, 19), |
2732 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2733 |
+-SIG_EXPR_LIST_DECL_SESG(AC7, ESPID3, ESPI, SIG_DESC_SET(SCU434, 19), |
2734 |
+ SIG_DESC_SET(SCU510, 6)); |
2735 |
++SIG_EXPR_LIST_DECL_SESG(AC7, ESPID3, ESPI, SIG_DESC_SET(SCU434, 19)); |
2736 |
+ PIN_DECL_2(AC7, GPIOW3, LAD3, ESPID3); |
2737 |
+ |
2738 |
+ #define AE7 180 |
2739 |
+ SIG_EXPR_LIST_DECL_SESG(AE7, LCLK, LPC, SIG_DESC_SET(SCU434, 20), |
2740 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2741 |
+-SIG_EXPR_LIST_DECL_SESG(AE7, ESPICK, ESPI, SIG_DESC_SET(SCU434, 20), |
2742 |
+ SIG_DESC_SET(SCU510, 6)); |
2743 |
++SIG_EXPR_LIST_DECL_SESG(AE7, ESPICK, ESPI, SIG_DESC_SET(SCU434, 20)); |
2744 |
+ PIN_DECL_2(AE7, GPIOW4, LCLK, ESPICK); |
2745 |
+ |
2746 |
+ #define AF7 181 |
2747 |
+ SIG_EXPR_LIST_DECL_SESG(AF7, LFRAME, LPC, SIG_DESC_SET(SCU434, 21), |
2748 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2749 |
+-SIG_EXPR_LIST_DECL_SESG(AF7, ESPICS, ESPI, SIG_DESC_SET(SCU434, 21), |
2750 |
+ SIG_DESC_SET(SCU510, 6)); |
2751 |
++SIG_EXPR_LIST_DECL_SESG(AF7, ESPICS, ESPI, SIG_DESC_SET(SCU434, 21)); |
2752 |
+ PIN_DECL_2(AF7, GPIOW5, LFRAME, ESPICS); |
2753 |
+ |
2754 |
+ #define AD7 182 |
2755 |
+ SIG_EXPR_LIST_DECL_SESG(AD7, LSIRQ, LSIRQ, SIG_DESC_SET(SCU434, 22), |
2756 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2757 |
+-SIG_EXPR_LIST_DECL_SESG(AD7, ESPIALT, ESPIALT, SIG_DESC_SET(SCU434, 22), |
2758 |
+ SIG_DESC_SET(SCU510, 6)); |
2759 |
++SIG_EXPR_LIST_DECL_SESG(AD7, ESPIALT, ESPIALT, SIG_DESC_SET(SCU434, 22)); |
2760 |
+ PIN_DECL_2(AD7, GPIOW6, LSIRQ, ESPIALT); |
2761 |
+ FUNC_GROUP_DECL(LSIRQ, AD7); |
2762 |
+ FUNC_GROUP_DECL(ESPIALT, AD7); |
2763 |
+ |
2764 |
+ #define AD8 183 |
2765 |
+ SIG_EXPR_LIST_DECL_SESG(AD8, LPCRST, LPC, SIG_DESC_SET(SCU434, 23), |
2766 |
+- SIG_DESC_CLEAR(SCU510, 6)); |
2767 |
+-SIG_EXPR_LIST_DECL_SESG(AD8, ESPIRST, ESPI, SIG_DESC_SET(SCU434, 23), |
2768 |
+ SIG_DESC_SET(SCU510, 6)); |
2769 |
++SIG_EXPR_LIST_DECL_SESG(AD8, ESPIRST, ESPI, SIG_DESC_SET(SCU434, 23)); |
2770 |
+ PIN_DECL_2(AD8, GPIOW7, LPCRST, ESPIRST); |
2771 |
+ |
2772 |
+ FUNC_GROUP_DECL(LPC, AB7, AB8, AC8, AC7, AE7, AF7, AD8); |
2773 |
+diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c |
2774 |
+index e914f6efd39e..9503ddf2edc7 100644 |
2775 |
+--- a/drivers/pinctrl/pinmux.c |
2776 |
++++ b/drivers/pinctrl/pinmux.c |
2777 |
+@@ -85,7 +85,7 @@ bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned pin) |
2778 |
+ const struct pinmux_ops *ops = pctldev->desc->pmxops; |
2779 |
+ |
2780 |
+ /* Can't inspect pin, assume it can be used */ |
2781 |
+- if (!desc) |
2782 |
++ if (!desc || !ops) |
2783 |
+ return true; |
2784 |
+ |
2785 |
+ if (ops->strict && desc->mux_usecount) |
2786 |
+diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c |
2787 |
+index 48b112b4f0b0..c32daf087640 100644 |
2788 |
+--- a/drivers/platform/x86/pcengines-apuv2.c |
2789 |
++++ b/drivers/platform/x86/pcengines-apuv2.c |
2790 |
+@@ -95,7 +95,7 @@ static struct gpiod_lookup_table gpios_led_table = { |
2791 |
+ NULL, 1, GPIO_ACTIVE_LOW), |
2792 |
+ GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_LED3, |
2793 |
+ NULL, 2, GPIO_ACTIVE_LOW), |
2794 |
+- GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_REG_SIMSWAP, |
2795 |
++ GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_SIMSWAP, |
2796 |
+ NULL, 3, GPIO_ACTIVE_LOW), |
2797 |
+ } |
2798 |
+ }; |
2799 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
2800 |
+index 87bc06b386a0..1dba0bdf3762 100644 |
2801 |
+--- a/drivers/regulator/core.c |
2802 |
++++ b/drivers/regulator/core.c |
2803 |
+@@ -1937,8 +1937,8 @@ struct regulator *_regulator_get(struct device *dev, const char *id, |
2804 |
+ regulator = create_regulator(rdev, dev, id); |
2805 |
+ if (regulator == NULL) { |
2806 |
+ regulator = ERR_PTR(-ENOMEM); |
2807 |
+- put_device(&rdev->dev); |
2808 |
+ module_put(rdev->owner); |
2809 |
++ put_device(&rdev->dev); |
2810 |
+ return regulator; |
2811 |
+ } |
2812 |
+ |
2813 |
+@@ -2059,13 +2059,13 @@ static void _regulator_put(struct regulator *regulator) |
2814 |
+ |
2815 |
+ rdev->open_count--; |
2816 |
+ rdev->exclusive = 0; |
2817 |
+- put_device(&rdev->dev); |
2818 |
+ regulator_unlock(rdev); |
2819 |
+ |
2820 |
+ kfree_const(regulator->supply_name); |
2821 |
+ kfree(regulator); |
2822 |
+ |
2823 |
+ module_put(rdev->owner); |
2824 |
++ put_device(&rdev->dev); |
2825 |
+ } |
2826 |
+ |
2827 |
+ /** |
2828 |
+@@ -4992,6 +4992,7 @@ regulator_register(const struct regulator_desc *regulator_desc, |
2829 |
+ struct regulator_dev *rdev; |
2830 |
+ bool dangling_cfg_gpiod = false; |
2831 |
+ bool dangling_of_gpiod = false; |
2832 |
++ bool reg_device_fail = false; |
2833 |
+ struct device *dev; |
2834 |
+ int ret, i; |
2835 |
+ |
2836 |
+@@ -5177,7 +5178,7 @@ regulator_register(const struct regulator_desc *regulator_desc, |
2837 |
+ dev_set_drvdata(&rdev->dev, rdev); |
2838 |
+ ret = device_register(&rdev->dev); |
2839 |
+ if (ret != 0) { |
2840 |
+- put_device(&rdev->dev); |
2841 |
++ reg_device_fail = true; |
2842 |
+ goto unset_supplies; |
2843 |
+ } |
2844 |
+ |
2845 |
+@@ -5208,7 +5209,10 @@ wash: |
2846 |
+ clean: |
2847 |
+ if (dangling_of_gpiod) |
2848 |
+ gpiod_put(config->ena_gpiod); |
2849 |
+- kfree(rdev); |
2850 |
++ if (reg_device_fail) |
2851 |
++ put_device(&rdev->dev); |
2852 |
++ else |
2853 |
++ kfree(rdev); |
2854 |
+ kfree(config); |
2855 |
+ rinse: |
2856 |
+ if (dangling_cfg_gpiod) |
2857 |
+diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c |
2858 |
+index eb807a059479..aa6e7c5341ce 100644 |
2859 |
+--- a/drivers/regulator/rn5t618-regulator.c |
2860 |
++++ b/drivers/regulator/rn5t618-regulator.c |
2861 |
+@@ -148,6 +148,7 @@ static struct platform_driver rn5t618_regulator_driver = { |
2862 |
+ |
2863 |
+ module_platform_driver(rn5t618_regulator_driver); |
2864 |
+ |
2865 |
++MODULE_ALIAS("platform:rn5t618-regulator"); |
2866 |
+ MODULE_AUTHOR("Beniamino Galvani <b.galvani@×××××.com>"); |
2867 |
+ MODULE_DESCRIPTION("RN5T618 regulator driver"); |
2868 |
+ MODULE_LICENSE("GPL v2"); |
2869 |
+diff --git a/drivers/reset/core.c b/drivers/reset/core.c |
2870 |
+index 3c9a64c1b7a8..f343bd814d32 100644 |
2871 |
+--- a/drivers/reset/core.c |
2872 |
++++ b/drivers/reset/core.c |
2873 |
+@@ -787,7 +787,7 @@ struct reset_control *__devm_reset_control_get(struct device *dev, |
2874 |
+ return ERR_PTR(-ENOMEM); |
2875 |
+ |
2876 |
+ rstc = __reset_control_get(dev, id, index, shared, optional, acquired); |
2877 |
+- if (!IS_ERR(rstc)) { |
2878 |
++ if (!IS_ERR_OR_NULL(rstc)) { |
2879 |
+ *ptr = rstc; |
2880 |
+ devres_add(dev, ptr); |
2881 |
+ } else { |
2882 |
+@@ -930,7 +930,7 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) |
2883 |
+ return ERR_PTR(-ENOMEM); |
2884 |
+ |
2885 |
+ rstc = of_reset_control_array_get(dev->of_node, shared, optional, true); |
2886 |
+- if (IS_ERR(rstc)) { |
2887 |
++ if (IS_ERR_OR_NULL(rstc)) { |
2888 |
+ devres_free(devres); |
2889 |
+ return rstc; |
2890 |
+ } |
2891 |
+diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c |
2892 |
+index c94184d080f8..a28b9ff82378 100644 |
2893 |
+--- a/drivers/s390/block/dasd_eckd.c |
2894 |
++++ b/drivers/s390/block/dasd_eckd.c |
2895 |
+@@ -1128,7 +1128,8 @@ static u32 get_fcx_max_data(struct dasd_device *device) |
2896 |
+ { |
2897 |
+ struct dasd_eckd_private *private = device->private; |
2898 |
+ int fcx_in_css, fcx_in_gneq, fcx_in_features; |
2899 |
+- int tpm, mdc; |
2900 |
++ unsigned int mdc; |
2901 |
++ int tpm; |
2902 |
+ |
2903 |
+ if (dasd_nofcx) |
2904 |
+ return 0; |
2905 |
+@@ -1142,7 +1143,7 @@ static u32 get_fcx_max_data(struct dasd_device *device) |
2906 |
+ return 0; |
2907 |
+ |
2908 |
+ mdc = ccw_device_get_mdc(device->cdev, 0); |
2909 |
+- if (mdc < 0) { |
2910 |
++ if (mdc == 0) { |
2911 |
+ dev_warn(&device->cdev->dev, "Detecting the maximum supported data size for zHPF requests failed\n"); |
2912 |
+ return 0; |
2913 |
+ } else { |
2914 |
+@@ -1153,12 +1154,12 @@ static u32 get_fcx_max_data(struct dasd_device *device) |
2915 |
+ static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm) |
2916 |
+ { |
2917 |
+ struct dasd_eckd_private *private = device->private; |
2918 |
+- int mdc; |
2919 |
++ unsigned int mdc; |
2920 |
+ u32 fcx_max_data; |
2921 |
+ |
2922 |
+ if (private->fcx_max_data) { |
2923 |
+ mdc = ccw_device_get_mdc(device->cdev, lpm); |
2924 |
+- if ((mdc < 0)) { |
2925 |
++ if (mdc == 0) { |
2926 |
+ dev_warn(&device->cdev->dev, |
2927 |
+ "Detecting the maximum data size for zHPF " |
2928 |
+ "requests failed (rc=%d) for a new path %x\n", |
2929 |
+@@ -2073,7 +2074,7 @@ out_err2: |
2930 |
+ dasd_free_block(device->block); |
2931 |
+ device->block = NULL; |
2932 |
+ out_err1: |
2933 |
+- kfree(private->conf_data); |
2934 |
++ dasd_eckd_clear_conf_data(device); |
2935 |
+ kfree(device->private); |
2936 |
+ device->private = NULL; |
2937 |
+ return rc; |
2938 |
+@@ -2082,7 +2083,6 @@ out_err1: |
2939 |
+ static void dasd_eckd_uncheck_device(struct dasd_device *device) |
2940 |
+ { |
2941 |
+ struct dasd_eckd_private *private = device->private; |
2942 |
+- int i; |
2943 |
+ |
2944 |
+ if (!private) |
2945 |
+ return; |
2946 |
+@@ -2092,21 +2092,7 @@ static void dasd_eckd_uncheck_device(struct dasd_device *device) |
2947 |
+ private->sneq = NULL; |
2948 |
+ private->vdsneq = NULL; |
2949 |
+ private->gneq = NULL; |
2950 |
+- private->conf_len = 0; |
2951 |
+- for (i = 0; i < 8; i++) { |
2952 |
+- kfree(device->path[i].conf_data); |
2953 |
+- if ((__u8 *)device->path[i].conf_data == |
2954 |
+- private->conf_data) { |
2955 |
+- private->conf_data = NULL; |
2956 |
+- private->conf_len = 0; |
2957 |
+- } |
2958 |
+- device->path[i].conf_data = NULL; |
2959 |
+- device->path[i].cssid = 0; |
2960 |
+- device->path[i].ssid = 0; |
2961 |
+- device->path[i].chpid = 0; |
2962 |
+- } |
2963 |
+- kfree(private->conf_data); |
2964 |
+- private->conf_data = NULL; |
2965 |
++ dasd_eckd_clear_conf_data(device); |
2966 |
+ } |
2967 |
+ |
2968 |
+ static struct dasd_ccw_req * |
2969 |
+diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c |
2970 |
+index 65841af15748..ccecf6b9504e 100644 |
2971 |
+--- a/drivers/s390/cio/device_ops.c |
2972 |
++++ b/drivers/s390/cio/device_ops.c |
2973 |
+@@ -635,7 +635,7 @@ EXPORT_SYMBOL(ccw_device_tm_start_timeout); |
2974 |
+ * @mask: mask of paths to use |
2975 |
+ * |
2976 |
+ * Return the number of 64K-bytes blocks all paths at least support |
2977 |
+- * for a transport command. Return values <= 0 indicate failures. |
2978 |
++ * for a transport command. Return value 0 indicates failure. |
2979 |
+ */ |
2980 |
+ int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask) |
2981 |
+ { |
2982 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
2983 |
+index 83794d7494d4..9df47421d69c 100644 |
2984 |
+--- a/drivers/s390/net/qeth_core_main.c |
2985 |
++++ b/drivers/s390/net/qeth_core_main.c |
2986 |
+@@ -653,17 +653,17 @@ static int qeth_check_idx_response(struct qeth_card *card, |
2987 |
+ unsigned char *buffer) |
2988 |
+ { |
2989 |
+ QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN); |
2990 |
+- if ((buffer[2] & 0xc0) == 0xc0) { |
2991 |
++ if ((buffer[2] & QETH_IDX_TERMINATE_MASK) == QETH_IDX_TERMINATE) { |
2992 |
+ QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#04x\n", |
2993 |
+ buffer[4]); |
2994 |
+ QETH_CARD_TEXT(card, 2, "ckidxres"); |
2995 |
+ QETH_CARD_TEXT(card, 2, " idxterm"); |
2996 |
+- QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); |
2997 |
+- if (buffer[4] == 0xf6) { |
2998 |
++ QETH_CARD_TEXT_(card, 2, "rc%x", buffer[4]); |
2999 |
++ if (buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT || |
3000 |
++ buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT_VM) { |
3001 |
+ dev_err(&card->gdev->dev, |
3002 |
+- "The qeth device is not configured " |
3003 |
+- "for the OSI layer required by z/VM\n"); |
3004 |
+- return -EPERM; |
3005 |
++ "The device does not support the configured transport mode\n"); |
3006 |
++ return -EPROTONOSUPPORT; |
3007 |
+ } |
3008 |
+ return -EIO; |
3009 |
+ } |
3010 |
+@@ -740,10 +740,10 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, |
3011 |
+ case 0: |
3012 |
+ break; |
3013 |
+ case -EIO: |
3014 |
+- qeth_clear_ipacmd_list(card); |
3015 |
+ qeth_schedule_recovery(card); |
3016 |
+ /* fall through */ |
3017 |
+ default: |
3018 |
++ qeth_clear_ipacmd_list(card); |
3019 |
+ goto out; |
3020 |
+ } |
3021 |
+ |
3022 |
+diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h |
3023 |
+index 6420b58cf42b..b7c17b5c823b 100644 |
3024 |
+--- a/drivers/s390/net/qeth_core_mpc.h |
3025 |
++++ b/drivers/s390/net/qeth_core_mpc.h |
3026 |
+@@ -912,6 +912,11 @@ extern unsigned char IDX_ACTIVATE_WRITE[]; |
3027 |
+ #define QETH_IDX_ACT_ERR_AUTH 0x1E |
3028 |
+ #define QETH_IDX_ACT_ERR_AUTH_USER 0x20 |
3029 |
+ |
3030 |
++#define QETH_IDX_TERMINATE 0xc0 |
3031 |
++#define QETH_IDX_TERMINATE_MASK 0xc0 |
3032 |
++#define QETH_IDX_TERM_BAD_TRANSPORT 0x41 |
3033 |
++#define QETH_IDX_TERM_BAD_TRANSPORT_VM 0xf6 |
3034 |
++ |
3035 |
+ #define PDU_ENCAPSULATION(buffer) \ |
3036 |
+ (buffer + *(buffer + (*(buffer + 0x0b)) + \ |
3037 |
+ *(buffer + *(buffer + 0x0b) + 0x11) + 0x07)) |
3038 |
+diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c |
3039 |
+index 9f392497d570..4c3e222e5572 100644 |
3040 |
+--- a/drivers/s390/net/qeth_core_sys.c |
3041 |
++++ b/drivers/s390/net/qeth_core_sys.c |
3042 |
+@@ -227,7 +227,7 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev, |
3043 |
+ card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; |
3044 |
+ } else if (sysfs_streq(buf, "prio_queueing_vlan")) { |
3045 |
+ if (IS_LAYER3(card)) { |
3046 |
+- rc = -ENOTSUPP; |
3047 |
++ rc = -EOPNOTSUPP; |
3048 |
+ goto out; |
3049 |
+ } |
3050 |
+ card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_VLAN; |
3051 |
+diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
3052 |
+index 4bccdce19b5a..8b7d911dccd8 100644 |
3053 |
+--- a/drivers/s390/net/qeth_l2_main.c |
3054 |
++++ b/drivers/s390/net/qeth_l2_main.c |
3055 |
+@@ -295,6 +295,7 @@ static void qeth_l2_stop_card(struct qeth_card *card) |
3056 |
+ |
3057 |
+ flush_workqueue(card->event_wq); |
3058 |
+ card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
3059 |
++ card->info.promisc_mode = 0; |
3060 |
+ } |
3061 |
+ |
3062 |
+ static int qeth_l2_process_inbound_buffer(struct qeth_card *card, |
3063 |
+diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c |
3064 |
+index e2bcb26105a3..fc7101ad84de 100644 |
3065 |
+--- a/drivers/s390/net/qeth_l2_sys.c |
3066 |
++++ b/drivers/s390/net/qeth_l2_sys.c |
3067 |
+@@ -279,7 +279,8 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card) |
3068 |
+ return; |
3069 |
+ |
3070 |
+ mutex_lock(&card->sbp_lock); |
3071 |
+- if (card->options.sbp.role != QETH_SBP_ROLE_NONE) { |
3072 |
++ if (!card->options.sbp.reflect_promisc && |
3073 |
++ card->options.sbp.role != QETH_SBP_ROLE_NONE) { |
3074 |
+ /* Conditional to avoid spurious error messages */ |
3075 |
+ qeth_bridgeport_setrole(card, card->options.sbp.role); |
3076 |
+ /* Let the callback function refresh the stored role value. */ |
3077 |
+diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c |
3078 |
+index d7bfc7a0e4c0..32385327539b 100644 |
3079 |
+--- a/drivers/s390/net/qeth_l3_main.c |
3080 |
++++ b/drivers/s390/net/qeth_l3_main.c |
3081 |
+@@ -1433,6 +1433,7 @@ static void qeth_l3_stop_card(struct qeth_card *card) |
3082 |
+ } |
3083 |
+ |
3084 |
+ flush_workqueue(card->event_wq); |
3085 |
++ card->info.promisc_mode = 0; |
3086 |
+ } |
3087 |
+ |
3088 |
+ static void qeth_l3_set_promisc_mode(struct qeth_card *card) |
3089 |
+diff --git a/drivers/spi/spi-cavium-thunderx.c b/drivers/spi/spi-cavium-thunderx.c |
3090 |
+index d12e149f1a41..fd6b9caffaf0 100644 |
3091 |
+--- a/drivers/spi/spi-cavium-thunderx.c |
3092 |
++++ b/drivers/spi/spi-cavium-thunderx.c |
3093 |
+@@ -82,6 +82,7 @@ static int thunderx_spi_probe(struct pci_dev *pdev, |
3094 |
+ |
3095 |
+ error: |
3096 |
+ clk_disable_unprepare(p->clk); |
3097 |
++ pci_release_regions(pdev); |
3098 |
+ spi_master_put(master); |
3099 |
+ return ret; |
3100 |
+ } |
3101 |
+@@ -96,6 +97,7 @@ static void thunderx_spi_remove(struct pci_dev *pdev) |
3102 |
+ return; |
3103 |
+ |
3104 |
+ clk_disable_unprepare(p->clk); |
3105 |
++ pci_release_regions(pdev); |
3106 |
+ /* Put everything in a known state. */ |
3107 |
+ writeq(0, p->register_base + OCTEON_SPI_CFG(p)); |
3108 |
+ } |
3109 |
+diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
3110 |
+index 2d563874b4ac..be7c6ba73072 100644 |
3111 |
+--- a/drivers/spi/spi-fsl-spi.c |
3112 |
++++ b/drivers/spi/spi-fsl-spi.c |
3113 |
+@@ -612,6 +612,7 @@ static struct spi_master * fsl_spi_probe(struct device *dev, |
3114 |
+ master->setup = fsl_spi_setup; |
3115 |
+ master->cleanup = fsl_spi_cleanup; |
3116 |
+ master->transfer_one_message = fsl_spi_do_one_msg; |
3117 |
++ master->use_gpio_descriptors = true; |
3118 |
+ |
3119 |
+ mpc8xxx_spi = spi_master_get_devdata(master); |
3120 |
+ mpc8xxx_spi->max_bits_per_word = 32; |
3121 |
+@@ -728,8 +729,18 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
3122 |
+ } |
3123 |
+ } |
3124 |
+ #endif |
3125 |
+- |
3126 |
+- pdata->cs_control = fsl_spi_cs_control; |
3127 |
++ /* |
3128 |
++ * Handle the case where we have one hardwired (always selected) |
3129 |
++ * device on the first "chipselect". Else we let the core code |
3130 |
++ * handle any GPIOs or native chip selects and assign the |
3131 |
++ * appropriate callback for dealing with the CS lines. This isn't |
3132 |
++ * supported on the GRLIB variant. |
3133 |
++ */ |
3134 |
++ ret = gpiod_count(dev, "cs"); |
3135 |
++ if (ret <= 0) |
3136 |
++ pdata->max_chipselect = 1; |
3137 |
++ else |
3138 |
++ pdata->cs_control = fsl_spi_cs_control; |
3139 |
+ } |
3140 |
+ |
3141 |
+ ret = of_address_to_resource(np, 0, &mem); |
3142 |
+diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c |
3143 |
+index 501b923f2c27..28ae5229f889 100644 |
3144 |
+--- a/drivers/spi/spi-nxp-fspi.c |
3145 |
++++ b/drivers/spi/spi-nxp-fspi.c |
3146 |
+@@ -439,7 +439,7 @@ static bool nxp_fspi_supports_op(struct spi_mem *mem, |
3147 |
+ op->data.nbytes > f->devtype_data->txfifo) |
3148 |
+ return false; |
3149 |
+ |
3150 |
+- return true; |
3151 |
++ return spi_mem_default_supports_op(mem, op); |
3152 |
+ } |
3153 |
+ |
3154 |
+ /* Instead of busy looping invoke readl_poll_timeout functionality. */ |
3155 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
3156 |
+index 2e73d75a6ac5..ae95ec0bc964 100644 |
3157 |
+--- a/drivers/spi/spi-pxa2xx.c |
3158 |
++++ b/drivers/spi/spi-pxa2xx.c |
3159 |
+@@ -1441,6 +1441,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { |
3160 |
+ { PCI_VDEVICE(INTEL, 0x4b2a), LPSS_BXT_SSP }, |
3161 |
+ { PCI_VDEVICE(INTEL, 0x4b2b), LPSS_BXT_SSP }, |
3162 |
+ { PCI_VDEVICE(INTEL, 0x4b37), LPSS_BXT_SSP }, |
3163 |
++ /* JSL */ |
3164 |
++ { PCI_VDEVICE(INTEL, 0x4daa), LPSS_CNL_SSP }, |
3165 |
++ { PCI_VDEVICE(INTEL, 0x4dab), LPSS_CNL_SSP }, |
3166 |
++ { PCI_VDEVICE(INTEL, 0x4dfb), LPSS_CNL_SSP }, |
3167 |
+ /* APL */ |
3168 |
+ { PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP }, |
3169 |
+ { PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP }, |
3170 |
+diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c |
3171 |
+index 3cb65371ae3b..66dcb6128539 100644 |
3172 |
+--- a/drivers/spi/spi-ti-qspi.c |
3173 |
++++ b/drivers/spi/spi-ti-qspi.c |
3174 |
+@@ -62,6 +62,7 @@ struct ti_qspi { |
3175 |
+ u32 dc; |
3176 |
+ |
3177 |
+ bool mmap_enabled; |
3178 |
++ int current_cs; |
3179 |
+ }; |
3180 |
+ |
3181 |
+ #define QSPI_PID (0x0) |
3182 |
+@@ -487,6 +488,7 @@ static void ti_qspi_enable_memory_map(struct spi_device *spi) |
3183 |
+ MEM_CS_EN(spi->chip_select)); |
3184 |
+ } |
3185 |
+ qspi->mmap_enabled = true; |
3186 |
++ qspi->current_cs = spi->chip_select; |
3187 |
+ } |
3188 |
+ |
3189 |
+ static void ti_qspi_disable_memory_map(struct spi_device *spi) |
3190 |
+@@ -498,6 +500,7 @@ static void ti_qspi_disable_memory_map(struct spi_device *spi) |
3191 |
+ regmap_update_bits(qspi->ctrl_base, qspi->ctrl_reg, |
3192 |
+ MEM_CS_MASK, 0); |
3193 |
+ qspi->mmap_enabled = false; |
3194 |
++ qspi->current_cs = -1; |
3195 |
+ } |
3196 |
+ |
3197 |
+ static void ti_qspi_setup_mmap_read(struct spi_device *spi, u8 opcode, |
3198 |
+@@ -543,7 +546,7 @@ static int ti_qspi_exec_mem_op(struct spi_mem *mem, |
3199 |
+ |
3200 |
+ mutex_lock(&qspi->list_lock); |
3201 |
+ |
3202 |
+- if (!qspi->mmap_enabled) |
3203 |
++ if (!qspi->mmap_enabled || qspi->current_cs != mem->spi->chip_select) |
3204 |
+ ti_qspi_enable_memory_map(mem->spi); |
3205 |
+ ti_qspi_setup_mmap_read(mem->spi, op->cmd.opcode, op->data.buswidth, |
3206 |
+ op->addr.nbytes, op->dummy.nbytes); |
3207 |
+@@ -799,6 +802,7 @@ no_dma: |
3208 |
+ } |
3209 |
+ } |
3210 |
+ qspi->mmap_enabled = false; |
3211 |
++ qspi->current_cs = -1; |
3212 |
+ |
3213 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
3214 |
+ if (!ret) |
3215 |
+diff --git a/drivers/staging/axis-fifo/Kconfig b/drivers/staging/axis-fifo/Kconfig |
3216 |
+index 3fffe4d6f327..f180a8e9f58a 100644 |
3217 |
+--- a/drivers/staging/axis-fifo/Kconfig |
3218 |
++++ b/drivers/staging/axis-fifo/Kconfig |
3219 |
+@@ -4,7 +4,7 @@ |
3220 |
+ # |
3221 |
+ config XIL_AXIS_FIFO |
3222 |
+ tristate "Xilinx AXI-Stream FIFO IP core driver" |
3223 |
+- depends on OF |
3224 |
++ depends on OF && HAS_IOMEM |
3225 |
+ help |
3226 |
+ This adds support for the Xilinx AXI-Stream FIFO IP core driver. |
3227 |
+ The AXI Streaming FIFO allows memory mapped access to a AXI Streaming |
3228 |
+diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c |
3229 |
+index 1ac1095bfeac..5e92c6abe306 100644 |
3230 |
+--- a/drivers/usb/core/config.c |
3231 |
++++ b/drivers/usb/core/config.c |
3232 |
+@@ -203,9 +203,58 @@ static const unsigned short super_speed_maxpacket_maxes[4] = { |
3233 |
+ [USB_ENDPOINT_XFER_INT] = 1024, |
3234 |
+ }; |
3235 |
+ |
3236 |
+-static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
3237 |
+- int asnum, struct usb_host_interface *ifp, int num_ep, |
3238 |
+- unsigned char *buffer, int size) |
3239 |
++static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1, |
3240 |
++ struct usb_endpoint_descriptor *e2) |
3241 |
++{ |
3242 |
++ if (e1->bEndpointAddress == e2->bEndpointAddress) |
3243 |
++ return true; |
3244 |
++ |
3245 |
++ if (usb_endpoint_xfer_control(e1) || usb_endpoint_xfer_control(e2)) { |
3246 |
++ if (usb_endpoint_num(e1) == usb_endpoint_num(e2)) |
3247 |
++ return true; |
3248 |
++ } |
3249 |
++ |
3250 |
++ return false; |
3251 |
++} |
3252 |
++ |
3253 |
++/* |
3254 |
++ * Check for duplicate endpoint addresses in other interfaces and in the |
3255 |
++ * altsetting currently being parsed. |
3256 |
++ */ |
3257 |
++static bool config_endpoint_is_duplicate(struct usb_host_config *config, |
3258 |
++ int inum, int asnum, struct usb_endpoint_descriptor *d) |
3259 |
++{ |
3260 |
++ struct usb_endpoint_descriptor *epd; |
3261 |
++ struct usb_interface_cache *intfc; |
3262 |
++ struct usb_host_interface *alt; |
3263 |
++ int i, j, k; |
3264 |
++ |
3265 |
++ for (i = 0; i < config->desc.bNumInterfaces; ++i) { |
3266 |
++ intfc = config->intf_cache[i]; |
3267 |
++ |
3268 |
++ for (j = 0; j < intfc->num_altsetting; ++j) { |
3269 |
++ alt = &intfc->altsetting[j]; |
3270 |
++ |
3271 |
++ if (alt->desc.bInterfaceNumber == inum && |
3272 |
++ alt->desc.bAlternateSetting != asnum) |
3273 |
++ continue; |
3274 |
++ |
3275 |
++ for (k = 0; k < alt->desc.bNumEndpoints; ++k) { |
3276 |
++ epd = &alt->endpoint[k].desc; |
3277 |
++ |
3278 |
++ if (endpoint_is_duplicate(epd, d)) |
3279 |
++ return true; |
3280 |
++ } |
3281 |
++ } |
3282 |
++ } |
3283 |
++ |
3284 |
++ return false; |
3285 |
++} |
3286 |
++ |
3287 |
++static int usb_parse_endpoint(struct device *ddev, int cfgno, |
3288 |
++ struct usb_host_config *config, int inum, int asnum, |
3289 |
++ struct usb_host_interface *ifp, int num_ep, |
3290 |
++ unsigned char *buffer, int size) |
3291 |
+ { |
3292 |
+ unsigned char *buffer0 = buffer; |
3293 |
+ struct usb_endpoint_descriptor *d; |
3294 |
+@@ -242,13 +291,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
3295 |
+ goto skip_to_next_endpoint_or_interface_descriptor; |
3296 |
+ |
3297 |
+ /* Check for duplicate endpoint addresses */ |
3298 |
+- for (i = 0; i < ifp->desc.bNumEndpoints; ++i) { |
3299 |
+- if (ifp->endpoint[i].desc.bEndpointAddress == |
3300 |
+- d->bEndpointAddress) { |
3301 |
+- dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", |
3302 |
+- cfgno, inum, asnum, d->bEndpointAddress); |
3303 |
+- goto skip_to_next_endpoint_or_interface_descriptor; |
3304 |
+- } |
3305 |
++ if (config_endpoint_is_duplicate(config, inum, asnum, d)) { |
3306 |
++ dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", |
3307 |
++ cfgno, inum, asnum, d->bEndpointAddress); |
3308 |
++ goto skip_to_next_endpoint_or_interface_descriptor; |
3309 |
+ } |
3310 |
+ |
3311 |
+ endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; |
3312 |
+@@ -522,8 +568,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, |
3313 |
+ if (((struct usb_descriptor_header *) buffer)->bDescriptorType |
3314 |
+ == USB_DT_INTERFACE) |
3315 |
+ break; |
3316 |
+- retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt, |
3317 |
+- num_ep, buffer, size); |
3318 |
++ retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum, |
3319 |
++ alt, num_ep, buffer, size); |
3320 |
+ if (retval < 0) |
3321 |
+ return retval; |
3322 |
+ ++n; |
3323 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
3324 |
+index dfe9ac8d2375..8b23162e4239 100644 |
3325 |
+--- a/drivers/usb/core/hub.c |
3326 |
++++ b/drivers/usb/core/hub.c |
3327 |
+@@ -2691,7 +2691,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) |
3328 |
+ #define SET_ADDRESS_TRIES 2 |
3329 |
+ #define GET_DESCRIPTOR_TRIES 2 |
3330 |
+ #define SET_CONFIG_TRIES (2 * (use_both_schemes + 1)) |
3331 |
+-#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)scheme) |
3332 |
++#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme)) |
3333 |
+ |
3334 |
+ #define HUB_ROOT_RESET_TIME 60 /* times are in msec */ |
3335 |
+ #define HUB_SHORT_RESET_TIME 10 |
3336 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
3337 |
+index 0c960a97ea02..154f3f3e8cff 100644 |
3338 |
+--- a/drivers/usb/dwc3/gadget.c |
3339 |
++++ b/drivers/usb/dwc3/gadget.c |
3340 |
+@@ -2467,6 +2467,13 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, |
3341 |
+ |
3342 |
+ static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) |
3343 |
+ { |
3344 |
++ /* |
3345 |
++ * For OUT direction, host may send less than the setup |
3346 |
++ * length. Return true for all OUT requests. |
3347 |
++ */ |
3348 |
++ if (!req->direction) |
3349 |
++ return true; |
3350 |
++ |
3351 |
+ return req->request.actual == req->request.length; |
3352 |
+ } |
3353 |
+ |
3354 |
+diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c |
3355 |
+index a8f1e5707c14..4c9d1e49d5ed 100644 |
3356 |
+--- a/drivers/usb/gadget/udc/dummy_hcd.c |
3357 |
++++ b/drivers/usb/gadget/udc/dummy_hcd.c |
3358 |
+@@ -1321,7 +1321,7 @@ static int dummy_perform_transfer(struct urb *urb, struct dummy_request *req, |
3359 |
+ u32 this_sg; |
3360 |
+ bool next_sg; |
3361 |
+ |
3362 |
+- to_host = usb_pipein(urb->pipe); |
3363 |
++ to_host = usb_urb_dir_in(urb); |
3364 |
+ rbuf = req->req.buf + req->req.actual; |
3365 |
+ |
3366 |
+ if (!urb->num_sgs) { |
3367 |
+@@ -1409,7 +1409,7 @@ top: |
3368 |
+ |
3369 |
+ /* FIXME update emulated data toggle too */ |
3370 |
+ |
3371 |
+- to_host = usb_pipein(urb->pipe); |
3372 |
++ to_host = usb_urb_dir_in(urb); |
3373 |
+ if (unlikely(len == 0)) |
3374 |
+ is_short = 1; |
3375 |
+ else { |
3376 |
+@@ -1830,7 +1830,7 @@ restart: |
3377 |
+ |
3378 |
+ /* find the gadget's ep for this request (if configured) */ |
3379 |
+ address = usb_pipeendpoint (urb->pipe); |
3380 |
+- if (usb_pipein(urb->pipe)) |
3381 |
++ if (usb_urb_dir_in(urb)) |
3382 |
+ address |= USB_DIR_IN; |
3383 |
+ ep = find_endpoint(dum, address); |
3384 |
+ if (!ep) { |
3385 |
+@@ -2385,7 +2385,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb) |
3386 |
+ s = "?"; |
3387 |
+ break; |
3388 |
+ } s; }), |
3389 |
+- ep, ep ? (usb_pipein(urb->pipe) ? "in" : "out") : "", |
3390 |
++ ep, ep ? (usb_urb_dir_in(urb) ? "in" : "out") : "", |
3391 |
+ ({ char *s; \ |
3392 |
+ switch (usb_pipetype(urb->pipe)) { \ |
3393 |
+ case PIPE_CONTROL: \ |
3394 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
3395 |
+index e9491d400a24..fea09a3f491f 100644 |
3396 |
+--- a/drivers/usb/serial/option.c |
3397 |
++++ b/drivers/usb/serial/option.c |
3398 |
+@@ -1172,6 +1172,8 @@ static const struct usb_device_id option_ids[] = { |
3399 |
+ .driver_info = NCTRL(0) | RSVD(3) }, |
3400 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */ |
3401 |
+ .driver_info = NCTRL(0) }, |
3402 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */ |
3403 |
++ .driver_info = NCTRL(0) | RSVD(3) }, |
3404 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
3405 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
3406 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
3407 |
+diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig |
3408 |
+index 72481bbb2af3..5b986d6c801d 100644 |
3409 |
+--- a/drivers/usb/typec/tcpm/Kconfig |
3410 |
++++ b/drivers/usb/typec/tcpm/Kconfig |
3411 |
+@@ -32,6 +32,7 @@ endif # TYPEC_TCPCI |
3412 |
+ config TYPEC_FUSB302 |
3413 |
+ tristate "Fairchild FUSB302 Type-C chip driver" |
3414 |
+ depends on I2C |
3415 |
++ depends on EXTCON || !EXTCON |
3416 |
+ help |
3417 |
+ The Fairchild FUSB302 Type-C chip driver that works with |
3418 |
+ Type-C Port Controller Manager to provide USB PD and USB |
3419 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
3420 |
+index eb95ed78a18e..dc50605ecbda 100644 |
3421 |
+--- a/fs/btrfs/extent-tree.c |
3422 |
++++ b/fs/btrfs/extent-tree.c |
3423 |
+@@ -3781,6 +3781,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info, |
3424 |
+ u64 flags, int delalloc) |
3425 |
+ { |
3426 |
+ int ret = 0; |
3427 |
++ int cache_block_group_error = 0; |
3428 |
+ struct btrfs_free_cluster *last_ptr = NULL; |
3429 |
+ struct btrfs_block_group_cache *block_group = NULL; |
3430 |
+ struct find_free_extent_ctl ffe_ctl = {0}; |
3431 |
+@@ -3940,7 +3941,20 @@ have_block_group: |
3432 |
+ if (unlikely(!ffe_ctl.cached)) { |
3433 |
+ ffe_ctl.have_caching_bg = true; |
3434 |
+ ret = btrfs_cache_block_group(block_group, 0); |
3435 |
+- BUG_ON(ret < 0); |
3436 |
++ |
3437 |
++ /* |
3438 |
++ * If we get ENOMEM here or something else we want to |
3439 |
++ * try other block groups, because it may not be fatal. |
3440 |
++ * However if we can't find anything else we need to |
3441 |
++ * save our return here so that we return the actual |
3442 |
++ * error that caused problems, not ENOSPC. |
3443 |
++ */ |
3444 |
++ if (ret < 0) { |
3445 |
++ if (!cache_block_group_error) |
3446 |
++ cache_block_group_error = ret; |
3447 |
++ ret = 0; |
3448 |
++ goto loop; |
3449 |
++ } |
3450 |
+ ret = 0; |
3451 |
+ } |
3452 |
+ |
3453 |
+@@ -4027,7 +4041,7 @@ loop: |
3454 |
+ if (ret > 0) |
3455 |
+ goto search; |
3456 |
+ |
3457 |
+- if (ret == -ENOSPC) { |
3458 |
++ if (ret == -ENOSPC && !cache_block_group_error) { |
3459 |
+ /* |
3460 |
+ * Use ffe_ctl->total_free_space as fallback if we can't find |
3461 |
+ * any contiguous hole. |
3462 |
+@@ -4038,6 +4052,8 @@ loop: |
3463 |
+ space_info->max_extent_size = ffe_ctl.max_extent_size; |
3464 |
+ spin_unlock(&space_info->lock); |
3465 |
+ ins->offset = ffe_ctl.max_extent_size; |
3466 |
++ } else if (ret == -ENOSPC) { |
3467 |
++ ret = cache_block_group_error; |
3468 |
+ } |
3469 |
+ return ret; |
3470 |
+ } |
3471 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
3472 |
+index c332968f9056..eaafd00f93d4 100644 |
3473 |
+--- a/fs/btrfs/file.c |
3474 |
++++ b/fs/btrfs/file.c |
3475 |
+@@ -2601,8 +2601,8 @@ int btrfs_punch_hole_range(struct inode *inode, struct btrfs_path *path, |
3476 |
+ } |
3477 |
+ } |
3478 |
+ |
3479 |
+- if (clone_info) { |
3480 |
+- u64 clone_len = drop_end - cur_offset; |
3481 |
++ if (clone_info && drop_end > clone_info->file_offset) { |
3482 |
++ u64 clone_len = drop_end - clone_info->file_offset; |
3483 |
+ |
3484 |
+ ret = btrfs_insert_clone_extent(trans, inode, path, |
3485 |
+ clone_info, clone_len); |
3486 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
3487 |
+index a56dcc0c9c2a..5720e450a46f 100644 |
3488 |
+--- a/fs/btrfs/ioctl.c |
3489 |
++++ b/fs/btrfs/ioctl.c |
3490 |
+@@ -3727,24 +3727,18 @@ process_slot: |
3491 |
+ ret = 0; |
3492 |
+ |
3493 |
+ if (last_dest_end < destoff + len) { |
3494 |
+- struct btrfs_clone_extent_info clone_info = { 0 }; |
3495 |
+ /* |
3496 |
+- * We have an implicit hole (NO_HOLES feature is enabled) that |
3497 |
+- * fully or partially overlaps our cloning range at its end. |
3498 |
++ * We have an implicit hole that fully or partially overlaps our |
3499 |
++ * cloning range at its end. This means that we either have the |
3500 |
++ * NO_HOLES feature enabled or the implicit hole happened due to |
3501 |
++ * mixing buffered and direct IO writes against this file. |
3502 |
+ */ |
3503 |
+ btrfs_release_path(path); |
3504 |
+ path->leave_spinning = 0; |
3505 |
+ |
3506 |
+- /* |
3507 |
+- * We are dealing with a hole and our clone_info already has a |
3508 |
+- * disk_offset of 0, we only need to fill the data length and |
3509 |
+- * file offset. |
3510 |
+- */ |
3511 |
+- clone_info.data_len = destoff + len - last_dest_end; |
3512 |
+- clone_info.file_offset = last_dest_end; |
3513 |
+ ret = btrfs_punch_hole_range(inode, path, |
3514 |
+ last_dest_end, destoff + len - 1, |
3515 |
+- &clone_info, &trans); |
3516 |
++ NULL, &trans); |
3517 |
+ if (ret) |
3518 |
+ goto out; |
3519 |
+ |
3520 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
3521 |
+index 27a903aaf43b..aeb5f2f3cdd7 100644 |
3522 |
+--- a/fs/btrfs/qgroup.c |
3523 |
++++ b/fs/btrfs/qgroup.c |
3524 |
+@@ -3232,12 +3232,12 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, |
3525 |
+ if (!(fs_info->qgroup_flags & |
3526 |
+ BTRFS_QGROUP_STATUS_FLAG_RESCAN)) { |
3527 |
+ btrfs_warn(fs_info, |
3528 |
+- "qgroup rescan init failed, qgroup is not enabled"); |
3529 |
++ "qgroup rescan init failed, qgroup rescan is not queued"); |
3530 |
+ ret = -EINVAL; |
3531 |
+ } else if (!(fs_info->qgroup_flags & |
3532 |
+ BTRFS_QGROUP_STATUS_FLAG_ON)) { |
3533 |
+ btrfs_warn(fs_info, |
3534 |
+- "qgroup rescan init failed, qgroup rescan is not queued"); |
3535 |
++ "qgroup rescan init failed, qgroup is not enabled"); |
3536 |
+ ret = -EINVAL; |
3537 |
+ } |
3538 |
+ |
3539 |
+diff --git a/fs/drop_caches.c b/fs/drop_caches.c |
3540 |
+index d31b6c72b476..dc1a1d5d825b 100644 |
3541 |
+--- a/fs/drop_caches.c |
3542 |
++++ b/fs/drop_caches.c |
3543 |
+@@ -35,11 +35,11 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) |
3544 |
+ spin_unlock(&inode->i_lock); |
3545 |
+ spin_unlock(&sb->s_inode_list_lock); |
3546 |
+ |
3547 |
+- cond_resched(); |
3548 |
+ invalidate_mapping_pages(inode->i_mapping, 0, -1); |
3549 |
+ iput(toput_inode); |
3550 |
+ toput_inode = inode; |
3551 |
+ |
3552 |
++ cond_resched(); |
3553 |
+ spin_lock(&sb->s_inode_list_lock); |
3554 |
+ } |
3555 |
+ spin_unlock(&sb->s_inode_list_lock); |
3556 |
+diff --git a/fs/inode.c b/fs/inode.c |
3557 |
+index fef457a42882..96d62d97694e 100644 |
3558 |
+--- a/fs/inode.c |
3559 |
++++ b/fs/inode.c |
3560 |
+@@ -676,6 +676,7 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) |
3561 |
+ struct inode *inode, *next; |
3562 |
+ LIST_HEAD(dispose); |
3563 |
+ |
3564 |
++again: |
3565 |
+ spin_lock(&sb->s_inode_list_lock); |
3566 |
+ list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { |
3567 |
+ spin_lock(&inode->i_lock); |
3568 |
+@@ -698,6 +699,12 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) |
3569 |
+ inode_lru_list_del(inode); |
3570 |
+ spin_unlock(&inode->i_lock); |
3571 |
+ list_add(&inode->i_lru, &dispose); |
3572 |
++ if (need_resched()) { |
3573 |
++ spin_unlock(&sb->s_inode_list_lock); |
3574 |
++ cond_resched(); |
3575 |
++ dispose_list(&dispose); |
3576 |
++ goto again; |
3577 |
++ } |
3578 |
+ } |
3579 |
+ spin_unlock(&sb->s_inode_list_lock); |
3580 |
+ |
3581 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
3582 |
+index a60c6315a348..709671faaed6 100644 |
3583 |
+--- a/fs/io_uring.c |
3584 |
++++ b/fs/io_uring.c |
3585 |
+@@ -3721,6 +3721,9 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, |
3586 |
+ mutex_lock(&ctx->uring_lock); |
3587 |
+ submitted = io_ring_submit(ctx, to_submit); |
3588 |
+ mutex_unlock(&ctx->uring_lock); |
3589 |
++ |
3590 |
++ if (submitted != to_submit) |
3591 |
++ goto out; |
3592 |
+ } |
3593 |
+ if (flags & IORING_ENTER_GETEVENTS) { |
3594 |
+ unsigned nr_events = 0; |
3595 |
+@@ -3734,6 +3737,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, |
3596 |
+ } |
3597 |
+ } |
3598 |
+ |
3599 |
++out: |
3600 |
+ percpu_ref_put(&ctx->refs); |
3601 |
+ out_fput: |
3602 |
+ fdput(f); |
3603 |
+diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c |
3604 |
+index 2ecef6155fc0..f44e39c68328 100644 |
3605 |
+--- a/fs/notify/fsnotify.c |
3606 |
++++ b/fs/notify/fsnotify.c |
3607 |
+@@ -57,6 +57,9 @@ static void fsnotify_unmount_inodes(struct super_block *sb) |
3608 |
+ * doing an __iget/iput with SB_ACTIVE clear would actually |
3609 |
+ * evict all inodes with zero i_count from icache which is |
3610 |
+ * unnecessarily violent and may in fact be illegal to do. |
3611 |
++ * However, we should have been called /after/ evict_inodes |
3612 |
++ * removed all zero refcount inodes, in any case. Test to |
3613 |
++ * be sure. |
3614 |
+ */ |
3615 |
+ if (!atomic_read(&inode->i_count)) { |
3616 |
+ spin_unlock(&inode->i_lock); |
3617 |
+@@ -77,6 +80,7 @@ static void fsnotify_unmount_inodes(struct super_block *sb) |
3618 |
+ |
3619 |
+ iput_inode = inode; |
3620 |
+ |
3621 |
++ cond_resched(); |
3622 |
+ spin_lock(&sb->s_inode_list_lock); |
3623 |
+ } |
3624 |
+ spin_unlock(&sb->s_inode_list_lock); |
3625 |
+diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
3626 |
+index 9b96243de081..7abc3230c21a 100644 |
3627 |
+--- a/fs/quota/dquot.c |
3628 |
++++ b/fs/quota/dquot.c |
3629 |
+@@ -986,6 +986,7 @@ static int add_dquot_ref(struct super_block *sb, int type) |
3630 |
+ * later. |
3631 |
+ */ |
3632 |
+ old_inode = inode; |
3633 |
++ cond_resched(); |
3634 |
+ spin_lock(&sb->s_inode_list_lock); |
3635 |
+ } |
3636 |
+ spin_unlock(&sb->s_inode_list_lock); |
3637 |
+diff --git a/fs/super.c b/fs/super.c |
3638 |
+index cfadab2cbf35..cd352530eca9 100644 |
3639 |
+--- a/fs/super.c |
3640 |
++++ b/fs/super.c |
3641 |
+@@ -448,10 +448,12 @@ void generic_shutdown_super(struct super_block *sb) |
3642 |
+ sync_filesystem(sb); |
3643 |
+ sb->s_flags &= ~SB_ACTIVE; |
3644 |
+ |
3645 |
+- fsnotify_sb_delete(sb); |
3646 |
+ cgroup_writeback_umount(); |
3647 |
+ |
3648 |
++ /* evict all inodes with zero refcount */ |
3649 |
+ evict_inodes(sb); |
3650 |
++ /* only nonzero refcount inodes can have marks */ |
3651 |
++ fsnotify_sb_delete(sb); |
3652 |
+ |
3653 |
+ if (sb->s_dio_done_wq) { |
3654 |
+ destroy_workqueue(sb->s_dio_done_wq); |
3655 |
+diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h |
3656 |
+index 76cf11e905e1..8a9792a6427a 100644 |
3657 |
+--- a/include/linux/if_ether.h |
3658 |
++++ b/include/linux/if_ether.h |
3659 |
+@@ -24,6 +24,14 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) |
3660 |
+ return (struct ethhdr *)skb_mac_header(skb); |
3661 |
+ } |
3662 |
+ |
3663 |
++/* Prefer this version in TX path, instead of |
3664 |
++ * skb_reset_mac_header() + eth_hdr() |
3665 |
++ */ |
3666 |
++static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb) |
3667 |
++{ |
3668 |
++ return (struct ethhdr *)skb->data; |
3669 |
++} |
3670 |
++ |
3671 |
+ static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb) |
3672 |
+ { |
3673 |
+ return (struct ethhdr *)skb_inner_mac_header(skb); |
3674 |
+diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h |
3675 |
+index 4bc6d1a08781..b4d804a9fccb 100644 |
3676 |
+--- a/include/uapi/linux/netfilter/xt_sctp.h |
3677 |
++++ b/include/uapi/linux/netfilter/xt_sctp.h |
3678 |
+@@ -41,19 +41,19 @@ struct xt_sctp_info { |
3679 |
+ #define SCTP_CHUNKMAP_SET(chunkmap, type) \ |
3680 |
+ do { \ |
3681 |
+ (chunkmap)[type / bytes(__u32)] |= \ |
3682 |
+- 1 << (type % bytes(__u32)); \ |
3683 |
++ 1u << (type % bytes(__u32)); \ |
3684 |
+ } while (0) |
3685 |
+ |
3686 |
+ #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ |
3687 |
+ do { \ |
3688 |
+ (chunkmap)[type / bytes(__u32)] &= \ |
3689 |
+- ~(1 << (type % bytes(__u32))); \ |
3690 |
++ ~(1u << (type % bytes(__u32))); \ |
3691 |
+ } while (0) |
3692 |
+ |
3693 |
+ #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ |
3694 |
+ ({ \ |
3695 |
+ ((chunkmap)[type / bytes (__u32)] & \ |
3696 |
+- (1 << (type % bytes (__u32)))) ? 1: 0; \ |
3697 |
++ (1u << (type % bytes (__u32)))) ? 1: 0; \ |
3698 |
+ }) |
3699 |
+ |
3700 |
+ #define SCTP_CHUNKMAP_RESET(chunkmap) \ |
3701 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
3702 |
+index 5c51021775af..9c74c98f6501 100644 |
3703 |
+--- a/kernel/bpf/verifier.c |
3704 |
++++ b/kernel/bpf/verifier.c |
3705 |
+@@ -6039,6 +6039,7 @@ static bool may_access_skb(enum bpf_prog_type type) |
3706 |
+ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3707 |
+ { |
3708 |
+ struct bpf_reg_state *regs = cur_regs(env); |
3709 |
++ static const int ctx_reg = BPF_REG_6; |
3710 |
+ u8 mode = BPF_MODE(insn->code); |
3711 |
+ int i, err; |
3712 |
+ |
3713 |
+@@ -6072,7 +6073,7 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3714 |
+ } |
3715 |
+ |
3716 |
+ /* check whether implicit source operand (register R6) is readable */ |
3717 |
+- err = check_reg_arg(env, BPF_REG_6, SRC_OP); |
3718 |
++ err = check_reg_arg(env, ctx_reg, SRC_OP); |
3719 |
+ if (err) |
3720 |
+ return err; |
3721 |
+ |
3722 |
+@@ -6091,7 +6092,7 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3723 |
+ return -EINVAL; |
3724 |
+ } |
3725 |
+ |
3726 |
+- if (regs[BPF_REG_6].type != PTR_TO_CTX) { |
3727 |
++ if (regs[ctx_reg].type != PTR_TO_CTX) { |
3728 |
+ verbose(env, |
3729 |
+ "at the time of BPF_LD_ABS|IND R6 != pointer to skb\n"); |
3730 |
+ return -EINVAL; |
3731 |
+@@ -6104,6 +6105,10 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) |
3732 |
+ return err; |
3733 |
+ } |
3734 |
+ |
3735 |
++ err = check_ctx_reg(env, ®s[ctx_reg], ctx_reg); |
3736 |
++ if (err < 0) |
3737 |
++ return err; |
3738 |
++ |
3739 |
+ /* reset caller saved regs to unreadable */ |
3740 |
+ for (i = 0; i < CALLER_SAVED_REGS; i++) { |
3741 |
+ mark_reg_not_init(env, regs, caller_saved[i]); |
3742 |
+diff --git a/kernel/locking/spinlock_debug.c b/kernel/locking/spinlock_debug.c |
3743 |
+index 399669f7eba8..472dd462a40c 100644 |
3744 |
+--- a/kernel/locking/spinlock_debug.c |
3745 |
++++ b/kernel/locking/spinlock_debug.c |
3746 |
+@@ -51,19 +51,19 @@ EXPORT_SYMBOL(__rwlock_init); |
3747 |
+ |
3748 |
+ static void spin_dump(raw_spinlock_t *lock, const char *msg) |
3749 |
+ { |
3750 |
+- struct task_struct *owner = NULL; |
3751 |
++ struct task_struct *owner = READ_ONCE(lock->owner); |
3752 |
+ |
3753 |
+- if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) |
3754 |
+- owner = lock->owner; |
3755 |
++ if (owner == SPINLOCK_OWNER_INIT) |
3756 |
++ owner = NULL; |
3757 |
+ printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n", |
3758 |
+ msg, raw_smp_processor_id(), |
3759 |
+ current->comm, task_pid_nr(current)); |
3760 |
+ printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, " |
3761 |
+ ".owner_cpu: %d\n", |
3762 |
+- lock, lock->magic, |
3763 |
++ lock, READ_ONCE(lock->magic), |
3764 |
+ owner ? owner->comm : "<none>", |
3765 |
+ owner ? task_pid_nr(owner) : -1, |
3766 |
+- lock->owner_cpu); |
3767 |
++ READ_ONCE(lock->owner_cpu)); |
3768 |
+ dump_stack(); |
3769 |
+ } |
3770 |
+ |
3771 |
+@@ -80,16 +80,16 @@ static void spin_bug(raw_spinlock_t *lock, const char *msg) |
3772 |
+ static inline void |
3773 |
+ debug_spin_lock_before(raw_spinlock_t *lock) |
3774 |
+ { |
3775 |
+- SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); |
3776 |
+- SPIN_BUG_ON(lock->owner == current, lock, "recursion"); |
3777 |
+- SPIN_BUG_ON(lock->owner_cpu == raw_smp_processor_id(), |
3778 |
++ SPIN_BUG_ON(READ_ONCE(lock->magic) != SPINLOCK_MAGIC, lock, "bad magic"); |
3779 |
++ SPIN_BUG_ON(READ_ONCE(lock->owner) == current, lock, "recursion"); |
3780 |
++ SPIN_BUG_ON(READ_ONCE(lock->owner_cpu) == raw_smp_processor_id(), |
3781 |
+ lock, "cpu recursion"); |
3782 |
+ } |
3783 |
+ |
3784 |
+ static inline void debug_spin_lock_after(raw_spinlock_t *lock) |
3785 |
+ { |
3786 |
+- lock->owner_cpu = raw_smp_processor_id(); |
3787 |
+- lock->owner = current; |
3788 |
++ WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id()); |
3789 |
++ WRITE_ONCE(lock->owner, current); |
3790 |
+ } |
3791 |
+ |
3792 |
+ static inline void debug_spin_unlock(raw_spinlock_t *lock) |
3793 |
+@@ -99,8 +99,8 @@ static inline void debug_spin_unlock(raw_spinlock_t *lock) |
3794 |
+ SPIN_BUG_ON(lock->owner != current, lock, "wrong owner"); |
3795 |
+ SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), |
3796 |
+ lock, "wrong CPU"); |
3797 |
+- lock->owner = SPINLOCK_OWNER_INIT; |
3798 |
+- lock->owner_cpu = -1; |
3799 |
++ WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT); |
3800 |
++ WRITE_ONCE(lock->owner_cpu, -1); |
3801 |
+ } |
3802 |
+ |
3803 |
+ /* |
3804 |
+@@ -187,8 +187,8 @@ static inline void debug_write_lock_before(rwlock_t *lock) |
3805 |
+ |
3806 |
+ static inline void debug_write_lock_after(rwlock_t *lock) |
3807 |
+ { |
3808 |
+- lock->owner_cpu = raw_smp_processor_id(); |
3809 |
+- lock->owner = current; |
3810 |
++ WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id()); |
3811 |
++ WRITE_ONCE(lock->owner, current); |
3812 |
+ } |
3813 |
+ |
3814 |
+ static inline void debug_write_unlock(rwlock_t *lock) |
3815 |
+@@ -197,8 +197,8 @@ static inline void debug_write_unlock(rwlock_t *lock) |
3816 |
+ RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner"); |
3817 |
+ RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), |
3818 |
+ lock, "wrong CPU"); |
3819 |
+- lock->owner = SPINLOCK_OWNER_INIT; |
3820 |
+- lock->owner_cpu = -1; |
3821 |
++ WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT); |
3822 |
++ WRITE_ONCE(lock->owner_cpu, -1); |
3823 |
+ } |
3824 |
+ |
3825 |
+ void do_raw_write_lock(rwlock_t *lock) |
3826 |
+diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c |
3827 |
+index 517e3719027e..ce8f6748678a 100644 |
3828 |
+--- a/kernel/sched/psi.c |
3829 |
++++ b/kernel/sched/psi.c |
3830 |
+@@ -185,7 +185,8 @@ static void group_init(struct psi_group *group) |
3831 |
+ |
3832 |
+ for_each_possible_cpu(cpu) |
3833 |
+ seqcount_init(&per_cpu_ptr(group->pcpu, cpu)->seq); |
3834 |
+- group->avg_next_update = sched_clock() + psi_period; |
3835 |
++ group->avg_last_update = sched_clock(); |
3836 |
++ group->avg_next_update = group->avg_last_update + psi_period; |
3837 |
+ INIT_DELAYED_WORK(&group->avgs_work, psi_avgs_work); |
3838 |
+ mutex_init(&group->avgs_lock); |
3839 |
+ /* Init trigger-related members */ |
3840 |
+@@ -481,7 +482,7 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value) |
3841 |
+ u32 remaining; |
3842 |
+ |
3843 |
+ remaining = win->size - elapsed; |
3844 |
+- growth += div_u64(win->prev_growth * remaining, win->size); |
3845 |
++ growth += div64_u64(win->prev_growth * remaining, win->size); |
3846 |
+ } |
3847 |
+ |
3848 |
+ return growth; |
3849 |
+diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c |
3850 |
+index 66358d66c933..4bf050fcfe3b 100644 |
3851 |
+--- a/kernel/trace/ring_buffer.c |
3852 |
++++ b/kernel/trace/ring_buffer.c |
3853 |
+@@ -11,6 +11,7 @@ |
3854 |
+ #include <linux/trace_seq.h> |
3855 |
+ #include <linux/spinlock.h> |
3856 |
+ #include <linux/irq_work.h> |
3857 |
++#include <linux/security.h> |
3858 |
+ #include <linux/uaccess.h> |
3859 |
+ #include <linux/hardirq.h> |
3860 |
+ #include <linux/kthread.h> /* for self test */ |
3861 |
+@@ -5068,6 +5069,11 @@ static __init int test_ringbuffer(void) |
3862 |
+ int cpu; |
3863 |
+ int ret = 0; |
3864 |
+ |
3865 |
++ if (security_locked_down(LOCKDOWN_TRACEFS)) { |
3866 |
++ pr_warning("Lockdown is enabled, skipping ring buffer tests\n"); |
3867 |
++ return 0; |
3868 |
++ } |
3869 |
++ |
3870 |
+ pr_info("Running ring buffer tests...\n"); |
3871 |
+ |
3872 |
+ buffer = ring_buffer_alloc(RB_TEST_BUFFER_SIZE, RB_FL_OVERWRITE); |
3873 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
3874 |
+index d8bd9b1d8bce..bcb72f102613 100644 |
3875 |
+--- a/kernel/trace/trace.c |
3876 |
++++ b/kernel/trace/trace.c |
3877 |
+@@ -1804,6 +1804,12 @@ int __init register_tracer(struct tracer *type) |
3878 |
+ return -1; |
3879 |
+ } |
3880 |
+ |
3881 |
++ if (security_locked_down(LOCKDOWN_TRACEFS)) { |
3882 |
++ pr_warning("Can not register tracer %s due to lockdown\n", |
3883 |
++ type->name); |
3884 |
++ return -EPERM; |
3885 |
++ } |
3886 |
++ |
3887 |
+ mutex_lock(&trace_types_lock); |
3888 |
+ |
3889 |
+ tracing_selftest_running = true; |
3890 |
+@@ -8647,6 +8653,11 @@ struct dentry *tracing_init_dentry(void) |
3891 |
+ { |
3892 |
+ struct trace_array *tr = &global_trace; |
3893 |
+ |
3894 |
++ if (security_locked_down(LOCKDOWN_TRACEFS)) { |
3895 |
++ pr_warning("Tracing disabled due to lockdown\n"); |
3896 |
++ return ERR_PTR(-EPERM); |
3897 |
++ } |
3898 |
++ |
3899 |
+ /* The top level trace array uses NULL as parent */ |
3900 |
+ if (tr->dir) |
3901 |
+ return NULL; |
3902 |
+@@ -9089,6 +9100,12 @@ __init static int tracer_alloc_buffers(void) |
3903 |
+ int ring_buf_size; |
3904 |
+ int ret = -ENOMEM; |
3905 |
+ |
3906 |
++ |
3907 |
++ if (security_locked_down(LOCKDOWN_TRACEFS)) { |
3908 |
++ pr_warning("Tracing disabled due to lockdown\n"); |
3909 |
++ return -EPERM; |
3910 |
++ } |
3911 |
++ |
3912 |
+ /* |
3913 |
+ * Make sure we don't accidently add more trace options |
3914 |
+ * than we have bits for. |
3915 |
+diff --git a/lib/sbitmap.c b/lib/sbitmap.c |
3916 |
+index 969e5400a615..ee3ce1494568 100644 |
3917 |
+--- a/lib/sbitmap.c |
3918 |
++++ b/lib/sbitmap.c |
3919 |
+@@ -667,8 +667,8 @@ void sbitmap_add_wait_queue(struct sbitmap_queue *sbq, |
3920 |
+ if (!sbq_wait->sbq) { |
3921 |
+ sbq_wait->sbq = sbq; |
3922 |
+ atomic_inc(&sbq->ws_active); |
3923 |
++ add_wait_queue(&ws->wait, &sbq_wait->wait); |
3924 |
+ } |
3925 |
+- add_wait_queue(&ws->wait, &sbq_wait->wait); |
3926 |
+ } |
3927 |
+ EXPORT_SYMBOL_GPL(sbitmap_add_wait_queue); |
3928 |
+ |
3929 |
+diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h |
3930 |
+index c46daf09a501..bb7ec1a3915d 100644 |
3931 |
+--- a/net/8021q/vlan.h |
3932 |
++++ b/net/8021q/vlan.h |
3933 |
+@@ -126,6 +126,7 @@ int vlan_check_real_dev(struct net_device *real_dev, |
3934 |
+ void vlan_setup(struct net_device *dev); |
3935 |
+ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack); |
3936 |
+ void unregister_vlan_dev(struct net_device *dev, struct list_head *head); |
3937 |
++void vlan_dev_uninit(struct net_device *dev); |
3938 |
+ bool vlan_dev_inherit_address(struct net_device *dev, |
3939 |
+ struct net_device *real_dev); |
3940 |
+ |
3941 |
+diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c |
3942 |
+index e5bff5cc6f97..2a78da4072de 100644 |
3943 |
+--- a/net/8021q/vlan_dev.c |
3944 |
++++ b/net/8021q/vlan_dev.c |
3945 |
+@@ -586,7 +586,8 @@ static int vlan_dev_init(struct net_device *dev) |
3946 |
+ return 0; |
3947 |
+ } |
3948 |
+ |
3949 |
+-static void vlan_dev_uninit(struct net_device *dev) |
3950 |
++/* Note: this function might be called multiple times for the same device. */ |
3951 |
++void vlan_dev_uninit(struct net_device *dev) |
3952 |
+ { |
3953 |
+ struct vlan_priority_tci_mapping *pm; |
3954 |
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev); |
3955 |
+diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c |
3956 |
+index c482a6fe9393..0db85aeb119b 100644 |
3957 |
+--- a/net/8021q/vlan_netlink.c |
3958 |
++++ b/net/8021q/vlan_netlink.c |
3959 |
+@@ -108,11 +108,13 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], |
3960 |
+ struct ifla_vlan_flags *flags; |
3961 |
+ struct ifla_vlan_qos_mapping *m; |
3962 |
+ struct nlattr *attr; |
3963 |
+- int rem; |
3964 |
++ int rem, err; |
3965 |
+ |
3966 |
+ if (data[IFLA_VLAN_FLAGS]) { |
3967 |
+ flags = nla_data(data[IFLA_VLAN_FLAGS]); |
3968 |
+- vlan_dev_change_flags(dev, flags->flags, flags->mask); |
3969 |
++ err = vlan_dev_change_flags(dev, flags->flags, flags->mask); |
3970 |
++ if (err) |
3971 |
++ return err; |
3972 |
+ } |
3973 |
+ if (data[IFLA_VLAN_INGRESS_QOS]) { |
3974 |
+ nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) { |
3975 |
+@@ -123,7 +125,9 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], |
3976 |
+ if (data[IFLA_VLAN_EGRESS_QOS]) { |
3977 |
+ nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) { |
3978 |
+ m = nla_data(attr); |
3979 |
+- vlan_dev_set_egress_priority(dev, m->from, m->to); |
3980 |
++ err = vlan_dev_set_egress_priority(dev, m->from, m->to); |
3981 |
++ if (err) |
3982 |
++ return err; |
3983 |
+ } |
3984 |
+ } |
3985 |
+ return 0; |
3986 |
+@@ -179,10 +183,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev, |
3987 |
+ return -EINVAL; |
3988 |
+ |
3989 |
+ err = vlan_changelink(dev, tb, data, extack); |
3990 |
+- if (err < 0) |
3991 |
+- return err; |
3992 |
+- |
3993 |
+- return register_vlan_dev(dev, extack); |
3994 |
++ if (!err) |
3995 |
++ err = register_vlan_dev(dev, extack); |
3996 |
++ if (err) |
3997 |
++ vlan_dev_uninit(dev); |
3998 |
++ return err; |
3999 |
+ } |
4000 |
+ |
4001 |
+ static inline size_t vlan_qos_map_size(unsigned int n) |
4002 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
4003 |
+index 6d0111bfdb4a..2f76461c120d 100644 |
4004 |
+--- a/net/core/filter.c |
4005 |
++++ b/net/core/filter.c |
4006 |
+@@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb) |
4007 |
+ } |
4008 |
+ |
4009 |
+ skb->dev = dev; |
4010 |
++ skb->tstamp = 0; |
4011 |
+ |
4012 |
+ dev_xmit_recursion_inc(); |
4013 |
+ ret = dev_queue_xmit(skb); |
4014 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
4015 |
+index a2e52ad7cdab..67e44e6717b0 100644 |
4016 |
+--- a/net/ipv4/tcp_input.c |
4017 |
++++ b/net/ipv4/tcp_input.c |
4018 |
+@@ -1727,8 +1727,11 @@ tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, |
4019 |
+ } |
4020 |
+ |
4021 |
+ /* Ignore very old stuff early */ |
4022 |
+- if (!after(sp[used_sacks].end_seq, prior_snd_una)) |
4023 |
++ if (!after(sp[used_sacks].end_seq, prior_snd_una)) { |
4024 |
++ if (i == 0) |
4025 |
++ first_sack_index = -1; |
4026 |
+ continue; |
4027 |
++ } |
4028 |
+ |
4029 |
+ used_sacks++; |
4030 |
+ } |
4031 |
+diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c |
4032 |
+index 204a8351efff..c29170e767a8 100644 |
4033 |
+--- a/net/llc/llc_station.c |
4034 |
++++ b/net/llc/llc_station.c |
4035 |
+@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) |
4036 |
+ return LLC_PDU_IS_CMD(pdu) && /* command PDU */ |
4037 |
+ LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ |
4038 |
+ LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID && |
4039 |
+- !pdu->dsap ? 0 : 1; /* NULL DSAP value */ |
4040 |
++ !pdu->dsap; /* NULL DSAP value */ |
4041 |
+ } |
4042 |
+ |
4043 |
+ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) |
4044 |
+@@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) |
4045 |
+ return LLC_PDU_IS_CMD(pdu) && /* command PDU */ |
4046 |
+ LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ |
4047 |
+ LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST && |
4048 |
+- !pdu->dsap ? 0 : 1; /* NULL DSAP */ |
4049 |
++ !pdu->dsap; /* NULL DSAP */ |
4050 |
+ } |
4051 |
+ |
4052 |
+ static int llc_station_ac_send_xid_r(struct sk_buff *skb) |
4053 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
4054 |
+index 1fa422782905..cbd273c0b275 100644 |
4055 |
+--- a/net/mac80211/tx.c |
4056 |
++++ b/net/mac80211/tx.c |
4057 |
+@@ -2263,6 +2263,15 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, |
4058 |
+ payload[7]); |
4059 |
+ } |
4060 |
+ |
4061 |
++ /* |
4062 |
++ * Initialize skb->priority for QoS frames. This is put in the TID field |
4063 |
++ * of the frame before passing it to the driver. |
4064 |
++ */ |
4065 |
++ if (ieee80211_is_data_qos(hdr->frame_control)) { |
4066 |
++ u8 *p = ieee80211_get_qos_ctl(hdr); |
4067 |
++ skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; |
4068 |
++ } |
4069 |
++ |
4070 |
+ memset(info, 0, sizeof(*info)); |
4071 |
+ |
4072 |
+ info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS | |
4073 |
+diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c |
4074 |
+index e2d13cd18875..aa8adf930b3c 100644 |
4075 |
+--- a/net/netfilter/nf_conntrack_netlink.c |
4076 |
++++ b/net/netfilter/nf_conntrack_netlink.c |
4077 |
+@@ -3602,6 +3602,9 @@ static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list) |
4078 |
+ |
4079 |
+ list_for_each_entry(net, net_exit_list, exit_list) |
4080 |
+ ctnetlink_net_exit(net); |
4081 |
++ |
4082 |
++ /* wait for other cpus until they are done with ctnl_notifiers */ |
4083 |
++ synchronize_rcu(); |
4084 |
+ } |
4085 |
+ |
4086 |
+ static struct pernet_operations ctnetlink_net_ops = { |
4087 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
4088 |
+index 712a428509ad..67ca47c7ce54 100644 |
4089 |
+--- a/net/netfilter/nf_tables_api.c |
4090 |
++++ b/net/netfilter/nf_tables_api.c |
4091 |
+@@ -4252,8 +4252,10 @@ static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set, |
4092 |
+ return err; |
4093 |
+ |
4094 |
+ err = -EINVAL; |
4095 |
+- if (desc.type != NFT_DATA_VALUE || desc.len != set->klen) |
4096 |
++ if (desc.type != NFT_DATA_VALUE || desc.len != set->klen) { |
4097 |
++ nft_data_release(&elem.key.val, desc.type); |
4098 |
+ return err; |
4099 |
++ } |
4100 |
+ |
4101 |
+ priv = set->ops->get(ctx->net, set, &elem, flags); |
4102 |
+ if (IS_ERR(priv)) |
4103 |
+@@ -4489,14 +4491,20 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, |
4104 |
+ if (nla[NFTA_SET_ELEM_DATA] == NULL && |
4105 |
+ !(flags & NFT_SET_ELEM_INTERVAL_END)) |
4106 |
+ return -EINVAL; |
4107 |
+- if (nla[NFTA_SET_ELEM_DATA] != NULL && |
4108 |
+- flags & NFT_SET_ELEM_INTERVAL_END) |
4109 |
+- return -EINVAL; |
4110 |
+ } else { |
4111 |
+ if (nla[NFTA_SET_ELEM_DATA] != NULL) |
4112 |
+ return -EINVAL; |
4113 |
+ } |
4114 |
+ |
4115 |
++ if ((flags & NFT_SET_ELEM_INTERVAL_END) && |
4116 |
++ (nla[NFTA_SET_ELEM_DATA] || |
4117 |
++ nla[NFTA_SET_ELEM_OBJREF] || |
4118 |
++ nla[NFTA_SET_ELEM_TIMEOUT] || |
4119 |
++ nla[NFTA_SET_ELEM_EXPIRATION] || |
4120 |
++ nla[NFTA_SET_ELEM_USERDATA] || |
4121 |
++ nla[NFTA_SET_ELEM_EXPR])) |
4122 |
++ return -EINVAL; |
4123 |
++ |
4124 |
+ timeout = 0; |
4125 |
+ if (nla[NFTA_SET_ELEM_TIMEOUT] != NULL) { |
4126 |
+ if (!(set->flags & NFT_SET_TIMEOUT)) |
4127 |
+@@ -5209,7 +5217,7 @@ static int nf_tables_newobj(struct net *net, struct sock *nlsk, |
4128 |
+ if (nlh->nlmsg_flags & NLM_F_REPLACE) |
4129 |
+ return -EOPNOTSUPP; |
4130 |
+ |
4131 |
+- type = nft_obj_type_get(net, objtype); |
4132 |
++ type = __nft_obj_type_get(objtype); |
4133 |
+ nft_ctx_init(&ctx, net, skb, nlh, family, table, NULL, nla); |
4134 |
+ |
4135 |
+ return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj); |
4136 |
+diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c |
4137 |
+index 5f6037695dee..e743f811245f 100644 |
4138 |
+--- a/net/netfilter/nf_tables_offload.c |
4139 |
++++ b/net/netfilter/nf_tables_offload.c |
4140 |
+@@ -44,6 +44,9 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net, |
4141 |
+ expr = nft_expr_next(expr); |
4142 |
+ } |
4143 |
+ |
4144 |
++ if (num_actions == 0) |
4145 |
++ return ERR_PTR(-EOPNOTSUPP); |
4146 |
++ |
4147 |
+ flow = nft_flow_rule_alloc(num_actions); |
4148 |
+ if (!flow) |
4149 |
+ return ERR_PTR(-ENOMEM); |
4150 |
+@@ -446,6 +449,9 @@ static int nft_offload_netdev_event(struct notifier_block *this, |
4151 |
+ struct net *net = dev_net(dev); |
4152 |
+ struct nft_chain *chain; |
4153 |
+ |
4154 |
++ if (event != NETDEV_UNREGISTER) |
4155 |
++ return NOTIFY_DONE; |
4156 |
++ |
4157 |
+ mutex_lock(&net->nft.commit_mutex); |
4158 |
+ chain = __nft_offload_get_chain(dev); |
4159 |
+ if (chain) |
4160 |
+diff --git a/net/netfilter/nft_bitwise.c b/net/netfilter/nft_bitwise.c |
4161 |
+index 02afa752dd2e..10e9d50e4e19 100644 |
4162 |
+--- a/net/netfilter/nft_bitwise.c |
4163 |
++++ b/net/netfilter/nft_bitwise.c |
4164 |
+@@ -80,7 +80,7 @@ static int nft_bitwise_init(const struct nft_ctx *ctx, |
4165 |
+ tb[NFTA_BITWISE_MASK]); |
4166 |
+ if (err < 0) |
4167 |
+ return err; |
4168 |
+- if (d1.len != priv->len) { |
4169 |
++ if (d1.type != NFT_DATA_VALUE || d1.len != priv->len) { |
4170 |
+ err = -EINVAL; |
4171 |
+ goto err1; |
4172 |
+ } |
4173 |
+@@ -89,7 +89,7 @@ static int nft_bitwise_init(const struct nft_ctx *ctx, |
4174 |
+ tb[NFTA_BITWISE_XOR]); |
4175 |
+ if (err < 0) |
4176 |
+ goto err1; |
4177 |
+- if (d2.len != priv->len) { |
4178 |
++ if (d2.type != NFT_DATA_VALUE || d2.len != priv->len) { |
4179 |
+ err = -EINVAL; |
4180 |
+ goto err2; |
4181 |
+ } |
4182 |
+diff --git a/net/netfilter/nft_cmp.c b/net/netfilter/nft_cmp.c |
4183 |
+index 0744b2bb46da..ae730dba60c8 100644 |
4184 |
+--- a/net/netfilter/nft_cmp.c |
4185 |
++++ b/net/netfilter/nft_cmp.c |
4186 |
+@@ -80,6 +80,12 @@ static int nft_cmp_init(const struct nft_ctx *ctx, const struct nft_expr *expr, |
4187 |
+ if (err < 0) |
4188 |
+ return err; |
4189 |
+ |
4190 |
++ if (desc.type != NFT_DATA_VALUE) { |
4191 |
++ err = -EINVAL; |
4192 |
++ nft_data_release(&priv->data, desc.type); |
4193 |
++ return err; |
4194 |
++ } |
4195 |
++ |
4196 |
+ priv->sreg = nft_parse_register(tb[NFTA_CMP_SREG]); |
4197 |
+ err = nft_validate_register_load(priv->sreg, desc.len); |
4198 |
+ if (err < 0) |
4199 |
+diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c |
4200 |
+index 4701fa8a45e7..89efcc5a533d 100644 |
4201 |
+--- a/net/netfilter/nft_range.c |
4202 |
++++ b/net/netfilter/nft_range.c |
4203 |
+@@ -66,11 +66,21 @@ static int nft_range_init(const struct nft_ctx *ctx, const struct nft_expr *expr |
4204 |
+ if (err < 0) |
4205 |
+ return err; |
4206 |
+ |
4207 |
++ if (desc_from.type != NFT_DATA_VALUE) { |
4208 |
++ err = -EINVAL; |
4209 |
++ goto err1; |
4210 |
++ } |
4211 |
++ |
4212 |
+ err = nft_data_init(NULL, &priv->data_to, sizeof(priv->data_to), |
4213 |
+ &desc_to, tb[NFTA_RANGE_TO_DATA]); |
4214 |
+ if (err < 0) |
4215 |
+ goto err1; |
4216 |
+ |
4217 |
++ if (desc_to.type != NFT_DATA_VALUE) { |
4218 |
++ err = -EINVAL; |
4219 |
++ goto err2; |
4220 |
++ } |
4221 |
++ |
4222 |
+ if (desc_from.len != desc_to.len) { |
4223 |
+ err = -EINVAL; |
4224 |
+ goto err2; |
4225 |
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
4226 |
+index 57123259452f..a9f804f7a04a 100644 |
4227 |
+--- a/net/netfilter/nft_set_rbtree.c |
4228 |
++++ b/net/netfilter/nft_set_rbtree.c |
4229 |
+@@ -74,8 +74,13 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set |
4230 |
+ parent = rcu_dereference_raw(parent->rb_left); |
4231 |
+ continue; |
4232 |
+ } |
4233 |
+- if (nft_rbtree_interval_end(rbe)) |
4234 |
+- goto out; |
4235 |
++ if (nft_rbtree_interval_end(rbe)) { |
4236 |
++ if (nft_set_is_anonymous(set)) |
4237 |
++ return false; |
4238 |
++ parent = rcu_dereference_raw(parent->rb_left); |
4239 |
++ interval = NULL; |
4240 |
++ continue; |
4241 |
++ } |
4242 |
+ |
4243 |
+ *ext = &rbe->ext; |
4244 |
+ return true; |
4245 |
+@@ -88,7 +93,7 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set |
4246 |
+ *ext = &interval->ext; |
4247 |
+ return true; |
4248 |
+ } |
4249 |
+-out: |
4250 |
++ |
4251 |
+ return false; |
4252 |
+ } |
4253 |
+ |
4254 |
+@@ -139,8 +144,10 @@ static bool __nft_rbtree_get(const struct net *net, const struct nft_set *set, |
4255 |
+ if (flags & NFT_SET_ELEM_INTERVAL_END) |
4256 |
+ interval = rbe; |
4257 |
+ } else { |
4258 |
+- if (!nft_set_elem_active(&rbe->ext, genmask)) |
4259 |
++ if (!nft_set_elem_active(&rbe->ext, genmask)) { |
4260 |
+ parent = rcu_dereference_raw(parent->rb_left); |
4261 |
++ continue; |
4262 |
++ } |
4263 |
+ |
4264 |
+ if (!nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) || |
4265 |
+ (*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END) == |
4266 |
+@@ -148,7 +155,11 @@ static bool __nft_rbtree_get(const struct net *net, const struct nft_set *set, |
4267 |
+ *elem = rbe; |
4268 |
+ return true; |
4269 |
+ } |
4270 |
+- return false; |
4271 |
++ |
4272 |
++ if (nft_rbtree_interval_end(rbe)) |
4273 |
++ interval = NULL; |
4274 |
++ |
4275 |
++ parent = rcu_dereference_raw(parent->rb_left); |
4276 |
+ } |
4277 |
+ } |
4278 |
+ |
4279 |
+diff --git a/net/rfkill/core.c b/net/rfkill/core.c |
4280 |
+index 0bf9bf1ceb8f..6c089320ae4f 100644 |
4281 |
+--- a/net/rfkill/core.c |
4282 |
++++ b/net/rfkill/core.c |
4283 |
+@@ -1002,10 +1002,13 @@ static void rfkill_sync_work(struct work_struct *work) |
4284 |
+ int __must_check rfkill_register(struct rfkill *rfkill) |
4285 |
+ { |
4286 |
+ static unsigned long rfkill_no; |
4287 |
+- struct device *dev = &rfkill->dev; |
4288 |
++ struct device *dev; |
4289 |
+ int error; |
4290 |
+ |
4291 |
+- BUG_ON(!rfkill); |
4292 |
++ if (!rfkill) |
4293 |
++ return -EINVAL; |
4294 |
++ |
4295 |
++ dev = &rfkill->dev; |
4296 |
+ |
4297 |
+ mutex_lock(&rfkill_global_mutex); |
4298 |
+ |
4299 |
+diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c |
4300 |
+index 53a80bc6b13a..dd0e8680b030 100644 |
4301 |
+--- a/net/sched/sch_cake.c |
4302 |
++++ b/net/sched/sch_cake.c |
4303 |
+@@ -1769,7 +1769,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
4304 |
+ q->avg_window_begin)); |
4305 |
+ u64 b = q->avg_window_bytes * (u64)NSEC_PER_SEC; |
4306 |
+ |
4307 |
+- do_div(b, window_interval); |
4308 |
++ b = div64_u64(b, window_interval); |
4309 |
+ q->avg_peak_bandwidth = |
4310 |
+ cake_ewma(q->avg_peak_bandwidth, b, |
4311 |
+ b > q->avg_peak_bandwidth ? 2 : 8); |
4312 |
+diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c |
4313 |
+index 78ecdf146882..712ad248d6a7 100644 |
4314 |
+--- a/net/sched/sch_fq.c |
4315 |
++++ b/net/sched/sch_fq.c |
4316 |
+@@ -787,10 +787,12 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, |
4317 |
+ if (tb[TCA_FQ_QUANTUM]) { |
4318 |
+ u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); |
4319 |
+ |
4320 |
+- if (quantum > 0) |
4321 |
++ if (quantum > 0 && quantum <= (1 << 20)) { |
4322 |
+ q->quantum = quantum; |
4323 |
+- else |
4324 |
++ } else { |
4325 |
++ NL_SET_ERR_MSG_MOD(extack, "invalid quantum"); |
4326 |
+ err = -EINVAL; |
4327 |
++ } |
4328 |
+ } |
4329 |
+ |
4330 |
+ if (tb[TCA_FQ_INITIAL_QUANTUM]) |
4331 |
+diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c |
4332 |
+index 18b884cfdfe8..647941702f9f 100644 |
4333 |
+--- a/net/sched/sch_prio.c |
4334 |
++++ b/net/sched/sch_prio.c |
4335 |
+@@ -292,8 +292,14 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, |
4336 |
+ struct tc_prio_qopt_offload graft_offload; |
4337 |
+ unsigned long band = arg - 1; |
4338 |
+ |
4339 |
+- if (new == NULL) |
4340 |
+- new = &noop_qdisc; |
4341 |
++ if (!new) { |
4342 |
++ new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, |
4343 |
++ TC_H_MAKE(sch->handle, arg), extack); |
4344 |
++ if (!new) |
4345 |
++ new = &noop_qdisc; |
4346 |
++ else |
4347 |
++ qdisc_hash_add(new, true); |
4348 |
++ } |
4349 |
+ |
4350 |
+ *old = qdisc_replace(sch, new, &q->queues[band]); |
4351 |
+ |
4352 |
+diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c |
4353 |
+index e52b2128e43b..b06cae508158 100644 |
4354 |
+--- a/net/sctp/sm_sideeffect.c |
4355 |
++++ b/net/sctp/sm_sideeffect.c |
4356 |
+@@ -1358,8 +1358,10 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, |
4357 |
+ /* Generate an INIT ACK chunk. */ |
4358 |
+ new_obj = sctp_make_init_ack(asoc, chunk, GFP_ATOMIC, |
4359 |
+ 0); |
4360 |
+- if (!new_obj) |
4361 |
+- goto nomem; |
4362 |
++ if (!new_obj) { |
4363 |
++ error = -ENOMEM; |
4364 |
++ break; |
4365 |
++ } |
4366 |
+ |
4367 |
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
4368 |
+ SCTP_CHUNK(new_obj)); |
4369 |
+@@ -1381,7 +1383,8 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, |
4370 |
+ if (!new_obj) { |
4371 |
+ if (cmd->obj.chunk) |
4372 |
+ sctp_chunk_free(cmd->obj.chunk); |
4373 |
+- goto nomem; |
4374 |
++ error = -ENOMEM; |
4375 |
++ break; |
4376 |
+ } |
4377 |
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
4378 |
+ SCTP_CHUNK(new_obj)); |
4379 |
+@@ -1428,8 +1431,10 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, |
4380 |
+ |
4381 |
+ /* Generate a SHUTDOWN chunk. */ |
4382 |
+ new_obj = sctp_make_shutdown(asoc, chunk); |
4383 |
+- if (!new_obj) |
4384 |
+- goto nomem; |
4385 |
++ if (!new_obj) { |
4386 |
++ error = -ENOMEM; |
4387 |
++ break; |
4388 |
++ } |
4389 |
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
4390 |
+ SCTP_CHUNK(new_obj)); |
4391 |
+ break; |
4392 |
+@@ -1765,11 +1770,17 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, |
4393 |
+ break; |
4394 |
+ } |
4395 |
+ |
4396 |
+- if (error) |
4397 |
++ if (error) { |
4398 |
++ cmd = sctp_next_cmd(commands); |
4399 |
++ while (cmd) { |
4400 |
++ if (cmd->verb == SCTP_CMD_REPLY) |
4401 |
++ sctp_chunk_free(cmd->obj.chunk); |
4402 |
++ cmd = sctp_next_cmd(commands); |
4403 |
++ } |
4404 |
+ break; |
4405 |
++ } |
4406 |
+ } |
4407 |
+ |
4408 |
+-out: |
4409 |
+ /* If this is in response to a received chunk, wait until |
4410 |
+ * we are done with the packet to open the queue so that we don't |
4411 |
+ * send multiple packets in response to a single request. |
4412 |
+@@ -1784,7 +1795,4 @@ out: |
4413 |
+ sp->data_ready_signalled = 0; |
4414 |
+ |
4415 |
+ return error; |
4416 |
+-nomem: |
4417 |
+- error = -ENOMEM; |
4418 |
+- goto out; |
4419 |
+ } |
4420 |
+diff --git a/net/wireless/core.c b/net/wireless/core.c |
4421 |
+index 350513744575..3e25229a059d 100644 |
4422 |
+--- a/net/wireless/core.c |
4423 |
++++ b/net/wireless/core.c |
4424 |
+@@ -1102,6 +1102,7 @@ static void __cfg80211_unregister_wdev(struct wireless_dev *wdev, bool sync) |
4425 |
+ |
4426 |
+ #ifdef CONFIG_CFG80211_WEXT |
4427 |
+ kzfree(wdev->wext.keys); |
4428 |
++ wdev->wext.keys = NULL; |
4429 |
+ #endif |
4430 |
+ /* only initialized if we have a netdev */ |
4431 |
+ if (wdev->netdev) |
4432 |
+diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
4433 |
+index 9044073fbf22..d426fc01c529 100644 |
4434 |
+--- a/net/xdp/xsk.c |
4435 |
++++ b/net/xdp/xsk.c |
4436 |
+@@ -305,12 +305,21 @@ out: |
4437 |
+ } |
4438 |
+ EXPORT_SYMBOL(xsk_umem_consume_tx); |
4439 |
+ |
4440 |
+-static int xsk_zc_xmit(struct xdp_sock *xs) |
4441 |
++static int xsk_wakeup(struct xdp_sock *xs, u8 flags) |
4442 |
+ { |
4443 |
+ struct net_device *dev = xs->dev; |
4444 |
++ int err; |
4445 |
++ |
4446 |
++ rcu_read_lock(); |
4447 |
++ err = dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, flags); |
4448 |
++ rcu_read_unlock(); |
4449 |
++ |
4450 |
++ return err; |
4451 |
++} |
4452 |
+ |
4453 |
+- return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, |
4454 |
+- XDP_WAKEUP_TX); |
4455 |
++static int xsk_zc_xmit(struct xdp_sock *xs) |
4456 |
++{ |
4457 |
++ return xsk_wakeup(xs, XDP_WAKEUP_TX); |
4458 |
+ } |
4459 |
+ |
4460 |
+ static void xsk_destruct_skb(struct sk_buff *skb) |
4461 |
+@@ -424,19 +433,16 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock, |
4462 |
+ unsigned int mask = datagram_poll(file, sock, wait); |
4463 |
+ struct sock *sk = sock->sk; |
4464 |
+ struct xdp_sock *xs = xdp_sk(sk); |
4465 |
+- struct net_device *dev; |
4466 |
+ struct xdp_umem *umem; |
4467 |
+ |
4468 |
+ if (unlikely(!xsk_is_bound(xs))) |
4469 |
+ return mask; |
4470 |
+ |
4471 |
+- dev = xs->dev; |
4472 |
+ umem = xs->umem; |
4473 |
+ |
4474 |
+ if (umem->need_wakeup) { |
4475 |
+- if (dev->netdev_ops->ndo_xsk_wakeup) |
4476 |
+- dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, |
4477 |
+- umem->need_wakeup); |
4478 |
++ if (xs->zc) |
4479 |
++ xsk_wakeup(xs, umem->need_wakeup); |
4480 |
+ else |
4481 |
+ /* Poll needs to drive Tx also in copy mode */ |
4482 |
+ __xsk_sendmsg(sk); |
4483 |
+diff --git a/samples/bpf/syscall_tp_kern.c b/samples/bpf/syscall_tp_kern.c |
4484 |
+index 1d78819ffef1..630ce8c4d5a2 100644 |
4485 |
+--- a/samples/bpf/syscall_tp_kern.c |
4486 |
++++ b/samples/bpf/syscall_tp_kern.c |
4487 |
+@@ -47,13 +47,27 @@ static __always_inline void count(void *map) |
4488 |
+ SEC("tracepoint/syscalls/sys_enter_open") |
4489 |
+ int trace_enter_open(struct syscalls_enter_open_args *ctx) |
4490 |
+ { |
4491 |
+- count((void *)&enter_open_map); |
4492 |
++ count(&enter_open_map); |
4493 |
++ return 0; |
4494 |
++} |
4495 |
++ |
4496 |
++SEC("tracepoint/syscalls/sys_enter_openat") |
4497 |
++int trace_enter_open_at(struct syscalls_enter_open_args *ctx) |
4498 |
++{ |
4499 |
++ count(&enter_open_map); |
4500 |
+ return 0; |
4501 |
+ } |
4502 |
+ |
4503 |
+ SEC("tracepoint/syscalls/sys_exit_open") |
4504 |
+ int trace_enter_exit(struct syscalls_exit_open_args *ctx) |
4505 |
+ { |
4506 |
+- count((void *)&exit_open_map); |
4507 |
++ count(&exit_open_map); |
4508 |
++ return 0; |
4509 |
++} |
4510 |
++ |
4511 |
++SEC("tracepoint/syscalls/sys_exit_openat") |
4512 |
++int trace_enter_exit_at(struct syscalls_exit_open_args *ctx) |
4513 |
++{ |
4514 |
++ count(&exit_open_map); |
4515 |
+ return 0; |
4516 |
+ } |
4517 |
+diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c |
4518 |
+index 16a16eadd509..749a50f2f9f3 100644 |
4519 |
+--- a/samples/bpf/trace_event_user.c |
4520 |
++++ b/samples/bpf/trace_event_user.c |
4521 |
+@@ -37,9 +37,9 @@ static void print_ksym(__u64 addr) |
4522 |
+ } |
4523 |
+ |
4524 |
+ printf("%s;", sym->name); |
4525 |
+- if (!strcmp(sym->name, "sys_read")) |
4526 |
++ if (!strstr(sym->name, "sys_read")) |
4527 |
+ sys_read_seen = true; |
4528 |
+- else if (!strcmp(sym->name, "sys_write")) |
4529 |
++ else if (!strstr(sym->name, "sys_write")) |
4530 |
+ sys_write_seen = true; |
4531 |
+ } |
4532 |
+ |
4533 |
+diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c |
4534 |
+index 77ffff3a053c..9f1de58e9f0c 100644 |
4535 |
+--- a/scripts/kconfig/expr.c |
4536 |
++++ b/scripts/kconfig/expr.c |
4537 |
+@@ -254,6 +254,13 @@ static int expr_eq(struct expr *e1, struct expr *e2) |
4538 |
+ { |
4539 |
+ int res, old_count; |
4540 |
+ |
4541 |
++ /* |
4542 |
++ * A NULL expr is taken to be yes, but there's also a different way to |
4543 |
++ * represent yes. expr_is_yes() checks for either representation. |
4544 |
++ */ |
4545 |
++ if (!e1 || !e2) |
4546 |
++ return expr_is_yes(e1) && expr_is_yes(e2); |
4547 |
++ |
4548 |
+ if (e1->type != e2->type) |
4549 |
+ return 0; |
4550 |
+ switch (e1->type) { |
4551 |
+diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian |
4552 |
+index e0750b70453f..7c230016b08d 100755 |
4553 |
+--- a/scripts/package/mkdebian |
4554 |
++++ b/scripts/package/mkdebian |
4555 |
+@@ -174,7 +174,7 @@ Source: $sourcename |
4556 |
+ Section: kernel |
4557 |
+ Priority: optional |
4558 |
+ Maintainer: $maintainer |
4559 |
+-Build-Depends: bc, kmod, cpio, bison, flex | flex:native $extra_build_depends |
4560 |
++Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native $extra_build_depends |
4561 |
+ Homepage: http://www.kernel.org/ |
4562 |
+ |
4563 |
+ Package: $packagename |
4564 |
+diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c |
4565 |
+index f6bf4cfbea23..45da2b51543e 100644 |
4566 |
+--- a/sound/soc/codecs/max98090.c |
4567 |
++++ b/sound/soc/codecs/max98090.c |
4568 |
+@@ -2103,10 +2103,8 @@ static void max98090_pll_det_disable_work(struct work_struct *work) |
4569 |
+ M98090_IULK_MASK, 0); |
4570 |
+ } |
4571 |
+ |
4572 |
+-static void max98090_pll_work(struct work_struct *work) |
4573 |
++static void max98090_pll_work(struct max98090_priv *max98090) |
4574 |
+ { |
4575 |
+- struct max98090_priv *max98090 = |
4576 |
+- container_of(work, struct max98090_priv, pll_work); |
4577 |
+ struct snd_soc_component *component = max98090->component; |
4578 |
+ |
4579 |
+ if (!snd_soc_component_is_active(component)) |
4580 |
+@@ -2259,7 +2257,7 @@ static irqreturn_t max98090_interrupt(int irq, void *data) |
4581 |
+ |
4582 |
+ if (active & M98090_ULK_MASK) { |
4583 |
+ dev_dbg(component->dev, "M98090_ULK_MASK\n"); |
4584 |
+- schedule_work(&max98090->pll_work); |
4585 |
++ max98090_pll_work(max98090); |
4586 |
+ } |
4587 |
+ |
4588 |
+ if (active & M98090_JDET_MASK) { |
4589 |
+@@ -2422,7 +2420,6 @@ static int max98090_probe(struct snd_soc_component *component) |
4590 |
+ max98090_pll_det_enable_work); |
4591 |
+ INIT_WORK(&max98090->pll_det_disable_work, |
4592 |
+ max98090_pll_det_disable_work); |
4593 |
+- INIT_WORK(&max98090->pll_work, max98090_pll_work); |
4594 |
+ |
4595 |
+ /* Enable jack detection */ |
4596 |
+ snd_soc_component_write(component, M98090_REG_JACK_DETECT, |
4597 |
+@@ -2475,7 +2472,6 @@ static void max98090_remove(struct snd_soc_component *component) |
4598 |
+ cancel_delayed_work_sync(&max98090->jack_work); |
4599 |
+ cancel_delayed_work_sync(&max98090->pll_det_enable_work); |
4600 |
+ cancel_work_sync(&max98090->pll_det_disable_work); |
4601 |
+- cancel_work_sync(&max98090->pll_work); |
4602 |
+ max98090->component = NULL; |
4603 |
+ } |
4604 |
+ |
4605 |
+diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h |
4606 |
+index 57965cd678b4..a197114b0dad 100644 |
4607 |
+--- a/sound/soc/codecs/max98090.h |
4608 |
++++ b/sound/soc/codecs/max98090.h |
4609 |
+@@ -1530,7 +1530,6 @@ struct max98090_priv { |
4610 |
+ struct delayed_work jack_work; |
4611 |
+ struct delayed_work pll_det_enable_work; |
4612 |
+ struct work_struct pll_det_disable_work; |
4613 |
+- struct work_struct pll_work; |
4614 |
+ struct snd_soc_jack *jack; |
4615 |
+ unsigned int dai_fmt; |
4616 |
+ int tdm_slots; |
4617 |
+diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
4618 |
+index c50b75ce82e0..05e883a65d7a 100644 |
4619 |
+--- a/sound/soc/codecs/rt5682.c |
4620 |
++++ b/sound/soc/codecs/rt5682.c |
4621 |
+@@ -72,6 +72,7 @@ struct rt5682_priv { |
4622 |
+ static const struct reg_sequence patch_list[] = { |
4623 |
+ {RT5682_HP_IMP_SENS_CTRL_19, 0x1000}, |
4624 |
+ {RT5682_DAC_ADC_DIG_VOL1, 0xa020}, |
4625 |
++ {RT5682_I2C_CTRL, 0x000f}, |
4626 |
+ }; |
4627 |
+ |
4628 |
+ static const struct reg_default rt5682_reg[] = { |
4629 |
+@@ -2481,6 +2482,7 @@ static void rt5682_calibrate(struct rt5682_priv *rt5682) |
4630 |
+ mutex_lock(&rt5682->calibrate_mutex); |
4631 |
+ |
4632 |
+ rt5682_reset(rt5682->regmap); |
4633 |
++ regmap_write(rt5682->regmap, RT5682_I2C_CTRL, 0x000f); |
4634 |
+ regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xa2af); |
4635 |
+ usleep_range(15000, 20000); |
4636 |
+ regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xf2af); |
4637 |
+diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c |
4638 |
+index 3e5c69fbc33a..d9d59f45833f 100644 |
4639 |
+--- a/sound/soc/codecs/wm8962.c |
4640 |
++++ b/sound/soc/codecs/wm8962.c |
4641 |
+@@ -2788,7 +2788,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, |
4642 |
+ |
4643 |
+ if (target % Fref == 0) { |
4644 |
+ fll_div->theta = 0; |
4645 |
+- fll_div->lambda = 0; |
4646 |
++ fll_div->lambda = 1; |
4647 |
+ } else { |
4648 |
+ gcd_fll = gcd(target, fratio * Fref); |
4649 |
+ |
4650 |
+@@ -2858,7 +2858,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s |
4651 |
+ return -EINVAL; |
4652 |
+ } |
4653 |
+ |
4654 |
+- if (fll_div.theta || fll_div.lambda) |
4655 |
++ if (fll_div.theta) |
4656 |
+ fll1 |= WM8962_FLL_FRAC; |
4657 |
+ |
4658 |
+ /* Stop the FLL while we reconfigure */ |
4659 |
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
4660 |
+index dd2b5ad08659..243f683bc02a 100644 |
4661 |
+--- a/sound/soc/intel/boards/bytcr_rt5640.c |
4662 |
++++ b/sound/soc/intel/boards/bytcr_rt5640.c |
4663 |
+@@ -707,13 +707,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
4664 |
+ BYT_RT5640_MCLK_EN), |
4665 |
+ }, |
4666 |
+ { |
4667 |
++ /* Teclast X89 */ |
4668 |
+ .matches = { |
4669 |
+ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"), |
4670 |
+ DMI_MATCH(DMI_BOARD_NAME, "tPAD"), |
4671 |
+ }, |
4672 |
+ .driver_data = (void *)(BYT_RT5640_IN3_MAP | |
4673 |
+- BYT_RT5640_MCLK_EN | |
4674 |
+- BYT_RT5640_SSP0_AIF1), |
4675 |
++ BYT_RT5640_JD_SRC_JD1_IN4P | |
4676 |
++ BYT_RT5640_OVCD_TH_2000UA | |
4677 |
++ BYT_RT5640_OVCD_SF_1P0 | |
4678 |
++ BYT_RT5640_SSP0_AIF1 | |
4679 |
++ BYT_RT5640_MCLK_EN), |
4680 |
+ }, |
4681 |
+ { /* Toshiba Satellite Click Mini L9W-B */ |
4682 |
+ .matches = { |
4683 |
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c |
4684 |
+index 0fd032914a31..fd2d22ddc81b 100644 |
4685 |
+--- a/sound/soc/soc-topology.c |
4686 |
++++ b/sound/soc/soc-topology.c |
4687 |
+@@ -1918,11 +1918,13 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, |
4688 |
+ ret = soc_tplg_dai_link_load(tplg, link, NULL); |
4689 |
+ if (ret < 0) { |
4690 |
+ dev_err(tplg->comp->dev, "ASoC: FE link loading failed\n"); |
4691 |
+- kfree(link->name); |
4692 |
+- kfree(link->stream_name); |
4693 |
+- kfree(link->cpus->dai_name); |
4694 |
+- kfree(link); |
4695 |
+- return ret; |
4696 |
++ goto err; |
4697 |
++ } |
4698 |
++ |
4699 |
++ ret = snd_soc_add_dai_link(tplg->comp->card, link); |
4700 |
++ if (ret < 0) { |
4701 |
++ dev_err(tplg->comp->dev, "ASoC: adding FE link failed\n"); |
4702 |
++ goto err; |
4703 |
+ } |
4704 |
+ |
4705 |
+ link->dobj.index = tplg->index; |
4706 |
+@@ -1930,8 +1932,13 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, |
4707 |
+ link->dobj.type = SND_SOC_DOBJ_DAI_LINK; |
4708 |
+ list_add(&link->dobj.list, &tplg->comp->dobj_list); |
4709 |
+ |
4710 |
+- snd_soc_add_dai_link(tplg->comp->card, link); |
4711 |
+ return 0; |
4712 |
++err: |
4713 |
++ kfree(link->name); |
4714 |
++ kfree(link->stream_name); |
4715 |
++ kfree(link->cpus->dai_name); |
4716 |
++ kfree(link); |
4717 |
++ return ret; |
4718 |
+ } |
4719 |
+ |
4720 |
+ /* create a FE DAI and DAI link from the PCM object */ |
4721 |
+@@ -2024,6 +2031,7 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg, |
4722 |
+ int size; |
4723 |
+ int i; |
4724 |
+ bool abi_match; |
4725 |
++ int ret; |
4726 |
+ |
4727 |
+ count = le32_to_cpu(hdr->count); |
4728 |
+ |
4729 |
+@@ -2065,7 +2073,12 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg, |
4730 |
+ } |
4731 |
+ |
4732 |
+ /* create the FE DAIs and DAI links */ |
4733 |
+- soc_tplg_pcm_create(tplg, _pcm); |
4734 |
++ ret = soc_tplg_pcm_create(tplg, _pcm); |
4735 |
++ if (ret < 0) { |
4736 |
++ if (!abi_match) |
4737 |
++ kfree(_pcm); |
4738 |
++ return ret; |
4739 |
++ } |
4740 |
+ |
4741 |
+ /* offset by version-specific struct size and |
4742 |
+ * real priv data size |
4743 |
+diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c |
4744 |
+index a1e514f71739..41008c974ac6 100644 |
4745 |
+--- a/sound/soc/sof/intel/byt.c |
4746 |
++++ b/sound/soc/sof/intel/byt.c |
4747 |
+@@ -24,7 +24,8 @@ |
4748 |
+ #define DRAM_OFFSET 0x100000 |
4749 |
+ #define DRAM_SIZE (160 * 1024) |
4750 |
+ #define SHIM_OFFSET 0x140000 |
4751 |
+-#define SHIM_SIZE 0x100 |
4752 |
++#define SHIM_SIZE_BYT 0x100 |
4753 |
++#define SHIM_SIZE_CHT 0x118 |
4754 |
+ #define MBOX_OFFSET 0x144000 |
4755 |
+ #define MBOX_SIZE 0x1000 |
4756 |
+ #define EXCEPT_OFFSET 0x800 |
4757 |
+@@ -75,7 +76,7 @@ static const struct snd_sof_debugfs_map byt_debugfs[] = { |
4758 |
+ SOF_DEBUGFS_ACCESS_D0_ONLY}, |
4759 |
+ {"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE, |
4760 |
+ SOF_DEBUGFS_ACCESS_D0_ONLY}, |
4761 |
+- {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE, |
4762 |
++ {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_BYT, |
4763 |
+ SOF_DEBUGFS_ACCESS_ALWAYS}, |
4764 |
+ }; |
4765 |
+ |
4766 |
+@@ -102,7 +103,7 @@ static const struct snd_sof_debugfs_map cht_debugfs[] = { |
4767 |
+ SOF_DEBUGFS_ACCESS_D0_ONLY}, |
4768 |
+ {"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE, |
4769 |
+ SOF_DEBUGFS_ACCESS_D0_ONLY}, |
4770 |
+- {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE, |
4771 |
++ {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_CHT, |
4772 |
+ SOF_DEBUGFS_ACCESS_ALWAYS}, |
4773 |
+ }; |
4774 |
+ |
4775 |
+diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c |
4776 |
+index 9a9a381a908d..a041adf0669d 100644 |
4777 |
+--- a/sound/soc/sof/loader.c |
4778 |
++++ b/sound/soc/sof/loader.c |
4779 |
+@@ -66,6 +66,8 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset) |
4780 |
+ ret = get_ext_windows(sdev, ext_hdr); |
4781 |
+ break; |
4782 |
+ default: |
4783 |
++ dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n", |
4784 |
++ ext_hdr->type, ext_hdr->hdr.size); |
4785 |
+ break; |
4786 |
+ } |
4787 |
+ |
4788 |
+diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c |
4789 |
+index 43fdbbfe41bb..ea0bcd58bcb9 100644 |
4790 |
+--- a/tools/bpf/bpftool/prog.c |
4791 |
++++ b/tools/bpf/bpftool/prog.c |
4792 |
+@@ -493,7 +493,7 @@ static int do_dump(int argc, char **argv) |
4793 |
+ |
4794 |
+ info = &info_linear->info; |
4795 |
+ if (mode == DUMP_JITED) { |
4796 |
+- if (info->jited_prog_len == 0) { |
4797 |
++ if (info->jited_prog_len == 0 || !info->jited_prog_insns) { |
4798 |
+ p_info("no instructions returned"); |
4799 |
+ goto err_free; |
4800 |
+ } |
4801 |
+diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c |
4802 |
+index 494d7ae3614d..5b91ee65a080 100644 |
4803 |
+--- a/tools/bpf/bpftool/xlated_dumper.c |
4804 |
++++ b/tools/bpf/bpftool/xlated_dumper.c |
4805 |
+@@ -174,7 +174,7 @@ static const char *print_call(void *private_data, |
4806 |
+ struct kernel_sym *sym; |
4807 |
+ |
4808 |
+ if (insn->src_reg == BPF_PSEUDO_CALL && |
4809 |
+- (__u32) insn->imm < dd->nr_jited_ksyms) |
4810 |
++ (__u32) insn->imm < dd->nr_jited_ksyms && dd->jited_ksyms) |
4811 |
+ address = dd->jited_ksyms[insn->imm]; |
4812 |
+ |
4813 |
+ sym = kernel_syms_search(dd, address); |
4814 |
+diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile |
4815 |
+index 5315f3787f8d..ecf882308d8a 100644 |
4816 |
+--- a/tools/lib/traceevent/Makefile |
4817 |
++++ b/tools/lib/traceevent/Makefile |
4818 |
+@@ -97,6 +97,7 @@ EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) |
4819 |
+ |
4820 |
+ LIB_TARGET = libtraceevent.a libtraceevent.so.$(EVENT_PARSE_VERSION) |
4821 |
+ LIB_INSTALL = libtraceevent.a libtraceevent.so* |
4822 |
++LIB_INSTALL := $(addprefix $(OUTPUT),$(LIB_INSTALL)) |
4823 |
+ |
4824 |
+ INCLUDES = -I. -I $(srctree)/tools/include $(CONFIG_INCLUDES) |
4825 |
+ |
4826 |
+@@ -207,10 +208,11 @@ define do_install |
4827 |
+ $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' |
4828 |
+ endef |
4829 |
+ |
4830 |
+-PKG_CONFIG_FILE = libtraceevent.pc |
4831 |
++PKG_CONFIG_SOURCE_FILE = libtraceevent.pc |
4832 |
++PKG_CONFIG_FILE := $(addprefix $(OUTPUT),$(PKG_CONFIG_SOURCE_FILE)) |
4833 |
+ define do_install_pkgconfig_file |
4834 |
+ if [ -n "${pkgconfig_dir}" ]; then \ |
4835 |
+- cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; \ |
4836 |
++ cp -f ${PKG_CONFIG_SOURCE_FILE}.template ${PKG_CONFIG_FILE}; \ |
4837 |
+ sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; \ |
4838 |
+ sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \ |
4839 |
+ sed -i "s|LIB_DIR|${libdir}|g" ${PKG_CONFIG_FILE}; \ |
4840 |
+diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c |
4841 |
+index becc2d109423..d3412f2c0d18 100644 |
4842 |
+--- a/tools/perf/util/header.c |
4843 |
++++ b/tools/perf/util/header.c |
4844 |
+@@ -1089,21 +1089,18 @@ static void cpu_cache_level__fprintf(FILE *out, struct cpu_cache_level *c) |
4845 |
+ fprintf(out, "L%d %-15s %8s [%s]\n", c->level, c->type, c->size, c->map); |
4846 |
+ } |
4847 |
+ |
4848 |
+-static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp) |
4849 |
++#define MAX_CACHE_LVL 4 |
4850 |
++ |
4851 |
++static int build_caches(struct cpu_cache_level caches[], u32 *cntp) |
4852 |
+ { |
4853 |
+ u32 i, cnt = 0; |
4854 |
+- long ncpus; |
4855 |
+ u32 nr, cpu; |
4856 |
+ u16 level; |
4857 |
+ |
4858 |
+- ncpus = sysconf(_SC_NPROCESSORS_CONF); |
4859 |
+- if (ncpus < 0) |
4860 |
+- return -1; |
4861 |
+- |
4862 |
+- nr = (u32)(ncpus & UINT_MAX); |
4863 |
++ nr = cpu__max_cpu(); |
4864 |
+ |
4865 |
+ for (cpu = 0; cpu < nr; cpu++) { |
4866 |
+- for (level = 0; level < 10; level++) { |
4867 |
++ for (level = 0; level < MAX_CACHE_LVL; level++) { |
4868 |
+ struct cpu_cache_level c; |
4869 |
+ int err; |
4870 |
+ |
4871 |
+@@ -1123,18 +1120,12 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp) |
4872 |
+ caches[cnt++] = c; |
4873 |
+ else |
4874 |
+ cpu_cache_level__free(&c); |
4875 |
+- |
4876 |
+- if (WARN_ONCE(cnt == size, "way too many cpu caches..")) |
4877 |
+- goto out; |
4878 |
+ } |
4879 |
+ } |
4880 |
+- out: |
4881 |
+ *cntp = cnt; |
4882 |
+ return 0; |
4883 |
+ } |
4884 |
+ |
4885 |
+-#define MAX_CACHE_LVL 4 |
4886 |
+- |
4887 |
+ static int write_cache(struct feat_fd *ff, |
4888 |
+ struct evlist *evlist __maybe_unused) |
4889 |
+ { |
4890 |
+@@ -1143,7 +1134,7 @@ static int write_cache(struct feat_fd *ff, |
4891 |
+ u32 cnt = 0, i, version = 1; |
4892 |
+ int ret; |
4893 |
+ |
4894 |
+- ret = build_caches(caches, max_caches, &cnt); |
4895 |
++ ret = build_caches(caches, &cnt); |
4896 |
+ if (ret) |
4897 |
+ goto out; |
4898 |
+ |
4899 |
+diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c |
4900 |
+index a7c0424dbda3..940a6e7a6854 100644 |
4901 |
+--- a/tools/perf/util/metricgroup.c |
4902 |
++++ b/tools/perf/util/metricgroup.c |
4903 |
+@@ -103,8 +103,11 @@ static struct evsel *find_evsel_group(struct evlist *perf_evlist, |
4904 |
+ if (!strcmp(ev->name, ids[i])) { |
4905 |
+ if (!metric_events[i]) |
4906 |
+ metric_events[i] = ev; |
4907 |
++ i++; |
4908 |
++ if (i == idnum) |
4909 |
++ break; |
4910 |
+ } else { |
4911 |
+- if (++i == idnum) { |
4912 |
++ if (i + 1 == idnum) { |
4913 |
+ /* Discard the whole match and start again */ |
4914 |
+ i = 0; |
4915 |
+ memset(metric_events, 0, |
4916 |
+@@ -124,7 +127,7 @@ static struct evsel *find_evsel_group(struct evlist *perf_evlist, |
4917 |
+ } |
4918 |
+ } |
4919 |
+ |
4920 |
+- if (i != idnum - 1) { |
4921 |
++ if (i != idnum) { |
4922 |
+ /* Not whole match */ |
4923 |
+ return NULL; |
4924 |
+ } |
4925 |
+diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc |
4926 |
+index 36fb59f886ea..1a52f2883fe0 100644 |
4927 |
+--- a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc |
4928 |
++++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc |
4929 |
+@@ -3,6 +3,8 @@ |
4930 |
+ # description: ftrace - stacktrace filter command |
4931 |
+ # flags: instance |
4932 |
+ |
4933 |
++[ ! -f set_ftrace_filter ] && exit_unsupported |
4934 |
++ |
4935 |
+ echo _do_fork:stacktrace >> set_ftrace_filter |
4936 |
+ |
4937 |
+ grep -q "_do_fork:stacktrace:unlimited" set_ftrace_filter |
4938 |
+diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc |
4939 |
+index 86a1f07ef2ca..71fa3f49e35e 100644 |
4940 |
+--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc |
4941 |
++++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc |
4942 |
+@@ -15,6 +15,11 @@ if [ $NP -eq 1 ] ;then |
4943 |
+ exit_unresolved |
4944 |
+ fi |
4945 |
+ |
4946 |
++if ! grep -q "function" available_tracers ; then |
4947 |
++ echo "Function trace is not enabled" |
4948 |
++ exit_unsupported |
4949 |
++fi |
4950 |
++ |
4951 |
+ ORIG_CPUMASK=`cat tracing_cpumask` |
4952 |
+ |
4953 |
+ do_reset() { |
4954 |
+diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions |
4955 |
+index 86986c4bba54..5d4550591ff9 100644 |
4956 |
+--- a/tools/testing/selftests/ftrace/test.d/functions |
4957 |
++++ b/tools/testing/selftests/ftrace/test.d/functions |
4958 |
+@@ -46,6 +46,9 @@ reset_events_filter() { # reset all current setting filters |
4959 |
+ } |
4960 |
+ |
4961 |
+ reset_ftrace_filter() { # reset all triggers in set_ftrace_filter |
4962 |
++ if [ ! -f set_ftrace_filter ]; then |
4963 |
++ return 0 |
4964 |
++ fi |
4965 |
+ echo > set_ftrace_filter |
4966 |
+ grep -v '^#' set_ftrace_filter | while read t; do |
4967 |
+ tr=`echo $t | cut -d: -f2` |
4968 |
+@@ -93,7 +96,7 @@ initialize_ftrace() { # Reset ftrace to initial-state |
4969 |
+ disable_events |
4970 |
+ [ -f set_event_pid ] && echo > set_event_pid |
4971 |
+ [ -f set_ftrace_pid ] && echo > set_ftrace_pid |
4972 |
+- [ -f set_ftrace_filter ] && echo | tee set_ftrace_* |
4973 |
++ [ -f set_ftrace_notrace ] && echo > set_ftrace_notrace |
4974 |
+ [ -f set_graph_function ] && echo | tee set_graph_* |
4975 |
+ [ -f stack_trace_filter ] && echo > stack_trace_filter |
4976 |
+ [ -f kprobe_events ] && echo > kprobe_events |
4977 |
+diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc |
4978 |
+index 5862eee91e1d..6e3dbe5f96b7 100644 |
4979 |
+--- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc |
4980 |
++++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc |
4981 |
+@@ -20,9 +20,9 @@ while read i; do |
4982 |
+ test $N -eq 256 && break |
4983 |
+ done |
4984 |
+ |
4985 |
+-L=`wc -l kprobe_events` |
4986 |
+-if [ $L -ne $N ]; then |
4987 |
+- echo "The number of kprobes events ($L) is not $N" |
4988 |
++L=`cat kprobe_events | wc -l` |
4989 |
++if [ $L -ne 256 ]; then |
4990 |
++ echo "The number of kprobes events ($L) is not 256" |
4991 |
+ exit_fail |
4992 |
+ fi |
4993 |
+ |
4994 |
+diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc |
4995 |
+index 1221240f8cf6..3f2aee115f6e 100644 |
4996 |
+--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc |
4997 |
++++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-action-hist-xfail.tc |
4998 |
+@@ -21,10 +21,10 @@ grep -q "snapshot()" README || exit_unsupported # version issue |
4999 |
+ |
5000 |
+ echo "Test expected snapshot action failure" |
5001 |
+ |
5002 |
+-echo 'hist:keys=comm:onmatch(sched.sched_wakeup).snapshot()' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger && exit_fail |
5003 |
++echo 'hist:keys=comm:onmatch(sched.sched_wakeup).snapshot()' >> events/sched/sched_waking/trigger && exit_fail |
5004 |
+ |
5005 |
+ echo "Test expected save action failure" |
5006 |
+ |
5007 |
+-echo 'hist:keys=comm:onmatch(sched.sched_wakeup).save(comm,prio)' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger && exit_fail |
5008 |
++echo 'hist:keys=comm:onmatch(sched.sched_wakeup).save(comm,prio)' >> events/sched/sched_waking/trigger && exit_fail |
5009 |
+ |
5010 |
+ exit_xfail |
5011 |
+diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc |
5012 |
+index 064a284e4e75..c80007aa9f86 100644 |
5013 |
+--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc |
5014 |
++++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc |
5015 |
+@@ -16,7 +16,7 @@ grep -q "onchange(var)" README || exit_unsupported # version issue |
5016 |
+ |
5017 |
+ echo "Test onchange action" |
5018 |
+ |
5019 |
+-echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger |
5020 |
++echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> events/sched/sched_waking/trigger |
5021 |
+ |
5022 |
+ ping $LOCALHOST -c 3 |
5023 |
+ nice -n 1 ping $LOCALHOST -c 3 |
5024 |
+diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc |
5025 |
+index 18fff69fc433..f546c1b66a9b 100644 |
5026 |
+--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc |
5027 |
++++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc |
5028 |
+@@ -23,9 +23,9 @@ grep -q "snapshot()" README || exit_unsupported # version issue |
5029 |
+ |
5030 |
+ echo "Test snapshot action" |
5031 |
+ |
5032 |
+-echo 1 > /sys/kernel/debug/tracing/events/sched/enable |
5033 |
++echo 1 > events/sched/enable |
5034 |
+ |
5035 |
+-echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger |
5036 |
++echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> events/sched/sched_waking/trigger |
5037 |
+ |
5038 |
+ ping $LOCALHOST -c 3 |
5039 |
+ nice -n 1 ping $LOCALHOST -c 3 |
5040 |
+diff --git a/tools/testing/selftests/kselftest/prefix.pl b/tools/testing/selftests/kselftest/prefix.pl |
5041 |
+index ec7e48118183..31f7c2a0a8bd 100755 |
5042 |
+--- a/tools/testing/selftests/kselftest/prefix.pl |
5043 |
++++ b/tools/testing/selftests/kselftest/prefix.pl |
5044 |
+@@ -3,6 +3,7 @@ |
5045 |
+ # Prefix all lines with "# ", unbuffered. Command being piped in may need |
5046 |
+ # to have unbuffering forced with "stdbuf -i0 -o0 -e0 $cmd". |
5047 |
+ use strict; |
5048 |
++use IO::Handle; |
5049 |
+ |
5050 |
+ binmode STDIN; |
5051 |
+ binmode STDOUT; |
5052 |
+diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh |
5053 |
+index 84de7bc74f2c..a8d20cbb711c 100644 |
5054 |
+--- a/tools/testing/selftests/kselftest/runner.sh |
5055 |
++++ b/tools/testing/selftests/kselftest/runner.sh |
5056 |
+@@ -79,6 +79,7 @@ run_one() |
5057 |
+ if [ $rc -eq $skip_rc ]; then \ |
5058 |
+ echo "not ok $test_num $TEST_HDR_MSG # SKIP" |
5059 |
+ elif [ $rc -eq $timeout_rc ]; then \ |
5060 |
++ echo "#" |
5061 |
+ echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT" |
5062 |
+ else |
5063 |
+ echo "not ok $test_num $TEST_HDR_MSG # exit=$rc" |
5064 |
+diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh |
5065 |
+index d697815d2785..71a62e7e35b1 100755 |
5066 |
+--- a/tools/testing/selftests/net/pmtu.sh |
5067 |
++++ b/tools/testing/selftests/net/pmtu.sh |
5068 |
+@@ -11,9 +11,9 @@ |
5069 |
+ # R1 and R2 (also implemented with namespaces), with different MTUs: |
5070 |
+ # |
5071 |
+ # segment a_r1 segment b_r1 a_r1: 2000 |
5072 |
+-# .--------------R1--------------. a_r2: 1500 |
5073 |
+-# A B a_r3: 2000 |
5074 |
+-# '--------------R2--------------' a_r4: 1400 |
5075 |
++# .--------------R1--------------. b_r1: 1400 |
5076 |
++# A B a_r2: 2000 |
5077 |
++# '--------------R2--------------' b_r2: 1500 |
5078 |
+ # segment a_r2 segment b_r2 |
5079 |
+ # |
5080 |
+ # Check that PMTU exceptions with the correct PMTU are created. Then |
5081 |
+diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh |
5082 |
+index 1be55e705780..d7e07f4c3d7f 100755 |
5083 |
+--- a/tools/testing/selftests/netfilter/nft_nat.sh |
5084 |
++++ b/tools/testing/selftests/netfilter/nft_nat.sh |
5085 |
+@@ -8,9 +8,14 @@ ksft_skip=4 |
5086 |
+ ret=0 |
5087 |
+ test_inet_nat=true |
5088 |
+ |
5089 |
++sfx=$(mktemp -u "XXXXXXXX") |
5090 |
++ns0="ns0-$sfx" |
5091 |
++ns1="ns1-$sfx" |
5092 |
++ns2="ns2-$sfx" |
5093 |
++ |
5094 |
+ cleanup() |
5095 |
+ { |
5096 |
+- for i in 0 1 2; do ip netns del ns$i;done |
5097 |
++ for i in 0 1 2; do ip netns del ns$i-"$sfx";done |
5098 |
+ } |
5099 |
+ |
5100 |
+ nft --version > /dev/null 2>&1 |
5101 |
+@@ -25,40 +30,49 @@ if [ $? -ne 0 ];then |
5102 |
+ exit $ksft_skip |
5103 |
+ fi |
5104 |
+ |
5105 |
+-ip netns add ns0 |
5106 |
++ip netns add "$ns0" |
5107 |
+ if [ $? -ne 0 ];then |
5108 |
+- echo "SKIP: Could not create net namespace" |
5109 |
++ echo "SKIP: Could not create net namespace $ns0" |
5110 |
+ exit $ksft_skip |
5111 |
+ fi |
5112 |
+ |
5113 |
+ trap cleanup EXIT |
5114 |
+ |
5115 |
+-ip netns add ns1 |
5116 |
+-ip netns add ns2 |
5117 |
++ip netns add "$ns1" |
5118 |
++if [ $? -ne 0 ];then |
5119 |
++ echo "SKIP: Could not create net namespace $ns1" |
5120 |
++ exit $ksft_skip |
5121 |
++fi |
5122 |
++ |
5123 |
++ip netns add "$ns2" |
5124 |
++if [ $? -ne 0 ];then |
5125 |
++ echo "SKIP: Could not create net namespace $ns2" |
5126 |
++ exit $ksft_skip |
5127 |
++fi |
5128 |
+ |
5129 |
+-ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1 |
5130 |
++ip link add veth0 netns "$ns0" type veth peer name eth0 netns "$ns1" > /dev/null 2>&1 |
5131 |
+ if [ $? -ne 0 ];then |
5132 |
+ echo "SKIP: No virtual ethernet pair device support in kernel" |
5133 |
+ exit $ksft_skip |
5134 |
+ fi |
5135 |
+-ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 |
5136 |
++ip link add veth1 netns "$ns0" type veth peer name eth0 netns "$ns2" |
5137 |
+ |
5138 |
+-ip -net ns0 link set lo up |
5139 |
+-ip -net ns0 link set veth0 up |
5140 |
+-ip -net ns0 addr add 10.0.1.1/24 dev veth0 |
5141 |
+-ip -net ns0 addr add dead:1::1/64 dev veth0 |
5142 |
++ip -net "$ns0" link set lo up |
5143 |
++ip -net "$ns0" link set veth0 up |
5144 |
++ip -net "$ns0" addr add 10.0.1.1/24 dev veth0 |
5145 |
++ip -net "$ns0" addr add dead:1::1/64 dev veth0 |
5146 |
+ |
5147 |
+-ip -net ns0 link set veth1 up |
5148 |
+-ip -net ns0 addr add 10.0.2.1/24 dev veth1 |
5149 |
+-ip -net ns0 addr add dead:2::1/64 dev veth1 |
5150 |
++ip -net "$ns0" link set veth1 up |
5151 |
++ip -net "$ns0" addr add 10.0.2.1/24 dev veth1 |
5152 |
++ip -net "$ns0" addr add dead:2::1/64 dev veth1 |
5153 |
+ |
5154 |
+ for i in 1 2; do |
5155 |
+- ip -net ns$i link set lo up |
5156 |
+- ip -net ns$i link set eth0 up |
5157 |
+- ip -net ns$i addr add 10.0.$i.99/24 dev eth0 |
5158 |
+- ip -net ns$i route add default via 10.0.$i.1 |
5159 |
+- ip -net ns$i addr add dead:$i::99/64 dev eth0 |
5160 |
+- ip -net ns$i route add default via dead:$i::1 |
5161 |
++ ip -net ns$i-$sfx link set lo up |
5162 |
++ ip -net ns$i-$sfx link set eth0 up |
5163 |
++ ip -net ns$i-$sfx addr add 10.0.$i.99/24 dev eth0 |
5164 |
++ ip -net ns$i-$sfx route add default via 10.0.$i.1 |
5165 |
++ ip -net ns$i-$sfx addr add dead:$i::99/64 dev eth0 |
5166 |
++ ip -net ns$i-$sfx route add default via dead:$i::1 |
5167 |
+ done |
5168 |
+ |
5169 |
+ bad_counter() |
5170 |
+@@ -66,8 +80,9 @@ bad_counter() |
5171 |
+ local ns=$1 |
5172 |
+ local counter=$2 |
5173 |
+ local expect=$3 |
5174 |
++ local tag=$4 |
5175 |
+ |
5176 |
+- echo "ERROR: $counter counter in $ns has unexpected value (expected $expect)" 1>&2 |
5177 |
++ echo "ERROR: $counter counter in $ns has unexpected value (expected $expect) at $tag" 1>&2 |
5178 |
+ ip netns exec $ns nft list counter inet filter $counter 1>&2 |
5179 |
+ } |
5180 |
+ |
5181 |
+@@ -78,24 +93,24 @@ check_counters() |
5182 |
+ |
5183 |
+ cnt=$(ip netns exec $ns nft list counter inet filter ns0in | grep -q "packets 1 bytes 84") |
5184 |
+ if [ $? -ne 0 ]; then |
5185 |
+- bad_counter $ns ns0in "packets 1 bytes 84" |
5186 |
++ bad_counter $ns ns0in "packets 1 bytes 84" "check_counters 1" |
5187 |
+ lret=1 |
5188 |
+ fi |
5189 |
+ cnt=$(ip netns exec $ns nft list counter inet filter ns0out | grep -q "packets 1 bytes 84") |
5190 |
+ if [ $? -ne 0 ]; then |
5191 |
+- bad_counter $ns ns0out "packets 1 bytes 84" |
5192 |
++ bad_counter $ns ns0out "packets 1 bytes 84" "check_counters 2" |
5193 |
+ lret=1 |
5194 |
+ fi |
5195 |
+ |
5196 |
+ expect="packets 1 bytes 104" |
5197 |
+ cnt=$(ip netns exec $ns nft list counter inet filter ns0in6 | grep -q "$expect") |
5198 |
+ if [ $? -ne 0 ]; then |
5199 |
+- bad_counter $ns ns0in6 "$expect" |
5200 |
++ bad_counter $ns ns0in6 "$expect" "check_counters 3" |
5201 |
+ lret=1 |
5202 |
+ fi |
5203 |
+ cnt=$(ip netns exec $ns nft list counter inet filter ns0out6 | grep -q "$expect") |
5204 |
+ if [ $? -ne 0 ]; then |
5205 |
+- bad_counter $ns ns0out6 "$expect" |
5206 |
++ bad_counter $ns ns0out6 "$expect" "check_counters 4" |
5207 |
+ lret=1 |
5208 |
+ fi |
5209 |
+ |
5210 |
+@@ -107,41 +122,41 @@ check_ns0_counters() |
5211 |
+ local ns=$1 |
5212 |
+ local lret=0 |
5213 |
+ |
5214 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") |
5215 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in | grep -q "packets 0 bytes 0") |
5216 |
+ if [ $? -ne 0 ]; then |
5217 |
+- bad_counter ns0 ns0in "packets 0 bytes 0" |
5218 |
++ bad_counter "$ns0" ns0in "packets 0 bytes 0" "check_ns0_counters 1" |
5219 |
+ lret=1 |
5220 |
+ fi |
5221 |
+ |
5222 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") |
5223 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0in6 | grep -q "packets 0 bytes 0") |
5224 |
+ if [ $? -ne 0 ]; then |
5225 |
+- bad_counter ns0 ns0in6 "packets 0 bytes 0" |
5226 |
++ bad_counter "$ns0" ns0in6 "packets 0 bytes 0" |
5227 |
+ lret=1 |
5228 |
+ fi |
5229 |
+ |
5230 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") |
5231 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out | grep -q "packets 0 bytes 0") |
5232 |
+ if [ $? -ne 0 ]; then |
5233 |
+- bad_counter ns0 ns0out "packets 0 bytes 0" |
5234 |
++ bad_counter "$ns0" ns0out "packets 0 bytes 0" "check_ns0_counters 2" |
5235 |
+ lret=1 |
5236 |
+ fi |
5237 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") |
5238 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns0out6 | grep -q "packets 0 bytes 0") |
5239 |
+ if [ $? -ne 0 ]; then |
5240 |
+- bad_counter ns0 ns0out6 "packets 0 bytes 0" |
5241 |
++ bad_counter "$ns0" ns0out6 "packets 0 bytes 0" "check_ns0_counters3 " |
5242 |
+ lret=1 |
5243 |
+ fi |
5244 |
+ |
5245 |
+ for dir in "in" "out" ; do |
5246 |
+ expect="packets 1 bytes 84" |
5247 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir} | grep -q "$expect") |
5248 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir} | grep -q "$expect") |
5249 |
+ if [ $? -ne 0 ]; then |
5250 |
+- bad_counter ns0 $ns$dir "$expect" |
5251 |
++ bad_counter "$ns0" $ns$dir "$expect" "check_ns0_counters 4" |
5252 |
+ lret=1 |
5253 |
+ fi |
5254 |
+ |
5255 |
+ expect="packets 1 bytes 104" |
5256 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") |
5257 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ${ns}${dir}6 | grep -q "$expect") |
5258 |
+ if [ $? -ne 0 ]; then |
5259 |
+- bad_counter ns0 $ns$dir6 "$expect" |
5260 |
++ bad_counter "$ns0" $ns$dir6 "$expect" "check_ns0_counters 5" |
5261 |
+ lret=1 |
5262 |
+ fi |
5263 |
+ done |
5264 |
+@@ -152,7 +167,7 @@ check_ns0_counters() |
5265 |
+ reset_counters() |
5266 |
+ { |
5267 |
+ for i in 0 1 2;do |
5268 |
+- ip netns exec ns$i nft reset counters inet > /dev/null |
5269 |
++ ip netns exec ns$i-$sfx nft reset counters inet > /dev/null |
5270 |
+ done |
5271 |
+ } |
5272 |
+ |
5273 |
+@@ -166,7 +181,7 @@ test_local_dnat6() |
5274 |
+ IPF="ip6" |
5275 |
+ fi |
5276 |
+ |
5277 |
+-ip netns exec ns0 nft -f - <<EOF |
5278 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
5279 |
+ table $family nat { |
5280 |
+ chain output { |
5281 |
+ type nat hook output priority 0; policy accept; |
5282 |
+@@ -180,7 +195,7 @@ EOF |
5283 |
+ fi |
5284 |
+ |
5285 |
+ # ping netns1, expect rewrite to netns2 |
5286 |
+- ip netns exec ns0 ping -q -c 1 dead:1::99 > /dev/null |
5287 |
++ ip netns exec "$ns0" ping -q -c 1 dead:1::99 > /dev/null |
5288 |
+ if [ $? -ne 0 ]; then |
5289 |
+ lret=1 |
5290 |
+ echo "ERROR: ping6 failed" |
5291 |
+@@ -189,18 +204,18 @@ EOF |
5292 |
+ |
5293 |
+ expect="packets 0 bytes 0" |
5294 |
+ for dir in "in6" "out6" ; do |
5295 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5296 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5297 |
+ if [ $? -ne 0 ]; then |
5298 |
+- bad_counter ns0 ns1$dir "$expect" |
5299 |
++ bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat6 1" |
5300 |
+ lret=1 |
5301 |
+ fi |
5302 |
+ done |
5303 |
+ |
5304 |
+ expect="packets 1 bytes 104" |
5305 |
+ for dir in "in6" "out6" ; do |
5306 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5307 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5308 |
+ if [ $? -ne 0 ]; then |
5309 |
+- bad_counter ns0 ns2$dir "$expect" |
5310 |
++ bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat6 2" |
5311 |
+ lret=1 |
5312 |
+ fi |
5313 |
+ done |
5314 |
+@@ -208,9 +223,9 @@ EOF |
5315 |
+ # expect 0 count in ns1 |
5316 |
+ expect="packets 0 bytes 0" |
5317 |
+ for dir in "in6" "out6" ; do |
5318 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5319 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5320 |
+ if [ $? -ne 0 ]; then |
5321 |
+- bad_counter ns1 ns0$dir "$expect" |
5322 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat6 3" |
5323 |
+ lret=1 |
5324 |
+ fi |
5325 |
+ done |
5326 |
+@@ -218,15 +233,15 @@ EOF |
5327 |
+ # expect 1 packet in ns2 |
5328 |
+ expect="packets 1 bytes 104" |
5329 |
+ for dir in "in6" "out6" ; do |
5330 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5331 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5332 |
+ if [ $? -ne 0 ]; then |
5333 |
+- bad_counter ns2 ns0$dir "$expect" |
5334 |
++ bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat6 4" |
5335 |
+ lret=1 |
5336 |
+ fi |
5337 |
+ done |
5338 |
+ |
5339 |
+- test $lret -eq 0 && echo "PASS: ipv6 ping to ns1 was $family NATted to ns2" |
5340 |
+- ip netns exec ns0 nft flush chain ip6 nat output |
5341 |
++ test $lret -eq 0 && echo "PASS: ipv6 ping to $ns1 was $family NATted to $ns2" |
5342 |
++ ip netns exec "$ns0" nft flush chain ip6 nat output |
5343 |
+ |
5344 |
+ return $lret |
5345 |
+ } |
5346 |
+@@ -241,7 +256,7 @@ test_local_dnat() |
5347 |
+ IPF="ip" |
5348 |
+ fi |
5349 |
+ |
5350 |
+-ip netns exec ns0 nft -f - <<EOF 2>/dev/null |
5351 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF 2>/dev/null |
5352 |
+ table $family nat { |
5353 |
+ chain output { |
5354 |
+ type nat hook output priority 0; policy accept; |
5355 |
+@@ -260,7 +275,7 @@ EOF |
5356 |
+ fi |
5357 |
+ |
5358 |
+ # ping netns1, expect rewrite to netns2 |
5359 |
+- ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
5360 |
++ ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null |
5361 |
+ if [ $? -ne 0 ]; then |
5362 |
+ lret=1 |
5363 |
+ echo "ERROR: ping failed" |
5364 |
+@@ -269,18 +284,18 @@ EOF |
5365 |
+ |
5366 |
+ expect="packets 0 bytes 0" |
5367 |
+ for dir in "in" "out" ; do |
5368 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5369 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5370 |
+ if [ $? -ne 0 ]; then |
5371 |
+- bad_counter ns0 ns1$dir "$expect" |
5372 |
++ bad_counter "$ns0" ns1$dir "$expect" "test_local_dnat 1" |
5373 |
+ lret=1 |
5374 |
+ fi |
5375 |
+ done |
5376 |
+ |
5377 |
+ expect="packets 1 bytes 84" |
5378 |
+ for dir in "in" "out" ; do |
5379 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5380 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5381 |
+ if [ $? -ne 0 ]; then |
5382 |
+- bad_counter ns0 ns2$dir "$expect" |
5383 |
++ bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 2" |
5384 |
+ lret=1 |
5385 |
+ fi |
5386 |
+ done |
5387 |
+@@ -288,9 +303,9 @@ EOF |
5388 |
+ # expect 0 count in ns1 |
5389 |
+ expect="packets 0 bytes 0" |
5390 |
+ for dir in "in" "out" ; do |
5391 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5392 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5393 |
+ if [ $? -ne 0 ]; then |
5394 |
+- bad_counter ns1 ns0$dir "$expect" |
5395 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_local_dnat 3" |
5396 |
+ lret=1 |
5397 |
+ fi |
5398 |
+ done |
5399 |
+@@ -298,19 +313,19 @@ EOF |
5400 |
+ # expect 1 packet in ns2 |
5401 |
+ expect="packets 1 bytes 84" |
5402 |
+ for dir in "in" "out" ; do |
5403 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5404 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5405 |
+ if [ $? -ne 0 ]; then |
5406 |
+- bad_counter ns2 ns0$dir "$expect" |
5407 |
++ bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 4" |
5408 |
+ lret=1 |
5409 |
+ fi |
5410 |
+ done |
5411 |
+ |
5412 |
+- test $lret -eq 0 && echo "PASS: ping to ns1 was $family NATted to ns2" |
5413 |
++ test $lret -eq 0 && echo "PASS: ping to $ns1 was $family NATted to $ns2" |
5414 |
+ |
5415 |
+- ip netns exec ns0 nft flush chain $family nat output |
5416 |
++ ip netns exec "$ns0" nft flush chain $family nat output |
5417 |
+ |
5418 |
+ reset_counters |
5419 |
+- ip netns exec ns0 ping -q -c 1 10.0.1.99 > /dev/null |
5420 |
++ ip netns exec "$ns0" ping -q -c 1 10.0.1.99 > /dev/null |
5421 |
+ if [ $? -ne 0 ]; then |
5422 |
+ lret=1 |
5423 |
+ echo "ERROR: ping failed" |
5424 |
+@@ -319,17 +334,17 @@ EOF |
5425 |
+ |
5426 |
+ expect="packets 1 bytes 84" |
5427 |
+ for dir in "in" "out" ; do |
5428 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5429 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5430 |
+ if [ $? -ne 0 ]; then |
5431 |
+- bad_counter ns1 ns1$dir "$expect" |
5432 |
++ bad_counter "$ns1" ns1$dir "$expect" "test_local_dnat 5" |
5433 |
+ lret=1 |
5434 |
+ fi |
5435 |
+ done |
5436 |
+ expect="packets 0 bytes 0" |
5437 |
+ for dir in "in" "out" ; do |
5438 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5439 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5440 |
+ if [ $? -ne 0 ]; then |
5441 |
+- bad_counter ns0 ns2$dir "$expect" |
5442 |
++ bad_counter "$ns0" ns2$dir "$expect" "test_local_dnat 6" |
5443 |
+ lret=1 |
5444 |
+ fi |
5445 |
+ done |
5446 |
+@@ -337,9 +352,9 @@ EOF |
5447 |
+ # expect 1 count in ns1 |
5448 |
+ expect="packets 1 bytes 84" |
5449 |
+ for dir in "in" "out" ; do |
5450 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5451 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5452 |
+ if [ $? -ne 0 ]; then |
5453 |
+- bad_counter ns0 ns0$dir "$expect" |
5454 |
++ bad_counter "$ns0" ns0$dir "$expect" "test_local_dnat 7" |
5455 |
+ lret=1 |
5456 |
+ fi |
5457 |
+ done |
5458 |
+@@ -347,14 +362,14 @@ EOF |
5459 |
+ # expect 0 packet in ns2 |
5460 |
+ expect="packets 0 bytes 0" |
5461 |
+ for dir in "in" "out" ; do |
5462 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5463 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5464 |
+ if [ $? -ne 0 ]; then |
5465 |
+- bad_counter ns2 ns2$dir "$expect" |
5466 |
++ bad_counter "$ns2" ns0$dir "$expect" "test_local_dnat 8" |
5467 |
+ lret=1 |
5468 |
+ fi |
5469 |
+ done |
5470 |
+ |
5471 |
+- test $lret -eq 0 && echo "PASS: ping to ns1 OK after $family nat output chain flush" |
5472 |
++ test $lret -eq 0 && echo "PASS: ping to $ns1 OK after $family nat output chain flush" |
5473 |
+ |
5474 |
+ return $lret |
5475 |
+ } |
5476 |
+@@ -366,26 +381,26 @@ test_masquerade6() |
5477 |
+ local natflags=$2 |
5478 |
+ local lret=0 |
5479 |
+ |
5480 |
+- ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
5481 |
++ ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
5482 |
+ |
5483 |
+- ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5484 |
++ ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5485 |
+ if [ $? -ne 0 ] ; then |
5486 |
+- echo "ERROR: cannot ping ns1 from ns2 via ipv6" |
5487 |
++ echo "ERROR: cannot ping $ns1 from $ns2 via ipv6" |
5488 |
+ return 1 |
5489 |
+ lret=1 |
5490 |
+ fi |
5491 |
+ |
5492 |
+ expect="packets 1 bytes 104" |
5493 |
+ for dir in "in6" "out6" ; do |
5494 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5495 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5496 |
+ if [ $? -ne 0 ]; then |
5497 |
+- bad_counter ns1 ns2$dir "$expect" |
5498 |
++ bad_counter "$ns1" ns2$dir "$expect" "test_masquerade6 1" |
5499 |
+ lret=1 |
5500 |
+ fi |
5501 |
+ |
5502 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5503 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5504 |
+ if [ $? -ne 0 ]; then |
5505 |
+- bad_counter ns2 ns1$dir "$expect" |
5506 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 2" |
5507 |
+ lret=1 |
5508 |
+ fi |
5509 |
+ done |
5510 |
+@@ -393,7 +408,7 @@ test_masquerade6() |
5511 |
+ reset_counters |
5512 |
+ |
5513 |
+ # add masquerading rule |
5514 |
+-ip netns exec ns0 nft -f - <<EOF |
5515 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
5516 |
+ table $family nat { |
5517 |
+ chain postrouting { |
5518 |
+ type nat hook postrouting priority 0; policy accept; |
5519 |
+@@ -406,24 +421,24 @@ EOF |
5520 |
+ return $ksft_skip |
5521 |
+ fi |
5522 |
+ |
5523 |
+- ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5524 |
++ ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5525 |
+ if [ $? -ne 0 ] ; then |
5526 |
+- echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags" |
5527 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags" |
5528 |
+ lret=1 |
5529 |
+ fi |
5530 |
+ |
5531 |
+ # ns1 should have seen packets from ns0, due to masquerade |
5532 |
+ expect="packets 1 bytes 104" |
5533 |
+ for dir in "in6" "out6" ; do |
5534 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5535 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5536 |
+ if [ $? -ne 0 ]; then |
5537 |
+- bad_counter ns1 ns0$dir "$expect" |
5538 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 3" |
5539 |
+ lret=1 |
5540 |
+ fi |
5541 |
+ |
5542 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5543 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5544 |
+ if [ $? -ne 0 ]; then |
5545 |
+- bad_counter ns2 ns1$dir "$expect" |
5546 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_masquerade6 4" |
5547 |
+ lret=1 |
5548 |
+ fi |
5549 |
+ done |
5550 |
+@@ -431,32 +446,32 @@ EOF |
5551 |
+ # ns1 should not have seen packets from ns2, due to masquerade |
5552 |
+ expect="packets 0 bytes 0" |
5553 |
+ for dir in "in6" "out6" ; do |
5554 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5555 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5556 |
+ if [ $? -ne 0 ]; then |
5557 |
+- bad_counter ns1 ns0$dir "$expect" |
5558 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_masquerade6 5" |
5559 |
+ lret=1 |
5560 |
+ fi |
5561 |
+ |
5562 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5563 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5564 |
+ if [ $? -ne 0 ]; then |
5565 |
+- bad_counter ns2 ns1$dir "$expect" |
5566 |
++ bad_counter "$ns0" ns1$dir "$expect" "test_masquerade6 6" |
5567 |
+ lret=1 |
5568 |
+ fi |
5569 |
+ done |
5570 |
+ |
5571 |
+- ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5572 |
++ ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5573 |
+ if [ $? -ne 0 ] ; then |
5574 |
+- echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)" |
5575 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with active ipv6 masquerade $natflags (attempt 2)" |
5576 |
+ lret=1 |
5577 |
+ fi |
5578 |
+ |
5579 |
+- ip netns exec ns0 nft flush chain $family nat postrouting |
5580 |
++ ip netns exec "$ns0" nft flush chain $family nat postrouting |
5581 |
+ if [ $? -ne 0 ]; then |
5582 |
+ echo "ERROR: Could not flush $family nat postrouting" 1>&2 |
5583 |
+ lret=1 |
5584 |
+ fi |
5585 |
+ |
5586 |
+- test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for ns2" |
5587 |
++ test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for $ns2" |
5588 |
+ |
5589 |
+ return $lret |
5590 |
+ } |
5591 |
+@@ -467,26 +482,26 @@ test_masquerade() |
5592 |
+ local natflags=$2 |
5593 |
+ local lret=0 |
5594 |
+ |
5595 |
+- ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
5596 |
+- ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
5597 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
5598 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
5599 |
+ |
5600 |
+- ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5601 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5602 |
+ if [ $? -ne 0 ] ; then |
5603 |
+- echo "ERROR: cannot ping ns1 from ns2 $natflags" |
5604 |
++ echo "ERROR: cannot ping $ns1 from "$ns2" $natflags" |
5605 |
+ lret=1 |
5606 |
+ fi |
5607 |
+ |
5608 |
+ expect="packets 1 bytes 84" |
5609 |
+ for dir in "in" "out" ; do |
5610 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5611 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5612 |
+ if [ $? -ne 0 ]; then |
5613 |
+- bad_counter ns1 ns2$dir "$expect" |
5614 |
++ bad_counter "$ns1" ns2$dir "$expect" "test_masquerade 1" |
5615 |
+ lret=1 |
5616 |
+ fi |
5617 |
+ |
5618 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5619 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5620 |
+ if [ $? -ne 0 ]; then |
5621 |
+- bad_counter ns2 ns1$dir "$expect" |
5622 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 2" |
5623 |
+ lret=1 |
5624 |
+ fi |
5625 |
+ done |
5626 |
+@@ -494,7 +509,7 @@ test_masquerade() |
5627 |
+ reset_counters |
5628 |
+ |
5629 |
+ # add masquerading rule |
5630 |
+-ip netns exec ns0 nft -f - <<EOF |
5631 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
5632 |
+ table $family nat { |
5633 |
+ chain postrouting { |
5634 |
+ type nat hook postrouting priority 0; policy accept; |
5635 |
+@@ -507,24 +522,24 @@ EOF |
5636 |
+ return $ksft_skip |
5637 |
+ fi |
5638 |
+ |
5639 |
+- ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5640 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5641 |
+ if [ $? -ne 0 ] ; then |
5642 |
+- echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags" |
5643 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with active $family masquerade $natflags" |
5644 |
+ lret=1 |
5645 |
+ fi |
5646 |
+ |
5647 |
+ # ns1 should have seen packets from ns0, due to masquerade |
5648 |
+ expect="packets 1 bytes 84" |
5649 |
+ for dir in "in" "out" ; do |
5650 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect") |
5651 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0${dir} | grep -q "$expect") |
5652 |
+ if [ $? -ne 0 ]; then |
5653 |
+- bad_counter ns1 ns0$dir "$expect" |
5654 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 3" |
5655 |
+ lret=1 |
5656 |
+ fi |
5657 |
+ |
5658 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5659 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5660 |
+ if [ $? -ne 0 ]; then |
5661 |
+- bad_counter ns2 ns1$dir "$expect" |
5662 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_masquerade 4" |
5663 |
+ lret=1 |
5664 |
+ fi |
5665 |
+ done |
5666 |
+@@ -532,32 +547,32 @@ EOF |
5667 |
+ # ns1 should not have seen packets from ns2, due to masquerade |
5668 |
+ expect="packets 0 bytes 0" |
5669 |
+ for dir in "in" "out" ; do |
5670 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5671 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5672 |
+ if [ $? -ne 0 ]; then |
5673 |
+- bad_counter ns1 ns0$dir "$expect" |
5674 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 5" |
5675 |
+ lret=1 |
5676 |
+ fi |
5677 |
+ |
5678 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5679 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5680 |
+ if [ $? -ne 0 ]; then |
5681 |
+- bad_counter ns2 ns1$dir "$expect" |
5682 |
++ bad_counter "$ns0" ns1$dir "$expect" "test_masquerade 6" |
5683 |
+ lret=1 |
5684 |
+ fi |
5685 |
+ done |
5686 |
+ |
5687 |
+- ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5688 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5689 |
+ if [ $? -ne 0 ] ; then |
5690 |
+- echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)" |
5691 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with active ip masquerade $natflags (attempt 2)" |
5692 |
+ lret=1 |
5693 |
+ fi |
5694 |
+ |
5695 |
+- ip netns exec ns0 nft flush chain $family nat postrouting |
5696 |
++ ip netns exec "$ns0" nft flush chain $family nat postrouting |
5697 |
+ if [ $? -ne 0 ]; then |
5698 |
+ echo "ERROR: Could not flush $family nat postrouting" 1>&2 |
5699 |
+ lret=1 |
5700 |
+ fi |
5701 |
+ |
5702 |
+- test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for ns2" |
5703 |
++ test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for $ns2" |
5704 |
+ |
5705 |
+ return $lret |
5706 |
+ } |
5707 |
+@@ -567,25 +582,25 @@ test_redirect6() |
5708 |
+ local family=$1 |
5709 |
+ local lret=0 |
5710 |
+ |
5711 |
+- ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
5712 |
++ ip netns exec "$ns0" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
5713 |
+ |
5714 |
+- ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5715 |
++ ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5716 |
+ if [ $? -ne 0 ] ; then |
5717 |
+- echo "ERROR: cannnot ping ns1 from ns2 via ipv6" |
5718 |
++ echo "ERROR: cannnot ping $ns1 from $ns2 via ipv6" |
5719 |
+ lret=1 |
5720 |
+ fi |
5721 |
+ |
5722 |
+ expect="packets 1 bytes 104" |
5723 |
+ for dir in "in6" "out6" ; do |
5724 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5725 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5726 |
+ if [ $? -ne 0 ]; then |
5727 |
+- bad_counter ns1 ns2$dir "$expect" |
5728 |
++ bad_counter "$ns1" ns2$dir "$expect" "test_redirect6 1" |
5729 |
+ lret=1 |
5730 |
+ fi |
5731 |
+ |
5732 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5733 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5734 |
+ if [ $? -ne 0 ]; then |
5735 |
+- bad_counter ns2 ns1$dir "$expect" |
5736 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_redirect6 2" |
5737 |
+ lret=1 |
5738 |
+ fi |
5739 |
+ done |
5740 |
+@@ -593,7 +608,7 @@ test_redirect6() |
5741 |
+ reset_counters |
5742 |
+ |
5743 |
+ # add redirect rule |
5744 |
+-ip netns exec ns0 nft -f - <<EOF |
5745 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
5746 |
+ table $family nat { |
5747 |
+ chain prerouting { |
5748 |
+ type nat hook prerouting priority 0; policy accept; |
5749 |
+@@ -606,18 +621,18 @@ EOF |
5750 |
+ return $ksft_skip |
5751 |
+ fi |
5752 |
+ |
5753 |
+- ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5754 |
++ ip netns exec "$ns2" ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
5755 |
+ if [ $? -ne 0 ] ; then |
5756 |
+- echo "ERROR: cannot ping ns1 from ns2 via ipv6 with active $family redirect" |
5757 |
++ echo "ERROR: cannot ping $ns1 from $ns2 via ipv6 with active $family redirect" |
5758 |
+ lret=1 |
5759 |
+ fi |
5760 |
+ |
5761 |
+ # ns1 should have seen no packets from ns2, due to redirection |
5762 |
+ expect="packets 0 bytes 0" |
5763 |
+ for dir in "in6" "out6" ; do |
5764 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5765 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5766 |
+ if [ $? -ne 0 ]; then |
5767 |
+- bad_counter ns1 ns0$dir "$expect" |
5768 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 3" |
5769 |
+ lret=1 |
5770 |
+ fi |
5771 |
+ done |
5772 |
+@@ -625,20 +640,20 @@ EOF |
5773 |
+ # ns0 should have seen packets from ns2, due to masquerade |
5774 |
+ expect="packets 1 bytes 104" |
5775 |
+ for dir in "in6" "out6" ; do |
5776 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5777 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5778 |
+ if [ $? -ne 0 ]; then |
5779 |
+- bad_counter ns1 ns0$dir "$expect" |
5780 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_redirect6 4" |
5781 |
+ lret=1 |
5782 |
+ fi |
5783 |
+ done |
5784 |
+ |
5785 |
+- ip netns exec ns0 nft delete table $family nat |
5786 |
++ ip netns exec "$ns0" nft delete table $family nat |
5787 |
+ if [ $? -ne 0 ]; then |
5788 |
+ echo "ERROR: Could not delete $family nat table" 1>&2 |
5789 |
+ lret=1 |
5790 |
+ fi |
5791 |
+ |
5792 |
+- test $lret -eq 0 && echo "PASS: $family IPv6 redirection for ns2" |
5793 |
++ test $lret -eq 0 && echo "PASS: $family IPv6 redirection for $ns2" |
5794 |
+ |
5795 |
+ return $lret |
5796 |
+ } |
5797 |
+@@ -648,26 +663,26 @@ test_redirect() |
5798 |
+ local family=$1 |
5799 |
+ local lret=0 |
5800 |
+ |
5801 |
+- ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
5802 |
+- ip netns exec ns0 sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
5803 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
5804 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
5805 |
+ |
5806 |
+- ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5807 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5808 |
+ if [ $? -ne 0 ] ; then |
5809 |
+- echo "ERROR: cannot ping ns1 from ns2" |
5810 |
++ echo "ERROR: cannot ping $ns1 from $ns2" |
5811 |
+ lret=1 |
5812 |
+ fi |
5813 |
+ |
5814 |
+ expect="packets 1 bytes 84" |
5815 |
+ for dir in "in" "out" ; do |
5816 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5817 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5818 |
+ if [ $? -ne 0 ]; then |
5819 |
+- bad_counter ns1 ns2$dir "$expect" |
5820 |
++ bad_counter "$ns1" $ns2$dir "$expect" "test_redirect 1" |
5821 |
+ lret=1 |
5822 |
+ fi |
5823 |
+ |
5824 |
+- cnt=$(ip netns exec ns2 nft list counter inet filter ns1${dir} | grep -q "$expect") |
5825 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
5826 |
+ if [ $? -ne 0 ]; then |
5827 |
+- bad_counter ns2 ns1$dir "$expect" |
5828 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_redirect 2" |
5829 |
+ lret=1 |
5830 |
+ fi |
5831 |
+ done |
5832 |
+@@ -675,7 +690,7 @@ test_redirect() |
5833 |
+ reset_counters |
5834 |
+ |
5835 |
+ # add redirect rule |
5836 |
+-ip netns exec ns0 nft -f - <<EOF |
5837 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
5838 |
+ table $family nat { |
5839 |
+ chain prerouting { |
5840 |
+ type nat hook prerouting priority 0; policy accept; |
5841 |
+@@ -688,9 +703,9 @@ EOF |
5842 |
+ return $ksft_skip |
5843 |
+ fi |
5844 |
+ |
5845 |
+- ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5846 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
5847 |
+ if [ $? -ne 0 ] ; then |
5848 |
+- echo "ERROR: cannot ping ns1 from ns2 with active $family ip redirect" |
5849 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with active $family ip redirect" |
5850 |
+ lret=1 |
5851 |
+ fi |
5852 |
+ |
5853 |
+@@ -698,9 +713,9 @@ EOF |
5854 |
+ expect="packets 0 bytes 0" |
5855 |
+ for dir in "in" "out" ; do |
5856 |
+ |
5857 |
+- cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5858 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5859 |
+ if [ $? -ne 0 ]; then |
5860 |
+- bad_counter ns1 ns0$dir "$expect" |
5861 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_redirect 3" |
5862 |
+ lret=1 |
5863 |
+ fi |
5864 |
+ done |
5865 |
+@@ -708,28 +723,28 @@ EOF |
5866 |
+ # ns0 should have seen packets from ns2, due to masquerade |
5867 |
+ expect="packets 1 bytes 84" |
5868 |
+ for dir in "in" "out" ; do |
5869 |
+- cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect") |
5870 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect") |
5871 |
+ if [ $? -ne 0 ]; then |
5872 |
+- bad_counter ns1 ns0$dir "$expect" |
5873 |
++ bad_counter "$ns0" ns0$dir "$expect" "test_redirect 4" |
5874 |
+ lret=1 |
5875 |
+ fi |
5876 |
+ done |
5877 |
+ |
5878 |
+- ip netns exec ns0 nft delete table $family nat |
5879 |
++ ip netns exec "$ns0" nft delete table $family nat |
5880 |
+ if [ $? -ne 0 ]; then |
5881 |
+ echo "ERROR: Could not delete $family nat table" 1>&2 |
5882 |
+ lret=1 |
5883 |
+ fi |
5884 |
+ |
5885 |
+- test $lret -eq 0 && echo "PASS: $family IP redirection for ns2" |
5886 |
++ test $lret -eq 0 && echo "PASS: $family IP redirection for $ns2" |
5887 |
+ |
5888 |
+ return $lret |
5889 |
+ } |
5890 |
+ |
5891 |
+ |
5892 |
+-# ip netns exec ns0 ping -c 1 -q 10.0.$i.99 |
5893 |
++# ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 |
5894 |
+ for i in 0 1 2; do |
5895 |
+-ip netns exec ns$i nft -f - <<EOF |
5896 |
++ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF |
5897 |
+ table inet filter { |
5898 |
+ counter ns0in {} |
5899 |
+ counter ns1in {} |
5900 |
+@@ -796,18 +811,18 @@ done |
5901 |
+ sleep 3 |
5902 |
+ # test basic connectivity |
5903 |
+ for i in 1 2; do |
5904 |
+- ip netns exec ns0 ping -c 1 -q 10.0.$i.99 > /dev/null |
5905 |
++ ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 > /dev/null |
5906 |
+ if [ $? -ne 0 ];then |
5907 |
+ echo "ERROR: Could not reach other namespace(s)" 1>&2 |
5908 |
+ ret=1 |
5909 |
+ fi |
5910 |
+ |
5911 |
+- ip netns exec ns0 ping -c 1 -q dead:$i::99 > /dev/null |
5912 |
++ ip netns exec "$ns0" ping -c 1 -q dead:$i::99 > /dev/null |
5913 |
+ if [ $? -ne 0 ];then |
5914 |
+ echo "ERROR: Could not reach other namespace(s) via ipv6" 1>&2 |
5915 |
+ ret=1 |
5916 |
+ fi |
5917 |
+- check_counters ns$i |
5918 |
++ check_counters ns$i-$sfx |
5919 |
+ if [ $? -ne 0 ]; then |
5920 |
+ ret=1 |
5921 |
+ fi |
5922 |
+@@ -820,7 +835,7 @@ for i in 1 2; do |
5923 |
+ done |
5924 |
+ |
5925 |
+ if [ $ret -eq 0 ];then |
5926 |
+- echo "PASS: netns routing/connectivity: ns0 can reach ns1 and ns2" |
5927 |
++ echo "PASS: netns routing/connectivity: $ns0 can reach $ns1 and $ns2" |
5928 |
+ fi |
5929 |
+ |
5930 |
+ reset_counters |
5931 |
+@@ -846,4 +861,9 @@ reset_counters |
5932 |
+ $test_inet_nat && test_redirect inet |
5933 |
+ $test_inet_nat && test_redirect6 inet |
5934 |
+ |
5935 |
++if [ $ret -ne 0 ];then |
5936 |
++ echo -n "FAIL: " |
5937 |
++ nft --version |
5938 |
++fi |
5939 |
++ |
5940 |
+ exit $ret |
5941 |
+diff --git a/tools/testing/selftests/safesetid/Makefile b/tools/testing/selftests/safesetid/Makefile |
5942 |
+index 98da7a504737..fa02c4d5ec13 100644 |
5943 |
+--- a/tools/testing/selftests/safesetid/Makefile |
5944 |
++++ b/tools/testing/selftests/safesetid/Makefile |
5945 |
+@@ -1,8 +1,9 @@ |
5946 |
+ # SPDX-License-Identifier: GPL-2.0 |
5947 |
+ # Makefile for mount selftests. |
5948 |
+-CFLAGS = -Wall -lcap -O2 |
5949 |
++CFLAGS = -Wall -O2 |
5950 |
++LDLIBS = -lcap |
5951 |
+ |
5952 |
+-TEST_PROGS := run_tests.sh |
5953 |
++TEST_PROGS := safesetid-test.sh |
5954 |
+ TEST_GEN_FILES := safesetid-test |
5955 |
+ |
5956 |
+ include ../lib.mk |
5957 |
+diff --git a/tools/testing/selftests/safesetid/safesetid-test.c b/tools/testing/selftests/safesetid/safesetid-test.c |
5958 |
+index 8f40c6ecdad1..0c4d50644c13 100644 |
5959 |
+--- a/tools/testing/selftests/safesetid/safesetid-test.c |
5960 |
++++ b/tools/testing/selftests/safesetid/safesetid-test.c |
5961 |
+@@ -213,7 +213,8 @@ static void test_setuid(uid_t child_uid, bool expect_success) |
5962 |
+ } |
5963 |
+ |
5964 |
+ if (cpid == 0) { /* Code executed by child */ |
5965 |
+- setuid(child_uid); |
5966 |
++ if (setuid(child_uid) < 0) |
5967 |
++ exit(EXIT_FAILURE); |
5968 |
+ if (getuid() == child_uid) |
5969 |
+ exit(EXIT_SUCCESS); |
5970 |
+ else |
5971 |
+@@ -291,8 +292,10 @@ int main(int argc, char **argv) |
5972 |
+ |
5973 |
+ // First test to make sure we can write userns mappings from a user |
5974 |
+ // that doesn't have any restrictions (as long as it has CAP_SETUID); |
5975 |
+- setuid(NO_POLICY_USER); |
5976 |
+- setgid(NO_POLICY_USER); |
5977 |
++ if (setuid(NO_POLICY_USER) < 0) |
5978 |
++ die("Error with set uid(%d)\n", NO_POLICY_USER); |
5979 |
++ if (setgid(NO_POLICY_USER) < 0) |
5980 |
++ die("Error with set gid(%d)\n", NO_POLICY_USER); |
5981 |
+ |
5982 |
+ // Take away all but setid caps |
5983 |
+ drop_caps(true); |
5984 |
+@@ -306,8 +309,10 @@ int main(int argc, char **argv) |
5985 |
+ die("test_userns failed when it should work\n"); |
5986 |
+ } |
5987 |
+ |
5988 |
+- setuid(RESTRICTED_PARENT); |
5989 |
+- setgid(RESTRICTED_PARENT); |
5990 |
++ if (setuid(RESTRICTED_PARENT) < 0) |
5991 |
++ die("Error with set uid(%d)\n", RESTRICTED_PARENT); |
5992 |
++ if (setgid(RESTRICTED_PARENT) < 0) |
5993 |
++ die("Error with set gid(%d)\n", RESTRICTED_PARENT); |
5994 |
+ |
5995 |
+ test_setuid(ROOT_USER, false); |
5996 |
+ test_setuid(ALLOWED_CHILD1, true); |