Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Fri, 24 Aug 2018 11:43:07
Message-Id: 1535110973.bb672c80be123345ed76ec976ad159b5cb0c6ab5.mpagano@gentoo
1 commit: bb672c80be123345ed76ec976ad159b5cb0c6ab5
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 24 11:42:53 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 24 11:42:53 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=bb672c80
7
8 Linux patch 4.9.124
9
10 0000_README | 4 +
11 1123_linux-4.9.124.patch | 4071 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 4075 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 41e0394..a65a30e 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -535,6 +535,10 @@ Patch: 1122_linux-4.9.123.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.123
21
22 +Patch: 1123_linux-4.9.124.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.124
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/1123_linux-4.9.124.patch b/1123_linux-4.9.124.patch
31 new file mode 100644
32 index 0000000..212c43c
33 --- /dev/null
34 +++ b/1123_linux-4.9.124.patch
35 @@ -0,0 +1,4071 @@
36 +diff --git a/Makefile b/Makefile
37 +index b11e375bb18e..53d57acfc17e 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 123
44 ++SUBLEVEL = 124
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/arc/Makefile b/arch/arc/Makefile
49 +index 19cce226d1a8..8447eed836ef 100644
50 +--- a/arch/arc/Makefile
51 ++++ b/arch/arc/Makefile
52 +@@ -18,7 +18,7 @@ endif
53 +
54 + KBUILD_DEFCONFIG := nsim_700_defconfig
55 +
56 +-cflags-y += -fno-common -pipe -fno-builtin -D__linux__
57 ++cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
58 + cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
59 + cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs
60 +
61 +@@ -141,16 +141,3 @@ dtbs: scripts
62 +
63 + archclean:
64 + $(Q)$(MAKE) $(clean)=$(boot)
65 +-
66 +-# Hacks to enable final link due to absence of link-time branch relexation
67 +-# and gcc choosing optimal(shorter) branches at -O3
68 +-#
69 +-# vineetg Feb 2010: -mlong-calls switched off for overall kernel build
70 +-# However lib/decompress_inflate.o (.init.text) calls
71 +-# zlib_inflate_workspacesize (.text) causing relocation errors.
72 +-# Thus forcing all exten calls in this file to be long calls
73 +-export CFLAGS_decompress_inflate.o = -mmedium-calls
74 +-export CFLAGS_initramfs.o = -mmedium-calls
75 +-ifdef CONFIG_SMP
76 +-export CFLAGS_core.o = -mmedium-calls
77 +-endif
78 +diff --git a/arch/arc/include/asm/mach_desc.h b/arch/arc/include/asm/mach_desc.h
79 +index c28e6c347b49..871f3cb16af9 100644
80 +--- a/arch/arc/include/asm/mach_desc.h
81 ++++ b/arch/arc/include/asm/mach_desc.h
82 +@@ -34,9 +34,7 @@ struct machine_desc {
83 + const char *name;
84 + const char **dt_compat;
85 + void (*init_early)(void);
86 +-#ifdef CONFIG_SMP
87 + void (*init_per_cpu)(unsigned int);
88 +-#endif
89 + void (*init_machine)(void);
90 + void (*init_late)(void);
91 +
92 +diff --git a/arch/arc/kernel/irq.c b/arch/arc/kernel/irq.c
93 +index 538b36afe89e..62b185057c04 100644
94 +--- a/arch/arc/kernel/irq.c
95 ++++ b/arch/arc/kernel/irq.c
96 +@@ -31,10 +31,10 @@ void __init init_IRQ(void)
97 + /* a SMP H/w block could do IPI IRQ request here */
98 + if (plat_smp_ops.init_per_cpu)
99 + plat_smp_ops.init_per_cpu(smp_processor_id());
100 ++#endif
101 +
102 + if (machine_desc->init_per_cpu)
103 + machine_desc->init_per_cpu(smp_processor_id());
104 +-#endif
105 + }
106 +
107 + /*
108 +diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
109 +index a41a79a4f4fe..0e8c0151a390 100644
110 +--- a/arch/arc/kernel/process.c
111 ++++ b/arch/arc/kernel/process.c
112 +@@ -44,7 +44,8 @@ SYSCALL_DEFINE0(arc_gettls)
113 + SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
114 + {
115 + struct pt_regs *regs = current_pt_regs();
116 +- int uval = -EFAULT;
117 ++ u32 uval;
118 ++ int ret;
119 +
120 + /*
121 + * This is only for old cores lacking LLOCK/SCOND, which by defintion
122 +@@ -57,23 +58,47 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
123 + /* Z indicates to userspace if operation succeded */
124 + regs->status32 &= ~STATUS_Z_MASK;
125 +
126 +- if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
127 +- return -EFAULT;
128 ++ ret = access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr));
129 ++ if (!ret)
130 ++ goto fail;
131 +
132 ++again:
133 + preempt_disable();
134 +
135 +- if (__get_user(uval, uaddr))
136 +- goto done;
137 ++ ret = __get_user(uval, uaddr);
138 ++ if (ret)
139 ++ goto fault;
140 +
141 +- if (uval == expected) {
142 +- if (!__put_user(new, uaddr))
143 +- regs->status32 |= STATUS_Z_MASK;
144 +- }
145 ++ if (uval != expected)
146 ++ goto out;
147 +
148 +-done:
149 +- preempt_enable();
150 ++ ret = __put_user(new, uaddr);
151 ++ if (ret)
152 ++ goto fault;
153 ++
154 ++ regs->status32 |= STATUS_Z_MASK;
155 +
156 ++out:
157 ++ preempt_enable();
158 + return uval;
159 ++
160 ++fault:
161 ++ preempt_enable();
162 ++
163 ++ if (unlikely(ret != -EFAULT))
164 ++ goto fail;
165 ++
166 ++ down_read(&current->mm->mmap_sem);
167 ++ ret = fixup_user_fault(current, current->mm, (unsigned long) uaddr,
168 ++ FAULT_FLAG_WRITE, NULL);
169 ++ up_read(&current->mm->mmap_sem);
170 ++
171 ++ if (likely(!ret))
172 ++ goto again;
173 ++
174 ++fail:
175 ++ force_sig(SIGSEGV, current);
176 ++ return ret;
177 + }
178 +
179 + void arch_cpu_idle(void)
180 +diff --git a/arch/arm/boot/dts/am3517.dtsi b/arch/arm/boot/dts/am3517.dtsi
181 +index 0db19d39d24c..d022b6b03273 100644
182 +--- a/arch/arm/boot/dts/am3517.dtsi
183 ++++ b/arch/arm/boot/dts/am3517.dtsi
184 +@@ -74,6 +74,11 @@
185 + };
186 + };
187 +
188 ++/* Table Table 5-79 of the TRM shows 480ab000 is reserved */
189 ++&usb_otg_hs {
190 ++ status = "disabled";
191 ++};
192 ++
193 + &iva {
194 + status = "disabled";
195 + };
196 +diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts
197 +index 319d94205350..6482ada22015 100644
198 +--- a/arch/arm/boot/dts/am437x-sk-evm.dts
199 ++++ b/arch/arm/boot/dts/am437x-sk-evm.dts
200 +@@ -533,6 +533,8 @@
201 +
202 + touchscreen-size-x = <480>;
203 + touchscreen-size-y = <272>;
204 ++
205 ++ wakeup-source;
206 + };
207 +
208 + tlv320aic3106: tlv320aic3106@1b {
209 +diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi
210 +index fabc9f36c408..5ad61537990e 100644
211 +--- a/arch/arm/boot/dts/bcm-cygnus.dtsi
212 ++++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
213 +@@ -128,7 +128,7 @@
214 + reg = <0x18008000 0x100>;
215 + #address-cells = <1>;
216 + #size-cells = <0>;
217 +- interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>;
218 ++ interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
219 + clock-frequency = <100000>;
220 + status = "disabled";
221 + };
222 +@@ -157,7 +157,7 @@
223 + reg = <0x1800b000 0x100>;
224 + #address-cells = <1>;
225 + #size-cells = <0>;
226 +- interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>;
227 ++ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
228 + clock-frequency = <100000>;
229 + status = "disabled";
230 + };
231 +@@ -168,7 +168,7 @@
232 +
233 + #interrupt-cells = <1>;
234 + interrupt-map-mask = <0 0 0 0>;
235 +- interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>;
236 ++ interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
237 +
238 + linux,pci-domain = <0>;
239 +
240 +@@ -190,10 +190,10 @@
241 + compatible = "brcm,iproc-msi";
242 + msi-controller;
243 + interrupt-parent = <&gic>;
244 +- interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>,
245 +- <GIC_SPI 97 IRQ_TYPE_NONE>,
246 +- <GIC_SPI 98 IRQ_TYPE_NONE>,
247 +- <GIC_SPI 99 IRQ_TYPE_NONE>;
248 ++ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>,
249 ++ <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
250 ++ <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
251 ++ <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
252 + };
253 + };
254 +
255 +@@ -203,7 +203,7 @@
256 +
257 + #interrupt-cells = <1>;
258 + interrupt-map-mask = <0 0 0 0>;
259 +- interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>;
260 ++ interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
261 +
262 + linux,pci-domain = <1>;
263 +
264 +@@ -225,10 +225,10 @@
265 + compatible = "brcm,iproc-msi";
266 + msi-controller;
267 + interrupt-parent = <&gic>;
268 +- interrupts = <GIC_SPI 102 IRQ_TYPE_NONE>,
269 +- <GIC_SPI 103 IRQ_TYPE_NONE>,
270 +- <GIC_SPI 104 IRQ_TYPE_NONE>,
271 +- <GIC_SPI 105 IRQ_TYPE_NONE>;
272 ++ interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
273 ++ <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
274 ++ <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
275 ++ <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
276 + };
277 + };
278 +
279 +diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
280 +index 65e0db1d3bd7..6e3d3b50824e 100644
281 +--- a/arch/arm/boot/dts/bcm-nsp.dtsi
282 ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi
283 +@@ -288,7 +288,7 @@
284 + reg = <0x38000 0x50>;
285 + #address-cells = <1>;
286 + #size-cells = <0>;
287 +- interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>;
288 ++ interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
289 + clock-frequency = <100000>;
290 + };
291 +
292 +@@ -375,7 +375,7 @@
293 +
294 + #interrupt-cells = <1>;
295 + interrupt-map-mask = <0 0 0 0>;
296 +- interrupt-map = <0 0 0 0 &gic GIC_SPI 131 IRQ_TYPE_NONE>;
297 ++ interrupt-map = <0 0 0 0 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
298 +
299 + linux,pci-domain = <0>;
300 +
301 +@@ -397,10 +397,10 @@
302 + compatible = "brcm,iproc-msi";
303 + msi-controller;
304 + interrupt-parent = <&gic>;
305 +- interrupts = <GIC_SPI 127 IRQ_TYPE_NONE>,
306 +- <GIC_SPI 128 IRQ_TYPE_NONE>,
307 +- <GIC_SPI 129 IRQ_TYPE_NONE>,
308 +- <GIC_SPI 130 IRQ_TYPE_NONE>;
309 ++ interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>,
310 ++ <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
311 ++ <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
312 ++ <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
313 + brcm,pcie-msi-inten;
314 + };
315 + };
316 +@@ -411,7 +411,7 @@
317 +
318 + #interrupt-cells = <1>;
319 + interrupt-map-mask = <0 0 0 0>;
320 +- interrupt-map = <0 0 0 0 &gic GIC_SPI 137 IRQ_TYPE_NONE>;
321 ++ interrupt-map = <0 0 0 0 &gic GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
322 +
323 + linux,pci-domain = <1>;
324 +
325 +@@ -433,10 +433,10 @@
326 + compatible = "brcm,iproc-msi";
327 + msi-controller;
328 + interrupt-parent = <&gic>;
329 +- interrupts = <GIC_SPI 133 IRQ_TYPE_NONE>,
330 +- <GIC_SPI 134 IRQ_TYPE_NONE>,
331 +- <GIC_SPI 135 IRQ_TYPE_NONE>,
332 +- <GIC_SPI 136 IRQ_TYPE_NONE>;
333 ++ interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
334 ++ <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
335 ++ <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
336 ++ <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
337 + brcm,pcie-msi-inten;
338 + };
339 + };
340 +@@ -447,7 +447,7 @@
341 +
342 + #interrupt-cells = <1>;
343 + interrupt-map-mask = <0 0 0 0>;
344 +- interrupt-map = <0 0 0 0 &gic GIC_SPI 143 IRQ_TYPE_NONE>;
345 ++ interrupt-map = <0 0 0 0 &gic GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
346 +
347 + linux,pci-domain = <2>;
348 +
349 +@@ -469,10 +469,10 @@
350 + compatible = "brcm,iproc-msi";
351 + msi-controller;
352 + interrupt-parent = <&gic>;
353 +- interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>,
354 +- <GIC_SPI 140 IRQ_TYPE_NONE>,
355 +- <GIC_SPI 141 IRQ_TYPE_NONE>,
356 +- <GIC_SPI 142 IRQ_TYPE_NONE>;
357 ++ interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
358 ++ <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
359 ++ <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
360 ++ <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
361 + brcm,pcie-msi-inten;
362 + };
363 + };
364 +diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
365 +index f79e1b91c680..51ab92fa7a6a 100644
366 +--- a/arch/arm/boot/dts/da850.dtsi
367 ++++ b/arch/arm/boot/dts/da850.dtsi
368 +@@ -377,11 +377,7 @@
369 + gpio-controller;
370 + #gpio-cells = <2>;
371 + reg = <0x226000 0x1000>;
372 +- interrupts = <42 IRQ_TYPE_EDGE_BOTH
373 +- 43 IRQ_TYPE_EDGE_BOTH 44 IRQ_TYPE_EDGE_BOTH
374 +- 45 IRQ_TYPE_EDGE_BOTH 46 IRQ_TYPE_EDGE_BOTH
375 +- 47 IRQ_TYPE_EDGE_BOTH 48 IRQ_TYPE_EDGE_BOTH
376 +- 49 IRQ_TYPE_EDGE_BOTH 50 IRQ_TYPE_EDGE_BOTH>;
377 ++ interrupts = <42 43 44 45 46 47 48 49 50>;
378 + ti,ngpio = <144>;
379 + ti,davinci-gpio-unbanked = <0>;
380 + status = "disabled";
381 +diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
382 +index 5f013c9fc1ed..8290c9ace6e9 100644
383 +--- a/arch/arm/configs/imx_v4_v5_defconfig
384 ++++ b/arch/arm/configs/imx_v4_v5_defconfig
385 +@@ -145,9 +145,11 @@ CONFIG_USB_STORAGE=y
386 + CONFIG_USB_CHIPIDEA=y
387 + CONFIG_USB_CHIPIDEA_UDC=y
388 + CONFIG_USB_CHIPIDEA_HOST=y
389 ++CONFIG_USB_CHIPIDEA_ULPI=y
390 + CONFIG_NOP_USB_XCEIV=y
391 + CONFIG_USB_GADGET=y
392 + CONFIG_USB_ETH=m
393 ++CONFIG_USB_ULPI_BUS=y
394 + CONFIG_MMC=y
395 + CONFIG_MMC_SDHCI=y
396 + CONFIG_MMC_SDHCI_PLTFM=y
397 +diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
398 +index 8ec4dbbb50b0..6b7d4f535984 100644
399 +--- a/arch/arm/configs/imx_v6_v7_defconfig
400 ++++ b/arch/arm/configs/imx_v6_v7_defconfig
401 +@@ -271,6 +271,7 @@ CONFIG_USB_STORAGE=y
402 + CONFIG_USB_CHIPIDEA=y
403 + CONFIG_USB_CHIPIDEA_UDC=y
404 + CONFIG_USB_CHIPIDEA_HOST=y
405 ++CONFIG_USB_CHIPIDEA_ULPI=y
406 + CONFIG_USB_SERIAL=m
407 + CONFIG_USB_SERIAL_GENERIC=y
408 + CONFIG_USB_SERIAL_FTDI_SIO=m
409 +@@ -307,6 +308,7 @@ CONFIG_USB_GADGETFS=m
410 + CONFIG_USB_FUNCTIONFS=m
411 + CONFIG_USB_MASS_STORAGE=m
412 + CONFIG_USB_G_SERIAL=m
413 ++CONFIG_USB_ULPI_BUS=y
414 + CONFIG_MMC=y
415 + CONFIG_MMC_SDHCI=y
416 + CONFIG_MMC_SDHCI_PLTFM=y
417 +diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
418 +index b4de3da6dffa..f7f36da80f40 100644
419 +--- a/arch/arm/mach-omap2/omap-smp.c
420 ++++ b/arch/arm/mach-omap2/omap-smp.c
421 +@@ -104,6 +104,45 @@ void omap5_erratum_workaround_801819(void)
422 + static inline void omap5_erratum_workaround_801819(void) { }
423 + #endif
424 +
425 ++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
426 ++/*
427 ++ * Configure ACR and enable ACTLR[0] (Enable invalidates of BTB with
428 ++ * ICIALLU) to activate the workaround for secondary Core.
429 ++ * NOTE: it is assumed that the primary core's configuration is done
430 ++ * by the boot loader (kernel will detect a misconfiguration and complain
431 ++ * if this is not done).
432 ++ *
433 ++ * In General Purpose(GP) devices, ACR bit settings can only be done
434 ++ * by ROM code in "secure world" using the smc call and there is no
435 ++ * option to update the "firmware" on such devices. This also works for
436 ++ * High security(HS) devices, as a backup option in case the
437 ++ * "update" is not done in the "security firmware".
438 ++ */
439 ++static void omap5_secondary_harden_predictor(void)
440 ++{
441 ++ u32 acr, acr_mask;
442 ++
443 ++ asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
444 ++
445 ++ /*
446 ++ * ACTLR[0] (Enable invalidates of BTB with ICIALLU)
447 ++ */
448 ++ acr_mask = BIT(0);
449 ++
450 ++ /* Do we already have it done.. if yes, skip expensive smc */
451 ++ if ((acr & acr_mask) == acr_mask)
452 ++ return;
453 ++
454 ++ acr |= acr_mask;
455 ++ omap_smc1(OMAP5_DRA7_MON_SET_ACR_INDEX, acr);
456 ++
457 ++ pr_debug("%s: ARM ACR setup for CVE_2017_5715 applied on CPU%d\n",
458 ++ __func__, smp_processor_id());
459 ++}
460 ++#else
461 ++static inline void omap5_secondary_harden_predictor(void) { }
462 ++#endif
463 ++
464 + static void omap4_secondary_init(unsigned int cpu)
465 + {
466 + /*
467 +@@ -126,6 +165,8 @@ static void omap4_secondary_init(unsigned int cpu)
468 + set_cntfreq();
469 + /* Configure ACR to disable streaming WA for 801819 */
470 + omap5_erratum_workaround_801819();
471 ++ /* Enable ACR to allow for ICUALLU workaround */
472 ++ omap5_secondary_harden_predictor();
473 + }
474 +
475 + /*
476 +diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
477 +index 9c10248fadcc..4e8c2116808e 100644
478 +--- a/arch/arm/mach-pxa/irq.c
479 ++++ b/arch/arm/mach-pxa/irq.c
480 +@@ -185,7 +185,7 @@ static int pxa_irq_suspend(void)
481 + {
482 + int i;
483 +
484 +- for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
485 ++ for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
486 + void __iomem *base = irq_base(i);
487 +
488 + saved_icmr[i] = __raw_readl(base + ICMR);
489 +@@ -204,7 +204,7 @@ static void pxa_irq_resume(void)
490 + {
491 + int i;
492 +
493 +- for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
494 ++ for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
495 + void __iomem *base = irq_base(i);
496 +
497 + __raw_writel(saved_icmr[i], base + ICMR);
498 +diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
499 +index 4c587ad8bfe3..1565d6b67163 100644
500 +--- a/arch/arm/mm/init.c
501 ++++ b/arch/arm/mm/init.c
502 +@@ -722,19 +722,28 @@ int __mark_rodata_ro(void *unused)
503 + return 0;
504 + }
505 +
506 ++static int kernel_set_to_readonly __read_mostly;
507 ++
508 + void mark_rodata_ro(void)
509 + {
510 ++ kernel_set_to_readonly = 1;
511 + stop_machine(__mark_rodata_ro, NULL, NULL);
512 + }
513 +
514 + void set_kernel_text_rw(void)
515 + {
516 ++ if (!kernel_set_to_readonly)
517 ++ return;
518 ++
519 + set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false,
520 + current->active_mm);
521 + }
522 +
523 + void set_kernel_text_ro(void)
524 + {
525 ++ if (!kernel_set_to_readonly)
526 ++ return;
527 ++
528 + set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true,
529 + current->active_mm);
530 + }
531 +diff --git a/arch/arm64/boot/dts/broadcom/ns2.dtsi b/arch/arm64/boot/dts/broadcom/ns2.dtsi
532 +index a16b1b3f9fc6..8a94ec8035d3 100644
533 +--- a/arch/arm64/boot/dts/broadcom/ns2.dtsi
534 ++++ b/arch/arm64/boot/dts/broadcom/ns2.dtsi
535 +@@ -393,7 +393,7 @@
536 + reg = <0x66080000 0x100>;
537 + #address-cells = <1>;
538 + #size-cells = <0>;
539 +- interrupts = <GIC_SPI 394 IRQ_TYPE_NONE>;
540 ++ interrupts = <GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>;
541 + clock-frequency = <100000>;
542 + status = "disabled";
543 + };
544 +@@ -421,7 +421,7 @@
545 + reg = <0x660b0000 0x100>;
546 + #address-cells = <1>;
547 + #size-cells = <0>;
548 +- interrupts = <GIC_SPI 395 IRQ_TYPE_NONE>;
549 ++ interrupts = <GIC_SPI 395 IRQ_TYPE_LEVEL_HIGH>;
550 + clock-frequency = <100000>;
551 + status = "disabled";
552 + };
553 +diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
554 +index a70f7d3361c4..cfd33f18f437 100644
555 +--- a/arch/arm64/kernel/smp.c
556 ++++ b/arch/arm64/kernel/smp.c
557 +@@ -205,7 +205,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
558 + * This is the secondary CPU boot entry. We're using this CPUs
559 + * idle thread stack, but a set of temporary page tables.
560 + */
561 +-asmlinkage void secondary_start_kernel(void)
562 ++asmlinkage notrace void secondary_start_kernel(void)
563 + {
564 + struct mm_struct *mm = &init_mm;
565 + unsigned int cpu = smp_processor_id();
566 +diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
567 +index fb95aed5f428..dac7564a48da 100644
568 +--- a/arch/m68k/include/asm/mcf_pgalloc.h
569 ++++ b/arch/m68k/include/asm/mcf_pgalloc.h
570 +@@ -43,6 +43,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
571 + static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
572 + unsigned long address)
573 + {
574 ++ pgtable_page_dtor(page);
575 + __free_page(page);
576 + }
577 +
578 +@@ -73,8 +74,9 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
579 + return page;
580 + }
581 +
582 +-extern inline void pte_free(struct mm_struct *mm, struct page *page)
583 ++static inline void pte_free(struct mm_struct *mm, struct page *page)
584 + {
585 ++ pgtable_page_dtor(page);
586 + __free_page(page);
587 + }
588 +
589 +diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
590 +index e32936cd7f10..7031483b110c 100644
591 +--- a/arch/parisc/include/asm/spinlock.h
592 ++++ b/arch/parisc/include/asm/spinlock.h
593 +@@ -26,7 +26,6 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *x,
594 + {
595 + volatile unsigned int *a;
596 +
597 +- mb();
598 + a = __ldcw_align(x);
599 + while (__ldcw(a) == 0)
600 + while (*a == 0)
601 +@@ -36,16 +35,15 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *x,
602 + local_irq_disable();
603 + } else
604 + cpu_relax();
605 +- mb();
606 + }
607 +
608 + static inline void arch_spin_unlock(arch_spinlock_t *x)
609 + {
610 + volatile unsigned int *a;
611 +- mb();
612 ++
613 + a = __ldcw_align(x);
614 +- *a = 1;
615 + mb();
616 ++ *a = 1;
617 + }
618 +
619 + static inline int arch_spin_trylock(arch_spinlock_t *x)
620 +@@ -53,10 +51,8 @@ static inline int arch_spin_trylock(arch_spinlock_t *x)
621 + volatile unsigned int *a;
622 + int ret;
623 +
624 +- mb();
625 + a = __ldcw_align(x);
626 + ret = __ldcw(a) != 0;
627 +- mb();
628 +
629 + return ret;
630 + }
631 +diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
632 +index 4886a6db42e9..5f7e57fcaeef 100644
633 +--- a/arch/parisc/kernel/syscall.S
634 ++++ b/arch/parisc/kernel/syscall.S
635 +@@ -629,12 +629,12 @@ cas_action:
636 + stw %r1, 4(%sr2,%r20)
637 + #endif
638 + /* The load and store could fail */
639 +-1: ldw,ma 0(%r26), %r28
640 ++1: ldw 0(%r26), %r28
641 + sub,<> %r28, %r25, %r0
642 +-2: stw,ma %r24, 0(%r26)
643 ++2: stw %r24, 0(%r26)
644 + /* Free lock */
645 + sync
646 +- stw,ma %r20, 0(%sr2,%r20)
647 ++ stw %r20, 0(%sr2,%r20)
648 + #if ENABLE_LWS_DEBUG
649 + /* Clear thread register indicator */
650 + stw %r0, 4(%sr2,%r20)
651 +@@ -798,30 +798,30 @@ cas2_action:
652 + ldo 1(%r0),%r28
653 +
654 + /* 8bit CAS */
655 +-13: ldb,ma 0(%r26), %r29
656 ++13: ldb 0(%r26), %r29
657 + sub,= %r29, %r25, %r0
658 + b,n cas2_end
659 +-14: stb,ma %r24, 0(%r26)
660 ++14: stb %r24, 0(%r26)
661 + b cas2_end
662 + copy %r0, %r28
663 + nop
664 + nop
665 +
666 + /* 16bit CAS */
667 +-15: ldh,ma 0(%r26), %r29
668 ++15: ldh 0(%r26), %r29
669 + sub,= %r29, %r25, %r0
670 + b,n cas2_end
671 +-16: sth,ma %r24, 0(%r26)
672 ++16: sth %r24, 0(%r26)
673 + b cas2_end
674 + copy %r0, %r28
675 + nop
676 + nop
677 +
678 + /* 32bit CAS */
679 +-17: ldw,ma 0(%r26), %r29
680 ++17: ldw 0(%r26), %r29
681 + sub,= %r29, %r25, %r0
682 + b,n cas2_end
683 +-18: stw,ma %r24, 0(%r26)
684 ++18: stw %r24, 0(%r26)
685 + b cas2_end
686 + copy %r0, %r28
687 + nop
688 +@@ -829,10 +829,10 @@ cas2_action:
689 +
690 + /* 64bit CAS */
691 + #ifdef CONFIG_64BIT
692 +-19: ldd,ma 0(%r26), %r29
693 ++19: ldd 0(%r26), %r29
694 + sub,*= %r29, %r25, %r0
695 + b,n cas2_end
696 +-20: std,ma %r24, 0(%r26)
697 ++20: std %r24, 0(%r26)
698 + copy %r0, %r28
699 + #else
700 + /* Compare first word */
701 +@@ -851,7 +851,7 @@ cas2_action:
702 + cas2_end:
703 + /* Free lock */
704 + sync
705 +- stw,ma %r20, 0(%sr2,%r20)
706 ++ stw %r20, 0(%sr2,%r20)
707 + /* Enable interrupts */
708 + ssm PSW_SM_I, %r0
709 + /* Return to userspace, set no error */
710 +diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
711 +index e7ce2577f0c9..949a871e9506 100644
712 +--- a/arch/s390/net/bpf_jit_comp.c
713 ++++ b/arch/s390/net/bpf_jit_comp.c
714 +@@ -1386,6 +1386,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
715 + goto free_addrs;
716 + }
717 + if (bpf_jit_prog(&jit, fp)) {
718 ++ bpf_jit_binary_free(header);
719 + fp = orig_fp;
720 + goto free_addrs;
721 + }
722 +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
723 +index d58d8dcb8245..76c1d85e749b 100644
724 +--- a/arch/x86/entry/entry_64.S
725 ++++ b/arch/x86/entry/entry_64.S
726 +@@ -774,7 +774,7 @@ ENTRY(\sym)
727 +
728 + call \do_sym
729 +
730 +- jmp error_exit /* %ebx: no swapgs flag */
731 ++ jmp error_exit
732 + .endif
733 + END(\sym)
734 + .endm
735 +@@ -1043,7 +1043,6 @@ END(paranoid_exit)
736 +
737 + /*
738 + * Save all registers in pt_regs, and switch gs if needed.
739 +- * Return: EBX=0: came from user mode; EBX=1: otherwise
740 + */
741 + ENTRY(error_entry)
742 + cld
743 +@@ -1056,7 +1055,6 @@ ENTRY(error_entry)
744 + * the kernel CR3 here.
745 + */
746 + SWITCH_KERNEL_CR3
747 +- xorl %ebx, %ebx
748 + testb $3, CS+8(%rsp)
749 + jz .Lerror_kernelspace
750 +
751 +@@ -1087,7 +1085,6 @@ ENTRY(error_entry)
752 + * for these here too.
753 + */
754 + .Lerror_kernelspace:
755 +- incl %ebx
756 + leaq native_irq_return_iret(%rip), %rcx
757 + cmpq %rcx, RIP+8(%rsp)
758 + je .Lerror_bad_iret
759 +@@ -1119,28 +1116,19 @@ ENTRY(error_entry)
760 +
761 + /*
762 + * Pretend that the exception came from user mode: set up pt_regs
763 +- * as if we faulted immediately after IRET and clear EBX so that
764 +- * error_exit knows that we will be returning to user mode.
765 ++ * as if we faulted immediately after IRET.
766 + */
767 + mov %rsp, %rdi
768 + call fixup_bad_iret
769 + mov %rax, %rsp
770 +- decl %ebx
771 + jmp .Lerror_entry_from_usermode_after_swapgs
772 + END(error_entry)
773 +
774 +-
775 +-/*
776 +- * On entry, EBX is a "return to kernel mode" flag:
777 +- * 1: already in kernel mode, don't need SWAPGS
778 +- * 0: user gsbase is loaded, we need SWAPGS and standard preparation for return to usermode
779 +- */
780 + ENTRY(error_exit)
781 +- movl %ebx, %eax
782 + DISABLE_INTERRUPTS(CLBR_NONE)
783 + TRACE_IRQS_OFF
784 +- testl %eax, %eax
785 +- jnz retint_kernel
786 ++ testb $3, CS(%rsp)
787 ++ jz retint_kernel
788 + jmp retint_user
789 + END(error_exit)
790 +
791 +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
792 +index 3874eec972cd..ef32e5766a01 100644
793 +--- a/drivers/acpi/nfit/core.c
794 ++++ b/drivers/acpi/nfit/core.c
795 +@@ -201,6 +201,8 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
796 + const u8 *uuid;
797 + int rc, i;
798 +
799 ++ if (cmd_rc)
800 ++ *cmd_rc = -EINVAL;
801 + func = cmd;
802 + if (cmd == ND_CMD_CALL) {
803 + call_pkg = buf;
804 +@@ -288,6 +290,8 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
805 + * If we return an error (like elsewhere) then caller wouldn't
806 + * be able to rely upon data returned to make calculation.
807 + */
808 ++ if (cmd_rc)
809 ++ *cmd_rc = 0;
810 + return 0;
811 + }
812 +
813 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
814 +index 0d028ead99e8..d81b984b72e4 100644
815 +--- a/drivers/ata/libahci.c
816 ++++ b/drivers/ata/libahci.c
817 +@@ -35,6 +35,7 @@
818 + #include <linux/kernel.h>
819 + #include <linux/gfp.h>
820 + #include <linux/module.h>
821 ++#include <linux/nospec.h>
822 + #include <linux/blkdev.h>
823 + #include <linux/delay.h>
824 + #include <linux/interrupt.h>
825 +@@ -1124,10 +1125,12 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
826 +
827 + /* get the slot number from the message */
828 + pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
829 +- if (pmp < EM_MAX_SLOTS)
830 ++ if (pmp < EM_MAX_SLOTS) {
831 ++ pmp = array_index_nospec(pmp, EM_MAX_SLOTS);
832 + emp = &pp->em_priv[pmp];
833 +- else
834 ++ } else {
835 + return -EINVAL;
836 ++ }
837 +
838 + /* mask off the activity bits if we are in sw_activity
839 + * mode, user should turn off sw_activity before setting
840 +diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
841 +index aabcb7934b05..cd7f67b2545c 100644
842 +--- a/drivers/dma/k3dma.c
843 ++++ b/drivers/dma/k3dma.c
844 +@@ -792,7 +792,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
845 + struct k3_dma_dev *d = ofdma->of_dma_data;
846 + unsigned int request = dma_spec->args[0];
847 +
848 +- if (request > d->dma_requests)
849 ++ if (request >= d->dma_requests)
850 + return NULL;
851 +
852 + return dma_get_slave_channel(&(d->chans[request].vc.chan));
853 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
854 +index 2c449bdacb91..b9dad4e40bb8 100644
855 +--- a/drivers/dma/pl330.c
856 ++++ b/drivers/dma/pl330.c
857 +@@ -2951,7 +2951,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
858 + pd->src_addr_widths = PL330_DMA_BUSWIDTHS;
859 + pd->dst_addr_widths = PL330_DMA_BUSWIDTHS;
860 + pd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
861 +- pd->residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
862 ++ pd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
863 + pd->max_burst = ((pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ?
864 + 1 : PL330_MAX_BURST);
865 +
866 +diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
867 +index a6132f1d58c1..5eee325feb29 100644
868 +--- a/drivers/gpu/drm/arm/malidp_hw.c
869 ++++ b/drivers/gpu/drm/arm/malidp_hw.c
870 +@@ -432,7 +432,8 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = {
871 + .vsync_irq = MALIDP500_DE_IRQ_VSYNC,
872 + },
873 + .se_irq_map = {
874 +- .irq_mask = MALIDP500_SE_IRQ_CONF_MODE,
875 ++ .irq_mask = MALIDP500_SE_IRQ_CONF_MODE |
876 ++ MALIDP500_SE_IRQ_GLOBAL,
877 + .vsync_irq = 0,
878 + },
879 + .dc_irq_map = {
880 +diff --git a/drivers/gpu/drm/armada/armada_hw.h b/drivers/gpu/drm/armada/armada_hw.h
881 +index 27319a8335e2..345dc4d0851e 100644
882 +--- a/drivers/gpu/drm/armada/armada_hw.h
883 ++++ b/drivers/gpu/drm/armada/armada_hw.h
884 +@@ -160,6 +160,7 @@ enum {
885 + CFG_ALPHAM_GRA = 0x1 << 16,
886 + CFG_ALPHAM_CFG = 0x2 << 16,
887 + CFG_ALPHA_MASK = 0xff << 8,
888 ++#define CFG_ALPHA(x) ((x) << 8)
889 + CFG_PIXCMD_MASK = 0xff,
890 + };
891 +
892 +diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
893 +index 152b4e716269..6a9bba7206df 100644
894 +--- a/drivers/gpu/drm/armada/armada_overlay.c
895 ++++ b/drivers/gpu/drm/armada/armada_overlay.c
896 +@@ -27,6 +27,7 @@ struct armada_ovl_plane_properties {
897 + uint16_t contrast;
898 + uint16_t saturation;
899 + uint32_t colorkey_mode;
900 ++ uint32_t colorkey_enable;
901 + };
902 +
903 + struct armada_ovl_plane {
904 +@@ -62,11 +63,13 @@ armada_ovl_update_attr(struct armada_ovl_plane_properties *prop,
905 + writel_relaxed(0x00002000, dcrtc->base + LCD_SPU_CBSH_HUE);
906 +
907 + spin_lock_irq(&dcrtc->irq_lock);
908 +- armada_updatel(prop->colorkey_mode | CFG_ALPHAM_GRA,
909 +- CFG_CKMODE_MASK | CFG_ALPHAM_MASK | CFG_ALPHA_MASK,
910 +- dcrtc->base + LCD_SPU_DMA_CTRL1);
911 +-
912 +- armada_updatel(ADV_GRACOLORKEY, 0, dcrtc->base + LCD_SPU_ADV_REG);
913 ++ armada_updatel(prop->colorkey_mode,
914 ++ CFG_CKMODE_MASK | CFG_ALPHAM_MASK | CFG_ALPHA_MASK,
915 ++ dcrtc->base + LCD_SPU_DMA_CTRL1);
916 ++ if (dcrtc->variant->has_spu_adv_reg)
917 ++ armada_updatel(prop->colorkey_enable,
918 ++ ADV_GRACOLORKEY | ADV_VIDCOLORKEY,
919 ++ dcrtc->base + LCD_SPU_ADV_REG);
920 + spin_unlock_irq(&dcrtc->irq_lock);
921 + }
922 +
923 +@@ -340,8 +343,17 @@ static int armada_ovl_plane_set_property(struct drm_plane *plane,
924 + dplane->prop.colorkey_vb |= K2B(val);
925 + update_attr = true;
926 + } else if (property == priv->colorkey_mode_prop) {
927 +- dplane->prop.colorkey_mode &= ~CFG_CKMODE_MASK;
928 +- dplane->prop.colorkey_mode |= CFG_CKMODE(val);
929 ++ if (val == CKMODE_DISABLE) {
930 ++ dplane->prop.colorkey_mode =
931 ++ CFG_CKMODE(CKMODE_DISABLE) |
932 ++ CFG_ALPHAM_CFG | CFG_ALPHA(255);
933 ++ dplane->prop.colorkey_enable = 0;
934 ++ } else {
935 ++ dplane->prop.colorkey_mode =
936 ++ CFG_CKMODE(val) |
937 ++ CFG_ALPHAM_GRA | CFG_ALPHA(0);
938 ++ dplane->prop.colorkey_enable = ADV_GRACOLORKEY;
939 ++ }
940 + update_attr = true;
941 + } else if (property == priv->brightness_prop) {
942 + dplane->prop.brightness = val - 256;
943 +@@ -470,7 +482,9 @@ int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs)
944 + dplane->prop.colorkey_yr = 0xfefefe00;
945 + dplane->prop.colorkey_ug = 0x01010100;
946 + dplane->prop.colorkey_vb = 0x01010100;
947 +- dplane->prop.colorkey_mode = CFG_CKMODE(CKMODE_RGB);
948 ++ dplane->prop.colorkey_mode = CFG_CKMODE(CKMODE_RGB) |
949 ++ CFG_ALPHAM_GRA | CFG_ALPHA(0);
950 ++ dplane->prop.colorkey_enable = ADV_GRACOLORKEY;
951 + dplane->prop.brightness = 0;
952 + dplane->prop.contrast = 0x4000;
953 + dplane->prop.saturation = 0x4000;
954 +diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
955 +index 6dd09c306bc1..bdcc6ec3c67b 100644
956 +--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
957 ++++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
958 +@@ -199,7 +199,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
959 + unsigned long val;
960 +
961 + val = readl(ctx->addr + DECON_WINCONx(win));
962 +- val &= ~WINCONx_BPPMODE_MASK;
963 ++ val &= WINCONx_ENWIN_F;
964 +
965 + switch (fb->pixel_format) {
966 + case DRM_FORMAT_XRGB1555:
967 +@@ -291,8 +291,8 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
968 + COORDINATE_Y(state->crtc.y + state->crtc.h - 1);
969 + writel(val, ctx->addr + DECON_VIDOSDxB(win));
970 +
971 +- val = VIDOSD_Wx_ALPHA_R_F(0x0) | VIDOSD_Wx_ALPHA_G_F(0x0) |
972 +- VIDOSD_Wx_ALPHA_B_F(0x0);
973 ++ val = VIDOSD_Wx_ALPHA_R_F(0xff) | VIDOSD_Wx_ALPHA_G_F(0xff) |
974 ++ VIDOSD_Wx_ALPHA_B_F(0xff);
975 + writel(val, ctx->addr + DECON_VIDOSDxC(win));
976 +
977 + val = VIDOSD_Wx_ALPHA_R_F(0x0) | VIDOSD_Wx_ALPHA_G_F(0x0) |
978 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
979 +index 52a9d269484e..4c81c79b15ea 100644
980 +--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
981 ++++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
982 +@@ -532,21 +532,25 @@ static int gsc_src_set_fmt(struct device *dev, u32 fmt)
983 + GSC_IN_CHROMA_ORDER_CRCB);
984 + break;
985 + case DRM_FORMAT_NV21:
986 ++ cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV420_2P);
987 ++ break;
988 + case DRM_FORMAT_NV61:
989 +- cfg |= (GSC_IN_CHROMA_ORDER_CRCB |
990 +- GSC_IN_YUV420_2P);
991 ++ cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV422_2P);
992 + break;
993 + case DRM_FORMAT_YUV422:
994 + cfg |= GSC_IN_YUV422_3P;
995 + break;
996 + case DRM_FORMAT_YUV420:
997 ++ cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV420_3P);
998 ++ break;
999 + case DRM_FORMAT_YVU420:
1000 +- cfg |= GSC_IN_YUV420_3P;
1001 ++ cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV420_3P);
1002 + break;
1003 + case DRM_FORMAT_NV12:
1004 ++ cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV420_2P);
1005 ++ break;
1006 + case DRM_FORMAT_NV16:
1007 +- cfg |= (GSC_IN_CHROMA_ORDER_CBCR |
1008 +- GSC_IN_YUV420_2P);
1009 ++ cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV422_2P);
1010 + break;
1011 + default:
1012 + dev_err(ippdrv->dev, "invalid target yuv order 0x%x.\n", fmt);
1013 +@@ -806,18 +810,25 @@ static int gsc_dst_set_fmt(struct device *dev, u32 fmt)
1014 + GSC_OUT_CHROMA_ORDER_CRCB);
1015 + break;
1016 + case DRM_FORMAT_NV21:
1017 +- case DRM_FORMAT_NV61:
1018 + cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV420_2P);
1019 + break;
1020 ++ case DRM_FORMAT_NV61:
1021 ++ cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV422_2P);
1022 ++ break;
1023 + case DRM_FORMAT_YUV422:
1024 ++ cfg |= GSC_OUT_YUV422_3P;
1025 ++ break;
1026 + case DRM_FORMAT_YUV420:
1027 ++ cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV420_3P);
1028 ++ break;
1029 + case DRM_FORMAT_YVU420:
1030 +- cfg |= GSC_OUT_YUV420_3P;
1031 ++ cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV420_3P);
1032 + break;
1033 + case DRM_FORMAT_NV12:
1034 ++ cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV420_2P);
1035 ++ break;
1036 + case DRM_FORMAT_NV16:
1037 +- cfg |= (GSC_OUT_CHROMA_ORDER_CBCR |
1038 +- GSC_OUT_YUV420_2P);
1039 ++ cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV422_2P);
1040 + break;
1041 + default:
1042 + dev_err(ippdrv->dev, "invalid target yuv order 0x%x.\n", fmt);
1043 +diff --git a/drivers/gpu/drm/exynos/regs-gsc.h b/drivers/gpu/drm/exynos/regs-gsc.h
1044 +index 4704a993cbb7..16b39734115c 100644
1045 +--- a/drivers/gpu/drm/exynos/regs-gsc.h
1046 ++++ b/drivers/gpu/drm/exynos/regs-gsc.h
1047 +@@ -138,6 +138,7 @@
1048 + #define GSC_OUT_YUV420_3P (3 << 4)
1049 + #define GSC_OUT_YUV422_1P (4 << 4)
1050 + #define GSC_OUT_YUV422_2P (5 << 4)
1051 ++#define GSC_OUT_YUV422_3P (6 << 4)
1052 + #define GSC_OUT_YUV444 (7 << 4)
1053 + #define GSC_OUT_TILE_TYPE_MASK (1 << 2)
1054 + #define GSC_OUT_TILE_C_16x8 (0 << 2)
1055 +diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
1056 +index 909f69a302ee..505dca48b9f8 100644
1057 +--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
1058 ++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
1059 +@@ -601,7 +601,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
1060 + struct nouveau_bo *nvbo;
1061 + uint32_t data;
1062 +
1063 +- if (unlikely(r->bo_index > req->nr_buffers)) {
1064 ++ if (unlikely(r->bo_index >= req->nr_buffers)) {
1065 + NV_PRINTK(err, cli, "reloc bo index invalid\n");
1066 + ret = -EINVAL;
1067 + break;
1068 +@@ -611,7 +611,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
1069 + if (b->presumed.valid)
1070 + continue;
1071 +
1072 +- if (unlikely(r->reloc_bo_index > req->nr_buffers)) {
1073 ++ if (unlikely(r->reloc_bo_index >= req->nr_buffers)) {
1074 + NV_PRINTK(err, cli, "reloc container bo index invalid\n");
1075 + ret = -EINVAL;
1076 + break;
1077 +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
1078 +index db951c4fd6dd..b1ad378cb2a6 100644
1079 +--- a/drivers/hid/wacom_wac.c
1080 ++++ b/drivers/hid/wacom_wac.c
1081 +@@ -2429,8 +2429,14 @@ void wacom_setup_device_quirks(struct wacom *wacom)
1082 + if (features->type >= INTUOSHT && features->type <= BAMBOO_PT)
1083 + features->device_type |= WACOM_DEVICETYPE_PAD;
1084 +
1085 +- features->x_max = 4096;
1086 +- features->y_max = 4096;
1087 ++ if (features->type == INTUOSHT2) {
1088 ++ features->x_max = features->x_max / 10;
1089 ++ features->y_max = features->y_max / 10;
1090 ++ }
1091 ++ else {
1092 ++ features->x_max = 4096;
1093 ++ features->y_max = 4096;
1094 ++ }
1095 + }
1096 + else if (features->pktlen == WACOM_PKGLEN_BBTOUCH) {
1097 + features->device_type |= WACOM_DEVICETYPE_PAD;
1098 +diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
1099 +index 4d297d554e52..c4188308cefa 100644
1100 +--- a/drivers/i2c/busses/i2c-imx.c
1101 ++++ b/drivers/i2c/busses/i2c-imx.c
1102 +@@ -665,9 +665,6 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
1103 + struct imx_i2c_dma *dma = i2c_imx->dma;
1104 + struct device *dev = &i2c_imx->adapter.dev;
1105 +
1106 +- temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
1107 +- temp |= I2CR_DMAEN;
1108 +- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
1109 +
1110 + dma->chan_using = dma->chan_rx;
1111 + dma->dma_transfer_dir = DMA_DEV_TO_MEM;
1112 +@@ -780,6 +777,7 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo
1113 + int i, result;
1114 + unsigned int temp;
1115 + int block_data = msgs->flags & I2C_M_RECV_LEN;
1116 ++ int use_dma = i2c_imx->dma && msgs->len >= DMA_THRESHOLD && !block_data;
1117 +
1118 + dev_dbg(&i2c_imx->adapter.dev,
1119 + "<%s> write slave address: addr=0x%x\n",
1120 +@@ -806,12 +804,14 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo
1121 + */
1122 + if ((msgs->len - 1) || block_data)
1123 + temp &= ~I2CR_TXAK;
1124 ++ if (use_dma)
1125 ++ temp |= I2CR_DMAEN;
1126 + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
1127 + imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR); /* dummy read */
1128 +
1129 + dev_dbg(&i2c_imx->adapter.dev, "<%s> read data\n", __func__);
1130 +
1131 +- if (i2c_imx->dma && msgs->len >= DMA_THRESHOLD && !block_data)
1132 ++ if (use_dma)
1133 + return i2c_imx_dma_read(i2c_imx, msgs, is_lastmsg);
1134 +
1135 + /* read data */
1136 +diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
1137 +index 19aa957bd454..c9263acc190b 100644
1138 +--- a/drivers/iio/pressure/bmp280-core.c
1139 ++++ b/drivers/iio/pressure/bmp280-core.c
1140 +@@ -347,10 +347,9 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2)
1141 + adc_humidity = be16_to_cpu(tmp);
1142 + comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
1143 +
1144 +- *val = comp_humidity;
1145 +- *val2 = 1024;
1146 ++ *val = comp_humidity * 1000 / 1024;
1147 +
1148 +- return IIO_VAL_FRACTIONAL;
1149 ++ return IIO_VAL_INT;
1150 + }
1151 +
1152 + static int bmp280_read_raw(struct iio_dev *indio_dev,
1153 +diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
1154 +index 5c1dbe2f8757..d6e5002edb92 100644
1155 +--- a/drivers/infiniband/hw/mlx5/srq.c
1156 ++++ b/drivers/infiniband/hw/mlx5/srq.c
1157 +@@ -268,18 +268,24 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
1158 +
1159 + desc_size = sizeof(struct mlx5_wqe_srq_next_seg) +
1160 + srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg);
1161 +- if (desc_size == 0 || srq->msrq.max_gs > desc_size)
1162 +- return ERR_PTR(-EINVAL);
1163 ++ if (desc_size == 0 || srq->msrq.max_gs > desc_size) {
1164 ++ err = -EINVAL;
1165 ++ goto err_srq;
1166 ++ }
1167 + desc_size = roundup_pow_of_two(desc_size);
1168 + desc_size = max_t(size_t, 32, desc_size);
1169 +- if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg))
1170 +- return ERR_PTR(-EINVAL);
1171 ++ if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg)) {
1172 ++ err = -EINVAL;
1173 ++ goto err_srq;
1174 ++ }
1175 + srq->msrq.max_avail_gather = (desc_size - sizeof(struct mlx5_wqe_srq_next_seg)) /
1176 + sizeof(struct mlx5_wqe_data_seg);
1177 + srq->msrq.wqe_shift = ilog2(desc_size);
1178 + buf_size = srq->msrq.max * desc_size;
1179 +- if (buf_size < desc_size)
1180 +- return ERR_PTR(-EINVAL);
1181 ++ if (buf_size < desc_size) {
1182 ++ err = -EINVAL;
1183 ++ goto err_srq;
1184 ++ }
1185 + in.type = init_attr->srq_type;
1186 +
1187 + if (pd->uobject)
1188 +diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
1189 +index 5b0ca35c06ab..47219ebd8ff2 100644
1190 +--- a/drivers/infiniband/sw/rxe/rxe_req.c
1191 ++++ b/drivers/infiniband/sw/rxe/rxe_req.c
1192 +@@ -648,6 +648,9 @@ next_wqe:
1193 + } else {
1194 + goto exit;
1195 + }
1196 ++ if ((wqe->wr.send_flags & IB_SEND_SIGNALED) ||
1197 ++ qp->sq_sig_type == IB_SIGNAL_ALL_WR)
1198 ++ rxe_run_task(&qp->comp.task, 1);
1199 + qp->req.wqe_index = next_index(qp->sq.queue,
1200 + qp->req.wqe_index);
1201 + goto next_wqe;
1202 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1203 +index b138b5cba286..6da66c3acd46 100644
1204 +--- a/drivers/md/raid10.c
1205 ++++ b/drivers/md/raid10.c
1206 +@@ -3734,6 +3734,13 @@ static int raid10_run(struct mddev *mddev)
1207 + disk->rdev->saved_raid_disk < 0)
1208 + conf->fullsync = 1;
1209 + }
1210 ++
1211 ++ if (disk->replacement &&
1212 ++ !test_bit(In_sync, &disk->replacement->flags) &&
1213 ++ disk->replacement->saved_raid_disk < 0) {
1214 ++ conf->fullsync = 1;
1215 ++ }
1216 ++
1217 + disk->recovery_disabled = mddev->recovery_disabled - 1;
1218 + }
1219 +
1220 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
1221 +index 7dd7490fdac1..f3f2d66432ab 100644
1222 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
1223 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
1224 +@@ -1529,6 +1529,7 @@ struct bnx2x {
1225 + struct link_vars link_vars;
1226 + u32 link_cnt;
1227 + struct bnx2x_link_report_data last_reported_link;
1228 ++ bool force_link_down;
1229 +
1230 + struct mdio_if_info mdio;
1231 +
1232 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1233 +index 31287cec6e3a..2cd1dcd77559 100644
1234 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1235 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1236 +@@ -1265,6 +1265,11 @@ void __bnx2x_link_report(struct bnx2x *bp)
1237 + {
1238 + struct bnx2x_link_report_data cur_data;
1239 +
1240 ++ if (bp->force_link_down) {
1241 ++ bp->link_vars.link_up = 0;
1242 ++ return;
1243 ++ }
1244 ++
1245 + /* reread mf_cfg */
1246 + if (IS_PF(bp) && !CHIP_IS_E1(bp))
1247 + bnx2x_read_mf_cfg(bp);
1248 +@@ -2822,6 +2827,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1249 + bp->pending_max = 0;
1250 + }
1251 +
1252 ++ bp->force_link_down = false;
1253 + if (bp->port.pmf) {
1254 + rc = bnx2x_initial_phy_init(bp, load_mode);
1255 + if (rc)
1256 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
1257 +index 554c4086b3c6..54dab4eac804 100644
1258 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
1259 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
1260 +@@ -10279,6 +10279,12 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work)
1261 + bp->sp_rtnl_state = 0;
1262 + smp_mb();
1263 +
1264 ++ /* Immediately indicate link as down */
1265 ++ bp->link_vars.link_up = 0;
1266 ++ bp->force_link_down = true;
1267 ++ netif_carrier_off(bp->dev);
1268 ++ BNX2X_ERR("Indicating link is down due to Tx-timeout\n");
1269 ++
1270 + bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
1271 + bnx2x_nic_load(bp, LOAD_NORMAL);
1272 +
1273 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1274 +index 8777c3a4c095..72297b76944f 100644
1275 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1276 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1277 +@@ -5560,7 +5560,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1278 + rc = bnxt_request_irq(bp);
1279 + if (rc) {
1280 + netdev_err(bp->dev, "bnxt_request_irq err: %x\n", rc);
1281 +- goto open_err;
1282 ++ goto open_err_irq;
1283 + }
1284 + }
1285 +
1286 +@@ -5593,6 +5593,8 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1287 +
1288 + open_err:
1289 + bnxt_disable_napi(bp);
1290 ++
1291 ++open_err_irq:
1292 + bnxt_del_napi(bp);
1293 +
1294 + open_err_free_mem:
1295 +@@ -6862,11 +6864,11 @@ int bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, bool shared)
1296 + int rx, tx, cp;
1297 +
1298 + _bnxt_get_max_rings(bp, &rx, &tx, &cp);
1299 ++ *max_rx = rx;
1300 ++ *max_tx = tx;
1301 + if (!rx || !tx || !cp)
1302 + return -ENOMEM;
1303 +
1304 +- *max_rx = rx;
1305 +- *max_tx = tx;
1306 + return bnxt_trim_rings(bp, max_rx, max_tx, cp, shared);
1307 + }
1308 +
1309 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1310 +index c395b21cb57b..c71a52a2f801 100644
1311 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1312 ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1313 +@@ -274,7 +274,7 @@ static void dcb_tx_queue_prio_enable(struct net_device *dev, int enable)
1314 + "Can't %s DCB Priority on port %d, TX Queue %d: err=%d\n",
1315 + enable ? "set" : "unset", pi->port_id, i, -err);
1316 + else
1317 +- txq->dcb_prio = value;
1318 ++ txq->dcb_prio = enable ? value : 0;
1319 + }
1320 + }
1321 +
1322 +diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c
1323 +index 3c677ed3c29e..4d9014d5b36d 100644
1324 +--- a/drivers/net/ethernet/cisco/enic/enic_clsf.c
1325 ++++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c
1326 +@@ -78,7 +78,6 @@ void enic_rfs_flw_tbl_init(struct enic *enic)
1327 + enic->rfs_h.max = enic->config.num_arfs;
1328 + enic->rfs_h.free = enic->rfs_h.max;
1329 + enic->rfs_h.toclean = 0;
1330 +- enic_rfs_timer_start(enic);
1331 + }
1332 +
1333 + void enic_rfs_flw_tbl_free(struct enic *enic)
1334 +@@ -87,7 +86,6 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
1335 +
1336 + enic_rfs_timer_stop(enic);
1337 + spin_lock_bh(&enic->rfs_h.lock);
1338 +- enic->rfs_h.free = 0;
1339 + for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) {
1340 + struct hlist_head *hhead;
1341 + struct hlist_node *tmp;
1342 +@@ -98,6 +96,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
1343 + enic_delfltr(enic, n->fltr_id);
1344 + hlist_del(&n->node);
1345 + kfree(n);
1346 ++ enic->rfs_h.free++;
1347 + }
1348 + }
1349 + spin_unlock_bh(&enic->rfs_h.lock);
1350 +diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
1351 +index 99f593be26e2..2e9bab45d419 100644
1352 +--- a/drivers/net/ethernet/cisco/enic/enic_main.c
1353 ++++ b/drivers/net/ethernet/cisco/enic/enic_main.c
1354 +@@ -1760,7 +1760,7 @@ static int enic_open(struct net_device *netdev)
1355 + vnic_intr_unmask(&enic->intr[i]);
1356 +
1357 + enic_notify_timer_start(enic);
1358 +- enic_rfs_flw_tbl_init(enic);
1359 ++ enic_rfs_timer_start(enic);
1360 +
1361 + return 0;
1362 +
1363 +@@ -2692,6 +2692,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1364 + enic->notify_timer.function = enic_notify_timer;
1365 + enic->notify_timer.data = (unsigned long)enic;
1366 +
1367 ++ enic_rfs_flw_tbl_init(enic);
1368 + enic_set_rx_coal_setting(enic);
1369 + INIT_WORK(&enic->reset, enic_reset);
1370 + INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset);
1371 +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
1372 +index ad3362293cbd..0d2baec546e1 100644
1373 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
1374 ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
1375 +@@ -1847,7 +1847,12 @@ s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
1376 + if (enable_addr != 0)
1377 + rar_high |= IXGBE_RAH_AV;
1378 +
1379 ++ /* Record lower 32 bits of MAC address and then make
1380 ++ * sure that write is flushed to hardware before writing
1381 ++ * the upper 16 bits and setting the valid bit.
1382 ++ */
1383 + IXGBE_WRITE_REG(hw, IXGBE_RAL(index), rar_low);
1384 ++ IXGBE_WRITE_FLUSH(hw);
1385 + IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
1386 +
1387 + return 0;
1388 +@@ -1879,8 +1884,13 @@ s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index)
1389 + rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index));
1390 + rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV);
1391 +
1392 +- IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0);
1393 ++ /* Clear the address valid bit and upper 16 bits of the address
1394 ++ * before clearing the lower bits. This way we aren't updating
1395 ++ * a live filter.
1396 ++ */
1397 + IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
1398 ++ IXGBE_WRITE_FLUSH(hw);
1399 ++ IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0);
1400 +
1401 + /* clear VMDq pool/queue selection for this RAR */
1402 + hw->mac.ops.clear_vmdq(hw, index, IXGBE_CLEAR_VMDQ_ALL);
1403 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
1404 +index f36bd0bd37da..1ed13a165e58 100644
1405 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
1406 ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
1407 +@@ -502,8 +502,16 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance)
1408 + /* Fastpath interrupts */
1409 + for (j = 0; j < 64; j++) {
1410 + if ((0x2ULL << j) & status) {
1411 +- hwfn->simd_proto_handler[j].func(
1412 +- hwfn->simd_proto_handler[j].token);
1413 ++ struct qed_simd_fp_handler *p_handler =
1414 ++ &hwfn->simd_proto_handler[j];
1415 ++
1416 ++ if (p_handler->func)
1417 ++ p_handler->func(p_handler->token);
1418 ++ else
1419 ++ DP_NOTICE(hwfn,
1420 ++ "Not calling fastpath handler as it is NULL [handler #%d, status 0x%llx]\n",
1421 ++ j, status);
1422 ++
1423 + status &= ~(0x2ULL << j);
1424 + rc = IRQ_HANDLED;
1425 + }
1426 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
1427 +index ccbb04503b27..b53a18e365c2 100644
1428 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
1429 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
1430 +@@ -1128,6 +1128,8 @@ static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
1431 + struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
1432 +
1433 + ret = kstrtoul(buf, 16, &data);
1434 ++ if (ret)
1435 ++ return ret;
1436 +
1437 + switch (data) {
1438 + case QLC_83XX_FLASH_SECTOR_ERASE_CMD:
1439 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
1440 +index 8bbb55f31909..21f546587e3d 100644
1441 +--- a/drivers/net/ethernet/qualcomm/qca_spi.c
1442 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.c
1443 +@@ -635,7 +635,7 @@ qcaspi_netdev_open(struct net_device *dev)
1444 + return ret;
1445 + }
1446 +
1447 +- netif_start_queue(qca->net_dev);
1448 ++ /* SPI thread takes care of TX queue */
1449 +
1450 + return 0;
1451 + }
1452 +@@ -739,6 +739,9 @@ qcaspi_netdev_tx_timeout(struct net_device *dev)
1453 + qca->net_dev->stats.tx_errors++;
1454 + /* Trigger tx queue flush and QCA7000 reset */
1455 + qca->sync = QCASPI_SYNC_UNKNOWN;
1456 ++
1457 ++ if (qca->spi_thread)
1458 ++ wake_up_process(qca->spi_thread);
1459 + }
1460 +
1461 + static int
1462 +@@ -865,22 +868,22 @@ qca_spi_probe(struct spi_device *spi)
1463 +
1464 + if ((qcaspi_clkspeed < QCASPI_CLK_SPEED_MIN) ||
1465 + (qcaspi_clkspeed > QCASPI_CLK_SPEED_MAX)) {
1466 +- dev_info(&spi->dev, "Invalid clkspeed: %d\n",
1467 +- qcaspi_clkspeed);
1468 ++ dev_err(&spi->dev, "Invalid clkspeed: %d\n",
1469 ++ qcaspi_clkspeed);
1470 + return -EINVAL;
1471 + }
1472 +
1473 + if ((qcaspi_burst_len < QCASPI_BURST_LEN_MIN) ||
1474 + (qcaspi_burst_len > QCASPI_BURST_LEN_MAX)) {
1475 +- dev_info(&spi->dev, "Invalid burst len: %d\n",
1476 +- qcaspi_burst_len);
1477 ++ dev_err(&spi->dev, "Invalid burst len: %d\n",
1478 ++ qcaspi_burst_len);
1479 + return -EINVAL;
1480 + }
1481 +
1482 + if ((qcaspi_pluggable < QCASPI_PLUGGABLE_MIN) ||
1483 + (qcaspi_pluggable > QCASPI_PLUGGABLE_MAX)) {
1484 +- dev_info(&spi->dev, "Invalid pluggable: %d\n",
1485 +- qcaspi_pluggable);
1486 ++ dev_err(&spi->dev, "Invalid pluggable: %d\n",
1487 ++ qcaspi_pluggable);
1488 + return -EINVAL;
1489 + }
1490 +
1491 +@@ -941,8 +944,8 @@ qca_spi_probe(struct spi_device *spi)
1492 + }
1493 +
1494 + if (register_netdev(qcaspi_devs)) {
1495 +- dev_info(&spi->dev, "Unable to register net device %s\n",
1496 +- qcaspi_devs->name);
1497 ++ dev_err(&spi->dev, "Unable to register net device %s\n",
1498 ++ qcaspi_devs->name);
1499 + free_netdev(qcaspi_devs);
1500 + return -EFAULT;
1501 + }
1502 +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
1503 +index 10d3a9f6349e..307ecd500dac 100644
1504 +--- a/drivers/net/ethernet/renesas/ravb_main.c
1505 ++++ b/drivers/net/ethernet/renesas/ravb_main.c
1506 +@@ -955,6 +955,13 @@ static void ravb_adjust_link(struct net_device *ndev)
1507 + struct ravb_private *priv = netdev_priv(ndev);
1508 + struct phy_device *phydev = ndev->phydev;
1509 + bool new_state = false;
1510 ++ unsigned long flags;
1511 ++
1512 ++ spin_lock_irqsave(&priv->lock, flags);
1513 ++
1514 ++ /* Disable TX and RX right over here, if E-MAC change is ignored */
1515 ++ if (priv->no_avb_link)
1516 ++ ravb_rcv_snd_disable(ndev);
1517 +
1518 + if (phydev->link) {
1519 + if (phydev->duplex != priv->duplex) {
1520 +@@ -972,18 +979,21 @@ static void ravb_adjust_link(struct net_device *ndev)
1521 + ravb_modify(ndev, ECMR, ECMR_TXF, 0);
1522 + new_state = true;
1523 + priv->link = phydev->link;
1524 +- if (priv->no_avb_link)
1525 +- ravb_rcv_snd_enable(ndev);
1526 + }
1527 + } else if (priv->link) {
1528 + new_state = true;
1529 + priv->link = 0;
1530 + priv->speed = 0;
1531 + priv->duplex = -1;
1532 +- if (priv->no_avb_link)
1533 +- ravb_rcv_snd_disable(ndev);
1534 + }
1535 +
1536 ++ /* Enable TX and RX right over here, if E-MAC change is ignored */
1537 ++ if (priv->no_avb_link && phydev->link)
1538 ++ ravb_rcv_snd_enable(ndev);
1539 ++
1540 ++ mmiowb();
1541 ++ spin_unlock_irqrestore(&priv->lock, flags);
1542 ++
1543 + if (new_state && netif_msg_link(priv))
1544 + phy_print_status(phydev);
1545 + }
1546 +@@ -1085,52 +1095,18 @@ static int ravb_get_link_ksettings(struct net_device *ndev,
1547 + static int ravb_set_link_ksettings(struct net_device *ndev,
1548 + const struct ethtool_link_ksettings *cmd)
1549 + {
1550 +- struct ravb_private *priv = netdev_priv(ndev);
1551 +- unsigned long flags;
1552 +- int error;
1553 +-
1554 + if (!ndev->phydev)
1555 + return -ENODEV;
1556 +
1557 +- spin_lock_irqsave(&priv->lock, flags);
1558 +-
1559 +- /* Disable TX and RX */
1560 +- ravb_rcv_snd_disable(ndev);
1561 +-
1562 +- error = phy_ethtool_ksettings_set(ndev->phydev, cmd);
1563 +- if (error)
1564 +- goto error_exit;
1565 +-
1566 +- if (cmd->base.duplex == DUPLEX_FULL)
1567 +- priv->duplex = 1;
1568 +- else
1569 +- priv->duplex = 0;
1570 +-
1571 +- ravb_set_duplex(ndev);
1572 +-
1573 +-error_exit:
1574 +- mdelay(1);
1575 +-
1576 +- /* Enable TX and RX */
1577 +- ravb_rcv_snd_enable(ndev);
1578 +-
1579 +- mmiowb();
1580 +- spin_unlock_irqrestore(&priv->lock, flags);
1581 +-
1582 +- return error;
1583 ++ return phy_ethtool_ksettings_set(ndev->phydev, cmd);
1584 + }
1585 +
1586 + static int ravb_nway_reset(struct net_device *ndev)
1587 + {
1588 +- struct ravb_private *priv = netdev_priv(ndev);
1589 + int error = -ENODEV;
1590 +- unsigned long flags;
1591 +
1592 +- if (ndev->phydev) {
1593 +- spin_lock_irqsave(&priv->lock, flags);
1594 ++ if (ndev->phydev)
1595 + error = phy_start_aneg(ndev->phydev);
1596 +- spin_unlock_irqrestore(&priv->lock, flags);
1597 +- }
1598 +
1599 + return error;
1600 + }
1601 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
1602 +index c8fd99b3ca29..c59e8fe37069 100644
1603 +--- a/drivers/net/ethernet/renesas/sh_eth.c
1604 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
1605 +@@ -1743,8 +1743,15 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1606 + {
1607 + struct sh_eth_private *mdp = netdev_priv(ndev);
1608 + struct phy_device *phydev = ndev->phydev;
1609 ++ unsigned long flags;
1610 + int new_state = 0;
1611 +
1612 ++ spin_lock_irqsave(&mdp->lock, flags);
1613 ++
1614 ++ /* Disable TX and RX right over here, if E-MAC change is ignored */
1615 ++ if (mdp->cd->no_psr || mdp->no_ether_link)
1616 ++ sh_eth_rcv_snd_disable(ndev);
1617 ++
1618 + if (phydev->link) {
1619 + if (phydev->duplex != mdp->duplex) {
1620 + new_state = 1;
1621 +@@ -1763,18 +1770,21 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1622 + sh_eth_modify(ndev, ECMR, ECMR_TXF, 0);
1623 + new_state = 1;
1624 + mdp->link = phydev->link;
1625 +- if (mdp->cd->no_psr || mdp->no_ether_link)
1626 +- sh_eth_rcv_snd_enable(ndev);
1627 + }
1628 + } else if (mdp->link) {
1629 + new_state = 1;
1630 + mdp->link = 0;
1631 + mdp->speed = 0;
1632 + mdp->duplex = -1;
1633 +- if (mdp->cd->no_psr || mdp->no_ether_link)
1634 +- sh_eth_rcv_snd_disable(ndev);
1635 + }
1636 +
1637 ++ /* Enable TX and RX right over here, if E-MAC change is ignored */
1638 ++ if ((mdp->cd->no_psr || mdp->no_ether_link) && phydev->link)
1639 ++ sh_eth_rcv_snd_enable(ndev);
1640 ++
1641 ++ mmiowb();
1642 ++ spin_unlock_irqrestore(&mdp->lock, flags);
1643 ++
1644 + if (new_state && netif_msg_link(mdp))
1645 + phy_print_status(phydev);
1646 + }
1647 +@@ -1856,39 +1866,10 @@ static int sh_eth_get_link_ksettings(struct net_device *ndev,
1648 + static int sh_eth_set_link_ksettings(struct net_device *ndev,
1649 + const struct ethtool_link_ksettings *cmd)
1650 + {
1651 +- struct sh_eth_private *mdp = netdev_priv(ndev);
1652 +- unsigned long flags;
1653 +- int ret;
1654 +-
1655 + if (!ndev->phydev)
1656 + return -ENODEV;
1657 +
1658 +- spin_lock_irqsave(&mdp->lock, flags);
1659 +-
1660 +- /* disable tx and rx */
1661 +- sh_eth_rcv_snd_disable(ndev);
1662 +-
1663 +- ret = phy_ethtool_ksettings_set(ndev->phydev, cmd);
1664 +- if (ret)
1665 +- goto error_exit;
1666 +-
1667 +- if (cmd->base.duplex == DUPLEX_FULL)
1668 +- mdp->duplex = 1;
1669 +- else
1670 +- mdp->duplex = 0;
1671 +-
1672 +- if (mdp->cd->set_duplex)
1673 +- mdp->cd->set_duplex(ndev);
1674 +-
1675 +-error_exit:
1676 +- mdelay(1);
1677 +-
1678 +- /* enable tx and rx */
1679 +- sh_eth_rcv_snd_enable(ndev);
1680 +-
1681 +- spin_unlock_irqrestore(&mdp->lock, flags);
1682 +-
1683 +- return ret;
1684 ++ return phy_ethtool_ksettings_set(ndev->phydev, cmd);
1685 + }
1686 +
1687 + /* If it is ever necessary to increase SH_ETH_REG_DUMP_MAX_REGS, the
1688 +@@ -2079,18 +2060,10 @@ static void sh_eth_get_regs(struct net_device *ndev, struct ethtool_regs *regs,
1689 +
1690 + static int sh_eth_nway_reset(struct net_device *ndev)
1691 + {
1692 +- struct sh_eth_private *mdp = netdev_priv(ndev);
1693 +- unsigned long flags;
1694 +- int ret;
1695 +-
1696 + if (!ndev->phydev)
1697 + return -ENODEV;
1698 +
1699 +- spin_lock_irqsave(&mdp->lock, flags);
1700 +- ret = phy_start_aneg(ndev->phydev);
1701 +- spin_unlock_irqrestore(&mdp->lock, flags);
1702 +-
1703 +- return ret;
1704 ++ return phy_start_aneg(ndev->phydev);
1705 + }
1706 +
1707 + static u32 sh_eth_get_msglevel(struct net_device *ndev)
1708 +diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
1709 +index 4b78168a5f3c..0d03682faffb 100644
1710 +--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
1711 ++++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
1712 +@@ -83,7 +83,7 @@ config DWMAC_ROCKCHIP
1713 + config DWMAC_SOCFPGA
1714 + tristate "SOCFPGA dwmac support"
1715 + default ARCH_SOCFPGA
1716 +- depends on OF && (ARCH_SOCFPGA || COMPILE_TEST)
1717 ++ depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST)
1718 + select MFD_SYSCON
1719 + help
1720 + Support for ethernet controller on Altera SOCFPGA
1721 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
1722 +index 0c420e97de1e..c3a78c113424 100644
1723 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
1724 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
1725 +@@ -55,6 +55,7 @@ struct socfpga_dwmac {
1726 + struct device *dev;
1727 + struct regmap *sys_mgr_base_addr;
1728 + struct reset_control *stmmac_rst;
1729 ++ struct reset_control *stmmac_ocp_rst;
1730 + void __iomem *splitter_base;
1731 + bool f2h_ptp_ref_clk;
1732 + struct tse_pcs pcs;
1733 +@@ -262,8 +263,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
1734 + val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
1735 +
1736 + /* Assert reset to the enet controller before changing the phy mode */
1737 +- if (dwmac->stmmac_rst)
1738 +- reset_control_assert(dwmac->stmmac_rst);
1739 ++ reset_control_assert(dwmac->stmmac_ocp_rst);
1740 ++ reset_control_assert(dwmac->stmmac_rst);
1741 +
1742 + regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
1743 + ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
1744 +@@ -285,8 +286,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
1745 + /* Deassert reset for the phy configuration to be sampled by
1746 + * the enet controller, and operation to start in requested mode
1747 + */
1748 +- if (dwmac->stmmac_rst)
1749 +- reset_control_deassert(dwmac->stmmac_rst);
1750 ++ reset_control_deassert(dwmac->stmmac_ocp_rst);
1751 ++ reset_control_deassert(dwmac->stmmac_rst);
1752 + if (phymode == PHY_INTERFACE_MODE_SGMII) {
1753 + if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) {
1754 + dev_err(dwmac->dev, "Unable to initialize TSE PCS");
1755 +@@ -321,6 +322,15 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
1756 + goto err_remove_config_dt;
1757 + }
1758 +
1759 ++ dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp");
1760 ++ if (IS_ERR(dwmac->stmmac_ocp_rst)) {
1761 ++ ret = PTR_ERR(dwmac->stmmac_ocp_rst);
1762 ++ dev_err(dev, "error getting reset control of ocp %d\n", ret);
1763 ++ goto err_remove_config_dt;
1764 ++ }
1765 ++
1766 ++ reset_control_deassert(dwmac->stmmac_ocp_rst);
1767 ++
1768 + ret = socfpga_dwmac_parse_data(dwmac, dev);
1769 + if (ret) {
1770 + dev_err(dev, "Unable to parse OF data\n");
1771 +diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
1772 +index 481c7bf0395b..413cf14dbacd 100644
1773 +--- a/drivers/net/ethernet/ti/davinci_emac.c
1774 ++++ b/drivers/net/ethernet/ti/davinci_emac.c
1775 +@@ -1387,6 +1387,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
1776 +
1777 + static int match_first_device(struct device *dev, void *data)
1778 + {
1779 ++ if (dev->parent && dev->parent->of_node)
1780 ++ return of_device_is_compatible(dev->parent->of_node,
1781 ++ "ti,davinci_mdio");
1782 ++
1783 + return !strncmp(dev_name(dev), "davinci_mdio", 12);
1784 + }
1785 +
1786 +diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
1787 +index 622ab3ab9e93..f5e0983ae2a1 100644
1788 +--- a/drivers/net/hamradio/bpqether.c
1789 ++++ b/drivers/net/hamradio/bpqether.c
1790 +@@ -89,10 +89,6 @@
1791 + static const char banner[] __initconst = KERN_INFO \
1792 + "AX.25: bpqether driver version 004\n";
1793 +
1794 +-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
1795 +-
1796 +-static char bpq_eth_addr[6];
1797 +-
1798 + static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
1799 + static int bpq_device_event(struct notifier_block *, unsigned long, void *);
1800 +
1801 +@@ -515,8 +511,8 @@ static int bpq_new_device(struct net_device *edev)
1802 + bpq->ethdev = edev;
1803 + bpq->axdev = ndev;
1804 +
1805 +- memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
1806 +- memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
1807 ++ eth_broadcast_addr(bpq->dest_addr);
1808 ++ eth_broadcast_addr(bpq->acpt_addr);
1809 +
1810 + err = register_netdevice(ndev);
1811 + if (err)
1812 +diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
1813 +index 9f10da60e02d..ce3b7fb7eda0 100644
1814 +--- a/drivers/net/ieee802154/at86rf230.c
1815 ++++ b/drivers/net/ieee802154/at86rf230.c
1816 +@@ -941,7 +941,7 @@ at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
1817 + static int
1818 + at86rf230_ed(struct ieee802154_hw *hw, u8 *level)
1819 + {
1820 +- BUG_ON(!level);
1821 ++ WARN_ON(!level);
1822 + *level = 0xbe;
1823 + return 0;
1824 + }
1825 +@@ -1117,8 +1117,7 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
1826 + if (changed & IEEE802154_AFILT_SADDR_CHANGED) {
1827 + u16 addr = le16_to_cpu(filt->short_addr);
1828 +
1829 +- dev_vdbg(&lp->spi->dev,
1830 +- "at86rf230_set_hw_addr_filt called for saddr\n");
1831 ++ dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__);
1832 + __at86rf230_write(lp, RG_SHORT_ADDR_0, addr);
1833 + __at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8);
1834 + }
1835 +@@ -1126,8 +1125,7 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
1836 + if (changed & IEEE802154_AFILT_PANID_CHANGED) {
1837 + u16 pan = le16_to_cpu(filt->pan_id);
1838 +
1839 +- dev_vdbg(&lp->spi->dev,
1840 +- "at86rf230_set_hw_addr_filt called for pan id\n");
1841 ++ dev_vdbg(&lp->spi->dev, "%s called for pan id\n", __func__);
1842 + __at86rf230_write(lp, RG_PAN_ID_0, pan);
1843 + __at86rf230_write(lp, RG_PAN_ID_1, pan >> 8);
1844 + }
1845 +@@ -1136,15 +1134,13 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
1846 + u8 i, addr[8];
1847 +
1848 + memcpy(addr, &filt->ieee_addr, 8);
1849 +- dev_vdbg(&lp->spi->dev,
1850 +- "at86rf230_set_hw_addr_filt called for IEEE addr\n");
1851 ++ dev_vdbg(&lp->spi->dev, "%s called for IEEE addr\n", __func__);
1852 + for (i = 0; i < 8; i++)
1853 + __at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]);
1854 + }
1855 +
1856 + if (changed & IEEE802154_AFILT_PANC_CHANGED) {
1857 +- dev_vdbg(&lp->spi->dev,
1858 +- "at86rf230_set_hw_addr_filt called for panc change\n");
1859 ++ dev_vdbg(&lp->spi->dev, "%s called for panc change\n", __func__);
1860 + if (filt->pan_coord)
1861 + at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1);
1862 + else
1863 +@@ -1248,7 +1244,6 @@ at86rf230_set_cca_mode(struct ieee802154_hw *hw,
1864 + return at86rf230_write_subreg(lp, SR_CCA_MODE, val);
1865 + }
1866 +
1867 +-
1868 + static int
1869 + at86rf230_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm)
1870 + {
1871 +diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
1872 +index ec387efb61d0..685398191995 100644
1873 +--- a/drivers/net/ieee802154/fakelb.c
1874 ++++ b/drivers/net/ieee802154/fakelb.c
1875 +@@ -49,7 +49,7 @@ struct fakelb_phy {
1876 +
1877 + static int fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
1878 + {
1879 +- BUG_ON(!level);
1880 ++ WARN_ON(!level);
1881 + *level = 0xbe;
1882 +
1883 + return 0;
1884 +diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
1885 +index 24eb5755604f..b299277361b7 100644
1886 +--- a/drivers/net/ipvlan/ipvlan_main.c
1887 ++++ b/drivers/net/ipvlan/ipvlan_main.c
1888 +@@ -63,10 +63,23 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
1889 + {
1890 + struct ipvl_dev *ipvlan;
1891 + struct net_device *mdev = port->dev;
1892 +- int err = 0;
1893 ++ unsigned int flags;
1894 ++ int err;
1895 +
1896 + ASSERT_RTNL();
1897 + if (port->mode != nval) {
1898 ++ list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
1899 ++ flags = ipvlan->dev->flags;
1900 ++ if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S) {
1901 ++ err = dev_change_flags(ipvlan->dev,
1902 ++ flags | IFF_NOARP);
1903 ++ } else {
1904 ++ err = dev_change_flags(ipvlan->dev,
1905 ++ flags & ~IFF_NOARP);
1906 ++ }
1907 ++ if (unlikely(err))
1908 ++ goto fail;
1909 ++ }
1910 + if (nval == IPVLAN_MODE_L3S) {
1911 + /* New mode is L3S */
1912 + err = ipvlan_register_nf_hook();
1913 +@@ -74,21 +87,28 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
1914 + mdev->l3mdev_ops = &ipvl_l3mdev_ops;
1915 + mdev->priv_flags |= IFF_L3MDEV_MASTER;
1916 + } else
1917 +- return err;
1918 ++ goto fail;
1919 + } else if (port->mode == IPVLAN_MODE_L3S) {
1920 + /* Old mode was L3S */
1921 + mdev->priv_flags &= ~IFF_L3MDEV_MASTER;
1922 + ipvlan_unregister_nf_hook();
1923 + mdev->l3mdev_ops = NULL;
1924 + }
1925 +- list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
1926 +- if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S)
1927 +- ipvlan->dev->flags |= IFF_NOARP;
1928 +- else
1929 +- ipvlan->dev->flags &= ~IFF_NOARP;
1930 +- }
1931 + port->mode = nval;
1932 + }
1933 ++ return 0;
1934 ++
1935 ++fail:
1936 ++ /* Undo the flags changes that have been done so far. */
1937 ++ list_for_each_entry_continue_reverse(ipvlan, &port->ipvlans, pnode) {
1938 ++ flags = ipvlan->dev->flags;
1939 ++ if (port->mode == IPVLAN_MODE_L3 ||
1940 ++ port->mode == IPVLAN_MODE_L3S)
1941 ++ dev_change_flags(ipvlan->dev, flags | IFF_NOARP);
1942 ++ else
1943 ++ dev_change_flags(ipvlan->dev, flags & ~IFF_NOARP);
1944 ++ }
1945 ++
1946 + return err;
1947 + }
1948 +
1949 +diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
1950 +index dc4f7ea95c9b..9504800217ed 100644
1951 +--- a/drivers/net/usb/rtl8150.c
1952 ++++ b/drivers/net/usb/rtl8150.c
1953 +@@ -681,7 +681,7 @@ static void rtl8150_set_multicast(struct net_device *netdev)
1954 + (netdev->flags & IFF_ALLMULTI)) {
1955 + rx_creg &= 0xfffe;
1956 + rx_creg |= 0x0002;
1957 +- dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name);
1958 ++ dev_dbg(&netdev->dev, "%s: allmulti set\n", netdev->name);
1959 + } else {
1960 + /* ~RX_MULTICAST, ~RX_PROMISCUOUS */
1961 + rx_creg &= 0x00fc;
1962 +diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
1963 +index 2cc0f28f4fd2..03d04011d653 100644
1964 +--- a/drivers/net/usb/smsc75xx.c
1965 ++++ b/drivers/net/usb/smsc75xx.c
1966 +@@ -82,6 +82,9 @@ static bool turbo_mode = true;
1967 + module_param(turbo_mode, bool, 0644);
1968 + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
1969 +
1970 ++static int smsc75xx_link_ok_nopm(struct usbnet *dev);
1971 ++static int smsc75xx_phy_gig_workaround(struct usbnet *dev);
1972 ++
1973 + static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index,
1974 + u32 *data, int in_pm)
1975 + {
1976 +@@ -852,6 +855,9 @@ static int smsc75xx_phy_initialize(struct usbnet *dev)
1977 + return -EIO;
1978 + }
1979 +
1980 ++ /* phy workaround for gig link */
1981 ++ smsc75xx_phy_gig_workaround(dev);
1982 ++
1983 + smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
1984 + ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
1985 + ADVERTISE_PAUSE_ASYM);
1986 +@@ -990,6 +996,62 @@ static int smsc75xx_wait_ready(struct usbnet *dev, int in_pm)
1987 + return -EIO;
1988 + }
1989 +
1990 ++static int smsc75xx_phy_gig_workaround(struct usbnet *dev)
1991 ++{
1992 ++ struct mii_if_info *mii = &dev->mii;
1993 ++ int ret = 0, timeout = 0;
1994 ++ u32 buf, link_up = 0;
1995 ++
1996 ++ /* Set the phy in Gig loopback */
1997 ++ smsc75xx_mdio_write(dev->net, mii->phy_id, MII_BMCR, 0x4040);
1998 ++
1999 ++ /* Wait for the link up */
2000 ++ do {
2001 ++ link_up = smsc75xx_link_ok_nopm(dev);
2002 ++ usleep_range(10000, 20000);
2003 ++ timeout++;
2004 ++ } while ((!link_up) && (timeout < 1000));
2005 ++
2006 ++ if (timeout >= 1000) {
2007 ++ netdev_warn(dev->net, "Timeout waiting for PHY link up\n");
2008 ++ return -EIO;
2009 ++ }
2010 ++
2011 ++ /* phy reset */
2012 ++ ret = smsc75xx_read_reg(dev, PMT_CTL, &buf);
2013 ++ if (ret < 0) {
2014 ++ netdev_warn(dev->net, "Failed to read PMT_CTL: %d\n", ret);
2015 ++ return ret;
2016 ++ }
2017 ++
2018 ++ buf |= PMT_CTL_PHY_RST;
2019 ++
2020 ++ ret = smsc75xx_write_reg(dev, PMT_CTL, buf);
2021 ++ if (ret < 0) {
2022 ++ netdev_warn(dev->net, "Failed to write PMT_CTL: %d\n", ret);
2023 ++ return ret;
2024 ++ }
2025 ++
2026 ++ timeout = 0;
2027 ++ do {
2028 ++ usleep_range(10000, 20000);
2029 ++ ret = smsc75xx_read_reg(dev, PMT_CTL, &buf);
2030 ++ if (ret < 0) {
2031 ++ netdev_warn(dev->net, "Failed to read PMT_CTL: %d\n",
2032 ++ ret);
2033 ++ return ret;
2034 ++ }
2035 ++ timeout++;
2036 ++ } while ((buf & PMT_CTL_PHY_RST) && (timeout < 100));
2037 ++
2038 ++ if (timeout >= 100) {
2039 ++ netdev_warn(dev->net, "timeout waiting for PHY Reset\n");
2040 ++ return -EIO;
2041 ++ }
2042 ++
2043 ++ return 0;
2044 ++}
2045 ++
2046 + static int smsc75xx_reset(struct usbnet *dev)
2047 + {
2048 + struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
2049 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
2050 +index d46f086e6360..de52d826eb24 100644
2051 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
2052 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
2053 +@@ -4229,6 +4229,13 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus)
2054 + brcmf_dbg(TRACE, "Enter\n");
2055 +
2056 + if (bus) {
2057 ++ /* Stop watchdog task */
2058 ++ if (bus->watchdog_tsk) {
2059 ++ send_sig(SIGTERM, bus->watchdog_tsk, 1);
2060 ++ kthread_stop(bus->watchdog_tsk);
2061 ++ bus->watchdog_tsk = NULL;
2062 ++ }
2063 ++
2064 + /* De-register interrupt handler */
2065 + brcmf_sdiod_intr_unregister(bus->sdiodev);
2066 +
2067 +diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
2068 +index 33ed78be2750..3a897f57cac5 100644
2069 +--- a/drivers/nfc/pn533/usb.c
2070 ++++ b/drivers/nfc/pn533/usb.c
2071 +@@ -71,7 +71,7 @@ static void pn533_recv_response(struct urb *urb)
2072 + struct sk_buff *skb = NULL;
2073 +
2074 + if (!urb->status) {
2075 +- skb = alloc_skb(urb->actual_length, GFP_KERNEL);
2076 ++ skb = alloc_skb(urb->actual_length, GFP_ATOMIC);
2077 + if (!skb) {
2078 + nfc_err(&phy->udev->dev, "failed to alloc memory\n");
2079 + } else {
2080 +@@ -180,7 +180,7 @@ static int pn533_usb_send_frame(struct pn533 *dev,
2081 +
2082 + if (dev->protocol_type == PN533_PROTO_REQ_RESP) {
2083 + /* request for response for sent packet directly */
2084 +- rc = pn533_submit_urb_for_response(phy, GFP_ATOMIC);
2085 ++ rc = pn533_submit_urb_for_response(phy, GFP_KERNEL);
2086 + if (rc)
2087 + goto error;
2088 + } else if (dev->protocol_type == PN533_PROTO_REQ_ACK_RESP) {
2089 +diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
2090 +index 64b40a12abcf..f12753eb3216 100644
2091 +--- a/drivers/nvme/target/core.c
2092 ++++ b/drivers/nvme/target/core.c
2093 +@@ -578,6 +578,14 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
2094 + }
2095 +
2096 + ctrl->csts = NVME_CSTS_RDY;
2097 ++
2098 ++ /*
2099 ++ * Controllers that are not yet enabled should not really enforce the
2100 ++ * keep alive timeout, but we still want to track a timeout and cleanup
2101 ++ * in case a host died before it enabled the controller. Hence, simply
2102 ++ * reset the keep alive timer when the controller is enabled.
2103 ++ */
2104 ++ mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
2105 + }
2106 +
2107 + static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
2108 +diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
2109 +index e3c48b5deb93..5c90d7be2184 100644
2110 +--- a/drivers/pci/host/pci-host-common.c
2111 ++++ b/drivers/pci/host/pci-host-common.c
2112 +@@ -45,7 +45,7 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
2113 +
2114 + switch (resource_type(res)) {
2115 + case IORESOURCE_IO:
2116 +- err = pci_remap_iospace(res, iobase);
2117 ++ err = devm_pci_remap_iospace(dev, res, iobase);
2118 + if (err) {
2119 + dev_warn(dev, "error %d: failed to map resource %pR\n",
2120 + err, res);
2121 +diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c
2122 +index b7dc07002f13..4096cce0ef0e 100644
2123 +--- a/drivers/pci/host/pci-versatile.c
2124 ++++ b/drivers/pci/host/pci-versatile.c
2125 +@@ -89,7 +89,7 @@ static int versatile_pci_parse_request_of_pci_ranges(struct device *dev,
2126 +
2127 + switch (resource_type(res)) {
2128 + case IORESOURCE_IO:
2129 +- err = pci_remap_iospace(res, iobase);
2130 ++ err = devm_pci_remap_iospace(dev, res, iobase);
2131 + if (err) {
2132 + dev_warn(dev, "error %d: failed to map resource %pR\n",
2133 + err, res);
2134 +diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
2135 +index 62700d1896f4..d6196f7b1d58 100644
2136 +--- a/drivers/pci/host/pcie-rcar.c
2137 ++++ b/drivers/pci/host/pcie-rcar.c
2138 +@@ -1102,7 +1102,7 @@ static int rcar_pcie_parse_request_of_pci_ranges(struct rcar_pcie *pci)
2139 + struct resource *res = win->res;
2140 +
2141 + if (resource_type(res) == IORESOURCE_IO) {
2142 +- err = pci_remap_iospace(res, iobase);
2143 ++ err = devm_pci_remap_iospace(dev, res, iobase);
2144 + if (err) {
2145 + dev_warn(dev, "error %d: failed to map resource %pR\n",
2146 + err, res);
2147 +diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
2148 +index 43eaa4afab94..94fdd295aae2 100644
2149 +--- a/drivers/pci/host/pcie-xilinx-nwl.c
2150 ++++ b/drivers/pci/host/pcie-xilinx-nwl.c
2151 +@@ -532,7 +532,7 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
2152 + INTX_NUM,
2153 + &legacy_domain_ops,
2154 + pcie);
2155 +-
2156 ++ of_node_put(legacy_intc_node);
2157 + if (!pcie->legacy_irq_domain) {
2158 + dev_err(dev, "failed to create IRQ domain\n");
2159 + return -ENOMEM;
2160 +diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
2161 +index c8616fadccf1..61332f4d51c3 100644
2162 +--- a/drivers/pci/host/pcie-xilinx.c
2163 ++++ b/drivers/pci/host/pcie-xilinx.c
2164 +@@ -527,6 +527,7 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
2165 + port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
2166 + &intx_domain_ops,
2167 + port);
2168 ++ of_node_put(pcie_intc_node);
2169 + if (!port->leg_domain) {
2170 + dev_err(dev, "Failed to get a INTx IRQ domain\n");
2171 + return -ENODEV;
2172 +diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
2173 +index fea0b8b33589..0a3b3f72c94b 100644
2174 +--- a/drivers/pci/hotplug/pci_hotplug_core.c
2175 ++++ b/drivers/pci/hotplug/pci_hotplug_core.c
2176 +@@ -455,8 +455,17 @@ int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
2177 + list_add(&slot->slot_list, &pci_hotplug_slot_list);
2178 +
2179 + result = fs_add_slot(pci_slot);
2180 ++ if (result)
2181 ++ goto err_list_del;
2182 ++
2183 + kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
2184 + dbg("Added slot %s to the list\n", name);
2185 ++ goto out;
2186 ++
2187 ++err_list_del:
2188 ++ list_del(&slot->slot_list);
2189 ++ pci_slot->hotplug = NULL;
2190 ++ pci_destroy_slot(pci_slot);
2191 + out:
2192 + mutex_unlock(&pci_hp_mutex);
2193 + return result;
2194 +diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
2195 +index 2bba8481beb1..56c0b60df25e 100644
2196 +--- a/drivers/pci/hotplug/pciehp.h
2197 ++++ b/drivers/pci/hotplug/pciehp.h
2198 +@@ -132,6 +132,7 @@ int pciehp_unconfigure_device(struct slot *p_slot);
2199 + void pciehp_queue_pushbutton_work(struct work_struct *work);
2200 + struct controller *pcie_init(struct pcie_device *dev);
2201 + int pcie_init_notification(struct controller *ctrl);
2202 ++void pcie_shutdown_notification(struct controller *ctrl);
2203 + int pciehp_enable_slot(struct slot *p_slot);
2204 + int pciehp_disable_slot(struct slot *p_slot);
2205 + void pcie_reenable_notification(struct controller *ctrl);
2206 +diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
2207 +index 6620b1095046..a7485bc1e975 100644
2208 +--- a/drivers/pci/hotplug/pciehp_core.c
2209 ++++ b/drivers/pci/hotplug/pciehp_core.c
2210 +@@ -76,6 +76,12 @@ static int reset_slot(struct hotplug_slot *slot, int probe);
2211 + */
2212 + static void release_slot(struct hotplug_slot *hotplug_slot)
2213 + {
2214 ++ struct slot *slot = hotplug_slot->private;
2215 ++
2216 ++ /* queued work needs hotplug_slot name */
2217 ++ cancel_delayed_work(&slot->work);
2218 ++ drain_workqueue(slot->wq);
2219 ++
2220 + kfree(hotplug_slot->ops);
2221 + kfree(hotplug_slot->info);
2222 + kfree(hotplug_slot);
2223 +@@ -278,6 +284,7 @@ static void pciehp_remove(struct pcie_device *dev)
2224 + {
2225 + struct controller *ctrl = get_service_data(dev);
2226 +
2227 ++ pcie_shutdown_notification(ctrl);
2228 + cleanup_slot(ctrl);
2229 + pciehp_release_ctrl(ctrl);
2230 + }
2231 +diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
2232 +index 8d811ea353c8..8b8b096167d7 100644
2233 +--- a/drivers/pci/hotplug/pciehp_hpc.c
2234 ++++ b/drivers/pci/hotplug/pciehp_hpc.c
2235 +@@ -562,8 +562,6 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
2236 + {
2237 + struct controller *ctrl = (struct controller *)dev_id;
2238 + struct pci_dev *pdev = ctrl_dev(ctrl);
2239 +- struct pci_bus *subordinate = pdev->subordinate;
2240 +- struct pci_dev *dev;
2241 + struct slot *slot = ctrl->slot;
2242 + u16 status, events;
2243 + u8 present;
2244 +@@ -611,14 +609,9 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
2245 + wake_up(&ctrl->queue);
2246 + }
2247 +
2248 +- if (subordinate) {
2249 +- list_for_each_entry(dev, &subordinate->devices, bus_list) {
2250 +- if (dev->ignore_hotplug) {
2251 +- ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n",
2252 +- events, pci_name(dev));
2253 +- return IRQ_HANDLED;
2254 +- }
2255 +- }
2256 ++ if (pdev->ignore_hotplug) {
2257 ++ ctrl_dbg(ctrl, "ignoring hotplug event %#06x\n", events);
2258 ++ return IRQ_HANDLED;
2259 + }
2260 +
2261 + /* Check Attention Button Pressed */
2262 +@@ -786,7 +779,7 @@ int pcie_init_notification(struct controller *ctrl)
2263 + return 0;
2264 + }
2265 +
2266 +-static void pcie_shutdown_notification(struct controller *ctrl)
2267 ++void pcie_shutdown_notification(struct controller *ctrl)
2268 + {
2269 + if (ctrl->notification_enabled) {
2270 + pcie_disable_notification(ctrl);
2271 +@@ -821,7 +814,7 @@ abort:
2272 + static void pcie_cleanup_slot(struct controller *ctrl)
2273 + {
2274 + struct slot *slot = ctrl->slot;
2275 +- cancel_delayed_work(&slot->work);
2276 ++
2277 + destroy_workqueue(slot->wq);
2278 + kfree(slot);
2279 + }
2280 +@@ -902,7 +895,6 @@ abort:
2281 +
2282 + void pciehp_release_ctrl(struct controller *ctrl)
2283 + {
2284 +- pcie_shutdown_notification(ctrl);
2285 + pcie_cleanup_slot(ctrl);
2286 + kfree(ctrl);
2287 + }
2288 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
2289 +index 9c13aeeeb973..6b3c5c4cbb37 100644
2290 +--- a/drivers/pci/pci.c
2291 ++++ b/drivers/pci/pci.c
2292 +@@ -3407,6 +3407,44 @@ void pci_unmap_iospace(struct resource *res)
2293 + #endif
2294 + }
2295 +
2296 ++static void devm_pci_unmap_iospace(struct device *dev, void *ptr)
2297 ++{
2298 ++ struct resource **res = ptr;
2299 ++
2300 ++ pci_unmap_iospace(*res);
2301 ++}
2302 ++
2303 ++/**
2304 ++ * devm_pci_remap_iospace - Managed pci_remap_iospace()
2305 ++ * @dev: Generic device to remap IO address for
2306 ++ * @res: Resource describing the I/O space
2307 ++ * @phys_addr: physical address of range to be mapped
2308 ++ *
2309 ++ * Managed pci_remap_iospace(). Map is automatically unmapped on driver
2310 ++ * detach.
2311 ++ */
2312 ++int devm_pci_remap_iospace(struct device *dev, const struct resource *res,
2313 ++ phys_addr_t phys_addr)
2314 ++{
2315 ++ const struct resource **ptr;
2316 ++ int error;
2317 ++
2318 ++ ptr = devres_alloc(devm_pci_unmap_iospace, sizeof(*ptr), GFP_KERNEL);
2319 ++ if (!ptr)
2320 ++ return -ENOMEM;
2321 ++
2322 ++ error = pci_remap_iospace(res, phys_addr);
2323 ++ if (error) {
2324 ++ devres_free(ptr);
2325 ++ } else {
2326 ++ *ptr = res;
2327 ++ devres_add(dev, ptr);
2328 ++ }
2329 ++
2330 ++ return error;
2331 ++}
2332 ++EXPORT_SYMBOL(devm_pci_remap_iospace);
2333 ++
2334 + static void __pci_set_master(struct pci_dev *dev, bool enable)
2335 + {
2336 + u16 old_cmd, cmd;
2337 +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
2338 +index 56340abe4fc6..16611cf3aba4 100644
2339 +--- a/drivers/pci/probe.c
2340 ++++ b/drivers/pci/probe.c
2341 +@@ -1363,6 +1363,10 @@ static void pci_configure_mps(struct pci_dev *dev)
2342 + if (!pci_is_pcie(dev) || !bridge || !pci_is_pcie(bridge))
2343 + return;
2344 +
2345 ++ /* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */
2346 ++ if (dev->is_virtfn)
2347 ++ return;
2348 ++
2349 + mps = pcie_get_mps(dev);
2350 + p_mps = pcie_get_mps(bridge);
2351 +
2352 +diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
2353 +index 35c17653c694..87618a4e90e4 100644
2354 +--- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
2355 ++++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
2356 +@@ -460,8 +460,8 @@ static int nsp_pinmux_enable(struct pinctrl_dev *pctrl_dev,
2357 + const struct nsp_pin_function *func;
2358 + const struct nsp_pin_group *grp;
2359 +
2360 +- if (grp_select > pinctrl->num_groups ||
2361 +- func_select > pinctrl->num_functions)
2362 ++ if (grp_select >= pinctrl->num_groups ||
2363 ++ func_select >= pinctrl->num_functions)
2364 + return -EINVAL;
2365 +
2366 + func = &pinctrl->functions[func_select];
2367 +@@ -577,6 +577,8 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
2368 + return PTR_ERR(pinctrl->base0);
2369 +
2370 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
2371 ++ if (!res)
2372 ++ return -EINVAL;
2373 + pinctrl->base1 = devm_ioremap_nocache(&pdev->dev, res->start,
2374 + resource_size(res));
2375 + if (!pinctrl->base1) {
2376 +diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
2377 +index 9dc8687bf048..e1b32ed0aa20 100644
2378 +--- a/drivers/scsi/xen-scsifront.c
2379 ++++ b/drivers/scsi/xen-scsifront.c
2380 +@@ -676,10 +676,17 @@ static int scsifront_dev_reset_handler(struct scsi_cmnd *sc)
2381 + static int scsifront_sdev_configure(struct scsi_device *sdev)
2382 + {
2383 + struct vscsifrnt_info *info = shost_priv(sdev->host);
2384 ++ int err;
2385 +
2386 +- if (info && current == info->curr)
2387 +- xenbus_printf(XBT_NIL, info->dev->nodename,
2388 ++ if (info && current == info->curr) {
2389 ++ err = xenbus_printf(XBT_NIL, info->dev->nodename,
2390 + info->dev_state_path, "%d", XenbusStateConnected);
2391 ++ if (err) {
2392 ++ xenbus_dev_error(info->dev, err,
2393 ++ "%s: writing dev_state_path", __func__);
2394 ++ return err;
2395 ++ }
2396 ++ }
2397 +
2398 + return 0;
2399 + }
2400 +@@ -687,10 +694,15 @@ static int scsifront_sdev_configure(struct scsi_device *sdev)
2401 + static void scsifront_sdev_destroy(struct scsi_device *sdev)
2402 + {
2403 + struct vscsifrnt_info *info = shost_priv(sdev->host);
2404 ++ int err;
2405 +
2406 +- if (info && current == info->curr)
2407 +- xenbus_printf(XBT_NIL, info->dev->nodename,
2408 ++ if (info && current == info->curr) {
2409 ++ err = xenbus_printf(XBT_NIL, info->dev->nodename,
2410 + info->dev_state_path, "%d", XenbusStateClosed);
2411 ++ if (err)
2412 ++ xenbus_dev_error(info->dev, err,
2413 ++ "%s: writing dev_state_path", __func__);
2414 ++ }
2415 + }
2416 +
2417 + static struct scsi_host_template scsifront_sht = {
2418 +@@ -1025,9 +1037,12 @@ static void scsifront_do_lun_hotplug(struct vscsifrnt_info *info, int op)
2419 +
2420 + if (scsi_add_device(info->host, chn, tgt, lun)) {
2421 + dev_err(&dev->dev, "scsi_add_device\n");
2422 +- xenbus_printf(XBT_NIL, dev->nodename,
2423 ++ err = xenbus_printf(XBT_NIL, dev->nodename,
2424 + info->dev_state_path,
2425 + "%d", XenbusStateClosed);
2426 ++ if (err)
2427 ++ xenbus_dev_error(dev, err,
2428 ++ "%s: writing dev_state_path", __func__);
2429 + }
2430 + break;
2431 + case VSCSIFRONT_OP_DEL_LUN:
2432 +@@ -1041,10 +1056,14 @@ static void scsifront_do_lun_hotplug(struct vscsifrnt_info *info, int op)
2433 + }
2434 + break;
2435 + case VSCSIFRONT_OP_READD_LUN:
2436 +- if (device_state == XenbusStateConnected)
2437 +- xenbus_printf(XBT_NIL, dev->nodename,
2438 ++ if (device_state == XenbusStateConnected) {
2439 ++ err = xenbus_printf(XBT_NIL, dev->nodename,
2440 + info->dev_state_path,
2441 + "%d", XenbusStateConnected);
2442 ++ if (err)
2443 ++ xenbus_dev_error(dev, err,
2444 ++ "%s: writing dev_state_path", __func__);
2445 ++ }
2446 + break;
2447 + default:
2448 + break;
2449 +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
2450 +index 09921ef07ac5..3ae27b6ed07c 100644
2451 +--- a/drivers/usb/dwc2/gadget.c
2452 ++++ b/drivers/usb/dwc2/gadget.c
2453 +@@ -3948,9 +3948,11 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
2454 + }
2455 +
2456 + ret = usb_add_gadget_udc(dev, &hsotg->gadget);
2457 +- if (ret)
2458 ++ if (ret) {
2459 ++ dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep,
2460 ++ hsotg->ctrl_req);
2461 + return ret;
2462 +-
2463 ++ }
2464 + dwc2_hsotg_dump(hsotg);
2465 +
2466 + return 0;
2467 +@@ -3963,6 +3965,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
2468 + int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg)
2469 + {
2470 + usb_del_gadget_udc(&hsotg->gadget);
2471 ++ dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, hsotg->ctrl_req);
2472 +
2473 + return 0;
2474 + }
2475 +diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
2476 +index 906f223542ee..8066fa9ac97b 100644
2477 +--- a/drivers/usb/dwc2/hcd_intr.c
2478 ++++ b/drivers/usb/dwc2/hcd_intr.c
2479 +@@ -922,9 +922,8 @@ static int dwc2_xfercomp_isoc_split_in(struct dwc2_hsotg *hsotg,
2480 + frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index];
2481 + len = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd,
2482 + DWC2_HC_XFER_COMPLETE, NULL);
2483 +- if (!len) {
2484 ++ if (!len && !qtd->isoc_split_offset) {
2485 + qtd->complete_split = 0;
2486 +- qtd->isoc_split_offset = 0;
2487 + return 0;
2488 + }
2489 +
2490 +diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
2491 +index a3e2200f5b5f..58526932d2b6 100644
2492 +--- a/drivers/usb/dwc3/dwc3-of-simple.c
2493 ++++ b/drivers/usb/dwc3/dwc3-of-simple.c
2494 +@@ -132,8 +132,9 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
2495 +
2496 + of_platform_depopulate(dev);
2497 +
2498 +- pm_runtime_put_sync(dev);
2499 + pm_runtime_disable(dev);
2500 ++ pm_runtime_put_noidle(dev);
2501 ++ pm_runtime_set_suspended(dev);
2502 +
2503 + return 0;
2504 + }
2505 +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
2506 +index ca97f5b36e1b..2c022a08f163 100644
2507 +--- a/drivers/usb/gadget/composite.c
2508 ++++ b/drivers/usb/gadget/composite.c
2509 +@@ -1712,6 +1712,8 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
2510 + */
2511 + if (w_value && !f->get_alt)
2512 + break;
2513 ++
2514 ++ spin_lock(&cdev->lock);
2515 + value = f->set_alt(f, w_index, w_value);
2516 + if (value == USB_GADGET_DELAYED_STATUS) {
2517 + DBG(cdev,
2518 +@@ -1721,6 +1723,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
2519 + DBG(cdev, "delayed_status count %d\n",
2520 + cdev->delayed_status);
2521 + }
2522 ++ spin_unlock(&cdev->lock);
2523 + break;
2524 + case USB_REQ_GET_INTERFACE:
2525 + if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE))
2526 +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
2527 +index a59fafb4b329..97d57a94776a 100644
2528 +--- a/drivers/usb/host/xhci-tegra.c
2529 ++++ b/drivers/usb/host/xhci-tegra.c
2530 +@@ -482,7 +482,7 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
2531 + unsigned long mask;
2532 + unsigned int port;
2533 + bool idle, enable;
2534 +- int err;
2535 ++ int err = 0;
2536 +
2537 + memset(&rsp, 0, sizeof(rsp));
2538 +
2539 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
2540 +index 81f25213cb41..c190fabd1875 100644
2541 +--- a/drivers/usb/host/xhci.c
2542 ++++ b/drivers/usb/host/xhci.c
2543 +@@ -1056,8 +1056,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
2544 + command = readl(&xhci->op_regs->command);
2545 + command |= CMD_CRS;
2546 + writel(command, &xhci->op_regs->command);
2547 ++ /*
2548 ++ * Some controllers take up to 55+ ms to complete the controller
2549 ++ * restore so setting the timeout to 100ms. Xhci specification
2550 ++ * doesn't mention any timeout value.
2551 ++ */
2552 + if (xhci_handshake(&xhci->op_regs->status,
2553 +- STS_RESTORE, 0, 10 * 1000)) {
2554 ++ STS_RESTORE, 0, 100 * 1000)) {
2555 + xhci_warn(xhci, "WARN: xHC restore state timeout\n");
2556 + spin_unlock_irq(&xhci->lock);
2557 + return -ETIMEDOUT;
2558 +diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
2559 +index 9122ba25bb00..7abaaa5f0f67 100644
2560 +--- a/drivers/xen/manage.c
2561 ++++ b/drivers/xen/manage.c
2562 +@@ -291,8 +291,15 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
2563 + return;
2564 + }
2565 +
2566 +- if (sysrq_key != '\0')
2567 +- xenbus_printf(xbt, "control", "sysrq", "%c", '\0');
2568 ++ if (sysrq_key != '\0') {
2569 ++ err = xenbus_printf(xbt, "control", "sysrq", "%c", '\0');
2570 ++ if (err) {
2571 ++ pr_err("%s: Error %d writing sysrq in control/sysrq\n",
2572 ++ __func__, err);
2573 ++ xenbus_transaction_end(xbt, 1);
2574 ++ return;
2575 ++ }
2576 ++ }
2577 +
2578 + err = xenbus_transaction_end(xbt, 0);
2579 + if (err == -EAGAIN)
2580 +@@ -344,7 +351,12 @@ static int setup_shutdown_watcher(void)
2581 + continue;
2582 + snprintf(node, FEATURE_PATH_SIZE, "feature-%s",
2583 + shutdown_handlers[idx].command);
2584 +- xenbus_printf(XBT_NIL, "control", node, "%u", 1);
2585 ++ err = xenbus_printf(XBT_NIL, "control", node, "%u", 1);
2586 ++ if (err) {
2587 ++ pr_err("%s: Error %d writing %s\n", __func__,
2588 ++ err, node);
2589 ++ return err;
2590 ++ }
2591 + }
2592 +
2593 + return 0;
2594 +diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
2595 +index 980f32817305..992cb8fa272c 100644
2596 +--- a/drivers/xen/xen-scsiback.c
2597 ++++ b/drivers/xen/xen-scsiback.c
2598 +@@ -1014,6 +1014,7 @@ static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
2599 + {
2600 + struct v2p_entry *entry;
2601 + unsigned long flags;
2602 ++ int err;
2603 +
2604 + if (try) {
2605 + spin_lock_irqsave(&info->v2p_lock, flags);
2606 +@@ -1029,8 +1030,11 @@ static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
2607 + scsiback_del_translation_entry(info, vir);
2608 + }
2609 + } else if (!try) {
2610 +- xenbus_printf(XBT_NIL, info->dev->nodename, state,
2611 ++ err = xenbus_printf(XBT_NIL, info->dev->nodename, state,
2612 + "%d", XenbusStateClosed);
2613 ++ if (err)
2614 ++ xenbus_dev_error(info->dev, err,
2615 ++ "%s: writing %s", __func__, state);
2616 + }
2617 + }
2618 +
2619 +@@ -1069,8 +1073,11 @@ static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
2620 + snprintf(str, sizeof(str), "vscsi-devs/%s/p-dev", ent);
2621 + val = xenbus_read(XBT_NIL, dev->nodename, str, NULL);
2622 + if (IS_ERR(val)) {
2623 +- xenbus_printf(XBT_NIL, dev->nodename, state,
2624 ++ err = xenbus_printf(XBT_NIL, dev->nodename, state,
2625 + "%d", XenbusStateClosed);
2626 ++ if (err)
2627 ++ xenbus_dev_error(info->dev, err,
2628 ++ "%s: writing %s", __func__, state);
2629 + return;
2630 + }
2631 + strlcpy(phy, val, VSCSI_NAMELEN);
2632 +@@ -1081,8 +1088,11 @@ static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
2633 + err = xenbus_scanf(XBT_NIL, dev->nodename, str, "%u:%u:%u:%u",
2634 + &vir.hst, &vir.chn, &vir.tgt, &vir.lun);
2635 + if (XENBUS_EXIST_ERR(err)) {
2636 +- xenbus_printf(XBT_NIL, dev->nodename, state,
2637 ++ err = xenbus_printf(XBT_NIL, dev->nodename, state,
2638 + "%d", XenbusStateClosed);
2639 ++ if (err)
2640 ++ xenbus_dev_error(info->dev, err,
2641 ++ "%s: writing %s", __func__, state);
2642 + return;
2643 + }
2644 +
2645 +diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
2646 +index 4a6df2ce0f76..1f754336f801 100644
2647 +--- a/fs/ceph/inode.c
2648 ++++ b/fs/ceph/inode.c
2649 +@@ -1077,6 +1077,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in)
2650 + if (IS_ERR(realdn)) {
2651 + pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
2652 + PTR_ERR(realdn), dn, in, ceph_vinop(in));
2653 ++ dput(dn);
2654 + dn = realdn; /* note realdn contains the error */
2655 + goto out;
2656 + } else if (realdn) {
2657 +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2658 +index 53e1890660a2..a49d0e5d7baf 100644
2659 +--- a/fs/ext4/mballoc.c
2660 ++++ b/fs/ext4/mballoc.c
2661 +@@ -26,6 +26,7 @@
2662 + #include <linux/log2.h>
2663 + #include <linux/module.h>
2664 + #include <linux/slab.h>
2665 ++#include <linux/nospec.h>
2666 + #include <linux/backing-dev.h>
2667 + #include <trace/events/ext4.h>
2668 +
2669 +@@ -2144,7 +2145,8 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
2670 + * This should tell if fe_len is exactly power of 2
2671 + */
2672 + if ((ac->ac_g_ex.fe_len & (~(1 << (i - 1)))) == 0)
2673 +- ac->ac_2order = i - 1;
2674 ++ ac->ac_2order = array_index_nospec(i - 1,
2675 ++ sb->s_blocksize_bits + 2);
2676 + }
2677 +
2678 + /* if stream allocation is enabled, use global goal */
2679 +diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
2680 +index e87aa21c30de..06a9fae202a7 100644
2681 +--- a/fs/reiserfs/xattr.c
2682 ++++ b/fs/reiserfs/xattr.c
2683 +@@ -791,8 +791,10 @@ static int listxattr_filler(struct dir_context *ctx, const char *name,
2684 + return 0;
2685 + size = namelen + 1;
2686 + if (b->buf) {
2687 +- if (size > b->size)
2688 ++ if (b->pos + size > b->size) {
2689 ++ b->pos = -ERANGE;
2690 + return -ERANGE;
2691 ++ }
2692 + memcpy(b->buf + b->pos, name, namelen);
2693 + b->buf[b->pos + namelen] = 0;
2694 + }
2695 +diff --git a/include/linux/fsl/guts.h b/include/linux/fsl/guts.h
2696 +index 649e9171a9b3..270eef7d2267 100644
2697 +--- a/include/linux/fsl/guts.h
2698 ++++ b/include/linux/fsl/guts.h
2699 +@@ -16,6 +16,7 @@
2700 + #define __FSL_GUTS_H__
2701 +
2702 + #include <linux/types.h>
2703 ++#include <linux/io.h>
2704 +
2705 + /**
2706 + * Global Utility Registers.
2707 +diff --git a/include/linux/pci.h b/include/linux/pci.h
2708 +index 36522905685b..78c9f4a91d94 100644
2709 +--- a/include/linux/pci.h
2710 ++++ b/include/linux/pci.h
2711 +@@ -1190,6 +1190,8 @@ int pci_register_io_range(phys_addr_t addr, resource_size_t size);
2712 + unsigned long pci_address_to_pio(phys_addr_t addr);
2713 + phys_addr_t pci_pio_to_address(unsigned long pio);
2714 + int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
2715 ++int devm_pci_remap_iospace(struct device *dev, const struct resource *res,
2716 ++ phys_addr_t phys_addr);
2717 + void pci_unmap_iospace(struct resource *res);
2718 +
2719 + static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
2720 +diff --git a/include/net/ipv6.h b/include/net/ipv6.h
2721 +index 407087d686a7..64b0e9df31c7 100644
2722 +--- a/include/net/ipv6.h
2723 ++++ b/include/net/ipv6.h
2724 +@@ -312,14 +312,7 @@ struct ipv6_txoptions *ipv6_dup_options(struct sock *sk,
2725 + struct ipv6_txoptions *ipv6_renew_options(struct sock *sk,
2726 + struct ipv6_txoptions *opt,
2727 + int newtype,
2728 +- struct ipv6_opt_hdr __user *newopt,
2729 +- int newoptlen);
2730 +-struct ipv6_txoptions *
2731 +-ipv6_renew_options_kern(struct sock *sk,
2732 +- struct ipv6_txoptions *opt,
2733 +- int newtype,
2734 +- struct ipv6_opt_hdr *newopt,
2735 +- int newoptlen);
2736 ++ struct ipv6_opt_hdr *newopt);
2737 + struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
2738 + struct ipv6_txoptions *opt);
2739 +
2740 +diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
2741 +index 23102da24dd9..c05db6ff2515 100644
2742 +--- a/include/net/net_namespace.h
2743 ++++ b/include/net/net_namespace.h
2744 +@@ -116,6 +116,7 @@ struct net {
2745 + #endif
2746 + #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
2747 + struct netns_nf_frag nf_frag;
2748 ++ struct ctl_table_header *nf_frag_frags_hdr;
2749 + #endif
2750 + struct sock *nfnl;
2751 + struct sock *nfnl_stash;
2752 +diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
2753 +index 10d0848f5b8a..5cae575db07b 100644
2754 +--- a/include/net/netns/ipv6.h
2755 ++++ b/include/net/netns/ipv6.h
2756 +@@ -89,7 +89,6 @@ struct netns_ipv6 {
2757 +
2758 + #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
2759 + struct netns_nf_frag {
2760 +- struct netns_sysctl_ipv6 sysctl;
2761 + struct netns_frags frags;
2762 + };
2763 + #endif
2764 +diff --git a/include/net/tc_act/tc_tunnel_key.h b/include/net/tc_act/tc_tunnel_key.h
2765 +index 253f8da6c2a6..2dcd80d62206 100644
2766 +--- a/include/net/tc_act/tc_tunnel_key.h
2767 ++++ b/include/net/tc_act/tc_tunnel_key.h
2768 +@@ -16,7 +16,6 @@
2769 + struct tcf_tunnel_key_params {
2770 + struct rcu_head rcu;
2771 + int tcft_action;
2772 +- int action;
2773 + struct metadata_dst *tcft_enc_metadata;
2774 + };
2775 +
2776 +diff --git a/include/net/tcp.h b/include/net/tcp.h
2777 +index 97d210535cdd..c3f4f6a9e6c3 100644
2778 +--- a/include/net/tcp.h
2779 ++++ b/include/net/tcp.h
2780 +@@ -850,8 +850,6 @@ enum tcp_ca_event {
2781 + CA_EVENT_LOSS, /* loss timeout */
2782 + CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */
2783 + CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */
2784 +- CA_EVENT_DELAYED_ACK, /* Delayed ack is sent */
2785 +- CA_EVENT_NON_DELAYED_ACK,
2786 + };
2787 +
2788 + /* Information about inbound ACK, passed to cong_ops->in_ack_event() */
2789 +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
2790 +index 6599c7f3071d..61a15e538435 100644
2791 +--- a/kernel/locking/lockdep.c
2792 ++++ b/kernel/locking/lockdep.c
2793 +@@ -1240,11 +1240,11 @@ unsigned long lockdep_count_forward_deps(struct lock_class *class)
2794 + this.parent = NULL;
2795 + this.class = class;
2796 +
2797 +- local_irq_save(flags);
2798 ++ raw_local_irq_save(flags);
2799 + arch_spin_lock(&lockdep_lock);
2800 + ret = __lockdep_count_forward_deps(&this);
2801 + arch_spin_unlock(&lockdep_lock);
2802 +- local_irq_restore(flags);
2803 ++ raw_local_irq_restore(flags);
2804 +
2805 + return ret;
2806 + }
2807 +@@ -1267,11 +1267,11 @@ unsigned long lockdep_count_backward_deps(struct lock_class *class)
2808 + this.parent = NULL;
2809 + this.class = class;
2810 +
2811 +- local_irq_save(flags);
2812 ++ raw_local_irq_save(flags);
2813 + arch_spin_lock(&lockdep_lock);
2814 + ret = __lockdep_count_backward_deps(&this);
2815 + arch_spin_unlock(&lockdep_lock);
2816 +- local_irq_restore(flags);
2817 ++ raw_local_irq_restore(flags);
2818 +
2819 + return ret;
2820 + }
2821 +@@ -4273,7 +4273,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
2822 + if (unlikely(!debug_locks))
2823 + return;
2824 +
2825 +- local_irq_save(flags);
2826 ++ raw_local_irq_save(flags);
2827 + for (i = 0; i < curr->lockdep_depth; i++) {
2828 + hlock = curr->held_locks + i;
2829 +
2830 +@@ -4284,7 +4284,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
2831 + print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
2832 + break;
2833 + }
2834 +- local_irq_restore(flags);
2835 ++ raw_local_irq_restore(flags);
2836 + }
2837 + EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
2838 +
2839 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
2840 +index 901c7f15f6e2..148c2210a2b8 100644
2841 +--- a/kernel/trace/trace.c
2842 ++++ b/kernel/trace/trace.c
2843 +@@ -2525,6 +2525,7 @@ out_nobuffer:
2844 + }
2845 + EXPORT_SYMBOL_GPL(trace_vbprintk);
2846 +
2847 ++__printf(3, 0)
2848 + static int
2849 + __trace_array_vprintk(struct ring_buffer *buffer,
2850 + unsigned long ip, const char *fmt, va_list args)
2851 +@@ -2579,12 +2580,14 @@ out_nobuffer:
2852 + return len;
2853 + }
2854 +
2855 ++__printf(3, 0)
2856 + int trace_array_vprintk(struct trace_array *tr,
2857 + unsigned long ip, const char *fmt, va_list args)
2858 + {
2859 + return __trace_array_vprintk(tr->trace_buffer.buffer, ip, fmt, args);
2860 + }
2861 +
2862 ++__printf(3, 0)
2863 + int trace_array_printk(struct trace_array *tr,
2864 + unsigned long ip, const char *fmt, ...)
2865 + {
2866 +@@ -2600,6 +2603,7 @@ int trace_array_printk(struct trace_array *tr,
2867 + return ret;
2868 + }
2869 +
2870 ++__printf(3, 4)
2871 + int trace_array_printk_buf(struct ring_buffer *buffer,
2872 + unsigned long ip, const char *fmt, ...)
2873 + {
2874 +@@ -2615,6 +2619,7 @@ int trace_array_printk_buf(struct ring_buffer *buffer,
2875 + return ret;
2876 + }
2877 +
2878 ++__printf(2, 0)
2879 + int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
2880 + {
2881 + return trace_array_vprintk(&global_trace, ip, fmt, args);
2882 +diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
2883 +index 73c258129257..4ce386c44cf1 100644
2884 +--- a/mm/kasan/kasan.c
2885 ++++ b/mm/kasan/kasan.c
2886 +@@ -660,12 +660,13 @@ void kasan_kfree_large(const void *ptr)
2887 + int kasan_module_alloc(void *addr, size_t size)
2888 + {
2889 + void *ret;
2890 ++ size_t scaled_size;
2891 + size_t shadow_size;
2892 + unsigned long shadow_start;
2893 +
2894 + shadow_start = (unsigned long)kasan_mem_to_shadow(addr);
2895 +- shadow_size = round_up(size >> KASAN_SHADOW_SCALE_SHIFT,
2896 +- PAGE_SIZE);
2897 ++ scaled_size = (size + KASAN_SHADOW_MASK) >> KASAN_SHADOW_SCALE_SHIFT;
2898 ++ shadow_size = round_up(scaled_size, PAGE_SIZE);
2899 +
2900 + if (WARN_ON(!PAGE_ALIGNED(shadow_start)))
2901 + return -EINVAL;
2902 +diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
2903 +index 946f1c269b1f..1ae8c59fcb2d 100644
2904 +--- a/net/batman-adv/bat_iv_ogm.c
2905 ++++ b/net/batman-adv/bat_iv_ogm.c
2906 +@@ -2704,7 +2704,7 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
2907 + {
2908 + struct batadv_neigh_ifinfo *router_ifinfo = NULL;
2909 + struct batadv_neigh_node *router;
2910 +- struct batadv_gw_node *curr_gw;
2911 ++ struct batadv_gw_node *curr_gw = NULL;
2912 + int ret = 0;
2913 + void *hdr;
2914 +
2915 +@@ -2752,6 +2752,8 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
2916 + ret = 0;
2917 +
2918 + out:
2919 ++ if (curr_gw)
2920 ++ batadv_gw_node_put(curr_gw);
2921 + if (router_ifinfo)
2922 + batadv_neigh_ifinfo_put(router_ifinfo);
2923 + if (router)
2924 +diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
2925 +index ed4ddf2059a6..4348118e7eac 100644
2926 +--- a/net/batman-adv/bat_v.c
2927 ++++ b/net/batman-adv/bat_v.c
2928 +@@ -919,7 +919,7 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
2929 + {
2930 + struct batadv_neigh_ifinfo *router_ifinfo = NULL;
2931 + struct batadv_neigh_node *router;
2932 +- struct batadv_gw_node *curr_gw;
2933 ++ struct batadv_gw_node *curr_gw = NULL;
2934 + int ret = 0;
2935 + void *hdr;
2936 +
2937 +@@ -987,6 +987,8 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
2938 + ret = 0;
2939 +
2940 + out:
2941 ++ if (curr_gw)
2942 ++ batadv_gw_node_put(curr_gw);
2943 + if (router_ifinfo)
2944 + batadv_neigh_ifinfo_put(router_ifinfo);
2945 + if (router)
2946 +diff --git a/net/core/dev.c b/net/core/dev.c
2947 +index 5407d5f7b2d0..b85e789044d5 100644
2948 +--- a/net/core/dev.c
2949 ++++ b/net/core/dev.c
2950 +@@ -7945,7 +7945,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
2951 + /* We get here if we can't use the current device name */
2952 + if (!pat)
2953 + goto out;
2954 +- if (dev_get_valid_name(net, dev, pat) < 0)
2955 ++ err = dev_get_valid_name(net, dev, pat);
2956 ++ if (err < 0)
2957 + goto out;
2958 + }
2959 +
2960 +@@ -7957,7 +7958,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
2961 + dev_close(dev);
2962 +
2963 + /* And unlink it from device chain */
2964 +- err = -ENODEV;
2965 + unlist_netdevice(dev);
2966 +
2967 + synchronize_net();
2968 +diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
2969 +index 83af5339e582..ba8bd24eb8b6 100644
2970 +--- a/net/ieee802154/6lowpan/core.c
2971 ++++ b/net/ieee802154/6lowpan/core.c
2972 +@@ -90,12 +90,18 @@ static int lowpan_neigh_construct(struct net_device *dev, struct neighbour *n)
2973 + return 0;
2974 + }
2975 +
2976 ++static int lowpan_get_iflink(const struct net_device *dev)
2977 ++{
2978 ++ return lowpan_802154_dev(dev)->wdev->ifindex;
2979 ++}
2980 ++
2981 + static const struct net_device_ops lowpan_netdev_ops = {
2982 + .ndo_init = lowpan_dev_init,
2983 + .ndo_start_xmit = lowpan_xmit,
2984 + .ndo_open = lowpan_open,
2985 + .ndo_stop = lowpan_stop,
2986 + .ndo_neigh_construct = lowpan_neigh_construct,
2987 ++ .ndo_get_iflink = lowpan_get_iflink,
2988 + };
2989 +
2990 + static void lowpan_setup(struct net_device *ldev)
2991 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
2992 +index 06aa4948d0c0..4822459e8f42 100644
2993 +--- a/net/ipv4/netfilter/ip_tables.c
2994 ++++ b/net/ipv4/netfilter/ip_tables.c
2995 +@@ -1913,6 +1913,7 @@ static struct xt_match ipt_builtin_mt[] __read_mostly = {
2996 + .checkentry = icmp_checkentry,
2997 + .proto = IPPROTO_ICMP,
2998 + .family = NFPROTO_IPV4,
2999 ++ .me = THIS_MODULE,
3000 + },
3001 + };
3002 +
3003 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
3004 +index 8f15eae3325b..9de77d946f5a 100644
3005 +--- a/net/ipv4/tcp.c
3006 ++++ b/net/ipv4/tcp.c
3007 +@@ -1696,7 +1696,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
3008 + * shouldn't happen.
3009 + */
3010 + if (WARN(before(*seq, TCP_SKB_CB(skb)->seq),
3011 +- "recvmsg bug: copied %X seq %X rcvnxt %X fl %X\n",
3012 ++ "TCP recvmsg seq # bug: copied %X, seq %X, rcvnxt %X, fl %X\n",
3013 + *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt,
3014 + flags))
3015 + break;
3016 +@@ -1711,7 +1711,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
3017 + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
3018 + goto found_fin_ok;
3019 + WARN(!(flags & MSG_PEEK),
3020 +- "recvmsg bug 2: copied %X seq %X rcvnxt %X fl %X\n",
3021 ++ "TCP recvmsg seq # bug 2: copied %X, seq %X, rcvnxt %X, fl %X\n",
3022 + *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt, flags);
3023 + }
3024 +
3025 +diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
3026 +index 8905a0aec8ee..a08cedf9d286 100644
3027 +--- a/net/ipv4/tcp_dctcp.c
3028 ++++ b/net/ipv4/tcp_dctcp.c
3029 +@@ -55,7 +55,6 @@ struct dctcp {
3030 + u32 dctcp_alpha;
3031 + u32 next_seq;
3032 + u32 ce_state;
3033 +- u32 delayed_ack_reserved;
3034 + u32 loss_cwnd;
3035 + };
3036 +
3037 +@@ -96,7 +95,6 @@ static void dctcp_init(struct sock *sk)
3038 +
3039 + ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA);
3040 +
3041 +- ca->delayed_ack_reserved = 0;
3042 + ca->loss_cwnd = 0;
3043 + ca->ce_state = 0;
3044 +
3045 +@@ -230,25 +228,6 @@ static void dctcp_state(struct sock *sk, u8 new_state)
3046 + }
3047 + }
3048 +
3049 +-static void dctcp_update_ack_reserved(struct sock *sk, enum tcp_ca_event ev)
3050 +-{
3051 +- struct dctcp *ca = inet_csk_ca(sk);
3052 +-
3053 +- switch (ev) {
3054 +- case CA_EVENT_DELAYED_ACK:
3055 +- if (!ca->delayed_ack_reserved)
3056 +- ca->delayed_ack_reserved = 1;
3057 +- break;
3058 +- case CA_EVENT_NON_DELAYED_ACK:
3059 +- if (ca->delayed_ack_reserved)
3060 +- ca->delayed_ack_reserved = 0;
3061 +- break;
3062 +- default:
3063 +- /* Don't care for the rest. */
3064 +- break;
3065 +- }
3066 +-}
3067 +-
3068 + static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
3069 + {
3070 + switch (ev) {
3071 +@@ -258,10 +237,6 @@ static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
3072 + case CA_EVENT_ECN_NO_CE:
3073 + dctcp_ce_state_1_to_0(sk);
3074 + break;
3075 +- case CA_EVENT_DELAYED_ACK:
3076 +- case CA_EVENT_NON_DELAYED_ACK:
3077 +- dctcp_update_ack_reserved(sk, ev);
3078 +- break;
3079 + default:
3080 + /* Don't care for the rest. */
3081 + break;
3082 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
3083 +index 5f916953b28e..bd68f073570b 100644
3084 +--- a/net/ipv4/tcp_output.c
3085 ++++ b/net/ipv4/tcp_output.c
3086 +@@ -3444,8 +3444,6 @@ void tcp_send_delayed_ack(struct sock *sk)
3087 + int ato = icsk->icsk_ack.ato;
3088 + unsigned long timeout;
3089 +
3090 +- tcp_ca_event(sk, CA_EVENT_DELAYED_ACK);
3091 +-
3092 + if (ato > TCP_DELACK_MIN) {
3093 + const struct tcp_sock *tp = tcp_sk(sk);
3094 + int max_ato = HZ / 2;
3095 +@@ -3502,8 +3500,6 @@ void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
3096 + if (sk->sk_state == TCP_CLOSE)
3097 + return;
3098 +
3099 +- tcp_ca_event(sk, CA_EVENT_NON_DELAYED_ACK);
3100 +-
3101 + /* We are not putting this on the write queue, so
3102 + * tcp_transmit_skb() will set the ownership to this
3103 + * sock.
3104 +diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
3105 +index 8d772fea1dde..9742abf5ac26 100644
3106 +--- a/net/ipv6/calipso.c
3107 ++++ b/net/ipv6/calipso.c
3108 +@@ -799,8 +799,7 @@ static int calipso_opt_update(struct sock *sk, struct ipv6_opt_hdr *hop)
3109 + {
3110 + struct ipv6_txoptions *old = txopt_get(inet6_sk(sk)), *txopts;
3111 +
3112 +- txopts = ipv6_renew_options_kern(sk, old, IPV6_HOPOPTS,
3113 +- hop, hop ? ipv6_optlen(hop) : 0);
3114 ++ txopts = ipv6_renew_options(sk, old, IPV6_HOPOPTS, hop);
3115 + txopt_put(old);
3116 + if (IS_ERR(txopts))
3117 + return PTR_ERR(txopts);
3118 +@@ -1222,8 +1221,7 @@ static int calipso_req_setattr(struct request_sock *req,
3119 + if (IS_ERR(new))
3120 + return PTR_ERR(new);
3121 +
3122 +- txopts = ipv6_renew_options_kern(sk, req_inet->ipv6_opt, IPV6_HOPOPTS,
3123 +- new, new ? ipv6_optlen(new) : 0);
3124 ++ txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
3125 +
3126 + kfree(new);
3127 +
3128 +@@ -1260,8 +1258,7 @@ static void calipso_req_delattr(struct request_sock *req)
3129 + if (calipso_opt_del(req_inet->ipv6_opt->hopopt, &new))
3130 + return; /* Nothing to do */
3131 +
3132 +- txopts = ipv6_renew_options_kern(sk, req_inet->ipv6_opt, IPV6_HOPOPTS,
3133 +- new, new ? ipv6_optlen(new) : 0);
3134 ++ txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
3135 +
3136 + if (!IS_ERR(txopts)) {
3137 + txopts = xchg(&req_inet->ipv6_opt, txopts);
3138 +diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
3139 +index 139ceb68bd37..b909c772453f 100644
3140 +--- a/net/ipv6/exthdrs.c
3141 ++++ b/net/ipv6/exthdrs.c
3142 +@@ -760,29 +760,21 @@ ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt)
3143 + }
3144 + EXPORT_SYMBOL_GPL(ipv6_dup_options);
3145 +
3146 +-static int ipv6_renew_option(void *ohdr,
3147 +- struct ipv6_opt_hdr __user *newopt, int newoptlen,
3148 +- int inherit,
3149 +- struct ipv6_opt_hdr **hdr,
3150 +- char **p)
3151 ++static void ipv6_renew_option(int renewtype,
3152 ++ struct ipv6_opt_hdr **dest,
3153 ++ struct ipv6_opt_hdr *old,
3154 ++ struct ipv6_opt_hdr *new,
3155 ++ int newtype, char **p)
3156 + {
3157 +- if (inherit) {
3158 +- if (ohdr) {
3159 +- memcpy(*p, ohdr, ipv6_optlen((struct ipv6_opt_hdr *)ohdr));
3160 +- *hdr = (struct ipv6_opt_hdr *)*p;
3161 +- *p += CMSG_ALIGN(ipv6_optlen(*hdr));
3162 +- }
3163 +- } else {
3164 +- if (newopt) {
3165 +- if (copy_from_user(*p, newopt, newoptlen))
3166 +- return -EFAULT;
3167 +- *hdr = (struct ipv6_opt_hdr *)*p;
3168 +- if (ipv6_optlen(*hdr) > newoptlen)
3169 +- return -EINVAL;
3170 +- *p += CMSG_ALIGN(newoptlen);
3171 +- }
3172 +- }
3173 +- return 0;
3174 ++ struct ipv6_opt_hdr *src;
3175 ++
3176 ++ src = (renewtype == newtype ? new : old);
3177 ++ if (!src)
3178 ++ return;
3179 ++
3180 ++ memcpy(*p, src, ipv6_optlen(src));
3181 ++ *dest = (struct ipv6_opt_hdr *)*p;
3182 ++ *p += CMSG_ALIGN(ipv6_optlen(*dest));
3183 + }
3184 +
3185 + /**
3186 +@@ -808,13 +800,11 @@ static int ipv6_renew_option(void *ohdr,
3187 + */
3188 + struct ipv6_txoptions *
3189 + ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
3190 +- int newtype,
3191 +- struct ipv6_opt_hdr __user *newopt, int newoptlen)
3192 ++ int newtype, struct ipv6_opt_hdr *newopt)
3193 + {
3194 + int tot_len = 0;
3195 + char *p;
3196 + struct ipv6_txoptions *opt2;
3197 +- int err;
3198 +
3199 + if (opt) {
3200 + if (newtype != IPV6_HOPOPTS && opt->hopopt)
3201 +@@ -827,8 +817,8 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
3202 + tot_len += CMSG_ALIGN(ipv6_optlen(opt->dst1opt));
3203 + }
3204 +
3205 +- if (newopt && newoptlen)
3206 +- tot_len += CMSG_ALIGN(newoptlen);
3207 ++ if (newopt)
3208 ++ tot_len += CMSG_ALIGN(ipv6_optlen(newopt));
3209 +
3210 + if (!tot_len)
3211 + return NULL;
3212 +@@ -843,29 +833,19 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
3213 + opt2->tot_len = tot_len;
3214 + p = (char *)(opt2 + 1);
3215 +
3216 +- err = ipv6_renew_option(opt ? opt->hopopt : NULL, newopt, newoptlen,
3217 +- newtype != IPV6_HOPOPTS,
3218 +- &opt2->hopopt, &p);
3219 +- if (err)
3220 +- goto out;
3221 +-
3222 +- err = ipv6_renew_option(opt ? opt->dst0opt : NULL, newopt, newoptlen,
3223 +- newtype != IPV6_RTHDRDSTOPTS,
3224 +- &opt2->dst0opt, &p);
3225 +- if (err)
3226 +- goto out;
3227 +-
3228 +- err = ipv6_renew_option(opt ? opt->srcrt : NULL, newopt, newoptlen,
3229 +- newtype != IPV6_RTHDR,
3230 +- (struct ipv6_opt_hdr **)&opt2->srcrt, &p);
3231 +- if (err)
3232 +- goto out;
3233 +-
3234 +- err = ipv6_renew_option(opt ? opt->dst1opt : NULL, newopt, newoptlen,
3235 +- newtype != IPV6_DSTOPTS,
3236 +- &opt2->dst1opt, &p);
3237 +- if (err)
3238 +- goto out;
3239 ++ ipv6_renew_option(IPV6_HOPOPTS, &opt2->hopopt,
3240 ++ (opt ? opt->hopopt : NULL),
3241 ++ newopt, newtype, &p);
3242 ++ ipv6_renew_option(IPV6_RTHDRDSTOPTS, &opt2->dst0opt,
3243 ++ (opt ? opt->dst0opt : NULL),
3244 ++ newopt, newtype, &p);
3245 ++ ipv6_renew_option(IPV6_RTHDR,
3246 ++ (struct ipv6_opt_hdr **)&opt2->srcrt,
3247 ++ (opt ? (struct ipv6_opt_hdr *)opt->srcrt : NULL),
3248 ++ newopt, newtype, &p);
3249 ++ ipv6_renew_option(IPV6_DSTOPTS, &opt2->dst1opt,
3250 ++ (opt ? opt->dst1opt : NULL),
3251 ++ newopt, newtype, &p);
3252 +
3253 + opt2->opt_nflen = (opt2->hopopt ? ipv6_optlen(opt2->hopopt) : 0) +
3254 + (opt2->dst0opt ? ipv6_optlen(opt2->dst0opt) : 0) +
3255 +@@ -873,37 +853,6 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
3256 + opt2->opt_flen = (opt2->dst1opt ? ipv6_optlen(opt2->dst1opt) : 0);
3257 +
3258 + return opt2;
3259 +-out:
3260 +- sock_kfree_s(sk, opt2, opt2->tot_len);
3261 +- return ERR_PTR(err);
3262 +-}
3263 +-
3264 +-/**
3265 +- * ipv6_renew_options_kern - replace a specific ext hdr with a new one.
3266 +- *
3267 +- * @sk: sock from which to allocate memory
3268 +- * @opt: original options
3269 +- * @newtype: option type to replace in @opt
3270 +- * @newopt: new option of type @newtype to replace (kernel-mem)
3271 +- * @newoptlen: length of @newopt
3272 +- *
3273 +- * See ipv6_renew_options(). The difference is that @newopt is
3274 +- * kernel memory, rather than user memory.
3275 +- */
3276 +-struct ipv6_txoptions *
3277 +-ipv6_renew_options_kern(struct sock *sk, struct ipv6_txoptions *opt,
3278 +- int newtype, struct ipv6_opt_hdr *newopt,
3279 +- int newoptlen)
3280 +-{
3281 +- struct ipv6_txoptions *ret_val;
3282 +- const mm_segment_t old_fs = get_fs();
3283 +-
3284 +- set_fs(KERNEL_DS);
3285 +- ret_val = ipv6_renew_options(sk, opt, newtype,
3286 +- (struct ipv6_opt_hdr __user *)newopt,
3287 +- newoptlen);
3288 +- set_fs(old_fs);
3289 +- return ret_val;
3290 + }
3291 +
3292 + struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
3293 +diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
3294 +index c66b9a87e995..81fd35ed8732 100644
3295 +--- a/net/ipv6/ipv6_sockglue.c
3296 ++++ b/net/ipv6/ipv6_sockglue.c
3297 +@@ -390,6 +390,12 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
3298 + case IPV6_DSTOPTS:
3299 + {
3300 + struct ipv6_txoptions *opt;
3301 ++ struct ipv6_opt_hdr *new = NULL;
3302 ++
3303 ++ /* hop-by-hop / destination options are privileged option */
3304 ++ retv = -EPERM;
3305 ++ if (optname != IPV6_RTHDR && !ns_capable(net->user_ns, CAP_NET_RAW))
3306 ++ break;
3307 +
3308 + /* remove any sticky options header with a zero option
3309 + * length, per RFC3542.
3310 +@@ -401,17 +407,22 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
3311 + else if (optlen < sizeof(struct ipv6_opt_hdr) ||
3312 + optlen & 0x7 || optlen > 8 * 255)
3313 + goto e_inval;
3314 +-
3315 +- /* hop-by-hop / destination options are privileged option */
3316 +- retv = -EPERM;
3317 +- if (optname != IPV6_RTHDR && !ns_capable(net->user_ns, CAP_NET_RAW))
3318 +- break;
3319 ++ else {
3320 ++ new = memdup_user(optval, optlen);
3321 ++ if (IS_ERR(new)) {
3322 ++ retv = PTR_ERR(new);
3323 ++ break;
3324 ++ }
3325 ++ if (unlikely(ipv6_optlen(new) > optlen)) {
3326 ++ kfree(new);
3327 ++ goto e_inval;
3328 ++ }
3329 ++ }
3330 +
3331 + opt = rcu_dereference_protected(np->opt,
3332 + lockdep_sock_is_held(sk));
3333 +- opt = ipv6_renew_options(sk, opt, optname,
3334 +- (struct ipv6_opt_hdr __user *)optval,
3335 +- optlen);
3336 ++ opt = ipv6_renew_options(sk, opt, optname, new);
3337 ++ kfree(new);
3338 + if (IS_ERR(opt)) {
3339 + retv = PTR_ERR(opt);
3340 + break;
3341 +diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
3342 +index 918c161e5b55..6c54c76847bf 100644
3343 +--- a/net/ipv6/mcast.c
3344 ++++ b/net/ipv6/mcast.c
3345 +@@ -2084,7 +2084,8 @@ void ipv6_mc_dad_complete(struct inet6_dev *idev)
3346 + mld_send_initial_cr(idev);
3347 + idev->mc_dad_count--;
3348 + if (idev->mc_dad_count)
3349 +- mld_dad_start_timer(idev, idev->mc_maxdelay);
3350 ++ mld_dad_start_timer(idev,
3351 ++ unsolicited_report_interval(idev));
3352 + }
3353 + }
3354 +
3355 +@@ -2096,7 +2097,8 @@ static void mld_dad_timer_expire(unsigned long data)
3356 + if (idev->mc_dad_count) {
3357 + idev->mc_dad_count--;
3358 + if (idev->mc_dad_count)
3359 +- mld_dad_start_timer(idev, idev->mc_maxdelay);
3360 ++ mld_dad_start_timer(idev,
3361 ++ unsolicited_report_interval(idev));
3362 + }
3363 + in6_dev_put(idev);
3364 + }
3365 +@@ -2454,7 +2456,8 @@ static void mld_ifc_timer_expire(unsigned long data)
3366 + if (idev->mc_ifc_count) {
3367 + idev->mc_ifc_count--;
3368 + if (idev->mc_ifc_count)
3369 +- mld_ifc_start_timer(idev, idev->mc_maxdelay);
3370 ++ mld_ifc_start_timer(idev,
3371 ++ unsolicited_report_interval(idev));
3372 + }
3373 + in6_dev_put(idev);
3374 + }
3375 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
3376 +index 180f19526a80..21cad30e4546 100644
3377 +--- a/net/ipv6/netfilter/ip6_tables.c
3378 ++++ b/net/ipv6/netfilter/ip6_tables.c
3379 +@@ -1934,6 +1934,7 @@ static struct xt_match ip6t_builtin_mt[] __read_mostly = {
3380 + .checkentry = icmp6_checkentry,
3381 + .proto = IPPROTO_ICMPV6,
3382 + .family = NFPROTO_IPV6,
3383 ++ .me = THIS_MODULE,
3384 + },
3385 + };
3386 +
3387 +diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
3388 +index 722a9db8c6a7..ee33a6743f3b 100644
3389 +--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
3390 ++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
3391 +@@ -117,7 +117,7 @@ static int nf_ct_frag6_sysctl_register(struct net *net)
3392 + if (hdr == NULL)
3393 + goto err_reg;
3394 +
3395 +- net->nf_frag.sysctl.frags_hdr = hdr;
3396 ++ net->nf_frag_frags_hdr = hdr;
3397 + return 0;
3398 +
3399 + err_reg:
3400 +@@ -131,8 +131,8 @@ static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net)
3401 + {
3402 + struct ctl_table *table;
3403 +
3404 +- table = net->nf_frag.sysctl.frags_hdr->ctl_table_arg;
3405 +- unregister_net_sysctl_table(net->nf_frag.sysctl.frags_hdr);
3406 ++ table = net->nf_frag_frags_hdr->ctl_table_arg;
3407 ++ unregister_net_sysctl_table(net->nf_frag_frags_hdr);
3408 + if (!net_eq(net, &init_net))
3409 + kfree(table);
3410 + }
3411 +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
3412 +index 2039fd7daf4e..db3586ba1211 100644
3413 +--- a/net/netfilter/nf_conntrack_core.c
3414 ++++ b/net/netfilter/nf_conntrack_core.c
3415 +@@ -1822,7 +1822,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
3416 + return -EOPNOTSUPP;
3417 +
3418 + /* On boot, we can set this without any fancy locking. */
3419 +- if (!nf_conntrack_htable_size)
3420 ++ if (!nf_conntrack_hash)
3421 + return param_set_uint(val, kp);
3422 +
3423 + rc = kstrtouint(val, 0, &hashsize);
3424 +diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c
3425 +index a45bee52dccc..d5560ae8c4b3 100644
3426 +--- a/net/netfilter/nf_conntrack_proto_dccp.c
3427 ++++ b/net/netfilter/nf_conntrack_proto_dccp.c
3428 +@@ -244,14 +244,14 @@ dccp_state_table[CT_DCCP_ROLE_MAX + 1][DCCP_PKT_SYNCACK + 1][CT_DCCP_MAX + 1] =
3429 + * We currently ignore Sync packets
3430 + *
3431 + * sNO, sRQ, sRS, sPO, sOP, sCR, sCG, sTW */
3432 +- sIG, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3433 ++ sIV, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3434 + },
3435 + [DCCP_PKT_SYNCACK] = {
3436 + /*
3437 + * We currently ignore SyncAck packets
3438 + *
3439 + * sNO, sRQ, sRS, sPO, sOP, sCR, sCG, sTW */
3440 +- sIG, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3441 ++ sIV, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3442 + },
3443 + },
3444 + [CT_DCCP_ROLE_SERVER] = {
3445 +@@ -372,14 +372,14 @@ dccp_state_table[CT_DCCP_ROLE_MAX + 1][DCCP_PKT_SYNCACK + 1][CT_DCCP_MAX + 1] =
3446 + * We currently ignore Sync packets
3447 + *
3448 + * sNO, sRQ, sRS, sPO, sOP, sCR, sCG, sTW */
3449 +- sIG, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3450 ++ sIV, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3451 + },
3452 + [DCCP_PKT_SYNCACK] = {
3453 + /*
3454 + * We currently ignore SyncAck packets
3455 + *
3456 + * sNO, sRQ, sRS, sPO, sOP, sCR, sCG, sTW */
3457 +- sIG, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3458 ++ sIV, sIG, sIG, sIG, sIG, sIG, sIG, sIG,
3459 + },
3460 + },
3461 + };
3462 +diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
3463 +index e02fed784cd0..42938f9c467e 100644
3464 +--- a/net/netfilter/nf_log.c
3465 ++++ b/net/netfilter/nf_log.c
3466 +@@ -426,6 +426,10 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write,
3467 + if (write) {
3468 + struct ctl_table tmp = *table;
3469 +
3470 ++ /* proc_dostring() can append to existing strings, so we need to
3471 ++ * initialize it as an empty string.
3472 ++ */
3473 ++ buf[0] = '\0';
3474 + tmp.data = buf;
3475 + r = proc_dostring(&tmp, write, buffer, lenp, ppos);
3476 + if (r)
3477 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
3478 +index ea601f7ca2f8..24412e8f4061 100644
3479 +--- a/net/packet/af_packet.c
3480 ++++ b/net/packet/af_packet.c
3481 +@@ -2917,6 +2917,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
3482 + goto out_free;
3483 + } else if (reserve) {
3484 + skb_reserve(skb, -reserve);
3485 ++ if (len < reserve)
3486 ++ skb_reset_network_header(skb);
3487 + }
3488 +
3489 + /* Returns -EFAULT on error */
3490 +@@ -4273,6 +4275,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
3491 + }
3492 +
3493 + if (req->tp_block_nr) {
3494 ++ unsigned int min_frame_size;
3495 ++
3496 + /* Sanity tests and some calculations */
3497 + err = -EBUSY;
3498 + if (unlikely(rb->pg_vec))
3499 +@@ -4295,12 +4299,12 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
3500 + goto out;
3501 + if (unlikely(!PAGE_ALIGNED(req->tp_block_size)))
3502 + goto out;
3503 ++ min_frame_size = po->tp_hdrlen + po->tp_reserve;
3504 + if (po->tp_version >= TPACKET_V3 &&
3505 +- req->tp_block_size <=
3506 +- BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + sizeof(struct tpacket3_hdr))
3507 ++ req->tp_block_size <
3508 ++ BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + min_frame_size)
3509 + goto out;
3510 +- if (unlikely(req->tp_frame_size < po->tp_hdrlen +
3511 +- po->tp_reserve))
3512 ++ if (unlikely(req->tp_frame_size < min_frame_size))
3513 + goto out;
3514 + if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1)))
3515 + goto out;
3516 +diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
3517 +index ae5ac175b2be..7b670a9a375e 100644
3518 +--- a/net/qrtr/qrtr.c
3519 ++++ b/net/qrtr/qrtr.c
3520 +@@ -621,6 +621,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
3521 + node = NULL;
3522 + if (addr->sq_node == QRTR_NODE_BCAST) {
3523 + enqueue_fn = qrtr_bcast_enqueue;
3524 ++ if (addr->sq_port != QRTR_PORT_CTRL) {
3525 ++ release_sock(sk);
3526 ++ return -ENOTCONN;
3527 ++ }
3528 + } else if (addr->sq_node == ipc->us.sq_node) {
3529 + enqueue_fn = qrtr_local_enqueue;
3530 + } else {
3531 +diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
3532 +index 901fb8bb9dce..41835f6e86bc 100644
3533 +--- a/net/sched/act_tunnel_key.c
3534 ++++ b/net/sched/act_tunnel_key.c
3535 +@@ -39,7 +39,7 @@ static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
3536 +
3537 + tcf_lastuse_update(&t->tcf_tm);
3538 + bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
3539 +- action = params->action;
3540 ++ action = READ_ONCE(t->tcf_action);
3541 +
3542 + switch (params->tcft_action) {
3543 + case TCA_TUNNEL_KEY_ACT_RELEASE:
3544 +@@ -170,7 +170,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
3545 +
3546 + params_old = rtnl_dereference(t->params);
3547 +
3548 +- params_new->action = parm->action;
3549 ++ t->tcf_action = parm->action;
3550 + params_new->tcft_action = parm->t_action;
3551 + params_new->tcft_enc_metadata = metadata;
3552 +
3553 +@@ -242,13 +242,13 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a,
3554 + .index = t->tcf_index,
3555 + .refcnt = t->tcf_refcnt - ref,
3556 + .bindcnt = t->tcf_bindcnt - bind,
3557 ++ .action = t->tcf_action,
3558 + };
3559 + struct tcf_t tm;
3560 +
3561 + params = rtnl_dereference(t->params);
3562 +
3563 + opt.t_action = params->tcft_action;
3564 +- opt.action = params->action;
3565 +
3566 + if (nla_put(skb, TCA_TUNNEL_KEY_PARMS, sizeof(opt), &opt))
3567 + goto nla_put_failure;
3568 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
3569 +index 36280e114959..5b75468b5acd 100644
3570 +--- a/net/wireless/nl80211.c
3571 ++++ b/net/wireless/nl80211.c
3572 +@@ -5847,7 +5847,7 @@ do { \
3573 + nl80211_check_s32);
3574 + /*
3575 + * Check HT operation mode based on
3576 +- * IEEE 802.11 2012 8.4.2.59 HT Operation element.
3577 ++ * IEEE 802.11-2016 9.4.2.57 HT Operation element.
3578 + */
3579 + if (tb[NL80211_MESHCONF_HT_OPMODE]) {
3580 + ht_opmode = nla_get_u16(tb[NL80211_MESHCONF_HT_OPMODE]);
3581 +@@ -5857,22 +5857,9 @@ do { \
3582 + IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
3583 + return -EINVAL;
3584 +
3585 +- if ((ht_opmode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) &&
3586 +- (ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
3587 +- return -EINVAL;
3588 ++ /* NON_HT_STA bit is reserved, but some programs set it */
3589 ++ ht_opmode &= ~IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT;
3590 +
3591 +- switch (ht_opmode & IEEE80211_HT_OP_MODE_PROTECTION) {
3592 +- case IEEE80211_HT_OP_MODE_PROTECTION_NONE:
3593 +- case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
3594 +- if (ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT)
3595 +- return -EINVAL;
3596 +- break;
3597 +- case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
3598 +- case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED:
3599 +- if (!(ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
3600 +- return -EINVAL;
3601 +- break;
3602 +- }
3603 + cfg->ht_opmode = ht_opmode;
3604 + mask |= (1 << (NL80211_MESHCONF_HT_OPMODE - 1));
3605 + }
3606 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
3607 +index 6a029358bfd1..bb61956c0f9c 100644
3608 +--- a/net/xfrm/xfrm_user.c
3609 ++++ b/net/xfrm/xfrm_user.c
3610 +@@ -1628,9 +1628,11 @@ static inline size_t userpolicy_type_attrsize(void)
3611 + #ifdef CONFIG_XFRM_SUB_POLICY
3612 + static int copy_to_user_policy_type(u8 type, struct sk_buff *skb)
3613 + {
3614 +- struct xfrm_userpolicy_type upt = {
3615 +- .type = type,
3616 +- };
3617 ++ struct xfrm_userpolicy_type upt;
3618 ++
3619 ++ /* Sadly there are two holes in struct xfrm_userpolicy_type */
3620 ++ memset(&upt, 0, sizeof(upt));
3621 ++ upt.type = type;
3622 +
3623 + return nla_put(skb, XFRMA_POLICY_TYPE, sizeof(upt), &upt);
3624 + }
3625 +diff --git a/samples/bpf/parse_varlen.c b/samples/bpf/parse_varlen.c
3626 +index 95c16324760c..0b6f22feb2c9 100644
3627 +--- a/samples/bpf/parse_varlen.c
3628 ++++ b/samples/bpf/parse_varlen.c
3629 +@@ -6,6 +6,7 @@
3630 + */
3631 + #define KBUILD_MODNAME "foo"
3632 + #include <linux/if_ether.h>
3633 ++#include <linux/if_vlan.h>
3634 + #include <linux/ip.h>
3635 + #include <linux/ipv6.h>
3636 + #include <linux/in.h>
3637 +@@ -108,11 +109,6 @@ static int parse_ipv6(void *data, uint64_t nh_off, void *data_end)
3638 + return 0;
3639 + }
3640 +
3641 +-struct vlan_hdr {
3642 +- uint16_t h_vlan_TCI;
3643 +- uint16_t h_vlan_encapsulated_proto;
3644 +-};
3645 +-
3646 + SEC("varlen")
3647 + int handle_ingress(struct __sk_buff *skb)
3648 + {
3649 +diff --git a/samples/bpf/test_overhead_user.c b/samples/bpf/test_overhead_user.c
3650 +index d291167fd3c7..7dad9a3168e1 100644
3651 +--- a/samples/bpf/test_overhead_user.c
3652 ++++ b/samples/bpf/test_overhead_user.c
3653 +@@ -6,6 +6,7 @@
3654 + */
3655 + #define _GNU_SOURCE
3656 + #include <sched.h>
3657 ++#include <errno.h>
3658 + #include <stdio.h>
3659 + #include <sys/types.h>
3660 + #include <asm/unistd.h>
3661 +@@ -44,8 +45,13 @@ static void test_task_rename(int cpu)
3662 + exit(1);
3663 + }
3664 + start_time = time_get_ns();
3665 +- for (i = 0; i < MAX_CNT; i++)
3666 +- write(fd, buf, sizeof(buf));
3667 ++ for (i = 0; i < MAX_CNT; i++) {
3668 ++ if (write(fd, buf, sizeof(buf)) < 0) {
3669 ++ printf("task rename failed: %s\n", strerror(errno));
3670 ++ close(fd);
3671 ++ return;
3672 ++ }
3673 ++ }
3674 + printf("task_rename:%d: %lld events per sec\n",
3675 + cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
3676 + close(fd);
3677 +@@ -63,8 +69,13 @@ static void test_urandom_read(int cpu)
3678 + exit(1);
3679 + }
3680 + start_time = time_get_ns();
3681 +- for (i = 0; i < MAX_CNT; i++)
3682 +- read(fd, buf, sizeof(buf));
3683 ++ for (i = 0; i < MAX_CNT; i++) {
3684 ++ if (read(fd, buf, sizeof(buf)) < 0) {
3685 ++ printf("failed to read from /dev/urandom: %s\n", strerror(errno));
3686 ++ close(fd);
3687 ++ return;
3688 ++ }
3689 ++ }
3690 + printf("urandom_read:%d: %lld events per sec\n",
3691 + cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
3692 + close(fd);
3693 +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
3694 +index a8a7fbc377f6..ca3ea985c100 100644
3695 +--- a/security/smack/smack_lsm.c
3696 ++++ b/security/smack/smack_lsm.c
3697 +@@ -2307,6 +2307,7 @@ static void smack_task_to_inode(struct task_struct *p, struct inode *inode)
3698 + struct smack_known *skp = smk_of_task_struct(p);
3699 +
3700 + isp->smk_inode = skp;
3701 ++ isp->smk_flags |= SMK_INODE_INSTANT;
3702 + }
3703 +
3704 + /*
3705 +diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
3706 +index ecd1c5fc8db8..965473d4129c 100644
3707 +--- a/sound/core/seq/seq_clientmgr.c
3708 ++++ b/sound/core/seq/seq_clientmgr.c
3709 +@@ -2002,7 +2002,8 @@ static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
3710 + struct snd_seq_client *cptr = NULL;
3711 +
3712 + /* search for next client */
3713 +- info->client++;
3714 ++ if (info->client < INT_MAX)
3715 ++ info->client++;
3716 + if (info->client < 0)
3717 + info->client = 0;
3718 + for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) {
3719 +diff --git a/tools/build/Makefile b/tools/build/Makefile
3720 +index 8332959fbca4..20d9ae11b6e1 100644
3721 +--- a/tools/build/Makefile
3722 ++++ b/tools/build/Makefile
3723 +@@ -42,7 +42,7 @@ $(OUTPUT)fixdep-in.o: FORCE
3724 + $(Q)$(MAKE) $(build)=fixdep
3725 +
3726 + $(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
3727 +- $(QUIET_LINK)$(HOSTCC) $(LDFLAGS) -o $@ $<
3728 ++ $(QUIET_LINK)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $<
3729 +
3730 + FORCE:
3731 +
3732 +diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
3733 +index 4e60e105583e..0d1acb704f64 100644
3734 +--- a/tools/objtool/elf.c
3735 ++++ b/tools/objtool/elf.c
3736 +@@ -302,19 +302,34 @@ static int read_symbols(struct elf *elf)
3737 + continue;
3738 + sym->pfunc = sym->cfunc = sym;
3739 + coldstr = strstr(sym->name, ".cold.");
3740 +- if (coldstr) {
3741 +- coldstr[0] = '\0';
3742 +- pfunc = find_symbol_by_name(elf, sym->name);
3743 +- coldstr[0] = '.';
3744 +-
3745 +- if (!pfunc) {
3746 +- WARN("%s(): can't find parent function",
3747 +- sym->name);
3748 +- goto err;
3749 +- }
3750 +-
3751 +- sym->pfunc = pfunc;
3752 +- pfunc->cfunc = sym;
3753 ++ if (!coldstr)
3754 ++ continue;
3755 ++
3756 ++ coldstr[0] = '\0';
3757 ++ pfunc = find_symbol_by_name(elf, sym->name);
3758 ++ coldstr[0] = '.';
3759 ++
3760 ++ if (!pfunc) {
3761 ++ WARN("%s(): can't find parent function",
3762 ++ sym->name);
3763 ++ goto err;
3764 ++ }
3765 ++
3766 ++ sym->pfunc = pfunc;
3767 ++ pfunc->cfunc = sym;
3768 ++
3769 ++ /*
3770 ++ * Unfortunately, -fnoreorder-functions puts the child
3771 ++ * inside the parent. Remove the overlap so we can
3772 ++ * have sane assumptions.
3773 ++ *
3774 ++ * Note that pfunc->len now no longer matches
3775 ++ * pfunc->sym.st_size.
3776 ++ */
3777 ++ if (sym->sec == pfunc->sec &&
3778 ++ sym->offset >= pfunc->offset &&
3779 ++ sym->offset + sym->len == pfunc->offset + pfunc->len) {
3780 ++ pfunc->len -= sym->len;
3781 + }
3782 + }
3783 + }
3784 +diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
3785 +index 0c370f81e002..bd630c222e65 100644
3786 +--- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
3787 ++++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
3788 +@@ -243,7 +243,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
3789 + u64 ip;
3790 + u64 skip_slot = -1;
3791 +
3792 +- if (chain->nr < 3)
3793 ++ if (!chain || chain->nr < 3)
3794 + return skip_slot;
3795 +
3796 + ip = chain->ips[2];
3797 +diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
3798 +index 23cce5e5197a..ee9565a033f4 100644
3799 +--- a/tools/perf/bench/numa.c
3800 ++++ b/tools/perf/bench/numa.c
3801 +@@ -1093,7 +1093,7 @@ static void *worker_thread(void *__tdata)
3802 + u8 *global_data;
3803 + u8 *process_data;
3804 + u8 *thread_data;
3805 +- u64 bytes_done;
3806 ++ u64 bytes_done, secs;
3807 + long work_done;
3808 + u32 l;
3809 + struct rusage rusage;
3810 +@@ -1249,7 +1249,8 @@ static void *worker_thread(void *__tdata)
3811 + timersub(&stop, &start0, &diff);
3812 + td->runtime_ns = diff.tv_sec * NSEC_PER_SEC;
3813 + td->runtime_ns += diff.tv_usec * NSEC_PER_USEC;
3814 +- td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9;
3815 ++ secs = td->runtime_ns / NSEC_PER_SEC;
3816 ++ td->speed_gbs = secs ? bytes_done / secs / 1e9 : 0;
3817 +
3818 + getrusage(RUSAGE_THREAD, &rusage);
3819 + td->system_time_ns = rusage.ru_stime.tv_sec * NSEC_PER_SEC;
3820 +diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
3821 +index 98fe69ac553c..3e7cdefb0817 100644
3822 +--- a/tools/perf/tests/topology.c
3823 ++++ b/tools/perf/tests/topology.c
3824 +@@ -42,6 +42,7 @@ static int session_write_header(char *path)
3825 +
3826 + perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
3827 + perf_header__set_feat(&session->header, HEADER_NRCPUS);
3828 ++ perf_header__set_feat(&session->header, HEADER_ARCH);
3829 +
3830 + session->header.data_size += DATA_SIZE;
3831 +
3832 +diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c
3833 +index bf7216b8731d..621f6527b790 100644
3834 +--- a/tools/perf/util/llvm-utils.c
3835 ++++ b/tools/perf/util/llvm-utils.c
3836 +@@ -260,16 +260,16 @@ static const char *kinc_fetch_script =
3837 + "#!/usr/bin/env sh\n"
3838 + "if ! test -d \"$KBUILD_DIR\"\n"
3839 + "then\n"
3840 +-" exit -1\n"
3841 ++" exit 1\n"
3842 + "fi\n"
3843 + "if ! test -f \"$KBUILD_DIR/include/generated/autoconf.h\"\n"
3844 + "then\n"
3845 +-" exit -1\n"
3846 ++" exit 1\n"
3847 + "fi\n"
3848 + "TMPDIR=`mktemp -d`\n"
3849 + "if test -z \"$TMPDIR\"\n"
3850 + "then\n"
3851 +-" exit -1\n"
3852 ++" exit 1\n"
3853 + "fi\n"
3854 + "cat << EOF > $TMPDIR/Makefile\n"
3855 + "obj-y := dummy.o\n"
3856 +diff --git a/tools/testing/selftests/pstore/pstore_post_reboot_tests b/tools/testing/selftests/pstore/pstore_post_reboot_tests
3857 +index 6ccb154cb4aa..22f8df1ad7d4 100755
3858 +--- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
3859 ++++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
3860 +@@ -7,13 +7,16 @@
3861 + #
3862 + # Released under the terms of the GPL v2.
3863 +
3864 ++# Kselftest framework requirement - SKIP code is 4.
3865 ++ksft_skip=4
3866 ++
3867 + . ./common_tests
3868 +
3869 + if [ -e $REBOOT_FLAG ]; then
3870 + rm $REBOOT_FLAG
3871 + else
3872 + prlog "pstore_crash_test has not been executed yet. we skip further tests."
3873 +- exit 0
3874 ++ exit $ksft_skip
3875 + fi
3876 +
3877 + prlog -n "Mounting pstore filesystem ... "
3878 +diff --git a/tools/testing/selftests/static_keys/test_static_keys.sh b/tools/testing/selftests/static_keys/test_static_keys.sh
3879 +index 1261e3fa1e3a..5bba7796fb34 100755
3880 +--- a/tools/testing/selftests/static_keys/test_static_keys.sh
3881 ++++ b/tools/testing/selftests/static_keys/test_static_keys.sh
3882 +@@ -1,6 +1,19 @@
3883 + #!/bin/sh
3884 + # Runs static keys kernel module tests
3885 +
3886 ++# Kselftest framework requirement - SKIP code is 4.
3887 ++ksft_skip=4
3888 ++
3889 ++if ! /sbin/modprobe -q -n test_static_key_base; then
3890 ++ echo "static_key: module test_static_key_base is not found [SKIP]"
3891 ++ exit $ksft_skip
3892 ++fi
3893 ++
3894 ++if ! /sbin/modprobe -q -n test_static_keys; then
3895 ++ echo "static_key: module test_static_keys is not found [SKIP]"
3896 ++ exit $ksft_skip
3897 ++fi
3898 ++
3899 + if /sbin/modprobe -q test_static_key_base; then
3900 + if /sbin/modprobe -q test_static_keys; then
3901 + echo "static_key: ok"
3902 +diff --git a/tools/testing/selftests/sync/config b/tools/testing/selftests/sync/config
3903 +new file mode 100644
3904 +index 000000000000..1ab7e8130db2
3905 +--- /dev/null
3906 ++++ b/tools/testing/selftests/sync/config
3907 +@@ -0,0 +1,4 @@
3908 ++CONFIG_STAGING=y
3909 ++CONFIG_ANDROID=y
3910 ++CONFIG_SYNC=y
3911 ++CONFIG_SW_SYNC=y
3912 +diff --git a/tools/testing/selftests/user/test_user_copy.sh b/tools/testing/selftests/user/test_user_copy.sh
3913 +index 350107f40c1d..0409270f998c 100755
3914 +--- a/tools/testing/selftests/user/test_user_copy.sh
3915 ++++ b/tools/testing/selftests/user/test_user_copy.sh
3916 +@@ -1,6 +1,13 @@
3917 + #!/bin/sh
3918 + # Runs copy_to/from_user infrastructure using test_user_copy kernel module
3919 +
3920 ++# Kselftest framework requirement - SKIP code is 4.
3921 ++ksft_skip=4
3922 ++
3923 ++if ! /sbin/modprobe -q -n test_user_copy; then
3924 ++ echo "user: module test_user_copy is not found [SKIP]"
3925 ++ exit $ksft_skip
3926 ++fi
3927 + if /sbin/modprobe -q test_user_copy; then
3928 + /sbin/modprobe -q -r test_user_copy
3929 + echo "user_copy: ok"
3930 +diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c
3931 +index 246145b84a12..4d9dc3f2fd70 100644
3932 +--- a/tools/testing/selftests/x86/sigreturn.c
3933 ++++ b/tools/testing/selftests/x86/sigreturn.c
3934 +@@ -610,21 +610,41 @@ static int test_valid_sigreturn(int cs_bits, bool use_16bit_ss, int force_ss)
3935 + */
3936 + for (int i = 0; i < NGREG; i++) {
3937 + greg_t req = requested_regs[i], res = resulting_regs[i];
3938 ++
3939 + if (i == REG_TRAPNO || i == REG_IP)
3940 + continue; /* don't care */
3941 +- if (i == REG_SP) {
3942 +- printf("\tSP: %llx -> %llx\n", (unsigned long long)req,
3943 +- (unsigned long long)res);
3944 +
3945 ++ if (i == REG_SP) {
3946 + /*
3947 +- * In many circumstances, the high 32 bits of rsp
3948 +- * are zeroed. For example, we could be a real
3949 +- * 32-bit program, or we could hit any of a number
3950 +- * of poorly-documented IRET or segmented ESP
3951 +- * oddities. If this happens, it's okay.
3952 ++ * If we were using a 16-bit stack segment, then
3953 ++ * the kernel is a bit stuck: IRET only restores
3954 ++ * the low 16 bits of ESP/RSP if SS is 16-bit.
3955 ++ * The kernel uses a hack to restore bits 31:16,
3956 ++ * but that hack doesn't help with bits 63:32.
3957 ++ * On Intel CPUs, bits 63:32 end up zeroed, and, on
3958 ++ * AMD CPUs, they leak the high bits of the kernel
3959 ++ * espfix64 stack pointer. There's very little that
3960 ++ * the kernel can do about it.
3961 ++ *
3962 ++ * Similarly, if we are returning to a 32-bit context,
3963 ++ * the CPU will often lose the high 32 bits of RSP.
3964 + */
3965 +- if (res == (req & 0xFFFFFFFF))
3966 +- continue; /* OK; not expected to work */
3967 ++
3968 ++ if (res == req)
3969 ++ continue;
3970 ++
3971 ++ if (cs_bits != 64 && ((res ^ req) & 0xFFFFFFFF) == 0) {
3972 ++ printf("[NOTE]\tSP: %llx -> %llx\n",
3973 ++ (unsigned long long)req,
3974 ++ (unsigned long long)res);
3975 ++ continue;
3976 ++ }
3977 ++
3978 ++ printf("[FAIL]\tSP mismatch: requested 0x%llx; got 0x%llx\n",
3979 ++ (unsigned long long)requested_regs[i],
3980 ++ (unsigned long long)resulting_regs[i]);
3981 ++ nerrs++;
3982 ++ continue;
3983 + }
3984 +
3985 + bool ignore_reg = false;
3986 +@@ -654,25 +674,18 @@ static int test_valid_sigreturn(int cs_bits, bool use_16bit_ss, int force_ss)
3987 + #endif
3988 +
3989 + /* Sanity check on the kernel */
3990 +- if (i == REG_CX && requested_regs[i] != resulting_regs[i]) {
3991 ++ if (i == REG_CX && req != res) {
3992 + printf("[FAIL]\tCX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n",
3993 +- (unsigned long long)requested_regs[i],
3994 +- (unsigned long long)resulting_regs[i]);
3995 ++ (unsigned long long)req,
3996 ++ (unsigned long long)res);
3997 + nerrs++;
3998 + continue;
3999 + }
4000 +
4001 +- if (requested_regs[i] != resulting_regs[i] && !ignore_reg) {
4002 +- /*
4003 +- * SP is particularly interesting here. The
4004 +- * usual cause of failures is that we hit the
4005 +- * nasty IRET case of returning to a 16-bit SS,
4006 +- * in which case bits 16:31 of the *kernel*
4007 +- * stack pointer persist in ESP.
4008 +- */
4009 ++ if (req != res && !ignore_reg) {
4010 + printf("[FAIL]\tReg %d mismatch: requested 0x%llx; got 0x%llx\n",
4011 +- i, (unsigned long long)requested_regs[i],
4012 +- (unsigned long long)resulting_regs[i]);
4013 ++ i, (unsigned long long)req,
4014 ++ (unsigned long long)res);
4015 + nerrs++;
4016 + }
4017 + }
4018 +diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh
4019 +index 683a292e3290..9399c4aeaa26 100755
4020 +--- a/tools/testing/selftests/zram/zram.sh
4021 ++++ b/tools/testing/selftests/zram/zram.sh
4022 +@@ -1,6 +1,9 @@
4023 + #!/bin/bash
4024 + TCID="zram.sh"
4025 +
4026 ++# Kselftest framework requirement - SKIP code is 4.
4027 ++ksft_skip=4
4028 ++
4029 + . ./zram_lib.sh
4030 +
4031 + run_zram () {
4032 +@@ -23,5 +26,5 @@ elif [ -b /dev/zram0 ]; then
4033 + else
4034 + echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
4035 + echo "$TCID : CONFIG_ZRAM is not set"
4036 +- exit 1
4037 ++ exit $ksft_skip
4038 + fi
4039 +diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh
4040 +index f6a9c73e7a44..9e73a4fb9b0a 100755
4041 +--- a/tools/testing/selftests/zram/zram_lib.sh
4042 ++++ b/tools/testing/selftests/zram/zram_lib.sh
4043 +@@ -18,6 +18,9 @@ MODULE=0
4044 + dev_makeswap=-1
4045 + dev_mounted=-1
4046 +
4047 ++# Kselftest framework requirement - SKIP code is 4.
4048 ++ksft_skip=4
4049 ++
4050 + trap INT
4051 +
4052 + check_prereqs()
4053 +@@ -27,7 +30,7 @@ check_prereqs()
4054 +
4055 + if [ $uid -ne 0 ]; then
4056 + echo $msg must be run as root >&2
4057 +- exit 0
4058 ++ exit $ksft_skip
4059 + fi
4060 + }
4061 +
4062 +diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
4063 +index f1320063db28..c7924718990e 100644
4064 +--- a/virt/kvm/arm/vgic/vgic-v3.c
4065 ++++ b/virt/kvm/arm/vgic/vgic-v3.c
4066 +@@ -337,11 +337,6 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
4067 + pr_warn("GICV physical address 0x%llx not page aligned\n",
4068 + (unsigned long long)info->vcpu.start);
4069 + kvm_vgic_global_state.vcpu_base = 0;
4070 +- } else if (!PAGE_ALIGNED(resource_size(&info->vcpu))) {
4071 +- pr_warn("GICV size 0x%llx not a multiple of page size 0x%lx\n",
4072 +- (unsigned long long)resource_size(&info->vcpu),
4073 +- PAGE_SIZE);
4074 +- kvm_vgic_global_state.vcpu_base = 0;
4075 + } else {
4076 + kvm_vgic_global_state.vcpu_base = info->vcpu.start;
4077 + kvm_vgic_global_state.can_emulate_gicv2 = true;
4078 +diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
4079 +index 3f24eb1e8554..16e17ea06e1e 100644
4080 +--- a/virt/kvm/eventfd.c
4081 ++++ b/virt/kvm/eventfd.c
4082 +@@ -405,11 +405,6 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
4083 + if (events & POLLIN)
4084 + schedule_work(&irqfd->inject);
4085 +
4086 +- /*
4087 +- * do not drop the file until the irqfd is fully initialized, otherwise
4088 +- * we might race against the POLLHUP
4089 +- */
4090 +- fdput(f);
4091 + #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
4092 + if (kvm_arch_has_irq_bypass()) {
4093 + irqfd->consumer.token = (void *)irqfd->eventfd;
4094 +@@ -425,6 +420,12 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
4095 + #endif
4096 +
4097 + srcu_read_unlock(&kvm->irq_srcu, idx);
4098 ++
4099 ++ /*
4100 ++ * do not drop the file until the irqfd is fully initialized, otherwise
4101 ++ * we might race against the POLLHUP
4102 ++ */
4103 ++ fdput(f);
4104 + return 0;
4105 +
4106 + fail: