Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0183-4.9.84-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3203 - (hide annotations) (download)
Wed Aug 8 14:26:04 2018 UTC (5 years, 9 months ago) by niro
File size: 171141 byte(s)
-linux-4.9.84
1 niro 3203 diff --git a/Makefile b/Makefile
2     index cfae9b823d2b..db13b13cdcc2 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 83
9     +SUBLEVEL = 84
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     @@ -87,10 +87,12 @@ endif
14     ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
15     ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
16     quiet=silent_
17     + tools_silent=s
18     endif
19     else # make-3.8x
20     ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
21     quiet=silent_
22     + tools_silent=-s
23     endif
24     endif
25    
26     @@ -1614,11 +1616,11 @@ image_name:
27     # Clear a bunch of variables before executing the submake
28     tools/: FORCE
29     $(Q)mkdir -p $(objtree)/tools
30     - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
31     + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
32    
33     tools/%: FORCE
34     $(Q)mkdir -p $(objtree)/tools
35     - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
36     + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
37    
38     # Single targets
39     # ---------------------------------------------------------------------------
40     diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
41     index a20a71d9d22e..c9c9a47446e8 100644
42     --- a/arch/arm/boot/dts/am4372.dtsi
43     +++ b/arch/arm/boot/dts/am4372.dtsi
44     @@ -926,7 +926,8 @@
45     reg = <0x48038000 0x2000>,
46     <0x46000000 0x400000>;
47     reg-names = "mpu", "dat";
48     - interrupts = <80>, <81>;
49     + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>,
50     + <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
51     interrupt-names = "tx", "rx";
52     status = "disabled";
53     dmas = <&edma 8 2>,
54     @@ -940,7 +941,8 @@
55     reg = <0x4803C000 0x2000>,
56     <0x46400000 0x400000>;
57     reg-names = "mpu", "dat";
58     - interrupts = <82>, <83>;
59     + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,
60     + <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
61     interrupt-names = "tx", "rx";
62     status = "disabled";
63     dmas = <&edma 10 2>,
64     diff --git a/arch/arm/boot/dts/am437x-cm-t43.dts b/arch/arm/boot/dts/am437x-cm-t43.dts
65     index 9e92d480576b..3b9a94c274a7 100644
66     --- a/arch/arm/boot/dts/am437x-cm-t43.dts
67     +++ b/arch/arm/boot/dts/am437x-cm-t43.dts
68     @@ -301,8 +301,8 @@
69     status = "okay";
70     pinctrl-names = "default";
71     pinctrl-0 = <&spi0_pins>;
72     - dmas = <&edma 16
73     - &edma 17>;
74     + dmas = <&edma 16 0
75     + &edma 17 0>;
76     dma-names = "tx0", "rx0";
77    
78     flash: w25q64cvzpig@0 {
79     diff --git a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
80     index 38faa90007d7..2fa5eb4bd402 100644
81     --- a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
82     +++ b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
83     @@ -72,7 +72,8 @@
84     };
85    
86     &gpmc {
87     - ranges = <1 0 0x08000000 0x1000000>; /* CS1: 16MB for LAN9221 */
88     + ranges = <0 0 0x30000000 0x1000000 /* CS0: 16MB for NAND */
89     + 1 0 0x2c000000 0x1000000>; /* CS1: 16MB for LAN9221 */
90    
91     ethernet@gpmc {
92     pinctrl-names = "default";
93     diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi
94     index 26cce4d18405..4f2c5ec75714 100644
95     --- a/arch/arm/boot/dts/logicpd-som-lv.dtsi
96     +++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
97     @@ -37,7 +37,7 @@
98     };
99    
100     &gpmc {
101     - ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */
102     + ranges = <0 0 0x30000000 0x1000000>; /* CS0: 16MB for NAND */
103    
104     nand@0,0 {
105     compatible = "ti,omap2-nand";
106     @@ -121,7 +121,7 @@
107    
108     &mmc3 {
109     interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>;
110     - pinctrl-0 = <&mmc3_pins>;
111     + pinctrl-0 = <&mmc3_pins &wl127x_gpio>;
112     pinctrl-names = "default";
113     vmmc-supply = <&wl12xx_vmmc>;
114     non-removable;
115     @@ -132,8 +132,8 @@
116     wlcore: wlcore@2 {
117     compatible = "ti,wl1273";
118     reg = <2>;
119     - interrupt-parent = <&gpio5>;
120     - interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; /* gpio 152 */
121     + interrupt-parent = <&gpio1>;
122     + interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; /* gpio 2 */
123     ref-clock-frequency = <26000000>;
124     };
125     };
126     @@ -157,8 +157,6 @@
127     OMAP3_CORE1_IOPAD(0x2166, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat5.sdmmc3_dat1 */
128     OMAP3_CORE1_IOPAD(0x2168, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat6.sdmmc3_dat2 */
129     OMAP3_CORE1_IOPAD(0x216a, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat6.sdmmc3_dat3 */
130     - OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT_PULLUP | MUX_MODE4) /* mcbsp4_clkx.gpio_152 */
131     - OMAP3_CORE1_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */
132     OMAP3_CORE1_IOPAD(0x21d0, PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.sdmmc3_cmd */
133     OMAP3_CORE1_IOPAD(0x21d2, PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs2.sdmmc_clk */
134     >;
135     @@ -228,6 +226,12 @@
136     OMAP3_WKUP_IOPAD(0x2a0e, PIN_OUTPUT | MUX_MODE4) /* sys_boot2.gpio_4 */
137     >;
138     };
139     + wl127x_gpio: pinmux_wl127x_gpio_pin {
140     + pinctrl-single,pins = <
141     + OMAP3_WKUP_IOPAD(0x2a0c, PIN_INPUT | MUX_MODE4) /* sys_boot0.gpio_2 */
142     + OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */
143     + >;
144     + };
145     };
146    
147     &omap3_pmx_core2 {
148     diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
149     index 9c289ddab3df..4d6584f15b17 100644
150     --- a/arch/arm/boot/dts/omap4.dtsi
151     +++ b/arch/arm/boot/dts/omap4.dtsi
152     @@ -352,7 +352,7 @@
153     elm: elm@48078000 {
154     compatible = "ti,am3352-elm";
155     reg = <0x48078000 0x2000>;
156     - interrupts = <4>;
157     + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
158     ti,hwmods = "elm";
159     status = "disabled";
160     };
161     @@ -859,14 +859,12 @@
162     usbhsohci: ohci@4a064800 {
163     compatible = "ti,ohci-omap3";
164     reg = <0x4a064800 0x400>;
165     - interrupt-parent = <&gic>;
166     interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
167     };
168    
169     usbhsehci: ehci@4a064c00 {
170     compatible = "ti,ehci-omap";
171     reg = <0x4a064c00 0x400>;
172     - interrupt-parent = <&gic>;
173     interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
174     };
175     };
176     diff --git a/arch/arm/common/bL_switcher_dummy_if.c b/arch/arm/common/bL_switcher_dummy_if.c
177     index 6053f64c3752..94133e33943c 100644
178     --- a/arch/arm/common/bL_switcher_dummy_if.c
179     +++ b/arch/arm/common/bL_switcher_dummy_if.c
180     @@ -57,3 +57,7 @@ static struct miscdevice bL_switcher_device = {
181     &bL_switcher_fops
182     };
183     module_misc_device(bL_switcher_device);
184     +
185     +MODULE_AUTHOR("Nicolas Pitre <nico@linaro.org>");
186     +MODULE_LICENSE("GPL v2");
187     +MODULE_DESCRIPTION("big.LITTLE switcher dummy user interface");
188     diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
189     index 5ac122e88f67..9ff92050053c 100644
190     --- a/arch/arm/mach-omap2/omap-secure.c
191     +++ b/arch/arm/mach-omap2/omap-secure.c
192     @@ -73,6 +73,25 @@ phys_addr_t omap_secure_ram_mempool_base(void)
193     return omap_secure_memblock_base;
194     }
195    
196     +u32 omap3_save_secure_ram(void __iomem *addr, int size)
197     +{
198     + u32 ret;
199     + u32 param[5];
200     +
201     + if (size != OMAP3_SAVE_SECURE_RAM_SZ)
202     + return OMAP3_SAVE_SECURE_RAM_SZ;
203     +
204     + param[0] = 4; /* Number of arguments */
205     + param[1] = __pa(addr); /* Physical address for saving */
206     + param[2] = 0;
207     + param[3] = 1;
208     + param[4] = 1;
209     +
210     + ret = save_secure_ram_context(__pa(param));
211     +
212     + return ret;
213     +}
214     +
215     /**
216     * rx51_secure_dispatcher: Routine to dispatch secure PPA API calls
217     * @idx: The PPA API index
218     diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
219     index bae263fba640..c509cde71f93 100644
220     --- a/arch/arm/mach-omap2/omap-secure.h
221     +++ b/arch/arm/mach-omap2/omap-secure.h
222     @@ -31,6 +31,8 @@
223     /* Maximum Secure memory storage size */
224     #define OMAP_SECURE_RAM_STORAGE (88 * SZ_1K)
225    
226     +#define OMAP3_SAVE_SECURE_RAM_SZ 0x803F
227     +
228     /* Secure low power HAL API index */
229     #define OMAP4_HAL_SAVESECURERAM_INDEX 0x1a
230     #define OMAP4_HAL_SAVEHW_INDEX 0x1b
231     @@ -65,6 +67,8 @@ extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
232     extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32 pargs);
233     extern phys_addr_t omap_secure_ram_mempool_base(void);
234     extern int omap_secure_ram_reserve_memblock(void);
235     +extern u32 save_secure_ram_context(u32 args_pa);
236     +extern u32 omap3_save_secure_ram(void __iomem *save_regs, int size);
237    
238     extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs,
239     u32 arg1, u32 arg2, u32 arg3, u32 arg4);
240     diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
241     index b668719b9b25..8e30772cfe32 100644
242     --- a/arch/arm/mach-omap2/pm.h
243     +++ b/arch/arm/mach-omap2/pm.h
244     @@ -81,10 +81,6 @@ extern unsigned int omap3_do_wfi_sz;
245     /* ... and its pointer from SRAM after copy */
246     extern void (*omap3_do_wfi_sram)(void);
247    
248     -/* save_secure_ram_context function pointer and size, for copy to SRAM */
249     -extern int save_secure_ram_context(u32 *addr);
250     -extern unsigned int save_secure_ram_context_sz;
251     -
252     extern void omap3_save_scratchpad_contents(void);
253    
254     #define PM_RTA_ERRATUM_i608 (1 << 0)
255     diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
256     index d44e0e2f1106..3836958074ac 100644
257     --- a/arch/arm/mach-omap2/pm34xx.c
258     +++ b/arch/arm/mach-omap2/pm34xx.c
259     @@ -48,6 +48,7 @@
260     #include "prm3xxx.h"
261     #include "pm.h"
262     #include "sdrc.h"
263     +#include "omap-secure.h"
264     #include "sram.h"
265     #include "control.h"
266     #include "vc.h"
267     @@ -66,7 +67,6 @@ struct power_state {
268    
269     static LIST_HEAD(pwrst_list);
270    
271     -static int (*_omap_save_secure_sram)(u32 *addr);
272     void (*omap3_do_wfi_sram)(void);
273    
274     static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
275     @@ -121,8 +121,8 @@ static void omap3_save_secure_ram_context(void)
276     * will hang the system.
277     */
278     pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
279     - ret = _omap_save_secure_sram((u32 *)(unsigned long)
280     - __pa(omap3_secure_ram_storage));
281     + ret = omap3_save_secure_ram(omap3_secure_ram_storage,
282     + OMAP3_SAVE_SECURE_RAM_SZ);
283     pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state);
284     /* Following is for error tracking, it should not happen */
285     if (ret) {
286     @@ -434,15 +434,10 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
287     *
288     * The minimum set of functions is pushed to SRAM for execution:
289     * - omap3_do_wfi for erratum i581 WA,
290     - * - save_secure_ram_context for security extensions.
291     */
292     void omap_push_sram_idle(void)
293     {
294     omap3_do_wfi_sram = omap_sram_push(omap3_do_wfi, omap3_do_wfi_sz);
295     -
296     - if (omap_type() != OMAP2_DEVICE_TYPE_GP)
297     - _omap_save_secure_sram = omap_sram_push(save_secure_ram_context,
298     - save_secure_ram_context_sz);
299     }
300    
301     static void __init pm_errata_configure(void)
302     @@ -554,7 +549,7 @@ int __init omap3_pm_init(void)
303     clkdm_add_wkdep(neon_clkdm, mpu_clkdm);
304     if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
305     omap3_secure_ram_storage =
306     - kmalloc(0x803F, GFP_KERNEL);
307     + kmalloc(OMAP3_SAVE_SECURE_RAM_SZ, GFP_KERNEL);
308     if (!omap3_secure_ram_storage)
309     pr_err("Memory allocation failed when allocating for secure sram context\n");
310    
311     diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
312     index dcb5001d77da..973bcd754e1c 100644
313     --- a/arch/arm/mach-omap2/prm33xx.c
314     +++ b/arch/arm/mach-omap2/prm33xx.c
315     @@ -176,17 +176,6 @@ static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
316     return v;
317     }
318    
319     -static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
320     -{
321     - u32 v;
322     -
323     - v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
324     - v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
325     - v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
326     -
327     - return v;
328     -}
329     -
330     static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
331     {
332     am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
333     @@ -357,7 +346,6 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
334     .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
335     .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
336     .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
337     - .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
338     .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
339     .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
340     .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
341     diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
342     index 1b9f0520dea9..3e0d802c59da 100644
343     --- a/arch/arm/mach-omap2/sleep34xx.S
344     +++ b/arch/arm/mach-omap2/sleep34xx.S
345     @@ -93,20 +93,13 @@ ENTRY(enable_omap3630_toggle_l2_on_restore)
346     ENDPROC(enable_omap3630_toggle_l2_on_restore)
347    
348     /*
349     - * Function to call rom code to save secure ram context. This gets
350     - * relocated to SRAM, so it can be all in .data section. Otherwise
351     - * we need to initialize api_params separately.
352     + * Function to call rom code to save secure ram context.
353     + *
354     + * r0 = physical address of the parameters
355     */
356     - .data
357     - .align 3
358     ENTRY(save_secure_ram_context)
359     stmfd sp!, {r4 - r11, lr} @ save registers on stack
360     - adr r3, api_params @ r3 points to parameters
361     - str r0, [r3,#0x4] @ r0 has sdram address
362     - ldr r12, high_mask
363     - and r3, r3, r12
364     - ldr r12, sram_phy_addr_mask
365     - orr r3, r3, r12
366     + mov r3, r0 @ physical address of parameters
367     mov r0, #25 @ set service ID for PPA
368     mov r12, r0 @ copy secure service ID in r12
369     mov r1, #0 @ set task id for ROM code in r1
370     @@ -120,18 +113,7 @@ ENTRY(save_secure_ram_context)
371     nop
372     nop
373     ldmfd sp!, {r4 - r11, pc}
374     - .align
375     -sram_phy_addr_mask:
376     - .word SRAM_BASE_P
377     -high_mask:
378     - .word 0xffff
379     -api_params:
380     - .word 0x4, 0x0, 0x0, 0x1, 0x1
381     ENDPROC(save_secure_ram_context)
382     -ENTRY(save_secure_ram_context_sz)
383     - .word . - save_secure_ram_context
384     -
385     - .text
386    
387     /*
388     * ======================
389     diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
390     index cf57a7799a0f..7769c2e27788 100644
391     --- a/arch/arm64/Kconfig
392     +++ b/arch/arm64/Kconfig
393     @@ -1007,7 +1007,7 @@ source "fs/Kconfig.binfmt"
394     config COMPAT
395     bool "Kernel support for 32-bit EL0"
396     depends on ARM64_4K_PAGES || EXPERT
397     - select COMPAT_BINFMT_ELF
398     + select COMPAT_BINFMT_ELF if BINFMT_ELF
399     select HAVE_UID16
400     select OLD_SIGSUSPEND3
401     select COMPAT_OLD_SIGACTION
402     diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
403     index 101794f5ce10..08a4497f70a6 100644
404     --- a/arch/arm64/Kconfig.platforms
405     +++ b/arch/arm64/Kconfig.platforms
406     @@ -2,9 +2,11 @@ menu "Platform selection"
407    
408     config ARCH_SUNXI
409     bool "Allwinner sunxi 64-bit SoC Family"
410     + select ARCH_HAS_RESET_CONTROLLER
411     select GENERIC_IRQ_CHIP
412     select PINCTRL
413     select PINCTRL_SUN50I_A64
414     + select RESET_CONTROLLER
415     help
416     This enables support for Allwinner sunxi based SoCs like the A64.
417    
418     diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
419     index 6c03c1702bb3..b307d6b6357e 100644
420     --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
421     +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
422     @@ -73,6 +73,7 @@
423     reg = <0x000>;
424     enable-method = "psci";
425     cpu-idle-states = <&CPU_SLEEP_0>;
426     + #cooling-cells = <2>;
427     };
428    
429     cpu1: cpu@1 {
430     @@ -89,6 +90,7 @@
431     reg = <0x100>;
432     enable-method = "psci";
433     cpu-idle-states = <&CPU_SLEEP_0>;
434     + #cooling-cells = <2>;
435     };
436    
437     cpu3: cpu@101 {
438     diff --git a/arch/arm64/crypto/crc32-arm64.c b/arch/arm64/crypto/crc32-arm64.c
439     index 6a37c3c6b11d..3ec568afd1d3 100644
440     --- a/arch/arm64/crypto/crc32-arm64.c
441     +++ b/arch/arm64/crypto/crc32-arm64.c
442     @@ -232,6 +232,7 @@ static struct shash_alg crc32_alg = {
443     .cra_name = "crc32",
444     .cra_driver_name = "crc32-arm64-hw",
445     .cra_priority = 300,
446     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
447     .cra_blocksize = CHKSUM_BLOCK_SIZE,
448     .cra_alignmask = 0,
449     .cra_ctxsize = sizeof(struct chksum_ctx),
450     @@ -253,6 +254,7 @@ static struct shash_alg crc32c_alg = {
451     .cra_name = "crc32c",
452     .cra_driver_name = "crc32c-arm64-hw",
453     .cra_priority = 300,
454     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
455     .cra_blocksize = CHKSUM_BLOCK_SIZE,
456     .cra_alignmask = 0,
457     .cra_ctxsize = sizeof(struct chksum_ctx),
458     diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
459     index 561190d15881..0bfe1df12b19 100644
460     --- a/arch/arm64/include/asm/bug.h
461     +++ b/arch/arm64/include/asm/bug.h
462     @@ -20,9 +20,6 @@
463    
464     #include <asm/brk-imm.h>
465    
466     -#ifdef CONFIG_GENERIC_BUG
467     -#define HAVE_ARCH_BUG
468     -
469     #ifdef CONFIG_DEBUG_BUGVERBOSE
470     #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
471     #define __BUGVERBOSE_LOCATION(file, line) \
472     @@ -36,28 +33,36 @@
473     #define _BUGVERBOSE_LOCATION(file, line)
474     #endif
475    
476     -#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
477     +#ifdef CONFIG_GENERIC_BUG
478    
479     -#define __BUG_FLAGS(flags) asm volatile ( \
480     +#define __BUG_ENTRY(flags) \
481     ".pushsection __bug_table,\"a\"\n\t" \
482     ".align 2\n\t" \
483     "0: .long 1f - 0b\n\t" \
484     _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
485     ".short " #flags "\n\t" \
486     ".popsection\n" \
487     - \
488     - "1: brk %[imm]" \
489     - :: [imm] "i" (BUG_BRK_IMM) \
490     -)
491     + "1: "
492     +#else
493     +#define __BUG_ENTRY(flags) ""
494     +#endif
495     +
496     +#define __BUG_FLAGS(flags) \
497     + asm volatile ( \
498     + __BUG_ENTRY(flags) \
499     + "brk %[imm]" :: [imm] "i" (BUG_BRK_IMM) \
500     + );
501    
502     -#define BUG() do { \
503     - _BUG_FLAGS(0); \
504     - unreachable(); \
505     +
506     +#define BUG() do { \
507     + __BUG_FLAGS(0); \
508     + unreachable(); \
509     } while (0)
510    
511     -#define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
512     +#define __WARN_TAINT(taint) \
513     + __BUG_FLAGS(BUGFLAG_TAINT(taint))
514    
515     -#endif /* ! CONFIG_GENERIC_BUG */
516     +#define HAVE_ARCH_BUG
517    
518     #include <asm-generic/bug.h>
519    
520     diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
521     index 05615a3fdc6f..d5cc6d73c2c4 100644
522     --- a/arch/arm64/mm/mmu.c
523     +++ b/arch/arm64/mm/mmu.c
524     @@ -479,7 +479,7 @@ void __init paging_init(void)
525     * To do this we need to go via a temporary pgd.
526     */
527     cpu_replace_ttbr1(__va(pgd_phys));
528     - memcpy(swapper_pg_dir, pgd, PAGE_SIZE);
529     + memcpy(swapper_pg_dir, pgd, PGD_SIZE);
530     cpu_replace_ttbr1(swapper_pg_dir);
531    
532     pgd_clear_fixmap();
533     diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
534     index d2c8abf1c8c4..e958abe0f51e 100644
535     --- a/arch/m68k/kernel/vmlinux-nommu.lds
536     +++ b/arch/m68k/kernel/vmlinux-nommu.lds
537     @@ -44,6 +44,8 @@ SECTIONS {
538     .text : {
539     HEAD_TEXT
540     TEXT_TEXT
541     + IRQENTRY_TEXT
542     + SOFTIRQENTRY_TEXT
543     SCHED_TEXT
544     CPUIDLE_TEXT
545     LOCK_TEXT
546     diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
547     index 5b5ce1e4d1ed..1656ae8a145d 100644
548     --- a/arch/m68k/kernel/vmlinux-std.lds
549     +++ b/arch/m68k/kernel/vmlinux-std.lds
550     @@ -15,6 +15,8 @@ SECTIONS
551     .text : {
552     HEAD_TEXT
553     TEXT_TEXT
554     + IRQENTRY_TEXT
555     + SOFTIRQENTRY_TEXT
556     SCHED_TEXT
557     CPUIDLE_TEXT
558     LOCK_TEXT
559     diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
560     index fe5ea1974b16..07b9818b3176 100644
561     --- a/arch/m68k/kernel/vmlinux-sun3.lds
562     +++ b/arch/m68k/kernel/vmlinux-sun3.lds
563     @@ -15,6 +15,8 @@ SECTIONS
564     .text : {
565     HEAD_TEXT
566     TEXT_TEXT
567     + IRQENTRY_TEXT
568     + SOFTIRQENTRY_TEXT
569     SCHED_TEXT
570     CPUIDLE_TEXT
571     LOCK_TEXT
572     diff --git a/arch/powerpc/crypto/crc32c-vpmsum_glue.c b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
573     index f058e0c3e4d4..fd1d6c83f0c0 100644
574     --- a/arch/powerpc/crypto/crc32c-vpmsum_glue.c
575     +++ b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
576     @@ -141,6 +141,7 @@ static struct shash_alg alg = {
577     .cra_name = "crc32c",
578     .cra_driver_name = "crc32c-vpmsum",
579     .cra_priority = 200,
580     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
581     .cra_blocksize = CHKSUM_BLOCK_SIZE,
582     .cra_ctxsize = sizeof(u32),
583     .cra_module = THIS_MODULE,
584     diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
585     index cab6d2a46c41..903e76a9f158 100644
586     --- a/arch/powerpc/include/asm/exception-64s.h
587     +++ b/arch/powerpc/include/asm/exception-64s.h
588     @@ -242,7 +242,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
589     mtspr SPRN_##h##SRR0,r12; \
590     mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
591     mtspr SPRN_##h##SRR1,r10; \
592     - h##rfid; \
593     + h##RFI_TO_KERNEL; \
594     b . /* prevent speculative execution */
595     #define EXCEPTION_PROLOG_PSERIES_1(label, h) \
596     __EXCEPTION_PROLOG_PSERIES_1(label, h)
597     diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
598     index ea43897183fd..c75ee2d886fc 100644
599     --- a/arch/powerpc/include/asm/paca.h
600     +++ b/arch/powerpc/include/asm/paca.h
601     @@ -212,8 +212,7 @@ struct paca_struct {
602     */
603     u64 exrfi[13] __aligned(0x80);
604     void *rfi_flush_fallback_area;
605     - u64 l1d_flush_congruence;
606     - u64 l1d_flush_sets;
607     + u64 l1d_flush_size;
608     #endif
609     };
610    
611     diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
612     index 64bcbd580495..14fbbd9035ca 100644
613     --- a/arch/powerpc/kernel/asm-offsets.c
614     +++ b/arch/powerpc/kernel/asm-offsets.c
615     @@ -242,8 +242,7 @@ int main(void)
616     DEFINE(PACA_IN_MCE, offsetof(struct paca_struct, in_mce));
617     DEFINE(PACA_RFI_FLUSH_FALLBACK_AREA, offsetof(struct paca_struct, rfi_flush_fallback_area));
618     DEFINE(PACA_EXRFI, offsetof(struct paca_struct, exrfi));
619     - DEFINE(PACA_L1D_FLUSH_CONGRUENCE, offsetof(struct paca_struct, l1d_flush_congruence));
620     - DEFINE(PACA_L1D_FLUSH_SETS, offsetof(struct paca_struct, l1d_flush_sets));
621     + DEFINE(PACA_L1D_FLUSH_SIZE, offsetof(struct paca_struct, l1d_flush_size));
622     #endif
623     DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
624     DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state));
625     diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
626     index 9121b9a35c8a..2dc52e6d2af4 100644
627     --- a/arch/powerpc/kernel/entry_64.S
628     +++ b/arch/powerpc/kernel/entry_64.S
629     @@ -401,8 +401,7 @@ tabort_syscall:
630     mtmsrd r10, 1
631     mtspr SPRN_SRR0, r11
632     mtspr SPRN_SRR1, r12
633     -
634     - rfid
635     + RFI_TO_USER
636     b . /* prevent speculative execution */
637     #endif
638    
639     @@ -1078,7 +1077,7 @@ _GLOBAL(enter_rtas)
640    
641     mtspr SPRN_SRR0,r5
642     mtspr SPRN_SRR1,r6
643     - rfid
644     + RFI_TO_KERNEL
645     b . /* prevent speculative execution */
646    
647     rtas_return_loc:
648     @@ -1103,7 +1102,7 @@ rtas_return_loc:
649    
650     mtspr SPRN_SRR0,r3
651     mtspr SPRN_SRR1,r4
652     - rfid
653     + RFI_TO_KERNEL
654     b . /* prevent speculative execution */
655    
656     .align 3
657     @@ -1174,7 +1173,7 @@ _GLOBAL(enter_prom)
658     LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_ISF | MSR_LE)
659     andc r11,r11,r12
660     mtsrr1 r11
661     - rfid
662     + RFI_TO_KERNEL
663     #endif /* CONFIG_PPC_BOOK3E */
664    
665     1: /* Return from OF */
666     diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
667     index 96db6c3adebe..7614d1dd2c0b 100644
668     --- a/arch/powerpc/kernel/exceptions-64s.S
669     +++ b/arch/powerpc/kernel/exceptions-64s.S
670     @@ -244,7 +244,7 @@ BEGIN_FTR_SECTION
671     LOAD_HANDLER(r12, machine_check_handle_early)
672     1: mtspr SPRN_SRR0,r12
673     mtspr SPRN_SRR1,r11
674     - rfid
675     + RFI_TO_KERNEL
676     b . /* prevent speculative execution */
677     2:
678     /* Stack overflow. Stay on emergency stack and panic.
679     @@ -280,7 +280,7 @@ machine_check_pSeries_0:
680     mtspr SPRN_SRR0,r12
681     mfspr r12,SPRN_SRR1
682     mtspr SPRN_SRR1,r10
683     - rfid
684     + RFI_TO_KERNEL
685     b . /* prevent speculative execution */
686    
687     TRAMP_KVM_SKIP(PACA_EXMC, 0x200)
688     @@ -446,7 +446,7 @@ EXC_COMMON_BEGIN(machine_check_handle_early)
689     li r3,MSR_ME
690     andc r10,r10,r3 /* Turn off MSR_ME */
691     mtspr SPRN_SRR1,r10
692     - rfid
693     + RFI_TO_KERNEL
694     b .
695     2:
696     /*
697     @@ -464,7 +464,7 @@ EXC_COMMON_BEGIN(machine_check_handle_early)
698     */
699     bl machine_check_queue_event
700     MACHINE_CHECK_HANDLER_WINDUP
701     - rfid
702     + RFI_TO_USER_OR_KERNEL
703     9:
704     /* Deliver the machine check to host kernel in V mode. */
705     MACHINE_CHECK_HANDLER_WINDUP
706     @@ -680,6 +680,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX)
707     .machine push
708     .machine "power4"
709     mtcrf 0x80,r9
710     + mtcrf 0x02,r9 /* I/D indication is in cr6 */
711     mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */
712     .machine pop
713    
714     @@ -705,7 +706,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX)
715     mtspr SPRN_SRR0,r10
716     ld r10,PACAKMSR(r13)
717     mtspr SPRN_SRR1,r10
718     - rfid
719     + RFI_TO_KERNEL
720     b .
721    
722     EXC_COMMON_BEGIN(unrecov_slb)
723     @@ -892,7 +893,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
724     mtspr SPRN_SRR0,r10 ; \
725     ld r10,PACAKMSR(r13) ; \
726     mtspr SPRN_SRR1,r10 ; \
727     - rfid ; \
728     + RFI_TO_KERNEL ; \
729     b . ; /* prevent speculative execution */
730    
731     #define SYSCALL_PSERIES_3 \
732     @@ -900,7 +901,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
733     1: mfspr r12,SPRN_SRR1 ; \
734     xori r12,r12,MSR_LE ; \
735     mtspr SPRN_SRR1,r12 ; \
736     - rfid ; /* return to userspace */ \
737     + RFI_TO_USER ; /* return to userspace */ \
738     b . ; /* prevent speculative execution */
739    
740     #if defined(CONFIG_RELOCATABLE)
741     @@ -1275,7 +1276,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
742     ld r11,PACA_EXGEN+EX_R11(r13)
743     ld r12,PACA_EXGEN+EX_R12(r13)
744     ld r13,PACA_EXGEN+EX_R13(r13)
745     - HRFID
746     + HRFI_TO_UNKNOWN
747     b .
748     #endif
749    
750     @@ -1349,7 +1350,7 @@ masked_##_H##interrupt: \
751     ld r10,PACA_EXGEN+EX_R10(r13); \
752     ld r11,PACA_EXGEN+EX_R11(r13); \
753     GET_SCRATCH0(r13); \
754     - ##_H##rfid; \
755     + ##_H##RFI_TO_KERNEL; \
756     b .
757    
758     /*
759     @@ -1371,7 +1372,7 @@ TRAMP_REAL_BEGIN(kvmppc_skip_interrupt)
760     addi r13, r13, 4
761     mtspr SPRN_SRR0, r13
762     GET_SCRATCH0(r13)
763     - rfid
764     + RFI_TO_KERNEL
765     b .
766    
767     TRAMP_REAL_BEGIN(kvmppc_skip_Hinterrupt)
768     @@ -1383,7 +1384,7 @@ TRAMP_REAL_BEGIN(kvmppc_skip_Hinterrupt)
769     addi r13, r13, 4
770     mtspr SPRN_HSRR0, r13
771     GET_SCRATCH0(r13)
772     - hrfid
773     + HRFI_TO_KERNEL
774     b .
775     #endif
776    
777     @@ -1601,39 +1602,37 @@ rfi_flush_fallback:
778     std r9,PACA_EXRFI+EX_R9(r13)
779     std r10,PACA_EXRFI+EX_R10(r13)
780     std r11,PACA_EXRFI+EX_R11(r13)
781     - std r12,PACA_EXRFI+EX_R12(r13)
782     - std r8,PACA_EXRFI+EX_R13(r13)
783     mfctr r9
784     ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13)
785     - ld r11,PACA_L1D_FLUSH_SETS(r13)
786     - ld r12,PACA_L1D_FLUSH_CONGRUENCE(r13)
787     - /*
788     - * The load adresses are at staggered offsets within cachelines,
789     - * which suits some pipelines better (on others it should not
790     - * hurt).
791     - */
792     - addi r12,r12,8
793     + ld r11,PACA_L1D_FLUSH_SIZE(r13)
794     + srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */
795     mtctr r11
796     DCBT_STOP_ALL_STREAM_IDS(r11) /* Stop prefetch streams */
797    
798     /* order ld/st prior to dcbt stop all streams with flushing */
799     sync
800     -1: li r8,0
801     - .rept 8 /* 8-way set associative */
802     - ldx r11,r10,r8
803     - add r8,r8,r12
804     - xor r11,r11,r11 // Ensure r11 is 0 even if fallback area is not
805     - add r8,r8,r11 // Add 0, this creates a dependency on the ldx
806     - .endr
807     - addi r10,r10,128 /* 128 byte cache line */
808     +
809     + /*
810     + * The load adresses are at staggered offsets within cachelines,
811     + * which suits some pipelines better (on others it should not
812     + * hurt).
813     + */
814     +1:
815     + ld r11,(0x80 + 8)*0(r10)
816     + ld r11,(0x80 + 8)*1(r10)
817     + ld r11,(0x80 + 8)*2(r10)
818     + ld r11,(0x80 + 8)*3(r10)
819     + ld r11,(0x80 + 8)*4(r10)
820     + ld r11,(0x80 + 8)*5(r10)
821     + ld r11,(0x80 + 8)*6(r10)
822     + ld r11,(0x80 + 8)*7(r10)
823     + addi r10,r10,0x80*8
824     bdnz 1b
825    
826     mtctr r9
827     ld r9,PACA_EXRFI+EX_R9(r13)
828     ld r10,PACA_EXRFI+EX_R10(r13)
829     ld r11,PACA_EXRFI+EX_R11(r13)
830     - ld r12,PACA_EXRFI+EX_R12(r13)
831     - ld r8,PACA_EXRFI+EX_R13(r13)
832     GET_SCRATCH0(r13);
833     rfid
834    
835     @@ -1644,39 +1643,37 @@ hrfi_flush_fallback:
836     std r9,PACA_EXRFI+EX_R9(r13)
837     std r10,PACA_EXRFI+EX_R10(r13)
838     std r11,PACA_EXRFI+EX_R11(r13)
839     - std r12,PACA_EXRFI+EX_R12(r13)
840     - std r8,PACA_EXRFI+EX_R13(r13)
841     mfctr r9
842     ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13)
843     - ld r11,PACA_L1D_FLUSH_SETS(r13)
844     - ld r12,PACA_L1D_FLUSH_CONGRUENCE(r13)
845     - /*
846     - * The load adresses are at staggered offsets within cachelines,
847     - * which suits some pipelines better (on others it should not
848     - * hurt).
849     - */
850     - addi r12,r12,8
851     + ld r11,PACA_L1D_FLUSH_SIZE(r13)
852     + srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */
853     mtctr r11
854     DCBT_STOP_ALL_STREAM_IDS(r11) /* Stop prefetch streams */
855    
856     /* order ld/st prior to dcbt stop all streams with flushing */
857     sync
858     -1: li r8,0
859     - .rept 8 /* 8-way set associative */
860     - ldx r11,r10,r8
861     - add r8,r8,r12
862     - xor r11,r11,r11 // Ensure r11 is 0 even if fallback area is not
863     - add r8,r8,r11 // Add 0, this creates a dependency on the ldx
864     - .endr
865     - addi r10,r10,128 /* 128 byte cache line */
866     +
867     + /*
868     + * The load adresses are at staggered offsets within cachelines,
869     + * which suits some pipelines better (on others it should not
870     + * hurt).
871     + */
872     +1:
873     + ld r11,(0x80 + 8)*0(r10)
874     + ld r11,(0x80 + 8)*1(r10)
875     + ld r11,(0x80 + 8)*2(r10)
876     + ld r11,(0x80 + 8)*3(r10)
877     + ld r11,(0x80 + 8)*4(r10)
878     + ld r11,(0x80 + 8)*5(r10)
879     + ld r11,(0x80 + 8)*6(r10)
880     + ld r11,(0x80 + 8)*7(r10)
881     + addi r10,r10,0x80*8
882     bdnz 1b
883    
884     mtctr r9
885     ld r9,PACA_EXRFI+EX_R9(r13)
886     ld r10,PACA_EXRFI+EX_R10(r13)
887     ld r11,PACA_EXRFI+EX_R11(r13)
888     - ld r12,PACA_EXRFI+EX_R12(r13)
889     - ld r8,PACA_EXRFI+EX_R13(r13)
890     GET_SCRATCH0(r13);
891     hrfid
892    
893     diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
894     index b350ac5e3111..d92c95333435 100644
895     --- a/arch/powerpc/kernel/idle_book3s.S
896     +++ b/arch/powerpc/kernel/idle_book3s.S
897     @@ -9,6 +9,7 @@
898     */
899    
900     #include <linux/threads.h>
901     +#include <asm/exception-64s.h>
902     #include <asm/processor.h>
903     #include <asm/page.h>
904     #include <asm/cputable.h>
905     @@ -178,7 +179,7 @@ _GLOBAL(pnv_powersave_common)
906     mtmsrd r6, 1 /* clear RI before setting SRR0/1 */
907     mtspr SPRN_SRR0, r5
908     mtspr SPRN_SRR1, r7
909     - rfid
910     + RFI_TO_KERNEL
911    
912     .globl pnv_enter_arch207_idle_mode
913     pnv_enter_arch207_idle_mode:
914     @@ -668,7 +669,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
915     mtcr r6
916     mtspr SPRN_SRR1,r4
917     mtspr SPRN_SRR0,r5
918     - rfid
919     + RFI_TO_KERNEL
920    
921     /*
922     * R3 here contains the value that will be returned to the caller
923     @@ -689,4 +690,4 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
924     mtcr r6
925     mtspr SPRN_SRR1,r4
926     mtspr SPRN_SRR0,r5
927     - rfid
928     + RFI_TO_KERNEL
929     diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
930     index 7c30a91c1f86..5243501d95ef 100644
931     --- a/arch/powerpc/kernel/setup_64.c
932     +++ b/arch/powerpc/kernel/setup_64.c
933     @@ -745,19 +745,8 @@ static void init_fallback_flush(void)
934     memset(l1d_flush_fallback_area, 0, l1d_size * 2);
935    
936     for_each_possible_cpu(cpu) {
937     - /*
938     - * The fallback flush is currently coded for 8-way
939     - * associativity. Different associativity is possible, but it
940     - * will be treated as 8-way and may not evict the lines as
941     - * effectively.
942     - *
943     - * 128 byte lines are mandatory.
944     - */
945     - u64 c = l1d_size / 8;
946     -
947     paca[cpu].rfi_flush_fallback_area = l1d_flush_fallback_area;
948     - paca[cpu].l1d_flush_congruence = c;
949     - paca[cpu].l1d_flush_sets = c / 128;
950     + paca[cpu].l1d_flush_size = l1d_size;
951     }
952     }
953    
954     diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
955     index 0447a22a4df6..55fbc0c78721 100644
956     --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
957     +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
958     @@ -65,7 +65,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
959     mtmsrd r0,1 /* clear RI in MSR */
960     mtsrr0 r5
961     mtsrr1 r6
962     - RFI
963     + RFI_TO_KERNEL
964    
965     kvmppc_call_hv_entry:
966     ld r4, HSTATE_KVM_VCPU(r13)
967     @@ -171,7 +171,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
968     mtsrr0 r8
969     mtsrr1 r7
970     beq cr1, 13f /* machine check */
971     - RFI
972     + RFI_TO_KERNEL
973    
974     /* On POWER7, we have external interrupts set to use HSRR0/1 */
975     11: mtspr SPRN_HSRR0, r8
976     @@ -1018,8 +1018,7 @@ BEGIN_FTR_SECTION
977     END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
978     ld r0, VCPU_GPR(R0)(r4)
979     ld r4, VCPU_GPR(R4)(r4)
980     -
981     - hrfid
982     + HRFI_TO_GUEST
983     b .
984    
985     secondary_too_late:
986     diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
987     index 42a4b237df5f..34a5adeff084 100644
988     --- a/arch/powerpc/kvm/book3s_rmhandlers.S
989     +++ b/arch/powerpc/kvm/book3s_rmhandlers.S
990     @@ -46,6 +46,9 @@
991    
992     #define FUNC(name) name
993    
994     +#define RFI_TO_KERNEL RFI
995     +#define RFI_TO_GUEST RFI
996     +
997     .macro INTERRUPT_TRAMPOLINE intno
998    
999     .global kvmppc_trampoline_\intno
1000     @@ -141,7 +144,7 @@ kvmppc_handler_skip_ins:
1001     GET_SCRATCH0(r13)
1002    
1003     /* And get back into the code */
1004     - RFI
1005     + RFI_TO_KERNEL
1006     #endif
1007    
1008     /*
1009     @@ -164,6 +167,6 @@ _GLOBAL_TOC(kvmppc_entry_trampoline)
1010     ori r5, r5, MSR_EE
1011     mtsrr0 r7
1012     mtsrr1 r6
1013     - RFI
1014     + RFI_TO_KERNEL
1015    
1016     #include "book3s_segment.S"
1017     diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
1018     index ca8f174289bb..7c982956d709 100644
1019     --- a/arch/powerpc/kvm/book3s_segment.S
1020     +++ b/arch/powerpc/kvm/book3s_segment.S
1021     @@ -156,7 +156,7 @@ no_dcbz32_on:
1022     PPC_LL r9, SVCPU_R9(r3)
1023     PPC_LL r3, (SVCPU_R3)(r3)
1024    
1025     - RFI
1026     + RFI_TO_GUEST
1027     kvmppc_handler_trampoline_enter_end:
1028    
1029    
1030     @@ -389,5 +389,5 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
1031     cmpwi r12, BOOK3S_INTERRUPT_DOORBELL
1032     beqa BOOK3S_INTERRUPT_DOORBELL
1033    
1034     - RFI
1035     + RFI_TO_KERNEL
1036     kvmppc_handler_trampoline_exit_end:
1037     diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
1038     index 083f92746951..bf949623de90 100644
1039     --- a/arch/powerpc/perf/core-book3s.c
1040     +++ b/arch/powerpc/perf/core-book3s.c
1041     @@ -1381,7 +1381,7 @@ static int collect_events(struct perf_event *group, int max_count,
1042     int n = 0;
1043     struct perf_event *event;
1044    
1045     - if (!is_software_event(group)) {
1046     + if (group->pmu->task_ctx_nr == perf_hw_context) {
1047     if (n >= max_count)
1048     return -1;
1049     ctrs[n] = group;
1050     @@ -1389,7 +1389,7 @@ static int collect_events(struct perf_event *group, int max_count,
1051     events[n++] = group->hw.config;
1052     }
1053     list_for_each_entry(event, &group->sibling_list, group_entry) {
1054     - if (!is_software_event(event) &&
1055     + if (event->pmu->task_ctx_nr == perf_hw_context &&
1056     event->state != PERF_EVENT_STATE_OFF) {
1057     if (n >= max_count)
1058     return -1;
1059     diff --git a/arch/s390/crypto/crc32-vx.c b/arch/s390/crypto/crc32-vx.c
1060     index 992e630c227b..6f4985f357c6 100644
1061     --- a/arch/s390/crypto/crc32-vx.c
1062     +++ b/arch/s390/crypto/crc32-vx.c
1063     @@ -238,6 +238,7 @@ static struct shash_alg crc32_vx_algs[] = {
1064     .cra_name = "crc32",
1065     .cra_driver_name = "crc32-vx",
1066     .cra_priority = 200,
1067     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1068     .cra_blocksize = CRC32_BLOCK_SIZE,
1069     .cra_ctxsize = sizeof(struct crc_ctx),
1070     .cra_module = THIS_MODULE,
1071     @@ -258,6 +259,7 @@ static struct shash_alg crc32_vx_algs[] = {
1072     .cra_name = "crc32be",
1073     .cra_driver_name = "crc32be-vx",
1074     .cra_priority = 200,
1075     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1076     .cra_blocksize = CRC32_BLOCK_SIZE,
1077     .cra_ctxsize = sizeof(struct crc_ctx),
1078     .cra_module = THIS_MODULE,
1079     @@ -278,6 +280,7 @@ static struct shash_alg crc32_vx_algs[] = {
1080     .cra_name = "crc32c",
1081     .cra_driver_name = "crc32c-vx",
1082     .cra_priority = 200,
1083     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1084     .cra_blocksize = CRC32_BLOCK_SIZE,
1085     .cra_ctxsize = sizeof(struct crc_ctx),
1086     .cra_module = THIS_MODULE,
1087     diff --git a/arch/sparc/crypto/crc32c_glue.c b/arch/sparc/crypto/crc32c_glue.c
1088     index d1064e46efe8..8aa664638c3c 100644
1089     --- a/arch/sparc/crypto/crc32c_glue.c
1090     +++ b/arch/sparc/crypto/crc32c_glue.c
1091     @@ -133,6 +133,7 @@ static struct shash_alg alg = {
1092     .cra_name = "crc32c",
1093     .cra_driver_name = "crc32c-sparc64",
1094     .cra_priority = SPARC_CR_OPCODE_PRIORITY,
1095     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1096     .cra_blocksize = CHKSUM_BLOCK_SIZE,
1097     .cra_ctxsize = sizeof(u32),
1098     .cra_alignmask = 7,
1099     diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
1100     index 0ca4d12ce95c..a4ac7bab15f7 100644
1101     --- a/arch/x86/Kconfig
1102     +++ b/arch/x86/Kconfig
1103     @@ -1057,7 +1057,7 @@ config X86_MCE_THRESHOLD
1104     def_bool y
1105    
1106     config X86_MCE_INJECT
1107     - depends on X86_MCE
1108     + depends on X86_MCE && X86_LOCAL_APIC
1109     tristate "Machine check injector support"
1110     ---help---
1111     Provide support for injecting machine checks for testing purposes.
1112     diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
1113     index 67eec55093a5..4386440fe463 100644
1114     --- a/arch/x86/Kconfig.debug
1115     +++ b/arch/x86/Kconfig.debug
1116     @@ -352,6 +352,7 @@ config X86_DEBUG_FPU
1117    
1118     config PUNIT_ATOM_DEBUG
1119     tristate "ATOM Punit debug driver"
1120     + depends on PCI
1121     select DEBUG_FS
1122     select IOSF_MBI
1123     ---help---
1124     diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
1125     index 12ea8f8384f4..3b7156f46bc1 100644
1126     --- a/arch/x86/boot/Makefile
1127     +++ b/arch/x86/boot/Makefile
1128     @@ -73,12 +73,13 @@ UBSAN_SANITIZE := n
1129     $(obj)/bzImage: asflags-y := $(SVGA_MODE)
1130    
1131     quiet_cmd_image = BUILD $@
1132     +silent_redirect_image = >/dev/null
1133     cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
1134     - $(obj)/zoffset.h $@
1135     + $(obj)/zoffset.h $@ $($(quiet)redirect_image)
1136    
1137     $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
1138     $(call if_changed,image)
1139     - @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
1140     + @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')'
1141    
1142     OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
1143     $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
1144     diff --git a/arch/x86/crypto/crc32-pclmul_glue.c b/arch/x86/crypto/crc32-pclmul_glue.c
1145     index 27226df3f7d8..c8d9cdacbf10 100644
1146     --- a/arch/x86/crypto/crc32-pclmul_glue.c
1147     +++ b/arch/x86/crypto/crc32-pclmul_glue.c
1148     @@ -162,6 +162,7 @@ static struct shash_alg alg = {
1149     .cra_name = "crc32",
1150     .cra_driver_name = "crc32-pclmul",
1151     .cra_priority = 200,
1152     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1153     .cra_blocksize = CHKSUM_BLOCK_SIZE,
1154     .cra_ctxsize = sizeof(u32),
1155     .cra_module = THIS_MODULE,
1156     diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c
1157     index 0857b1a1de3b..60a391b8c4a2 100644
1158     --- a/arch/x86/crypto/crc32c-intel_glue.c
1159     +++ b/arch/x86/crypto/crc32c-intel_glue.c
1160     @@ -239,6 +239,7 @@ static struct shash_alg alg = {
1161     .cra_name = "crc32c",
1162     .cra_driver_name = "crc32c-intel",
1163     .cra_priority = 200,
1164     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
1165     .cra_blocksize = CHKSUM_BLOCK_SIZE,
1166     .cra_ctxsize = sizeof(u32),
1167     .cra_module = THIS_MODULE,
1168     diff --git a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
1169     index 1c3b7ceb36d2..e7273a606a07 100644
1170     --- a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
1171     +++ b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
1172     @@ -55,29 +55,31 @@
1173     #define RAB1bl %bl
1174     #define RAB2bl %cl
1175    
1176     +#define CD0 0x0(%rsp)
1177     +#define CD1 0x8(%rsp)
1178     +#define CD2 0x10(%rsp)
1179     +
1180     +# used only before/after all rounds
1181     #define RCD0 %r8
1182     #define RCD1 %r9
1183     #define RCD2 %r10
1184    
1185     -#define RCD0d %r8d
1186     -#define RCD1d %r9d
1187     -#define RCD2d %r10d
1188     -
1189     -#define RX0 %rbp
1190     -#define RX1 %r11
1191     -#define RX2 %r12
1192     +# used only during rounds
1193     +#define RX0 %r8
1194     +#define RX1 %r9
1195     +#define RX2 %r10
1196    
1197     -#define RX0d %ebp
1198     -#define RX1d %r11d
1199     -#define RX2d %r12d
1200     +#define RX0d %r8d
1201     +#define RX1d %r9d
1202     +#define RX2d %r10d
1203    
1204     -#define RY0 %r13
1205     -#define RY1 %r14
1206     -#define RY2 %r15
1207     +#define RY0 %r11
1208     +#define RY1 %r12
1209     +#define RY2 %r13
1210    
1211     -#define RY0d %r13d
1212     -#define RY1d %r14d
1213     -#define RY2d %r15d
1214     +#define RY0d %r11d
1215     +#define RY1d %r12d
1216     +#define RY2d %r13d
1217    
1218     #define RT0 %rdx
1219     #define RT1 %rsi
1220     @@ -85,6 +87,8 @@
1221     #define RT0d %edx
1222     #define RT1d %esi
1223    
1224     +#define RT1bl %sil
1225     +
1226     #define do16bit_ror(rot, op1, op2, T0, T1, tmp1, tmp2, ab, dst) \
1227     movzbl ab ## bl, tmp2 ## d; \
1228     movzbl ab ## bh, tmp1 ## d; \
1229     @@ -92,6 +96,11 @@
1230     op1##l T0(CTX, tmp2, 4), dst ## d; \
1231     op2##l T1(CTX, tmp1, 4), dst ## d;
1232    
1233     +#define swap_ab_with_cd(ab, cd, tmp) \
1234     + movq cd, tmp; \
1235     + movq ab, cd; \
1236     + movq tmp, ab;
1237     +
1238     /*
1239     * Combined G1 & G2 function. Reordered with help of rotates to have moves
1240     * at begining.
1241     @@ -110,15 +119,15 @@
1242     /* G1,2 && G2,2 */ \
1243     do16bit_ror(32, xor, xor, Tx2, Tx3, RT0, RT1, ab ## 0, x ## 0); \
1244     do16bit_ror(16, xor, xor, Ty3, Ty0, RT0, RT1, ab ## 0, y ## 0); \
1245     - xchgq cd ## 0, ab ## 0; \
1246     + swap_ab_with_cd(ab ## 0, cd ## 0, RT0); \
1247     \
1248     do16bit_ror(32, xor, xor, Tx2, Tx3, RT0, RT1, ab ## 1, x ## 1); \
1249     do16bit_ror(16, xor, xor, Ty3, Ty0, RT0, RT1, ab ## 1, y ## 1); \
1250     - xchgq cd ## 1, ab ## 1; \
1251     + swap_ab_with_cd(ab ## 1, cd ## 1, RT0); \
1252     \
1253     do16bit_ror(32, xor, xor, Tx2, Tx3, RT0, RT1, ab ## 2, x ## 2); \
1254     do16bit_ror(16, xor, xor, Ty3, Ty0, RT0, RT1, ab ## 2, y ## 2); \
1255     - xchgq cd ## 2, ab ## 2;
1256     + swap_ab_with_cd(ab ## 2, cd ## 2, RT0);
1257    
1258     #define enc_round_end(ab, x, y, n) \
1259     addl y ## d, x ## d; \
1260     @@ -168,6 +177,16 @@
1261     decrypt_round3(ba, dc, (n*2)+1); \
1262     decrypt_round3(ba, dc, (n*2));
1263    
1264     +#define push_cd() \
1265     + pushq RCD2; \
1266     + pushq RCD1; \
1267     + pushq RCD0;
1268     +
1269     +#define pop_cd() \
1270     + popq RCD0; \
1271     + popq RCD1; \
1272     + popq RCD2;
1273     +
1274     #define inpack3(in, n, xy, m) \
1275     movq 4*(n)(in), xy ## 0; \
1276     xorq w+4*m(CTX), xy ## 0; \
1277     @@ -223,11 +242,8 @@ ENTRY(__twofish_enc_blk_3way)
1278     * %rdx: src, RIO
1279     * %rcx: bool, if true: xor output
1280     */
1281     - pushq %r15;
1282     - pushq %r14;
1283     pushq %r13;
1284     pushq %r12;
1285     - pushq %rbp;
1286     pushq %rbx;
1287    
1288     pushq %rcx; /* bool xor */
1289     @@ -235,40 +251,36 @@ ENTRY(__twofish_enc_blk_3way)
1290    
1291     inpack_enc3();
1292    
1293     - encrypt_cycle3(RAB, RCD, 0);
1294     - encrypt_cycle3(RAB, RCD, 1);
1295     - encrypt_cycle3(RAB, RCD, 2);
1296     - encrypt_cycle3(RAB, RCD, 3);
1297     - encrypt_cycle3(RAB, RCD, 4);
1298     - encrypt_cycle3(RAB, RCD, 5);
1299     - encrypt_cycle3(RAB, RCD, 6);
1300     - encrypt_cycle3(RAB, RCD, 7);
1301     + push_cd();
1302     + encrypt_cycle3(RAB, CD, 0);
1303     + encrypt_cycle3(RAB, CD, 1);
1304     + encrypt_cycle3(RAB, CD, 2);
1305     + encrypt_cycle3(RAB, CD, 3);
1306     + encrypt_cycle3(RAB, CD, 4);
1307     + encrypt_cycle3(RAB, CD, 5);
1308     + encrypt_cycle3(RAB, CD, 6);
1309     + encrypt_cycle3(RAB, CD, 7);
1310     + pop_cd();
1311    
1312     popq RIO; /* dst */
1313     - popq %rbp; /* bool xor */
1314     + popq RT1; /* bool xor */
1315    
1316     - testb %bpl, %bpl;
1317     + testb RT1bl, RT1bl;
1318     jnz .L__enc_xor3;
1319    
1320     outunpack_enc3(mov);
1321    
1322     popq %rbx;
1323     - popq %rbp;
1324     popq %r12;
1325     popq %r13;
1326     - popq %r14;
1327     - popq %r15;
1328     ret;
1329    
1330     .L__enc_xor3:
1331     outunpack_enc3(xor);
1332    
1333     popq %rbx;
1334     - popq %rbp;
1335     popq %r12;
1336     popq %r13;
1337     - popq %r14;
1338     - popq %r15;
1339     ret;
1340     ENDPROC(__twofish_enc_blk_3way)
1341    
1342     @@ -278,35 +290,31 @@ ENTRY(twofish_dec_blk_3way)
1343     * %rsi: dst
1344     * %rdx: src, RIO
1345     */
1346     - pushq %r15;
1347     - pushq %r14;
1348     pushq %r13;
1349     pushq %r12;
1350     - pushq %rbp;
1351     pushq %rbx;
1352    
1353     pushq %rsi; /* dst */
1354    
1355     inpack_dec3();
1356    
1357     - decrypt_cycle3(RAB, RCD, 7);
1358     - decrypt_cycle3(RAB, RCD, 6);
1359     - decrypt_cycle3(RAB, RCD, 5);
1360     - decrypt_cycle3(RAB, RCD, 4);
1361     - decrypt_cycle3(RAB, RCD, 3);
1362     - decrypt_cycle3(RAB, RCD, 2);
1363     - decrypt_cycle3(RAB, RCD, 1);
1364     - decrypt_cycle3(RAB, RCD, 0);
1365     + push_cd();
1366     + decrypt_cycle3(RAB, CD, 7);
1367     + decrypt_cycle3(RAB, CD, 6);
1368     + decrypt_cycle3(RAB, CD, 5);
1369     + decrypt_cycle3(RAB, CD, 4);
1370     + decrypt_cycle3(RAB, CD, 3);
1371     + decrypt_cycle3(RAB, CD, 2);
1372     + decrypt_cycle3(RAB, CD, 1);
1373     + decrypt_cycle3(RAB, CD, 0);
1374     + pop_cd();
1375    
1376     popq RIO; /* dst */
1377    
1378     outunpack_dec3();
1379    
1380     popq %rbx;
1381     - popq %rbp;
1382     popq %r12;
1383     popq %r13;
1384     - popq %r14;
1385     - popq %r15;
1386     ret;
1387     ENDPROC(twofish_dec_blk_3way)
1388     diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
1389     index 9604b2574d6c..f73796db8758 100644
1390     --- a/arch/x86/events/core.c
1391     +++ b/arch/x86/events/core.c
1392     @@ -190,8 +190,8 @@ static void release_pmc_hardware(void) {}
1393    
1394     static bool check_hw_exists(void)
1395     {
1396     - u64 val, val_fail, val_new= ~0;
1397     - int i, reg, reg_fail, ret = 0;
1398     + u64 val, val_fail = -1, val_new= ~0;
1399     + int i, reg, reg_fail = -1, ret = 0;
1400     int bios_fail = 0;
1401     int reg_safe = -1;
1402    
1403     diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
1404     index 15eb75484cc0..98ccbd1dbb01 100644
1405     --- a/arch/x86/include/asm/microcode_amd.h
1406     +++ b/arch/x86/include/asm/microcode_amd.h
1407     @@ -59,7 +59,6 @@ static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table,
1408    
1409     extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
1410     extern int apply_microcode_amd(int cpu);
1411     -extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size);
1412    
1413     #define PATCH_MAX_SIZE PAGE_SIZE
1414    
1415     diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
1416     index a002b07a7099..6899cf187ba2 100644
1417     --- a/arch/x86/include/asm/vmx.h
1418     +++ b/arch/x86/include/asm/vmx.h
1419     @@ -399,10 +399,11 @@ enum vmcs_field {
1420     #define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 2)
1421    
1422     #define VMX_NR_VPIDS (1 << 16)
1423     +#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR 0
1424     #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
1425     #define VMX_VPID_EXTENT_ALL_CONTEXT 2
1426     +#define VMX_VPID_EXTENT_SINGLE_NON_GLOBAL 3
1427    
1428     -#define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0
1429     #define VMX_EPT_EXTENT_CONTEXT 1
1430     #define VMX_EPT_EXTENT_GLOBAL 2
1431     #define VMX_EPT_EXTENT_SHIFT 24
1432     @@ -419,8 +420,10 @@ enum vmcs_field {
1433     #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
1434    
1435     #define VMX_VPID_INVVPID_BIT (1ull << 0) /* (32 - 32) */
1436     +#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT (1ull << 8) /* (40 - 32) */
1437     #define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */
1438     #define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */
1439     +#define VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT (1ull << 11) /* (43 - 32) */
1440    
1441     #define VMX_EPT_DEFAULT_GAW 3
1442     #define VMX_EPT_MAX_GAW 0x4
1443     diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
1444     index 517619ea6498..99165b206df3 100644
1445     --- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
1446     +++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
1447     @@ -152,7 +152,6 @@ static void raise_mce(struct mce *m)
1448     if (context == MCJ_CTX_RANDOM)
1449     return;
1450    
1451     -#ifdef CONFIG_X86_LOCAL_APIC
1452     if (m->inject_flags & (MCJ_IRQ_BROADCAST | MCJ_NMI_BROADCAST)) {
1453     unsigned long start;
1454     int cpu;
1455     @@ -192,9 +191,7 @@ static void raise_mce(struct mce *m)
1456     raise_local();
1457     put_cpu();
1458     put_online_cpus();
1459     - } else
1460     -#endif
1461     - {
1462     + } else {
1463     preempt_disable();
1464     raise_local();
1465     preempt_enable();
1466     diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
1467     index b74bb29db6b9..732bb03fcf91 100644
1468     --- a/arch/x86/kernel/cpu/microcode/amd.c
1469     +++ b/arch/x86/kernel/cpu/microcode/amd.c
1470     @@ -135,6 +135,9 @@ static size_t compute_container_size(u8 *data, u32 total_size)
1471     return size;
1472     }
1473    
1474     +static enum ucode_state
1475     +load_microcode_amd(bool save, u8 family, const u8 *data, size_t size);
1476     +
1477     /*
1478     * Early load occurs before we can vmalloc(). So we look for the microcode
1479     * patch container file in initrd, traverse equivalent cpu table, look for a
1480     @@ -451,7 +454,7 @@ int __init save_microcode_in_initrd_amd(void)
1481     eax = cpuid_eax(0x00000001);
1482     eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
1483    
1484     - ret = load_microcode_amd(smp_processor_id(), eax, container, container_size);
1485     + ret = load_microcode_amd(true, eax, container, container_size);
1486     if (ret != UCODE_OK)
1487     retval = -EINVAL;
1488    
1489     @@ -864,7 +867,8 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
1490     return UCODE_OK;
1491     }
1492    
1493     -enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size)
1494     +static enum ucode_state
1495     +load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
1496     {
1497     enum ucode_state ret;
1498    
1499     @@ -878,8 +882,8 @@ enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t s
1500    
1501     #ifdef CONFIG_X86_32
1502     /* save BSP's matching patch for early load */
1503     - if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
1504     - struct ucode_patch *p = find_patch(cpu);
1505     + if (save) {
1506     + struct ucode_patch *p = find_patch(0);
1507     if (p) {
1508     memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
1509     memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data),
1510     @@ -911,11 +915,12 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
1511     {
1512     char fw_name[36] = "amd-ucode/microcode_amd.bin";
1513     struct cpuinfo_x86 *c = &cpu_data(cpu);
1514     + bool bsp = c->cpu_index == boot_cpu_data.cpu_index;
1515     enum ucode_state ret = UCODE_NFOUND;
1516     const struct firmware *fw;
1517    
1518     /* reload ucode container only on the boot cpu */
1519     - if (!refresh_fw || c->cpu_index != boot_cpu_data.cpu_index)
1520     + if (!refresh_fw || !bsp)
1521     return UCODE_OK;
1522    
1523     if (c->x86 >= 0x15)
1524     @@ -932,7 +937,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
1525     goto fw_release;
1526     }
1527    
1528     - ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size);
1529     + ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
1530    
1531     fw_release:
1532     release_firmware(fw);
1533     diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
1534     index 4b3012888ada..8a1d63591399 100644
1535     --- a/arch/x86/kernel/vm86_32.c
1536     +++ b/arch/x86/kernel/vm86_32.c
1537     @@ -160,11 +160,12 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
1538    
1539     static void mark_screen_rdonly(struct mm_struct *mm)
1540     {
1541     + struct vm_area_struct *vma;
1542     + spinlock_t *ptl;
1543     pgd_t *pgd;
1544     pud_t *pud;
1545     pmd_t *pmd;
1546     pte_t *pte;
1547     - spinlock_t *ptl;
1548     int i;
1549    
1550     down_write(&mm->mmap_sem);
1551     @@ -177,7 +178,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
1552     pmd = pmd_offset(pud, 0xA0000);
1553    
1554     if (pmd_trans_huge(*pmd)) {
1555     - struct vm_area_struct *vma = find_vma(mm, 0xA0000);
1556     + vma = find_vma(mm, 0xA0000);
1557     split_huge_pmd(vma, pmd, 0xA0000);
1558     }
1559     if (pmd_none_or_clear_bad(pmd))
1560     diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
1561     index ab8e32f7b9a8..9150e09773cb 100644
1562     --- a/arch/x86/kvm/Kconfig
1563     +++ b/arch/x86/kvm/Kconfig
1564     @@ -22,7 +22,8 @@ config KVM
1565     depends on HAVE_KVM
1566     depends on HIGH_RES_TIMERS
1567     # for TASKSTATS/TASK_DELAY_ACCT:
1568     - depends on NET
1569     + depends on NET && MULTIUSER
1570     + depends on X86_LOCAL_APIC
1571     select PREEMPT_NOTIFIERS
1572     select MMU_NOTIFIER
1573     select ANON_INODES
1574     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
1575     index 1e16821c1378..c51aaac953b4 100644
1576     --- a/arch/x86/kvm/vmx.c
1577     +++ b/arch/x86/kvm/vmx.c
1578     @@ -142,6 +142,12 @@ module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
1579    
1580     #define VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE 5
1581    
1582     +#define VMX_VPID_EXTENT_SUPPORTED_MASK \
1583     + (VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT | \
1584     + VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT | \
1585     + VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT | \
1586     + VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT)
1587     +
1588     /*
1589     * These 2 parameters are used to config the controls for Pause-Loop Exiting:
1590     * ple_gap: upper bound on the amount of time between two successive
1591     @@ -2839,8 +2845,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
1592     */
1593     if (enable_vpid)
1594     vmx->nested.nested_vmx_vpid_caps = VMX_VPID_INVVPID_BIT |
1595     - VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT |
1596     - VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
1597     + VMX_VPID_EXTENT_SUPPORTED_MASK;
1598     else
1599     vmx->nested.nested_vmx_vpid_caps = 0;
1600    
1601     @@ -7685,7 +7690,8 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
1602     vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
1603     type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf);
1604    
1605     - types = (vmx->nested.nested_vmx_vpid_caps >> 8) & 0x7;
1606     + types = (vmx->nested.nested_vmx_vpid_caps &
1607     + VMX_VPID_EXTENT_SUPPORTED_MASK) >> 8;
1608    
1609     if (type >= 32 || !(types & (1 << type))) {
1610     nested_vmx_failValid(vcpu,
1611     @@ -7707,21 +7713,27 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
1612     }
1613    
1614     switch (type) {
1615     + case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:
1616     case VMX_VPID_EXTENT_SINGLE_CONTEXT:
1617     - /*
1618     - * Old versions of KVM use the single-context version so we
1619     - * have to support it; just treat it the same as all-context.
1620     - */
1621     + case VMX_VPID_EXTENT_SINGLE_NON_GLOBAL:
1622     + if (!vpid) {
1623     + nested_vmx_failValid(vcpu,
1624     + VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
1625     + skip_emulated_instruction(vcpu);
1626     + return 1;
1627     + }
1628     + break;
1629     case VMX_VPID_EXTENT_ALL_CONTEXT:
1630     - __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
1631     - nested_vmx_succeed(vcpu);
1632     break;
1633     default:
1634     - /* Trap individual address invalidation invvpid calls */
1635     - BUG_ON(1);
1636     - break;
1637     + WARN_ON_ONCE(1);
1638     + skip_emulated_instruction(vcpu);
1639     + return 1;
1640     }
1641    
1642     + __vmx_flush_tlb(vcpu, vmx->nested.vpid02);
1643     + nested_vmx_succeed(vcpu);
1644     +
1645     skip_emulated_instruction(vcpu);
1646     return 1;
1647     }
1648     diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
1649     index 75f756eac979..4b19ec1da22d 100644
1650     --- a/arch/x86/kvm/x86.c
1651     +++ b/arch/x86/kvm/x86.c
1652     @@ -2847,6 +2847,12 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
1653     kvm_x86_ops->vcpu_put(vcpu);
1654     kvm_put_guest_fpu(vcpu);
1655     vcpu->arch.last_host_tsc = rdtsc();
1656     + /*
1657     + * If userspace has set any breakpoints or watchpoints, dr6 is restored
1658     + * on every vmexit, but if not, we might have a stale dr6 from the
1659     + * guest. do_debug expects dr6 to be cleared after it runs, do the same.
1660     + */
1661     + set_debugreg(0, 6);
1662     }
1663    
1664     static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
1665     @@ -8421,6 +8427,13 @@ static int apf_put_user(struct kvm_vcpu *vcpu, u32 val)
1666     sizeof(val));
1667     }
1668    
1669     +static int apf_get_user(struct kvm_vcpu *vcpu, u32 *val)
1670     +{
1671     +
1672     + return kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apf.data, val,
1673     + sizeof(u32));
1674     +}
1675     +
1676     void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
1677     struct kvm_async_pf *work)
1678     {
1679     @@ -8447,6 +8460,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
1680     struct kvm_async_pf *work)
1681     {
1682     struct x86_exception fault;
1683     + u32 val;
1684    
1685     if (work->wakeup_all)
1686     work->arch.token = ~0; /* broadcast wakeup */
1687     @@ -8454,14 +8468,24 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
1688     kvm_del_async_pf_gfn(vcpu, work->arch.gfn);
1689     trace_kvm_async_pf_ready(work->arch.token, work->gva);
1690    
1691     - if ((vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED) &&
1692     - !apf_put_user(vcpu, KVM_PV_REASON_PAGE_READY)) {
1693     - fault.vector = PF_VECTOR;
1694     - fault.error_code_valid = true;
1695     - fault.error_code = 0;
1696     - fault.nested_page_fault = false;
1697     - fault.address = work->arch.token;
1698     - kvm_inject_page_fault(vcpu, &fault);
1699     + if (vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED &&
1700     + !apf_get_user(vcpu, &val)) {
1701     + if (val == KVM_PV_REASON_PAGE_NOT_PRESENT &&
1702     + vcpu->arch.exception.pending &&
1703     + vcpu->arch.exception.nr == PF_VECTOR &&
1704     + !apf_put_user(vcpu, 0)) {
1705     + vcpu->arch.exception.pending = false;
1706     + vcpu->arch.exception.nr = 0;
1707     + vcpu->arch.exception.has_error_code = false;
1708     + vcpu->arch.exception.error_code = 0;
1709     + } else if (!apf_put_user(vcpu, KVM_PV_REASON_PAGE_READY)) {
1710     + fault.vector = PF_VECTOR;
1711     + fault.error_code_valid = true;
1712     + fault.error_code = 0;
1713     + fault.nested_page_fault = false;
1714     + fault.address = work->arch.token;
1715     + kvm_inject_page_fault(vcpu, &fault);
1716     + }
1717     }
1718     vcpu->arch.apf.halted = false;
1719     vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1720     diff --git a/arch/x86/math-emu/Makefile b/arch/x86/math-emu/Makefile
1721     index 9b0c63b60302..1b2dac174321 100644
1722     --- a/arch/x86/math-emu/Makefile
1723     +++ b/arch/x86/math-emu/Makefile
1724     @@ -5,8 +5,8 @@
1725     #DEBUG = -DDEBUGGING
1726     DEBUG =
1727     PARANOID = -DPARANOID
1728     -EXTRA_CFLAGS := $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
1729     -EXTRA_AFLAGS := $(PARANOID)
1730     +ccflags-y += $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
1731     +asflags-y += $(PARANOID)
1732    
1733     # From 'C' language sources:
1734     C_OBJS =fpu_entry.o errors.o \
1735     diff --git a/arch/x86/math-emu/reg_compare.c b/arch/x86/math-emu/reg_compare.c
1736     index b77360fdbf4a..19b33b50adfa 100644
1737     --- a/arch/x86/math-emu/reg_compare.c
1738     +++ b/arch/x86/math-emu/reg_compare.c
1739     @@ -168,7 +168,7 @@ static int compare(FPU_REG const *b, int tagb)
1740     /* This function requires that st(0) is not empty */
1741     int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
1742     {
1743     - int f = 0, c;
1744     + int f, c;
1745    
1746     c = compare(loaded_data, loaded_tag);
1747    
1748     @@ -189,12 +189,12 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
1749     case COMP_No_Comp:
1750     f = SW_C3 | SW_C2 | SW_C0;
1751     break;
1752     -#ifdef PARANOID
1753     default:
1754     +#ifdef PARANOID
1755     EXCEPTION(EX_INTERNAL | 0x121);
1756     +#endif /* PARANOID */
1757     f = SW_C3 | SW_C2 | SW_C0;
1758     break;
1759     -#endif /* PARANOID */
1760     }
1761     setcc(f);
1762     if (c & COMP_Denormal) {
1763     @@ -205,7 +205,7 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
1764    
1765     static int compare_st_st(int nr)
1766     {
1767     - int f = 0, c;
1768     + int f, c;
1769     FPU_REG *st_ptr;
1770    
1771     if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) {
1772     @@ -235,12 +235,12 @@ static int compare_st_st(int nr)
1773     case COMP_No_Comp:
1774     f = SW_C3 | SW_C2 | SW_C0;
1775     break;
1776     -#ifdef PARANOID
1777     default:
1778     +#ifdef PARANOID
1779     EXCEPTION(EX_INTERNAL | 0x122);
1780     +#endif /* PARANOID */
1781     f = SW_C3 | SW_C2 | SW_C0;
1782     break;
1783     -#endif /* PARANOID */
1784     }
1785     setcc(f);
1786     if (c & COMP_Denormal) {
1787     @@ -283,12 +283,12 @@ static int compare_i_st_st(int nr)
1788     case COMP_No_Comp:
1789     f = X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF;
1790     break;
1791     -#ifdef PARANOID
1792     default:
1793     +#ifdef PARANOID
1794     EXCEPTION(EX_INTERNAL | 0x122);
1795     +#endif /* PARANOID */
1796     f = 0;
1797     break;
1798     -#endif /* PARANOID */
1799     }
1800     FPU_EFLAGS = (FPU_EFLAGS & ~(X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF)) | f;
1801     if (c & COMP_Denormal) {
1802     diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
1803     index 7aaa2635862d..ecae9ac216fa 100644
1804     --- a/arch/x86/mm/ioremap.c
1805     +++ b/arch/x86/mm/ioremap.c
1806     @@ -347,11 +347,11 @@ void iounmap(volatile void __iomem *addr)
1807     (void __force *)addr < phys_to_virt(ISA_END_ADDRESS))
1808     return;
1809    
1810     + mmiotrace_iounmap(addr);
1811     +
1812     addr = (volatile void __iomem *)
1813     (PAGE_MASK & (unsigned long __force)addr);
1814    
1815     - mmiotrace_iounmap(addr);
1816     -
1817     /* Use the vm area unlocked, assuming the caller
1818     ensures there isn't another iounmap for the same address
1819     in parallel. Reuse of the virtual address is prevented by
1820     diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
1821     index afc47f5c9531..cadb82be5f36 100644
1822     --- a/arch/x86/mm/kmmio.c
1823     +++ b/arch/x86/mm/kmmio.c
1824     @@ -434,17 +434,18 @@ int register_kmmio_probe(struct kmmio_probe *p)
1825     unsigned long flags;
1826     int ret = 0;
1827     unsigned long size = 0;
1828     + unsigned long addr = p->addr & PAGE_MASK;
1829     const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
1830     unsigned int l;
1831     pte_t *pte;
1832    
1833     spin_lock_irqsave(&kmmio_lock, flags);
1834     - if (get_kmmio_probe(p->addr)) {
1835     + if (get_kmmio_probe(addr)) {
1836     ret = -EEXIST;
1837     goto out;
1838     }
1839    
1840     - pte = lookup_address(p->addr, &l);
1841     + pte = lookup_address(addr, &l);
1842     if (!pte) {
1843     ret = -EINVAL;
1844     goto out;
1845     @@ -453,7 +454,7 @@ int register_kmmio_probe(struct kmmio_probe *p)
1846     kmmio_count++;
1847     list_add_rcu(&p->list, &kmmio_probes);
1848     while (size < size_lim) {
1849     - if (add_kmmio_fault_page(p->addr + size))
1850     + if (add_kmmio_fault_page(addr + size))
1851     pr_err("Unable to set page fault.\n");
1852     size += page_level_size(l);
1853     }
1854     @@ -527,19 +528,20 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
1855     {
1856     unsigned long flags;
1857     unsigned long size = 0;
1858     + unsigned long addr = p->addr & PAGE_MASK;
1859     const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
1860     struct kmmio_fault_page *release_list = NULL;
1861     struct kmmio_delayed_release *drelease;
1862     unsigned int l;
1863     pte_t *pte;
1864    
1865     - pte = lookup_address(p->addr, &l);
1866     + pte = lookup_address(addr, &l);
1867     if (!pte)
1868     return;
1869    
1870     spin_lock_irqsave(&kmmio_lock, flags);
1871     while (size < size_lim) {
1872     - release_kmmio_fault_page(p->addr + size, &release_list);
1873     + release_kmmio_fault_page(addr + size, &release_list);
1874     size += page_level_size(l);
1875     }
1876     list_del_rcu(&p->list);
1877     diff --git a/block/blk-map.c b/block/blk-map.c
1878     index 27fd8d92892d..a8b4f526d8bb 100644
1879     --- a/block/blk-map.c
1880     +++ b/block/blk-map.c
1881     @@ -116,7 +116,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
1882     unsigned long align = q->dma_pad_mask | queue_dma_alignment(q);
1883     struct bio *bio = NULL;
1884     struct iov_iter i;
1885     - int ret;
1886     + int ret = -EINVAL;
1887    
1888     if (!iter_is_iovec(iter))
1889     goto fail;
1890     @@ -145,7 +145,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
1891     __blk_rq_unmap_user(bio);
1892     fail:
1893     rq->bio = NULL;
1894     - return -EINVAL;
1895     + return ret;
1896     }
1897     EXPORT_SYMBOL(blk_rq_map_user_iov);
1898    
1899     diff --git a/crypto/ahash.c b/crypto/ahash.c
1900     index f3fa104de479..14402ef6d826 100644
1901     --- a/crypto/ahash.c
1902     +++ b/crypto/ahash.c
1903     @@ -192,11 +192,18 @@ int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
1904     unsigned int keylen)
1905     {
1906     unsigned long alignmask = crypto_ahash_alignmask(tfm);
1907     + int err;
1908    
1909     if ((unsigned long)key & alignmask)
1910     - return ahash_setkey_unaligned(tfm, key, keylen);
1911     + err = ahash_setkey_unaligned(tfm, key, keylen);
1912     + else
1913     + err = tfm->setkey(tfm, key, keylen);
1914     +
1915     + if (err)
1916     + return err;
1917    
1918     - return tfm->setkey(tfm, key, keylen);
1919     + crypto_ahash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
1920     + return 0;
1921     }
1922     EXPORT_SYMBOL_GPL(crypto_ahash_setkey);
1923    
1924     @@ -369,7 +376,12 @@ EXPORT_SYMBOL_GPL(crypto_ahash_finup);
1925    
1926     int crypto_ahash_digest(struct ahash_request *req)
1927     {
1928     - return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->digest);
1929     + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
1930     +
1931     + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
1932     + return -ENOKEY;
1933     +
1934     + return crypto_ahash_op(req, tfm->digest);
1935     }
1936     EXPORT_SYMBOL_GPL(crypto_ahash_digest);
1937    
1938     @@ -455,7 +467,6 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
1939     struct ahash_alg *alg = crypto_ahash_alg(hash);
1940    
1941     hash->setkey = ahash_nosetkey;
1942     - hash->has_setkey = false;
1943     hash->export = ahash_no_export;
1944     hash->import = ahash_no_import;
1945    
1946     @@ -470,7 +481,8 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
1947    
1948     if (alg->setkey) {
1949     hash->setkey = alg->setkey;
1950     - hash->has_setkey = true;
1951     + if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
1952     + crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
1953     }
1954     if (alg->export)
1955     hash->export = alg->export;
1956     diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
1957     index 54fc90e8339c..731b5fb8567b 100644
1958     --- a/crypto/algif_hash.c
1959     +++ b/crypto/algif_hash.c
1960     @@ -34,11 +34,6 @@ struct hash_ctx {
1961     struct ahash_request req;
1962     };
1963    
1964     -struct algif_hash_tfm {
1965     - struct crypto_ahash *hash;
1966     - bool has_key;
1967     -};
1968     -
1969     static int hash_alloc_result(struct sock *sk, struct hash_ctx *ctx)
1970     {
1971     unsigned ds;
1972     @@ -308,7 +303,7 @@ static int hash_check_key(struct socket *sock)
1973     int err = 0;
1974     struct sock *psk;
1975     struct alg_sock *pask;
1976     - struct algif_hash_tfm *tfm;
1977     + struct crypto_ahash *tfm;
1978     struct sock *sk = sock->sk;
1979     struct alg_sock *ask = alg_sk(sk);
1980    
1981     @@ -322,7 +317,7 @@ static int hash_check_key(struct socket *sock)
1982    
1983     err = -ENOKEY;
1984     lock_sock_nested(psk, SINGLE_DEPTH_NESTING);
1985     - if (!tfm->has_key)
1986     + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
1987     goto unlock;
1988    
1989     if (!pask->refcnt++)
1990     @@ -413,41 +408,17 @@ static struct proto_ops algif_hash_ops_nokey = {
1991    
1992     static void *hash_bind(const char *name, u32 type, u32 mask)
1993     {
1994     - struct algif_hash_tfm *tfm;
1995     - struct crypto_ahash *hash;
1996     -
1997     - tfm = kzalloc(sizeof(*tfm), GFP_KERNEL);
1998     - if (!tfm)
1999     - return ERR_PTR(-ENOMEM);
2000     -
2001     - hash = crypto_alloc_ahash(name, type, mask);
2002     - if (IS_ERR(hash)) {
2003     - kfree(tfm);
2004     - return ERR_CAST(hash);
2005     - }
2006     -
2007     - tfm->hash = hash;
2008     -
2009     - return tfm;
2010     + return crypto_alloc_ahash(name, type, mask);
2011     }
2012    
2013     static void hash_release(void *private)
2014     {
2015     - struct algif_hash_tfm *tfm = private;
2016     -
2017     - crypto_free_ahash(tfm->hash);
2018     - kfree(tfm);
2019     + crypto_free_ahash(private);
2020     }
2021    
2022     static int hash_setkey(void *private, const u8 *key, unsigned int keylen)
2023     {
2024     - struct algif_hash_tfm *tfm = private;
2025     - int err;
2026     -
2027     - err = crypto_ahash_setkey(tfm->hash, key, keylen);
2028     - tfm->has_key = !err;
2029     -
2030     - return err;
2031     + return crypto_ahash_setkey(private, key, keylen);
2032     }
2033    
2034     static void hash_sock_destruct(struct sock *sk)
2035     @@ -462,11 +433,10 @@ static void hash_sock_destruct(struct sock *sk)
2036    
2037     static int hash_accept_parent_nokey(void *private, struct sock *sk)
2038     {
2039     - struct hash_ctx *ctx;
2040     + struct crypto_ahash *tfm = private;
2041     struct alg_sock *ask = alg_sk(sk);
2042     - struct algif_hash_tfm *tfm = private;
2043     - struct crypto_ahash *hash = tfm->hash;
2044     - unsigned len = sizeof(*ctx) + crypto_ahash_reqsize(hash);
2045     + struct hash_ctx *ctx;
2046     + unsigned int len = sizeof(*ctx) + crypto_ahash_reqsize(tfm);
2047    
2048     ctx = sock_kmalloc(sk, len, GFP_KERNEL);
2049     if (!ctx)
2050     @@ -479,7 +449,7 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
2051    
2052     ask->private = ctx;
2053    
2054     - ahash_request_set_tfm(&ctx->req, hash);
2055     + ahash_request_set_tfm(&ctx->req, tfm);
2056     ahash_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
2057     af_alg_complete, &ctx->completion);
2058    
2059     @@ -490,9 +460,9 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
2060    
2061     static int hash_accept_parent(void *private, struct sock *sk)
2062     {
2063     - struct algif_hash_tfm *tfm = private;
2064     + struct crypto_ahash *tfm = private;
2065    
2066     - if (!tfm->has_key && crypto_ahash_has_setkey(tfm->hash))
2067     + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
2068     return -ENOKEY;
2069    
2070     return hash_accept_parent_nokey(private, sk);
2071     diff --git a/crypto/crc32_generic.c b/crypto/crc32_generic.c
2072     index aa2a25fc7482..718cbce8d169 100644
2073     --- a/crypto/crc32_generic.c
2074     +++ b/crypto/crc32_generic.c
2075     @@ -133,6 +133,7 @@ static struct shash_alg alg = {
2076     .cra_name = "crc32",
2077     .cra_driver_name = "crc32-generic",
2078     .cra_priority = 100,
2079     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
2080     .cra_blocksize = CHKSUM_BLOCK_SIZE,
2081     .cra_ctxsize = sizeof(u32),
2082     .cra_module = THIS_MODULE,
2083     diff --git a/crypto/crc32c_generic.c b/crypto/crc32c_generic.c
2084     index 4c0a0e271876..372320399622 100644
2085     --- a/crypto/crc32c_generic.c
2086     +++ b/crypto/crc32c_generic.c
2087     @@ -146,6 +146,7 @@ static struct shash_alg alg = {
2088     .cra_name = "crc32c",
2089     .cra_driver_name = "crc32c-generic",
2090     .cra_priority = 100,
2091     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
2092     .cra_blocksize = CHKSUM_BLOCK_SIZE,
2093     .cra_alignmask = 3,
2094     .cra_ctxsize = sizeof(struct chksum_ctx),
2095     diff --git a/crypto/cryptd.c b/crypto/cryptd.c
2096     index af9ad45d1909..9b66ce7e728d 100644
2097     --- a/crypto/cryptd.c
2098     +++ b/crypto/cryptd.c
2099     @@ -673,10 +673,9 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
2100     if (err)
2101     goto out_free_inst;
2102    
2103     - type = CRYPTO_ALG_ASYNC;
2104     - if (alg->cra_flags & CRYPTO_ALG_INTERNAL)
2105     - type |= CRYPTO_ALG_INTERNAL;
2106     - inst->alg.halg.base.cra_flags = type;
2107     + inst->alg.halg.base.cra_flags = CRYPTO_ALG_ASYNC |
2108     + (alg->cra_flags & (CRYPTO_ALG_INTERNAL |
2109     + CRYPTO_ALG_OPTIONAL_KEY));
2110    
2111     inst->alg.halg.digestsize = salg->digestsize;
2112     inst->alg.halg.statesize = salg->statesize;
2113     diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c
2114     index 6e9389c8bfbd..7406ed0745be 100644
2115     --- a/crypto/mcryptd.c
2116     +++ b/crypto/mcryptd.c
2117     @@ -516,10 +516,9 @@ static int mcryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
2118     if (err)
2119     goto out_free_inst;
2120    
2121     - type = CRYPTO_ALG_ASYNC;
2122     - if (alg->cra_flags & CRYPTO_ALG_INTERNAL)
2123     - type |= CRYPTO_ALG_INTERNAL;
2124     - inst->alg.halg.base.cra_flags = type;
2125     + inst->alg.halg.base.cra_flags = CRYPTO_ALG_ASYNC |
2126     + (alg->cra_flags & (CRYPTO_ALG_INTERNAL |
2127     + CRYPTO_ALG_OPTIONAL_KEY));
2128    
2129     inst->alg.halg.digestsize = halg->digestsize;
2130     inst->alg.halg.statesize = halg->statesize;
2131     diff --git a/crypto/shash.c b/crypto/shash.c
2132     index 9bd5044d467b..d5bd2f05d036 100644
2133     --- a/crypto/shash.c
2134     +++ b/crypto/shash.c
2135     @@ -57,11 +57,18 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
2136     {
2137     struct shash_alg *shash = crypto_shash_alg(tfm);
2138     unsigned long alignmask = crypto_shash_alignmask(tfm);
2139     + int err;
2140    
2141     if ((unsigned long)key & alignmask)
2142     - return shash_setkey_unaligned(tfm, key, keylen);
2143     + err = shash_setkey_unaligned(tfm, key, keylen);
2144     + else
2145     + err = shash->setkey(tfm, key, keylen);
2146     +
2147     + if (err)
2148     + return err;
2149    
2150     - return shash->setkey(tfm, key, keylen);
2151     + crypto_shash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
2152     + return 0;
2153     }
2154     EXPORT_SYMBOL_GPL(crypto_shash_setkey);
2155    
2156     @@ -180,6 +187,9 @@ int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
2157     struct shash_alg *shash = crypto_shash_alg(tfm);
2158     unsigned long alignmask = crypto_shash_alignmask(tfm);
2159    
2160     + if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
2161     + return -ENOKEY;
2162     +
2163     if (((unsigned long)data | (unsigned long)out) & alignmask)
2164     return shash_digest_unaligned(desc, data, len, out);
2165    
2166     @@ -359,7 +369,8 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
2167     crt->digest = shash_async_digest;
2168     crt->setkey = shash_async_setkey;
2169    
2170     - crt->has_setkey = alg->setkey != shash_no_setkey;
2171     + crypto_ahash_set_flags(crt, crypto_shash_get_flags(shash) &
2172     + CRYPTO_TFM_NEED_KEY);
2173    
2174     if (alg->export)
2175     crt->export = shash_async_export;
2176     @@ -374,8 +385,14 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
2177     static int crypto_shash_init_tfm(struct crypto_tfm *tfm)
2178     {
2179     struct crypto_shash *hash = __crypto_shash_cast(tfm);
2180     + struct shash_alg *alg = crypto_shash_alg(hash);
2181     +
2182     + hash->descsize = alg->descsize;
2183     +
2184     + if (crypto_shash_alg_has_setkey(alg) &&
2185     + !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
2186     + crypto_shash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
2187    
2188     - hash->descsize = crypto_shash_alg(hash)->descsize;
2189     return 0;
2190     }
2191    
2192     diff --git a/drivers/Makefile b/drivers/Makefile
2193     index 733bf0b2613f..7c3d58dcf6b3 100644
2194     --- a/drivers/Makefile
2195     +++ b/drivers/Makefile
2196     @@ -99,6 +99,7 @@ obj-$(CONFIG_TC) += tc/
2197     obj-$(CONFIG_UWB) += uwb/
2198     obj-$(CONFIG_USB_PHY) += usb/
2199     obj-$(CONFIG_USB) += usb/
2200     +obj-$(CONFIG_USB_SUPPORT) += usb/
2201     obj-$(CONFIG_PCI) += usb/
2202     obj-$(CONFIG_USB_GADGET) += usb/
2203     obj-$(CONFIG_OF) += usb/
2204     diff --git a/drivers/android/binder.c b/drivers/android/binder.c
2205     index 15009b2b33c7..3b6ac80b2127 100644
2206     --- a/drivers/android/binder.c
2207     +++ b/drivers/android/binder.c
2208     @@ -2628,6 +2628,8 @@ static unsigned int binder_poll(struct file *filp,
2209     binder_lock(__func__);
2210    
2211     thread = binder_get_thread(proc);
2212     + if (!thread)
2213     + return POLLERR;
2214    
2215     wait_for_proc_work = thread->transaction_stack == NULL &&
2216     list_empty(&thread->todo) && thread->return_error == BR_OK;
2217     diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
2218     index e32badd26c8a..343cad9bf7e7 100644
2219     --- a/drivers/block/rbd.c
2220     +++ b/drivers/block/rbd.c
2221     @@ -3756,7 +3756,7 @@ static void rbd_watch_cb(void *arg, u64 notify_id, u64 cookie,
2222     struct rbd_device *rbd_dev = arg;
2223     void *p = data;
2224     void *const end = p + data_len;
2225     - u8 struct_v;
2226     + u8 struct_v = 0;
2227     u32 len;
2228     u32 notify_op;
2229     int ret;
2230     diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig
2231     index 19480bcc7046..2f29ee1a4d00 100644
2232     --- a/drivers/clk/meson/Kconfig
2233     +++ b/drivers/clk/meson/Kconfig
2234     @@ -14,6 +14,7 @@ config COMMON_CLK_MESON8B
2235     config COMMON_CLK_GXBB
2236     bool
2237     depends on COMMON_CLK_AMLOGIC
2238     + select RESET_CONTROLLER
2239     help
2240     Support for the clock controller on AmLogic S905 devices, aka gxbb.
2241     Say Y if you want peripherals and CPU frequency scaling to work.
2242     diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig
2243     index 254d9526c018..4e8e9bc8f3e5 100644
2244     --- a/drivers/clk/sunxi-ng/Kconfig
2245     +++ b/drivers/clk/sunxi-ng/Kconfig
2246     @@ -1,6 +1,7 @@
2247     config SUNXI_CCU
2248     bool "Clock support for Allwinner SoCs"
2249     depends on ARCH_SUNXI || COMPILE_TEST
2250     + select RESET_CONTROLLER
2251     default ARCH_SUNXI
2252    
2253     if SUNXI_CCU
2254     diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
2255     index 10db7df366c8..2ee11802992f 100644
2256     --- a/drivers/crypto/bfin_crc.c
2257     +++ b/drivers/crypto/bfin_crc.c
2258     @@ -494,7 +494,8 @@ static struct ahash_alg algs = {
2259     .cra_driver_name = DRIVER_NAME,
2260     .cra_priority = 100,
2261     .cra_flags = CRYPTO_ALG_TYPE_AHASH |
2262     - CRYPTO_ALG_ASYNC,
2263     + CRYPTO_ALG_ASYNC |
2264     + CRYPTO_ALG_OPTIONAL_KEY,
2265     .cra_blocksize = CHKSUM_BLOCK_SIZE,
2266     .cra_ctxsize = sizeof(struct bfin_crypto_crc_ctx),
2267     .cra_alignmask = 3,
2268     diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
2269     index a668286d62cb..500e4090e2fd 100644
2270     --- a/drivers/crypto/s5p-sss.c
2271     +++ b/drivers/crypto/s5p-sss.c
2272     @@ -542,15 +542,21 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
2273     uint32_t aes_control;
2274     unsigned long flags;
2275     int err;
2276     + u8 *iv;
2277    
2278     aes_control = SSS_AES_KEY_CHANGE_MODE;
2279     if (mode & FLAGS_AES_DECRYPT)
2280     aes_control |= SSS_AES_MODE_DECRYPT;
2281    
2282     - if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CBC)
2283     + if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CBC) {
2284     aes_control |= SSS_AES_CHAIN_MODE_CBC;
2285     - else if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CTR)
2286     + iv = req->info;
2287     + } else if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CTR) {
2288     aes_control |= SSS_AES_CHAIN_MODE_CTR;
2289     + iv = req->info;
2290     + } else {
2291     + iv = NULL; /* AES_ECB */
2292     + }
2293    
2294     if (dev->ctx->keylen == AES_KEYSIZE_192)
2295     aes_control |= SSS_AES_KEY_SIZE_192;
2296     @@ -581,7 +587,7 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
2297     goto outdata_error;
2298    
2299     SSS_AES_WRITE(dev, AES_CONTROL, aes_control);
2300     - s5p_set_aes(dev, dev->ctx->aes_key, req->info, dev->ctx->keylen);
2301     + s5p_set_aes(dev, dev->ctx->aes_key, iv, dev->ctx->keylen);
2302    
2303     s5p_set_dma_indata(dev, dev->sg_src);
2304     s5p_set_dma_outdata(dev, dev->sg_dst);
2305     diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
2306     index 1c8d79d93098..42c060c7ae15 100644
2307     --- a/drivers/crypto/talitos.c
2308     +++ b/drivers/crypto/talitos.c
2309     @@ -1124,6 +1124,11 @@ int talitos_sg_map(struct device *dev, struct scatterlist *src,
2310     struct talitos_private *priv = dev_get_drvdata(dev);
2311     bool is_sec1 = has_ftr_sec1(priv);
2312    
2313     + if (!src) {
2314     + *ptr = zero_entry;
2315     + return 1;
2316     + }
2317     +
2318     to_talitos_ptr_len(ptr, len, is_sec1);
2319     to_talitos_ptr_ext_set(ptr, 0, is_sec1);
2320    
2321     diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
2322     index a4c8f80db29d..e2cec5b357fd 100644
2323     --- a/drivers/dma/at_hdmac.c
2324     +++ b/drivers/dma/at_hdmac.c
2325     @@ -709,7 +709,7 @@ atc_prep_dma_interleaved(struct dma_chan *chan,
2326     unsigned long flags)
2327     {
2328     struct at_dma_chan *atchan = to_at_dma_chan(chan);
2329     - struct data_chunk *first = xt->sgl;
2330     + struct data_chunk *first;
2331     struct at_desc *desc = NULL;
2332     size_t xfer_count;
2333     unsigned int dwidth;
2334     @@ -721,6 +721,8 @@ atc_prep_dma_interleaved(struct dma_chan *chan,
2335     if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
2336     return NULL;
2337    
2338     + first = xt->sgl;
2339     +
2340     dev_info(chan2dev(chan),
2341     "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
2342     __func__, &xt->src_start, &xt->dst_start, xt->numf,
2343     diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
2344     index d50273fed715..afd5e10f8927 100644
2345     --- a/drivers/dma/dma-jz4740.c
2346     +++ b/drivers/dma/dma-jz4740.c
2347     @@ -555,7 +555,7 @@ static int jz4740_dma_probe(struct platform_device *pdev)
2348    
2349     ret = dma_async_device_register(dd);
2350     if (ret)
2351     - return ret;
2352     + goto err_clk;
2353    
2354     irq = platform_get_irq(pdev, 0);
2355     ret = request_irq(irq, jz4740_dma_irq, 0, dev_name(&pdev->dev), dmadev);
2356     @@ -568,6 +568,8 @@ static int jz4740_dma_probe(struct platform_device *pdev)
2357    
2358     err_unregister:
2359     dma_async_device_unregister(dd);
2360     +err_clk:
2361     + clk_disable_unprepare(dmadev->clk);
2362     return ret;
2363     }
2364    
2365     diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
2366     index 0dea6d55f0ff..84eb83eb2efe 100644
2367     --- a/drivers/dma/ioat/init.c
2368     +++ b/drivers/dma/ioat/init.c
2369     @@ -388,7 +388,7 @@ static int ioat_dma_self_test(struct ioatdma_device *ioat_dma)
2370     if (memcmp(src, dest, IOAT_TEST_SIZE)) {
2371     dev_err(dev, "Self-test copy failed compare, disabling\n");
2372     err = -ENODEV;
2373     - goto free_resources;
2374     + goto unmap_dma;
2375     }
2376    
2377     unmap_dma:
2378     diff --git a/drivers/dma/zx296702_dma.c b/drivers/dma/zx296702_dma.c
2379     index 6059d81e701a..8e55403847b2 100644
2380     --- a/drivers/dma/zx296702_dma.c
2381     +++ b/drivers/dma/zx296702_dma.c
2382     @@ -26,7 +26,7 @@
2383    
2384     #define DRIVER_NAME "zx-dma"
2385     #define DMA_ALIGN 4
2386     -#define DMA_MAX_SIZE (0x10000 - PAGE_SIZE)
2387     +#define DMA_MAX_SIZE (0x10000 - 512)
2388     #define LLI_BLOCK_SIZE (4 * PAGE_SIZE)
2389    
2390     #define REG_ZX_SRC_ADDR 0x00
2391     diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c
2392     index 164de64b11fc..9d46af0c4084 100644
2393     --- a/drivers/gpio/gpio-intel-mid.c
2394     +++ b/drivers/gpio/gpio-intel-mid.c
2395     @@ -321,7 +321,7 @@ static void intel_mid_irq_init_hw(struct intel_mid_gpio *priv)
2396     }
2397     }
2398    
2399     -static int intel_gpio_runtime_idle(struct device *dev)
2400     +static int __maybe_unused intel_gpio_runtime_idle(struct device *dev)
2401     {
2402     int err = pm_schedule_suspend(dev, 500);
2403     return err ?: -EBUSY;
2404     diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
2405     index 40a8881c2ce8..f1c6ec17b90a 100644
2406     --- a/drivers/gpio/gpio-xgene.c
2407     +++ b/drivers/gpio/gpio-xgene.c
2408     @@ -42,9 +42,7 @@ struct xgene_gpio {
2409     struct gpio_chip chip;
2410     void __iomem *base;
2411     spinlock_t lock;
2412     -#ifdef CONFIG_PM
2413     u32 set_dr_val[XGENE_MAX_GPIO_BANKS];
2414     -#endif
2415     };
2416    
2417     static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset)
2418     @@ -138,8 +136,7 @@ static int xgene_gpio_dir_out(struct gpio_chip *gc,
2419     return 0;
2420     }
2421    
2422     -#ifdef CONFIG_PM
2423     -static int xgene_gpio_suspend(struct device *dev)
2424     +static __maybe_unused int xgene_gpio_suspend(struct device *dev)
2425     {
2426     struct xgene_gpio *gpio = dev_get_drvdata(dev);
2427     unsigned long bank_offset;
2428     @@ -152,7 +149,7 @@ static int xgene_gpio_suspend(struct device *dev)
2429     return 0;
2430     }
2431    
2432     -static int xgene_gpio_resume(struct device *dev)
2433     +static __maybe_unused int xgene_gpio_resume(struct device *dev)
2434     {
2435     struct xgene_gpio *gpio = dev_get_drvdata(dev);
2436     unsigned long bank_offset;
2437     @@ -166,10 +163,6 @@ static int xgene_gpio_resume(struct device *dev)
2438     }
2439    
2440     static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
2441     -#define XGENE_GPIO_PM_OPS (&xgene_gpio_pm)
2442     -#else
2443     -#define XGENE_GPIO_PM_OPS NULL
2444     -#endif
2445    
2446     static int xgene_gpio_probe(struct platform_device *pdev)
2447     {
2448     @@ -241,7 +234,7 @@ static struct platform_driver xgene_gpio_driver = {
2449     .name = "xgene-gpio",
2450     .of_match_table = xgene_gpio_of_match,
2451     .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match),
2452     - .pm = XGENE_GPIO_PM_OPS,
2453     + .pm = &xgene_gpio_pm,
2454     },
2455     .probe = xgene_gpio_probe,
2456     };
2457     diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
2458     index a51f8cbcfe26..3137adf7b0af 100644
2459     --- a/drivers/gpu/drm/armada/armada_crtc.c
2460     +++ b/drivers/gpu/drm/armada/armada_crtc.c
2461     @@ -1178,17 +1178,13 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
2462    
2463     ret = devm_request_irq(dev, irq, armada_drm_irq, 0, "armada_drm_crtc",
2464     dcrtc);
2465     - if (ret < 0) {
2466     - kfree(dcrtc);
2467     - return ret;
2468     - }
2469     + if (ret < 0)
2470     + goto err_crtc;
2471    
2472     if (dcrtc->variant->init) {
2473     ret = dcrtc->variant->init(dcrtc, dev);
2474     - if (ret) {
2475     - kfree(dcrtc);
2476     - return ret;
2477     - }
2478     + if (ret)
2479     + goto err_crtc;
2480     }
2481    
2482     /* Ensure AXI pipeline is enabled */
2483     @@ -1199,13 +1195,15 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
2484     dcrtc->crtc.port = port;
2485    
2486     primary = kzalloc(sizeof(*primary), GFP_KERNEL);
2487     - if (!primary)
2488     - return -ENOMEM;
2489     + if (!primary) {
2490     + ret = -ENOMEM;
2491     + goto err_crtc;
2492     + }
2493    
2494     ret = armada_drm_plane_init(primary);
2495     if (ret) {
2496     kfree(primary);
2497     - return ret;
2498     + goto err_crtc;
2499     }
2500    
2501     ret = drm_universal_plane_init(drm, &primary->base, 0,
2502     @@ -1215,7 +1213,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
2503     DRM_PLANE_TYPE_PRIMARY, NULL);
2504     if (ret) {
2505     kfree(primary);
2506     - return ret;
2507     + goto err_crtc;
2508     }
2509    
2510     ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, &primary->base, NULL,
2511     @@ -1234,6 +1232,9 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
2512    
2513     err_crtc_init:
2514     primary->base.funcs->destroy(&primary->base);
2515     +err_crtc:
2516     + kfree(dcrtc);
2517     +
2518     return ret;
2519     }
2520    
2521     diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
2522     index 61146f5b4f56..0a6bf815640e 100644
2523     --- a/drivers/gpu/drm/drm_modeset_lock.c
2524     +++ b/drivers/gpu/drm/drm_modeset_lock.c
2525     @@ -81,7 +81,7 @@ void drm_modeset_lock_all(struct drm_device *dev)
2526     struct drm_modeset_acquire_ctx *ctx;
2527     int ret;
2528    
2529     - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
2530     + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL | __GFP_NOFAIL);
2531     if (WARN_ON(!ctx))
2532     return;
2533    
2534     diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
2535     index 38eaa63afb31..4198e50fa27b 100644
2536     --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
2537     +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
2538     @@ -1939,8 +1939,7 @@ static int hdmi_remove(struct platform_device *pdev)
2539     return 0;
2540     }
2541    
2542     -#ifdef CONFIG_PM
2543     -static int exynos_hdmi_suspend(struct device *dev)
2544     +static int __maybe_unused exynos_hdmi_suspend(struct device *dev)
2545     {
2546     struct hdmi_context *hdata = dev_get_drvdata(dev);
2547    
2548     @@ -1949,7 +1948,7 @@ static int exynos_hdmi_suspend(struct device *dev)
2549     return 0;
2550     }
2551    
2552     -static int exynos_hdmi_resume(struct device *dev)
2553     +static int __maybe_unused exynos_hdmi_resume(struct device *dev)
2554     {
2555     struct hdmi_context *hdata = dev_get_drvdata(dev);
2556     int ret;
2557     @@ -1960,7 +1959,6 @@ static int exynos_hdmi_resume(struct device *dev)
2558    
2559     return 0;
2560     }
2561     -#endif
2562    
2563     static const struct dev_pm_ops exynos_hdmi_pm_ops = {
2564     SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL)
2565     diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
2566     index a19ec06f9e42..6a9860df208f 100644
2567     --- a/drivers/gpu/drm/i915/intel_drv.h
2568     +++ b/drivers/gpu/drm/i915/intel_drv.h
2569     @@ -1581,7 +1581,7 @@ extern struct drm_display_mode *intel_find_panel_downclock(
2570     int intel_backlight_device_register(struct intel_connector *connector);
2571     void intel_backlight_device_unregister(struct intel_connector *connector);
2572     #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
2573     -static int intel_backlight_device_register(struct intel_connector *connector)
2574     +static inline int intel_backlight_device_register(struct intel_connector *connector)
2575     {
2576     return 0;
2577     }
2578     diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
2579     index be4b4d546fd9..1cb1b01e4471 100644
2580     --- a/drivers/gpu/drm/i915/intel_panel.c
2581     +++ b/drivers/gpu/drm/i915/intel_panel.c
2582     @@ -544,25 +544,6 @@ static u32 pwm_get_backlight(struct intel_connector *connector)
2583     return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS);
2584     }
2585    
2586     -static u32 intel_panel_get_backlight(struct intel_connector *connector)
2587     -{
2588     - struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
2589     - struct intel_panel *panel = &connector->panel;
2590     - u32 val = 0;
2591     -
2592     - mutex_lock(&dev_priv->backlight_lock);
2593     -
2594     - if (panel->backlight.enabled) {
2595     - val = panel->backlight.get(connector);
2596     - val = intel_panel_compute_brightness(connector, val);
2597     - }
2598     -
2599     - mutex_unlock(&dev_priv->backlight_lock);
2600     -
2601     - DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
2602     - return val;
2603     -}
2604     -
2605     static void lpt_set_backlight(struct intel_connector *connector, u32 level)
2606     {
2607     struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
2608     @@ -646,30 +627,6 @@ intel_panel_actually_set_backlight(struct intel_connector *connector, u32 level)
2609     panel->backlight.set(connector, level);
2610     }
2611    
2612     -/* set backlight brightness to level in range [0..max], scaling wrt hw min */
2613     -static void intel_panel_set_backlight(struct intel_connector *connector,
2614     - u32 user_level, u32 user_max)
2615     -{
2616     - struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
2617     - struct intel_panel *panel = &connector->panel;
2618     - u32 hw_level;
2619     -
2620     - if (!panel->backlight.present)
2621     - return;
2622     -
2623     - mutex_lock(&dev_priv->backlight_lock);
2624     -
2625     - WARN_ON(panel->backlight.max == 0);
2626     -
2627     - hw_level = scale_user_to_hw(connector, user_level, user_max);
2628     - panel->backlight.level = hw_level;
2629     -
2630     - if (panel->backlight.enabled)
2631     - intel_panel_actually_set_backlight(connector, hw_level);
2632     -
2633     - mutex_unlock(&dev_priv->backlight_lock);
2634     -}
2635     -
2636     /* set backlight brightness to level in range [0..max], assuming hw min is
2637     * respected.
2638     */
2639     @@ -1122,6 +1079,49 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
2640     }
2641    
2642     #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
2643     +static u32 intel_panel_get_backlight(struct intel_connector *connector)
2644     +{
2645     + struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
2646     + struct intel_panel *panel = &connector->panel;
2647     + u32 val = 0;
2648     +
2649     + mutex_lock(&dev_priv->backlight_lock);
2650     +
2651     + if (panel->backlight.enabled) {
2652     + val = panel->backlight.get(connector);
2653     + val = intel_panel_compute_brightness(connector, val);
2654     + }
2655     +
2656     + mutex_unlock(&dev_priv->backlight_lock);
2657     +
2658     + DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
2659     + return val;
2660     +}
2661     +
2662     +/* set backlight brightness to level in range [0..max], scaling wrt hw min */
2663     +static void intel_panel_set_backlight(struct intel_connector *connector,
2664     + u32 user_level, u32 user_max)
2665     +{
2666     + struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
2667     + struct intel_panel *panel = &connector->panel;
2668     + u32 hw_level;
2669     +
2670     + if (!panel->backlight.present)
2671     + return;
2672     +
2673     + mutex_lock(&dev_priv->backlight_lock);
2674     +
2675     + WARN_ON(panel->backlight.max == 0);
2676     +
2677     + hw_level = scale_user_to_hw(connector, user_level, user_max);
2678     + panel->backlight.level = hw_level;
2679     +
2680     + if (panel->backlight.enabled)
2681     + intel_panel_actually_set_backlight(connector, hw_level);
2682     +
2683     + mutex_unlock(&dev_priv->backlight_lock);
2684     +}
2685     +
2686     static int intel_backlight_device_update_status(struct backlight_device *bd)
2687     {
2688     struct intel_connector *connector = bl_get_data(bd);
2689     diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
2690     index 72e2399bce39..909f69a302ee 100644
2691     --- a/drivers/gpu/drm/nouveau/nouveau_gem.c
2692     +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
2693     @@ -369,7 +369,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
2694     {
2695     struct nouveau_cli *cli = nouveau_cli(file_priv);
2696     int trycnt = 0;
2697     - int ret, i;
2698     + int ret = -EINVAL, i;
2699     struct nouveau_bo *res_bo = NULL;
2700     LIST_HEAD(gart_list);
2701     LIST_HEAD(vram_list);
2702     diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig
2703     index 4732dfc15447..331adc509f3a 100644
2704     --- a/drivers/idle/Kconfig
2705     +++ b/drivers/idle/Kconfig
2706     @@ -17,6 +17,7 @@ config I7300_IDLE_IOAT_CHANNEL
2707    
2708     config I7300_IDLE
2709     tristate "Intel chipset idle memory power saving driver"
2710     + depends on PCI
2711     select I7300_IDLE_IOAT_CHANNEL
2712     help
2713     Enable memory power savings when idle with certain Intel server
2714     diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
2715     index a09d6eed3b88..30f01613b518 100644
2716     --- a/drivers/infiniband/core/cma.c
2717     +++ b/drivers/infiniband/core/cma.c
2718     @@ -744,6 +744,7 @@ struct rdma_cm_id *rdma_create_id(struct net *net,
2719     INIT_LIST_HEAD(&id_priv->mc_list);
2720     get_random_bytes(&id_priv->seq_num, sizeof id_priv->seq_num);
2721     id_priv->id.route.addr.dev_addr.net = get_net(net);
2722     + id_priv->seq_num &= 0x00ffffff;
2723    
2724     return &id_priv->id;
2725     }
2726     diff --git a/drivers/infiniband/hw/i40iw/i40iw_d.h b/drivers/infiniband/hw/i40iw/i40iw_d.h
2727     index 2fac1db0e0a0..d1328a697750 100644
2728     --- a/drivers/infiniband/hw/i40iw/i40iw_d.h
2729     +++ b/drivers/infiniband/hw/i40iw/i40iw_d.h
2730     @@ -1102,7 +1102,7 @@
2731     #define I40IWQPC_VLANTAG_MASK (0xffffULL << I40IWQPC_VLANTAG_SHIFT)
2732    
2733     #define I40IWQPC_ARPIDX_SHIFT 48
2734     -#define I40IWQPC_ARPIDX_MASK (0xfffULL << I40IWQPC_ARPIDX_SHIFT)
2735     +#define I40IWQPC_ARPIDX_MASK (0xffffULL << I40IWQPC_ARPIDX_SHIFT)
2736    
2737     #define I40IWQPC_FLOWLABEL_SHIFT 0
2738     #define I40IWQPC_FLOWLABEL_MASK (0xfffffUL << I40IWQPC_FLOWLABEL_SHIFT)
2739     diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c
2740     index 9002298698fc..3048ef3e3e16 100644
2741     --- a/drivers/input/keyboard/tca8418_keypad.c
2742     +++ b/drivers/input/keyboard/tca8418_keypad.c
2743     @@ -164,11 +164,18 @@ static void tca8418_read_keypad(struct tca8418_keypad *keypad_data)
2744     int error, col, row;
2745     u8 reg, state, code;
2746    
2747     - /* Initial read of the key event FIFO */
2748     - error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, &reg);
2749     + do {
2750     + error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, &reg);
2751     + if (error < 0) {
2752     + dev_err(&keypad_data->client->dev,
2753     + "unable to read REG_KEY_EVENT_A\n");
2754     + break;
2755     + }
2756     +
2757     + /* Assume that key code 0 signifies empty FIFO */
2758     + if (reg <= 0)
2759     + break;
2760    
2761     - /* Assume that key code 0 signifies empty FIFO */
2762     - while (error >= 0 && reg > 0) {
2763     state = reg & KEY_EVENT_VALUE;
2764     code = reg & KEY_EVENT_CODE;
2765    
2766     @@ -184,11 +191,7 @@ static void tca8418_read_keypad(struct tca8418_keypad *keypad_data)
2767    
2768     /* Read for next loop */
2769     error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, &reg);
2770     - }
2771     -
2772     - if (error < 0)
2773     - dev_err(&keypad_data->client->dev,
2774     - "unable to read REG_KEY_EVENT_A\n");
2775     + } while (1);
2776    
2777     input_sync(input);
2778     }
2779     diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
2780     index 296f1411fe84..3b11422b1cce 100644
2781     --- a/drivers/isdn/hardware/eicon/message.c
2782     +++ b/drivers/isdn/hardware/eicon/message.c
2783     @@ -147,7 +147,7 @@ static word plci_remove_check(PLCI *);
2784     static void listen_check(DIVA_CAPI_ADAPTER *);
2785     static byte AddInfo(byte **, byte **, byte *, byte *);
2786     static byte getChannel(API_PARSE *);
2787     -static void IndParse(PLCI *, word *, byte **, byte);
2788     +static void IndParse(PLCI *, const word *, byte **, byte);
2789     static byte ie_compare(byte *, byte *);
2790     static word find_cip(DIVA_CAPI_ADAPTER *, byte *, byte *);
2791     static word CPN_filter_ok(byte *cpn, DIVA_CAPI_ADAPTER *, word);
2792     @@ -4858,7 +4858,7 @@ static void sig_ind(PLCI *plci)
2793     /* included before the ESC_MSGTYPE and MAXPARMSIDS has to be incremented */
2794     /* SMSG is situated at the end because its 0 (for compatibility reasons */
2795     /* (see Info_Mask Bit 4, first IE. then the message type) */
2796     - word parms_id[] =
2797     + static const word parms_id[] =
2798     {MAXPARMSIDS, CPN, 0xff, DSA, OSA, BC, LLC, HLC, ESC_CAUSE, DSP, DT, CHA,
2799     UUI, CONG_RR, CONG_RNR, ESC_CHI, KEY, CHI, CAU, ESC_LAW,
2800     RDN, RDX, CONN_NR, RIN, NI, CAI, ESC_CR,
2801     @@ -4866,12 +4866,12 @@ static void sig_ind(PLCI *plci)
2802     /* 14 FTY repl by ESC_CHI */
2803     /* 18 PI repl by ESC_LAW */
2804     /* removed OAD changed to 0xff for future use, OAD is multiIE now */
2805     - word multi_fac_id[] = {1, FTY};
2806     - word multi_pi_id[] = {1, PI};
2807     - word multi_CiPN_id[] = {1, OAD};
2808     - word multi_ssext_id[] = {1, ESC_SSEXT};
2809     + static const word multi_fac_id[] = {1, FTY};
2810     + static const word multi_pi_id[] = {1, PI};
2811     + static const word multi_CiPN_id[] = {1, OAD};
2812     + static const word multi_ssext_id[] = {1, ESC_SSEXT};
2813    
2814     - word multi_vswitch_id[] = {1, ESC_VSWITCH};
2815     + static const word multi_vswitch_id[] = {1, ESC_VSWITCH};
2816    
2817     byte *cau;
2818     word ncci;
2819     @@ -8924,7 +8924,7 @@ static void listen_check(DIVA_CAPI_ADAPTER *a)
2820     /* functions for all parameters sent in INDs */
2821     /*------------------------------------------------------------------*/
2822    
2823     -static void IndParse(PLCI *plci, word *parms_id, byte **parms, byte multiIEsize)
2824     +static void IndParse(PLCI *plci, const word *parms_id, byte **parms, byte multiIEsize)
2825     {
2826     word ploc; /* points to current location within packet */
2827     byte w;
2828     diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
2829     index faee11383cb7..4b615b4b0463 100644
2830     --- a/drivers/media/i2c/s5k6aa.c
2831     +++ b/drivers/media/i2c/s5k6aa.c
2832     @@ -421,6 +421,7 @@ static int s5k6aa_set_ahb_address(struct i2c_client *client)
2833    
2834     /**
2835     * s5k6aa_configure_pixel_clock - apply ISP main clock/PLL configuration
2836     + * @s5k6aa: pointer to &struct s5k6aa describing the device
2837     *
2838     * Configure the internal ISP PLL for the required output frequency.
2839     * Locking: called with s5k6aa.lock mutex held.
2840     @@ -669,6 +670,7 @@ static int s5k6aa_set_input_params(struct s5k6aa *s5k6aa)
2841    
2842     /**
2843     * s5k6aa_configure_video_bus - configure the video output interface
2844     + * @s5k6aa: pointer to &struct s5k6aa describing the device
2845     * @bus_type: video bus type: parallel or MIPI-CSI
2846     * @nlanes: number of MIPI lanes to be used (MIPI-CSI only)
2847     *
2848     @@ -724,6 +726,8 @@ static int s5k6aa_new_config_sync(struct i2c_client *client, int timeout,
2849    
2850     /**
2851     * s5k6aa_set_prev_config - write user preview register set
2852     + * @s5k6aa: pointer to &struct s5k6aa describing the device
2853     + * @preset: s5kaa preset to be applied
2854     *
2855     * Configure output resolution and color fromat, pixel clock
2856     * frequency range, device frame rate type and frame period range.
2857     @@ -777,6 +781,7 @@ static int s5k6aa_set_prev_config(struct s5k6aa *s5k6aa,
2858    
2859     /**
2860     * s5k6aa_initialize_isp - basic ISP MCU initialization
2861     + * @sd: pointer to V4L2 sub-device descriptor
2862     *
2863     * Configure AHB addresses for registers read/write; configure PLLs for
2864     * required output pixel clock. The ISP power supply needs to be already
2865     diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
2866     index 1e3a0dd2238c..26d999c812c9 100644
2867     --- a/drivers/media/i2c/tc358743.c
2868     +++ b/drivers/media/i2c/tc358743.c
2869     @@ -193,57 +193,61 @@ static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
2870     }
2871     }
2872    
2873     -static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
2874     +static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
2875     {
2876     - u8 val;
2877     + __le32 val = 0;
2878    
2879     - i2c_rd(sd, reg, &val, 1);
2880     + i2c_rd(sd, reg, (u8 __force *)&val, n);
2881    
2882     - return val;
2883     + return le32_to_cpu(val);
2884     +}
2885     +
2886     +static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n)
2887     +{
2888     + __le32 raw = cpu_to_le32(val);
2889     +
2890     + i2c_wr(sd, reg, (u8 __force *)&raw, n);
2891     +}
2892     +
2893     +static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
2894     +{
2895     + return i2c_rdreg(sd, reg, 1);
2896     }
2897    
2898     static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)
2899     {
2900     - i2c_wr(sd, reg, &val, 1);
2901     + i2c_wrreg(sd, reg, val, 1);
2902     }
2903    
2904     static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
2905     u8 mask, u8 val)
2906     {
2907     - i2c_wr8(sd, reg, (i2c_rd8(sd, reg) & mask) | val);
2908     + i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
2909     }
2910    
2911     static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
2912     {
2913     - u16 val;
2914     -
2915     - i2c_rd(sd, reg, (u8 *)&val, 2);
2916     -
2917     - return val;
2918     + return i2c_rdreg(sd, reg, 2);
2919     }
2920    
2921     static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
2922     {
2923     - i2c_wr(sd, reg, (u8 *)&val, 2);
2924     + i2c_wrreg(sd, reg, val, 2);
2925     }
2926    
2927     static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val)
2928     {
2929     - i2c_wr16(sd, reg, (i2c_rd16(sd, reg) & mask) | val);
2930     + i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
2931     }
2932    
2933     static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg)
2934     {
2935     - u32 val;
2936     -
2937     - i2c_rd(sd, reg, (u8 *)&val, 4);
2938     -
2939     - return val;
2940     + return i2c_rdreg(sd, reg, 4);
2941     }
2942    
2943     static void i2c_wr32(struct v4l2_subdev *sd, u16 reg, u32 val)
2944     {
2945     - i2c_wr(sd, reg, (u8 *)&val, 4);
2946     + i2c_wrreg(sd, reg, val, 4);
2947     }
2948    
2949     /* --------------- STATUS --------------- */
2950     @@ -1236,7 +1240,7 @@ static int tc358743_g_register(struct v4l2_subdev *sd,
2951    
2952     reg->size = tc358743_get_reg_size(reg->reg);
2953    
2954     - i2c_rd(sd, reg->reg, (u8 *)&reg->val, reg->size);
2955     + reg->val = i2c_rdreg(sd, reg->reg, reg->size);
2956    
2957     return 0;
2958     }
2959     @@ -1262,7 +1266,7 @@ static int tc358743_s_register(struct v4l2_subdev *sd,
2960     reg->reg == BCAPS)
2961     return 0;
2962    
2963     - i2c_wr(sd, (u16)reg->reg, (u8 *)&reg->val,
2964     + i2c_wrreg(sd, (u16)reg->reg, reg->val,
2965     tc358743_get_reg_size(reg->reg));
2966    
2967     return 0;
2968     diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c
2969     index 652a059b2e0a..1ddf80f85c24 100644
2970     --- a/drivers/media/pci/tw5864/tw5864-video.c
2971     +++ b/drivers/media/pci/tw5864/tw5864-video.c
2972     @@ -708,6 +708,8 @@ static void tw5864_frame_interval_set(struct tw5864_input *input)
2973     static int tw5864_frameinterval_get(struct tw5864_input *input,
2974     struct v4l2_fract *frameinterval)
2975     {
2976     + struct tw5864_dev *dev = input->root;
2977     +
2978     switch (input->std) {
2979     case STD_NTSC:
2980     frameinterval->numerator = 1001;
2981     @@ -719,8 +721,8 @@ static int tw5864_frameinterval_get(struct tw5864_input *input,
2982     frameinterval->denominator = 25;
2983     break;
2984     default:
2985     - WARN(1, "tw5864_frameinterval_get requested for unknown std %d\n",
2986     - input->std);
2987     + dev_warn(&dev->pci->dev, "tw5864_frameinterval_get requested for unknown std %d\n",
2988     + input->std);
2989     return -EINVAL;
2990     }
2991    
2992     diff --git a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig
2993     index d917b0a2beb1..aa131cf9989b 100644
2994     --- a/drivers/media/usb/em28xx/Kconfig
2995     +++ b/drivers/media/usb/em28xx/Kconfig
2996     @@ -11,7 +11,7 @@ config VIDEO_EM28XX_V4L2
2997     select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
2998     select VIDEO_TVP5150 if MEDIA_SUBDRV_AUTOSELECT
2999     select VIDEO_MSP3400 if MEDIA_SUBDRV_AUTOSELECT
3000     - select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT
3001     + select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
3002    
3003     ---help---
3004     This is a video4linux driver for Empia 28xx based TV cards.
3005     diff --git a/drivers/media/usb/go7007/Kconfig b/drivers/media/usb/go7007/Kconfig
3006     index 95a3af644a92..af1d02430931 100644
3007     --- a/drivers/media/usb/go7007/Kconfig
3008     +++ b/drivers/media/usb/go7007/Kconfig
3009     @@ -11,7 +11,7 @@ config VIDEO_GO7007
3010     select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
3011     select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
3012     select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
3013     - select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT
3014     + select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
3015     select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
3016     ---help---
3017     This is a video4linux driver for the WIS GO7007 MPEG
3018     diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
3019     index 95c32f2d7601..db28e22edbf9 100644
3020     --- a/drivers/net/Kconfig
3021     +++ b/drivers/net/Kconfig
3022     @@ -437,6 +437,9 @@ config XEN_NETDEV_BACKEND
3023     config VMXNET3
3024     tristate "VMware VMXNET3 ethernet driver"
3025     depends on PCI && INET
3026     + depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \
3027     + IA64_PAGE_SIZE_64KB || MICROBLAZE_64K_PAGES || \
3028     + PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES)
3029     help
3030     This driver supports VMware's vmxnet3 virtual ethernet NIC.
3031     To compile this driver as a module, choose M here: the
3032     diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
3033     index e278e3d96ee0..c6163874e4e7 100644
3034     --- a/drivers/net/ethernet/arc/emac_rockchip.c
3035     +++ b/drivers/net/ethernet/arc/emac_rockchip.c
3036     @@ -220,9 +220,11 @@ static int emac_rockchip_probe(struct platform_device *pdev)
3037    
3038     /* RMII TX/RX needs always a rate of 25MHz */
3039     err = clk_set_rate(priv->macclk, 25000000);
3040     - if (err)
3041     + if (err) {
3042     dev_err(dev,
3043     "failed to change mac clock rate (%d)\n", err);
3044     + goto out_clk_disable_macclk;
3045     + }
3046     }
3047    
3048     err = arc_emac_probe(ndev, interface);
3049     @@ -232,7 +234,8 @@ static int emac_rockchip_probe(struct platform_device *pdev)
3050     }
3051    
3052     return 0;
3053     -
3054     +out_clk_disable_macclk:
3055     + clk_disable_unprepare(priv->macclk);
3056     out_regulator_disable:
3057     if (priv->regulator)
3058     regulator_disable(priv->regulator);
3059     diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
3060     index fd206889a433..e3b41ba95168 100644
3061     --- a/drivers/net/ethernet/freescale/gianfar.c
3062     +++ b/drivers/net/ethernet/freescale/gianfar.c
3063     @@ -1375,9 +1375,11 @@ static int gfar_probe(struct platform_device *ofdev)
3064    
3065     gfar_init_addr_hash_table(priv);
3066    
3067     - /* Insert receive time stamps into padding alignment bytes */
3068     + /* Insert receive time stamps into padding alignment bytes, and
3069     + * plus 2 bytes padding to ensure the cpu alignment.
3070     + */
3071     if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
3072     - priv->padding = 8;
3073     + priv->padding = 8 + DEFAULT_PADDING;
3074    
3075     if (dev->features & NETIF_F_IP_CSUM ||
3076     priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
3077     @@ -1787,6 +1789,7 @@ static int init_phy(struct net_device *dev)
3078     GFAR_SUPPORTED_GBIT : 0;
3079     phy_interface_t interface;
3080     struct phy_device *phydev;
3081     + struct ethtool_eee edata;
3082    
3083     priv->oldlink = 0;
3084     priv->oldspeed = 0;
3085     @@ -1811,6 +1814,10 @@ static int init_phy(struct net_device *dev)
3086     /* Add support for flow control, but don't advertise it by default */
3087     phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
3088    
3089     + /* disable EEE autoneg, EEE not supported by eTSEC */
3090     + memset(&edata, 0, sizeof(struct ethtool_eee));
3091     + phy_ethtool_set_eee(phydev, &edata);
3092     +
3093     return 0;
3094     }
3095    
3096     diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
3097     index 95c0b45a68fb..313e006f74fe 100644
3098     --- a/drivers/net/hippi/rrunner.c
3099     +++ b/drivers/net/hippi/rrunner.c
3100     @@ -1381,8 +1381,8 @@ static int rr_close(struct net_device *dev)
3101     rrpriv->info_dma);
3102     rrpriv->info = NULL;
3103    
3104     - free_irq(pdev->irq, dev);
3105     spin_unlock_irqrestore(&rrpriv->lock, flags);
3106     + free_irq(pdev->irq, dev);
3107    
3108     return 0;
3109     }
3110     diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
3111     index 980e38524418..627eb825eb74 100644
3112     --- a/drivers/net/ipvlan/ipvlan_core.c
3113     +++ b/drivers/net/ipvlan/ipvlan_core.c
3114     @@ -370,6 +370,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
3115     .flowi4_oif = dev->ifindex,
3116     .flowi4_tos = RT_TOS(ip4h->tos),
3117     .flowi4_flags = FLOWI_FLAG_ANYSRC,
3118     + .flowi4_mark = skb->mark,
3119     .daddr = ip4h->daddr,
3120     .saddr = ip4h->saddr,
3121     };
3122     diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
3123     index edffe5aeeeb1..d46f086e6360 100644
3124     --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
3125     +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
3126     @@ -2049,7 +2049,7 @@ static int brcmf_sdio_txpkt_hdalign(struct brcmf_sdio *bus, struct sk_buff *pkt)
3127     return head_pad;
3128     }
3129    
3130     -/**
3131     +/*
3132     * struct brcmf_skbuff_cb reserves first two bytes in sk_buff::cb for
3133     * bus layer usage.
3134     */
3135     diff --git a/drivers/net/wireless/st/cw1200/wsm.c b/drivers/net/wireless/st/cw1200/wsm.c
3136     index 680d60eabc75..ed93bf3474ec 100644
3137     --- a/drivers/net/wireless/st/cw1200/wsm.c
3138     +++ b/drivers/net/wireless/st/cw1200/wsm.c
3139     @@ -379,7 +379,6 @@ static int wsm_multi_tx_confirm(struct cw1200_common *priv,
3140     {
3141     int ret;
3142     int count;
3143     - int i;
3144    
3145     count = WSM_GET32(buf);
3146     if (WARN_ON(count <= 0))
3147     @@ -395,11 +394,10 @@ static int wsm_multi_tx_confirm(struct cw1200_common *priv,
3148     }
3149    
3150     cw1200_debug_txed_multi(priv, count);
3151     - for (i = 0; i < count; ++i) {
3152     + do {
3153     ret = wsm_tx_confirm(priv, buf, link_id);
3154     - if (ret)
3155     - return ret;
3156     - }
3157     + } while (!ret && --count);
3158     +
3159     return ret;
3160    
3161     underflow:
3162     diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
3163     index 37e29b580be3..0e7f8f319fe3 100644
3164     --- a/drivers/pci/host/vmd.c
3165     +++ b/drivers/pci/host/vmd.c
3166     @@ -727,7 +727,7 @@ static void vmd_remove(struct pci_dev *dev)
3167     irq_domain_remove(vmd->irq_domain);
3168     }
3169    
3170     -#ifdef CONFIG_PM
3171     +#ifdef CONFIG_PM_SLEEP
3172     static int vmd_suspend(struct device *dev)
3173     {
3174     struct pci_dev *pdev = to_pci_dev(dev);
3175     diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c
3176     index a8ac4bcef2c0..35b5289bc5da 100644
3177     --- a/drivers/perf/xgene_pmu.c
3178     +++ b/drivers/perf/xgene_pmu.c
3179     @@ -25,6 +25,7 @@
3180     #include <linux/interrupt.h>
3181     #include <linux/io.h>
3182     #include <linux/mfd/syscon.h>
3183     +#include <linux/module.h>
3184     #include <linux/of_address.h>
3185     #include <linux/of_fdt.h>
3186     #include <linux/of_irq.h>
3187     diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
3188     index 4f2a726bbaeb..f5f77432ce6f 100644
3189     --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
3190     +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
3191     @@ -428,7 +428,7 @@ static const struct sunxi_desc_pin a64_pins[] = {
3192     SUNXI_FUNCTION(0x0, "gpio_in"),
3193     SUNXI_FUNCTION(0x1, "gpio_out"),
3194     SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
3195     - SUNXI_FUNCTION(0x4, "uart0")), /* RX */
3196     + SUNXI_FUNCTION(0x3, "uart0")), /* RX */
3197     SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
3198     SUNXI_FUNCTION(0x0, "gpio_in"),
3199     SUNXI_FUNCTION(0x1, "gpio_out"),
3200     diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
3201     index 1b580ba76453..907d7db3fcee 100644
3202     --- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
3203     +++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
3204     @@ -145,19 +145,19 @@ static const struct sunxi_desc_pin sun9i_a80_pins[] = {
3205     SUNXI_FUNCTION(0x0, "gpio_in"),
3206     SUNXI_FUNCTION(0x1, "gpio_out"),
3207     SUNXI_FUNCTION(0x3, "mcsi"), /* MCLK */
3208     - SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PB_EINT14 */
3209     + SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 14)), /* PB_EINT14 */
3210     SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 15),
3211     SUNXI_FUNCTION(0x0, "gpio_in"),
3212     SUNXI_FUNCTION(0x1, "gpio_out"),
3213     SUNXI_FUNCTION(0x3, "mcsi"), /* SCK */
3214     SUNXI_FUNCTION(0x4, "i2c4"), /* SCK */
3215     - SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PB_EINT15 */
3216     + SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 15)), /* PB_EINT15 */
3217     SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 16),
3218     SUNXI_FUNCTION(0x0, "gpio_in"),
3219     SUNXI_FUNCTION(0x1, "gpio_out"),
3220     SUNXI_FUNCTION(0x3, "mcsi"), /* SDA */
3221     SUNXI_FUNCTION(0x4, "i2c4"), /* SDA */
3222     - SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PB_EINT16 */
3223     + SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 16)), /* PB_EINT16 */
3224    
3225     /* Hole */
3226     SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
3227     diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
3228     index 2c2f02b2e08a..167d5042a629 100644
3229     --- a/drivers/platform/x86/dell-laptop.c
3230     +++ b/drivers/platform/x86/dell-laptop.c
3231     @@ -45,6 +45,7 @@
3232    
3233     struct quirk_entry {
3234     u8 touchpad_led;
3235     + u8 kbd_led_levels_off_1;
3236    
3237     int needs_kbd_timeouts;
3238     /*
3239     @@ -75,6 +76,10 @@ static struct quirk_entry quirk_dell_xps13_9333 = {
3240     .kbd_timeouts = { 0, 5, 15, 60, 5 * 60, 15 * 60, -1 },
3241     };
3242    
3243     +static struct quirk_entry quirk_dell_latitude_e6410 = {
3244     + .kbd_led_levels_off_1 = 1,
3245     +};
3246     +
3247     static struct platform_driver platform_driver = {
3248     .driver = {
3249     .name = "dell-laptop",
3250     @@ -270,6 +275,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
3251     },
3252     .driver_data = &quirk_dell_xps13_9333,
3253     },
3254     + {
3255     + .callback = dmi_matched,
3256     + .ident = "Dell Latitude E6410",
3257     + .matches = {
3258     + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
3259     + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6410"),
3260     + },
3261     + .driver_data = &quirk_dell_latitude_e6410,
3262     + },
3263     { }
3264     };
3265    
3266     @@ -1170,6 +1184,9 @@ static int kbd_get_info(struct kbd_info *info)
3267     units = (buffer->output[2] >> 8) & 0xFF;
3268     info->levels = (buffer->output[2] >> 16) & 0xFF;
3269    
3270     + if (quirks && quirks->kbd_led_levels_off_1 && info->levels)
3271     + info->levels--;
3272     +
3273     if (units & BIT(0))
3274     info->seconds = (buffer->output[3] >> 0) & 0xFF;
3275     if (units & BIT(1))
3276     diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
3277     index 5c768c4627d3..78e1bfee698a 100644
3278     --- a/drivers/platform/x86/intel_mid_thermal.c
3279     +++ b/drivers/platform/x86/intel_mid_thermal.c
3280     @@ -415,6 +415,7 @@ static struct thermal_device_info *initialize_sensor(int index)
3281     return td_info;
3282     }
3283    
3284     +#ifdef CONFIG_PM_SLEEP
3285     /**
3286     * mid_thermal_resume - resume routine
3287     * @dev: device structure
3288     @@ -442,6 +443,7 @@ static int mid_thermal_suspend(struct device *dev)
3289     */
3290     return configure_adc(0);
3291     }
3292     +#endif
3293    
3294     static SIMPLE_DEV_PM_OPS(mid_thermal_pm,
3295     mid_thermal_suspend, mid_thermal_resume);
3296     diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
3297     index a7a88476e215..0f5bc2f8382b 100644
3298     --- a/drivers/s390/block/dasd_eckd.c
3299     +++ b/drivers/s390/block/dasd_eckd.c
3300     @@ -521,10 +521,12 @@ static int prefix_LRE(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata,
3301     pfxdata->validity.define_extent = 1;
3302    
3303     /* private uid is kept up to date, conf_data may be outdated */
3304     - if (startpriv->uid.type != UA_BASE_DEVICE) {
3305     + if (startpriv->uid.type == UA_BASE_PAV_ALIAS)
3306     pfxdata->validity.verify_base = 1;
3307     - if (startpriv->uid.type == UA_HYPER_PAV_ALIAS)
3308     - pfxdata->validity.hyper_pav = 1;
3309     +
3310     + if (startpriv->uid.type == UA_HYPER_PAV_ALIAS) {
3311     + pfxdata->validity.verify_base = 1;
3312     + pfxdata->validity.hyper_pav = 1;
3313     }
3314    
3315     /* define extend data (mostly)*/
3316     @@ -3471,10 +3473,12 @@ static int prepare_itcw(struct itcw *itcw,
3317     pfxdata.validity.define_extent = 1;
3318    
3319     /* private uid is kept up to date, conf_data may be outdated */
3320     - if (startpriv->uid.type != UA_BASE_DEVICE) {
3321     + if (startpriv->uid.type == UA_BASE_PAV_ALIAS)
3322     + pfxdata.validity.verify_base = 1;
3323     +
3324     + if (startpriv->uid.type == UA_HYPER_PAV_ALIAS) {
3325     pfxdata.validity.verify_base = 1;
3326     - if (startpriv->uid.type == UA_HYPER_PAV_ALIAS)
3327     - pfxdata.validity.hyper_pav = 1;
3328     + pfxdata.validity.hyper_pav = 1;
3329     }
3330    
3331     switch (cmd) {
3332     diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
3333     index febbd83e2ecd..24e57e770432 100644
3334     --- a/drivers/scsi/advansys.c
3335     +++ b/drivers/scsi/advansys.c
3336     @@ -6291,18 +6291,17 @@ static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time)
3337     static uchar
3338     AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset)
3339     {
3340     - EXT_MSG sdtr_buf;
3341     - uchar sdtr_period_index;
3342     - PortAddr iop_base;
3343     -
3344     - iop_base = asc_dvc->iop_base;
3345     - sdtr_buf.msg_type = EXTENDED_MESSAGE;
3346     - sdtr_buf.msg_len = MS_SDTR_LEN;
3347     - sdtr_buf.msg_req = EXTENDED_SDTR;
3348     - sdtr_buf.xfer_period = sdtr_period;
3349     + PortAddr iop_base = asc_dvc->iop_base;
3350     + uchar sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
3351     + EXT_MSG sdtr_buf = {
3352     + .msg_type = EXTENDED_MESSAGE,
3353     + .msg_len = MS_SDTR_LEN,
3354     + .msg_req = EXTENDED_SDTR,
3355     + .xfer_period = sdtr_period,
3356     + .req_ack_offset = sdtr_offset,
3357     + };
3358     sdtr_offset &= ASC_SYN_MAX_OFFSET;
3359     - sdtr_buf.req_ack_offset = sdtr_offset;
3360     - sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
3361     +
3362     if (sdtr_period_index <= asc_dvc->max_sdtr_index) {
3363     AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG,
3364     (uchar *)&sdtr_buf,
3365     @@ -11030,6 +11029,9 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop,
3366     ASC_DBG(2, "AdvInitGetConfig()\n");
3367    
3368     ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
3369     +#else
3370     + share_irq = 0;
3371     + ret = -ENODEV;
3372     #endif /* CONFIG_PCI */
3373     }
3374    
3375     diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
3376     index b7995474148c..0e7415f6d093 100644
3377     --- a/drivers/spi/Kconfig
3378     +++ b/drivers/spi/Kconfig
3379     @@ -156,6 +156,7 @@ config SPI_BCM63XX_HSSPI
3380     config SPI_BCM_QSPI
3381     tristate "Broadcom BSPI and MSPI controller support"
3382     depends on ARCH_BRCMSTB || ARCH_BCM || ARCH_BCM_IPROC || COMPILE_TEST
3383     + depends on MTD_NORFLASH
3384     default ARCH_BCM_IPROC
3385     help
3386     Enables support for the Broadcom SPI flash and MSPI controller.
3387     diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
3388     index 4969dc10684a..d8995b6c5a7e 100644
3389     --- a/drivers/spi/spi-sun4i.c
3390     +++ b/drivers/spi/spi-sun4i.c
3391     @@ -466,7 +466,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
3392    
3393     static int sun4i_spi_remove(struct platform_device *pdev)
3394     {
3395     - pm_runtime_disable(&pdev->dev);
3396     + pm_runtime_force_suspend(&pdev->dev);
3397    
3398     return 0;
3399     }
3400     diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
3401     index 558a66b459fa..d08324998933 100644
3402     --- a/drivers/staging/android/ashmem.c
3403     +++ b/drivers/staging/android/ashmem.c
3404     @@ -719,30 +719,32 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
3405     size_t pgstart, pgend;
3406     int ret = -EINVAL;
3407    
3408     + mutex_lock(&ashmem_mutex);
3409     +
3410     if (unlikely(!asma->file))
3411     - return -EINVAL;
3412     + goto out_unlock;
3413    
3414     - if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
3415     - return -EFAULT;
3416     + if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {
3417     + ret = -EFAULT;
3418     + goto out_unlock;
3419     + }
3420    
3421     /* per custom, you can pass zero for len to mean "everything onward" */
3422     if (!pin.len)
3423     pin.len = PAGE_ALIGN(asma->size) - pin.offset;
3424    
3425     if (unlikely((pin.offset | pin.len) & ~PAGE_MASK))
3426     - return -EINVAL;
3427     + goto out_unlock;
3428    
3429     if (unlikely(((__u32)-1) - pin.offset < pin.len))
3430     - return -EINVAL;
3431     + goto out_unlock;
3432    
3433     if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len))
3434     - return -EINVAL;
3435     + goto out_unlock;
3436    
3437     pgstart = pin.offset / PAGE_SIZE;
3438     pgend = pgstart + (pin.len / PAGE_SIZE) - 1;
3439    
3440     - mutex_lock(&ashmem_mutex);
3441     -
3442     switch (cmd) {
3443     case ASHMEM_PIN:
3444     ret = ashmem_pin(asma, pgstart, pgend);
3445     @@ -755,6 +757,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
3446     break;
3447     }
3448    
3449     +out_unlock:
3450     mutex_unlock(&ashmem_mutex);
3451    
3452     return ret;
3453     diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
3454     index 7e7431d8d49f..2b700e8455c6 100644
3455     --- a/drivers/staging/android/ion/ion-ioctl.c
3456     +++ b/drivers/staging/android/ion/ion-ioctl.c
3457     @@ -83,8 +83,10 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3458     return -EFAULT;
3459    
3460     ret = validate_ioctl_arg(cmd, &data);
3461     - if (WARN_ON_ONCE(ret))
3462     + if (ret) {
3463     + pr_warn_once("%s: ioctl validate failed\n", __func__);
3464     return ret;
3465     + }
3466    
3467     if (!(dir & _IOC_WRITE))
3468     memset(&data, 0, sizeof(data));
3469     diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
3470     index 7e023d505af8..d270a424ecac 100644
3471     --- a/drivers/staging/android/ion/ion_system_heap.c
3472     +++ b/drivers/staging/android/ion/ion_system_heap.c
3473     @@ -384,7 +384,7 @@ static int ion_system_contig_heap_allocate(struct ion_heap *heap,
3474     if (align > (PAGE_SIZE << order))
3475     return -EINVAL;
3476    
3477     - page = alloc_pages(low_order_gfp_flags, order);
3478     + page = alloc_pages(low_order_gfp_flags | __GFP_NOWARN, order);
3479     if (!page)
3480     return -ENOMEM;
3481    
3482     diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
3483     index eeacb0e55db7..4dc9ca3a11b4 100644
3484     --- a/drivers/staging/iio/adc/ad7192.c
3485     +++ b/drivers/staging/iio/adc/ad7192.c
3486     @@ -141,6 +141,8 @@
3487     #define AD7192_GPOCON_P1DAT BIT(1) /* P1 state */
3488     #define AD7192_GPOCON_P0DAT BIT(0) /* P0 state */
3489    
3490     +#define AD7192_EXT_FREQ_MHZ_MIN 2457600
3491     +#define AD7192_EXT_FREQ_MHZ_MAX 5120000
3492     #define AD7192_INT_FREQ_MHZ 4915200
3493    
3494     /* NOTE:
3495     @@ -216,6 +218,12 @@ static int ad7192_calibrate_all(struct ad7192_state *st)
3496     ARRAY_SIZE(ad7192_calib_arr));
3497     }
3498    
3499     +static inline bool ad7192_valid_external_frequency(u32 freq)
3500     +{
3501     + return (freq >= AD7192_EXT_FREQ_MHZ_MIN &&
3502     + freq <= AD7192_EXT_FREQ_MHZ_MAX);
3503     +}
3504     +
3505     static int ad7192_setup(struct ad7192_state *st,
3506     const struct ad7192_platform_data *pdata)
3507     {
3508     @@ -241,17 +249,20 @@ static int ad7192_setup(struct ad7192_state *st,
3509     id);
3510    
3511     switch (pdata->clock_source_sel) {
3512     - case AD7192_CLK_EXT_MCLK1_2:
3513     - case AD7192_CLK_EXT_MCLK2:
3514     - st->mclk = AD7192_INT_FREQ_MHZ;
3515     - break;
3516     case AD7192_CLK_INT:
3517     case AD7192_CLK_INT_CO:
3518     - if (pdata->ext_clk_hz)
3519     - st->mclk = pdata->ext_clk_hz;
3520     - else
3521     - st->mclk = AD7192_INT_FREQ_MHZ;
3522     + st->mclk = AD7192_INT_FREQ_MHZ;
3523     break;
3524     + case AD7192_CLK_EXT_MCLK1_2:
3525     + case AD7192_CLK_EXT_MCLK2:
3526     + if (ad7192_valid_external_frequency(pdata->ext_clk_hz)) {
3527     + st->mclk = pdata->ext_clk_hz;
3528     + break;
3529     + }
3530     + dev_err(&st->sd.spi->dev, "Invalid frequency setting %u\n",
3531     + pdata->ext_clk_hz);
3532     + ret = -EINVAL;
3533     + goto out;
3534     default:
3535     ret = -EINVAL;
3536     goto out;
3537     diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
3538     index 3892a7470410..4c7465c2d91c 100644
3539     --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
3540     +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
3541     @@ -642,8 +642,6 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
3542     /* Ring buffer functions - here trigger setup related */
3543     indio_dev->setup_ops = &ad5933_ring_setup_ops;
3544    
3545     - indio_dev->modes |= INDIO_BUFFER_HARDWARE;
3546     -
3547     return 0;
3548     }
3549    
3550     @@ -754,7 +752,7 @@ static int ad5933_probe(struct i2c_client *client,
3551     indio_dev->dev.parent = &client->dev;
3552     indio_dev->info = &ad5933_info;
3553     indio_dev->name = id->name;
3554     - indio_dev->modes = INDIO_DIRECT_MODE;
3555     + indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
3556     indio_dev->channels = ad5933_channels;
3557     indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
3558    
3559     diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c
3560     index db0572733712..ab30a0f5129c 100644
3561     --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c
3562     +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c
3563     @@ -119,6 +119,7 @@ static struct shash_alg alg = {
3564     .cra_name = "adler32",
3565     .cra_driver_name = "adler32-zlib",
3566     .cra_priority = 100,
3567     + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
3568     .cra_blocksize = CHKSUM_BLOCK_SIZE,
3569     .cra_ctxsize = sizeof(u32),
3570     .cra_module = THIS_MODULE,
3571     diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
3572     index a13541bdc726..6356295672cb 100644
3573     --- a/drivers/thermal/Kconfig
3574     +++ b/drivers/thermal/Kconfig
3575     @@ -316,7 +316,7 @@ config X86_PKG_TEMP_THERMAL
3576    
3577     config INTEL_SOC_DTS_IOSF_CORE
3578     tristate
3579     - depends on X86
3580     + depends on X86 && PCI
3581     select IOSF_MBI
3582     help
3583     This is becoming a common feature for Intel SoCs to expose the additional
3584     @@ -326,7 +326,7 @@ config INTEL_SOC_DTS_IOSF_CORE
3585    
3586     config INTEL_SOC_DTS_THERMAL
3587     tristate "Intel SoCs DTS thermal driver"
3588     - depends on X86
3589     + depends on X86 && PCI
3590     select INTEL_SOC_DTS_IOSF_CORE
3591     select THERMAL_WRITABLE_TRIPS
3592     help
3593     diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
3594     index fe414e7a9c78..a3e2200f5b5f 100644
3595     --- a/drivers/usb/dwc3/dwc3-of-simple.c
3596     +++ b/drivers/usb/dwc3/dwc3-of-simple.c
3597     @@ -58,8 +58,10 @@ static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
3598    
3599     clk = of_clk_get(np, i);
3600     if (IS_ERR(clk)) {
3601     - while (--i >= 0)
3602     + while (--i >= 0) {
3603     + clk_disable_unprepare(simple->clks[i]);
3604     clk_put(simple->clks[i]);
3605     + }
3606     return PTR_ERR(clk);
3607     }
3608    
3609     diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
3610     index 16c67120d72b..f483c3b1e971 100644
3611     --- a/drivers/usb/dwc3/gadget.c
3612     +++ b/drivers/usb/dwc3/gadget.c
3613     @@ -247,7 +247,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
3614     struct dwc3_gadget_ep_cmd_params *params)
3615     {
3616     struct dwc3 *dwc = dep->dwc;
3617     - u32 timeout = 500;
3618     + u32 timeout = 1000;
3619     u32 reg;
3620    
3621     int cmd_status = 0;
3622     diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
3623     index aac28d998073..2d9a8067eaca 100644
3624     --- a/drivers/usb/musb/musb_core.c
3625     +++ b/drivers/usb/musb/musb_core.c
3626     @@ -2043,6 +2043,7 @@ struct musb_pending_work {
3627     struct list_head node;
3628     };
3629    
3630     +#ifdef CONFIG_PM
3631     /*
3632     * Called from musb_runtime_resume(), musb_resume(), and
3633     * musb_queue_resume_work(). Callers must take musb->lock.
3634     @@ -2070,6 +2071,7 @@ static int musb_run_resume_work(struct musb *musb)
3635    
3636     return error;
3637     }
3638     +#endif
3639    
3640     /*
3641     * Called to run work if device is active or else queue the work to happen
3642     diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
3643     index b9c409a18faa..125cea1c3c8d 100644
3644     --- a/drivers/usb/phy/Kconfig
3645     +++ b/drivers/usb/phy/Kconfig
3646     @@ -147,6 +147,7 @@ config USB_MSM_OTG
3647     depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
3648     depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
3649     depends on RESET_CONTROLLER
3650     + depends on REGULATOR
3651     depends on EXTCON
3652     select USB_PHY
3653     help
3654     diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
3655     index 1886d8e4f14e..3550224f4d69 100644
3656     --- a/drivers/usb/usbip/stub_dev.c
3657     +++ b/drivers/usb/usbip/stub_dev.c
3658     @@ -87,6 +87,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
3659     goto err;
3660    
3661     sdev->ud.tcp_socket = socket;
3662     + sdev->ud.sockfd = sockfd;
3663    
3664     spin_unlock_irq(&sdev->ud.lock);
3665    
3666     @@ -186,6 +187,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)
3667     if (ud->tcp_socket) {
3668     sockfd_put(ud->tcp_socket);
3669     ud->tcp_socket = NULL;
3670     + ud->sockfd = -1;
3671     }
3672    
3673     /* 3. free used data */
3674     @@ -280,6 +282,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev)
3675     sdev->ud.status = SDEV_ST_AVAILABLE;
3676     spin_lock_init(&sdev->ud.lock);
3677     sdev->ud.tcp_socket = NULL;
3678     + sdev->ud.sockfd = -1;
3679    
3680     INIT_LIST_HEAD(&sdev->priv_init);
3681     INIT_LIST_HEAD(&sdev->priv_tx);
3682     diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
3683     index dbe615ba07c9..9936a2f199b1 100644
3684     --- a/drivers/usb/usbip/vhci_hcd.c
3685     +++ b/drivers/usb/usbip/vhci_hcd.c
3686     @@ -832,6 +832,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
3687     if (vdev->ud.tcp_socket) {
3688     sockfd_put(vdev->ud.tcp_socket);
3689     vdev->ud.tcp_socket = NULL;
3690     + vdev->ud.sockfd = -1;
3691     }
3692     pr_info("release socket\n");
3693    
3694     @@ -879,6 +880,7 @@ static void vhci_device_reset(struct usbip_device *ud)
3695     if (ud->tcp_socket) {
3696     sockfd_put(ud->tcp_socket);
3697     ud->tcp_socket = NULL;
3698     + ud->sockfd = -1;
3699     }
3700     ud->status = VDEV_ST_NULL;
3701    
3702     diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
3703     index 64613fbf5cf8..cd38f5add254 100644
3704     --- a/drivers/vhost/vhost.c
3705     +++ b/drivers/vhost/vhost.c
3706     @@ -849,7 +849,7 @@ static void vhost_dev_lock_vqs(struct vhost_dev *d)
3707     {
3708     int i = 0;
3709     for (i = 0; i < d->nvqs; ++i)
3710     - mutex_lock(&d->vqs[i]->mutex);
3711     + mutex_lock_nested(&d->vqs[i]->mutex, i);
3712     }
3713    
3714     static void vhost_dev_unlock_vqs(struct vhost_dev *d)
3715     diff --git a/drivers/video/fbdev/mmp/core.c b/drivers/video/fbdev/mmp/core.c
3716     index a0f496049db7..3a6bb6561ba0 100644
3717     --- a/drivers/video/fbdev/mmp/core.c
3718     +++ b/drivers/video/fbdev/mmp/core.c
3719     @@ -23,6 +23,7 @@
3720     #include <linux/slab.h>
3721     #include <linux/dma-mapping.h>
3722     #include <linux/export.h>
3723     +#include <linux/module.h>
3724     #include <video/mmp_disp.h>
3725    
3726     static struct mmp_overlay *path_get_overlay(struct mmp_path *path,
3727     @@ -249,3 +250,7 @@ void mmp_unregister_path(struct mmp_path *path)
3728     mutex_unlock(&disp_lock);
3729     }
3730     EXPORT_SYMBOL_GPL(mmp_unregister_path);
3731     +
3732     +MODULE_AUTHOR("Zhou Zhu <zzhu3@marvell.com>");
3733     +MODULE_DESCRIPTION("Marvell MMP display framework");
3734     +MODULE_LICENSE("GPL");
3735     diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
3736     index f9718f012aae..badee04ef496 100644
3737     --- a/drivers/video/fbdev/via/viafbdev.c
3738     +++ b/drivers/video/fbdev/via/viafbdev.c
3739     @@ -1630,16 +1630,14 @@ static void viafb_init_proc(struct viafb_shared *shared)
3740     }
3741     static void viafb_remove_proc(struct viafb_shared *shared)
3742     {
3743     - struct proc_dir_entry *viafb_entry = shared->proc_entry,
3744     - *iga1_entry = shared->iga1_proc_entry,
3745     - *iga2_entry = shared->iga2_proc_entry;
3746     + struct proc_dir_entry *viafb_entry = shared->proc_entry;
3747    
3748     if (!viafb_entry)
3749     return;
3750    
3751     - remove_proc_entry("output_devices", iga2_entry);
3752     + remove_proc_entry("output_devices", shared->iga2_proc_entry);
3753     remove_proc_entry("iga2", viafb_entry);
3754     - remove_proc_entry("output_devices", iga1_entry);
3755     + remove_proc_entry("output_devices", shared->iga1_proc_entry);
3756     remove_proc_entry("iga1", viafb_entry);
3757     remove_proc_entry("supported_output_devices", viafb_entry);
3758    
3759     diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
3760     index f15bb3b789d5..98b8f3205322 100644
3761     --- a/drivers/xen/Kconfig
3762     +++ b/drivers/xen/Kconfig
3763     @@ -246,7 +246,7 @@ config XEN_ACPI_HOTPLUG_CPU
3764    
3765     config XEN_ACPI_PROCESSOR
3766     tristate "Xen ACPI processor"
3767     - depends on XEN && X86 && ACPI_PROCESSOR && CPU_FREQ
3768     + depends on XEN && XEN_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ
3769     default m
3770     help
3771     This ACPI processor uploads Power Management information to the Xen
3772     diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
3773     index 0fe346c4bd28..d3dd631432eb 100644
3774     --- a/fs/btrfs/ioctl.c
3775     +++ b/fs/btrfs/ioctl.c
3776     @@ -2244,7 +2244,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
3777     if (!path)
3778     return -ENOMEM;
3779    
3780     - ptr = &name[BTRFS_INO_LOOKUP_PATH_MAX];
3781     + ptr = &name[BTRFS_INO_LOOKUP_PATH_MAX - 1];
3782    
3783     key.objectid = tree_id;
3784     key.type = BTRFS_ROOT_ITEM_KEY;
3785     diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c
3786     index 4d24d17bcfc1..943be5ecfcd9 100644
3787     --- a/fs/compat_binfmt_elf.c
3788     +++ b/fs/compat_binfmt_elf.c
3789     @@ -51,6 +51,7 @@
3790     #define elf_prstatus compat_elf_prstatus
3791     #define elf_prpsinfo compat_elf_prpsinfo
3792    
3793     +#ifdef CONFIG_ELF_CORE
3794     /*
3795     * Compat version of cputime_to_compat_timeval, perhaps this
3796     * should be an inline in <linux/compat.h>.
3797     @@ -63,6 +64,7 @@ static void cputime_to_compat_timeval(const cputime_t cputime,
3798     value->tv_sec = tv.tv_sec;
3799     value->tv_usec = tv.tv_usec;
3800     }
3801     +#endif
3802    
3803     #undef cputime_to_timeval
3804     #define cputime_to_timeval cputime_to_compat_timeval
3805     diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
3806     index 249594a821e0..f5cebd70d903 100644
3807     --- a/fs/reiserfs/lbalance.c
3808     +++ b/fs/reiserfs/lbalance.c
3809     @@ -475,7 +475,7 @@ static void leaf_item_bottle(struct buffer_info *dest_bi,
3810     * 'cpy_bytes'; create new item header;
3811     * n_ih = new item_header;
3812     */
3813     - memcpy(&n_ih, ih, SHORT_KEY_SIZE);
3814     + memcpy(&n_ih.ih_key, &ih->ih_key, KEY_SIZE);
3815    
3816     /* Endian safe, both le */
3817     n_ih.ih_version = ih->ih_version;
3818     diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
3819     index 2adcde137c3f..5dcf3ab83886 100644
3820     --- a/fs/reiserfs/reiserfs.h
3821     +++ b/fs/reiserfs/reiserfs.h
3822     @@ -1326,7 +1326,6 @@ struct cpu_key {
3823     #define KEY_NOT_FOUND 0
3824    
3825     #define KEY_SIZE (sizeof(struct reiserfs_key))
3826     -#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32))
3827    
3828     /* return values for search_by_key and clones */
3829     #define ITEM_FOUND 1
3830     diff --git a/include/crypto/hash.h b/include/crypto/hash.h
3831     index 26605888a199..d3de3b819ec0 100644
3832     --- a/include/crypto/hash.h
3833     +++ b/include/crypto/hash.h
3834     @@ -205,7 +205,6 @@ struct crypto_ahash {
3835     unsigned int keylen);
3836    
3837     unsigned int reqsize;
3838     - bool has_setkey;
3839     struct crypto_tfm base;
3840     };
3841    
3842     @@ -399,11 +398,6 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
3843     int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
3844     unsigned int keylen);
3845    
3846     -static inline bool crypto_ahash_has_setkey(struct crypto_ahash *tfm)
3847     -{
3848     - return tfm->has_setkey;
3849     -}
3850     -
3851     /**
3852     * crypto_ahash_finup() - update and finalize message digest
3853     * @req: reference to the ahash_request handle that holds all information
3854     @@ -475,7 +469,12 @@ static inline int crypto_ahash_export(struct ahash_request *req, void *out)
3855     */
3856     static inline int crypto_ahash_import(struct ahash_request *req, const void *in)
3857     {
3858     - return crypto_ahash_reqtfm(req)->import(req, in);
3859     + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
3860     +
3861     + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
3862     + return -ENOKEY;
3863     +
3864     + return tfm->import(req, in);
3865     }
3866    
3867     /**
3868     @@ -492,7 +491,12 @@ static inline int crypto_ahash_import(struct ahash_request *req, const void *in)
3869     */
3870     static inline int crypto_ahash_init(struct ahash_request *req)
3871     {
3872     - return crypto_ahash_reqtfm(req)->init(req);
3873     + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
3874     +
3875     + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
3876     + return -ENOKEY;
3877     +
3878     + return tfm->init(req);
3879     }
3880    
3881     /**
3882     @@ -845,7 +849,12 @@ static inline int crypto_shash_export(struct shash_desc *desc, void *out)
3883     */
3884     static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
3885     {
3886     - return crypto_shash_alg(desc->tfm)->import(desc, in);
3887     + struct crypto_shash *tfm = desc->tfm;
3888     +
3889     + if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
3890     + return -ENOKEY;
3891     +
3892     + return crypto_shash_alg(tfm)->import(desc, in);
3893     }
3894    
3895     /**
3896     @@ -861,7 +870,12 @@ static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
3897     */
3898     static inline int crypto_shash_init(struct shash_desc *desc)
3899     {
3900     - return crypto_shash_alg(desc->tfm)->init(desc);
3901     + struct crypto_shash *tfm = desc->tfm;
3902     +
3903     + if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
3904     + return -ENOKEY;
3905     +
3906     + return crypto_shash_alg(tfm)->init(desc);
3907     }
3908    
3909     /**
3910     diff --git a/include/linux/crypto.h b/include/linux/crypto.h
3911     index 7cee5551625b..8edb3ba6f640 100644
3912     --- a/include/linux/crypto.h
3913     +++ b/include/linux/crypto.h
3914     @@ -102,9 +102,17 @@
3915     */
3916     #define CRYPTO_ALG_INTERNAL 0x00002000
3917    
3918     +/*
3919     + * Set if the algorithm has a ->setkey() method but can be used without
3920     + * calling it first, i.e. there is a default key.
3921     + */
3922     +#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
3923     +
3924     /*
3925     * Transform masks and values (for crt_flags).
3926     */
3927     +#define CRYPTO_TFM_NEED_KEY 0x00000001
3928     +
3929     #define CRYPTO_TFM_REQ_MASK 0x000fff00
3930     #define CRYPTO_TFM_RES_MASK 0xfff00000
3931    
3932     diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
3933     index 7adad206b1f4..e19efac11d13 100644
3934     --- a/include/linux/pci-ecam.h
3935     +++ b/include/linux/pci-ecam.h
3936     @@ -59,7 +59,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
3937     /* default ECAM ops */
3938     extern struct pci_ecam_ops pci_generic_ecam_ops;
3939    
3940     -#ifdef CONFIG_PCI_HOST_GENERIC
3941     +#ifdef CONFIG_PCI_HOST_COMMON
3942     /* for DT-based PCI controllers that support ECAM */
3943     int pci_host_common_probe(struct platform_device *pdev,
3944     struct pci_ecam_ops *ops);
3945     diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
3946     index e38f471a5402..05c6d20c2a7a 100644
3947     --- a/include/linux/ptr_ring.h
3948     +++ b/include/linux/ptr_ring.h
3949     @@ -351,6 +351,8 @@ static inline void *ptr_ring_consume_bh(struct ptr_ring *r)
3950    
3951     static inline void **__ptr_ring_init_queue_alloc(unsigned int size, gfp_t gfp)
3952     {
3953     + if (size * sizeof(void *) > KMALLOC_MAX_SIZE)
3954     + return NULL;
3955     return kcalloc(size, sizeof(void *), gfp);
3956     }
3957    
3958     diff --git a/include/linux/string.h b/include/linux/string.h
3959     index 26b6f6a66f83..0c88c0a1a72b 100644
3960     --- a/include/linux/string.h
3961     +++ b/include/linux/string.h
3962     @@ -123,6 +123,7 @@ extern char *kstrdup(const char *s, gfp_t gfp) __malloc;
3963     extern const char *kstrdup_const(const char *s, gfp_t gfp);
3964     extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
3965     extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
3966     +extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
3967    
3968     extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
3969     extern void argv_free(char **argv);
3970     diff --git a/include/net/red.h b/include/net/red.h
3971     index 76e0b5f922c6..3618cdfec884 100644
3972     --- a/include/net/red.h
3973     +++ b/include/net/red.h
3974     @@ -167,6 +167,17 @@ static inline void red_set_vars(struct red_vars *v)
3975     v->qcount = -1;
3976     }
3977    
3978     +static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
3979     +{
3980     + if (fls(qth_min) + Wlog > 32)
3981     + return false;
3982     + if (fls(qth_max) + Wlog > 32)
3983     + return false;
3984     + if (qth_max < qth_min)
3985     + return false;
3986     + return true;
3987     +}
3988     +
3989     static inline void red_set_parms(struct red_parms *p,
3990     u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
3991     u8 Scell_log, u8 *stab, u32 max_P)
3992     @@ -178,7 +189,7 @@ static inline void red_set_parms(struct red_parms *p,
3993     p->qth_max = qth_max << Wlog;
3994     p->Wlog = Wlog;
3995     p->Plog = Plog;
3996     - if (delta < 0)
3997     + if (delta <= 0)
3998     delta = 1;
3999     p->qth_delta = delta;
4000     if (!max_P) {
4001     diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
4002     index 61d9ce89d10d..579ded2c6ef1 100644
4003     --- a/include/net/sctp/sctp.h
4004     +++ b/include/net/sctp/sctp.h
4005     @@ -433,7 +433,8 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
4006     if (asoc->user_frag)
4007     frag = min_t(int, frag, asoc->user_frag);
4008    
4009     - frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN));
4010     + frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN -
4011     + sizeof(struct sctp_data_chunk)));
4012    
4013     return frag;
4014     }
4015     diff --git a/include/trace/events/clk.h b/include/trace/events/clk.h
4016     index 758607226bfd..2cd449328aee 100644
4017     --- a/include/trace/events/clk.h
4018     +++ b/include/trace/events/clk.h
4019     @@ -134,12 +134,12 @@ DECLARE_EVENT_CLASS(clk_parent,
4020    
4021     TP_STRUCT__entry(
4022     __string( name, core->name )
4023     - __string( pname, parent->name )
4024     + __string( pname, parent ? parent->name : "none" )
4025     ),
4026    
4027     TP_fast_assign(
4028     __assign_str(name, core->name);
4029     - __assign_str(pname, parent->name);
4030     + __assign_str(pname, parent ? parent->name : "none");
4031     ),
4032    
4033     TP_printk("%s %s", __get_str(name), __get_str(pname))
4034     diff --git a/kernel/kcov.c b/kernel/kcov.c
4035     index 3cbb0c879705..3883df58aa12 100644
4036     --- a/kernel/kcov.c
4037     +++ b/kernel/kcov.c
4038     @@ -220,9 +220,9 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
4039     if (unused != 0 || kcov->mode == KCOV_MODE_DISABLED ||
4040     kcov->area == NULL)
4041     return -EINVAL;
4042     - if (kcov->t != NULL)
4043     - return -EBUSY;
4044     t = current;
4045     + if (kcov->t != NULL || t->kcov != NULL)
4046     + return -EBUSY;
4047     /* Cache in task struct for performance. */
4048     t->kcov_size = kcov->size;
4049     t->kcov_area = kcov->area;
4050     diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
4051     index dbafc5df03f3..4e17d55ba127 100644
4052     --- a/kernel/trace/blktrace.c
4053     +++ b/kernel/trace/blktrace.c
4054     @@ -57,7 +57,8 @@ static struct tracer_flags blk_tracer_flags = {
4055     };
4056    
4057     /* Global reference count of probes */
4058     -static atomic_t blk_probes_ref = ATOMIC_INIT(0);
4059     +static DEFINE_MUTEX(blk_probe_mutex);
4060     +static int blk_probes_ref;
4061    
4062     static void blk_register_tracepoints(void);
4063     static void blk_unregister_tracepoints(void);
4064     @@ -306,11 +307,26 @@ static void blk_trace_free(struct blk_trace *bt)
4065     kfree(bt);
4066     }
4067    
4068     +static void get_probe_ref(void)
4069     +{
4070     + mutex_lock(&blk_probe_mutex);
4071     + if (++blk_probes_ref == 1)
4072     + blk_register_tracepoints();
4073     + mutex_unlock(&blk_probe_mutex);
4074     +}
4075     +
4076     +static void put_probe_ref(void)
4077     +{
4078     + mutex_lock(&blk_probe_mutex);
4079     + if (!--blk_probes_ref)
4080     + blk_unregister_tracepoints();
4081     + mutex_unlock(&blk_probe_mutex);
4082     +}
4083     +
4084     static void blk_trace_cleanup(struct blk_trace *bt)
4085     {
4086     blk_trace_free(bt);
4087     - if (atomic_dec_and_test(&blk_probes_ref))
4088     - blk_unregister_tracepoints();
4089     + put_probe_ref();
4090     }
4091    
4092     int blk_trace_remove(struct request_queue *q)
4093     @@ -522,8 +538,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
4094     if (cmpxchg(&q->blk_trace, NULL, bt))
4095     goto err;
4096    
4097     - if (atomic_inc_return(&blk_probes_ref) == 1)
4098     - blk_register_tracepoints();
4099     + get_probe_ref();
4100    
4101     return 0;
4102     err:
4103     @@ -1469,9 +1484,7 @@ static int blk_trace_remove_queue(struct request_queue *q)
4104     if (bt == NULL)
4105     return -EINVAL;
4106    
4107     - if (atomic_dec_and_test(&blk_probes_ref))
4108     - blk_unregister_tracepoints();
4109     -
4110     + put_probe_ref();
4111     blk_trace_free(bt);
4112     return 0;
4113     }
4114     @@ -1502,8 +1515,7 @@ static int blk_trace_setup_queue(struct request_queue *q,
4115     if (cmpxchg(&q->blk_trace, NULL, bt))
4116     goto free_bt;
4117    
4118     - if (atomic_inc_return(&blk_probes_ref) == 1)
4119     - blk_register_tracepoints();
4120     + get_probe_ref();
4121     return 0;
4122    
4123     free_bt:
4124     diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
4125     index f60e67217f18..58a22ca10f33 100644
4126     --- a/lib/Kconfig.debug
4127     +++ b/lib/Kconfig.debug
4128     @@ -197,7 +197,6 @@ config ENABLE_MUST_CHECK
4129     config FRAME_WARN
4130     int "Warn for stack frames larger than (needs gcc 4.4)"
4131     range 0 8192
4132     - default 0 if KASAN
4133     default 2048 if GCC_PLUGIN_LATENT_ENTROPY
4134     default 1024 if !64BIT
4135     default 2048 if 64BIT
4136     diff --git a/lib/oid_registry.c b/lib/oid_registry.c
4137     index 318f382a010d..150e04d70303 100644
4138     --- a/lib/oid_registry.c
4139     +++ b/lib/oid_registry.c
4140     @@ -116,7 +116,7 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize)
4141     int count;
4142    
4143     if (v >= end)
4144     - return -EBADMSG;
4145     + goto bad;
4146    
4147     n = *v++;
4148     ret = count = snprintf(buffer, bufsize, "%u.%u", n / 40, n % 40);
4149     @@ -134,7 +134,7 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize)
4150     num = n & 0x7f;
4151     do {
4152     if (v >= end)
4153     - return -EBADMSG;
4154     + goto bad;
4155     n = *v++;
4156     num <<= 7;
4157     num |= n & 0x7f;
4158     @@ -148,6 +148,10 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize)
4159     }
4160    
4161     return ret;
4162     +
4163     +bad:
4164     + snprintf(buffer, bufsize, "(bad)");
4165     + return -EBADMSG;
4166     }
4167     EXPORT_SYMBOL_GPL(sprint_oid);
4168    
4169     diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c
4170     index 6d5717bd7197..57540de2b44c 100644
4171     --- a/mm/early_ioremap.c
4172     +++ b/mm/early_ioremap.c
4173     @@ -103,7 +103,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
4174     enum fixed_addresses idx;
4175     int i, slot;
4176    
4177     - WARN_ON(system_state != SYSTEM_BOOTING);
4178     + WARN_ON(system_state >= SYSTEM_RUNNING);
4179    
4180     slot = -1;
4181     for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {
4182     diff --git a/mm/shmem.c b/mm/shmem.c
4183     index 004e0f87e8a8..2123bfc39ef2 100644
4184     --- a/mm/shmem.c
4185     +++ b/mm/shmem.c
4186     @@ -370,6 +370,7 @@ static bool shmem_confirm_swap(struct address_space *mapping,
4187    
4188     int shmem_huge __read_mostly;
4189    
4190     +#if defined(CONFIG_SYSFS) || defined(CONFIG_TMPFS)
4191     static int shmem_parse_huge(const char *str)
4192     {
4193     if (!strcmp(str, "never"))
4194     @@ -407,6 +408,7 @@ static const char *shmem_format_huge(int huge)
4195     return "bad_val";
4196     }
4197     }
4198     +#endif
4199    
4200     static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
4201     struct shrink_control *sc, unsigned long nr_to_split)
4202     @@ -1550,7 +1552,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
4203     struct mm_struct *fault_mm, int *fault_type)
4204     {
4205     struct address_space *mapping = inode->i_mapping;
4206     - struct shmem_inode_info *info;
4207     + struct shmem_inode_info *info = SHMEM_I(inode);
4208     struct shmem_sb_info *sbinfo;
4209     struct mm_struct *charge_mm;
4210     struct mem_cgroup *memcg;
4211     @@ -1600,7 +1602,6 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
4212     * Fast cache lookup did not find it:
4213     * bring it back from swap or allocate.
4214     */
4215     - info = SHMEM_I(inode);
4216     sbinfo = SHMEM_SB(inode->i_sb);
4217     charge_mm = fault_mm ? : current->mm;
4218    
4219     @@ -1852,7 +1853,6 @@ alloc_nohuge: page = shmem_alloc_and_acct_page(gfp, info, sbinfo,
4220     put_page(page);
4221     }
4222     if (error == -ENOSPC && !once++) {
4223     - info = SHMEM_I(inode);
4224     spin_lock_irq(&info->lock);
4225     shmem_recalc_inode(inode);
4226     spin_unlock_irq(&info->lock);
4227     diff --git a/mm/util.c b/mm/util.c
4228     index 1a41553db866..8c755d05d4e6 100644
4229     --- a/mm/util.c
4230     +++ b/mm/util.c
4231     @@ -80,6 +80,8 @@ EXPORT_SYMBOL(kstrdup_const);
4232     * @s: the string to duplicate
4233     * @max: read at most @max chars from @s
4234     * @gfp: the GFP mask used in the kmalloc() call when allocating memory
4235     + *
4236     + * Note: Use kmemdup_nul() instead if the size is known exactly.
4237     */
4238     char *kstrndup(const char *s, size_t max, gfp_t gfp)
4239     {
4240     @@ -117,6 +119,28 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp)
4241     }
4242     EXPORT_SYMBOL(kmemdup);
4243    
4244     +/**
4245     + * kmemdup_nul - Create a NUL-terminated string from unterminated data
4246     + * @s: The data to stringify
4247     + * @len: The size of the data
4248     + * @gfp: the GFP mask used in the kmalloc() call when allocating memory
4249     + */
4250     +char *kmemdup_nul(const char *s, size_t len, gfp_t gfp)
4251     +{
4252     + char *buf;
4253     +
4254     + if (!s)
4255     + return NULL;
4256     +
4257     + buf = kmalloc_track_caller(len + 1, gfp);
4258     + if (buf) {
4259     + memcpy(buf, s, len);
4260     + buf[len] = '\0';
4261     + }
4262     + return buf;
4263     +}
4264     +EXPORT_SYMBOL(kmemdup_nul);
4265     +
4266     /**
4267     * memdup_user - duplicate memory region from user space
4268     *
4269     diff --git a/mm/vmscan.c b/mm/vmscan.c
4270     index f118dc23f662..4365de74bdb0 100644
4271     --- a/mm/vmscan.c
4272     +++ b/mm/vmscan.c
4273     @@ -295,10 +295,13 @@ EXPORT_SYMBOL(register_shrinker);
4274     */
4275     void unregister_shrinker(struct shrinker *shrinker)
4276     {
4277     + if (!shrinker->nr_deferred)
4278     + return;
4279     down_write(&shrinker_rwsem);
4280     list_del(&shrinker->list);
4281     up_write(&shrinker_rwsem);
4282     kfree(shrinker->nr_deferred);
4283     + shrinker->nr_deferred = NULL;
4284     }
4285     EXPORT_SYMBOL(unregister_shrinker);
4286    
4287     diff --git a/net/core/dev.c b/net/core/dev.c
4288     index 67b5d4d8acb1..8898618bf341 100644
4289     --- a/net/core/dev.c
4290     +++ b/net/core/dev.c
4291     @@ -2763,7 +2763,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
4292    
4293     segs = skb_mac_gso_segment(skb, features);
4294    
4295     - if (unlikely(skb_needs_check(skb, tx_path)))
4296     + if (unlikely(skb_needs_check(skb, tx_path) && !IS_ERR(segs)))
4297     skb_warn_bad_offload(skb);
4298    
4299     return segs;
4300     diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
4301     index 13d6b1a6e0fc..9d8fcdefefc0 100644
4302     --- a/net/decnet/af_decnet.c
4303     +++ b/net/decnet/af_decnet.c
4304     @@ -1337,6 +1337,12 @@ static int dn_setsockopt(struct socket *sock, int level, int optname, char __use
4305     lock_sock(sk);
4306     err = __dn_setsockopt(sock, level, optname, optval, optlen, 0);
4307     release_sock(sk);
4308     +#ifdef CONFIG_NETFILTER
4309     + /* we need to exclude all possible ENOPROTOOPTs except default case */
4310     + if (err == -ENOPROTOOPT && optname != DSO_LINKINFO &&
4311     + optname != DSO_STREAM && optname != DSO_SEQPACKET)
4312     + err = nf_setsockopt(sk, PF_DECnet, optname, optval, optlen);
4313     +#endif
4314    
4315     return err;
4316     }
4317     @@ -1444,15 +1450,6 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
4318     dn_nsp_send_disc(sk, 0x38, 0, sk->sk_allocation);
4319     break;
4320    
4321     - default:
4322     -#ifdef CONFIG_NETFILTER
4323     - return nf_setsockopt(sk, PF_DECnet, optname, optval, optlen);
4324     -#endif
4325     - case DSO_LINKINFO:
4326     - case DSO_STREAM:
4327     - case DSO_SEQPACKET:
4328     - return -ENOPROTOOPT;
4329     -
4330     case DSO_MAXWINDOW:
4331     if (optlen != sizeof(unsigned long))
4332     return -EINVAL;
4333     @@ -1500,6 +1497,12 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
4334     return -EINVAL;
4335     scp->info_loc = u.info;
4336     break;
4337     +
4338     + case DSO_LINKINFO:
4339     + case DSO_STREAM:
4340     + case DSO_SEQPACKET:
4341     + default:
4342     + return -ENOPROTOOPT;
4343     }
4344    
4345     return 0;
4346     @@ -1513,6 +1516,20 @@ static int dn_getsockopt(struct socket *sock, int level, int optname, char __use
4347     lock_sock(sk);
4348     err = __dn_getsockopt(sock, level, optname, optval, optlen, 0);
4349     release_sock(sk);
4350     +#ifdef CONFIG_NETFILTER
4351     + if (err == -ENOPROTOOPT && optname != DSO_STREAM &&
4352     + optname != DSO_SEQPACKET && optname != DSO_CONACCEPT &&
4353     + optname != DSO_CONREJECT) {
4354     + int len;
4355     +
4356     + if (get_user(len, optlen))
4357     + return -EFAULT;
4358     +
4359     + err = nf_getsockopt(sk, PF_DECnet, optname, optval, &len);
4360     + if (err >= 0)
4361     + err = put_user(len, optlen);
4362     + }
4363     +#endif
4364    
4365     return err;
4366     }
4367     @@ -1578,26 +1595,6 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
4368     r_data = &link;
4369     break;
4370    
4371     - default:
4372     -#ifdef CONFIG_NETFILTER
4373     - {
4374     - int ret, len;
4375     -
4376     - if (get_user(len, optlen))
4377     - return -EFAULT;
4378     -
4379     - ret = nf_getsockopt(sk, PF_DECnet, optname, optval, &len);
4380     - if (ret >= 0)
4381     - ret = put_user(len, optlen);
4382     - return ret;
4383     - }
4384     -#endif
4385     - case DSO_STREAM:
4386     - case DSO_SEQPACKET:
4387     - case DSO_CONACCEPT:
4388     - case DSO_CONREJECT:
4389     - return -ENOPROTOOPT;
4390     -
4391     case DSO_MAXWINDOW:
4392     if (r_len > sizeof(unsigned long))
4393     r_len = sizeof(unsigned long);
4394     @@ -1629,6 +1626,13 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
4395     r_len = sizeof(unsigned char);
4396     r_data = &scp->info_rem;
4397     break;
4398     +
4399     + case DSO_STREAM:
4400     + case DSO_SEQPACKET:
4401     + case DSO_CONACCEPT:
4402     + case DSO_CONREJECT:
4403     + default:
4404     + return -ENOPROTOOPT;
4405     }
4406    
4407     if (r_data) {
4408     diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
4409     index 551dd393ceec..bf62fa487262 100644
4410     --- a/net/ipv4/ip_sockglue.c
4411     +++ b/net/ipv4/ip_sockglue.c
4412     @@ -1243,11 +1243,8 @@ int ip_setsockopt(struct sock *sk, int level,
4413     if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
4414     optname != IP_IPSEC_POLICY &&
4415     optname != IP_XFRM_POLICY &&
4416     - !ip_mroute_opt(optname)) {
4417     - lock_sock(sk);
4418     + !ip_mroute_opt(optname))
4419     err = nf_setsockopt(sk, PF_INET, optname, optval, optlen);
4420     - release_sock(sk);
4421     - }
4422     #endif
4423     return err;
4424     }
4425     @@ -1272,12 +1269,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
4426     if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
4427     optname != IP_IPSEC_POLICY &&
4428     optname != IP_XFRM_POLICY &&
4429     - !ip_mroute_opt(optname)) {
4430     - lock_sock(sk);
4431     - err = compat_nf_setsockopt(sk, PF_INET, optname,
4432     - optval, optlen);
4433     - release_sock(sk);
4434     - }
4435     + !ip_mroute_opt(optname))
4436     + err = compat_nf_setsockopt(sk, PF_INET, optname, optval,
4437     + optlen);
4438     #endif
4439     return err;
4440     }
4441     diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
4442     index 4a9e6db9df8d..16599bae11dd 100644
4443     --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
4444     +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
4445     @@ -365,7 +365,7 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
4446     struct ipt_clusterip_tgt_info *cipinfo = par->targinfo;
4447     const struct ipt_entry *e = par->entryinfo;
4448     struct clusterip_config *config;
4449     - int ret;
4450     + int ret, i;
4451    
4452     if (par->nft_compat) {
4453     pr_err("cannot use CLUSTERIP target from nftables compat\n");
4454     @@ -384,8 +384,18 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
4455     pr_info("Please specify destination IP\n");
4456     return -EINVAL;
4457     }
4458     -
4459     - /* FIXME: further sanity checks */
4460     + if (cipinfo->num_local_nodes > ARRAY_SIZE(cipinfo->local_nodes)) {
4461     + pr_info("bad num_local_nodes %u\n", cipinfo->num_local_nodes);
4462     + return -EINVAL;
4463     + }
4464     + for (i = 0; i < cipinfo->num_local_nodes; i++) {
4465     + if (cipinfo->local_nodes[i] - 1 >=
4466     + sizeof(config->local_nodes) * 8) {
4467     + pr_info("bad local_nodes[%d] %u\n",
4468     + i, cipinfo->local_nodes[i]);
4469     + return -EINVAL;
4470     + }
4471     + }
4472    
4473     config = clusterip_config_find_get(par->net, e->ip.dst.s_addr, 1);
4474     if (!config) {
4475     diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
4476     index 0c9ded247ebb..6dc8eab0fabc 100644
4477     --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
4478     +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
4479     @@ -218,15 +218,19 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
4480     struct nf_conntrack_tuple tuple;
4481    
4482     memset(&tuple, 0, sizeof(tuple));
4483     +
4484     + lock_sock(sk);
4485     tuple.src.u3.ip = inet->inet_rcv_saddr;
4486     tuple.src.u.tcp.port = inet->inet_sport;
4487     tuple.dst.u3.ip = inet->inet_daddr;
4488     tuple.dst.u.tcp.port = inet->inet_dport;
4489     tuple.src.l3num = PF_INET;
4490     tuple.dst.protonum = sk->sk_protocol;
4491     + release_sock(sk);
4492    
4493     /* We only do TCP and SCTP at the moment: is there a better way? */
4494     - if (sk->sk_protocol != IPPROTO_TCP && sk->sk_protocol != IPPROTO_SCTP) {
4495     + if (tuple.dst.protonum != IPPROTO_TCP &&
4496     + tuple.dst.protonum != IPPROTO_SCTP) {
4497     pr_debug("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n");
4498     return -ENOPROTOOPT;
4499     }
4500     diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
4501     index bcea985dd76b..493a32f6a5f2 100644
4502     --- a/net/ipv6/ipv6_sockglue.c
4503     +++ b/net/ipv6/ipv6_sockglue.c
4504     @@ -907,12 +907,8 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname,
4505     #ifdef CONFIG_NETFILTER
4506     /* we need to exclude all possible ENOPROTOOPTs except default case */
4507     if (err == -ENOPROTOOPT && optname != IPV6_IPSEC_POLICY &&
4508     - optname != IPV6_XFRM_POLICY) {
4509     - lock_sock(sk);
4510     - err = nf_setsockopt(sk, PF_INET6, optname, optval,
4511     - optlen);
4512     - release_sock(sk);
4513     - }
4514     + optname != IPV6_XFRM_POLICY)
4515     + err = nf_setsockopt(sk, PF_INET6, optname, optval, optlen);
4516     #endif
4517     return err;
4518     }
4519     @@ -942,12 +938,9 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
4520     #ifdef CONFIG_NETFILTER
4521     /* we need to exclude all possible ENOPROTOOPTs except default case */
4522     if (err == -ENOPROTOOPT && optname != IPV6_IPSEC_POLICY &&
4523     - optname != IPV6_XFRM_POLICY) {
4524     - lock_sock(sk);
4525     - err = compat_nf_setsockopt(sk, PF_INET6, optname,
4526     - optval, optlen);
4527     - release_sock(sk);
4528     - }
4529     + optname != IPV6_XFRM_POLICY)
4530     + err = compat_nf_setsockopt(sk, PF_INET6, optname, optval,
4531     + optlen);
4532     #endif
4533     return err;
4534     }
4535     diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
4536     index 963ee3848675..af80e97f59b5 100644
4537     --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
4538     +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
4539     @@ -226,20 +226,27 @@ static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = {
4540     static int
4541     ipv6_getorigdst(struct sock *sk, int optval, void __user *user, int *len)
4542     {
4543     - const struct inet_sock *inet = inet_sk(sk);
4544     + struct nf_conntrack_tuple tuple = { .src.l3num = NFPROTO_IPV6 };
4545     const struct ipv6_pinfo *inet6 = inet6_sk(sk);
4546     + const struct inet_sock *inet = inet_sk(sk);
4547     const struct nf_conntrack_tuple_hash *h;
4548     struct sockaddr_in6 sin6;
4549     - struct nf_conntrack_tuple tuple = { .src.l3num = NFPROTO_IPV6 };
4550     struct nf_conn *ct;
4551     + __be32 flow_label;
4552     + int bound_dev_if;
4553    
4554     + lock_sock(sk);
4555     tuple.src.u3.in6 = sk->sk_v6_rcv_saddr;
4556     tuple.src.u.tcp.port = inet->inet_sport;
4557     tuple.dst.u3.in6 = sk->sk_v6_daddr;
4558     tuple.dst.u.tcp.port = inet->inet_dport;
4559     tuple.dst.protonum = sk->sk_protocol;
4560     + bound_dev_if = sk->sk_bound_dev_if;
4561     + flow_label = inet6->flow_label;
4562     + release_sock(sk);
4563    
4564     - if (sk->sk_protocol != IPPROTO_TCP && sk->sk_protocol != IPPROTO_SCTP)
4565     + if (tuple.dst.protonum != IPPROTO_TCP &&
4566     + tuple.dst.protonum != IPPROTO_SCTP)
4567     return -ENOPROTOOPT;
4568    
4569     if (*len < 0 || (unsigned int) *len < sizeof(sin6))
4570     @@ -257,14 +264,13 @@ ipv6_getorigdst(struct sock *sk, int optval, void __user *user, int *len)
4571    
4572     sin6.sin6_family = AF_INET6;
4573     sin6.sin6_port = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.tcp.port;
4574     - sin6.sin6_flowinfo = inet6->flow_label & IPV6_FLOWINFO_MASK;
4575     + sin6.sin6_flowinfo = flow_label & IPV6_FLOWINFO_MASK;
4576     memcpy(&sin6.sin6_addr,
4577     &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.in6,
4578     sizeof(sin6.sin6_addr));
4579    
4580     nf_ct_put(ct);
4581     - sin6.sin6_scope_id = ipv6_iface_scope_id(&sin6.sin6_addr,
4582     - sk->sk_bound_dev_if);
4583     + sin6.sin6_scope_id = ipv6_iface_scope_id(&sin6.sin6_addr, bound_dev_if);
4584     return copy_to_user(user, &sin6, sizeof(sin6)) ? -EFAULT : 0;
4585     }
4586    
4587     diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
4588     index 22785dc03051..179cd9b1b1f4 100644
4589     --- a/net/kcm/kcmsock.c
4590     +++ b/net/kcm/kcmsock.c
4591     @@ -1381,8 +1381,13 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
4592     if (!csk)
4593     return -EINVAL;
4594    
4595     - /* We must prevent loops or risk deadlock ! */
4596     - if (csk->sk_family == PF_KCM)
4597     + /* Only allow TCP sockets to be attached for now */
4598     + if ((csk->sk_family != AF_INET && csk->sk_family != AF_INET6) ||
4599     + csk->sk_protocol != IPPROTO_TCP)
4600     + return -EOPNOTSUPP;
4601     +
4602     + /* Don't allow listeners or closed sockets */
4603     + if (csk->sk_state == TCP_LISTEN || csk->sk_state == TCP_CLOSE)
4604     return -EOPNOTSUPP;
4605    
4606     psock = kmem_cache_zalloc(kcm_psockp, GFP_KERNEL);
4607     @@ -1404,9 +1409,18 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
4608     return err;
4609     }
4610    
4611     - sock_hold(csk);
4612     -
4613     write_lock_bh(&csk->sk_callback_lock);
4614     +
4615     + /* Check if sk_user_data is aready by KCM or someone else.
4616     + * Must be done under lock to prevent race conditions.
4617     + */
4618     + if (csk->sk_user_data) {
4619     + write_unlock_bh(&csk->sk_callback_lock);
4620     + strp_done(&psock->strp);
4621     + kmem_cache_free(kcm_psockp, psock);
4622     + return -EALREADY;
4623     + }
4624     +
4625     psock->save_data_ready = csk->sk_data_ready;
4626     psock->save_write_space = csk->sk_write_space;
4627     psock->save_state_change = csk->sk_state_change;
4628     @@ -1414,8 +1428,11 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
4629     csk->sk_data_ready = psock_data_ready;
4630     csk->sk_write_space = psock_write_space;
4631     csk->sk_state_change = psock_state_change;
4632     +
4633     write_unlock_bh(&csk->sk_callback_lock);
4634    
4635     + sock_hold(csk);
4636     +
4637     /* Finished initialization, now add the psock to the MUX. */
4638     spin_lock_bh(&mux->lock);
4639     head = &mux->psocks;
4640     diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
4641     index fc4977456c30..e47ade305a46 100644
4642     --- a/net/netfilter/x_tables.c
4643     +++ b/net/netfilter/x_tables.c
4644     @@ -39,8 +39,6 @@ MODULE_LICENSE("GPL");
4645     MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
4646     MODULE_DESCRIPTION("{ip,ip6,arp,eb}_tables backend module");
4647    
4648     -#define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
4649     -
4650     struct compat_delta {
4651     unsigned int offset; /* offset in kernel */
4652     int delta; /* delta in 32bit user land */
4653     @@ -209,6 +207,9 @@ xt_request_find_match(uint8_t nfproto, const char *name, uint8_t revision)
4654     {
4655     struct xt_match *match;
4656    
4657     + if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
4658     + return ERR_PTR(-EINVAL);
4659     +
4660     match = xt_find_match(nfproto, name, revision);
4661     if (IS_ERR(match)) {
4662     request_module("%st_%s", xt_prefix[nfproto], name);
4663     @@ -251,6 +252,9 @@ struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision)
4664     {
4665     struct xt_target *target;
4666    
4667     + if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
4668     + return ERR_PTR(-EINVAL);
4669     +
4670     target = xt_find_target(af, name, revision);
4671     if (IS_ERR(target)) {
4672     request_module("%st_%s", xt_prefix[af], name);
4673     @@ -952,7 +956,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
4674     return NULL;
4675    
4676     /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
4677     - if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
4678     + if ((size >> PAGE_SHIFT) + 2 > totalram_pages)
4679     return NULL;
4680    
4681     if (sz <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
4682     diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
4683     index dbd6c4a12b97..92cfae66743b 100644
4684     --- a/net/netfilter/xt_RATEEST.c
4685     +++ b/net/netfilter/xt_RATEEST.c
4686     @@ -39,23 +39,31 @@ static void xt_rateest_hash_insert(struct xt_rateest *est)
4687     hlist_add_head(&est->list, &rateest_hash[h]);
4688     }
4689    
4690     -struct xt_rateest *xt_rateest_lookup(const char *name)
4691     +static struct xt_rateest *__xt_rateest_lookup(const char *name)
4692     {
4693     struct xt_rateest *est;
4694     unsigned int h;
4695    
4696     h = xt_rateest_hash(name);
4697     - mutex_lock(&xt_rateest_mutex);
4698     hlist_for_each_entry(est, &rateest_hash[h], list) {
4699     if (strcmp(est->name, name) == 0) {
4700     est->refcnt++;
4701     - mutex_unlock(&xt_rateest_mutex);
4702     return est;
4703     }
4704     }
4705     - mutex_unlock(&xt_rateest_mutex);
4706     +
4707     return NULL;
4708     }
4709     +
4710     +struct xt_rateest *xt_rateest_lookup(const char *name)
4711     +{
4712     + struct xt_rateest *est;
4713     +
4714     + mutex_lock(&xt_rateest_mutex);
4715     + est = __xt_rateest_lookup(name);
4716     + mutex_unlock(&xt_rateest_mutex);
4717     + return est;
4718     +}
4719     EXPORT_SYMBOL_GPL(xt_rateest_lookup);
4720    
4721     void xt_rateest_put(struct xt_rateest *est)
4722     @@ -100,8 +108,10 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
4723    
4724     net_get_random_once(&jhash_rnd, sizeof(jhash_rnd));
4725    
4726     - est = xt_rateest_lookup(info->name);
4727     + mutex_lock(&xt_rateest_mutex);
4728     + est = __xt_rateest_lookup(info->name);
4729     if (est) {
4730     + mutex_unlock(&xt_rateest_mutex);
4731     /*
4732     * If estimator parameters are specified, they must match the
4733     * existing estimator.
4734     @@ -139,11 +149,13 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
4735    
4736     info->est = est;
4737     xt_rateest_hash_insert(est);
4738     + mutex_unlock(&xt_rateest_mutex);
4739     return 0;
4740    
4741     err2:
4742     kfree(est);
4743     err1:
4744     + mutex_unlock(&xt_rateest_mutex);
4745     return ret;
4746     }
4747    
4748     diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c
4749     index a086a914865f..0eddbd5328af 100644
4750     --- a/net/netfilter/xt_cgroup.c
4751     +++ b/net/netfilter/xt_cgroup.c
4752     @@ -52,6 +52,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par)
4753     return -EINVAL;
4754     }
4755    
4756     + info->priv = NULL;
4757     if (info->has_path) {
4758     cgrp = cgroup_get_from_path(info->path);
4759     if (IS_ERR(cgrp)) {
4760     diff --git a/net/rds/tcp.c b/net/rds/tcp.c
4761     index 78f976d32018..d36effbf7614 100644
4762     --- a/net/rds/tcp.c
4763     +++ b/net/rds/tcp.c
4764     @@ -303,7 +303,8 @@ static void rds_tcp_conn_free(void *arg)
4765     rdsdebug("freeing tc %p\n", tc);
4766    
4767     spin_lock_irqsave(&rds_tcp_conn_lock, flags);
4768     - list_del(&tc->t_tcp_node);
4769     + if (!tc->t_tcp_node_detached)
4770     + list_del(&tc->t_tcp_node);
4771     spin_unlock_irqrestore(&rds_tcp_conn_lock, flags);
4772    
4773     kmem_cache_free(rds_tcp_conn_slab, tc);
4774     @@ -528,8 +529,12 @@ static void rds_tcp_kill_sock(struct net *net)
4775    
4776     if (net != c_net || !tc->t_sock)
4777     continue;
4778     - if (!list_has_conn(&tmp_list, tc->t_cpath->cp_conn))
4779     + if (!list_has_conn(&tmp_list, tc->t_cpath->cp_conn)) {
4780     list_move_tail(&tc->t_tcp_node, &tmp_list);
4781     + } else {
4782     + list_del(&tc->t_tcp_node);
4783     + tc->t_tcp_node_detached = true;
4784     + }
4785     }
4786     spin_unlock_irq(&rds_tcp_conn_lock);
4787     list_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) {
4788     diff --git a/net/rds/tcp.h b/net/rds/tcp.h
4789     index 56ea6620fcf9..800e847d2e00 100644
4790     --- a/net/rds/tcp.h
4791     +++ b/net/rds/tcp.h
4792     @@ -11,6 +11,7 @@ struct rds_tcp_incoming {
4793     struct rds_tcp_connection {
4794    
4795     struct list_head t_tcp_node;
4796     + bool t_tcp_node_detached;
4797     struct rds_conn_path *t_cpath;
4798     /* t_conn_path_lock synchronizes the connection establishment between
4799     * rds_tcp_accept_one and rds_tcp_conn_path_connect
4800     diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
4801     index 3b6d5bd69101..6125c17cffaf 100644
4802     --- a/net/sched/sch_choke.c
4803     +++ b/net/sched/sch_choke.c
4804     @@ -424,6 +424,9 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt)
4805    
4806     ctl = nla_data(tb[TCA_CHOKE_PARMS]);
4807    
4808     + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
4809     + return -EINVAL;
4810     +
4811     if (ctl->limit > CHOKE_MAX_QUEUE)
4812     return -EINVAL;
4813    
4814     diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
4815     index c78a093c551a..44941e25f3ad 100644
4816     --- a/net/sched/sch_gred.c
4817     +++ b/net/sched/sch_gred.c
4818     @@ -356,6 +356,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
4819     struct gred_sched *table = qdisc_priv(sch);
4820     struct gred_sched_data *q = table->tab[dp];
4821    
4822     + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
4823     + return -EINVAL;
4824     +
4825     if (!q) {
4826     table->tab[dp] = q = *prealloc;
4827     *prealloc = NULL;
4828     diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
4829     index 249b2a18acbd..4610d44f58d3 100644
4830     --- a/net/sched/sch_red.c
4831     +++ b/net/sched/sch_red.c
4832     @@ -184,6 +184,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt)
4833     max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0;
4834    
4835     ctl = nla_data(tb[TCA_RED_PARMS]);
4836     + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
4837     + return -EINVAL;
4838    
4839     if (ctl->limit > 0) {
4840     child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit);
4841     diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
4842     index ea8a56f76b32..d8c2b6baaad2 100644
4843     --- a/net/sched/sch_sfq.c
4844     +++ b/net/sched/sch_sfq.c
4845     @@ -633,6 +633,9 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
4846     if (ctl->divisor &&
4847     (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))
4848     return -EINVAL;
4849     + if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max,
4850     + ctl_v1->Wlog))
4851     + return -EINVAL;
4852     if (ctl_v1 && ctl_v1->qth_min) {
4853     p = kmalloc(sizeof(*p), GFP_KERNEL);
4854     if (!p)
4855     diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
4856     index 0994ce491e7c..0188d9e8272d 100644
4857     --- a/net/sctp/outqueue.c
4858     +++ b/net/sctp/outqueue.c
4859     @@ -364,7 +364,8 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc,
4860     asoc->sent_cnt_removable--;
4861     asoc->abandoned_sent[SCTP_PR_INDEX(PRIO)]++;
4862    
4863     - if (!chk->tsn_gap_acked) {
4864     + if (queue != &asoc->outqueue.retransmit &&
4865     + !chk->tsn_gap_acked) {
4866     if (chk->transport)
4867     chk->transport->flight_size -=
4868     sctp_data_size(chk);
4869     @@ -1409,7 +1410,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,
4870     /* If this chunk has not been acked, stop
4871     * considering it as 'outstanding'.
4872     */
4873     - if (!tchunk->tsn_gap_acked) {
4874     + if (transmitted_queue != &q->retransmit &&
4875     + !tchunk->tsn_gap_acked) {
4876     if (tchunk->transport)
4877     tchunk->transport->flight_size -=
4878     sctp_data_size(tchunk);
4879     diff --git a/net/sctp/socket.c b/net/sctp/socket.c
4880     index c472b8391dde..fd5b9d573b38 100644
4881     --- a/net/sctp/socket.c
4882     +++ b/net/sctp/socket.c
4883     @@ -3125,9 +3125,9 @@ static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, unsign
4884     */
4885     static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned int optlen)
4886     {
4887     + struct sctp_sock *sp = sctp_sk(sk);
4888     struct sctp_assoc_value params;
4889     struct sctp_association *asoc;
4890     - struct sctp_sock *sp = sctp_sk(sk);
4891     int val;
4892    
4893     if (optlen == sizeof(int)) {
4894     @@ -3143,26 +3143,35 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
4895     if (copy_from_user(&params, optval, optlen))
4896     return -EFAULT;
4897     val = params.assoc_value;
4898     - } else
4899     + } else {
4900     return -EINVAL;
4901     + }
4902    
4903     - if ((val != 0) && ((val < 8) || (val > SCTP_MAX_CHUNK_LEN)))
4904     - return -EINVAL;
4905     + if (val) {
4906     + int min_len, max_len;
4907    
4908     - asoc = sctp_id2assoc(sk, params.assoc_id);
4909     - if (!asoc && params.assoc_id && sctp_style(sk, UDP))
4910     - return -EINVAL;
4911     + min_len = SCTP_DEFAULT_MINSEGMENT - sp->pf->af->net_header_len;
4912     + min_len -= sizeof(struct sctphdr) +
4913     + sizeof(struct sctp_data_chunk);
4914     +
4915     + max_len = SCTP_MAX_CHUNK_LEN - sizeof(struct sctp_data_chunk);
4916    
4917     + if (val < min_len || val > max_len)
4918     + return -EINVAL;
4919     + }
4920     +
4921     + asoc = sctp_id2assoc(sk, params.assoc_id);
4922     if (asoc) {
4923     if (val == 0) {
4924     - val = asoc->pathmtu;
4925     - val -= sp->pf->af->net_header_len;
4926     + val = asoc->pathmtu - sp->pf->af->net_header_len;
4927     val -= sizeof(struct sctphdr) +
4928     - sizeof(struct sctp_data_chunk);
4929     + sizeof(struct sctp_data_chunk);
4930     }
4931     asoc->user_frag = val;
4932     asoc->frag_point = sctp_frag_point(asoc, asoc->pathmtu);
4933     } else {
4934     + if (params.assoc_id && sctp_style(sk, UDP))
4935     + return -EINVAL;
4936     sp->user_frag = val;
4937     }
4938    
4939     diff --git a/net/wireless/core.c b/net/wireless/core.c
4940     index 8201e6d7449e..ce16da2905dc 100644
4941     --- a/net/wireless/core.c
4942     +++ b/net/wireless/core.c
4943     @@ -421,6 +421,8 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
4944     if (rv)
4945     goto use_default_name;
4946     } else {
4947     + int rv;
4948     +
4949     use_default_name:
4950     /* NOTE: This is *probably* safe w/out holding rtnl because of
4951     * the restrictions on phy names. Probably this call could
4952     @@ -428,7 +430,11 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
4953     * phyX. But, might should add some locking and check return
4954     * value, and use a different name if this one exists?
4955     */
4956     - dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
4957     + rv = dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
4958     + if (rv < 0) {
4959     + kfree(rdev);
4960     + return NULL;
4961     + }
4962     }
4963    
4964     INIT_LIST_HEAD(&rdev->wiphy.wdev_list);
4965     diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
4966     index f19e6a57e118..5e89b7461f99 100644
4967     --- a/net/xfrm/xfrm_policy.c
4968     +++ b/net/xfrm/xfrm_policy.c
4969     @@ -643,7 +643,8 @@ static void xfrm_hash_rebuild(struct work_struct *work)
4970    
4971     /* re-insert all policies by order of creation */
4972     list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) {
4973     - if (xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) {
4974     + if (policy->walk.dead ||
4975     + xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) {
4976     /* skip socket policies */
4977     continue;
4978     }
4979     @@ -1256,9 +1257,15 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir,
4980     again:
4981     pol = rcu_dereference(sk->sk_policy[dir]);
4982     if (pol != NULL) {
4983     - bool match = xfrm_selector_match(&pol->selector, fl, family);
4984     + bool match;
4985     int err = 0;
4986    
4987     + if (pol->family != family) {
4988     + pol = NULL;
4989     + goto out;
4990     + }
4991     +
4992     + match = xfrm_selector_match(&pol->selector, fl, family);
4993     if (match) {
4994     if ((sk->sk_mark & pol->mark.m) != pol->mark.v) {
4995     pol = NULL;
4996     diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
4997     index 22934885bd3f..5d33967d9aa1 100644
4998     --- a/net/xfrm/xfrm_user.c
4999     +++ b/net/xfrm/xfrm_user.c
5000     @@ -1380,11 +1380,14 @@ static void copy_templates(struct xfrm_policy *xp, struct xfrm_user_tmpl *ut,
5001    
5002     static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
5003     {
5004     + u16 prev_family;
5005     int i;
5006    
5007     if (nr > XFRM_MAX_DEPTH)
5008     return -EINVAL;
5009    
5010     + prev_family = family;
5011     +
5012     for (i = 0; i < nr; i++) {
5013     /* We never validated the ut->family value, so many
5014     * applications simply leave it at zero. The check was
5015     @@ -1396,6 +1399,12 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
5016     if (!ut[i].family)
5017     ut[i].family = family;
5018    
5019     + if ((ut[i].mode == XFRM_MODE_TRANSPORT) &&
5020     + (ut[i].family != prev_family))
5021     + return -EINVAL;
5022     +
5023     + prev_family = ut[i].family;
5024     +
5025     switch (ut[i].family) {
5026     case AF_INET:
5027     break;
5028     @@ -1406,6 +1415,21 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
5029     default:
5030     return -EINVAL;
5031     }
5032     +
5033     + switch (ut[i].id.proto) {
5034     + case IPPROTO_AH:
5035     + case IPPROTO_ESP:
5036     + case IPPROTO_COMP:
5037     +#if IS_ENABLED(CONFIG_IPV6)
5038     + case IPPROTO_ROUTING:
5039     + case IPPROTO_DSTOPTS:
5040     +#endif
5041     + case IPSEC_PROTO_ANY:
5042     + break;
5043     + default:
5044     + return -EINVAL;
5045     + }
5046     +
5047     }
5048    
5049     return 0;
5050     diff --git a/scripts/kernel-doc b/scripts/kernel-doc
5051     index 93721f3c91bf..7b163f99624c 100755
5052     --- a/scripts/kernel-doc
5053     +++ b/scripts/kernel-doc
5054     @@ -3139,4 +3139,4 @@ if ($verbose && $warnings) {
5055     print STDERR "$warnings warnings\n";
5056     }
5057    
5058     -exit($errors);
5059     +exit($output_mode eq "none" ? 0 : $errors);
5060     diff --git a/security/keys/Kconfig b/security/keys/Kconfig
5061     index 0832f6368955..f2980084a38f 100644
5062     --- a/security/keys/Kconfig
5063     +++ b/security/keys/Kconfig
5064     @@ -45,6 +45,7 @@ config BIG_KEYS
5065     bool "Large payload keys"
5066     depends on KEYS
5067     depends on TMPFS
5068     + select CRYPTO
5069     select CRYPTO_AES
5070     select CRYPTO_GCM
5071     help
5072     diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
5073     index 082b20c78363..73275a92f2e2 100644
5074     --- a/security/selinux/ss/services.c
5075     +++ b/security/selinux/ss/services.c
5076     @@ -854,6 +854,9 @@ int security_bounded_transition(u32 old_sid, u32 new_sid)
5077     int index;
5078     int rc;
5079    
5080     + if (!ss_initialized)
5081     + return 0;
5082     +
5083     read_lock(&policy_rwlock);
5084    
5085     rc = -EINVAL;
5086     @@ -1400,27 +1403,25 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
5087     if (!scontext_len)
5088     return -EINVAL;
5089    
5090     + /* Copy the string to allow changes and ensure a NUL terminator */
5091     + scontext2 = kmemdup_nul(scontext, scontext_len, gfp_flags);
5092     + if (!scontext2)
5093     + return -ENOMEM;
5094     +
5095     if (!ss_initialized) {
5096     int i;
5097    
5098     for (i = 1; i < SECINITSID_NUM; i++) {
5099     - if (!strcmp(initial_sid_to_string[i], scontext)) {
5100     + if (!strcmp(initial_sid_to_string[i], scontext2)) {
5101     *sid = i;
5102     - return 0;
5103     + goto out;
5104     }
5105     }
5106     *sid = SECINITSID_KERNEL;
5107     - return 0;
5108     + goto out;
5109     }
5110     *sid = SECSID_NULL;
5111    
5112     - /* Copy the string so that we can modify the copy as we parse it. */
5113     - scontext2 = kmalloc(scontext_len + 1, gfp_flags);
5114     - if (!scontext2)
5115     - return -ENOMEM;
5116     - memcpy(scontext2, scontext, scontext_len);
5117     - scontext2[scontext_len] = 0;
5118     -
5119     if (force) {
5120     /* Save another copy for storing in uninterpreted form */
5121     rc = -ENOMEM;
5122     diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
5123     index 11b9b2f17a2e..9ec4dba8a793 100644
5124     --- a/sound/pci/hda/patch_ca0132.c
5125     +++ b/sound/pci/hda/patch_ca0132.c
5126     @@ -1482,6 +1482,9 @@ static int dspio_scp(struct hda_codec *codec,
5127     } else if (ret_size != reply_data_size) {
5128     codec_dbg(codec, "RetLen and HdrLen .NE.\n");
5129     return -EINVAL;
5130     + } else if (!reply) {
5131     + codec_dbg(codec, "NULL reply\n");
5132     + return -EINVAL;
5133     } else {
5134     *reply_len = ret_size*sizeof(unsigned int);
5135     memcpy(reply, scp_reply.data, *reply_len);
5136     diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
5137     index fa8101d1e16f..f387d7bae3d4 100644
5138     --- a/sound/soc/rockchip/rockchip_spdif.c
5139     +++ b/sound/soc/rockchip/rockchip_spdif.c
5140     @@ -318,26 +318,30 @@ static int rk_spdif_probe(struct platform_device *pdev)
5141     spdif->mclk = devm_clk_get(&pdev->dev, "mclk");
5142     if (IS_ERR(spdif->mclk)) {
5143     dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n");
5144     - return PTR_ERR(spdif->mclk);
5145     + ret = PTR_ERR(spdif->mclk);
5146     + goto err_disable_hclk;
5147     }
5148    
5149     ret = clk_prepare_enable(spdif->mclk);
5150     if (ret) {
5151     dev_err(spdif->dev, "clock enable failed %d\n", ret);
5152     - return ret;
5153     + goto err_disable_clocks;
5154     }
5155    
5156     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5157     regs = devm_ioremap_resource(&pdev->dev, res);
5158     - if (IS_ERR(regs))
5159     - return PTR_ERR(regs);
5160     + if (IS_ERR(regs)) {
5161     + ret = PTR_ERR(regs);
5162     + goto err_disable_clocks;
5163     + }
5164    
5165     spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs,
5166     &rk_spdif_regmap_config);
5167     if (IS_ERR(spdif->regmap)) {
5168     dev_err(&pdev->dev,
5169     "Failed to initialise managed register map\n");
5170     - return PTR_ERR(spdif->regmap);
5171     + ret = PTR_ERR(spdif->regmap);
5172     + goto err_disable_clocks;
5173     }
5174    
5175     spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR;
5176     @@ -369,6 +373,10 @@ static int rk_spdif_probe(struct platform_device *pdev)
5177    
5178     err_pm_runtime:
5179     pm_runtime_disable(&pdev->dev);
5180     +err_disable_clocks:
5181     + clk_disable_unprepare(spdif->mclk);
5182     +err_disable_hclk:
5183     + clk_disable_unprepare(spdif->hclk);
5184    
5185     return ret;
5186     }
5187     diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
5188     index ba9fc099cf67..503aef8fcde2 100644
5189     --- a/sound/soc/ux500/mop500.c
5190     +++ b/sound/soc/ux500/mop500.c
5191     @@ -164,3 +164,7 @@ static struct platform_driver snd_soc_mop500_driver = {
5192     };
5193    
5194     module_platform_driver(snd_soc_mop500_driver);
5195     +
5196     +MODULE_LICENSE("GPL v2");
5197     +MODULE_DESCRIPTION("ASoC MOP500 board driver");
5198     +MODULE_AUTHOR("Ola Lilja");
5199     diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
5200     index f12c01dddc8d..d35ba7700f46 100644
5201     --- a/sound/soc/ux500/ux500_pcm.c
5202     +++ b/sound/soc/ux500/ux500_pcm.c
5203     @@ -165,3 +165,8 @@ int ux500_pcm_unregister_platform(struct platform_device *pdev)
5204     return 0;
5205     }
5206     EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform);
5207     +
5208     +MODULE_AUTHOR("Ola Lilja");
5209     +MODULE_AUTHOR("Roger Nilsson");
5210     +MODULE_DESCRIPTION("ASoC UX500 driver");
5211     +MODULE_LICENSE("GPL v2");
5212     diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
5213     index 99c0ccd2f176..e279a71c650d 100644
5214     --- a/tools/build/Makefile.build
5215     +++ b/tools/build/Makefile.build
5216     @@ -19,6 +19,16 @@ else
5217     Q=@
5218     endif
5219    
5220     +ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
5221     +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
5222     + quiet=silent_
5223     +endif
5224     +else # make-3.8x
5225     +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
5226     + quiet=silent_
5227     +endif
5228     +endif
5229     +
5230     build-dir := $(srctree)/tools/build
5231    
5232     # Define $(fixdep) for dep-cmd function
5233     diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
5234     index 9e5a02d6b9a9..23cce5e5197a 100644
5235     --- a/tools/perf/bench/numa.c
5236     +++ b/tools/perf/bench/numa.c
5237     @@ -211,6 +211,47 @@ static const char * const numa_usage[] = {
5238     NULL
5239     };
5240    
5241     +/*
5242     + * To get number of numa nodes present.
5243     + */
5244     +static int nr_numa_nodes(void)
5245     +{
5246     + int i, nr_nodes = 0;
5247     +
5248     + for (i = 0; i < g->p.nr_nodes; i++) {
5249     + if (numa_bitmask_isbitset(numa_nodes_ptr, i))
5250     + nr_nodes++;
5251     + }
5252     +
5253     + return nr_nodes;
5254     +}
5255     +
5256     +/*
5257     + * To check if given numa node is present.
5258     + */
5259     +static int is_node_present(int node)
5260     +{
5261     + return numa_bitmask_isbitset(numa_nodes_ptr, node);
5262     +}
5263     +
5264     +/*
5265     + * To check given numa node has cpus.
5266     + */
5267     +static bool node_has_cpus(int node)
5268     +{
5269     + struct bitmask *cpu = numa_allocate_cpumask();
5270     + unsigned int i;
5271     +
5272     + if (cpu && !numa_node_to_cpus(node, cpu)) {
5273     + for (i = 0; i < cpu->size; i++) {
5274     + if (numa_bitmask_isbitset(cpu, i))
5275     + return true;
5276     + }
5277     + }
5278     +
5279     + return false; /* lets fall back to nocpus safely */
5280     +}
5281     +
5282     static cpu_set_t bind_to_cpu(int target_cpu)
5283     {
5284     cpu_set_t orig_mask, mask;
5285     @@ -239,12 +280,12 @@ static cpu_set_t bind_to_cpu(int target_cpu)
5286    
5287     static cpu_set_t bind_to_node(int target_node)
5288     {
5289     - int cpus_per_node = g->p.nr_cpus/g->p.nr_nodes;
5290     + int cpus_per_node = g->p.nr_cpus / nr_numa_nodes();
5291     cpu_set_t orig_mask, mask;
5292     int cpu;
5293     int ret;
5294    
5295     - BUG_ON(cpus_per_node*g->p.nr_nodes != g->p.nr_cpus);
5296     + BUG_ON(cpus_per_node * nr_numa_nodes() != g->p.nr_cpus);
5297     BUG_ON(!cpus_per_node);
5298    
5299     ret = sched_getaffinity(0, sizeof(orig_mask), &orig_mask);
5300     @@ -644,7 +685,7 @@ static int parse_setup_node_list(void)
5301     int i;
5302    
5303     for (i = 0; i < mul; i++) {
5304     - if (t >= g->p.nr_tasks) {
5305     + if (t >= g->p.nr_tasks || !node_has_cpus(bind_node)) {
5306     printf("\n# NOTE: ignoring bind NODEs starting at NODE#%d\n", bind_node);
5307     goto out;
5308     }
5309     @@ -959,6 +1000,8 @@ static void calc_convergence(double runtime_ns_max, double *convergence)
5310     sum = 0;
5311    
5312     for (node = 0; node < g->p.nr_nodes; node++) {
5313     + if (!is_node_present(node))
5314     + continue;
5315     nr = nodes[node];
5316     nr_min = min(nr, nr_min);
5317     nr_max = max(nr, nr_max);
5318     @@ -979,8 +1022,11 @@ static void calc_convergence(double runtime_ns_max, double *convergence)
5319     process_groups = 0;
5320    
5321     for (node = 0; node < g->p.nr_nodes; node++) {
5322     - int processes = count_node_processes(node);
5323     + int processes;
5324    
5325     + if (!is_node_present(node))
5326     + continue;
5327     + processes = count_node_processes(node);
5328     nr = nodes[node];
5329     tprintf(" %2d/%-2d", nr, processes);
5330    
5331     @@ -1286,7 +1332,7 @@ static void print_summary(void)
5332    
5333     printf("\n ###\n");
5334     printf(" # %d %s will execute (on %d nodes, %d CPUs):\n",
5335     - g->p.nr_tasks, g->p.nr_tasks == 1 ? "task" : "tasks", g->p.nr_nodes, g->p.nr_cpus);
5336     + g->p.nr_tasks, g->p.nr_tasks == 1 ? "task" : "tasks", nr_numa_nodes(), g->p.nr_cpus);
5337     printf(" # %5dx %5ldMB global shared mem operations\n",
5338     g->p.nr_loops, g->p.bytes_global/1024/1024);
5339     printf(" # %5dx %5ldMB process shared mem operations\n",
5340     diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
5341     index 0b613e701736..c61e012e9771 100644
5342     --- a/tools/perf/builtin-top.c
5343     +++ b/tools/perf/builtin-top.c
5344     @@ -73,6 +73,7 @@
5345     #include <linux/types.h>
5346    
5347     static volatile int done;
5348     +static volatile int resize;
5349    
5350     #define HEADER_LINE_NR 5
5351    
5352     @@ -82,10 +83,13 @@ static void perf_top__update_print_entries(struct perf_top *top)
5353     }
5354    
5355     static void perf_top__sig_winch(int sig __maybe_unused,
5356     - siginfo_t *info __maybe_unused, void *arg)
5357     + siginfo_t *info __maybe_unused, void *arg __maybe_unused)
5358     {
5359     - struct perf_top *top = arg;
5360     + resize = 1;
5361     +}
5362    
5363     +static void perf_top__resize(struct perf_top *top)
5364     +{
5365     get_term_dimensions(&top->winsize);
5366     perf_top__update_print_entries(top);
5367     }
5368     @@ -472,7 +476,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
5369     .sa_sigaction = perf_top__sig_winch,
5370     .sa_flags = SA_SIGINFO,
5371     };
5372     - perf_top__sig_winch(SIGWINCH, NULL, top);
5373     + perf_top__resize(top);
5374     sigaction(SIGWINCH, &act, NULL);
5375     } else {
5376     signal(SIGWINCH, SIG_DFL);
5377     @@ -1003,6 +1007,11 @@ static int __cmd_top(struct perf_top *top)
5378    
5379     if (hits == top->samples)
5380     ret = perf_evlist__poll(top->evlist, 100);
5381     +
5382     + if (resize) {
5383     + perf_top__resize(top);
5384     + resize = 0;
5385     + }
5386     }
5387    
5388     ret = 0;
5389     diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
5390     index 8abbef164b4e..19edc1a7a232 100644
5391     --- a/tools/scripts/Makefile.include
5392     +++ b/tools/scripts/Makefile.include
5393     @@ -46,6 +46,16 @@ else
5394     NO_SUBDIR = :
5395     endif
5396    
5397     +ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
5398     +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
5399     + silent=1
5400     +endif
5401     +else # make-3.8x
5402     +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
5403     + silent=1
5404     +endif
5405     +endif
5406     +
5407     #
5408     # Define a callable command for descending to a new directory
5409     #
5410     @@ -58,7 +68,7 @@ descend = \
5411     QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir
5412     QUIET_SUBDIR1 =
5413    
5414     -ifneq ($(findstring $(MAKEFLAGS),s),s)
5415     +ifneq ($(silent),1)
5416     ifneq ($(V),1)
5417     QUIET_CC = @echo ' CC '$@;
5418     QUIET_CC_FPIC = @echo ' CC FPIC '$@;