Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sun, 04 Nov 2018 17:31:21
Message-Id: 1541352643.45625e29ac9ee0956e90c0063b880573bbbca0f9.alicef@gentoo
1 commit: 45625e29ac9ee0956e90c0063b880573bbbca0f9
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 4 17:30:43 2018 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 4 17:30:43 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=45625e29
7
8 linux kernel 4.14.79
9
10 0000_README | 4 +
11 1078_linux-4.14.79.patch | 4661 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 4665 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 509ffd2..319ee36 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -355,6 +355,10 @@ Patch: 1077_linux-4.14.78.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.14.78
21
22 +Patch: 1078_linux-4.14.79.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.14.79
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1078_linux-4.14.79.patch b/1078_linux-4.14.79.patch
31 new file mode 100644
32 index 0000000..e13487a
33 --- /dev/null
34 +++ b/1078_linux-4.14.79.patch
35 @@ -0,0 +1,4661 @@
36 +diff --git a/Makefile b/Makefile
37 +index 89574ee68d6b..57a007bf1181 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,7 +1,7 @@
41 + # SPDX-License-Identifier: GPL-2.0
42 + VERSION = 4
43 + PATCHLEVEL = 14
44 +-SUBLEVEL = 78
45 ++SUBLEVEL = 79
46 + EXTRAVERSION =
47 + NAME = Petit Gorille
48 +
49 +@@ -487,6 +487,8 @@ CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN)
50 + endif
51 + KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
52 + KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
53 ++KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
54 ++KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
55 + endif
56 +
57 + RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
58 +@@ -721,8 +723,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
59 + # See modpost pattern 2
60 + KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
61 + KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
62 +-KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
63 +-KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
64 + else
65 +
66 + # These warnings generated too much noise in a regular build.
67 +diff --git a/arch/Kconfig b/arch/Kconfig
68 +index 40dc31fea90c..77b3e21c4844 100644
69 +--- a/arch/Kconfig
70 ++++ b/arch/Kconfig
71 +@@ -965,4 +965,12 @@ config REFCOUNT_FULL
72 + against various use-after-free conditions that can be used in
73 + security flaw exploits.
74 +
75 ++config HAVE_ARCH_COMPILER_H
76 ++ bool
77 ++ help
78 ++ An architecture can select this if it provides an
79 ++ asm/compiler.h header that should be included after
80 ++ linux/compiler-*.h in order to override macro definitions that those
81 ++ headers generally provide.
82 ++
83 + source "kernel/gcov/Kconfig"
84 +diff --git a/arch/arm/boot/dts/bcm63138.dtsi b/arch/arm/boot/dts/bcm63138.dtsi
85 +index 43ee992ccdcf..6df61518776f 100644
86 +--- a/arch/arm/boot/dts/bcm63138.dtsi
87 ++++ b/arch/arm/boot/dts/bcm63138.dtsi
88 +@@ -106,21 +106,23 @@
89 + global_timer: timer@1e200 {
90 + compatible = "arm,cortex-a9-global-timer";
91 + reg = <0x1e200 0x20>;
92 +- interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
93 ++ interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
94 + clocks = <&axi_clk>;
95 + };
96 +
97 + local_timer: local-timer@1e600 {
98 + compatible = "arm,cortex-a9-twd-timer";
99 + reg = <0x1e600 0x20>;
100 +- interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
101 ++ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) |
102 ++ IRQ_TYPE_EDGE_RISING)>;
103 + clocks = <&axi_clk>;
104 + };
105 +
106 + twd_watchdog: watchdog@1e620 {
107 + compatible = "arm,cortex-a9-twd-wdt";
108 + reg = <0x1e620 0x20>;
109 +- interrupts = <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>;
110 ++ interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) |
111 ++ IRQ_TYPE_LEVEL_HIGH)>;
112 + };
113 +
114 + armpll: armpll {
115 +@@ -158,7 +160,7 @@
116 + serial0: serial@600 {
117 + compatible = "brcm,bcm6345-uart";
118 + reg = <0x600 0x1b>;
119 +- interrupts = <GIC_SPI 32 0>;
120 ++ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
121 + clocks = <&periph_clk>;
122 + clock-names = "periph";
123 + status = "disabled";
124 +@@ -167,7 +169,7 @@
125 + serial1: serial@620 {
126 + compatible = "brcm,bcm6345-uart";
127 + reg = <0x620 0x1b>;
128 +- interrupts = <GIC_SPI 33 0>;
129 ++ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
130 + clocks = <&periph_clk>;
131 + clock-names = "periph";
132 + status = "disabled";
133 +@@ -180,7 +182,7 @@
134 + reg = <0x2000 0x600>, <0xf0 0x10>;
135 + reg-names = "nand", "nand-int-base";
136 + status = "disabled";
137 +- interrupts = <GIC_SPI 38 0>;
138 ++ interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
139 + interrupt-names = "nand";
140 + };
141 +
142 +diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi
143 +index 683dcbe27cbd..8c11190c5218 100644
144 +--- a/arch/arm/boot/dts/imx53-qsb-common.dtsi
145 ++++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi
146 +@@ -130,6 +130,17 @@
147 + };
148 + };
149 +
150 ++&cpu0 {
151 ++ /* CPU rated to 1GHz, not 1.2GHz as per the default settings */
152 ++ operating-points = <
153 ++ /* kHz uV */
154 ++ 166666 850000
155 ++ 400000 900000
156 ++ 800000 1050000
157 ++ 1000000 1200000
158 ++ >;
159 ++};
160 ++
161 + &esdhc1 {
162 + pinctrl-names = "default";
163 + pinctrl-0 = <&pinctrl_esdhc1>;
164 +diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
165 +index 16358bf8d1db..97e8b9b0b750 100644
166 +--- a/arch/arm/boot/dts/r8a7790.dtsi
167 ++++ b/arch/arm/boot/dts/r8a7790.dtsi
168 +@@ -153,7 +153,7 @@
169 +
170 + trips {
171 + cpu-crit {
172 +- temperature = <115000>;
173 ++ temperature = <95000>;
174 + hysteresis = <0>;
175 + type = "critical";
176 + };
177 +diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
178 +index 914f59166a99..2780e68a853b 100644
179 +--- a/arch/arm/boot/dts/tegra20.dtsi
180 ++++ b/arch/arm/boot/dts/tegra20.dtsi
181 +@@ -706,7 +706,7 @@
182 + phy_type = "ulpi";
183 + clocks = <&tegra_car TEGRA20_CLK_USB2>,
184 + <&tegra_car TEGRA20_CLK_PLL_U>,
185 +- <&tegra_car TEGRA20_CLK_CDEV2>;
186 ++ <&tegra_car TEGRA20_CLK_PLL_P_OUT4>;
187 + clock-names = "reg", "pll_u", "ulpi-link";
188 + resets = <&tegra_car 58>, <&tegra_car 22>;
189 + reset-names = "usb", "utmi-pads";
190 +diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
191 +index fc91205ff46c..5bf9443cfbaa 100644
192 +--- a/arch/arm/mm/ioremap.c
193 ++++ b/arch/arm/mm/ioremap.c
194 +@@ -473,7 +473,7 @@ void pci_ioremap_set_mem_type(int mem_type)
195 +
196 + int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
197 + {
198 +- BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT);
199 ++ BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT);
200 +
201 + return ioremap_page_range(PCI_IO_VIRT_BASE + offset,
202 + PCI_IO_VIRT_BASE + offset + SZ_64K,
203 +diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
204 +index 6cb0fa92a651..9f6ae9686dac 100644
205 +--- a/arch/arm64/mm/hugetlbpage.c
206 ++++ b/arch/arm64/mm/hugetlbpage.c
207 +@@ -118,11 +118,14 @@ static pte_t get_clear_flush(struct mm_struct *mm,
208 +
209 + /*
210 + * If HW_AFDBM is enabled, then the HW could turn on
211 +- * the dirty bit for any page in the set, so check
212 +- * them all. All hugetlb entries are already young.
213 ++ * the dirty or accessed bit for any page in the set,
214 ++ * so check them all.
215 + */
216 + if (pte_dirty(pte))
217 + orig_pte = pte_mkdirty(orig_pte);
218 ++
219 ++ if (pte_young(pte))
220 ++ orig_pte = pte_mkyoung(orig_pte);
221 + }
222 +
223 + if (valid)
224 +@@ -347,10 +350,13 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
225 + if (!pte_same(orig_pte, pte))
226 + changed = 1;
227 +
228 +- /* Make sure we don't lose the dirty state */
229 ++ /* Make sure we don't lose the dirty or young state */
230 + if (pte_dirty(orig_pte))
231 + pte = pte_mkdirty(pte);
232 +
233 ++ if (pte_young(orig_pte))
234 ++ pte = pte_mkyoung(pte);
235 ++
236 + hugeprot = pte_pgprot(pte);
237 + for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn)
238 + set_pte_at(vma->vm_mm, addr, ptep, pfn_pte(pfn, hugeprot));
239 +diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
240 +index c82457b0e733..23e3d3e0ee5b 100644
241 +--- a/arch/mips/Kconfig
242 ++++ b/arch/mips/Kconfig
243 +@@ -29,6 +29,7 @@ config MIPS
244 + select GENERIC_SMP_IDLE_THREAD
245 + select GENERIC_TIME_VSYSCALL
246 + select HANDLE_DOMAIN_IRQ
247 ++ select HAVE_ARCH_COMPILER_H
248 + select HAVE_ARCH_JUMP_LABEL
249 + select HAVE_ARCH_KGDB
250 + select HAVE_ARCH_MMAP_RND_BITS if MMU
251 +diff --git a/arch/mips/include/asm/compiler.h b/arch/mips/include/asm/compiler.h
252 +index e081a265f422..cc2eb1b06050 100644
253 +--- a/arch/mips/include/asm/compiler.h
254 ++++ b/arch/mips/include/asm/compiler.h
255 +@@ -8,6 +8,41 @@
256 + #ifndef _ASM_COMPILER_H
257 + #define _ASM_COMPILER_H
258 +
259 ++/*
260 ++ * With GCC 4.5 onwards we can use __builtin_unreachable to indicate to the
261 ++ * compiler that a particular code path will never be hit. This allows it to be
262 ++ * optimised out of the generated binary.
263 ++ *
264 ++ * Unfortunately at least GCC 4.6.3 through 7.3.0 inclusive suffer from a bug
265 ++ * that can lead to instructions from beyond an unreachable statement being
266 ++ * incorrectly reordered into earlier delay slots if the unreachable statement
267 ++ * is the only content of a case in a switch statement. This can lead to
268 ++ * seemingly random behaviour, such as invalid memory accesses from incorrectly
269 ++ * reordered loads or stores. See this potential GCC fix for details:
270 ++ *
271 ++ * https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
272 ++ *
273 ++ * It is unclear whether GCC 8 onwards suffer from the same issue - nothing
274 ++ * relevant is mentioned in GCC 8 release notes and nothing obviously relevant
275 ++ * stands out in GCC commit logs, but these newer GCC versions generate very
276 ++ * different code for the testcase which doesn't exhibit the bug.
277 ++ *
278 ++ * GCC also handles stack allocation suboptimally when calling noreturn
279 ++ * functions or calling __builtin_unreachable():
280 ++ *
281 ++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
282 ++ *
283 ++ * We work around both of these issues by placing a volatile asm statement,
284 ++ * which GCC is prevented from reordering past, prior to __builtin_unreachable
285 ++ * calls.
286 ++ *
287 ++ * The .insn statement is required to ensure that any branches to the
288 ++ * statement, which sadly must be kept due to the asm statement, are known to
289 ++ * be branches to code and satisfy linker requirements for microMIPS kernels.
290 ++ */
291 ++#undef barrier_before_unreachable
292 ++#define barrier_before_unreachable() asm volatile(".insn")
293 ++
294 + #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
295 + #define GCC_IMM_ASM() "n"
296 + #define GCC_REG_ACCUM "$0"
297 +diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
298 +index d5f2ee882f74..66c72b356ac0 100644
299 +--- a/arch/powerpc/include/asm/topology.h
300 ++++ b/arch/powerpc/include/asm/topology.h
301 +@@ -81,6 +81,9 @@ static inline int numa_update_cpu_topology(bool cpus_locked)
302 + {
303 + return 0;
304 + }
305 ++
306 ++static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node) {}
307 ++
308 + #endif /* CONFIG_NUMA */
309 +
310 + #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
311 +diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
312 +index 847ddffbf38a..b5cfab711651 100644
313 +--- a/arch/sparc/mm/tlb.c
314 ++++ b/arch/sparc/mm/tlb.c
315 +@@ -163,13 +163,10 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
316 + pte_unmap(pte);
317 + }
318 +
319 +-void set_pmd_at(struct mm_struct *mm, unsigned long addr,
320 +- pmd_t *pmdp, pmd_t pmd)
321 +-{
322 +- pmd_t orig = *pmdp;
323 +-
324 +- *pmdp = pmd;
325 +
326 ++static void __set_pmd_acct(struct mm_struct *mm, unsigned long addr,
327 ++ pmd_t orig, pmd_t pmd)
328 ++{
329 + if (mm == &init_mm)
330 + return;
331 +
332 +@@ -219,6 +216,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
333 + }
334 + }
335 +
336 ++void set_pmd_at(struct mm_struct *mm, unsigned long addr,
337 ++ pmd_t *pmdp, pmd_t pmd)
338 ++{
339 ++ pmd_t orig = *pmdp;
340 ++
341 ++ *pmdp = pmd;
342 ++ __set_pmd_acct(mm, addr, orig, pmd);
343 ++}
344 ++
345 + static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
346 + unsigned long address, pmd_t *pmdp, pmd_t pmd)
347 + {
348 +@@ -227,6 +233,7 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
349 + do {
350 + old = *pmdp;
351 + } while (cmpxchg64(&pmdp->pmd, old.pmd, pmd.pmd) != old.pmd);
352 ++ __set_pmd_acct(vma->vm_mm, address, old, pmd);
353 +
354 + return old;
355 + }
356 +diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
357 +index f5cbbba99283..4e1d7483b78c 100644
358 +--- a/arch/x86/events/amd/uncore.c
359 ++++ b/arch/x86/events/amd/uncore.c
360 +@@ -35,6 +35,7 @@
361 +
362 + static int num_counters_llc;
363 + static int num_counters_nb;
364 ++static bool l3_mask;
365 +
366 + static HLIST_HEAD(uncore_unused_list);
367 +
368 +@@ -208,6 +209,13 @@ static int amd_uncore_event_init(struct perf_event *event)
369 + hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
370 + hwc->idx = -1;
371 +
372 ++ /*
373 ++ * SliceMask and ThreadMask need to be set for certain L3 events in
374 ++ * Family 17h. For other events, the two fields do not affect the count.
375 ++ */
376 ++ if (l3_mask)
377 ++ hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
378 ++
379 + if (event->cpu < 0)
380 + return -EINVAL;
381 +
382 +@@ -542,6 +550,7 @@ static int __init amd_uncore_init(void)
383 + amd_llc_pmu.name = "amd_l3";
384 + format_attr_event_df.show = &event_show_df;
385 + format_attr_event_l3.show = &event_show_l3;
386 ++ l3_mask = true;
387 + } else {
388 + num_counters_nb = NUM_COUNTERS_NB;
389 + num_counters_llc = NUM_COUNTERS_L2;
390 +@@ -549,6 +558,7 @@ static int __init amd_uncore_init(void)
391 + amd_llc_pmu.name = "amd_l2";
392 + format_attr_event_df = format_attr_event;
393 + format_attr_event_l3 = format_attr_event;
394 ++ l3_mask = false;
395 + }
396 +
397 + amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
398 +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
399 +index 2dae3f585c01..a68aba8a482f 100644
400 +--- a/arch/x86/events/intel/uncore_snbep.c
401 ++++ b/arch/x86/events/intel/uncore_snbep.c
402 +@@ -3807,16 +3807,16 @@ static const struct pci_device_id skx_uncore_pci_ids[] = {
403 + .driver_data = UNCORE_PCI_DEV_FULL_DATA(21, 5, SKX_PCI_UNCORE_M2PCIE, 3),
404 + },
405 + { /* M3UPI0 Link 0 */
406 +- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C),
407 +- .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 0, SKX_PCI_UNCORE_M3UPI, 0),
408 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
409 ++ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 0),
410 + },
411 + { /* M3UPI0 Link 1 */
412 +- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
413 +- .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 1),
414 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204E),
415 ++ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 2, SKX_PCI_UNCORE_M3UPI, 1),
416 + },
417 + { /* M3UPI1 Link 2 */
418 +- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C),
419 +- .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 4, SKX_PCI_UNCORE_M3UPI, 2),
420 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
421 ++ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 5, SKX_PCI_UNCORE_M3UPI, 2),
422 + },
423 + { /* end: all zeroes */ }
424 + };
425 +diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
426 +index 12f54082f4c8..78241b736f2a 100644
427 +--- a/arch/x86/include/asm/perf_event.h
428 ++++ b/arch/x86/include/asm/perf_event.h
429 +@@ -46,6 +46,14 @@
430 + #define INTEL_ARCH_EVENT_MASK \
431 + (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT)
432 +
433 ++#define AMD64_L3_SLICE_SHIFT 48
434 ++#define AMD64_L3_SLICE_MASK \
435 ++ ((0xFULL) << AMD64_L3_SLICE_SHIFT)
436 ++
437 ++#define AMD64_L3_THREAD_SHIFT 56
438 ++#define AMD64_L3_THREAD_MASK \
439 ++ ((0xFFULL) << AMD64_L3_THREAD_SHIFT)
440 ++
441 + #define X86_RAW_EVENT_MASK \
442 + (ARCH_PERFMON_EVENTSEL_EVENT | \
443 + ARCH_PERFMON_EVENTSEL_UMASK | \
444 +diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
445 +index f3559b84cd75..04da826381c9 100644
446 +--- a/arch/x86/kernel/paravirt.c
447 ++++ b/arch/x86/kernel/paravirt.c
448 +@@ -90,7 +90,7 @@ unsigned paravirt_patch_call(void *insnbuf,
449 +
450 + if (len < 5) {
451 + #ifdef CONFIG_RETPOLINE
452 +- WARN_ONCE("Failing to patch indirect CALL in %ps\n", (void *)addr);
453 ++ WARN_ONCE(1, "Failing to patch indirect CALL in %ps\n", (void *)addr);
454 + #endif
455 + return len; /* call too long for patch site */
456 + }
457 +@@ -110,7 +110,7 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
458 +
459 + if (len < 5) {
460 + #ifdef CONFIG_RETPOLINE
461 +- WARN_ONCE("Failing to patch indirect JMP in %ps\n", (void *)addr);
462 ++ WARN_ONCE(1, "Failing to patch indirect JMP in %ps\n", (void *)addr);
463 + #endif
464 + return len; /* call too long for patch site */
465 + }
466 +diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
467 +index 5abae72266b7..6288e9d7068e 100644
468 +--- a/arch/x86/kvm/paging_tmpl.h
469 ++++ b/arch/x86/kvm/paging_tmpl.h
470 +@@ -452,14 +452,21 @@ error:
471 + * done by is_rsvd_bits_set() above.
472 + *
473 + * We set up the value of exit_qualification to inject:
474 +- * [2:0] - Derive from [2:0] of real exit_qualification at EPT violation
475 ++ * [2:0] - Derive from the access bits. The exit_qualification might be
476 ++ * out of date if it is serving an EPT misconfiguration.
477 + * [5:3] - Calculated by the page walk of the guest EPT page tables
478 + * [7:8] - Derived from [7:8] of real exit_qualification
479 + *
480 + * The other bits are set to 0.
481 + */
482 + if (!(errcode & PFERR_RSVD_MASK)) {
483 +- vcpu->arch.exit_qualification &= 0x187;
484 ++ vcpu->arch.exit_qualification &= 0x180;
485 ++ if (write_fault)
486 ++ vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_WRITE;
487 ++ if (user_fault)
488 ++ vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_READ;
489 ++ if (fetch_fault)
490 ++ vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_INSTR;
491 + vcpu->arch.exit_qualification |= (pte_access & 0x7) << 3;
492 + }
493 + #endif
494 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
495 +index 3856828ee1dc..8d688b213504 100644
496 +--- a/arch/x86/kvm/x86.c
497 ++++ b/arch/x86/kvm/x86.c
498 +@@ -7393,13 +7393,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
499 +
500 + int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
501 + {
502 +- struct fpu *fpu = &current->thread.fpu;
503 + int r;
504 +
505 +- fpu__initialize(fpu);
506 +-
507 + kvm_sigset_activate(vcpu);
508 +
509 ++ kvm_load_guest_fpu(vcpu);
510 ++
511 + if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
512 + if (kvm_run->immediate_exit) {
513 + r = -EINTR;
514 +@@ -7440,6 +7439,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
515 + r = vcpu_run(vcpu);
516 +
517 + out:
518 ++ kvm_put_guest_fpu(vcpu);
519 + post_kvm_run_save(vcpu);
520 + kvm_sigset_deactivate(vcpu);
521 +
522 +diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
523 +index a2070ab86c82..89d5915b1a3f 100644
524 +--- a/drivers/char/tpm/tpm-interface.c
525 ++++ b/drivers/char/tpm/tpm-interface.c
526 +@@ -611,12 +611,13 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
527 + rc = be32_to_cpu(header->return_code);
528 + if (rc != TPM2_RC_RETRY)
529 + break;
530 +- delay_msec *= 2;
531 ++
532 + if (delay_msec > TPM2_DURATION_LONG) {
533 + dev_err(&chip->dev, "TPM is in retry loop\n");
534 + break;
535 + }
536 + tpm_msleep(delay_msec);
537 ++ delay_msec *= 2;
538 + memcpy(buf, save, save_size);
539 + }
540 + return ret;
541 +diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
542 +index 5c7ce5aaaf6f..b4ad169836e9 100644
543 +--- a/drivers/char/tpm/tpm_crb.c
544 ++++ b/drivers/char/tpm/tpm_crb.c
545 +@@ -520,8 +520,10 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
546 +
547 + priv->regs_t = crb_map_res(dev, priv, &io_res, buf->control_address,
548 + sizeof(struct crb_regs_tail));
549 +- if (IS_ERR(priv->regs_t))
550 +- return PTR_ERR(priv->regs_t);
551 ++ if (IS_ERR(priv->regs_t)) {
552 ++ ret = PTR_ERR(priv->regs_t);
553 ++ goto out_relinquish_locality;
554 ++ }
555 +
556 + /*
557 + * PTT HW bug w/a: wake up the device to access
558 +@@ -529,7 +531,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
559 + */
560 + ret = __crb_cmd_ready(dev, priv);
561 + if (ret)
562 +- return ret;
563 ++ goto out_relinquish_locality;
564 +
565 + pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high);
566 + pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low);
567 +@@ -574,6 +576,8 @@ out:
568 +
569 + __crb_go_idle(dev, priv);
570 +
571 ++out_relinquish_locality:
572 ++
573 + __crb_relinquish_locality(dev, priv, 0);
574 +
575 + return ret;
576 +diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
577 +index d4726a3358a4..d6993c2707d1 100644
578 +--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
579 ++++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
580 +@@ -2802,6 +2802,7 @@ static int init_cmd_table(struct intel_gvt *gvt)
581 + if (info) {
582 + gvt_err("%s %s duplicated\n", e->info->name,
583 + info->name);
584 ++ kfree(e);
585 + return -EEXIST;
586 + }
587 +
588 +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
589 +index ab70194a73db..c3a4f5d92391 100644
590 +--- a/drivers/infiniband/hw/mlx5/main.c
591 ++++ b/drivers/infiniband/hw/mlx5/main.c
592 +@@ -3911,7 +3911,7 @@ mlx5_ib_get_vector_affinity(struct ib_device *ibdev, int comp_vector)
593 + {
594 + struct mlx5_ib_dev *dev = to_mdev(ibdev);
595 +
596 +- return mlx5_get_vector_affinity(dev->mdev, comp_vector);
597 ++ return mlx5_get_vector_affinity_hint(dev->mdev, comp_vector);
598 + }
599 +
600 + static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
601 +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
602 +index ef9ee6c328a1..dfc190055167 100644
603 +--- a/drivers/infiniband/hw/mlx5/qp.c
604 ++++ b/drivers/infiniband/hw/mlx5/qp.c
605 +@@ -1527,6 +1527,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
606 + u32 uidx = MLX5_IB_DEFAULT_UIDX;
607 + struct mlx5_ib_create_qp ucmd;
608 + struct mlx5_ib_qp_base *base;
609 ++ int mlx5_st;
610 + void *qpc;
611 + u32 *in;
612 + int err;
613 +@@ -1535,6 +1536,10 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
614 + spin_lock_init(&qp->sq.lock);
615 + spin_lock_init(&qp->rq.lock);
616 +
617 ++ mlx5_st = to_mlx5_st(init_attr->qp_type);
618 ++ if (mlx5_st < 0)
619 ++ return -EINVAL;
620 ++
621 + if (init_attr->rwq_ind_tbl) {
622 + if (!udata)
623 + return -ENOSYS;
624 +@@ -1688,7 +1693,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
625 +
626 + qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
627 +
628 +- MLX5_SET(qpc, qpc, st, to_mlx5_st(init_attr->qp_type));
629 ++ MLX5_SET(qpc, qpc, st, mlx5_st);
630 + MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);
631 +
632 + if (init_attr->qp_type != MLX5_IB_QPT_REG_UMR)
633 +diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
634 +index e4113ef09315..3c3453d213dc 100644
635 +--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
636 ++++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
637 +@@ -642,7 +642,7 @@ int usnic_ib_dereg_mr(struct ib_mr *ibmr)
638 +
639 + usnic_dbg("va 0x%lx length 0x%zx\n", mr->umem->va, mr->umem->length);
640 +
641 +- usnic_uiom_reg_release(mr->umem, ibmr->pd->uobject->context->closing);
642 ++ usnic_uiom_reg_release(mr->umem, ibmr->uobject->context);
643 + kfree(mr);
644 + return 0;
645 + }
646 +diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c
647 +index 4381c0a9a873..9dd39daa602b 100644
648 +--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
649 ++++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
650 +@@ -41,6 +41,7 @@
651 + #include <linux/workqueue.h>
652 + #include <linux/list.h>
653 + #include <linux/pci.h>
654 ++#include <rdma/ib_verbs.h>
655 +
656 + #include "usnic_log.h"
657 + #include "usnic_uiom.h"
658 +@@ -88,7 +89,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty)
659 + for_each_sg(chunk->page_list, sg, chunk->nents, i) {
660 + page = sg_page(sg);
661 + pa = sg_phys(sg);
662 +- if (dirty)
663 ++ if (!PageDirty(page) && dirty)
664 + set_page_dirty_lock(page);
665 + put_page(page);
666 + usnic_dbg("pa: %pa\n", &pa);
667 +@@ -114,6 +115,16 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
668 + dma_addr_t pa;
669 + unsigned int gup_flags;
670 +
671 ++ /*
672 ++ * If the combination of the addr and size requested for this memory
673 ++ * region causes an integer overflow, return error.
674 ++ */
675 ++ if (((addr + size) < addr) || PAGE_ALIGN(addr + size) < (addr + size))
676 ++ return -EINVAL;
677 ++
678 ++ if (!size)
679 ++ return -EINVAL;
680 ++
681 + if (!can_do_mlock())
682 + return -EPERM;
683 +
684 +@@ -127,7 +138,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
685 +
686 + down_write(&current->mm->mmap_sem);
687 +
688 +- locked = npages + current->mm->locked_vm;
689 ++ locked = npages + current->mm->pinned_vm;
690 + lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
691 +
692 + if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
693 +@@ -143,7 +154,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
694 + ret = 0;
695 +
696 + while (npages) {
697 +- ret = get_user_pages(cur_base,
698 ++ ret = get_user_pages_longterm(cur_base,
699 + min_t(unsigned long, npages,
700 + PAGE_SIZE / sizeof(struct page *)),
701 + gup_flags, page_list, NULL);
702 +@@ -186,7 +197,7 @@ out:
703 + if (ret < 0)
704 + usnic_uiom_put_pages(chunk_list, 0);
705 + else
706 +- current->mm->locked_vm = locked;
707 ++ current->mm->pinned_vm = locked;
708 +
709 + up_write(&current->mm->mmap_sem);
710 + free_page((unsigned long) page_list);
711 +@@ -420,18 +431,22 @@ out_free_uiomr:
712 + return ERR_PTR(err);
713 + }
714 +
715 +-void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing)
716 ++void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr,
717 ++ struct ib_ucontext *ucontext)
718 + {
719 ++ struct task_struct *task;
720 + struct mm_struct *mm;
721 + unsigned long diff;
722 +
723 + __usnic_uiom_reg_release(uiomr->pd, uiomr, 1);
724 +
725 +- mm = get_task_mm(current);
726 +- if (!mm) {
727 +- kfree(uiomr);
728 +- return;
729 +- }
730 ++ task = get_pid_task(ucontext->tgid, PIDTYPE_PID);
731 ++ if (!task)
732 ++ goto out;
733 ++ mm = get_task_mm(task);
734 ++ put_task_struct(task);
735 ++ if (!mm)
736 ++ goto out;
737 +
738 + diff = PAGE_ALIGN(uiomr->length + uiomr->offset) >> PAGE_SHIFT;
739 +
740 +@@ -443,7 +458,7 @@ void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing)
741 + * up here and not be able to take the mmap_sem. In that case
742 + * we defer the vm_locked accounting to the system workqueue.
743 + */
744 +- if (closing) {
745 ++ if (ucontext->closing) {
746 + if (!down_write_trylock(&mm->mmap_sem)) {
747 + INIT_WORK(&uiomr->work, usnic_uiom_reg_account);
748 + uiomr->mm = mm;
749 +@@ -455,9 +470,10 @@ void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing)
750 + } else
751 + down_write(&mm->mmap_sem);
752 +
753 +- current->mm->locked_vm -= diff;
754 ++ mm->pinned_vm -= diff;
755 + up_write(&mm->mmap_sem);
756 + mmput(mm);
757 ++out:
758 + kfree(uiomr);
759 + }
760 +
761 +diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.h b/drivers/infiniband/hw/usnic/usnic_uiom.h
762 +index 431efe4143f4..8c096acff123 100644
763 +--- a/drivers/infiniband/hw/usnic/usnic_uiom.h
764 ++++ b/drivers/infiniband/hw/usnic/usnic_uiom.h
765 +@@ -39,6 +39,8 @@
766 +
767 + #include "usnic_uiom_interval_tree.h"
768 +
769 ++struct ib_ucontext;
770 ++
771 + #define USNIC_UIOM_READ (1)
772 + #define USNIC_UIOM_WRITE (2)
773 +
774 +@@ -89,7 +91,8 @@ void usnic_uiom_free_dev_list(struct device **devs);
775 + struct usnic_uiom_reg *usnic_uiom_reg_get(struct usnic_uiom_pd *pd,
776 + unsigned long addr, size_t size,
777 + int access, int dmasync);
778 +-void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing);
779 ++void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr,
780 ++ struct ib_ucontext *ucontext);
781 + int usnic_uiom_init(char *drv_name);
782 + void usnic_uiom_fini(void);
783 + #endif /* USNIC_UIOM_H_ */
784 +diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
785 +index 3b4916680018..b4a8acc7bb7d 100644
786 +--- a/drivers/infiniband/sw/rxe/rxe_pool.c
787 ++++ b/drivers/infiniband/sw/rxe/rxe_pool.c
788 +@@ -394,23 +394,25 @@ void *rxe_alloc(struct rxe_pool *pool)
789 +
790 + kref_get(&pool->rxe->ref_cnt);
791 +
792 +- if (atomic_inc_return(&pool->num_elem) > pool->max_elem) {
793 +- atomic_dec(&pool->num_elem);
794 +- rxe_dev_put(pool->rxe);
795 +- rxe_pool_put(pool);
796 +- return NULL;
797 +- }
798 ++ if (atomic_inc_return(&pool->num_elem) > pool->max_elem)
799 ++ goto out_put_pool;
800 +
801 + elem = kmem_cache_zalloc(pool_cache(pool),
802 + (pool->flags & RXE_POOL_ATOMIC) ?
803 + GFP_ATOMIC : GFP_KERNEL);
804 + if (!elem)
805 +- return NULL;
806 ++ goto out_put_pool;
807 +
808 + elem->pool = pool;
809 + kref_init(&elem->ref_cnt);
810 +
811 + return elem;
812 ++
813 ++out_put_pool:
814 ++ atomic_dec(&pool->num_elem);
815 ++ rxe_dev_put(pool->rxe);
816 ++ rxe_pool_put(pool);
817 ++ return NULL;
818 + }
819 +
820 + void rxe_elem_release(struct kref *kref)
821 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
822 +index c97384c914a4..d77e8e2ae05f 100644
823 +--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
824 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
825 +@@ -1203,13 +1203,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
826 + ipoib_ib_dev_down(dev);
827 +
828 + if (level == IPOIB_FLUSH_HEAVY) {
829 +- rtnl_lock();
830 + if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
831 + ipoib_ib_dev_stop(dev);
832 +
833 +- result = ipoib_ib_dev_open(dev);
834 +- rtnl_unlock();
835 +- if (result)
836 ++ if (ipoib_ib_dev_open(dev))
837 + return;
838 +
839 + if (netif_queue_stopped(dev))
840 +@@ -1249,7 +1246,9 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work)
841 + struct ipoib_dev_priv *priv =
842 + container_of(work, struct ipoib_dev_priv, flush_heavy);
843 +
844 ++ rtnl_lock();
845 + __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY, 0);
846 ++ rtnl_unlock();
847 + }
848 +
849 + void ipoib_ib_dev_cleanup(struct net_device *dev)
850 +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
851 +index 898286ed47a1..b10e4c5641ea 100644
852 +--- a/drivers/md/dm-integrity.c
853 ++++ b/drivers/md/dm-integrity.c
854 +@@ -2547,6 +2547,9 @@ static int get_mac(struct crypto_shash **hash, struct alg_spec *a, char **error,
855 + *error = error_key;
856 + return r;
857 + }
858 ++ } else if (crypto_shash_get_flags(*hash) & CRYPTO_TFM_NEED_KEY) {
859 ++ *error = error_key;
860 ++ return -ENOKEY;
861 + }
862 + }
863 +
864 +diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
865 +index 6d22b22cb35b..064d88299adc 100644
866 +--- a/drivers/media/usb/uvc/uvc_driver.c
867 ++++ b/drivers/media/usb/uvc/uvc_driver.c
868 +@@ -1865,13 +1865,6 @@ static void uvc_unregister_video(struct uvc_device *dev)
869 + {
870 + struct uvc_streaming *stream;
871 +
872 +- /* Unregistering all video devices might result in uvc_delete() being
873 +- * called from inside the loop if there's no open file handle. To avoid
874 +- * that, increment the refcount before iterating over the streams and
875 +- * decrement it when done.
876 +- */
877 +- kref_get(&dev->ref);
878 +-
879 + list_for_each_entry(stream, &dev->streams, list) {
880 + if (!video_is_registered(&stream->vdev))
881 + continue;
882 +@@ -1880,8 +1873,6 @@ static void uvc_unregister_video(struct uvc_device *dev)
883 +
884 + uvc_debugfs_cleanup_stream(stream);
885 + }
886 +-
887 +- kref_put(&dev->ref, uvc_delete);
888 + }
889 +
890 + static int uvc_register_video(struct uvc_device *dev,
891 +@@ -2129,6 +2120,7 @@ static int uvc_probe(struct usb_interface *intf,
892 +
893 + error:
894 + uvc_unregister_video(dev);
895 ++ kref_put(&dev->ref, uvc_delete);
896 + return -ENODEV;
897 + }
898 +
899 +@@ -2146,6 +2138,7 @@ static void uvc_disconnect(struct usb_interface *intf)
900 + return;
901 +
902 + uvc_unregister_video(dev);
903 ++ kref_put(&dev->ref, uvc_delete);
904 + }
905 +
906 + static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
907 +diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
908 +index 339295212935..40d7de2eea12 100644
909 +--- a/drivers/mmc/host/dw_mmc-rockchip.c
910 ++++ b/drivers/mmc/host/dw_mmc-rockchip.c
911 +@@ -282,11 +282,11 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
912 +
913 + priv->drv_clk = devm_clk_get(host->dev, "ciu-drive");
914 + if (IS_ERR(priv->drv_clk))
915 +- dev_dbg(host->dev, "ciu_drv not available\n");
916 ++ dev_dbg(host->dev, "ciu-drive not available\n");
917 +
918 + priv->sample_clk = devm_clk_get(host->dev, "ciu-sample");
919 + if (IS_ERR(priv->sample_clk))
920 +- dev_dbg(host->dev, "ciu_sample not available\n");
921 ++ dev_dbg(host->dev, "ciu-sample not available\n");
922 +
923 + host->priv = priv;
924 +
925 +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
926 +index 19c000722cbc..34ecc12ee3d9 100644
927 +--- a/drivers/mtd/spi-nor/spi-nor.c
928 ++++ b/drivers/mtd/spi-nor/spi-nor.c
929 +@@ -1005,6 +1005,12 @@ static const struct flash_info spi_nor_ids[] = {
930 +
931 + /* ISSI */
932 + { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) },
933 ++ { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64,
934 ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
935 ++ { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128,
936 ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
937 ++ { "is25wp128", INFO(0x9d7018, 0, 64 * 1024, 256,
938 ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
939 +
940 + /* Macronix */
941 + { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) },
942 +diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
943 +index a1b33aa6054a..77babf1417a7 100644
944 +--- a/drivers/net/bonding/bond_netlink.c
945 ++++ b/drivers/net/bonding/bond_netlink.c
946 +@@ -638,8 +638,7 @@ static int bond_fill_info(struct sk_buff *skb,
947 + goto nla_put_failure;
948 +
949 + if (nla_put(skb, IFLA_BOND_AD_ACTOR_SYSTEM,
950 +- sizeof(bond->params.ad_actor_system),
951 +- &bond->params.ad_actor_system))
952 ++ ETH_ALEN, &bond->params.ad_actor_system))
953 + goto nla_put_failure;
954 + }
955 + if (!bond_3ad_get_active_agg_info(bond, &info)) {
956 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
957 +index 60b3ee29d82c..3c7813f04962 100644
958 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
959 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
960 +@@ -1571,8 +1571,6 @@ static int ena_up_complete(struct ena_adapter *adapter)
961 + if (rc)
962 + return rc;
963 +
964 +- ena_init_napi(adapter);
965 +-
966 + ena_change_mtu(adapter->netdev, adapter->netdev->mtu);
967 +
968 + ena_refill_all_rx_bufs(adapter);
969 +@@ -1726,6 +1724,13 @@ static int ena_up(struct ena_adapter *adapter)
970 +
971 + ena_setup_io_intr(adapter);
972 +
973 ++ /* napi poll functions should be initialized before running
974 ++ * request_irq(), to handle a rare condition where there is a pending
975 ++ * interrupt, causing the ISR to fire immediately while the poll
976 ++ * function wasn't set yet, causing a null dereference
977 ++ */
978 ++ ena_init_napi(adapter);
979 ++
980 + rc = ena_request_io_irq(adapter);
981 + if (rc)
982 + goto err_req_irq;
983 +@@ -3059,15 +3064,8 @@ err_rss_init:
984 +
985 + static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev)
986 + {
987 +- int release_bars;
988 +-
989 +- if (ena_dev->mem_bar)
990 +- devm_iounmap(&pdev->dev, ena_dev->mem_bar);
991 +-
992 +- if (ena_dev->reg_bar)
993 +- devm_iounmap(&pdev->dev, ena_dev->reg_bar);
994 ++ int release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
995 +
996 +- release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
997 + pci_release_selected_regions(pdev, release_bars);
998 + }
999 +
1000 +diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c
1001 +index 82cc81385033..c7cde58feaf7 100644
1002 +--- a/drivers/net/ethernet/amd/declance.c
1003 ++++ b/drivers/net/ethernet/amd/declance.c
1004 +@@ -1029,6 +1029,7 @@ static int dec_lance_probe(struct device *bdev, const int type)
1005 + int i, ret;
1006 + unsigned long esar_base;
1007 + unsigned char *esar;
1008 ++ const char *desc;
1009 +
1010 + if (dec_lance_debug && version_printed++ == 0)
1011 + printk(version);
1012 +@@ -1214,19 +1215,20 @@ static int dec_lance_probe(struct device *bdev, const int type)
1013 + */
1014 + switch (type) {
1015 + case ASIC_LANCE:
1016 +- printk("%s: IOASIC onboard LANCE", name);
1017 ++ desc = "IOASIC onboard LANCE";
1018 + break;
1019 + case PMAD_LANCE:
1020 +- printk("%s: PMAD-AA", name);
1021 ++ desc = "PMAD-AA";
1022 + break;
1023 + case PMAX_LANCE:
1024 +- printk("%s: PMAX onboard LANCE", name);
1025 ++ desc = "PMAX onboard LANCE";
1026 + break;
1027 + }
1028 + for (i = 0; i < 6; i++)
1029 + dev->dev_addr[i] = esar[i * 4];
1030 +
1031 +- printk(", addr = %pM, irq = %d\n", dev->dev_addr, dev->irq);
1032 ++ printk("%s: %s, addr = %pM, irq = %d\n",
1033 ++ name, desc, dev->dev_addr, dev->irq);
1034 +
1035 + dev->netdev_ops = &lance_netdev_ops;
1036 + dev->watchdog_timeo = 5*HZ;
1037 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1038 +index 6ad0ca7ed3e9..abbd2894f870 100644
1039 +--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
1040 ++++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1041 +@@ -339,9 +339,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
1042 + phydev->advertising = phydev->supported;
1043 +
1044 + /* The internal PHY has its link interrupts routed to the
1045 +- * Ethernet MAC ISRs
1046 +- */
1047 +- if (priv->internal_phy)
1048 ++ * Ethernet MAC ISRs. On GENETv5 there is a hardware issue
1049 ++ * that prevents the signaling of link UP interrupts when
1050 ++ * the link operates at 10Mbps, so fallback to polling for
1051 ++ * those versions of GENET.
1052 ++ */
1053 ++ if (priv->internal_phy && !GENET_IS_V5(priv))
1054 + priv->phydev->irq = PHY_IGNORE_INTERRUPT;
1055 +
1056 + return 0;
1057 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
1058 +index b4f92de1efbd..d6f8d6c8b0f1 100644
1059 +--- a/drivers/net/ethernet/cadence/macb_main.c
1060 ++++ b/drivers/net/ethernet/cadence/macb_main.c
1061 +@@ -2000,6 +2000,7 @@ static void macb_configure_dma(struct macb *bp)
1062 + else
1063 + dmacfg &= ~GEM_BIT(TXCOEN);
1064 +
1065 ++ dmacfg &= ~GEM_BIT(ADDR64);
1066 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
1067 + if (bp->hw_dma_cap & HW_DMA_CAP_64B)
1068 + dmacfg |= GEM_BIT(ADDR64);
1069 +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
1070 +index bf291e90cdb0..79053d2ce7a3 100644
1071 +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
1072 ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
1073 +@@ -2159,6 +2159,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1074 + return -EPERM;
1075 + if (copy_from_user(&t, useraddr, sizeof(t)))
1076 + return -EFAULT;
1077 ++ if (t.cmd != CHELSIO_SET_QSET_PARAMS)
1078 ++ return -EINVAL;
1079 + if (t.qset_idx >= SGE_QSETS)
1080 + return -EINVAL;
1081 + if (!in_range(t.intr_lat, 0, M_NEWTIMER) ||
1082 +@@ -2258,6 +2260,9 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1083 + if (copy_from_user(&t, useraddr, sizeof(t)))
1084 + return -EFAULT;
1085 +
1086 ++ if (t.cmd != CHELSIO_GET_QSET_PARAMS)
1087 ++ return -EINVAL;
1088 ++
1089 + /* Display qsets for all ports when offload enabled */
1090 + if (test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
1091 + q1 = 0;
1092 +@@ -2303,6 +2308,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1093 + return -EBUSY;
1094 + if (copy_from_user(&edata, useraddr, sizeof(edata)))
1095 + return -EFAULT;
1096 ++ if (edata.cmd != CHELSIO_SET_QSET_NUM)
1097 ++ return -EINVAL;
1098 + if (edata.val < 1 ||
1099 + (edata.val > 1 && !(adapter->flags & USING_MSIX)))
1100 + return -EINVAL;
1101 +@@ -2343,6 +2350,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1102 + return -EPERM;
1103 + if (copy_from_user(&t, useraddr, sizeof(t)))
1104 + return -EFAULT;
1105 ++ if (t.cmd != CHELSIO_LOAD_FW)
1106 ++ return -EINVAL;
1107 + /* Check t.len sanity ? */
1108 + fw_data = memdup_user(useraddr + sizeof(t), t.len);
1109 + if (IS_ERR(fw_data))
1110 +@@ -2366,6 +2375,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1111 + return -EBUSY;
1112 + if (copy_from_user(&m, useraddr, sizeof(m)))
1113 + return -EFAULT;
1114 ++ if (m.cmd != CHELSIO_SETMTUTAB)
1115 ++ return -EINVAL;
1116 + if (m.nmtus != NMTUS)
1117 + return -EINVAL;
1118 + if (m.mtus[0] < 81) /* accommodate SACK */
1119 +@@ -2407,6 +2418,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1120 + return -EBUSY;
1121 + if (copy_from_user(&m, useraddr, sizeof(m)))
1122 + return -EFAULT;
1123 ++ if (m.cmd != CHELSIO_SET_PM)
1124 ++ return -EINVAL;
1125 + if (!is_power_of_2(m.rx_pg_sz) ||
1126 + !is_power_of_2(m.tx_pg_sz))
1127 + return -EINVAL; /* not power of 2 */
1128 +@@ -2440,6 +2453,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1129 + return -EIO; /* need the memory controllers */
1130 + if (copy_from_user(&t, useraddr, sizeof(t)))
1131 + return -EFAULT;
1132 ++ if (t.cmd != CHELSIO_GET_MEM)
1133 ++ return -EINVAL;
1134 + if ((t.addr & 7) || (t.len & 7))
1135 + return -EINVAL;
1136 + if (t.mem_id == MEM_CM)
1137 +@@ -2492,6 +2507,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1138 + return -EAGAIN;
1139 + if (copy_from_user(&t, useraddr, sizeof(t)))
1140 + return -EFAULT;
1141 ++ if (t.cmd != CHELSIO_SET_TRACE_FILTER)
1142 ++ return -EINVAL;
1143 +
1144 + tp = (const struct trace_params *)&t.sip;
1145 + if (t.config_tx)
1146 +diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
1147 +index 2bfaf3e118b1..03f4fee1bbc9 100644
1148 +--- a/drivers/net/ethernet/cisco/enic/enic_main.c
1149 ++++ b/drivers/net/ethernet/cisco/enic/enic_main.c
1150 +@@ -1879,7 +1879,7 @@ static int enic_open(struct net_device *netdev)
1151 + {
1152 + struct enic *enic = netdev_priv(netdev);
1153 + unsigned int i;
1154 +- int err;
1155 ++ int err, ret;
1156 +
1157 + err = enic_request_intr(enic);
1158 + if (err) {
1159 +@@ -1936,10 +1936,9 @@ static int enic_open(struct net_device *netdev)
1160 +
1161 + err_out_free_rq:
1162 + for (i = 0; i < enic->rq_count; i++) {
1163 +- err = vnic_rq_disable(&enic->rq[i]);
1164 +- if (err)
1165 +- return err;
1166 +- vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);
1167 ++ ret = vnic_rq_disable(&enic->rq[i]);
1168 ++ if (!ret)
1169 ++ vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);
1170 + }
1171 + enic_dev_notify_unset(enic);
1172 + err_out_free_intr:
1173 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
1174 +index 7e2b70c2bba3..39f399741647 100644
1175 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
1176 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
1177 +@@ -3900,8 +3900,6 @@ static int be_enable_vxlan_offloads(struct be_adapter *adapter)
1178 + netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1179 + NETIF_F_TSO | NETIF_F_TSO6 |
1180 + NETIF_F_GSO_UDP_TUNNEL;
1181 +- netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
1182 +- netdev->features |= NETIF_F_GSO_UDP_TUNNEL;
1183 +
1184 + dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n",
1185 + be16_to_cpu(port));
1186 +@@ -3923,8 +3921,6 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter)
1187 + adapter->vxlan_port = 0;
1188 +
1189 + netdev->hw_enc_features = 0;
1190 +- netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL);
1191 +- netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL);
1192 + }
1193 +
1194 + static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
1195 +@@ -5215,6 +5211,7 @@ static void be_netdev_init(struct net_device *netdev)
1196 + struct be_adapter *adapter = netdev_priv(netdev);
1197 +
1198 + netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
1199 ++ NETIF_F_GSO_UDP_TUNNEL |
1200 + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
1201 + NETIF_F_HW_VLAN_CTAG_TX;
1202 + if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
1203 +diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
1204 +index 44720f83af27..4d4f16ad88c3 100644
1205 +--- a/drivers/net/ethernet/freescale/fec.h
1206 ++++ b/drivers/net/ethernet/freescale/fec.h
1207 +@@ -451,6 +451,10 @@ struct bufdesc_ex {
1208 + * initialisation.
1209 + */
1210 + #define FEC_QUIRK_MIB_CLEAR (1 << 15)
1211 ++/* Only i.MX25/i.MX27/i.MX28 controller supports FRBR,FRSR registers,
1212 ++ * those FIFO receive registers are resolved in other platforms.
1213 ++ */
1214 ++#define FEC_QUIRK_HAS_FRREG (1 << 16)
1215 +
1216 + struct bufdesc_prop {
1217 + int qid;
1218 +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
1219 +index eb2ea231c7ca..ce55c8f7f33a 100644
1220 +--- a/drivers/net/ethernet/freescale/fec_main.c
1221 ++++ b/drivers/net/ethernet/freescale/fec_main.c
1222 +@@ -89,14 +89,16 @@ static struct platform_device_id fec_devtype[] = {
1223 + .driver_data = 0,
1224 + }, {
1225 + .name = "imx25-fec",
1226 +- .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR,
1227 ++ .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR |
1228 ++ FEC_QUIRK_HAS_FRREG,
1229 + }, {
1230 + .name = "imx27-fec",
1231 +- .driver_data = FEC_QUIRK_MIB_CLEAR,
1232 ++ .driver_data = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG,
1233 + }, {
1234 + .name = "imx28-fec",
1235 + .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
1236 +- FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC,
1237 ++ FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
1238 ++ FEC_QUIRK_HAS_FRREG,
1239 + }, {
1240 + .name = "imx6q-fec",
1241 + .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
1242 +@@ -1155,7 +1157,7 @@ static void fec_enet_timeout_work(struct work_struct *work)
1243 + napi_disable(&fep->napi);
1244 + netif_tx_lock_bh(ndev);
1245 + fec_restart(ndev);
1246 +- netif_wake_queue(ndev);
1247 ++ netif_tx_wake_all_queues(ndev);
1248 + netif_tx_unlock_bh(ndev);
1249 + napi_enable(&fep->napi);
1250 + }
1251 +@@ -1270,7 +1272,7 @@ skb_done:
1252 +
1253 + /* Since we have freed up a buffer, the ring is no longer full
1254 + */
1255 +- if (netif_queue_stopped(ndev)) {
1256 ++ if (netif_tx_queue_stopped(nq)) {
1257 + entries_free = fec_enet_get_free_txdesc_num(txq);
1258 + if (entries_free >= txq->tx_wake_threshold)
1259 + netif_tx_wake_queue(nq);
1260 +@@ -1747,7 +1749,7 @@ static void fec_enet_adjust_link(struct net_device *ndev)
1261 + napi_disable(&fep->napi);
1262 + netif_tx_lock_bh(ndev);
1263 + fec_restart(ndev);
1264 +- netif_wake_queue(ndev);
1265 ++ netif_tx_wake_all_queues(ndev);
1266 + netif_tx_unlock_bh(ndev);
1267 + napi_enable(&fep->napi);
1268 + }
1269 +@@ -2166,7 +2168,13 @@ static void fec_enet_get_regs(struct net_device *ndev,
1270 + memset(buf, 0, regs->len);
1271 +
1272 + for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
1273 +- off = fec_enet_register_offset[i] / 4;
1274 ++ off = fec_enet_register_offset[i];
1275 ++
1276 ++ if ((off == FEC_R_BOUND || off == FEC_R_FSTART) &&
1277 ++ !(fep->quirks & FEC_QUIRK_HAS_FRREG))
1278 ++ continue;
1279 ++
1280 ++ off >>= 2;
1281 + buf[off] = readl(&theregs[off]);
1282 + }
1283 + }
1284 +@@ -2249,7 +2257,7 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
1285 + napi_disable(&fep->napi);
1286 + netif_tx_lock_bh(ndev);
1287 + fec_restart(ndev);
1288 +- netif_wake_queue(ndev);
1289 ++ netif_tx_wake_all_queues(ndev);
1290 + netif_tx_unlock_bh(ndev);
1291 + napi_enable(&fep->napi);
1292 + }
1293 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
1294 +index 9d64d0759ee9..a5dd99aaf321 100644
1295 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
1296 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
1297 +@@ -257,7 +257,8 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets)
1298 + }
1299 +
1300 + static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
1301 +- struct ieee_ets *ets)
1302 ++ struct ieee_ets *ets,
1303 ++ bool zero_sum_allowed)
1304 + {
1305 + bool have_ets_tc = false;
1306 + int bw_sum = 0;
1307 +@@ -282,8 +283,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
1308 + }
1309 +
1310 + if (have_ets_tc && bw_sum != 100) {
1311 +- netdev_err(netdev,
1312 +- "Failed to validate ETS: BW sum is illegal\n");
1313 ++ if (bw_sum || (!bw_sum && !zero_sum_allowed))
1314 ++ netdev_err(netdev,
1315 ++ "Failed to validate ETS: BW sum is illegal\n");
1316 + return -EINVAL;
1317 + }
1318 + return 0;
1319 +@@ -298,7 +300,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev,
1320 + if (!MLX5_CAP_GEN(priv->mdev, ets))
1321 + return -EOPNOTSUPP;
1322 +
1323 +- err = mlx5e_dbcnl_validate_ets(netdev, ets);
1324 ++ err = mlx5e_dbcnl_validate_ets(netdev, ets, false);
1325 + if (err)
1326 + return err;
1327 +
1328 +@@ -477,12 +479,9 @@ static u8 mlx5e_dcbnl_setall(struct net_device *netdev)
1329 + ets.prio_tc[i] = cee_cfg->prio_to_pg_map[i];
1330 + }
1331 +
1332 +- err = mlx5e_dbcnl_validate_ets(netdev, &ets);
1333 +- if (err) {
1334 +- netdev_err(netdev,
1335 +- "%s, Failed to validate ETS: %d\n", __func__, err);
1336 ++ err = mlx5e_dbcnl_validate_ets(netdev, &ets, true);
1337 ++ if (err)
1338 + goto out;
1339 +- }
1340 +
1341 + err = mlx5e_dcbnl_ieee_setets_core(priv, &ets);
1342 + if (err) {
1343 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1344 +index 8285e6d24f30..3d3fd03fa450 100644
1345 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1346 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1347 +@@ -635,43 +635,15 @@ static inline bool is_first_ethertype_ip(struct sk_buff *skb)
1348 + return (ethertype == htons(ETH_P_IP) || ethertype == htons(ETH_P_IPV6));
1349 + }
1350 +
1351 +-static __be32 mlx5e_get_fcs(struct sk_buff *skb)
1352 ++static u32 mlx5e_get_fcs(const struct sk_buff *skb)
1353 + {
1354 +- int last_frag_sz, bytes_in_prev, nr_frags;
1355 +- u8 *fcs_p1, *fcs_p2;
1356 +- skb_frag_t *last_frag;
1357 +- __be32 fcs_bytes;
1358 ++ const void *fcs_bytes;
1359 ++ u32 _fcs_bytes;
1360 +
1361 +- if (!skb_is_nonlinear(skb))
1362 +- return *(__be32 *)(skb->data + skb->len - ETH_FCS_LEN);
1363 ++ fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN,
1364 ++ ETH_FCS_LEN, &_fcs_bytes);
1365 +
1366 +- nr_frags = skb_shinfo(skb)->nr_frags;
1367 +- last_frag = &skb_shinfo(skb)->frags[nr_frags - 1];
1368 +- last_frag_sz = skb_frag_size(last_frag);
1369 +-
1370 +- /* If all FCS data is in last frag */
1371 +- if (last_frag_sz >= ETH_FCS_LEN)
1372 +- return *(__be32 *)(skb_frag_address(last_frag) +
1373 +- last_frag_sz - ETH_FCS_LEN);
1374 +-
1375 +- fcs_p2 = (u8 *)skb_frag_address(last_frag);
1376 +- bytes_in_prev = ETH_FCS_LEN - last_frag_sz;
1377 +-
1378 +- /* Find where the other part of the FCS is - Linear or another frag */
1379 +- if (nr_frags == 1) {
1380 +- fcs_p1 = skb_tail_pointer(skb);
1381 +- } else {
1382 +- skb_frag_t *prev_frag = &skb_shinfo(skb)->frags[nr_frags - 2];
1383 +-
1384 +- fcs_p1 = skb_frag_address(prev_frag) +
1385 +- skb_frag_size(prev_frag);
1386 +- }
1387 +- fcs_p1 -= bytes_in_prev;
1388 +-
1389 +- memcpy(&fcs_bytes, fcs_p1, bytes_in_prev);
1390 +- memcpy(((u8 *)&fcs_bytes) + bytes_in_prev, fcs_p2, last_frag_sz);
1391 +-
1392 +- return fcs_bytes;
1393 ++ return __get_unaligned_cpu32(fcs_bytes);
1394 + }
1395 +
1396 + static inline void mlx5e_handle_csum(struct net_device *netdev,
1397 +@@ -693,8 +665,9 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
1398 + skb->ip_summed = CHECKSUM_COMPLETE;
1399 + skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
1400 + if (unlikely(netdev->features & NETIF_F_RXFCS))
1401 +- skb->csum = csum_add(skb->csum,
1402 +- (__force __wsum)mlx5e_get_fcs(skb));
1403 ++ skb->csum = csum_block_add(skb->csum,
1404 ++ (__force __wsum)mlx5e_get_fcs(skb),
1405 ++ skb->len - ETH_FCS_LEN);
1406 + rq->stats.csum_complete++;
1407 + return;
1408 + }
1409 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
1410 +index eb91de86202b..5da0b6e11530 100644
1411 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
1412 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
1413 +@@ -262,7 +262,7 @@ static void eq_pf_process(struct mlx5_eq *eq)
1414 + case MLX5_PFAULT_SUBTYPE_WQE:
1415 + /* WQE based event */
1416 + pfault->type =
1417 +- be32_to_cpu(pf_eqe->wqe.pftype_wq) >> 24;
1418 ++ (be32_to_cpu(pf_eqe->wqe.pftype_wq) >> 24) & 0x7;
1419 + pfault->token =
1420 + be32_to_cpu(pf_eqe->wqe.token);
1421 + pfault->wqe.wq_num =
1422 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1423 +index e41f28602535..eb666877d1aa 100644
1424 +--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1425 ++++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
1426 +@@ -1672,7 +1672,7 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
1427 +
1428 + cm_info->local_ip[0] = ntohl(iph->daddr);
1429 + cm_info->remote_ip[0] = ntohl(iph->saddr);
1430 +- cm_info->ip_version = TCP_IPV4;
1431 ++ cm_info->ip_version = QED_TCP_IPV4;
1432 +
1433 + ip_hlen = (iph->ihl) * sizeof(u32);
1434 + *payload_len = ntohs(iph->tot_len) - ip_hlen;
1435 +@@ -1692,7 +1692,7 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
1436 + cm_info->remote_ip[i] =
1437 + ntohl(ip6h->saddr.in6_u.u6_addr32[i]);
1438 + }
1439 +- cm_info->ip_version = TCP_IPV6;
1440 ++ cm_info->ip_version = QED_TCP_IPV6;
1441 +
1442 + ip_hlen = sizeof(*ip6h);
1443 + *payload_len = ntohs(ip6h->payload_len);
1444 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
1445 +index fb7c2d1562ae..bedbf840fd7d 100644
1446 +--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
1447 ++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
1448 +@@ -129,23 +129,16 @@ static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
1449 +
1450 + static enum roce_flavor qed_roce_mode_to_flavor(enum roce_mode roce_mode)
1451 + {
1452 +- enum roce_flavor flavor;
1453 +-
1454 + switch (roce_mode) {
1455 + case ROCE_V1:
1456 +- flavor = PLAIN_ROCE;
1457 +- break;
1458 ++ return PLAIN_ROCE;
1459 + case ROCE_V2_IPV4:
1460 +- flavor = RROCE_IPV4;
1461 +- break;
1462 ++ return RROCE_IPV4;
1463 + case ROCE_V2_IPV6:
1464 +- flavor = ROCE_V2_IPV6;
1465 +- break;
1466 ++ return RROCE_IPV6;
1467 + default:
1468 +- flavor = MAX_ROCE_MODE;
1469 +- break;
1470 ++ return MAX_ROCE_FLAVOR;
1471 + }
1472 +- return flavor;
1473 + }
1474 +
1475 + void qed_roce_free_cid_pair(struct qed_hwfn *p_hwfn, u16 cid)
1476 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
1477 +index 46d0c3cb83a5..d7c5965328be 100644
1478 +--- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
1479 ++++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
1480 +@@ -154,7 +154,7 @@ qed_set_pf_update_tunn_mode(struct qed_tunnel_info *p_tun,
1481 + static void qed_set_tunn_cls_info(struct qed_tunnel_info *p_tun,
1482 + struct qed_tunnel_info *p_src)
1483 + {
1484 +- enum tunnel_clss type;
1485 ++ int type;
1486 +
1487 + p_tun->b_update_rx_cls = p_src->b_update_rx_cls;
1488 + p_tun->b_update_tx_cls = p_src->b_update_tx_cls;
1489 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
1490 +index 6eb85db69f9a..dd8ebf6d380f 100644
1491 +--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
1492 ++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
1493 +@@ -413,7 +413,6 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn)
1494 + }
1495 +
1496 + if (!p_iov->b_pre_fp_hsi &&
1497 +- ETH_HSI_VER_MINOR &&
1498 + (resp->pfdev_info.minor_fp_hsi < ETH_HSI_VER_MINOR)) {
1499 + DP_INFO(p_hwfn,
1500 + "PF is using older fastpath HSI; %02x.%02x is configured\n",
1501 +@@ -572,7 +571,7 @@ free_p_iov:
1502 + static void
1503 + __qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req,
1504 + struct qed_tunn_update_type *p_src,
1505 +- enum qed_tunn_clss mask, u8 *p_cls)
1506 ++ enum qed_tunn_mode mask, u8 *p_cls)
1507 + {
1508 + if (p_src->b_update_mode) {
1509 + p_req->tun_mode_update_mask |= BIT(mask);
1510 +@@ -587,7 +586,7 @@ __qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req,
1511 + static void
1512 + qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req,
1513 + struct qed_tunn_update_type *p_src,
1514 +- enum qed_tunn_clss mask,
1515 ++ enum qed_tunn_mode mask,
1516 + u8 *p_cls, struct qed_tunn_update_udp_port *p_port,
1517 + u8 *p_update_port, u16 *p_udp_port)
1518 + {
1519 +diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
1520 +index 929fb8d96ec0..8d979fef5fc7 100644
1521 +--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
1522 ++++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
1523 +@@ -205,6 +205,9 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)
1524 + if (!skb)
1525 + return RX_HANDLER_CONSUMED;
1526 +
1527 ++ if (skb->pkt_type == PACKET_LOOPBACK)
1528 ++ return RX_HANDLER_PASS;
1529 ++
1530 + dev = skb->dev;
1531 + port = rmnet_get_port(dev);
1532 +
1533 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
1534 +index f7e540eeb877..1b61ce310132 100644
1535 +--- a/drivers/net/ethernet/realtek/r8169.c
1536 ++++ b/drivers/net/ethernet/realtek/r8169.c
1537 +@@ -7579,17 +7579,15 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
1538 + struct rtl8169_private *tp = container_of(napi, struct rtl8169_private, napi);
1539 + struct net_device *dev = tp->dev;
1540 + u16 enable_mask = RTL_EVENT_NAPI | tp->event_slow;
1541 +- int work_done= 0;
1542 ++ int work_done;
1543 + u16 status;
1544 +
1545 + status = rtl_get_events(tp);
1546 + rtl_ack_events(tp, status & ~tp->event_slow);
1547 +
1548 +- if (status & RTL_EVENT_NAPI_RX)
1549 +- work_done = rtl_rx(dev, tp, (u32) budget);
1550 ++ work_done = rtl_rx(dev, tp, (u32) budget);
1551 +
1552 +- if (status & RTL_EVENT_NAPI_TX)
1553 +- rtl_tx(dev, tp);
1554 ++ rtl_tx(dev, tp);
1555 +
1556 + if (status & tp->event_slow) {
1557 + enable_mask &= ~tp->event_slow;
1558 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
1559 +index f5f37bfa1d58..ff2eeddf588e 100644
1560 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
1561 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
1562 +@@ -133,7 +133,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
1563 + */
1564 + int stmmac_mdio_reset(struct mii_bus *bus)
1565 + {
1566 +-#if defined(CONFIG_STMMAC_PLATFORM)
1567 ++#if IS_ENABLED(CONFIG_STMMAC_PLATFORM)
1568 + struct net_device *ndev = bus->priv;
1569 + struct stmmac_priv *priv = netdev_priv(ndev);
1570 + unsigned int mii_address = priv->hw->mii.addr;
1571 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
1572 +index 6a393b16a1fc..c54a50dbd5ac 100644
1573 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
1574 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
1575 +@@ -303,7 +303,7 @@ static void stmmac_pci_remove(struct pci_dev *pdev)
1576 + pci_disable_device(pdev);
1577 + }
1578 +
1579 +-static int stmmac_pci_suspend(struct device *dev)
1580 ++static int __maybe_unused stmmac_pci_suspend(struct device *dev)
1581 + {
1582 + struct pci_dev *pdev = to_pci_dev(dev);
1583 + int ret;
1584 +@@ -321,7 +321,7 @@ static int stmmac_pci_suspend(struct device *dev)
1585 + return 0;
1586 + }
1587 +
1588 +-static int stmmac_pci_resume(struct device *dev)
1589 ++static int __maybe_unused stmmac_pci_resume(struct device *dev)
1590 + {
1591 + struct pci_dev *pdev = to_pci_dev(dev);
1592 + int ret;
1593 +diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
1594 +index 7a7c5224a336..16a6e1193912 100644
1595 +--- a/drivers/net/hamradio/yam.c
1596 ++++ b/drivers/net/hamradio/yam.c
1597 +@@ -980,6 +980,8 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1598 + sizeof(struct yamdrv_ioctl_mcs));
1599 + if (IS_ERR(ym))
1600 + return PTR_ERR(ym);
1601 ++ if (ym->cmd != SIOCYAMSMCS)
1602 ++ return -EINVAL;
1603 + if (ym->bitrate > YAM_MAXBITRATE) {
1604 + kfree(ym);
1605 + return -EINVAL;
1606 +@@ -995,6 +997,8 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1607 + if (copy_from_user(&yi, ifr->ifr_data, sizeof(struct yamdrv_ioctl_cfg)))
1608 + return -EFAULT;
1609 +
1610 ++ if (yi.cmd != SIOCYAMSCFG)
1611 ++ return -EINVAL;
1612 + if ((yi.cfg.mask & YAM_IOBASE) && netif_running(dev))
1613 + return -EINVAL; /* Cannot change this parameter when up */
1614 + if ((yi.cfg.mask & YAM_IRQ) && netif_running(dev))
1615 +diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
1616 +index a174d05a9752..fe76e2c4022a 100644
1617 +--- a/drivers/net/phy/phy_device.c
1618 ++++ b/drivers/net/phy/phy_device.c
1619 +@@ -1641,6 +1641,23 @@ int genphy_config_init(struct phy_device *phydev)
1620 + }
1621 + EXPORT_SYMBOL(genphy_config_init);
1622 +
1623 ++/* This is used for the phy device which doesn't support the MMD extended
1624 ++ * register access, but it does have side effect when we are trying to access
1625 ++ * the MMD register via indirect method.
1626 ++ */
1627 ++int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad, u16 regnum)
1628 ++{
1629 ++ return -EOPNOTSUPP;
1630 ++}
1631 ++EXPORT_SYMBOL(genphy_read_mmd_unsupported);
1632 ++
1633 ++int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
1634 ++ u16 regnum, u16 val)
1635 ++{
1636 ++ return -EOPNOTSUPP;
1637 ++}
1638 ++EXPORT_SYMBOL(genphy_write_mmd_unsupported);
1639 ++
1640 + int genphy_suspend(struct phy_device *phydev)
1641 + {
1642 + int value;
1643 +diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
1644 +index e4a6ed88b9cf..79f28b9186c6 100644
1645 +--- a/drivers/net/phy/phylink.c
1646 ++++ b/drivers/net/phy/phylink.c
1647 +@@ -561,7 +561,7 @@ void phylink_destroy(struct phylink *pl)
1648 + {
1649 + if (pl->sfp_bus)
1650 + sfp_unregister_upstream(pl->sfp_bus);
1651 +- if (!IS_ERR(pl->link_gpio))
1652 ++ if (!IS_ERR_OR_NULL(pl->link_gpio))
1653 + gpiod_put(pl->link_gpio);
1654 +
1655 + cancel_work_sync(&pl->resolve);
1656 +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
1657 +index 9cbe645e3d89..7d38af5ed4b5 100644
1658 +--- a/drivers/net/phy/realtek.c
1659 ++++ b/drivers/net/phy/realtek.c
1660 +@@ -138,6 +138,8 @@ static struct phy_driver realtek_drvs[] = {
1661 + .read_status = &genphy_read_status,
1662 + .ack_interrupt = &rtl821x_ack_interrupt,
1663 + .config_intr = &rtl8211b_config_intr,
1664 ++ .read_mmd = &genphy_read_mmd_unsupported,
1665 ++ .write_mmd = &genphy_write_mmd_unsupported,
1666 + }, {
1667 + .phy_id = 0x001cc914,
1668 + .name = "RTL8211DN Gigabit Ethernet",
1669 +diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
1670 +index 522d2900cd1d..e9fcf6ef716a 100644
1671 +--- a/drivers/net/usb/asix_common.c
1672 ++++ b/drivers/net/usb/asix_common.c
1673 +@@ -607,6 +607,9 @@ int asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
1674 + struct usbnet *dev = netdev_priv(net);
1675 + u8 opt = 0;
1676 +
1677 ++ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
1678 ++ return -EINVAL;
1679 ++
1680 + if (wolinfo->wolopts & WAKE_PHY)
1681 + opt |= AX_MONITOR_LINK;
1682 + if (wolinfo->wolopts & WAKE_MAGIC)
1683 +diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
1684 +index f32261ecd215..0f69b77e8502 100644
1685 +--- a/drivers/net/usb/ax88179_178a.c
1686 ++++ b/drivers/net/usb/ax88179_178a.c
1687 +@@ -566,6 +566,9 @@ ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
1688 + struct usbnet *dev = netdev_priv(net);
1689 + u8 opt = 0;
1690 +
1691 ++ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
1692 ++ return -EINVAL;
1693 ++
1694 + if (wolinfo->wolopts & WAKE_PHY)
1695 + opt |= AX_MONITOR_MODE_RWLC;
1696 + if (wolinfo->wolopts & WAKE_MAGIC)
1697 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
1698 +index 9e3f632e22f1..50e2e10a9050 100644
1699 +--- a/drivers/net/usb/lan78xx.c
1700 ++++ b/drivers/net/usb/lan78xx.c
1701 +@@ -1375,19 +1375,10 @@ static int lan78xx_set_wol(struct net_device *netdev,
1702 + if (ret < 0)
1703 + return ret;
1704 +
1705 +- pdata->wol = 0;
1706 +- if (wol->wolopts & WAKE_UCAST)
1707 +- pdata->wol |= WAKE_UCAST;
1708 +- if (wol->wolopts & WAKE_MCAST)
1709 +- pdata->wol |= WAKE_MCAST;
1710 +- if (wol->wolopts & WAKE_BCAST)
1711 +- pdata->wol |= WAKE_BCAST;
1712 +- if (wol->wolopts & WAKE_MAGIC)
1713 +- pdata->wol |= WAKE_MAGIC;
1714 +- if (wol->wolopts & WAKE_PHY)
1715 +- pdata->wol |= WAKE_PHY;
1716 +- if (wol->wolopts & WAKE_ARP)
1717 +- pdata->wol |= WAKE_ARP;
1718 ++ if (wol->wolopts & ~WAKE_ALL)
1719 ++ return -EINVAL;
1720 ++
1721 ++ pdata->wol = wol->wolopts;
1722 +
1723 + device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);
1724 +
1725 +@@ -2517,10 +2508,6 @@ static int lan78xx_open(struct net_device *net)
1726 + if (ret < 0)
1727 + goto out;
1728 +
1729 +- ret = lan78xx_reset(dev);
1730 +- if (ret < 0)
1731 +- goto done;
1732 +-
1733 + phy_start(net->phydev);
1734 +
1735 + netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
1736 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1737 +index 0fa64cc1a011..66beff4d7646 100644
1738 +--- a/drivers/net/usb/r8152.c
1739 ++++ b/drivers/net/usb/r8152.c
1740 +@@ -4497,6 +4497,9 @@ static int rtl8152_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1741 + if (!rtl_can_wakeup(tp))
1742 + return -EOPNOTSUPP;
1743 +
1744 ++ if (wol->wolopts & ~WAKE_ANY)
1745 ++ return -EINVAL;
1746 ++
1747 + ret = usb_autopm_get_interface(tp->intf);
1748 + if (ret < 0)
1749 + goto out_set_wol;
1750 +diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
1751 +index b64b1ee56d2d..ec287c9741e8 100644
1752 +--- a/drivers/net/usb/smsc75xx.c
1753 ++++ b/drivers/net/usb/smsc75xx.c
1754 +@@ -731,6 +731,9 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net,
1755 + struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
1756 + int ret;
1757 +
1758 ++ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
1759 ++ return -EINVAL;
1760 ++
1761 + pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
1762 +
1763 + ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
1764 +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
1765 +index 309b88acd3d0..99e684e39d35 100644
1766 +--- a/drivers/net/usb/smsc95xx.c
1767 ++++ b/drivers/net/usb/smsc95xx.c
1768 +@@ -774,6 +774,9 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net,
1769 + struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1770 + int ret;
1771 +
1772 ++ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
1773 ++ return -EINVAL;
1774 ++
1775 + pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
1776 +
1777 + ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
1778 +diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
1779 +index 9277a0f228df..35f39f23d881 100644
1780 +--- a/drivers/net/usb/sr9800.c
1781 ++++ b/drivers/net/usb/sr9800.c
1782 +@@ -421,6 +421,9 @@ sr_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
1783 + struct usbnet *dev = netdev_priv(net);
1784 + u8 opt = 0;
1785 +
1786 ++ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
1787 ++ return -EINVAL;
1788 ++
1789 + if (wolinfo->wolopts & WAKE_PHY)
1790 + opt |= SR_MONITOR_LINK;
1791 + if (wolinfo->wolopts & WAKE_MAGIC)
1792 +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
1793 +index 910c46b47769..f528e9ac3413 100644
1794 +--- a/drivers/net/virtio_net.c
1795 ++++ b/drivers/net/virtio_net.c
1796 +@@ -1872,8 +1872,9 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
1797 + /* Make sure no work handler is accessing the device */
1798 + flush_work(&vi->config_work);
1799 +
1800 ++ netif_tx_lock_bh(vi->dev);
1801 + netif_device_detach(vi->dev);
1802 +- netif_tx_disable(vi->dev);
1803 ++ netif_tx_unlock_bh(vi->dev);
1804 + cancel_delayed_work_sync(&vi->refill);
1805 +
1806 + if (netif_running(vi->dev)) {
1807 +@@ -1909,7 +1910,9 @@ static int virtnet_restore_up(struct virtio_device *vdev)
1808 + }
1809 + }
1810 +
1811 ++ netif_tx_lock_bh(vi->dev);
1812 + netif_device_attach(vi->dev);
1813 ++ netif_tx_unlock_bh(vi->dev);
1814 + return err;
1815 + }
1816 +
1817 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h b/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
1818 +index 3684a3e180e5..007bfe7656a4 100644
1819 +--- a/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
1820 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
1821 +@@ -95,8 +95,8 @@ enum {
1822 + #define IWL_ALIVE_FLG_RFKILL BIT(0)
1823 +
1824 + struct iwl_lmac_alive {
1825 +- __le32 ucode_minor;
1826 + __le32 ucode_major;
1827 ++ __le32 ucode_minor;
1828 + u8 ver_subtype;
1829 + u8 ver_type;
1830 + u8 mac;
1831 +@@ -113,8 +113,8 @@ struct iwl_lmac_alive {
1832 + } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
1833 +
1834 + struct iwl_umac_alive {
1835 +- __le32 umac_minor; /* UMAC version: minor */
1836 + __le32 umac_major; /* UMAC version: major */
1837 ++ __le32 umac_minor; /* UMAC version: minor */
1838 + __le32 error_info_addr; /* SRAM address for UMAC error log */
1839 + __le32 dbg_print_buff_addr;
1840 + } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
1841 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1842 +index 2fa7ec466275..839010417241 100644
1843 +--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1844 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
1845 +@@ -950,7 +950,20 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
1846 + if (trigger)
1847 + delay = msecs_to_jiffies(le32_to_cpu(trigger->stop_delay));
1848 +
1849 +- if (WARN(fwrt->trans->state == IWL_TRANS_NO_FW,
1850 ++ /*
1851 ++ * If the loading of the FW completed successfully, the next step is to
1852 ++ * get the SMEM config data. Thus, if fwrt->smem_cfg.num_lmacs is non
1853 ++ * zero, the FW was already loaded successully. If the state is "NO_FW"
1854 ++ * in such a case - WARN and exit, since FW may be dead. Otherwise, we
1855 ++ * can try to collect the data, since FW might just not be fully
1856 ++ * loaded (no "ALIVE" yet), and the debug data is accessible.
1857 ++ *
1858 ++ * Corner case: got the FW alive but crashed before getting the SMEM
1859 ++ * config. In such a case, due to HW access problems, we might
1860 ++ * collect garbage.
1861 ++ */
1862 ++ if (WARN((fwrt->trans->state == IWL_TRANS_NO_FW) &&
1863 ++ fwrt->smem_cfg.num_lmacs,
1864 + "Can't collect dbg data when FW isn't alive\n"))
1865 + return -EIO;
1866 +
1867 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
1868 +index 2d14a58cbdd7..c73e4be9bde3 100644
1869 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
1870 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
1871 +@@ -439,7 +439,8 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
1872 + rx_status->bw = RATE_INFO_BW_160;
1873 + break;
1874 + }
1875 +- if (rate_n_flags & RATE_MCS_SGI_MSK)
1876 ++ if (!(rate_n_flags & RATE_MCS_CCK_MSK) &&
1877 ++ rate_n_flags & RATE_MCS_SGI_MSK)
1878 + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
1879 + if (rate_n_flags & RATE_HT_MCS_GF_MSK)
1880 + rx_status->enc_flags |= RX_ENC_FLAG_HT_GF;
1881 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1882 +index e2196dc35dc6..8ba8c70571fb 100644
1883 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1884 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1885 +@@ -981,7 +981,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
1886 + rx_status->bw = RATE_INFO_BW_160;
1887 + break;
1888 + }
1889 +- if (rate_n_flags & RATE_MCS_SGI_MSK)
1890 ++
1891 ++ if (!(rate_n_flags & RATE_MCS_CCK_MSK) &&
1892 ++ rate_n_flags & RATE_MCS_SGI_MSK)
1893 + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
1894 + if (rate_n_flags & RATE_HT_MCS_GF_MSK)
1895 + rx_status->enc_flags |= RX_ENC_FLAG_HT_GF;
1896 +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
1897 +index aafa7aa18fbd..477f9f2f6626 100644
1898 +--- a/drivers/net/wireless/mac80211_hwsim.c
1899 ++++ b/drivers/net/wireless/mac80211_hwsim.c
1900 +@@ -2730,8 +2730,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
1901 + list_add_tail(&data->list, &hwsim_radios);
1902 + spin_unlock_bh(&hwsim_radio_lock);
1903 +
1904 +- if (idx > 0)
1905 +- hwsim_mcast_new_radio(idx, info, param);
1906 ++ hwsim_mcast_new_radio(idx, info, param);
1907 +
1908 + return idx;
1909 +
1910 +diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c
1911 +index 43743c26c071..39bf85d0ade0 100644
1912 +--- a/drivers/net/wireless/marvell/libertas/if_sdio.c
1913 ++++ b/drivers/net/wireless/marvell/libertas/if_sdio.c
1914 +@@ -1317,6 +1317,10 @@ static int if_sdio_suspend(struct device *dev)
1915 + if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
1916 + dev_info(dev, "Suspend without wake params -- powering down card\n");
1917 + if (priv->fw_ready) {
1918 ++ ret = lbs_suspend(priv);
1919 ++ if (ret)
1920 ++ return ret;
1921 ++
1922 + priv->power_up_on_resume = true;
1923 + if_sdio_power_off(card);
1924 + }
1925 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1926 +index 1a40fc3517a8..6ea95b316256 100644
1927 +--- a/drivers/net/xen-netfront.c
1928 ++++ b/drivers/net/xen-netfront.c
1929 +@@ -1824,7 +1824,7 @@ static int talk_to_netback(struct xenbus_device *dev,
1930 + err = xen_net_read_mac(dev, info->netdev->dev_addr);
1931 + if (err) {
1932 + xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
1933 +- goto out;
1934 ++ goto out_unlocked;
1935 + }
1936 +
1937 + rtnl_lock();
1938 +@@ -1939,6 +1939,7 @@ abort_transaction_no_dev_fatal:
1939 + xennet_destroy_queues(info);
1940 + out:
1941 + rtnl_unlock();
1942 ++out_unlocked:
1943 + device_unregister(&dev->dev);
1944 + return err;
1945 + }
1946 +@@ -1964,10 +1965,6 @@ static int xennet_connect(struct net_device *dev)
1947 + /* talk_to_netback() sets the correct number of queues */
1948 + num_queues = dev->real_num_tx_queues;
1949 +
1950 +- rtnl_lock();
1951 +- netdev_update_features(dev);
1952 +- rtnl_unlock();
1953 +-
1954 + if (dev->reg_state == NETREG_UNINITIALIZED) {
1955 + err = register_netdev(dev);
1956 + if (err) {
1957 +@@ -1977,6 +1974,10 @@ static int xennet_connect(struct net_device *dev)
1958 + }
1959 + }
1960 +
1961 ++ rtnl_lock();
1962 ++ netdev_update_features(dev);
1963 ++ rtnl_unlock();
1964 ++
1965 + /*
1966 + * All public and private state should now be sane. Get
1967 + * ready to start sending and receiving packets and give the driver
1968 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
1969 +index 4f2747cd15a6..169dd7127f9e 100644
1970 +--- a/drivers/s390/net/qeth_core_main.c
1971 ++++ b/drivers/s390/net/qeth_core_main.c
1972 +@@ -3001,28 +3001,23 @@ static int qeth_send_startlan(struct qeth_card *card)
1973 + return rc;
1974 + }
1975 +
1976 +-static int qeth_default_setadapterparms_cb(struct qeth_card *card,
1977 +- struct qeth_reply *reply, unsigned long data)
1978 ++static int qeth_setadpparms_inspect_rc(struct qeth_ipa_cmd *cmd)
1979 + {
1980 +- struct qeth_ipa_cmd *cmd;
1981 +-
1982 +- QETH_CARD_TEXT(card, 4, "defadpcb");
1983 +-
1984 +- cmd = (struct qeth_ipa_cmd *) data;
1985 +- if (cmd->hdr.return_code == 0)
1986 ++ if (!cmd->hdr.return_code)
1987 + cmd->hdr.return_code =
1988 + cmd->data.setadapterparms.hdr.return_code;
1989 +- return 0;
1990 ++ return cmd->hdr.return_code;
1991 + }
1992 +
1993 + static int qeth_query_setadapterparms_cb(struct qeth_card *card,
1994 + struct qeth_reply *reply, unsigned long data)
1995 + {
1996 +- struct qeth_ipa_cmd *cmd;
1997 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
1998 +
1999 + QETH_CARD_TEXT(card, 3, "quyadpcb");
2000 ++ if (qeth_setadpparms_inspect_rc(cmd))
2001 ++ return 0;
2002 +
2003 +- cmd = (struct qeth_ipa_cmd *) data;
2004 + if (cmd->data.setadapterparms.data.query_cmds_supp.lan_type & 0x7f) {
2005 + card->info.link_type =
2006 + cmd->data.setadapterparms.data.query_cmds_supp.lan_type;
2007 +@@ -3030,7 +3025,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card,
2008 + }
2009 + card->options.adp.supported_funcs =
2010 + cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds;
2011 +- return qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
2012 ++ return 0;
2013 + }
2014 +
2015 + static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card,
2016 +@@ -3122,22 +3117,20 @@ EXPORT_SYMBOL_GPL(qeth_query_ipassists);
2017 + static int qeth_query_switch_attributes_cb(struct qeth_card *card,
2018 + struct qeth_reply *reply, unsigned long data)
2019 + {
2020 +- struct qeth_ipa_cmd *cmd;
2021 +- struct qeth_switch_info *sw_info;
2022 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
2023 + struct qeth_query_switch_attributes *attrs;
2024 ++ struct qeth_switch_info *sw_info;
2025 +
2026 + QETH_CARD_TEXT(card, 2, "qswiatcb");
2027 +- cmd = (struct qeth_ipa_cmd *) data;
2028 +- sw_info = (struct qeth_switch_info *)reply->param;
2029 +- if (cmd->data.setadapterparms.hdr.return_code == 0) {
2030 +- attrs = &cmd->data.setadapterparms.data.query_switch_attributes;
2031 +- sw_info->capabilities = attrs->capabilities;
2032 +- sw_info->settings = attrs->settings;
2033 +- QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities,
2034 +- sw_info->settings);
2035 +- }
2036 +- qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
2037 ++ if (qeth_setadpparms_inspect_rc(cmd))
2038 ++ return 0;
2039 +
2040 ++ sw_info = (struct qeth_switch_info *)reply->param;
2041 ++ attrs = &cmd->data.setadapterparms.data.query_switch_attributes;
2042 ++ sw_info->capabilities = attrs->capabilities;
2043 ++ sw_info->settings = attrs->settings;
2044 ++ QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities,
2045 ++ sw_info->settings);
2046 + return 0;
2047 + }
2048 +
2049 +@@ -4188,16 +4181,13 @@ EXPORT_SYMBOL_GPL(qeth_do_send_packet);
2050 + static int qeth_setadp_promisc_mode_cb(struct qeth_card *card,
2051 + struct qeth_reply *reply, unsigned long data)
2052 + {
2053 +- struct qeth_ipa_cmd *cmd;
2054 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
2055 + struct qeth_ipacmd_setadpparms *setparms;
2056 +
2057 + QETH_CARD_TEXT(card, 4, "prmadpcb");
2058 +
2059 +- cmd = (struct qeth_ipa_cmd *) data;
2060 + setparms = &(cmd->data.setadapterparms);
2061 +-
2062 +- qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
2063 +- if (cmd->hdr.return_code) {
2064 ++ if (qeth_setadpparms_inspect_rc(cmd)) {
2065 + QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code);
2066 + setparms->data.mode = SET_PROMISC_MODE_OFF;
2067 + }
2068 +@@ -4267,11 +4257,12 @@ EXPORT_SYMBOL_GPL(qeth_get_stats);
2069 + static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
2070 + struct qeth_reply *reply, unsigned long data)
2071 + {
2072 +- struct qeth_ipa_cmd *cmd;
2073 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
2074 +
2075 + QETH_CARD_TEXT(card, 4, "chgmaccb");
2076 ++ if (qeth_setadpparms_inspect_rc(cmd))
2077 ++ return 0;
2078 +
2079 +- cmd = (struct qeth_ipa_cmd *) data;
2080 + if (!card->options.layer2 ||
2081 + !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) {
2082 + memcpy(card->dev->dev_addr,
2083 +@@ -4279,7 +4270,6 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
2084 + OSA_ADDR_LEN);
2085 + card->info.mac_bits |= QETH_LAYER2_MAC_READ;
2086 + }
2087 +- qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
2088 + return 0;
2089 + }
2090 +
2091 +@@ -4310,13 +4300,15 @@ EXPORT_SYMBOL_GPL(qeth_setadpparms_change_macaddr);
2092 + static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
2093 + struct qeth_reply *reply, unsigned long data)
2094 + {
2095 +- struct qeth_ipa_cmd *cmd;
2096 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
2097 + struct qeth_set_access_ctrl *access_ctrl_req;
2098 + int fallback = *(int *)reply->param;
2099 +
2100 + QETH_CARD_TEXT(card, 4, "setaccb");
2101 ++ if (cmd->hdr.return_code)
2102 ++ return 0;
2103 ++ qeth_setadpparms_inspect_rc(cmd);
2104 +
2105 +- cmd = (struct qeth_ipa_cmd *) data;
2106 + access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;
2107 + QETH_DBF_TEXT_(SETUP, 2, "setaccb");
2108 + QETH_DBF_TEXT_(SETUP, 2, "%s", card->gdev->dev.kobj.name);
2109 +@@ -4389,7 +4381,6 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
2110 + card->options.isolation = card->options.prev_isolation;
2111 + break;
2112 + }
2113 +- qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
2114 + return 0;
2115 + }
2116 +
2117 +@@ -4677,14 +4668,15 @@ out:
2118 + static int qeth_setadpparms_query_oat_cb(struct qeth_card *card,
2119 + struct qeth_reply *reply, unsigned long data)
2120 + {
2121 +- struct qeth_ipa_cmd *cmd;
2122 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;
2123 + struct qeth_qoat_priv *priv;
2124 + char *resdata;
2125 + int resdatalen;
2126 +
2127 + QETH_CARD_TEXT(card, 3, "qoatcb");
2128 ++ if (qeth_setadpparms_inspect_rc(cmd))
2129 ++ return 0;
2130 +
2131 +- cmd = (struct qeth_ipa_cmd *)data;
2132 + priv = (struct qeth_qoat_priv *)reply->param;
2133 + resdatalen = cmd->data.setadapterparms.hdr.cmdlength;
2134 + resdata = (char *)data + 28;
2135 +@@ -4778,21 +4770,18 @@ out:
2136 + static int qeth_query_card_info_cb(struct qeth_card *card,
2137 + struct qeth_reply *reply, unsigned long data)
2138 + {
2139 +- struct qeth_ipa_cmd *cmd;
2140 ++ struct carrier_info *carrier_info = (struct carrier_info *)reply->param;
2141 ++ struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;
2142 + struct qeth_query_card_info *card_info;
2143 +- struct carrier_info *carrier_info;
2144 +
2145 + QETH_CARD_TEXT(card, 2, "qcrdincb");
2146 +- carrier_info = (struct carrier_info *)reply->param;
2147 +- cmd = (struct qeth_ipa_cmd *)data;
2148 +- card_info = &cmd->data.setadapterparms.data.card_info;
2149 +- if (cmd->data.setadapterparms.hdr.return_code == 0) {
2150 +- carrier_info->card_type = card_info->card_type;
2151 +- carrier_info->port_mode = card_info->port_mode;
2152 +- carrier_info->port_speed = card_info->port_speed;
2153 +- }
2154 ++ if (qeth_setadpparms_inspect_rc(cmd))
2155 ++ return 0;
2156 +
2157 +- qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
2158 ++ card_info = &cmd->data.setadapterparms.data.card_info;
2159 ++ carrier_info->card_type = card_info->card_type;
2160 ++ carrier_info->port_mode = card_info->port_mode;
2161 ++ carrier_info->port_speed = card_info->port_speed;
2162 + return 0;
2163 + }
2164 +
2165 +diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
2166 +index 998788a967be..3e38bae6ecde 100644
2167 +--- a/drivers/scsi/aacraid/commsup.c
2168 ++++ b/drivers/scsi/aacraid/commsup.c
2169 +@@ -2506,8 +2506,8 @@ int aac_command_thread(void *data)
2170 + /* Synchronize our watches */
2171 + if (((NSEC_PER_SEC - (NSEC_PER_SEC / HZ)) > now.tv_nsec)
2172 + && (now.tv_nsec > (NSEC_PER_SEC / HZ)))
2173 +- difference = (((NSEC_PER_SEC - now.tv_nsec) * HZ)
2174 +- + NSEC_PER_SEC / 2) / NSEC_PER_SEC;
2175 ++ difference = HZ + HZ / 2 -
2176 ++ now.tv_nsec / (NSEC_PER_SEC / HZ);
2177 + else {
2178 + if (now.tv_nsec > NSEC_PER_SEC / 2)
2179 + ++now.tv_sec;
2180 +@@ -2531,6 +2531,10 @@ int aac_command_thread(void *data)
2181 + if (kthread_should_stop())
2182 + break;
2183 +
2184 ++ /*
2185 ++ * we probably want usleep_range() here instead of the
2186 ++ * jiffies computation
2187 ++ */
2188 + schedule_timeout(difference);
2189 +
2190 + if (kthread_should_stop())
2191 +diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
2192 +index b491af31a5f8..a06b24a61622 100644
2193 +--- a/drivers/scsi/ibmvscsi/ibmvfc.c
2194 ++++ b/drivers/scsi/ibmvscsi/ibmvfc.c
2195 +@@ -3580,11 +3580,9 @@ static void ibmvfc_tgt_implicit_logout(struct ibmvfc_target *tgt)
2196 + static int ibmvfc_adisc_needs_plogi(struct ibmvfc_passthru_mad *mad,
2197 + struct ibmvfc_target *tgt)
2198 + {
2199 +- if (memcmp(&mad->fc_iu.response[2], &tgt->ids.port_name,
2200 +- sizeof(tgt->ids.port_name)))
2201 ++ if (wwn_to_u64((u8 *)&mad->fc_iu.response[2]) != tgt->ids.port_name)
2202 + return 1;
2203 +- if (memcmp(&mad->fc_iu.response[4], &tgt->ids.node_name,
2204 +- sizeof(tgt->ids.node_name)))
2205 ++ if (wwn_to_u64((u8 *)&mad->fc_iu.response[4]) != tgt->ids.node_name)
2206 + return 1;
2207 + if (be32_to_cpu(mad->fc_iu.response[6]) != tgt->scsi_id)
2208 + return 1;
2209 +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
2210 +index 1d42d38f5a45..0e19f6bc24ff 100644
2211 +--- a/drivers/scsi/qla2xxx/qla_init.c
2212 ++++ b/drivers/scsi/qla2xxx/qla_init.c
2213 +@@ -1365,8 +1365,8 @@ qla24xx_abort_sp_done(void *ptr, int res)
2214 + srb_t *sp = ptr;
2215 + struct srb_iocb *abt = &sp->u.iocb_cmd;
2216 +
2217 +- del_timer(&sp->u.iocb_cmd.timer);
2218 +- complete(&abt->u.abt.comp);
2219 ++ if (del_timer(&sp->u.iocb_cmd.timer))
2220 ++ complete(&abt->u.abt.comp);
2221 + }
2222 +
2223 + int
2224 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2225 +index 6d3091ff9b92..c7b284587365 100644
2226 +--- a/drivers/scsi/sd.c
2227 ++++ b/drivers/scsi/sd.c
2228 +@@ -2498,6 +2498,8 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
2229 + sector_size = old_sector_size;
2230 + goto got_data;
2231 + }
2232 ++ /* Remember that READ CAPACITY(16) succeeded */
2233 ++ sdp->try_rc_10_first = 0;
2234 + }
2235 + }
2236 +
2237 +diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
2238 +index 0c6065dba48a..4f27e95efcdd 100644
2239 +--- a/drivers/soc/fsl/qbman/qman.c
2240 ++++ b/drivers/soc/fsl/qbman/qman.c
2241 +@@ -2699,6 +2699,9 @@ static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt)
2242 + {
2243 + unsigned long addr;
2244 +
2245 ++ if (!p)
2246 ++ return -ENODEV;
2247 ++
2248 + addr = gen_pool_alloc(p, cnt);
2249 + if (!addr)
2250 + return -ENOMEM;
2251 +diff --git a/drivers/soc/fsl/qe/ucc.c b/drivers/soc/fsl/qe/ucc.c
2252 +index c646d8713861..681f7d4b7724 100644
2253 +--- a/drivers/soc/fsl/qe/ucc.c
2254 ++++ b/drivers/soc/fsl/qe/ucc.c
2255 +@@ -626,7 +626,7 @@ static u32 ucc_get_tdm_sync_shift(enum comm_dir mode, u32 tdm_num)
2256 + {
2257 + u32 shift;
2258 +
2259 +- shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE;
2260 ++ shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE;
2261 + shift -= tdm_num * 2;
2262 +
2263 + return shift;
2264 +diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
2265 +index 4a22a9f06d96..eb7898353457 100644
2266 +--- a/drivers/usb/usbip/vhci_sysfs.c
2267 ++++ b/drivers/usb/usbip/vhci_sysfs.c
2268 +@@ -34,10 +34,10 @@
2269 +
2270 + /*
2271 + * output example:
2272 +- * hub port sta spd dev sockfd local_busid
2273 +- * hs 0000 004 000 00000000 3 1-2.3
2274 ++ * hub port sta spd dev sockfd local_busid
2275 ++ * hs 0000 004 000 00000000 000003 1-2.3
2276 + * ................................................
2277 +- * ss 0008 004 000 00000000 4 2-3.4
2278 ++ * ss 0008 004 000 00000000 000004 2-3.4
2279 + * ................................................
2280 + *
2281 + * Output includes socket fd instead of socket pointer address to avoid
2282 +@@ -61,13 +61,13 @@ static void port_show_vhci(char **out, int hub, int port, struct vhci_device *vd
2283 + if (vdev->ud.status == VDEV_ST_USED) {
2284 + *out += sprintf(*out, "%03u %08x ",
2285 + vdev->speed, vdev->devid);
2286 +- *out += sprintf(*out, "%u %s",
2287 ++ *out += sprintf(*out, "%06u %s",
2288 + vdev->ud.sockfd,
2289 + dev_name(&vdev->udev->dev));
2290 +
2291 + } else {
2292 + *out += sprintf(*out, "000 00000000 ");
2293 +- *out += sprintf(*out, "0000000000000000 0-0");
2294 ++ *out += sprintf(*out, "000000 0-0");
2295 + }
2296 +
2297 + *out += sprintf(*out, "\n");
2298 +@@ -165,7 +165,7 @@ static ssize_t status_show(struct device *dev,
2299 + int pdev_nr;
2300 +
2301 + out += sprintf(out,
2302 +- "hub port sta spd dev socket local_busid\n");
2303 ++ "hub port sta spd dev sockfd local_busid\n");
2304 +
2305 + pdev_nr = status_name_to_id(attr->attr.name);
2306 + if (pdev_nr < 0)
2307 +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
2308 +index 7ee3167bc083..ffdd4e937d1d 100644
2309 +--- a/drivers/vhost/vhost.c
2310 ++++ b/drivers/vhost/vhost.c
2311 +@@ -30,6 +30,7 @@
2312 + #include <linux/sched/mm.h>
2313 + #include <linux/sched/signal.h>
2314 + #include <linux/interval_tree_generic.h>
2315 ++#include <linux/nospec.h>
2316 +
2317 + #include "vhost.h"
2318 +
2319 +@@ -1366,6 +1367,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
2320 + if (idx >= d->nvqs)
2321 + return -ENOBUFS;
2322 +
2323 ++ idx = array_index_nospec(idx, d->nvqs);
2324 + vq = d->vqs[idx];
2325 +
2326 + mutex_lock(&vq->mutex);
2327 +diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
2328 +index def3a501acd6..d059d04c63ac 100644
2329 +--- a/drivers/video/fbdev/pxa168fb.c
2330 ++++ b/drivers/video/fbdev/pxa168fb.c
2331 +@@ -712,7 +712,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
2332 + /*
2333 + * enable controller clock
2334 + */
2335 +- clk_enable(fbi->clk);
2336 ++ clk_prepare_enable(fbi->clk);
2337 +
2338 + pxa168fb_set_par(info);
2339 +
2340 +@@ -767,7 +767,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
2341 + failed_free_cmap:
2342 + fb_dealloc_cmap(&info->cmap);
2343 + failed_free_clk:
2344 +- clk_disable(fbi->clk);
2345 ++ clk_disable_unprepare(fbi->clk);
2346 + failed_free_fbmem:
2347 + dma_free_coherent(fbi->dev, info->fix.smem_len,
2348 + info->screen_base, fbi->fb_start_dma);
2349 +@@ -807,7 +807,7 @@ static int pxa168fb_remove(struct platform_device *pdev)
2350 + dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
2351 + info->screen_base, info->fix.smem_start);
2352 +
2353 +- clk_disable(fbi->clk);
2354 ++ clk_disable_unprepare(fbi->clk);
2355 +
2356 + framebuffer_release(info);
2357 +
2358 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
2359 +index 473ad5985aa3..47dec283628d 100644
2360 +--- a/fs/btrfs/qgroup.c
2361 ++++ b/fs/btrfs/qgroup.c
2362 +@@ -2603,8 +2603,10 @@ out:
2363 + }
2364 + btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
2365 +
2366 +- if (done && !ret)
2367 ++ if (done && !ret) {
2368 + ret = 1;
2369 ++ fs_info->qgroup_rescan_progress.objectid = (u64)-1;
2370 ++ }
2371 + return ret;
2372 + }
2373 +
2374 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
2375 +index 2cd0b3053439..d01cbca84701 100644
2376 +--- a/fs/cifs/inode.c
2377 ++++ b/fs/cifs/inode.c
2378 +@@ -712,7 +712,7 @@ cgfi_exit:
2379 + /* Simple function to return a 64 bit hash of string. Rarely called */
2380 + static __u64 simple_hashstr(const char *str)
2381 + {
2382 +- const __u64 hash_mult = 1125899906842597L; /* a big enough prime */
2383 ++ const __u64 hash_mult = 1125899906842597ULL; /* a big enough prime */
2384 + __u64 hash = 0;
2385 +
2386 + while (*str)
2387 +diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
2388 +index a40f36b1b292..9635df94db7d 100644
2389 +--- a/fs/fat/fatent.c
2390 ++++ b/fs/fat/fatent.c
2391 +@@ -681,6 +681,7 @@ int fat_count_free_clusters(struct super_block *sb)
2392 + if (ops->ent_get(&fatent) == FAT_ENT_FREE)
2393 + free++;
2394 + } while (fat_ent_next(sbi, &fatent));
2395 ++ cond_resched();
2396 + }
2397 + sbi->free_clusters = free;
2398 + sbi->free_clus_valid = 1;
2399 +diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
2400 +index 1b1283f07941..824f407df1db 100644
2401 +--- a/fs/ocfs2/refcounttree.c
2402 ++++ b/fs/ocfs2/refcounttree.c
2403 +@@ -2946,6 +2946,7 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
2404 + if (map_end & (PAGE_SIZE - 1))
2405 + to = map_end & (PAGE_SIZE - 1);
2406 +
2407 ++retry:
2408 + page = find_or_create_page(mapping, page_index, GFP_NOFS);
2409 + if (!page) {
2410 + ret = -ENOMEM;
2411 +@@ -2954,11 +2955,18 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
2412 + }
2413 +
2414 + /*
2415 +- * In case PAGE_SIZE <= CLUSTER_SIZE, This page
2416 +- * can't be dirtied before we CoW it out.
2417 ++ * In case PAGE_SIZE <= CLUSTER_SIZE, we do not expect a dirty
2418 ++ * page, so write it back.
2419 + */
2420 +- if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize)
2421 +- BUG_ON(PageDirty(page));
2422 ++ if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) {
2423 ++ if (PageDirty(page)) {
2424 ++ /*
2425 ++ * write_on_page will unlock the page on return
2426 ++ */
2427 ++ ret = write_one_page(page);
2428 ++ goto retry;
2429 ++ }
2430 ++ }
2431 +
2432 + if (!PageUptodate(page)) {
2433 + ret = block_read_full_page(page, ocfs2_get_block);
2434 +diff --git a/include/linux/bpf.h b/include/linux/bpf.h
2435 +index 5c5be80ce802..c9d2a1a3ef11 100644
2436 +--- a/include/linux/bpf.h
2437 ++++ b/include/linux/bpf.h
2438 +@@ -27,6 +27,7 @@ struct bpf_map_ops {
2439 + void (*map_release)(struct bpf_map *map, struct file *map_file);
2440 + void (*map_free)(struct bpf_map *map);
2441 + int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
2442 ++ void (*map_release_uref)(struct bpf_map *map);
2443 +
2444 + /* funcs callable from userspace and from eBPF programs */
2445 + void *(*map_lookup_elem)(struct bpf_map *map, void *key);
2446 +@@ -300,7 +301,6 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);
2447 + int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file,
2448 + void *key, void *value, u64 map_flags);
2449 + int bpf_fd_array_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
2450 +-void bpf_fd_array_map_clear(struct bpf_map *map);
2451 + int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,
2452 + void *key, void *value, u64 map_flags);
2453 + int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
2454 +diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
2455 +index 6b79a9bba9a7..4be464a07612 100644
2456 +--- a/include/linux/compiler_types.h
2457 ++++ b/include/linux/compiler_types.h
2458 +@@ -78,6 +78,18 @@ extern void __chk_io_ptr(const volatile void __iomem *);
2459 + #include <linux/compiler-clang.h>
2460 + #endif
2461 +
2462 ++/*
2463 ++ * Some architectures need to provide custom definitions of macros provided
2464 ++ * by linux/compiler-*.h, and can do so using asm/compiler.h. We include that
2465 ++ * conditionally rather than using an asm-generic wrapper in order to avoid
2466 ++ * build failures if any C compilation, which will include this file via an
2467 ++ * -include argument in c_flags, occurs prior to the asm-generic wrappers being
2468 ++ * generated.
2469 ++ */
2470 ++#ifdef CONFIG_HAVE_ARCH_COMPILER_H
2471 ++#include <asm/compiler.h>
2472 ++#endif
2473 ++
2474 + /*
2475 + * Generic compiler-dependent macros required for kernel
2476 + * build go below this comment. Actual compiler/compiler version
2477 +diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h
2478 +index 767467d886de..67c75372b691 100644
2479 +--- a/include/linux/iio/buffer-dma.h
2480 ++++ b/include/linux/iio/buffer-dma.h
2481 +@@ -141,7 +141,7 @@ int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n,
2482 + char __user *user_buffer);
2483 + size_t iio_dma_buffer_data_available(struct iio_buffer *buffer);
2484 + int iio_dma_buffer_set_bytes_per_datum(struct iio_buffer *buffer, size_t bpd);
2485 +-int iio_dma_buffer_set_length(struct iio_buffer *buffer, int length);
2486 ++int iio_dma_buffer_set_length(struct iio_buffer *buffer, unsigned int length);
2487 + int iio_dma_buffer_request_update(struct iio_buffer *buffer);
2488 +
2489 + int iio_dma_buffer_init(struct iio_dma_buffer_queue *queue,
2490 +diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
2491 +index c4d19e77fea8..fb677e4f902d 100644
2492 +--- a/include/linux/mlx5/driver.h
2493 ++++ b/include/linux/mlx5/driver.h
2494 +@@ -1193,25 +1193,9 @@ enum {
2495 + };
2496 +
2497 + static inline const struct cpumask *
2498 +-mlx5_get_vector_affinity(struct mlx5_core_dev *dev, int vector)
2499 ++mlx5_get_vector_affinity_hint(struct mlx5_core_dev *dev, int vector)
2500 + {
2501 +- const struct cpumask *mask;
2502 +- struct irq_desc *desc;
2503 +- unsigned int irq;
2504 +- int eqn;
2505 +- int err;
2506 +-
2507 +- err = mlx5_vector2eqn(dev, MLX5_EQ_VEC_COMP_BASE + vector, &eqn, &irq);
2508 +- if (err)
2509 +- return NULL;
2510 +-
2511 +- desc = irq_to_desc(irq);
2512 +-#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
2513 +- mask = irq_data_get_effective_affinity_mask(&desc->irq_data);
2514 +-#else
2515 +- mask = desc->irq_common_data.affinity;
2516 +-#endif
2517 +- return mask;
2518 ++ return dev->priv.irq_info[vector].mask;
2519 + }
2520 +
2521 + #endif /* MLX5_DRIVER_H */
2522 +diff --git a/include/linux/phy.h b/include/linux/phy.h
2523 +index dca9e926b88f..efc04c2d92c9 100644
2524 +--- a/include/linux/phy.h
2525 ++++ b/include/linux/phy.h
2526 +@@ -879,6 +879,10 @@ static inline int genphy_no_soft_reset(struct phy_device *phydev)
2527 + {
2528 + return 0;
2529 + }
2530 ++int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,
2531 ++ u16 regnum);
2532 ++int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
2533 ++ u16 regnum, u16 val);
2534 +
2535 + /* Clause 45 PHY */
2536 + int genphy_c45_restart_aneg(struct phy_device *phydev);
2537 +diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
2538 +index f57d0bdf3c9e..a8f55ea4146b 100644
2539 +--- a/kernel/bpf/arraymap.c
2540 ++++ b/kernel/bpf/arraymap.c
2541 +@@ -467,7 +467,7 @@ static u32 prog_fd_array_sys_lookup_elem(void *ptr)
2542 + }
2543 +
2544 + /* decrement refcnt of all bpf_progs that are stored in this map */
2545 +-void bpf_fd_array_map_clear(struct bpf_map *map)
2546 ++static void bpf_fd_array_map_clear(struct bpf_map *map)
2547 + {
2548 + struct bpf_array *array = container_of(map, struct bpf_array, map);
2549 + int i;
2550 +@@ -485,6 +485,7 @@ const struct bpf_map_ops prog_array_map_ops = {
2551 + .map_fd_get_ptr = prog_fd_array_get_ptr,
2552 + .map_fd_put_ptr = prog_fd_array_put_ptr,
2553 + .map_fd_sys_lookup_elem = prog_fd_array_sys_lookup_elem,
2554 ++ .map_release_uref = bpf_fd_array_map_clear,
2555 + };
2556 +
2557 + static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file,
2558 +diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
2559 +index 20eaddfa691c..22991e19c01c 100644
2560 +--- a/kernel/bpf/sockmap.c
2561 ++++ b/kernel/bpf/sockmap.c
2562 +@@ -875,7 +875,7 @@ static int sock_map_update_elem(struct bpf_map *map,
2563 + return err;
2564 + }
2565 +
2566 +-static void sock_map_release(struct bpf_map *map, struct file *map_file)
2567 ++static void sock_map_release(struct bpf_map *map)
2568 + {
2569 + struct bpf_stab *stab = container_of(map, struct bpf_stab, map);
2570 + struct bpf_prog *orig;
2571 +@@ -895,7 +895,7 @@ const struct bpf_map_ops sock_map_ops = {
2572 + .map_get_next_key = sock_map_get_next_key,
2573 + .map_update_elem = sock_map_update_elem,
2574 + .map_delete_elem = sock_map_delete_elem,
2575 +- .map_release = sock_map_release,
2576 ++ .map_release_uref = sock_map_release,
2577 + };
2578 +
2579 + BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, bpf_sock,
2580 +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
2581 +index 4e933219fec6..ea22d0b6a9f0 100644
2582 +--- a/kernel/bpf/syscall.c
2583 ++++ b/kernel/bpf/syscall.c
2584 +@@ -214,8 +214,8 @@ static void bpf_map_free_deferred(struct work_struct *work)
2585 + static void bpf_map_put_uref(struct bpf_map *map)
2586 + {
2587 + if (atomic_dec_and_test(&map->usercnt)) {
2588 +- if (map->map_type == BPF_MAP_TYPE_PROG_ARRAY)
2589 +- bpf_fd_array_map_clear(map);
2590 ++ if (map->ops->map_release_uref)
2591 ++ map->ops->map_release_uref(map);
2592 + }
2593 + }
2594 +
2595 +diff --git a/kernel/events/core.c b/kernel/events/core.c
2596 +index 4dbce29a9313..991af683ef9e 100644
2597 +--- a/kernel/events/core.c
2598 ++++ b/kernel/events/core.c
2599 +@@ -8058,6 +8058,8 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
2600 + goto unlock;
2601 +
2602 + list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
2603 ++ if (event->cpu != smp_processor_id())
2604 ++ continue;
2605 + if (event->attr.type != PERF_TYPE_TRACEPOINT)
2606 + continue;
2607 + if (event->attr.config != entry->type)
2608 +@@ -9020,9 +9022,7 @@ static void free_pmu_context(struct pmu *pmu)
2609 + if (pmu->task_ctx_nr > perf_invalid_context)
2610 + return;
2611 +
2612 +- mutex_lock(&pmus_lock);
2613 + free_percpu(pmu->pmu_cpu_context);
2614 +- mutex_unlock(&pmus_lock);
2615 + }
2616 +
2617 + /*
2618 +@@ -9278,12 +9278,8 @@ EXPORT_SYMBOL_GPL(perf_pmu_register);
2619 +
2620 + void perf_pmu_unregister(struct pmu *pmu)
2621 + {
2622 +- int remove_device;
2623 +-
2624 + mutex_lock(&pmus_lock);
2625 +- remove_device = pmu_bus_running;
2626 + list_del_rcu(&pmu->entry);
2627 +- mutex_unlock(&pmus_lock);
2628 +
2629 + /*
2630 + * We dereference the pmu list under both SRCU and regular RCU, so
2631 +@@ -9295,13 +9291,14 @@ void perf_pmu_unregister(struct pmu *pmu)
2632 + free_percpu(pmu->pmu_disable_count);
2633 + if (pmu->type >= PERF_TYPE_MAX)
2634 + idr_remove(&pmu_idr, pmu->type);
2635 +- if (remove_device) {
2636 ++ if (pmu_bus_running) {
2637 + if (pmu->nr_addr_filters)
2638 + device_remove_file(pmu->dev, &dev_attr_nr_addr_filters);
2639 + device_del(pmu->dev);
2640 + put_device(pmu->dev);
2641 + }
2642 + free_pmu_context(pmu);
2643 ++ mutex_unlock(&pmus_lock);
2644 + }
2645 + EXPORT_SYMBOL_GPL(perf_pmu_unregister);
2646 +
2647 +diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c
2648 +index 0e4cd64ad2c0..654977862b06 100644
2649 +--- a/kernel/locking/test-ww_mutex.c
2650 ++++ b/kernel/locking/test-ww_mutex.c
2651 +@@ -260,7 +260,7 @@ static void test_cycle_work(struct work_struct *work)
2652 + {
2653 + struct test_cycle *cycle = container_of(work, typeof(*cycle), work);
2654 + struct ww_acquire_ctx ctx;
2655 +- int err;
2656 ++ int err, erra = 0;
2657 +
2658 + ww_acquire_init(&ctx, &ww_class);
2659 + ww_mutex_lock(&cycle->a_mutex, &ctx);
2660 +@@ -270,17 +270,19 @@ static void test_cycle_work(struct work_struct *work)
2661 +
2662 + err = ww_mutex_lock(cycle->b_mutex, &ctx);
2663 + if (err == -EDEADLK) {
2664 ++ err = 0;
2665 + ww_mutex_unlock(&cycle->a_mutex);
2666 + ww_mutex_lock_slow(cycle->b_mutex, &ctx);
2667 +- err = ww_mutex_lock(&cycle->a_mutex, &ctx);
2668 ++ erra = ww_mutex_lock(&cycle->a_mutex, &ctx);
2669 + }
2670 +
2671 + if (!err)
2672 + ww_mutex_unlock(cycle->b_mutex);
2673 +- ww_mutex_unlock(&cycle->a_mutex);
2674 ++ if (!erra)
2675 ++ ww_mutex_unlock(&cycle->a_mutex);
2676 + ww_acquire_fini(&ctx);
2677 +
2678 +- cycle->result = err;
2679 ++ cycle->result = err ?: erra;
2680 + }
2681 +
2682 + static int __test_cycle(unsigned int nthreads)
2683 +diff --git a/lib/test_bpf.c b/lib/test_bpf.c
2684 +index 64701b4c9900..75ebf2bbc2ee 100644
2685 +--- a/lib/test_bpf.c
2686 ++++ b/lib/test_bpf.c
2687 +@@ -5427,7 +5427,7 @@ static struct bpf_test tests[] = {
2688 + {
2689 + "BPF_MAXINSNS: Jump, gap, jump, ...",
2690 + { },
2691 +-#ifdef CONFIG_BPF_JIT_ALWAYS_ON
2692 ++#if defined(CONFIG_BPF_JIT_ALWAYS_ON) && defined(CONFIG_X86)
2693 + CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
2694 + #else
2695 + CLASSIC | FLAG_NO_DATA,
2696 +diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
2697 +index 1fba2a03f8ae..ba24f613c0fc 100644
2698 +--- a/net/bluetooth/mgmt.c
2699 ++++ b/net/bluetooth/mgmt.c
2700 +@@ -2298,9 +2298,8 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
2701 + /* LE address type */
2702 + addr_type = le_addr_type(cp->addr.type);
2703 +
2704 +- hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type);
2705 +-
2706 +- err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);
2707 ++ /* Abort any ongoing SMP pairing. Removes ltk and irk if they exist. */
2708 ++ err = smp_cancel_and_remove_pairing(hdev, &cp->addr.bdaddr, addr_type);
2709 + if (err < 0) {
2710 + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
2711 + MGMT_STATUS_NOT_PAIRED, &rp,
2712 +@@ -2314,8 +2313,6 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
2713 + goto done;
2714 + }
2715 +
2716 +- /* Abort any ongoing SMP pairing */
2717 +- smp_cancel_pairing(conn);
2718 +
2719 + /* Defer clearing up the connection parameters until closing to
2720 + * give a chance of keeping them if a repairing happens.
2721 +diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
2722 +index a27704ff13a9..dbcc439fc78b 100644
2723 +--- a/net/bluetooth/smp.c
2724 ++++ b/net/bluetooth/smp.c
2725 +@@ -2410,30 +2410,51 @@ unlock:
2726 + return ret;
2727 + }
2728 +
2729 +-void smp_cancel_pairing(struct hci_conn *hcon)
2730 ++int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
2731 ++ u8 addr_type)
2732 + {
2733 +- struct l2cap_conn *conn = hcon->l2cap_data;
2734 ++ struct hci_conn *hcon;
2735 ++ struct l2cap_conn *conn;
2736 + struct l2cap_chan *chan;
2737 + struct smp_chan *smp;
2738 ++ int err;
2739 ++
2740 ++ err = hci_remove_ltk(hdev, bdaddr, addr_type);
2741 ++ hci_remove_irk(hdev, bdaddr, addr_type);
2742 ++
2743 ++ hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
2744 ++ if (!hcon)
2745 ++ goto done;
2746 +
2747 ++ conn = hcon->l2cap_data;
2748 + if (!conn)
2749 +- return;
2750 ++ goto done;
2751 +
2752 + chan = conn->smp;
2753 + if (!chan)
2754 +- return;
2755 ++ goto done;
2756 +
2757 + l2cap_chan_lock(chan);
2758 +
2759 + smp = chan->data;
2760 + if (smp) {
2761 ++ /* Set keys to NULL to make sure smp_failure() does not try to
2762 ++ * remove and free already invalidated rcu list entries. */
2763 ++ smp->ltk = NULL;
2764 ++ smp->slave_ltk = NULL;
2765 ++ smp->remote_irk = NULL;
2766 ++
2767 + if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))
2768 + smp_failure(conn, 0);
2769 + else
2770 + smp_failure(conn, SMP_UNSPECIFIED);
2771 ++ err = 0;
2772 + }
2773 +
2774 + l2cap_chan_unlock(chan);
2775 ++
2776 ++done:
2777 ++ return err;
2778 + }
2779 +
2780 + static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
2781 +diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
2782 +index 0ff6247eaa6c..121edadd5f8d 100644
2783 +--- a/net/bluetooth/smp.h
2784 ++++ b/net/bluetooth/smp.h
2785 +@@ -181,7 +181,8 @@ enum smp_key_pref {
2786 + };
2787 +
2788 + /* SMP Commands */
2789 +-void smp_cancel_pairing(struct hci_conn *hcon);
2790 ++int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
2791 ++ u8 addr_type);
2792 + bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level,
2793 + enum smp_key_pref key_pref);
2794 + int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
2795 +diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
2796 +index 8dc5c8d69bcd..a813dfe2dc2c 100644
2797 +--- a/net/bridge/br_multicast.c
2798 ++++ b/net/bridge/br_multicast.c
2799 +@@ -1390,7 +1390,14 @@ static void br_multicast_query_received(struct net_bridge *br,
2800 + return;
2801 +
2802 + br_multicast_update_query_timer(br, query, max_delay);
2803 +- br_multicast_mark_router(br, port);
2804 ++
2805 ++ /* Based on RFC4541, section 2.1.1 IGMP Forwarding Rules,
2806 ++ * the arrival port for IGMP Queries where the source address
2807 ++ * is 0.0.0.0 should not be added to router port list.
2808 ++ */
2809 ++ if ((saddr->proto == htons(ETH_P_IP) && saddr->u.ip4) ||
2810 ++ saddr->proto == htons(ETH_P_IPV6))
2811 ++ br_multicast_mark_router(br, port);
2812 + }
2813 +
2814 + static int br_ip4_multicast_query(struct net_bridge *br,
2815 +diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
2816 +index c2eea1b8737a..7582f28ab306 100644
2817 +--- a/net/bridge/br_netfilter_hooks.c
2818 ++++ b/net/bridge/br_netfilter_hooks.c
2819 +@@ -832,7 +832,8 @@ static unsigned int ip_sabotage_in(void *priv,
2820 + struct sk_buff *skb,
2821 + const struct nf_hook_state *state)
2822 + {
2823 +- if (skb->nf_bridge && !skb->nf_bridge->in_prerouting) {
2824 ++ if (skb->nf_bridge && !skb->nf_bridge->in_prerouting &&
2825 ++ !netif_is_l3_master(skb->dev)) {
2826 + state->okfn(state->net, state->sk, skb);
2827 + return NF_STOLEN;
2828 + }
2829 +diff --git a/net/core/datagram.c b/net/core/datagram.c
2830 +index 3964c108b169..d8a0774f7608 100644
2831 +--- a/net/core/datagram.c
2832 ++++ b/net/core/datagram.c
2833 +@@ -810,8 +810,9 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
2834 + return -EINVAL;
2835 + }
2836 +
2837 +- if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE))
2838 +- netdev_rx_csum_fault(skb->dev);
2839 ++ if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
2840 ++ !skb->csum_complete_sw)
2841 ++ netdev_rx_csum_fault(NULL);
2842 + }
2843 + return 0;
2844 + fault:
2845 +diff --git a/net/core/ethtool.c b/net/core/ethtool.c
2846 +index 0ae5ac5e090f..3469f5053c79 100644
2847 +--- a/net/core/ethtool.c
2848 ++++ b/net/core/ethtool.c
2849 +@@ -2410,13 +2410,17 @@ roll_back:
2850 + return ret;
2851 + }
2852 +
2853 +-static int ethtool_set_per_queue(struct net_device *dev, void __user *useraddr)
2854 ++static int ethtool_set_per_queue(struct net_device *dev,
2855 ++ void __user *useraddr, u32 sub_cmd)
2856 + {
2857 + struct ethtool_per_queue_op per_queue_opt;
2858 +
2859 + if (copy_from_user(&per_queue_opt, useraddr, sizeof(per_queue_opt)))
2860 + return -EFAULT;
2861 +
2862 ++ if (per_queue_opt.sub_command != sub_cmd)
2863 ++ return -EINVAL;
2864 ++
2865 + switch (per_queue_opt.sub_command) {
2866 + case ETHTOOL_GCOALESCE:
2867 + return ethtool_get_per_queue_coalesce(dev, useraddr, &per_queue_opt);
2868 +@@ -2787,7 +2791,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
2869 + rc = ethtool_get_phy_stats(dev, useraddr);
2870 + break;
2871 + case ETHTOOL_PERQUEUE:
2872 +- rc = ethtool_set_per_queue(dev, useraddr);
2873 ++ rc = ethtool_set_per_queue(dev, useraddr, sub_cmd);
2874 + break;
2875 + case ETHTOOL_GLINKSETTINGS:
2876 + rc = ethtool_get_link_ksettings(dev, useraddr);
2877 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
2878 +index 760364526dc1..c392a77ff788 100644
2879 +--- a/net/core/rtnetlink.c
2880 ++++ b/net/core/rtnetlink.c
2881 +@@ -3080,6 +3080,11 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
2882 + return -EINVAL;
2883 + }
2884 +
2885 ++ if (dev->type != ARPHRD_ETHER) {
2886 ++ NL_SET_ERR_MSG(extack, "FDB add only supported for Ethernet devices");
2887 ++ return -EINVAL;
2888 ++ }
2889 ++
2890 + addr = nla_data(tb[NDA_LLADDR]);
2891 +
2892 + err = fdb_vid_parse(tb[NDA_VLAN], &vid);
2893 +@@ -3184,6 +3189,11 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
2894 + return -EINVAL;
2895 + }
2896 +
2897 ++ if (dev->type != ARPHRD_ETHER) {
2898 ++ NL_SET_ERR_MSG(extack, "FDB delete only supported for Ethernet devices");
2899 ++ return -EINVAL;
2900 ++ }
2901 ++
2902 + addr = nla_data(tb[NDA_LLADDR]);
2903 +
2904 + err = fdb_vid_parse(tb[NDA_VLAN], &vid);
2905 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
2906 +index 9f80b947f53b..c19a118f9f82 100644
2907 +--- a/net/core/skbuff.c
2908 ++++ b/net/core/skbuff.c
2909 +@@ -1843,8 +1843,9 @@ int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len)
2910 + if (skb->ip_summed == CHECKSUM_COMPLETE) {
2911 + int delta = skb->len - len;
2912 +
2913 +- skb->csum = csum_sub(skb->csum,
2914 +- skb_checksum(skb, len, delta, 0));
2915 ++ skb->csum = csum_block_sub(skb->csum,
2916 ++ skb_checksum(skb, len, delta, 0),
2917 ++ len);
2918 + }
2919 + return __pskb_trim(skb, len);
2920 + }
2921 +diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
2922 +index e7227128df2c..cb8fa5d7afe1 100644
2923 +--- a/net/ipv4/ip_fragment.c
2924 ++++ b/net/ipv4/ip_fragment.c
2925 +@@ -720,10 +720,14 @@ struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user)
2926 + if (ip_is_fragment(&iph)) {
2927 + skb = skb_share_check(skb, GFP_ATOMIC);
2928 + if (skb) {
2929 +- if (!pskb_may_pull(skb, netoff + iph.ihl * 4))
2930 +- return skb;
2931 +- if (pskb_trim_rcsum(skb, netoff + len))
2932 +- return skb;
2933 ++ if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) {
2934 ++ kfree_skb(skb);
2935 ++ return NULL;
2936 ++ }
2937 ++ if (pskb_trim_rcsum(skb, netoff + len)) {
2938 ++ kfree_skb(skb);
2939 ++ return NULL;
2940 ++ }
2941 + memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
2942 + if (ip_defrag(net, skb, user))
2943 + return NULL;
2944 +diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
2945 +index cbd9c0d8a788..9f314a5e9f27 100644
2946 +--- a/net/ipv4/ipmr.c
2947 ++++ b/net/ipv4/ipmr.c
2948 +@@ -2499,8 +2499,6 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb)
2949 + next_entry:
2950 + e++;
2951 + }
2952 +- e = 0;
2953 +- s_e = 0;
2954 +
2955 + spin_lock_bh(&mfc_unres_lock);
2956 + list_for_each_entry(mfc, &mrt->mfc_unres_queue, list) {
2957 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
2958 +index dc0ec227b9d2..b89920c0f226 100644
2959 +--- a/net/ipv4/udp.c
2960 ++++ b/net/ipv4/udp.c
2961 +@@ -2045,8 +2045,24 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh,
2962 + /* Note, we are only interested in != 0 or == 0, thus the
2963 + * force to int.
2964 + */
2965 +- return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
2966 +- inet_compute_pseudo);
2967 ++ err = (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
2968 ++ inet_compute_pseudo);
2969 ++ if (err)
2970 ++ return err;
2971 ++
2972 ++ if (skb->ip_summed == CHECKSUM_COMPLETE && !skb->csum_valid) {
2973 ++ /* If SW calculated the value, we know it's bad */
2974 ++ if (skb->csum_complete_sw)
2975 ++ return 1;
2976 ++
2977 ++ /* HW says the value is bad. Let's validate that.
2978 ++ * skb->csum is no longer the full packet checksum,
2979 ++ * so don't treat it as such.
2980 ++ */
2981 ++ skb_checksum_complete_unset(skb);
2982 ++ }
2983 ++
2984 ++ return 0;
2985 + }
2986 +
2987 + /* wrapper for udp_queue_rcv_skb tacking care of csum conversion and
2988 +diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
2989 +index bcfc00e88756..f8de2482a529 100644
2990 +--- a/net/ipv4/xfrm4_input.c
2991 ++++ b/net/ipv4/xfrm4_input.c
2992 +@@ -67,6 +67,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)
2993 +
2994 + if (xo && (xo->flags & XFRM_GRO)) {
2995 + skb_mac_header_rebuild(skb);
2996 ++ skb_reset_transport_header(skb);
2997 + return 0;
2998 + }
2999 +
3000 +diff --git a/net/ipv4/xfrm4_mode_transport.c b/net/ipv4/xfrm4_mode_transport.c
3001 +index 3d36644890bb..1ad2c2c4e250 100644
3002 +--- a/net/ipv4/xfrm4_mode_transport.c
3003 ++++ b/net/ipv4/xfrm4_mode_transport.c
3004 +@@ -46,7 +46,6 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
3005 + static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
3006 + {
3007 + int ihl = skb->data - skb_transport_header(skb);
3008 +- struct xfrm_offload *xo = xfrm_offload(skb);
3009 +
3010 + if (skb->transport_header != skb->network_header) {
3011 + memmove(skb_transport_header(skb),
3012 +@@ -54,8 +53,7 @@ static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
3013 + skb->network_header = skb->transport_header;
3014 + }
3015 + ip_hdr(skb)->tot_len = htons(skb->len + ihl);
3016 +- if (!xo || !(xo->flags & XFRM_GRO))
3017 +- skb_reset_transport_header(skb);
3018 ++ skb_reset_transport_header(skb);
3019 + return 0;
3020 + }
3021 +
3022 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
3023 +index 569f7c3f6b95..9ac6f6232294 100644
3024 +--- a/net/ipv6/addrconf.c
3025 ++++ b/net/ipv6/addrconf.c
3026 +@@ -4793,8 +4793,8 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
3027 +
3028 + /* unicast address incl. temp addr */
3029 + list_for_each_entry(ifa, &idev->addr_list, if_list) {
3030 +- if (++ip_idx < s_ip_idx)
3031 +- continue;
3032 ++ if (ip_idx < s_ip_idx)
3033 ++ goto next;
3034 + err = inet6_fill_ifaddr(skb, ifa,
3035 + NETLINK_CB(cb->skb).portid,
3036 + cb->nlh->nlmsg_seq,
3037 +@@ -4803,6 +4803,8 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
3038 + if (err < 0)
3039 + break;
3040 + nl_dump_check_consistent(cb, nlmsg_hdr(skb));
3041 ++next:
3042 ++ ip_idx++;
3043 + }
3044 + break;
3045 + }
3046 +diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c
3047 +index 547515e8450a..377717045f8f 100644
3048 +--- a/net/ipv6/ip6_checksum.c
3049 ++++ b/net/ipv6/ip6_checksum.c
3050 +@@ -88,8 +88,24 @@ int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)
3051 + * Note, we are only interested in != 0 or == 0, thus the
3052 + * force to int.
3053 + */
3054 +- return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
3055 +- ip6_compute_pseudo);
3056 ++ err = (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
3057 ++ ip6_compute_pseudo);
3058 ++ if (err)
3059 ++ return err;
3060 ++
3061 ++ if (skb->ip_summed == CHECKSUM_COMPLETE && !skb->csum_valid) {
3062 ++ /* If SW calculated the value, we know it's bad */
3063 ++ if (skb->csum_complete_sw)
3064 ++ return 1;
3065 ++
3066 ++ /* HW says the value is bad. Let's validate that.
3067 ++ * skb->csum is no longer the full packet checksum,
3068 ++ * so don't treat is as such.
3069 ++ */
3070 ++ skb_checksum_complete_unset(skb);
3071 ++ }
3072 ++
3073 ++ return 0;
3074 + }
3075 + EXPORT_SYMBOL(udp6_csum_init);
3076 +
3077 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
3078 +index 0e9296f44ee4..948f304db0a3 100644
3079 +--- a/net/ipv6/ip6_tunnel.c
3080 ++++ b/net/ipv6/ip6_tunnel.c
3081 +@@ -1185,10 +1185,6 @@ route_lookup:
3082 + }
3083 + skb_dst_set(skb, dst);
3084 +
3085 +- if (encap_limit >= 0) {
3086 +- init_tel_txopt(&opt, encap_limit);
3087 +- ipv6_push_frag_opts(skb, &opt.ops, &proto);
3088 +- }
3089 + hop_limit = hop_limit ? : ip6_dst_hoplimit(dst);
3090 +
3091 + /* Calculate max headroom for all the headers and adjust
3092 +@@ -1203,6 +1199,11 @@ route_lookup:
3093 + if (err)
3094 + return err;
3095 +
3096 ++ if (encap_limit >= 0) {
3097 ++ init_tel_txopt(&opt, encap_limit);
3098 ++ ipv6_push_frag_opts(skb, &opt.ops, &proto);
3099 ++ }
3100 ++
3101 + skb_push(skb, sizeof(struct ipv6hdr));
3102 + skb_reset_network_header(skb);
3103 + ipv6h = ipv6_hdr(skb);
3104 +diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
3105 +index d112762b4cb8..bd269e78272a 100644
3106 +--- a/net/ipv6/mcast.c
3107 ++++ b/net/ipv6/mcast.c
3108 +@@ -2412,17 +2412,17 @@ static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
3109 + {
3110 + int err;
3111 +
3112 +- /* callers have the socket lock and rtnl lock
3113 +- * so no other readers or writers of iml or its sflist
3114 +- */
3115 ++ write_lock_bh(&iml->sflock);
3116 + if (!iml->sflist) {
3117 + /* any-source empty exclude case */
3118 +- return ip6_mc_del_src(idev, &iml->addr, iml->sfmode, 0, NULL, 0);
3119 ++ err = ip6_mc_del_src(idev, &iml->addr, iml->sfmode, 0, NULL, 0);
3120 ++ } else {
3121 ++ err = ip6_mc_del_src(idev, &iml->addr, iml->sfmode,
3122 ++ iml->sflist->sl_count, iml->sflist->sl_addr, 0);
3123 ++ sock_kfree_s(sk, iml->sflist, IP6_SFLSIZE(iml->sflist->sl_max));
3124 ++ iml->sflist = NULL;
3125 + }
3126 +- err = ip6_mc_del_src(idev, &iml->addr, iml->sfmode,
3127 +- iml->sflist->sl_count, iml->sflist->sl_addr, 0);
3128 +- sock_kfree_s(sk, iml->sflist, IP6_SFLSIZE(iml->sflist->sl_max));
3129 +- iml->sflist = NULL;
3130 ++ write_unlock_bh(&iml->sflock);
3131 + return err;
3132 + }
3133 +
3134 +diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
3135 +index 528218460bc5..5f80e57e93ed 100644
3136 +--- a/net/ipv6/ndisc.c
3137 ++++ b/net/ipv6/ndisc.c
3138 +@@ -1722,10 +1722,9 @@ int ndisc_rcv(struct sk_buff *skb)
3139 + return 0;
3140 + }
3141 +
3142 +- memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb));
3143 +-
3144 + switch (msg->icmph.icmp6_type) {
3145 + case NDISC_NEIGHBOUR_SOLICITATION:
3146 ++ memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb));
3147 + ndisc_recv_ns(skb);
3148 + break;
3149 +
3150 +diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
3151 +index 2ed8536e10b6..611d406c4656 100644
3152 +--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
3153 ++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
3154 +@@ -598,8 +598,6 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
3155 + fq->q.meat == fq->q.len &&
3156 + nf_ct_frag6_reasm(fq, skb, dev))
3157 + ret = 0;
3158 +- else
3159 +- skb_dst_drop(skb);
3160 +
3161 + out_unlock:
3162 + spin_unlock_bh(&fq->q.lock);
3163 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
3164 +index 5cee941ab0a9..8d185a0fc5af 100644
3165 +--- a/net/ipv6/udp.c
3166 ++++ b/net/ipv6/udp.c
3167 +@@ -794,11 +794,9 @@ static int udp6_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
3168 +
3169 + ret = udpv6_queue_rcv_skb(sk, skb);
3170 +
3171 +- /* a return value > 0 means to resubmit the input, but
3172 +- * it wants the return to be -protocol, or 0
3173 +- */
3174 ++ /* a return value > 0 means to resubmit the input */
3175 + if (ret > 0)
3176 +- return -ret;
3177 ++ return ret;
3178 + return 0;
3179 + }
3180 +
3181 +diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
3182 +index 841f4a07438e..9ef490dddcea 100644
3183 +--- a/net/ipv6/xfrm6_input.c
3184 ++++ b/net/ipv6/xfrm6_input.c
3185 +@@ -59,6 +59,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)
3186 +
3187 + if (xo && (xo->flags & XFRM_GRO)) {
3188 + skb_mac_header_rebuild(skb);
3189 ++ skb_reset_transport_header(skb);
3190 + return -1;
3191 + }
3192 +
3193 +diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
3194 +index 9ad07a91708e..3c29da5defe6 100644
3195 +--- a/net/ipv6/xfrm6_mode_transport.c
3196 ++++ b/net/ipv6/xfrm6_mode_transport.c
3197 +@@ -51,7 +51,6 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
3198 + static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
3199 + {
3200 + int ihl = skb->data - skb_transport_header(skb);
3201 +- struct xfrm_offload *xo = xfrm_offload(skb);
3202 +
3203 + if (skb->transport_header != skb->network_header) {
3204 + memmove(skb_transport_header(skb),
3205 +@@ -60,8 +59,7 @@ static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
3206 + }
3207 + ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
3208 + sizeof(struct ipv6hdr));
3209 +- if (!xo || !(xo->flags & XFRM_GRO))
3210 +- skb_reset_transport_header(skb);
3211 ++ skb_reset_transport_header(skb);
3212 + return 0;
3213 + }
3214 +
3215 +diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
3216 +index 8ae87d4ec5ff..29dae7f2ff14 100644
3217 +--- a/net/ipv6/xfrm6_output.c
3218 ++++ b/net/ipv6/xfrm6_output.c
3219 +@@ -170,9 +170,11 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
3220 +
3221 + if (toobig && xfrm6_local_dontfrag(skb)) {
3222 + xfrm6_local_rxpmtu(skb, mtu);
3223 ++ kfree_skb(skb);
3224 + return -EMSGSIZE;
3225 + } else if (!skb->ignore_df && toobig && skb->sk) {
3226 + xfrm_local_error(skb, mtu);
3227 ++ kfree_skb(skb);
3228 + return -EMSGSIZE;
3229 + }
3230 +
3231 +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
3232 +index 5c87f1d3e525..33ea389ee015 100644
3233 +--- a/net/l2tp/l2tp_core.c
3234 ++++ b/net/l2tp/l2tp_core.c
3235 +@@ -808,10 +808,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
3236 + }
3237 + }
3238 +
3239 +- /* Session data offset is handled differently for L2TPv2 and
3240 +- * L2TPv3. For L2TPv2, there is an optional 16-bit value in
3241 +- * the header. For L2TPv3, the offset is negotiated using AVPs
3242 +- * in the session setup control protocol.
3243 ++ /* Session data offset is defined only for L2TPv2 and is
3244 ++ * indicated by an optional 16-bit value in the header.
3245 + */
3246 + if (tunnel->version == L2TP_HDR_VER_2) {
3247 + /* If offset bit set, skip it. */
3248 +@@ -819,8 +817,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
3249 + offset = ntohs(*(__be16 *)ptr);
3250 + ptr += 2 + offset;
3251 + }
3252 +- } else
3253 +- ptr += session->offset;
3254 ++ }
3255 +
3256 + offset = ptr - optr;
3257 + if (!pskb_may_pull(skb, offset))
3258 +@@ -1104,8 +1101,6 @@ static int l2tp_build_l2tpv3_header(struct l2tp_session *session, void *buf)
3259 + }
3260 + bufp += session->l2specific_len;
3261 + }
3262 +- if (session->offset)
3263 +- bufp += session->offset;
3264 +
3265 + return bufp - optr;
3266 + }
3267 +@@ -1779,7 +1774,7 @@ void l2tp_session_set_header_len(struct l2tp_session *session, int version)
3268 + if (session->send_seq)
3269 + session->hdr_len += 4;
3270 + } else {
3271 +- session->hdr_len = 4 + session->cookie_len + session->l2specific_len + session->offset;
3272 ++ session->hdr_len = 4 + session->cookie_len + session->l2specific_len;
3273 + if (session->tunnel->encap == L2TP_ENCAPTYPE_UDP)
3274 + session->hdr_len += 4;
3275 + }
3276 +@@ -1830,7 +1825,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn
3277 + session->recv_seq = cfg->recv_seq;
3278 + session->lns_mode = cfg->lns_mode;
3279 + session->reorder_timeout = cfg->reorder_timeout;
3280 +- session->offset = cfg->offset;
3281 + session->l2specific_type = cfg->l2specific_type;
3282 + session->l2specific_len = cfg->l2specific_len;
3283 + session->cookie_len = cfg->cookie_len;
3284 +diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
3285 +index 9e2f1fda1b03..0a58c0754526 100644
3286 +--- a/net/l2tp/l2tp_core.h
3287 ++++ b/net/l2tp/l2tp_core.h
3288 +@@ -59,7 +59,6 @@ struct l2tp_session_cfg {
3289 + int debug; /* bitmask of debug message
3290 + * categories */
3291 + u16 vlan_id; /* VLAN pseudowire only */
3292 +- u16 offset; /* offset to payload */
3293 + u16 l2specific_len; /* Layer 2 specific length */
3294 + u16 l2specific_type; /* Layer 2 specific type */
3295 + u8 cookie[8]; /* optional cookie */
3296 +@@ -86,8 +85,6 @@ struct l2tp_session {
3297 + int cookie_len;
3298 + u8 peer_cookie[8];
3299 + int peer_cookie_len;
3300 +- u16 offset; /* offset from end of L2TP header
3301 +- to beginning of data */
3302 + u16 l2specific_len;
3303 + u16 l2specific_type;
3304 + u16 hdr_len;
3305 +diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c
3306 +index 53bae54c4d6e..534cad03b9e9 100644
3307 +--- a/net/l2tp/l2tp_debugfs.c
3308 ++++ b/net/l2tp/l2tp_debugfs.c
3309 +@@ -180,8 +180,8 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v)
3310 + session->lns_mode ? "LNS" : "LAC",
3311 + session->debug,
3312 + jiffies_to_msecs(session->reorder_timeout));
3313 +- seq_printf(m, " offset %hu l2specific %hu/%hu\n",
3314 +- session->offset, session->l2specific_type, session->l2specific_len);
3315 ++ seq_printf(m, " offset 0 l2specific %hu/%hu\n",
3316 ++ session->l2specific_type, session->l2specific_len);
3317 + if (session->cookie_len) {
3318 + seq_printf(m, " cookie %02x%02x%02x%02x",
3319 + session->cookie[0], session->cookie[1],
3320 +diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
3321 +index c28223d8092b..001797ce4084 100644
3322 +--- a/net/l2tp/l2tp_netlink.c
3323 ++++ b/net/l2tp/l2tp_netlink.c
3324 +@@ -549,9 +549,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
3325 + }
3326 +
3327 + if (tunnel->version > 2) {
3328 +- if (info->attrs[L2TP_ATTR_OFFSET])
3329 +- cfg.offset = nla_get_u16(info->attrs[L2TP_ATTR_OFFSET]);
3330 +-
3331 + if (info->attrs[L2TP_ATTR_DATA_SEQ])
3332 + cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]);
3333 +
3334 +diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
3335 +index b084fd19ad32..56c3fb5cc805 100644
3336 +--- a/net/llc/llc_conn.c
3337 ++++ b/net/llc/llc_conn.c
3338 +@@ -734,6 +734,7 @@ void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk)
3339 + llc_sk(sk)->sap = sap;
3340 +
3341 + spin_lock_bh(&sap->sk_lock);
3342 ++ sock_set_flag(sk, SOCK_RCU_FREE);
3343 + sap->sk_count++;
3344 + sk_nulls_add_node_rcu(sk, laddr_hb);
3345 + hlist_add_head(&llc->dev_hash_node, dev_hb);
3346 +diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
3347 +index 7e5f271e3c30..4f1c61637ce3 100644
3348 +--- a/net/mac80211/mesh.h
3349 ++++ b/net/mac80211/mesh.h
3350 +@@ -217,7 +217,8 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
3351 + int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
3352 + void ieee80211s_init(void);
3353 + void ieee80211s_update_metric(struct ieee80211_local *local,
3354 +- struct sta_info *sta, struct sk_buff *skb);
3355 ++ struct sta_info *sta,
3356 ++ struct ieee80211_tx_status *st);
3357 + void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata);
3358 + void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata);
3359 + int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
3360 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
3361 +index 055ea36ff27b..fab0764c315f 100644
3362 +--- a/net/mac80211/mesh_hwmp.c
3363 ++++ b/net/mac80211/mesh_hwmp.c
3364 +@@ -295,15 +295,12 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,
3365 + }
3366 +
3367 + void ieee80211s_update_metric(struct ieee80211_local *local,
3368 +- struct sta_info *sta, struct sk_buff *skb)
3369 ++ struct sta_info *sta,
3370 ++ struct ieee80211_tx_status *st)
3371 + {
3372 +- struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
3373 +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
3374 ++ struct ieee80211_tx_info *txinfo = st->info;
3375 + int failed;
3376 +
3377 +- if (!ieee80211_is_data(hdr->frame_control))
3378 +- return;
3379 +-
3380 + failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
3381 +
3382 + /* moving average, scaled to 100.
3383 +diff --git a/net/mac80211/status.c b/net/mac80211/status.c
3384 +index da7427a41529..bdf131ed5ce8 100644
3385 +--- a/net/mac80211/status.c
3386 ++++ b/net/mac80211/status.c
3387 +@@ -470,11 +470,6 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,
3388 + if (!skb)
3389 + return;
3390 +
3391 +- if (dropped) {
3392 +- dev_kfree_skb_any(skb);
3393 +- return;
3394 +- }
3395 +-
3396 + if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
3397 + u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie;
3398 + struct ieee80211_sub_if_data *sdata;
3399 +@@ -495,6 +490,8 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,
3400 + }
3401 + rcu_read_unlock();
3402 +
3403 ++ dev_kfree_skb_any(skb);
3404 ++ } else if (dropped) {
3405 + dev_kfree_skb_any(skb);
3406 + } else {
3407 + /* consumes skb */
3408 +@@ -800,7 +797,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
3409 +
3410 + rate_control_tx_status(local, sband, status);
3411 + if (ieee80211_vif_is_mesh(&sta->sdata->vif))
3412 +- ieee80211s_update_metric(local, sta, skb);
3413 ++ ieee80211s_update_metric(local, sta, status);
3414 +
3415 + if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
3416 + ieee80211_frame_acked(sta, skb);
3417 +@@ -961,6 +958,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
3418 + }
3419 +
3420 + rate_control_tx_status(local, sband, status);
3421 ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif))
3422 ++ ieee80211s_update_metric(local, sta, status);
3423 + }
3424 +
3425 + if (acked || noack_success) {
3426 +diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
3427 +index 91093d4a2f84..6e7aa65cf345 100644
3428 +--- a/net/mac80211/tdls.c
3429 ++++ b/net/mac80211/tdls.c
3430 +@@ -16,6 +16,7 @@
3431 + #include "ieee80211_i.h"
3432 + #include "driver-ops.h"
3433 + #include "rate.h"
3434 ++#include "wme.h"
3435 +
3436 + /* give usermode some time for retries in setting up the TDLS session */
3437 + #define TDLS_PEER_SETUP_TIMEOUT (15 * HZ)
3438 +@@ -1006,14 +1007,13 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,
3439 + switch (action_code) {
3440 + case WLAN_TDLS_SETUP_REQUEST:
3441 + case WLAN_TDLS_SETUP_RESPONSE:
3442 +- skb_set_queue_mapping(skb, IEEE80211_AC_BK);
3443 +- skb->priority = 2;
3444 ++ skb->priority = 256 + 2;
3445 + break;
3446 + default:
3447 +- skb_set_queue_mapping(skb, IEEE80211_AC_VI);
3448 +- skb->priority = 5;
3449 ++ skb->priority = 256 + 5;
3450 + break;
3451 + }
3452 ++ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
3453 +
3454 + /*
3455 + * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress.
3456 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
3457 +index d8fddd88bf46..a17a56032a21 100644
3458 +--- a/net/mac80211/tx.c
3459 ++++ b/net/mac80211/tx.c
3460 +@@ -1837,7 +1837,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
3461 + sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
3462 +
3463 + if (invoke_tx_handlers_early(&tx))
3464 +- return false;
3465 ++ return true;
3466 +
3467 + if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
3468 + return true;
3469 +diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
3470 +index 4c9c9458374a..f70e9cbf33d5 100644
3471 +--- a/net/openvswitch/flow_netlink.c
3472 ++++ b/net/openvswitch/flow_netlink.c
3473 +@@ -2622,7 +2622,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
3474 + * is already present */
3475 + if (mac_proto != MAC_PROTO_NONE)
3476 + return -EINVAL;
3477 +- mac_proto = MAC_PROTO_NONE;
3478 ++ mac_proto = MAC_PROTO_ETHERNET;
3479 + break;
3480 +
3481 + case OVS_ACTION_ATTR_POP_ETH:
3482 +@@ -2630,7 +2630,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
3483 + return -EINVAL;
3484 + if (vlan_tci & htons(VLAN_TAG_PRESENT))
3485 + return -EINVAL;
3486 +- mac_proto = MAC_PROTO_ETHERNET;
3487 ++ mac_proto = MAC_PROTO_NONE;
3488 + break;
3489 +
3490 + default:
3491 +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
3492 +index e6c2c4f56fb1..71c7f1dd4599 100644
3493 +--- a/net/rxrpc/ar-internal.h
3494 ++++ b/net/rxrpc/ar-internal.h
3495 +@@ -424,8 +424,7 @@ struct rxrpc_connection {
3496 + spinlock_t state_lock; /* state-change lock */
3497 + enum rxrpc_conn_cache_state cache_state;
3498 + enum rxrpc_conn_proto_state state; /* current state of connection */
3499 +- u32 local_abort; /* local abort code */
3500 +- u32 remote_abort; /* remote abort code */
3501 ++ u32 abort_code; /* Abort code of connection abort */
3502 + int debug_id; /* debug ID for printks */
3503 + atomic_t serial; /* packet serial number counter */
3504 + unsigned int hi_serial; /* highest serial number received */
3505 +@@ -435,6 +434,7 @@ struct rxrpc_connection {
3506 + u8 security_size; /* security header size */
3507 + u8 security_ix; /* security type */
3508 + u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
3509 ++ short error; /* Local error code */
3510 + };
3511 +
3512 + /*
3513 +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
3514 +index 62b1581d44a5..2dd13f5c47c8 100644
3515 +--- a/net/rxrpc/call_accept.c
3516 ++++ b/net/rxrpc/call_accept.c
3517 +@@ -418,11 +418,11 @@ found_service:
3518 +
3519 + case RXRPC_CONN_REMOTELY_ABORTED:
3520 + rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
3521 +- conn->remote_abort, -ECONNABORTED);
3522 ++ conn->abort_code, conn->error);
3523 + break;
3524 + case RXRPC_CONN_LOCALLY_ABORTED:
3525 + rxrpc_abort_call("CON", call, sp->hdr.seq,
3526 +- conn->local_abort, -ECONNABORTED);
3527 ++ conn->abort_code, conn->error);
3528 + break;
3529 + default:
3530 + BUG();
3531 +diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
3532 +index 0435c4167a1a..75ec1ad595b7 100644
3533 +--- a/net/rxrpc/conn_event.c
3534 ++++ b/net/rxrpc/conn_event.c
3535 +@@ -117,7 +117,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
3536 +
3537 + switch (chan->last_type) {
3538 + case RXRPC_PACKET_TYPE_ABORT:
3539 +- _proto("Tx ABORT %%%u { %d } [re]", serial, conn->local_abort);
3540 ++ _proto("Tx ABORT %%%u { %d } [re]", serial, conn->abort_code);
3541 + break;
3542 + case RXRPC_PACKET_TYPE_ACK:
3543 + trace_rxrpc_tx_ack(NULL, serial, chan->last_seq, 0,
3544 +@@ -135,13 +135,12 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
3545 + * pass a connection-level abort onto all calls on that connection
3546 + */
3547 + static void rxrpc_abort_calls(struct rxrpc_connection *conn,
3548 +- enum rxrpc_call_completion compl,
3549 +- u32 abort_code, int error)
3550 ++ enum rxrpc_call_completion compl)
3551 + {
3552 + struct rxrpc_call *call;
3553 + int i;
3554 +
3555 +- _enter("{%d},%x", conn->debug_id, abort_code);
3556 ++ _enter("{%d},%x", conn->debug_id, conn->abort_code);
3557 +
3558 + spin_lock(&conn->channel_lock);
3559 +
3560 +@@ -153,9 +152,11 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn,
3561 + if (compl == RXRPC_CALL_LOCALLY_ABORTED)
3562 + trace_rxrpc_abort("CON", call->cid,
3563 + call->call_id, 0,
3564 +- abort_code, error);
3565 ++ conn->abort_code,
3566 ++ conn->error);
3567 + if (rxrpc_set_call_completion(call, compl,
3568 +- abort_code, error))
3569 ++ conn->abort_code,
3570 ++ conn->error))
3571 + rxrpc_notify_socket(call);
3572 + }
3573 + }
3574 +@@ -188,10 +189,12 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
3575 + return 0;
3576 + }
3577 +
3578 ++ conn->error = error;
3579 ++ conn->abort_code = abort_code;
3580 + conn->state = RXRPC_CONN_LOCALLY_ABORTED;
3581 + spin_unlock_bh(&conn->state_lock);
3582 +
3583 +- rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code, error);
3584 ++ rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED);
3585 +
3586 + msg.msg_name = &conn->params.peer->srx.transport;
3587 + msg.msg_namelen = conn->params.peer->srx.transport_len;
3588 +@@ -210,7 +213,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
3589 + whdr._rsvd = 0;
3590 + whdr.serviceId = htons(conn->service_id);
3591 +
3592 +- word = htonl(conn->local_abort);
3593 ++ word = htonl(conn->abort_code);
3594 +
3595 + iov[0].iov_base = &whdr;
3596 + iov[0].iov_len = sizeof(whdr);
3597 +@@ -221,7 +224,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
3598 +
3599 + serial = atomic_inc_return(&conn->serial);
3600 + whdr.serial = htonl(serial);
3601 +- _proto("Tx CONN ABORT %%%u { %d }", serial, conn->local_abort);
3602 ++ _proto("Tx CONN ABORT %%%u { %d }", serial, conn->abort_code);
3603 +
3604 + ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
3605 + if (ret < 0) {
3606 +@@ -289,9 +292,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
3607 + abort_code = ntohl(wtmp);
3608 + _proto("Rx ABORT %%%u { ac=%d }", sp->hdr.serial, abort_code);
3609 +
3610 ++ conn->error = -ECONNABORTED;
3611 ++ conn->abort_code = abort_code;
3612 + conn->state = RXRPC_CONN_REMOTELY_ABORTED;
3613 +- rxrpc_abort_calls(conn, RXRPC_CALL_REMOTELY_ABORTED,
3614 +- abort_code, -ECONNABORTED);
3615 ++ rxrpc_abort_calls(conn, RXRPC_CALL_REMOTELY_ABORTED);
3616 + return -ECONNABORTED;
3617 +
3618 + case RXRPC_PACKET_TYPE_CHALLENGE:
3619 +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
3620 +index 5edb636dbc4d..ea506a77f3c8 100644
3621 +--- a/net/rxrpc/input.c
3622 ++++ b/net/rxrpc/input.c
3623 +@@ -216,10 +216,11 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb,
3624 + /*
3625 + * Apply a hard ACK by advancing the Tx window.
3626 + */
3627 +-static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
3628 ++static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
3629 + struct rxrpc_ack_summary *summary)
3630 + {
3631 + struct sk_buff *skb, *list = NULL;
3632 ++ bool rot_last = false;
3633 + int ix;
3634 + u8 annotation;
3635 +
3636 +@@ -243,15 +244,17 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
3637 + skb->next = list;
3638 + list = skb;
3639 +
3640 +- if (annotation & RXRPC_TX_ANNO_LAST)
3641 ++ if (annotation & RXRPC_TX_ANNO_LAST) {
3642 + set_bit(RXRPC_CALL_TX_LAST, &call->flags);
3643 ++ rot_last = true;
3644 ++ }
3645 + if ((annotation & RXRPC_TX_ANNO_MASK) != RXRPC_TX_ANNO_ACK)
3646 + summary->nr_rot_new_acks++;
3647 + }
3648 +
3649 + spin_unlock(&call->lock);
3650 +
3651 +- trace_rxrpc_transmit(call, (test_bit(RXRPC_CALL_TX_LAST, &call->flags) ?
3652 ++ trace_rxrpc_transmit(call, (rot_last ?
3653 + rxrpc_transmit_rotate_last :
3654 + rxrpc_transmit_rotate));
3655 + wake_up(&call->waitq);
3656 +@@ -262,6 +265,8 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
3657 + skb->next = NULL;
3658 + rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
3659 + }
3660 ++
3661 ++ return rot_last;
3662 + }
3663 +
3664 + /*
3665 +@@ -332,11 +337,11 @@ static bool rxrpc_receiving_reply(struct rxrpc_call *call)
3666 + ktime_get_real());
3667 + }
3668 +
3669 +- if (!test_bit(RXRPC_CALL_TX_LAST, &call->flags))
3670 +- rxrpc_rotate_tx_window(call, top, &summary);
3671 + if (!test_bit(RXRPC_CALL_TX_LAST, &call->flags)) {
3672 +- rxrpc_proto_abort("TXL", call, top);
3673 +- return false;
3674 ++ if (!rxrpc_rotate_tx_window(call, top, &summary)) {
3675 ++ rxrpc_proto_abort("TXL", call, top);
3676 ++ return false;
3677 ++ }
3678 + }
3679 + if (!rxrpc_end_tx_phase(call, true, "ETD"))
3680 + return false;
3681 +@@ -801,6 +806,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
3682 + rxrpc_propose_ack_respond_to_ack);
3683 + }
3684 +
3685 ++ /* Discard any out-of-order or duplicate ACKs. */
3686 ++ if (before_eq(sp->hdr.serial, call->acks_latest)) {
3687 ++ _debug("discard ACK %d <= %d",
3688 ++ sp->hdr.serial, call->acks_latest);
3689 ++ return;
3690 ++ }
3691 ++ call->acks_latest_ts = skb->tstamp;
3692 ++ call->acks_latest = sp->hdr.serial;
3693 ++
3694 ++ /* Parse rwind and mtu sizes if provided. */
3695 + ioffset = offset + nr_acks + 3;
3696 + if (skb->len >= ioffset + sizeof(buf.info)) {
3697 + if (skb_copy_bits(skb, ioffset, &buf.info, sizeof(buf.info)) < 0)
3698 +@@ -822,23 +837,18 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
3699 + return;
3700 + }
3701 +
3702 +- /* Discard any out-of-order or duplicate ACKs. */
3703 +- if (before_eq(sp->hdr.serial, call->acks_latest)) {
3704 +- _debug("discard ACK %d <= %d",
3705 +- sp->hdr.serial, call->acks_latest);
3706 +- return;
3707 +- }
3708 +- call->acks_latest_ts = skb->tstamp;
3709 +- call->acks_latest = sp->hdr.serial;
3710 +-
3711 + if (before(hard_ack, call->tx_hard_ack) ||
3712 + after(hard_ack, call->tx_top))
3713 + return rxrpc_proto_abort("AKW", call, 0);
3714 + if (nr_acks > call->tx_top - hard_ack)
3715 + return rxrpc_proto_abort("AKN", call, 0);
3716 +
3717 +- if (after(hard_ack, call->tx_hard_ack))
3718 +- rxrpc_rotate_tx_window(call, hard_ack, &summary);
3719 ++ if (after(hard_ack, call->tx_hard_ack)) {
3720 ++ if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
3721 ++ rxrpc_end_tx_phase(call, false, "ETA");
3722 ++ return;
3723 ++ }
3724 ++ }
3725 +
3726 + if (nr_acks > 0) {
3727 + if (skb_copy_bits(skb, offset, buf.acks, nr_acks) < 0)
3728 +@@ -847,11 +857,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
3729 + &summary);
3730 + }
3731 +
3732 +- if (test_bit(RXRPC_CALL_TX_LAST, &call->flags)) {
3733 +- rxrpc_end_tx_phase(call, false, "ETA");
3734 +- return;
3735 +- }
3736 +-
3737 + if (call->rxtx_annotations[call->tx_top & RXRPC_RXTX_BUFF_MASK] &
3738 + RXRPC_TX_ANNO_LAST &&
3739 + summary.nr_acks == call->tx_top - hard_ack &&
3740 +@@ -873,8 +878,7 @@ static void rxrpc_input_ackall(struct rxrpc_call *call, struct sk_buff *skb)
3741 +
3742 + _proto("Rx ACKALL %%%u", sp->hdr.serial);
3743 +
3744 +- rxrpc_rotate_tx_window(call, call->tx_top, &summary);
3745 +- if (test_bit(RXRPC_CALL_TX_LAST, &call->flags))
3746 ++ if (rxrpc_rotate_tx_window(call, call->tx_top, &summary))
3747 + rxrpc_end_tx_phase(call, false, "ETL");
3748 + }
3749 +
3750 +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
3751 +index 2f4e1483aced..04a70793c1fe 100644
3752 +--- a/net/sched/cls_api.c
3753 ++++ b/net/sched/cls_api.c
3754 +@@ -31,6 +31,8 @@
3755 + #include <net/pkt_sched.h>
3756 + #include <net/pkt_cls.h>
3757 +
3758 ++extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
3759 ++
3760 + /* The list of all installed classifier types */
3761 + static LIST_HEAD(tcf_proto_base);
3762 +
3763 +@@ -559,7 +561,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
3764 + replay:
3765 + tp_created = 0;
3766 +
3767 +- err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL, extack);
3768 ++ err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack);
3769 + if (err < 0)
3770 + return err;
3771 +
3772 +@@ -836,7 +838,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
3773 + if (nlmsg_len(cb->nlh) < sizeof(*tcm))
3774 + return skb->len;
3775 +
3776 +- err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
3777 ++ err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
3778 ++ NULL);
3779 + if (err)
3780 + return err;
3781 +
3782 +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
3783 +index cd69aa067543..691ca96f7460 100644
3784 +--- a/net/sched/sch_api.c
3785 ++++ b/net/sched/sch_api.c
3786 +@@ -1917,7 +1917,8 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
3787 +
3788 + if (tcm->tcm_parent) {
3789 + q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent));
3790 +- if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
3791 ++ if (q && q != root &&
3792 ++ tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
3793 + return -1;
3794 + return 0;
3795 + }
3796 +diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
3797 +index bc30f9186ac6..d3105ee8decf 100644
3798 +--- a/net/sched/sch_gred.c
3799 ++++ b/net/sched/sch_gred.c
3800 +@@ -411,7 +411,7 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)
3801 + if (tb[TCA_GRED_PARMS] == NULL && tb[TCA_GRED_STAB] == NULL) {
3802 + if (tb[TCA_GRED_LIMIT] != NULL)
3803 + sch->limit = nla_get_u32(tb[TCA_GRED_LIMIT]);
3804 +- return gred_change_table_def(sch, opt);
3805 ++ return gred_change_table_def(sch, tb[TCA_GRED_DPS]);
3806 + }
3807 +
3808 + if (tb[TCA_GRED_PARMS] == NULL ||
3809 +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
3810 +index 2a2ab6bfe5d8..3d325b840802 100644
3811 +--- a/net/sched/sch_netem.c
3812 ++++ b/net/sched/sch_netem.c
3813 +@@ -624,6 +624,10 @@ deliver:
3814 + skb->next = NULL;
3815 + skb->prev = NULL;
3816 + skb->tstamp = netem_skb_cb(skb)->tstamp_save;
3817 ++ /* skb->dev shares skb->rbnode area,
3818 ++ * we need to restore its value.
3819 ++ */
3820 ++ skb->dev = qdisc_dev(sch);
3821 +
3822 + #ifdef CONFIG_NET_CLS_ACT
3823 + /*
3824 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
3825 +index 790094311143..d87d56978b4c 100644
3826 +--- a/net/sctp/socket.c
3827 ++++ b/net/sctp/socket.c
3828 +@@ -250,11 +250,10 @@ struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id)
3829 +
3830 + spin_lock_bh(&sctp_assocs_id_lock);
3831 + asoc = (struct sctp_association *)idr_find(&sctp_assocs_id, (int)id);
3832 ++ if (asoc && (asoc->base.sk != sk || asoc->base.dead))
3833 ++ asoc = NULL;
3834 + spin_unlock_bh(&sctp_assocs_id_lock);
3835 +
3836 +- if (!asoc || (asoc->base.sk != sk) || asoc->base.dead)
3837 +- return NULL;
3838 +-
3839 + return asoc;
3840 + }
3841 +
3842 +diff --git a/net/socket.c b/net/socket.c
3843 +index d27922639a20..a401578f3f28 100644
3844 +--- a/net/socket.c
3845 ++++ b/net/socket.c
3846 +@@ -2879,9 +2879,14 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
3847 + copy_in_user(&rxnfc->fs.ring_cookie,
3848 + &compat_rxnfc->fs.ring_cookie,
3849 + (void __user *)(&rxnfc->fs.location + 1) -
3850 +- (void __user *)&rxnfc->fs.ring_cookie) ||
3851 +- copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt,
3852 +- sizeof(rxnfc->rule_cnt)))
3853 ++ (void __user *)&rxnfc->fs.ring_cookie))
3854 ++ return -EFAULT;
3855 ++ if (ethcmd == ETHTOOL_GRXCLSRLALL) {
3856 ++ if (put_user(rule_cnt, &rxnfc->rule_cnt))
3857 ++ return -EFAULT;
3858 ++ } else if (copy_in_user(&rxnfc->rule_cnt,
3859 ++ &compat_rxnfc->rule_cnt,
3860 ++ sizeof(rxnfc->rule_cnt)))
3861 + return -EFAULT;
3862 + }
3863 +
3864 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
3865 +index 3de415bca391..46e9812d13c0 100644
3866 +--- a/net/wireless/nl80211.c
3867 ++++ b/net/wireless/nl80211.c
3868 +@@ -3480,6 +3480,7 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
3869 + return false;
3870 +
3871 + /* check availability */
3872 ++ ridx = array_index_nospec(ridx, IEEE80211_HT_MCS_MASK_LEN);
3873 + if (sband->ht_cap.mcs.rx_mask[ridx] & rbit)
3874 + mcs[ridx] |= rbit;
3875 + else
3876 +@@ -9719,7 +9720,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
3877 + struct wireless_dev *wdev = dev->ieee80211_ptr;
3878 + s32 last, low, high;
3879 + u32 hyst;
3880 +- int i, n;
3881 ++ int i, n, low_index;
3882 + int err;
3883 +
3884 + /* RSSI reporting disabled? */
3885 +@@ -9756,10 +9757,19 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
3886 + if (last < wdev->cqm_config->rssi_thresholds[i])
3887 + break;
3888 +
3889 +- low = i > 0 ?
3890 +- (wdev->cqm_config->rssi_thresholds[i - 1] - hyst) : S32_MIN;
3891 +- high = i < n ?
3892 +- (wdev->cqm_config->rssi_thresholds[i] + hyst - 1) : S32_MAX;
3893 ++ low_index = i - 1;
3894 ++ if (low_index >= 0) {
3895 ++ low_index = array_index_nospec(low_index, n);
3896 ++ low = wdev->cqm_config->rssi_thresholds[low_index] - hyst;
3897 ++ } else {
3898 ++ low = S32_MIN;
3899 ++ }
3900 ++ if (i < n) {
3901 ++ i = array_index_nospec(i, n);
3902 ++ high = wdev->cqm_config->rssi_thresholds[i] + hyst - 1;
3903 ++ } else {
3904 ++ high = S32_MAX;
3905 ++ }
3906 +
3907 + return rdev_set_cqm_rssi_range_config(rdev, dev, low, high);
3908 + }
3909 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
3910 +index 6e94f6934a0e..bd91de416035 100644
3911 +--- a/net/wireless/reg.c
3912 ++++ b/net/wireless/reg.c
3913 +@@ -2170,11 +2170,12 @@ static void reg_process_hint(struct regulatory_request *reg_request)
3914 + {
3915 + struct wiphy *wiphy = NULL;
3916 + enum reg_request_treatment treatment;
3917 ++ enum nl80211_reg_initiator initiator = reg_request->initiator;
3918 +
3919 + if (reg_request->wiphy_idx != WIPHY_IDX_INVALID)
3920 + wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
3921 +
3922 +- switch (reg_request->initiator) {
3923 ++ switch (initiator) {
3924 + case NL80211_REGDOM_SET_BY_CORE:
3925 + treatment = reg_process_hint_core(reg_request);
3926 + break;
3927 +@@ -2192,7 +2193,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
3928 + treatment = reg_process_hint_country_ie(wiphy, reg_request);
3929 + break;
3930 + default:
3931 +- WARN(1, "invalid initiator %d\n", reg_request->initiator);
3932 ++ WARN(1, "invalid initiator %d\n", initiator);
3933 + goto out_free;
3934 + }
3935 +
3936 +@@ -2207,7 +2208,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
3937 + */
3938 + if (treatment == REG_REQ_ALREADY_SET && wiphy &&
3939 + wiphy->regulatory_flags & REGULATORY_STRICT_REG) {
3940 +- wiphy_update_regulatory(wiphy, reg_request->initiator);
3941 ++ wiphy_update_regulatory(wiphy, initiator);
3942 + wiphy_all_share_dfs_chan_state(wiphy);
3943 + reg_check_channels();
3944 + }
3945 +@@ -2384,6 +2385,7 @@ static int regulatory_hint_core(const char *alpha2)
3946 + request->alpha2[0] = alpha2[0];
3947 + request->alpha2[1] = alpha2[1];
3948 + request->initiator = NL80211_REGDOM_SET_BY_CORE;
3949 ++ request->wiphy_idx = WIPHY_IDX_INVALID;
3950 +
3951 + queue_regulatory_request(request);
3952 +
3953 +diff --git a/net/wireless/scan.c b/net/wireless/scan.c
3954 +index f6c5fe482506..5ed0ed0559dc 100644
3955 +--- a/net/wireless/scan.c
3956 ++++ b/net/wireless/scan.c
3957 +@@ -1055,13 +1055,23 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
3958 + return NULL;
3959 + }
3960 +
3961 ++/*
3962 ++ * Update RX channel information based on the available frame payload
3963 ++ * information. This is mainly for the 2.4 GHz band where frames can be received
3964 ++ * from neighboring channels and the Beacon frames use the DSSS Parameter Set
3965 ++ * element to indicate the current (transmitting) channel, but this might also
3966 ++ * be needed on other bands if RX frequency does not match with the actual
3967 ++ * operating channel of a BSS.
3968 ++ */
3969 + static struct ieee80211_channel *
3970 + cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,
3971 +- struct ieee80211_channel *channel)
3972 ++ struct ieee80211_channel *channel,
3973 ++ enum nl80211_bss_scan_width scan_width)
3974 + {
3975 + const u8 *tmp;
3976 + u32 freq;
3977 + int channel_number = -1;
3978 ++ struct ieee80211_channel *alt_channel;
3979 +
3980 + tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);
3981 + if (tmp && tmp[1] == 1) {
3982 +@@ -1075,16 +1085,45 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,
3983 + }
3984 + }
3985 +
3986 +- if (channel_number < 0)
3987 ++ if (channel_number < 0) {
3988 ++ /* No channel information in frame payload */
3989 + return channel;
3990 ++ }
3991 +
3992 + freq = ieee80211_channel_to_frequency(channel_number, channel->band);
3993 +- channel = ieee80211_get_channel(wiphy, freq);
3994 +- if (!channel)
3995 +- return NULL;
3996 +- if (channel->flags & IEEE80211_CHAN_DISABLED)
3997 ++ alt_channel = ieee80211_get_channel(wiphy, freq);
3998 ++ if (!alt_channel) {
3999 ++ if (channel->band == NL80211_BAND_2GHZ) {
4000 ++ /*
4001 ++ * Better not allow unexpected channels when that could
4002 ++ * be going beyond the 1-11 range (e.g., discovering
4003 ++ * BSS on channel 12 when radio is configured for
4004 ++ * channel 11.
4005 ++ */
4006 ++ return NULL;
4007 ++ }
4008 ++
4009 ++ /* No match for the payload channel number - ignore it */
4010 ++ return channel;
4011 ++ }
4012 ++
4013 ++ if (scan_width == NL80211_BSS_CHAN_WIDTH_10 ||
4014 ++ scan_width == NL80211_BSS_CHAN_WIDTH_5) {
4015 ++ /*
4016 ++ * Ignore channel number in 5 and 10 MHz channels where there
4017 ++ * may not be an n:1 or 1:n mapping between frequencies and
4018 ++ * channel numbers.
4019 ++ */
4020 ++ return channel;
4021 ++ }
4022 ++
4023 ++ /*
4024 ++ * Use the channel determined through the payload channel number
4025 ++ * instead of the RX channel reported by the driver.
4026 ++ */
4027 ++ if (alt_channel->flags & IEEE80211_CHAN_DISABLED)
4028 + return NULL;
4029 +- return channel;
4030 ++ return alt_channel;
4031 + }
4032 +
4033 + /* Returned bss is reference counted and must be cleaned up appropriately. */
4034 +@@ -1109,7 +1148,8 @@ cfg80211_inform_bss_data(struct wiphy *wiphy,
4035 + (data->signal < 0 || data->signal > 100)))
4036 + return NULL;
4037 +
4038 +- channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan);
4039 ++ channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan,
4040 ++ data->scan_width);
4041 + if (!channel)
4042 + return NULL;
4043 +
4044 +@@ -1207,7 +1247,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
4045 + return NULL;
4046 +
4047 + channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable,
4048 +- ielen, data->chan);
4049 ++ ielen, data->chan, data->scan_width);
4050 + if (!channel)
4051 + return NULL;
4052 +
4053 +diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
4054 +index 9f492dc417d5..8e75319dd9c0 100644
4055 +--- a/net/xfrm/xfrm_input.c
4056 ++++ b/net/xfrm/xfrm_input.c
4057 +@@ -453,6 +453,7 @@ resume:
4058 + XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
4059 + goto drop;
4060 + }
4061 ++ crypto_done = false;
4062 + } while (!err);
4063 +
4064 + err = xfrm_rcv_cb(skb, family, x->type->proto, 0);
4065 +diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
4066 +index 35610cc881a9..c47660fba498 100644
4067 +--- a/net/xfrm/xfrm_output.c
4068 ++++ b/net/xfrm/xfrm_output.c
4069 +@@ -101,6 +101,10 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
4070 + spin_unlock_bh(&x->lock);
4071 +
4072 + skb_dst_force(skb);
4073 ++ if (!skb_dst(skb)) {
4074 ++ XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
4075 ++ goto error_nolock;
4076 ++ }
4077 +
4078 + if (xfrm_offload(skb)) {
4079 + x->type_offload->encap(x, skb);
4080 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
4081 +index 2fb7a78308e1..37c32e73aaef 100644
4082 +--- a/net/xfrm/xfrm_policy.c
4083 ++++ b/net/xfrm/xfrm_policy.c
4084 +@@ -2550,6 +2550,10 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
4085 + }
4086 +
4087 + skb_dst_force(skb);
4088 ++ if (!skb_dst(skb)) {
4089 ++ XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
4090 ++ return 0;
4091 ++ }
4092 +
4093 + dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE);
4094 + if (IS_ERR(dst)) {
4095 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
4096 +index 5554d28a32eb..4e8319766f2b 100644
4097 +--- a/net/xfrm/xfrm_user.c
4098 ++++ b/net/xfrm/xfrm_user.c
4099 +@@ -151,10 +151,16 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
4100 + err = -EINVAL;
4101 + switch (p->family) {
4102 + case AF_INET:
4103 ++ if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
4104 ++ goto out;
4105 ++
4106 + break;
4107 +
4108 + case AF_INET6:
4109 + #if IS_ENABLED(CONFIG_IPV6)
4110 ++ if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
4111 ++ goto out;
4112 ++
4113 + break;
4114 + #else
4115 + err = -EAFNOSUPPORT;
4116 +@@ -1353,10 +1359,16 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
4117 +
4118 + switch (p->sel.family) {
4119 + case AF_INET:
4120 ++ if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
4121 ++ return -EINVAL;
4122 ++
4123 + break;
4124 +
4125 + case AF_INET6:
4126 + #if IS_ENABLED(CONFIG_IPV6)
4127 ++ if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
4128 ++ return -EINVAL;
4129 ++
4130 + break;
4131 + #else
4132 + return -EAFNOSUPPORT;
4133 +@@ -1437,6 +1449,9 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
4134 + (ut[i].family != prev_family))
4135 + return -EINVAL;
4136 +
4137 ++ if (ut[i].mode >= XFRM_MODE_MAX)
4138 ++ return -EINVAL;
4139 ++
4140 + prev_family = ut[i].family;
4141 +
4142 + switch (ut[i].family) {
4143 +diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
4144 +index 126e3f2e1ed7..2b0adeb5fc42 100644
4145 +--- a/scripts/kconfig/zconf.y
4146 ++++ b/scripts/kconfig/zconf.y
4147 +@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
4148 + static struct menu *current_menu, *current_entry;
4149 +
4150 + %}
4151 +-%expect 31
4152 ++%expect 30
4153 +
4154 + %union
4155 + {
4156 +@@ -112,7 +112,7 @@ start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
4157 +
4158 + /* mainmenu entry */
4159 +
4160 +-mainmenu_stmt: T_MAINMENU prompt nl
4161 ++mainmenu_stmt: T_MAINMENU prompt T_EOL
4162 + {
4163 + menu_add_prompt(P_MENU, $2, NULL);
4164 + };
4165 +diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
4166 +index e229abd21652..b0f8979ff2d2 100644
4167 +--- a/sound/usb/usx2y/usb_stream.c
4168 ++++ b/sound/usb/usx2y/usb_stream.c
4169 +@@ -56,7 +56,7 @@ check:
4170 + lb, s->period_size);
4171 + }
4172 +
4173 +-static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4174 ++static int init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4175 + struct urb **urbs, char *transfer,
4176 + struct usb_device *dev, int pipe)
4177 + {
4178 +@@ -77,6 +77,8 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4179 + urb->interval = 1;
4180 + if (usb_pipeout(pipe))
4181 + continue;
4182 ++ if (usb_urb_ep_type_check(urb))
4183 ++ return -EINVAL;
4184 +
4185 + urb->transfer_buffer_length = transfer_length;
4186 + desc = urb->iso_frame_desc;
4187 +@@ -87,9 +89,11 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4188 + desc[p].length = maxpacket;
4189 + }
4190 + }
4191 ++
4192 ++ return 0;
4193 + }
4194 +
4195 +-static void init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4196 ++static int init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4197 + struct usb_device *dev, int in_pipe, int out_pipe)
4198 + {
4199 + struct usb_stream *s = sk->s;
4200 +@@ -103,9 +107,12 @@ static void init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
4201 + sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL);
4202 + }
4203 +
4204 +- init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe);
4205 +- init_pipe_urbs(sk, use_packsize, sk->outurb, sk->write_page, dev,
4206 +- out_pipe);
4207 ++ if (init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe) ||
4208 ++ init_pipe_urbs(sk, use_packsize, sk->outurb, sk->write_page, dev,
4209 ++ out_pipe))
4210 ++ return -EINVAL;
4211 ++
4212 ++ return 0;
4213 + }
4214 +
4215 +
4216 +@@ -226,7 +233,11 @@ struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk,
4217 + else
4218 + sk->freqn = get_usb_high_speed_rate(sample_rate);
4219 +
4220 +- init_urbs(sk, use_packsize, dev, in_pipe, out_pipe);
4221 ++ if (init_urbs(sk, use_packsize, dev, in_pipe, out_pipe) < 0) {
4222 ++ usb_stream_free(sk);
4223 ++ return NULL;
4224 ++ }
4225 ++
4226 + sk->s->state = usb_stream_stopped;
4227 + out:
4228 + return sk->s;
4229 +diff --git a/tools/perf/Makefile b/tools/perf/Makefile
4230 +index 225454416ed5..7902a5681fc8 100644
4231 +--- a/tools/perf/Makefile
4232 ++++ b/tools/perf/Makefile
4233 +@@ -84,10 +84,10 @@ endif # has_clean
4234 + endif # MAKECMDGOALS
4235 +
4236 + #
4237 +-# The clean target is not really parallel, don't print the jobs info:
4238 ++# Explicitly disable parallelism for the clean target.
4239 + #
4240 + clean:
4241 +- $(make)
4242 ++ $(make) -j1
4243 +
4244 + #
4245 + # The build-test target is not really parallel, don't print the jobs info,
4246 +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
4247 +index 5966f1f9b160..1c9bc3516f8b 100644
4248 +--- a/tools/perf/tests/builtin-test.c
4249 ++++ b/tools/perf/tests/builtin-test.c
4250 +@@ -375,7 +375,7 @@ static int test_and_print(struct test *t, bool force_skip, int subtest)
4251 + if (!t->subtest.get_nr)
4252 + pr_debug("%s:", t->desc);
4253 + else
4254 +- pr_debug("%s subtest %d:", t->desc, subtest);
4255 ++ pr_debug("%s subtest %d:", t->desc, subtest + 1);
4256 +
4257 + switch (err) {
4258 + case TEST_OK:
4259 +@@ -589,7 +589,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
4260 + for (subi = 0; subi < subn; subi++) {
4261 + pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
4262 + t->subtest.get_desc(subi));
4263 +- err = test_and_print(t, skip, subi + 1);
4264 ++ err = test_and_print(t, skip, subi);
4265 + if (err != TEST_OK && t->subtest.skip_if_fail)
4266 + skip = true;
4267 + }
4268 +diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
4269 +index da4df7fd43a2..23f1bf175179 100644
4270 +--- a/tools/perf/util/setup.py
4271 ++++ b/tools/perf/util/setup.py
4272 +@@ -27,7 +27,7 @@ class install_lib(_install_lib):
4273 +
4274 + cflags = getenv('CFLAGS', '').split()
4275 + # switch off several checks (need to be at the end of cflags list)
4276 +-cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
4277 ++cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ]
4278 + if cc != "clang":
4279 + cflags += ['-Wno-cast-function-type' ]
4280 +
4281 +diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
4282 +index bef419d4266d..3ad0b3a3317b 100644
4283 +--- a/tools/testing/nvdimm/test/nfit.c
4284 ++++ b/tools/testing/nvdimm/test/nfit.c
4285 +@@ -1589,6 +1589,7 @@ static int nfit_ctl_test(struct device *dev)
4286 + unsigned long mask, cmd_size, offset;
4287 + union {
4288 + struct nd_cmd_get_config_size cfg_size;
4289 ++ struct nd_cmd_clear_error clear_err;
4290 + struct nd_cmd_ars_status ars_stat;
4291 + struct nd_cmd_ars_cap ars_cap;
4292 + char buf[sizeof(struct nd_cmd_ars_status)
4293 +@@ -1767,6 +1768,23 @@ static int nfit_ctl_test(struct device *dev)
4294 + return -EIO;
4295 + }
4296 +
4297 ++ /* test clear error */
4298 ++ cmd_size = sizeof(cmds.clear_err);
4299 ++ cmds.clear_err = (struct nd_cmd_clear_error) {
4300 ++ .length = 512,
4301 ++ .cleared = 512,
4302 ++ };
4303 ++ rc = setup_result(cmds.buf, cmd_size);
4304 ++ if (rc)
4305 ++ return rc;
4306 ++ rc = acpi_nfit_ctl(&acpi_desc->nd_desc, NULL, ND_CMD_CLEAR_ERROR,
4307 ++ cmds.buf, cmd_size, &cmd_rc);
4308 ++ if (rc < 0 || cmd_rc) {
4309 ++ dev_dbg(dev, "%s: failed at: %d rc: %d cmd_rc: %d\n",
4310 ++ __func__, __LINE__, rc, cmd_rc);
4311 ++ return -EIO;
4312 ++ }
4313 ++
4314 + return 0;
4315 + }
4316 +
4317 +diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
4318 +index 57b5ff576240..891130daac7c 100755
4319 +--- a/tools/testing/selftests/net/rtnetlink.sh
4320 ++++ b/tools/testing/selftests/net/rtnetlink.sh
4321 +@@ -1,4 +1,4 @@
4322 +-#!/bin/sh
4323 ++#!/bin/bash
4324 + #
4325 + # This test is for checking rtnetlink callpaths, and get as much coverage as possible.
4326 + #
4327 +diff --git a/tools/testing/selftests/powerpc/ptrace/.gitignore b/tools/testing/selftests/powerpc/ptrace/.gitignore
4328 +index 349acfafc95b..9dcc16ea8179 100644
4329 +--- a/tools/testing/selftests/powerpc/ptrace/.gitignore
4330 ++++ b/tools/testing/selftests/powerpc/ptrace/.gitignore
4331 +@@ -8,3 +8,4 @@ ptrace-vsx
4332 + ptrace-tm-vsx
4333 + ptrace-tm-spd-vsx
4334 + ptrace-tm-spr
4335 ++ptrace-hwbreak
4336 +diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
4337 +index 480305266504..0e2f4601d1a8 100644
4338 +--- a/tools/testing/selftests/powerpc/ptrace/Makefile
4339 ++++ b/tools/testing/selftests/powerpc/ptrace/Makefile
4340 +@@ -1,7 +1,7 @@
4341 + # SPDX-License-Identifier: GPL-2.0
4342 + TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
4343 + ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
4344 +- ptrace-tm-spd-vsx ptrace-tm-spr
4345 ++ ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak
4346 +
4347 + include ../../lib.mk
4348 +
4349 +diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c b/tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
4350 +new file mode 100644
4351 +index 000000000000..3066d310f32b
4352 +--- /dev/null
4353 ++++ b/tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
4354 +@@ -0,0 +1,342 @@
4355 ++// SPDX-License-Identifier: GPL-2.0+
4356 ++
4357 ++/*
4358 ++ * Ptrace test for hw breakpoints
4359 ++ *
4360 ++ * Based on tools/testing/selftests/breakpoints/breakpoint_test.c
4361 ++ *
4362 ++ * This test forks and the parent then traces the child doing various
4363 ++ * types of ptrace enabled breakpoints
4364 ++ *
4365 ++ * Copyright (C) 2018 Michael Neuling, IBM Corporation.
4366 ++ */
4367 ++
4368 ++#include <sys/ptrace.h>
4369 ++#include <unistd.h>
4370 ++#include <stddef.h>
4371 ++#include <sys/user.h>
4372 ++#include <stdio.h>
4373 ++#include <stdlib.h>
4374 ++#include <signal.h>
4375 ++#include <sys/types.h>
4376 ++#include <sys/wait.h>
4377 ++#include "ptrace.h"
4378 ++
4379 ++/* Breakpoint access modes */
4380 ++enum {
4381 ++ BP_X = 1,
4382 ++ BP_RW = 2,
4383 ++ BP_W = 4,
4384 ++};
4385 ++
4386 ++static pid_t child_pid;
4387 ++static struct ppc_debug_info dbginfo;
4388 ++
4389 ++static void get_dbginfo(void)
4390 ++{
4391 ++ int ret;
4392 ++
4393 ++ ret = ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, &dbginfo);
4394 ++ if (ret) {
4395 ++ perror("Can't get breakpoint info\n");
4396 ++ exit(-1);
4397 ++ }
4398 ++}
4399 ++
4400 ++static bool hwbreak_present(void)
4401 ++{
4402 ++ return (dbginfo.num_data_bps != 0);
4403 ++}
4404 ++
4405 ++static bool dawr_present(void)
4406 ++{
4407 ++ return !!(dbginfo.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR);
4408 ++}
4409 ++
4410 ++static void set_breakpoint_addr(void *addr)
4411 ++{
4412 ++ int ret;
4413 ++
4414 ++ ret = ptrace(PTRACE_SET_DEBUGREG, child_pid, 0, addr);
4415 ++ if (ret) {
4416 ++ perror("Can't set breakpoint addr\n");
4417 ++ exit(-1);
4418 ++ }
4419 ++}
4420 ++
4421 ++static int set_hwbreakpoint_addr(void *addr, int range)
4422 ++{
4423 ++ int ret;
4424 ++
4425 ++ struct ppc_hw_breakpoint info;
4426 ++
4427 ++ info.version = 1;
4428 ++ info.trigger_type = PPC_BREAKPOINT_TRIGGER_RW;
4429 ++ info.addr_mode = PPC_BREAKPOINT_MODE_EXACT;
4430 ++ if (range > 0)
4431 ++ info.addr_mode = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE;
4432 ++ info.condition_mode = PPC_BREAKPOINT_CONDITION_NONE;
4433 ++ info.addr = (__u64)addr;
4434 ++ info.addr2 = (__u64)addr + range;
4435 ++ info.condition_value = 0;
4436 ++
4437 ++ ret = ptrace(PPC_PTRACE_SETHWDEBUG, child_pid, 0, &info);
4438 ++ if (ret < 0) {
4439 ++ perror("Can't set breakpoint\n");
4440 ++ exit(-1);
4441 ++ }
4442 ++ return ret;
4443 ++}
4444 ++
4445 ++static int del_hwbreakpoint_addr(int watchpoint_handle)
4446 ++{
4447 ++ int ret;
4448 ++
4449 ++ ret = ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, watchpoint_handle);
4450 ++ if (ret < 0) {
4451 ++ perror("Can't delete hw breakpoint\n");
4452 ++ exit(-1);
4453 ++ }
4454 ++ return ret;
4455 ++}
4456 ++
4457 ++#define DAWR_LENGTH_MAX 512
4458 ++
4459 ++/* Dummy variables to test read/write accesses */
4460 ++static unsigned long long
4461 ++ dummy_array[DAWR_LENGTH_MAX / sizeof(unsigned long long)]
4462 ++ __attribute__((aligned(512)));
4463 ++static unsigned long long *dummy_var = dummy_array;
4464 ++
4465 ++static void write_var(int len)
4466 ++{
4467 ++ long long *plval;
4468 ++ char *pcval;
4469 ++ short *psval;
4470 ++ int *pival;
4471 ++
4472 ++ switch (len) {
4473 ++ case 1:
4474 ++ pcval = (char *)dummy_var;
4475 ++ *pcval = 0xff;
4476 ++ break;
4477 ++ case 2:
4478 ++ psval = (short *)dummy_var;
4479 ++ *psval = 0xffff;
4480 ++ break;
4481 ++ case 4:
4482 ++ pival = (int *)dummy_var;
4483 ++ *pival = 0xffffffff;
4484 ++ break;
4485 ++ case 8:
4486 ++ plval = (long long *)dummy_var;
4487 ++ *plval = 0xffffffffffffffffLL;
4488 ++ break;
4489 ++ }
4490 ++}
4491 ++
4492 ++static void read_var(int len)
4493 ++{
4494 ++ char cval __attribute__((unused));
4495 ++ short sval __attribute__((unused));
4496 ++ int ival __attribute__((unused));
4497 ++ long long lval __attribute__((unused));
4498 ++
4499 ++ switch (len) {
4500 ++ case 1:
4501 ++ cval = *(char *)dummy_var;
4502 ++ break;
4503 ++ case 2:
4504 ++ sval = *(short *)dummy_var;
4505 ++ break;
4506 ++ case 4:
4507 ++ ival = *(int *)dummy_var;
4508 ++ break;
4509 ++ case 8:
4510 ++ lval = *(long long *)dummy_var;
4511 ++ break;
4512 ++ }
4513 ++}
4514 ++
4515 ++/*
4516 ++ * Do the r/w accesses to trigger the breakpoints. And run
4517 ++ * the usual traps.
4518 ++ */
4519 ++static void trigger_tests(void)
4520 ++{
4521 ++ int len, ret;
4522 ++
4523 ++ ret = ptrace(PTRACE_TRACEME, 0, NULL, 0);
4524 ++ if (ret) {
4525 ++ perror("Can't be traced?\n");
4526 ++ return;
4527 ++ }
4528 ++
4529 ++ /* Wake up father so that it sets up the first test */
4530 ++ kill(getpid(), SIGUSR1);
4531 ++
4532 ++ /* Test write watchpoints */
4533 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4534 ++ write_var(len);
4535 ++
4536 ++ /* Test read/write watchpoints (on read accesses) */
4537 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4538 ++ read_var(len);
4539 ++
4540 ++ /* Test when breakpoint is unset */
4541 ++
4542 ++ /* Test write watchpoints */
4543 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4544 ++ write_var(len);
4545 ++
4546 ++ /* Test read/write watchpoints (on read accesses) */
4547 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4548 ++ read_var(len);
4549 ++}
4550 ++
4551 ++static void check_success(const char *msg)
4552 ++{
4553 ++ const char *msg2;
4554 ++ int status;
4555 ++
4556 ++ /* Wait for the child to SIGTRAP */
4557 ++ wait(&status);
4558 ++
4559 ++ msg2 = "Failed";
4560 ++
4561 ++ if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
4562 ++ msg2 = "Child process hit the breakpoint";
4563 ++ }
4564 ++
4565 ++ printf("%s Result: [%s]\n", msg, msg2);
4566 ++}
4567 ++
4568 ++static void launch_watchpoints(char *buf, int mode, int len,
4569 ++ struct ppc_debug_info *dbginfo, bool dawr)
4570 ++{
4571 ++ const char *mode_str;
4572 ++ unsigned long data = (unsigned long)(dummy_var);
4573 ++ int wh, range;
4574 ++
4575 ++ data &= ~0x7UL;
4576 ++
4577 ++ if (mode == BP_W) {
4578 ++ data |= (1UL << 1);
4579 ++ mode_str = "write";
4580 ++ } else {
4581 ++ data |= (1UL << 0);
4582 ++ data |= (1UL << 1);
4583 ++ mode_str = "read";
4584 ++ }
4585 ++
4586 ++ /* Set DABR_TRANSLATION bit */
4587 ++ data |= (1UL << 2);
4588 ++
4589 ++ /* use PTRACE_SET_DEBUGREG breakpoints */
4590 ++ set_breakpoint_addr((void *)data);
4591 ++ ptrace(PTRACE_CONT, child_pid, NULL, 0);
4592 ++ sprintf(buf, "Test %s watchpoint with len: %d ", mode_str, len);
4593 ++ check_success(buf);
4594 ++ /* Unregister hw brkpoint */
4595 ++ set_breakpoint_addr(NULL);
4596 ++
4597 ++ data = (data & ~7); /* remove dabr control bits */
4598 ++
4599 ++ /* use PPC_PTRACE_SETHWDEBUG breakpoint */
4600 ++ if (!(dbginfo->features & PPC_DEBUG_FEATURE_DATA_BP_RANGE))
4601 ++ return; /* not supported */
4602 ++ wh = set_hwbreakpoint_addr((void *)data, 0);
4603 ++ ptrace(PTRACE_CONT, child_pid, NULL, 0);
4604 ++ sprintf(buf, "Test %s watchpoint with len: %d ", mode_str, len);
4605 ++ check_success(buf);
4606 ++ /* Unregister hw brkpoint */
4607 ++ del_hwbreakpoint_addr(wh);
4608 ++
4609 ++ /* try a wider range */
4610 ++ range = 8;
4611 ++ if (dawr)
4612 ++ range = 512 - ((int)data & (DAWR_LENGTH_MAX - 1));
4613 ++ wh = set_hwbreakpoint_addr((void *)data, range);
4614 ++ ptrace(PTRACE_CONT, child_pid, NULL, 0);
4615 ++ sprintf(buf, "Test %s watchpoint with len: %d ", mode_str, len);
4616 ++ check_success(buf);
4617 ++ /* Unregister hw brkpoint */
4618 ++ del_hwbreakpoint_addr(wh);
4619 ++}
4620 ++
4621 ++/* Set the breakpoints and check the child successfully trigger them */
4622 ++static int launch_tests(bool dawr)
4623 ++{
4624 ++ char buf[1024];
4625 ++ int len, i, status;
4626 ++
4627 ++ struct ppc_debug_info dbginfo;
4628 ++
4629 ++ i = ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, &dbginfo);
4630 ++ if (i) {
4631 ++ perror("Can't set breakpoint info\n");
4632 ++ exit(-1);
4633 ++ }
4634 ++ if (!(dbginfo.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE))
4635 ++ printf("WARNING: Kernel doesn't support PPC_PTRACE_SETHWDEBUG\n");
4636 ++
4637 ++ /* Write watchpoint */
4638 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4639 ++ launch_watchpoints(buf, BP_W, len, &dbginfo, dawr);
4640 ++
4641 ++ /* Read-Write watchpoint */
4642 ++ for (len = 1; len <= sizeof(long); len <<= 1)
4643 ++ launch_watchpoints(buf, BP_RW, len, &dbginfo, dawr);
4644 ++
4645 ++ ptrace(PTRACE_CONT, child_pid, NULL, 0);
4646 ++
4647 ++ /*
4648 ++ * Now we have unregistered the breakpoint, access by child
4649 ++ * should not cause SIGTRAP.
4650 ++ */
4651 ++
4652 ++ wait(&status);
4653 ++
4654 ++ if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
4655 ++ printf("FAIL: Child process hit the breakpoint, which is not expected\n");
4656 ++ ptrace(PTRACE_CONT, child_pid, NULL, 0);
4657 ++ return TEST_FAIL;
4658 ++ }
4659 ++
4660 ++ if (WIFEXITED(status))
4661 ++ printf("Child exited normally\n");
4662 ++
4663 ++ return TEST_PASS;
4664 ++}
4665 ++
4666 ++static int ptrace_hwbreak(void)
4667 ++{
4668 ++ pid_t pid;
4669 ++ int ret;
4670 ++ bool dawr;
4671 ++
4672 ++ pid = fork();
4673 ++ if (!pid) {
4674 ++ trigger_tests();
4675 ++ return 0;
4676 ++ }
4677 ++
4678 ++ wait(NULL);
4679 ++
4680 ++ child_pid = pid;
4681 ++
4682 ++ get_dbginfo();
4683 ++ SKIP_IF(!hwbreak_present());
4684 ++ dawr = dawr_present();
4685 ++
4686 ++ ret = launch_tests(dawr);
4687 ++
4688 ++ wait(NULL);
4689 ++
4690 ++ return ret;
4691 ++}
4692 ++
4693 ++int main(int argc, char **argv, char **envp)
4694 ++{
4695 ++ return test_harness(ptrace_hwbreak, "ptrace-hwbreak");
4696 ++}