Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0103-4.9.4-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (hide annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 8 months ago) by niro
File size: 58683 byte(s)
-added kerenl-alx-legacy pkg
1 niro 3608 diff --git a/Makefile b/Makefile
2     index ae42a0aaab06..9175706bfe7f 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 3
9     +SUBLEVEL = 4
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig
14     index c2dff4fd5fc4..9f6d2a69a6f7 100644
15     --- a/arch/arm/configs/qcom_defconfig
16     +++ b/arch/arm/configs/qcom_defconfig
17     @@ -162,8 +162,8 @@ CONFIG_APQ_MMCC_8084=y
18     CONFIG_IPQ_LCC_806X=y
19     CONFIG_MSM_GCC_8660=y
20     CONFIG_MSM_LCC_8960=y
21     -CONFIG_MSM_GCC_9615=y
22     -CONFIG_MSM_LCC_9615=y
23     +CONFIG_MDM_GCC_9615=y
24     +CONFIG_MDM_LCC_9615=y
25     CONFIG_MSM_MMCC_8960=y
26     CONFIG_MSM_MMCC_8974=y
27     CONFIG_HWSPINLOCK_QCOM=y
28     diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
29     index 5b37ec29996e..e37ceb81a379 100644
30     --- a/arch/arm/mach-omap2/Makefile
31     +++ b/arch/arm/mach-omap2/Makefile
32     @@ -80,7 +80,7 @@ endif
33     # Power Management
34     omap-4-5-pm-common = omap-mpuss-lowpower.o
35     obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-pm-common)
36     -obj-$(CONFIG_ARCH_OMAP5) += $(omap-4-5-pm-common)
37     +obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-pm-common)
38     obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
39    
40     ifeq ($(CONFIG_PM),y)
41     diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
42     index bab814d2f37d..60f5e838a3bc 100644
43     --- a/arch/arm/mach-omap2/board-generic.c
44     +++ b/arch/arm/mach-omap2/board-generic.c
45     @@ -306,7 +306,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
46     .init_late = am43xx_init_late,
47     .init_irq = omap_gic_of_init,
48     .init_machine = omap_generic_init,
49     - .init_time = omap4_local_timer_init,
50     + .init_time = omap3_gptimer_timer_init,
51     .dt_compat = am43_boards_compat,
52     .restart = omap44xx_restart,
53     MACHINE_END
54     diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
55     index deed42e1dd9c..6dcca2957e23 100644
56     --- a/arch/arm/mach-omap2/common.h
57     +++ b/arch/arm/mach-omap2/common.h
58     @@ -262,8 +262,6 @@ extern void __iomem *omap4_get_sar_ram_base(void);
59     extern void omap4_mpuss_early_init(void);
60     extern void omap_do_wfi(void);
61    
62     -extern void omap4_secondary_startup(void);
63     -extern void omap4460_secondary_startup(void);
64    
65     #ifdef CONFIG_SMP
66     /* Needed for secondary core boot */
67     @@ -275,16 +273,11 @@ extern void omap4_cpu_die(unsigned int cpu);
68     extern int omap4_cpu_kill(unsigned int cpu);
69    
70     extern const struct smp_operations omap4_smp_ops;
71     -
72     -extern void omap5_secondary_startup(void);
73     -extern void omap5_secondary_hyp_startup(void);
74     #endif
75    
76     #if defined(CONFIG_SMP) && defined(CONFIG_PM)
77     extern int omap4_mpuss_init(void);
78     extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
79     -extern int omap4_finish_suspend(unsigned long cpu_state);
80     -extern void omap4_cpu_resume(void);
81     extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state);
82     #else
83     static inline int omap4_enter_lowpower(unsigned int cpu,
84     @@ -305,14 +298,41 @@ static inline int omap4_mpuss_init(void)
85     return 0;
86     }
87    
88     +#endif
89     +
90     +#ifdef CONFIG_ARCH_OMAP4
91     +void omap4_secondary_startup(void);
92     +void omap4460_secondary_startup(void);
93     +int omap4_finish_suspend(unsigned long cpu_state);
94     +void omap4_cpu_resume(void);
95     +#else
96     +static inline void omap4_secondary_startup(void)
97     +{
98     +}
99     +
100     +static inline void omap4460_secondary_startup(void)
101     +{
102     +}
103     static inline int omap4_finish_suspend(unsigned long cpu_state)
104     {
105     return 0;
106     }
107     -
108     static inline void omap4_cpu_resume(void)
109     -{}
110     +{
111     +}
112     +#endif
113    
114     +#if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
115     +void omap5_secondary_startup(void);
116     +void omap5_secondary_hyp_startup(void);
117     +#else
118     +static inline void omap5_secondary_startup(void)
119     +{
120     +}
121     +
122     +static inline void omap5_secondary_hyp_startup(void)
123     +{
124     +}
125     #endif
126    
127     void pdata_quirks_init(const struct of_device_id *);
128     diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
129     index 0e9acdd95d70..f0da5259762a 100644
130     --- a/arch/arm/mach-omap2/io.c
131     +++ b/arch/arm/mach-omap2/io.c
132     @@ -717,10 +717,11 @@ void __init omap5_init_early(void)
133     OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
134     omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
135     omap2_control_base_init();
136     - omap4_pm_init_early();
137     omap2_prcm_base_init();
138     omap5xxx_check_revision();
139     omap4_sar_ram_init();
140     + omap4_mpuss_early_init();
141     + omap4_pm_init_early();
142     omap54xx_voltagedomains_init();
143     omap54xx_powerdomains_init();
144     omap54xx_clockdomains_init();
145     diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
146     index ad982465efd0..7d62ad48c7c9 100644
147     --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
148     +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
149     @@ -48,6 +48,7 @@
150     #include <asm/smp_scu.h>
151     #include <asm/pgalloc.h>
152     #include <asm/suspend.h>
153     +#include <asm/virt.h>
154     #include <asm/hardware/cache-l2x0.h>
155    
156     #include "soc.h"
157     @@ -244,10 +245,9 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
158     save_state = 1;
159     break;
160     case PWRDM_POWER_RET:
161     - if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) {
162     + if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE))
163     save_state = 0;
164     - break;
165     - }
166     + break;
167     default:
168     /*
169     * CPUx CSWR is invalid hardware state. Also CPUx OSWR
170     @@ -371,8 +371,12 @@ int __init omap4_mpuss_init(void)
171     pm_info = &per_cpu(omap4_pm_info, 0x0);
172     if (sar_base) {
173     pm_info->scu_sar_addr = sar_base + SCU_OFFSET0;
174     - pm_info->wkup_sar_addr = sar_base +
175     - CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
176     + if (cpu_is_omap44xx())
177     + pm_info->wkup_sar_addr = sar_base +
178     + CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
179     + else
180     + pm_info->wkup_sar_addr = sar_base +
181     + OMAP5_CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
182     pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0;
183     }
184     pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm");
185     @@ -391,8 +395,12 @@ int __init omap4_mpuss_init(void)
186     pm_info = &per_cpu(omap4_pm_info, 0x1);
187     if (sar_base) {
188     pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
189     - pm_info->wkup_sar_addr = sar_base +
190     - CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
191     + if (cpu_is_omap44xx())
192     + pm_info->wkup_sar_addr = sar_base +
193     + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
194     + else
195     + pm_info->wkup_sar_addr = sar_base +
196     + OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
197     pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
198     }
199    
200     @@ -453,15 +461,24 @@ void __init omap4_mpuss_early_init(void)
201     {
202     unsigned long startup_pa;
203    
204     - if (!cpu_is_omap44xx())
205     + if (!(cpu_is_omap44xx() || soc_is_omap54xx()))
206     return;
207    
208     sar_base = omap4_get_sar_ram_base();
209    
210     if (cpu_is_omap443x())
211     startup_pa = virt_to_phys(omap4_secondary_startup);
212     - else
213     + else if (cpu_is_omap446x())
214     startup_pa = virt_to_phys(omap4460_secondary_startup);
215     + else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE)
216     + startup_pa = virt_to_phys(omap5_secondary_hyp_startup);
217     + else
218     + startup_pa = virt_to_phys(omap5_secondary_startup);
219    
220     - writel_relaxed(startup_pa, sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
221     + if (cpu_is_omap44xx())
222     + writel_relaxed(startup_pa, sar_base +
223     + CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
224     + else
225     + writel_relaxed(startup_pa, sar_base +
226     + OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
227     }
228     diff --git a/arch/arm/mach-omap2/omap4-sar-layout.h b/arch/arm/mach-omap2/omap4-sar-layout.h
229     index 792b1069f724..5b2966a0f733 100644
230     --- a/arch/arm/mach-omap2/omap4-sar-layout.h
231     +++ b/arch/arm/mach-omap2/omap4-sar-layout.h
232     @@ -31,6 +31,8 @@
233     /* CPUx Wakeup Non-Secure Physical Address offsets in SAR_BANK3 */
234     #define CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xa04
235     #define CPU1_WAKEUP_NS_PA_ADDR_OFFSET 0xa08
236     +#define OMAP5_CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xe00
237     +#define OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET 0xe04
238    
239     #define SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x500)
240     #define SAR_SECURE_RAM_SIZE_OFFSET (SAR_BANK3_OFFSET + 0x504)
241     diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
242     index 5e2e2218a402..b2f2448bfa6d 100644
243     --- a/arch/arm/mach-omap2/timer.c
244     +++ b/arch/arm/mach-omap2/timer.c
245     @@ -510,18 +510,19 @@ void __init omap3_secure_sync32k_timer_init(void)
246     }
247     #endif /* CONFIG_ARCH_OMAP3 */
248    
249     -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
250     +#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \
251     + defined(CONFIG_SOC_AM43XX)
252     void __init omap3_gptimer_timer_init(void)
253     {
254     __omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
255     1, "timer_sys_ck", "ti,timer-alwon", true);
256     -
257     - clocksource_probe();
258     + if (of_have_populated_dt())
259     + clocksource_probe();
260     }
261     #endif
262    
263     #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
264     - defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX)
265     + defined(CONFIG_SOC_DRA7XX)
266     static void __init omap4_sync32k_timer_init(void)
267     {
268     __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon",
269     diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
270     index 12b94357fbc1..c725baf119e1 100644
271     --- a/arch/arm/mach-pxa/pxa25x.c
272     +++ b/arch/arm/mach-pxa/pxa25x.c
273     @@ -156,7 +156,7 @@ static int __init __init
274     pxa25x_dt_init_irq(struct device_node *node, struct device_node *parent)
275     {
276     pxa_dt_irq_init(pxa25x_set_wake);
277     - set_handle_irq(ichp_handle_irq);
278     + set_handle_irq(icip_handle_irq);
279    
280     return 0;
281     }
282     diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
283     index d12002cd63bc..ed118648313f 100644
284     --- a/arch/arm/mach-zynq/common.c
285     +++ b/arch/arm/mach-zynq/common.c
286     @@ -59,7 +59,7 @@ void __iomem *zynq_scu_base;
287     static void __init zynq_memory_init(void)
288     {
289     if (!__pa(PAGE_OFFSET))
290     - memblock_reserve(__pa(PAGE_OFFSET), __pa(swapper_pg_dir));
291     + memblock_reserve(__pa(PAGE_OFFSET), 0x80000);
292     }
293    
294     static struct platform_device zynq_cpuidle_device = {
295     diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
296     index 7841b724e340..4617759670da 100644
297     --- a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
298     +++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
299     @@ -15,13 +15,6 @@
300     act {
301     gpios = <&gpio 47 0>;
302     };
303     -
304     - pwr {
305     - label = "PWR";
306     - gpios = <&gpio 35 0>;
307     - default-state = "keep";
308     - linux,default-trigger = "default-on";
309     - };
310     };
311     };
312    
313     diff --git a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
314     index 8216bbb29fe0..c1f719b7097a 100644
315     --- a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
316     +++ b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
317     @@ -1,7 +1,7 @@
318     #include "bcm283x.dtsi"
319    
320     / {
321     - compatible = "brcm,bcm2836";
322     + compatible = "brcm,bcm2837";
323    
324     soc {
325     ranges = <0x7e000000 0x3f000000 0x1000000>,
326     diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
327     index 1c71e256601d..6c03c1702bb3 100644
328     --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
329     +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
330     @@ -450,6 +450,9 @@
331     auxadc: auxadc@11001000 {
332     compatible = "mediatek,mt8173-auxadc";
333     reg = <0 0x11001000 0 0x1000>;
334     + clocks = <&pericfg CLK_PERI_AUXADC>;
335     + clock-names = "main";
336     + #io-channel-cells = <1>;
337     };
338    
339     uart0: serial@11002000 {
340     diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
341     index 93cf7a5846a6..030d72df5dd5 100644
342     --- a/arch/powerpc/kernel/misc_32.S
343     +++ b/arch/powerpc/kernel/misc_32.S
344     @@ -296,7 +296,7 @@ _GLOBAL(flush_instruction_cache)
345     lis r3, KERNELBASE@h
346     iccci 0,r3
347     #endif
348     -#elif CONFIG_FSL_BOOKE
349     +#elif defined(CONFIG_FSL_BOOKE)
350     BEGIN_FTR_SECTION
351     mfspr r3,SPRN_L1CSR0
352     ori r3,r3,L1CSR0_CFI|L1CSR0_CLFC
353     diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
354     index fe04a04dab8e..15f743615923 100644
355     --- a/arch/x86/net/bpf_jit_comp.c
356     +++ b/arch/x86/net/bpf_jit_comp.c
357     @@ -1172,6 +1172,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
358     set_memory_ro((unsigned long)header, header->pages);
359     prog->bpf_func = (void *)image;
360     prog->jited = 1;
361     + } else {
362     + prog = orig_prog;
363     }
364    
365     out_addrs:
366     diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
367     index d1074d9b38ba..aee83462b796 100644
368     --- a/drivers/bus/arm-ccn.c
369     +++ b/drivers/bus/arm-ccn.c
370     @@ -1570,7 +1570,10 @@ static int __init arm_ccn_init(void)
371     for (i = 0; i < ARRAY_SIZE(arm_ccn_pmu_events); i++)
372     arm_ccn_pmu_events_attrs[i] = &arm_ccn_pmu_events[i].attr.attr;
373    
374     - return platform_driver_register(&arm_ccn_driver);
375     + ret = platform_driver_register(&arm_ccn_driver);
376     + if (ret)
377     + cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE);
378     + return ret;
379     }
380    
381     static void __exit arm_ccn_exit(void)
382     diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
383     index 97ae60fa1584..bb8a77a5985f 100644
384     --- a/drivers/clk/clkdev.c
385     +++ b/drivers/clk/clkdev.c
386     @@ -448,12 +448,20 @@ EXPORT_SYMBOL(clk_register_clkdev);
387     *
388     * con_id or dev_id may be NULL as a wildcard, just as in the rest of
389     * clkdev.
390     + *
391     + * To make things easier for mass registration, we detect error clk_hws
392     + * from a previous clk_hw_register_*() call, and return the error code for
393     + * those. This is to permit this function to be called immediately
394     + * after clk_hw_register_*().
395     */
396     int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id,
397     const char *dev_id)
398     {
399     struct clk_lookup *cl;
400    
401     + if (IS_ERR(hw))
402     + return PTR_ERR(hw);
403     +
404     /*
405     * Since dev_id can be NULL, and NULL is handled specially, we must
406     * pass it as either a NULL format string, or with "%s".
407     diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
408     index 685e9e065287..da832d3cdca7 100644
409     --- a/drivers/gpu/drm/i915/i915_drv.h
410     +++ b/drivers/gpu/drm/i915/i915_drv.h
411     @@ -3684,6 +3684,8 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
412    
413     int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val);
414     int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val);
415     +int skl_pcode_request(struct drm_i915_private *dev_priv, u32 mbox, u32 request,
416     + u32 reply_mask, u32 reply, int timeout_base_ms);
417    
418     /* intel_sideband.c */
419     u32 vlv_punit_read(struct drm_i915_private *dev_priv, u32 addr);
420     diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
421     index 71441c329603..c9e83f39ec0a 100644
422     --- a/drivers/gpu/drm/i915/intel_display.c
423     +++ b/drivers/gpu/drm/i915/intel_display.c
424     @@ -6262,36 +6262,25 @@ skl_dpll0_disable(struct drm_i915_private *dev_priv)
425     dev_priv->cdclk_pll.vco = 0;
426     }
427    
428     -static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
429     -{
430     - int ret;
431     - u32 val;
432     -
433     - /* inform PCU we want to change CDCLK */
434     - val = SKL_CDCLK_PREPARE_FOR_CHANGE;
435     - mutex_lock(&dev_priv->rps.hw_lock);
436     - ret = sandybridge_pcode_read(dev_priv, SKL_PCODE_CDCLK_CONTROL, &val);
437     - mutex_unlock(&dev_priv->rps.hw_lock);
438     -
439     - return ret == 0 && (val & SKL_CDCLK_READY_FOR_CHANGE);
440     -}
441     -
442     -static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
443     -{
444     - return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
445     -}
446     -
447     static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
448     {
449     struct drm_device *dev = &dev_priv->drm;
450     u32 freq_select, pcu_ack;
451     + int ret;
452    
453     WARN_ON((cdclk == 24000) != (vco == 0));
454    
455     DRM_DEBUG_DRIVER("Changing CDCLK to %d kHz (VCO %d kHz)\n", cdclk, vco);
456    
457     - if (!skl_cdclk_wait_for_pcu_ready(dev_priv)) {
458     - DRM_ERROR("failed to inform PCU about cdclk change\n");
459     + mutex_lock(&dev_priv->rps.hw_lock);
460     + ret = skl_pcode_request(dev_priv, SKL_PCODE_CDCLK_CONTROL,
461     + SKL_CDCLK_PREPARE_FOR_CHANGE,
462     + SKL_CDCLK_READY_FOR_CHANGE,
463     + SKL_CDCLK_READY_FOR_CHANGE, 3);
464     + mutex_unlock(&dev_priv->rps.hw_lock);
465     + if (ret) {
466     + DRM_ERROR("Failed to inform PCU about cdclk change (%d)\n",
467     + ret);
468     return;
469     }
470    
471     diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
472     index 103cefdb9ddd..985cb31f4b44 100644
473     --- a/drivers/gpu/drm/i915/intel_pm.c
474     +++ b/drivers/gpu/drm/i915/intel_pm.c
475     @@ -7955,6 +7955,81 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
476     return 0;
477     }
478    
479     +static bool skl_pcode_try_request(struct drm_i915_private *dev_priv, u32 mbox,
480     + u32 request, u32 reply_mask, u32 reply,
481     + u32 *status)
482     +{
483     + u32 val = request;
484     +
485     + *status = sandybridge_pcode_read(dev_priv, mbox, &val);
486     +
487     + return *status || ((val & reply_mask) == reply);
488     +}
489     +
490     +/**
491     + * skl_pcode_request - send PCODE request until acknowledgment
492     + * @dev_priv: device private
493     + * @mbox: PCODE mailbox ID the request is targeted for
494     + * @request: request ID
495     + * @reply_mask: mask used to check for request acknowledgment
496     + * @reply: value used to check for request acknowledgment
497     + * @timeout_base_ms: timeout for polling with preemption enabled
498     + *
499     + * Keep resending the @request to @mbox until PCODE acknowledges it, PCODE
500     + * reports an error or an overall timeout of @timeout_base_ms+10 ms expires.
501     + * The request is acknowledged once the PCODE reply dword equals @reply after
502     + * applying @reply_mask. Polling is first attempted with preemption enabled
503     + * for @timeout_base_ms and if this times out for another 10 ms with
504     + * preemption disabled.
505     + *
506     + * Returns 0 on success, %-ETIMEDOUT in case of a timeout, <0 in case of some
507     + * other error as reported by PCODE.
508     + */
509     +int skl_pcode_request(struct drm_i915_private *dev_priv, u32 mbox, u32 request,
510     + u32 reply_mask, u32 reply, int timeout_base_ms)
511     +{
512     + u32 status;
513     + int ret;
514     +
515     + WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
516     +
517     +#define COND skl_pcode_try_request(dev_priv, mbox, request, reply_mask, reply, \
518     + &status)
519     +
520     + /*
521     + * Prime the PCODE by doing a request first. Normally it guarantees
522     + * that a subsequent request, at most @timeout_base_ms later, succeeds.
523     + * _wait_for() doesn't guarantee when its passed condition is evaluated
524     + * first, so send the first request explicitly.
525     + */
526     + if (COND) {
527     + ret = 0;
528     + goto out;
529     + }
530     + ret = _wait_for(COND, timeout_base_ms * 1000, 10);
531     + if (!ret)
532     + goto out;
533     +
534     + /*
535     + * The above can time out if the number of requests was low (2 in the
536     + * worst case) _and_ PCODE was busy for some reason even after a
537     + * (queued) request and @timeout_base_ms delay. As a workaround retry
538     + * the poll with preemption disabled to maximize the number of
539     + * requests. Increase the timeout from @timeout_base_ms to 50ms to
540     + * account for interrupts that could reduce the number of these
541     + * requests.
542     + */
543     + DRM_DEBUG_KMS("PCODE timeout, retrying with preemption disabled\n");
544     + WARN_ON_ONCE(timeout_base_ms > 3);
545     + preempt_disable();
546     + ret = wait_for_atomic(COND, 50);
547     + preempt_enable();
548     +
549     +out:
550     + return ret ? ret : status;
551     +#undef COND
552     +}
553     +
554     static int byt_gpu_freq(struct drm_i915_private *dev_priv, int val)
555     {
556     /*
557     diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
558     index 1b764d1745f3..1689568b597d 100644
559     --- a/drivers/hid/hid-cypress.c
560     +++ b/drivers/hid/hid-cypress.c
561     @@ -39,6 +39,9 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
562     if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
563     return rdesc;
564    
565     + if (*rsize < 4)
566     + return rdesc;
567     +
568     for (i = 0; i < *rsize - 4; i++)
569     if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
570     rdesc[i] = 0x19;
571     diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
572     index 9ec33b51a0ed..2ce7ae97ac91 100644
573     --- a/drivers/net/dsa/bcm_sf2.c
574     +++ b/drivers/net/dsa/bcm_sf2.c
575     @@ -393,7 +393,7 @@ static int bcm_sf2_sw_mdio_read(struct mii_bus *bus, int addr, int regnum)
576     if (addr == BRCM_PSEUDO_PHY_ADDR && priv->indir_phy_mask & BIT(addr))
577     return bcm_sf2_sw_indir_rw(priv, 1, addr, regnum, 0);
578     else
579     - return mdiobus_read(priv->master_mii_bus, addr, regnum);
580     + return mdiobus_read_nested(priv->master_mii_bus, addr, regnum);
581     }
582    
583     static int bcm_sf2_sw_mdio_write(struct mii_bus *bus, int addr, int regnum,
584     @@ -407,7 +407,7 @@ static int bcm_sf2_sw_mdio_write(struct mii_bus *bus, int addr, int regnum,
585     if (addr == BRCM_PSEUDO_PHY_ADDR && priv->indir_phy_mask & BIT(addr))
586     bcm_sf2_sw_indir_rw(priv, 0, addr, regnum, val);
587     else
588     - mdiobus_write(priv->master_mii_bus, addr, regnum, val);
589     + mdiobus_write_nested(priv->master_mii_bus, addr, regnum, val);
590    
591     return 0;
592     }
593     @@ -982,6 +982,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
594     const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME;
595     struct device_node *dn = pdev->dev.of_node;
596     struct b53_platform_data *pdata;
597     + struct dsa_switch_ops *ops;
598     struct bcm_sf2_priv *priv;
599     struct b53_device *dev;
600     struct dsa_switch *ds;
601     @@ -995,6 +996,10 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
602     if (!priv)
603     return -ENOMEM;
604    
605     + ops = devm_kzalloc(&pdev->dev, sizeof(*ops), GFP_KERNEL);
606     + if (!ops)
607     + return -ENOMEM;
608     +
609     dev = b53_switch_alloc(&pdev->dev, &bcm_sf2_io_ops, priv);
610     if (!dev)
611     return -ENOMEM;
612     @@ -1014,6 +1019,8 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
613     ds = dev->ds;
614    
615     /* Override the parts that are non-standard wrt. normal b53 devices */
616     + memcpy(ops, ds->ops, sizeof(*ops));
617     + ds->ops = ops;
618     ds->ops->get_tag_protocol = bcm_sf2_sw_get_tag_protocol;
619     ds->ops->setup = bcm_sf2_sw_setup;
620     ds->ops->get_phy_flags = bcm_sf2_sw_get_phy_flags;
621     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
622     index d17c24227900..90e81ae9f3bc 100644
623     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
624     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
625     @@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v,
626     }
627     if (fs->flow_type & FLOW_MAC_EXT &&
628     !is_zero_ether_addr(fs->m_ext.h_dest)) {
629     + mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN);
630     ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4,
631     outer_headers_c, dmac_47_16),
632     fs->m_ext.h_dest);
633     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
634     index 246d98ebb588..5dc3e2453ff5 100644
635     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
636     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
637     @@ -3773,14 +3773,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
638    
639     mlx5_lag_add(mdev, netdev);
640    
641     - if (mlx5e_vxlan_allowed(mdev)) {
642     - rtnl_lock();
643     - udp_tunnel_get_rx_info(netdev);
644     - rtnl_unlock();
645     - }
646     -
647     mlx5e_enable_async_events(priv);
648     - queue_work(priv->wq, &priv->set_rx_mode_work);
649    
650     if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
651     mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
652     @@ -3790,6 +3783,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
653     rep.priv_data = priv;
654     mlx5_eswitch_register_vport_rep(esw, 0, &rep);
655     }
656     +
657     + if (netdev->reg_state != NETREG_REGISTERED)
658     + return;
659     +
660     + /* Device already registered: sync netdev system state */
661     + if (mlx5e_vxlan_allowed(mdev)) {
662     + rtnl_lock();
663     + udp_tunnel_get_rx_info(netdev);
664     + rtnl_unlock();
665     + }
666     +
667     + queue_work(priv->wq, &priv->set_rx_mode_work);
668     }
669    
670     static void mlx5e_nic_disable(struct mlx5e_priv *priv)
671     @@ -3937,10 +3942,6 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
672     const struct mlx5e_profile *profile = priv->profile;
673    
674     set_bit(MLX5E_STATE_DESTROYING, &priv->state);
675     - if (profile->disable)
676     - profile->disable(priv);
677     -
678     - flush_workqueue(priv->wq);
679    
680     rtnl_lock();
681     if (netif_running(netdev))
682     @@ -3948,6 +3949,10 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
683     netif_device_detach(netdev);
684     rtnl_unlock();
685    
686     + if (profile->disable)
687     + profile->disable(priv);
688     + flush_workqueue(priv->wq);
689     +
690     mlx5e_destroy_q_counter(priv);
691     profile->cleanup_rx(priv);
692     mlx5e_close_drop_rq(priv);
693     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c
694     index 1fffe48a93cc..cbfac06b7ffd 100644
695     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c
696     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c
697     @@ -109,7 +109,6 @@ static bool mlx5e_am_on_top(struct mlx5e_rx_am *am)
698     switch (am->tune_state) {
699     case MLX5E_AM_PARKING_ON_TOP:
700     case MLX5E_AM_PARKING_TIRED:
701     - WARN_ONCE(true, "mlx5e_am_on_top: PARKING\n");
702     return true;
703     case MLX5E_AM_GOING_RIGHT:
704     return (am->steps_left > 1) && (am->steps_right == 1);
705     @@ -123,7 +122,6 @@ static void mlx5e_am_turn(struct mlx5e_rx_am *am)
706     switch (am->tune_state) {
707     case MLX5E_AM_PARKING_ON_TOP:
708     case MLX5E_AM_PARKING_TIRED:
709     - WARN_ONCE(true, "mlx5e_am_turn: PARKING\n");
710     break;
711     case MLX5E_AM_GOING_RIGHT:
712     am->tune_state = MLX5E_AM_GOING_LEFT;
713     @@ -144,7 +142,6 @@ static int mlx5e_am_step(struct mlx5e_rx_am *am)
714     switch (am->tune_state) {
715     case MLX5E_AM_PARKING_ON_TOP:
716     case MLX5E_AM_PARKING_TIRED:
717     - WARN_ONCE(true, "mlx5e_am_step: PARKING\n");
718     break;
719     case MLX5E_AM_GOING_RIGHT:
720     if (am->profile_ix == (MLX5E_PARAMS_AM_NUM_PROFILES - 1))
721     @@ -282,10 +279,8 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
722     u32 delta_us = ktime_us_delta(end->time, start->time);
723     unsigned int npkts = end->pkt_ctr - start->pkt_ctr;
724    
725     - if (!delta_us) {
726     - WARN_ONCE(true, "mlx5e_am_calc_stats: delta_us=0\n");
727     + if (!delta_us)
728     return;
729     - }
730    
731     curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us;
732     curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us;
733     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
734     index be1f7333ab7f..c7011ef4e351 100644
735     --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
736     +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
737     @@ -1703,7 +1703,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
738    
739     if (!ESW_ALLOWED(esw))
740     return -EPERM;
741     - if (!LEGAL_VPORT(esw, vport))
742     + if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
743     return -EINVAL;
744    
745     mutex_lock(&esw->state_lock);
746     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
747     index ada24e103b02..92bd13ddc39d 100644
748     --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
749     +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
750     @@ -468,6 +468,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
751     MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
752     to_fw_pkey_sz(dev, 128));
753    
754     + /* Check log_max_qp from HCA caps to set in current profile */
755     + if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
756     + mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
757     + profile[prof_sel].log_max_qp,
758     + MLX5_CAP_GEN_MAX(dev, log_max_qp));
759     + profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
760     + }
761     if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
762     MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
763     prof->log_max_qp);
764     @@ -540,7 +547,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
765     struct mlx5_priv *priv = &mdev->priv;
766     struct msix_entry *msix = priv->msix_arr;
767     int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
768     - int numa_node = priv->numa_node;
769     int err;
770    
771     if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
772     @@ -548,7 +554,7 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
773     return -ENOMEM;
774     }
775    
776     - cpumask_set_cpu(cpumask_local_spread(i, numa_node),
777     + cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
778     priv->irq_info[i].mask);
779    
780     err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
781     @@ -1152,6 +1158,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
782     {
783     int err = 0;
784    
785     + mlx5_drain_health_wq(dev);
786     +
787     mutex_lock(&dev->intf_state_mutex);
788     if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
789     dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
790     @@ -1312,10 +1320,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
791    
792     mlx5_enter_error_state(dev);
793     mlx5_unload_one(dev, priv, false);
794     - /* In case of kernel call save the pci state and drain health wq */
795     + /* In case of kernel call save the pci state */
796     if (state) {
797     pci_save_state(pdev);
798     - mlx5_drain_health_wq(dev);
799     mlx5_pci_disable_device(dev);
800     }
801    
802     diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
803     index caf069a465f2..b2893fbe25e5 100644
804     --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
805     +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
806     @@ -3349,12 +3349,6 @@ int stmmac_dvr_probe(struct device *device,
807     spin_lock_init(&priv->lock);
808     spin_lock_init(&priv->tx_lock);
809    
810     - ret = register_netdev(ndev);
811     - if (ret) {
812     - pr_err("%s: ERROR %i registering the device\n", __func__, ret);
813     - goto error_netdev_register;
814     - }
815     -
816     /* If a specific clk_csr value is passed from the platform
817     * this means that the CSR Clock Range selection cannot be
818     * changed at run-time and it is fixed. Viceversa the driver'll try to
819     @@ -3376,15 +3370,24 @@ int stmmac_dvr_probe(struct device *device,
820     if (ret < 0) {
821     pr_debug("%s: MDIO bus (id: %d) registration failed",
822     __func__, priv->plat->bus_id);
823     - goto error_mdio_register;
824     + goto error_napi_register;
825     }
826     }
827    
828     - return 0;
829     + ret = register_netdev(ndev);
830     + if (ret) {
831     + pr_err("%s: ERROR %i registering the device\n", __func__, ret);
832     + goto error_netdev_register;
833     + }
834     +
835     + return ret;
836    
837     -error_mdio_register:
838     - unregister_netdev(ndev);
839     error_netdev_register:
840     + if (priv->hw->pcs != STMMAC_PCS_RGMII &&
841     + priv->hw->pcs != STMMAC_PCS_TBI &&
842     + priv->hw->pcs != STMMAC_PCS_RTBI)
843     + stmmac_mdio_unregister(ndev);
844     +error_napi_register:
845     netif_napi_del(&priv->napi);
846     error_hw_init:
847     clk_disable_unprepare(priv->pclk);
848     diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
849     index efb84f092492..4b5cb162442b 100644
850     --- a/drivers/net/usb/r8152.c
851     +++ b/drivers/net/usb/r8152.c
852     @@ -3576,39 +3576,87 @@ static bool delay_autosuspend(struct r8152 *tp)
853     return false;
854     }
855    
856     -static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
857     +static int rtl8152_rumtime_suspend(struct r8152 *tp)
858     {
859     - struct r8152 *tp = usb_get_intfdata(intf);
860     struct net_device *netdev = tp->netdev;
861     int ret = 0;
862    
863     - mutex_lock(&tp->control);
864     + if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
865     + u32 rcr = 0;
866    
867     - if (PMSG_IS_AUTO(message)) {
868     - if (netif_running(netdev) && delay_autosuspend(tp)) {
869     + if (delay_autosuspend(tp)) {
870     ret = -EBUSY;
871     goto out1;
872     }
873    
874     - set_bit(SELECTIVE_SUSPEND, &tp->flags);
875     - } else {
876     - netif_device_detach(netdev);
877     + if (netif_carrier_ok(netdev)) {
878     + u32 ocp_data;
879     +
880     + rcr = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
881     + ocp_data = rcr & ~RCR_ACPT_ALL;
882     + ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
883     + rxdy_gated_en(tp, true);
884     + ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA,
885     + PLA_OOB_CTRL);
886     + if (!(ocp_data & RXFIFO_EMPTY)) {
887     + rxdy_gated_en(tp, false);
888     + ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
889     + ret = -EBUSY;
890     + goto out1;
891     + }
892     + }
893     +
894     + clear_bit(WORK_ENABLE, &tp->flags);
895     + usb_kill_urb(tp->intr_urb);
896     +
897     + tp->rtl_ops.autosuspend_en(tp, true);
898     +
899     + if (netif_carrier_ok(netdev)) {
900     + napi_disable(&tp->napi);
901     + rtl_stop_rx(tp);
902     + rxdy_gated_en(tp, false);
903     + ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
904     + napi_enable(&tp->napi);
905     + }
906     }
907    
908     + set_bit(SELECTIVE_SUSPEND, &tp->flags);
909     +
910     +out1:
911     + return ret;
912     +}
913     +
914     +static int rtl8152_system_suspend(struct r8152 *tp)
915     +{
916     + struct net_device *netdev = tp->netdev;
917     + int ret = 0;
918     +
919     + netif_device_detach(netdev);
920     +
921     if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
922     clear_bit(WORK_ENABLE, &tp->flags);
923     usb_kill_urb(tp->intr_urb);
924     napi_disable(&tp->napi);
925     - if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
926     - rtl_stop_rx(tp);
927     - tp->rtl_ops.autosuspend_en(tp, true);
928     - } else {
929     - cancel_delayed_work_sync(&tp->schedule);
930     - tp->rtl_ops.down(tp);
931     - }
932     + cancel_delayed_work_sync(&tp->schedule);
933     + tp->rtl_ops.down(tp);
934     napi_enable(&tp->napi);
935     }
936     -out1:
937     +
938     + return ret;
939     +}
940     +
941     +static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
942     +{
943     + struct r8152 *tp = usb_get_intfdata(intf);
944     + int ret;
945     +
946     + mutex_lock(&tp->control);
947     +
948     + if (PMSG_IS_AUTO(message))
949     + ret = rtl8152_rumtime_suspend(tp);
950     + else
951     + ret = rtl8152_system_suspend(tp);
952     +
953     mutex_unlock(&tp->control);
954    
955     return ret;
956     diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
957     index 820de6a9ddde..95cf1d844781 100644
958     --- a/drivers/net/vrf.c
959     +++ b/drivers/net/vrf.c
960     @@ -263,7 +263,9 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
961     .flowi4_iif = LOOPBACK_IFINDEX,
962     .flowi4_tos = RT_TOS(ip4h->tos),
963     .flowi4_flags = FLOWI_FLAG_ANYSRC | FLOWI_FLAG_SKIP_NH_OIF,
964     + .flowi4_proto = ip4h->protocol,
965     .daddr = ip4h->daddr,
966     + .saddr = ip4h->saddr,
967     };
968     struct net *net = dev_net(vrf_dev);
969     struct rtable *rt;
970     @@ -371,6 +373,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
971     struct in6_addr *nexthop;
972     int ret;
973    
974     + nf_reset(skb);
975     +
976     skb->protocol = htons(ETH_P_IPV6);
977     skb->dev = dev;
978    
979     @@ -552,6 +556,8 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
980     u32 nexthop;
981     int ret = -EINVAL;
982    
983     + nf_reset(skb);
984     +
985     /* Be paranoid, rather than too clever. */
986     if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
987     struct sk_buff *skb2;
988     @@ -850,8 +856,6 @@ static struct sk_buff *vrf_rcv_nfhook(u8 pf, unsigned int hook,
989     {
990     struct net *net = dev_net(dev);
991    
992     - nf_reset(skb);
993     -
994     if (NF_HOOK(pf, hook, net, NULL, skb, dev, NULL, vrf_rcv_finish) < 0)
995     skb = NULL; /* kfree_skb(skb) handled by nf code */
996    
997     @@ -966,6 +970,7 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
998     */
999     need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
1000     if (!ipv6_ndisc_frame(skb) && !need_strict) {
1001     + vrf_rx_stats(vrf_dev, skb->len);
1002     skb->dev = vrf_dev;
1003     skb->skb_iif = vrf_dev->ifindex;
1004    
1005     @@ -1007,6 +1012,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev,
1006     goto out;
1007     }
1008    
1009     + vrf_rx_stats(vrf_dev, skb->len);
1010     +
1011     skb_push(skb, skb->mac_len);
1012     dev_queue_xmit_nit(skb, vrf_dev);
1013     skb_pull(skb, skb->mac_len);
1014     @@ -1232,6 +1239,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
1015     return -EINVAL;
1016    
1017     vrf->tb_id = nla_get_u32(data[IFLA_VRF_TABLE]);
1018     + if (vrf->tb_id == RT_TABLE_UNSPEC)
1019     + return -EINVAL;
1020    
1021     dev->priv_flags |= IFF_L3MDEV_MASTER;
1022    
1023     diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
1024     index 264466f59c57..4ac928bf1f8e 100644
1025     --- a/drivers/net/wireless/realtek/rtlwifi/base.c
1026     +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
1027     @@ -1303,12 +1303,13 @@ EXPORT_SYMBOL_GPL(rtl_action_proc);
1028    
1029     static void setup_arp_tx(struct rtl_priv *rtlpriv, struct rtl_ps_ctl *ppsc)
1030     {
1031     + struct ieee80211_hw *hw = rtlpriv->hw;
1032     +
1033     rtlpriv->ra.is_special_data = true;
1034     if (rtlpriv->cfg->ops->get_btc_status())
1035     rtlpriv->btcoexist.btc_ops->btc_special_packet_notify(
1036     rtlpriv, 1);
1037     - rtlpriv->enter_ps = false;
1038     - schedule_work(&rtlpriv->works.lps_change_work);
1039     + rtl_lps_leave(hw);
1040     ppsc->last_delaylps_stamp_jiffies = jiffies;
1041     }
1042    
1043     @@ -1381,8 +1382,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
1044    
1045     if (is_tx) {
1046     rtlpriv->ra.is_special_data = true;
1047     - rtlpriv->enter_ps = false;
1048     - schedule_work(&rtlpriv->works.lps_change_work);
1049     + rtl_lps_leave(hw);
1050     ppsc->last_delaylps_stamp_jiffies = jiffies;
1051     }
1052    
1053     diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
1054     index 8e7f23c11680..4da4e458142c 100644
1055     --- a/drivers/net/wireless/realtek/rtlwifi/core.c
1056     +++ b/drivers/net/wireless/realtek/rtlwifi/core.c
1057     @@ -1150,10 +1150,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
1058     } else {
1059     mstatus = RT_MEDIA_DISCONNECT;
1060    
1061     - if (mac->link_state == MAC80211_LINKED) {
1062     - rtlpriv->enter_ps = false;
1063     - schedule_work(&rtlpriv->works.lps_change_work);
1064     - }
1065     + if (mac->link_state == MAC80211_LINKED)
1066     + rtl_lps_leave(hw);
1067     if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
1068     rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
1069     mac->link_state = MAC80211_NOLINK;
1070     @@ -1431,8 +1429,7 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw,
1071     }
1072    
1073     if (mac->link_state == MAC80211_LINKED) {
1074     - rtlpriv->enter_ps = false;
1075     - schedule_work(&rtlpriv->works.lps_change_work);
1076     + rtl_lps_leave(hw);
1077     mac->link_state = MAC80211_LINKED_SCANNING;
1078     } else {
1079     rtl_ips_nic_on(hw);
1080     diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
1081     index 0dfa9eac3926..5be4fc96002d 100644
1082     --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
1083     +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
1084     @@ -663,11 +663,9 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
1085     }
1086    
1087     if (((rtlpriv->link_info.num_rx_inperiod +
1088     - rtlpriv->link_info.num_tx_inperiod) > 8) ||
1089     - (rtlpriv->link_info.num_rx_inperiod > 2)) {
1090     - rtlpriv->enter_ps = false;
1091     - schedule_work(&rtlpriv->works.lps_change_work);
1092     - }
1093     + rtlpriv->link_info.num_tx_inperiod) > 8) ||
1094     + (rtlpriv->link_info.num_rx_inperiod > 2))
1095     + rtl_lps_leave(hw);
1096     }
1097    
1098     static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
1099     @@ -918,10 +916,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
1100     }
1101     if (((rtlpriv->link_info.num_rx_inperiod +
1102     rtlpriv->link_info.num_tx_inperiod) > 8) ||
1103     - (rtlpriv->link_info.num_rx_inperiod > 2)) {
1104     - rtlpriv->enter_ps = false;
1105     - schedule_work(&rtlpriv->works.lps_change_work);
1106     - }
1107     + (rtlpriv->link_info.num_rx_inperiod > 2))
1108     + rtl_lps_leave(hw);
1109     skb = new_skb;
1110     no_new:
1111     if (rtlpriv->use_new_trx_flow) {
1112     diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
1113     index 18d979affc18..d0ffc4d508cf 100644
1114     --- a/drivers/net/wireless/realtek/rtlwifi/ps.c
1115     +++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
1116     @@ -407,8 +407,8 @@ void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
1117     }
1118     }
1119    
1120     -/*Enter the leisure power save mode.*/
1121     -void rtl_lps_enter(struct ieee80211_hw *hw)
1122     +/* Interrupt safe routine to enter the leisure power save mode.*/
1123     +static void rtl_lps_enter_core(struct ieee80211_hw *hw)
1124     {
1125     struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1126     struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
1127     @@ -444,10 +444,9 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
1128    
1129     spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
1130     }
1131     -EXPORT_SYMBOL(rtl_lps_enter);
1132    
1133     -/*Leave the leisure power save mode.*/
1134     -void rtl_lps_leave(struct ieee80211_hw *hw)
1135     +/* Interrupt safe routine to leave the leisure power save mode.*/
1136     +static void rtl_lps_leave_core(struct ieee80211_hw *hw)
1137     {
1138     struct rtl_priv *rtlpriv = rtl_priv(hw);
1139     struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
1140     @@ -477,7 +476,6 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
1141     }
1142     spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
1143     }
1144     -EXPORT_SYMBOL(rtl_lps_leave);
1145    
1146     /* For sw LPS*/
1147     void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
1148     @@ -670,12 +668,34 @@ void rtl_lps_change_work_callback(struct work_struct *work)
1149     struct rtl_priv *rtlpriv = rtl_priv(hw);
1150    
1151     if (rtlpriv->enter_ps)
1152     - rtl_lps_enter(hw);
1153     + rtl_lps_enter_core(hw);
1154     else
1155     - rtl_lps_leave(hw);
1156     + rtl_lps_leave_core(hw);
1157     }
1158     EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback);
1159    
1160     +void rtl_lps_enter(struct ieee80211_hw *hw)
1161     +{
1162     + struct rtl_priv *rtlpriv = rtl_priv(hw);
1163     +
1164     + if (!in_interrupt())
1165     + return rtl_lps_enter_core(hw);
1166     + rtlpriv->enter_ps = true;
1167     + schedule_work(&rtlpriv->works.lps_change_work);
1168     +}
1169     +EXPORT_SYMBOL_GPL(rtl_lps_enter);
1170     +
1171     +void rtl_lps_leave(struct ieee80211_hw *hw)
1172     +{
1173     + struct rtl_priv *rtlpriv = rtl_priv(hw);
1174     +
1175     + if (!in_interrupt())
1176     + return rtl_lps_leave_core(hw);
1177     + rtlpriv->enter_ps = false;
1178     + schedule_work(&rtlpriv->works.lps_change_work);
1179     +}
1180     +EXPORT_SYMBOL_GPL(rtl_lps_leave);
1181     +
1182     void rtl_swlps_wq_callback(void *data)
1183     {
1184     struct rtl_works *rtlworks = container_of_dwork_rtl(data,
1185     diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
1186     index 32aa5c1d070a..3837bbdecf05 100644
1187     --- a/drivers/net/wireless/realtek/rtlwifi/usb.c
1188     +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
1189     @@ -1067,6 +1067,7 @@ int rtl_usb_probe(struct usb_interface *intf,
1190     return -ENOMEM;
1191     }
1192     rtlpriv = hw->priv;
1193     + rtlpriv->hw = hw;
1194     rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32),
1195     GFP_KERNEL);
1196     if (!rtlpriv->usb_data)
1197     diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
1198     index ded37025b445..6b001c4a5640 100644
1199     --- a/drivers/spi/spi-orion.c
1200     +++ b/drivers/spi/spi-orion.c
1201     @@ -138,37 +138,62 @@ static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
1202     tclk_hz = clk_get_rate(orion_spi->clk);
1203    
1204     if (devdata->typ == ARMADA_SPI) {
1205     - unsigned int clk, spr, sppr, sppr2, err;
1206     - unsigned int best_spr, best_sppr, best_err;
1207     -
1208     - best_err = speed;
1209     - best_spr = 0;
1210     - best_sppr = 0;
1211     -
1212     - /* Iterate over the valid range looking for best fit */
1213     - for (sppr = 0; sppr < 8; sppr++) {
1214     - sppr2 = 0x1 << sppr;
1215     -
1216     - spr = tclk_hz / sppr2;
1217     - spr = DIV_ROUND_UP(spr, speed);
1218     - if ((spr == 0) || (spr > 15))
1219     - continue;
1220     -
1221     - clk = tclk_hz / (spr * sppr2);
1222     - err = speed - clk;
1223     -
1224     - if (err < best_err) {
1225     - best_spr = spr;
1226     - best_sppr = sppr;
1227     - best_err = err;
1228     - }
1229     - }
1230     + /*
1231     + * Given the core_clk (tclk_hz) and the target rate (speed) we
1232     + * determine the best values for SPR (in [0 .. 15]) and SPPR (in
1233     + * [0..7]) such that
1234     + *
1235     + * core_clk / (SPR * 2 ** SPPR)
1236     + *
1237     + * is as big as possible but not bigger than speed.
1238     + */
1239    
1240     - if ((best_sppr == 0) && (best_spr == 0))
1241     - return -EINVAL;
1242     + /* best integer divider: */
1243     + unsigned divider = DIV_ROUND_UP(tclk_hz, speed);
1244     + unsigned spr, sppr;
1245     +
1246     + if (divider < 16) {
1247     + /* This is the easy case, divider is less than 16 */
1248     + spr = divider;
1249     + sppr = 0;
1250     +
1251     + } else {
1252     + unsigned two_pow_sppr;
1253     + /*
1254     + * Find the highest bit set in divider. This and the
1255     + * three next bits define SPR (apart from rounding).
1256     + * SPPR is then the number of zero bits that must be
1257     + * appended:
1258     + */
1259     + sppr = fls(divider) - 4;
1260     +
1261     + /*
1262     + * As SPR only has 4 bits, we have to round divider up
1263     + * to the next multiple of 2 ** sppr.
1264     + */
1265     + two_pow_sppr = 1 << sppr;
1266     + divider = (divider + two_pow_sppr - 1) & -two_pow_sppr;
1267     +
1268     + /*
1269     + * recalculate sppr as rounding up divider might have
1270     + * increased it enough to change the position of the
1271     + * highest set bit. In this case the bit that now
1272     + * doesn't make it into SPR is 0, so there is no need to
1273     + * round again.
1274     + */
1275     + sppr = fls(divider) - 4;
1276     + spr = divider >> sppr;
1277     +
1278     + /*
1279     + * Now do range checking. SPR is constructed to have a
1280     + * width of 4 bits, so this is fine for sure. So we
1281     + * still need to check for sppr to fit into 3 bits:
1282     + */
1283     + if (sppr > 7)
1284     + return -EINVAL;
1285     + }
1286    
1287     - prescale = ((best_sppr & 0x6) << 5) |
1288     - ((best_sppr & 0x1) << 4) | best_spr;
1289     + prescale = ((sppr & 0x6) << 5) | ((sppr & 0x1) << 4) | spr;
1290     } else {
1291     /*
1292     * the supported rates are: 4,6,8...30
1293     diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
1294     index e16a2a980ea8..d83590ef74a1 100644
1295     --- a/include/linux/netdevice.h
1296     +++ b/include/linux/netdevice.h
1297     @@ -2502,14 +2502,19 @@ static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
1298     return NAPI_GRO_CB(skb)->frag0_len < hlen;
1299     }
1300    
1301     +static inline void skb_gro_frag0_invalidate(struct sk_buff *skb)
1302     +{
1303     + NAPI_GRO_CB(skb)->frag0 = NULL;
1304     + NAPI_GRO_CB(skb)->frag0_len = 0;
1305     +}
1306     +
1307     static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1308     unsigned int offset)
1309     {
1310     if (!pskb_may_pull(skb, hlen))
1311     return NULL;
1312    
1313     - NAPI_GRO_CB(skb)->frag0 = NULL;
1314     - NAPI_GRO_CB(skb)->frag0_len = 0;
1315     + skb_gro_frag0_invalidate(skb);
1316     return skb->data + offset;
1317     }
1318    
1319     diff --git a/net/core/dev.c b/net/core/dev.c
1320     index 6666b28b6815..e1d731fdc72c 100644
1321     --- a/net/core/dev.c
1322     +++ b/net/core/dev.c
1323     @@ -4453,7 +4453,9 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
1324     pinfo->nr_frags &&
1325     !PageHighMem(skb_frag_page(frag0))) {
1326     NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0);
1327     - NAPI_GRO_CB(skb)->frag0_len = skb_frag_size(frag0);
1328     + NAPI_GRO_CB(skb)->frag0_len = min_t(unsigned int,
1329     + skb_frag_size(frag0),
1330     + skb->end - skb->tail);
1331     }
1332     }
1333    
1334     diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
1335     index 72cfb0c61125..ca2c9c8b9a3e 100644
1336     --- a/net/core/drop_monitor.c
1337     +++ b/net/core/drop_monitor.c
1338     @@ -80,6 +80,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
1339     struct nlattr *nla;
1340     struct sk_buff *skb;
1341     unsigned long flags;
1342     + void *msg_header;
1343    
1344     al = sizeof(struct net_dm_alert_msg);
1345     al += dm_hit_limit * sizeof(struct net_dm_drop_point);
1346     @@ -87,21 +88,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
1347    
1348     skb = genlmsg_new(al, GFP_KERNEL);
1349    
1350     - if (skb) {
1351     - genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
1352     - 0, NET_DM_CMD_ALERT);
1353     - nla = nla_reserve(skb, NLA_UNSPEC,
1354     - sizeof(struct net_dm_alert_msg));
1355     - msg = nla_data(nla);
1356     - memset(msg, 0, al);
1357     - } else {
1358     - mod_timer(&data->send_timer, jiffies + HZ / 10);
1359     + if (!skb)
1360     + goto err;
1361     +
1362     + msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
1363     + 0, NET_DM_CMD_ALERT);
1364     + if (!msg_header) {
1365     + nlmsg_free(skb);
1366     + skb = NULL;
1367     + goto err;
1368     + }
1369     + nla = nla_reserve(skb, NLA_UNSPEC,
1370     + sizeof(struct net_dm_alert_msg));
1371     + if (!nla) {
1372     + nlmsg_free(skb);
1373     + skb = NULL;
1374     + goto err;
1375     }
1376     + msg = nla_data(nla);
1377     + memset(msg, 0, al);
1378     + goto out;
1379    
1380     +err:
1381     + mod_timer(&data->send_timer, jiffies + HZ / 10);
1382     +out:
1383     spin_lock_irqsave(&data->lock, flags);
1384     swap(data->skb, skb);
1385     spin_unlock_irqrestore(&data->lock, flags);
1386    
1387     + if (skb) {
1388     + struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
1389     + struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
1390     +
1391     + genlmsg_end(skb, genlmsg_data(gnlh));
1392     + }
1393     +
1394     return skb;
1395     }
1396    
1397     diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
1398     index c6d8207ffa7e..32e4e0158846 100644
1399     --- a/net/core/flow_dissector.c
1400     +++ b/net/core/flow_dissector.c
1401     @@ -445,8 +445,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
1402     if (hdr->flags & GRE_ACK)
1403     offset += sizeof(((struct pptp_gre_header *)0)->ack);
1404    
1405     - ppp_hdr = skb_header_pointer(skb, nhoff + offset,
1406     - sizeof(_ppp_hdr), _ppp_hdr);
1407     + ppp_hdr = __skb_header_pointer(skb, nhoff + offset,
1408     + sizeof(_ppp_hdr),
1409     + data, hlen, _ppp_hdr);
1410     if (!ppp_hdr)
1411     goto out_bad;
1412    
1413     diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
1414     index a6196cf844f6..b7f9ae7b1c5f 100644
1415     --- a/net/core/rtnetlink.c
1416     +++ b/net/core/rtnetlink.c
1417     @@ -3886,6 +3886,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
1418     u32 filter_mask;
1419     int err;
1420    
1421     + if (nlmsg_len(nlh) < sizeof(*ifsm))
1422     + return -EINVAL;
1423     +
1424     ifsm = nlmsg_data(nlh);
1425     if (ifsm->ifindex > 0)
1426     dev = __dev_get_by_index(net, ifsm->ifindex);
1427     @@ -3935,6 +3938,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
1428    
1429     cb->seq = net->dev_base_seq;
1430    
1431     + if (nlmsg_len(cb->nlh) < sizeof(*ifsm))
1432     + return -EINVAL;
1433     +
1434     ifsm = nlmsg_data(cb->nlh);
1435     filter_mask = ifsm->filter_mask;
1436     if (!filter_mask)
1437     diff --git a/net/core/sock.c b/net/core/sock.c
1438     index 00a074dbfe9b..bc6543f7de36 100644
1439     --- a/net/core/sock.c
1440     +++ b/net/core/sock.c
1441     @@ -222,7 +222,7 @@ static const char *const af_family_key_strings[AF_MAX+1] = {
1442     "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" ,
1443     "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" ,
1444     "sk_lock-AF_NFC" , "sk_lock-AF_VSOCK" , "sk_lock-AF_KCM" ,
1445     - "sk_lock-AF_MAX"
1446     + "sk_lock-AF_QIPCRTR", "sk_lock-AF_MAX"
1447     };
1448     static const char *const af_family_slock_key_strings[AF_MAX+1] = {
1449     "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
1450     @@ -239,7 +239,7 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {
1451     "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" ,
1452     "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" ,
1453     "slock-AF_NFC" , "slock-AF_VSOCK" ,"slock-AF_KCM" ,
1454     - "slock-AF_MAX"
1455     + "slock-AF_QIPCRTR", "slock-AF_MAX"
1456     };
1457     static const char *const af_family_clock_key_strings[AF_MAX+1] = {
1458     "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
1459     @@ -256,7 +256,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {
1460     "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" ,
1461     "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" ,
1462     "clock-AF_NFC" , "clock-AF_VSOCK" , "clock-AF_KCM" ,
1463     - "clock-AF_MAX"
1464     + "clock-AF_QIPCRTR", "clock-AF_MAX"
1465     };
1466    
1467     /*
1468     diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
1469     index 5fff951a0a49..da3862124545 100644
1470     --- a/net/dsa/dsa2.c
1471     +++ b/net/dsa/dsa2.c
1472     @@ -394,9 +394,11 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
1473     return err;
1474     }
1475    
1476     - err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
1477     - if (err)
1478     - return err;
1479     + if (dst->ds[0]) {
1480     + err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
1481     + if (err)
1482     + return err;
1483     + }
1484    
1485     /* If we use a tagging format that doesn't have an ethertype
1486     * field, make sure that all packets from this point on get
1487     @@ -433,7 +435,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
1488     dsa_ds_unapply(dst, ds);
1489     }
1490    
1491     - dsa_cpu_port_ethtool_restore(dst->ds[0]);
1492     + if (dst->ds[0])
1493     + dsa_cpu_port_ethtool_restore(dst->ds[0]);
1494    
1495     pr_info("DSA: tree %d unapplied\n", dst->tree);
1496     dst->applied = false;
1497     diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
1498     index 161fc0f0d752..3e4f183fc241 100644
1499     --- a/net/ipv4/fib_frontend.c
1500     +++ b/net/ipv4/fib_frontend.c
1501     @@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id)
1502     if (tb)
1503     return tb;
1504    
1505     - if (id == RT_TABLE_LOCAL)
1506     + if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules)
1507     alias = fib_new_table(net, RT_TABLE_MAIN);
1508    
1509     tb = fib_trie_table(id, alias);
1510     diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
1511     index 388d3e21629b..a8508b79b406 100644
1512     --- a/net/ipv4/fib_semantics.c
1513     +++ b/net/ipv4/fib_semantics.c
1514     @@ -1617,8 +1617,13 @@ void fib_select_multipath(struct fib_result *res, int hash)
1515     void fib_select_path(struct net *net, struct fib_result *res,
1516     struct flowi4 *fl4, int mp_hash)
1517     {
1518     + bool oif_check;
1519     +
1520     + oif_check = (fl4->flowi4_oif == 0 ||
1521     + fl4->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF);
1522     +
1523     #ifdef CONFIG_IP_ROUTE_MULTIPATH
1524     - if (res->fi->fib_nhs > 1 && fl4->flowi4_oif == 0) {
1525     + if (res->fi->fib_nhs > 1 && oif_check) {
1526     if (mp_hash < 0)
1527     mp_hash = get_hash_from_flowi4(fl4) >> 1;
1528    
1529     @@ -1628,7 +1633,7 @@ void fib_select_path(struct net *net, struct fib_result *res,
1530     #endif
1531     if (!res->prefixlen &&
1532     res->table->tb_num_default > 1 &&
1533     - res->type == RTN_UNICAST && !fl4->flowi4_oif)
1534     + res->type == RTN_UNICAST && oif_check)
1535     fib_select_default(fl4, res);
1536    
1537     if (!fl4->saddr)
1538     diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
1539     index 15db786d50ed..32a08bc010bf 100644
1540     --- a/net/ipv4/igmp.c
1541     +++ b/net/ipv4/igmp.c
1542     @@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
1543     static void igmp_gq_start_timer(struct in_device *in_dev)
1544     {
1545     int tv = prandom_u32() % in_dev->mr_maxdelay;
1546     + unsigned long exp = jiffies + tv + 2;
1547     +
1548     + if (in_dev->mr_gq_running &&
1549     + time_after_eq(exp, (in_dev->mr_gq_timer).expires))
1550     + return;
1551    
1552     in_dev->mr_gq_running = 1;
1553     - if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2))
1554     + if (!mod_timer(&in_dev->mr_gq_timer, exp))
1555     in_dev_hold(in_dev);
1556     }
1557    
1558     diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
1559     index b8a2d63d1fb8..f226f4086e05 100644
1560     --- a/net/ipv4/ip_sockglue.c
1561     +++ b/net/ipv4/ip_sockglue.c
1562     @@ -137,7 +137,7 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb)
1563     const struct iphdr *iph = ip_hdr(skb);
1564     __be16 *ports = (__be16 *)skb_transport_header(skb);
1565    
1566     - if (skb_transport_offset(skb) + 4 > skb->len)
1567     + if (skb_transport_offset(skb) + 4 > (int)skb->len)
1568     return;
1569    
1570     /* All current transport protocols have the port numbers in the
1571     @@ -1202,8 +1202,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1572     * which has interface index (iif) as the first member of the
1573     * underlying inet{6}_skb_parm struct. This code then overlays
1574     * PKTINFO_SKB_CB and in_pktinfo also has iif as the first
1575     - * element so the iif is picked up from the prior IPCB
1576     + * element so the iif is picked up from the prior IPCB. If iif
1577     + * is the loopback interface, then return the sending interface
1578     + * (e.g., process binds socket to eth0 for Tx which is
1579     + * redirected to loopback in the rtable/dst).
1580     */
1581     + if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)
1582     + pktinfo->ipi_ifindex = inet_iif(skb);
1583     +
1584     pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
1585     } else {
1586     pktinfo->ipi_ifindex = 0;
1587     diff --git a/net/ipv4/route.c b/net/ipv4/route.c
1588     index 2a57566e6e91..8197b06d9aaa 100644
1589     --- a/net/ipv4/route.c
1590     +++ b/net/ipv4/route.c
1591     @@ -1902,7 +1902,8 @@ out: return err;
1592     }
1593     }
1594    
1595     - rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type,
1596     + rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
1597     + flags | RTCF_LOCAL, res.type,
1598     IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
1599     if (!rth)
1600     goto e_nobufs;
1601     diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
1602     index ccf40550c475..8616d17cf08f 100644
1603     --- a/net/ipv6/datagram.c
1604     +++ b/net/ipv6/datagram.c
1605     @@ -700,7 +700,7 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
1606     struct sockaddr_in6 sin6;
1607     __be16 *ports = (__be16 *) skb_transport_header(skb);
1608    
1609     - if (skb_transport_offset(skb) + 4 <= skb->len) {
1610     + if (skb_transport_offset(skb) + 4 <= (int)skb->len) {
1611     /* All current transport protocols have the port numbers in the
1612     * first four bytes of the transport header and this function is
1613     * written with this assumption in mind.
1614     diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
1615     index 89c59e656f44..fc7b4017ba24 100644
1616     --- a/net/ipv6/ip6_offload.c
1617     +++ b/net/ipv6/ip6_offload.c
1618     @@ -191,6 +191,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
1619     ops = rcu_dereference(inet6_offloads[proto]);
1620     if (!ops || !ops->callbacks.gro_receive) {
1621     __pskb_pull(skb, skb_gro_offset(skb));
1622     + skb_gro_frag0_invalidate(skb);
1623     proto = ipv6_gso_pull_exthdrs(skb, proto);
1624     skb_gro_pull(skb, -skb_transport_offset(skb));
1625     skb_reset_transport_header(skb);
1626     diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
1627     index 054a1d84fc5e..869ffc76befa 100644
1628     --- a/net/ipv6/raw.c
1629     +++ b/net/ipv6/raw.c
1630     @@ -589,7 +589,11 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
1631     }
1632    
1633     offset += skb_transport_offset(skb);
1634     - BUG_ON(skb_copy_bits(skb, offset, &csum, 2));
1635     + err = skb_copy_bits(skb, offset, &csum, 2);
1636     + if (err < 0) {
1637     + ip6_flush_pending_frames(sk);
1638     + goto out;
1639     + }
1640    
1641     /* in case cksum was not initialized */
1642     if (unlikely(csum))
1643     diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
1644     index b05d4a2155b0..c1a4b5d30814 100644
1645     --- a/net/sched/cls_api.c
1646     +++ b/net/sched/cls_api.c
1647     @@ -148,13 +148,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
1648     unsigned long cl;
1649     unsigned long fh;
1650     int err;
1651     - int tp_created = 0;
1652     + int tp_created;
1653    
1654     if ((n->nlmsg_type != RTM_GETTFILTER) &&
1655     !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
1656     return -EPERM;
1657    
1658     replay:
1659     + tp_created = 0;
1660     +
1661     err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL);
1662     if (err < 0)
1663     return err;
1664     diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
1665     index 904442421db3..eee299bb6bcf 100644
1666     --- a/net/sched/cls_flower.c
1667     +++ b/net/sched/cls_flower.c
1668     @@ -149,10 +149,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
1669    
1670     switch (ip_tunnel_info_af(info)) {
1671     case AF_INET:
1672     + skb_key.enc_control.addr_type =
1673     + FLOW_DISSECTOR_KEY_IPV4_ADDRS;
1674     skb_key.enc_ipv4.src = key->u.ipv4.src;
1675     skb_key.enc_ipv4.dst = key->u.ipv4.dst;
1676     break;
1677     case AF_INET6:
1678     + skb_key.enc_control.addr_type =
1679     + FLOW_DISSECTOR_KEY_IPV6_ADDRS;
1680     skb_key.enc_ipv6.src = key->u.ipv6.src;
1681     skb_key.enc_ipv6.dst = key->u.ipv6.dst;
1682     break;
1683     diff --git a/net/sctp/socket.c b/net/sctp/socket.c
1684     index f23ad913dc7a..ca12aa346c0d 100644
1685     --- a/net/sctp/socket.c
1686     +++ b/net/sctp/socket.c
1687     @@ -4479,9 +4479,10 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
1688    
1689     rcu_read_lock();
1690     transport = sctp_addrs_lookup_transport(net, laddr, paddr);
1691     - if (!transport || !sctp_transport_hold(transport))
1692     + if (!transport || !sctp_transport_hold(transport)) {
1693     + rcu_read_unlock();
1694     goto out;
1695     -
1696     + }
1697     rcu_read_unlock();
1698     err = cb(transport, p);
1699     sctp_transport_put(transport);
1700     diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1701     index 20027f8de129..6035c5a380a6 100644
1702     --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1703     +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1704     @@ -359,6 +359,7 @@ xprt_setup_rdma_bc(struct xprt_create *args)
1705     out_fail:
1706     xprt_rdma_free_addresses(xprt);
1707     args->bc_xprt->xpt_bc_xprt = NULL;
1708     + args->bc_xprt->xpt_bc_xps = NULL;
1709     xprt_put(xprt);
1710     xprt_free(xprt);
1711     return ERR_PTR(-EINVAL);
1712     diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c
1713     index 4ad3bd7fd445..f1657a4e0621 100644
1714     --- a/sound/firewire/tascam/tascam-stream.c
1715     +++ b/sound/firewire/tascam/tascam-stream.c
1716     @@ -343,7 +343,7 @@ int snd_tscm_stream_init_duplex(struct snd_tscm *tscm)
1717     if (err < 0)
1718     amdtp_stream_destroy(&tscm->rx_stream);
1719    
1720     - return 0;
1721     + return err;
1722     }
1723    
1724     /* At bus reset, streaming is stopped and some registers are clear. */
1725     diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
1726     index 2782155ae3ce..93bb14e7e0f7 100644
1727     --- a/sound/usb/quirks.c
1728     +++ b/sound/usb/quirks.c
1729     @@ -1135,6 +1135,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1730     case USB_ID(0x045E, 0x076F): /* MS Lifecam HD-6000 */
1731     case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */
1732     case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */
1733     + case USB_ID(0x047F, 0x02F7): /* Plantronics BT-600 */
1734     case USB_ID(0x047F, 0x0415): /* Plantronics BT-300 */
1735     case USB_ID(0x047F, 0xAA05): /* Plantronics DA45 */
1736     case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
1737     diff --git a/tools/virtio/linux/compiler.h b/tools/virtio/linux/compiler.h
1738     index 845960e1cbf2..c9ccfd42ec13 100644
1739     --- a/tools/virtio/linux/compiler.h
1740     +++ b/tools/virtio/linux/compiler.h
1741     @@ -4,6 +4,6 @@
1742     #define WRITE_ONCE(var, val) \
1743     (*((volatile typeof(val) *)(&(var))) = (val))
1744    
1745     -#define READ_ONCE(var) (*((volatile typeof(val) *)(&(var))))
1746     +#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var))))
1747    
1748     #endif