1 |
commit: 14243423be4baa539a5f9b13c2ddbeed904b7cad |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 8 14:30:59 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 8 14:30:59 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=14243423 |
7 |
|
8 |
Linux patch 4.15.16 |
9 |
|
10 |
0000_README | 4 + |
11 |
1015_linux-4.15.16.patch | 2899 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 2903 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index f1a4ce6..ba8435c 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -103,6 +103,10 @@ Patch: 1014_linux-4.15.15.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.15.15 |
21 |
|
22 |
+Patch: 1015_linux-4.15.16.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.15.16 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1015_linux-4.15.16.patch b/1015_linux-4.15.16.patch |
31 |
new file mode 100644 |
32 |
index 0000000..bec9a07 |
33 |
--- /dev/null |
34 |
+++ b/1015_linux-4.15.16.patch |
35 |
@@ -0,0 +1,2899 @@ |
36 |
+diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt |
37 |
+index dad3b2ec66d4..aeb6db4e35c3 100644 |
38 |
+--- a/Documentation/devicetree/bindings/serial/8250.txt |
39 |
++++ b/Documentation/devicetree/bindings/serial/8250.txt |
40 |
+@@ -24,6 +24,7 @@ Required properties: |
41 |
+ - "ti,da830-uart" |
42 |
+ - "aspeed,ast2400-vuart" |
43 |
+ - "aspeed,ast2500-vuart" |
44 |
++ - "nuvoton,npcm750-uart" |
45 |
+ - "serial" if the port type is unknown. |
46 |
+ - reg : offset and length of the register set for the device. |
47 |
+ - interrupts : should contain uart interrupt. |
48 |
+diff --git a/Makefile b/Makefile |
49 |
+index 20c9b7bfeed4..b28f0f721ec7 100644 |
50 |
+--- a/Makefile |
51 |
++++ b/Makefile |
52 |
+@@ -1,7 +1,7 @@ |
53 |
+ # SPDX-License-Identifier: GPL-2.0 |
54 |
+ VERSION = 4 |
55 |
+ PATCHLEVEL = 15 |
56 |
+-SUBLEVEL = 15 |
57 |
++SUBLEVEL = 16 |
58 |
+ EXTRAVERSION = |
59 |
+ NAME = Fearless Coyote |
60 |
+ |
61 |
+diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts |
62 |
+index 9fb7426070ce..03c7d77023c6 100644 |
63 |
+--- a/arch/arm/boot/dts/am335x-pepper.dts |
64 |
++++ b/arch/arm/boot/dts/am335x-pepper.dts |
65 |
+@@ -139,7 +139,7 @@ |
66 |
+ &audio_codec { |
67 |
+ status = "okay"; |
68 |
+ |
69 |
+- reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; |
70 |
++ gpio-reset = <&gpio1 16 GPIO_ACTIVE_LOW>; |
71 |
+ AVDD-supply = <&ldo3_reg>; |
72 |
+ IOVDD-supply = <&ldo3_reg>; |
73 |
+ DRVDD-supply = <&ldo3_reg>; |
74 |
+diff --git a/arch/arm/boot/dts/dra76-evm.dts b/arch/arm/boot/dts/dra76-evm.dts |
75 |
+index b024a65c6e27..f64aab450315 100644 |
76 |
+--- a/arch/arm/boot/dts/dra76-evm.dts |
77 |
++++ b/arch/arm/boot/dts/dra76-evm.dts |
78 |
+@@ -148,6 +148,7 @@ |
79 |
+ compatible = "ti,tps65917"; |
80 |
+ reg = <0x58>; |
81 |
+ ti,system-power-controller; |
82 |
++ ti,palmas-override-powerhold; |
83 |
+ interrupt-controller; |
84 |
+ #interrupt-cells = <2>; |
85 |
+ |
86 |
+diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts |
87 |
+index 5362139d5312..669c51c00c00 100644 |
88 |
+--- a/arch/arm/boot/dts/omap3-n900.dts |
89 |
++++ b/arch/arm/boot/dts/omap3-n900.dts |
90 |
+@@ -558,7 +558,7 @@ |
91 |
+ tlv320aic3x: tlv320aic3x@18 { |
92 |
+ compatible = "ti,tlv320aic3x"; |
93 |
+ reg = <0x18>; |
94 |
+- reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
95 |
++ gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
96 |
+ ai3x-gpio-func = < |
97 |
+ 0 /* AIC3X_GPIO1_FUNC_DISABLED */ |
98 |
+ 5 /* AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT */ |
99 |
+@@ -575,7 +575,7 @@ |
100 |
+ tlv320aic3x_aux: tlv320aic3x@19 { |
101 |
+ compatible = "ti,tlv320aic3x"; |
102 |
+ reg = <0x19>; |
103 |
+- reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
104 |
++ gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
105 |
+ |
106 |
+ AVDD-supply = <&vmmc2>; |
107 |
+ DRVDD-supply = <&vmmc2>; |
108 |
+diff --git a/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts b/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts |
109 |
+index 51e6f1d21c32..b2758dd8ce43 100644 |
110 |
+--- a/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts |
111 |
++++ b/arch/arm/boot/dts/sun6i-a31s-sinovoip-bpi-m2.dts |
112 |
+@@ -42,7 +42,6 @@ |
113 |
+ |
114 |
+ /dts-v1/; |
115 |
+ #include "sun6i-a31s.dtsi" |
116 |
+-#include "sunxi-common-regulators.dtsi" |
117 |
+ #include <dt-bindings/gpio/gpio.h> |
118 |
+ |
119 |
+ / { |
120 |
+@@ -99,6 +98,7 @@ |
121 |
+ pinctrl-0 = <&gmac_pins_rgmii_a>, <&gmac_phy_reset_pin_bpi_m2>; |
122 |
+ phy = <&phy1>; |
123 |
+ phy-mode = "rgmii"; |
124 |
++ phy-supply = <®_dldo1>; |
125 |
+ snps,reset-gpio = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */ |
126 |
+ snps,reset-active-low; |
127 |
+ snps,reset-delays-us = <0 10000 30000>; |
128 |
+@@ -118,7 +118,7 @@ |
129 |
+ &mmc0 { |
130 |
+ pinctrl-names = "default"; |
131 |
+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bpi_m2>; |
132 |
+- vmmc-supply = <®_vcc3v0>; |
133 |
++ vmmc-supply = <®_dcdc1>; |
134 |
+ bus-width = <4>; |
135 |
+ cd-gpios = <&pio 0 4 GPIO_ACTIVE_HIGH>; /* PA4 */ |
136 |
+ cd-inverted; |
137 |
+@@ -132,7 +132,7 @@ |
138 |
+ &mmc2 { |
139 |
+ pinctrl-names = "default"; |
140 |
+ pinctrl-0 = <&mmc2_pins_a>; |
141 |
+- vmmc-supply = <®_vcc3v0>; |
142 |
++ vmmc-supply = <®_aldo1>; |
143 |
+ mmc-pwrseq = <&mmc2_pwrseq>; |
144 |
+ bus-width = <4>; |
145 |
+ non-removable; |
146 |
+@@ -163,6 +163,8 @@ |
147 |
+ reg = <0x68>; |
148 |
+ interrupt-parent = <&nmi_intc>; |
149 |
+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
150 |
++ eldoin-supply = <®_dcdc1>; |
151 |
++ x-powers,drive-vbus-en; |
152 |
+ }; |
153 |
+ }; |
154 |
+ |
155 |
+@@ -193,7 +195,28 @@ |
156 |
+ |
157 |
+ #include "axp22x.dtsi" |
158 |
+ |
159 |
++®_aldo1 { |
160 |
++ regulator-min-microvolt = <3300000>; |
161 |
++ regulator-max-microvolt = <3300000>; |
162 |
++ regulator-name = "vcc-wifi"; |
163 |
++}; |
164 |
++ |
165 |
++®_aldo2 { |
166 |
++ regulator-always-on; |
167 |
++ regulator-min-microvolt = <2500000>; |
168 |
++ regulator-max-microvolt = <2500000>; |
169 |
++ regulator-name = "vcc-gmac"; |
170 |
++}; |
171 |
++ |
172 |
++®_aldo3 { |
173 |
++ regulator-always-on; |
174 |
++ regulator-min-microvolt = <3000000>; |
175 |
++ regulator-max-microvolt = <3000000>; |
176 |
++ regulator-name = "avcc"; |
177 |
++}; |
178 |
++ |
179 |
+ ®_dc5ldo { |
180 |
++ regulator-always-on; |
181 |
+ regulator-min-microvolt = <700000>; |
182 |
+ regulator-max-microvolt = <1320000>; |
183 |
+ regulator-name = "vdd-cpus"; |
184 |
+@@ -233,6 +256,40 @@ |
185 |
+ regulator-name = "vcc-dram"; |
186 |
+ }; |
187 |
+ |
188 |
++®_dldo1 { |
189 |
++ regulator-min-microvolt = <3000000>; |
190 |
++ regulator-max-microvolt = <3000000>; |
191 |
++ regulator-name = "vcc-mac"; |
192 |
++}; |
193 |
++ |
194 |
++®_dldo2 { |
195 |
++ regulator-min-microvolt = <2800000>; |
196 |
++ regulator-max-microvolt = <2800000>; |
197 |
++ regulator-name = "avdd-csi"; |
198 |
++}; |
199 |
++ |
200 |
++®_dldo3 { |
201 |
++ regulator-always-on; |
202 |
++ regulator-min-microvolt = <3300000>; |
203 |
++ regulator-max-microvolt = <3300000>; |
204 |
++ regulator-name = "vcc-pb"; |
205 |
++}; |
206 |
++ |
207 |
++®_eldo1 { |
208 |
++ regulator-min-microvolt = <1800000>; |
209 |
++ regulator-max-microvolt = <1800000>; |
210 |
++ regulator-name = "vdd-csi"; |
211 |
++ status = "okay"; |
212 |
++}; |
213 |
++ |
214 |
++®_ldo_io1 { |
215 |
++ regulator-always-on; |
216 |
++ regulator-min-microvolt = <1800000>; |
217 |
++ regulator-max-microvolt = <1800000>; |
218 |
++ regulator-name = "vcc-pm-cpus"; |
219 |
++ status = "okay"; |
220 |
++}; |
221 |
++ |
222 |
+ &uart0 { |
223 |
+ pinctrl-names = "default"; |
224 |
+ pinctrl-0 = <&uart0_pins_a>; |
225 |
+diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile |
226 |
+index 30ef8e291271..c9919c2b7ad1 100644 |
227 |
+--- a/arch/arm/crypto/Makefile |
228 |
++++ b/arch/arm/crypto/Makefile |
229 |
+@@ -54,6 +54,7 @@ crct10dif-arm-ce-y := crct10dif-ce-core.o crct10dif-ce-glue.o |
230 |
+ crc32-arm-ce-y:= crc32-ce-core.o crc32-ce-glue.o |
231 |
+ chacha20-neon-y := chacha20-neon-core.o chacha20-neon-glue.o |
232 |
+ |
233 |
++ifdef REGENERATE_ARM_CRYPTO |
234 |
+ quiet_cmd_perl = PERL $@ |
235 |
+ cmd_perl = $(PERL) $(<) > $(@) |
236 |
+ |
237 |
+@@ -62,5 +63,6 @@ $(src)/sha256-core.S_shipped: $(src)/sha256-armv4.pl |
238 |
+ |
239 |
+ $(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl |
240 |
+ $(call cmd,perl) |
241 |
++endif |
242 |
+ |
243 |
+ .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S |
244 |
+diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h |
245 |
+index fb061cf0d736..30a07730807a 100644 |
246 |
+--- a/arch/arm/plat-omap/include/plat/sram.h |
247 |
++++ b/arch/arm/plat-omap/include/plat/sram.h |
248 |
+@@ -5,13 +5,4 @@ void omap_map_sram(unsigned long start, unsigned long size, |
249 |
+ unsigned long skip, int cached); |
250 |
+ void omap_sram_reset(void); |
251 |
+ |
252 |
+-extern void *omap_sram_push_address(unsigned long size); |
253 |
+- |
254 |
+-/* Macro to push a function to the internal SRAM, using the fncpy API */ |
255 |
+-#define omap_sram_push(funcp, size) ({ \ |
256 |
+- typeof(&(funcp)) _res = NULL; \ |
257 |
+- void *_sram_address = omap_sram_push_address(size); \ |
258 |
+- if (_sram_address) \ |
259 |
+- _res = fncpy(_sram_address, &(funcp), size); \ |
260 |
+- _res; \ |
261 |
+-}) |
262 |
++extern void *omap_sram_push(void *funcp, unsigned long size); |
263 |
+diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c |
264 |
+index a5bc92d7e476..921840acf65c 100644 |
265 |
+--- a/arch/arm/plat-omap/sram.c |
266 |
++++ b/arch/arm/plat-omap/sram.c |
267 |
+@@ -23,6 +23,7 @@ |
268 |
+ #include <asm/fncpy.h> |
269 |
+ #include <asm/tlb.h> |
270 |
+ #include <asm/cacheflush.h> |
271 |
++#include <asm/set_memory.h> |
272 |
+ |
273 |
+ #include <asm/mach/map.h> |
274 |
+ |
275 |
+@@ -42,7 +43,7 @@ static void __iomem *omap_sram_ceil; |
276 |
+ * Note that fncpy requires the returned address to be aligned |
277 |
+ * to an 8-byte boundary. |
278 |
+ */ |
279 |
+-void *omap_sram_push_address(unsigned long size) |
280 |
++static void *omap_sram_push_address(unsigned long size) |
281 |
+ { |
282 |
+ unsigned long available, new_ceil = (unsigned long)omap_sram_ceil; |
283 |
+ |
284 |
+@@ -60,6 +61,30 @@ void *omap_sram_push_address(unsigned long size) |
285 |
+ return (void *)omap_sram_ceil; |
286 |
+ } |
287 |
+ |
288 |
++void *omap_sram_push(void *funcp, unsigned long size) |
289 |
++{ |
290 |
++ void *sram; |
291 |
++ unsigned long base; |
292 |
++ int pages; |
293 |
++ void *dst = NULL; |
294 |
++ |
295 |
++ sram = omap_sram_push_address(size); |
296 |
++ if (!sram) |
297 |
++ return NULL; |
298 |
++ |
299 |
++ base = (unsigned long)sram & PAGE_MASK; |
300 |
++ pages = PAGE_ALIGN(size) / PAGE_SIZE; |
301 |
++ |
302 |
++ set_memory_rw(base, pages); |
303 |
++ |
304 |
++ dst = fncpy(sram, funcp, size); |
305 |
++ |
306 |
++ set_memory_ro(base, pages); |
307 |
++ set_memory_x(base, pages); |
308 |
++ |
309 |
++ return dst; |
310 |
++} |
311 |
++ |
312 |
+ /* |
313 |
+ * The SRAM context is lost during off-idle and stack |
314 |
+ * needs to be reset. |
315 |
+@@ -75,6 +100,9 @@ void omap_sram_reset(void) |
316 |
+ void __init omap_map_sram(unsigned long start, unsigned long size, |
317 |
+ unsigned long skip, int cached) |
318 |
+ { |
319 |
++ unsigned long base; |
320 |
++ int pages; |
321 |
++ |
322 |
+ if (size == 0) |
323 |
+ return; |
324 |
+ |
325 |
+@@ -95,4 +123,10 @@ void __init omap_map_sram(unsigned long start, unsigned long size, |
326 |
+ */ |
327 |
+ memset_io(omap_sram_base + omap_sram_skip, 0, |
328 |
+ omap_sram_size - omap_sram_skip); |
329 |
++ |
330 |
++ base = (unsigned long)omap_sram_base; |
331 |
++ pages = PAGE_ALIGN(omap_sram_size) / PAGE_SIZE; |
332 |
++ |
333 |
++ set_memory_ro(base, pages); |
334 |
++ set_memory_x(base, pages); |
335 |
+ } |
336 |
+diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c |
337 |
+index a71a48e71fff..aa7496be311d 100644 |
338 |
+--- a/arch/arm/vfp/vfpmodule.c |
339 |
++++ b/arch/arm/vfp/vfpmodule.c |
340 |
+@@ -648,7 +648,7 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, |
341 |
+ */ |
342 |
+ static int vfp_dying_cpu(unsigned int cpu) |
343 |
+ { |
344 |
+- vfp_force_reload(cpu, current_thread_info()); |
345 |
++ vfp_current_hw_state[cpu] = NULL; |
346 |
+ return 0; |
347 |
+ } |
348 |
+ |
349 |
+diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile |
350 |
+index b5edc5918c28..12fd81af1d1c 100644 |
351 |
+--- a/arch/arm64/crypto/Makefile |
352 |
++++ b/arch/arm64/crypto/Makefile |
353 |
+@@ -58,6 +58,7 @@ CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS |
354 |
+ $(obj)/aes-glue-%.o: $(src)/aes-glue.c FORCE |
355 |
+ $(call if_changed_rule,cc_o_c) |
356 |
+ |
357 |
++ifdef REGENERATE_ARM64_CRYPTO |
358 |
+ quiet_cmd_perlasm = PERLASM $@ |
359 |
+ cmd_perlasm = $(PERL) $(<) void $(@) |
360 |
+ |
361 |
+@@ -66,5 +67,6 @@ $(src)/sha256-core.S_shipped: $(src)/sha512-armv8.pl |
362 |
+ |
363 |
+ $(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl |
364 |
+ $(call cmd,perlasm) |
365 |
++endif |
366 |
+ |
367 |
+ .PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S |
368 |
+diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h |
369 |
+index c9448e19847a..62290feddd56 100644 |
370 |
+--- a/arch/powerpc/include/asm/book3s/64/mmu.h |
371 |
++++ b/arch/powerpc/include/asm/book3s/64/mmu.h |
372 |
+@@ -87,6 +87,9 @@ typedef struct { |
373 |
+ /* Number of bits in the mm_cpumask */ |
374 |
+ atomic_t active_cpus; |
375 |
+ |
376 |
++ /* Number of users of the external (Nest) MMU */ |
377 |
++ atomic_t copros; |
378 |
++ |
379 |
+ /* NPU NMMU context */ |
380 |
+ struct npu_context *npu_context; |
381 |
+ |
382 |
+diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h |
383 |
+index e2a2b8400490..4f8a03c74e3f 100644 |
384 |
+--- a/arch/powerpc/include/asm/mmu_context.h |
385 |
++++ b/arch/powerpc/include/asm/mmu_context.h |
386 |
+@@ -92,15 +92,23 @@ static inline void dec_mm_active_cpus(struct mm_struct *mm) |
387 |
+ static inline void mm_context_add_copro(struct mm_struct *mm) |
388 |
+ { |
389 |
+ /* |
390 |
+- * On hash, should only be called once over the lifetime of |
391 |
+- * the context, as we can't decrement the active cpus count |
392 |
+- * and flush properly for the time being. |
393 |
++ * If any copro is in use, increment the active CPU count |
394 |
++ * in order to force TLB invalidations to be global as to |
395 |
++ * propagate to the Nest MMU. |
396 |
+ */ |
397 |
+- inc_mm_active_cpus(mm); |
398 |
++ if (atomic_inc_return(&mm->context.copros) == 1) |
399 |
++ inc_mm_active_cpus(mm); |
400 |
+ } |
401 |
+ |
402 |
+ static inline void mm_context_remove_copro(struct mm_struct *mm) |
403 |
+ { |
404 |
++ int c; |
405 |
++ |
406 |
++ c = atomic_dec_if_positive(&mm->context.copros); |
407 |
++ |
408 |
++ /* Detect imbalance between add and remove */ |
409 |
++ WARN_ON(c < 0); |
410 |
++ |
411 |
+ /* |
412 |
+ * Need to broadcast a global flush of the full mm before |
413 |
+ * decrementing active_cpus count, as the next TLBI may be |
414 |
+@@ -111,7 +119,7 @@ static inline void mm_context_remove_copro(struct mm_struct *mm) |
415 |
+ * for the time being. Invalidations will remain global if |
416 |
+ * used on hash. |
417 |
+ */ |
418 |
+- if (radix_enabled()) { |
419 |
++ if (c == 0 && radix_enabled()) { |
420 |
+ flush_all_mm(mm); |
421 |
+ dec_mm_active_cpus(mm); |
422 |
+ } |
423 |
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
424 |
+index 2dc10bf646b8..9b060a41185e 100644 |
425 |
+--- a/arch/powerpc/kernel/exceptions-64s.S |
426 |
++++ b/arch/powerpc/kernel/exceptions-64s.S |
427 |
+@@ -706,7 +706,7 @@ EXC_COMMON_BEGIN(bad_addr_slb) |
428 |
+ ld r3, PACA_EXSLB+EX_DAR(r13) |
429 |
+ std r3, _DAR(r1) |
430 |
+ beq cr6, 2f |
431 |
+- li r10, 0x480 /* fix trap number for I-SLB miss */ |
432 |
++ li r10, 0x481 /* fix trap number for I-SLB miss */ |
433 |
+ std r10, _TRAP(r1) |
434 |
+ 2: bl save_nvgprs |
435 |
+ addi r3, r1, STACK_FRAME_OVERHEAD |
436 |
+diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c |
437 |
+index b7a84522e652..c933632aa08d 100644 |
438 |
+--- a/arch/powerpc/kernel/irq.c |
439 |
++++ b/arch/powerpc/kernel/irq.c |
440 |
+@@ -475,6 +475,14 @@ void force_external_irq_replay(void) |
441 |
+ */ |
442 |
+ WARN_ON(!arch_irqs_disabled()); |
443 |
+ |
444 |
++ /* |
445 |
++ * Interrupts must always be hard disabled before irq_happened is |
446 |
++ * modified (to prevent lost update in case of interrupt between |
447 |
++ * load and store). |
448 |
++ */ |
449 |
++ __hard_irq_disable(); |
450 |
++ local_paca->irq_happened |= PACA_IRQ_HARD_DIS; |
451 |
++ |
452 |
+ /* Indicate in the PACA that we have an interrupt to replay */ |
453 |
+ local_paca->irq_happened |= PACA_IRQ_EE; |
454 |
+ } |
455 |
+diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c |
456 |
+index 59c0766ae4e0..5066276229f8 100644 |
457 |
+--- a/arch/powerpc/mm/mmu_context_book3s64.c |
458 |
++++ b/arch/powerpc/mm/mmu_context_book3s64.c |
459 |
+@@ -171,6 +171,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) |
460 |
+ mm_iommu_init(mm); |
461 |
+ #endif |
462 |
+ atomic_set(&mm->context.active_cpus, 0); |
463 |
++ atomic_set(&mm->context.copros, 0); |
464 |
+ |
465 |
+ return 0; |
466 |
+ } |
467 |
+diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c |
468 |
+index 913a2b81b177..91afe00abbb0 100644 |
469 |
+--- a/arch/powerpc/mm/tlb-radix.c |
470 |
++++ b/arch/powerpc/mm/tlb-radix.c |
471 |
+@@ -85,7 +85,23 @@ static inline void _tlbiel_pid(unsigned long pid, unsigned long ric) |
472 |
+ static inline void _tlbie_pid(unsigned long pid, unsigned long ric) |
473 |
+ { |
474 |
+ asm volatile("ptesync": : :"memory"); |
475 |
+- __tlbie_pid(pid, ric); |
476 |
++ |
477 |
++ /* |
478 |
++ * Workaround the fact that the "ric" argument to __tlbie_pid |
479 |
++ * must be a compile-time contraint to match the "i" constraint |
480 |
++ * in the asm statement. |
481 |
++ */ |
482 |
++ switch (ric) { |
483 |
++ case RIC_FLUSH_TLB: |
484 |
++ __tlbie_pid(pid, RIC_FLUSH_TLB); |
485 |
++ break; |
486 |
++ case RIC_FLUSH_PWC: |
487 |
++ __tlbie_pid(pid, RIC_FLUSH_PWC); |
488 |
++ break; |
489 |
++ case RIC_FLUSH_ALL: |
490 |
++ default: |
491 |
++ __tlbie_pid(pid, RIC_FLUSH_ALL); |
492 |
++ } |
493 |
+ asm volatile("eieio; tlbsync; ptesync": : :"memory"); |
494 |
+ } |
495 |
+ |
496 |
+@@ -245,6 +261,16 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd |
497 |
+ } |
498 |
+ EXPORT_SYMBOL(radix__local_flush_tlb_page); |
499 |
+ |
500 |
++static bool mm_needs_flush_escalation(struct mm_struct *mm) |
501 |
++{ |
502 |
++ /* |
503 |
++ * P9 nest MMU has issues with the page walk cache |
504 |
++ * caching PTEs and not flushing them properly when |
505 |
++ * RIC = 0 for a PID/LPID invalidate |
506 |
++ */ |
507 |
++ return atomic_read(&mm->context.copros) != 0; |
508 |
++} |
509 |
++ |
510 |
+ #ifdef CONFIG_SMP |
511 |
+ void radix__flush_tlb_mm(struct mm_struct *mm) |
512 |
+ { |
513 |
+@@ -255,9 +281,12 @@ void radix__flush_tlb_mm(struct mm_struct *mm) |
514 |
+ return; |
515 |
+ |
516 |
+ preempt_disable(); |
517 |
+- if (!mm_is_thread_local(mm)) |
518 |
+- _tlbie_pid(pid, RIC_FLUSH_TLB); |
519 |
+- else |
520 |
++ if (!mm_is_thread_local(mm)) { |
521 |
++ if (mm_needs_flush_escalation(mm)) |
522 |
++ _tlbie_pid(pid, RIC_FLUSH_ALL); |
523 |
++ else |
524 |
++ _tlbie_pid(pid, RIC_FLUSH_TLB); |
525 |
++ } else |
526 |
+ _tlbiel_pid(pid, RIC_FLUSH_TLB); |
527 |
+ preempt_enable(); |
528 |
+ } |
529 |
+@@ -369,10 +398,14 @@ void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start, |
530 |
+ } |
531 |
+ |
532 |
+ if (full) { |
533 |
+- if (local) |
534 |
++ if (local) { |
535 |
+ _tlbiel_pid(pid, RIC_FLUSH_TLB); |
536 |
+- else |
537 |
+- _tlbie_pid(pid, RIC_FLUSH_TLB); |
538 |
++ } else { |
539 |
++ if (mm_needs_flush_escalation(mm)) |
540 |
++ _tlbie_pid(pid, RIC_FLUSH_ALL); |
541 |
++ else |
542 |
++ _tlbie_pid(pid, RIC_FLUSH_TLB); |
543 |
++ } |
544 |
+ } else { |
545 |
+ bool hflush = false; |
546 |
+ unsigned long hstart, hend; |
547 |
+@@ -482,6 +515,9 @@ static inline void __radix__flush_tlb_range_psize(struct mm_struct *mm, |
548 |
+ } |
549 |
+ |
550 |
+ if (full) { |
551 |
++ if (!local && mm_needs_flush_escalation(mm)) |
552 |
++ also_pwc = true; |
553 |
++ |
554 |
+ if (local) |
555 |
+ _tlbiel_pid(pid, also_pwc ? RIC_FLUSH_ALL : RIC_FLUSH_TLB); |
556 |
+ else |
557 |
+diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c |
558 |
+index dbea6020ffe7..575292a33bdf 100644 |
559 |
+--- a/arch/x86/crypto/cast5_avx_glue.c |
560 |
++++ b/arch/x86/crypto/cast5_avx_glue.c |
561 |
+@@ -66,8 +66,6 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, |
562 |
+ void (*fn)(struct cast5_ctx *ctx, u8 *dst, const u8 *src); |
563 |
+ int err; |
564 |
+ |
565 |
+- fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; |
566 |
+- |
567 |
+ err = blkcipher_walk_virt(desc, walk); |
568 |
+ desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
569 |
+ |
570 |
+@@ -79,6 +77,7 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, |
571 |
+ |
572 |
+ /* Process multi-block batch */ |
573 |
+ if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { |
574 |
++ fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; |
575 |
+ do { |
576 |
+ fn(ctx, wdst, wsrc); |
577 |
+ |
578 |
+diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h |
579 |
+index 2851077b6051..32e666e1231e 100644 |
580 |
+--- a/arch/x86/include/asm/hw_irq.h |
581 |
++++ b/arch/x86/include/asm/hw_irq.h |
582 |
+@@ -36,6 +36,7 @@ extern asmlinkage void kvm_posted_intr_wakeup_ipi(void); |
583 |
+ extern asmlinkage void kvm_posted_intr_nested_ipi(void); |
584 |
+ extern asmlinkage void error_interrupt(void); |
585 |
+ extern asmlinkage void irq_work_interrupt(void); |
586 |
++extern asmlinkage void uv_bau_message_intr1(void); |
587 |
+ |
588 |
+ extern asmlinkage void spurious_interrupt(void); |
589 |
+ extern asmlinkage void thermal_interrupt(void); |
590 |
+diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
591 |
+index 50bee5fe1140..2c3a1b4294eb 100644 |
592 |
+--- a/arch/x86/kernel/idt.c |
593 |
++++ b/arch/x86/kernel/idt.c |
594 |
+@@ -140,6 +140,9 @@ static const __initconst struct idt_data apic_idts[] = { |
595 |
+ # ifdef CONFIG_IRQ_WORK |
596 |
+ INTG(IRQ_WORK_VECTOR, irq_work_interrupt), |
597 |
+ # endif |
598 |
++#ifdef CONFIG_X86_UV |
599 |
++ INTG(UV_BAU_MESSAGE, uv_bau_message_intr1), |
600 |
++#endif |
601 |
+ INTG(SPURIOUS_APIC_VECTOR, spurious_interrupt), |
602 |
+ INTG(ERROR_APIC_VECTOR, error_interrupt), |
603 |
+ #endif |
604 |
+diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c |
605 |
+index 7d5d53f36a7a..0b530c53de1f 100644 |
606 |
+--- a/arch/x86/platform/uv/tlb_uv.c |
607 |
++++ b/arch/x86/platform/uv/tlb_uv.c |
608 |
+@@ -2254,8 +2254,6 @@ static int __init uv_bau_init(void) |
609 |
+ init_uvhub(uvhub, vector, uv_base_pnode); |
610 |
+ } |
611 |
+ |
612 |
+- alloc_intr_gate(vector, uv_bau_message_intr1); |
613 |
+- |
614 |
+ for_each_possible_blade(uvhub) { |
615 |
+ if (uv_blade_nr_possible_cpus(uvhub)) { |
616 |
+ unsigned long val; |
617 |
+diff --git a/block/bio.c b/block/bio.c |
618 |
+index 9ef6cf3addb3..2dd0c1305be5 100644 |
619 |
+--- a/block/bio.c |
620 |
++++ b/block/bio.c |
621 |
+@@ -43,9 +43,9 @@ |
622 |
+ * break badly! cannot be bigger than what you can fit into an |
623 |
+ * unsigned short |
624 |
+ */ |
625 |
+-#define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) } |
626 |
++#define BV(x, n) { .nr_vecs = x, .name = "biovec-"#n } |
627 |
+ static struct biovec_slab bvec_slabs[BVEC_POOL_NR] __read_mostly = { |
628 |
+- BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES), |
629 |
++ BV(1, 1), BV(4, 4), BV(16, 16), BV(64, 64), BV(128, 128), BV(BIO_MAX_PAGES, max), |
630 |
+ }; |
631 |
+ #undef BV |
632 |
+ |
633 |
+diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c |
634 |
+index 0af3a3db6fb0..82c44f7df911 100644 |
635 |
+--- a/block/partitions/msdos.c |
636 |
++++ b/block/partitions/msdos.c |
637 |
+@@ -301,7 +301,9 @@ static void parse_bsd(struct parsed_partitions *state, |
638 |
+ continue; |
639 |
+ bsd_start = le32_to_cpu(p->p_offset); |
640 |
+ bsd_size = le32_to_cpu(p->p_size); |
641 |
+- if (memcmp(flavour, "bsd\0", 4) == 0) |
642 |
++ /* FreeBSD has relative offset if C partition offset is zero */ |
643 |
++ if (memcmp(flavour, "bsd\0", 4) == 0 && |
644 |
++ le32_to_cpu(l->d_partitions[2].p_offset) == 0) |
645 |
+ bsd_start += offset; |
646 |
+ if (offset == bsd_start && size == bsd_size) |
647 |
+ /* full parent partition, we have it already */ |
648 |
+diff --git a/crypto/ahash.c b/crypto/ahash.c |
649 |
+index 266fc1d64f61..c03cc177870b 100644 |
650 |
+--- a/crypto/ahash.c |
651 |
++++ b/crypto/ahash.c |
652 |
+@@ -92,13 +92,14 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) |
653 |
+ |
654 |
+ if (nbytes && walk->offset & alignmask && !err) { |
655 |
+ walk->offset = ALIGN(walk->offset, alignmask + 1); |
656 |
+- walk->data += walk->offset; |
657 |
+- |
658 |
+ nbytes = min(nbytes, |
659 |
+ ((unsigned int)(PAGE_SIZE)) - walk->offset); |
660 |
+ walk->entrylen -= nbytes; |
661 |
+ |
662 |
+- return nbytes; |
663 |
++ if (nbytes) { |
664 |
++ walk->data += walk->offset; |
665 |
++ return nbytes; |
666 |
++ } |
667 |
+ } |
668 |
+ |
669 |
+ if (walk->flags & CRYPTO_ALG_ASYNC) |
670 |
+diff --git a/crypto/lrw.c b/crypto/lrw.c |
671 |
+index cbbd7c50ad19..1d813a6d3fec 100644 |
672 |
+--- a/crypto/lrw.c |
673 |
++++ b/crypto/lrw.c |
674 |
+@@ -313,7 +313,7 @@ static void exit_crypt(struct skcipher_request *req) |
675 |
+ rctx->left = 0; |
676 |
+ |
677 |
+ if (rctx->ext) |
678 |
+- kfree(rctx->ext); |
679 |
++ kzfree(rctx->ext); |
680 |
+ } |
681 |
+ |
682 |
+ static int do_encrypt(struct skcipher_request *req, int err) |
683 |
+diff --git a/crypto/testmgr.h b/crypto/testmgr.h |
684 |
+index a714b6293959..a3cd18476e40 100644 |
685 |
+--- a/crypto/testmgr.h |
686 |
++++ b/crypto/testmgr.h |
687 |
+@@ -548,7 +548,7 @@ static const struct akcipher_testvec rsa_tv_template[] = { |
688 |
+ static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = { |
689 |
+ { |
690 |
+ .key = |
691 |
+- "\x30\x82\x03\x1f\x02\x01\x10\x02\x82\x01\x01\x00\xd7\x1e\x77\x82" |
692 |
++ "\x30\x82\x03\x1f\x02\x01\x00\x02\x82\x01\x01\x00\xd7\x1e\x77\x82" |
693 |
+ "\x8c\x92\x31\xe7\x69\x02\xa2\xd5\x5c\x78\xde\xa2\x0c\x8f\xfe\x28" |
694 |
+ "\x59\x31\xdf\x40\x9c\x60\x61\x06\xb9\x2f\x62\x40\x80\x76\xcb\x67" |
695 |
+ "\x4a\xb5\x59\x56\x69\x17\x07\xfa\xf9\x4c\xbd\x6c\x37\x7a\x46\x7d" |
696 |
+@@ -597,8 +597,8 @@ static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = { |
697 |
+ "\xfe\xf8\x27\x1b\xd6\x55\x60\x5e\x48\xb7\x6d\x9a\xa8\x37\xf9\x7a" |
698 |
+ "\xde\x1b\xcd\x5d\x1a\x30\xd4\xe9\x9e\x5b\x3c\x15\xf8\x9c\x1f\xda" |
699 |
+ "\xd1\x86\x48\x55\xce\x83\xee\x8e\x51\xc7\xde\x32\x12\x47\x7d\x46" |
700 |
+- "\xb8\x35\xdf\x41\x02\x01\x30\x02\x01\x30\x02\x01\x30\x02\x01\x30" |
701 |
+- "\x02\x01\x30", |
702 |
++ "\xb8\x35\xdf\x41\x02\x01\x00\x02\x01\x00\x02\x01\x00\x02\x01\x00" |
703 |
++ "\x02\x01\x00", |
704 |
+ .key_len = 804, |
705 |
+ /* |
706 |
+ * m is SHA256 hash of following message: |
707 |
+diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c |
708 |
+index 4de87b0b53c8..8bfd498d3090 100644 |
709 |
+--- a/drivers/base/arch_topology.c |
710 |
++++ b/drivers/base/arch_topology.c |
711 |
+@@ -175,11 +175,11 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) |
712 |
+ } |
713 |
+ |
714 |
+ #ifdef CONFIG_CPU_FREQ |
715 |
+-static cpumask_var_t cpus_to_visit __initdata; |
716 |
+-static void __init parsing_done_workfn(struct work_struct *work); |
717 |
+-static __initdata DECLARE_WORK(parsing_done_work, parsing_done_workfn); |
718 |
++static cpumask_var_t cpus_to_visit; |
719 |
++static void parsing_done_workfn(struct work_struct *work); |
720 |
++static DECLARE_WORK(parsing_done_work, parsing_done_workfn); |
721 |
+ |
722 |
+-static int __init |
723 |
++static int |
724 |
+ init_cpu_capacity_callback(struct notifier_block *nb, |
725 |
+ unsigned long val, |
726 |
+ void *data) |
727 |
+@@ -215,7 +215,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, |
728 |
+ return 0; |
729 |
+ } |
730 |
+ |
731 |
+-static struct notifier_block init_cpu_capacity_notifier __initdata = { |
732 |
++static struct notifier_block init_cpu_capacity_notifier = { |
733 |
+ .notifier_call = init_cpu_capacity_callback, |
734 |
+ }; |
735 |
+ |
736 |
+@@ -248,7 +248,7 @@ static int __init register_cpufreq_notifier(void) |
737 |
+ } |
738 |
+ core_initcall(register_cpufreq_notifier); |
739 |
+ |
740 |
+-static void __init parsing_done_workfn(struct work_struct *work) |
741 |
++static void parsing_done_workfn(struct work_struct *work) |
742 |
+ { |
743 |
+ cpufreq_unregister_notifier(&init_cpu_capacity_notifier, |
744 |
+ CPUFREQ_POLICY_NOTIFIER); |
745 |
+diff --git a/drivers/char/mem.c b/drivers/char/mem.c |
746 |
+index 052011bcf100..ffeb60d3434c 100644 |
747 |
+--- a/drivers/char/mem.c |
748 |
++++ b/drivers/char/mem.c |
749 |
+@@ -137,7 +137,7 @@ static ssize_t read_mem(struct file *file, char __user *buf, |
750 |
+ |
751 |
+ while (count > 0) { |
752 |
+ unsigned long remaining; |
753 |
+- int allowed; |
754 |
++ int allowed, probe; |
755 |
+ |
756 |
+ sz = size_inside_page(p, count); |
757 |
+ |
758 |
+@@ -160,9 +160,9 @@ static ssize_t read_mem(struct file *file, char __user *buf, |
759 |
+ if (!ptr) |
760 |
+ goto failed; |
761 |
+ |
762 |
+- err = probe_kernel_read(bounce, ptr, sz); |
763 |
++ probe = probe_kernel_read(bounce, ptr, sz); |
764 |
+ unxlate_dev_mem_ptr(p, ptr); |
765 |
+- if (err) |
766 |
++ if (probe) |
767 |
+ goto failed; |
768 |
+ |
769 |
+ remaining = copy_to_user(buf, bounce, sz); |
770 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
771 |
+index d6a3038a128d..41d148af7748 100644 |
772 |
+--- a/drivers/cpufreq/cpufreq.c |
773 |
++++ b/drivers/cpufreq/cpufreq.c |
774 |
+@@ -637,8 +637,6 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, |
775 |
+ *governor = t; |
776 |
+ err = 0; |
777 |
+ } |
778 |
+- if (t && !try_module_get(t->owner)) |
779 |
+- t = NULL; |
780 |
+ |
781 |
+ mutex_unlock(&cpufreq_governor_mutex); |
782 |
+ } |
783 |
+@@ -767,10 +765,6 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, |
784 |
+ return -EINVAL; |
785 |
+ |
786 |
+ ret = cpufreq_set_policy(policy, &new_policy); |
787 |
+- |
788 |
+- if (new_policy.governor) |
789 |
+- module_put(new_policy.governor->owner); |
790 |
+- |
791 |
+ return ret ? ret : count; |
792 |
+ } |
793 |
+ |
794 |
+diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c |
795 |
+index e1d4ae1153c4..39f70411f28f 100644 |
796 |
+--- a/drivers/crypto/caam/ctrl.c |
797 |
++++ b/drivers/crypto/caam/ctrl.c |
798 |
+@@ -813,9 +813,6 @@ static int caam_probe(struct platform_device *pdev) |
799 |
+ return 0; |
800 |
+ |
801 |
+ caam_remove: |
802 |
+-#ifdef CONFIG_DEBUG_FS |
803 |
+- debugfs_remove_recursive(ctrlpriv->dfs_root); |
804 |
+-#endif |
805 |
+ caam_remove(pdev); |
806 |
+ return ret; |
807 |
+ |
808 |
+diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c |
809 |
+index e6db8672d89c..05850dfd7940 100644 |
810 |
+--- a/drivers/crypto/ccp/ccp-crypto-rsa.c |
811 |
++++ b/drivers/crypto/ccp/ccp-crypto-rsa.c |
812 |
+@@ -60,10 +60,9 @@ static int ccp_rsa_complete(struct crypto_async_request *async_req, int ret) |
813 |
+ |
814 |
+ static unsigned int ccp_rsa_maxsize(struct crypto_akcipher *tfm) |
815 |
+ { |
816 |
+- if (ccp_version() > CCP_VERSION(3, 0)) |
817 |
+- return CCP5_RSA_MAXMOD; |
818 |
+- else |
819 |
+- return CCP_RSA_MAXMOD; |
820 |
++ struct ccp_ctx *ctx = akcipher_tfm_ctx(tfm); |
821 |
++ |
822 |
++ return ctx->u.rsa.n_len; |
823 |
+ } |
824 |
+ |
825 |
+ static int ccp_rsa_crypt(struct akcipher_request *req, bool encrypt) |
826 |
+diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c |
827 |
+index 4bcef78a08aa..d4c81cb73bee 100644 |
828 |
+--- a/drivers/crypto/inside-secure/safexcel.c |
829 |
++++ b/drivers/crypto/inside-secure/safexcel.c |
830 |
+@@ -789,7 +789,7 @@ static int safexcel_probe(struct platform_device *pdev) |
831 |
+ return PTR_ERR(priv->base); |
832 |
+ } |
833 |
+ |
834 |
+- priv->clk = of_clk_get(dev->of_node, 0); |
835 |
++ priv->clk = devm_clk_get(&pdev->dev, NULL); |
836 |
+ if (!IS_ERR(priv->clk)) { |
837 |
+ ret = clk_prepare_enable(priv->clk); |
838 |
+ if (ret) { |
839 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
840 |
+index 6882fa2f8bad..c805d0122c0b 100644 |
841 |
+--- a/drivers/crypto/talitos.c |
842 |
++++ b/drivers/crypto/talitos.c |
843 |
+@@ -832,8 +832,6 @@ struct talitos_ctx { |
844 |
+ unsigned int keylen; |
845 |
+ unsigned int enckeylen; |
846 |
+ unsigned int authkeylen; |
847 |
+- dma_addr_t dma_buf; |
848 |
+- dma_addr_t dma_hw_context; |
849 |
+ }; |
850 |
+ |
851 |
+ #define HASH_MAX_BLOCK_SIZE SHA512_BLOCK_SIZE |
852 |
+@@ -1130,10 +1128,10 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count, |
853 |
+ return count; |
854 |
+ } |
855 |
+ |
856 |
+-static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
857 |
+- unsigned int len, struct talitos_edesc *edesc, |
858 |
+- struct talitos_ptr *ptr, |
859 |
+- int sg_count, unsigned int offset, int tbl_off) |
860 |
++static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src, |
861 |
++ unsigned int len, struct talitos_edesc *edesc, |
862 |
++ struct talitos_ptr *ptr, int sg_count, |
863 |
++ unsigned int offset, int tbl_off, int elen) |
864 |
+ { |
865 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
866 |
+ bool is_sec1 = has_ftr_sec1(priv); |
867 |
+@@ -1142,6 +1140,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
868 |
+ to_talitos_ptr(ptr, 0, 0, is_sec1); |
869 |
+ return 1; |
870 |
+ } |
871 |
++ to_talitos_ptr_ext_set(ptr, elen, is_sec1); |
872 |
+ if (sg_count == 1) { |
873 |
+ to_talitos_ptr(ptr, sg_dma_address(src) + offset, len, is_sec1); |
874 |
+ return sg_count; |
875 |
+@@ -1150,7 +1149,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
876 |
+ to_talitos_ptr(ptr, edesc->dma_link_tbl + offset, len, is_sec1); |
877 |
+ return sg_count; |
878 |
+ } |
879 |
+- sg_count = sg_to_link_tbl_offset(src, sg_count, offset, len, |
880 |
++ sg_count = sg_to_link_tbl_offset(src, sg_count, offset, len + elen, |
881 |
+ &edesc->link_tbl[tbl_off]); |
882 |
+ if (sg_count == 1) { |
883 |
+ /* Only one segment now, so no link tbl needed*/ |
884 |
+@@ -1164,6 +1163,15 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
885 |
+ return sg_count; |
886 |
+ } |
887 |
+ |
888 |
++static int talitos_sg_map(struct device *dev, struct scatterlist *src, |
889 |
++ unsigned int len, struct talitos_edesc *edesc, |
890 |
++ struct talitos_ptr *ptr, int sg_count, |
891 |
++ unsigned int offset, int tbl_off) |
892 |
++{ |
893 |
++ return talitos_sg_map_ext(dev, src, len, edesc, ptr, sg_count, offset, |
894 |
++ tbl_off, 0); |
895 |
++} |
896 |
++ |
897 |
+ /* |
898 |
+ * fill in and submit ipsec_esp descriptor |
899 |
+ */ |
900 |
+@@ -1181,7 +1189,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
901 |
+ unsigned int ivsize = crypto_aead_ivsize(aead); |
902 |
+ int tbl_off = 0; |
903 |
+ int sg_count, ret; |
904 |
+- int sg_link_tbl_len; |
905 |
++ int elen = 0; |
906 |
+ bool sync_needed = false; |
907 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
908 |
+ bool is_sec1 = has_ftr_sec1(priv); |
909 |
+@@ -1223,17 +1231,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
910 |
+ * extent is bytes of HMAC postpended to ciphertext, |
911 |
+ * typically 12 for ipsec |
912 |
+ */ |
913 |
+- sg_link_tbl_len = cryptlen; |
914 |
+- |
915 |
+- if (is_ipsec_esp) { |
916 |
+- to_talitos_ptr_ext_set(&desc->ptr[4], authsize, is_sec1); |
917 |
+- |
918 |
+- if (desc->hdr & DESC_HDR_MODE1_MDEU_CICV) |
919 |
+- sg_link_tbl_len += authsize; |
920 |
+- } |
921 |
++ if (is_ipsec_esp && (desc->hdr & DESC_HDR_MODE1_MDEU_CICV)) |
922 |
++ elen = authsize; |
923 |
+ |
924 |
+- ret = talitos_sg_map(dev, areq->src, sg_link_tbl_len, edesc, |
925 |
+- &desc->ptr[4], sg_count, areq->assoclen, tbl_off); |
926 |
++ ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4], |
927 |
++ sg_count, areq->assoclen, tbl_off, elen); |
928 |
+ |
929 |
+ if (ret > 1) { |
930 |
+ tbl_off += ret; |
931 |
+@@ -1690,9 +1692,30 @@ static void common_nonsnoop_hash_unmap(struct device *dev, |
932 |
+ struct ahash_request *areq) |
933 |
+ { |
934 |
+ struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
935 |
++ struct talitos_private *priv = dev_get_drvdata(dev); |
936 |
++ bool is_sec1 = has_ftr_sec1(priv); |
937 |
++ struct talitos_desc *desc = &edesc->desc; |
938 |
++ struct talitos_desc *desc2 = desc + 1; |
939 |
++ |
940 |
++ unmap_single_talitos_ptr(dev, &edesc->desc.ptr[5], DMA_FROM_DEVICE); |
941 |
++ if (desc->next_desc && |
942 |
++ desc->ptr[5].ptr != desc2->ptr[5].ptr) |
943 |
++ unmap_single_talitos_ptr(dev, &desc2->ptr[5], DMA_FROM_DEVICE); |
944 |
+ |
945 |
+ talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL, 0, 0); |
946 |
+ |
947 |
++ /* When using hashctx-in, must unmap it. */ |
948 |
++ if (from_talitos_ptr_len(&edesc->desc.ptr[1], is_sec1)) |
949 |
++ unmap_single_talitos_ptr(dev, &edesc->desc.ptr[1], |
950 |
++ DMA_TO_DEVICE); |
951 |
++ else if (desc->next_desc) |
952 |
++ unmap_single_talitos_ptr(dev, &desc2->ptr[1], |
953 |
++ DMA_TO_DEVICE); |
954 |
++ |
955 |
++ if (is_sec1 && req_ctx->nbuf) |
956 |
++ unmap_single_talitos_ptr(dev, &desc->ptr[3], |
957 |
++ DMA_TO_DEVICE); |
958 |
++ |
959 |
+ if (edesc->dma_len) |
960 |
+ dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len, |
961 |
+ DMA_BIDIRECTIONAL); |
962 |
+@@ -1766,8 +1789,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
963 |
+ |
964 |
+ /* hash context in */ |
965 |
+ if (!req_ctx->first || req_ctx->swinit) { |
966 |
+- to_talitos_ptr(&desc->ptr[1], ctx->dma_hw_context, |
967 |
+- req_ctx->hw_context_size, is_sec1); |
968 |
++ map_single_talitos_ptr(dev, &desc->ptr[1], |
969 |
++ req_ctx->hw_context_size, |
970 |
++ (char *)req_ctx->hw_context, |
971 |
++ DMA_TO_DEVICE); |
972 |
+ req_ctx->swinit = 0; |
973 |
+ } |
974 |
+ /* Indicate next op is not the first. */ |
975 |
+@@ -1793,10 +1818,9 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
976 |
+ * data in |
977 |
+ */ |
978 |
+ if (is_sec1 && req_ctx->nbuf) { |
979 |
+- dma_addr_t dma_buf = ctx->dma_buf + req_ctx->buf_idx * |
980 |
+- HASH_MAX_BLOCK_SIZE; |
981 |
+- |
982 |
+- to_talitos_ptr(&desc->ptr[3], dma_buf, req_ctx->nbuf, is_sec1); |
983 |
++ map_single_talitos_ptr(dev, &desc->ptr[3], req_ctx->nbuf, |
984 |
++ req_ctx->buf[req_ctx->buf_idx], |
985 |
++ DMA_TO_DEVICE); |
986 |
+ } else { |
987 |
+ sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc, |
988 |
+ &desc->ptr[3], sg_count, offset, 0); |
989 |
+@@ -1812,8 +1836,9 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
990 |
+ crypto_ahash_digestsize(tfm), |
991 |
+ areq->result, DMA_FROM_DEVICE); |
992 |
+ else |
993 |
+- to_talitos_ptr(&desc->ptr[5], ctx->dma_hw_context, |
994 |
+- req_ctx->hw_context_size, is_sec1); |
995 |
++ map_single_talitos_ptr(dev, &desc->ptr[5], |
996 |
++ req_ctx->hw_context_size, |
997 |
++ req_ctx->hw_context, DMA_FROM_DEVICE); |
998 |
+ |
999 |
+ /* last DWORD empty */ |
1000 |
+ |
1001 |
+@@ -1832,9 +1857,14 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
1002 |
+ desc->hdr |= DESC_HDR_MODE0_MDEU_CONT; |
1003 |
+ desc->hdr &= ~DESC_HDR_DONE_NOTIFY; |
1004 |
+ |
1005 |
+- to_talitos_ptr(&desc2->ptr[1], ctx->dma_hw_context, |
1006 |
+- req_ctx->hw_context_size, is_sec1); |
1007 |
+- |
1008 |
++ if (desc->ptr[1].ptr) |
1009 |
++ copy_talitos_ptr(&desc2->ptr[1], &desc->ptr[1], |
1010 |
++ is_sec1); |
1011 |
++ else |
1012 |
++ map_single_talitos_ptr(dev, &desc2->ptr[1], |
1013 |
++ req_ctx->hw_context_size, |
1014 |
++ req_ctx->hw_context, |
1015 |
++ DMA_TO_DEVICE); |
1016 |
+ copy_talitos_ptr(&desc2->ptr[2], &desc->ptr[2], is_sec1); |
1017 |
+ sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc, |
1018 |
+ &desc2->ptr[3], sg_count, offset, 0); |
1019 |
+@@ -1842,8 +1872,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
1020 |
+ sync_needed = true; |
1021 |
+ copy_talitos_ptr(&desc2->ptr[5], &desc->ptr[5], is_sec1); |
1022 |
+ if (req_ctx->last) |
1023 |
+- to_talitos_ptr(&desc->ptr[5], ctx->dma_hw_context, |
1024 |
+- req_ctx->hw_context_size, is_sec1); |
1025 |
++ map_single_talitos_ptr(dev, &desc->ptr[5], |
1026 |
++ req_ctx->hw_context_size, |
1027 |
++ req_ctx->hw_context, |
1028 |
++ DMA_FROM_DEVICE); |
1029 |
+ |
1030 |
+ next_desc = dma_map_single(dev, &desc2->hdr1, TALITOS_DESC_SIZE, |
1031 |
+ DMA_BIDIRECTIONAL); |
1032 |
+@@ -1881,12 +1913,8 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, |
1033 |
+ static int ahash_init(struct ahash_request *areq) |
1034 |
+ { |
1035 |
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); |
1036 |
+- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm); |
1037 |
+- struct device *dev = ctx->dev; |
1038 |
+ struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
1039 |
+ unsigned int size; |
1040 |
+- struct talitos_private *priv = dev_get_drvdata(dev); |
1041 |
+- bool is_sec1 = has_ftr_sec1(priv); |
1042 |
+ |
1043 |
+ /* Initialize the context */ |
1044 |
+ req_ctx->buf_idx = 0; |
1045 |
+@@ -1898,18 +1926,6 @@ static int ahash_init(struct ahash_request *areq) |
1046 |
+ : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512; |
1047 |
+ req_ctx->hw_context_size = size; |
1048 |
+ |
1049 |
+- if (ctx->dma_hw_context) |
1050 |
+- dma_unmap_single(dev, ctx->dma_hw_context, size, |
1051 |
+- DMA_BIDIRECTIONAL); |
1052 |
+- ctx->dma_hw_context = dma_map_single(dev, req_ctx->hw_context, size, |
1053 |
+- DMA_BIDIRECTIONAL); |
1054 |
+- if (ctx->dma_buf) |
1055 |
+- dma_unmap_single(dev, ctx->dma_buf, sizeof(req_ctx->buf), |
1056 |
+- DMA_TO_DEVICE); |
1057 |
+- if (is_sec1) |
1058 |
+- ctx->dma_buf = dma_map_single(dev, req_ctx->buf, |
1059 |
+- sizeof(req_ctx->buf), |
1060 |
+- DMA_TO_DEVICE); |
1061 |
+ return 0; |
1062 |
+ } |
1063 |
+ |
1064 |
+@@ -1920,9 +1936,6 @@ static int ahash_init(struct ahash_request *areq) |
1065 |
+ static int ahash_init_sha224_swinit(struct ahash_request *areq) |
1066 |
+ { |
1067 |
+ struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
1068 |
+- struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); |
1069 |
+- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm); |
1070 |
+- struct device *dev = ctx->dev; |
1071 |
+ |
1072 |
+ ahash_init(areq); |
1073 |
+ req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/ |
1074 |
+@@ -1940,9 +1953,6 @@ static int ahash_init_sha224_swinit(struct ahash_request *areq) |
1075 |
+ req_ctx->hw_context[8] = 0; |
1076 |
+ req_ctx->hw_context[9] = 0; |
1077 |
+ |
1078 |
+- dma_sync_single_for_device(dev, ctx->dma_hw_context, |
1079 |
+- req_ctx->hw_context_size, DMA_TO_DEVICE); |
1080 |
+- |
1081 |
+ return 0; |
1082 |
+ } |
1083 |
+ |
1084 |
+@@ -2046,13 +2056,6 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) |
1085 |
+ /* request SEC to INIT hash. */ |
1086 |
+ if (req_ctx->first && !req_ctx->swinit) |
1087 |
+ edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_INIT; |
1088 |
+- if (is_sec1) { |
1089 |
+- dma_addr_t dma_buf = ctx->dma_buf + req_ctx->buf_idx * |
1090 |
+- HASH_MAX_BLOCK_SIZE; |
1091 |
+- |
1092 |
+- dma_sync_single_for_device(dev, dma_buf, |
1093 |
+- req_ctx->nbuf, DMA_TO_DEVICE); |
1094 |
+- } |
1095 |
+ |
1096 |
+ /* When the tfm context has a keylen, it's an HMAC. |
1097 |
+ * A first or last (ie. not middle) descriptor must request HMAC. |
1098 |
+@@ -2106,12 +2109,7 @@ static int ahash_export(struct ahash_request *areq, void *out) |
1099 |
+ { |
1100 |
+ struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
1101 |
+ struct talitos_export_state *export = out; |
1102 |
+- struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); |
1103 |
+- struct talitos_ctx *ctx = crypto_ahash_ctx(ahash); |
1104 |
+- struct device *dev = ctx->dev; |
1105 |
+ |
1106 |
+- dma_sync_single_for_cpu(dev, ctx->dma_hw_context, |
1107 |
+- req_ctx->hw_context_size, DMA_FROM_DEVICE); |
1108 |
+ memcpy(export->hw_context, req_ctx->hw_context, |
1109 |
+ req_ctx->hw_context_size); |
1110 |
+ memcpy(export->buf, req_ctx->buf[req_ctx->buf_idx], req_ctx->nbuf); |
1111 |
+@@ -2130,31 +2128,14 @@ static int ahash_import(struct ahash_request *areq, const void *in) |
1112 |
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); |
1113 |
+ const struct talitos_export_state *export = in; |
1114 |
+ unsigned int size; |
1115 |
+- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm); |
1116 |
+- struct device *dev = ctx->dev; |
1117 |
+- struct talitos_private *priv = dev_get_drvdata(dev); |
1118 |
+- bool is_sec1 = has_ftr_sec1(priv); |
1119 |
+ |
1120 |
+ memset(req_ctx, 0, sizeof(*req_ctx)); |
1121 |
+ size = (crypto_ahash_digestsize(tfm) <= SHA256_DIGEST_SIZE) |
1122 |
+ ? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 |
1123 |
+ : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512; |
1124 |
+ req_ctx->hw_context_size = size; |
1125 |
+- if (ctx->dma_hw_context) |
1126 |
+- dma_unmap_single(dev, ctx->dma_hw_context, size, |
1127 |
+- DMA_BIDIRECTIONAL); |
1128 |
+- |
1129 |
+ memcpy(req_ctx->hw_context, export->hw_context, size); |
1130 |
+- ctx->dma_hw_context = dma_map_single(dev, req_ctx->hw_context, size, |
1131 |
+- DMA_BIDIRECTIONAL); |
1132 |
+- if (ctx->dma_buf) |
1133 |
+- dma_unmap_single(dev, ctx->dma_buf, sizeof(req_ctx->buf), |
1134 |
+- DMA_TO_DEVICE); |
1135 |
+ memcpy(req_ctx->buf[0], export->buf, export->nbuf); |
1136 |
+- if (is_sec1) |
1137 |
+- ctx->dma_buf = dma_map_single(dev, req_ctx->buf, |
1138 |
+- sizeof(req_ctx->buf), |
1139 |
+- DMA_TO_DEVICE); |
1140 |
+ req_ctx->swinit = export->swinit; |
1141 |
+ req_ctx->first = export->first; |
1142 |
+ req_ctx->last = export->last; |
1143 |
+@@ -3064,27 +3045,6 @@ static void talitos_cra_exit(struct crypto_tfm *tfm) |
1144 |
+ dma_unmap_single(dev, ctx->dma_key, ctx->keylen, DMA_TO_DEVICE); |
1145 |
+ } |
1146 |
+ |
1147 |
+-static void talitos_cra_exit_ahash(struct crypto_tfm *tfm) |
1148 |
+-{ |
1149 |
+- struct talitos_ctx *ctx = crypto_tfm_ctx(tfm); |
1150 |
+- struct device *dev = ctx->dev; |
1151 |
+- unsigned int size; |
1152 |
+- |
1153 |
+- talitos_cra_exit(tfm); |
1154 |
+- |
1155 |
+- size = (crypto_ahash_digestsize(__crypto_ahash_cast(tfm)) <= |
1156 |
+- SHA256_DIGEST_SIZE) |
1157 |
+- ? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 |
1158 |
+- : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512; |
1159 |
+- |
1160 |
+- if (ctx->dma_hw_context) |
1161 |
+- dma_unmap_single(dev, ctx->dma_hw_context, size, |
1162 |
+- DMA_BIDIRECTIONAL); |
1163 |
+- if (ctx->dma_buf) |
1164 |
+- dma_unmap_single(dev, ctx->dma_buf, HASH_MAX_BLOCK_SIZE * 2, |
1165 |
+- DMA_TO_DEVICE); |
1166 |
+-} |
1167 |
+- |
1168 |
+ /* |
1169 |
+ * given the alg's descriptor header template, determine whether descriptor |
1170 |
+ * type and primary/secondary execution units required match the hw |
1171 |
+@@ -3183,7 +3143,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, |
1172 |
+ case CRYPTO_ALG_TYPE_AHASH: |
1173 |
+ alg = &t_alg->algt.alg.hash.halg.base; |
1174 |
+ alg->cra_init = talitos_cra_init_ahash; |
1175 |
+- alg->cra_exit = talitos_cra_exit_ahash; |
1176 |
++ alg->cra_exit = talitos_cra_exit; |
1177 |
+ alg->cra_type = &crypto_ahash_type; |
1178 |
+ t_alg->algt.alg.hash.init = ahash_init; |
1179 |
+ t_alg->algt.alg.hash.update = ahash_update; |
1180 |
+diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
1181 |
+index 58a3755544b2..38e53d6b8127 100644 |
1182 |
+--- a/drivers/gpu/drm/i915/intel_ddi.c |
1183 |
++++ b/drivers/gpu/drm/i915/intel_ddi.c |
1184 |
+@@ -2208,8 +2208,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, |
1185 |
+ intel_prepare_dp_ddi_buffers(encoder); |
1186 |
+ |
1187 |
+ intel_ddi_init_dp_buf_reg(encoder); |
1188 |
+- if (!is_mst) |
1189 |
+- intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); |
1190 |
++ intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); |
1191 |
+ intel_dp_start_link_train(intel_dp); |
1192 |
+ if (port != PORT_A || INTEL_GEN(dev_priv) >= 9) |
1193 |
+ intel_dp_stop_link_train(intel_dp); |
1194 |
+@@ -2294,19 +2293,12 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder, |
1195 |
+ struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
1196 |
+ struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); |
1197 |
+ struct intel_dp *intel_dp = &dig_port->dp; |
1198 |
+- /* |
1199 |
+- * old_crtc_state and old_conn_state are NULL when called from |
1200 |
+- * DP_MST. The main connector associated with this port is never |
1201 |
+- * bound to a crtc for MST. |
1202 |
+- */ |
1203 |
+- bool is_mst = !old_crtc_state; |
1204 |
+ |
1205 |
+ /* |
1206 |
+ * Power down sink before disabling the port, otherwise we end |
1207 |
+ * up getting interrupts from the sink on detecting link loss. |
1208 |
+ */ |
1209 |
+- if (!is_mst) |
1210 |
+- intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); |
1211 |
++ intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); |
1212 |
+ |
1213 |
+ intel_disable_ddi_buf(encoder); |
1214 |
+ |
1215 |
+diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c |
1216 |
+index b445b3bb0bb1..f273e28c39db 100644 |
1217 |
+--- a/drivers/i2c/busses/i2c-stm32f7.c |
1218 |
++++ b/drivers/i2c/busses/i2c-stm32f7.c |
1219 |
+@@ -888,6 +888,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) |
1220 |
+ } |
1221 |
+ |
1222 |
+ setup = of_device_get_match_data(&pdev->dev); |
1223 |
++ if (!setup) { |
1224 |
++ dev_err(&pdev->dev, "Can't get device data\n"); |
1225 |
++ ret = -ENODEV; |
1226 |
++ goto clk_free; |
1227 |
++ } |
1228 |
+ i2c_dev->setup = *setup; |
1229 |
+ |
1230 |
+ ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns", |
1231 |
+diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c |
1232 |
+index f4e8185bccd3..0885b8cfbe0b 100644 |
1233 |
+--- a/drivers/infiniband/core/addr.c |
1234 |
++++ b/drivers/infiniband/core/addr.c |
1235 |
+@@ -207,6 +207,22 @@ int rdma_addr_size(struct sockaddr *addr) |
1236 |
+ } |
1237 |
+ EXPORT_SYMBOL(rdma_addr_size); |
1238 |
+ |
1239 |
++int rdma_addr_size_in6(struct sockaddr_in6 *addr) |
1240 |
++{ |
1241 |
++ int ret = rdma_addr_size((struct sockaddr *) addr); |
1242 |
++ |
1243 |
++ return ret <= sizeof(*addr) ? ret : 0; |
1244 |
++} |
1245 |
++EXPORT_SYMBOL(rdma_addr_size_in6); |
1246 |
++ |
1247 |
++int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr) |
1248 |
++{ |
1249 |
++ int ret = rdma_addr_size((struct sockaddr *) addr); |
1250 |
++ |
1251 |
++ return ret <= sizeof(*addr) ? ret : 0; |
1252 |
++} |
1253 |
++EXPORT_SYMBOL(rdma_addr_size_kss); |
1254 |
++ |
1255 |
+ static struct rdma_addr_client self; |
1256 |
+ |
1257 |
+ void rdma_addr_register_client(struct rdma_addr_client *client) |
1258 |
+@@ -598,6 +614,15 @@ static void process_one_req(struct work_struct *_work) |
1259 |
+ list_del(&req->list); |
1260 |
+ mutex_unlock(&lock); |
1261 |
+ |
1262 |
++ /* |
1263 |
++ * Although the work will normally have been canceled by the |
1264 |
++ * workqueue, it can still be requeued as long as it is on the |
1265 |
++ * req_list, so it could have been requeued before we grabbed &lock. |
1266 |
++ * We need to cancel it after it is removed from req_list to really be |
1267 |
++ * sure it is safe to free. |
1268 |
++ */ |
1269 |
++ cancel_delayed_work(&req->work); |
1270 |
++ |
1271 |
+ req->callback(req->status, (struct sockaddr *)&req->src_addr, |
1272 |
+ req->addr, req->context); |
1273 |
+ put_client(req->client); |
1274 |
+diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
1275 |
+index 77ca9da570a2..722235bed075 100644 |
1276 |
+--- a/drivers/infiniband/core/ucma.c |
1277 |
++++ b/drivers/infiniband/core/ucma.c |
1278 |
+@@ -132,7 +132,7 @@ static inline struct ucma_context *_ucma_find_context(int id, |
1279 |
+ ctx = idr_find(&ctx_idr, id); |
1280 |
+ if (!ctx) |
1281 |
+ ctx = ERR_PTR(-ENOENT); |
1282 |
+- else if (ctx->file != file) |
1283 |
++ else if (ctx->file != file || !ctx->cm_id) |
1284 |
+ ctx = ERR_PTR(-EINVAL); |
1285 |
+ return ctx; |
1286 |
+ } |
1287 |
+@@ -456,6 +456,7 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
1288 |
+ struct rdma_ucm_create_id cmd; |
1289 |
+ struct rdma_ucm_create_id_resp resp; |
1290 |
+ struct ucma_context *ctx; |
1291 |
++ struct rdma_cm_id *cm_id; |
1292 |
+ enum ib_qp_type qp_type; |
1293 |
+ int ret; |
1294 |
+ |
1295 |
+@@ -476,10 +477,10 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
1296 |
+ return -ENOMEM; |
1297 |
+ |
1298 |
+ ctx->uid = cmd.uid; |
1299 |
+- ctx->cm_id = rdma_create_id(current->nsproxy->net_ns, |
1300 |
+- ucma_event_handler, ctx, cmd.ps, qp_type); |
1301 |
+- if (IS_ERR(ctx->cm_id)) { |
1302 |
+- ret = PTR_ERR(ctx->cm_id); |
1303 |
++ cm_id = rdma_create_id(current->nsproxy->net_ns, |
1304 |
++ ucma_event_handler, ctx, cmd.ps, qp_type); |
1305 |
++ if (IS_ERR(cm_id)) { |
1306 |
++ ret = PTR_ERR(cm_id); |
1307 |
+ goto err1; |
1308 |
+ } |
1309 |
+ |
1310 |
+@@ -489,14 +490,19 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
1311 |
+ ret = -EFAULT; |
1312 |
+ goto err2; |
1313 |
+ } |
1314 |
++ |
1315 |
++ ctx->cm_id = cm_id; |
1316 |
+ return 0; |
1317 |
+ |
1318 |
+ err2: |
1319 |
+- rdma_destroy_id(ctx->cm_id); |
1320 |
++ rdma_destroy_id(cm_id); |
1321 |
+ err1: |
1322 |
+ mutex_lock(&mut); |
1323 |
+ idr_remove(&ctx_idr, ctx->id); |
1324 |
+ mutex_unlock(&mut); |
1325 |
++ mutex_lock(&file->mut); |
1326 |
++ list_del(&ctx->list); |
1327 |
++ mutex_unlock(&file->mut); |
1328 |
+ kfree(ctx); |
1329 |
+ return ret; |
1330 |
+ } |
1331 |
+@@ -626,6 +632,9 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf, |
1332 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1333 |
+ return -EFAULT; |
1334 |
+ |
1335 |
++ if (!rdma_addr_size_in6(&cmd.addr)) |
1336 |
++ return -EINVAL; |
1337 |
++ |
1338 |
+ ctx = ucma_get_ctx(file, cmd.id); |
1339 |
+ if (IS_ERR(ctx)) |
1340 |
+ return PTR_ERR(ctx); |
1341 |
+@@ -639,22 +648,21 @@ static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf, |
1342 |
+ int in_len, int out_len) |
1343 |
+ { |
1344 |
+ struct rdma_ucm_bind cmd; |
1345 |
+- struct sockaddr *addr; |
1346 |
+ struct ucma_context *ctx; |
1347 |
+ int ret; |
1348 |
+ |
1349 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1350 |
+ return -EFAULT; |
1351 |
+ |
1352 |
+- addr = (struct sockaddr *) &cmd.addr; |
1353 |
+- if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr))) |
1354 |
++ if (cmd.reserved || !cmd.addr_size || |
1355 |
++ cmd.addr_size != rdma_addr_size_kss(&cmd.addr)) |
1356 |
+ return -EINVAL; |
1357 |
+ |
1358 |
+ ctx = ucma_get_ctx(file, cmd.id); |
1359 |
+ if (IS_ERR(ctx)) |
1360 |
+ return PTR_ERR(ctx); |
1361 |
+ |
1362 |
+- ret = rdma_bind_addr(ctx->cm_id, addr); |
1363 |
++ ret = rdma_bind_addr(ctx->cm_id, (struct sockaddr *) &cmd.addr); |
1364 |
+ ucma_put_ctx(ctx); |
1365 |
+ return ret; |
1366 |
+ } |
1367 |
+@@ -670,13 +678,16 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file, |
1368 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1369 |
+ return -EFAULT; |
1370 |
+ |
1371 |
++ if (!rdma_addr_size_in6(&cmd.src_addr) || |
1372 |
++ !rdma_addr_size_in6(&cmd.dst_addr)) |
1373 |
++ return -EINVAL; |
1374 |
++ |
1375 |
+ ctx = ucma_get_ctx(file, cmd.id); |
1376 |
+ if (IS_ERR(ctx)) |
1377 |
+ return PTR_ERR(ctx); |
1378 |
+ |
1379 |
+ ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, |
1380 |
+- (struct sockaddr *) &cmd.dst_addr, |
1381 |
+- cmd.timeout_ms); |
1382 |
++ (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); |
1383 |
+ ucma_put_ctx(ctx); |
1384 |
+ return ret; |
1385 |
+ } |
1386 |
+@@ -686,24 +697,23 @@ static ssize_t ucma_resolve_addr(struct ucma_file *file, |
1387 |
+ int in_len, int out_len) |
1388 |
+ { |
1389 |
+ struct rdma_ucm_resolve_addr cmd; |
1390 |
+- struct sockaddr *src, *dst; |
1391 |
+ struct ucma_context *ctx; |
1392 |
+ int ret; |
1393 |
+ |
1394 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1395 |
+ return -EFAULT; |
1396 |
+ |
1397 |
+- src = (struct sockaddr *) &cmd.src_addr; |
1398 |
+- dst = (struct sockaddr *) &cmd.dst_addr; |
1399 |
+- if (cmd.reserved || (cmd.src_size && (cmd.src_size != rdma_addr_size(src))) || |
1400 |
+- !cmd.dst_size || (cmd.dst_size != rdma_addr_size(dst))) |
1401 |
++ if (cmd.reserved || |
1402 |
++ (cmd.src_size && (cmd.src_size != rdma_addr_size_kss(&cmd.src_addr))) || |
1403 |
++ !cmd.dst_size || (cmd.dst_size != rdma_addr_size_kss(&cmd.dst_addr))) |
1404 |
+ return -EINVAL; |
1405 |
+ |
1406 |
+ ctx = ucma_get_ctx(file, cmd.id); |
1407 |
+ if (IS_ERR(ctx)) |
1408 |
+ return PTR_ERR(ctx); |
1409 |
+ |
1410 |
+- ret = rdma_resolve_addr(ctx->cm_id, src, dst, cmd.timeout_ms); |
1411 |
++ ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, |
1412 |
++ (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); |
1413 |
+ ucma_put_ctx(ctx); |
1414 |
+ return ret; |
1415 |
+ } |
1416 |
+@@ -1155,6 +1165,11 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file, |
1417 |
+ if (IS_ERR(ctx)) |
1418 |
+ return PTR_ERR(ctx); |
1419 |
+ |
1420 |
++ if (!ctx->cm_id->device) { |
1421 |
++ ret = -EINVAL; |
1422 |
++ goto out; |
1423 |
++ } |
1424 |
++ |
1425 |
+ resp.qp_attr_mask = 0; |
1426 |
+ memset(&qp_attr, 0, sizeof qp_attr); |
1427 |
+ qp_attr.qp_state = cmd.qp_state; |
1428 |
+@@ -1320,7 +1335,7 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, |
1429 |
+ { |
1430 |
+ struct rdma_ucm_notify cmd; |
1431 |
+ struct ucma_context *ctx; |
1432 |
+- int ret; |
1433 |
++ int ret = -EINVAL; |
1434 |
+ |
1435 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1436 |
+ return -EFAULT; |
1437 |
+@@ -1329,7 +1344,9 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, |
1438 |
+ if (IS_ERR(ctx)) |
1439 |
+ return PTR_ERR(ctx); |
1440 |
+ |
1441 |
+- ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event); |
1442 |
++ if (ctx->cm_id->device) |
1443 |
++ ret = rdma_notify(ctx->cm_id, (enum ib_event_type)cmd.event); |
1444 |
++ |
1445 |
+ ucma_put_ctx(ctx); |
1446 |
+ return ret; |
1447 |
+ } |
1448 |
+@@ -1415,7 +1432,7 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file, |
1449 |
+ join_cmd.response = cmd.response; |
1450 |
+ join_cmd.uid = cmd.uid; |
1451 |
+ join_cmd.id = cmd.id; |
1452 |
+- join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr); |
1453 |
++ join_cmd.addr_size = rdma_addr_size_in6(&cmd.addr); |
1454 |
+ if (!join_cmd.addr_size) |
1455 |
+ return -EINVAL; |
1456 |
+ |
1457 |
+@@ -1434,7 +1451,7 @@ static ssize_t ucma_join_multicast(struct ucma_file *file, |
1458 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1459 |
+ return -EFAULT; |
1460 |
+ |
1461 |
+- if (!rdma_addr_size((struct sockaddr *)&cmd.addr)) |
1462 |
++ if (!rdma_addr_size_kss(&cmd.addr)) |
1463 |
+ return -EINVAL; |
1464 |
+ |
1465 |
+ return ucma_process_join(file, &cmd, out_len); |
1466 |
+diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c |
1467 |
+index dbe57da8c1a1..4a3bc168a4a7 100644 |
1468 |
+--- a/drivers/input/mouse/alps.c |
1469 |
++++ b/drivers/input/mouse/alps.c |
1470 |
+@@ -2544,13 +2544,31 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], |
1471 |
+ } |
1472 |
+ |
1473 |
+ static int alps_update_dual_info_ss4_v2(unsigned char otp[][4], |
1474 |
+- struct alps_data *priv) |
1475 |
++ struct alps_data *priv, |
1476 |
++ struct psmouse *psmouse) |
1477 |
+ { |
1478 |
+ bool is_dual = false; |
1479 |
++ int reg_val = 0; |
1480 |
++ struct ps2dev *ps2dev = &psmouse->ps2dev; |
1481 |
+ |
1482 |
+- if (IS_SS4PLUS_DEV(priv->dev_id)) |
1483 |
++ if (IS_SS4PLUS_DEV(priv->dev_id)) { |
1484 |
+ is_dual = (otp[0][0] >> 4) & 0x01; |
1485 |
+ |
1486 |
++ if (!is_dual) { |
1487 |
++ /* For support TrackStick of Thinkpad L/E series */ |
1488 |
++ if (alps_exit_command_mode(psmouse) == 0 && |
1489 |
++ alps_enter_command_mode(psmouse) == 0) { |
1490 |
++ reg_val = alps_command_mode_read_reg(psmouse, |
1491 |
++ 0xD7); |
1492 |
++ } |
1493 |
++ alps_exit_command_mode(psmouse); |
1494 |
++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); |
1495 |
++ |
1496 |
++ if (reg_val == 0x0C || reg_val == 0x1D) |
1497 |
++ is_dual = true; |
1498 |
++ } |
1499 |
++ } |
1500 |
++ |
1501 |
+ if (is_dual) |
1502 |
+ priv->flags |= ALPS_DUALPOINT | |
1503 |
+ ALPS_DUALPOINT_WITH_PRESSURE; |
1504 |
+@@ -2573,7 +2591,7 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, |
1505 |
+ |
1506 |
+ alps_update_btn_info_ss4_v2(otp, priv); |
1507 |
+ |
1508 |
+- alps_update_dual_info_ss4_v2(otp, priv); |
1509 |
++ alps_update_dual_info_ss4_v2(otp, priv, psmouse); |
1510 |
+ |
1511 |
+ return 0; |
1512 |
+ } |
1513 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
1514 |
+index 6cbbdc6e9687..b353d494ad40 100644 |
1515 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
1516 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
1517 |
+@@ -530,6 +530,20 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
1518 |
+ { } |
1519 |
+ }; |
1520 |
+ |
1521 |
++static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = { |
1522 |
++ { |
1523 |
++ /* |
1524 |
++ * Sony Vaio VGN-CS series require MUX or the touch sensor |
1525 |
++ * buttons will disturb touchpad operation |
1526 |
++ */ |
1527 |
++ .matches = { |
1528 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
1529 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"), |
1530 |
++ }, |
1531 |
++ }, |
1532 |
++ { } |
1533 |
++}; |
1534 |
++ |
1535 |
+ /* |
1536 |
+ * On some Asus laptops, just running self tests cause problems. |
1537 |
+ */ |
1538 |
+@@ -620,6 +634,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { |
1539 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "20046"), |
1540 |
+ }, |
1541 |
+ }, |
1542 |
++ { |
1543 |
++ /* Lenovo ThinkPad L460 */ |
1544 |
++ .matches = { |
1545 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
1546 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"), |
1547 |
++ }, |
1548 |
++ }, |
1549 |
+ { |
1550 |
+ /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */ |
1551 |
+ .matches = { |
1552 |
+@@ -1163,6 +1184,9 @@ static int __init i8042_platform_init(void) |
1553 |
+ if (dmi_check_system(i8042_dmi_nomux_table)) |
1554 |
+ i8042_nomux = true; |
1555 |
+ |
1556 |
++ if (dmi_check_system(i8042_dmi_forcemux_table)) |
1557 |
++ i8042_nomux = false; |
1558 |
++ |
1559 |
+ if (dmi_check_system(i8042_dmi_notimeout_table)) |
1560 |
+ i8042_notimeout = true; |
1561 |
+ |
1562 |
+diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c |
1563 |
+index 127f8a0c098b..0c2e628e8723 100644 |
1564 |
+--- a/drivers/media/usb/usbtv/usbtv-core.c |
1565 |
++++ b/drivers/media/usb/usbtv/usbtv-core.c |
1566 |
+@@ -112,6 +112,8 @@ static int usbtv_probe(struct usb_interface *intf, |
1567 |
+ return 0; |
1568 |
+ |
1569 |
+ usbtv_audio_fail: |
1570 |
++ /* we must not free at this point */ |
1571 |
++ usb_get_dev(usbtv->udev); |
1572 |
+ usbtv_video_free(usbtv); |
1573 |
+ |
1574 |
+ usbtv_video_fail: |
1575 |
+diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c |
1576 |
+index e825f013e54e..22efc039f302 100644 |
1577 |
+--- a/drivers/misc/mei/main.c |
1578 |
++++ b/drivers/misc/mei/main.c |
1579 |
+@@ -507,7 +507,6 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) |
1580 |
+ break; |
1581 |
+ |
1582 |
+ default: |
1583 |
+- dev_err(dev->dev, ": unsupported ioctl %d.\n", cmd); |
1584 |
+ rets = -ENOIOCTLCMD; |
1585 |
+ } |
1586 |
+ |
1587 |
+diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c |
1588 |
+index 7c0b27d132b1..b479bd81120b 100644 |
1589 |
+--- a/drivers/mtd/chips/jedec_probe.c |
1590 |
++++ b/drivers/mtd/chips/jedec_probe.c |
1591 |
+@@ -1889,6 +1889,8 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base, |
1592 |
+ do { |
1593 |
+ uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi); |
1594 |
+ mask = (1 << (cfi->device_type * 8)) - 1; |
1595 |
++ if (ofs >= map->size) |
1596 |
++ return 0; |
1597 |
+ result = map_read(map, base + ofs); |
1598 |
+ bank++; |
1599 |
+ } while ((result.x[0] & mask) == CFI_MFR_CONTINUATION); |
1600 |
+diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c |
1601 |
+index fcbe4fd6e684..ca0a70389ba9 100644 |
1602 |
+--- a/drivers/mtd/nand/atmel/pmecc.c |
1603 |
++++ b/drivers/mtd/nand/atmel/pmecc.c |
1604 |
+@@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user) |
1605 |
+ |
1606 |
+ static int get_sectorsize(struct atmel_pmecc_user *user) |
1607 |
+ { |
1608 |
+- return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512; |
1609 |
++ return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512; |
1610 |
+ } |
1611 |
+ |
1612 |
+ static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector) |
1613 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
1614 |
+index 86944bc3b273..74bd260ca02a 100644 |
1615 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
1616 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
1617 |
+@@ -666,7 +666,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data) |
1618 |
+ |
1619 |
+ static int hns_gmac_get_sset_count(int stringset) |
1620 |
+ { |
1621 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
1622 |
++ if (stringset == ETH_SS_STATS) |
1623 |
+ return ARRAY_SIZE(g_gmac_stats_string); |
1624 |
+ |
1625 |
+ return 0; |
1626 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
1627 |
+index b62816c1574e..93e71e27401b 100644 |
1628 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
1629 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
1630 |
+@@ -422,7 +422,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb) |
1631 |
+ |
1632 |
+ int hns_ppe_get_sset_count(int stringset) |
1633 |
+ { |
1634 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
1635 |
++ if (stringset == ETH_SS_STATS) |
1636 |
+ return ETH_PPE_STATIC_NUM; |
1637 |
+ return 0; |
1638 |
+ } |
1639 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
1640 |
+index 6f3570cfb501..e2e28532e4dc 100644 |
1641 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
1642 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
1643 |
+@@ -876,7 +876,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data) |
1644 |
+ */ |
1645 |
+ int hns_rcb_get_ring_sset_count(int stringset) |
1646 |
+ { |
1647 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
1648 |
++ if (stringset == ETH_SS_STATS) |
1649 |
+ return HNS_RING_STATIC_REG_NUM; |
1650 |
+ |
1651 |
+ return 0; |
1652 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1653 |
+index 7ea7f8a4aa2a..2e14a3ae1d8b 100644 |
1654 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1655 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
1656 |
+@@ -993,8 +993,10 @@ int hns_get_sset_count(struct net_device *netdev, int stringset) |
1657 |
+ cnt--; |
1658 |
+ |
1659 |
+ return cnt; |
1660 |
+- } else { |
1661 |
++ } else if (stringset == ETH_SS_STATS) { |
1662 |
+ return (HNS_NET_STATS_CNT + ops->get_sset_count(h, stringset)); |
1663 |
++ } else { |
1664 |
++ return -EOPNOTSUPP; |
1665 |
+ } |
1666 |
+ } |
1667 |
+ |
1668 |
+diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c |
1669 |
+index 489492b608cf..380916bff9e0 100644 |
1670 |
+--- a/drivers/parport/parport_pc.c |
1671 |
++++ b/drivers/parport/parport_pc.c |
1672 |
+@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards { |
1673 |
+ netmos_9901, |
1674 |
+ netmos_9865, |
1675 |
+ quatech_sppxp100, |
1676 |
++ wch_ch382l, |
1677 |
+ }; |
1678 |
+ |
1679 |
+ |
1680 |
+@@ -2708,6 +2709,7 @@ static struct parport_pc_pci { |
1681 |
+ /* netmos_9901 */ { 1, { { 0, -1 }, } }, |
1682 |
+ /* netmos_9865 */ { 1, { { 0, -1 }, } }, |
1683 |
+ /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, |
1684 |
++ /* wch_ch382l */ { 1, { { 2, -1 }, } }, |
1685 |
+ }; |
1686 |
+ |
1687 |
+ static const struct pci_device_id parport_pc_pci_tbl[] = { |
1688 |
+@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { |
1689 |
+ /* Quatech SPPXP-100 Parallel port PCI ExpressCard */ |
1690 |
+ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, |
1691 |
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, |
1692 |
++ /* WCH CH382L PCI-E single parallel port card */ |
1693 |
++ { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l }, |
1694 |
+ { 0, } /* terminate list */ |
1695 |
+ }; |
1696 |
+ MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl); |
1697 |
+diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c |
1698 |
+index c5ff4525edef..c5493ea51282 100644 |
1699 |
+--- a/drivers/phy/qualcomm/phy-qcom-ufs.c |
1700 |
++++ b/drivers/phy/qualcomm/phy-qcom-ufs.c |
1701 |
+@@ -675,3 +675,8 @@ int ufs_qcom_phy_power_off(struct phy *generic_phy) |
1702 |
+ return 0; |
1703 |
+ } |
1704 |
+ EXPORT_SYMBOL_GPL(ufs_qcom_phy_power_off); |
1705 |
++ |
1706 |
++MODULE_AUTHOR("Yaniv Gardi <ygardi@××××××××××.org>"); |
1707 |
++MODULE_AUTHOR("Vivek Gautam <vivek.gautam@××××××××××.org>"); |
1708 |
++MODULE_DESCRIPTION("Universal Flash Storage (UFS) QCOM PHY"); |
1709 |
++MODULE_LICENSE("GPL v2"); |
1710 |
+diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c |
1711 |
+index 398347fedc47..2cac160993bb 100644 |
1712 |
+--- a/drivers/staging/comedi/drivers/ni_mio_common.c |
1713 |
++++ b/drivers/staging/comedi/drivers/ni_mio_common.c |
1714 |
+@@ -1284,6 +1284,8 @@ static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status) |
1715 |
+ ack |= NISTC_INTA_ACK_AI_START; |
1716 |
+ if (a_status & NISTC_AI_STATUS1_STOP) |
1717 |
+ ack |= NISTC_INTA_ACK_AI_STOP; |
1718 |
++ if (a_status & NISTC_AI_STATUS1_OVER) |
1719 |
++ ack |= NISTC_INTA_ACK_AI_ERR; |
1720 |
+ if (ack) |
1721 |
+ ni_stc_writew(dev, ack, NISTC_INTA_ACK_REG); |
1722 |
+ } |
1723 |
+diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c |
1724 |
+index 160b8906d9b9..9835b1c1cbe1 100644 |
1725 |
+--- a/drivers/tty/serial/8250/8250_of.c |
1726 |
++++ b/drivers/tty/serial/8250/8250_of.c |
1727 |
+@@ -316,6 +316,7 @@ static const struct of_device_id of_platform_serial_table[] = { |
1728 |
+ { .compatible = "mrvl,mmp-uart", |
1729 |
+ .data = (void *)PORT_XSCALE, }, |
1730 |
+ { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, }, |
1731 |
++ { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, }, |
1732 |
+ { /* end of list */ }, |
1733 |
+ }; |
1734 |
+ MODULE_DEVICE_TABLE(of, of_platform_serial_table); |
1735 |
+diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
1736 |
+index 11434551ac0a..2cda4b28c78a 100644 |
1737 |
+--- a/drivers/tty/serial/8250/8250_port.c |
1738 |
++++ b/drivers/tty/serial/8250/8250_port.c |
1739 |
+@@ -47,6 +47,10 @@ |
1740 |
+ #define UART_EXAR_SLEEP 0x8b /* Sleep mode */ |
1741 |
+ #define UART_EXAR_DVID 0x8d /* Device identification */ |
1742 |
+ |
1743 |
++/* Nuvoton NPCM timeout register */ |
1744 |
++#define UART_NPCM_TOR 7 |
1745 |
++#define UART_NPCM_TOIE BIT(7) /* Timeout Interrupt Enable */ |
1746 |
++ |
1747 |
+ /* |
1748 |
+ * Debugging. |
1749 |
+ */ |
1750 |
+@@ -293,6 +297,15 @@ static const struct serial8250_config uart_config[] = { |
1751 |
+ UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, |
1752 |
+ .flags = UART_CAP_FIFO, |
1753 |
+ }, |
1754 |
++ [PORT_NPCM] = { |
1755 |
++ .name = "Nuvoton 16550", |
1756 |
++ .fifo_size = 16, |
1757 |
++ .tx_loadsz = 16, |
1758 |
++ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 | |
1759 |
++ UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, |
1760 |
++ .rxtrig_bytes = {1, 4, 8, 14}, |
1761 |
++ .flags = UART_CAP_FIFO, |
1762 |
++ }, |
1763 |
+ }; |
1764 |
+ |
1765 |
+ /* Uart divisor latch read */ |
1766 |
+@@ -2161,6 +2174,15 @@ int serial8250_do_startup(struct uart_port *port) |
1767 |
+ UART_DA830_PWREMU_MGMT_FREE); |
1768 |
+ } |
1769 |
+ |
1770 |
++ if (port->type == PORT_NPCM) { |
1771 |
++ /* |
1772 |
++ * Nuvoton calls the scratch register 'UART_TOR' (timeout |
1773 |
++ * register). Enable it, and set TIOC (timeout interrupt |
1774 |
++ * comparator) to be 0x20 for correct operation. |
1775 |
++ */ |
1776 |
++ serial_port_out(port, UART_NPCM_TOR, UART_NPCM_TOIE | 0x20); |
1777 |
++ } |
1778 |
++ |
1779 |
+ #ifdef CONFIG_SERIAL_8250_RSA |
1780 |
+ /* |
1781 |
+ * If this is an RSA port, see if we can kick it up to the |
1782 |
+@@ -2483,6 +2505,15 @@ static unsigned int xr17v35x_get_divisor(struct uart_8250_port *up, |
1783 |
+ return quot_16 >> 4; |
1784 |
+ } |
1785 |
+ |
1786 |
++/* Nuvoton NPCM UARTs have a custom divisor calculation */ |
1787 |
++static unsigned int npcm_get_divisor(struct uart_8250_port *up, |
1788 |
++ unsigned int baud) |
1789 |
++{ |
1790 |
++ struct uart_port *port = &up->port; |
1791 |
++ |
1792 |
++ return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud + 2) - 2; |
1793 |
++} |
1794 |
++ |
1795 |
+ static unsigned int serial8250_get_divisor(struct uart_8250_port *up, |
1796 |
+ unsigned int baud, |
1797 |
+ unsigned int *frac) |
1798 |
+@@ -2503,6 +2534,8 @@ static unsigned int serial8250_get_divisor(struct uart_8250_port *up, |
1799 |
+ quot = 0x8002; |
1800 |
+ else if (up->port.type == PORT_XR17V35X) |
1801 |
+ quot = xr17v35x_get_divisor(up, baud, frac); |
1802 |
++ else if (up->port.type == PORT_NPCM) |
1803 |
++ quot = npcm_get_divisor(up, baud); |
1804 |
+ else |
1805 |
+ quot = uart_get_divisor(port, baud); |
1806 |
+ |
1807 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1808 |
+index b4e57c5a8bba..f97251f39c26 100644 |
1809 |
+--- a/drivers/tty/vt/vt.c |
1810 |
++++ b/drivers/tty/vt/vt.c |
1811 |
+@@ -1354,6 +1354,11 @@ static void csi_m(struct vc_data *vc) |
1812 |
+ case 3: |
1813 |
+ vc->vc_italic = 1; |
1814 |
+ break; |
1815 |
++ case 21: |
1816 |
++ /* |
1817 |
++ * No console drivers support double underline, so |
1818 |
++ * convert it to a single underline. |
1819 |
++ */ |
1820 |
+ case 4: |
1821 |
+ vc->vc_underline = 1; |
1822 |
+ break; |
1823 |
+@@ -1389,7 +1394,6 @@ static void csi_m(struct vc_data *vc) |
1824 |
+ vc->vc_disp_ctrl = 1; |
1825 |
+ vc->vc_toggle_meta = 1; |
1826 |
+ break; |
1827 |
+- case 21: |
1828 |
+ case 22: |
1829 |
+ vc->vc_intensity = 1; |
1830 |
+ break; |
1831 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1832 |
+index 06d502b3e913..de1e759dd512 100644 |
1833 |
+--- a/drivers/usb/serial/cp210x.c |
1834 |
++++ b/drivers/usb/serial/cp210x.c |
1835 |
+@@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = { |
1836 |
+ { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ |
1837 |
+ { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
1838 |
+ { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
1839 |
++ { USB_DEVICE(0x155A, 0x1006) }, /* ELDAT Easywave RX09 */ |
1840 |
+ { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ |
1841 |
+ { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */ |
1842 |
+ { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
1843 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1844 |
+index fc68952c994a..e456617216f9 100644 |
1845 |
+--- a/drivers/usb/serial/ftdi_sio.c |
1846 |
++++ b/drivers/usb/serial/ftdi_sio.c |
1847 |
+@@ -769,6 +769,7 @@ static const struct usb_device_id id_table_combined[] = { |
1848 |
+ .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
1849 |
+ { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
1850 |
+ { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, |
1851 |
++ { USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) }, |
1852 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
1853 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
1854 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
1855 |
+@@ -931,6 +932,7 @@ static const struct usb_device_id id_table_combined[] = { |
1856 |
+ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, |
1857 |
+ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, |
1858 |
+ { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) }, |
1859 |
++ { USB_DEVICE(FTDI_VID, FTDI_FHE_PID) }, |
1860 |
+ { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, |
1861 |
+ { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
1862 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
1863 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
1864 |
+index 8b4ecd2bd297..975d02666c5a 100644 |
1865 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
1866 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
1867 |
+@@ -923,6 +923,9 @@ |
1868 |
+ /* |
1869 |
+ * RT Systems programming cables for various ham radios |
1870 |
+ */ |
1871 |
++/* This device uses the VID of FTDI */ |
1872 |
++#define RTSYSTEMS_USB_VX8_PID 0x9e50 /* USB-VX8 USB to 7 pin modular plug for Yaesu VX-8 radio */ |
1873 |
++ |
1874 |
+ #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
1875 |
+ #define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */ |
1876 |
+ #define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */ |
1877 |
+@@ -1441,6 +1444,12 @@ |
1878 |
+ */ |
1879 |
+ #define FTDI_CINTERION_MC55I_PID 0xA951 |
1880 |
+ |
1881 |
++/* |
1882 |
++ * Product: FirmwareHubEmulator |
1883 |
++ * Manufacturer: Harman Becker Automotive Systems |
1884 |
++ */ |
1885 |
++#define FTDI_FHE_PID 0xA9A0 |
1886 |
++ |
1887 |
+ /* |
1888 |
+ * Product: Comet Caller ID decoder |
1889 |
+ * Manufacturer: Crucible Technologies |
1890 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
1891 |
+index c04183cc2117..ae07b3a2fb5d 100644 |
1892 |
+--- a/fs/btrfs/inode.c |
1893 |
++++ b/fs/btrfs/inode.c |
1894 |
+@@ -1257,6 +1257,8 @@ static noinline int csum_exist_in_range(struct btrfs_fs_info *fs_info, |
1895 |
+ list_del(&sums->list); |
1896 |
+ kfree(sums); |
1897 |
+ } |
1898 |
++ if (ret < 0) |
1899 |
++ return ret; |
1900 |
+ return 1; |
1901 |
+ } |
1902 |
+ |
1903 |
+@@ -1389,10 +1391,23 @@ static noinline int run_delalloc_nocow(struct inode *inode, |
1904 |
+ goto out_check; |
1905 |
+ if (btrfs_extent_readonly(fs_info, disk_bytenr)) |
1906 |
+ goto out_check; |
1907 |
+- if (btrfs_cross_ref_exist(root, ino, |
1908 |
+- found_key.offset - |
1909 |
+- extent_offset, disk_bytenr)) |
1910 |
++ ret = btrfs_cross_ref_exist(root, ino, |
1911 |
++ found_key.offset - |
1912 |
++ extent_offset, disk_bytenr); |
1913 |
++ if (ret) { |
1914 |
++ /* |
1915 |
++ * ret could be -EIO if the above fails to read |
1916 |
++ * metadata. |
1917 |
++ */ |
1918 |
++ if (ret < 0) { |
1919 |
++ if (cow_start != (u64)-1) |
1920 |
++ cur_offset = cow_start; |
1921 |
++ goto error; |
1922 |
++ } |
1923 |
++ |
1924 |
++ WARN_ON_ONCE(nolock); |
1925 |
+ goto out_check; |
1926 |
++ } |
1927 |
+ disk_bytenr += extent_offset; |
1928 |
+ disk_bytenr += cur_offset - found_key.offset; |
1929 |
+ num_bytes = min(end + 1, extent_end) - cur_offset; |
1930 |
+@@ -1410,10 +1425,22 @@ static noinline int run_delalloc_nocow(struct inode *inode, |
1931 |
+ * this ensure that csum for a given extent are |
1932 |
+ * either valid or do not exist. |
1933 |
+ */ |
1934 |
+- if (csum_exist_in_range(fs_info, disk_bytenr, |
1935 |
+- num_bytes)) { |
1936 |
++ ret = csum_exist_in_range(fs_info, disk_bytenr, |
1937 |
++ num_bytes); |
1938 |
++ if (ret) { |
1939 |
+ if (!nolock) |
1940 |
+ btrfs_end_write_no_snapshotting(root); |
1941 |
++ |
1942 |
++ /* |
1943 |
++ * ret could be -EIO if the above fails to read |
1944 |
++ * metadata. |
1945 |
++ */ |
1946 |
++ if (ret < 0) { |
1947 |
++ if (cow_start != (u64)-1) |
1948 |
++ cur_offset = cow_start; |
1949 |
++ goto error; |
1950 |
++ } |
1951 |
++ WARN_ON_ONCE(nolock); |
1952 |
+ goto out_check; |
1953 |
+ } |
1954 |
+ if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr)) { |
1955 |
+diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
1956 |
+index 5c17125f45c7..0024d3e61bcd 100644 |
1957 |
+--- a/fs/ceph/file.c |
1958 |
++++ b/fs/ceph/file.c |
1959 |
+@@ -635,7 +635,8 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to, |
1960 |
+ struct ceph_aio_request { |
1961 |
+ struct kiocb *iocb; |
1962 |
+ size_t total_len; |
1963 |
+- int write; |
1964 |
++ bool write; |
1965 |
++ bool should_dirty; |
1966 |
+ int error; |
1967 |
+ struct list_head osd_reqs; |
1968 |
+ unsigned num_reqs; |
1969 |
+@@ -745,7 +746,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req) |
1970 |
+ } |
1971 |
+ } |
1972 |
+ |
1973 |
+- ceph_put_page_vector(osd_data->pages, num_pages, !aio_req->write); |
1974 |
++ ceph_put_page_vector(osd_data->pages, num_pages, aio_req->should_dirty); |
1975 |
+ ceph_osdc_put_request(req); |
1976 |
+ |
1977 |
+ if (rc < 0) |
1978 |
+@@ -842,6 +843,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, |
1979 |
+ size_t count = iov_iter_count(iter); |
1980 |
+ loff_t pos = iocb->ki_pos; |
1981 |
+ bool write = iov_iter_rw(iter) == WRITE; |
1982 |
++ bool should_dirty = !write && iter_is_iovec(iter); |
1983 |
+ |
1984 |
+ if (write && ceph_snap(file_inode(file)) != CEPH_NOSNAP) |
1985 |
+ return -EROFS; |
1986 |
+@@ -909,6 +911,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, |
1987 |
+ if (aio_req) { |
1988 |
+ aio_req->iocb = iocb; |
1989 |
+ aio_req->write = write; |
1990 |
++ aio_req->should_dirty = should_dirty; |
1991 |
+ INIT_LIST_HEAD(&aio_req->osd_reqs); |
1992 |
+ if (write) { |
1993 |
+ aio_req->mtime = mtime; |
1994 |
+@@ -966,7 +969,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, |
1995 |
+ len = ret; |
1996 |
+ } |
1997 |
+ |
1998 |
+- ceph_put_page_vector(pages, num_pages, !write); |
1999 |
++ ceph_put_page_vector(pages, num_pages, should_dirty); |
2000 |
+ |
2001 |
+ ceph_osdc_put_request(req); |
2002 |
+ if (ret < 0) |
2003 |
+diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h |
2004 |
+index 3489253e38fc..1347b33399e1 100644 |
2005 |
+--- a/include/linux/bitmap.h |
2006 |
++++ b/include/linux/bitmap.h |
2007 |
+@@ -271,12 +271,20 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr |
2008 |
+ __bitmap_complement(dst, src, nbits); |
2009 |
+ } |
2010 |
+ |
2011 |
++#ifdef __LITTLE_ENDIAN |
2012 |
++#define BITMAP_MEM_ALIGNMENT 8 |
2013 |
++#else |
2014 |
++#define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long)) |
2015 |
++#endif |
2016 |
++#define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1) |
2017 |
++ |
2018 |
+ static inline int bitmap_equal(const unsigned long *src1, |
2019 |
+ const unsigned long *src2, unsigned int nbits) |
2020 |
+ { |
2021 |
+ if (small_const_nbits(nbits)) |
2022 |
+ return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); |
2023 |
+- if (__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8)) |
2024 |
++ if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) && |
2025 |
++ IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) |
2026 |
+ return !memcmp(src1, src2, nbits / 8); |
2027 |
+ return __bitmap_equal(src1, src2, nbits); |
2028 |
+ } |
2029 |
+@@ -327,8 +335,10 @@ static __always_inline void bitmap_set(unsigned long *map, unsigned int start, |
2030 |
+ { |
2031 |
+ if (__builtin_constant_p(nbits) && nbits == 1) |
2032 |
+ __set_bit(start, map); |
2033 |
+- else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) && |
2034 |
+- __builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8)) |
2035 |
++ else if (__builtin_constant_p(start & BITMAP_MEM_MASK) && |
2036 |
++ IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) && |
2037 |
++ __builtin_constant_p(nbits & BITMAP_MEM_MASK) && |
2038 |
++ IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) |
2039 |
+ memset((char *)map + start / 8, 0xff, nbits / 8); |
2040 |
+ else |
2041 |
+ __bitmap_set(map, start, nbits); |
2042 |
+@@ -339,8 +349,10 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start, |
2043 |
+ { |
2044 |
+ if (__builtin_constant_p(nbits) && nbits == 1) |
2045 |
+ __clear_bit(start, map); |
2046 |
+- else if (__builtin_constant_p(start & 7) && IS_ALIGNED(start, 8) && |
2047 |
+- __builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8)) |
2048 |
++ else if (__builtin_constant_p(start & BITMAP_MEM_MASK) && |
2049 |
++ IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) && |
2050 |
++ __builtin_constant_p(nbits & BITMAP_MEM_MASK) && |
2051 |
++ IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) |
2052 |
+ memset((char *)map + start / 8, 0, nbits / 8); |
2053 |
+ else |
2054 |
+ __bitmap_clear(map, start, nbits); |
2055 |
+diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h |
2056 |
+index 33f7530f96b9..8e46c35d654b 100644 |
2057 |
+--- a/include/linux/netfilter/x_tables.h |
2058 |
++++ b/include/linux/netfilter/x_tables.h |
2059 |
+@@ -285,6 +285,8 @@ unsigned int *xt_alloc_entry_offsets(unsigned int size); |
2060 |
+ bool xt_find_jump_offset(const unsigned int *offsets, |
2061 |
+ unsigned int target, unsigned int size); |
2062 |
+ |
2063 |
++int xt_check_proc_name(const char *name, unsigned int size); |
2064 |
++ |
2065 |
+ int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto, |
2066 |
+ bool inv_proto); |
2067 |
+ int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto, |
2068 |
+diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h |
2069 |
+index 18c564f60e93..60e5cabee928 100644 |
2070 |
+--- a/include/rdma/ib_addr.h |
2071 |
++++ b/include/rdma/ib_addr.h |
2072 |
+@@ -130,6 +130,8 @@ void rdma_copy_addr(struct rdma_dev_addr *dev_addr, |
2073 |
+ const unsigned char *dst_dev_addr); |
2074 |
+ |
2075 |
+ int rdma_addr_size(struct sockaddr *addr); |
2076 |
++int rdma_addr_size_in6(struct sockaddr_in6 *addr); |
2077 |
++int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr); |
2078 |
+ |
2079 |
+ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id); |
2080 |
+ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, |
2081 |
+diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h |
2082 |
+index 1c8413f93e3d..dce5f9dae121 100644 |
2083 |
+--- a/include/uapi/linux/serial_core.h |
2084 |
++++ b/include/uapi/linux/serial_core.h |
2085 |
+@@ -76,6 +76,9 @@ |
2086 |
+ #define PORT_SUNZILOG 38 |
2087 |
+ #define PORT_SUNSAB 39 |
2088 |
+ |
2089 |
++/* Nuvoton UART */ |
2090 |
++#define PORT_NPCM 40 |
2091 |
++ |
2092 |
+ /* Intel EG20 */ |
2093 |
+ #define PORT_PCH_8LINE 44 |
2094 |
+ #define PORT_PCH_2LINE 45 |
2095 |
+diff --git a/ipc/shm.c b/ipc/shm.c |
2096 |
+index 7acda23430aa..50e88fc060b1 100644 |
2097 |
+--- a/ipc/shm.c |
2098 |
++++ b/ipc/shm.c |
2099 |
+@@ -386,6 +386,17 @@ static int shm_fault(struct vm_fault *vmf) |
2100 |
+ return sfd->vm_ops->fault(vmf); |
2101 |
+ } |
2102 |
+ |
2103 |
++static int shm_split(struct vm_area_struct *vma, unsigned long addr) |
2104 |
++{ |
2105 |
++ struct file *file = vma->vm_file; |
2106 |
++ struct shm_file_data *sfd = shm_file_data(file); |
2107 |
++ |
2108 |
++ if (sfd->vm_ops && sfd->vm_ops->split) |
2109 |
++ return sfd->vm_ops->split(vma, addr); |
2110 |
++ |
2111 |
++ return 0; |
2112 |
++} |
2113 |
++ |
2114 |
+ #ifdef CONFIG_NUMA |
2115 |
+ static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new) |
2116 |
+ { |
2117 |
+@@ -510,6 +521,7 @@ static const struct vm_operations_struct shm_vm_ops = { |
2118 |
+ .open = shm_open, /* callback for a new vm-area open */ |
2119 |
+ .close = shm_close, /* callback for when the vm-area is released */ |
2120 |
+ .fault = shm_fault, |
2121 |
++ .split = shm_split, |
2122 |
+ #if defined(CONFIG_NUMA) |
2123 |
+ .set_policy = shm_set_policy, |
2124 |
+ .get_policy = shm_get_policy, |
2125 |
+diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c |
2126 |
+index 3f8cb1e14588..253ae2da13c3 100644 |
2127 |
+--- a/kernel/events/hw_breakpoint.c |
2128 |
++++ b/kernel/events/hw_breakpoint.c |
2129 |
+@@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); |
2130 |
+ * modify_user_hw_breakpoint - modify a user-space hardware breakpoint |
2131 |
+ * @bp: the breakpoint structure to modify |
2132 |
+ * @attr: new breakpoint attributes |
2133 |
+- * @triggered: callback to trigger when we hit the breakpoint |
2134 |
+- * @tsk: pointer to 'task_struct' of the process to which the address belongs |
2135 |
+ */ |
2136 |
+ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) |
2137 |
+ { |
2138 |
+- u64 old_addr = bp->attr.bp_addr; |
2139 |
+- u64 old_len = bp->attr.bp_len; |
2140 |
+- int old_type = bp->attr.bp_type; |
2141 |
+- int err = 0; |
2142 |
+- |
2143 |
+ /* |
2144 |
+ * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it |
2145 |
+ * will not be possible to raise IPIs that invoke __perf_event_disable. |
2146 |
+@@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att |
2147 |
+ bp->attr.bp_addr = attr->bp_addr; |
2148 |
+ bp->attr.bp_type = attr->bp_type; |
2149 |
+ bp->attr.bp_len = attr->bp_len; |
2150 |
++ bp->attr.disabled = 1; |
2151 |
+ |
2152 |
+- if (attr->disabled) |
2153 |
+- goto end; |
2154 |
+- |
2155 |
+- err = validate_hw_breakpoint(bp); |
2156 |
+- if (!err) |
2157 |
+- perf_event_enable(bp); |
2158 |
++ if (!attr->disabled) { |
2159 |
++ int err = validate_hw_breakpoint(bp); |
2160 |
+ |
2161 |
+- if (err) { |
2162 |
+- bp->attr.bp_addr = old_addr; |
2163 |
+- bp->attr.bp_type = old_type; |
2164 |
+- bp->attr.bp_len = old_len; |
2165 |
+- if (!bp->attr.disabled) |
2166 |
+- perf_event_enable(bp); |
2167 |
++ if (err) |
2168 |
++ return err; |
2169 |
+ |
2170 |
+- return err; |
2171 |
++ perf_event_enable(bp); |
2172 |
++ bp->attr.disabled = 0; |
2173 |
+ } |
2174 |
+ |
2175 |
+-end: |
2176 |
+- bp->attr.disabled = attr->disabled; |
2177 |
+- |
2178 |
+ return 0; |
2179 |
+ } |
2180 |
+ EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint); |
2181 |
+diff --git a/mm/percpu-km.c b/mm/percpu-km.c |
2182 |
+index d2a76642c4ae..0d88d7bd5706 100644 |
2183 |
+--- a/mm/percpu-km.c |
2184 |
++++ b/mm/percpu-km.c |
2185 |
+@@ -34,7 +34,7 @@ |
2186 |
+ #include <linux/log2.h> |
2187 |
+ |
2188 |
+ static int pcpu_populate_chunk(struct pcpu_chunk *chunk, |
2189 |
+- int page_start, int page_end) |
2190 |
++ int page_start, int page_end, gfp_t gfp) |
2191 |
+ { |
2192 |
+ return 0; |
2193 |
+ } |
2194 |
+@@ -45,18 +45,18 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, |
2195 |
+ /* nada */ |
2196 |
+ } |
2197 |
+ |
2198 |
+-static struct pcpu_chunk *pcpu_create_chunk(void) |
2199 |
++static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp) |
2200 |
+ { |
2201 |
+ const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT; |
2202 |
+ struct pcpu_chunk *chunk; |
2203 |
+ struct page *pages; |
2204 |
+ int i; |
2205 |
+ |
2206 |
+- chunk = pcpu_alloc_chunk(); |
2207 |
++ chunk = pcpu_alloc_chunk(gfp); |
2208 |
+ if (!chunk) |
2209 |
+ return NULL; |
2210 |
+ |
2211 |
+- pages = alloc_pages(GFP_KERNEL, order_base_2(nr_pages)); |
2212 |
++ pages = alloc_pages(gfp | GFP_KERNEL, order_base_2(nr_pages)); |
2213 |
+ if (!pages) { |
2214 |
+ pcpu_free_chunk(chunk); |
2215 |
+ return NULL; |
2216 |
+diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c |
2217 |
+index 9158e5a81391..0af71eb2fff0 100644 |
2218 |
+--- a/mm/percpu-vm.c |
2219 |
++++ b/mm/percpu-vm.c |
2220 |
+@@ -37,7 +37,7 @@ static struct page **pcpu_get_pages(void) |
2221 |
+ lockdep_assert_held(&pcpu_alloc_mutex); |
2222 |
+ |
2223 |
+ if (!pages) |
2224 |
+- pages = pcpu_mem_zalloc(pages_size); |
2225 |
++ pages = pcpu_mem_zalloc(pages_size, 0); |
2226 |
+ return pages; |
2227 |
+ } |
2228 |
+ |
2229 |
+@@ -73,18 +73,21 @@ static void pcpu_free_pages(struct pcpu_chunk *chunk, |
2230 |
+ * @pages: array to put the allocated pages into, indexed by pcpu_page_idx() |
2231 |
+ * @page_start: page index of the first page to be allocated |
2232 |
+ * @page_end: page index of the last page to be allocated + 1 |
2233 |
++ * @gfp: allocation flags passed to the underlying allocator |
2234 |
+ * |
2235 |
+ * Allocate pages [@page_start,@page_end) into @pages for all units. |
2236 |
+ * The allocation is for @chunk. Percpu core doesn't care about the |
2237 |
+ * content of @pages and will pass it verbatim to pcpu_map_pages(). |
2238 |
+ */ |
2239 |
+ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, |
2240 |
+- struct page **pages, int page_start, int page_end) |
2241 |
++ struct page **pages, int page_start, int page_end, |
2242 |
++ gfp_t gfp) |
2243 |
+ { |
2244 |
+- const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM; |
2245 |
+ unsigned int cpu, tcpu; |
2246 |
+ int i; |
2247 |
+ |
2248 |
++ gfp |= GFP_KERNEL | __GFP_HIGHMEM; |
2249 |
++ |
2250 |
+ for_each_possible_cpu(cpu) { |
2251 |
+ for (i = page_start; i < page_end; i++) { |
2252 |
+ struct page **pagep = &pages[pcpu_page_idx(cpu, i)]; |
2253 |
+@@ -262,6 +265,7 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk, |
2254 |
+ * @chunk: chunk of interest |
2255 |
+ * @page_start: the start page |
2256 |
+ * @page_end: the end page |
2257 |
++ * @gfp: allocation flags passed to the underlying memory allocator |
2258 |
+ * |
2259 |
+ * For each cpu, populate and map pages [@page_start,@page_end) into |
2260 |
+ * @chunk. |
2261 |
+@@ -270,7 +274,7 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk, |
2262 |
+ * pcpu_alloc_mutex, does GFP_KERNEL allocation. |
2263 |
+ */ |
2264 |
+ static int pcpu_populate_chunk(struct pcpu_chunk *chunk, |
2265 |
+- int page_start, int page_end) |
2266 |
++ int page_start, int page_end, gfp_t gfp) |
2267 |
+ { |
2268 |
+ struct page **pages; |
2269 |
+ |
2270 |
+@@ -278,7 +282,7 @@ static int pcpu_populate_chunk(struct pcpu_chunk *chunk, |
2271 |
+ if (!pages) |
2272 |
+ return -ENOMEM; |
2273 |
+ |
2274 |
+- if (pcpu_alloc_pages(chunk, pages, page_start, page_end)) |
2275 |
++ if (pcpu_alloc_pages(chunk, pages, page_start, page_end, gfp)) |
2276 |
+ return -ENOMEM; |
2277 |
+ |
2278 |
+ if (pcpu_map_pages(chunk, pages, page_start, page_end)) { |
2279 |
+@@ -325,12 +329,12 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, |
2280 |
+ pcpu_free_pages(chunk, pages, page_start, page_end); |
2281 |
+ } |
2282 |
+ |
2283 |
+-static struct pcpu_chunk *pcpu_create_chunk(void) |
2284 |
++static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp) |
2285 |
+ { |
2286 |
+ struct pcpu_chunk *chunk; |
2287 |
+ struct vm_struct **vms; |
2288 |
+ |
2289 |
+- chunk = pcpu_alloc_chunk(); |
2290 |
++ chunk = pcpu_alloc_chunk(gfp); |
2291 |
+ if (!chunk) |
2292 |
+ return NULL; |
2293 |
+ |
2294 |
+diff --git a/mm/percpu.c b/mm/percpu.c |
2295 |
+index 50e7fdf84055..3248afb3862c 100644 |
2296 |
+--- a/mm/percpu.c |
2297 |
++++ b/mm/percpu.c |
2298 |
+@@ -447,10 +447,12 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits, |
2299 |
+ /** |
2300 |
+ * pcpu_mem_zalloc - allocate memory |
2301 |
+ * @size: bytes to allocate |
2302 |
++ * @gfp: allocation flags |
2303 |
+ * |
2304 |
+ * Allocate @size bytes. If @size is smaller than PAGE_SIZE, |
2305 |
+- * kzalloc() is used; otherwise, vzalloc() is used. The returned |
2306 |
+- * memory is always zeroed. |
2307 |
++ * kzalloc() is used; otherwise, the equivalent of vzalloc() is used. |
2308 |
++ * This is to facilitate passing through whitelisted flags. The |
2309 |
++ * returned memory is always zeroed. |
2310 |
+ * |
2311 |
+ * CONTEXT: |
2312 |
+ * Does GFP_KERNEL allocation. |
2313 |
+@@ -458,15 +460,16 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits, |
2314 |
+ * RETURNS: |
2315 |
+ * Pointer to the allocated area on success, NULL on failure. |
2316 |
+ */ |
2317 |
+-static void *pcpu_mem_zalloc(size_t size) |
2318 |
++static void *pcpu_mem_zalloc(size_t size, gfp_t gfp) |
2319 |
+ { |
2320 |
+ if (WARN_ON_ONCE(!slab_is_available())) |
2321 |
+ return NULL; |
2322 |
+ |
2323 |
+ if (size <= PAGE_SIZE) |
2324 |
+- return kzalloc(size, GFP_KERNEL); |
2325 |
++ return kzalloc(size, gfp | GFP_KERNEL); |
2326 |
+ else |
2327 |
+- return vzalloc(size); |
2328 |
++ return __vmalloc(size, gfp | GFP_KERNEL | __GFP_ZERO, |
2329 |
++ PAGE_KERNEL); |
2330 |
+ } |
2331 |
+ |
2332 |
+ /** |
2333 |
+@@ -1154,12 +1157,12 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr, |
2334 |
+ return chunk; |
2335 |
+ } |
2336 |
+ |
2337 |
+-static struct pcpu_chunk *pcpu_alloc_chunk(void) |
2338 |
++static struct pcpu_chunk *pcpu_alloc_chunk(gfp_t gfp) |
2339 |
+ { |
2340 |
+ struct pcpu_chunk *chunk; |
2341 |
+ int region_bits; |
2342 |
+ |
2343 |
+- chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size); |
2344 |
++ chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size, gfp); |
2345 |
+ if (!chunk) |
2346 |
+ return NULL; |
2347 |
+ |
2348 |
+@@ -1168,17 +1171,17 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) |
2349 |
+ region_bits = pcpu_chunk_map_bits(chunk); |
2350 |
+ |
2351 |
+ chunk->alloc_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits) * |
2352 |
+- sizeof(chunk->alloc_map[0])); |
2353 |
++ sizeof(chunk->alloc_map[0]), gfp); |
2354 |
+ if (!chunk->alloc_map) |
2355 |
+ goto alloc_map_fail; |
2356 |
+ |
2357 |
+ chunk->bound_map = pcpu_mem_zalloc(BITS_TO_LONGS(region_bits + 1) * |
2358 |
+- sizeof(chunk->bound_map[0])); |
2359 |
++ sizeof(chunk->bound_map[0]), gfp); |
2360 |
+ if (!chunk->bound_map) |
2361 |
+ goto bound_map_fail; |
2362 |
+ |
2363 |
+ chunk->md_blocks = pcpu_mem_zalloc(pcpu_chunk_nr_blocks(chunk) * |
2364 |
+- sizeof(chunk->md_blocks[0])); |
2365 |
++ sizeof(chunk->md_blocks[0]), gfp); |
2366 |
+ if (!chunk->md_blocks) |
2367 |
+ goto md_blocks_fail; |
2368 |
+ |
2369 |
+@@ -1277,9 +1280,10 @@ static void pcpu_chunk_depopulated(struct pcpu_chunk *chunk, |
2370 |
+ * pcpu_addr_to_page - translate address to physical address |
2371 |
+ * pcpu_verify_alloc_info - check alloc_info is acceptable during init |
2372 |
+ */ |
2373 |
+-static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size); |
2374 |
++static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size, |
2375 |
++ gfp_t gfp); |
2376 |
+ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size); |
2377 |
+-static struct pcpu_chunk *pcpu_create_chunk(void); |
2378 |
++static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp); |
2379 |
+ static void pcpu_destroy_chunk(struct pcpu_chunk *chunk); |
2380 |
+ static struct page *pcpu_addr_to_page(void *addr); |
2381 |
+ static int __init pcpu_verify_alloc_info(const struct pcpu_alloc_info *ai); |
2382 |
+@@ -1421,7 +1425,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, |
2383 |
+ } |
2384 |
+ |
2385 |
+ if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) { |
2386 |
+- chunk = pcpu_create_chunk(); |
2387 |
++ chunk = pcpu_create_chunk(0); |
2388 |
+ if (!chunk) { |
2389 |
+ err = "failed to allocate new chunk"; |
2390 |
+ goto fail; |
2391 |
+@@ -1450,7 +1454,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, |
2392 |
+ page_start, page_end) { |
2393 |
+ WARN_ON(chunk->immutable); |
2394 |
+ |
2395 |
+- ret = pcpu_populate_chunk(chunk, rs, re); |
2396 |
++ ret = pcpu_populate_chunk(chunk, rs, re, 0); |
2397 |
+ |
2398 |
+ spin_lock_irqsave(&pcpu_lock, flags); |
2399 |
+ if (ret) { |
2400 |
+@@ -1561,10 +1565,17 @@ void __percpu *__alloc_reserved_percpu(size_t size, size_t align) |
2401 |
+ * pcpu_balance_workfn - manage the amount of free chunks and populated pages |
2402 |
+ * @work: unused |
2403 |
+ * |
2404 |
+- * Reclaim all fully free chunks except for the first one. |
2405 |
++ * Reclaim all fully free chunks except for the first one. This is also |
2406 |
++ * responsible for maintaining the pool of empty populated pages. However, |
2407 |
++ * it is possible that this is called when physical memory is scarce causing |
2408 |
++ * OOM killer to be triggered. We should avoid doing so until an actual |
2409 |
++ * allocation causes the failure as it is possible that requests can be |
2410 |
++ * serviced from already backed regions. |
2411 |
+ */ |
2412 |
+ static void pcpu_balance_workfn(struct work_struct *work) |
2413 |
+ { |
2414 |
++ /* gfp flags passed to underlying allocators */ |
2415 |
++ const gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN; |
2416 |
+ LIST_HEAD(to_free); |
2417 |
+ struct list_head *free_head = &pcpu_slot[pcpu_nr_slots - 1]; |
2418 |
+ struct pcpu_chunk *chunk, *next; |
2419 |
+@@ -1645,7 +1656,7 @@ static void pcpu_balance_workfn(struct work_struct *work) |
2420 |
+ chunk->nr_pages) { |
2421 |
+ int nr = min(re - rs, nr_to_pop); |
2422 |
+ |
2423 |
+- ret = pcpu_populate_chunk(chunk, rs, rs + nr); |
2424 |
++ ret = pcpu_populate_chunk(chunk, rs, rs + nr, gfp); |
2425 |
+ if (!ret) { |
2426 |
+ nr_to_pop -= nr; |
2427 |
+ spin_lock_irq(&pcpu_lock); |
2428 |
+@@ -1662,7 +1673,7 @@ static void pcpu_balance_workfn(struct work_struct *work) |
2429 |
+ |
2430 |
+ if (nr_to_pop) { |
2431 |
+ /* ran out of chunks to populate, create a new one and retry */ |
2432 |
+- chunk = pcpu_create_chunk(); |
2433 |
++ chunk = pcpu_create_chunk(gfp); |
2434 |
+ if (chunk) { |
2435 |
+ spin_lock_irq(&pcpu_lock); |
2436 |
+ pcpu_chunk_relocate(chunk, -1); |
2437 |
+diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c |
2438 |
+index 01117ae84f1d..a2ddae2f37d7 100644 |
2439 |
+--- a/net/bluetooth/smp.c |
2440 |
++++ b/net/bluetooth/smp.c |
2441 |
+@@ -2296,8 +2296,14 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) |
2442 |
+ else |
2443 |
+ sec_level = authreq_to_seclevel(auth); |
2444 |
+ |
2445 |
+- if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) |
2446 |
++ if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) { |
2447 |
++ /* If link is already encrypted with sufficient security we |
2448 |
++ * still need refresh encryption as per Core Spec 5.0 Vol 3, |
2449 |
++ * Part H 2.4.6 |
2450 |
++ */ |
2451 |
++ smp_ltk_encrypt(conn, hcon->sec_level); |
2452 |
+ return 0; |
2453 |
++ } |
2454 |
+ |
2455 |
+ if (sec_level > hcon->pending_sec_level) |
2456 |
+ hcon->pending_sec_level = sec_level; |
2457 |
+diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c |
2458 |
+index 59baaecd3e54..0b589a6b365c 100644 |
2459 |
+--- a/net/bridge/netfilter/ebt_among.c |
2460 |
++++ b/net/bridge/netfilter/ebt_among.c |
2461 |
+@@ -177,6 +177,28 @@ static bool poolsize_invalid(const struct ebt_mac_wormhash *w) |
2462 |
+ return w && w->poolsize >= (INT_MAX / sizeof(struct ebt_mac_wormhash_tuple)); |
2463 |
+ } |
2464 |
+ |
2465 |
++static bool wormhash_offset_invalid(int off, unsigned int len) |
2466 |
++{ |
2467 |
++ if (off == 0) /* not present */ |
2468 |
++ return false; |
2469 |
++ |
2470 |
++ if (off < (int)sizeof(struct ebt_among_info) || |
2471 |
++ off % __alignof__(struct ebt_mac_wormhash)) |
2472 |
++ return true; |
2473 |
++ |
2474 |
++ off += sizeof(struct ebt_mac_wormhash); |
2475 |
++ |
2476 |
++ return off > len; |
2477 |
++} |
2478 |
++ |
2479 |
++static bool wormhash_sizes_valid(const struct ebt_mac_wormhash *wh, int a, int b) |
2480 |
++{ |
2481 |
++ if (a == 0) |
2482 |
++ a = sizeof(struct ebt_among_info); |
2483 |
++ |
2484 |
++ return ebt_mac_wormhash_size(wh) + a == b; |
2485 |
++} |
2486 |
++ |
2487 |
+ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
2488 |
+ { |
2489 |
+ const struct ebt_among_info *info = par->matchinfo; |
2490 |
+@@ -189,6 +211,10 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
2491 |
+ if (expected_length > em->match_size) |
2492 |
+ return -EINVAL; |
2493 |
+ |
2494 |
++ if (wormhash_offset_invalid(info->wh_dst_ofs, em->match_size) || |
2495 |
++ wormhash_offset_invalid(info->wh_src_ofs, em->match_size)) |
2496 |
++ return -EINVAL; |
2497 |
++ |
2498 |
+ wh_dst = ebt_among_wh_dst(info); |
2499 |
+ if (poolsize_invalid(wh_dst)) |
2500 |
+ return -EINVAL; |
2501 |
+@@ -201,6 +227,14 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
2502 |
+ if (poolsize_invalid(wh_src)) |
2503 |
+ return -EINVAL; |
2504 |
+ |
2505 |
++ if (info->wh_src_ofs < info->wh_dst_ofs) { |
2506 |
++ if (!wormhash_sizes_valid(wh_src, info->wh_src_ofs, info->wh_dst_ofs)) |
2507 |
++ return -EINVAL; |
2508 |
++ } else { |
2509 |
++ if (!wormhash_sizes_valid(wh_dst, info->wh_dst_ofs, info->wh_src_ofs)) |
2510 |
++ return -EINVAL; |
2511 |
++ } |
2512 |
++ |
2513 |
+ expected_length += ebt_mac_wormhash_size(wh_src); |
2514 |
+ |
2515 |
+ if (em->match_size != EBT_ALIGN(expected_length)) { |
2516 |
+diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2517 |
+index a5727036a8a8..a9670b642ba4 100644 |
2518 |
+--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2519 |
++++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2520 |
+@@ -159,8 +159,20 @@ static unsigned int ipv4_conntrack_local(void *priv, |
2521 |
+ ip_hdrlen(skb) < sizeof(struct iphdr)) |
2522 |
+ return NF_ACCEPT; |
2523 |
+ |
2524 |
+- if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */ |
2525 |
++ if (ip_is_fragment(ip_hdr(skb))) { /* IP_NODEFRAG setsockopt set */ |
2526 |
++ enum ip_conntrack_info ctinfo; |
2527 |
++ struct nf_conn *tmpl; |
2528 |
++ |
2529 |
++ tmpl = nf_ct_get(skb, &ctinfo); |
2530 |
++ if (tmpl && nf_ct_is_template(tmpl)) { |
2531 |
++ /* when skipping ct, clear templates to avoid fooling |
2532 |
++ * later targets/matches |
2533 |
++ */ |
2534 |
++ skb->_nfct = 0; |
2535 |
++ nf_ct_put(tmpl); |
2536 |
++ } |
2537 |
+ return NF_ACCEPT; |
2538 |
++ } |
2539 |
+ |
2540 |
+ return nf_conntrack_in(state->net, PF_INET, state->hook, skb); |
2541 |
+ } |
2542 |
+diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
2543 |
+index fa3ae1cb50d3..8c184f84f353 100644 |
2544 |
+--- a/net/ipv6/ip6_vti.c |
2545 |
++++ b/net/ipv6/ip6_vti.c |
2546 |
+@@ -626,7 +626,6 @@ static void vti6_link_config(struct ip6_tnl *t) |
2547 |
+ { |
2548 |
+ struct net_device *dev = t->dev; |
2549 |
+ struct __ip6_tnl_parm *p = &t->parms; |
2550 |
+- struct net_device *tdev = NULL; |
2551 |
+ |
2552 |
+ memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); |
2553 |
+ memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); |
2554 |
+@@ -639,25 +638,6 @@ static void vti6_link_config(struct ip6_tnl *t) |
2555 |
+ dev->flags |= IFF_POINTOPOINT; |
2556 |
+ else |
2557 |
+ dev->flags &= ~IFF_POINTOPOINT; |
2558 |
+- |
2559 |
+- if (p->flags & IP6_TNL_F_CAP_XMIT) { |
2560 |
+- int strict = (ipv6_addr_type(&p->raddr) & |
2561 |
+- (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); |
2562 |
+- struct rt6_info *rt = rt6_lookup(t->net, |
2563 |
+- &p->raddr, &p->laddr, |
2564 |
+- p->link, strict); |
2565 |
+- |
2566 |
+- if (rt) |
2567 |
+- tdev = rt->dst.dev; |
2568 |
+- ip6_rt_put(rt); |
2569 |
+- } |
2570 |
+- |
2571 |
+- if (!tdev && p->link) |
2572 |
+- tdev = __dev_get_by_index(t->net, p->link); |
2573 |
+- |
2574 |
+- if (tdev) |
2575 |
+- dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, |
2576 |
+- IPV6_MIN_MTU); |
2577 |
+ } |
2578 |
+ |
2579 |
+ /** |
2580 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
2581 |
+index 08a2a65d3304..1f0d94439c77 100644 |
2582 |
+--- a/net/ipv6/route.c |
2583 |
++++ b/net/ipv6/route.c |
2584 |
+@@ -1627,11 +1627,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket, |
2585 |
+ struct neighbour *neigh; |
2586 |
+ __u8 neigh_flags = 0; |
2587 |
+ |
2588 |
+- neigh = dst_neigh_lookup(&rt->dst, &rt->rt6i_gateway); |
2589 |
+- if (neigh) { |
2590 |
++ neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway); |
2591 |
++ if (neigh) |
2592 |
+ neigh_flags = neigh->flags; |
2593 |
+- neigh_release(neigh); |
2594 |
+- } |
2595 |
++ |
2596 |
+ if (!(neigh_flags & NTF_ROUTER)) { |
2597 |
+ RT6_TRACE("purging route %p via non-router but gateway\n", |
2598 |
+ rt); |
2599 |
+@@ -1655,7 +1654,8 @@ void rt6_age_exceptions(struct rt6_info *rt, |
2600 |
+ if (!rcu_access_pointer(rt->rt6i_exception_bucket)) |
2601 |
+ return; |
2602 |
+ |
2603 |
+- spin_lock_bh(&rt6_exception_lock); |
2604 |
++ rcu_read_lock_bh(); |
2605 |
++ spin_lock(&rt6_exception_lock); |
2606 |
+ bucket = rcu_dereference_protected(rt->rt6i_exception_bucket, |
2607 |
+ lockdep_is_held(&rt6_exception_lock)); |
2608 |
+ |
2609 |
+@@ -1669,7 +1669,8 @@ void rt6_age_exceptions(struct rt6_info *rt, |
2610 |
+ bucket++; |
2611 |
+ } |
2612 |
+ } |
2613 |
+- spin_unlock_bh(&rt6_exception_lock); |
2614 |
++ spin_unlock(&rt6_exception_lock); |
2615 |
++ rcu_read_unlock_bh(); |
2616 |
+ } |
2617 |
+ |
2618 |
+ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, |
2619 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
2620 |
+index e8b26afeb194..083fa2ffee15 100644 |
2621 |
+--- a/net/l2tp/l2tp_core.c |
2622 |
++++ b/net/l2tp/l2tp_core.c |
2623 |
+@@ -111,6 +111,13 @@ struct l2tp_net { |
2624 |
+ spinlock_t l2tp_session_hlist_lock; |
2625 |
+ }; |
2626 |
+ |
2627 |
++#if IS_ENABLED(CONFIG_IPV6) |
2628 |
++static bool l2tp_sk_is_v6(struct sock *sk) |
2629 |
++{ |
2630 |
++ return sk->sk_family == PF_INET6 && |
2631 |
++ !ipv6_addr_v4mapped(&sk->sk_v6_daddr); |
2632 |
++} |
2633 |
++#endif |
2634 |
+ |
2635 |
+ static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) |
2636 |
+ { |
2637 |
+@@ -1058,7 +1065,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, |
2638 |
+ /* Queue the packet to IP for output */ |
2639 |
+ skb->ignore_df = 1; |
2640 |
+ #if IS_ENABLED(CONFIG_IPV6) |
2641 |
+- if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped) |
2642 |
++ if (l2tp_sk_is_v6(tunnel->sock)) |
2643 |
+ error = inet6_csk_xmit(tunnel->sock, skb, NULL); |
2644 |
+ else |
2645 |
+ #endif |
2646 |
+@@ -1121,6 +1128,15 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len |
2647 |
+ goto out_unlock; |
2648 |
+ } |
2649 |
+ |
2650 |
++ /* The user-space may change the connection status for the user-space |
2651 |
++ * provided socket at run time: we must check it under the socket lock |
2652 |
++ */ |
2653 |
++ if (tunnel->fd >= 0 && sk->sk_state != TCP_ESTABLISHED) { |
2654 |
++ kfree_skb(skb); |
2655 |
++ ret = NET_XMIT_DROP; |
2656 |
++ goto out_unlock; |
2657 |
++ } |
2658 |
++ |
2659 |
+ /* Get routing info from the tunnel socket */ |
2660 |
+ skb_dst_drop(skb); |
2661 |
+ skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); |
2662 |
+@@ -1140,7 +1156,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len |
2663 |
+ |
2664 |
+ /* Calculate UDP checksum if configured to do so */ |
2665 |
+ #if IS_ENABLED(CONFIG_IPV6) |
2666 |
+- if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) |
2667 |
++ if (l2tp_sk_is_v6(sk)) |
2668 |
+ udp6_set_csum(udp_get_no_check6_tx(sk), |
2669 |
+ skb, &inet6_sk(sk)->saddr, |
2670 |
+ &sk->sk_v6_daddr, udp_len); |
2671 |
+@@ -1520,24 +1536,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 |
2672 |
+ if (cfg != NULL) |
2673 |
+ tunnel->debug = cfg->debug; |
2674 |
+ |
2675 |
+-#if IS_ENABLED(CONFIG_IPV6) |
2676 |
+- if (sk->sk_family == PF_INET6) { |
2677 |
+- struct ipv6_pinfo *np = inet6_sk(sk); |
2678 |
+- |
2679 |
+- if (ipv6_addr_v4mapped(&np->saddr) && |
2680 |
+- ipv6_addr_v4mapped(&sk->sk_v6_daddr)) { |
2681 |
+- struct inet_sock *inet = inet_sk(sk); |
2682 |
+- |
2683 |
+- tunnel->v4mapped = true; |
2684 |
+- inet->inet_saddr = np->saddr.s6_addr32[3]; |
2685 |
+- inet->inet_rcv_saddr = sk->sk_v6_rcv_saddr.s6_addr32[3]; |
2686 |
+- inet->inet_daddr = sk->sk_v6_daddr.s6_addr32[3]; |
2687 |
+- } else { |
2688 |
+- tunnel->v4mapped = false; |
2689 |
+- } |
2690 |
+- } |
2691 |
+-#endif |
2692 |
+- |
2693 |
+ /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
2694 |
+ tunnel->encap = encap; |
2695 |
+ if (encap == L2TP_ENCAPTYPE_UDP) { |
2696 |
+diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h |
2697 |
+index 8ecb1d357445..3fddfb207113 100644 |
2698 |
+--- a/net/l2tp/l2tp_core.h |
2699 |
++++ b/net/l2tp/l2tp_core.h |
2700 |
+@@ -193,9 +193,6 @@ struct l2tp_tunnel { |
2701 |
+ struct sock *sock; /* Parent socket */ |
2702 |
+ int fd; /* Parent fd, if tunnel socket |
2703 |
+ * was created by userspace */ |
2704 |
+-#if IS_ENABLED(CONFIG_IPV6) |
2705 |
+- bool v4mapped; |
2706 |
+-#endif |
2707 |
+ |
2708 |
+ struct work_struct del_work; |
2709 |
+ |
2710 |
+diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c |
2711 |
+index d7070d18db20..a33def530adf 100644 |
2712 |
+--- a/net/netfilter/x_tables.c |
2713 |
++++ b/net/netfilter/x_tables.c |
2714 |
+@@ -423,6 +423,36 @@ textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto) |
2715 |
+ return buf; |
2716 |
+ } |
2717 |
+ |
2718 |
++/** |
2719 |
++ * xt_check_proc_name - check that name is suitable for /proc file creation |
2720 |
++ * |
2721 |
++ * @name: file name candidate |
2722 |
++ * @size: length of buffer |
2723 |
++ * |
2724 |
++ * some x_tables modules wish to create a file in /proc. |
2725 |
++ * This function makes sure that the name is suitable for this |
2726 |
++ * purpose, it checks that name is NUL terminated and isn't a 'special' |
2727 |
++ * name, like "..". |
2728 |
++ * |
2729 |
++ * returns negative number on error or 0 if name is useable. |
2730 |
++ */ |
2731 |
++int xt_check_proc_name(const char *name, unsigned int size) |
2732 |
++{ |
2733 |
++ if (name[0] == '\0') |
2734 |
++ return -EINVAL; |
2735 |
++ |
2736 |
++ if (strnlen(name, size) == size) |
2737 |
++ return -ENAMETOOLONG; |
2738 |
++ |
2739 |
++ if (strcmp(name, ".") == 0 || |
2740 |
++ strcmp(name, "..") == 0 || |
2741 |
++ strchr(name, '/')) |
2742 |
++ return -EINVAL; |
2743 |
++ |
2744 |
++ return 0; |
2745 |
++} |
2746 |
++EXPORT_SYMBOL(xt_check_proc_name); |
2747 |
++ |
2748 |
+ int xt_check_match(struct xt_mtchk_param *par, |
2749 |
+ unsigned int size, u_int8_t proto, bool inv_proto) |
2750 |
+ { |
2751 |
+@@ -1008,7 +1038,12 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size) |
2752 |
+ if ((size >> PAGE_SHIFT) + 2 > totalram_pages) |
2753 |
+ return NULL; |
2754 |
+ |
2755 |
+- info = kvmalloc(sz, GFP_KERNEL); |
2756 |
++ /* __GFP_NORETRY is not fully supported by kvmalloc but it should |
2757 |
++ * work reasonably well if sz is too large and bail out rather |
2758 |
++ * than shoot all processes down before realizing there is nothing |
2759 |
++ * more to reclaim. |
2760 |
++ */ |
2761 |
++ info = kvmalloc(sz, GFP_KERNEL | __GFP_NORETRY); |
2762 |
+ if (!info) |
2763 |
+ return NULL; |
2764 |
+ |
2765 |
+diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c |
2766 |
+index b8a3e740ffd4..0c034597b9b8 100644 |
2767 |
+--- a/net/netfilter/xt_hashlimit.c |
2768 |
++++ b/net/netfilter/xt_hashlimit.c |
2769 |
+@@ -915,8 +915,9 @@ static int hashlimit_mt_check_v1(const struct xt_mtchk_param *par) |
2770 |
+ struct hashlimit_cfg3 cfg = {}; |
2771 |
+ int ret; |
2772 |
+ |
2773 |
+- if (info->name[sizeof(info->name) - 1] != '\0') |
2774 |
+- return -EINVAL; |
2775 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2776 |
++ if (ret) |
2777 |
++ return ret; |
2778 |
+ |
2779 |
+ ret = cfg_copy(&cfg, (void *)&info->cfg, 1); |
2780 |
+ |
2781 |
+@@ -933,8 +934,9 @@ static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par) |
2782 |
+ struct hashlimit_cfg3 cfg = {}; |
2783 |
+ int ret; |
2784 |
+ |
2785 |
+- if (info->name[sizeof(info->name) - 1] != '\0') |
2786 |
+- return -EINVAL; |
2787 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2788 |
++ if (ret) |
2789 |
++ return ret; |
2790 |
+ |
2791 |
+ ret = cfg_copy(&cfg, (void *)&info->cfg, 2); |
2792 |
+ |
2793 |
+@@ -948,9 +950,11 @@ static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par) |
2794 |
+ static int hashlimit_mt_check(const struct xt_mtchk_param *par) |
2795 |
+ { |
2796 |
+ struct xt_hashlimit_mtinfo3 *info = par->matchinfo; |
2797 |
++ int ret; |
2798 |
+ |
2799 |
+- if (info->name[sizeof(info->name) - 1] != '\0') |
2800 |
+- return -EINVAL; |
2801 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2802 |
++ if (ret) |
2803 |
++ return ret; |
2804 |
+ |
2805 |
+ return hashlimit_mt_check_common(par, &info->hinfo, &info->cfg, |
2806 |
+ info->name, 3); |
2807 |
+diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c |
2808 |
+index 245fa350a7a8..cf96d230e5a3 100644 |
2809 |
+--- a/net/netfilter/xt_recent.c |
2810 |
++++ b/net/netfilter/xt_recent.c |
2811 |
+@@ -361,9 +361,9 @@ static int recent_mt_check(const struct xt_mtchk_param *par, |
2812 |
+ info->hit_count, XT_RECENT_MAX_NSTAMPS - 1); |
2813 |
+ return -EINVAL; |
2814 |
+ } |
2815 |
+- if (info->name[0] == '\0' || |
2816 |
+- strnlen(info->name, XT_RECENT_NAME_LEN) == XT_RECENT_NAME_LEN) |
2817 |
+- return -EINVAL; |
2818 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2819 |
++ if (ret) |
2820 |
++ return ret; |
2821 |
+ |
2822 |
+ if (ip_pkt_list_tot && info->hit_count < ip_pkt_list_tot) |
2823 |
+ nstamp_mask = roundup_pow_of_two(ip_pkt_list_tot) - 1; |
2824 |
+diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c |
2825 |
+index ccfdc7115a83..a00ec715aa46 100644 |
2826 |
+--- a/net/xfrm/xfrm_ipcomp.c |
2827 |
++++ b/net/xfrm/xfrm_ipcomp.c |
2828 |
+@@ -283,7 +283,7 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name) |
2829 |
+ struct crypto_comp *tfm; |
2830 |
+ |
2831 |
+ /* This can be any valid CPU ID so we don't need locking. */ |
2832 |
+- tfm = __this_cpu_read(*pos->tfms); |
2833 |
++ tfm = this_cpu_read(*pos->tfms); |
2834 |
+ |
2835 |
+ if (!strcmp(crypto_comp_name(tfm), alg_name)) { |
2836 |
+ pos->users++; |
2837 |
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
2838 |
+index 54e21f19d722..f9d2f2233f09 100644 |
2839 |
+--- a/net/xfrm/xfrm_state.c |
2840 |
++++ b/net/xfrm/xfrm_state.c |
2841 |
+@@ -2056,6 +2056,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen |
2842 |
+ struct xfrm_mgr *km; |
2843 |
+ struct xfrm_policy *pol = NULL; |
2844 |
+ |
2845 |
++#ifdef CONFIG_COMPAT |
2846 |
++ if (in_compat_syscall()) |
2847 |
++ return -EOPNOTSUPP; |
2848 |
++#endif |
2849 |
++ |
2850 |
+ if (!optval && !optlen) { |
2851 |
+ xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); |
2852 |
+ xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL); |
2853 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
2854 |
+index 7f52b8eb177d..080035f056d9 100644 |
2855 |
+--- a/net/xfrm/xfrm_user.c |
2856 |
++++ b/net/xfrm/xfrm_user.c |
2857 |
+@@ -121,22 +121,17 @@ static inline int verify_replay(struct xfrm_usersa_info *p, |
2858 |
+ struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL]; |
2859 |
+ struct xfrm_replay_state_esn *rs; |
2860 |
+ |
2861 |
+- if (p->flags & XFRM_STATE_ESN) { |
2862 |
+- if (!rt) |
2863 |
+- return -EINVAL; |
2864 |
++ if (!rt) |
2865 |
++ return (p->flags & XFRM_STATE_ESN) ? -EINVAL : 0; |
2866 |
+ |
2867 |
+- rs = nla_data(rt); |
2868 |
++ rs = nla_data(rt); |
2869 |
+ |
2870 |
+- if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8) |
2871 |
+- return -EINVAL; |
2872 |
+- |
2873 |
+- if (nla_len(rt) < (int)xfrm_replay_state_esn_len(rs) && |
2874 |
+- nla_len(rt) != sizeof(*rs)) |
2875 |
+- return -EINVAL; |
2876 |
+- } |
2877 |
++ if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8) |
2878 |
++ return -EINVAL; |
2879 |
+ |
2880 |
+- if (!rt) |
2881 |
+- return 0; |
2882 |
++ if (nla_len(rt) < (int)xfrm_replay_state_esn_len(rs) && |
2883 |
++ nla_len(rt) != sizeof(*rs)) |
2884 |
++ return -EINVAL; |
2885 |
+ |
2886 |
+ /* As only ESP and AH support ESN feature. */ |
2887 |
+ if ((p->id.proto != IPPROTO_ESP) && (p->id.proto != IPPROTO_AH)) |
2888 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
2889 |
+index 012881461058..d6e9a18fd821 100644 |
2890 |
+--- a/sound/core/oss/pcm_oss.c |
2891 |
++++ b/sound/core/oss/pcm_oss.c |
2892 |
+@@ -1326,7 +1326,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha |
2893 |
+ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size_t bytes) |
2894 |
+ { |
2895 |
+ size_t xfer = 0; |
2896 |
+- ssize_t tmp; |
2897 |
++ ssize_t tmp = 0; |
2898 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2899 |
+ |
2900 |
+ if (atomic_read(&substream->mmap_count)) |
2901 |
+@@ -1433,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, |
2902 |
+ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t bytes) |
2903 |
+ { |
2904 |
+ size_t xfer = 0; |
2905 |
+- ssize_t tmp; |
2906 |
++ ssize_t tmp = 0; |
2907 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2908 |
+ |
2909 |
+ if (atomic_read(&substream->mmap_count)) |
2910 |
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
2911 |
+index f08772568c17..b01cc015a93c 100644 |
2912 |
+--- a/sound/core/pcm_native.c |
2913 |
++++ b/sound/core/pcm_native.c |
2914 |
+@@ -3422,7 +3422,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, |
2915 |
+ area, |
2916 |
+ substream->runtime->dma_area, |
2917 |
+ substream->runtime->dma_addr, |
2918 |
+- area->vm_end - area->vm_start); |
2919 |
++ substream->runtime->dma_bytes); |
2920 |
+ #endif /* CONFIG_X86 */ |
2921 |
+ /* mmap with fault handler */ |
2922 |
+ area->vm_ops = &snd_pcm_vm_ops_data_fault; |
2923 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
2924 |
+index ea8f3de92fa4..794224e1d6df 100644 |
2925 |
+--- a/sound/usb/quirks.c |
2926 |
++++ b/sound/usb/quirks.c |
2927 |
+@@ -1171,6 +1171,7 @@ static bool is_teac_dsd_dac(unsigned int id) |
2928 |
+ switch (id) { |
2929 |
+ case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */ |
2930 |
+ case USB_ID(0x0644, 0x8044): /* Esoteric D-05X */ |
2931 |
++ case USB_ID(0x0644, 0x804a): /* TEAC UD-301 */ |
2932 |
+ return true; |
2933 |
+ } |
2934 |
+ return false; |