Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0223-4.9.124-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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