Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.14/0132-4.14.33-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3238 - (hide annotations) (download)
Fri Nov 9 12:14:58 2018 UTC (5 years, 6 months ago) by niro
File size: 78800 byte(s)
-added up to patches-4.14.79
1 niro 3238 diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
2     index dad3b2ec66d4..aeb6db4e35c3 100644
3     --- a/Documentation/devicetree/bindings/serial/8250.txt
4     +++ b/Documentation/devicetree/bindings/serial/8250.txt
5     @@ -24,6 +24,7 @@ Required properties:
6     - "ti,da830-uart"
7     - "aspeed,ast2400-vuart"
8     - "aspeed,ast2500-vuart"
9     + - "nuvoton,npcm750-uart"
10     - "serial" if the port type is unknown.
11     - reg : offset and length of the register set for the device.
12     - interrupts : should contain uart interrupt.
13     diff --git a/Makefile b/Makefile
14     index c4c681b53ff0..00dd6af8eab4 100644
15     --- a/Makefile
16     +++ b/Makefile
17     @@ -1,7 +1,7 @@
18     # SPDX-License-Identifier: GPL-2.0
19     VERSION = 4
20     PATCHLEVEL = 14
21     -SUBLEVEL = 32
22     +SUBLEVEL = 33
23     EXTRAVERSION =
24     NAME = Petit Gorille
25    
26     diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts
27     index 9fb7426070ce..03c7d77023c6 100644
28     --- a/arch/arm/boot/dts/am335x-pepper.dts
29     +++ b/arch/arm/boot/dts/am335x-pepper.dts
30     @@ -139,7 +139,7 @@
31     &audio_codec {
32     status = "okay";
33    
34     - reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
35     + gpio-reset = <&gpio1 16 GPIO_ACTIVE_LOW>;
36     AVDD-supply = <&ldo3_reg>;
37     IOVDD-supply = <&ldo3_reg>;
38     DRVDD-supply = <&ldo3_reg>;
39     diff --git a/arch/arm/boot/dts/dra76-evm.dts b/arch/arm/boot/dts/dra76-evm.dts
40     index b024a65c6e27..f64aab450315 100644
41     --- a/arch/arm/boot/dts/dra76-evm.dts
42     +++ b/arch/arm/boot/dts/dra76-evm.dts
43     @@ -148,6 +148,7 @@
44     compatible = "ti,tps65917";
45     reg = <0x58>;
46     ti,system-power-controller;
47     + ti,palmas-override-powerhold;
48     interrupt-controller;
49     #interrupt-cells = <2>;
50    
51     diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
52     index c66ee8432a85..4acd32a1c4ef 100644
53     --- a/arch/arm/boot/dts/omap3-n900.dts
54     +++ b/arch/arm/boot/dts/omap3-n900.dts
55     @@ -558,7 +558,7 @@
56     tlv320aic3x: tlv320aic3x@18 {
57     compatible = "ti,tlv320aic3x";
58     reg = <0x18>;
59     - reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */
60     + gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */
61     ai3x-gpio-func = <
62     0 /* AIC3X_GPIO1_FUNC_DISABLED */
63     5 /* AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT */
64     @@ -575,7 +575,7 @@
65     tlv320aic3x_aux: tlv320aic3x@19 {
66     compatible = "ti,tlv320aic3x";
67     reg = <0x19>;
68     - reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */
69     + gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */
70    
71     AVDD-supply = <&vmmc2>;
72     DRVDD-supply = <&vmmc2>;
73     diff --git a/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts b/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts
74     index 51e6f1d21c32..b2758dd8ce43 100644
75     --- a/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts
76     +++ b/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts
77     @@ -42,7 +42,6 @@
78    
79     /dts-v1/;
80     #include "sun6i-a31s.dtsi"
81     -#include "sunxi-common-regulators.dtsi"
82     #include <dt-bindings/gpio/gpio.h>
83    
84     / {
85     @@ -99,6 +98,7 @@
86     pinctrl-0 = <&gmac_pins_rgmii_a>, <&gmac_phy_reset_pin_bpi_m2>;
87     phy = <&phy1>;
88     phy-mode = "rgmii";
89     + phy-supply = <&reg_dldo1>;
90     snps,reset-gpio = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
91     snps,reset-active-low;
92     snps,reset-delays-us = <0 10000 30000>;
93     @@ -118,7 +118,7 @@
94     &mmc0 {
95     pinctrl-names = "default";
96     pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bpi_m2>;
97     - vmmc-supply = <&reg_vcc3v0>;
98     + vmmc-supply = <&reg_dcdc1>;
99     bus-width = <4>;
100     cd-gpios = <&pio 0 4 GPIO_ACTIVE_HIGH>; /* PA4 */
101     cd-inverted;
102     @@ -132,7 +132,7 @@
103     &mmc2 {
104     pinctrl-names = "default";
105     pinctrl-0 = <&mmc2_pins_a>;
106     - vmmc-supply = <&reg_vcc3v0>;
107     + vmmc-supply = <&reg_aldo1>;
108     mmc-pwrseq = <&mmc2_pwrseq>;
109     bus-width = <4>;
110     non-removable;
111     @@ -163,6 +163,8 @@
112     reg = <0x68>;
113     interrupt-parent = <&nmi_intc>;
114     interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
115     + eldoin-supply = <&reg_dcdc1>;
116     + x-powers,drive-vbus-en;
117     };
118     };
119    
120     @@ -193,7 +195,28 @@
121    
122     #include "axp22x.dtsi"
123    
124     +&reg_aldo1 {
125     + regulator-min-microvolt = <3300000>;
126     + regulator-max-microvolt = <3300000>;
127     + regulator-name = "vcc-wifi";
128     +};
129     +
130     +&reg_aldo2 {
131     + regulator-always-on;
132     + regulator-min-microvolt = <2500000>;
133     + regulator-max-microvolt = <2500000>;
134     + regulator-name = "vcc-gmac";
135     +};
136     +
137     +&reg_aldo3 {
138     + regulator-always-on;
139     + regulator-min-microvolt = <3000000>;
140     + regulator-max-microvolt = <3000000>;
141     + regulator-name = "avcc";
142     +};
143     +
144     &reg_dc5ldo {
145     + regulator-always-on;
146     regulator-min-microvolt = <700000>;
147     regulator-max-microvolt = <1320000>;
148     regulator-name = "vdd-cpus";
149     @@ -233,6 +256,40 @@
150     regulator-name = "vcc-dram";
151     };
152    
153     +&reg_dldo1 {
154     + regulator-min-microvolt = <3000000>;
155     + regulator-max-microvolt = <3000000>;
156     + regulator-name = "vcc-mac";
157     +};
158     +
159     +&reg_dldo2 {
160     + regulator-min-microvolt = <2800000>;
161     + regulator-max-microvolt = <2800000>;
162     + regulator-name = "avdd-csi";
163     +};
164     +
165     +&reg_dldo3 {
166     + regulator-always-on;
167     + regulator-min-microvolt = <3300000>;
168     + regulator-max-microvolt = <3300000>;
169     + regulator-name = "vcc-pb";
170     +};
171     +
172     +&reg_eldo1 {
173     + regulator-min-microvolt = <1800000>;
174     + regulator-max-microvolt = <1800000>;
175     + regulator-name = "vdd-csi";
176     + status = "okay";
177     +};
178     +
179     +&reg_ldo_io1 {
180     + regulator-always-on;
181     + regulator-min-microvolt = <1800000>;
182     + regulator-max-microvolt = <1800000>;
183     + regulator-name = "vcc-pm-cpus";
184     + status = "okay";
185     +};
186     +
187     &uart0 {
188     pinctrl-names = "default";
189     pinctrl-0 = <&uart0_pins_a>;
190     diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
191     index 30ef8e291271..c9919c2b7ad1 100644
192     --- a/arch/arm/crypto/Makefile
193     +++ b/arch/arm/crypto/Makefile
194     @@ -54,6 +54,7 @@ crct10dif-arm-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o
195     crc32-arm-ce-y:= crc32-ce-core.o crc32-ce-glue.o
196     chacha20-neon-y := chacha20-neon-core.o chacha20-neon-glue.o
197    
198     +ifdef REGENERATE_ARM_CRYPTO
199     quiet_cmd_perl = PERL $@
200     cmd_perl = $(PERL) $(<) > $(@)
201    
202     @@ -62,5 +63,6 @@ $(src)/sha256-core.S_shipped: $(src)/sha256-armv4.pl
203    
204     $(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl
205     $(call cmd,perl)
206     +endif
207    
208     .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S
209     diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h
210     index fb061cf0d736..30a07730807a 100644
211     --- a/arch/arm/plat-omap/include/plat/sram.h
212     +++ b/arch/arm/plat-omap/include/plat/sram.h
213     @@ -5,13 +5,4 @@ void omap_map_sram(unsigned long start, unsigned long size,
214     unsigned long skip, int cached);
215     void omap_sram_reset(void);
216    
217     -extern void *omap_sram_push_address(unsigned long size);
218     -
219     -/* Macro to push a function to the internal SRAM, using the fncpy API */
220     -#define omap_sram_push(funcp, size) ({ \
221     - typeof(&(funcp)) _res = NULL; \
222     - void *_sram_address = omap_sram_push_address(size); \
223     - if (_sram_address) \
224     - _res = fncpy(_sram_address, &(funcp), size); \
225     - _res; \
226     -})
227     +extern void *omap_sram_push(void *funcp, unsigned long size);
228     diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
229     index a5bc92d7e476..921840acf65c 100644
230     --- a/arch/arm/plat-omap/sram.c
231     +++ b/arch/arm/plat-omap/sram.c
232     @@ -23,6 +23,7 @@
233     #include <asm/fncpy.h>
234     #include <asm/tlb.h>
235     #include <asm/cacheflush.h>
236     +#include <asm/set_memory.h>
237    
238     #include <asm/mach/map.h>
239    
240     @@ -42,7 +43,7 @@ static void __iomem *omap_sram_ceil;
241     * Note that fncpy requires the returned address to be aligned
242     * to an 8-byte boundary.
243     */
244     -void *omap_sram_push_address(unsigned long size)
245     +static void *omap_sram_push_address(unsigned long size)
246     {
247     unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
248    
249     @@ -60,6 +61,30 @@ void *omap_sram_push_address(unsigned long size)
250     return (void *)omap_sram_ceil;
251     }
252    
253     +void *omap_sram_push(void *funcp, unsigned long size)
254     +{
255     + void *sram;
256     + unsigned long base;
257     + int pages;
258     + void *dst = NULL;
259     +
260     + sram = omap_sram_push_address(size);
261     + if (!sram)
262     + return NULL;
263     +
264     + base = (unsigned long)sram & PAGE_MASK;
265     + pages = PAGE_ALIGN(size) / PAGE_SIZE;
266     +
267     + set_memory_rw(base, pages);
268     +
269     + dst = fncpy(sram, funcp, size);
270     +
271     + set_memory_ro(base, pages);
272     + set_memory_x(base, pages);
273     +
274     + return dst;
275     +}
276     +
277     /*
278     * The SRAM context is lost during off-idle and stack
279     * needs to be reset.
280     @@ -75,6 +100,9 @@ void omap_sram_reset(void)
281     void __init omap_map_sram(unsigned long start, unsigned long size,
282     unsigned long skip, int cached)
283     {
284     + unsigned long base;
285     + int pages;
286     +
287     if (size == 0)
288     return;
289    
290     @@ -95,4 +123,10 @@ void __init omap_map_sram(unsigned long start, unsigned long size,
291     */
292     memset_io(omap_sram_base + omap_sram_skip, 0,
293     omap_sram_size - omap_sram_skip);
294     +
295     + base = (unsigned long)omap_sram_base;
296     + pages = PAGE_ALIGN(omap_sram_size) / PAGE_SIZE;
297     +
298     + set_memory_ro(base, pages);
299     + set_memory_x(base, pages);
300     }
301     diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
302     index a71a48e71fff..aa7496be311d 100644
303     --- a/arch/arm/vfp/vfpmodule.c
304     +++ b/arch/arm/vfp/vfpmodule.c
305     @@ -648,7 +648,7 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
306     */
307     static int vfp_dying_cpu(unsigned int cpu)
308     {
309     - vfp_force_reload(cpu, current_thread_info());
310     + vfp_current_hw_state[cpu] = NULL;
311     return 0;
312     }
313    
314     diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile
315     index b5edc5918c28..12fd81af1d1c 100644
316     --- a/arch/arm64/crypto/Makefile
317     +++ b/arch/arm64/crypto/Makefile
318     @@ -58,6 +58,7 @@ CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS
319     $(obj)/aes-glue-%.o: $(src)/aes-glue.c FORCE
320     $(call if_changed_rule,cc_o_c)
321    
322     +ifdef REGENERATE_ARM64_CRYPTO
323     quiet_cmd_perlasm = PERLASM $@
324     cmd_perlasm = $(PERL) $(<) void $(@)
325    
326     @@ -66,5 +67,6 @@ $(src)/sha256-core.S_shipped: $(src)/sha512-armv8.pl
327    
328     $(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl
329     $(call cmd,perlasm)
330     +endif
331    
332     .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S
333     diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
334     index e91b40aa5417..f9ca4bb3d48e 100644
335     --- a/arch/powerpc/kernel/exceptions-64s.S
336     +++ b/arch/powerpc/kernel/exceptions-64s.S
337     @@ -704,7 +704,7 @@ EXC_COMMON_BEGIN(bad_addr_slb)
338     ld r3, PACA_EXSLB+EX_DAR(r13)
339     std r3, _DAR(r1)
340     beq cr6, 2f
341     - li r10, 0x480 /* fix trap number for I-SLB miss */
342     + li r10, 0x481 /* fix trap number for I-SLB miss */
343     std r10, _TRAP(r1)
344     2: bl save_nvgprs
345     addi r3, r1, STACK_FRAME_OVERHEAD
346     diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
347     index 4e65bf82f5e0..0ce8b0e5d7ba 100644
348     --- a/arch/powerpc/kernel/irq.c
349     +++ b/arch/powerpc/kernel/irq.c
350     @@ -430,6 +430,14 @@ void force_external_irq_replay(void)
351     */
352     WARN_ON(!arch_irqs_disabled());
353    
354     + /*
355     + * Interrupts must always be hard disabled before irq_happened is
356     + * modified (to prevent lost update in case of interrupt between
357     + * load and store).
358     + */
359     + __hard_irq_disable();
360     + local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
361     +
362     /* Indicate in the PACA that we have an interrupt to replay */
363     local_paca->irq_happened |= PACA_IRQ_EE;
364     }
365     diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
366     index dbea6020ffe7..575292a33bdf 100644
367     --- a/arch/x86/crypto/cast5_avx_glue.c
368     +++ b/arch/x86/crypto/cast5_avx_glue.c
369     @@ -66,8 +66,6 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
370     void (*fn)(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
371     int err;
372    
373     - fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way;
374     -
375     err = blkcipher_walk_virt(desc, walk);
376     desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
377    
378     @@ -79,6 +77,7 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
379    
380     /* Process multi-block batch */
381     if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) {
382     + fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way;
383     do {
384     fn(ctx, wdst, wsrc);
385    
386     diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
387     index 8ec99a55e6b9..bf253ad93bbc 100644
388     --- a/arch/x86/include/asm/hw_irq.h
389     +++ b/arch/x86/include/asm/hw_irq.h
390     @@ -34,6 +34,7 @@ extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
391     extern asmlinkage void kvm_posted_intr_nested_ipi(void);
392     extern asmlinkage void error_interrupt(void);
393     extern asmlinkage void irq_work_interrupt(void);
394     +extern asmlinkage void uv_bau_message_intr1(void);
395    
396     extern asmlinkage void spurious_interrupt(void);
397     extern asmlinkage void thermal_interrupt(void);
398     diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
399     index a59624080015..0c5256653d6c 100644
400     --- a/arch/x86/kernel/idt.c
401     +++ b/arch/x86/kernel/idt.c
402     @@ -140,6 +140,9 @@ static const __initconst struct idt_data apic_idts[] = {
403     # ifdef CONFIG_IRQ_WORK
404     INTG(IRQ_WORK_VECTOR, irq_work_interrupt),
405     # endif
406     +#ifdef CONFIG_X86_UV
407     + INTG(UV_BAU_MESSAGE, uv_bau_message_intr1),
408     +#endif
409     INTG(SPURIOUS_APIC_VECTOR, spurious_interrupt),
410     INTG(ERROR_APIC_VECTOR, error_interrupt),
411     #endif
412     diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
413     index 7d5d53f36a7a..0b530c53de1f 100644
414     --- a/arch/x86/platform/uv/tlb_uv.c
415     +++ b/arch/x86/platform/uv/tlb_uv.c
416     @@ -2254,8 +2254,6 @@ static int __init uv_bau_init(void)
417     init_uvhub(uvhub, vector, uv_base_pnode);
418     }
419    
420     - alloc_intr_gate(vector, uv_bau_message_intr1);
421     -
422     for_each_possible_blade(uvhub) {
423     if (uv_blade_nr_possible_cpus(uvhub)) {
424     unsigned long val;
425     diff --git a/block/bio.c b/block/bio.c
426     index 7f978eac9a7a..dbaa82c967f4 100644
427     --- a/block/bio.c
428     +++ b/block/bio.c
429     @@ -43,9 +43,9 @@
430     * break badly! cannot be bigger than what you can fit into an
431     * unsigned short
432     */
433     -#define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) }
434     +#define BV(x, n) { .nr_vecs = x, .name = "biovec-"#n }
435     static struct biovec_slab bvec_slabs[BVEC_POOL_NR] __read_mostly = {
436     - BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES),
437     + BV(1, 1), BV(4, 4), BV(16, 16), BV(64, 64), BV(128, 128), BV(BIO_MAX_PAGES, max),
438     };
439     #undef BV
440    
441     diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c
442     index 0af3a3db6fb0..82c44f7df911 100644
443     --- a/block/partitions/msdos.c
444     +++ b/block/partitions/msdos.c
445     @@ -301,7 +301,9 @@ static void parse_bsd(struct parsed_partitions *state,
446     continue;
447     bsd_start = le32_to_cpu(p->p_offset);
448     bsd_size = le32_to_cpu(p->p_size);
449     - if (memcmp(flavour, "bsd\0", 4) == 0)
450     + /* FreeBSD has relative offset if C partition offset is zero */
451     + if (memcmp(flavour, "bsd\0", 4) == 0 &&
452     + le32_to_cpu(l->d_partitions[2].p_offset) == 0)
453     bsd_start += offset;
454     if (offset == bsd_start && size == bsd_size)
455     /* full parent partition, we have it already */
456     diff --git a/crypto/ahash.c b/crypto/ahash.c
457     index f75b5c1f7152..3980e9e45289 100644
458     --- a/crypto/ahash.c
459     +++ b/crypto/ahash.c
460     @@ -92,13 +92,14 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
461    
462     if (nbytes && walk->offset & alignmask && !err) {
463     walk->offset = ALIGN(walk->offset, alignmask + 1);
464     - walk->data += walk->offset;
465     -
466     nbytes = min(nbytes,
467     ((unsigned int)(PAGE_SIZE)) - walk->offset);
468     walk->entrylen -= nbytes;
469    
470     - return nbytes;
471     + if (nbytes) {
472     + walk->data += walk->offset;
473     + return nbytes;
474     + }
475     }
476    
477     if (walk->flags & CRYPTO_ALG_ASYNC)
478     diff --git a/crypto/lrw.c b/crypto/lrw.c
479     index eb681e9fe574..fdba6dd6db63 100644
480     --- a/crypto/lrw.c
481     +++ b/crypto/lrw.c
482     @@ -313,7 +313,7 @@ static void exit_crypt(struct skcipher_request *req)
483     rctx->left = 0;
484    
485     if (rctx->ext)
486     - kfree(rctx->ext);
487     + kzfree(rctx->ext);
488     }
489    
490     static int do_encrypt(struct skcipher_request *req, int err)
491     diff --git a/crypto/testmgr.h b/crypto/testmgr.h
492     index d54971d2d1c8..fbc0fab5e79e 100644
493     --- a/crypto/testmgr.h
494     +++ b/crypto/testmgr.h
495     @@ -548,7 +548,7 @@ static const struct akcipher_testvec rsa_tv_template[] = {
496     static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = {
497     {
498     .key =
499     - "\x30\x82\x03\x1f\x02\x01\x10\x02\x82\x01\x01\x00\xd7\x1e\x77\x82"
500     + "\x30\x82\x03\x1f\x02\x01\x00\x02\x82\x01\x01\x00\xd7\x1e\x77\x82"
501     "\x8c\x92\x31\xe7\x69\x02\xa2\xd5\x5c\x78\xde\xa2\x0c\x8f\xfe\x28"
502     "\x59\x31\xdf\x40\x9c\x60\x61\x06\xb9\x2f\x62\x40\x80\x76\xcb\x67"
503     "\x4a\xb5\x59\x56\x69\x17\x07\xfa\xf9\x4c\xbd\x6c\x37\x7a\x46\x7d"
504     @@ -597,8 +597,8 @@ static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = {
505     "\xfe\xf8\x27\x1b\xd6\x55\x60\x5e\x48\xb7\x6d\x9a\xa8\x37\xf9\x7a"
506     "\xde\x1b\xcd\x5d\x1a\x30\xd4\xe9\x9e\x5b\x3c\x15\xf8\x9c\x1f\xda"
507     "\xd1\x86\x48\x55\xce\x83\xee\x8e\x51\xc7\xde\x32\x12\x47\x7d\x46"
508     - "\xb8\x35\xdf\x41\x02\x01\x30\x02\x01\x30\x02\x01\x30\x02\x01\x30"
509     - "\x02\x01\x30",
510     + "\xb8\x35\xdf\x41\x02\x01\x00\x02\x01\x00\x02\x01\x00\x02\x01\x00"
511     + "\x02\x01\x00",
512     .key_len = 804,
513     /*
514     * m is SHA256 hash of following message:
515     diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
516     index 6df7d6676a48..41be9ff7d70a 100644
517     --- a/drivers/base/arch_topology.c
518     +++ b/drivers/base/arch_topology.c
519     @@ -166,11 +166,11 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
520     }
521    
522     #ifdef CONFIG_CPU_FREQ
523     -static cpumask_var_t cpus_to_visit __initdata;
524     -static void __init parsing_done_workfn(struct work_struct *work);
525     -static __initdata DECLARE_WORK(parsing_done_work, parsing_done_workfn);
526     +static cpumask_var_t cpus_to_visit;
527     +static void parsing_done_workfn(struct work_struct *work);
528     +static DECLARE_WORK(parsing_done_work, parsing_done_workfn);
529    
530     -static int __init
531     +static int
532     init_cpu_capacity_callback(struct notifier_block *nb,
533     unsigned long val,
534     void *data)
535     @@ -206,7 +206,7 @@ init_cpu_capacity_callback(struct notifier_block *nb,
536     return 0;
537     }
538    
539     -static struct notifier_block init_cpu_capacity_notifier __initdata = {
540     +static struct notifier_block init_cpu_capacity_notifier = {
541     .notifier_call = init_cpu_capacity_callback,
542     };
543    
544     @@ -232,7 +232,7 @@ static int __init register_cpufreq_notifier(void)
545     }
546     core_initcall(register_cpufreq_notifier);
547    
548     -static void __init parsing_done_workfn(struct work_struct *work)
549     +static void parsing_done_workfn(struct work_struct *work)
550     {
551     cpufreq_unregister_notifier(&init_cpu_capacity_notifier,
552     CPUFREQ_POLICY_NOTIFIER);
553     diff --git a/drivers/char/mem.c b/drivers/char/mem.c
554     index 3a70dba2c645..f11224a5dc5c 100644
555     --- a/drivers/char/mem.c
556     +++ b/drivers/char/mem.c
557     @@ -137,7 +137,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
558    
559     while (count > 0) {
560     unsigned long remaining;
561     - int allowed;
562     + int allowed, probe;
563    
564     sz = size_inside_page(p, count);
565    
566     @@ -160,9 +160,9 @@ static ssize_t read_mem(struct file *file, char __user *buf,
567     if (!ptr)
568     goto failed;
569    
570     - err = probe_kernel_read(bounce, ptr, sz);
571     + probe = probe_kernel_read(bounce, ptr, sz);
572     unxlate_dev_mem_ptr(p, ptr);
573     - if (err)
574     + if (probe)
575     goto failed;
576    
577     remaining = copy_to_user(buf, bounce, sz);
578     diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
579     index bb1e148ebfd4..ea43b147a7fe 100644
580     --- a/drivers/cpufreq/cpufreq.c
581     +++ b/drivers/cpufreq/cpufreq.c
582     @@ -631,8 +631,6 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
583     *governor = t;
584     err = 0;
585     }
586     - if (t && !try_module_get(t->owner))
587     - t = NULL;
588    
589     mutex_unlock(&cpufreq_governor_mutex);
590     }
591     @@ -761,10 +759,6 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
592     return -EINVAL;
593    
594     ret = cpufreq_set_policy(policy, &new_policy);
595     -
596     - if (new_policy.governor)
597     - module_put(new_policy.governor->owner);
598     -
599     return ret ? ret : count;
600     }
601    
602     diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
603     index e1d4ae1153c4..39f70411f28f 100644
604     --- a/drivers/crypto/caam/ctrl.c
605     +++ b/drivers/crypto/caam/ctrl.c
606     @@ -813,9 +813,6 @@ static int caam_probe(struct platform_device *pdev)
607     return 0;
608    
609     caam_remove:
610     -#ifdef CONFIG_DEBUG_FS
611     - debugfs_remove_recursive(ctrlpriv->dfs_root);
612     -#endif
613     caam_remove(pdev);
614     return ret;
615    
616     diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c
617     index e6db8672d89c..05850dfd7940 100644
618     --- a/drivers/crypto/ccp/ccp-crypto-rsa.c
619     +++ b/drivers/crypto/ccp/ccp-crypto-rsa.c
620     @@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret)
621    
622     static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm)
623     {
624     - if (ccp_version() > CCP_VERSION(3, 0))
625     - return CCP5_RSA_MAXMOD;
626     - else
627     - return CCP_RSA_MAXMOD;
628     + struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm);
629     +
630     + return ctx->u.rsa.n_len;
631     }
632    
633     static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt)
634     diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
635     index 4bcef78a08aa..d4c81cb73bee 100644
636     --- a/drivers/crypto/inside-secure/safexcel.c
637     +++ b/drivers/crypto/inside-secure/safexcel.c
638     @@ -789,7 +789,7 @@ static int safexcel_probe(struct platform_device *pdev)
639     return PTR_ERR(priv->base);
640     }
641    
642     - priv->clk = of_clk_get(dev->of_node, 0);
643     + priv->clk = devm_clk_get(&pdev->dev, NULL);
644     if (!IS_ERR(priv->clk)) {
645     ret = clk_prepare_enable(priv->clk);
646     if (ret) {
647     diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
648     index d4a6e9c2e9aa..124f9b1cf1b0 100644
649     --- a/drivers/i2c/busses/i2c-stm32f7.c
650     +++ b/drivers/i2c/busses/i2c-stm32f7.c
651     @@ -887,6 +887,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
652     }
653    
654     setup = of_device_get_match_data(&pdev->dev);
655     + if (!setup) {
656     + dev_err(&pdev->dev, "Can't get device data\n");
657     + ret = -ENODEV;
658     + goto clk_free;
659     + }
660     i2c_dev->setup = *setup;
661    
662     ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
663     diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
664     index d2f74721b3ba..40475ebf3a61 100644
665     --- a/drivers/infiniband/core/addr.c
666     +++ b/drivers/infiniband/core/addr.c
667     @@ -207,6 +207,22 @@ int rdma_addr_size(struct sockaddr *addr)
668     }
669     EXPORT_SYMBOL(rdma_addr_size);
670    
671     +int rdma_addr_size_in6(struct sockaddr_in6 *addr)
672     +{
673     + int ret = rdma_addr_size((struct sockaddr *) addr);
674     +
675     + return ret <= sizeof(*addr) ? ret : 0;
676     +}
677     +EXPORT_SYMBOL(rdma_addr_size_in6);
678     +
679     +int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr)
680     +{
681     + int ret = rdma_addr_size((struct sockaddr *) addr);
682     +
683     + return ret <= sizeof(*addr) ? ret : 0;
684     +}
685     +EXPORT_SYMBOL(rdma_addr_size_kss);
686     +
687     static struct rdma_addr_client self;
688    
689     void rdma_addr_register_client(struct rdma_addr_client *client)
690     @@ -597,6 +613,15 @@ static void process_one_req(struct work_struct *_work)
691     list_del(&req->list);
692     mutex_unlock(&lock);
693    
694     + /*
695     + * Although the work will normally have been canceled by the
696     + * workqueue, it can still be requeued as long as it is on the
697     + * req_list, so it could have been requeued before we grabbed &lock.
698     + * We need to cancel it after it is removed from req_list to really be
699     + * sure it is safe to free.
700     + */
701     + cancel_delayed_work(&req->work);
702     +
703     req->callback(req->status, (struct sockaddr *)&req->src_addr,
704     req->addr, req->context);
705     put_client(req->client);
706     diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
707     index 77ca9da570a2..722235bed075 100644
708     --- a/drivers/infiniband/core/ucma.c
709     +++ b/drivers/infiniband/core/ucma.c
710     @@ -132,7 +132,7 @@ static inline struct ucma_context *_ucma_find_context(int id,
711     ctx = idr_find(&ctx_idr, id);
712     if (!ctx)
713     ctx = ERR_PTR(-ENOENT);
714     - else if (ctx->file != file)
715     + else if (ctx->file != file || !ctx->cm_id)
716     ctx = ERR_PTR(-EINVAL);
717     return ctx;
718     }
719     @@ -456,6 +456,7 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf,
720     struct rdma_ucm_create_id cmd;
721     struct rdma_ucm_create_id_resp resp;
722     struct ucma_context *ctx;
723     + struct rdma_cm_id *cm_id;
724     enum ib_qp_type qp_type;
725     int ret;
726    
727     @@ -476,10 +477,10 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf,
728     return -ENOMEM;
729    
730     ctx->uid = cmd.uid;
731     - ctx->cm_id = rdma_create_id(current->nsproxy->net_ns,
732     - ucma_event_handler, ctx, cmd.ps, qp_type);
733     - if (IS_ERR(ctx->cm_id)) {
734     - ret = PTR_ERR(ctx->cm_id);
735     + cm_id = rdma_create_id(current->nsproxy->net_ns,
736     + ucma_event_handler, ctx, cmd.ps, qp_type);
737     + if (IS_ERR(cm_id)) {
738     + ret = PTR_ERR(cm_id);
739     goto err1;
740     }
741    
742     @@ -489,14 +490,19 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf,
743     ret = -EFAULT;
744     goto err2;
745     }
746     +
747     + ctx->cm_id = cm_id;
748     return 0;
749    
750     err2:
751     - rdma_destroy_id(ctx->cm_id);
752     + rdma_destroy_id(cm_id);
753     err1:
754     mutex_lock(&mut);
755     idr_remove(&ctx_idr, ctx->id);
756     mutex_unlock(&mut);
757     + mutex_lock(&file->mut);
758     + list_del(&ctx->list);
759     + mutex_unlock(&file->mut);
760     kfree(ctx);
761     return ret;
762     }
763     @@ -626,6 +632,9 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf,
764     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
765     return -EFAULT;
766    
767     + if (!rdma_addr_size_in6(&cmd.addr))
768     + return -EINVAL;
769     +
770     ctx = ucma_get_ctx(file, cmd.id);
771     if (IS_ERR(ctx))
772     return PTR_ERR(ctx);
773     @@ -639,22 +648,21 @@ static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf,
774     int in_len, int out_len)
775     {
776     struct rdma_ucm_bind cmd;
777     - struct sockaddr *addr;
778     struct ucma_context *ctx;
779     int ret;
780    
781     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
782     return -EFAULT;
783    
784     - addr = (struct sockaddr *) &cmd.addr;
785     - if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr)))
786     + if (cmd.reserved || !cmd.addr_size ||
787     + cmd.addr_size != rdma_addr_size_kss(&cmd.addr))
788     return -EINVAL;
789    
790     ctx = ucma_get_ctx(file, cmd.id);
791     if (IS_ERR(ctx))
792     return PTR_ERR(ctx);
793    
794     - ret = rdma_bind_addr(ctx->cm_id, addr);
795     + ret = rdma_bind_addr(ctx->cm_id, (struct sockaddr *) &cmd.addr);
796     ucma_put_ctx(ctx);
797     return ret;
798     }
799     @@ -670,13 +678,16 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file,
800     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
801     return -EFAULT;
802    
803     + if (!rdma_addr_size_in6(&cmd.src_addr) ||
804     + !rdma_addr_size_in6(&cmd.dst_addr))
805     + return -EINVAL;
806     +
807     ctx = ucma_get_ctx(file, cmd.id);
808     if (IS_ERR(ctx))
809     return PTR_ERR(ctx);
810    
811     ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr,
812     - (struct sockaddr *) &cmd.dst_addr,
813     - cmd.timeout_ms);
814     + (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms);
815     ucma_put_ctx(ctx);
816     return ret;
817     }
818     @@ -686,24 +697,23 @@ static ssize_t ucma_resolve_addr(struct ucma_file *file,
819     int in_len, int out_len)
820     {
821     struct rdma_ucm_resolve_addr cmd;
822     - struct sockaddr *src, *dst;
823     struct ucma_context *ctx;
824     int ret;
825    
826     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
827     return -EFAULT;
828    
829     - src = (struct sockaddr *) &cmd.src_addr;
830     - dst = (struct sockaddr *) &cmd.dst_addr;
831     - if (cmd.reserved || (cmd.src_size && (cmd.src_size != rdma_addr_size(src))) ||
832     - !cmd.dst_size || (cmd.dst_size != rdma_addr_size(dst)))
833     + if (cmd.reserved ||
834     + (cmd.src_size && (cmd.src_size != rdma_addr_size_kss(&cmd.src_addr))) ||
835     + !cmd.dst_size || (cmd.dst_size != rdma_addr_size_kss(&cmd.dst_addr)))
836     return -EINVAL;
837    
838     ctx = ucma_get_ctx(file, cmd.id);
839     if (IS_ERR(ctx))
840     return PTR_ERR(ctx);
841    
842     - ret = rdma_resolve_addr(ctx->cm_id, src, dst, cmd.timeout_ms);
843     + ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr,
844     + (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms);
845     ucma_put_ctx(ctx);
846     return ret;
847     }
848     @@ -1155,6 +1165,11 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
849     if (IS_ERR(ctx))
850     return PTR_ERR(ctx);
851    
852     + if (!ctx->cm_id->device) {
853     + ret = -EINVAL;
854     + goto out;
855     + }
856     +
857     resp.qp_attr_mask = 0;
858     memset(&qp_attr, 0, sizeof qp_attr);
859     qp_attr.qp_state = cmd.qp_state;
860     @@ -1320,7 +1335,7 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf,
861     {
862     struct rdma_ucm_notify cmd;
863     struct ucma_context *ctx;
864     - int ret;
865     + int ret = -EINVAL;
866    
867     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
868     return -EFAULT;
869     @@ -1329,7 +1344,9 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf,
870     if (IS_ERR(ctx))
871     return PTR_ERR(ctx);
872    
873     - ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event);
874     + if (ctx->cm_id->device)
875     + ret = rdma_notify(ctx->cm_id, (enum ib_event_type)cmd.event);
876     +
877     ucma_put_ctx(ctx);
878     return ret;
879     }
880     @@ -1415,7 +1432,7 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file,
881     join_cmd.response = cmd.response;
882     join_cmd.uid = cmd.uid;
883     join_cmd.id = cmd.id;
884     - join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr);
885     + join_cmd.addr_size = rdma_addr_size_in6(&cmd.addr);
886     if (!join_cmd.addr_size)
887     return -EINVAL;
888    
889     @@ -1434,7 +1451,7 @@ static ssize_t ucma_join_multicast(struct ucma_file *file,
890     if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
891     return -EFAULT;
892    
893     - if (!rdma_addr_size((struct sockaddr *)&cmd.addr))
894     + if (!rdma_addr_size_kss(&cmd.addr))
895     return -EINVAL;
896    
897     return ucma_process_join(file, &cmd, out_len);
898     diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
899     index 3d9c294e84db..9a234da8cac2 100644
900     --- a/drivers/input/mouse/alps.c
901     +++ b/drivers/input/mouse/alps.c
902     @@ -2544,13 +2544,31 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4],
903     }
904    
905     static int alps_update_dual_info_ss4_v2(unsigned char otp[][4],
906     - struct alps_data *priv)
907     + struct alps_data *priv,
908     + struct psmouse *psmouse)
909     {
910     bool is_dual = false;
911     + int reg_val = 0;
912     + struct ps2dev *ps2dev = &psmouse->ps2dev;
913    
914     - if (IS_SS4PLUS_DEV(priv->dev_id))
915     + if (IS_SS4PLUS_DEV(priv->dev_id)) {
916     is_dual = (otp[0][0] >> 4) & 0x01;
917    
918     + if (!is_dual) {
919     + /* For support TrackStick of Thinkpad L/E series */
920     + if (alps_exit_command_mode(psmouse) == 0 &&
921     + alps_enter_command_mode(psmouse) == 0) {
922     + reg_val = alps_command_mode_read_reg(psmouse,
923     + 0xD7);
924     + }
925     + alps_exit_command_mode(psmouse);
926     + ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
927     +
928     + if (reg_val == 0x0C || reg_val == 0x1D)
929     + is_dual = true;
930     + }
931     + }
932     +
933     if (is_dual)
934     priv->flags |= ALPS_DUALPOINT |
935     ALPS_DUALPOINT_WITH_PRESSURE;
936     @@ -2573,7 +2591,7 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse,
937    
938     alps_update_btn_info_ss4_v2(otp, priv);
939    
940     - alps_update_dual_info_ss4_v2(otp, priv);
941     + alps_update_dual_info_ss4_v2(otp, priv, psmouse);
942    
943     return 0;
944     }
945     diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
946     index 6cbbdc6e9687..b353d494ad40 100644
947     --- a/drivers/input/serio/i8042-x86ia64io.h
948     +++ b/drivers/input/serio/i8042-x86ia64io.h
949     @@ -530,6 +530,20 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
950     { }
951     };
952    
953     +static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = {
954     + {
955     + /*
956     + * Sony Vaio VGN-CS series require MUX or the touch sensor
957     + * buttons will disturb touchpad operation
958     + */
959     + .matches = {
960     + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
961     + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
962     + },
963     + },
964     + { }
965     +};
966     +
967     /*
968     * On some Asus laptops, just running self tests cause problems.
969     */
970     @@ -620,6 +634,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
971     DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
972     },
973     },
974     + {
975     + /* Lenovo ThinkPad L460 */
976     + .matches = {
977     + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
978     + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"),
979     + },
980     + },
981     {
982     /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
983     .matches = {
984     @@ -1163,6 +1184,9 @@ static int __init i8042_platform_init(void)
985     if (dmi_check_system(i8042_dmi_nomux_table))
986     i8042_nomux = true;
987    
988     + if (dmi_check_system(i8042_dmi_forcemux_table))
989     + i8042_nomux = false;
990     +
991     if (dmi_check_system(i8042_dmi_notimeout_table))
992     i8042_notimeout = true;
993    
994     diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c
995     index 71fb5734995b..68df16b3ce72 100644
996     --- a/drivers/media/usb/usbtv/usbtv-core.c
997     +++ b/drivers/media/usb/usbtv/usbtv-core.c
998     @@ -112,6 +112,8 @@ static int usbtv_probe(struct usb_interface *intf,
999     return 0;
1000    
1001     usbtv_audio_fail:
1002     + /* we must not free at this point */
1003     + usb_get_dev(usbtv->udev);
1004     usbtv_video_free(usbtv);
1005    
1006     usbtv_video_fail:
1007     diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
1008     index e825f013e54e..22efc039f302 100644
1009     --- a/drivers/misc/mei/main.c
1010     +++ b/drivers/misc/mei/main.c
1011     @@ -507,7 +507,6 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
1012     break;
1013    
1014     default:
1015     - dev_err(dev->dev, ": unsupported ioctl %d.\n", cmd);
1016     rets = -ENOIOCTLCMD;
1017     }
1018    
1019     diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
1020     index 7c0b27d132b1..b479bd81120b 100644
1021     --- a/drivers/mtd/chips/jedec_probe.c
1022     +++ b/drivers/mtd/chips/jedec_probe.c
1023     @@ -1889,6 +1889,8 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
1024     do {
1025     uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
1026     mask = (1 << (cfi->device_type * 8)) - 1;
1027     + if (ofs >= map->size)
1028     + return 0;
1029     result = map_read(map, base + ofs);
1030     bank++;
1031     } while ((result.x[0] & mask) == CFI_MFR_CONTINUATION);
1032     diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
1033     index 8268636675ef..4124bf91bee6 100644
1034     --- a/drivers/mtd/nand/atmel/pmecc.c
1035     +++ b/drivers/mtd/nand/atmel/pmecc.c
1036     @@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user)
1037    
1038     static int get_sectorsize(struct atmel_pmecc_user *user)
1039     {
1040     - return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512;
1041     + return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
1042     }
1043    
1044     static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector)
1045     diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1046     index 86944bc3b273..74bd260ca02a 100644
1047     --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1048     +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1049     @@ -666,7 +666,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)
1050    
1051     static int hns_gmac_get_sset_count(int stringset)
1052     {
1053     - if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1054     + if (stringset == ETH_SS_STATS)
1055     return ARRAY_SIZE(g_gmac_stats_string);
1056    
1057     return 0;
1058     diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1059     index b62816c1574e..93e71e27401b 100644
1060     --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1061     +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1062     @@ -422,7 +422,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb)
1063    
1064     int hns_ppe_get_sset_count(int stringset)
1065     {
1066     - if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1067     + if (stringset == ETH_SS_STATS)
1068     return ETH_PPE_STATIC_NUM;
1069     return 0;
1070     }
1071     diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1072     index 6f3570cfb501..e2e28532e4dc 100644
1073     --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1074     +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1075     @@ -876,7 +876,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data)
1076     */
1077     int hns_rcb_get_ring_sset_count(int stringset)
1078     {
1079     - if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1080     + if (stringset == ETH_SS_STATS)
1081     return HNS_RING_STATIC_REG_NUM;
1082    
1083     return 0;
1084     diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
1085     index 7ea7f8a4aa2a..2e14a3ae1d8b 100644
1086     --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
1087     +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
1088     @@ -993,8 +993,10 @@ int hns_get_sset_count(struct net_device *netdev, int stringset)
1089     cnt--;
1090    
1091     return cnt;
1092     - } else {
1093     + } else if (stringset == ETH_SS_STATS) {
1094     return (HNS_NET_STATS_CNT + ops->get_sset_count(h, stringset));
1095     + } else {
1096     + return -EOPNOTSUPP;
1097     }
1098     }
1099    
1100     diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
1101     index 489492b608cf..380916bff9e0 100644
1102     --- a/drivers/parport/parport_pc.c
1103     +++ b/drivers/parport/parport_pc.c
1104     @@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
1105     netmos_9901,
1106     netmos_9865,
1107     quatech_sppxp100,
1108     + wch_ch382l,
1109     };
1110    
1111    
1112     @@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
1113     /* netmos_9901 */ { 1, { { 0, -1 }, } },
1114     /* netmos_9865 */ { 1, { { 0, -1 }, } },
1115     /* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
1116     + /* wch_ch382l */ { 1, { { 2, -1 }, } },
1117     };
1118    
1119     static const struct pci_device_id parport_pc_pci_tbl[] = {
1120     @@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
1121     /* Quatech SPPXP-100 Parallel port PCI ExpressCard */
1122     { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
1123     PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
1124     + /* WCH CH382L PCI-E single parallel port card */
1125     + { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l },
1126     { 0, } /* terminate list */
1127     };
1128     MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
1129     diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c
1130     index 43865ef340e2..3afba145f2e6 100644
1131     --- a/drivers/phy/qualcomm/phy-qcom-ufs.c
1132     +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c
1133     @@ -689,3 +689,8 @@ int ufs_qcom_phy_power_off(struct phy *generic_phy)
1134     return 0;
1135     }
1136     EXPORT_SYMBOL_GPL(ufs_qcom_phy_power_off);
1137     +
1138     +MODULE_AUTHOR("Yaniv Gardi <ygardi@codeaurora.org>");
1139     +MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>");
1140     +MODULE_DESCRIPTION("Universal Flash Storage (UFS) QCOM PHY");
1141     +MODULE_LICENSE("GPL v2");
1142     diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
1143     index 398347fedc47..2cac160993bb 100644
1144     --- a/drivers/staging/comedi/drivers/ni_mio_common.c
1145     +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
1146     @@ -1284,6 +1284,8 @@ static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status)
1147     ack |= NISTC_INTA_ACK_AI_START;
1148     if (a_status & NISTC_AI_STATUS1_STOP)
1149     ack |= NISTC_INTA_ACK_AI_STOP;
1150     + if (a_status & NISTC_AI_STATUS1_OVER)
1151     + ack |= NISTC_INTA_ACK_AI_ERR;
1152     if (ack)
1153     ni_stc_writew(dev, ack, NISTC_INTA_ACK_REG);
1154     }
1155     diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
1156     index 951680640ad5..3613a6aabfb3 100644
1157     --- a/drivers/tty/serial/8250/8250_of.c
1158     +++ b/drivers/tty/serial/8250/8250_of.c
1159     @@ -321,6 +321,7 @@ static const struct of_device_id of_platform_serial_table[] = {
1160     { .compatible = "mrvl,mmp-uart",
1161     .data = (void *)PORT_XSCALE, },
1162     { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
1163     + { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, },
1164     { /* end of list */ },
1165     };
1166     MODULE_DEVICE_TABLE(of, of_platform_serial_table);
1167     diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
1168     index 8dcfd4978a03..fde34c84e707 100644
1169     --- a/drivers/tty/serial/8250/8250_port.c
1170     +++ b/drivers/tty/serial/8250/8250_port.c
1171     @@ -51,6 +51,10 @@
1172     #define UART_EXAR_SLEEP 0x8b /* Sleep mode */
1173     #define UART_EXAR_DVID 0x8d /* Device identification */
1174    
1175     +/* Nuvoton NPCM timeout register */
1176     +#define UART_NPCM_TOR 7
1177     +#define UART_NPCM_TOIE BIT(7) /* Timeout Interrupt Enable */
1178     +
1179     /*
1180     * Debugging.
1181     */
1182     @@ -297,6 +301,15 @@ static const struct serial8250_config uart_config[] = {
1183     UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
1184     .flags = UART_CAP_FIFO,
1185     },
1186     + [PORT_NPCM] = {
1187     + .name = "Nuvoton 16550",
1188     + .fifo_size = 16,
1189     + .tx_loadsz = 16,
1190     + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
1191     + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
1192     + .rxtrig_bytes = {1, 4, 8, 14},
1193     + .flags = UART_CAP_FIFO,
1194     + },
1195     };
1196    
1197     /* Uart divisor latch read */
1198     @@ -2168,6 +2181,15 @@ int serial8250_do_startup(struct uart_port *port)
1199     UART_DA830_PWREMU_MGMT_FREE);
1200     }
1201    
1202     + if (port->type == PORT_NPCM) {
1203     + /*
1204     + * Nuvoton calls the scratch register 'UART_TOR' (timeout
1205     + * register). Enable it, and set TIOC (timeout interrupt
1206     + * comparator) to be 0x20 for correct operation.
1207     + */
1208     + serial_port_out(port, UART_NPCM_TOR, UART_NPCM_TOIE | 0x20);
1209     + }
1210     +
1211     #ifdef CONFIG_SERIAL_8250_RSA
1212     /*
1213     * If this is an RSA port, see if we can kick it up to the
1214     @@ -2490,6 +2512,15 @@ static unsigned int xr17v35x_get_divisor(struct uart_8250_port *up,
1215     return quot_16 >> 4;
1216     }
1217    
1218     +/* Nuvoton NPCM UARTs have a custom divisor calculation */
1219     +static unsigned int npcm_get_divisor(struct uart_8250_port *up,
1220     + unsigned int baud)
1221     +{
1222     + struct uart_port *port = &up->port;
1223     +
1224     + return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud + 2) - 2;
1225     +}
1226     +
1227     static unsigned int serial8250_get_divisor(struct uart_8250_port *up,
1228     unsigned int baud,
1229     unsigned int *frac)
1230     @@ -2510,6 +2541,8 @@ static unsigned int serial8250_get_divisor(struct uart_8250_port *up,
1231     quot = 0x8002;
1232     else if (up->port.type == PORT_XR17V35X)
1233     quot = xr17v35x_get_divisor(up, baud, frac);
1234     + else if (up->port.type == PORT_NPCM)
1235     + quot = npcm_get_divisor(up, baud);
1236     else
1237     quot = uart_get_divisor(port, baud);
1238    
1239     diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1240     index 5a5813d01cf8..de67abbda921 100644
1241     --- a/drivers/tty/vt/vt.c
1242     +++ b/drivers/tty/vt/vt.c
1243     @@ -1352,6 +1352,11 @@ static void csi_m(struct vc_data *vc)
1244     case 3:
1245     vc->vc_italic = 1;
1246     break;
1247     + case 21:
1248     + /*
1249     + * No console drivers support double underline, so
1250     + * convert it to a single underline.
1251     + */
1252     case 4:
1253     vc->vc_underline = 1;
1254     break;
1255     @@ -1387,7 +1392,6 @@ static void csi_m(struct vc_data *vc)
1256     vc->vc_disp_ctrl = 1;
1257     vc->vc_toggle_meta = 1;
1258     break;
1259     - case 21:
1260     case 22:
1261     vc->vc_intensity = 1;
1262     break;
1263     diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
1264     index c2631145f404..9bd60ec83ac6 100644
1265     --- a/drivers/usb/dwc2/hcd.c
1266     +++ b/drivers/usb/dwc2/hcd.c
1267     @@ -3277,7 +3277,6 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
1268     dwc2_core_init(hsotg, false);
1269     dwc2_enable_global_interrupts(hsotg);
1270     spin_lock_irqsave(&hsotg->lock, flags);
1271     - dwc2_hsotg_disconnect(hsotg);
1272     dwc2_hsotg_core_init_disconnected(hsotg, false);
1273     spin_unlock_irqrestore(&hsotg->lock, flags);
1274     dwc2_hsotg_core_connect(hsotg);
1275     @@ -3296,8 +3295,12 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
1276     if (count > 250)
1277     dev_err(hsotg->dev,
1278     "Connection id status change timed out\n");
1279     - hsotg->op_state = OTG_STATE_A_HOST;
1280    
1281     + spin_lock_irqsave(&hsotg->lock, flags);
1282     + dwc2_hsotg_disconnect(hsotg);
1283     + spin_unlock_irqrestore(&hsotg->lock, flags);
1284     +
1285     + hsotg->op_state = OTG_STATE_A_HOST;
1286     /* Initialize the Core for Host mode */
1287     dwc2_core_init(hsotg, false);
1288     dwc2_enable_global_interrupts(hsotg);
1289     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1290     index aed182d24d23..2836acf73a07 100644
1291     --- a/drivers/usb/serial/cp210x.c
1292     +++ b/drivers/usb/serial/cp210x.c
1293     @@ -158,6 +158,7 @@ static const struct usb_device_id id_table[] = {
1294     { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
1295     { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
1296     { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
1297     + { USB_DEVICE(0x155A, 0x1006) }, /* ELDAT Easywave RX09 */
1298     { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
1299     { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */
1300     { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
1301     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1302     index d038e543c246..a2a5232751cb 100644
1303     --- a/drivers/usb/serial/ftdi_sio.c
1304     +++ b/drivers/usb/serial/ftdi_sio.c
1305     @@ -773,6 +773,7 @@ static const struct usb_device_id id_table_combined[] = {
1306     .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
1307     { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
1308     { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) },
1309     + { USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) },
1310     { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) },
1311     { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) },
1312     { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
1313     @@ -935,6 +936,7 @@ static const struct usb_device_id id_table_combined[] = {
1314     { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
1315     { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
1316     { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) },
1317     + { USB_DEVICE(FTDI_VID, FTDI_FHE_PID) },
1318     { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
1319     { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
1320     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1321     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1322     index 8b4ecd2bd297..975d02666c5a 100644
1323     --- a/drivers/usb/serial/ftdi_sio_ids.h
1324     +++ b/drivers/usb/serial/ftdi_sio_ids.h
1325     @@ -923,6 +923,9 @@
1326     /*
1327     * RT Systems programming cables for various ham radios
1328     */
1329     +/* This device uses the VID of FTDI */
1330     +#define RTSYSTEMS_USB_VX8_PID 0x9e50 /* USB-VX8 USB to 7 pin modular plug for Yaesu VX-8 radio */
1331     +
1332     #define RTSYSTEMS_VID 0x2100 /* Vendor ID */
1333     #define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */
1334     #define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */
1335     @@ -1441,6 +1444,12 @@
1336     */
1337     #define FTDI_CINTERION_MC55I_PID 0xA951
1338    
1339     +/*
1340     + * Product: FirmwareHubEmulator
1341     + * Manufacturer: Harman Becker Automotive Systems
1342     + */
1343     +#define FTDI_FHE_PID 0xA9A0
1344     +
1345     /*
1346     * Product: Comet Caller ID decoder
1347     * Manufacturer: Crucible Technologies
1348     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1349     index 59a01a0844c9..dfa360d18ae2 100644
1350     --- a/fs/btrfs/inode.c
1351     +++ b/fs/btrfs/inode.c
1352     @@ -1257,6 +1257,8 @@ static noinline int csum_exist_in_range(struct btrfs_fs_info *fs_info,
1353     list_del(&sums->list);
1354     kfree(sums);
1355     }
1356     + if (ret < 0)
1357     + return ret;
1358     return 1;
1359     }
1360    
1361     @@ -1389,10 +1391,23 @@ static noinline int run_delalloc_nocow(struct inode *inode,
1362     goto out_check;
1363     if (btrfs_extent_readonly(fs_info, disk_bytenr))
1364     goto out_check;
1365     - if (btrfs_cross_ref_exist(root, ino,
1366     - found_key.offset -
1367     - extent_offset, disk_bytenr))
1368     + ret = btrfs_cross_ref_exist(root, ino,
1369     + found_key.offset -
1370     + extent_offset, disk_bytenr);
1371     + if (ret) {
1372     + /*
1373     + * ret could be -EIO if the above fails to read
1374     + * metadata.
1375     + */
1376     + if (ret < 0) {
1377     + if (cow_start != (u64)-1)
1378     + cur_offset = cow_start;
1379     + goto error;
1380     + }
1381     +
1382     + WARN_ON_ONCE(nolock);
1383     goto out_check;
1384     + }
1385     disk_bytenr += extent_offset;
1386     disk_bytenr += cur_offset - found_key.offset;
1387     num_bytes = min(end + 1, extent_end) - cur_offset;
1388     @@ -1410,10 +1425,22 @@ static noinline int run_delalloc_nocow(struct inode *inode,
1389     * this ensure that csum for a given extent are
1390     * either valid or do not exist.
1391     */
1392     - if (csum_exist_in_range(fs_info, disk_bytenr,
1393     - num_bytes)) {
1394     + ret = csum_exist_in_range(fs_info, disk_bytenr,
1395     + num_bytes);
1396     + if (ret) {
1397     if (!nolock)
1398     btrfs_end_write_no_snapshotting(root);
1399     +
1400     + /*
1401     + * ret could be -EIO if the above fails to read
1402     + * metadata.
1403     + */
1404     + if (ret < 0) {
1405     + if (cow_start != (u64)-1)
1406     + cur_offset = cow_start;
1407     + goto error;
1408     + }
1409     + WARN_ON_ONCE(nolock);
1410     goto out_check;
1411     }
1412     if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr)) {
1413     diff --git a/fs/ceph/file.c b/fs/ceph/file.c
1414     index 5c17125f45c7..0024d3e61bcd 100644
1415     --- a/fs/ceph/file.c
1416     +++ b/fs/ceph/file.c
1417     @@ -635,7 +635,8 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to,
1418     struct ceph_aio_request {
1419     struct kiocb *iocb;
1420     size_t total_len;
1421     - int write;
1422     + bool write;
1423     + bool should_dirty;
1424     int error;
1425     struct list_head osd_reqs;
1426     unsigned num_reqs;
1427     @@ -745,7 +746,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
1428     }
1429     }
1430    
1431     - ceph_put_page_vector(osd_data->pages, num_pages, !aio_req->write);
1432     + ceph_put_page_vector(osd_data->pages, num_pages, aio_req->should_dirty);
1433     ceph_osdc_put_request(req);
1434    
1435     if (rc < 0)
1436     @@ -842,6 +843,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
1437     size_t count = iov_iter_count(iter);
1438     loff_t pos = iocb->ki_pos;
1439     bool write = iov_iter_rw(iter) == WRITE;
1440     + bool should_dirty = !write && iter_is_iovec(iter);
1441    
1442     if (write && ceph_snap(file_inode(file)) != CEPH_NOSNAP)
1443     return -EROFS;
1444     @@ -909,6 +911,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
1445     if (aio_req) {
1446     aio_req->iocb = iocb;
1447     aio_req->write = write;
1448     + aio_req->should_dirty = should_dirty;
1449     INIT_LIST_HEAD(&aio_req->osd_reqs);
1450     if (write) {
1451     aio_req->mtime = mtime;
1452     @@ -966,7 +969,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
1453     len = ret;
1454     }
1455    
1456     - ceph_put_page_vector(pages, num_pages, !write);
1457     + ceph_put_page_vector(pages, num_pages, should_dirty);
1458    
1459     ceph_osdc_put_request(req);
1460     if (ret < 0)
1461     diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
1462     index 19748a5b0e77..835c2271196a 100644
1463     --- a/include/linux/bitmap.h
1464     +++ b/include/linux/bitmap.h
1465     @@ -262,12 +262,20 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
1466     __bitmap_complement(dst, src, nbits);
1467     }
1468    
1469     +#ifdef __LITTLE_ENDIAN
1470     +#define BITMAP_MEM_ALIGNMENT 8
1471     +#else
1472     +#define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long))
1473     +#endif
1474     +#define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1)
1475     +
1476     static inline int bitmap_equal(const unsigned long *src1,
1477     const unsigned long *src2, unsigned int nbits)
1478     {
1479     if (small_const_nbits(nbits))
1480     return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
1481     - if (__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
1482     + if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
1483     + IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
1484     return !memcmp(src1, src2, nbits / 8);
1485     return __bitmap_equal(src1, src2, nbits);
1486     }
1487     @@ -318,8 +326,10 @@ static __always_inline void bitmap_set(unsigned long *map, unsigned int start,
1488     {
1489     if (__builtin_constant_p(nbits) && nbits == 1)
1490     __set_bit(start, map);
1491     - else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) &&
1492     - __builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
1493     + else if (__builtin_constant_p(start & BITMAP_MEM_MASK) &&
1494     + IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) &&
1495     + __builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
1496     + IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
1497     memset((char *)map + start / 8, 0xff, nbits / 8);
1498     else
1499     __bitmap_set(map, start, nbits);
1500     @@ -330,8 +340,10 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start,
1501     {
1502     if (__builtin_constant_p(nbits) && nbits == 1)
1503     __clear_bit(start, map);
1504     - else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) &&
1505     - __builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
1506     + else if (__builtin_constant_p(start & BITMAP_MEM_MASK) &&
1507     + IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) &&
1508     + __builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
1509     + IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
1510     memset((char *)map + start / 8, 0, nbits / 8);
1511     else
1512     __bitmap_clear(map, start, nbits);
1513     diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
1514     index 33f7530f96b9..8e46c35d654b 100644
1515     --- a/include/linux/netfilter/x_tables.h
1516     +++ b/include/linux/netfilter/x_tables.h
1517     @@ -285,6 +285,8 @@ unsigned int *xt_alloc_entry_offsets(unsigned int size);
1518     bool xt_find_jump_offset(const unsigned int *offsets,
1519     unsigned int target, unsigned int size);
1520    
1521     +int xt_check_proc_name(const char *name, unsigned int size);
1522     +
1523     int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
1524     bool inv_proto);
1525     int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
1526     diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
1527     index b2a10c762304..bec461bd6472 100644
1528     --- a/include/rdma/ib_addr.h
1529     +++ b/include/rdma/ib_addr.h
1530     @@ -129,6 +129,8 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
1531     const unsigned char *dst_dev_addr);
1532    
1533     int rdma_addr_size(struct sockaddr *addr);
1534     +int rdma_addr_size_in6(struct sockaddr_in6 *addr);
1535     +int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);
1536    
1537     int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
1538     int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
1539     diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
1540     index 1c8413f93e3d..dce5f9dae121 100644
1541     --- a/include/uapi/linux/serial_core.h
1542     +++ b/include/uapi/linux/serial_core.h
1543     @@ -76,6 +76,9 @@
1544     #define PORT_SUNZILOG 38
1545     #define PORT_SUNSAB 39
1546    
1547     +/* Nuvoton UART */
1548     +#define PORT_NPCM 40
1549     +
1550     /* Intel EG20 */
1551     #define PORT_PCH_8LINE 44
1552     #define PORT_PCH_2LINE 45
1553     diff --git a/ipc/shm.c b/ipc/shm.c
1554     index bd652755d32c..b469e910f887 100644
1555     --- a/ipc/shm.c
1556     +++ b/ipc/shm.c
1557     @@ -386,6 +386,17 @@ static int shm_fault(struct vm_fault *vmf)
1558     return sfd->vm_ops->fault(vmf);
1559     }
1560    
1561     +static int shm_split(struct vm_area_struct *vma, unsigned long addr)
1562     +{
1563     + struct file *file = vma->vm_file;
1564     + struct shm_file_data *sfd = shm_file_data(file);
1565     +
1566     + if (sfd->vm_ops && sfd->vm_ops->split)
1567     + return sfd->vm_ops->split(vma, addr);
1568     +
1569     + return 0;
1570     +}
1571     +
1572     #ifdef CONFIG_NUMA
1573     static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
1574     {
1575     @@ -510,6 +521,7 @@ static const struct vm_operations_struct shm_vm_ops = {
1576     .open = shm_open, /* callback for a new vm-area open */
1577     .close = shm_close, /* callback for when the vm-area is released */
1578     .fault = shm_fault,
1579     + .split = shm_split,
1580     #if defined(CONFIG_NUMA)
1581     .set_policy = shm_set_policy,
1582     .get_policy = shm_get_policy,
1583     diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
1584     index 3f8cb1e14588..253ae2da13c3 100644
1585     --- a/kernel/events/hw_breakpoint.c
1586     +++ b/kernel/events/hw_breakpoint.c
1587     @@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint);
1588     * modify_user_hw_breakpoint - modify a user-space hardware breakpoint
1589     * @bp: the breakpoint structure to modify
1590     * @attr: new breakpoint attributes
1591     - * @triggered: callback to trigger when we hit the breakpoint
1592     - * @tsk: pointer to 'task_struct' of the process to which the address belongs
1593     */
1594     int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr)
1595     {
1596     - u64 old_addr = bp->attr.bp_addr;
1597     - u64 old_len = bp->attr.bp_len;
1598     - int old_type = bp->attr.bp_type;
1599     - int err = 0;
1600     -
1601     /*
1602     * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it
1603     * will not be possible to raise IPIs that invoke __perf_event_disable.
1604     @@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
1605     bp->attr.bp_addr = attr->bp_addr;
1606     bp->attr.bp_type = attr->bp_type;
1607     bp->attr.bp_len = attr->bp_len;
1608     + bp->attr.disabled = 1;
1609    
1610     - if (attr->disabled)
1611     - goto end;
1612     -
1613     - err = validate_hw_breakpoint(bp);
1614     - if (!err)
1615     - perf_event_enable(bp);
1616     + if (!attr->disabled) {
1617     + int err = validate_hw_breakpoint(bp);
1618    
1619     - if (err) {
1620     - bp->attr.bp_addr = old_addr;
1621     - bp->attr.bp_type = old_type;
1622     - bp->attr.bp_len = old_len;
1623     - if (!bp->attr.disabled)
1624     - perf_event_enable(bp);
1625     + if (err)
1626     + return err;
1627    
1628     - return err;
1629     + perf_event_enable(bp);
1630     + bp->attr.disabled = 0;
1631     }
1632    
1633     -end:
1634     - bp->attr.disabled = attr->disabled;
1635     -
1636     return 0;
1637     }
1638     EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);
1639     diff --git a/mm/percpu-km.c b/mm/percpu-km.c
1640     index d2a76642c4ae..0d88d7bd5706 100644
1641     --- a/mm/percpu-km.c
1642     +++ b/mm/percpu-km.c
1643     @@ -34,7 +34,7 @@
1644     #include <linux/log2.h>
1645    
1646     static int pcpu_populate_chunk(struct pcpu_chunk *chunk,
1647     - int page_start, int page_end)
1648     + int page_start, int page_end, gfp_t gfp)
1649     {
1650     return 0;
1651     }
1652     @@ -45,18 +45,18 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk,
1653     /* nada */
1654     }
1655    
1656     -static struct pcpu_chunk *pcpu_create_chunk(void)
1657     +static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp)
1658     {
1659     const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT;
1660     struct pcpu_chunk *chunk;
1661     struct page *pages;
1662     int i;
1663    
1664     - chunk = pcpu_alloc_chunk();
1665     + chunk = pcpu_alloc_chunk(gfp);
1666     if (!chunk)
1667     return NULL;
1668    
1669     - pages = alloc_pages(GFP_KERNEL, order_base_2(nr_pages));
1670     + pages = alloc_pages(gfp | GFP_KERNEL, order_base_2(nr_pages));
1671     if (!pages) {
1672     pcpu_free_chunk(chunk);
1673     return NULL;
1674     diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
1675     index 15dab691ea70..f48ff9fc86fe 100644
1676     --- a/mm/percpu-vm.c
1677     +++ b/mm/percpu-vm.c
1678     @@ -37,7 +37,7 @@ static struct page **pcpu_get_pages(void)
1679     lockdep_assert_held(&pcpu_alloc_mutex);
1680    
1681     if (!pages)
1682     - pages = pcpu_mem_zalloc(pages_size);
1683     + pages = pcpu_mem_zalloc(pages_size, 0);
1684     return pages;
1685     }
1686    
1687     @@ -73,18 +73,21 @@ static void pcpu_free_pages(struct pcpu_chunk *chunk,
1688     * @pages: array to put the allocated pages into, indexed by pcpu_page_idx()
1689     * @page_start: page index of the first page to be allocated
1690     * @page_end: page index of the last page to be allocated + 1
1691     + * @gfp: allocation flags passed to the underlying allocator
1692     *
1693     * Allocate pages [@page_start,@page_end) into @pages for all units.
1694     * The allocation is for @chunk. Percpu core doesn't care about the
1695     * content of @pages and will pass it verbatim to pcpu_map_pages().
1696     */
1697     static int pcpu_alloc_pages(struct pcpu_chunk *chunk,
1698     - struct page **pages, int page_start, int page_end)
1699     + struct page **pages, int page_start, int page_end,
1700     + gfp_t gfp)
1701     {
1702     - const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD;
1703     unsigned int cpu, tcpu;
1704     int i;
1705    
1706     + gfp |= GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD;
1707     +
1708     for_each_possible_cpu(cpu) {
1709     for (i = page_start; i < page_end; i++) {
1710     struct page **pagep = &pages[pcpu_page_idx(cpu, i)];
1711     @@ -262,6 +265,7 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk,
1712     * @chunk: chunk of interest
1713     * @page_start: the start page
1714     * @page_end: the end page
1715     + * @gfp: allocation flags passed to the underlying memory allocator
1716     *
1717     * For each cpu, populate and map pages [@page_start,@page_end) into
1718     * @chunk.
1719     @@ -270,7 +274,7 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk,
1720     * pcpu_alloc_mutex, does GFP_KERNEL allocation.
1721     */
1722     static int pcpu_populate_chunk(struct pcpu_chunk *chunk,
1723     - int page_start, int page_end)
1724     + int page_start, int page_end, gfp_t gfp)
1725     {
1726     struct page **pages;
1727    
1728     @@ -278,7 +282,7 @@ static int pcpu_populate_chunk(struct pcpu_chunk *chunk,
1729     if (!pages)
1730     return -ENOMEM;
1731    
1732     - if (pcpu_alloc_pages(chunk, pages, page_start, page_end))
1733     + if (pcpu_alloc_pages(chunk, pages, page_start, page_end, gfp))
1734     return -ENOMEM;
1735    
1736     if (pcpu_map_pages(chunk, pages, page_start, page_end)) {
1737     @@ -325,12 +329,12 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk,
1738     pcpu_free_pages(chunk, pages, page_start, page_end);
1739     }
1740    
1741     -static struct pcpu_chunk *pcpu_create_chunk(void)
1742     +static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp)
1743     {
1744     struct pcpu_chunk *chunk;
1745     struct vm_struct **vms;
1746    
1747     - chunk = pcpu_alloc_chunk();
1748     + chunk = pcpu_alloc_chunk(gfp);
1749     if (!chunk)
1750     return NULL;
1751    
1752     diff --git a/mm/percpu.c b/mm/percpu.c
1753     index a0e0c82c1e4c..c80e796bf35c 100644
1754     --- a/mm/percpu.c
1755     +++ b/mm/percpu.c
1756     @@ -447,10 +447,12 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits,
1757     /**
1758     * pcpu_mem_zalloc - allocate memory
1759     * @size: bytes to allocate
1760     + * @gfp: allocation flags
1761     *
1762     * Allocate @size bytes. If @size is smaller than PAGE_SIZE,
1763     - * kzalloc() is used; otherwise, vzalloc() is used. The returned
1764     - * memory is always zeroed.
1765     + * kzalloc() is used; otherwise, the equivalent of vzalloc() is used.
1766     + * This is to facilitate passing through whitelisted flags. The
1767     + * returned memory is always zeroed.
1768     *
1769     * CONTEXT:
1770     * Does GFP_KERNEL allocation.
1771     @@ -458,15 +460,16 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits,
1772     * RETURNS:
1773     * Pointer to the allocated area on success, NULL on failure.
1774     */
1775     -static void *pcpu_mem_zalloc(size_t size)
1776     +static void *pcpu_mem_zalloc(size_t size, gfp_t gfp)
1777     {
1778     if (WARN_ON_ONCE(!slab_is_available()))
1779     return NULL;
1780    
1781     if (size <= PAGE_SIZE)
1782     - return kzalloc(size, GFP_KERNEL);
1783     + return kzalloc(size, gfp | GFP_KERNEL);
1784     else
1785     - return vzalloc(size);
1786     + return __vmalloc(size, gfp | GFP_KERNEL | __GFP_ZERO,
1787     + PAGE_KERNEL);
1788     }
1789    
1790     /**
1791     @@ -1154,12 +1157,12 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
1792     return chunk;
1793     }
1794    
1795     -static struct pcpu_chunk *pcpu_alloc_chunk(void)
1796     +static struct pcpu_chunk *pcpu_alloc_chunk(gfp_t gfp)
1797     {
1798     struct pcpu_chunk *chunk;
1799     int region_bits;
1800    
1801     - chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size);
1802     + chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size, gfp);
1803     if (!chunk)
1804     return NULL;
1805    
1806     @@ -1168,17 +1171,17 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void)
1807     region_bits = pcpu_chunk_map_bits(chunk);
1808    
1809     chunk->alloc_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits) *
1810     - sizeof(chunk->alloc_map[0]));
1811     + sizeof(chunk->alloc_map[0]), gfp);
1812     if (!chunk->alloc_map)
1813     goto alloc_map_fail;
1814    
1815     chunk->bound_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits + 1) *
1816     - sizeof(chunk->bound_map[0]));
1817     + sizeof(chunk->bound_map[0]), gfp);
1818     if (!chunk->bound_map)
1819     goto bound_map_fail;
1820    
1821     chunk->md_blocks = pcpu_mem_zalloc(pcpu_chunk_nr_blocks(chunk) *
1822     - sizeof(chunk->md_blocks[0]));
1823     + sizeof(chunk->md_blocks[0]), gfp);
1824     if (!chunk->md_blocks)
1825     goto md_blocks_fail;
1826    
1827     @@ -1277,9 +1280,10 @@ static void pcpu_chunk_depopulated(struct pcpu_chunk *chunk,
1828     * pcpu_addr_to_page - translate address to physical address
1829     * pcpu_verify_alloc_info - check alloc_info is acceptable during init
1830     */
1831     -static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size);
1832     +static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size,
1833     + gfp_t gfp);
1834     static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size);
1835     -static struct pcpu_chunk *pcpu_create_chunk(void);
1836     +static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp);
1837     static void pcpu_destroy_chunk(struct pcpu_chunk *chunk);
1838     static struct page *pcpu_addr_to_page(void *addr);
1839     static int __init pcpu_verify_alloc_info(const struct pcpu_alloc_info *ai);
1840     @@ -1421,7 +1425,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
1841     }
1842    
1843     if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) {
1844     - chunk = pcpu_create_chunk();
1845     + chunk = pcpu_create_chunk(0);
1846     if (!chunk) {
1847     err = "failed to allocate new chunk";
1848     goto fail;
1849     @@ -1450,7 +1454,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
1850     page_start, page_end) {
1851     WARN_ON(chunk->immutable);
1852    
1853     - ret = pcpu_populate_chunk(chunk, rs, re);
1854     + ret = pcpu_populate_chunk(chunk, rs, re, 0);
1855    
1856     spin_lock_irqsave(&pcpu_lock, flags);
1857     if (ret) {
1858     @@ -1561,10 +1565,17 @@ void __percpu *__alloc_reserved_percpu(size_t size, size_t align)
1859     * pcpu_balance_workfn - manage the amount of free chunks and populated pages
1860     * @work: unused
1861     *
1862     - * Reclaim all fully free chunks except for the first one.
1863     + * Reclaim all fully free chunks except for the first one. This is also
1864     + * responsible for maintaining the pool of empty populated pages. However,
1865     + * it is possible that this is called when physical memory is scarce causing
1866     + * OOM killer to be triggered. We should avoid doing so until an actual
1867     + * allocation causes the failure as it is possible that requests can be
1868     + * serviced from already backed regions.
1869     */
1870     static void pcpu_balance_workfn(struct work_struct *work)
1871     {
1872     + /* gfp flags passed to underlying allocators */
1873     + const gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN;
1874     LIST_HEAD(to_free);
1875     struct list_head *free_head = &pcpu_slot[pcpu_nr_slots - 1];
1876     struct pcpu_chunk *chunk, *next;
1877     @@ -1645,7 +1656,7 @@ static void pcpu_balance_workfn(struct work_struct *work)
1878     chunk->nr_pages) {
1879     int nr = min(re - rs, nr_to_pop);
1880    
1881     - ret = pcpu_populate_chunk(chunk, rs, rs + nr);
1882     + ret = pcpu_populate_chunk(chunk, rs, rs + nr, gfp);
1883     if (!ret) {
1884     nr_to_pop -= nr;
1885     spin_lock_irq(&pcpu_lock);
1886     @@ -1662,7 +1673,7 @@ static void pcpu_balance_workfn(struct work_struct *work)
1887    
1888     if (nr_to_pop) {
1889     /* ran out of chunks to populate, create a new one and retry */
1890     - chunk = pcpu_create_chunk();
1891     + chunk = pcpu_create_chunk(gfp);
1892     if (chunk) {
1893     spin_lock_irq(&pcpu_lock);
1894     pcpu_chunk_relocate(chunk, -1);
1895     diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
1896     index a0ef89772c36..a27704ff13a9 100644
1897     --- a/net/bluetooth/smp.c
1898     +++ b/net/bluetooth/smp.c
1899     @@ -2287,8 +2287,14 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
1900     else
1901     sec_level = authreq_to_seclevel(auth);
1902    
1903     - if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK))
1904     + if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) {
1905     + /* If link is already encrypted with sufficient security we
1906     + * still need refresh encryption as per Core Spec 5.0 Vol 3,
1907     + * Part H 2.4.6
1908     + */
1909     + smp_ltk_encrypt(conn, hcon->sec_level);
1910     return 0;
1911     + }
1912    
1913     if (sec_level > hcon->pending_sec_level)
1914     hcon->pending_sec_level = sec_level;
1915     diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
1916     index 59baaecd3e54..0b589a6b365c 100644
1917     --- a/net/bridge/netfilter/ebt_among.c
1918     +++ b/net/bridge/netfilter/ebt_among.c
1919     @@ -177,6 +177,28 @@ static bool poolsize_invalid(const struct ebt_mac_wormhash *w)
1920     return w && w->poolsize >= (INT_MAX / sizeof(struct ebt_mac_wormhash_tuple));
1921     }
1922    
1923     +static bool wormhash_offset_invalid(int off, unsigned int len)
1924     +{
1925     + if (off == 0) /* not present */
1926     + return false;
1927     +
1928     + if (off < (int)sizeof(struct ebt_among_info) ||
1929     + off % __alignof__(struct ebt_mac_wormhash))
1930     + return true;
1931     +
1932     + off += sizeof(struct ebt_mac_wormhash);
1933     +
1934     + return off > len;
1935     +}
1936     +
1937     +static bool wormhash_sizes_valid(const struct ebt_mac_wormhash *wh, int a, int b)
1938     +{
1939     + if (a == 0)
1940     + a = sizeof(struct ebt_among_info);
1941     +
1942     + return ebt_mac_wormhash_size(wh) + a == b;
1943     +}
1944     +
1945     static int ebt_among_mt_check(const struct xt_mtchk_param *par)
1946     {
1947     const struct ebt_among_info *info = par->matchinfo;
1948     @@ -189,6 +211,10 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par)
1949     if (expected_length > em->match_size)
1950     return -EINVAL;
1951    
1952     + if (wormhash_offset_invalid(info->wh_dst_ofs, em->match_size) ||
1953     + wormhash_offset_invalid(info->wh_src_ofs, em->match_size))
1954     + return -EINVAL;
1955     +
1956     wh_dst = ebt_among_wh_dst(info);
1957     if (poolsize_invalid(wh_dst))
1958     return -EINVAL;
1959     @@ -201,6 +227,14 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par)
1960     if (poolsize_invalid(wh_src))
1961     return -EINVAL;
1962    
1963     + if (info->wh_src_ofs < info->wh_dst_ofs) {
1964     + if (!wormhash_sizes_valid(wh_src, info->wh_src_ofs, info->wh_dst_ofs))
1965     + return -EINVAL;
1966     + } else {
1967     + if (!wormhash_sizes_valid(wh_dst, info->wh_dst_ofs, info->wh_src_ofs))
1968     + return -EINVAL;
1969     + }
1970     +
1971     expected_length += ebt_mac_wormhash_size(wh_src);
1972    
1973     if (em->match_size != EBT_ALIGN(expected_length)) {
1974     diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
1975     index 997a96896f1a..37fef48c8826 100644
1976     --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
1977     +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
1978     @@ -159,8 +159,20 @@ static unsigned int ipv4_conntrack_local(void *priv,
1979     ip_hdrlen(skb) < sizeof(struct iphdr))
1980     return NF_ACCEPT;
1981    
1982     - if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */
1983     + if (ip_is_fragment(ip_hdr(skb))) { /* IP_NODEFRAG setsockopt set */
1984     + enum ip_conntrack_info ctinfo;
1985     + struct nf_conn *tmpl;
1986     +
1987     + tmpl = nf_ct_get(skb, &ctinfo);
1988     + if (tmpl && nf_ct_is_template(tmpl)) {
1989     + /* when skipping ct, clear templates to avoid fooling
1990     + * later targets/matches
1991     + */
1992     + skb->_nfct = 0;
1993     + nf_ct_put(tmpl);
1994     + }
1995     return NF_ACCEPT;
1996     + }
1997    
1998     return nf_conntrack_in(state->net, PF_INET, state->hook, skb);
1999     }
2000     diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
2001     index 413f01be0c9b..bcdc2d557de1 100644
2002     --- a/net/ipv6/ip6_vti.c
2003     +++ b/net/ipv6/ip6_vti.c
2004     @@ -626,7 +626,6 @@ static void vti6_link_config(struct ip6_tnl *t)
2005     {
2006     struct net_device *dev = t->dev;
2007     struct __ip6_tnl_parm *p = &t->parms;
2008     - struct net_device *tdev = NULL;
2009    
2010     memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
2011     memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
2012     @@ -639,25 +638,6 @@ static void vti6_link_config(struct ip6_tnl *t)
2013     dev->flags |= IFF_POINTOPOINT;
2014     else
2015     dev->flags &= ~IFF_POINTOPOINT;
2016     -
2017     - if (p->flags & IP6_TNL_F_CAP_XMIT) {
2018     - int strict = (ipv6_addr_type(&p->raddr) &
2019     - (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
2020     - struct rt6_info *rt = rt6_lookup(t->net,
2021     - &p->raddr, &p->laddr,
2022     - p->link, strict);
2023     -
2024     - if (rt)
2025     - tdev = rt->dst.dev;
2026     - ip6_rt_put(rt);
2027     - }
2028     -
2029     - if (!tdev && p->link)
2030     - tdev = __dev_get_by_index(t->net, p->link);
2031     -
2032     - if (tdev)
2033     - dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len,
2034     - IPV6_MIN_MTU);
2035     }
2036    
2037     /**
2038     diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
2039     index 490d7360222e..316869df91e8 100644
2040     --- a/net/l2tp/l2tp_core.c
2041     +++ b/net/l2tp/l2tp_core.c
2042     @@ -113,6 +113,13 @@ struct l2tp_net {
2043     spinlock_t l2tp_session_hlist_lock;
2044     };
2045    
2046     +#if IS_ENABLED(CONFIG_IPV6)
2047     +static bool l2tp_sk_is_v6(struct sock *sk)
2048     +{
2049     + return sk->sk_family == PF_INET6 &&
2050     + !ipv6_addr_v4mapped(&sk->sk_v6_daddr);
2051     +}
2052     +#endif
2053    
2054     static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk)
2055     {
2056     @@ -1130,7 +1137,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb,
2057     /* Queue the packet to IP for output */
2058     skb->ignore_df = 1;
2059     #if IS_ENABLED(CONFIG_IPV6)
2060     - if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped)
2061     + if (l2tp_sk_is_v6(tunnel->sock))
2062     error = inet6_csk_xmit(tunnel->sock, skb, NULL);
2063     else
2064     #endif
2065     @@ -1193,6 +1200,15 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
2066     goto out_unlock;
2067     }
2068    
2069     + /* The user-space may change the connection status for the user-space
2070     + * provided socket at run time: we must check it under the socket lock
2071     + */
2072     + if (tunnel->fd >= 0 && sk->sk_state != TCP_ESTABLISHED) {
2073     + kfree_skb(skb);
2074     + ret = NET_XMIT_DROP;
2075     + goto out_unlock;
2076     + }
2077     +
2078     /* Get routing info from the tunnel socket */
2079     skb_dst_drop(skb);
2080     skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0)));
2081     @@ -1212,7 +1228,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
2082    
2083     /* Calculate UDP checksum if configured to do so */
2084     #if IS_ENABLED(CONFIG_IPV6)
2085     - if (sk->sk_family == PF_INET6 && !tunnel->v4mapped)
2086     + if (l2tp_sk_is_v6(sk))
2087     udp6_set_csum(udp_get_no_check6_tx(sk),
2088     skb, &inet6_sk(sk)->saddr,
2089     &sk->sk_v6_daddr, udp_len);
2090     @@ -1616,24 +1632,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
2091     if (cfg != NULL)
2092     tunnel->debug = cfg->debug;
2093    
2094     -#if IS_ENABLED(CONFIG_IPV6)
2095     - if (sk->sk_family == PF_INET6) {
2096     - struct ipv6_pinfo *np = inet6_sk(sk);
2097     -
2098     - if (ipv6_addr_v4mapped(&np->saddr) &&
2099     - ipv6_addr_v4mapped(&sk->sk_v6_daddr)) {
2100     - struct inet_sock *inet = inet_sk(sk);
2101     -
2102     - tunnel->v4mapped = true;
2103     - inet->inet_saddr = np->saddr.s6_addr32[3];
2104     - inet->inet_rcv_saddr = sk->sk_v6_rcv_saddr.s6_addr32[3];
2105     - inet->inet_daddr = sk->sk_v6_daddr.s6_addr32[3];
2106     - } else {
2107     - tunnel->v4mapped = false;
2108     - }
2109     - }
2110     -#endif
2111     -
2112     /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */
2113     tunnel->encap = encap;
2114     if (encap == L2TP_ENCAPTYPE_UDP) {
2115     diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
2116     index 67c79d9b5c6c..9e2f1fda1b03 100644
2117     --- a/net/l2tp/l2tp_core.h
2118     +++ b/net/l2tp/l2tp_core.h
2119     @@ -195,9 +195,6 @@ struct l2tp_tunnel {
2120     struct sock *sock; /* Parent socket */
2121     int fd; /* Parent fd, if tunnel socket
2122     * was created by userspace */
2123     -#if IS_ENABLED(CONFIG_IPV6)
2124     - bool v4mapped;
2125     -#endif
2126    
2127     struct work_struct del_work;
2128    
2129     diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
2130     index 60c92158a2cd..a450a1c8804b 100644
2131     --- a/net/netfilter/x_tables.c
2132     +++ b/net/netfilter/x_tables.c
2133     @@ -423,6 +423,36 @@ textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto)
2134     return buf;
2135     }
2136    
2137     +/**
2138     + * xt_check_proc_name - check that name is suitable for /proc file creation
2139     + *
2140     + * @name: file name candidate
2141     + * @size: length of buffer
2142     + *
2143     + * some x_tables modules wish to create a file in /proc.
2144     + * This function makes sure that the name is suitable for this
2145     + * purpose, it checks that name is NUL terminated and isn't a 'special'
2146     + * name, like "..".
2147     + *
2148     + * returns negative number on error or 0 if name is useable.
2149     + */
2150     +int xt_check_proc_name(const char *name, unsigned int size)
2151     +{
2152     + if (name[0] == '\0')
2153     + return -EINVAL;
2154     +
2155     + if (strnlen(name, size) == size)
2156     + return -ENAMETOOLONG;
2157     +
2158     + if (strcmp(name, ".") == 0 ||
2159     + strcmp(name, "..") == 0 ||
2160     + strchr(name, '/'))
2161     + return -EINVAL;
2162     +
2163     + return 0;
2164     +}
2165     +EXPORT_SYMBOL(xt_check_proc_name);
2166     +
2167     int xt_check_match(struct xt_mtchk_param *par,
2168     unsigned int size, u_int8_t proto, bool inv_proto)
2169     {
2170     @@ -1008,7 +1038,12 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
2171     if ((size >> PAGE_SHIFT) + 2 > totalram_pages)
2172     return NULL;
2173    
2174     - info = kvmalloc(sz, GFP_KERNEL);
2175     + /* __GFP_NORETRY is not fully supported by kvmalloc but it should
2176     + * work reasonably well if sz is too large and bail out rather
2177     + * than shoot all processes down before realizing there is nothing
2178     + * more to reclaim.
2179     + */
2180     + info = kvmalloc(sz, GFP_KERNEL | __GFP_NORETRY);
2181     if (!info)
2182     return NULL;
2183    
2184     diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
2185     index b8a3e740ffd4..0c034597b9b8 100644
2186     --- a/net/netfilter/xt_hashlimit.c
2187     +++ b/net/netfilter/xt_hashlimit.c
2188     @@ -915,8 +915,9 @@ static int hashlimit_mt_check_v1(const struct xt_mtchk_param *par)
2189     struct hashlimit_cfg3 cfg = {};
2190     int ret;
2191    
2192     - if (info->name[sizeof(info->name) - 1] != '\0')
2193     - return -EINVAL;
2194     + ret = xt_check_proc_name(info->name, sizeof(info->name));
2195     + if (ret)
2196     + return ret;
2197    
2198     ret = cfg_copy(&cfg, (void *)&info->cfg, 1);
2199    
2200     @@ -933,8 +934,9 @@ static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par)
2201     struct hashlimit_cfg3 cfg = {};
2202     int ret;
2203    
2204     - if (info->name[sizeof(info->name) - 1] != '\0')
2205     - return -EINVAL;
2206     + ret = xt_check_proc_name(info->name, sizeof(info->name));
2207     + if (ret)
2208     + return ret;
2209    
2210     ret = cfg_copy(&cfg, (void *)&info->cfg, 2);
2211    
2212     @@ -948,9 +950,11 @@ static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par)
2213     static int hashlimit_mt_check(const struct xt_mtchk_param *par)
2214     {
2215     struct xt_hashlimit_mtinfo3 *info = par->matchinfo;
2216     + int ret;
2217    
2218     - if (info->name[sizeof(info->name) - 1] != '\0')
2219     - return -EINVAL;
2220     + ret = xt_check_proc_name(info->name, sizeof(info->name));
2221     + if (ret)
2222     + return ret;
2223    
2224     return hashlimit_mt_check_common(par, &info->hinfo, &info->cfg,
2225     info->name, 3);
2226     diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
2227     index 245fa350a7a8..cf96d230e5a3 100644
2228     --- a/net/netfilter/xt_recent.c
2229     +++ b/net/netfilter/xt_recent.c
2230     @@ -361,9 +361,9 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
2231     info->hit_count, XT_RECENT_MAX_NSTAMPS - 1);
2232     return -EINVAL;
2233     }
2234     - if (info->name[0] == '\0' ||
2235     - strnlen(info->name, XT_RECENT_NAME_LEN) == XT_RECENT_NAME_LEN)
2236     - return -EINVAL;
2237     + ret = xt_check_proc_name(info->name, sizeof(info->name));
2238     + if (ret)
2239     + return ret;
2240    
2241     if (ip_pkt_list_tot && info->hit_count < ip_pkt_list_tot)
2242     nstamp_mask = roundup_pow_of_two(ip_pkt_list_tot) - 1;
2243     diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
2244     index ccfdc7115a83..a00ec715aa46 100644
2245     --- a/net/xfrm/xfrm_ipcomp.c
2246     +++ b/net/xfrm/xfrm_ipcomp.c
2247     @@ -283,7 +283,7 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name)
2248     struct crypto_comp *tfm;
2249    
2250     /* This can be any valid CPU ID so we don't need locking. */
2251     - tfm = __this_cpu_read(*pos->tfms);
2252     + tfm = this_cpu_read(*pos->tfms);
2253    
2254     if (!strcmp(crypto_comp_name(tfm), alg_name)) {
2255     pos->users++;
2256     diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
2257     index bab20c626943..8f13fb57eab5 100644
2258     --- a/net/xfrm/xfrm_state.c
2259     +++ b/net/xfrm/xfrm_state.c
2260     @@ -2050,6 +2050,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
2261     struct xfrm_mgr *km;
2262     struct xfrm_policy *pol = NULL;
2263    
2264     +#ifdef CONFIG_COMPAT
2265     + if (in_compat_syscall())
2266     + return -EOPNOTSUPP;
2267     +#endif
2268     +
2269     if (!optval && !optlen) {
2270     xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL);
2271     xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL);
2272     diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
2273     index 0edf38d2afd9..dbfcfefd6d69 100644
2274     --- a/net/xfrm/xfrm_user.c
2275     +++ b/net/xfrm/xfrm_user.c
2276     @@ -121,22 +121,17 @@ static inline int verify_replay(struct xfrm_usersa_info *p,
2277     struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL];
2278     struct xfrm_replay_state_esn *rs;
2279    
2280     - if (p->flags & XFRM_STATE_ESN) {
2281     - if (!rt)
2282     - return -EINVAL;
2283     + if (!rt)
2284     + return (p->flags & XFRM_STATE_ESN) ? -EINVAL : 0;
2285    
2286     - rs = nla_data(rt);
2287     + rs = nla_data(rt);
2288    
2289     - if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8)
2290     - return -EINVAL;
2291     -
2292     - if (nla_len(rt) < xfrm_replay_state_esn_len(rs) &&
2293     - nla_len(rt) != sizeof(*rs))
2294     - return -EINVAL;
2295     - }
2296     + if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8)
2297     + return -EINVAL;
2298    
2299     - if (!rt)
2300     - return 0;
2301     + if (nla_len(rt) < xfrm_replay_state_esn_len(rs) &&
2302     + nla_len(rt) != sizeof(*rs))
2303     + return -EINVAL;
2304    
2305     /* As only ESP and AH support ESN feature. */
2306     if ((p->id.proto != IPPROTO_ESP) && (p->id.proto != IPPROTO_AH))
2307     diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
2308     index 012881461058..d6e9a18fd821 100644
2309     --- a/sound/core/oss/pcm_oss.c
2310     +++ b/sound/core/oss/pcm_oss.c
2311     @@ -1326,7 +1326,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
2312     static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size_t bytes)
2313     {
2314     size_t xfer = 0;
2315     - ssize_t tmp;
2316     + ssize_t tmp = 0;
2317     struct snd_pcm_runtime *runtime = substream->runtime;
2318    
2319     if (atomic_read(&substream->mmap_count))
2320     @@ -1433,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
2321     static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t bytes)
2322     {
2323     size_t xfer = 0;
2324     - ssize_t tmp;
2325     + ssize_t tmp = 0;
2326     struct snd_pcm_runtime *runtime = substream->runtime;
2327    
2328     if (atomic_read(&substream->mmap_count))
2329     diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
2330     index 499f75b18e09..eba2bedcbc81 100644
2331     --- a/sound/core/pcm_native.c
2332     +++ b/sound/core/pcm_native.c
2333     @@ -3424,7 +3424,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
2334     area,
2335     substream->runtime->dma_area,
2336     substream->runtime->dma_addr,
2337     - area->vm_end - area->vm_start);
2338     + substream->runtime->dma_bytes);
2339     #endif /* CONFIG_X86 */
2340     /* mmap with fault handler */
2341     area->vm_ops = &snd_pcm_vm_ops_data_fault;
2342     diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
2343     index ed56cd307059..58f94f399efb 100644
2344     --- a/sound/usb/quirks.c
2345     +++ b/sound/usb/quirks.c
2346     @@ -1177,6 +1177,7 @@ static bool is_teac_dsd_dac(unsigned int id)
2347     switch (id) {
2348     case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */
2349     case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */
2350     + case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */
2351     return true;
2352     }
2353     return false;