Contents of /trunk/kernel-alx/patches-4.19/0147-4.19.48-all-fixes.patch
Parent Directory | Revision Log
Revision 3426 -
(show annotations)
(download)
Fri Aug 2 11:47:55 2019 UTC (5 years, 1 month ago) by niro
File size: 67754 byte(s)
Fri Aug 2 11:47:55 2019 UTC (5 years, 1 month ago) by niro
File size: 67754 byte(s)
-linux-4.19.48
1 | diff --git a/Makefile b/Makefile |
2 | index b3ba28ff73d5..42529a87f3b4 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 19 |
9 | -SUBLEVEL = 47 |
10 | +SUBLEVEL = 48 |
11 | EXTRAVERSION = |
12 | NAME = "People's Front" |
13 | |
14 | @@ -508,13 +508,6 @@ export RETPOLINE_VDSO_CFLAGS |
15 | KBUILD_CFLAGS += $(call cc-option,-fno-PIE) |
16 | KBUILD_AFLAGS += $(call cc-option,-fno-PIE) |
17 | |
18 | -# check for 'asm goto' |
19 | -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) |
20 | - CC_HAVE_ASM_GOTO := 1 |
21 | - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO |
22 | - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO |
23 | -endif |
24 | - |
25 | # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. |
26 | # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. |
27 | # CC_VERSION_TEXT is referenced from Kconfig (so it needs export), |
28 | diff --git a/arch/Kconfig b/arch/Kconfig |
29 | index 6801123932a5..a336548487e6 100644 |
30 | --- a/arch/Kconfig |
31 | +++ b/arch/Kconfig |
32 | @@ -71,6 +71,7 @@ config KPROBES |
33 | config JUMP_LABEL |
34 | bool "Optimize very unlikely/likely branches" |
35 | depends on HAVE_ARCH_JUMP_LABEL |
36 | + depends on CC_HAS_ASM_GOTO |
37 | help |
38 | This option enables a transparent branch optimization that |
39 | makes certain almost-always-true or almost-always-false branch |
40 | diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c |
41 | index 90bce3d9928e..303b3ab87f7e 100644 |
42 | --- a/arch/arm/kernel/jump_label.c |
43 | +++ b/arch/arm/kernel/jump_label.c |
44 | @@ -4,8 +4,6 @@ |
45 | #include <asm/patch.h> |
46 | #include <asm/insn.h> |
47 | |
48 | -#ifdef HAVE_JUMP_LABEL |
49 | - |
50 | static void __arch_jump_label_transform(struct jump_entry *entry, |
51 | enum jump_label_type type, |
52 | bool is_static) |
53 | @@ -35,5 +33,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, |
54 | { |
55 | __arch_jump_label_transform(entry, type, true); |
56 | } |
57 | - |
58 | -#endif |
59 | diff --git a/arch/arm64/kernel/jump_label.c b/arch/arm64/kernel/jump_label.c |
60 | index e0756416e567..b90754aebd12 100644 |
61 | --- a/arch/arm64/kernel/jump_label.c |
62 | +++ b/arch/arm64/kernel/jump_label.c |
63 | @@ -20,8 +20,6 @@ |
64 | #include <linux/jump_label.h> |
65 | #include <asm/insn.h> |
66 | |
67 | -#ifdef HAVE_JUMP_LABEL |
68 | - |
69 | void arch_jump_label_transform(struct jump_entry *entry, |
70 | enum jump_label_type type) |
71 | { |
72 | @@ -49,5 +47,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, |
73 | * NOP needs to be replaced by a branch. |
74 | */ |
75 | } |
76 | - |
77 | -#endif /* HAVE_JUMP_LABEL */ |
78 | diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c |
79 | index 32e3168316cd..ab943927f97a 100644 |
80 | --- a/arch/mips/kernel/jump_label.c |
81 | +++ b/arch/mips/kernel/jump_label.c |
82 | @@ -16,8 +16,6 @@ |
83 | #include <asm/cacheflush.h> |
84 | #include <asm/inst.h> |
85 | |
86 | -#ifdef HAVE_JUMP_LABEL |
87 | - |
88 | /* |
89 | * Define parameters for the standard MIPS and the microMIPS jump |
90 | * instruction encoding respectively: |
91 | @@ -70,5 +68,3 @@ void arch_jump_label_transform(struct jump_entry *e, |
92 | |
93 | mutex_unlock(&text_mutex); |
94 | } |
95 | - |
96 | -#endif /* HAVE_JUMP_LABEL */ |
97 | diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h |
98 | index 1f4691ce4126..e398173ae67d 100644 |
99 | --- a/arch/powerpc/include/asm/asm-prototypes.h |
100 | +++ b/arch/powerpc/include/asm/asm-prototypes.h |
101 | @@ -38,7 +38,7 @@ extern struct static_key hcall_tracepoint_key; |
102 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args); |
103 | void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf); |
104 | /* OPAL tracing */ |
105 | -#ifdef HAVE_JUMP_LABEL |
106 | +#ifdef CONFIG_JUMP_LABEL |
107 | extern struct static_key opal_tracepoint_key; |
108 | #endif |
109 | |
110 | diff --git a/arch/powerpc/kernel/jump_label.c b/arch/powerpc/kernel/jump_label.c |
111 | index 6472472093d0..0080c5fbd225 100644 |
112 | --- a/arch/powerpc/kernel/jump_label.c |
113 | +++ b/arch/powerpc/kernel/jump_label.c |
114 | @@ -11,7 +11,6 @@ |
115 | #include <linux/jump_label.h> |
116 | #include <asm/code-patching.h> |
117 | |
118 | -#ifdef HAVE_JUMP_LABEL |
119 | void arch_jump_label_transform(struct jump_entry *entry, |
120 | enum jump_label_type type) |
121 | { |
122 | @@ -22,4 +21,3 @@ void arch_jump_label_transform(struct jump_entry *entry, |
123 | else |
124 | patch_instruction(addr, PPC_INST_NOP); |
125 | } |
126 | -#endif |
127 | diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c |
128 | index 1ab7d26c0a2c..f16a43540e30 100644 |
129 | --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c |
130 | +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c |
131 | @@ -4,7 +4,7 @@ |
132 | #include <asm/trace.h> |
133 | #include <asm/asm-prototypes.h> |
134 | |
135 | -#ifdef HAVE_JUMP_LABEL |
136 | +#ifdef CONFIG_JUMP_LABEL |
137 | struct static_key opal_tracepoint_key = STATIC_KEY_INIT; |
138 | |
139 | int opal_tracepoint_regfunc(void) |
140 | diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S |
141 | index 251528231a9e..f4875fe3f8ff 100644 |
142 | --- a/arch/powerpc/platforms/powernv/opal-wrappers.S |
143 | +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S |
144 | @@ -20,7 +20,7 @@ |
145 | .section ".text" |
146 | |
147 | #ifdef CONFIG_TRACEPOINTS |
148 | -#ifdef HAVE_JUMP_LABEL |
149 | +#ifdef CONFIG_JUMP_LABEL |
150 | #define OPAL_BRANCH(LABEL) \ |
151 | ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key) |
152 | #else |
153 | diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S |
154 | index d91412c591ef..50dc9426d0be 100644 |
155 | --- a/arch/powerpc/platforms/pseries/hvCall.S |
156 | +++ b/arch/powerpc/platforms/pseries/hvCall.S |
157 | @@ -19,7 +19,7 @@ |
158 | |
159 | #ifdef CONFIG_TRACEPOINTS |
160 | |
161 | -#ifndef HAVE_JUMP_LABEL |
162 | +#ifndef CONFIG_JUMP_LABEL |
163 | .section ".toc","aw" |
164 | |
165 | .globl hcall_tracepoint_refcount |
166 | @@ -79,7 +79,7 @@ hcall_tracepoint_refcount: |
167 | mr r5,BUFREG; \ |
168 | __HCALL_INST_POSTCALL |
169 | |
170 | -#ifdef HAVE_JUMP_LABEL |
171 | +#ifdef CONFIG_JUMP_LABEL |
172 | #define HCALL_BRANCH(LABEL) \ |
173 | ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key) |
174 | #else |
175 | diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c |
176 | index d3992ced0782..9e52b686a8fa 100644 |
177 | --- a/arch/powerpc/platforms/pseries/lpar.c |
178 | +++ b/arch/powerpc/platforms/pseries/lpar.c |
179 | @@ -828,7 +828,7 @@ EXPORT_SYMBOL(arch_free_page); |
180 | #endif /* CONFIG_PPC_BOOK3S_64 */ |
181 | |
182 | #ifdef CONFIG_TRACEPOINTS |
183 | -#ifdef HAVE_JUMP_LABEL |
184 | +#ifdef CONFIG_JUMP_LABEL |
185 | struct static_key hcall_tracepoint_key = STATIC_KEY_INIT; |
186 | |
187 | int hcall_tracepoint_regfunc(void) |
188 | diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile |
189 | index dbfd1730e631..b205c0ff0b22 100644 |
190 | --- a/arch/s390/kernel/Makefile |
191 | +++ b/arch/s390/kernel/Makefile |
192 | @@ -44,7 +44,7 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' |
193 | obj-y := traps.o time.o process.o base.o early.o setup.o idle.o vtime.o |
194 | obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o |
195 | obj-y += debug.o irq.o ipl.o dis.o diag.o vdso.o early_nobss.o |
196 | -obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o |
197 | +obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o pgm_check.o |
198 | obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o |
199 | obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o |
200 | obj-y += nospec-branch.o |
201 | @@ -68,6 +68,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o |
202 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o |
203 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o |
204 | obj-$(CONFIG_UPROBES) += uprobes.o |
205 | +obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
206 | |
207 | obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o |
208 | obj-$(CONFIG_KEXEC_FILE) += kexec_elf.o |
209 | diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c |
210 | index 43f8430fb67d..68f415e334a5 100644 |
211 | --- a/arch/s390/kernel/jump_label.c |
212 | +++ b/arch/s390/kernel/jump_label.c |
213 | @@ -10,8 +10,6 @@ |
214 | #include <linux/jump_label.h> |
215 | #include <asm/ipl.h> |
216 | |
217 | -#ifdef HAVE_JUMP_LABEL |
218 | - |
219 | struct insn { |
220 | u16 opcode; |
221 | s32 offset; |
222 | @@ -102,5 +100,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry, |
223 | { |
224 | __jump_label_transform(entry, type, 1); |
225 | } |
226 | - |
227 | -#endif |
228 | diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile |
229 | index cf8640841b7a..97c0e19263d1 100644 |
230 | --- a/arch/sparc/kernel/Makefile |
231 | +++ b/arch/sparc/kernel/Makefile |
232 | @@ -118,4 +118,4 @@ pc--$(CONFIG_PERF_EVENTS) := perf_event.o |
233 | obj-$(CONFIG_SPARC64) += $(pc--y) |
234 | |
235 | obj-$(CONFIG_UPROBES) += uprobes.o |
236 | -obj-$(CONFIG_SPARC64) += jump_label.o |
237 | +obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
238 | diff --git a/arch/sparc/kernel/jump_label.c b/arch/sparc/kernel/jump_label.c |
239 | index 7f8eac51df33..a4cfaeecaf5e 100644 |
240 | --- a/arch/sparc/kernel/jump_label.c |
241 | +++ b/arch/sparc/kernel/jump_label.c |
242 | @@ -9,8 +9,6 @@ |
243 | |
244 | #include <asm/cacheflush.h> |
245 | |
246 | -#ifdef HAVE_JUMP_LABEL |
247 | - |
248 | void arch_jump_label_transform(struct jump_entry *entry, |
249 | enum jump_label_type type) |
250 | { |
251 | @@ -47,5 +45,3 @@ void arch_jump_label_transform(struct jump_entry *entry, |
252 | flushi(insn); |
253 | mutex_unlock(&text_mutex); |
254 | } |
255 | - |
256 | -#endif |
257 | diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
258 | index ab2071e40efe..ce0d0424a53d 100644 |
259 | --- a/arch/x86/Makefile |
260 | +++ b/arch/x86/Makefile |
261 | @@ -305,7 +305,7 @@ vdso_install: |
262 | |
263 | archprepare: checkbin |
264 | checkbin: |
265 | -ifndef CC_HAVE_ASM_GOTO |
266 | +ifndef CONFIG_CC_HAS_ASM_GOTO |
267 | @echo Compiler lacks asm-goto support. |
268 | @exit 1 |
269 | endif |
270 | diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h |
271 | index 352e70cd33e8..e699b2041665 100644 |
272 | --- a/arch/x86/entry/calling.h |
273 | +++ b/arch/x86/entry/calling.h |
274 | @@ -337,7 +337,7 @@ For 32-bit we have the following conventions - kernel is built with |
275 | */ |
276 | .macro CALL_enter_from_user_mode |
277 | #ifdef CONFIG_CONTEXT_TRACKING |
278 | -#ifdef HAVE_JUMP_LABEL |
279 | +#ifdef CONFIG_JUMP_LABEL |
280 | STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0 |
281 | #endif |
282 | call enter_from_user_mode |
283 | diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h |
284 | index aced6c9290d6..ce95b8cbd229 100644 |
285 | --- a/arch/x86/include/asm/cpufeature.h |
286 | +++ b/arch/x86/include/asm/cpufeature.h |
287 | @@ -140,7 +140,7 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit); |
288 | |
289 | #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) |
290 | |
291 | -#if defined(__clang__) && !defined(CC_HAVE_ASM_GOTO) |
292 | +#if defined(__clang__) && !defined(CONFIG_CC_HAS_ASM_GOTO) |
293 | |
294 | /* |
295 | * Workaround for the sake of BPF compilation which utilizes kernel |
296 | diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h |
297 | index 8c0de4282659..7010e1c594c4 100644 |
298 | --- a/arch/x86/include/asm/jump_label.h |
299 | +++ b/arch/x86/include/asm/jump_label.h |
300 | @@ -2,19 +2,6 @@ |
301 | #ifndef _ASM_X86_JUMP_LABEL_H |
302 | #define _ASM_X86_JUMP_LABEL_H |
303 | |
304 | -#ifndef HAVE_JUMP_LABEL |
305 | -/* |
306 | - * For better or for worse, if jump labels (the gcc extension) are missing, |
307 | - * then the entire static branch patching infrastructure is compiled out. |
308 | - * If that happens, the code in here will malfunction. Raise a compiler |
309 | - * error instead. |
310 | - * |
311 | - * In theory, jump labels and the static branch patching infrastructure |
312 | - * could be decoupled to fix this. |
313 | - */ |
314 | -#error asm/jump_label.h included on a non-jump-label kernel |
315 | -#endif |
316 | - |
317 | #define JUMP_LABEL_NOP_SIZE 5 |
318 | |
319 | #ifdef CONFIG_X86_64 |
320 | diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h |
321 | index 4914a3e7c803..033dc7ca49e9 100644 |
322 | --- a/arch/x86/include/asm/rmwcc.h |
323 | +++ b/arch/x86/include/asm/rmwcc.h |
324 | @@ -4,7 +4,7 @@ |
325 | |
326 | #define __CLOBBERS_MEM(clb...) "memory", ## clb |
327 | |
328 | -#if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CC_HAVE_ASM_GOTO) |
329 | +#if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CONFIG_CC_HAS_ASM_GOTO) |
330 | |
331 | /* Use asm goto */ |
332 | |
333 | @@ -21,7 +21,7 @@ cc_label: \ |
334 | #define __BINARY_RMWcc_ARG " %1, " |
335 | |
336 | |
337 | -#else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ |
338 | +#else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */ |
339 | |
340 | /* Use flags output or a set instruction */ |
341 | |
342 | @@ -36,7 +36,7 @@ do { \ |
343 | |
344 | #define __BINARY_RMWcc_ARG " %2, " |
345 | |
346 | -#endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ |
347 | +#endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CONFIG_CC_HAS_ASM_GOTO) */ |
348 | |
349 | #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ |
350 | __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM()) |
351 | diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile |
352 | index 8824d01c0c35..da0b6bc090f3 100644 |
353 | --- a/arch/x86/kernel/Makefile |
354 | +++ b/arch/x86/kernel/Makefile |
355 | @@ -49,7 +49,8 @@ obj-$(CONFIG_COMPAT) += signal_compat.o |
356 | obj-y += traps.o idt.o irq.o irq_$(BITS).o dumpstack_$(BITS).o |
357 | obj-y += time.o ioport.o dumpstack.o nmi.o |
358 | obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o |
359 | -obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o |
360 | +obj-y += setup.o x86_init.o i8259.o irqinit.o |
361 | +obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
362 | obj-$(CONFIG_IRQ_WORK) += irq_work.o |
363 | obj-y += probe_roms.o |
364 | obj-$(CONFIG_X86_64) += sys_x86_64.o |
365 | diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c |
366 | index eeea935e9bb5..4c3d9a3d45b2 100644 |
367 | --- a/arch/x86/kernel/jump_label.c |
368 | +++ b/arch/x86/kernel/jump_label.c |
369 | @@ -16,8 +16,6 @@ |
370 | #include <asm/alternative.h> |
371 | #include <asm/text-patching.h> |
372 | |
373 | -#ifdef HAVE_JUMP_LABEL |
374 | - |
375 | union jump_code_union { |
376 | char code[JUMP_LABEL_NOP_SIZE]; |
377 | struct { |
378 | @@ -142,5 +140,3 @@ __init_or_module void arch_jump_label_transform_static(struct jump_entry *entry, |
379 | if (jlstate == JL_STATE_UPDATE) |
380 | __jump_label_transform(entry, type, text_poke_early, 1); |
381 | } |
382 | - |
383 | -#endif |
384 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
385 | index 860bd271619d..4a688ef9e448 100644 |
386 | --- a/arch/x86/kvm/emulate.c |
387 | +++ b/arch/x86/kvm/emulate.c |
388 | @@ -456,7 +456,7 @@ FOP_END; |
389 | |
390 | /* |
391 | * XXX: inoutclob user must know where the argument is being expanded. |
392 | - * Relying on CC_HAVE_ASM_GOTO would allow us to remove _fault. |
393 | + * Relying on CONFIG_CC_HAS_ASM_GOTO would allow us to remove _fault. |
394 | */ |
395 | #define asm_safe(insn, inoutclob...) \ |
396 | ({ \ |
397 | diff --git a/drivers/crypto/vmx/ghash.c b/drivers/crypto/vmx/ghash.c |
398 | index dd8b8716467a..2d1a8cd35509 100644 |
399 | --- a/drivers/crypto/vmx/ghash.c |
400 | +++ b/drivers/crypto/vmx/ghash.c |
401 | @@ -1,22 +1,14 @@ |
402 | +// SPDX-License-Identifier: GPL-2.0 |
403 | /** |
404 | * GHASH routines supporting VMX instructions on the Power 8 |
405 | * |
406 | - * Copyright (C) 2015 International Business Machines Inc. |
407 | - * |
408 | - * This program is free software; you can redistribute it and/or modify |
409 | - * it under the terms of the GNU General Public License as published by |
410 | - * the Free Software Foundation; version 2 only. |
411 | - * |
412 | - * This program is distributed in the hope that it will be useful, |
413 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
414 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
415 | - * GNU General Public License for more details. |
416 | - * |
417 | - * You should have received a copy of the GNU General Public License |
418 | - * along with this program; if not, write to the Free Software |
419 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
420 | + * Copyright (C) 2015, 2019 International Business Machines Inc. |
421 | * |
422 | * Author: Marcelo Henrique Cerri <mhcerri@br.ibm.com> |
423 | + * |
424 | + * Extended by Daniel Axtens <dja@axtens.net> to replace the fallback |
425 | + * mechanism. The new approach is based on arm64 code, which is: |
426 | + * Copyright (C) 2014 - 2018 Linaro Ltd. <ard.biesheuvel@linaro.org> |
427 | */ |
428 | |
429 | #include <linux/types.h> |
430 | @@ -39,71 +31,25 @@ void gcm_ghash_p8(u64 Xi[2], const u128 htable[16], |
431 | const u8 *in, size_t len); |
432 | |
433 | struct p8_ghash_ctx { |
434 | + /* key used by vector asm */ |
435 | u128 htable[16]; |
436 | - struct crypto_shash *fallback; |
437 | + /* key used by software fallback */ |
438 | + be128 key; |
439 | }; |
440 | |
441 | struct p8_ghash_desc_ctx { |
442 | u64 shash[2]; |
443 | u8 buffer[GHASH_DIGEST_SIZE]; |
444 | int bytes; |
445 | - struct shash_desc fallback_desc; |
446 | }; |
447 | |
448 | -static int p8_ghash_init_tfm(struct crypto_tfm *tfm) |
449 | -{ |
450 | - const char *alg = "ghash-generic"; |
451 | - struct crypto_shash *fallback; |
452 | - struct crypto_shash *shash_tfm = __crypto_shash_cast(tfm); |
453 | - struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); |
454 | - |
455 | - fallback = crypto_alloc_shash(alg, 0, CRYPTO_ALG_NEED_FALLBACK); |
456 | - if (IS_ERR(fallback)) { |
457 | - printk(KERN_ERR |
458 | - "Failed to allocate transformation for '%s': %ld\n", |
459 | - alg, PTR_ERR(fallback)); |
460 | - return PTR_ERR(fallback); |
461 | - } |
462 | - |
463 | - crypto_shash_set_flags(fallback, |
464 | - crypto_shash_get_flags((struct crypto_shash |
465 | - *) tfm)); |
466 | - |
467 | - /* Check if the descsize defined in the algorithm is still enough. */ |
468 | - if (shash_tfm->descsize < sizeof(struct p8_ghash_desc_ctx) |
469 | - + crypto_shash_descsize(fallback)) { |
470 | - printk(KERN_ERR |
471 | - "Desc size of the fallback implementation (%s) does not match the expected value: %lu vs %u\n", |
472 | - alg, |
473 | - shash_tfm->descsize - sizeof(struct p8_ghash_desc_ctx), |
474 | - crypto_shash_descsize(fallback)); |
475 | - return -EINVAL; |
476 | - } |
477 | - ctx->fallback = fallback; |
478 | - |
479 | - return 0; |
480 | -} |
481 | - |
482 | -static void p8_ghash_exit_tfm(struct crypto_tfm *tfm) |
483 | -{ |
484 | - struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); |
485 | - |
486 | - if (ctx->fallback) { |
487 | - crypto_free_shash(ctx->fallback); |
488 | - ctx->fallback = NULL; |
489 | - } |
490 | -} |
491 | - |
492 | static int p8_ghash_init(struct shash_desc *desc) |
493 | { |
494 | - struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
495 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
496 | |
497 | dctx->bytes = 0; |
498 | memset(dctx->shash, 0, GHASH_DIGEST_SIZE); |
499 | - dctx->fallback_desc.tfm = ctx->fallback; |
500 | - dctx->fallback_desc.flags = desc->flags; |
501 | - return crypto_shash_init(&dctx->fallback_desc); |
502 | + return 0; |
503 | } |
504 | |
505 | static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
506 | @@ -121,7 +67,51 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
507 | disable_kernel_vsx(); |
508 | pagefault_enable(); |
509 | preempt_enable(); |
510 | - return crypto_shash_setkey(ctx->fallback, key, keylen); |
511 | + |
512 | + memcpy(&ctx->key, key, GHASH_BLOCK_SIZE); |
513 | + |
514 | + return 0; |
515 | +} |
516 | + |
517 | +static inline void __ghash_block(struct p8_ghash_ctx *ctx, |
518 | + struct p8_ghash_desc_ctx *dctx) |
519 | +{ |
520 | + if (!IN_INTERRUPT) { |
521 | + preempt_disable(); |
522 | + pagefault_disable(); |
523 | + enable_kernel_vsx(); |
524 | + gcm_ghash_p8(dctx->shash, ctx->htable, |
525 | + dctx->buffer, GHASH_DIGEST_SIZE); |
526 | + disable_kernel_vsx(); |
527 | + pagefault_enable(); |
528 | + preempt_enable(); |
529 | + } else { |
530 | + crypto_xor((u8 *)dctx->shash, dctx->buffer, GHASH_BLOCK_SIZE); |
531 | + gf128mul_lle((be128 *)dctx->shash, &ctx->key); |
532 | + } |
533 | +} |
534 | + |
535 | +static inline void __ghash_blocks(struct p8_ghash_ctx *ctx, |
536 | + struct p8_ghash_desc_ctx *dctx, |
537 | + const u8 *src, unsigned int srclen) |
538 | +{ |
539 | + if (!IN_INTERRUPT) { |
540 | + preempt_disable(); |
541 | + pagefault_disable(); |
542 | + enable_kernel_vsx(); |
543 | + gcm_ghash_p8(dctx->shash, ctx->htable, |
544 | + src, srclen); |
545 | + disable_kernel_vsx(); |
546 | + pagefault_enable(); |
547 | + preempt_enable(); |
548 | + } else { |
549 | + while (srclen >= GHASH_BLOCK_SIZE) { |
550 | + crypto_xor((u8 *)dctx->shash, src, GHASH_BLOCK_SIZE); |
551 | + gf128mul_lle((be128 *)dctx->shash, &ctx->key); |
552 | + srclen -= GHASH_BLOCK_SIZE; |
553 | + src += GHASH_BLOCK_SIZE; |
554 | + } |
555 | + } |
556 | } |
557 | |
558 | static int p8_ghash_update(struct shash_desc *desc, |
559 | @@ -131,49 +121,33 @@ static int p8_ghash_update(struct shash_desc *desc, |
560 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
561 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
562 | |
563 | - if (IN_INTERRUPT) { |
564 | - return crypto_shash_update(&dctx->fallback_desc, src, |
565 | - srclen); |
566 | - } else { |
567 | - if (dctx->bytes) { |
568 | - if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { |
569 | - memcpy(dctx->buffer + dctx->bytes, src, |
570 | - srclen); |
571 | - dctx->bytes += srclen; |
572 | - return 0; |
573 | - } |
574 | + if (dctx->bytes) { |
575 | + if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { |
576 | memcpy(dctx->buffer + dctx->bytes, src, |
577 | - GHASH_DIGEST_SIZE - dctx->bytes); |
578 | - preempt_disable(); |
579 | - pagefault_disable(); |
580 | - enable_kernel_vsx(); |
581 | - gcm_ghash_p8(dctx->shash, ctx->htable, |
582 | - dctx->buffer, GHASH_DIGEST_SIZE); |
583 | - disable_kernel_vsx(); |
584 | - pagefault_enable(); |
585 | - preempt_enable(); |
586 | - src += GHASH_DIGEST_SIZE - dctx->bytes; |
587 | - srclen -= GHASH_DIGEST_SIZE - dctx->bytes; |
588 | - dctx->bytes = 0; |
589 | - } |
590 | - len = srclen & ~(GHASH_DIGEST_SIZE - 1); |
591 | - if (len) { |
592 | - preempt_disable(); |
593 | - pagefault_disable(); |
594 | - enable_kernel_vsx(); |
595 | - gcm_ghash_p8(dctx->shash, ctx->htable, src, len); |
596 | - disable_kernel_vsx(); |
597 | - pagefault_enable(); |
598 | - preempt_enable(); |
599 | - src += len; |
600 | - srclen -= len; |
601 | - } |
602 | - if (srclen) { |
603 | - memcpy(dctx->buffer, src, srclen); |
604 | - dctx->bytes = srclen; |
605 | + srclen); |
606 | + dctx->bytes += srclen; |
607 | + return 0; |
608 | } |
609 | - return 0; |
610 | + memcpy(dctx->buffer + dctx->bytes, src, |
611 | + GHASH_DIGEST_SIZE - dctx->bytes); |
612 | + |
613 | + __ghash_block(ctx, dctx); |
614 | + |
615 | + src += GHASH_DIGEST_SIZE - dctx->bytes; |
616 | + srclen -= GHASH_DIGEST_SIZE - dctx->bytes; |
617 | + dctx->bytes = 0; |
618 | + } |
619 | + len = srclen & ~(GHASH_DIGEST_SIZE - 1); |
620 | + if (len) { |
621 | + __ghash_blocks(ctx, dctx, src, len); |
622 | + src += len; |
623 | + srclen -= len; |
624 | } |
625 | + if (srclen) { |
626 | + memcpy(dctx->buffer, src, srclen); |
627 | + dctx->bytes = srclen; |
628 | + } |
629 | + return 0; |
630 | } |
631 | |
632 | static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
633 | @@ -182,25 +156,14 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
634 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
635 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
636 | |
637 | - if (IN_INTERRUPT) { |
638 | - return crypto_shash_final(&dctx->fallback_desc, out); |
639 | - } else { |
640 | - if (dctx->bytes) { |
641 | - for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) |
642 | - dctx->buffer[i] = 0; |
643 | - preempt_disable(); |
644 | - pagefault_disable(); |
645 | - enable_kernel_vsx(); |
646 | - gcm_ghash_p8(dctx->shash, ctx->htable, |
647 | - dctx->buffer, GHASH_DIGEST_SIZE); |
648 | - disable_kernel_vsx(); |
649 | - pagefault_enable(); |
650 | - preempt_enable(); |
651 | - dctx->bytes = 0; |
652 | - } |
653 | - memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); |
654 | - return 0; |
655 | + if (dctx->bytes) { |
656 | + for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) |
657 | + dctx->buffer[i] = 0; |
658 | + __ghash_block(ctx, dctx); |
659 | + dctx->bytes = 0; |
660 | } |
661 | + memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); |
662 | + return 0; |
663 | } |
664 | |
665 | struct shash_alg p8_ghash_alg = { |
666 | @@ -215,11 +178,8 @@ struct shash_alg p8_ghash_alg = { |
667 | .cra_name = "ghash", |
668 | .cra_driver_name = "p8_ghash", |
669 | .cra_priority = 1000, |
670 | - .cra_flags = CRYPTO_ALG_NEED_FALLBACK, |
671 | .cra_blocksize = GHASH_BLOCK_SIZE, |
672 | .cra_ctxsize = sizeof(struct p8_ghash_ctx), |
673 | .cra_module = THIS_MODULE, |
674 | - .cra_init = p8_ghash_init_tfm, |
675 | - .cra_exit = p8_ghash_exit_tfm, |
676 | }, |
677 | }; |
678 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
679 | index 091b454e83fc..039beb5e0fa2 100644 |
680 | --- a/drivers/net/bonding/bond_main.c |
681 | +++ b/drivers/net/bonding/bond_main.c |
682 | @@ -3107,13 +3107,18 @@ static int bond_slave_netdev_event(unsigned long event, |
683 | case NETDEV_CHANGE: |
684 | /* For 802.3ad mode only: |
685 | * Getting invalid Speed/Duplex values here will put slave |
686 | - * in weird state. So mark it as link-fail for the time |
687 | - * being and let link-monitoring (miimon) set it right when |
688 | - * correct speeds/duplex are available. |
689 | + * in weird state. Mark it as link-fail if the link was |
690 | + * previously up or link-down if it hasn't yet come up, and |
691 | + * let link-monitoring (miimon) set it right when correct |
692 | + * speeds/duplex are available. |
693 | */ |
694 | if (bond_update_speed_duplex(slave) && |
695 | - BOND_MODE(bond) == BOND_MODE_8023AD) |
696 | - slave->link = BOND_LINK_FAIL; |
697 | + BOND_MODE(bond) == BOND_MODE_8023AD) { |
698 | + if (slave->last_link_up) |
699 | + slave->link = BOND_LINK_FAIL; |
700 | + else |
701 | + slave->link = BOND_LINK_DOWN; |
702 | + } |
703 | |
704 | if (BOND_MODE(bond) == BOND_MODE_8023AD) |
705 | bond_3ad_adapter_speed_duplex_changed(slave); |
706 | diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
707 | index 2caa5c0c2bc4..dfaad1c2c2b8 100644 |
708 | --- a/drivers/net/dsa/mv88e6xxx/chip.c |
709 | +++ b/drivers/net/dsa/mv88e6xxx/chip.c |
710 | @@ -877,7 +877,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
711 | err = mv88e6xxx_port_read(chip, port, s->reg + 1, ®); |
712 | if (err) |
713 | return U64_MAX; |
714 | - high = reg; |
715 | + low |= ((u32)reg) << 16; |
716 | } |
717 | break; |
718 | case STATS_TYPE_BANK1: |
719 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
720 | index de46331aefc1..c54a74de7b08 100644 |
721 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
722 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
723 | @@ -1599,6 +1599,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, |
724 | skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); |
725 | bnxt_reuse_rx_data(rxr, cons, data); |
726 | if (!skb) { |
727 | + if (agg_bufs) |
728 | + bnxt_reuse_rx_agg_bufs(bnapi, cp_cons, agg_bufs); |
729 | rc = -ENOMEM; |
730 | goto next_rx; |
731 | } |
732 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
733 | index c116f96956fe..f2aba5b160c2 100644 |
734 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
735 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
736 | @@ -228,6 +228,9 @@ static void cxgb4_process_flow_match(struct net_device *dev, |
737 | fs->val.ivlan = vlan_tci; |
738 | fs->mask.ivlan = vlan_tci_mask; |
739 | |
740 | + fs->val.ivlan_vld = 1; |
741 | + fs->mask.ivlan_vld = 1; |
742 | + |
743 | /* Chelsio adapters use ivlan_vld bit to match vlan packets |
744 | * as 802.1Q. Also, when vlan tag is present in packets, |
745 | * ethtype match is used then to match on ethtype of inner |
746 | @@ -238,8 +241,6 @@ static void cxgb4_process_flow_match(struct net_device *dev, |
747 | * ethtype value with ethtype of inner header. |
748 | */ |
749 | if (fs->val.ethtype == ETH_P_8021Q) { |
750 | - fs->val.ivlan_vld = 1; |
751 | - fs->mask.ivlan_vld = 1; |
752 | fs->val.ethtype = 0; |
753 | fs->mask.ethtype = 0; |
754 | } |
755 | diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
756 | index ad41ace0a27a..bf715a367273 100644 |
757 | --- a/drivers/net/ethernet/freescale/fec_main.c |
758 | +++ b/drivers/net/ethernet/freescale/fec_main.c |
759 | @@ -3571,7 +3571,7 @@ failed_init: |
760 | if (fep->reg_phy) |
761 | regulator_disable(fep->reg_phy); |
762 | failed_reset: |
763 | - pm_runtime_put(&pdev->dev); |
764 | + pm_runtime_put_noidle(&pdev->dev); |
765 | pm_runtime_disable(&pdev->dev); |
766 | failed_regulator: |
767 | clk_disable_unprepare(fep->clk_ahb); |
768 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
769 | index 2ba0d89aaf3c..28762314353f 100644 |
770 | --- a/drivers/net/ethernet/marvell/mvneta.c |
771 | +++ b/drivers/net/ethernet/marvell/mvneta.c |
772 | @@ -4611,7 +4611,7 @@ static int mvneta_probe(struct platform_device *pdev) |
773 | err = register_netdev(dev); |
774 | if (err < 0) { |
775 | dev_err(&pdev->dev, "failed to register\n"); |
776 | - goto err_free_stats; |
777 | + goto err_netdev; |
778 | } |
779 | |
780 | netdev_info(dev, "Using %s mac address %pM\n", mac_from, |
781 | @@ -4622,14 +4622,12 @@ static int mvneta_probe(struct platform_device *pdev) |
782 | return 0; |
783 | |
784 | err_netdev: |
785 | - unregister_netdev(dev); |
786 | if (pp->bm_priv) { |
787 | mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id); |
788 | mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, |
789 | 1 << pp->id); |
790 | mvneta_bm_put(pp->bm_priv); |
791 | } |
792 | -err_free_stats: |
793 | free_percpu(pp->stats); |
794 | err_free_ports: |
795 | free_percpu(pp->ports); |
796 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
797 | index 9b10abb604cb..59212d3d9587 100644 |
798 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
799 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
800 | @@ -1404,7 +1404,7 @@ static inline void mvpp2_xlg_max_rx_size_set(struct mvpp2_port *port) |
801 | /* Set defaults to the MVPP2 port */ |
802 | static void mvpp2_defaults_set(struct mvpp2_port *port) |
803 | { |
804 | - int tx_port_num, val, queue, ptxq, lrxq; |
805 | + int tx_port_num, val, queue, lrxq; |
806 | |
807 | if (port->priv->hw_version == MVPP21) { |
808 | /* Update TX FIFO MIN Threshold */ |
809 | @@ -1422,11 +1422,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port) |
810 | mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0); |
811 | |
812 | /* Close bandwidth for all queues */ |
813 | - for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { |
814 | - ptxq = mvpp2_txq_phys(port->id, queue); |
815 | + for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) |
816 | mvpp2_write(port->priv, |
817 | - MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(ptxq), 0); |
818 | - } |
819 | + MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(queue), 0); |
820 | |
821 | /* Set refill period to 1 usec, refill tokens |
822 | * and bucket size to maximum |
823 | @@ -2271,7 +2269,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, |
824 | txq->descs_dma = 0; |
825 | |
826 | /* Set minimum bandwidth for disabled TXQs */ |
827 | - mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0); |
828 | + mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->log_id), 0); |
829 | |
830 | /* Set Tx descriptors queue starting address and size */ |
831 | cpu = get_cpu(); |
832 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
833 | index b190c447aeb0..0f1c296c3ce4 100644 |
834 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
835 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
836 | @@ -3734,6 +3734,12 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, |
837 | netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); |
838 | } |
839 | |
840 | + if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) { |
841 | + features &= ~NETIF_F_RXHASH; |
842 | + if (netdev->features & NETIF_F_RXHASH) |
843 | + netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); |
844 | + } |
845 | + |
846 | mutex_unlock(&priv->state_lock); |
847 | |
848 | return features; |
849 | @@ -3860,6 +3866,9 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) |
850 | memcpy(&priv->tstamp, &config, sizeof(config)); |
851 | mutex_unlock(&priv->state_lock); |
852 | |
853 | + /* might need to fix some features */ |
854 | + netdev_update_features(priv->netdev); |
855 | + |
856 | return copy_to_user(ifr->ifr_data, &config, |
857 | sizeof(config)) ? -EFAULT : 0; |
858 | } |
859 | @@ -4702,6 +4711,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) |
860 | if (!priv->channels.params.scatter_fcs_en) |
861 | netdev->features &= ~NETIF_F_RXFCS; |
862 | |
863 | + /* prefere CQE compression over rxhash */ |
864 | + if (MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS)) |
865 | + netdev->features &= ~NETIF_F_RXHASH; |
866 | + |
867 | #define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) |
868 | if (FT_CAP(flow_modify_en) && |
869 | FT_CAP(modify_root) && |
870 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
871 | index d181645fd968..c079f85593d6 100644 |
872 | --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
873 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
874 | @@ -2220,7 +2220,7 @@ static struct mlx5_flow_root_namespace |
875 | cmds = mlx5_fs_cmd_get_default_ipsec_fpga_cmds(table_type); |
876 | |
877 | /* Create the root namespace */ |
878 | - root_ns = kvzalloc(sizeof(*root_ns), GFP_KERNEL); |
879 | + root_ns = kzalloc(sizeof(*root_ns), GFP_KERNEL); |
880 | if (!root_ns) |
881 | return NULL; |
882 | |
883 | @@ -2363,6 +2363,7 @@ static void cleanup_egress_acls_root_ns(struct mlx5_core_dev *dev) |
884 | cleanup_root_ns(steering->esw_egress_root_ns[i]); |
885 | |
886 | kfree(steering->esw_egress_root_ns); |
887 | + steering->esw_egress_root_ns = NULL; |
888 | } |
889 | |
890 | static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) |
891 | @@ -2377,6 +2378,7 @@ static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) |
892 | cleanup_root_ns(steering->esw_ingress_root_ns[i]); |
893 | |
894 | kfree(steering->esw_ingress_root_ns); |
895 | + steering->esw_ingress_root_ns = NULL; |
896 | } |
897 | |
898 | void mlx5_cleanup_fs(struct mlx5_core_dev *dev) |
899 | @@ -2505,6 +2507,7 @@ cleanup_root_ns: |
900 | for (i--; i >= 0; i--) |
901 | cleanup_root_ns(steering->esw_egress_root_ns[i]); |
902 | kfree(steering->esw_egress_root_ns); |
903 | + steering->esw_egress_root_ns = NULL; |
904 | return err; |
905 | } |
906 | |
907 | @@ -2532,6 +2535,7 @@ cleanup_root_ns: |
908 | for (i--; i >= 0; i--) |
909 | cleanup_root_ns(steering->esw_ingress_root_ns[i]); |
910 | kfree(steering->esw_ingress_root_ns); |
911 | + steering->esw_ingress_root_ns = NULL; |
912 | return err; |
913 | } |
914 | |
915 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
916 | index 5debe93ea4eb..50c00822b2d8 100644 |
917 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
918 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
919 | @@ -2195,6 +2195,10 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
920 | if (priv->plat->axi) |
921 | stmmac_axi(priv, priv->ioaddr, priv->plat->axi); |
922 | |
923 | + /* DMA CSR Channel configuration */ |
924 | + for (chan = 0; chan < dma_csr_ch; chan++) |
925 | + stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan); |
926 | + |
927 | /* DMA RX Channel Configuration */ |
928 | for (chan = 0; chan < rx_channels_count; chan++) { |
929 | rx_q = &priv->rx_queue[chan]; |
930 | @@ -2220,10 +2224,6 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
931 | tx_q->tx_tail_addr, chan); |
932 | } |
933 | |
934 | - /* DMA CSR Channel configuration */ |
935 | - for (chan = 0; chan < dma_csr_ch; chan++) |
936 | - stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan); |
937 | - |
938 | return ret; |
939 | } |
940 | |
941 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
942 | index bdd351597b55..093a223fe408 100644 |
943 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
944 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
945 | @@ -267,7 +267,8 @@ int stmmac_mdio_reset(struct mii_bus *bus) |
946 | of_property_read_u32_array(np, |
947 | "snps,reset-delays-us", data->delays, 3); |
948 | |
949 | - if (gpio_request(data->reset_gpio, "mdio-reset")) |
950 | + if (devm_gpio_request(priv->device, data->reset_gpio, |
951 | + "mdio-reset")) |
952 | return 0; |
953 | } |
954 | |
955 | diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c |
956 | index f77a2d9e7f9d..456a1f882b09 100644 |
957 | --- a/drivers/net/phy/marvell10g.c |
958 | +++ b/drivers/net/phy/marvell10g.c |
959 | @@ -27,6 +27,9 @@ |
960 | #include <linux/phy.h> |
961 | |
962 | enum { |
963 | + MV_PMA_BOOT = 0xc050, |
964 | + MV_PMA_BOOT_FATAL = BIT(0), |
965 | + |
966 | MV_PCS_BASE_T = 0x0000, |
967 | MV_PCS_BASE_R = 0x1000, |
968 | MV_PCS_1000BASEX = 0x2000, |
969 | @@ -226,6 +229,16 @@ static int mv3310_probe(struct phy_device *phydev) |
970 | (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) |
971 | return -ENODEV; |
972 | |
973 | + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT); |
974 | + if (ret < 0) |
975 | + return ret; |
976 | + |
977 | + if (ret & MV_PMA_BOOT_FATAL) { |
978 | + dev_warn(&phydev->mdio.dev, |
979 | + "PHY failed to boot firmware, status=%04x\n", ret); |
980 | + return -ENODEV; |
981 | + } |
982 | + |
983 | priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); |
984 | if (!priv) |
985 | return -ENOMEM; |
986 | diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c |
987 | index 770aa624147f..10854977c55f 100644 |
988 | --- a/drivers/net/usb/usbnet.c |
989 | +++ b/drivers/net/usb/usbnet.c |
990 | @@ -506,6 +506,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) |
991 | |
992 | if (netif_running (dev->net) && |
993 | netif_device_present (dev->net) && |
994 | + test_bit(EVENT_DEV_OPEN, &dev->flags) && |
995 | !test_bit (EVENT_RX_HALT, &dev->flags) && |
996 | !test_bit (EVENT_DEV_ASLEEP, &dev->flags)) { |
997 | switch (retval = usb_submit_urb (urb, GFP_ATOMIC)) { |
998 | @@ -1431,6 +1432,11 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, |
999 | spin_unlock_irqrestore(&dev->txq.lock, flags); |
1000 | goto drop; |
1001 | } |
1002 | + if (netif_queue_stopped(net)) { |
1003 | + usb_autopm_put_interface_async(dev->intf); |
1004 | + spin_unlock_irqrestore(&dev->txq.lock, flags); |
1005 | + goto drop; |
1006 | + } |
1007 | |
1008 | #ifdef CONFIG_PM |
1009 | /* if this triggers the device is still a sleep */ |
1010 | diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c |
1011 | index ea4a08b83fa0..787966f44589 100644 |
1012 | --- a/drivers/xen/xen-pciback/pciback_ops.c |
1013 | +++ b/drivers/xen/xen-pciback/pciback_ops.c |
1014 | @@ -127,8 +127,6 @@ void xen_pcibk_reset_device(struct pci_dev *dev) |
1015 | if (pci_is_enabled(dev)) |
1016 | pci_disable_device(dev); |
1017 | |
1018 | - pci_write_config_word(dev, PCI_COMMAND, 0); |
1019 | - |
1020 | dev->is_busmaster = 0; |
1021 | } else { |
1022 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
1023 | diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
1024 | index 81c2238b884c..bb22908c79e8 100644 |
1025 | --- a/include/linux/compiler.h |
1026 | +++ b/include/linux/compiler.h |
1027 | @@ -319,29 +319,14 @@ static inline void *offset_to_ptr(const int *off) |
1028 | #endif |
1029 | #ifndef __compiletime_error |
1030 | # define __compiletime_error(message) |
1031 | -/* |
1032 | - * Sparse complains of variable sized arrays due to the temporary variable in |
1033 | - * __compiletime_assert. Unfortunately we can't just expand it out to make |
1034 | - * sparse see a constant array size without breaking compiletime_assert on old |
1035 | - * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. |
1036 | - */ |
1037 | -# ifndef __CHECKER__ |
1038 | -# define __compiletime_error_fallback(condition) \ |
1039 | - do { ((void)sizeof(char[1 - 2 * condition])); } while (0) |
1040 | -# endif |
1041 | -#endif |
1042 | -#ifndef __compiletime_error_fallback |
1043 | -# define __compiletime_error_fallback(condition) do { } while (0) |
1044 | #endif |
1045 | |
1046 | #ifdef __OPTIMIZE__ |
1047 | # define __compiletime_assert(condition, msg, prefix, suffix) \ |
1048 | do { \ |
1049 | - int __cond = !(condition); \ |
1050 | extern void prefix ## suffix(void) __compiletime_error(msg); \ |
1051 | - if (__cond) \ |
1052 | + if (!(condition)) \ |
1053 | prefix ## suffix(); \ |
1054 | - __compiletime_error_fallback(__cond); \ |
1055 | } while (0) |
1056 | #else |
1057 | # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) |
1058 | diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h |
1059 | index db192becfec4..c2ded31a4cec 100644 |
1060 | --- a/include/linux/compiler_types.h |
1061 | +++ b/include/linux/compiler_types.h |
1062 | @@ -151,6 +151,10 @@ struct ftrace_likely_data { |
1063 | #define __assume_aligned(a, ...) |
1064 | #endif |
1065 | |
1066 | +#ifndef asm_volatile_goto |
1067 | +#define asm_volatile_goto(x...) asm goto(x) |
1068 | +#endif |
1069 | + |
1070 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
1071 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
1072 | |
1073 | diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h |
1074 | index 2fd8006153c3..b3419da1a776 100644 |
1075 | --- a/include/linux/dynamic_debug.h |
1076 | +++ b/include/linux/dynamic_debug.h |
1077 | @@ -2,7 +2,7 @@ |
1078 | #ifndef _DYNAMIC_DEBUG_H |
1079 | #define _DYNAMIC_DEBUG_H |
1080 | |
1081 | -#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) |
1082 | +#if defined(CONFIG_JUMP_LABEL) |
1083 | #include <linux/jump_label.h> |
1084 | #endif |
1085 | |
1086 | @@ -38,7 +38,7 @@ struct _ddebug { |
1087 | #define _DPRINTK_FLAGS_DEFAULT 0 |
1088 | #endif |
1089 | unsigned int flags:8; |
1090 | -#ifdef HAVE_JUMP_LABEL |
1091 | +#ifdef CONFIG_JUMP_LABEL |
1092 | union { |
1093 | struct static_key_true dd_key_true; |
1094 | struct static_key_false dd_key_false; |
1095 | @@ -83,7 +83,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor, |
1096 | dd_key_init(key, init) \ |
1097 | } |
1098 | |
1099 | -#ifdef HAVE_JUMP_LABEL |
1100 | +#ifdef CONFIG_JUMP_LABEL |
1101 | |
1102 | #define dd_key_init(key, init) key = (init) |
1103 | |
1104 | diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h |
1105 | index 1a0b6f17a5d6..4c3e77687d4e 100644 |
1106 | --- a/include/linux/jump_label.h |
1107 | +++ b/include/linux/jump_label.h |
1108 | @@ -71,10 +71,6 @@ |
1109 | * Additional babbling in: Documentation/static-keys.txt |
1110 | */ |
1111 | |
1112 | -#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) |
1113 | -# define HAVE_JUMP_LABEL |
1114 | -#endif |
1115 | - |
1116 | #ifndef __ASSEMBLY__ |
1117 | |
1118 | #include <linux/types.h> |
1119 | @@ -86,7 +82,7 @@ extern bool static_key_initialized; |
1120 | "%s(): static key '%pS' used before call to jump_label_init()", \ |
1121 | __func__, (key)) |
1122 | |
1123 | -#ifdef HAVE_JUMP_LABEL |
1124 | +#ifdef CONFIG_JUMP_LABEL |
1125 | |
1126 | struct static_key { |
1127 | atomic_t enabled; |
1128 | @@ -114,10 +110,10 @@ struct static_key { |
1129 | struct static_key { |
1130 | atomic_t enabled; |
1131 | }; |
1132 | -#endif /* HAVE_JUMP_LABEL */ |
1133 | +#endif /* CONFIG_JUMP_LABEL */ |
1134 | #endif /* __ASSEMBLY__ */ |
1135 | |
1136 | -#ifdef HAVE_JUMP_LABEL |
1137 | +#ifdef CONFIG_JUMP_LABEL |
1138 | #include <asm/jump_label.h> |
1139 | #endif |
1140 | |
1141 | @@ -130,7 +126,7 @@ enum jump_label_type { |
1142 | |
1143 | struct module; |
1144 | |
1145 | -#ifdef HAVE_JUMP_LABEL |
1146 | +#ifdef CONFIG_JUMP_LABEL |
1147 | |
1148 | #define JUMP_TYPE_FALSE 0UL |
1149 | #define JUMP_TYPE_TRUE 1UL |
1150 | @@ -184,7 +180,7 @@ extern void static_key_disable_cpuslocked(struct static_key *key); |
1151 | { .enabled = { 0 }, \ |
1152 | { .entries = (void *)JUMP_TYPE_FALSE } } |
1153 | |
1154 | -#else /* !HAVE_JUMP_LABEL */ |
1155 | +#else /* !CONFIG_JUMP_LABEL */ |
1156 | |
1157 | #include <linux/atomic.h> |
1158 | #include <linux/bug.h> |
1159 | @@ -271,7 +267,7 @@ static inline void static_key_disable(struct static_key *key) |
1160 | #define STATIC_KEY_INIT_TRUE { .enabled = ATOMIC_INIT(1) } |
1161 | #define STATIC_KEY_INIT_FALSE { .enabled = ATOMIC_INIT(0) } |
1162 | |
1163 | -#endif /* HAVE_JUMP_LABEL */ |
1164 | +#endif /* CONFIG_JUMP_LABEL */ |
1165 | |
1166 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE |
1167 | #define jump_label_enabled static_key_enabled |
1168 | @@ -335,7 +331,7 @@ extern bool ____wrong_branch_error(void); |
1169 | static_key_count((struct static_key *)x) > 0; \ |
1170 | }) |
1171 | |
1172 | -#ifdef HAVE_JUMP_LABEL |
1173 | +#ifdef CONFIG_JUMP_LABEL |
1174 | |
1175 | /* |
1176 | * Combine the right initial value (type) with the right branch order |
1177 | @@ -417,12 +413,12 @@ extern bool ____wrong_branch_error(void); |
1178 | unlikely(branch); \ |
1179 | }) |
1180 | |
1181 | -#else /* !HAVE_JUMP_LABEL */ |
1182 | +#else /* !CONFIG_JUMP_LABEL */ |
1183 | |
1184 | #define static_branch_likely(x) likely(static_key_enabled(&(x)->key)) |
1185 | #define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key)) |
1186 | |
1187 | -#endif /* HAVE_JUMP_LABEL */ |
1188 | +#endif /* CONFIG_JUMP_LABEL */ |
1189 | |
1190 | /* |
1191 | * Advanced usage; refcount, branch is enabled when: count != 0 |
1192 | diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h |
1193 | index baa8eabbaa56..a49f2b45b3f0 100644 |
1194 | --- a/include/linux/jump_label_ratelimit.h |
1195 | +++ b/include/linux/jump_label_ratelimit.h |
1196 | @@ -5,21 +5,19 @@ |
1197 | #include <linux/jump_label.h> |
1198 | #include <linux/workqueue.h> |
1199 | |
1200 | -#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) |
1201 | +#if defined(CONFIG_JUMP_LABEL) |
1202 | struct static_key_deferred { |
1203 | struct static_key key; |
1204 | unsigned long timeout; |
1205 | struct delayed_work work; |
1206 | }; |
1207 | -#endif |
1208 | |
1209 | -#ifdef HAVE_JUMP_LABEL |
1210 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); |
1211 | extern void static_key_deferred_flush(struct static_key_deferred *key); |
1212 | extern void |
1213 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
1214 | |
1215 | -#else /* !HAVE_JUMP_LABEL */ |
1216 | +#else /* !CONFIG_JUMP_LABEL */ |
1217 | struct static_key_deferred { |
1218 | struct static_key key; |
1219 | }; |
1220 | @@ -38,5 +36,5 @@ jump_label_rate_limit(struct static_key_deferred *key, |
1221 | { |
1222 | STATIC_KEY_CHECK_USE(key); |
1223 | } |
1224 | -#endif /* HAVE_JUMP_LABEL */ |
1225 | +#endif /* CONFIG_JUMP_LABEL */ |
1226 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |
1227 | diff --git a/include/linux/module.h b/include/linux/module.h |
1228 | index 904f94628132..c71044644979 100644 |
1229 | --- a/include/linux/module.h |
1230 | +++ b/include/linux/module.h |
1231 | @@ -433,7 +433,7 @@ struct module { |
1232 | unsigned int num_tracepoints; |
1233 | tracepoint_ptr_t *tracepoints_ptrs; |
1234 | #endif |
1235 | -#ifdef HAVE_JUMP_LABEL |
1236 | +#ifdef CONFIG_JUMP_LABEL |
1237 | struct jump_entry *jump_entries; |
1238 | unsigned int num_jump_entries; |
1239 | #endif |
1240 | diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h |
1241 | index bbe99d2b28b4..72cb19c3db6a 100644 |
1242 | --- a/include/linux/netfilter.h |
1243 | +++ b/include/linux/netfilter.h |
1244 | @@ -176,7 +176,7 @@ void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, |
1245 | int nf_register_sockopt(struct nf_sockopt_ops *reg); |
1246 | void nf_unregister_sockopt(struct nf_sockopt_ops *reg); |
1247 | |
1248 | -#ifdef HAVE_JUMP_LABEL |
1249 | +#ifdef CONFIG_JUMP_LABEL |
1250 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
1251 | #endif |
1252 | |
1253 | @@ -198,7 +198,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, |
1254 | struct nf_hook_entries *hook_head = NULL; |
1255 | int ret = 1; |
1256 | |
1257 | -#ifdef HAVE_JUMP_LABEL |
1258 | +#ifdef CONFIG_JUMP_LABEL |
1259 | if (__builtin_constant_p(pf) && |
1260 | __builtin_constant_p(hook) && |
1261 | !static_key_false(&nf_hooks_needed[pf][hook])) |
1262 | diff --git a/include/linux/netfilter_ingress.h b/include/linux/netfilter_ingress.h |
1263 | index 554c920691dd..a13774be2eb5 100644 |
1264 | --- a/include/linux/netfilter_ingress.h |
1265 | +++ b/include/linux/netfilter_ingress.h |
1266 | @@ -8,7 +8,7 @@ |
1267 | #ifdef CONFIG_NETFILTER_INGRESS |
1268 | static inline bool nf_hook_ingress_active(const struct sk_buff *skb) |
1269 | { |
1270 | -#ifdef HAVE_JUMP_LABEL |
1271 | +#ifdef CONFIG_JUMP_LABEL |
1272 | if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS])) |
1273 | return false; |
1274 | #endif |
1275 | diff --git a/include/linux/siphash.h b/include/linux/siphash.h |
1276 | index fa7a6b9cedbf..bf21591a9e5e 100644 |
1277 | --- a/include/linux/siphash.h |
1278 | +++ b/include/linux/siphash.h |
1279 | @@ -21,6 +21,11 @@ typedef struct { |
1280 | u64 key[2]; |
1281 | } siphash_key_t; |
1282 | |
1283 | +static inline bool siphash_key_is_zero(const siphash_key_t *key) |
1284 | +{ |
1285 | + return !(key->key[0] | key->key[1]); |
1286 | +} |
1287 | + |
1288 | u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key); |
1289 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
1290 | u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key); |
1291 | diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h |
1292 | index e47503b4e4d1..622db6bc2f02 100644 |
1293 | --- a/include/net/netns/ipv4.h |
1294 | +++ b/include/net/netns/ipv4.h |
1295 | @@ -9,6 +9,7 @@ |
1296 | #include <linux/uidgid.h> |
1297 | #include <net/inet_frag.h> |
1298 | #include <linux/rcupdate.h> |
1299 | +#include <linux/siphash.h> |
1300 | |
1301 | struct tcpm_hash_bucket; |
1302 | struct ctl_table_header; |
1303 | @@ -214,5 +215,6 @@ struct netns_ipv4 { |
1304 | unsigned int ipmr_seq; /* protected by rtnl_mutex */ |
1305 | |
1306 | atomic_t rt_genid; |
1307 | + siphash_key_t ip_id_key; |
1308 | }; |
1309 | #endif |
1310 | diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h |
1311 | index 4b2c93b1934c..4955e1a9f1bc 100644 |
1312 | --- a/include/uapi/linux/tipc_config.h |
1313 | +++ b/include/uapi/linux/tipc_config.h |
1314 | @@ -307,8 +307,10 @@ static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) |
1315 | tlv_ptr = (struct tlv_desc *)tlv; |
1316 | tlv_ptr->tlv_type = htons(type); |
1317 | tlv_ptr->tlv_len = htons(tlv_len); |
1318 | - if (len && data) |
1319 | - memcpy(TLV_DATA(tlv_ptr), data, tlv_len); |
1320 | + if (len && data) { |
1321 | + memcpy(TLV_DATA(tlv_ptr), data, len); |
1322 | + memset(TLV_DATA(tlv_ptr) + len, 0, TLV_SPACE(len) - tlv_len); |
1323 | + } |
1324 | return TLV_SPACE(len); |
1325 | } |
1326 | |
1327 | @@ -405,8 +407,10 @@ static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags, |
1328 | tcm_hdr->tcm_len = htonl(msg_len); |
1329 | tcm_hdr->tcm_type = htons(cmd); |
1330 | tcm_hdr->tcm_flags = htons(flags); |
1331 | - if (data_len && data) |
1332 | + if (data_len && data) { |
1333 | memcpy(TCM_DATA(msg), data, data_len); |
1334 | + memset(TCM_DATA(msg) + data_len, 0, TCM_SPACE(data_len) - msg_len); |
1335 | + } |
1336 | return TCM_SPACE(data_len); |
1337 | } |
1338 | |
1339 | diff --git a/init/Kconfig b/init/Kconfig |
1340 | index 864af10bb1b9..47035b5a46f6 100644 |
1341 | --- a/init/Kconfig |
1342 | +++ b/init/Kconfig |
1343 | @@ -23,6 +23,9 @@ config CLANG_VERSION |
1344 | int |
1345 | default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) |
1346 | |
1347 | +config CC_HAS_ASM_GOTO |
1348 | + def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) |
1349 | + |
1350 | config CONSTRUCTORS |
1351 | bool |
1352 | depends on !UML |
1353 | diff --git a/kernel/jump_label.c b/kernel/jump_label.c |
1354 | index 2e62503bea0d..7c8262635b29 100644 |
1355 | --- a/kernel/jump_label.c |
1356 | +++ b/kernel/jump_label.c |
1357 | @@ -18,8 +18,6 @@ |
1358 | #include <linux/cpu.h> |
1359 | #include <asm/sections.h> |
1360 | |
1361 | -#ifdef HAVE_JUMP_LABEL |
1362 | - |
1363 | /* mutex to protect coming/going of the the jump_label table */ |
1364 | static DEFINE_MUTEX(jump_label_mutex); |
1365 | |
1366 | @@ -60,13 +58,13 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop) |
1367 | static void jump_label_update(struct static_key *key); |
1368 | |
1369 | /* |
1370 | - * There are similar definitions for the !HAVE_JUMP_LABEL case in jump_label.h. |
1371 | + * There are similar definitions for the !CONFIG_JUMP_LABEL case in jump_label.h. |
1372 | * The use of 'atomic_read()' requires atomic.h and its problematic for some |
1373 | * kernel headers such as kernel.h and others. Since static_key_count() is not |
1374 | - * used in the branch statements as it is for the !HAVE_JUMP_LABEL case its ok |
1375 | + * used in the branch statements as it is for the !CONFIG_JUMP_LABEL case its ok |
1376 | * to have it be a function here. Similarly, for 'static_key_enable()' and |
1377 | * 'static_key_disable()', which require bug.h. This should allow jump_label.h |
1378 | - * to be included from most/all places for HAVE_JUMP_LABEL. |
1379 | + * to be included from most/all places for CONFIG_JUMP_LABEL. |
1380 | */ |
1381 | int static_key_count(struct static_key *key) |
1382 | { |
1383 | @@ -796,5 +794,3 @@ static __init int jump_label_test(void) |
1384 | } |
1385 | early_initcall(jump_label_test); |
1386 | #endif /* STATIC_KEYS_SELFTEST */ |
1387 | - |
1388 | -#endif /* HAVE_JUMP_LABEL */ |
1389 | diff --git a/kernel/module.c b/kernel/module.c |
1390 | index f797c6ace712..b8f37376856b 100644 |
1391 | --- a/kernel/module.c |
1392 | +++ b/kernel/module.c |
1393 | @@ -3100,7 +3100,7 @@ static int find_module_sections(struct module *mod, struct load_info *info) |
1394 | sizeof(*mod->tracepoints_ptrs), |
1395 | &mod->num_tracepoints); |
1396 | #endif |
1397 | -#ifdef HAVE_JUMP_LABEL |
1398 | +#ifdef CONFIG_JUMP_LABEL |
1399 | mod->jump_entries = section_objs(info, "__jump_table", |
1400 | sizeof(*mod->jump_entries), |
1401 | &mod->num_jump_entries); |
1402 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
1403 | index 6138754e5030..6859ea1d5c04 100644 |
1404 | --- a/kernel/sched/core.c |
1405 | +++ b/kernel/sched/core.c |
1406 | @@ -24,7 +24,7 @@ |
1407 | |
1408 | DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); |
1409 | |
1410 | -#if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL) |
1411 | +#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
1412 | /* |
1413 | * Debugging: various feature bits |
1414 | * |
1415 | diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c |
1416 | index 141ea9ff210e..78fadf0438ea 100644 |
1417 | --- a/kernel/sched/debug.c |
1418 | +++ b/kernel/sched/debug.c |
1419 | @@ -73,7 +73,7 @@ static int sched_feat_show(struct seq_file *m, void *v) |
1420 | return 0; |
1421 | } |
1422 | |
1423 | -#ifdef HAVE_JUMP_LABEL |
1424 | +#ifdef CONFIG_JUMP_LABEL |
1425 | |
1426 | #define jump_label_key__true STATIC_KEY_INIT_TRUE |
1427 | #define jump_label_key__false STATIC_KEY_INIT_FALSE |
1428 | @@ -99,7 +99,7 @@ static void sched_feat_enable(int i) |
1429 | #else |
1430 | static void sched_feat_disable(int i) { }; |
1431 | static void sched_feat_enable(int i) { }; |
1432 | -#endif /* HAVE_JUMP_LABEL */ |
1433 | +#endif /* CONFIG_JUMP_LABEL */ |
1434 | |
1435 | static int sched_feat_set(char *cmp) |
1436 | { |
1437 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
1438 | index 7a1e9db617f7..4a433608ba74 100644 |
1439 | --- a/kernel/sched/fair.c |
1440 | +++ b/kernel/sched/fair.c |
1441 | @@ -4209,7 +4209,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) |
1442 | |
1443 | #ifdef CONFIG_CFS_BANDWIDTH |
1444 | |
1445 | -#ifdef HAVE_JUMP_LABEL |
1446 | +#ifdef CONFIG_JUMP_LABEL |
1447 | static struct static_key __cfs_bandwidth_used; |
1448 | |
1449 | static inline bool cfs_bandwidth_used(void) |
1450 | @@ -4226,7 +4226,7 @@ void cfs_bandwidth_usage_dec(void) |
1451 | { |
1452 | static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used); |
1453 | } |
1454 | -#else /* HAVE_JUMP_LABEL */ |
1455 | +#else /* CONFIG_JUMP_LABEL */ |
1456 | static bool cfs_bandwidth_used(void) |
1457 | { |
1458 | return true; |
1459 | @@ -4234,7 +4234,7 @@ static bool cfs_bandwidth_used(void) |
1460 | |
1461 | void cfs_bandwidth_usage_inc(void) {} |
1462 | void cfs_bandwidth_usage_dec(void) {} |
1463 | -#endif /* HAVE_JUMP_LABEL */ |
1464 | +#endif /* CONFIG_JUMP_LABEL */ |
1465 | |
1466 | /* |
1467 | * default period for cfs group bandwidth. |
1468 | diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
1469 | index 4c7a837d7c14..9a7c3d08b39f 100644 |
1470 | --- a/kernel/sched/sched.h |
1471 | +++ b/kernel/sched/sched.h |
1472 | @@ -1359,7 +1359,7 @@ enum { |
1473 | |
1474 | #undef SCHED_FEAT |
1475 | |
1476 | -#if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL) |
1477 | +#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
1478 | |
1479 | /* |
1480 | * To support run-time toggling of sched features, all the translation units |
1481 | @@ -1379,7 +1379,7 @@ static __always_inline bool static_branch_##name(struct static_key *key) \ |
1482 | extern struct static_key sched_feat_keys[__SCHED_FEAT_NR]; |
1483 | #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) |
1484 | |
1485 | -#else /* !(SCHED_DEBUG && HAVE_JUMP_LABEL) */ |
1486 | +#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ |
1487 | |
1488 | /* |
1489 | * Each translation unit has its own copy of sysctl_sched_features to allow |
1490 | @@ -1395,7 +1395,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features = |
1491 | |
1492 | #define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) |
1493 | |
1494 | -#endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */ |
1495 | +#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ |
1496 | |
1497 | extern struct static_key_false sched_numa_balancing; |
1498 | extern struct static_key_false sched_schedstats; |
1499 | diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
1500 | index c7c96bc7654a..dbf2b457e47e 100644 |
1501 | --- a/lib/dynamic_debug.c |
1502 | +++ b/lib/dynamic_debug.c |
1503 | @@ -188,7 +188,7 @@ static int ddebug_change(const struct ddebug_query *query, |
1504 | newflags = (dp->flags & mask) | flags; |
1505 | if (newflags == dp->flags) |
1506 | continue; |
1507 | -#ifdef HAVE_JUMP_LABEL |
1508 | +#ifdef CONFIG_JUMP_LABEL |
1509 | if (dp->flags & _DPRINTK_FLAGS_PRINT) { |
1510 | if (!(flags & _DPRINTK_FLAGS_PRINT)) |
1511 | static_branch_disable(&dp->key.dd_key_true); |
1512 | diff --git a/net/core/dev.c b/net/core/dev.c |
1513 | index 13a82744a00a..138951d28643 100644 |
1514 | --- a/net/core/dev.c |
1515 | +++ b/net/core/dev.c |
1516 | @@ -1821,7 +1821,7 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue); |
1517 | #endif |
1518 | |
1519 | static DEFINE_STATIC_KEY_FALSE(netstamp_needed_key); |
1520 | -#ifdef HAVE_JUMP_LABEL |
1521 | +#ifdef CONFIG_JUMP_LABEL |
1522 | static atomic_t netstamp_needed_deferred; |
1523 | static atomic_t netstamp_wanted; |
1524 | static void netstamp_clear(struct work_struct *work) |
1525 | @@ -1840,7 +1840,7 @@ static DECLARE_WORK(netstamp_work, netstamp_clear); |
1526 | |
1527 | void net_enable_timestamp(void) |
1528 | { |
1529 | -#ifdef HAVE_JUMP_LABEL |
1530 | +#ifdef CONFIG_JUMP_LABEL |
1531 | int wanted; |
1532 | |
1533 | while (1) { |
1534 | @@ -1860,7 +1860,7 @@ EXPORT_SYMBOL(net_enable_timestamp); |
1535 | |
1536 | void net_disable_timestamp(void) |
1537 | { |
1538 | -#ifdef HAVE_JUMP_LABEL |
1539 | +#ifdef CONFIG_JUMP_LABEL |
1540 | int wanted; |
1541 | |
1542 | while (1) { |
1543 | @@ -5725,7 +5725,6 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi) |
1544 | skb_reset_mac_header(skb); |
1545 | skb_gro_reset_offset(skb); |
1546 | |
1547 | - eth = skb_gro_header_fast(skb, 0); |
1548 | if (unlikely(skb_gro_header_hard(skb, hlen))) { |
1549 | eth = skb_gro_header_slow(skb, hlen, 0); |
1550 | if (unlikely(!eth)) { |
1551 | @@ -5735,6 +5734,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi) |
1552 | return NULL; |
1553 | } |
1554 | } else { |
1555 | + eth = (const struct ethhdr *)skb->data; |
1556 | gro_pull_from_frag0(skb, hlen); |
1557 | NAPI_GRO_CB(skb)->frag0 += hlen; |
1558 | NAPI_GRO_CB(skb)->frag0_len -= hlen; |
1559 | diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
1560 | index 4da39446da2d..d187ee8156a1 100644 |
1561 | --- a/net/ipv4/igmp.c |
1562 | +++ b/net/ipv4/igmp.c |
1563 | @@ -190,6 +190,17 @@ static void ip_ma_put(struct ip_mc_list *im) |
1564 | pmc != NULL; \ |
1565 | pmc = rtnl_dereference(pmc->next_rcu)) |
1566 | |
1567 | +static void ip_sf_list_clear_all(struct ip_sf_list *psf) |
1568 | +{ |
1569 | + struct ip_sf_list *next; |
1570 | + |
1571 | + while (psf) { |
1572 | + next = psf->sf_next; |
1573 | + kfree(psf); |
1574 | + psf = next; |
1575 | + } |
1576 | +} |
1577 | + |
1578 | #ifdef CONFIG_IP_MULTICAST |
1579 | |
1580 | /* |
1581 | @@ -635,6 +646,13 @@ static void igmpv3_clear_zeros(struct ip_sf_list **ppsf) |
1582 | } |
1583 | } |
1584 | |
1585 | +static void kfree_pmc(struct ip_mc_list *pmc) |
1586 | +{ |
1587 | + ip_sf_list_clear_all(pmc->sources); |
1588 | + ip_sf_list_clear_all(pmc->tomb); |
1589 | + kfree(pmc); |
1590 | +} |
1591 | + |
1592 | static void igmpv3_send_cr(struct in_device *in_dev) |
1593 | { |
1594 | struct ip_mc_list *pmc, *pmc_prev, *pmc_next; |
1595 | @@ -671,7 +689,7 @@ static void igmpv3_send_cr(struct in_device *in_dev) |
1596 | else |
1597 | in_dev->mc_tomb = pmc_next; |
1598 | in_dev_put(pmc->interface); |
1599 | - kfree(pmc); |
1600 | + kfree_pmc(pmc); |
1601 | } else |
1602 | pmc_prev = pmc; |
1603 | } |
1604 | @@ -1201,14 +1219,18 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im) |
1605 | im->interface = pmc->interface; |
1606 | if (im->sfmode == MCAST_INCLUDE) { |
1607 | im->tomb = pmc->tomb; |
1608 | + pmc->tomb = NULL; |
1609 | + |
1610 | im->sources = pmc->sources; |
1611 | + pmc->sources = NULL; |
1612 | + |
1613 | for (psf = im->sources; psf; psf = psf->sf_next) |
1614 | psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; |
1615 | } else { |
1616 | im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; |
1617 | } |
1618 | in_dev_put(pmc->interface); |
1619 | - kfree(pmc); |
1620 | + kfree_pmc(pmc); |
1621 | } |
1622 | spin_unlock_bh(&im->lock); |
1623 | } |
1624 | @@ -1229,21 +1251,18 @@ static void igmpv3_clear_delrec(struct in_device *in_dev) |
1625 | nextpmc = pmc->next; |
1626 | ip_mc_clear_src(pmc); |
1627 | in_dev_put(pmc->interface); |
1628 | - kfree(pmc); |
1629 | + kfree_pmc(pmc); |
1630 | } |
1631 | /* clear dead sources, too */ |
1632 | rcu_read_lock(); |
1633 | for_each_pmc_rcu(in_dev, pmc) { |
1634 | - struct ip_sf_list *psf, *psf_next; |
1635 | + struct ip_sf_list *psf; |
1636 | |
1637 | spin_lock_bh(&pmc->lock); |
1638 | psf = pmc->tomb; |
1639 | pmc->tomb = NULL; |
1640 | spin_unlock_bh(&pmc->lock); |
1641 | - for (; psf; psf = psf_next) { |
1642 | - psf_next = psf->sf_next; |
1643 | - kfree(psf); |
1644 | - } |
1645 | + ip_sf_list_clear_all(psf); |
1646 | } |
1647 | rcu_read_unlock(); |
1648 | } |
1649 | @@ -2114,7 +2133,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1650 | |
1651 | static void ip_mc_clear_src(struct ip_mc_list *pmc) |
1652 | { |
1653 | - struct ip_sf_list *psf, *nextpsf, *tomb, *sources; |
1654 | + struct ip_sf_list *tomb, *sources; |
1655 | |
1656 | spin_lock_bh(&pmc->lock); |
1657 | tomb = pmc->tomb; |
1658 | @@ -2126,14 +2145,8 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc) |
1659 | pmc->sfcount[MCAST_EXCLUDE] = 1; |
1660 | spin_unlock_bh(&pmc->lock); |
1661 | |
1662 | - for (psf = tomb; psf; psf = nextpsf) { |
1663 | - nextpsf = psf->sf_next; |
1664 | - kfree(psf); |
1665 | - } |
1666 | - for (psf = sources; psf; psf = nextpsf) { |
1667 | - nextpsf = psf->sf_next; |
1668 | - kfree(psf); |
1669 | - } |
1670 | + ip_sf_list_clear_all(tomb); |
1671 | + ip_sf_list_clear_all(sources); |
1672 | } |
1673 | |
1674 | /* Join a multicast group |
1675 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
1676 | index 8bacbcd2db90..40bf19f7ae1a 100644 |
1677 | --- a/net/ipv4/route.c |
1678 | +++ b/net/ipv4/route.c |
1679 | @@ -500,15 +500,17 @@ EXPORT_SYMBOL(ip_idents_reserve); |
1680 | |
1681 | void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) |
1682 | { |
1683 | - static u32 ip_idents_hashrnd __read_mostly; |
1684 | u32 hash, id; |
1685 | |
1686 | - net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd)); |
1687 | + /* Note the following code is not safe, but this is okay. */ |
1688 | + if (unlikely(siphash_key_is_zero(&net->ipv4.ip_id_key))) |
1689 | + get_random_bytes(&net->ipv4.ip_id_key, |
1690 | + sizeof(net->ipv4.ip_id_key)); |
1691 | |
1692 | - hash = jhash_3words((__force u32)iph->daddr, |
1693 | + hash = siphash_3u32((__force u32)iph->daddr, |
1694 | (__force u32)iph->saddr, |
1695 | - iph->protocol ^ net_hash_mix(net), |
1696 | - ip_idents_hashrnd); |
1697 | + iph->protocol, |
1698 | + &net->ipv4.ip_id_key); |
1699 | id = ip_idents_reserve(hash, segs); |
1700 | iph->id = htons(id); |
1701 | } |
1702 | diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c |
1703 | index 4fe7c90962dd..868ae23dbae1 100644 |
1704 | --- a/net/ipv6/output_core.c |
1705 | +++ b/net/ipv6/output_core.c |
1706 | @@ -10,15 +10,25 @@ |
1707 | #include <net/secure_seq.h> |
1708 | #include <linux/netfilter.h> |
1709 | |
1710 | -static u32 __ipv6_select_ident(struct net *net, u32 hashrnd, |
1711 | +static u32 __ipv6_select_ident(struct net *net, |
1712 | const struct in6_addr *dst, |
1713 | const struct in6_addr *src) |
1714 | { |
1715 | + const struct { |
1716 | + struct in6_addr dst; |
1717 | + struct in6_addr src; |
1718 | + } __aligned(SIPHASH_ALIGNMENT) combined = { |
1719 | + .dst = *dst, |
1720 | + .src = *src, |
1721 | + }; |
1722 | u32 hash, id; |
1723 | |
1724 | - hash = __ipv6_addr_jhash(dst, hashrnd); |
1725 | - hash = __ipv6_addr_jhash(src, hash); |
1726 | - hash ^= net_hash_mix(net); |
1727 | + /* Note the following code is not safe, but this is okay. */ |
1728 | + if (unlikely(siphash_key_is_zero(&net->ipv4.ip_id_key))) |
1729 | + get_random_bytes(&net->ipv4.ip_id_key, |
1730 | + sizeof(net->ipv4.ip_id_key)); |
1731 | + |
1732 | + hash = siphash(&combined, sizeof(combined), &net->ipv4.ip_id_key); |
1733 | |
1734 | /* Treat id of 0 as unset and if we get 0 back from ip_idents_reserve, |
1735 | * set the hight order instead thus minimizing possible future |
1736 | @@ -41,7 +51,6 @@ static u32 __ipv6_select_ident(struct net *net, u32 hashrnd, |
1737 | */ |
1738 | __be32 ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb) |
1739 | { |
1740 | - static u32 ip6_proxy_idents_hashrnd __read_mostly; |
1741 | struct in6_addr buf[2]; |
1742 | struct in6_addr *addrs; |
1743 | u32 id; |
1744 | @@ -53,11 +62,7 @@ __be32 ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb) |
1745 | if (!addrs) |
1746 | return 0; |
1747 | |
1748 | - net_get_random_once(&ip6_proxy_idents_hashrnd, |
1749 | - sizeof(ip6_proxy_idents_hashrnd)); |
1750 | - |
1751 | - id = __ipv6_select_ident(net, ip6_proxy_idents_hashrnd, |
1752 | - &addrs[1], &addrs[0]); |
1753 | + id = __ipv6_select_ident(net, &addrs[1], &addrs[0]); |
1754 | return htonl(id); |
1755 | } |
1756 | EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); |
1757 | @@ -66,12 +71,9 @@ __be32 ipv6_select_ident(struct net *net, |
1758 | const struct in6_addr *daddr, |
1759 | const struct in6_addr *saddr) |
1760 | { |
1761 | - static u32 ip6_idents_hashrnd __read_mostly; |
1762 | u32 id; |
1763 | |
1764 | - net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); |
1765 | - |
1766 | - id = __ipv6_select_ident(net, ip6_idents_hashrnd, daddr, saddr); |
1767 | + id = __ipv6_select_ident(net, daddr, saddr); |
1768 | return htonl(id); |
1769 | } |
1770 | EXPORT_SYMBOL(ipv6_select_ident); |
1771 | diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c |
1772 | index 5e0efd3954e9..5833d4af7311 100644 |
1773 | --- a/net/ipv6/raw.c |
1774 | +++ b/net/ipv6/raw.c |
1775 | @@ -288,7 +288,9 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
1776 | /* Binding to link-local address requires an interface */ |
1777 | if (!sk->sk_bound_dev_if) |
1778 | goto out_unlock; |
1779 | + } |
1780 | |
1781 | + if (sk->sk_bound_dev_if) { |
1782 | err = -ENODEV; |
1783 | dev = dev_get_by_index_rcu(sock_net(sk), |
1784 | sk->sk_bound_dev_if); |
1785 | diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
1786 | index bf0940c42810..24f7b2cf504b 100644 |
1787 | --- a/net/ipv6/route.c |
1788 | +++ b/net/ipv6/route.c |
1789 | @@ -2480,6 +2480,12 @@ static struct rt6_info *__ip6_route_redirect(struct net *net, |
1790 | struct fib6_info *rt; |
1791 | struct fib6_node *fn; |
1792 | |
1793 | + /* l3mdev_update_flow overrides oif if the device is enslaved; in |
1794 | + * this case we must match on the real ingress device, so reset it |
1795 | + */ |
1796 | + if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF) |
1797 | + fl6->flowi6_oif = skb->dev->ifindex; |
1798 | + |
1799 | /* Get the "current" route for this destination and |
1800 | * check if the redirect has come from appropriate router. |
1801 | * |
1802 | diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c |
1803 | index 94425e421213..9e4b6bcf6920 100644 |
1804 | --- a/net/llc/llc_output.c |
1805 | +++ b/net/llc/llc_output.c |
1806 | @@ -72,6 +72,8 @@ int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, |
1807 | rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac); |
1808 | if (likely(!rc)) |
1809 | rc = dev_queue_xmit(skb); |
1810 | + else |
1811 | + kfree_skb(skb); |
1812 | return rc; |
1813 | } |
1814 | |
1815 | diff --git a/net/netfilter/core.c b/net/netfilter/core.c |
1816 | index dc240cb47ddf..93aaec3a54ec 100644 |
1817 | --- a/net/netfilter/core.c |
1818 | +++ b/net/netfilter/core.c |
1819 | @@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(nf_ipv6_ops); |
1820 | DEFINE_PER_CPU(bool, nf_skb_duplicated); |
1821 | EXPORT_SYMBOL_GPL(nf_skb_duplicated); |
1822 | |
1823 | -#ifdef HAVE_JUMP_LABEL |
1824 | +#ifdef CONFIG_JUMP_LABEL |
1825 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
1826 | EXPORT_SYMBOL(nf_hooks_needed); |
1827 | #endif |
1828 | @@ -347,7 +347,7 @@ static int __nf_register_net_hook(struct net *net, int pf, |
1829 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) |
1830 | net_inc_ingress_queue(); |
1831 | #endif |
1832 | -#ifdef HAVE_JUMP_LABEL |
1833 | +#ifdef CONFIG_JUMP_LABEL |
1834 | static_key_slow_inc(&nf_hooks_needed[pf][reg->hooknum]); |
1835 | #endif |
1836 | BUG_ON(p == new_hooks); |
1837 | @@ -405,7 +405,7 @@ static void __nf_unregister_net_hook(struct net *net, int pf, |
1838 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) |
1839 | net_dec_ingress_queue(); |
1840 | #endif |
1841 | -#ifdef HAVE_JUMP_LABEL |
1842 | +#ifdef CONFIG_JUMP_LABEL |
1843 | static_key_slow_dec(&nf_hooks_needed[pf][reg->hooknum]); |
1844 | #endif |
1845 | } else { |
1846 | diff --git a/net/sched/act_api.c b/net/sched/act_api.c |
1847 | index e12f8ef7baa4..7c4a4b874248 100644 |
1848 | --- a/net/sched/act_api.c |
1849 | +++ b/net/sched/act_api.c |
1850 | @@ -744,7 +744,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], |
1851 | |
1852 | for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { |
1853 | a = actions[i]; |
1854 | - nest = nla_nest_start(skb, a->order); |
1855 | + nest = nla_nest_start(skb, i + 1); |
1856 | if (nest == NULL) |
1857 | goto nla_put_failure; |
1858 | err = tcf_action_dump_1(skb, a, bind, ref); |
1859 | @@ -1257,7 +1257,6 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, |
1860 | ret = PTR_ERR(act); |
1861 | goto err; |
1862 | } |
1863 | - act->order = i; |
1864 | attr_size += tcf_action_fill_size(act); |
1865 | actions[i - 1] = act; |
1866 | } |
1867 | diff --git a/net/tipc/core.c b/net/tipc/core.c |
1868 | index d7b0688c98dd..3ecca3b88bf8 100644 |
1869 | --- a/net/tipc/core.c |
1870 | +++ b/net/tipc/core.c |
1871 | @@ -66,10 +66,6 @@ static int __net_init tipc_init_net(struct net *net) |
1872 | INIT_LIST_HEAD(&tn->node_list); |
1873 | spin_lock_init(&tn->node_list_lock); |
1874 | |
1875 | - err = tipc_socket_init(); |
1876 | - if (err) |
1877 | - goto out_socket; |
1878 | - |
1879 | err = tipc_sk_rht_init(net); |
1880 | if (err) |
1881 | goto out_sk_rht; |
1882 | @@ -79,9 +75,6 @@ static int __net_init tipc_init_net(struct net *net) |
1883 | goto out_nametbl; |
1884 | |
1885 | INIT_LIST_HEAD(&tn->dist_queue); |
1886 | - err = tipc_topsrv_start(net); |
1887 | - if (err) |
1888 | - goto out_subscr; |
1889 | |
1890 | err = tipc_bcast_init(net); |
1891 | if (err) |
1892 | @@ -90,25 +83,19 @@ static int __net_init tipc_init_net(struct net *net) |
1893 | return 0; |
1894 | |
1895 | out_bclink: |
1896 | - tipc_bcast_stop(net); |
1897 | -out_subscr: |
1898 | tipc_nametbl_stop(net); |
1899 | out_nametbl: |
1900 | tipc_sk_rht_destroy(net); |
1901 | out_sk_rht: |
1902 | - tipc_socket_stop(); |
1903 | -out_socket: |
1904 | return err; |
1905 | } |
1906 | |
1907 | static void __net_exit tipc_exit_net(struct net *net) |
1908 | { |
1909 | - tipc_topsrv_stop(net); |
1910 | tipc_net_stop(net); |
1911 | tipc_bcast_stop(net); |
1912 | tipc_nametbl_stop(net); |
1913 | tipc_sk_rht_destroy(net); |
1914 | - tipc_socket_stop(); |
1915 | } |
1916 | |
1917 | static struct pernet_operations tipc_net_ops = { |
1918 | @@ -118,6 +105,11 @@ static struct pernet_operations tipc_net_ops = { |
1919 | .size = sizeof(struct tipc_net), |
1920 | }; |
1921 | |
1922 | +static struct pernet_operations tipc_topsrv_net_ops = { |
1923 | + .init = tipc_topsrv_init_net, |
1924 | + .exit = tipc_topsrv_exit_net, |
1925 | +}; |
1926 | + |
1927 | static int __init tipc_init(void) |
1928 | { |
1929 | int err; |
1930 | @@ -144,6 +136,14 @@ static int __init tipc_init(void) |
1931 | if (err) |
1932 | goto out_pernet; |
1933 | |
1934 | + err = tipc_socket_init(); |
1935 | + if (err) |
1936 | + goto out_socket; |
1937 | + |
1938 | + err = register_pernet_subsys(&tipc_topsrv_net_ops); |
1939 | + if (err) |
1940 | + goto out_pernet_topsrv; |
1941 | + |
1942 | err = tipc_bearer_setup(); |
1943 | if (err) |
1944 | goto out_bearer; |
1945 | @@ -151,6 +151,10 @@ static int __init tipc_init(void) |
1946 | pr_info("Started in single node mode\n"); |
1947 | return 0; |
1948 | out_bearer: |
1949 | + unregister_pernet_subsys(&tipc_topsrv_net_ops); |
1950 | +out_pernet_topsrv: |
1951 | + tipc_socket_stop(); |
1952 | +out_socket: |
1953 | unregister_pernet_subsys(&tipc_net_ops); |
1954 | out_pernet: |
1955 | tipc_unregister_sysctl(); |
1956 | @@ -166,6 +170,8 @@ out_netlink: |
1957 | static void __exit tipc_exit(void) |
1958 | { |
1959 | tipc_bearer_cleanup(); |
1960 | + unregister_pernet_subsys(&tipc_topsrv_net_ops); |
1961 | + tipc_socket_stop(); |
1962 | unregister_pernet_subsys(&tipc_net_ops); |
1963 | tipc_netlink_stop(); |
1964 | tipc_netlink_compat_stop(); |
1965 | diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h |
1966 | index d793b4343885..aa015c233898 100644 |
1967 | --- a/net/tipc/subscr.h |
1968 | +++ b/net/tipc/subscr.h |
1969 | @@ -77,8 +77,9 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub, |
1970 | u32 found_lower, u32 found_upper, |
1971 | u32 event, u32 port, u32 node, |
1972 | u32 scope, int must); |
1973 | -int tipc_topsrv_start(struct net *net); |
1974 | -void tipc_topsrv_stop(struct net *net); |
1975 | + |
1976 | +int __net_init tipc_topsrv_init_net(struct net *net); |
1977 | +void __net_exit tipc_topsrv_exit_net(struct net *net); |
1978 | |
1979 | void tipc_sub_put(struct tipc_subscription *subscription); |
1980 | void tipc_sub_get(struct tipc_subscription *subscription); |
1981 | diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c |
1982 | index 2301b09df234..35558656fe02 100644 |
1983 | --- a/net/tipc/topsrv.c |
1984 | +++ b/net/tipc/topsrv.c |
1985 | @@ -643,7 +643,7 @@ static void tipc_topsrv_work_stop(struct tipc_topsrv *s) |
1986 | destroy_workqueue(s->send_wq); |
1987 | } |
1988 | |
1989 | -int tipc_topsrv_start(struct net *net) |
1990 | +static int tipc_topsrv_start(struct net *net) |
1991 | { |
1992 | struct tipc_net *tn = tipc_net(net); |
1993 | const char name[] = "topology_server"; |
1994 | @@ -677,7 +677,7 @@ int tipc_topsrv_start(struct net *net) |
1995 | return ret; |
1996 | } |
1997 | |
1998 | -void tipc_topsrv_stop(struct net *net) |
1999 | +static void tipc_topsrv_stop(struct net *net) |
2000 | { |
2001 | struct tipc_topsrv *srv = tipc_topsrv(net); |
2002 | struct socket *lsock = srv->listener; |
2003 | @@ -702,3 +702,13 @@ void tipc_topsrv_stop(struct net *net) |
2004 | idr_destroy(&srv->conn_idr); |
2005 | kfree(srv); |
2006 | } |
2007 | + |
2008 | +int __net_init tipc_topsrv_init_net(struct net *net) |
2009 | +{ |
2010 | + return tipc_topsrv_start(net); |
2011 | +} |
2012 | + |
2013 | +void __net_exit tipc_topsrv_exit_net(struct net *net) |
2014 | +{ |
2015 | + tipc_topsrv_stop(net); |
2016 | +} |
2017 | diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
2018 | index fdf22cb0b3e6..8035bf495eb2 100644 |
2019 | --- a/net/tls/tls_device.c |
2020 | +++ b/net/tls/tls_device.c |
2021 | @@ -916,12 +916,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk) |
2022 | if (!netdev) |
2023 | goto out; |
2024 | |
2025 | - if (!(netdev->features & NETIF_F_HW_TLS_RX)) { |
2026 | - pr_err_ratelimited("%s: device is missing NETIF_F_HW_TLS_RX cap\n", |
2027 | - __func__); |
2028 | - goto out; |
2029 | - } |
2030 | - |
2031 | netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx, |
2032 | TLS_OFFLOAD_CTX_DIR_RX); |
2033 | |
2034 | @@ -980,7 +974,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event, |
2035 | { |
2036 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2037 | |
2038 | - if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX))) |
2039 | + if (!dev->tlsdev_ops && |
2040 | + !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX))) |
2041 | return NOTIFY_DONE; |
2042 | |
2043 | switch (event) { |
2044 | diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh |
2045 | index 083c526073ef..8b980fb2270a 100755 |
2046 | --- a/scripts/gcc-goto.sh |
2047 | +++ b/scripts/gcc-goto.sh |
2048 | @@ -3,7 +3,7 @@ |
2049 | # Test for gcc 'asm goto' support |
2050 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> |
2051 | |
2052 | -cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" |
2053 | +cat << "END" | $@ -x c - -fno-PIE -c -o /dev/null |
2054 | int main(void) |
2055 | { |
2056 | #if defined(__arm__) || defined(__aarch64__) |
2057 | diff --git a/tools/arch/x86/include/asm/rmwcc.h b/tools/arch/x86/include/asm/rmwcc.h |
2058 | index dc90c0c2fae3..fee7983a90b4 100644 |
2059 | --- a/tools/arch/x86/include/asm/rmwcc.h |
2060 | +++ b/tools/arch/x86/include/asm/rmwcc.h |
2061 | @@ -2,7 +2,7 @@ |
2062 | #ifndef _TOOLS_LINUX_ASM_X86_RMWcc |
2063 | #define _TOOLS_LINUX_ASM_X86_RMWcc |
2064 | |
2065 | -#ifdef CC_HAVE_ASM_GOTO |
2066 | +#ifdef CONFIG_CC_HAS_ASM_GOTO |
2067 | |
2068 | #define __GEN_RMWcc(fullop, var, cc, ...) \ |
2069 | do { \ |
2070 | @@ -20,7 +20,7 @@ cc_label: \ |
2071 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
2072 | __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val)) |
2073 | |
2074 | -#else /* !CC_HAVE_ASM_GOTO */ |
2075 | +#else /* !CONFIG_CC_HAS_ASM_GOTO */ |
2076 | |
2077 | #define __GEN_RMWcc(fullop, var, cc, ...) \ |
2078 | do { \ |
2079 | @@ -37,6 +37,6 @@ do { \ |
2080 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
2081 | __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val)) |
2082 | |
2083 | -#endif /* CC_HAVE_ASM_GOTO */ |
2084 | +#endif /* CONFIG_CC_HAS_ASM_GOTO */ |
2085 | |
2086 | #endif /* _TOOLS_LINUX_ASM_X86_RMWcc */ |