1 |
commit: 7802bd38ec6a3e5cebd97ec87d85ebc4ac15d346 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 24 10:40:25 2016 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Sep 24 10:40:25 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7802bd38 |
7 |
|
8 |
Linux patch 4.7.5 |
9 |
|
10 |
0000_README | 4 + |
11 |
1004_linux-4.7.5.patch | 6989 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 6993 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 2b11683..fefac23 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -59,6 +59,10 @@ Patch: 1003_linux-4.7.4.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.7.4 |
21 |
|
22 |
+Patch: 1004_linux-4.7.5.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.7.5 |
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/1004_linux-4.7.5.patch b/1004_linux-4.7.5.patch |
31 |
new file mode 100644 |
32 |
index 0000000..4332e2c |
33 |
--- /dev/null |
34 |
+++ b/1004_linux-4.7.5.patch |
35 |
@@ -0,0 +1,6989 @@ |
36 |
+diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt |
37 |
+index bf99e2f24788..205593f56fe7 100644 |
38 |
+--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt |
39 |
++++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt |
40 |
+@@ -16,6 +16,11 @@ Required properties: |
41 |
+ - vref-supply: The regulator supply ADC reference voltage. |
42 |
+ - #io-channel-cells: Should be 1, see ../iio-bindings.txt |
43 |
+ |
44 |
++Optional properties: |
45 |
++- resets: Must contain an entry for each entry in reset-names if need support |
46 |
++ this option. See ../reset/reset.txt for details. |
47 |
++- reset-names: Must include the name "saradc-apb". |
48 |
++ |
49 |
+ Example: |
50 |
+ saradc: saradc@2006c000 { |
51 |
+ compatible = "rockchip,saradc"; |
52 |
+@@ -23,6 +28,8 @@ Example: |
53 |
+ interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; |
54 |
+ clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
55 |
+ clock-names = "saradc", "apb_pclk"; |
56 |
++ resets = <&cru SRST_SARADC>; |
57 |
++ reset-names = "saradc-apb"; |
58 |
+ #io-channel-cells = <1>; |
59 |
+ vref-supply = <&vcc18>; |
60 |
+ }; |
61 |
+diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c |
62 |
+index 30fb842a976d..49db1def1721 100644 |
63 |
+--- a/Documentation/mic/mpssd/mpssd.c |
64 |
++++ b/Documentation/mic/mpssd/mpssd.c |
65 |
+@@ -1538,9 +1538,9 @@ set_cmdline(struct mic_info *mic) |
66 |
+ |
67 |
+ len = snprintf(buffer, PATH_MAX, |
68 |
+ "clocksource=tsc highres=off nohz=off "); |
69 |
+- len += snprintf(buffer + len, PATH_MAX, |
70 |
++ len += snprintf(buffer + len, PATH_MAX - len, |
71 |
+ "cpufreq_on;corec6_off;pc3_off;pc6_off "); |
72 |
+- len += snprintf(buffer + len, PATH_MAX, |
73 |
++ len += snprintf(buffer + len, PATH_MAX - len, |
74 |
+ "ifcfg=static;address,172.31.%d.1;netmask,255.255.255.0", |
75 |
+ mic->id + 1); |
76 |
+ |
77 |
+diff --git a/Makefile b/Makefile |
78 |
+index ec3bd119fbf8..dd755d199ad6 100644 |
79 |
+--- a/Makefile |
80 |
++++ b/Makefile |
81 |
+@@ -1,6 +1,6 @@ |
82 |
+ VERSION = 4 |
83 |
+ PATCHLEVEL = 7 |
84 |
+-SUBLEVEL = 4 |
85 |
++SUBLEVEL = 5 |
86 |
+ EXTRAVERSION = |
87 |
+ NAME = Psychotic Stoned Sheep |
88 |
+ |
89 |
+diff --git a/arch/alpha/include/asm/uaccess.h b/arch/alpha/include/asm/uaccess.h |
90 |
+index c419b43c461d..466e42e96bfa 100644 |
91 |
+--- a/arch/alpha/include/asm/uaccess.h |
92 |
++++ b/arch/alpha/include/asm/uaccess.h |
93 |
+@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len) |
94 |
+ return __cu_len; |
95 |
+ } |
96 |
+ |
97 |
+-extern inline long |
98 |
+-__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) |
99 |
+-{ |
100 |
+- if (__access_ok((unsigned long)validate, len, get_fs())) |
101 |
+- len = __copy_tofrom_user_nocheck(to, from, len); |
102 |
+- return len; |
103 |
+-} |
104 |
+- |
105 |
+ #define __copy_to_user(to, from, n) \ |
106 |
+ ({ \ |
107 |
+ __chk_user_ptr(to); \ |
108 |
+@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali |
109 |
+ #define __copy_to_user_inatomic __copy_to_user |
110 |
+ #define __copy_from_user_inatomic __copy_from_user |
111 |
+ |
112 |
+- |
113 |
+ extern inline long |
114 |
+ copy_to_user(void __user *to, const void *from, long n) |
115 |
+ { |
116 |
+- return __copy_tofrom_user((__force void *)to, from, n, to); |
117 |
++ if (likely(__access_ok((unsigned long)to, n, get_fs()))) |
118 |
++ n = __copy_tofrom_user_nocheck((__force void *)to, from, n); |
119 |
++ return n; |
120 |
+ } |
121 |
+ |
122 |
+ extern inline long |
123 |
+ copy_from_user(void *to, const void __user *from, long n) |
124 |
+ { |
125 |
+- return __copy_tofrom_user(to, (__force void *)from, n, from); |
126 |
++ if (likely(__access_ok((unsigned long)from, n, get_fs()))) |
127 |
++ n = __copy_tofrom_user_nocheck(to, (__force void *)from, n); |
128 |
++ else |
129 |
++ memset(to, 0, n); |
130 |
++ return n; |
131 |
+ } |
132 |
+ |
133 |
+ extern void __do_clear_user(void); |
134 |
+diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h |
135 |
+index a78d5670884f..41faf17cd28d 100644 |
136 |
+--- a/arch/arc/include/asm/uaccess.h |
137 |
++++ b/arch/arc/include/asm/uaccess.h |
138 |
+@@ -83,7 +83,10 @@ |
139 |
+ "2: ;nop\n" \ |
140 |
+ " .section .fixup, \"ax\"\n" \ |
141 |
+ " .align 4\n" \ |
142 |
+- "3: mov %0, %3\n" \ |
143 |
++ "3: # return -EFAULT\n" \ |
144 |
++ " mov %0, %3\n" \ |
145 |
++ " # zero out dst ptr\n" \ |
146 |
++ " mov %1, 0\n" \ |
147 |
+ " j 2b\n" \ |
148 |
+ " .previous\n" \ |
149 |
+ " .section __ex_table, \"a\"\n" \ |
150 |
+@@ -101,7 +104,11 @@ |
151 |
+ "2: ;nop\n" \ |
152 |
+ " .section .fixup, \"ax\"\n" \ |
153 |
+ " .align 4\n" \ |
154 |
+- "3: mov %0, %3\n" \ |
155 |
++ "3: # return -EFAULT\n" \ |
156 |
++ " mov %0, %3\n" \ |
157 |
++ " # zero out dst ptr\n" \ |
158 |
++ " mov %1, 0\n" \ |
159 |
++ " mov %R1, 0\n" \ |
160 |
+ " j 2b\n" \ |
161 |
+ " .previous\n" \ |
162 |
+ " .section __ex_table, \"a\"\n" \ |
163 |
+diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts |
164 |
+index c60206efb583..7b7c15adaa8b 100644 |
165 |
+--- a/arch/arm/boot/dts/armada-388-clearfog.dts |
166 |
++++ b/arch/arm/boot/dts/armada-388-clearfog.dts |
167 |
+@@ -406,12 +406,12 @@ |
168 |
+ |
169 |
+ port@0 { |
170 |
+ reg = <0>; |
171 |
+- label = "lan1"; |
172 |
++ label = "lan5"; |
173 |
+ }; |
174 |
+ |
175 |
+ port@1 { |
176 |
+ reg = <1>; |
177 |
+- label = "lan2"; |
178 |
++ label = "lan4"; |
179 |
+ }; |
180 |
+ |
181 |
+ port@2 { |
182 |
+@@ -421,12 +421,12 @@ |
183 |
+ |
184 |
+ port@3 { |
185 |
+ reg = <3>; |
186 |
+- label = "lan4"; |
187 |
++ label = "lan2"; |
188 |
+ }; |
189 |
+ |
190 |
+ port@4 { |
191 |
+ reg = <4>; |
192 |
+- label = "lan5"; |
193 |
++ label = "lan1"; |
194 |
+ }; |
195 |
+ |
196 |
+ port@5 { |
197 |
+diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi |
198 |
+index ed613ebe0812..8b1738930145 100644 |
199 |
+--- a/arch/arm/boot/dts/imx6qdl.dtsi |
200 |
++++ b/arch/arm/boot/dts/imx6qdl.dtsi |
201 |
+@@ -242,7 +242,7 @@ |
202 |
+ clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>, |
203 |
+ <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>, |
204 |
+ <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>, |
205 |
+- <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>, |
206 |
++ <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>, |
207 |
+ <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>; |
208 |
+ clock-names = "core", "rxtx0", |
209 |
+ "rxtx1", "rxtx2", |
210 |
+diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts |
211 |
+index ef84d8699a76..5bf62897014c 100644 |
212 |
+--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts |
213 |
++++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts |
214 |
+@@ -113,7 +113,7 @@ |
215 |
+ |
216 |
+ partition@e0000 { |
217 |
+ label = "u-boot environment"; |
218 |
+- reg = <0xe0000 0x100000>; |
219 |
++ reg = <0xe0000 0x20000>; |
220 |
+ }; |
221 |
+ |
222 |
+ partition@100000 { |
223 |
+diff --git a/arch/arm/boot/dts/kirkwood-openrd.dtsi b/arch/arm/boot/dts/kirkwood-openrd.dtsi |
224 |
+index e4ecab112601..7175511a92da 100644 |
225 |
+--- a/arch/arm/boot/dts/kirkwood-openrd.dtsi |
226 |
++++ b/arch/arm/boot/dts/kirkwood-openrd.dtsi |
227 |
+@@ -116,6 +116,10 @@ |
228 |
+ }; |
229 |
+ }; |
230 |
+ |
231 |
++&pciec { |
232 |
++ status = "okay"; |
233 |
++}; |
234 |
++ |
235 |
+ &pcie0 { |
236 |
+ status = "okay"; |
237 |
+ }; |
238 |
+diff --git a/arch/arm/boot/dts/omap3-overo-base.dtsi b/arch/arm/boot/dts/omap3-overo-base.dtsi |
239 |
+index de256fa8da48..3e946cac55f3 100644 |
240 |
+--- a/arch/arm/boot/dts/omap3-overo-base.dtsi |
241 |
++++ b/arch/arm/boot/dts/omap3-overo-base.dtsi |
242 |
+@@ -223,7 +223,9 @@ |
243 |
+ }; |
244 |
+ |
245 |
+ &gpmc { |
246 |
+- ranges = <0 0 0x00000000 0x20000000>; |
247 |
++ ranges = <0 0 0x30000000 0x1000000>, /* CS0 */ |
248 |
++ <4 0 0x2b000000 0x1000000>, /* CS4 */ |
249 |
++ <5 0 0x2c000000 0x1000000>; /* CS5 */ |
250 |
+ |
251 |
+ nand@0,0 { |
252 |
+ compatible = "ti,omap2-nand"; |
253 |
+diff --git a/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi b/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi |
254 |
+index 7df27926ead2..4f4c6efbd518 100644 |
255 |
+--- a/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi |
256 |
++++ b/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi |
257 |
+@@ -55,8 +55,6 @@ |
258 |
+ #include "omap-gpmc-smsc9221.dtsi" |
259 |
+ |
260 |
+ &gpmc { |
261 |
+- ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ |
262 |
+- |
263 |
+ ethernet@gpmc { |
264 |
+ reg = <5 0 0xff>; |
265 |
+ interrupt-parent = <&gpio6>; |
266 |
+diff --git a/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi |
267 |
+index 9e24b6a1d07b..1b304e2f1bd2 100644 |
268 |
+--- a/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi |
269 |
++++ b/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi |
270 |
+@@ -27,8 +27,6 @@ |
271 |
+ #include "omap-gpmc-smsc9221.dtsi" |
272 |
+ |
273 |
+ &gpmc { |
274 |
+- ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ |
275 |
+- |
276 |
+ ethernet@gpmc { |
277 |
+ reg = <5 0 0xff>; |
278 |
+ interrupt-parent = <&gpio6>; |
279 |
+diff --git a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi |
280 |
+index 334109e14613..82e98ee3023a 100644 |
281 |
+--- a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi |
282 |
++++ b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi |
283 |
+@@ -15,9 +15,6 @@ |
284 |
+ #include "omap-gpmc-smsc9221.dtsi" |
285 |
+ |
286 |
+ &gpmc { |
287 |
+- ranges = <4 0 0x2b000000 0x1000000>, /* CS4 */ |
288 |
+- <5 0 0x2c000000 0x1000000>; /* CS5 */ |
289 |
+- |
290 |
+ smsc1: ethernet@gpmc { |
291 |
+ reg = <5 0 0xff>; |
292 |
+ interrupt-parent = <&gpio6>; |
293 |
+diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi |
294 |
+index c0ba86c3a2ab..0d0dae3a1694 100644 |
295 |
+--- a/arch/arm/boot/dts/rk3066a.dtsi |
296 |
++++ b/arch/arm/boot/dts/rk3066a.dtsi |
297 |
+@@ -197,6 +197,8 @@ |
298 |
+ clock-names = "saradc", "apb_pclk"; |
299 |
+ interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; |
300 |
+ #io-channel-cells = <1>; |
301 |
++ resets = <&cru SRST_SARADC>; |
302 |
++ reset-names = "saradc-apb"; |
303 |
+ status = "disabled"; |
304 |
+ }; |
305 |
+ |
306 |
+diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi |
307 |
+index 3b44ef3cff12..fd77e10b4746 100644 |
308 |
+--- a/arch/arm/boot/dts/rk3288.dtsi |
309 |
++++ b/arch/arm/boot/dts/rk3288.dtsi |
310 |
+@@ -279,6 +279,8 @@ |
311 |
+ #io-channel-cells = <1>; |
312 |
+ clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
313 |
+ clock-names = "saradc", "apb_pclk"; |
314 |
++ resets = <&cru SRST_SARADC>; |
315 |
++ reset-names = "saradc-apb"; |
316 |
+ status = "disabled"; |
317 |
+ }; |
318 |
+ |
319 |
+diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi |
320 |
+index 99bbcc2c9b89..e2cd683b4e4b 100644 |
321 |
+--- a/arch/arm/boot/dts/rk3xxx.dtsi |
322 |
++++ b/arch/arm/boot/dts/rk3xxx.dtsi |
323 |
+@@ -399,6 +399,8 @@ |
324 |
+ #io-channel-cells = <1>; |
325 |
+ clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
326 |
+ clock-names = "saradc", "apb_pclk"; |
327 |
++ resets = <&cru SRST_SARADC>; |
328 |
++ reset-names = "saradc-apb"; |
329 |
+ status = "disabled"; |
330 |
+ }; |
331 |
+ |
332 |
+diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi |
333 |
+index d294e82447a2..8b063ab10c19 100644 |
334 |
+--- a/arch/arm/boot/dts/stih407-family.dtsi |
335 |
++++ b/arch/arm/boot/dts/stih407-family.dtsi |
336 |
+@@ -550,8 +550,9 @@ |
337 |
+ interrupt-names = "mmcirq"; |
338 |
+ pinctrl-names = "default"; |
339 |
+ pinctrl-0 = <&pinctrl_mmc0>; |
340 |
+- clock-names = "mmc"; |
341 |
+- clocks = <&clk_s_c0_flexgen CLK_MMC_0>; |
342 |
++ clock-names = "mmc", "icn"; |
343 |
++ clocks = <&clk_s_c0_flexgen CLK_MMC_0>, |
344 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; |
345 |
+ bus-width = <8>; |
346 |
+ non-removable; |
347 |
+ }; |
348 |
+@@ -565,8 +566,9 @@ |
349 |
+ interrupt-names = "mmcirq"; |
350 |
+ pinctrl-names = "default"; |
351 |
+ pinctrl-0 = <&pinctrl_sd1>; |
352 |
+- clock-names = "mmc"; |
353 |
+- clocks = <&clk_s_c0_flexgen CLK_MMC_1>; |
354 |
++ clock-names = "mmc", "icn"; |
355 |
++ clocks = <&clk_s_c0_flexgen CLK_MMC_1>, |
356 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; |
357 |
+ resets = <&softreset STIH407_MMC1_SOFTRESET>; |
358 |
+ bus-width = <4>; |
359 |
+ }; |
360 |
+diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi |
361 |
+index 18ed1ad10d32..40318869c733 100644 |
362 |
+--- a/arch/arm/boot/dts/stih410.dtsi |
363 |
++++ b/arch/arm/boot/dts/stih410.dtsi |
364 |
+@@ -41,7 +41,8 @@ |
365 |
+ compatible = "st,st-ohci-300x"; |
366 |
+ reg = <0x9a03c00 0x100>; |
367 |
+ interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; |
368 |
+- clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; |
369 |
++ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
370 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
371 |
+ resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
372 |
+ <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
373 |
+ reset-names = "power", "softreset"; |
374 |
+@@ -57,7 +58,8 @@ |
375 |
+ interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; |
376 |
+ pinctrl-names = "default"; |
377 |
+ pinctrl-0 = <&pinctrl_usb0>; |
378 |
+- clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; |
379 |
++ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
380 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
381 |
+ resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
382 |
+ <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
383 |
+ reset-names = "power", "softreset"; |
384 |
+@@ -71,7 +73,8 @@ |
385 |
+ compatible = "st,st-ohci-300x"; |
386 |
+ reg = <0x9a83c00 0x100>; |
387 |
+ interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; |
388 |
+- clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; |
389 |
++ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
390 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
391 |
+ resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
392 |
+ <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
393 |
+ reset-names = "power", "softreset"; |
394 |
+@@ -87,7 +90,8 @@ |
395 |
+ interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; |
396 |
+ pinctrl-names = "default"; |
397 |
+ pinctrl-0 = <&pinctrl_usb1>; |
398 |
+- clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; |
399 |
++ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
400 |
++ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
401 |
+ resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
402 |
+ <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
403 |
+ reset-names = "power", "softreset"; |
404 |
+diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c |
405 |
+index f1bde7c4e736..4e1b22a80f55 100644 |
406 |
+--- a/arch/arm/kvm/arm.c |
407 |
++++ b/arch/arm/kvm/arm.c |
408 |
+@@ -157,8 +157,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) |
409 |
+ { |
410 |
+ int i; |
411 |
+ |
412 |
+- kvm_free_stage2_pgd(kvm); |
413 |
+- |
414 |
+ for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
415 |
+ if (kvm->vcpus[i]) { |
416 |
+ kvm_arch_vcpu_free(kvm->vcpus[i]); |
417 |
+diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c |
418 |
+index 45c43aecb8f2..15c8d839c1b3 100644 |
419 |
+--- a/arch/arm/kvm/mmu.c |
420 |
++++ b/arch/arm/kvm/mmu.c |
421 |
+@@ -1909,6 +1909,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm, struct kvm_memslots *slots) |
422 |
+ |
423 |
+ void kvm_arch_flush_shadow_all(struct kvm *kvm) |
424 |
+ { |
425 |
++ kvm_free_stage2_pgd(kvm); |
426 |
+ } |
427 |
+ |
428 |
+ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, |
429 |
+diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c |
430 |
+index 58924b3844df..fe708e26d021 100644 |
431 |
+--- a/arch/arm/mach-imx/pm-imx6.c |
432 |
++++ b/arch/arm/mach-imx/pm-imx6.c |
433 |
+@@ -295,7 +295,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) |
434 |
+ val &= ~BM_CLPCR_SBYOS; |
435 |
+ if (cpu_is_imx6sl()) |
436 |
+ val |= BM_CLPCR_BYPASS_PMIC_READY; |
437 |
+- if (cpu_is_imx6sl() || cpu_is_imx6sx()) |
438 |
++ if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
439 |
+ val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
440 |
+ else |
441 |
+ val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; |
442 |
+@@ -310,7 +310,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) |
443 |
+ val |= 0x3 << BP_CLPCR_STBY_COUNT; |
444 |
+ val |= BM_CLPCR_VSTBY; |
445 |
+ val |= BM_CLPCR_SBYOS; |
446 |
+- if (cpu_is_imx6sl()) |
447 |
++ if (cpu_is_imx6sl() || cpu_is_imx6sx()) |
448 |
+ val |= BM_CLPCR_BYPASS_PMIC_READY; |
449 |
+ if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
450 |
+ val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
451 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |
452 |
+index aed33621deeb..3a350f8879da 100644 |
453 |
+--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |
454 |
++++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |
455 |
+@@ -1476,6 +1476,7 @@ static void omap_hwmod_am43xx_rst(void) |
456 |
+ { |
457 |
+ RSTCTRL(am33xx_pruss_hwmod, AM43XX_RM_PER_RSTCTRL_OFFSET); |
458 |
+ RSTCTRL(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTCTRL_OFFSET); |
459 |
++ RSTST(am33xx_pruss_hwmod, AM43XX_RM_PER_RSTST_OFFSET); |
460 |
+ RSTST(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTST_OFFSET); |
461 |
+ } |
462 |
+ |
463 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
464 |
+index 9869a75c5d96..caf15c8e0c47 100644 |
465 |
+--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
466 |
++++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
467 |
+@@ -722,8 +722,20 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { |
468 |
+ * display serial interface controller |
469 |
+ */ |
470 |
+ |
471 |
++static struct omap_hwmod_class_sysconfig omap3xxx_dsi_sysc = { |
472 |
++ .rev_offs = 0x0000, |
473 |
++ .sysc_offs = 0x0010, |
474 |
++ .syss_offs = 0x0014, |
475 |
++ .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | |
476 |
++ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | |
477 |
++ SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), |
478 |
++ .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), |
479 |
++ .sysc_fields = &omap_hwmod_sysc_type1, |
480 |
++}; |
481 |
++ |
482 |
+ static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { |
483 |
+ .name = "dsi", |
484 |
++ .sysc = &omap3xxx_dsi_sysc, |
485 |
+ }; |
486 |
+ |
487 |
+ static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = { |
488 |
+diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h |
489 |
+index 7c34c44eb0ae..babb5db5a3a4 100644 |
490 |
+--- a/arch/arm/mach-omap2/prcm43xx.h |
491 |
++++ b/arch/arm/mach-omap2/prcm43xx.h |
492 |
+@@ -39,6 +39,7 @@ |
493 |
+ |
494 |
+ /* RM RSTST offsets */ |
495 |
+ #define AM43XX_RM_GFX_RSTST_OFFSET 0x0014 |
496 |
++#define AM43XX_RM_PER_RSTST_OFFSET 0x0014 |
497 |
+ #define AM43XX_RM_WKUP_RSTST_OFFSET 0x0014 |
498 |
+ |
499 |
+ /* CM instances */ |
500 |
+diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c |
501 |
+index c410d84b243d..66070acaa888 100644 |
502 |
+--- a/arch/arm/mach-pxa/idp.c |
503 |
++++ b/arch/arm/mach-pxa/idp.c |
504 |
+@@ -83,7 +83,8 @@ static struct resource smc91x_resources[] = { |
505 |
+ }; |
506 |
+ |
507 |
+ static struct smc91x_platdata smc91x_platdata = { |
508 |
+- .flags = SMC91X_USE_32BIT | SMC91X_USE_DMA | SMC91X_NOWAIT, |
509 |
++ .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
510 |
++ SMC91X_USE_DMA | SMC91X_NOWAIT, |
511 |
+ }; |
512 |
+ |
513 |
+ static struct platform_device smc91x_device = { |
514 |
+diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c |
515 |
+index 3f06cd90567a..056369ef250e 100644 |
516 |
+--- a/arch/arm/mach-pxa/xcep.c |
517 |
++++ b/arch/arm/mach-pxa/xcep.c |
518 |
+@@ -120,7 +120,8 @@ static struct resource smc91x_resources[] = { |
519 |
+ }; |
520 |
+ |
521 |
+ static struct smc91x_platdata xcep_smc91x_info = { |
522 |
+- .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA, |
523 |
++ .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
524 |
++ SMC91X_NOWAIT | SMC91X_USE_DMA, |
525 |
+ }; |
526 |
+ |
527 |
+ static struct platform_device smc91x_device = { |
528 |
+diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c |
529 |
+index baf174542e36..a0ead0ae23d6 100644 |
530 |
+--- a/arch/arm/mach-realview/core.c |
531 |
++++ b/arch/arm/mach-realview/core.c |
532 |
+@@ -93,7 +93,8 @@ static struct smsc911x_platform_config smsc911x_config = { |
533 |
+ }; |
534 |
+ |
535 |
+ static struct smc91x_platdata smc91x_platdata = { |
536 |
+- .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
537 |
++ .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
538 |
++ SMC91X_NOWAIT, |
539 |
+ }; |
540 |
+ |
541 |
+ static struct platform_device realview_eth_device = { |
542 |
+diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c |
543 |
+index 1525d7b5f1b7..88149f85bc49 100644 |
544 |
+--- a/arch/arm/mach-sa1100/pleb.c |
545 |
++++ b/arch/arm/mach-sa1100/pleb.c |
546 |
+@@ -45,7 +45,7 @@ static struct resource smc91x_resources[] = { |
547 |
+ }; |
548 |
+ |
549 |
+ static struct smc91x_platdata smc91x_platdata = { |
550 |
+- .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
551 |
++ .flags = SMC91X_USE_16BIT | SMC91X_USE_8BIT | SMC91X_NOWAIT, |
552 |
+ }; |
553 |
+ |
554 |
+ static struct platform_device smc91x_device = { |
555 |
+diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h |
556 |
+index e875a5a551d7..89206b568cd4 100644 |
557 |
+--- a/arch/arm64/include/asm/spinlock.h |
558 |
++++ b/arch/arm64/include/asm/spinlock.h |
559 |
+@@ -363,4 +363,14 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) |
560 |
+ #define arch_read_relax(lock) cpu_relax() |
561 |
+ #define arch_write_relax(lock) cpu_relax() |
562 |
+ |
563 |
++/* |
564 |
++ * Accesses appearing in program order before a spin_lock() operation |
565 |
++ * can be reordered with accesses inside the critical section, by virtue |
566 |
++ * of arch_spin_lock being constructed using acquire semantics. |
567 |
++ * |
568 |
++ * In cases where this is problematic (e.g. try_to_wake_up), an |
569 |
++ * smp_mb__before_spinlock() can restore the required ordering. |
570 |
++ */ |
571 |
++#define smp_mb__before_spinlock() smp_mb() |
572 |
++ |
573 |
+ #endif /* __ASM_SPINLOCK_H */ |
574 |
+diff --git a/arch/avr32/include/asm/uaccess.h b/arch/avr32/include/asm/uaccess.h |
575 |
+index 68cf638faf48..b1ec1fa06463 100644 |
576 |
+--- a/arch/avr32/include/asm/uaccess.h |
577 |
++++ b/arch/avr32/include/asm/uaccess.h |
578 |
+@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from, |
579 |
+ |
580 |
+ extern __kernel_size_t copy_to_user(void __user *to, const void *from, |
581 |
+ __kernel_size_t n); |
582 |
+-extern __kernel_size_t copy_from_user(void *to, const void __user *from, |
583 |
++extern __kernel_size_t ___copy_from_user(void *to, const void __user *from, |
584 |
+ __kernel_size_t n); |
585 |
+ |
586 |
+ static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, |
587 |
+@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, |
588 |
+ { |
589 |
+ return __copy_user(to, (const void __force *)from, n); |
590 |
+ } |
591 |
++static inline __kernel_size_t copy_from_user(void *to, |
592 |
++ const void __user *from, |
593 |
++ __kernel_size_t n) |
594 |
++{ |
595 |
++ size_t res = ___copy_from_user(to, from, n); |
596 |
++ if (unlikely(res)) |
597 |
++ memset(to + (n - res), 0, res); |
598 |
++ return res; |
599 |
++} |
600 |
+ |
601 |
+ #define __copy_to_user_inatomic __copy_to_user |
602 |
+ #define __copy_from_user_inatomic __copy_from_user |
603 |
+diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c |
604 |
+index d93ead02daed..7c6cf14f0985 100644 |
605 |
+--- a/arch/avr32/kernel/avr32_ksyms.c |
606 |
++++ b/arch/avr32/kernel/avr32_ksyms.c |
607 |
+@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page); |
608 |
+ /* |
609 |
+ * Userspace access stuff. |
610 |
+ */ |
611 |
+-EXPORT_SYMBOL(copy_from_user); |
612 |
++EXPORT_SYMBOL(___copy_from_user); |
613 |
+ EXPORT_SYMBOL(copy_to_user); |
614 |
+ EXPORT_SYMBOL(__copy_user); |
615 |
+ EXPORT_SYMBOL(strncpy_from_user); |
616 |
+diff --git a/arch/avr32/lib/copy_user.S b/arch/avr32/lib/copy_user.S |
617 |
+index ea59c04b07de..075373471da1 100644 |
618 |
+--- a/arch/avr32/lib/copy_user.S |
619 |
++++ b/arch/avr32/lib/copy_user.S |
620 |
+@@ -23,13 +23,13 @@ |
621 |
+ */ |
622 |
+ .text |
623 |
+ .align 1 |
624 |
+- .global copy_from_user |
625 |
+- .type copy_from_user, @function |
626 |
+-copy_from_user: |
627 |
++ .global ___copy_from_user |
628 |
++ .type ___copy_from_user, @function |
629 |
++___copy_from_user: |
630 |
+ branch_if_kernel r8, __copy_user |
631 |
+ ret_if_privileged r8, r11, r10, r10 |
632 |
+ rjmp __copy_user |
633 |
+- .size copy_from_user, . - copy_from_user |
634 |
++ .size ___copy_from_user, . - ___copy_from_user |
635 |
+ |
636 |
+ .global copy_to_user |
637 |
+ .type copy_to_user, @function |
638 |
+diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h |
639 |
+index 12f5d6851bbc..0a2a70096d8b 100644 |
640 |
+--- a/arch/blackfin/include/asm/uaccess.h |
641 |
++++ b/arch/blackfin/include/asm/uaccess.h |
642 |
+@@ -171,11 +171,12 @@ static inline int bad_user_access_length(void) |
643 |
+ static inline unsigned long __must_check |
644 |
+ copy_from_user(void *to, const void __user *from, unsigned long n) |
645 |
+ { |
646 |
+- if (access_ok(VERIFY_READ, from, n)) |
647 |
++ if (likely(access_ok(VERIFY_READ, from, n))) { |
648 |
+ memcpy(to, (const void __force *)from, n); |
649 |
+- else |
650 |
+- return n; |
651 |
+- return 0; |
652 |
++ return 0; |
653 |
++ } |
654 |
++ memset(to, 0, n); |
655 |
++ return n; |
656 |
+ } |
657 |
+ |
658 |
+ static inline unsigned long __must_check |
659 |
+diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c |
660 |
+index c6db52ba3a06..10c57771822d 100644 |
661 |
+--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c |
662 |
++++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c |
663 |
+@@ -146,7 +146,8 @@ static struct platform_device hitachi_fb_device = { |
664 |
+ #include <linux/smc91x.h> |
665 |
+ |
666 |
+ static struct smc91x_platdata smc91x_info = { |
667 |
+- .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
668 |
++ .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
669 |
++ SMC91X_NOWAIT, |
670 |
+ .leda = RPC_LED_100_10, |
671 |
+ .ledb = RPC_LED_TX_RX, |
672 |
+ }; |
673 |
+diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c |
674 |
+index f35525b55819..57d1c43726d9 100644 |
675 |
+--- a/arch/blackfin/mach-bf561/boards/ezkit.c |
676 |
++++ b/arch/blackfin/mach-bf561/boards/ezkit.c |
677 |
+@@ -134,7 +134,8 @@ static struct platform_device net2272_bfin_device = { |
678 |
+ #include <linux/smc91x.h> |
679 |
+ |
680 |
+ static struct smc91x_platdata smc91x_info = { |
681 |
+- .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
682 |
++ .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
683 |
++ SMC91X_NOWAIT, |
684 |
+ .leda = RPC_LED_100_10, |
685 |
+ .ledb = RPC_LED_TX_RX, |
686 |
+ }; |
687 |
+diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h |
688 |
+index e3530d0f13ee..56c7d5750abd 100644 |
689 |
+--- a/arch/cris/include/asm/uaccess.h |
690 |
++++ b/arch/cris/include/asm/uaccess.h |
691 |
+@@ -194,30 +194,6 @@ extern unsigned long __copy_user(void __user *to, const void *from, unsigned lon |
692 |
+ extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); |
693 |
+ extern unsigned long __do_clear_user(void __user *to, unsigned long n); |
694 |
+ |
695 |
+-static inline unsigned long |
696 |
+-__generic_copy_to_user(void __user *to, const void *from, unsigned long n) |
697 |
+-{ |
698 |
+- if (access_ok(VERIFY_WRITE, to, n)) |
699 |
+- return __copy_user(to, from, n); |
700 |
+- return n; |
701 |
+-} |
702 |
+- |
703 |
+-static inline unsigned long |
704 |
+-__generic_copy_from_user(void *to, const void __user *from, unsigned long n) |
705 |
+-{ |
706 |
+- if (access_ok(VERIFY_READ, from, n)) |
707 |
+- return __copy_user_zeroing(to, from, n); |
708 |
+- return n; |
709 |
+-} |
710 |
+- |
711 |
+-static inline unsigned long |
712 |
+-__generic_clear_user(void __user *to, unsigned long n) |
713 |
+-{ |
714 |
+- if (access_ok(VERIFY_WRITE, to, n)) |
715 |
+- return __do_clear_user(to, n); |
716 |
+- return n; |
717 |
+-} |
718 |
+- |
719 |
+ static inline long |
720 |
+ __strncpy_from_user(char *dst, const char __user *src, long count) |
721 |
+ { |
722 |
+@@ -282,7 +258,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) |
723 |
+ else if (n == 24) |
724 |
+ __asm_copy_from_user_24(to, from, ret); |
725 |
+ else |
726 |
+- ret = __generic_copy_from_user(to, from, n); |
727 |
++ ret = __copy_user_zeroing(to, from, n); |
728 |
+ |
729 |
+ return ret; |
730 |
+ } |
731 |
+@@ -333,7 +309,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) |
732 |
+ else if (n == 24) |
733 |
+ __asm_copy_to_user_24(to, from, ret); |
734 |
+ else |
735 |
+- ret = __generic_copy_to_user(to, from, n); |
736 |
++ ret = __copy_user(to, from, n); |
737 |
+ |
738 |
+ return ret; |
739 |
+ } |
740 |
+@@ -366,26 +342,43 @@ __constant_clear_user(void __user *to, unsigned long n) |
741 |
+ else if (n == 24) |
742 |
+ __asm_clear_24(to, ret); |
743 |
+ else |
744 |
+- ret = __generic_clear_user(to, n); |
745 |
++ ret = __do_clear_user(to, n); |
746 |
+ |
747 |
+ return ret; |
748 |
+ } |
749 |
+ |
750 |
+ |
751 |
+-#define clear_user(to, n) \ |
752 |
+- (__builtin_constant_p(n) ? \ |
753 |
+- __constant_clear_user(to, n) : \ |
754 |
+- __generic_clear_user(to, n)) |
755 |
++static inline size_t clear_user(void __user *to, size_t n) |
756 |
++{ |
757 |
++ if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
758 |
++ return n; |
759 |
++ if (__builtin_constant_p(n)) |
760 |
++ return __constant_clear_user(to, n); |
761 |
++ else |
762 |
++ return __do_clear_user(to, n); |
763 |
++} |
764 |
+ |
765 |
+-#define copy_from_user(to, from, n) \ |
766 |
+- (__builtin_constant_p(n) ? \ |
767 |
+- __constant_copy_from_user(to, from, n) : \ |
768 |
+- __generic_copy_from_user(to, from, n)) |
769 |
++static inline size_t copy_from_user(void *to, const void __user *from, size_t n) |
770 |
++{ |
771 |
++ if (unlikely(!access_ok(VERIFY_READ, from, n))) { |
772 |
++ memset(to, 0, n); |
773 |
++ return n; |
774 |
++ } |
775 |
++ if (__builtin_constant_p(n)) |
776 |
++ return __constant_copy_from_user(to, from, n); |
777 |
++ else |
778 |
++ return __copy_user_zeroing(to, from, n); |
779 |
++} |
780 |
+ |
781 |
+-#define copy_to_user(to, from, n) \ |
782 |
+- (__builtin_constant_p(n) ? \ |
783 |
+- __constant_copy_to_user(to, from, n) : \ |
784 |
+- __generic_copy_to_user(to, from, n)) |
785 |
++static inline size_t copy_to_user(void __user *to, const void *from, size_t n) |
786 |
++{ |
787 |
++ if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
788 |
++ return n; |
789 |
++ if (__builtin_constant_p(n)) |
790 |
++ return __constant_copy_to_user(to, from, n); |
791 |
++ else |
792 |
++ return __copy_user(to, from, n); |
793 |
++} |
794 |
+ |
795 |
+ /* We let the __ versions of copy_from/to_user inline, because they're often |
796 |
+ * used in fast paths and have only a small space overhead. |
797 |
+diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h |
798 |
+index 3ac9a59d65d4..87d9e34c5df8 100644 |
799 |
+--- a/arch/frv/include/asm/uaccess.h |
800 |
++++ b/arch/frv/include/asm/uaccess.h |
801 |
+@@ -263,19 +263,25 @@ do { \ |
802 |
+ extern long __memset_user(void *dst, unsigned long count); |
803 |
+ extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
804 |
+ |
805 |
+-#define clear_user(dst,count) __memset_user(____force(dst), (count)) |
806 |
++#define __clear_user(dst,count) __memset_user(____force(dst), (count)) |
807 |
+ #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) |
808 |
+ #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) |
809 |
+ |
810 |
+ #else |
811 |
+ |
812 |
+-#define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
813 |
++#define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
814 |
+ #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) |
815 |
+ #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) |
816 |
+ |
817 |
+ #endif |
818 |
+ |
819 |
+-#define __clear_user clear_user |
820 |
++static inline unsigned long __must_check |
821 |
++clear_user(void __user *to, unsigned long n) |
822 |
++{ |
823 |
++ if (likely(__access_ok(to, n))) |
824 |
++ n = __clear_user(to, n); |
825 |
++ return n; |
826 |
++} |
827 |
+ |
828 |
+ static inline unsigned long __must_check |
829 |
+ __copy_to_user(void __user *to, const void *from, unsigned long n) |
830 |
+diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h |
831 |
+index f000a382bc7f..f61cfb28e9f2 100644 |
832 |
+--- a/arch/hexagon/include/asm/uaccess.h |
833 |
++++ b/arch/hexagon/include/asm/uaccess.h |
834 |
+@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src, |
835 |
+ { |
836 |
+ long res = __strnlen_user(src, n); |
837 |
+ |
838 |
+- /* return from strnlen can't be zero -- that would be rubbish. */ |
839 |
++ if (unlikely(!res)) |
840 |
++ return -EFAULT; |
841 |
+ |
842 |
+ if (res > n) { |
843 |
+ copy_from_user(dst, src, n); |
844 |
+diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h |
845 |
+index 2189d5ddc1ee..ebcd8a15338b 100644 |
846 |
+--- a/arch/ia64/include/asm/uaccess.h |
847 |
++++ b/arch/ia64/include/asm/uaccess.h |
848 |
+@@ -263,17 +263,15 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) |
849 |
+ __cu_len; \ |
850 |
+ }) |
851 |
+ |
852 |
+-#define copy_from_user(to, from, n) \ |
853 |
+-({ \ |
854 |
+- void *__cu_to = (to); \ |
855 |
+- const void __user *__cu_from = (from); \ |
856 |
+- long __cu_len = (n); \ |
857 |
+- \ |
858 |
+- __chk_user_ptr(__cu_from); \ |
859 |
+- if (__access_ok(__cu_from, __cu_len, get_fs())) \ |
860 |
+- __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ |
861 |
+- __cu_len; \ |
862 |
+-}) |
863 |
++static inline unsigned long |
864 |
++copy_from_user(void *to, const void __user *from, unsigned long n) |
865 |
++{ |
866 |
++ if (likely(__access_ok(from, n, get_fs()))) |
867 |
++ n = __copy_user((__force void __user *) to, from, n); |
868 |
++ else |
869 |
++ memset(to, 0, n); |
870 |
++ return n; |
871 |
++} |
872 |
+ |
873 |
+ #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) |
874 |
+ |
875 |
+diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h |
876 |
+index cac7014daef3..6f8982157a75 100644 |
877 |
+--- a/arch/m32r/include/asm/uaccess.h |
878 |
++++ b/arch/m32r/include/asm/uaccess.h |
879 |
+@@ -219,7 +219,7 @@ extern int fixup_exception(struct pt_regs *regs); |
880 |
+ #define __get_user_nocheck(x, ptr, size) \ |
881 |
+ ({ \ |
882 |
+ long __gu_err = 0; \ |
883 |
+- unsigned long __gu_val; \ |
884 |
++ unsigned long __gu_val = 0; \ |
885 |
+ might_fault(); \ |
886 |
+ __get_user_size(__gu_val, (ptr), (size), __gu_err); \ |
887 |
+ (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
888 |
+diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h |
889 |
+index 8282cbce7e39..273e61225c27 100644 |
890 |
+--- a/arch/metag/include/asm/uaccess.h |
891 |
++++ b/arch/metag/include/asm/uaccess.h |
892 |
+@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to, |
893 |
+ static inline unsigned long |
894 |
+ copy_from_user(void *to, const void __user *from, unsigned long n) |
895 |
+ { |
896 |
+- if (access_ok(VERIFY_READ, from, n)) |
897 |
++ if (likely(access_ok(VERIFY_READ, from, n))) |
898 |
+ return __copy_user_zeroing(to, from, n); |
899 |
++ memset(to, 0, n); |
900 |
+ return n; |
901 |
+ } |
902 |
+ |
903 |
+diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h |
904 |
+index 331b0d35f89c..826676778094 100644 |
905 |
+--- a/arch/microblaze/include/asm/uaccess.h |
906 |
++++ b/arch/microblaze/include/asm/uaccess.h |
907 |
+@@ -227,7 +227,7 @@ extern long __user_bad(void); |
908 |
+ |
909 |
+ #define __get_user(x, ptr) \ |
910 |
+ ({ \ |
911 |
+- unsigned long __gu_val; \ |
912 |
++ unsigned long __gu_val = 0; \ |
913 |
+ /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ |
914 |
+ long __gu_err; \ |
915 |
+ switch (sizeof(*(ptr))) { \ |
916 |
+@@ -373,10 +373,13 @@ extern long __user_bad(void); |
917 |
+ static inline long copy_from_user(void *to, |
918 |
+ const void __user *from, unsigned long n) |
919 |
+ { |
920 |
++ unsigned long res = n; |
921 |
+ might_fault(); |
922 |
+- if (access_ok(VERIFY_READ, from, n)) |
923 |
+- return __copy_from_user(to, from, n); |
924 |
+- return n; |
925 |
++ if (likely(access_ok(VERIFY_READ, from, n))) |
926 |
++ res = __copy_from_user(to, from, n); |
927 |
++ if (unlikely(res)) |
928 |
++ memset(to + (n - res), 0, res); |
929 |
++ return res; |
930 |
+ } |
931 |
+ |
932 |
+ #define __copy_to_user(to, from, n) \ |
933 |
+diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h |
934 |
+index 7f109d4f64a4..b6e20f3053f4 100644 |
935 |
+--- a/arch/mips/include/asm/uaccess.h |
936 |
++++ b/arch/mips/include/asm/uaccess.h |
937 |
+@@ -14,6 +14,7 @@ |
938 |
+ #include <linux/kernel.h> |
939 |
+ #include <linux/errno.h> |
940 |
+ #include <linux/thread_info.h> |
941 |
++#include <linux/string.h> |
942 |
+ #include <asm/asm-eva.h> |
943 |
+ |
944 |
+ /* |
945 |
+@@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); |
946 |
+ __cu_len = __invoke_copy_from_user(__cu_to, \ |
947 |
+ __cu_from, \ |
948 |
+ __cu_len); \ |
949 |
++ } else { \ |
950 |
++ memset(__cu_to, 0, __cu_len); \ |
951 |
+ } \ |
952 |
+ } \ |
953 |
+ __cu_len; \ |
954 |
+diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c |
955 |
+index ad2270ff83d1..38bfbc9066eb 100644 |
956 |
+--- a/arch/mips/kvm/tlb.c |
957 |
++++ b/arch/mips/kvm/tlb.c |
958 |
+@@ -159,7 +159,7 @@ static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) |
959 |
+ srcu_idx = srcu_read_lock(&kvm->srcu); |
960 |
+ pfn = kvm_mips_gfn_to_pfn(kvm, gfn); |
961 |
+ |
962 |
+- if (kvm_mips_is_error_pfn(pfn)) { |
963 |
++ if (is_error_noslot_pfn(pfn)) { |
964 |
+ kvm_err("Couldn't get pfn for gfn %#" PRIx64 "!\n", gfn); |
965 |
+ err = -EFAULT; |
966 |
+ goto out; |
967 |
+diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h |
968 |
+index 20f7bf6de384..d012e877a95a 100644 |
969 |
+--- a/arch/mn10300/include/asm/uaccess.h |
970 |
++++ b/arch/mn10300/include/asm/uaccess.h |
971 |
+@@ -166,6 +166,7 @@ struct __large_struct { unsigned long buf[100]; }; |
972 |
+ "2:\n" \ |
973 |
+ " .section .fixup,\"ax\"\n" \ |
974 |
+ "3:\n\t" \ |
975 |
++ " mov 0,%1\n" \ |
976 |
+ " mov %3,%0\n" \ |
977 |
+ " jmp 2b\n" \ |
978 |
+ " .previous\n" \ |
979 |
+diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c |
980 |
+index 7826e6c364e7..ce8899e5e171 100644 |
981 |
+--- a/arch/mn10300/lib/usercopy.c |
982 |
++++ b/arch/mn10300/lib/usercopy.c |
983 |
+@@ -9,7 +9,7 @@ |
984 |
+ * as published by the Free Software Foundation; either version |
985 |
+ * 2 of the Licence, or (at your option) any later version. |
986 |
+ */ |
987 |
+-#include <asm/uaccess.h> |
988 |
++#include <linux/uaccess.h> |
989 |
+ |
990 |
+ unsigned long |
991 |
+ __generic_copy_to_user(void *to, const void *from, unsigned long n) |
992 |
+@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) |
993 |
+ { |
994 |
+ if (access_ok(VERIFY_READ, from, n)) |
995 |
+ __copy_user_zeroing(to, from, n); |
996 |
++ else |
997 |
++ memset(to, 0, n); |
998 |
+ return n; |
999 |
+ } |
1000 |
+ |
1001 |
+diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h |
1002 |
+index caa51ff85a3c..0ab82324c817 100644 |
1003 |
+--- a/arch/nios2/include/asm/uaccess.h |
1004 |
++++ b/arch/nios2/include/asm/uaccess.h |
1005 |
+@@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *to, const void *from, unsigned long n); |
1006 |
+ static inline long copy_from_user(void *to, const void __user *from, |
1007 |
+ unsigned long n) |
1008 |
+ { |
1009 |
+- if (!access_ok(VERIFY_READ, from, n)) |
1010 |
+- return n; |
1011 |
+- return __copy_from_user(to, from, n); |
1012 |
++ unsigned long res = n; |
1013 |
++ if (access_ok(VERIFY_READ, from, n)) |
1014 |
++ res = __copy_from_user(to, from, n); |
1015 |
++ if (unlikely(res)) |
1016 |
++ memset(to + (n - res), 0, res); |
1017 |
++ return res; |
1018 |
+ } |
1019 |
+ |
1020 |
+ static inline long copy_to_user(void __user *to, const void *from, |
1021 |
+@@ -139,7 +142,7 @@ extern long strnlen_user(const char __user *s, long n); |
1022 |
+ |
1023 |
+ #define __get_user_unknown(val, size, ptr, err) do { \ |
1024 |
+ err = 0; \ |
1025 |
+- if (copy_from_user(&(val), ptr, size)) { \ |
1026 |
++ if (__copy_from_user(&(val), ptr, size)) { \ |
1027 |
+ err = -EFAULT; \ |
1028 |
+ } \ |
1029 |
+ } while (0) |
1030 |
+@@ -166,7 +169,7 @@ do { \ |
1031 |
+ ({ \ |
1032 |
+ long __gu_err = -EFAULT; \ |
1033 |
+ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
1034 |
+- unsigned long __gu_val; \ |
1035 |
++ unsigned long __gu_val = 0; \ |
1036 |
+ __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
1037 |
+ (x) = (__force __typeof__(x))__gu_val; \ |
1038 |
+ __gu_err; \ |
1039 |
+diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h |
1040 |
+index a6bd07ca3d6c..5cc6b4f1b795 100644 |
1041 |
+--- a/arch/openrisc/include/asm/uaccess.h |
1042 |
++++ b/arch/openrisc/include/asm/uaccess.h |
1043 |
+@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void *from, unsigned long size); |
1044 |
+ static inline unsigned long |
1045 |
+ copy_from_user(void *to, const void *from, unsigned long n) |
1046 |
+ { |
1047 |
+- unsigned long over; |
1048 |
+- |
1049 |
+- if (access_ok(VERIFY_READ, from, n)) |
1050 |
+- return __copy_tofrom_user(to, from, n); |
1051 |
+- if ((unsigned long)from < TASK_SIZE) { |
1052 |
+- over = (unsigned long)from + n - TASK_SIZE; |
1053 |
+- return __copy_tofrom_user(to, from, n - over) + over; |
1054 |
+- } |
1055 |
+- return n; |
1056 |
++ unsigned long res = n; |
1057 |
++ |
1058 |
++ if (likely(access_ok(VERIFY_READ, from, n))) |
1059 |
++ res = __copy_tofrom_user(to, from, n); |
1060 |
++ if (unlikely(res)) |
1061 |
++ memset(to + (n - res), 0, res); |
1062 |
++ return res; |
1063 |
+ } |
1064 |
+ |
1065 |
+ static inline unsigned long |
1066 |
+ copy_to_user(void *to, const void *from, unsigned long n) |
1067 |
+ { |
1068 |
+- unsigned long over; |
1069 |
+- |
1070 |
+- if (access_ok(VERIFY_WRITE, to, n)) |
1071 |
+- return __copy_tofrom_user(to, from, n); |
1072 |
+- if ((unsigned long)to < TASK_SIZE) { |
1073 |
+- over = (unsigned long)to + n - TASK_SIZE; |
1074 |
+- return __copy_tofrom_user(to, from, n - over) + over; |
1075 |
+- } |
1076 |
++ if (likely(access_ok(VERIFY_WRITE, to, n))) |
1077 |
++ n = __copy_tofrom_user(to, from, n); |
1078 |
+ return n; |
1079 |
+ } |
1080 |
+ |
1081 |
+@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *addr, unsigned long size); |
1082 |
+ static inline __must_check unsigned long |
1083 |
+ clear_user(void *addr, unsigned long size) |
1084 |
+ { |
1085 |
+- |
1086 |
+- if (access_ok(VERIFY_WRITE, addr, size)) |
1087 |
+- return __clear_user(addr, size); |
1088 |
+- if ((unsigned long)addr < TASK_SIZE) { |
1089 |
+- unsigned long over = (unsigned long)addr + size - TASK_SIZE; |
1090 |
+- return __clear_user(addr, size - over) + over; |
1091 |
+- } |
1092 |
++ if (likely(access_ok(VERIFY_WRITE, addr, size))) |
1093 |
++ size = __clear_user(addr, size); |
1094 |
+ return size; |
1095 |
+ } |
1096 |
+ |
1097 |
+diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h |
1098 |
+index 0f59fd9ca205..37a1bee96444 100644 |
1099 |
+--- a/arch/parisc/include/asm/uaccess.h |
1100 |
++++ b/arch/parisc/include/asm/uaccess.h |
1101 |
+@@ -10,6 +10,7 @@ |
1102 |
+ #include <asm-generic/uaccess-unaligned.h> |
1103 |
+ |
1104 |
+ #include <linux/bug.h> |
1105 |
++#include <linux/string.h> |
1106 |
+ |
1107 |
+ #define VERIFY_READ 0 |
1108 |
+ #define VERIFY_WRITE 1 |
1109 |
+@@ -221,13 +222,14 @@ static inline unsigned long __must_check copy_from_user(void *to, |
1110 |
+ unsigned long n) |
1111 |
+ { |
1112 |
+ int sz = __compiletime_object_size(to); |
1113 |
+- int ret = -EFAULT; |
1114 |
++ unsigned long ret = n; |
1115 |
+ |
1116 |
+ if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n)) |
1117 |
+ ret = __copy_from_user(to, from, n); |
1118 |
+ else |
1119 |
+ copy_from_user_overflow(); |
1120 |
+- |
1121 |
++ if (unlikely(ret)) |
1122 |
++ memset(to + (n - ret), 0, ret); |
1123 |
+ return ret; |
1124 |
+ } |
1125 |
+ |
1126 |
+diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h |
1127 |
+index b7c20f0b8fbe..43888c8b9d1c 100644 |
1128 |
+--- a/arch/powerpc/include/asm/uaccess.h |
1129 |
++++ b/arch/powerpc/include/asm/uaccess.h |
1130 |
+@@ -308,30 +308,17 @@ extern unsigned long __copy_tofrom_user(void __user *to, |
1131 |
+ static inline unsigned long copy_from_user(void *to, |
1132 |
+ const void __user *from, unsigned long n) |
1133 |
+ { |
1134 |
+- unsigned long over; |
1135 |
+- |
1136 |
+- if (access_ok(VERIFY_READ, from, n)) |
1137 |
++ if (likely(access_ok(VERIFY_READ, from, n))) |
1138 |
+ return __copy_tofrom_user((__force void __user *)to, from, n); |
1139 |
+- if ((unsigned long)from < TASK_SIZE) { |
1140 |
+- over = (unsigned long)from + n - TASK_SIZE; |
1141 |
+- return __copy_tofrom_user((__force void __user *)to, from, |
1142 |
+- n - over) + over; |
1143 |
+- } |
1144 |
++ memset(to, 0, n); |
1145 |
+ return n; |
1146 |
+ } |
1147 |
+ |
1148 |
+ static inline unsigned long copy_to_user(void __user *to, |
1149 |
+ const void *from, unsigned long n) |
1150 |
+ { |
1151 |
+- unsigned long over; |
1152 |
+- |
1153 |
+ if (access_ok(VERIFY_WRITE, to, n)) |
1154 |
+ return __copy_tofrom_user(to, (__force void __user *)from, n); |
1155 |
+- if ((unsigned long)to < TASK_SIZE) { |
1156 |
+- over = (unsigned long)to + n - TASK_SIZE; |
1157 |
+- return __copy_tofrom_user(to, (__force void __user *)from, |
1158 |
+- n - over) + over; |
1159 |
+- } |
1160 |
+ return n; |
1161 |
+ } |
1162 |
+ |
1163 |
+@@ -422,10 +409,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) |
1164 |
+ might_fault(); |
1165 |
+ if (likely(access_ok(VERIFY_WRITE, addr, size))) |
1166 |
+ return __clear_user(addr, size); |
1167 |
+- if ((unsigned long)addr < TASK_SIZE) { |
1168 |
+- unsigned long over = (unsigned long)addr + size - TASK_SIZE; |
1169 |
+- return __clear_user(addr, size - over) + over; |
1170 |
+- } |
1171 |
+ return size; |
1172 |
+ } |
1173 |
+ |
1174 |
+diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S |
1175 |
+index 73e461a3dfbb..96fd031a3f78 100644 |
1176 |
+--- a/arch/powerpc/kernel/entry_64.S |
1177 |
++++ b/arch/powerpc/kernel/entry_64.S |
1178 |
+@@ -368,13 +368,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) |
1179 |
+ tabort_syscall: |
1180 |
+ /* Firstly we need to enable TM in the kernel */ |
1181 |
+ mfmsr r10 |
1182 |
+- li r13, 1 |
1183 |
+- rldimi r10, r13, MSR_TM_LG, 63-MSR_TM_LG |
1184 |
++ li r9, 1 |
1185 |
++ rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG |
1186 |
+ mtmsrd r10, 0 |
1187 |
+ |
1188 |
+ /* tabort, this dooms the transaction, nothing else */ |
1189 |
+- li r13, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) |
1190 |
+- TABORT(R13) |
1191 |
++ li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) |
1192 |
++ TABORT(R9) |
1193 |
+ |
1194 |
+ /* |
1195 |
+ * Return directly to userspace. We have corrupted user register state, |
1196 |
+@@ -382,8 +382,8 @@ tabort_syscall: |
1197 |
+ * resume after the tbegin of the aborted transaction with the |
1198 |
+ * checkpointed register state. |
1199 |
+ */ |
1200 |
+- li r13, MSR_RI |
1201 |
+- andc r10, r10, r13 |
1202 |
++ li r9, MSR_RI |
1203 |
++ andc r10, r10, r9 |
1204 |
+ mtmsrd r10, 1 |
1205 |
+ mtspr SPRN_SRR0, r11 |
1206 |
+ mtspr SPRN_SRR1, r12 |
1207 |
+diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S |
1208 |
+index d90870a66b60..aa8214f30c92 100644 |
1209 |
+--- a/arch/powerpc/lib/checksum_32.S |
1210 |
++++ b/arch/powerpc/lib/checksum_32.S |
1211 |
+@@ -127,17 +127,19 @@ _GLOBAL(csum_partial_copy_generic) |
1212 |
+ stw r7,12(r1) |
1213 |
+ stw r8,8(r1) |
1214 |
+ |
1215 |
+- andi. r0,r4,1 /* is destination address even ? */ |
1216 |
+- cmplwi cr7,r0,0 |
1217 |
+ addic r12,r6,0 |
1218 |
+ addi r6,r4,-4 |
1219 |
+ neg r0,r4 |
1220 |
+ addi r4,r3,-4 |
1221 |
+ andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ |
1222 |
++ crset 4*cr7+eq |
1223 |
+ beq 58f |
1224 |
+ |
1225 |
+ cmplw 0,r5,r0 /* is this more than total to do? */ |
1226 |
+ blt 63f /* if not much to do */ |
1227 |
++ rlwinm r7,r6,3,0x8 |
1228 |
++ rlwnm r12,r12,r7,0,31 /* odd destination address: rotate one byte */ |
1229 |
++ cmplwi cr7,r7,0 /* is destination address even ? */ |
1230 |
+ andi. r8,r0,3 /* get it word-aligned first */ |
1231 |
+ mtctr r8 |
1232 |
+ beq+ 61f |
1233 |
+@@ -237,7 +239,7 @@ _GLOBAL(csum_partial_copy_generic) |
1234 |
+ 66: addze r3,r12 |
1235 |
+ addi r1,r1,16 |
1236 |
+ beqlr+ cr7 |
1237 |
+- rlwinm r3,r3,8,0,31 /* swap bytes for odd destination */ |
1238 |
++ rlwinm r3,r3,8,0,31 /* odd destination address: rotate one byte */ |
1239 |
+ blr |
1240 |
+ |
1241 |
+ /* read fault */ |
1242 |
+diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S |
1243 |
+index dfdb90cb4403..9f1983404e1a 100644 |
1244 |
+--- a/arch/powerpc/mm/slb_low.S |
1245 |
++++ b/arch/powerpc/mm/slb_low.S |
1246 |
+@@ -113,7 +113,12 @@ BEGIN_FTR_SECTION |
1247 |
+ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) |
1248 |
+ b slb_finish_load_1T |
1249 |
+ |
1250 |
+-0: |
1251 |
++0: /* |
1252 |
++ * For userspace addresses, make sure this is region 0. |
1253 |
++ */ |
1254 |
++ cmpdi r9, 0 |
1255 |
++ bne 8f |
1256 |
++ |
1257 |
+ /* when using slices, we extract the psize off the slice bitmaps |
1258 |
+ * and then we need to get the sllp encoding off the mmu_psize_defs |
1259 |
+ * array. |
1260 |
+diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c |
1261 |
+index 2ee96431f736..4c827826c05e 100644 |
1262 |
+--- a/arch/powerpc/platforms/powernv/opal-dump.c |
1263 |
++++ b/arch/powerpc/platforms/powernv/opal-dump.c |
1264 |
+@@ -370,6 +370,7 @@ static irqreturn_t process_dump(int irq, void *data) |
1265 |
+ uint32_t dump_id, dump_size, dump_type; |
1266 |
+ struct dump_obj *dump; |
1267 |
+ char name[22]; |
1268 |
++ struct kobject *kobj; |
1269 |
+ |
1270 |
+ rc = dump_read_info(&dump_id, &dump_size, &dump_type); |
1271 |
+ if (rc != OPAL_SUCCESS) |
1272 |
+@@ -381,8 +382,12 @@ static irqreturn_t process_dump(int irq, void *data) |
1273 |
+ * that gracefully and not create two conflicting |
1274 |
+ * entries. |
1275 |
+ */ |
1276 |
+- if (kset_find_obj(dump_kset, name)) |
1277 |
++ kobj = kset_find_obj(dump_kset, name); |
1278 |
++ if (kobj) { |
1279 |
++ /* Drop reference added by kset_find_obj() */ |
1280 |
++ kobject_put(kobj); |
1281 |
+ return 0; |
1282 |
++ } |
1283 |
+ |
1284 |
+ dump = create_dump_obj(dump_id, dump_size, dump_type); |
1285 |
+ if (!dump) |
1286 |
+diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c |
1287 |
+index 37f959bf392e..f2344cbd2f46 100644 |
1288 |
+--- a/arch/powerpc/platforms/powernv/opal-elog.c |
1289 |
++++ b/arch/powerpc/platforms/powernv/opal-elog.c |
1290 |
+@@ -247,6 +247,7 @@ static irqreturn_t elog_event(int irq, void *data) |
1291 |
+ uint64_t elog_type; |
1292 |
+ int rc; |
1293 |
+ char name[2+16+1]; |
1294 |
++ struct kobject *kobj; |
1295 |
+ |
1296 |
+ rc = opal_get_elog_size(&id, &size, &type); |
1297 |
+ if (rc != OPAL_SUCCESS) { |
1298 |
+@@ -269,8 +270,12 @@ static irqreturn_t elog_event(int irq, void *data) |
1299 |
+ * that gracefully and not create two conflicting |
1300 |
+ * entries. |
1301 |
+ */ |
1302 |
+- if (kset_find_obj(elog_kset, name)) |
1303 |
++ kobj = kset_find_obj(elog_kset, name); |
1304 |
++ if (kobj) { |
1305 |
++ /* Drop reference added by kset_find_obj() */ |
1306 |
++ kobject_put(kobj); |
1307 |
+ return IRQ_HANDLED; |
1308 |
++ } |
1309 |
+ |
1310 |
+ create_elog_obj(log_id, elog_size, elog_type); |
1311 |
+ |
1312 |
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c |
1313 |
+index 3a5ea8236db8..9e160fa74b24 100644 |
1314 |
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c |
1315 |
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c |
1316 |
+@@ -156,11 +156,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) |
1317 |
+ static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) |
1318 |
+ { |
1319 |
+ struct pnv_phb *phb = pe->phb; |
1320 |
++ unsigned int pe_num = pe->pe_number; |
1321 |
+ |
1322 |
+ WARN_ON(pe->pdev); |
1323 |
+ |
1324 |
+ memset(pe, 0, sizeof(struct pnv_ioda_pe)); |
1325 |
+- clear_bit(pe->pe_number, phb->ioda.pe_alloc); |
1326 |
++ clear_bit(pe_num, phb->ioda.pe_alloc); |
1327 |
+ } |
1328 |
+ |
1329 |
+ /* The default M64 BAR is shared by all PEs */ |
1330 |
+diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c |
1331 |
+index 6c110994d902..81d49476c47e 100644 |
1332 |
+--- a/arch/powerpc/sysdev/cpm1.c |
1333 |
++++ b/arch/powerpc/sysdev/cpm1.c |
1334 |
+@@ -534,7 +534,8 @@ struct cpm1_gpio16_chip { |
1335 |
+ |
1336 |
+ static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc) |
1337 |
+ { |
1338 |
+- struct cpm1_gpio16_chip *cpm1_gc = gpiochip_get_data(&mm_gc->gc); |
1339 |
++ struct cpm1_gpio16_chip *cpm1_gc = |
1340 |
++ container_of(mm_gc, struct cpm1_gpio16_chip, mm_gc); |
1341 |
+ struct cpm_ioport16 __iomem *iop = mm_gc->regs; |
1342 |
+ |
1343 |
+ cpm1_gc->cpdata = in_be16(&iop->dat); |
1344 |
+@@ -649,7 +650,8 @@ struct cpm1_gpio32_chip { |
1345 |
+ |
1346 |
+ static void cpm1_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) |
1347 |
+ { |
1348 |
+- struct cpm1_gpio32_chip *cpm1_gc = gpiochip_get_data(&mm_gc->gc); |
1349 |
++ struct cpm1_gpio32_chip *cpm1_gc = |
1350 |
++ container_of(mm_gc, struct cpm1_gpio32_chip, mm_gc); |
1351 |
+ struct cpm_ioport32b __iomem *iop = mm_gc->regs; |
1352 |
+ |
1353 |
+ cpm1_gc->cpdata = in_be32(&iop->dat); |
1354 |
+diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c |
1355 |
+index 0ac12e5fd8ab..649a15f1a50c 100644 |
1356 |
+--- a/arch/powerpc/sysdev/cpm_common.c |
1357 |
++++ b/arch/powerpc/sysdev/cpm_common.c |
1358 |
+@@ -82,7 +82,8 @@ struct cpm2_gpio32_chip { |
1359 |
+ |
1360 |
+ static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) |
1361 |
+ { |
1362 |
+- struct cpm2_gpio32_chip *cpm2_gc = gpiochip_get_data(&mm_gc->gc); |
1363 |
++ struct cpm2_gpio32_chip *cpm2_gc = |
1364 |
++ container_of(mm_gc, struct cpm2_gpio32_chip, mm_gc); |
1365 |
+ struct cpm2_ioports __iomem *iop = mm_gc->regs; |
1366 |
+ |
1367 |
+ cpm2_gc->cpdata = in_be32(&iop->dat); |
1368 |
+diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h |
1369 |
+index e0900ddf91dd..666fd8ba157e 100644 |
1370 |
+--- a/arch/s390/include/asm/uaccess.h |
1371 |
++++ b/arch/s390/include/asm/uaccess.h |
1372 |
+@@ -209,28 +209,28 @@ int __put_user_bad(void) __attribute__((noreturn)); |
1373 |
+ __chk_user_ptr(ptr); \ |
1374 |
+ switch (sizeof(*(ptr))) { \ |
1375 |
+ case 1: { \ |
1376 |
+- unsigned char __x; \ |
1377 |
++ unsigned char __x = 0; \ |
1378 |
+ __gu_err = __get_user_fn(&__x, ptr, \ |
1379 |
+ sizeof(*(ptr))); \ |
1380 |
+ (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
1381 |
+ break; \ |
1382 |
+ }; \ |
1383 |
+ case 2: { \ |
1384 |
+- unsigned short __x; \ |
1385 |
++ unsigned short __x = 0; \ |
1386 |
+ __gu_err = __get_user_fn(&__x, ptr, \ |
1387 |
+ sizeof(*(ptr))); \ |
1388 |
+ (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
1389 |
+ break; \ |
1390 |
+ }; \ |
1391 |
+ case 4: { \ |
1392 |
+- unsigned int __x; \ |
1393 |
++ unsigned int __x = 0; \ |
1394 |
+ __gu_err = __get_user_fn(&__x, ptr, \ |
1395 |
+ sizeof(*(ptr))); \ |
1396 |
+ (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
1397 |
+ break; \ |
1398 |
+ }; \ |
1399 |
+ case 8: { \ |
1400 |
+- unsigned long long __x; \ |
1401 |
++ unsigned long long __x = 0; \ |
1402 |
+ __gu_err = __get_user_fn(&__x, ptr, \ |
1403 |
+ sizeof(*(ptr))); \ |
1404 |
+ (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
1405 |
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
1406 |
+index 43f2a2b80490..13c62e036521 100644 |
1407 |
+--- a/arch/s390/kvm/kvm-s390.c |
1408 |
++++ b/arch/s390/kvm/kvm-s390.c |
1409 |
+@@ -1951,9 +1951,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) |
1410 |
+ return -EINVAL; |
1411 |
+ current->thread.fpu.fpc = fpu->fpc; |
1412 |
+ if (MACHINE_HAS_VX) |
1413 |
+- convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs); |
1414 |
++ convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, |
1415 |
++ (freg_t *) fpu->fprs); |
1416 |
+ else |
1417 |
+- memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs)); |
1418 |
++ memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); |
1419 |
+ return 0; |
1420 |
+ } |
1421 |
+ |
1422 |
+@@ -1962,9 +1963,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) |
1423 |
+ /* make sure we have the latest values */ |
1424 |
+ save_fpu_regs(); |
1425 |
+ if (MACHINE_HAS_VX) |
1426 |
+- convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs); |
1427 |
++ convert_vx_to_fp((freg_t *) fpu->fprs, |
1428 |
++ (__vector128 *) vcpu->run->s.regs.vrs); |
1429 |
+ else |
1430 |
+- memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs)); |
1431 |
++ memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); |
1432 |
+ fpu->fpc = current->thread.fpu.fpc; |
1433 |
+ return 0; |
1434 |
+ } |
1435 |
+diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h |
1436 |
+index 20a3591225cc..01aec8ccde83 100644 |
1437 |
+--- a/arch/score/include/asm/uaccess.h |
1438 |
++++ b/arch/score/include/asm/uaccess.h |
1439 |
+@@ -163,7 +163,7 @@ do { \ |
1440 |
+ __get_user_asm(val, "lw", ptr); \ |
1441 |
+ break; \ |
1442 |
+ case 8: \ |
1443 |
+- if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ |
1444 |
++ if (__copy_from_user((void *)&val, ptr, 8) == 0) \ |
1445 |
+ __gu_err = 0; \ |
1446 |
+ else \ |
1447 |
+ __gu_err = -EFAULT; \ |
1448 |
+@@ -188,6 +188,8 @@ do { \ |
1449 |
+ \ |
1450 |
+ if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ |
1451 |
+ __get_user_common((x), size, __gu_ptr); \ |
1452 |
++ else \ |
1453 |
++ (x) = 0; \ |
1454 |
+ \ |
1455 |
+ __gu_err; \ |
1456 |
+ }) |
1457 |
+@@ -201,6 +203,7 @@ do { \ |
1458 |
+ "2:\n" \ |
1459 |
+ ".section .fixup,\"ax\"\n" \ |
1460 |
+ "3:li %0, %4\n" \ |
1461 |
++ "li %1, 0\n" \ |
1462 |
+ "j 2b\n" \ |
1463 |
+ ".previous\n" \ |
1464 |
+ ".section __ex_table,\"a\"\n" \ |
1465 |
+@@ -298,35 +301,34 @@ extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); |
1466 |
+ static inline unsigned long |
1467 |
+ copy_from_user(void *to, const void *from, unsigned long len) |
1468 |
+ { |
1469 |
+- unsigned long over; |
1470 |
++ unsigned long res = len; |
1471 |
+ |
1472 |
+- if (access_ok(VERIFY_READ, from, len)) |
1473 |
+- return __copy_tofrom_user(to, from, len); |
1474 |
++ if (likely(access_ok(VERIFY_READ, from, len))) |
1475 |
++ res = __copy_tofrom_user(to, from, len); |
1476 |
+ |
1477 |
+- if ((unsigned long)from < TASK_SIZE) { |
1478 |
+- over = (unsigned long)from + len - TASK_SIZE; |
1479 |
+- return __copy_tofrom_user(to, from, len - over) + over; |
1480 |
+- } |
1481 |
+- return len; |
1482 |
++ if (unlikely(res)) |
1483 |
++ memset(to + (len - res), 0, res); |
1484 |
++ |
1485 |
++ return res; |
1486 |
+ } |
1487 |
+ |
1488 |
+ static inline unsigned long |
1489 |
+ copy_to_user(void *to, const void *from, unsigned long len) |
1490 |
+ { |
1491 |
+- unsigned long over; |
1492 |
+- |
1493 |
+- if (access_ok(VERIFY_WRITE, to, len)) |
1494 |
+- return __copy_tofrom_user(to, from, len); |
1495 |
++ if (likely(access_ok(VERIFY_WRITE, to, len))) |
1496 |
++ len = __copy_tofrom_user(to, from, len); |
1497 |
+ |
1498 |
+- if ((unsigned long)to < TASK_SIZE) { |
1499 |
+- over = (unsigned long)to + len - TASK_SIZE; |
1500 |
+- return __copy_tofrom_user(to, from, len - over) + over; |
1501 |
+- } |
1502 |
+ return len; |
1503 |
+ } |
1504 |
+ |
1505 |
+-#define __copy_from_user(to, from, len) \ |
1506 |
+- __copy_tofrom_user((to), (from), (len)) |
1507 |
++static inline unsigned long |
1508 |
++__copy_from_user(void *to, const void *from, unsigned long len) |
1509 |
++{ |
1510 |
++ unsigned long left = __copy_tofrom_user(to, from, len); |
1511 |
++ if (unlikely(left)) |
1512 |
++ memset(to + (len - left), 0, left); |
1513 |
++ return left; |
1514 |
++} |
1515 |
+ |
1516 |
+ #define __copy_to_user(to, from, len) \ |
1517 |
+ __copy_tofrom_user((to), (from), (len)) |
1518 |
+@@ -340,17 +342,17 @@ __copy_to_user_inatomic(void *to, const void *from, unsigned long len) |
1519 |
+ static inline unsigned long |
1520 |
+ __copy_from_user_inatomic(void *to, const void *from, unsigned long len) |
1521 |
+ { |
1522 |
+- return __copy_from_user(to, from, len); |
1523 |
++ return __copy_tofrom_user(to, from, len); |
1524 |
+ } |
1525 |
+ |
1526 |
+-#define __copy_in_user(to, from, len) __copy_from_user(to, from, len) |
1527 |
++#define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) |
1528 |
+ |
1529 |
+ static inline unsigned long |
1530 |
+ copy_in_user(void *to, const void *from, unsigned long len) |
1531 |
+ { |
1532 |
+ if (access_ok(VERIFY_READ, from, len) && |
1533 |
+ access_ok(VERFITY_WRITE, to, len)) |
1534 |
+- return copy_from_user(to, from, len); |
1535 |
++ return __copy_tofrom_user(to, from, len); |
1536 |
+ } |
1537 |
+ |
1538 |
+ /* |
1539 |
+diff --git a/arch/sh/include/asm/cmpxchg-xchg.h b/arch/sh/include/asm/cmpxchg-xchg.h |
1540 |
+index 7219719c23a3..1e881f5db659 100644 |
1541 |
+--- a/arch/sh/include/asm/cmpxchg-xchg.h |
1542 |
++++ b/arch/sh/include/asm/cmpxchg-xchg.h |
1543 |
+@@ -21,7 +21,7 @@ static inline u32 __xchg_cmpxchg(volatile void *ptr, u32 x, int size) |
1544 |
+ int off = (unsigned long)ptr % sizeof(u32); |
1545 |
+ volatile u32 *p = ptr - off; |
1546 |
+ #ifdef __BIG_ENDIAN |
1547 |
+- int bitoff = (sizeof(u32) - 1 - off) * BITS_PER_BYTE; |
1548 |
++ int bitoff = (sizeof(u32) - size - off) * BITS_PER_BYTE; |
1549 |
+ #else |
1550 |
+ int bitoff = off * BITS_PER_BYTE; |
1551 |
+ #endif |
1552 |
+diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h |
1553 |
+index a49635c51266..92ade79ac427 100644 |
1554 |
+--- a/arch/sh/include/asm/uaccess.h |
1555 |
++++ b/arch/sh/include/asm/uaccess.h |
1556 |
+@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) |
1557 |
+ __kernel_size_t __copy_size = (__kernel_size_t) n; |
1558 |
+ |
1559 |
+ if (__copy_size && __access_ok(__copy_from, __copy_size)) |
1560 |
+- return __copy_user(to, from, __copy_size); |
1561 |
++ __copy_size = __copy_user(to, from, __copy_size); |
1562 |
++ |
1563 |
++ if (unlikely(__copy_size)) |
1564 |
++ memset(to + (n - __copy_size), 0, __copy_size); |
1565 |
+ |
1566 |
+ return __copy_size; |
1567 |
+ } |
1568 |
+diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h |
1569 |
+index c01376c76b86..ca5073dd4596 100644 |
1570 |
+--- a/arch/sh/include/asm/uaccess_64.h |
1571 |
++++ b/arch/sh/include/asm/uaccess_64.h |
1572 |
+@@ -24,6 +24,7 @@ |
1573 |
+ #define __get_user_size(x,ptr,size,retval) \ |
1574 |
+ do { \ |
1575 |
+ retval = 0; \ |
1576 |
++ x = 0; \ |
1577 |
+ switch (size) { \ |
1578 |
+ case 1: \ |
1579 |
+ retval = __get_user_asm_b((void *)&x, \ |
1580 |
+diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h |
1581 |
+index 57aca2792d29..3e8de69c6dcc 100644 |
1582 |
+--- a/arch/sparc/include/asm/uaccess_32.h |
1583 |
++++ b/arch/sparc/include/asm/uaccess_32.h |
1584 |
+@@ -263,8 +263,10 @@ static inline unsigned long copy_from_user(void *to, const void __user *from, un |
1585 |
+ { |
1586 |
+ if (n && __access_ok((unsigned long) from, n)) |
1587 |
+ return __copy_user((__force void __user *) to, from, n); |
1588 |
+- else |
1589 |
++ else { |
1590 |
++ memset(to, 0, n); |
1591 |
+ return n; |
1592 |
++ } |
1593 |
+ } |
1594 |
+ |
1595 |
+ static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) |
1596 |
+diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c |
1597 |
+index 52fef606bc54..a34da5b49002 100644 |
1598 |
+--- a/arch/x86/boot/compressed/eboot.c |
1599 |
++++ b/arch/x86/boot/compressed/eboot.c |
1600 |
+@@ -1006,79 +1006,87 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, |
1601 |
+ return status; |
1602 |
+ } |
1603 |
+ |
1604 |
+-static efi_status_t exit_boot(struct boot_params *boot_params, |
1605 |
+- void *handle, bool is64) |
1606 |
+-{ |
1607 |
+- struct efi_info *efi = &boot_params->efi_info; |
1608 |
+- unsigned long map_sz, key, desc_size; |
1609 |
+- efi_memory_desc_t *mem_map; |
1610 |
++struct exit_boot_struct { |
1611 |
++ struct boot_params *boot_params; |
1612 |
++ struct efi_info *efi; |
1613 |
+ struct setup_data *e820ext; |
1614 |
+- const char *signature; |
1615 |
+ __u32 e820ext_size; |
1616 |
+- __u32 nr_desc, prev_nr_desc; |
1617 |
+- efi_status_t status; |
1618 |
+- __u32 desc_version; |
1619 |
+- bool called_exit = false; |
1620 |
+- u8 nr_entries; |
1621 |
+- int i; |
1622 |
+- |
1623 |
+- nr_desc = 0; |
1624 |
+- e820ext = NULL; |
1625 |
+- e820ext_size = 0; |
1626 |
+- |
1627 |
+-get_map: |
1628 |
+- status = efi_get_memory_map(sys_table, &mem_map, &map_sz, &desc_size, |
1629 |
+- &desc_version, &key); |
1630 |
+- |
1631 |
+- if (status != EFI_SUCCESS) |
1632 |
+- return status; |
1633 |
+- |
1634 |
+- prev_nr_desc = nr_desc; |
1635 |
+- nr_desc = map_sz / desc_size; |
1636 |
+- if (nr_desc > prev_nr_desc && |
1637 |
+- nr_desc > ARRAY_SIZE(boot_params->e820_map)) { |
1638 |
+- u32 nr_e820ext = nr_desc - ARRAY_SIZE(boot_params->e820_map); |
1639 |
+- |
1640 |
+- status = alloc_e820ext(nr_e820ext, &e820ext, &e820ext_size); |
1641 |
+- if (status != EFI_SUCCESS) |
1642 |
+- goto free_mem_map; |
1643 |
++ bool is64; |
1644 |
++}; |
1645 |
+ |
1646 |
+- efi_call_early(free_pool, mem_map); |
1647 |
+- goto get_map; /* Allocated memory, get map again */ |
1648 |
++static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, |
1649 |
++ struct efi_boot_memmap *map, |
1650 |
++ void *priv) |
1651 |
++{ |
1652 |
++ static bool first = true; |
1653 |
++ const char *signature; |
1654 |
++ __u32 nr_desc; |
1655 |
++ efi_status_t status; |
1656 |
++ struct exit_boot_struct *p = priv; |
1657 |
++ |
1658 |
++ if (first) { |
1659 |
++ nr_desc = *map->buff_size / *map->desc_size; |
1660 |
++ if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) { |
1661 |
++ u32 nr_e820ext = nr_desc - |
1662 |
++ ARRAY_SIZE(p->boot_params->e820_map); |
1663 |
++ |
1664 |
++ status = alloc_e820ext(nr_e820ext, &p->e820ext, |
1665 |
++ &p->e820ext_size); |
1666 |
++ if (status != EFI_SUCCESS) |
1667 |
++ return status; |
1668 |
++ } |
1669 |
++ first = false; |
1670 |
+ } |
1671 |
+ |
1672 |
+- signature = is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; |
1673 |
+- memcpy(&efi->efi_loader_signature, signature, sizeof(__u32)); |
1674 |
++ signature = p->is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; |
1675 |
++ memcpy(&p->efi->efi_loader_signature, signature, sizeof(__u32)); |
1676 |
+ |
1677 |
+- efi->efi_systab = (unsigned long)sys_table; |
1678 |
+- efi->efi_memdesc_size = desc_size; |
1679 |
+- efi->efi_memdesc_version = desc_version; |
1680 |
+- efi->efi_memmap = (unsigned long)mem_map; |
1681 |
+- efi->efi_memmap_size = map_sz; |
1682 |
++ p->efi->efi_systab = (unsigned long)sys_table_arg; |
1683 |
++ p->efi->efi_memdesc_size = *map->desc_size; |
1684 |
++ p->efi->efi_memdesc_version = *map->desc_ver; |
1685 |
++ p->efi->efi_memmap = (unsigned long)*map->map; |
1686 |
++ p->efi->efi_memmap_size = *map->map_size; |
1687 |
+ |
1688 |
+ #ifdef CONFIG_X86_64 |
1689 |
+- efi->efi_systab_hi = (unsigned long)sys_table >> 32; |
1690 |
+- efi->efi_memmap_hi = (unsigned long)mem_map >> 32; |
1691 |
++ p->efi->efi_systab_hi = (unsigned long)sys_table_arg >> 32; |
1692 |
++ p->efi->efi_memmap_hi = (unsigned long)*map->map >> 32; |
1693 |
+ #endif |
1694 |
+ |
1695 |
++ return EFI_SUCCESS; |
1696 |
++} |
1697 |
++ |
1698 |
++static efi_status_t exit_boot(struct boot_params *boot_params, |
1699 |
++ void *handle, bool is64) |
1700 |
++{ |
1701 |
++ unsigned long map_sz, key, desc_size, buff_size; |
1702 |
++ efi_memory_desc_t *mem_map; |
1703 |
++ struct setup_data *e820ext; |
1704 |
++ __u32 e820ext_size; |
1705 |
++ efi_status_t status; |
1706 |
++ __u32 desc_version; |
1707 |
++ struct efi_boot_memmap map; |
1708 |
++ struct exit_boot_struct priv; |
1709 |
++ |
1710 |
++ map.map = &mem_map; |
1711 |
++ map.map_size = &map_sz; |
1712 |
++ map.desc_size = &desc_size; |
1713 |
++ map.desc_ver = &desc_version; |
1714 |
++ map.key_ptr = &key; |
1715 |
++ map.buff_size = &buff_size; |
1716 |
++ priv.boot_params = boot_params; |
1717 |
++ priv.efi = &boot_params->efi_info; |
1718 |
++ priv.e820ext = NULL; |
1719 |
++ priv.e820ext_size = 0; |
1720 |
++ priv.is64 = is64; |
1721 |
++ |
1722 |
+ /* Might as well exit boot services now */ |
1723 |
+- status = efi_call_early(exit_boot_services, handle, key); |
1724 |
+- if (status != EFI_SUCCESS) { |
1725 |
+- /* |
1726 |
+- * ExitBootServices() will fail if any of the event |
1727 |
+- * handlers change the memory map. In which case, we |
1728 |
+- * must be prepared to retry, but only once so that |
1729 |
+- * we're guaranteed to exit on repeated failures instead |
1730 |
+- * of spinning forever. |
1731 |
+- */ |
1732 |
+- if (called_exit) |
1733 |
+- goto free_mem_map; |
1734 |
+- |
1735 |
+- called_exit = true; |
1736 |
+- efi_call_early(free_pool, mem_map); |
1737 |
+- goto get_map; |
1738 |
+- } |
1739 |
++ status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
1740 |
++ exit_boot_func); |
1741 |
++ if (status != EFI_SUCCESS) |
1742 |
++ return status; |
1743 |
+ |
1744 |
++ e820ext = priv.e820ext; |
1745 |
++ e820ext_size = priv.e820ext_size; |
1746 |
+ /* Historic? */ |
1747 |
+ boot_params->alt_mem_k = 32 * 1024; |
1748 |
+ |
1749 |
+@@ -1087,10 +1095,6 @@ get_map: |
1750 |
+ return status; |
1751 |
+ |
1752 |
+ return EFI_SUCCESS; |
1753 |
+- |
1754 |
+-free_mem_map: |
1755 |
+- efi_call_early(free_pool, mem_map); |
1756 |
+- return status; |
1757 |
+ } |
1758 |
+ |
1759 |
+ /* |
1760 |
+diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config |
1761 |
+index 4e2ecfa23c15..4b429df40d7a 100644 |
1762 |
+--- a/arch/x86/configs/tiny.config |
1763 |
++++ b/arch/x86/configs/tiny.config |
1764 |
+@@ -1 +1,3 @@ |
1765 |
+ CONFIG_NOHIGHMEM=y |
1766 |
++# CONFIG_HIGHMEM4G is not set |
1767 |
++# CONFIG_HIGHMEM64G is not set |
1768 |
+diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c |
1769 |
+index bd3e8421b57c..a8309ea677a1 100644 |
1770 |
+--- a/arch/x86/events/amd/core.c |
1771 |
++++ b/arch/x86/events/amd/core.c |
1772 |
+@@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = |
1773 |
+ { |
1774 |
+ [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
1775 |
+ [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
1776 |
+- [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, |
1777 |
+- [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, |
1778 |
++ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
1779 |
++ [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
1780 |
+ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
1781 |
+ [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
1782 |
+ [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
1783 |
+diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c |
1784 |
+index 7b5fd811ef45..4ff41ae514a3 100644 |
1785 |
+--- a/arch/x86/events/intel/cqm.c |
1786 |
++++ b/arch/x86/events/intel/cqm.c |
1787 |
+@@ -458,6 +458,11 @@ static void __intel_cqm_event_count(void *info); |
1788 |
+ static void init_mbm_sample(u32 rmid, u32 evt_type); |
1789 |
+ static void __intel_mbm_event_count(void *info); |
1790 |
+ |
1791 |
++static bool is_cqm_event(int e) |
1792 |
++{ |
1793 |
++ return (e == QOS_L3_OCCUP_EVENT_ID); |
1794 |
++} |
1795 |
++ |
1796 |
+ static bool is_mbm_event(int e) |
1797 |
+ { |
1798 |
+ return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); |
1799 |
+@@ -1366,6 +1371,10 @@ static int intel_cqm_event_init(struct perf_event *event) |
1800 |
+ (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) |
1801 |
+ return -EINVAL; |
1802 |
+ |
1803 |
++ if ((is_cqm_event(event->attr.config) && !cqm_enabled) || |
1804 |
++ (is_mbm_event(event->attr.config) && !mbm_enabled)) |
1805 |
++ return -EINVAL; |
1806 |
++ |
1807 |
+ /* unsupported modes and filters */ |
1808 |
+ if (event->attr.exclude_user || |
1809 |
+ event->attr.exclude_kernel || |
1810 |
+diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c |
1811 |
+index 7ce9f3f669e6..9b983a474253 100644 |
1812 |
+--- a/arch/x86/events/intel/ds.c |
1813 |
++++ b/arch/x86/events/intel/ds.c |
1814 |
+@@ -1274,18 +1274,18 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) |
1815 |
+ struct pebs_record_nhm *p = at; |
1816 |
+ u64 pebs_status; |
1817 |
+ |
1818 |
+- /* PEBS v3 has accurate status bits */ |
1819 |
++ pebs_status = p->status & cpuc->pebs_enabled; |
1820 |
++ pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; |
1821 |
++ |
1822 |
++ /* PEBS v3 has more accurate status bits */ |
1823 |
+ if (x86_pmu.intel_cap.pebs_format >= 3) { |
1824 |
+- for_each_set_bit(bit, (unsigned long *)&p->status, |
1825 |
+- MAX_PEBS_EVENTS) |
1826 |
++ for_each_set_bit(bit, (unsigned long *)&pebs_status, |
1827 |
++ x86_pmu.max_pebs_events) |
1828 |
+ counts[bit]++; |
1829 |
+ |
1830 |
+ continue; |
1831 |
+ } |
1832 |
+ |
1833 |
+- pebs_status = p->status & cpuc->pebs_enabled; |
1834 |
+- pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; |
1835 |
+- |
1836 |
+ /* |
1837 |
+ * On some CPUs the PEBS status can be zero when PEBS is |
1838 |
+ * racing with clearing of GLOBAL_STATUS. |
1839 |
+@@ -1333,8 +1333,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) |
1840 |
+ continue; |
1841 |
+ |
1842 |
+ event = cpuc->events[bit]; |
1843 |
+- WARN_ON_ONCE(!event); |
1844 |
+- WARN_ON_ONCE(!event->attr.precise_ip); |
1845 |
++ if (WARN_ON_ONCE(!event)) |
1846 |
++ continue; |
1847 |
++ |
1848 |
++ if (WARN_ON_ONCE(!event->attr.precise_ip)) |
1849 |
++ continue; |
1850 |
+ |
1851 |
+ /* log dropped samples number */ |
1852 |
+ if (error[bit]) |
1853 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
1854 |
+index 04bb5fb5a8d7..861a7d9cb60f 100644 |
1855 |
+--- a/arch/x86/events/intel/pt.c |
1856 |
++++ b/arch/x86/events/intel/pt.c |
1857 |
+@@ -1074,6 +1074,11 @@ static void pt_addr_filters_fini(struct perf_event *event) |
1858 |
+ event->hw.addr_filters = NULL; |
1859 |
+ } |
1860 |
+ |
1861 |
++static inline bool valid_kernel_ip(unsigned long ip) |
1862 |
++{ |
1863 |
++ return virt_addr_valid(ip) && kernel_ip(ip); |
1864 |
++} |
1865 |
++ |
1866 |
+ static int pt_event_addr_filters_validate(struct list_head *filters) |
1867 |
+ { |
1868 |
+ struct perf_addr_filter *filter; |
1869 |
+@@ -1081,11 +1086,16 @@ static int pt_event_addr_filters_validate(struct list_head *filters) |
1870 |
+ |
1871 |
+ list_for_each_entry(filter, filters, entry) { |
1872 |
+ /* PT doesn't support single address triggers */ |
1873 |
+- if (!filter->range) |
1874 |
++ if (!filter->range || !filter->size) |
1875 |
+ return -EOPNOTSUPP; |
1876 |
+ |
1877 |
+- if (!filter->inode && !kernel_ip(filter->offset)) |
1878 |
+- return -EINVAL; |
1879 |
++ if (!filter->inode) { |
1880 |
++ if (!valid_kernel_ip(filter->offset)) |
1881 |
++ return -EINVAL; |
1882 |
++ |
1883 |
++ if (!valid_kernel_ip(filter->offset + filter->size)) |
1884 |
++ return -EINVAL; |
1885 |
++ } |
1886 |
+ |
1887 |
+ if (++range > pt_cap_get(PT_CAP_num_address_ranges)) |
1888 |
+ return -EOPNOTSUPP; |
1889 |
+@@ -1111,7 +1121,7 @@ static void pt_event_addr_filters_sync(struct perf_event *event) |
1890 |
+ } else { |
1891 |
+ /* apply the offset */ |
1892 |
+ msr_a = filter->offset + offs[range]; |
1893 |
+- msr_b = filter->size + msr_a; |
1894 |
++ msr_b = filter->size + msr_a - 1; |
1895 |
+ } |
1896 |
+ |
1897 |
+ filters->filter[range].msr_a = msr_a; |
1898 |
+diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
1899 |
+index 2982387ba817..0328c2ccc55d 100644 |
1900 |
+--- a/arch/x86/include/asm/uaccess.h |
1901 |
++++ b/arch/x86/include/asm/uaccess.h |
1902 |
+@@ -414,7 +414,11 @@ do { \ |
1903 |
+ #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
1904 |
+ asm volatile("1: mov"itype" %1,%"rtype"0\n" \ |
1905 |
+ "2:\n" \ |
1906 |
+- _ASM_EXTABLE_EX(1b, 2b) \ |
1907 |
++ ".section .fixup,\"ax\"\n" \ |
1908 |
++ "3:xor"itype" %"rtype"0,%"rtype"0\n" \ |
1909 |
++ " jmp 2b\n" \ |
1910 |
++ ".previous\n" \ |
1911 |
++ _ASM_EXTABLE_EX(1b, 3b) \ |
1912 |
+ : ltype(x) : "m" (__m(addr))) |
1913 |
+ |
1914 |
+ #define __put_user_nocheck(x, ptr, size) \ |
1915 |
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
1916 |
+index f5c69d8974e1..b81fe2d63e15 100644 |
1917 |
+--- a/arch/x86/kernel/cpu/amd.c |
1918 |
++++ b/arch/x86/kernel/cpu/amd.c |
1919 |
+@@ -669,6 +669,17 @@ static void init_amd_gh(struct cpuinfo_x86 *c) |
1920 |
+ set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); |
1921 |
+ } |
1922 |
+ |
1923 |
++#define MSR_AMD64_DE_CFG 0xC0011029 |
1924 |
++ |
1925 |
++static void init_amd_ln(struct cpuinfo_x86 *c) |
1926 |
++{ |
1927 |
++ /* |
1928 |
++ * Apply erratum 665 fix unconditionally so machines without a BIOS |
1929 |
++ * fix work. |
1930 |
++ */ |
1931 |
++ msr_set_bit(MSR_AMD64_DE_CFG, 31); |
1932 |
++} |
1933 |
++ |
1934 |
+ static void init_amd_bd(struct cpuinfo_x86 *c) |
1935 |
+ { |
1936 |
+ u64 value; |
1937 |
+@@ -726,6 +737,7 @@ static void init_amd(struct cpuinfo_x86 *c) |
1938 |
+ case 6: init_amd_k7(c); break; |
1939 |
+ case 0xf: init_amd_k8(c); break; |
1940 |
+ case 0x10: init_amd_gh(c); break; |
1941 |
++ case 0x12: init_amd_ln(c); break; |
1942 |
+ case 0x15: init_amd_bd(c); break; |
1943 |
+ } |
1944 |
+ |
1945 |
+diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c |
1946 |
+index 7b3b3f24c3ea..078c933f9fcc 100644 |
1947 |
+--- a/arch/x86/kernel/paravirt.c |
1948 |
++++ b/arch/x86/kernel/paravirt.c |
1949 |
+@@ -55,12 +55,12 @@ asm (".pushsection .entry.text, \"ax\"\n" |
1950 |
+ ".popsection"); |
1951 |
+ |
1952 |
+ /* identity function, which can be inlined */ |
1953 |
+-u32 _paravirt_ident_32(u32 x) |
1954 |
++u32 notrace _paravirt_ident_32(u32 x) |
1955 |
+ { |
1956 |
+ return x; |
1957 |
+ } |
1958 |
+ |
1959 |
+-u64 _paravirt_ident_64(u64 x) |
1960 |
++u64 notrace _paravirt_ident_64(u64 x) |
1961 |
+ { |
1962 |
+ return x; |
1963 |
+ } |
1964 |
+diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c |
1965 |
+index 5f42d038fcb4..c7220ba94aa7 100644 |
1966 |
+--- a/arch/x86/kvm/ioapic.c |
1967 |
++++ b/arch/x86/kvm/ioapic.c |
1968 |
+@@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) |
1969 |
+ { |
1970 |
+ bool new_val, old_val; |
1971 |
+ struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; |
1972 |
++ struct dest_map *dest_map = &ioapic->rtc_status.dest_map; |
1973 |
+ union kvm_ioapic_redirect_entry *e; |
1974 |
+ |
1975 |
+ e = &ioapic->redirtbl[RTC_GSI]; |
1976 |
+@@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) |
1977 |
+ return; |
1978 |
+ |
1979 |
+ new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); |
1980 |
+- old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); |
1981 |
++ old_val = test_bit(vcpu->vcpu_id, dest_map->map); |
1982 |
+ |
1983 |
+ if (new_val == old_val) |
1984 |
+ return; |
1985 |
+ |
1986 |
+ if (new_val) { |
1987 |
+- __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); |
1988 |
++ __set_bit(vcpu->vcpu_id, dest_map->map); |
1989 |
++ dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; |
1990 |
+ ioapic->rtc_status.pending_eoi++; |
1991 |
+ } else { |
1992 |
+- __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); |
1993 |
++ __clear_bit(vcpu->vcpu_id, dest_map->map); |
1994 |
+ ioapic->rtc_status.pending_eoi--; |
1995 |
+ rtc_status_pending_eoi_check_valid(ioapic); |
1996 |
+ } |
1997 |
+diff --git a/arch/x86/kvm/pmu_amd.c b/arch/x86/kvm/pmu_amd.c |
1998 |
+index 39b91127ef07..cd944435dfbd 100644 |
1999 |
+--- a/arch/x86/kvm/pmu_amd.c |
2000 |
++++ b/arch/x86/kvm/pmu_amd.c |
2001 |
+@@ -23,8 +23,8 @@ |
2002 |
+ static struct kvm_event_hw_type_mapping amd_event_mapping[] = { |
2003 |
+ [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, |
2004 |
+ [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, |
2005 |
+- [2] = { 0x80, 0x00, PERF_COUNT_HW_CACHE_REFERENCES }, |
2006 |
+- [3] = { 0x81, 0x00, PERF_COUNT_HW_CACHE_MISSES }, |
2007 |
++ [2] = { 0x7d, 0x07, PERF_COUNT_HW_CACHE_REFERENCES }, |
2008 |
++ [3] = { 0x7e, 0x07, PERF_COUNT_HW_CACHE_MISSES }, |
2009 |
+ [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, |
2010 |
+ [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, |
2011 |
+ [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, |
2012 |
+diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c |
2013 |
+index fb0604f11eec..5431a32f79e7 100644 |
2014 |
+--- a/arch/x86/mm/pat.c |
2015 |
++++ b/arch/x86/mm/pat.c |
2016 |
+@@ -931,9 +931,10 @@ int track_pfn_copy(struct vm_area_struct *vma) |
2017 |
+ } |
2018 |
+ |
2019 |
+ /* |
2020 |
+- * prot is passed in as a parameter for the new mapping. If the vma has a |
2021 |
+- * linear pfn mapping for the entire range reserve the entire vma range with |
2022 |
+- * single reserve_pfn_range call. |
2023 |
++ * prot is passed in as a parameter for the new mapping. If the vma has |
2024 |
++ * a linear pfn mapping for the entire range, or no vma is provided, |
2025 |
++ * reserve the entire pfn + size range with single reserve_pfn_range |
2026 |
++ * call. |
2027 |
+ */ |
2028 |
+ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, |
2029 |
+ unsigned long pfn, unsigned long addr, unsigned long size) |
2030 |
+@@ -942,11 +943,12 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, |
2031 |
+ enum page_cache_mode pcm; |
2032 |
+ |
2033 |
+ /* reserve the whole chunk starting from paddr */ |
2034 |
+- if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) { |
2035 |
++ if (!vma || (addr == vma->vm_start |
2036 |
++ && size == (vma->vm_end - vma->vm_start))) { |
2037 |
+ int ret; |
2038 |
+ |
2039 |
+ ret = reserve_pfn_range(paddr, size, prot, 0); |
2040 |
+- if (!ret) |
2041 |
++ if (ret == 0 && vma) |
2042 |
+ vma->vm_flags |= VM_PAT; |
2043 |
+ return ret; |
2044 |
+ } |
2045 |
+@@ -1001,7 +1003,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, |
2046 |
+ resource_size_t paddr; |
2047 |
+ unsigned long prot; |
2048 |
+ |
2049 |
+- if (!(vma->vm_flags & VM_PAT)) |
2050 |
++ if (vma && !(vma->vm_flags & VM_PAT)) |
2051 |
+ return; |
2052 |
+ |
2053 |
+ /* free the chunk starting from pfn or the whole chunk */ |
2054 |
+@@ -1015,7 +1017,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, |
2055 |
+ size = vma->vm_end - vma->vm_start; |
2056 |
+ } |
2057 |
+ free_pfn_range(paddr, size); |
2058 |
+- vma->vm_flags &= ~VM_PAT; |
2059 |
++ if (vma) |
2060 |
++ vma->vm_flags &= ~VM_PAT; |
2061 |
+ } |
2062 |
+ |
2063 |
+ /* |
2064 |
+diff --git a/crypto/cryptd.c b/crypto/cryptd.c |
2065 |
+index 7921251cdb13..90fefae402a5 100644 |
2066 |
+--- a/crypto/cryptd.c |
2067 |
++++ b/crypto/cryptd.c |
2068 |
+@@ -594,9 +594,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out) |
2069 |
+ |
2070 |
+ static int cryptd_hash_import(struct ahash_request *req, const void *in) |
2071 |
+ { |
2072 |
+- struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); |
2073 |
++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
2074 |
++ struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); |
2075 |
++ struct shash_desc *desc = cryptd_shash_desc(req); |
2076 |
++ |
2077 |
++ desc->tfm = ctx->child; |
2078 |
++ desc->flags = req->base.flags; |
2079 |
+ |
2080 |
+- return crypto_shash_import(&rctx->desc, in); |
2081 |
++ return crypto_shash_import(desc, in); |
2082 |
+ } |
2083 |
+ |
2084 |
+ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, |
2085 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
2086 |
+index 71b07198e207..ccd8cc47c4cf 100644 |
2087 |
+--- a/drivers/ata/libahci.c |
2088 |
++++ b/drivers/ata/libahci.c |
2089 |
+@@ -2516,7 +2516,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host, |
2090 |
+ |
2091 |
+ /* Do not receive interrupts sent by dummy ports */ |
2092 |
+ if (!pp) { |
2093 |
+- disable_irq(irq + i); |
2094 |
++ disable_irq(irq); |
2095 |
+ continue; |
2096 |
+ } |
2097 |
+ |
2098 |
+diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c |
2099 |
+index acc3eb542c74..d88372b794e4 100644 |
2100 |
+--- a/drivers/bus/arm-ccn.c |
2101 |
++++ b/drivers/bus/arm-ccn.c |
2102 |
+@@ -187,6 +187,7 @@ struct arm_ccn { |
2103 |
+ struct arm_ccn_component *xp; |
2104 |
+ |
2105 |
+ struct arm_ccn_dt dt; |
2106 |
++ int mn_id; |
2107 |
+ }; |
2108 |
+ |
2109 |
+ |
2110 |
+@@ -326,6 +327,7 @@ struct arm_ccn_pmu_event { |
2111 |
+ static ssize_t arm_ccn_pmu_event_show(struct device *dev, |
2112 |
+ struct device_attribute *attr, char *buf) |
2113 |
+ { |
2114 |
++ struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev)); |
2115 |
+ struct arm_ccn_pmu_event *event = container_of(attr, |
2116 |
+ struct arm_ccn_pmu_event, attr); |
2117 |
+ ssize_t res; |
2118 |
+@@ -352,6 +354,9 @@ static ssize_t arm_ccn_pmu_event_show(struct device *dev, |
2119 |
+ res += snprintf(buf + res, PAGE_SIZE - res, |
2120 |
+ ",cmp_l=?,cmp_h=?,mask=?"); |
2121 |
+ break; |
2122 |
++ case CCN_TYPE_MN: |
2123 |
++ res += snprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id); |
2124 |
++ break; |
2125 |
+ default: |
2126 |
+ res += snprintf(buf + res, PAGE_SIZE - res, ",node=?"); |
2127 |
+ break; |
2128 |
+@@ -381,9 +386,9 @@ static umode_t arm_ccn_pmu_events_is_visible(struct kobject *kobj, |
2129 |
+ } |
2130 |
+ |
2131 |
+ static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = { |
2132 |
+- CCN_EVENT_MN(eobarrier, "dir=0,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), |
2133 |
+- CCN_EVENT_MN(ecbarrier, "dir=0,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), |
2134 |
+- CCN_EVENT_MN(dvmop, "dir=0,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), |
2135 |
++ CCN_EVENT_MN(eobarrier, "dir=1,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), |
2136 |
++ CCN_EVENT_MN(ecbarrier, "dir=1,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), |
2137 |
++ CCN_EVENT_MN(dvmop, "dir=1,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), |
2138 |
+ CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY), |
2139 |
+ CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY), |
2140 |
+ CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY), |
2141 |
+@@ -757,6 +762,12 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
2142 |
+ |
2143 |
+ /* Validate node/xp vs topology */ |
2144 |
+ switch (type) { |
2145 |
++ case CCN_TYPE_MN: |
2146 |
++ if (node_xp != ccn->mn_id) { |
2147 |
++ dev_warn(ccn->dev, "Invalid MN ID %d!\n", node_xp); |
2148 |
++ return -EINVAL; |
2149 |
++ } |
2150 |
++ break; |
2151 |
+ case CCN_TYPE_XP: |
2152 |
+ if (node_xp >= ccn->num_xps) { |
2153 |
+ dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); |
2154 |
+@@ -884,6 +895,10 @@ static void arm_ccn_pmu_xp_dt_config(struct perf_event *event, int enable) |
2155 |
+ struct arm_ccn_component *xp; |
2156 |
+ u32 val, dt_cfg; |
2157 |
+ |
2158 |
++ /* Nothing to do for cycle counter */ |
2159 |
++ if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) |
2160 |
++ return; |
2161 |
++ |
2162 |
+ if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP) |
2163 |
+ xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)]; |
2164 |
+ else |
2165 |
+@@ -986,7 +1001,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) |
2166 |
+ |
2167 |
+ /* Comparison values */ |
2168 |
+ writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp)); |
2169 |
+- writel((cmp_l >> 32) & 0xefffffff, |
2170 |
++ writel((cmp_l >> 32) & 0x7fffffff, |
2171 |
+ source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4); |
2172 |
+ writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp)); |
2173 |
+ writel((cmp_h >> 32) & 0x0fffffff, |
2174 |
+@@ -994,7 +1009,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) |
2175 |
+ |
2176 |
+ /* Mask */ |
2177 |
+ writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp)); |
2178 |
+- writel((mask_l >> 32) & 0xefffffff, |
2179 |
++ writel((mask_l >> 32) & 0x7fffffff, |
2180 |
+ source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4); |
2181 |
+ writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp)); |
2182 |
+ writel((mask_h >> 32) & 0x0fffffff, |
2183 |
+@@ -1369,6 +1384,8 @@ static int arm_ccn_init_nodes(struct arm_ccn *ccn, int region, |
2184 |
+ |
2185 |
+ switch (type) { |
2186 |
+ case CCN_TYPE_MN: |
2187 |
++ ccn->mn_id = id; |
2188 |
++ return 0; |
2189 |
+ case CCN_TYPE_DT: |
2190 |
+ return 0; |
2191 |
+ case CCN_TYPE_XP: |
2192 |
+diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c |
2193 |
+index 6f3719d73390..e84877a2cacc 100644 |
2194 |
+--- a/drivers/clocksource/sun4i_timer.c |
2195 |
++++ b/drivers/clocksource/sun4i_timer.c |
2196 |
+@@ -123,12 +123,16 @@ static struct clock_event_device sun4i_clockevent = { |
2197 |
+ .set_next_event = sun4i_clkevt_next_event, |
2198 |
+ }; |
2199 |
+ |
2200 |
++static void sun4i_timer_clear_interrupt(void) |
2201 |
++{ |
2202 |
++ writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG); |
2203 |
++} |
2204 |
+ |
2205 |
+ static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id) |
2206 |
+ { |
2207 |
+ struct clock_event_device *evt = (struct clock_event_device *)dev_id; |
2208 |
+ |
2209 |
+- writel(0x1, timer_base + TIMER_IRQ_ST_REG); |
2210 |
++ sun4i_timer_clear_interrupt(); |
2211 |
+ evt->event_handler(evt); |
2212 |
+ |
2213 |
+ return IRQ_HANDLED; |
2214 |
+@@ -193,6 +197,9 @@ static void __init sun4i_timer_init(struct device_node *node) |
2215 |
+ /* Make sure timer is stopped before playing with interrupts */ |
2216 |
+ sun4i_clkevt_time_stop(0); |
2217 |
+ |
2218 |
++ /* clear timer0 interrupt */ |
2219 |
++ sun4i_timer_clear_interrupt(); |
2220 |
++ |
2221 |
+ sun4i_clockevent.cpumask = cpu_possible_mask; |
2222 |
+ sun4i_clockevent.irq = irq; |
2223 |
+ |
2224 |
+diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c |
2225 |
+index 3bd127f95315..aded10662020 100644 |
2226 |
+--- a/drivers/firmware/efi/libstub/efi-stub-helper.c |
2227 |
++++ b/drivers/firmware/efi/libstub/efi-stub-helper.c |
2228 |
+@@ -41,6 +41,8 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; |
2229 |
+ #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE |
2230 |
+ #endif |
2231 |
+ |
2232 |
++#define EFI_MMAP_NR_SLACK_SLOTS 8 |
2233 |
++ |
2234 |
+ struct file_info { |
2235 |
+ efi_file_handle_t *handle; |
2236 |
+ u64 size; |
2237 |
+@@ -63,49 +65,62 @@ void efi_printk(efi_system_table_t *sys_table_arg, char *str) |
2238 |
+ } |
2239 |
+ } |
2240 |
+ |
2241 |
++static inline bool mmap_has_headroom(unsigned long buff_size, |
2242 |
++ unsigned long map_size, |
2243 |
++ unsigned long desc_size) |
2244 |
++{ |
2245 |
++ unsigned long slack = buff_size - map_size; |
2246 |
++ |
2247 |
++ return slack / desc_size >= EFI_MMAP_NR_SLACK_SLOTS; |
2248 |
++} |
2249 |
++ |
2250 |
+ efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
2251 |
+- efi_memory_desc_t **map, |
2252 |
+- unsigned long *map_size, |
2253 |
+- unsigned long *desc_size, |
2254 |
+- u32 *desc_ver, |
2255 |
+- unsigned long *key_ptr) |
2256 |
++ struct efi_boot_memmap *map) |
2257 |
+ { |
2258 |
+ efi_memory_desc_t *m = NULL; |
2259 |
+ efi_status_t status; |
2260 |
+ unsigned long key; |
2261 |
+ u32 desc_version; |
2262 |
+ |
2263 |
+- *map_size = sizeof(*m) * 32; |
2264 |
++ *map->desc_size = sizeof(*m); |
2265 |
++ *map->map_size = *map->desc_size * 32; |
2266 |
++ *map->buff_size = *map->map_size; |
2267 |
+ again: |
2268 |
+- /* |
2269 |
+- * Add an additional efi_memory_desc_t because we're doing an |
2270 |
+- * allocation which may be in a new descriptor region. |
2271 |
+- */ |
2272 |
+- *map_size += sizeof(*m); |
2273 |
+ status = efi_call_early(allocate_pool, EFI_LOADER_DATA, |
2274 |
+- *map_size, (void **)&m); |
2275 |
++ *map->map_size, (void **)&m); |
2276 |
+ if (status != EFI_SUCCESS) |
2277 |
+ goto fail; |
2278 |
+ |
2279 |
+- *desc_size = 0; |
2280 |
++ *map->desc_size = 0; |
2281 |
+ key = 0; |
2282 |
+- status = efi_call_early(get_memory_map, map_size, m, |
2283 |
+- &key, desc_size, &desc_version); |
2284 |
+- if (status == EFI_BUFFER_TOO_SMALL) { |
2285 |
++ status = efi_call_early(get_memory_map, map->map_size, m, |
2286 |
++ &key, map->desc_size, &desc_version); |
2287 |
++ if (status == EFI_BUFFER_TOO_SMALL || |
2288 |
++ !mmap_has_headroom(*map->buff_size, *map->map_size, |
2289 |
++ *map->desc_size)) { |
2290 |
+ efi_call_early(free_pool, m); |
2291 |
++ /* |
2292 |
++ * Make sure there is some entries of headroom so that the |
2293 |
++ * buffer can be reused for a new map after allocations are |
2294 |
++ * no longer permitted. Its unlikely that the map will grow to |
2295 |
++ * exceed this headroom once we are ready to trigger |
2296 |
++ * ExitBootServices() |
2297 |
++ */ |
2298 |
++ *map->map_size += *map->desc_size * EFI_MMAP_NR_SLACK_SLOTS; |
2299 |
++ *map->buff_size = *map->map_size; |
2300 |
+ goto again; |
2301 |
+ } |
2302 |
+ |
2303 |
+ if (status != EFI_SUCCESS) |
2304 |
+ efi_call_early(free_pool, m); |
2305 |
+ |
2306 |
+- if (key_ptr && status == EFI_SUCCESS) |
2307 |
+- *key_ptr = key; |
2308 |
+- if (desc_ver && status == EFI_SUCCESS) |
2309 |
+- *desc_ver = desc_version; |
2310 |
++ if (map->key_ptr && status == EFI_SUCCESS) |
2311 |
++ *map->key_ptr = key; |
2312 |
++ if (map->desc_ver && status == EFI_SUCCESS) |
2313 |
++ *map->desc_ver = desc_version; |
2314 |
+ |
2315 |
+ fail: |
2316 |
+- *map = m; |
2317 |
++ *map->map = m; |
2318 |
+ return status; |
2319 |
+ } |
2320 |
+ |
2321 |
+@@ -113,13 +128,20 @@ fail: |
2322 |
+ unsigned long get_dram_base(efi_system_table_t *sys_table_arg) |
2323 |
+ { |
2324 |
+ efi_status_t status; |
2325 |
+- unsigned long map_size; |
2326 |
++ unsigned long map_size, buff_size; |
2327 |
+ unsigned long membase = EFI_ERROR; |
2328 |
+ struct efi_memory_map map; |
2329 |
+ efi_memory_desc_t *md; |
2330 |
++ struct efi_boot_memmap boot_map; |
2331 |
+ |
2332 |
+- status = efi_get_memory_map(sys_table_arg, (efi_memory_desc_t **)&map.map, |
2333 |
+- &map_size, &map.desc_size, NULL, NULL); |
2334 |
++ boot_map.map = (efi_memory_desc_t **)&map.map; |
2335 |
++ boot_map.map_size = &map_size; |
2336 |
++ boot_map.desc_size = &map.desc_size; |
2337 |
++ boot_map.desc_ver = NULL; |
2338 |
++ boot_map.key_ptr = NULL; |
2339 |
++ boot_map.buff_size = &buff_size; |
2340 |
++ |
2341 |
++ status = efi_get_memory_map(sys_table_arg, &boot_map); |
2342 |
+ if (status != EFI_SUCCESS) |
2343 |
+ return membase; |
2344 |
+ |
2345 |
+@@ -144,15 +166,22 @@ efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, |
2346 |
+ unsigned long size, unsigned long align, |
2347 |
+ unsigned long *addr, unsigned long max) |
2348 |
+ { |
2349 |
+- unsigned long map_size, desc_size; |
2350 |
++ unsigned long map_size, desc_size, buff_size; |
2351 |
+ efi_memory_desc_t *map; |
2352 |
+ efi_status_t status; |
2353 |
+ unsigned long nr_pages; |
2354 |
+ u64 max_addr = 0; |
2355 |
+ int i; |
2356 |
++ struct efi_boot_memmap boot_map; |
2357 |
++ |
2358 |
++ boot_map.map = ↦ |
2359 |
++ boot_map.map_size = &map_size; |
2360 |
++ boot_map.desc_size = &desc_size; |
2361 |
++ boot_map.desc_ver = NULL; |
2362 |
++ boot_map.key_ptr = NULL; |
2363 |
++ boot_map.buff_size = &buff_size; |
2364 |
+ |
2365 |
+- status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, |
2366 |
+- NULL, NULL); |
2367 |
++ status = efi_get_memory_map(sys_table_arg, &boot_map); |
2368 |
+ if (status != EFI_SUCCESS) |
2369 |
+ goto fail; |
2370 |
+ |
2371 |
+@@ -230,14 +259,21 @@ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, |
2372 |
+ unsigned long size, unsigned long align, |
2373 |
+ unsigned long *addr) |
2374 |
+ { |
2375 |
+- unsigned long map_size, desc_size; |
2376 |
++ unsigned long map_size, desc_size, buff_size; |
2377 |
+ efi_memory_desc_t *map; |
2378 |
+ efi_status_t status; |
2379 |
+ unsigned long nr_pages; |
2380 |
+ int i; |
2381 |
++ struct efi_boot_memmap boot_map; |
2382 |
+ |
2383 |
+- status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, |
2384 |
+- NULL, NULL); |
2385 |
++ boot_map.map = ↦ |
2386 |
++ boot_map.map_size = &map_size; |
2387 |
++ boot_map.desc_size = &desc_size; |
2388 |
++ boot_map.desc_ver = NULL; |
2389 |
++ boot_map.key_ptr = NULL; |
2390 |
++ boot_map.buff_size = &buff_size; |
2391 |
++ |
2392 |
++ status = efi_get_memory_map(sys_table_arg, &boot_map); |
2393 |
+ if (status != EFI_SUCCESS) |
2394 |
+ goto fail; |
2395 |
+ |
2396 |
+@@ -704,3 +740,76 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, |
2397 |
+ *cmd_line_len = options_bytes; |
2398 |
+ return (char *)cmdline_addr; |
2399 |
+ } |
2400 |
++ |
2401 |
++/* |
2402 |
++ * Handle calling ExitBootServices according to the requirements set out by the |
2403 |
++ * spec. Obtains the current memory map, and returns that info after calling |
2404 |
++ * ExitBootServices. The client must specify a function to perform any |
2405 |
++ * processing of the memory map data prior to ExitBootServices. A client |
2406 |
++ * specific structure may be passed to the function via priv. The client |
2407 |
++ * function may be called multiple times. |
2408 |
++ */ |
2409 |
++efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg, |
2410 |
++ void *handle, |
2411 |
++ struct efi_boot_memmap *map, |
2412 |
++ void *priv, |
2413 |
++ efi_exit_boot_map_processing priv_func) |
2414 |
++{ |
2415 |
++ efi_status_t status; |
2416 |
++ |
2417 |
++ status = efi_get_memory_map(sys_table_arg, map); |
2418 |
++ |
2419 |
++ if (status != EFI_SUCCESS) |
2420 |
++ goto fail; |
2421 |
++ |
2422 |
++ status = priv_func(sys_table_arg, map, priv); |
2423 |
++ if (status != EFI_SUCCESS) |
2424 |
++ goto free_map; |
2425 |
++ |
2426 |
++ status = efi_call_early(exit_boot_services, handle, *map->key_ptr); |
2427 |
++ |
2428 |
++ if (status == EFI_INVALID_PARAMETER) { |
2429 |
++ /* |
2430 |
++ * The memory map changed between efi_get_memory_map() and |
2431 |
++ * exit_boot_services(). Per the UEFI Spec v2.6, Section 6.4: |
2432 |
++ * EFI_BOOT_SERVICES.ExitBootServices we need to get the |
2433 |
++ * updated map, and try again. The spec implies one retry |
2434 |
++ * should be sufficent, which is confirmed against the EDK2 |
2435 |
++ * implementation. Per the spec, we can only invoke |
2436 |
++ * get_memory_map() and exit_boot_services() - we cannot alloc |
2437 |
++ * so efi_get_memory_map() cannot be used, and we must reuse |
2438 |
++ * the buffer. For all practical purposes, the headroom in the |
2439 |
++ * buffer should account for any changes in the map so the call |
2440 |
++ * to get_memory_map() is expected to succeed here. |
2441 |
++ */ |
2442 |
++ *map->map_size = *map->buff_size; |
2443 |
++ status = efi_call_early(get_memory_map, |
2444 |
++ map->map_size, |
2445 |
++ *map->map, |
2446 |
++ map->key_ptr, |
2447 |
++ map->desc_size, |
2448 |
++ map->desc_ver); |
2449 |
++ |
2450 |
++ /* exit_boot_services() was called, thus cannot free */ |
2451 |
++ if (status != EFI_SUCCESS) |
2452 |
++ goto fail; |
2453 |
++ |
2454 |
++ status = priv_func(sys_table_arg, map, priv); |
2455 |
++ /* exit_boot_services() was called, thus cannot free */ |
2456 |
++ if (status != EFI_SUCCESS) |
2457 |
++ goto fail; |
2458 |
++ |
2459 |
++ status = efi_call_early(exit_boot_services, handle, *map->key_ptr); |
2460 |
++ } |
2461 |
++ |
2462 |
++ /* exit_boot_services() was called, thus cannot free */ |
2463 |
++ if (status != EFI_SUCCESS) |
2464 |
++ goto fail; |
2465 |
++ |
2466 |
++ return EFI_SUCCESS; |
2467 |
++ |
2468 |
++free_map: |
2469 |
++ efi_call_early(free_pool, *map->map); |
2470 |
++fail: |
2471 |
++ return status; |
2472 |
++} |
2473 |
+diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c |
2474 |
+index e58abfa953cc..a6a93116a8f0 100644 |
2475 |
+--- a/drivers/firmware/efi/libstub/fdt.c |
2476 |
++++ b/drivers/firmware/efi/libstub/fdt.c |
2477 |
+@@ -152,6 +152,27 @@ fdt_set_fail: |
2478 |
+ #define EFI_FDT_ALIGN EFI_PAGE_SIZE |
2479 |
+ #endif |
2480 |
+ |
2481 |
++struct exit_boot_struct { |
2482 |
++ efi_memory_desc_t *runtime_map; |
2483 |
++ int *runtime_entry_count; |
2484 |
++}; |
2485 |
++ |
2486 |
++static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, |
2487 |
++ struct efi_boot_memmap *map, |
2488 |
++ void *priv) |
2489 |
++{ |
2490 |
++ struct exit_boot_struct *p = priv; |
2491 |
++ /* |
2492 |
++ * Update the memory map with virtual addresses. The function will also |
2493 |
++ * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME |
2494 |
++ * entries so that we can pass it straight to SetVirtualAddressMap() |
2495 |
++ */ |
2496 |
++ efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, |
2497 |
++ p->runtime_map, p->runtime_entry_count); |
2498 |
++ |
2499 |
++ return EFI_SUCCESS; |
2500 |
++} |
2501 |
++ |
2502 |
+ /* |
2503 |
+ * Allocate memory for a new FDT, then add EFI, commandline, and |
2504 |
+ * initrd related fields to the FDT. This routine increases the |
2505 |
+@@ -175,13 +196,22 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
2506 |
+ unsigned long fdt_addr, |
2507 |
+ unsigned long fdt_size) |
2508 |
+ { |
2509 |
+- unsigned long map_size, desc_size; |
2510 |
++ unsigned long map_size, desc_size, buff_size; |
2511 |
+ u32 desc_ver; |
2512 |
+ unsigned long mmap_key; |
2513 |
+ efi_memory_desc_t *memory_map, *runtime_map; |
2514 |
+ unsigned long new_fdt_size; |
2515 |
+ efi_status_t status; |
2516 |
+ int runtime_entry_count = 0; |
2517 |
++ struct efi_boot_memmap map; |
2518 |
++ struct exit_boot_struct priv; |
2519 |
++ |
2520 |
++ map.map = &runtime_map; |
2521 |
++ map.map_size = &map_size; |
2522 |
++ map.desc_size = &desc_size; |
2523 |
++ map.desc_ver = &desc_ver; |
2524 |
++ map.key_ptr = &mmap_key; |
2525 |
++ map.buff_size = &buff_size; |
2526 |
+ |
2527 |
+ /* |
2528 |
+ * Get a copy of the current memory map that we will use to prepare |
2529 |
+@@ -189,8 +219,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
2530 |
+ * subsequent allocations adding entries, since they could not affect |
2531 |
+ * the number of EFI_MEMORY_RUNTIME regions. |
2532 |
+ */ |
2533 |
+- status = efi_get_memory_map(sys_table, &runtime_map, &map_size, |
2534 |
+- &desc_size, &desc_ver, &mmap_key); |
2535 |
++ status = efi_get_memory_map(sys_table, &map); |
2536 |
+ if (status != EFI_SUCCESS) { |
2537 |
+ pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); |
2538 |
+ return status; |
2539 |
+@@ -199,6 +228,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
2540 |
+ pr_efi(sys_table, |
2541 |
+ "Exiting boot services and installing virtual address map...\n"); |
2542 |
+ |
2543 |
++ map.map = &memory_map; |
2544 |
+ /* |
2545 |
+ * Estimate size of new FDT, and allocate memory for it. We |
2546 |
+ * will allocate a bigger buffer if this ends up being too |
2547 |
+@@ -218,8 +248,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
2548 |
+ * we can get the memory map key needed for |
2549 |
+ * exit_boot_services(). |
2550 |
+ */ |
2551 |
+- status = efi_get_memory_map(sys_table, &memory_map, &map_size, |
2552 |
+- &desc_size, &desc_ver, &mmap_key); |
2553 |
++ status = efi_get_memory_map(sys_table, &map); |
2554 |
+ if (status != EFI_SUCCESS) |
2555 |
+ goto fail_free_new_fdt; |
2556 |
+ |
2557 |
+@@ -250,16 +279,11 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, |
2558 |
+ } |
2559 |
+ } |
2560 |
+ |
2561 |
+- /* |
2562 |
+- * Update the memory map with virtual addresses. The function will also |
2563 |
+- * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME |
2564 |
+- * entries so that we can pass it straight into SetVirtualAddressMap() |
2565 |
+- */ |
2566 |
+- efi_get_virtmap(memory_map, map_size, desc_size, runtime_map, |
2567 |
+- &runtime_entry_count); |
2568 |
+- |
2569 |
+- /* Now we are ready to exit_boot_services.*/ |
2570 |
+- status = sys_table->boottime->exit_boot_services(handle, mmap_key); |
2571 |
++ sys_table->boottime->free_pool(memory_map); |
2572 |
++ priv.runtime_map = runtime_map; |
2573 |
++ priv.runtime_entry_count = &runtime_entry_count; |
2574 |
++ status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
2575 |
++ exit_boot_func); |
2576 |
+ |
2577 |
+ if (status == EFI_SUCCESS) { |
2578 |
+ efi_set_virtual_address_map_t *svam; |
2579 |
+diff --git a/drivers/firmware/efi/libstub/random.c b/drivers/firmware/efi/libstub/random.c |
2580 |
+index 53f6d3fe6d86..0c9f58c5ba50 100644 |
2581 |
+--- a/drivers/firmware/efi/libstub/random.c |
2582 |
++++ b/drivers/firmware/efi/libstub/random.c |
2583 |
+@@ -73,12 +73,20 @@ efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, |
2584 |
+ unsigned long random_seed) |
2585 |
+ { |
2586 |
+ unsigned long map_size, desc_size, total_slots = 0, target_slot; |
2587 |
++ unsigned long buff_size; |
2588 |
+ efi_status_t status; |
2589 |
+ efi_memory_desc_t *memory_map; |
2590 |
+ int map_offset; |
2591 |
++ struct efi_boot_memmap map; |
2592 |
+ |
2593 |
+- status = efi_get_memory_map(sys_table_arg, &memory_map, &map_size, |
2594 |
+- &desc_size, NULL, NULL); |
2595 |
++ map.map = &memory_map; |
2596 |
++ map.map_size = &map_size; |
2597 |
++ map.desc_size = &desc_size; |
2598 |
++ map.desc_ver = NULL; |
2599 |
++ map.key_ptr = NULL; |
2600 |
++ map.buff_size = &buff_size; |
2601 |
++ |
2602 |
++ status = efi_get_memory_map(sys_table_arg, &map); |
2603 |
+ if (status != EFI_SUCCESS) |
2604 |
+ return status; |
2605 |
+ |
2606 |
+diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |
2607 |
+index 016c191221f3..52c527f6642a 100644 |
2608 |
+--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |
2609 |
++++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |
2610 |
+@@ -320,19 +320,19 @@ atmel_hlcdc_plane_update_pos_and_size(struct atmel_hlcdc_plane *plane, |
2611 |
+ u32 *coeff_tab = heo_upscaling_ycoef; |
2612 |
+ u32 max_memsize; |
2613 |
+ |
2614 |
+- if (state->crtc_w < state->src_w) |
2615 |
++ if (state->crtc_h < state->src_h) |
2616 |
+ coeff_tab = heo_downscaling_ycoef; |
2617 |
+ for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) |
2618 |
+ atmel_hlcdc_layer_update_cfg(&plane->layer, |
2619 |
+ 33 + i, |
2620 |
+ 0xffffffff, |
2621 |
+ coeff_tab[i]); |
2622 |
+- factor = ((8 * 256 * state->src_w) - (256 * 4)) / |
2623 |
+- state->crtc_w; |
2624 |
++ factor = ((8 * 256 * state->src_h) - (256 * 4)) / |
2625 |
++ state->crtc_h; |
2626 |
+ factor++; |
2627 |
+- max_memsize = ((factor * state->crtc_w) + (256 * 4)) / |
2628 |
++ max_memsize = ((factor * state->crtc_h) + (256 * 4)) / |
2629 |
+ 2048; |
2630 |
+- if (max_memsize > state->src_w) |
2631 |
++ if (max_memsize > state->src_h) |
2632 |
+ factor--; |
2633 |
+ factor_reg |= (factor << 16) | 0x80000000; |
2634 |
+ } |
2635 |
+diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c |
2636 |
+index 57676f8d7ecf..a6289752be16 100644 |
2637 |
+--- a/drivers/gpu/drm/drm_ioc32.c |
2638 |
++++ b/drivers/gpu/drm/drm_ioc32.c |
2639 |
+@@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, |
2640 |
+ return 0; |
2641 |
+ } |
2642 |
+ |
2643 |
++#if defined(CONFIG_X86) || defined(CONFIG_IA64) |
2644 |
+ typedef struct drm_mode_fb_cmd232 { |
2645 |
+ u32 fb_id; |
2646 |
+ u32 width; |
2647 |
+@@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, |
2648 |
+ |
2649 |
+ return 0; |
2650 |
+ } |
2651 |
++#endif |
2652 |
+ |
2653 |
+ static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
2654 |
+ [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
2655 |
+@@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
2656 |
+ [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
2657 |
+ #endif |
2658 |
+ [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
2659 |
++#if defined(CONFIG_X86) || defined(CONFIG_IA64) |
2660 |
+ [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, |
2661 |
++#endif |
2662 |
+ }; |
2663 |
+ |
2664 |
+ /** |
2665 |
+diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c |
2666 |
+index 103546834b60..2a6e12956baf 100644 |
2667 |
+--- a/drivers/gpu/drm/i915/i915_debugfs.c |
2668 |
++++ b/drivers/gpu/drm/i915/i915_debugfs.c |
2669 |
+@@ -2100,9 +2100,10 @@ static int i915_dump_lrc(struct seq_file *m, void *unused) |
2670 |
+ return ret; |
2671 |
+ |
2672 |
+ list_for_each_entry(ctx, &dev_priv->context_list, link) |
2673 |
+- if (ctx != dev_priv->kernel_context) |
2674 |
++ if (ctx != dev_priv->kernel_context) { |
2675 |
+ for_each_engine(engine, dev_priv) |
2676 |
+ i915_dump_lrc_obj(m, ctx, engine); |
2677 |
++ } |
2678 |
+ |
2679 |
+ mutex_unlock(&dev->struct_mutex); |
2680 |
+ |
2681 |
+diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c |
2682 |
+index 16e209d326b6..72842aafdcf6 100644 |
2683 |
+--- a/drivers/gpu/drm/i915/intel_opregion.c |
2684 |
++++ b/drivers/gpu/drm/i915/intel_opregion.c |
2685 |
+@@ -1013,6 +1013,23 @@ err_out: |
2686 |
+ return err; |
2687 |
+ } |
2688 |
+ |
2689 |
++static int intel_use_opregion_panel_type_callback(const struct dmi_system_id *id) |
2690 |
++{ |
2691 |
++ DRM_INFO("Using panel type from OpRegion on %s\n", id->ident); |
2692 |
++ return 1; |
2693 |
++} |
2694 |
++ |
2695 |
++static const struct dmi_system_id intel_use_opregion_panel_type[] = { |
2696 |
++ { |
2697 |
++ .callback = intel_use_opregion_panel_type_callback, |
2698 |
++ .ident = "Conrac GmbH IX45GM2", |
2699 |
++ .matches = {DMI_MATCH(DMI_SYS_VENDOR, "Conrac GmbH"), |
2700 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "IX45GM2"), |
2701 |
++ }, |
2702 |
++ }, |
2703 |
++ { } |
2704 |
++}; |
2705 |
++ |
2706 |
+ int |
2707 |
+ intel_opregion_get_panel_type(struct drm_device *dev) |
2708 |
+ { |
2709 |
+@@ -1039,6 +1056,16 @@ intel_opregion_get_panel_type(struct drm_device *dev) |
2710 |
+ } |
2711 |
+ |
2712 |
+ /* |
2713 |
++ * So far we know that some machined must use it, others must not use it. |
2714 |
++ * There doesn't seem to be any way to determine which way to go, except |
2715 |
++ * via a quirk list :( |
2716 |
++ */ |
2717 |
++ if (!dmi_check_system(intel_use_opregion_panel_type)) { |
2718 |
++ DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); |
2719 |
++ return -ENODEV; |
2720 |
++ } |
2721 |
++ |
2722 |
++ /* |
2723 |
+ * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us |
2724 |
+ * low vswing for eDP, whereas the VBT panel type (2) gives us normal |
2725 |
+ * vswing instead. Low vswing results in some display flickers, so |
2726 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h |
2727 |
+index 5b2963f32291..16ae246f7cc2 100644 |
2728 |
+--- a/drivers/gpu/drm/msm/msm_drv.h |
2729 |
++++ b/drivers/gpu/drm/msm/msm_drv.h |
2730 |
+@@ -148,6 +148,12 @@ struct msm_drm_private { |
2731 |
+ } vram; |
2732 |
+ |
2733 |
+ struct msm_vblank_ctrl vblank_ctrl; |
2734 |
++ |
2735 |
++ /* task holding struct_mutex.. currently only used in submit path |
2736 |
++ * to detect and reject faults from copy_from_user() for submit |
2737 |
++ * ioctl. |
2738 |
++ */ |
2739 |
++ struct task_struct *struct_mutex_task; |
2740 |
+ }; |
2741 |
+ |
2742 |
+ struct msm_format { |
2743 |
+diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c |
2744 |
+index 69836f5685b1..46ffcbf2f30e 100644 |
2745 |
+--- a/drivers/gpu/drm/msm/msm_gem.c |
2746 |
++++ b/drivers/gpu/drm/msm/msm_gem.c |
2747 |
+@@ -196,11 +196,20 @@ int msm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
2748 |
+ { |
2749 |
+ struct drm_gem_object *obj = vma->vm_private_data; |
2750 |
+ struct drm_device *dev = obj->dev; |
2751 |
++ struct msm_drm_private *priv = dev->dev_private; |
2752 |
+ struct page **pages; |
2753 |
+ unsigned long pfn; |
2754 |
+ pgoff_t pgoff; |
2755 |
+ int ret; |
2756 |
+ |
2757 |
++ /* This should only happen if userspace tries to pass a mmap'd |
2758 |
++ * but unfaulted gem bo vaddr into submit ioctl, triggering |
2759 |
++ * a page fault while struct_mutex is already held. This is |
2760 |
++ * not a valid use-case so just bail. |
2761 |
++ */ |
2762 |
++ if (priv->struct_mutex_task == current) |
2763 |
++ return VM_FAULT_SIGBUS; |
2764 |
++ |
2765 |
+ /* Make sure we don't parallel update on a fault, nor move or remove |
2766 |
+ * something from beneath our feet |
2767 |
+ */ |
2768 |
+diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c |
2769 |
+index eb515f04eb9d..c1889d700f26 100644 |
2770 |
+--- a/drivers/gpu/drm/msm/msm_gem_submit.c |
2771 |
++++ b/drivers/gpu/drm/msm/msm_gem_submit.c |
2772 |
+@@ -394,6 +394,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, |
2773 |
+ return -ENOMEM; |
2774 |
+ |
2775 |
+ mutex_lock(&dev->struct_mutex); |
2776 |
++ priv->struct_mutex_task = current; |
2777 |
+ |
2778 |
+ ret = submit_lookup_objects(submit, args, file); |
2779 |
+ if (ret) |
2780 |
+@@ -479,6 +480,7 @@ out: |
2781 |
+ submit_cleanup(submit); |
2782 |
+ if (ret) |
2783 |
+ msm_gem_submit_free(submit); |
2784 |
++ priv->struct_mutex_task = NULL; |
2785 |
+ mutex_unlock(&dev->struct_mutex); |
2786 |
+ return ret; |
2787 |
+ } |
2788 |
+diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c |
2789 |
+index 197e693e7e7b..3833c83a4065 100644 |
2790 |
+--- a/drivers/iio/accel/bmc150-accel-core.c |
2791 |
++++ b/drivers/iio/accel/bmc150-accel-core.c |
2792 |
+@@ -67,6 +67,9 @@ |
2793 |
+ #define BMC150_ACCEL_REG_PMU_BW 0x10 |
2794 |
+ #define BMC150_ACCEL_DEF_BW 125 |
2795 |
+ |
2796 |
++#define BMC150_ACCEL_REG_RESET 0x14 |
2797 |
++#define BMC150_ACCEL_RESET_VAL 0xB6 |
2798 |
++ |
2799 |
+ #define BMC150_ACCEL_REG_INT_MAP_0 0x19 |
2800 |
+ #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) |
2801 |
+ |
2802 |
+@@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) |
2803 |
+ int ret, i; |
2804 |
+ unsigned int val; |
2805 |
+ |
2806 |
++ /* |
2807 |
++ * Reset chip to get it in a known good state. A delay of 1.8ms after |
2808 |
++ * reset is required according to the data sheets of supported chips. |
2809 |
++ */ |
2810 |
++ regmap_write(data->regmap, BMC150_ACCEL_REG_RESET, |
2811 |
++ BMC150_ACCEL_RESET_VAL); |
2812 |
++ usleep_range(1800, 2500); |
2813 |
++ |
2814 |
+ ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); |
2815 |
+ if (ret < 0) { |
2816 |
+ dev_err(dev, "Error: Reading chip id\n"); |
2817 |
+diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c |
2818 |
+index 3a9f106787d2..9d72d4bcf5e9 100644 |
2819 |
+--- a/drivers/iio/accel/kxsd9.c |
2820 |
++++ b/drivers/iio/accel/kxsd9.c |
2821 |
+@@ -160,11 +160,13 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, |
2822 |
+ if (ret < 0) |
2823 |
+ goto error_ret; |
2824 |
+ *val = ret; |
2825 |
++ ret = IIO_VAL_INT; |
2826 |
+ break; |
2827 |
+ case IIO_CHAN_INFO_SCALE: |
2828 |
+ ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
2829 |
+ if (ret < 0) |
2830 |
+ goto error_ret; |
2831 |
++ *val = 0; |
2832 |
+ *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
2833 |
+ ret = IIO_VAL_INT_PLUS_MICRO; |
2834 |
+ break; |
2835 |
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
2836 |
+index 25378c5882e2..f7232185d191 100644 |
2837 |
+--- a/drivers/iio/adc/Kconfig |
2838 |
++++ b/drivers/iio/adc/Kconfig |
2839 |
+@@ -377,6 +377,7 @@ config QCOM_SPMI_VADC |
2840 |
+ config ROCKCHIP_SARADC |
2841 |
+ tristate "Rockchip SARADC driver" |
2842 |
+ depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) |
2843 |
++ depends on RESET_CONTROLLER |
2844 |
+ help |
2845 |
+ Say yes here to build support for the SARADC found in SoCs from |
2846 |
+ Rockchip. |
2847 |
+diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c |
2848 |
+index a3f5254f4e51..03962233501c 100644 |
2849 |
+--- a/drivers/iio/adc/ad799x.c |
2850 |
++++ b/drivers/iio/adc/ad799x.c |
2851 |
+@@ -533,6 +533,7 @@ static struct attribute_group ad799x_event_attrs_group = { |
2852 |
+ static const struct iio_info ad7991_info = { |
2853 |
+ .read_raw = &ad799x_read_raw, |
2854 |
+ .driver_module = THIS_MODULE, |
2855 |
++ .update_scan_mode = ad799x_update_scan_mode, |
2856 |
+ }; |
2857 |
+ |
2858 |
+ static const struct iio_info ad7993_4_7_8_noirq_info = { |
2859 |
+diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c |
2860 |
+index 52430ba171f3..0438c68015e8 100644 |
2861 |
+--- a/drivers/iio/adc/at91_adc.c |
2862 |
++++ b/drivers/iio/adc/at91_adc.c |
2863 |
+@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) |
2864 |
+ st->ts_bufferedmeasure = false; |
2865 |
+ input_report_key(st->ts_input, BTN_TOUCH, 0); |
2866 |
+ input_sync(st->ts_input); |
2867 |
+- } else if (status & AT91_ADC_EOC(3)) { |
2868 |
+- /* Conversion finished */ |
2869 |
++ } else if (status & AT91_ADC_EOC(3) && st->ts_input) { |
2870 |
++ /* Conversion finished and we've a touchscreen */ |
2871 |
+ if (st->ts_bufferedmeasure) { |
2872 |
+ /* |
2873 |
+ * Last measurement is always discarded, since it can |
2874 |
+diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c |
2875 |
+index f9ad6c2d6821..85d701291654 100644 |
2876 |
+--- a/drivers/iio/adc/rockchip_saradc.c |
2877 |
++++ b/drivers/iio/adc/rockchip_saradc.c |
2878 |
+@@ -21,6 +21,8 @@ |
2879 |
+ #include <linux/of_device.h> |
2880 |
+ #include <linux/clk.h> |
2881 |
+ #include <linux/completion.h> |
2882 |
++#include <linux/delay.h> |
2883 |
++#include <linux/reset.h> |
2884 |
+ #include <linux/regulator/consumer.h> |
2885 |
+ #include <linux/iio/iio.h> |
2886 |
+ |
2887 |
+@@ -53,6 +55,7 @@ struct rockchip_saradc { |
2888 |
+ struct clk *clk; |
2889 |
+ struct completion completion; |
2890 |
+ struct regulator *vref; |
2891 |
++ struct reset_control *reset; |
2892 |
+ const struct rockchip_saradc_data *data; |
2893 |
+ u16 last_val; |
2894 |
+ }; |
2895 |
+@@ -190,6 +193,16 @@ static const struct of_device_id rockchip_saradc_match[] = { |
2896 |
+ }; |
2897 |
+ MODULE_DEVICE_TABLE(of, rockchip_saradc_match); |
2898 |
+ |
2899 |
++/** |
2900 |
++ * Reset SARADC Controller. |
2901 |
++ */ |
2902 |
++static void rockchip_saradc_reset_controller(struct reset_control *reset) |
2903 |
++{ |
2904 |
++ reset_control_assert(reset); |
2905 |
++ usleep_range(10, 20); |
2906 |
++ reset_control_deassert(reset); |
2907 |
++} |
2908 |
++ |
2909 |
+ static int rockchip_saradc_probe(struct platform_device *pdev) |
2910 |
+ { |
2911 |
+ struct rockchip_saradc *info = NULL; |
2912 |
+@@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev) |
2913 |
+ if (IS_ERR(info->regs)) |
2914 |
+ return PTR_ERR(info->regs); |
2915 |
+ |
2916 |
++ /* |
2917 |
++ * The reset should be an optional property, as it should work |
2918 |
++ * with old devicetrees as well |
2919 |
++ */ |
2920 |
++ info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb"); |
2921 |
++ if (IS_ERR(info->reset)) { |
2922 |
++ ret = PTR_ERR(info->reset); |
2923 |
++ if (ret != -ENOENT) |
2924 |
++ return ret; |
2925 |
++ |
2926 |
++ dev_dbg(&pdev->dev, "no reset control found\n"); |
2927 |
++ info->reset = NULL; |
2928 |
++ } |
2929 |
++ |
2930 |
+ init_completion(&info->completion); |
2931 |
+ |
2932 |
+ irq = platform_get_irq(pdev, 0); |
2933 |
+@@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev) |
2934 |
+ return PTR_ERR(info->vref); |
2935 |
+ } |
2936 |
+ |
2937 |
++ if (info->reset) |
2938 |
++ rockchip_saradc_reset_controller(info->reset); |
2939 |
++ |
2940 |
+ /* |
2941 |
+ * Use a default value for the converter clock. |
2942 |
+ * This may become user-configurable in the future. |
2943 |
+diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c |
2944 |
+index 73cbf0b54e54..fe96af6059d5 100644 |
2945 |
+--- a/drivers/iio/adc/ti-ads1015.c |
2946 |
++++ b/drivers/iio/adc/ti-ads1015.c |
2947 |
+@@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = { |
2948 |
+ #ifdef CONFIG_OF |
2949 |
+ static int ads1015_get_channels_config_of(struct i2c_client *client) |
2950 |
+ { |
2951 |
+- struct ads1015_data *data = i2c_get_clientdata(client); |
2952 |
++ struct iio_dev *indio_dev = i2c_get_clientdata(client); |
2953 |
++ struct ads1015_data *data = iio_priv(indio_dev); |
2954 |
+ struct device_node *node; |
2955 |
+ |
2956 |
+ if (!client->dev.of_node || |
2957 |
+diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c |
2958 |
+index c1e05532d437..0470fc843d4e 100644 |
2959 |
+--- a/drivers/iio/adc/ti_am335x_adc.c |
2960 |
++++ b/drivers/iio/adc/ti_am335x_adc.c |
2961 |
+@@ -32,6 +32,7 @@ |
2962 |
+ |
2963 |
+ struct tiadc_device { |
2964 |
+ struct ti_tscadc_dev *mfd_tscadc; |
2965 |
++ struct mutex fifo1_lock; /* to protect fifo access */ |
2966 |
+ int channels; |
2967 |
+ u8 channel_line[8]; |
2968 |
+ u8 channel_step[8]; |
2969 |
+@@ -360,6 +361,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, |
2970 |
+ int *val, int *val2, long mask) |
2971 |
+ { |
2972 |
+ struct tiadc_device *adc_dev = iio_priv(indio_dev); |
2973 |
++ int ret = IIO_VAL_INT; |
2974 |
+ int i, map_val; |
2975 |
+ unsigned int fifo1count, read, stepid; |
2976 |
+ bool found = false; |
2977 |
+@@ -373,13 +375,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, |
2978 |
+ if (!step_en) |
2979 |
+ return -EINVAL; |
2980 |
+ |
2981 |
++ mutex_lock(&adc_dev->fifo1_lock); |
2982 |
+ fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
2983 |
+ while (fifo1count--) |
2984 |
+ tiadc_readl(adc_dev, REG_FIFO1); |
2985 |
+ |
2986 |
+ am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en); |
2987 |
+ |
2988 |
+- timeout = jiffies + usecs_to_jiffies |
2989 |
++ timeout = jiffies + msecs_to_jiffies |
2990 |
+ (IDLE_TIMEOUT * adc_dev->channels); |
2991 |
+ /* Wait for Fifo threshold interrupt */ |
2992 |
+ while (1) { |
2993 |
+@@ -389,7 +392,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, |
2994 |
+ |
2995 |
+ if (time_after(jiffies, timeout)) { |
2996 |
+ am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); |
2997 |
+- return -EAGAIN; |
2998 |
++ ret = -EAGAIN; |
2999 |
++ goto err_unlock; |
3000 |
+ } |
3001 |
+ } |
3002 |
+ map_val = adc_dev->channel_step[chan->scan_index]; |
3003 |
+@@ -415,8 +419,11 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, |
3004 |
+ am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); |
3005 |
+ |
3006 |
+ if (found == false) |
3007 |
+- return -EBUSY; |
3008 |
+- return IIO_VAL_INT; |
3009 |
++ ret = -EBUSY; |
3010 |
++ |
3011 |
++err_unlock: |
3012 |
++ mutex_unlock(&adc_dev->fifo1_lock); |
3013 |
++ return ret; |
3014 |
+ } |
3015 |
+ |
3016 |
+ static const struct iio_info tiadc_info = { |
3017 |
+@@ -485,6 +492,7 @@ static int tiadc_probe(struct platform_device *pdev) |
3018 |
+ |
3019 |
+ tiadc_step_config(indio_dev); |
3020 |
+ tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD); |
3021 |
++ mutex_init(&adc_dev->fifo1_lock); |
3022 |
+ |
3023 |
+ err = tiadc_channel_init(indio_dev, adc_dev->channels); |
3024 |
+ if (err < 0) |
3025 |
+diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
3026 |
+index e81f434760f4..dc33c1dd5191 100644 |
3027 |
+--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
3028 |
++++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
3029 |
+@@ -56,8 +56,8 @@ static struct { |
3030 |
+ {HID_USAGE_SENSOR_ALS, 0, 1, 0}, |
3031 |
+ {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, |
3032 |
+ |
3033 |
+- {HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0}, |
3034 |
+- {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0}, |
3035 |
++ {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, |
3036 |
++ {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000}, |
3037 |
+ }; |
3038 |
+ |
3039 |
+ static int pow_10(unsigned power) |
3040 |
+diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c |
3041 |
+index 11535911a5c6..0ebced5570af 100644 |
3042 |
+--- a/drivers/iio/humidity/am2315.c |
3043 |
++++ b/drivers/iio/humidity/am2315.c |
3044 |
+@@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client, |
3045 |
+ indio_dev->channels = am2315_channels; |
3046 |
+ indio_dev->num_channels = ARRAY_SIZE(am2315_channels); |
3047 |
+ |
3048 |
+- ret = iio_triggered_buffer_setup(indio_dev, NULL, |
3049 |
++ ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, |
3050 |
+ am2315_trigger_handler, NULL); |
3051 |
+ if (ret < 0) { |
3052 |
+ dev_err(&client->dev, "iio triggered buffer setup failed\n"); |
3053 |
+diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c |
3054 |
+index a03832a5fc95..e0c9c70c2a4a 100644 |
3055 |
+--- a/drivers/iio/humidity/hdc100x.c |
3056 |
++++ b/drivers/iio/humidity/hdc100x.c |
3057 |
+@@ -142,7 +142,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, |
3058 |
+ struct i2c_client *client = data->client; |
3059 |
+ int delay = data->adc_int_us[chan->address]; |
3060 |
+ int ret; |
3061 |
+- int val; |
3062 |
++ __be16 val; |
3063 |
+ |
3064 |
+ /* start measurement */ |
3065 |
+ ret = i2c_smbus_write_byte(client, chan->address); |
3066 |
+@@ -154,26 +154,13 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, |
3067 |
+ /* wait for integration time to pass */ |
3068 |
+ usleep_range(delay, delay + 1000); |
3069 |
+ |
3070 |
+- /* |
3071 |
+- * i2c_smbus_read_word_data cannot() be used here due to the command |
3072 |
+- * value not being understood and causes NAKs preventing any reading |
3073 |
+- * from being accessed. |
3074 |
+- */ |
3075 |
+- ret = i2c_smbus_read_byte(client); |
3076 |
++ /* read measurement */ |
3077 |
++ ret = i2c_master_recv(data->client, (char *)&val, sizeof(val)); |
3078 |
+ if (ret < 0) { |
3079 |
+- dev_err(&client->dev, "cannot read high byte measurement"); |
3080 |
++ dev_err(&client->dev, "cannot read sensor data\n"); |
3081 |
+ return ret; |
3082 |
+ } |
3083 |
+- val = ret << 8; |
3084 |
+- |
3085 |
+- ret = i2c_smbus_read_byte(client); |
3086 |
+- if (ret < 0) { |
3087 |
+- dev_err(&client->dev, "cannot read low byte measurement"); |
3088 |
+- return ret; |
3089 |
+- } |
3090 |
+- val |= ret; |
3091 |
+- |
3092 |
+- return val; |
3093 |
++ return be16_to_cpu(val); |
3094 |
+ } |
3095 |
+ |
3096 |
+ static int hdc100x_get_heater_status(struct hdc100x_data *data) |
3097 |
+@@ -272,8 +259,8 @@ static int hdc100x_probe(struct i2c_client *client, |
3098 |
+ struct iio_dev *indio_dev; |
3099 |
+ struct hdc100x_data *data; |
3100 |
+ |
3101 |
+- if (!i2c_check_functionality(client->adapter, |
3102 |
+- I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) |
3103 |
++ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA | |
3104 |
++ I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C)) |
3105 |
+ return -EOPNOTSUPP; |
3106 |
+ |
3107 |
+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
3108 |
+diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c |
3109 |
+index 49bf9c59f117..158aaf44dd95 100644 |
3110 |
+--- a/drivers/iio/industrialio-buffer.c |
3111 |
++++ b/drivers/iio/industrialio-buffer.c |
3112 |
+@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, |
3113 |
+ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
3114 |
+ size_t datum_size; |
3115 |
+ size_t to_wait; |
3116 |
+- int ret; |
3117 |
++ int ret = 0; |
3118 |
+ |
3119 |
+ if (!indio_dev->info) |
3120 |
+ return -ENODEV; |
3121 |
+@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, |
3122 |
+ ret = rb->access->read_first_n(rb, n, buf); |
3123 |
+ if (ret == 0 && (filp->f_flags & O_NONBLOCK)) |
3124 |
+ ret = -EAGAIN; |
3125 |
+- } while (ret == 0); |
3126 |
++ } while (ret == 0); |
3127 |
+ remove_wait_queue(&rb->pollq, &wait); |
3128 |
+ |
3129 |
+ return ret; |
3130 |
+diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c |
3131 |
+index e6319a9346b2..2e6a427588e1 100644 |
3132 |
+--- a/drivers/iio/industrialio-core.c |
3133 |
++++ b/drivers/iio/industrialio-core.c |
3134 |
+@@ -532,9 +532,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) |
3135 |
+ return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); |
3136 |
+ case IIO_VAL_FRACTIONAL: |
3137 |
+ tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); |
3138 |
+- vals[1] = do_div(tmp, 1000000000LL); |
3139 |
+- vals[0] = tmp; |
3140 |
+- return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); |
3141 |
++ vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]); |
3142 |
++ return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1])); |
3143 |
+ case IIO_VAL_FRACTIONAL_LOG2: |
3144 |
+ tmp = (s64)vals[0] * 1000000000LL >> vals[1]; |
3145 |
+ vals[1] = do_div(tmp, 1000000000LL); |
3146 |
+diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c |
3147 |
+index e2f926cdcad2..a0aedda7dfd7 100644 |
3148 |
+--- a/drivers/iio/proximity/as3935.c |
3149 |
++++ b/drivers/iio/proximity/as3935.c |
3150 |
+@@ -392,7 +392,7 @@ static int as3935_probe(struct spi_device *spi) |
3151 |
+ return ret; |
3152 |
+ } |
3153 |
+ |
3154 |
+- ret = iio_triggered_buffer_setup(indio_dev, NULL, |
3155 |
++ ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, |
3156 |
+ &as3935_trigger_handler, NULL); |
3157 |
+ |
3158 |
+ if (ret) { |
3159 |
+diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h |
3160 |
+index 612ccfd39bf9..9245e55debed 100644 |
3161 |
+--- a/drivers/infiniband/core/uverbs.h |
3162 |
++++ b/drivers/infiniband/core/uverbs.h |
3163 |
+@@ -116,6 +116,7 @@ struct ib_uverbs_event_file { |
3164 |
+ struct ib_uverbs_file { |
3165 |
+ struct kref ref; |
3166 |
+ struct mutex mutex; |
3167 |
++ struct mutex cleanup_mutex; /* protect cleanup */ |
3168 |
+ struct ib_uverbs_device *device; |
3169 |
+ struct ib_ucontext *ucontext; |
3170 |
+ struct ib_event_handler event_handler; |
3171 |
+diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c |
3172 |
+index 31f422a70623..09d515763ad6 100644 |
3173 |
+--- a/drivers/infiniband/core/uverbs_main.c |
3174 |
++++ b/drivers/infiniband/core/uverbs_main.c |
3175 |
+@@ -931,6 +931,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) |
3176 |
+ file->async_file = NULL; |
3177 |
+ kref_init(&file->ref); |
3178 |
+ mutex_init(&file->mutex); |
3179 |
++ mutex_init(&file->cleanup_mutex); |
3180 |
+ |
3181 |
+ filp->private_data = file; |
3182 |
+ kobject_get(&dev->kobj); |
3183 |
+@@ -956,18 +957,20 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) |
3184 |
+ { |
3185 |
+ struct ib_uverbs_file *file = filp->private_data; |
3186 |
+ struct ib_uverbs_device *dev = file->device; |
3187 |
+- struct ib_ucontext *ucontext = NULL; |
3188 |
++ |
3189 |
++ mutex_lock(&file->cleanup_mutex); |
3190 |
++ if (file->ucontext) { |
3191 |
++ ib_uverbs_cleanup_ucontext(file, file->ucontext); |
3192 |
++ file->ucontext = NULL; |
3193 |
++ } |
3194 |
++ mutex_unlock(&file->cleanup_mutex); |
3195 |
+ |
3196 |
+ mutex_lock(&file->device->lists_mutex); |
3197 |
+- ucontext = file->ucontext; |
3198 |
+- file->ucontext = NULL; |
3199 |
+ if (!file->is_closed) { |
3200 |
+ list_del(&file->list); |
3201 |
+ file->is_closed = 1; |
3202 |
+ } |
3203 |
+ mutex_unlock(&file->device->lists_mutex); |
3204 |
+- if (ucontext) |
3205 |
+- ib_uverbs_cleanup_ucontext(file, ucontext); |
3206 |
+ |
3207 |
+ if (file->async_file) |
3208 |
+ kref_put(&file->async_file->ref, ib_uverbs_release_event_file); |
3209 |
+@@ -1181,22 +1184,30 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev, |
3210 |
+ mutex_lock(&uverbs_dev->lists_mutex); |
3211 |
+ while (!list_empty(&uverbs_dev->uverbs_file_list)) { |
3212 |
+ struct ib_ucontext *ucontext; |
3213 |
+- |
3214 |
+ file = list_first_entry(&uverbs_dev->uverbs_file_list, |
3215 |
+ struct ib_uverbs_file, list); |
3216 |
+ file->is_closed = 1; |
3217 |
+- ucontext = file->ucontext; |
3218 |
+ list_del(&file->list); |
3219 |
+- file->ucontext = NULL; |
3220 |
+ kref_get(&file->ref); |
3221 |
+ mutex_unlock(&uverbs_dev->lists_mutex); |
3222 |
+- /* We must release the mutex before going ahead and calling |
3223 |
+- * disassociate_ucontext. disassociate_ucontext might end up |
3224 |
+- * indirectly calling uverbs_close, for example due to freeing |
3225 |
+- * the resources (e.g mmput). |
3226 |
+- */ |
3227 |
++ |
3228 |
+ ib_uverbs_event_handler(&file->event_handler, &event); |
3229 |
++ |
3230 |
++ mutex_lock(&file->cleanup_mutex); |
3231 |
++ ucontext = file->ucontext; |
3232 |
++ file->ucontext = NULL; |
3233 |
++ mutex_unlock(&file->cleanup_mutex); |
3234 |
++ |
3235 |
++ /* At this point ib_uverbs_close cannot be running |
3236 |
++ * ib_uverbs_cleanup_ucontext |
3237 |
++ */ |
3238 |
+ if (ucontext) { |
3239 |
++ /* We must release the mutex before going ahead and |
3240 |
++ * calling disassociate_ucontext. disassociate_ucontext |
3241 |
++ * might end up indirectly calling uverbs_close, |
3242 |
++ * for example due to freeing the resources |
3243 |
++ * (e.g mmput). |
3244 |
++ */ |
3245 |
+ ib_dev->disassociate_ucontext(ucontext); |
3246 |
+ ib_uverbs_cleanup_ucontext(file, ucontext); |
3247 |
+ } |
3248 |
+diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c |
3249 |
+index dbab9d9cc288..a49cc88f08a2 100644 |
3250 |
+--- a/drivers/infiniband/hw/hfi1/debugfs.c |
3251 |
++++ b/drivers/infiniband/hw/hfi1/debugfs.c |
3252 |
+@@ -223,28 +223,32 @@ DEBUGFS_SEQ_FILE_OPEN(ctx_stats) |
3253 |
+ DEBUGFS_FILE_OPS(ctx_stats); |
3254 |
+ |
3255 |
+ static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) |
3256 |
+-__acquires(RCU) |
3257 |
++ __acquires(RCU) |
3258 |
+ { |
3259 |
+ struct qp_iter *iter; |
3260 |
+ loff_t n = *pos; |
3261 |
+ |
3262 |
+- rcu_read_lock(); |
3263 |
+ iter = qp_iter_init(s->private); |
3264 |
++ |
3265 |
++ /* stop calls rcu_read_unlock */ |
3266 |
++ rcu_read_lock(); |
3267 |
++ |
3268 |
+ if (!iter) |
3269 |
+ return NULL; |
3270 |
+ |
3271 |
+- while (n--) { |
3272 |
++ do { |
3273 |
+ if (qp_iter_next(iter)) { |
3274 |
+ kfree(iter); |
3275 |
+ return NULL; |
3276 |
+ } |
3277 |
+- } |
3278 |
++ } while (n--); |
3279 |
+ |
3280 |
+ return iter; |
3281 |
+ } |
3282 |
+ |
3283 |
+ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
3284 |
+ loff_t *pos) |
3285 |
++ __must_hold(RCU) |
3286 |
+ { |
3287 |
+ struct qp_iter *iter = iter_ptr; |
3288 |
+ |
3289 |
+@@ -259,7 +263,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
3290 |
+ } |
3291 |
+ |
3292 |
+ static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
3293 |
+-__releases(RCU) |
3294 |
++ __releases(RCU) |
3295 |
+ { |
3296 |
+ rcu_read_unlock(); |
3297 |
+ } |
3298 |
+diff --git a/drivers/infiniband/hw/hfi1/platform.c b/drivers/infiniband/hw/hfi1/platform.c |
3299 |
+index 03df9322f862..1d09f767b680 100644 |
3300 |
+--- a/drivers/infiniband/hw/hfi1/platform.c |
3301 |
++++ b/drivers/infiniband/hw/hfi1/platform.c |
3302 |
+@@ -638,9 +638,13 @@ static int tune_active_qsfp(struct hfi1_pportdata *ppd, u32 *ptr_tx_preset, |
3303 |
+ if (ret) |
3304 |
+ return ret; |
3305 |
+ |
3306 |
++ /* |
3307 |
++ * We'll change the QSFP memory contents from here on out, thus we set a |
3308 |
++ * flag here to remind ourselves to reset the QSFP module. This prevents |
3309 |
++ * reuse of stale settings established in our previous pass through. |
3310 |
++ */ |
3311 |
+ if (ppd->qsfp_info.reset_needed) { |
3312 |
+ reset_qsfp(ppd); |
3313 |
+- ppd->qsfp_info.reset_needed = 0; |
3314 |
+ refresh_qsfp_cache(ppd, &ppd->qsfp_info); |
3315 |
+ } else { |
3316 |
+ ppd->qsfp_info.reset_needed = 1; |
3317 |
+diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c |
3318 |
+index 1a942ffba4cb..995c897669b2 100644 |
3319 |
+--- a/drivers/infiniband/hw/hfi1/qp.c |
3320 |
++++ b/drivers/infiniband/hw/hfi1/qp.c |
3321 |
+@@ -595,10 +595,6 @@ struct qp_iter *qp_iter_init(struct hfi1_ibdev *dev) |
3322 |
+ |
3323 |
+ iter->dev = dev; |
3324 |
+ iter->specials = dev->rdi.ibdev.phys_port_cnt * 2; |
3325 |
+- if (qp_iter_next(iter)) { |
3326 |
+- kfree(iter); |
3327 |
+- return NULL; |
3328 |
+- } |
3329 |
+ |
3330 |
+ return iter; |
3331 |
+ } |
3332 |
+diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c |
3333 |
+index 5e75b43c596b..5bad8e3b40bb 100644 |
3334 |
+--- a/drivers/infiniband/hw/qib/qib_debugfs.c |
3335 |
++++ b/drivers/infiniband/hw/qib/qib_debugfs.c |
3336 |
+@@ -189,27 +189,32 @@ static int _ctx_stats_seq_show(struct seq_file *s, void *v) |
3337 |
+ DEBUGFS_FILE(ctx_stats) |
3338 |
+ |
3339 |
+ static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) |
3340 |
++ __acquires(RCU) |
3341 |
+ { |
3342 |
+ struct qib_qp_iter *iter; |
3343 |
+ loff_t n = *pos; |
3344 |
+ |
3345 |
+- rcu_read_lock(); |
3346 |
+ iter = qib_qp_iter_init(s->private); |
3347 |
++ |
3348 |
++ /* stop calls rcu_read_unlock */ |
3349 |
++ rcu_read_lock(); |
3350 |
++ |
3351 |
+ if (!iter) |
3352 |
+ return NULL; |
3353 |
+ |
3354 |
+- while (n--) { |
3355 |
++ do { |
3356 |
+ if (qib_qp_iter_next(iter)) { |
3357 |
+ kfree(iter); |
3358 |
+ return NULL; |
3359 |
+ } |
3360 |
+- } |
3361 |
++ } while (n--); |
3362 |
+ |
3363 |
+ return iter; |
3364 |
+ } |
3365 |
+ |
3366 |
+ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
3367 |
+ loff_t *pos) |
3368 |
++ __must_hold(RCU) |
3369 |
+ { |
3370 |
+ struct qib_qp_iter *iter = iter_ptr; |
3371 |
+ |
3372 |
+@@ -224,6 +229,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
3373 |
+ } |
3374 |
+ |
3375 |
+ static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
3376 |
++ __releases(RCU) |
3377 |
+ { |
3378 |
+ rcu_read_unlock(); |
3379 |
+ } |
3380 |
+diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c |
3381 |
+index 575b737d9ef3..7119a7da289f 100644 |
3382 |
+--- a/drivers/infiniband/hw/qib/qib_qp.c |
3383 |
++++ b/drivers/infiniband/hw/qib/qib_qp.c |
3384 |
+@@ -530,10 +530,6 @@ struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev) |
3385 |
+ return NULL; |
3386 |
+ |
3387 |
+ iter->dev = dev; |
3388 |
+- if (qib_qp_iter_next(iter)) { |
3389 |
+- kfree(iter); |
3390 |
+- return NULL; |
3391 |
+- } |
3392 |
+ |
3393 |
+ return iter; |
3394 |
+ } |
3395 |
+diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c |
3396 |
+index 6a86b5d1defa..7330a66e2b7e 100644 |
3397 |
+--- a/drivers/iommu/dmar.c |
3398 |
++++ b/drivers/iommu/dmar.c |
3399 |
+@@ -1871,10 +1871,11 @@ static int dmar_hp_remove_drhd(struct acpi_dmar_header *header, void *arg) |
3400 |
+ /* |
3401 |
+ * All PCI devices managed by this unit should have been destroyed. |
3402 |
+ */ |
3403 |
+- if (!dmaru->include_all && dmaru->devices && dmaru->devices_cnt) |
3404 |
++ if (!dmaru->include_all && dmaru->devices && dmaru->devices_cnt) { |
3405 |
+ for_each_active_dev_scope(dmaru->devices, |
3406 |
+ dmaru->devices_cnt, i, dev) |
3407 |
+ return -EBUSY; |
3408 |
++ } |
3409 |
+ |
3410 |
+ ret = dmar_ir_hotplug(dmaru, false); |
3411 |
+ if (ret == 0) |
3412 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
3413 |
+index d416242c4ab8..50b639ba3daa 100644 |
3414 |
+--- a/drivers/iommu/intel-iommu.c |
3415 |
++++ b/drivers/iommu/intel-iommu.c |
3416 |
+@@ -4272,10 +4272,11 @@ int dmar_check_one_atsr(struct acpi_dmar_header *hdr, void *arg) |
3417 |
+ if (!atsru) |
3418 |
+ return 0; |
3419 |
+ |
3420 |
+- if (!atsru->include_all && atsru->devices && atsru->devices_cnt) |
3421 |
++ if (!atsru->include_all && atsru->devices && atsru->devices_cnt) { |
3422 |
+ for_each_active_dev_scope(atsru->devices, atsru->devices_cnt, |
3423 |
+ i, dev) |
3424 |
+ return -EBUSY; |
3425 |
++ } |
3426 |
+ |
3427 |
+ return 0; |
3428 |
+ } |
3429 |
+diff --git a/drivers/irqchip/irq-atmel-aic.c b/drivers/irqchip/irq-atmel-aic.c |
3430 |
+index 112e17c2768b..37f952dd9fc9 100644 |
3431 |
+--- a/drivers/irqchip/irq-atmel-aic.c |
3432 |
++++ b/drivers/irqchip/irq-atmel-aic.c |
3433 |
+@@ -176,6 +176,7 @@ static int aic_irq_domain_xlate(struct irq_domain *d, |
3434 |
+ { |
3435 |
+ struct irq_domain_chip_generic *dgc = d->gc; |
3436 |
+ struct irq_chip_generic *gc; |
3437 |
++ unsigned long flags; |
3438 |
+ unsigned smr; |
3439 |
+ int idx; |
3440 |
+ int ret; |
3441 |
+@@ -194,11 +195,11 @@ static int aic_irq_domain_xlate(struct irq_domain *d, |
3442 |
+ |
3443 |
+ gc = dgc->gc[idx]; |
3444 |
+ |
3445 |
+- irq_gc_lock(gc); |
3446 |
++ irq_gc_lock_irqsave(gc, flags); |
3447 |
+ smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); |
3448 |
+ aic_common_set_priority(intspec[2], &smr); |
3449 |
+ irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); |
3450 |
+- irq_gc_unlock(gc); |
3451 |
++ irq_gc_unlock_irqrestore(gc, flags); |
3452 |
+ |
3453 |
+ return ret; |
3454 |
+ } |
3455 |
+diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c |
3456 |
+index 4f0d068e1abe..2a624d87a035 100644 |
3457 |
+--- a/drivers/irqchip/irq-atmel-aic5.c |
3458 |
++++ b/drivers/irqchip/irq-atmel-aic5.c |
3459 |
+@@ -258,6 +258,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, |
3460 |
+ unsigned int *out_type) |
3461 |
+ { |
3462 |
+ struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); |
3463 |
++ unsigned long flags; |
3464 |
+ unsigned smr; |
3465 |
+ int ret; |
3466 |
+ |
3467 |
+@@ -269,12 +270,12 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, |
3468 |
+ if (ret) |
3469 |
+ return ret; |
3470 |
+ |
3471 |
+- irq_gc_lock(bgc); |
3472 |
++ irq_gc_lock_irqsave(bgc, flags); |
3473 |
+ irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); |
3474 |
+ smr = irq_reg_readl(bgc, AT91_AIC5_SMR); |
3475 |
+ aic_common_set_priority(intspec[2], &smr); |
3476 |
+ irq_reg_writel(bgc, smr, AT91_AIC5_SMR); |
3477 |
+- irq_gc_unlock(bgc); |
3478 |
++ irq_gc_unlock_irqrestore(bgc, flags); |
3479 |
+ |
3480 |
+ return ret; |
3481 |
+ } |
3482 |
+diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
3483 |
+index 4f3cb3554944..cfe28cf66ce4 100644 |
3484 |
+--- a/drivers/md/dm-crypt.c |
3485 |
++++ b/drivers/md/dm-crypt.c |
3486 |
+@@ -1453,7 +1453,7 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode) |
3487 |
+ unsigned i; |
3488 |
+ int err; |
3489 |
+ |
3490 |
+- cc->tfms = kmalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), |
3491 |
++ cc->tfms = kzalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), |
3492 |
+ GFP_KERNEL); |
3493 |
+ if (!cc->tfms) |
3494 |
+ return -ENOMEM; |
3495 |
+@@ -1923,6 +1923,13 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) |
3496 |
+ return DM_MAPIO_REMAPPED; |
3497 |
+ } |
3498 |
+ |
3499 |
++ /* |
3500 |
++ * Check if bio is too large, split as needed. |
3501 |
++ */ |
3502 |
++ if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) && |
3503 |
++ bio_data_dir(bio) == WRITE) |
3504 |
++ dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT)); |
3505 |
++ |
3506 |
+ io = dm_per_bio_data(bio, cc->per_bio_data_size); |
3507 |
+ crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector)); |
3508 |
+ io->ctx.req = (struct skcipher_request *)(io + 1); |
3509 |
+diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c |
3510 |
+index 4bb49cd602e9..4eb5c67b1309 100644 |
3511 |
+--- a/drivers/md/dm-flakey.c |
3512 |
++++ b/drivers/md/dm-flakey.c |
3513 |
+@@ -289,15 +289,13 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) |
3514 |
+ pb->bio_submitted = true; |
3515 |
+ |
3516 |
+ /* |
3517 |
+- * Map reads as normal only if corrupt_bio_byte set. |
3518 |
++ * Error reads if neither corrupt_bio_byte or drop_writes are set. |
3519 |
++ * Otherwise, flakey_end_io() will decide if the reads should be modified. |
3520 |
+ */ |
3521 |
+ if (bio_data_dir(bio) == READ) { |
3522 |
+- /* If flags were specified, only corrupt those that match. */ |
3523 |
+- if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && |
3524 |
+- all_corrupt_bio_flags_match(bio, fc)) |
3525 |
+- goto map_bio; |
3526 |
+- else |
3527 |
++ if (!fc->corrupt_bio_byte && !test_bit(DROP_WRITES, &fc->flags)) |
3528 |
+ return -EIO; |
3529 |
++ goto map_bio; |
3530 |
+ } |
3531 |
+ |
3532 |
+ /* |
3533 |
+@@ -334,14 +332,21 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) |
3534 |
+ struct flakey_c *fc = ti->private; |
3535 |
+ struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); |
3536 |
+ |
3537 |
+- /* |
3538 |
+- * Corrupt successful READs while in down state. |
3539 |
+- */ |
3540 |
+ if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { |
3541 |
+- if (fc->corrupt_bio_byte) |
3542 |
++ if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && |
3543 |
++ all_corrupt_bio_flags_match(bio, fc)) { |
3544 |
++ /* |
3545 |
++ * Corrupt successful matching READs while in down state. |
3546 |
++ */ |
3547 |
+ corrupt_bio_data(bio, fc); |
3548 |
+- else |
3549 |
++ |
3550 |
++ } else if (!test_bit(DROP_WRITES, &fc->flags)) { |
3551 |
++ /* |
3552 |
++ * Error read during the down_interval if drop_writes |
3553 |
++ * wasn't configured. |
3554 |
++ */ |
3555 |
+ return -EIO; |
3556 |
++ } |
3557 |
+ } |
3558 |
+ |
3559 |
+ return error; |
3560 |
+diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c |
3561 |
+index 608302e222af..d8f8cc85f96c 100644 |
3562 |
+--- a/drivers/md/dm-log-writes.c |
3563 |
++++ b/drivers/md/dm-log-writes.c |
3564 |
+@@ -258,12 +258,12 @@ static int log_one_block(struct log_writes_c *lc, |
3565 |
+ goto out; |
3566 |
+ sector++; |
3567 |
+ |
3568 |
++ atomic_inc(&lc->io_blocks); |
3569 |
+ bio = bio_alloc(GFP_KERNEL, block->vec_cnt); |
3570 |
+ if (!bio) { |
3571 |
+ DMERR("Couldn't alloc log bio"); |
3572 |
+ goto error; |
3573 |
+ } |
3574 |
+- atomic_inc(&lc->io_blocks); |
3575 |
+ bio->bi_iter.bi_size = 0; |
3576 |
+ bio->bi_iter.bi_sector = sector; |
3577 |
+ bio->bi_bdev = lc->logdev->bdev; |
3578 |
+@@ -456,9 +456,9 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
3579 |
+ goto bad; |
3580 |
+ } |
3581 |
+ |
3582 |
+- ret = -EINVAL; |
3583 |
+ lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); |
3584 |
+- if (!lc->log_kthread) { |
3585 |
++ if (IS_ERR(lc->log_kthread)) { |
3586 |
++ ret = PTR_ERR(lc->log_kthread); |
3587 |
+ ti->error = "Couldn't alloc kthread"; |
3588 |
+ dm_put_device(ti, lc->dev); |
3589 |
+ dm_put_device(ti, lc->logdev); |
3590 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
3591 |
+index 866825f10b4c..0678a0a95761 100644 |
3592 |
+--- a/drivers/md/md.c |
3593 |
++++ b/drivers/md/md.c |
3594 |
+@@ -7599,16 +7599,12 @@ EXPORT_SYMBOL(unregister_md_cluster_operations); |
3595 |
+ |
3596 |
+ int md_setup_cluster(struct mddev *mddev, int nodes) |
3597 |
+ { |
3598 |
+- int err; |
3599 |
+- |
3600 |
+- err = request_module("md-cluster"); |
3601 |
+- if (err) { |
3602 |
+- pr_err("md-cluster module not found.\n"); |
3603 |
+- return -ENOENT; |
3604 |
+- } |
3605 |
+- |
3606 |
++ if (!md_cluster_ops) |
3607 |
++ request_module("md-cluster"); |
3608 |
+ spin_lock(&pers_lock); |
3609 |
++ /* ensure module won't be unloaded */ |
3610 |
+ if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { |
3611 |
++ pr_err("can't find md-cluster module or get it's reference.\n"); |
3612 |
+ spin_unlock(&pers_lock); |
3613 |
+ return -ENOENT; |
3614 |
+ } |
3615 |
+diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c |
3616 |
+index 15508df24e5d..73ec3200191e 100644 |
3617 |
+--- a/drivers/memory/omap-gpmc.c |
3618 |
++++ b/drivers/memory/omap-gpmc.c |
3619 |
+@@ -2250,7 +2250,7 @@ static int gpmc_probe_dt(struct platform_device *pdev) |
3620 |
+ return 0; |
3621 |
+ } |
3622 |
+ |
3623 |
+-static int gpmc_probe_dt_children(struct platform_device *pdev) |
3624 |
++static void gpmc_probe_dt_children(struct platform_device *pdev) |
3625 |
+ { |
3626 |
+ int ret; |
3627 |
+ struct device_node *child; |
3628 |
+@@ -2265,11 +2265,11 @@ static int gpmc_probe_dt_children(struct platform_device *pdev) |
3629 |
+ else |
3630 |
+ ret = gpmc_probe_generic_child(pdev, child); |
3631 |
+ |
3632 |
+- if (ret) |
3633 |
+- return ret; |
3634 |
++ if (ret) { |
3635 |
++ dev_err(&pdev->dev, "failed to probe DT child '%s': %d\n", |
3636 |
++ child->name, ret); |
3637 |
++ } |
3638 |
+ } |
3639 |
+- |
3640 |
+- return 0; |
3641 |
+ } |
3642 |
+ #else |
3643 |
+ static int gpmc_probe_dt(struct platform_device *pdev) |
3644 |
+@@ -2277,9 +2277,8 @@ static int gpmc_probe_dt(struct platform_device *pdev) |
3645 |
+ return 0; |
3646 |
+ } |
3647 |
+ |
3648 |
+-static int gpmc_probe_dt_children(struct platform_device *pdev) |
3649 |
++static void gpmc_probe_dt_children(struct platform_device *pdev) |
3650 |
+ { |
3651 |
+- return 0; |
3652 |
+ } |
3653 |
+ #endif |
3654 |
+ |
3655 |
+@@ -2372,16 +2371,10 @@ static int gpmc_probe(struct platform_device *pdev) |
3656 |
+ goto setup_irq_failed; |
3657 |
+ } |
3658 |
+ |
3659 |
+- rc = gpmc_probe_dt_children(pdev); |
3660 |
+- if (rc < 0) { |
3661 |
+- dev_err(gpmc->dev, "failed to probe DT children\n"); |
3662 |
+- goto dt_children_failed; |
3663 |
+- } |
3664 |
++ gpmc_probe_dt_children(pdev); |
3665 |
+ |
3666 |
+ return 0; |
3667 |
+ |
3668 |
+-dt_children_failed: |
3669 |
+- gpmc_free_irq(gpmc); |
3670 |
+ setup_irq_failed: |
3671 |
+ gpmc_gpio_exit(gpmc); |
3672 |
+ gpio_init_failed: |
3673 |
+diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c |
3674 |
+index 320e1c2f8853..b7eaecfdd796 100644 |
3675 |
+--- a/drivers/mmc/host/sdhci-st.c |
3676 |
++++ b/drivers/mmc/host/sdhci-st.c |
3677 |
+@@ -28,6 +28,7 @@ |
3678 |
+ |
3679 |
+ struct st_mmc_platform_data { |
3680 |
+ struct reset_control *rstc; |
3681 |
++ struct clk *icnclk; |
3682 |
+ void __iomem *top_ioaddr; |
3683 |
+ }; |
3684 |
+ |
3685 |
+@@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev) |
3686 |
+ struct sdhci_host *host; |
3687 |
+ struct st_mmc_platform_data *pdata; |
3688 |
+ struct sdhci_pltfm_host *pltfm_host; |
3689 |
+- struct clk *clk; |
3690 |
++ struct clk *clk, *icnclk; |
3691 |
+ int ret = 0; |
3692 |
+ u16 host_version; |
3693 |
+ struct resource *res; |
3694 |
+@@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev) |
3695 |
+ return PTR_ERR(clk); |
3696 |
+ } |
3697 |
+ |
3698 |
++ /* ICN clock isn't compulsory, but use it if it's provided. */ |
3699 |
++ icnclk = devm_clk_get(&pdev->dev, "icn"); |
3700 |
++ if (IS_ERR(icnclk)) |
3701 |
++ icnclk = NULL; |
3702 |
++ |
3703 |
+ rstc = devm_reset_control_get(&pdev->dev, NULL); |
3704 |
+ if (IS_ERR(rstc)) |
3705 |
+ rstc = NULL; |
3706 |
+@@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev) |
3707 |
+ } |
3708 |
+ |
3709 |
+ clk_prepare_enable(clk); |
3710 |
++ clk_prepare_enable(icnclk); |
3711 |
+ |
3712 |
+ /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ |
3713 |
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
3714 |
+@@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev) |
3715 |
+ } |
3716 |
+ |
3717 |
+ pltfm_host->clk = clk; |
3718 |
++ pdata->icnclk = icnclk; |
3719 |
+ |
3720 |
+ /* Configure the Arasan HC inside the flashSS */ |
3721 |
+ st_mmcss_cconfig(np, host); |
3722 |
+@@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev) |
3723 |
+ return 0; |
3724 |
+ |
3725 |
+ err_out: |
3726 |
++ clk_disable_unprepare(icnclk); |
3727 |
+ clk_disable_unprepare(clk); |
3728 |
+ err_of: |
3729 |
+ sdhci_pltfm_free(pdev); |
3730 |
+@@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev) |
3731 |
+ |
3732 |
+ ret = sdhci_pltfm_unregister(pdev); |
3733 |
+ |
3734 |
++ clk_disable_unprepare(pdata->icnclk); |
3735 |
++ |
3736 |
+ if (rstc) |
3737 |
+ reset_control_assert(rstc); |
3738 |
+ |
3739 |
+@@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev) |
3740 |
+ if (pdata->rstc) |
3741 |
+ reset_control_assert(pdata->rstc); |
3742 |
+ |
3743 |
++ clk_disable_unprepare(pdata->icnclk); |
3744 |
+ clk_disable_unprepare(pltfm_host->clk); |
3745 |
+ out: |
3746 |
+ return ret; |
3747 |
+@@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev) |
3748 |
+ struct device_node *np = dev->of_node; |
3749 |
+ |
3750 |
+ clk_prepare_enable(pltfm_host->clk); |
3751 |
++ clk_prepare_enable(pdata->icnclk); |
3752 |
+ |
3753 |
+ if (pdata->rstc) |
3754 |
+ reset_control_deassert(pdata->rstc); |
3755 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
3756 |
+index 4d7981946f79..70dac7302d51 100644 |
3757 |
+--- a/drivers/net/bonding/bond_main.c |
3758 |
++++ b/drivers/net/bonding/bond_main.c |
3759 |
+@@ -1341,9 +1341,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
3760 |
+ slave_dev->name); |
3761 |
+ } |
3762 |
+ |
3763 |
+- /* already enslaved */ |
3764 |
+- if (slave_dev->flags & IFF_SLAVE) { |
3765 |
+- netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); |
3766 |
++ /* already in-use? */ |
3767 |
++ if (netdev_is_rx_handler_busy(slave_dev)) { |
3768 |
++ netdev_err(bond_dev, |
3769 |
++ "Error: Device is in use and cannot be enslaved\n"); |
3770 |
+ return -EBUSY; |
3771 |
+ } |
3772 |
+ |
3773 |
+diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h |
3774 |
+index 200b1f5fdb56..71b1e529812e 100644 |
3775 |
+--- a/drivers/net/dsa/bcm_sf2.h |
3776 |
++++ b/drivers/net/dsa/bcm_sf2.h |
3777 |
+@@ -189,8 +189,8 @@ static inline void name##_writeq(struct bcm_sf2_priv *priv, u64 val, \ |
3778 |
+ static inline void intrl2_##which##_mask_clear(struct bcm_sf2_priv *priv, \ |
3779 |
+ u32 mask) \ |
3780 |
+ { \ |
3781 |
+- intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ |
3782 |
+ priv->irq##which##_mask &= ~(mask); \ |
3783 |
++ intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ |
3784 |
+ } \ |
3785 |
+ static inline void intrl2_##which##_mask_set(struct bcm_sf2_priv *priv, \ |
3786 |
+ u32 mask) \ |
3787 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3788 |
+index c777cde85ce4..e655b76e8f31 100644 |
3789 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3790 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3791 |
+@@ -293,8 +293,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) |
3792 |
+ push_len = (length + sizeof(*tx_push) + 7) / 8; |
3793 |
+ if (push_len > 16) { |
3794 |
+ __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); |
3795 |
+- __iowrite64_copy(txr->tx_doorbell + 4, tx_push_buf + 1, |
3796 |
+- push_len - 16); |
3797 |
++ __iowrite32_copy(txr->tx_doorbell + 4, tx_push_buf + 1, |
3798 |
++ (push_len - 16) << 1); |
3799 |
+ } else { |
3800 |
+ __iowrite64_copy(txr->tx_doorbell, tx_push_buf, |
3801 |
+ push_len); |
3802 |
+diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h |
3803 |
+index 8a13824ef802..644743c9ca82 100644 |
3804 |
+--- a/drivers/net/ethernet/cadence/macb.h |
3805 |
++++ b/drivers/net/ethernet/cadence/macb.h |
3806 |
+@@ -403,11 +403,11 @@ |
3807 |
+ #define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII 0x00000004 |
3808 |
+ #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008 |
3809 |
+ #define MACB_CAPS_USRIO_DISABLED 0x00000010 |
3810 |
++#define MACB_CAPS_JUMBO 0x00000020 |
3811 |
+ #define MACB_CAPS_FIFO_MODE 0x10000000 |
3812 |
+ #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
3813 |
+ #define MACB_CAPS_SG_DISABLED 0x40000000 |
3814 |
+ #define MACB_CAPS_MACB_IS_GEM 0x80000000 |
3815 |
+-#define MACB_CAPS_JUMBO 0x00000010 |
3816 |
+ |
3817 |
+ /* Bit manipulation macros */ |
3818 |
+ #define MACB_BIT(name) \ |
3819 |
+diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h |
3820 |
+index afb10e326b4f..fab35a593898 100644 |
3821 |
+--- a/drivers/net/ethernet/cavium/thunder/nic_reg.h |
3822 |
++++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h |
3823 |
+@@ -170,7 +170,6 @@ |
3824 |
+ #define NIC_QSET_SQ_0_7_DOOR (0x010838) |
3825 |
+ #define NIC_QSET_SQ_0_7_STATUS (0x010840) |
3826 |
+ #define NIC_QSET_SQ_0_7_DEBUG (0x010848) |
3827 |
+-#define NIC_QSET_SQ_0_7_CNM_CHG (0x010860) |
3828 |
+ #define NIC_QSET_SQ_0_7_STAT_0_1 (0x010900) |
3829 |
+ |
3830 |
+ #define NIC_QSET_RBDR_0_1_CFG (0x010C00) |
3831 |
+diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c |
3832 |
+index d2d8ef270142..ad4fddb55421 100644 |
3833 |
+--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c |
3834 |
++++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c |
3835 |
+@@ -382,7 +382,10 @@ static void nicvf_get_regs(struct net_device *dev, |
3836 |
+ p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); |
3837 |
+ p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); |
3838 |
+ p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); |
3839 |
+- p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CNM_CHG, q); |
3840 |
++ /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which |
3841 |
++ * produces bus errors when read |
3842 |
++ */ |
3843 |
++ p[i++] = 0; |
3844 |
+ p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); |
3845 |
+ reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); |
3846 |
+ p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); |
3847 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3848 |
+index d6e2a1cae19a..c2ec01a22d55 100644 |
3849 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3850 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3851 |
+@@ -143,13 +143,14 @@ static struct mlx5_cmd_layout *get_inst(struct mlx5_cmd *cmd, int idx) |
3852 |
+ return cmd->cmd_buf + (idx << cmd->log_stride); |
3853 |
+ } |
3854 |
+ |
3855 |
+-static u8 xor8_buf(void *buf, int len) |
3856 |
++static u8 xor8_buf(void *buf, size_t offset, int len) |
3857 |
+ { |
3858 |
+ u8 *ptr = buf; |
3859 |
+ u8 sum = 0; |
3860 |
+ int i; |
3861 |
++ int end = len + offset; |
3862 |
+ |
3863 |
+- for (i = 0; i < len; i++) |
3864 |
++ for (i = offset; i < end; i++) |
3865 |
+ sum ^= ptr[i]; |
3866 |
+ |
3867 |
+ return sum; |
3868 |
+@@ -157,41 +158,49 @@ static u8 xor8_buf(void *buf, int len) |
3869 |
+ |
3870 |
+ static int verify_block_sig(struct mlx5_cmd_prot_block *block) |
3871 |
+ { |
3872 |
+- if (xor8_buf(block->rsvd0, sizeof(*block) - sizeof(block->data) - 1) != 0xff) |
3873 |
++ size_t rsvd0_off = offsetof(struct mlx5_cmd_prot_block, rsvd0); |
3874 |
++ int xor_len = sizeof(*block) - sizeof(block->data) - 1; |
3875 |
++ |
3876 |
++ if (xor8_buf(block, rsvd0_off, xor_len) != 0xff) |
3877 |
+ return -EINVAL; |
3878 |
+ |
3879 |
+- if (xor8_buf(block, sizeof(*block)) != 0xff) |
3880 |
++ if (xor8_buf(block, 0, sizeof(*block)) != 0xff) |
3881 |
+ return -EINVAL; |
3882 |
+ |
3883 |
+ return 0; |
3884 |
+ } |
3885 |
+ |
3886 |
+-static void calc_block_sig(struct mlx5_cmd_prot_block *block, u8 token, |
3887 |
+- int csum) |
3888 |
++static void calc_block_sig(struct mlx5_cmd_prot_block *block) |
3889 |
+ { |
3890 |
+- block->token = token; |
3891 |
+- if (csum) { |
3892 |
+- block->ctrl_sig = ~xor8_buf(block->rsvd0, sizeof(*block) - |
3893 |
+- sizeof(block->data) - 2); |
3894 |
+- block->sig = ~xor8_buf(block, sizeof(*block) - 1); |
3895 |
+- } |
3896 |
++ int ctrl_xor_len = sizeof(*block) - sizeof(block->data) - 2; |
3897 |
++ size_t rsvd0_off = offsetof(struct mlx5_cmd_prot_block, rsvd0); |
3898 |
++ |
3899 |
++ block->ctrl_sig = ~xor8_buf(block, rsvd0_off, ctrl_xor_len); |
3900 |
++ block->sig = ~xor8_buf(block, 0, sizeof(*block) - 1); |
3901 |
+ } |
3902 |
+ |
3903 |
+-static void calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) |
3904 |
++static void calc_chain_sig(struct mlx5_cmd_msg *msg) |
3905 |
+ { |
3906 |
+ struct mlx5_cmd_mailbox *next = msg->next; |
3907 |
+- |
3908 |
+- while (next) { |
3909 |
+- calc_block_sig(next->buf, token, csum); |
3910 |
++ int size = msg->len; |
3911 |
++ int blen = size - min_t(int, sizeof(msg->first.data), size); |
3912 |
++ int n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) |
3913 |
++ / MLX5_CMD_DATA_BLOCK_SIZE; |
3914 |
++ int i = 0; |
3915 |
++ |
3916 |
++ for (i = 0; i < n && next; i++) { |
3917 |
++ calc_block_sig(next->buf); |
3918 |
+ next = next->next; |
3919 |
+ } |
3920 |
+ } |
3921 |
+ |
3922 |
+ static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) |
3923 |
+ { |
3924 |
+- ent->lay->sig = ~xor8_buf(ent->lay, sizeof(*ent->lay)); |
3925 |
+- calc_chain_sig(ent->in, ent->token, csum); |
3926 |
+- calc_chain_sig(ent->out, ent->token, csum); |
3927 |
++ ent->lay->sig = ~xor8_buf(ent->lay, 0, sizeof(*ent->lay)); |
3928 |
++ if (csum) { |
3929 |
++ calc_chain_sig(ent->in); |
3930 |
++ calc_chain_sig(ent->out); |
3931 |
++ } |
3932 |
+ } |
3933 |
+ |
3934 |
+ static void poll_timeout(struct mlx5_cmd_work_ent *ent) |
3935 |
+@@ -222,12 +231,17 @@ static int verify_signature(struct mlx5_cmd_work_ent *ent) |
3936 |
+ struct mlx5_cmd_mailbox *next = ent->out->next; |
3937 |
+ int err; |
3938 |
+ u8 sig; |
3939 |
++ int size = ent->out->len; |
3940 |
++ int blen = size - min_t(int, sizeof(ent->out->first.data), size); |
3941 |
++ int n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) |
3942 |
++ / MLX5_CMD_DATA_BLOCK_SIZE; |
3943 |
++ int i = 0; |
3944 |
+ |
3945 |
+- sig = xor8_buf(ent->lay, sizeof(*ent->lay)); |
3946 |
++ sig = xor8_buf(ent->lay, 0, sizeof(*ent->lay)); |
3947 |
+ if (sig != 0xff) |
3948 |
+ return -EINVAL; |
3949 |
+ |
3950 |
+- while (next) { |
3951 |
++ for (i = 0; i < n && next; i++) { |
3952 |
+ err = verify_block_sig(next->buf); |
3953 |
+ if (err) |
3954 |
+ return err; |
3955 |
+@@ -656,7 +670,6 @@ static void cmd_work_handler(struct work_struct *work) |
3956 |
+ spin_unlock_irqrestore(&cmd->alloc_lock, flags); |
3957 |
+ } |
3958 |
+ |
3959 |
+- ent->token = alloc_token(cmd); |
3960 |
+ cmd->ent_arr[ent->idx] = ent; |
3961 |
+ lay = get_inst(cmd, ent->idx); |
3962 |
+ ent->lay = lay; |
3963 |
+@@ -766,7 +779,8 @@ static u8 *get_status_ptr(struct mlx5_outbox_hdr *out) |
3964 |
+ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, |
3965 |
+ struct mlx5_cmd_msg *out, void *uout, int uout_size, |
3966 |
+ mlx5_cmd_cbk_t callback, |
3967 |
+- void *context, int page_queue, u8 *status) |
3968 |
++ void *context, int page_queue, u8 *status, |
3969 |
++ u8 token) |
3970 |
+ { |
3971 |
+ struct mlx5_cmd *cmd = &dev->cmd; |
3972 |
+ struct mlx5_cmd_work_ent *ent; |
3973 |
+@@ -783,6 +797,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, |
3974 |
+ if (IS_ERR(ent)) |
3975 |
+ return PTR_ERR(ent); |
3976 |
+ |
3977 |
++ ent->token = token; |
3978 |
++ |
3979 |
+ if (!callback) |
3980 |
+ init_completion(&ent->done); |
3981 |
+ |
3982 |
+@@ -854,7 +870,8 @@ static const struct file_operations fops = { |
3983 |
+ .write = dbg_write, |
3984 |
+ }; |
3985 |
+ |
3986 |
+-static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) |
3987 |
++static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size, |
3988 |
++ u8 token) |
3989 |
+ { |
3990 |
+ struct mlx5_cmd_prot_block *block; |
3991 |
+ struct mlx5_cmd_mailbox *next; |
3992 |
+@@ -880,6 +897,7 @@ static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) |
3993 |
+ memcpy(block->data, from, copy); |
3994 |
+ from += copy; |
3995 |
+ size -= copy; |
3996 |
++ block->token = token; |
3997 |
+ next = next->next; |
3998 |
+ } |
3999 |
+ |
4000 |
+@@ -949,7 +967,8 @@ static void free_cmd_box(struct mlx5_core_dev *dev, |
4001 |
+ } |
4002 |
+ |
4003 |
+ static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, |
4004 |
+- gfp_t flags, int size) |
4005 |
++ gfp_t flags, int size, |
4006 |
++ u8 token) |
4007 |
+ { |
4008 |
+ struct mlx5_cmd_mailbox *tmp, *head = NULL; |
4009 |
+ struct mlx5_cmd_prot_block *block; |
4010 |
+@@ -978,6 +997,7 @@ static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, |
4011 |
+ tmp->next = head; |
4012 |
+ block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); |
4013 |
+ block->block_num = cpu_to_be32(n - i - 1); |
4014 |
++ block->token = token; |
4015 |
+ head = tmp; |
4016 |
+ } |
4017 |
+ msg->next = head; |
4018 |
+@@ -1352,7 +1372,7 @@ static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core_dev *dev, int in_size, |
4019 |
+ } |
4020 |
+ |
4021 |
+ if (IS_ERR(msg)) |
4022 |
+- msg = mlx5_alloc_cmd_msg(dev, gfp, in_size); |
4023 |
++ msg = mlx5_alloc_cmd_msg(dev, gfp, in_size, 0); |
4024 |
+ |
4025 |
+ return msg; |
4026 |
+ } |
4027 |
+@@ -1377,6 +1397,7 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, |
4028 |
+ int err; |
4029 |
+ u8 status = 0; |
4030 |
+ u32 drv_synd; |
4031 |
++ u8 token; |
4032 |
+ |
4033 |
+ if (pci_channel_offline(dev->pdev) || |
4034 |
+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
4035 |
+@@ -1395,20 +1416,22 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, |
4036 |
+ return err; |
4037 |
+ } |
4038 |
+ |
4039 |
+- err = mlx5_copy_to_msg(inb, in, in_size); |
4040 |
++ token = alloc_token(&dev->cmd); |
4041 |
++ |
4042 |
++ err = mlx5_copy_to_msg(inb, in, in_size, token); |
4043 |
+ if (err) { |
4044 |
+ mlx5_core_warn(dev, "err %d\n", err); |
4045 |
+ goto out_in; |
4046 |
+ } |
4047 |
+ |
4048 |
+- outb = mlx5_alloc_cmd_msg(dev, gfp, out_size); |
4049 |
++ outb = mlx5_alloc_cmd_msg(dev, gfp, out_size, token); |
4050 |
+ if (IS_ERR(outb)) { |
4051 |
+ err = PTR_ERR(outb); |
4052 |
+ goto out_in; |
4053 |
+ } |
4054 |
+ |
4055 |
+ err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, |
4056 |
+- pages_queue, &status); |
4057 |
++ pages_queue, &status, token); |
4058 |
+ if (err) |
4059 |
+ goto out_out; |
4060 |
+ |
4061 |
+@@ -1476,7 +1499,7 @@ static int create_msg_cache(struct mlx5_core_dev *dev) |
4062 |
+ INIT_LIST_HEAD(&cmd->cache.med.head); |
4063 |
+ |
4064 |
+ for (i = 0; i < NUM_LONG_LISTS; i++) { |
4065 |
+- msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, LONG_LIST_SIZE); |
4066 |
++ msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, LONG_LIST_SIZE, 0); |
4067 |
+ if (IS_ERR(msg)) { |
4068 |
+ err = PTR_ERR(msg); |
4069 |
+ goto ex_err; |
4070 |
+@@ -1486,7 +1509,7 @@ static int create_msg_cache(struct mlx5_core_dev *dev) |
4071 |
+ } |
4072 |
+ |
4073 |
+ for (i = 0; i < NUM_MED_LISTS; i++) { |
4074 |
+- msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, MED_LIST_SIZE); |
4075 |
++ msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, MED_LIST_SIZE, 0); |
4076 |
+ if (IS_ERR(msg)) { |
4077 |
+ err = PTR_ERR(msg); |
4078 |
+ goto ex_err; |
4079 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4080 |
+index 9f2a16a507e0..e41a06675ee5 100644 |
4081 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4082 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4083 |
+@@ -648,24 +648,32 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) |
4084 |
+ static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, |
4085 |
+ u32 cqe_bcnt) |
4086 |
+ { |
4087 |
+- struct ethhdr *eth = (struct ethhdr *)(skb->data); |
4088 |
+- struct iphdr *ipv4 = (struct iphdr *)(skb->data + ETH_HLEN); |
4089 |
+- struct ipv6hdr *ipv6 = (struct ipv6hdr *)(skb->data + ETH_HLEN); |
4090 |
++ struct ethhdr *eth = (struct ethhdr *)(skb->data); |
4091 |
++ struct iphdr *ipv4; |
4092 |
++ struct ipv6hdr *ipv6; |
4093 |
+ struct tcphdr *tcp; |
4094 |
++ int network_depth = 0; |
4095 |
++ __be16 proto; |
4096 |
++ u16 tot_len; |
4097 |
+ |
4098 |
+ u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); |
4099 |
+ int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || |
4100 |
+ (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); |
4101 |
+ |
4102 |
+- u16 tot_len = cqe_bcnt - ETH_HLEN; |
4103 |
++ skb->mac_len = ETH_HLEN; |
4104 |
++ proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth); |
4105 |
+ |
4106 |
+- if (eth->h_proto == htons(ETH_P_IP)) { |
4107 |
+- tcp = (struct tcphdr *)(skb->data + ETH_HLEN + |
4108 |
++ ipv4 = (struct iphdr *)(skb->data + network_depth); |
4109 |
++ ipv6 = (struct ipv6hdr *)(skb->data + network_depth); |
4110 |
++ tot_len = cqe_bcnt - network_depth; |
4111 |
++ |
4112 |
++ if (proto == htons(ETH_P_IP)) { |
4113 |
++ tcp = (struct tcphdr *)(skb->data + network_depth + |
4114 |
+ sizeof(struct iphdr)); |
4115 |
+ ipv6 = NULL; |
4116 |
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
4117 |
+ } else { |
4118 |
+- tcp = (struct tcphdr *)(skb->data + ETH_HLEN + |
4119 |
++ tcp = (struct tcphdr *)(skb->data + network_depth + |
4120 |
+ sizeof(struct ipv6hdr)); |
4121 |
+ ipv4 = NULL; |
4122 |
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
4123 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4124 |
+index 704c3d30493e..0db51cc3949b 100644 |
4125 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4126 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4127 |
+@@ -150,7 +150,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv, |
4128 |
+ if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) { |
4129 |
+ struct flow_dissector_key_control *key = |
4130 |
+ skb_flow_dissector_target(f->dissector, |
4131 |
+- FLOW_DISSECTOR_KEY_BASIC, |
4132 |
++ FLOW_DISSECTOR_KEY_CONTROL, |
4133 |
+ f->key); |
4134 |
+ addr_type = key->addr_type; |
4135 |
+ } |
4136 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4137 |
+index 6695893ddd2d..e782d0fde09e 100644 |
4138 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4139 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4140 |
+@@ -1392,36 +1392,12 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, |
4141 |
+ dev_info(&pdev->dev, "%s was called\n", __func__); |
4142 |
+ mlx5_enter_error_state(dev); |
4143 |
+ mlx5_unload_one(dev, priv); |
4144 |
++ pci_save_state(pdev); |
4145 |
+ mlx5_pci_disable_device(dev); |
4146 |
+ return state == pci_channel_io_perm_failure ? |
4147 |
+ PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; |
4148 |
+ } |
4149 |
+ |
4150 |
+-static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) |
4151 |
+-{ |
4152 |
+- struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
4153 |
+- int err = 0; |
4154 |
+- |
4155 |
+- dev_info(&pdev->dev, "%s was called\n", __func__); |
4156 |
+- |
4157 |
+- err = mlx5_pci_enable_device(dev); |
4158 |
+- if (err) { |
4159 |
+- dev_err(&pdev->dev, "%s: mlx5_pci_enable_device failed with error code: %d\n" |
4160 |
+- , __func__, err); |
4161 |
+- return PCI_ERS_RESULT_DISCONNECT; |
4162 |
+- } |
4163 |
+- pci_set_master(pdev); |
4164 |
+- pci_set_power_state(pdev, PCI_D0); |
4165 |
+- pci_restore_state(pdev); |
4166 |
+- |
4167 |
+- return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
4168 |
+-} |
4169 |
+- |
4170 |
+-void mlx5_disable_device(struct mlx5_core_dev *dev) |
4171 |
+-{ |
4172 |
+- mlx5_pci_err_detected(dev->pdev, 0); |
4173 |
+-} |
4174 |
+- |
4175 |
+ /* wait for the device to show vital signs by waiting |
4176 |
+ * for the health counter to start counting. |
4177 |
+ */ |
4178 |
+@@ -1449,21 +1425,44 @@ static int wait_vital(struct pci_dev *pdev) |
4179 |
+ return -ETIMEDOUT; |
4180 |
+ } |
4181 |
+ |
4182 |
+-static void mlx5_pci_resume(struct pci_dev *pdev) |
4183 |
++static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) |
4184 |
+ { |
4185 |
+ struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
4186 |
+- struct mlx5_priv *priv = &dev->priv; |
4187 |
+ int err; |
4188 |
+ |
4189 |
+ dev_info(&pdev->dev, "%s was called\n", __func__); |
4190 |
+ |
4191 |
+- pci_save_state(pdev); |
4192 |
+- err = wait_vital(pdev); |
4193 |
++ err = mlx5_pci_enable_device(dev); |
4194 |
+ if (err) { |
4195 |
++ dev_err(&pdev->dev, "%s: mlx5_pci_enable_device failed with error code: %d\n" |
4196 |
++ , __func__, err); |
4197 |
++ return PCI_ERS_RESULT_DISCONNECT; |
4198 |
++ } |
4199 |
++ |
4200 |
++ pci_set_master(pdev); |
4201 |
++ pci_restore_state(pdev); |
4202 |
++ |
4203 |
++ if (wait_vital(pdev)) { |
4204 |
+ dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); |
4205 |
+- return; |
4206 |
++ return PCI_ERS_RESULT_DISCONNECT; |
4207 |
+ } |
4208 |
+ |
4209 |
++ return PCI_ERS_RESULT_RECOVERED; |
4210 |
++} |
4211 |
++ |
4212 |
++void mlx5_disable_device(struct mlx5_core_dev *dev) |
4213 |
++{ |
4214 |
++ mlx5_pci_err_detected(dev->pdev, 0); |
4215 |
++} |
4216 |
++ |
4217 |
++static void mlx5_pci_resume(struct pci_dev *pdev) |
4218 |
++{ |
4219 |
++ struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
4220 |
++ struct mlx5_priv *priv = &dev->priv; |
4221 |
++ int err; |
4222 |
++ |
4223 |
++ dev_info(&pdev->dev, "%s was called\n", __func__); |
4224 |
++ |
4225 |
+ err = mlx5_load_one(dev, priv); |
4226 |
+ if (err) |
4227 |
+ dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" |
4228 |
+diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c |
4229 |
+index 18ac52ded696..b69d0e1e8daa 100644 |
4230 |
+--- a/drivers/net/ethernet/smsc/smc91x.c |
4231 |
++++ b/drivers/net/ethernet/smsc/smc91x.c |
4232 |
+@@ -2269,6 +2269,13 @@ static int smc_drv_probe(struct platform_device *pdev) |
4233 |
+ if (pd) { |
4234 |
+ memcpy(&lp->cfg, pd, sizeof(lp->cfg)); |
4235 |
+ lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags); |
4236 |
++ |
4237 |
++ if (!SMC_8BIT(lp) && !SMC_16BIT(lp)) { |
4238 |
++ dev_err(&pdev->dev, |
4239 |
++ "at least one of 8-bit or 16-bit access support is required.\n"); |
4240 |
++ ret = -ENXIO; |
4241 |
++ goto out_free_netdev; |
4242 |
++ } |
4243 |
+ } |
4244 |
+ |
4245 |
+ #if IS_BUILTIN(CONFIG_OF) |
4246 |
+diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h |
4247 |
+index 1a55c7976df0..e17671c9d1b0 100644 |
4248 |
+--- a/drivers/net/ethernet/smsc/smc91x.h |
4249 |
++++ b/drivers/net/ethernet/smsc/smc91x.h |
4250 |
+@@ -37,6 +37,27 @@ |
4251 |
+ #include <linux/smc91x.h> |
4252 |
+ |
4253 |
+ /* |
4254 |
++ * Any 16-bit access is performed with two 8-bit accesses if the hardware |
4255 |
++ * can't do it directly. Most registers are 16-bit so those are mandatory. |
4256 |
++ */ |
4257 |
++#define SMC_outw_b(x, a, r) \ |
4258 |
++ do { \ |
4259 |
++ unsigned int __val16 = (x); \ |
4260 |
++ unsigned int __reg = (r); \ |
4261 |
++ SMC_outb(__val16, a, __reg); \ |
4262 |
++ SMC_outb(__val16 >> 8, a, __reg + (1 << SMC_IO_SHIFT)); \ |
4263 |
++ } while (0) |
4264 |
++ |
4265 |
++#define SMC_inw_b(a, r) \ |
4266 |
++ ({ \ |
4267 |
++ unsigned int __val16; \ |
4268 |
++ unsigned int __reg = r; \ |
4269 |
++ __val16 = SMC_inb(a, __reg); \ |
4270 |
++ __val16 |= SMC_inb(a, __reg + (1 << SMC_IO_SHIFT)) << 8; \ |
4271 |
++ __val16; \ |
4272 |
++ }) |
4273 |
++ |
4274 |
++/* |
4275 |
+ * Define your architecture specific bus configuration parameters here. |
4276 |
+ */ |
4277 |
+ |
4278 |
+@@ -55,10 +76,30 @@ |
4279 |
+ #define SMC_IO_SHIFT (lp->io_shift) |
4280 |
+ |
4281 |
+ #define SMC_inb(a, r) readb((a) + (r)) |
4282 |
+-#define SMC_inw(a, r) readw((a) + (r)) |
4283 |
++#define SMC_inw(a, r) \ |
4284 |
++ ({ \ |
4285 |
++ unsigned int __smc_r = r; \ |
4286 |
++ SMC_16BIT(lp) ? readw((a) + __smc_r) : \ |
4287 |
++ SMC_8BIT(lp) ? SMC_inw_b(a, __smc_r) : \ |
4288 |
++ ({ BUG(); 0; }); \ |
4289 |
++ }) |
4290 |
++ |
4291 |
+ #define SMC_inl(a, r) readl((a) + (r)) |
4292 |
+ #define SMC_outb(v, a, r) writeb(v, (a) + (r)) |
4293 |
++#define SMC_outw(v, a, r) \ |
4294 |
++ do { \ |
4295 |
++ unsigned int __v = v, __smc_r = r; \ |
4296 |
++ if (SMC_16BIT(lp)) \ |
4297 |
++ __SMC_outw(__v, a, __smc_r); \ |
4298 |
++ else if (SMC_8BIT(lp)) \ |
4299 |
++ SMC_outw_b(__v, a, __smc_r); \ |
4300 |
++ else \ |
4301 |
++ BUG(); \ |
4302 |
++ } while (0) |
4303 |
++ |
4304 |
+ #define SMC_outl(v, a, r) writel(v, (a) + (r)) |
4305 |
++#define SMC_insb(a, r, p, l) readsb((a) + (r), p, l) |
4306 |
++#define SMC_outsb(a, r, p, l) writesb((a) + (r), p, l) |
4307 |
+ #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
4308 |
+ #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
4309 |
+ #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) |
4310 |
+@@ -66,7 +107,7 @@ |
4311 |
+ #define SMC_IRQ_FLAGS (-1) /* from resource */ |
4312 |
+ |
4313 |
+ /* We actually can't write halfwords properly if not word aligned */ |
4314 |
+-static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) |
4315 |
++static inline void __SMC_outw(u16 val, void __iomem *ioaddr, int reg) |
4316 |
+ { |
4317 |
+ if ((machine_is_mainstone() || machine_is_stargate2() || |
4318 |
+ machine_is_pxa_idp()) && reg & 2) { |
4319 |
+@@ -416,24 +457,8 @@ smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma, |
4320 |
+ |
4321 |
+ #if ! SMC_CAN_USE_16BIT |
4322 |
+ |
4323 |
+-/* |
4324 |
+- * Any 16-bit access is performed with two 8-bit accesses if the hardware |
4325 |
+- * can't do it directly. Most registers are 16-bit so those are mandatory. |
4326 |
+- */ |
4327 |
+-#define SMC_outw(x, ioaddr, reg) \ |
4328 |
+- do { \ |
4329 |
+- unsigned int __val16 = (x); \ |
4330 |
+- SMC_outb( __val16, ioaddr, reg ); \ |
4331 |
+- SMC_outb( __val16 >> 8, ioaddr, reg + (1 << SMC_IO_SHIFT));\ |
4332 |
+- } while (0) |
4333 |
+-#define SMC_inw(ioaddr, reg) \ |
4334 |
+- ({ \ |
4335 |
+- unsigned int __val16; \ |
4336 |
+- __val16 = SMC_inb( ioaddr, reg ); \ |
4337 |
+- __val16 |= SMC_inb( ioaddr, reg + (1 << SMC_IO_SHIFT)) << 8; \ |
4338 |
+- __val16; \ |
4339 |
+- }) |
4340 |
+- |
4341 |
++#define SMC_outw(x, ioaddr, reg) SMC_outw_b(x, ioaddr, reg) |
4342 |
++#define SMC_inw(ioaddr, reg) SMC_inw_b(ioaddr, reg) |
4343 |
+ #define SMC_insw(a, r, p, l) BUG() |
4344 |
+ #define SMC_outsw(a, r, p, l) BUG() |
4345 |
+ |
4346 |
+diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c |
4347 |
+index c5dc2c363f96..c6f66832a1a6 100644 |
4348 |
+--- a/drivers/net/phy/phy.c |
4349 |
++++ b/drivers/net/phy/phy.c |
4350 |
+@@ -722,8 +722,10 @@ phy_err: |
4351 |
+ int phy_start_interrupts(struct phy_device *phydev) |
4352 |
+ { |
4353 |
+ atomic_set(&phydev->irq_disable, 0); |
4354 |
+- if (request_irq(phydev->irq, phy_interrupt, 0, "phy_interrupt", |
4355 |
+- phydev) < 0) { |
4356 |
++ if (request_irq(phydev->irq, phy_interrupt, |
4357 |
++ IRQF_SHARED, |
4358 |
++ "phy_interrupt", |
4359 |
++ phydev) < 0) { |
4360 |
+ pr_warn("%s: Can't get IRQ %d (PHY)\n", |
4361 |
+ phydev->mdio.bus->name, phydev->irq); |
4362 |
+ phydev->irq = PHY_POLL; |
4363 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
4364 |
+index e16487cc6a9a..34259bd0a3b7 100644 |
4365 |
+--- a/drivers/net/tun.c |
4366 |
++++ b/drivers/net/tun.c |
4367 |
+@@ -878,11 +878,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) |
4368 |
+ if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) |
4369 |
+ goto drop; |
4370 |
+ |
4371 |
+- if (skb->sk && sk_fullsock(skb->sk)) { |
4372 |
+- sock_tx_timestamp(skb->sk, skb->sk->sk_tsflags, |
4373 |
+- &skb_shinfo(skb)->tx_flags); |
4374 |
+- sw_tx_timestamp(skb); |
4375 |
+- } |
4376 |
++ skb_tx_timestamp(skb); |
4377 |
+ |
4378 |
+ /* Orphan the skb - required as we might hang on to it |
4379 |
+ * for indefinite time. |
4380 |
+diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
4381 |
+index 8b6398850657..4b59a4c1552d 100644 |
4382 |
+--- a/drivers/net/wireless/ath/ath9k/main.c |
4383 |
++++ b/drivers/net/wireless/ath/ath9k/main.c |
4384 |
+@@ -718,9 +718,12 @@ static int ath9k_start(struct ieee80211_hw *hw) |
4385 |
+ if (!ath_complete_reset(sc, false)) |
4386 |
+ ah->reset_power_on = false; |
4387 |
+ |
4388 |
+- if (ah->led_pin >= 0) |
4389 |
++ if (ah->led_pin >= 0) { |
4390 |
+ ath9k_hw_set_gpio(ah, ah->led_pin, |
4391 |
+ (ah->config.led_active_high) ? 1 : 0); |
4392 |
++ ath9k_hw_gpio_request_out(ah, ah->led_pin, NULL, |
4393 |
++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
4394 |
++ } |
4395 |
+ |
4396 |
+ /* |
4397 |
+ * Reset key cache to sane defaults (all entries cleared) instead of |
4398 |
+@@ -864,9 +867,11 @@ static void ath9k_stop(struct ieee80211_hw *hw) |
4399 |
+ |
4400 |
+ spin_lock_bh(&sc->sc_pcu_lock); |
4401 |
+ |
4402 |
+- if (ah->led_pin >= 0) |
4403 |
++ if (ah->led_pin >= 0) { |
4404 |
+ ath9k_hw_set_gpio(ah, ah->led_pin, |
4405 |
+ (ah->config.led_active_high) ? 0 : 1); |
4406 |
++ ath9k_hw_gpio_request_in(ah, ah->led_pin, NULL); |
4407 |
++ } |
4408 |
+ |
4409 |
+ ath_prepare_reset(sc); |
4410 |
+ |
4411 |
+@@ -1552,13 +1557,13 @@ static int ath9k_sta_state(struct ieee80211_hw *hw, |
4412 |
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
4413 |
+ int ret = 0; |
4414 |
+ |
4415 |
+- if (old_state == IEEE80211_STA_AUTH && |
4416 |
+- new_state == IEEE80211_STA_ASSOC) { |
4417 |
++ if (old_state == IEEE80211_STA_NOTEXIST && |
4418 |
++ new_state == IEEE80211_STA_NONE) { |
4419 |
+ ret = ath9k_sta_add(hw, vif, sta); |
4420 |
+ ath_dbg(common, CONFIG, |
4421 |
+ "Add station: %pM\n", sta->addr); |
4422 |
+- } else if (old_state == IEEE80211_STA_ASSOC && |
4423 |
+- new_state == IEEE80211_STA_AUTH) { |
4424 |
++ } else if (old_state == IEEE80211_STA_NONE && |
4425 |
++ new_state == IEEE80211_STA_NOTEXIST) { |
4426 |
+ ret = ath9k_sta_remove(hw, vif, sta); |
4427 |
+ ath_dbg(common, CONFIG, |
4428 |
+ "Remove station: %pM\n", sta->addr); |
4429 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4430 |
+index 62f475e31077..121baba7acb1 100644 |
4431 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4432 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4433 |
+@@ -4467,7 +4467,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, |
4434 |
+ (u8 *)&settings->beacon.head[ie_offset], |
4435 |
+ settings->beacon.head_len - ie_offset, |
4436 |
+ WLAN_EID_SSID); |
4437 |
+- if (!ssid_ie) |
4438 |
++ if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) |
4439 |
+ return -EINVAL; |
4440 |
+ |
4441 |
+ memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); |
4442 |
+diff --git a/drivers/net/wireless/intel/iwlegacy/3945.c b/drivers/net/wireless/intel/iwlegacy/3945.c |
4443 |
+index 7bcedbb53d94..209dc9988455 100644 |
4444 |
+--- a/drivers/net/wireless/intel/iwlegacy/3945.c |
4445 |
++++ b/drivers/net/wireless/intel/iwlegacy/3945.c |
4446 |
+@@ -1019,12 +1019,13 @@ il3945_hw_txq_ctx_free(struct il_priv *il) |
4447 |
+ int txq_id; |
4448 |
+ |
4449 |
+ /* Tx queues */ |
4450 |
+- if (il->txq) |
4451 |
++ if (il->txq) { |
4452 |
+ for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) |
4453 |
+ if (txq_id == IL39_CMD_QUEUE_NUM) |
4454 |
+ il_cmd_queue_free(il); |
4455 |
+ else |
4456 |
+ il_tx_queue_free(il, txq_id); |
4457 |
++ } |
4458 |
+ |
4459 |
+ /* free tx queue structure */ |
4460 |
+ il_free_txq_mem(il); |
4461 |
+diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
4462 |
+index c6d410ef8de0..5bf8e78e0f47 100644 |
4463 |
+--- a/drivers/pinctrl/pinctrl-pistachio.c |
4464 |
++++ b/drivers/pinctrl/pinctrl-pistachio.c |
4465 |
+@@ -809,17 +809,17 @@ static const struct pistachio_pin_group pistachio_groups[] = { |
4466 |
+ PADS_FUNCTION_SELECT2, 12, 0x3), |
4467 |
+ MFIO_MUX_PIN_GROUP(83, MIPS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, |
4468 |
+ PADS_FUNCTION_SELECT2, 14, 0x3), |
4469 |
+- MFIO_MUX_PIN_GROUP(84, SYS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, |
4470 |
++ MFIO_MUX_PIN_GROUP(84, AUDIO_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, |
4471 |
+ PADS_FUNCTION_SELECT2, 16, 0x3), |
4472 |
+- MFIO_MUX_PIN_GROUP(85, WIFI_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
4473 |
++ MFIO_MUX_PIN_GROUP(85, RPU_V_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
4474 |
+ PADS_FUNCTION_SELECT2, 18, 0x3), |
4475 |
+- MFIO_MUX_PIN_GROUP(86, BT_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
4476 |
++ MFIO_MUX_PIN_GROUP(86, RPU_L_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
4477 |
+ PADS_FUNCTION_SELECT2, 20, 0x3), |
4478 |
+- MFIO_MUX_PIN_GROUP(87, RPU_V_PLL_LOCK, DREQ2, SOCIF_DEBUG, |
4479 |
++ MFIO_MUX_PIN_GROUP(87, SYS_PLL_LOCK, DREQ2, SOCIF_DEBUG, |
4480 |
+ PADS_FUNCTION_SELECT2, 22, 0x3), |
4481 |
+- MFIO_MUX_PIN_GROUP(88, RPU_L_PLL_LOCK, DREQ3, SOCIF_DEBUG, |
4482 |
++ MFIO_MUX_PIN_GROUP(88, WIFI_PLL_LOCK, DREQ3, SOCIF_DEBUG, |
4483 |
+ PADS_FUNCTION_SELECT2, 24, 0x3), |
4484 |
+- MFIO_MUX_PIN_GROUP(89, AUDIO_PLL_LOCK, DREQ4, DREQ5, |
4485 |
++ MFIO_MUX_PIN_GROUP(89, BT_PLL_LOCK, DREQ4, DREQ5, |
4486 |
+ PADS_FUNCTION_SELECT2, 26, 0x3), |
4487 |
+ PIN_GROUP(TCK, "tck"), |
4488 |
+ PIN_GROUP(TRSTN, "trstn"), |
4489 |
+diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c |
4490 |
+index 55083d278bb1..51fbf85301be 100644 |
4491 |
+--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c |
4492 |
++++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c |
4493 |
+@@ -485,12 +485,12 @@ static const struct sunxi_desc_pin sun8i_a23_pins[] = { |
4494 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), |
4495 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4496 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
4497 |
+- SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ |
4498 |
++ SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ |
4499 |
+ SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 8)), /* PG_EINT8 */ |
4500 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), |
4501 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4502 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
4503 |
+- SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ |
4504 |
++ SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ |
4505 |
+ SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 9)), /* PG_EINT9 */ |
4506 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), |
4507 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4508 |
+diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
4509 |
+index 8b381d69df86..584cdedea7a4 100644 |
4510 |
+--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
4511 |
++++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
4512 |
+@@ -407,12 +407,12 @@ static const struct sunxi_desc_pin sun8i_a33_pins[] = { |
4513 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), |
4514 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4515 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
4516 |
+- SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ |
4517 |
++ SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ |
4518 |
+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */ |
4519 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), |
4520 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4521 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
4522 |
+- SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ |
4523 |
++ SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ |
4524 |
+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */ |
4525 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), |
4526 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
4527 |
+diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c |
4528 |
+index b5b455614f8a..68d2bae00892 100644 |
4529 |
+--- a/drivers/rapidio/devices/tsi721.c |
4530 |
++++ b/drivers/rapidio/devices/tsi721.c |
4531 |
+@@ -1148,7 +1148,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart, |
4532 |
+ } else if (ibw_start < (ib_win->rstart + ib_win->size) && |
4533 |
+ (ibw_start + ibw_size) > ib_win->rstart) { |
4534 |
+ /* Return error if address translation involved */ |
4535 |
+- if (direct && ib_win->xlat) { |
4536 |
++ if (!direct || ib_win->xlat) { |
4537 |
+ ret = -EFAULT; |
4538 |
+ break; |
4539 |
+ } |
4540 |
+diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c |
4541 |
+index 86379a79a6a3..0f50a3f5e05d 100644 |
4542 |
+--- a/drivers/tty/serial/8250/8250_mid.c |
4543 |
++++ b/drivers/tty/serial/8250/8250_mid.c |
4544 |
+@@ -154,6 +154,9 @@ static void mid8250_set_termios(struct uart_port *p, |
4545 |
+ unsigned long w = BIT(24) - 1; |
4546 |
+ unsigned long mul, div; |
4547 |
+ |
4548 |
++ /* Gracefully handle the B0 case: fall back to B9600 */ |
4549 |
++ fuart = fuart ? fuart : 9600 * 16; |
4550 |
++ |
4551 |
+ if (mid->board->freq < fuart) { |
4552 |
+ /* Find prescaler value that satisfies Fuart < Fref */ |
4553 |
+ if (mid->board->freq > baud) |
4554 |
+diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
4555 |
+index 8dd250fbd367..e67a46301862 100644 |
4556 |
+--- a/drivers/tty/serial/8250/8250_pci.c |
4557 |
++++ b/drivers/tty/serial/8250/8250_pci.c |
4558 |
+@@ -1939,6 +1939,43 @@ pci_wch_ch38x_setup(struct serial_private *priv, |
4559 |
+ #define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954 |
4560 |
+ #define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958 |
4561 |
+ |
4562 |
++#define PCI_VENDOR_ID_ACCESIO 0x494f |
4563 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB 0x1051 |
4564 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S 0x1053 |
4565 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB 0x105C |
4566 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S 0x105E |
4567 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB 0x1091 |
4568 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2 0x1093 |
4569 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB 0x1099 |
4570 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4 0x109B |
4571 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB 0x10D1 |
4572 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM 0x10D3 |
4573 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB 0x10DA |
4574 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM 0x10DC |
4575 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1 0x1108 |
4576 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2 0x1110 |
4577 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2 0x1111 |
4578 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4 0x1118 |
4579 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4 0x1119 |
4580 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S 0x1152 |
4581 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S 0x115A |
4582 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2 0x1190 |
4583 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2 0x1191 |
4584 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4 0x1198 |
4585 |
++#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4 0x1199 |
4586 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM 0x11D0 |
4587 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4 0x105A |
4588 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4 0x105B |
4589 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8 0x106A |
4590 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM485_8 0x106B |
4591 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4 0x1098 |
4592 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8 0x10A9 |
4593 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM 0x10D9 |
4594 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM 0x10E9 |
4595 |
++#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM 0x11D8 |
4596 |
++ |
4597 |
++ |
4598 |
++ |
4599 |
+ /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ |
4600 |
+ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 |
4601 |
+ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 |
4602 |
+@@ -5093,6 +5130,108 @@ static struct pci_device_id serial_pci_tbl[] = { |
4603 |
+ 0, |
4604 |
+ 0, pbn_pericom_PI7C9X7958 }, |
4605 |
+ /* |
4606 |
++ * ACCES I/O Products quad |
4607 |
++ */ |
4608 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB, |
4609 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4610 |
++ pbn_pericom_PI7C9X7954 }, |
4611 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S, |
4612 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4613 |
++ pbn_pericom_PI7C9X7954 }, |
4614 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB, |
4615 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4616 |
++ pbn_pericom_PI7C9X7954 }, |
4617 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S, |
4618 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4619 |
++ pbn_pericom_PI7C9X7954 }, |
4620 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB, |
4621 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4622 |
++ pbn_pericom_PI7C9X7954 }, |
4623 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2, |
4624 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4625 |
++ pbn_pericom_PI7C9X7954 }, |
4626 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB, |
4627 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4628 |
++ pbn_pericom_PI7C9X7954 }, |
4629 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4, |
4630 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4631 |
++ pbn_pericom_PI7C9X7954 }, |
4632 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB, |
4633 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4634 |
++ pbn_pericom_PI7C9X7954 }, |
4635 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM, |
4636 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4637 |
++ pbn_pericom_PI7C9X7954 }, |
4638 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB, |
4639 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4640 |
++ pbn_pericom_PI7C9X7954 }, |
4641 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM, |
4642 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4643 |
++ pbn_pericom_PI7C9X7954 }, |
4644 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1, |
4645 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4646 |
++ pbn_pericom_PI7C9X7954 }, |
4647 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2, |
4648 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4649 |
++ pbn_pericom_PI7C9X7954 }, |
4650 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2, |
4651 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4652 |
++ pbn_pericom_PI7C9X7954 }, |
4653 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4, |
4654 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4655 |
++ pbn_pericom_PI7C9X7954 }, |
4656 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4, |
4657 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4658 |
++ pbn_pericom_PI7C9X7954 }, |
4659 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S, |
4660 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4661 |
++ pbn_pericom_PI7C9X7954 }, |
4662 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S, |
4663 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4664 |
++ pbn_pericom_PI7C9X7954 }, |
4665 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2, |
4666 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4667 |
++ pbn_pericom_PI7C9X7954 }, |
4668 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2, |
4669 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4670 |
++ pbn_pericom_PI7C9X7954 }, |
4671 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4, |
4672 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4673 |
++ pbn_pericom_PI7C9X7954 }, |
4674 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4, |
4675 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4676 |
++ pbn_pericom_PI7C9X7954 }, |
4677 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM, |
4678 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4679 |
++ pbn_pericom_PI7C9X7954 }, |
4680 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4, |
4681 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4682 |
++ pbn_pericom_PI7C9X7958 }, |
4683 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4, |
4684 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4685 |
++ pbn_pericom_PI7C9X7958 }, |
4686 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8, |
4687 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4688 |
++ pbn_pericom_PI7C9X7958 }, |
4689 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_8, |
4690 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4691 |
++ pbn_pericom_PI7C9X7958 }, |
4692 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4, |
4693 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4694 |
++ pbn_pericom_PI7C9X7958 }, |
4695 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8, |
4696 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4697 |
++ pbn_pericom_PI7C9X7958 }, |
4698 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM, |
4699 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4700 |
++ pbn_pericom_PI7C9X7958 }, |
4701 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM, |
4702 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4703 |
++ pbn_pericom_PI7C9X7958 }, |
4704 |
++ { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM, |
4705 |
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
4706 |
++ pbn_pericom_PI7C9X7958 }, |
4707 |
++ /* |
4708 |
+ * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke) |
4709 |
+ */ |
4710 |
+ { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560, |
4711 |
+diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c |
4712 |
+index dfec5a176315..b93356834bb5 100644 |
4713 |
+--- a/drivers/usb/chipidea/udc.c |
4714 |
++++ b/drivers/usb/chipidea/udc.c |
4715 |
+@@ -949,6 +949,15 @@ static int isr_setup_status_phase(struct ci_hdrc *ci) |
4716 |
+ int retval; |
4717 |
+ struct ci_hw_ep *hwep; |
4718 |
+ |
4719 |
++ /* |
4720 |
++ * Unexpected USB controller behavior, caused by bad signal integrity |
4721 |
++ * or ground reference problems, can lead to isr_setup_status_phase |
4722 |
++ * being called with ci->status equal to NULL. |
4723 |
++ * If this situation occurs, you should review your USB hardware design. |
4724 |
++ */ |
4725 |
++ if (WARN_ON_ONCE(!ci->status)) |
4726 |
++ return -EPIPE; |
4727 |
++ |
4728 |
+ hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; |
4729 |
+ ci->status->context = ci; |
4730 |
+ ci->status->complete = isr_setup_status_complete; |
4731 |
+diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c |
4732 |
+index 15ce4ab11688..a2d90aca779f 100644 |
4733 |
+--- a/drivers/usb/core/config.c |
4734 |
++++ b/drivers/usb/core/config.c |
4735 |
+@@ -240,8 +240,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
4736 |
+ memcpy(&endpoint->desc, d, n); |
4737 |
+ INIT_LIST_HEAD(&endpoint->urb_list); |
4738 |
+ |
4739 |
+- /* Fix up bInterval values outside the legal range. Use 32 ms if no |
4740 |
+- * proper value can be guessed. */ |
4741 |
++ /* |
4742 |
++ * Fix up bInterval values outside the legal range. |
4743 |
++ * Use 10 or 8 ms if no proper value can be guessed. |
4744 |
++ */ |
4745 |
+ i = 0; /* i = min, j = max, n = default */ |
4746 |
+ j = 255; |
4747 |
+ if (usb_endpoint_xfer_int(d)) { |
4748 |
+@@ -250,13 +252,15 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
4749 |
+ case USB_SPEED_SUPER_PLUS: |
4750 |
+ case USB_SPEED_SUPER: |
4751 |
+ case USB_SPEED_HIGH: |
4752 |
+- /* Many device manufacturers are using full-speed |
4753 |
++ /* |
4754 |
++ * Many device manufacturers are using full-speed |
4755 |
+ * bInterval values in high-speed interrupt endpoint |
4756 |
+- * descriptors. Try to fix those and fall back to a |
4757 |
+- * 32 ms default value otherwise. */ |
4758 |
++ * descriptors. Try to fix those and fall back to an |
4759 |
++ * 8-ms default value otherwise. |
4760 |
++ */ |
4761 |
+ n = fls(d->bInterval*8); |
4762 |
+ if (n == 0) |
4763 |
+- n = 9; /* 32 ms = 2^(9-1) uframes */ |
4764 |
++ n = 7; /* 8 ms = 2^(7-1) uframes */ |
4765 |
+ j = 16; |
4766 |
+ |
4767 |
+ /* |
4768 |
+@@ -271,10 +275,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
4769 |
+ } |
4770 |
+ break; |
4771 |
+ default: /* USB_SPEED_FULL or _LOW */ |
4772 |
+- /* For low-speed, 10 ms is the official minimum. |
4773 |
++ /* |
4774 |
++ * For low-speed, 10 ms is the official minimum. |
4775 |
+ * But some "overclocked" devices might want faster |
4776 |
+- * polling so we'll allow it. */ |
4777 |
+- n = 32; |
4778 |
++ * polling so we'll allow it. |
4779 |
++ */ |
4780 |
++ n = 10; |
4781 |
+ break; |
4782 |
+ } |
4783 |
+ } else if (usb_endpoint_xfer_isoc(d)) { |
4784 |
+@@ -282,10 +288,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, |
4785 |
+ j = 16; |
4786 |
+ switch (to_usb_device(ddev)->speed) { |
4787 |
+ case USB_SPEED_HIGH: |
4788 |
+- n = 9; /* 32 ms = 2^(9-1) uframes */ |
4789 |
++ n = 7; /* 8 ms = 2^(7-1) uframes */ |
4790 |
+ break; |
4791 |
+ default: /* USB_SPEED_FULL */ |
4792 |
+- n = 6; /* 32 ms = 2^(6-1) frames */ |
4793 |
++ n = 4; /* 8 ms = 2^(4-1) frames */ |
4794 |
+ break; |
4795 |
+ } |
4796 |
+ } |
4797 |
+diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
4798 |
+index 93a3bec81df7..fb8fc34827ab 100644 |
4799 |
+--- a/drivers/usb/gadget/udc/renesas_usb3.c |
4800 |
++++ b/drivers/usb/gadget/udc/renesas_usb3.c |
4801 |
+@@ -106,6 +106,7 @@ |
4802 |
+ |
4803 |
+ /* DRD_CON */ |
4804 |
+ #define DRD_CON_PERI_CON BIT(24) |
4805 |
++#define DRD_CON_VBOUT BIT(0) |
4806 |
+ |
4807 |
+ /* USB_INT_ENA_1 and USB_INT_STA_1 */ |
4808 |
+ #define USB_INT_1_B3_PLLWKUP BIT(31) |
4809 |
+@@ -363,6 +364,7 @@ static void usb3_init_epc_registers(struct renesas_usb3 *usb3) |
4810 |
+ { |
4811 |
+ /* FIXME: How to change host / peripheral mode as well? */ |
4812 |
+ usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON); |
4813 |
++ usb3_clear_bit(usb3, DRD_CON_VBOUT, USB3_DRD_CON); |
4814 |
+ |
4815 |
+ usb3_write(usb3, ~0, USB3_USB_INT_STA_1); |
4816 |
+ usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG); |
4817 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
4818 |
+index bc17bcf57bbd..e262cccbcdb2 100644 |
4819 |
+--- a/drivers/usb/host/xhci-ring.c |
4820 |
++++ b/drivers/usb/host/xhci-ring.c |
4821 |
+@@ -840,6 +840,10 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) |
4822 |
+ spin_lock_irqsave(&xhci->lock, flags); |
4823 |
+ |
4824 |
+ ep->stop_cmds_pending--; |
4825 |
++ if (xhci->xhc_state & XHCI_STATE_REMOVING) { |
4826 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
4827 |
++ return; |
4828 |
++ } |
4829 |
+ if (xhci->xhc_state & XHCI_STATE_DYING) { |
4830 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
4831 |
+ "Stop EP timer ran, but another timer marked " |
4832 |
+@@ -893,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) |
4833 |
+ spin_unlock_irqrestore(&xhci->lock, flags); |
4834 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
4835 |
+ "Calling usb_hc_died()"); |
4836 |
+- usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); |
4837 |
++ usb_hc_died(xhci_to_hcd(xhci)); |
4838 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
4839 |
+ "xHCI host controller is dead."); |
4840 |
+ } |
4841 |
+diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c |
4842 |
+index d4be5d594896..28965ef4f824 100644 |
4843 |
+--- a/drivers/usb/renesas_usbhs/mod.c |
4844 |
++++ b/drivers/usb/renesas_usbhs/mod.c |
4845 |
+@@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int irq, void *data) |
4846 |
+ if (usbhs_mod_is_host(priv)) |
4847 |
+ usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); |
4848 |
+ |
4849 |
+- usbhs_write(priv, BRDYSTS, ~irq_state.brdysts); |
4850 |
++ /* |
4851 |
++ * The driver should not clear the xxxSTS after the line of |
4852 |
++ * "call irq callback functions" because each "if" statement is |
4853 |
++ * possible to call the callback function for avoiding any side effects. |
4854 |
++ */ |
4855 |
++ if (irq_state.intsts0 & BRDY) |
4856 |
++ usbhs_write(priv, BRDYSTS, ~irq_state.brdysts); |
4857 |
+ usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts); |
4858 |
+- usbhs_write(priv, BEMPSTS, ~irq_state.bempsts); |
4859 |
++ if (irq_state.intsts0 & BEMP) |
4860 |
++ usbhs_write(priv, BEMPSTS, ~irq_state.bempsts); |
4861 |
+ |
4862 |
+ /* |
4863 |
+ * call irq callback functions |
4864 |
+diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c |
4865 |
+index a204782ae530..e98b6e57b703 100644 |
4866 |
+--- a/drivers/usb/serial/usb-serial-simple.c |
4867 |
++++ b/drivers/usb/serial/usb-serial-simple.c |
4868 |
+@@ -54,7 +54,8 @@ DEVICE(funsoft, FUNSOFT_IDS); |
4869 |
+ /* Infineon Flashloader driver */ |
4870 |
+ #define FLASHLOADER_IDS() \ |
4871 |
+ { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ |
4872 |
+- { USB_DEVICE(0x8087, 0x0716) } |
4873 |
++ { USB_DEVICE(0x8087, 0x0716) }, \ |
4874 |
++ { USB_DEVICE(0x8087, 0x0801) } |
4875 |
+ DEVICE(flashloader, FLASHLOADER_IDS); |
4876 |
+ |
4877 |
+ /* Google Serial USB SubClass */ |
4878 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
4879 |
+index c05f69a8ec42..542379f8feea 100644 |
4880 |
+--- a/fs/btrfs/tree-log.c |
4881 |
++++ b/fs/btrfs/tree-log.c |
4882 |
+@@ -2851,6 +2851,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, |
4883 |
+ |
4884 |
+ if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { |
4885 |
+ blk_finish_plug(&plug); |
4886 |
++ list_del_init(&root_log_ctx.list); |
4887 |
+ mutex_unlock(&log_root_tree->log_mutex); |
4888 |
+ ret = root_log_ctx.log_ret; |
4889 |
+ goto out; |
4890 |
+diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c |
4891 |
+index 37c134a132c7..cc543fea5d1e 100644 |
4892 |
+--- a/fs/devpts/inode.c |
4893 |
++++ b/fs/devpts/inode.c |
4894 |
+@@ -584,7 +584,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv) |
4895 |
+ */ |
4896 |
+ void *devpts_get_priv(struct dentry *dentry) |
4897 |
+ { |
4898 |
+- WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); |
4899 |
++ if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC) |
4900 |
++ return NULL; |
4901 |
+ return dentry->d_fsdata; |
4902 |
+ } |
4903 |
+ |
4904 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
4905 |
+index 28cc412852af..64eddc5289eb 100644 |
4906 |
+--- a/fs/ext4/ioctl.c |
4907 |
++++ b/fs/ext4/ioctl.c |
4908 |
+@@ -782,7 +782,13 @@ resizefs_out: |
4909 |
+ goto encryption_policy_out; |
4910 |
+ } |
4911 |
+ |
4912 |
++ err = mnt_want_write_file(filp); |
4913 |
++ if (err) |
4914 |
++ goto encryption_policy_out; |
4915 |
++ |
4916 |
+ err = ext4_process_policy(&policy, inode); |
4917 |
++ |
4918 |
++ mnt_drop_write_file(filp); |
4919 |
+ encryption_policy_out: |
4920 |
+ return err; |
4921 |
+ #else |
4922 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
4923 |
+index 6cac3dc33521..76962a349d57 100644 |
4924 |
+--- a/fs/fuse/file.c |
4925 |
++++ b/fs/fuse/file.c |
4926 |
+@@ -540,13 +540,13 @@ void fuse_read_fill(struct fuse_req *req, struct file *file, loff_t pos, |
4927 |
+ req->out.args[0].size = count; |
4928 |
+ } |
4929 |
+ |
4930 |
+-static void fuse_release_user_pages(struct fuse_req *req, int write) |
4931 |
++static void fuse_release_user_pages(struct fuse_req *req, bool should_dirty) |
4932 |
+ { |
4933 |
+ unsigned i; |
4934 |
+ |
4935 |
+ for (i = 0; i < req->num_pages; i++) { |
4936 |
+ struct page *page = req->pages[i]; |
4937 |
+- if (write) |
4938 |
++ if (should_dirty) |
4939 |
+ set_page_dirty_lock(page); |
4940 |
+ put_page(page); |
4941 |
+ } |
4942 |
+@@ -1331,6 +1331,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, |
4943 |
+ loff_t *ppos, int flags) |
4944 |
+ { |
4945 |
+ int write = flags & FUSE_DIO_WRITE; |
4946 |
++ bool should_dirty = !write && iter_is_iovec(iter); |
4947 |
+ int cuse = flags & FUSE_DIO_CUSE; |
4948 |
+ struct file *file = io->file; |
4949 |
+ struct inode *inode = file->f_mapping->host; |
4950 |
+@@ -1374,7 +1375,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, |
4951 |
+ nres = fuse_send_read(req, io, pos, nbytes, owner); |
4952 |
+ |
4953 |
+ if (!io->async) |
4954 |
+- fuse_release_user_pages(req, !write); |
4955 |
++ fuse_release_user_pages(req, should_dirty); |
4956 |
+ if (req->out.h.error) { |
4957 |
+ err = req->out.h.error; |
4958 |
+ break; |
4959 |
+diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c |
4960 |
+index e1574008adc9..2bcb86e6e6ca 100644 |
4961 |
+--- a/fs/kernfs/file.c |
4962 |
++++ b/fs/kernfs/file.c |
4963 |
+@@ -840,21 +840,35 @@ repeat: |
4964 |
+ mutex_lock(&kernfs_mutex); |
4965 |
+ |
4966 |
+ list_for_each_entry(info, &kernfs_root(kn)->supers, node) { |
4967 |
++ struct kernfs_node *parent; |
4968 |
+ struct inode *inode; |
4969 |
+- struct dentry *dentry; |
4970 |
+ |
4971 |
++ /* |
4972 |
++ * We want fsnotify_modify() on @kn but as the |
4973 |
++ * modifications aren't originating from userland don't |
4974 |
++ * have the matching @file available. Look up the inodes |
4975 |
++ * and generate the events manually. |
4976 |
++ */ |
4977 |
+ inode = ilookup(info->sb, kn->ino); |
4978 |
+ if (!inode) |
4979 |
+ continue; |
4980 |
+ |
4981 |
+- dentry = d_find_any_alias(inode); |
4982 |
+- if (dentry) { |
4983 |
+- fsnotify_parent(NULL, dentry, FS_MODIFY); |
4984 |
+- fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, |
4985 |
+- NULL, 0); |
4986 |
+- dput(dentry); |
4987 |
++ parent = kernfs_get_parent(kn); |
4988 |
++ if (parent) { |
4989 |
++ struct inode *p_inode; |
4990 |
++ |
4991 |
++ p_inode = ilookup(info->sb, parent->ino); |
4992 |
++ if (p_inode) { |
4993 |
++ fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD, |
4994 |
++ inode, FSNOTIFY_EVENT_INODE, kn->name, 0); |
4995 |
++ iput(p_inode); |
4996 |
++ } |
4997 |
++ |
4998 |
++ kernfs_put(parent); |
4999 |
+ } |
5000 |
+ |
5001 |
++ fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, |
5002 |
++ kn->name, 0); |
5003 |
+ iput(inode); |
5004 |
+ } |
5005 |
+ |
5006 |
+diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c |
5007 |
+index a7f2e6e33305..52a28311e2a4 100644 |
5008 |
+--- a/fs/nfs/callback.c |
5009 |
++++ b/fs/nfs/callback.c |
5010 |
+@@ -275,6 +275,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv, |
5011 |
+ err_socks: |
5012 |
+ svc_rpcb_cleanup(serv, net); |
5013 |
+ err_bind: |
5014 |
++ nn->cb_users[minorversion]--; |
5015 |
+ dprintk("NFS: Couldn't create callback socket: err = %d; " |
5016 |
+ "net = %p\n", ret, net); |
5017 |
+ return ret; |
5018 |
+diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
5019 |
+index aaa2e8d3df6f..8cfa21f40acd 100644 |
5020 |
+--- a/fs/nfs/callback_proc.c |
5021 |
++++ b/fs/nfs/callback_proc.c |
5022 |
+@@ -430,11 +430,8 @@ static bool referring_call_exists(struct nfs_client *clp, |
5023 |
+ ((u32 *)&rclist->rcl_sessionid.data)[3], |
5024 |
+ ref->rc_sequenceid, ref->rc_slotid); |
5025 |
+ |
5026 |
+- spin_lock(&tbl->slot_tbl_lock); |
5027 |
+- status = (test_bit(ref->rc_slotid, tbl->used_slots) && |
5028 |
+- tbl->slots[ref->rc_slotid].seq_nr == |
5029 |
++ status = nfs4_slot_seqid_in_use(tbl, ref->rc_slotid, |
5030 |
+ ref->rc_sequenceid); |
5031 |
+- spin_unlock(&tbl->slot_tbl_lock); |
5032 |
+ if (status) |
5033 |
+ goto out; |
5034 |
+ } |
5035 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c |
5036 |
+index 0e8018bc9880..6da14aedde2b 100644 |
5037 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c |
5038 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c |
5039 |
+@@ -806,11 +806,14 @@ ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg, |
5040 |
+ { |
5041 |
+ struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); |
5042 |
+ struct nfs4_pnfs_ds *ds; |
5043 |
++ bool fail_return = false; |
5044 |
+ int idx; |
5045 |
+ |
5046 |
+ /* mirrors are sorted by efficiency */ |
5047 |
+ for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) { |
5048 |
+- ds = nfs4_ff_layout_prepare_ds(lseg, idx, false); |
5049 |
++ if (idx+1 == fls->mirror_array_cnt) |
5050 |
++ fail_return = true; |
5051 |
++ ds = nfs4_ff_layout_prepare_ds(lseg, idx, fail_return); |
5052 |
+ if (ds) { |
5053 |
+ *best_idx = idx; |
5054 |
+ return ds; |
5055 |
+@@ -859,6 +862,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, |
5056 |
+ struct nfs4_pnfs_ds *ds; |
5057 |
+ int ds_idx; |
5058 |
+ |
5059 |
++retry: |
5060 |
+ /* Use full layout for now */ |
5061 |
+ if (!pgio->pg_lseg) |
5062 |
+ ff_layout_pg_get_read(pgio, req, false); |
5063 |
+@@ -871,10 +875,13 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, |
5064 |
+ |
5065 |
+ ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx); |
5066 |
+ if (!ds) { |
5067 |
+- if (ff_layout_no_fallback_to_mds(pgio->pg_lseg)) |
5068 |
+- goto out_pnfs; |
5069 |
+- else |
5070 |
++ if (!ff_layout_no_fallback_to_mds(pgio->pg_lseg)) |
5071 |
+ goto out_mds; |
5072 |
++ pnfs_put_lseg(pgio->pg_lseg); |
5073 |
++ pgio->pg_lseg = NULL; |
5074 |
++ /* Sleep for 1 second before retrying */ |
5075 |
++ ssleep(1); |
5076 |
++ goto retry; |
5077 |
+ } |
5078 |
+ |
5079 |
+ mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); |
5080 |
+@@ -890,12 +897,6 @@ out_mds: |
5081 |
+ pnfs_put_lseg(pgio->pg_lseg); |
5082 |
+ pgio->pg_lseg = NULL; |
5083 |
+ nfs_pageio_reset_read_mds(pgio); |
5084 |
+- return; |
5085 |
+- |
5086 |
+-out_pnfs: |
5087 |
+- pnfs_set_lo_fail(pgio->pg_lseg); |
5088 |
+- pnfs_put_lseg(pgio->pg_lseg); |
5089 |
+- pgio->pg_lseg = NULL; |
5090 |
+ } |
5091 |
+ |
5092 |
+ static void |
5093 |
+@@ -909,6 +910,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, |
5094 |
+ int i; |
5095 |
+ int status; |
5096 |
+ |
5097 |
++retry: |
5098 |
+ if (!pgio->pg_lseg) { |
5099 |
+ pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, |
5100 |
+ req->wb_context, |
5101 |
+@@ -940,10 +942,13 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, |
5102 |
+ for (i = 0; i < pgio->pg_mirror_count; i++) { |
5103 |
+ ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true); |
5104 |
+ if (!ds) { |
5105 |
+- if (ff_layout_no_fallback_to_mds(pgio->pg_lseg)) |
5106 |
+- goto out_pnfs; |
5107 |
+- else |
5108 |
++ if (!ff_layout_no_fallback_to_mds(pgio->pg_lseg)) |
5109 |
+ goto out_mds; |
5110 |
++ pnfs_put_lseg(pgio->pg_lseg); |
5111 |
++ pgio->pg_lseg = NULL; |
5112 |
++ /* Sleep for 1 second before retrying */ |
5113 |
++ ssleep(1); |
5114 |
++ goto retry; |
5115 |
+ } |
5116 |
+ pgm = &pgio->pg_mirrors[i]; |
5117 |
+ mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); |
5118 |
+@@ -956,12 +961,6 @@ out_mds: |
5119 |
+ pnfs_put_lseg(pgio->pg_lseg); |
5120 |
+ pgio->pg_lseg = NULL; |
5121 |
+ nfs_pageio_reset_write_mds(pgio); |
5122 |
+- return; |
5123 |
+- |
5124 |
+-out_pnfs: |
5125 |
+- pnfs_set_lo_fail(pgio->pg_lseg); |
5126 |
+- pnfs_put_lseg(pgio->pg_lseg); |
5127 |
+- pgio->pg_lseg = NULL; |
5128 |
+ } |
5129 |
+ |
5130 |
+ static unsigned int |
5131 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
5132 |
+index 0aa36be71fce..ae5e15fd1258 100644 |
5133 |
+--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
5134 |
++++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
5135 |
+@@ -379,7 +379,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx, |
5136 |
+ |
5137 |
+ devid = &mirror->mirror_ds->id_node; |
5138 |
+ if (ff_layout_test_devid_unavailable(devid)) |
5139 |
+- goto out; |
5140 |
++ goto out_fail; |
5141 |
+ |
5142 |
+ ds = mirror->mirror_ds->ds; |
5143 |
+ /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ |
5144 |
+@@ -405,15 +405,16 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx, |
5145 |
+ mirror->mirror_ds->ds_versions[0].rsize = max_payload; |
5146 |
+ if (mirror->mirror_ds->ds_versions[0].wsize > max_payload) |
5147 |
+ mirror->mirror_ds->ds_versions[0].wsize = max_payload; |
5148 |
+- } else { |
5149 |
+- ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout), |
5150 |
+- mirror, lseg->pls_range.offset, |
5151 |
+- lseg->pls_range.length, NFS4ERR_NXIO, |
5152 |
+- OP_ILLEGAL, GFP_NOIO); |
5153 |
+- if (fail_return || !ff_layout_has_available_ds(lseg)) |
5154 |
+- pnfs_error_mark_layout_for_return(ino, lseg); |
5155 |
+- ds = NULL; |
5156 |
++ goto out; |
5157 |
+ } |
5158 |
++ ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout), |
5159 |
++ mirror, lseg->pls_range.offset, |
5160 |
++ lseg->pls_range.length, NFS4ERR_NXIO, |
5161 |
++ OP_ILLEGAL, GFP_NOIO); |
5162 |
++out_fail: |
5163 |
++ if (fail_return || !ff_layout_has_available_ds(lseg)) |
5164 |
++ pnfs_error_mark_layout_for_return(ino, lseg); |
5165 |
++ ds = NULL; |
5166 |
+ out: |
5167 |
+ return ds; |
5168 |
+ } |
5169 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
5170 |
+index 7796beacdefb..e2320c643107 100644 |
5171 |
+--- a/fs/nfs/nfs4proc.c |
5172 |
++++ b/fs/nfs/nfs4proc.c |
5173 |
+@@ -7509,12 +7509,20 @@ static int _nfs4_proc_create_session(struct nfs_client *clp, |
5174 |
+ status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
5175 |
+ trace_nfs4_create_session(clp, status); |
5176 |
+ |
5177 |
++ switch (status) { |
5178 |
++ case -NFS4ERR_STALE_CLIENTID: |
5179 |
++ case -NFS4ERR_DELAY: |
5180 |
++ case -ETIMEDOUT: |
5181 |
++ case -EACCES: |
5182 |
++ case -EAGAIN: |
5183 |
++ goto out; |
5184 |
++ }; |
5185 |
++ |
5186 |
++ clp->cl_seqid++; |
5187 |
+ if (!status) { |
5188 |
+ /* Verify the session's negotiated channel_attrs values */ |
5189 |
+ status = nfs4_verify_channel_attrs(&args, &res); |
5190 |
+ /* Increment the clientid slot sequence id */ |
5191 |
+- if (clp->cl_seqid == res.seqid) |
5192 |
+- clp->cl_seqid++; |
5193 |
+ if (status) |
5194 |
+ goto out; |
5195 |
+ nfs4_update_session(session, &res); |
5196 |
+diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c |
5197 |
+index 332d06e64fa9..c1f4c208f38a 100644 |
5198 |
+--- a/fs/nfs/nfs4session.c |
5199 |
++++ b/fs/nfs/nfs4session.c |
5200 |
+@@ -172,6 +172,39 @@ struct nfs4_slot *nfs4_lookup_slot(struct nfs4_slot_table *tbl, u32 slotid) |
5201 |
+ return ERR_PTR(-E2BIG); |
5202 |
+ } |
5203 |
+ |
5204 |
++static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid, |
5205 |
++ u32 *seq_nr) |
5206 |
++ __must_hold(&tbl->slot_tbl_lock) |
5207 |
++{ |
5208 |
++ struct nfs4_slot *slot; |
5209 |
++ |
5210 |
++ slot = nfs4_lookup_slot(tbl, slotid); |
5211 |
++ if (IS_ERR(slot)) |
5212 |
++ return PTR_ERR(slot); |
5213 |
++ *seq_nr = slot->seq_nr; |
5214 |
++ return 0; |
5215 |
++} |
5216 |
++ |
5217 |
++/* |
5218 |
++ * nfs4_slot_seqid_in_use - test if a slot sequence id is still in use |
5219 |
++ * |
5220 |
++ * Given a slot table, slot id and sequence number, determine if the |
5221 |
++ * RPC call in question is still in flight. This function is mainly |
5222 |
++ * intended for use by the callback channel. |
5223 |
++ */ |
5224 |
++bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl, u32 slotid, u32 seq_nr) |
5225 |
++{ |
5226 |
++ u32 cur_seq; |
5227 |
++ bool ret = false; |
5228 |
++ |
5229 |
++ spin_lock(&tbl->slot_tbl_lock); |
5230 |
++ if (nfs4_slot_get_seqid(tbl, slotid, &cur_seq) == 0 && |
5231 |
++ cur_seq == seq_nr && test_bit(slotid, tbl->used_slots)) |
5232 |
++ ret = true; |
5233 |
++ spin_unlock(&tbl->slot_tbl_lock); |
5234 |
++ return ret; |
5235 |
++} |
5236 |
++ |
5237 |
+ /* |
5238 |
+ * nfs4_alloc_slot - efficiently look for a free slot |
5239 |
+ * |
5240 |
+diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h |
5241 |
+index 5b51298d1d03..33cace62b50b 100644 |
5242 |
+--- a/fs/nfs/nfs4session.h |
5243 |
++++ b/fs/nfs/nfs4session.h |
5244 |
+@@ -78,6 +78,7 @@ extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, |
5245 |
+ extern void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl); |
5246 |
+ extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl); |
5247 |
+ extern struct nfs4_slot *nfs4_lookup_slot(struct nfs4_slot_table *tbl, u32 slotid); |
5248 |
++extern bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl, u32 slotid, u32 seq_nr); |
5249 |
+ extern bool nfs4_try_to_lock_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); |
5250 |
+ extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); |
5251 |
+ extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl); |
5252 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
5253 |
+index 7d992362ff04..229fa6139e0a 100644 |
5254 |
+--- a/fs/nfs/pnfs.c |
5255 |
++++ b/fs/nfs/pnfs.c |
5256 |
+@@ -876,6 +876,9 @@ void pnfs_clear_layoutreturn_waitbit(struct pnfs_layout_hdr *lo) |
5257 |
+ static bool |
5258 |
+ pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo) |
5259 |
+ { |
5260 |
++ /* Serialise LAYOUTGET/LAYOUTRETURN */ |
5261 |
++ if (atomic_read(&lo->plh_outstanding) != 0) |
5262 |
++ return false; |
5263 |
+ if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) |
5264 |
+ return false; |
5265 |
+ lo->plh_return_iomode = 0; |
5266 |
+@@ -1527,6 +1530,7 @@ pnfs_update_layout(struct inode *ino, |
5267 |
+ } |
5268 |
+ |
5269 |
+ lookup_again: |
5270 |
++ nfs4_client_recover_expired_lease(clp); |
5271 |
+ first = false; |
5272 |
+ spin_lock(&ino->i_lock); |
5273 |
+ lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags); |
5274 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
5275 |
+index 806eda192d1c..6a230984086b 100644 |
5276 |
+--- a/fs/nfsd/nfs4state.c |
5277 |
++++ b/fs/nfsd/nfs4state.c |
5278 |
+@@ -1200,27 +1200,6 @@ free_ol_stateid_reaplist(struct list_head *reaplist) |
5279 |
+ } |
5280 |
+ } |
5281 |
+ |
5282 |
+-static void release_lockowner(struct nfs4_lockowner *lo) |
5283 |
+-{ |
5284 |
+- struct nfs4_client *clp = lo->lo_owner.so_client; |
5285 |
+- struct nfs4_ol_stateid *stp; |
5286 |
+- struct list_head reaplist; |
5287 |
+- |
5288 |
+- INIT_LIST_HEAD(&reaplist); |
5289 |
+- |
5290 |
+- spin_lock(&clp->cl_lock); |
5291 |
+- unhash_lockowner_locked(lo); |
5292 |
+- while (!list_empty(&lo->lo_owner.so_stateids)) { |
5293 |
+- stp = list_first_entry(&lo->lo_owner.so_stateids, |
5294 |
+- struct nfs4_ol_stateid, st_perstateowner); |
5295 |
+- WARN_ON(!unhash_lock_stateid(stp)); |
5296 |
+- put_ol_stateid_locked(stp, &reaplist); |
5297 |
+- } |
5298 |
+- spin_unlock(&clp->cl_lock); |
5299 |
+- free_ol_stateid_reaplist(&reaplist); |
5300 |
+- nfs4_put_stateowner(&lo->lo_owner); |
5301 |
+-} |
5302 |
+- |
5303 |
+ static void release_open_stateid_locks(struct nfs4_ol_stateid *open_stp, |
5304 |
+ struct list_head *reaplist) |
5305 |
+ { |
5306 |
+@@ -5976,6 +5955,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, |
5307 |
+ __be32 status; |
5308 |
+ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); |
5309 |
+ struct nfs4_client *clp; |
5310 |
++ LIST_HEAD (reaplist); |
5311 |
+ |
5312 |
+ dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", |
5313 |
+ clid->cl_boot, clid->cl_id); |
5314 |
+@@ -6006,9 +5986,23 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, |
5315 |
+ nfs4_get_stateowner(sop); |
5316 |
+ break; |
5317 |
+ } |
5318 |
++ if (!lo) { |
5319 |
++ spin_unlock(&clp->cl_lock); |
5320 |
++ return status; |
5321 |
++ } |
5322 |
++ |
5323 |
++ unhash_lockowner_locked(lo); |
5324 |
++ while (!list_empty(&lo->lo_owner.so_stateids)) { |
5325 |
++ stp = list_first_entry(&lo->lo_owner.so_stateids, |
5326 |
++ struct nfs4_ol_stateid, |
5327 |
++ st_perstateowner); |
5328 |
++ WARN_ON(!unhash_lock_stateid(stp)); |
5329 |
++ put_ol_stateid_locked(stp, &reaplist); |
5330 |
++ } |
5331 |
+ spin_unlock(&clp->cl_lock); |
5332 |
+- if (lo) |
5333 |
+- release_lockowner(lo); |
5334 |
++ free_ol_stateid_reaplist(&reaplist); |
5335 |
++ nfs4_put_stateowner(&lo->lo_owner); |
5336 |
++ |
5337 |
+ return status; |
5338 |
+ } |
5339 |
+ |
5340 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
5341 |
+index a11eb7196ec8..7583df74d0c8 100644 |
5342 |
+--- a/fs/proc/base.c |
5343 |
++++ b/fs/proc/base.c |
5344 |
+@@ -1552,18 +1552,13 @@ static const struct file_operations proc_pid_set_comm_operations = { |
5345 |
+ static int proc_exe_link(struct dentry *dentry, struct path *exe_path) |
5346 |
+ { |
5347 |
+ struct task_struct *task; |
5348 |
+- struct mm_struct *mm; |
5349 |
+ struct file *exe_file; |
5350 |
+ |
5351 |
+ task = get_proc_task(d_inode(dentry)); |
5352 |
+ if (!task) |
5353 |
+ return -ENOENT; |
5354 |
+- mm = get_task_mm(task); |
5355 |
++ exe_file = get_task_exe_file(task); |
5356 |
+ put_task_struct(task); |
5357 |
+- if (!mm) |
5358 |
+- return -ENOENT; |
5359 |
+- exe_file = get_mm_exe_file(mm); |
5360 |
+- mmput(mm); |
5361 |
+ if (exe_file) { |
5362 |
+ *exe_path = exe_file->f_path; |
5363 |
+ path_get(&exe_file->f_path); |
5364 |
+diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h |
5365 |
+index 1bfa602958f2..32901d11f8c4 100644 |
5366 |
+--- a/include/asm-generic/uaccess.h |
5367 |
++++ b/include/asm-generic/uaccess.h |
5368 |
+@@ -230,14 +230,18 @@ extern int __put_user_bad(void) __attribute__((noreturn)); |
5369 |
+ might_fault(); \ |
5370 |
+ access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ |
5371 |
+ __get_user((x), (__typeof__(*(ptr)) *)__p) : \ |
5372 |
+- -EFAULT; \ |
5373 |
++ ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ |
5374 |
+ }) |
5375 |
+ |
5376 |
+ #ifndef __get_user_fn |
5377 |
+ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) |
5378 |
+ { |
5379 |
+- size = __copy_from_user(x, ptr, size); |
5380 |
+- return size ? -EFAULT : size; |
5381 |
++ size_t n = __copy_from_user(x, ptr, size); |
5382 |
++ if (unlikely(n)) { |
5383 |
++ memset(x + (size - n), 0, n); |
5384 |
++ return -EFAULT; |
5385 |
++ } |
5386 |
++ return 0; |
5387 |
+ } |
5388 |
+ |
5389 |
+ #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) |
5390 |
+@@ -257,11 +261,13 @@ extern int __get_user_bad(void) __attribute__((noreturn)); |
5391 |
+ static inline long copy_from_user(void *to, |
5392 |
+ const void __user * from, unsigned long n) |
5393 |
+ { |
5394 |
++ unsigned long res = n; |
5395 |
+ might_fault(); |
5396 |
+- if (access_ok(VERIFY_READ, from, n)) |
5397 |
+- return __copy_from_user(to, from, n); |
5398 |
+- else |
5399 |
+- return n; |
5400 |
++ if (likely(access_ok(VERIFY_READ, from, n))) |
5401 |
++ res = __copy_from_user(to, from, n); |
5402 |
++ if (unlikely(res)) |
5403 |
++ memset(to + (n - res), 0, res); |
5404 |
++ return res; |
5405 |
+ } |
5406 |
+ |
5407 |
+ static inline long copy_to_user(void __user *to, |
5408 |
+diff --git a/include/linux/efi.h b/include/linux/efi.h |
5409 |
+index f196dd0b0f2f..17fd2c5bf81f 100644 |
5410 |
+--- a/include/linux/efi.h |
5411 |
++++ b/include/linux/efi.h |
5412 |
+@@ -118,6 +118,15 @@ typedef struct { |
5413 |
+ u32 imagesize; |
5414 |
+ } efi_capsule_header_t; |
5415 |
+ |
5416 |
++struct efi_boot_memmap { |
5417 |
++ efi_memory_desc_t **map; |
5418 |
++ unsigned long *map_size; |
5419 |
++ unsigned long *desc_size; |
5420 |
++ u32 *desc_ver; |
5421 |
++ unsigned long *key_ptr; |
5422 |
++ unsigned long *buff_size; |
5423 |
++}; |
5424 |
++ |
5425 |
+ /* |
5426 |
+ * EFI capsule flags |
5427 |
+ */ |
5428 |
+@@ -1005,7 +1014,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm, |
5429 |
+ /* Iterate through an efi_memory_map */ |
5430 |
+ #define for_each_efi_memory_desc_in_map(m, md) \ |
5431 |
+ for ((md) = (m)->map; \ |
5432 |
+- ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ |
5433 |
++ (md) && ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ |
5434 |
+ (md) = (void *)(md) + (m)->desc_size) |
5435 |
+ |
5436 |
+ /** |
5437 |
+@@ -1430,11 +1439,7 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, |
5438 |
+ efi_loaded_image_t *image, int *cmd_line_len); |
5439 |
+ |
5440 |
+ efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
5441 |
+- efi_memory_desc_t **map, |
5442 |
+- unsigned long *map_size, |
5443 |
+- unsigned long *desc_size, |
5444 |
+- u32 *desc_ver, |
5445 |
+- unsigned long *key_ptr); |
5446 |
++ struct efi_boot_memmap *map); |
5447 |
+ |
5448 |
+ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, |
5449 |
+ unsigned long size, unsigned long align, |
5450 |
+@@ -1465,4 +1470,15 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, |
5451 |
+ unsigned long size); |
5452 |
+ |
5453 |
+ bool efi_runtime_disabled(void); |
5454 |
++ |
5455 |
++typedef efi_status_t (*efi_exit_boot_map_processing)( |
5456 |
++ efi_system_table_t *sys_table_arg, |
5457 |
++ struct efi_boot_memmap *map, |
5458 |
++ void *priv); |
5459 |
++ |
5460 |
++efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table, |
5461 |
++ void *handle, |
5462 |
++ struct efi_boot_memmap *map, |
5463 |
++ void *priv, |
5464 |
++ efi_exit_boot_map_processing priv_func); |
5465 |
+ #endif /* _LINUX_EFI_H */ |
5466 |
+diff --git a/include/linux/iio/sw_trigger.h b/include/linux/iio/sw_trigger.h |
5467 |
+index 5198f8ed08a4..c97eab67558f 100644 |
5468 |
+--- a/include/linux/iio/sw_trigger.h |
5469 |
++++ b/include/linux/iio/sw_trigger.h |
5470 |
+@@ -62,7 +62,7 @@ void iio_swt_group_init_type_name(struct iio_sw_trigger *t, |
5471 |
+ const char *name, |
5472 |
+ struct config_item_type *type) |
5473 |
+ { |
5474 |
+-#ifdef CONFIG_CONFIGFS_FS |
5475 |
++#if IS_ENABLED(CONFIG_CONFIGFS_FS) |
5476 |
+ config_group_init_type_name(&t->group, name, type); |
5477 |
+ #endif |
5478 |
+ } |
5479 |
+diff --git a/include/linux/irq.h b/include/linux/irq.h |
5480 |
+index 4d758a7c604a..cbb5a2c5dcb0 100644 |
5481 |
+--- a/include/linux/irq.h |
5482 |
++++ b/include/linux/irq.h |
5483 |
+@@ -933,6 +933,16 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { } |
5484 |
+ static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } |
5485 |
+ #endif |
5486 |
+ |
5487 |
++/* |
5488 |
++ * The irqsave variants are for usage in non interrupt code. Do not use |
5489 |
++ * them in irq_chip callbacks. Use irq_gc_lock() instead. |
5490 |
++ */ |
5491 |
++#define irq_gc_lock_irqsave(gc, flags) \ |
5492 |
++ raw_spin_lock_irqsave(&(gc)->lock, flags) |
5493 |
++ |
5494 |
++#define irq_gc_unlock_irqrestore(gc, flags) \ |
5495 |
++ raw_spin_unlock_irqrestore(&(gc)->lock, flags) |
5496 |
++ |
5497 |
+ static inline void irq_reg_writel(struct irq_chip_generic *gc, |
5498 |
+ u32 val, int reg_offset) |
5499 |
+ { |
5500 |
+diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h |
5501 |
+index 4429d255c8ab..5e5b2969d931 100644 |
5502 |
+--- a/include/linux/mempolicy.h |
5503 |
++++ b/include/linux/mempolicy.h |
5504 |
+@@ -195,6 +195,7 @@ static inline bool vma_migratable(struct vm_area_struct *vma) |
5505 |
+ } |
5506 |
+ |
5507 |
+ extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long); |
5508 |
++extern void mpol_put_task_policy(struct task_struct *); |
5509 |
+ |
5510 |
+ #else |
5511 |
+ |
5512 |
+@@ -297,5 +298,8 @@ static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma, |
5513 |
+ return -1; /* no node preference */ |
5514 |
+ } |
5515 |
+ |
5516 |
++static inline void mpol_put_task_policy(struct task_struct *task) |
5517 |
++{ |
5518 |
++} |
5519 |
+ #endif /* CONFIG_NUMA */ |
5520 |
+ #endif |
5521 |
+diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h |
5522 |
+index 1fd50dcfe47c..175c82699e9d 100644 |
5523 |
+--- a/include/linux/mfd/ti_am335x_tscadc.h |
5524 |
++++ b/include/linux/mfd/ti_am335x_tscadc.h |
5525 |
+@@ -138,16 +138,16 @@ |
5526 |
+ /* |
5527 |
+ * time in us for processing a single channel, calculated as follows: |
5528 |
+ * |
5529 |
+- * num cycles = open delay + (sample delay + conv time) * averaging |
5530 |
++ * max num cycles = open delay + (sample delay + conv time) * averaging |
5531 |
+ * |
5532 |
+- * num cycles: 152 + (1 + 13) * 16 = 376 |
5533 |
++ * max num cycles: 262143 + (255 + 13) * 16 = 266431 |
5534 |
+ * |
5535 |
+ * clock frequency: 26MHz / 8 = 3.25MHz |
5536 |
+ * clock period: 1 / 3.25MHz = 308ns |
5537 |
+ * |
5538 |
+- * processing time: 376 * 308ns = 116us |
5539 |
++ * max processing time: 266431 * 308ns = 83ms(approx) |
5540 |
+ */ |
5541 |
+-#define IDLE_TIMEOUT 116 /* microsec */ |
5542 |
++#define IDLE_TIMEOUT 83 /* milliseconds */ |
5543 |
+ |
5544 |
+ #define TSCADC_CELLS 2 |
5545 |
+ |
5546 |
+diff --git a/include/linux/mm.h b/include/linux/mm.h |
5547 |
+index ece042dfe23c..317564b11dc7 100644 |
5548 |
+--- a/include/linux/mm.h |
5549 |
++++ b/include/linux/mm.h |
5550 |
+@@ -1975,6 +1975,7 @@ extern void mm_drop_all_locks(struct mm_struct *mm); |
5551 |
+ |
5552 |
+ extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); |
5553 |
+ extern struct file *get_mm_exe_file(struct mm_struct *mm); |
5554 |
++extern struct file *get_task_exe_file(struct task_struct *task); |
5555 |
+ |
5556 |
+ extern bool may_expand_vm(struct mm_struct *, vm_flags_t, unsigned long npages); |
5557 |
+ extern void vm_stat_account(struct mm_struct *, vm_flags_t, long npages); |
5558 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
5559 |
+index da4b33bea982..4f0e6fb39a36 100644 |
5560 |
+--- a/include/linux/netdevice.h |
5561 |
++++ b/include/linux/netdevice.h |
5562 |
+@@ -3225,6 +3225,7 @@ static inline void napi_free_frags(struct napi_struct *napi) |
5563 |
+ napi->skb = NULL; |
5564 |
+ } |
5565 |
+ |
5566 |
++bool netdev_is_rx_handler_busy(struct net_device *dev); |
5567 |
+ int netdev_rx_handler_register(struct net_device *dev, |
5568 |
+ rx_handler_func_t *rx_handler, |
5569 |
+ void *rx_handler_data); |
5570 |
+diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h |
5571 |
+index 76199b75d584..e302c447e057 100644 |
5572 |
+--- a/include/linux/smc91x.h |
5573 |
++++ b/include/linux/smc91x.h |
5574 |
+@@ -1,6 +1,16 @@ |
5575 |
+ #ifndef __SMC91X_H__ |
5576 |
+ #define __SMC91X_H__ |
5577 |
+ |
5578 |
++/* |
5579 |
++ * These bits define which access sizes a platform can support, rather |
5580 |
++ * than the maximal access size. So, if your platform can do 16-bit |
5581 |
++ * and 32-bit accesses to the SMC91x device, but not 8-bit, set both |
5582 |
++ * SMC91X_USE_16BIT and SMC91X_USE_32BIT. |
5583 |
++ * |
5584 |
++ * The SMC91x driver requires at least one of SMC91X_USE_8BIT or |
5585 |
++ * SMC91X_USE_16BIT to be supported - just setting SMC91X_USE_32BIT is |
5586 |
++ * an invalid configuration. |
5587 |
++ */ |
5588 |
+ #define SMC91X_USE_8BIT (1 << 0) |
5589 |
+ #define SMC91X_USE_16BIT (1 << 1) |
5590 |
+ #define SMC91X_USE_32BIT (1 << 2) |
5591 |
+diff --git a/include/linux/uio.h b/include/linux/uio.h |
5592 |
+index 1b5d1cd796e2..75b4aaf31a9d 100644 |
5593 |
+--- a/include/linux/uio.h |
5594 |
++++ b/include/linux/uio.h |
5595 |
+@@ -76,7 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, |
5596 |
+ struct iov_iter *i, unsigned long offset, size_t bytes); |
5597 |
+ void iov_iter_advance(struct iov_iter *i, size_t bytes); |
5598 |
+ int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); |
5599 |
+-int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes); |
5600 |
++#define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable |
5601 |
+ size_t iov_iter_single_seg_count(const struct iov_iter *i); |
5602 |
+ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, |
5603 |
+ struct iov_iter *i); |
5604 |
+diff --git a/include/net/af_unix.h b/include/net/af_unix.h |
5605 |
+index 9b4c418bebd8..fd60eccb59a6 100644 |
5606 |
+--- a/include/net/af_unix.h |
5607 |
++++ b/include/net/af_unix.h |
5608 |
+@@ -52,7 +52,7 @@ struct unix_sock { |
5609 |
+ struct sock sk; |
5610 |
+ struct unix_address *addr; |
5611 |
+ struct path path; |
5612 |
+- struct mutex readlock; |
5613 |
++ struct mutex iolock, bindlock; |
5614 |
+ struct sock *peer; |
5615 |
+ struct list_head link; |
5616 |
+ atomic_long_t inflight; |
5617 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
5618 |
+index 0bcc70f4e1fb..725405170f0e 100644 |
5619 |
+--- a/include/net/tcp.h |
5620 |
++++ b/include/net/tcp.h |
5621 |
+@@ -1522,6 +1522,8 @@ static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unli |
5622 |
+ { |
5623 |
+ if (sk->sk_send_head == skb_unlinked) |
5624 |
+ sk->sk_send_head = NULL; |
5625 |
++ if (tcp_sk(sk)->highest_sack == skb_unlinked) |
5626 |
++ tcp_sk(sk)->highest_sack = NULL; |
5627 |
+ } |
5628 |
+ |
5629 |
+ static inline void tcp_init_send_head(struct sock *sk) |
5630 |
+diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c |
5631 |
+index d6709eb70970..0d302a87f21b 100644 |
5632 |
+--- a/kernel/audit_watch.c |
5633 |
++++ b/kernel/audit_watch.c |
5634 |
+@@ -19,6 +19,7 @@ |
5635 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
5636 |
+ */ |
5637 |
+ |
5638 |
++#include <linux/file.h> |
5639 |
+ #include <linux/kernel.h> |
5640 |
+ #include <linux/audit.h> |
5641 |
+ #include <linux/kthread.h> |
5642 |
+@@ -544,10 +545,11 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark) |
5643 |
+ unsigned long ino; |
5644 |
+ dev_t dev; |
5645 |
+ |
5646 |
+- rcu_read_lock(); |
5647 |
+- exe_file = rcu_dereference(tsk->mm->exe_file); |
5648 |
++ exe_file = get_task_exe_file(tsk); |
5649 |
++ if (!exe_file) |
5650 |
++ return 0; |
5651 |
+ ino = exe_file->f_inode->i_ino; |
5652 |
+ dev = exe_file->f_inode->i_sb->s_dev; |
5653 |
+- rcu_read_unlock(); |
5654 |
++ fput(exe_file); |
5655 |
+ return audit_mark_compare(mark, ino, dev); |
5656 |
+ } |
5657 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
5658 |
+index eec9f90ba030..6d011c693f67 100644 |
5659 |
+--- a/kernel/bpf/verifier.c |
5660 |
++++ b/kernel/bpf/verifier.c |
5661 |
+@@ -194,6 +194,7 @@ struct verifier_env { |
5662 |
+ struct verifier_state_list **explored_states; /* search pruning optimization */ |
5663 |
+ struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */ |
5664 |
+ u32 used_map_cnt; /* number of used maps */ |
5665 |
++ u32 id_gen; /* used to generate unique reg IDs */ |
5666 |
+ bool allow_ptr_leaks; |
5667 |
+ }; |
5668 |
+ |
5669 |
+@@ -1277,7 +1278,7 @@ add_imm: |
5670 |
+ /* dst_reg stays as pkt_ptr type and since some positive |
5671 |
+ * integer value was added to the pointer, increment its 'id' |
5672 |
+ */ |
5673 |
+- dst_reg->id++; |
5674 |
++ dst_reg->id = ++env->id_gen; |
5675 |
+ |
5676 |
+ /* something was added to pkt_ptr, set range and off to zero */ |
5677 |
+ dst_reg->off = 0; |
5678 |
+diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config |
5679 |
+index c2de56ab0fce..7fa0c4ae6394 100644 |
5680 |
+--- a/kernel/configs/tiny.config |
5681 |
++++ b/kernel/configs/tiny.config |
5682 |
+@@ -1,4 +1,12 @@ |
5683 |
++# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set |
5684 |
+ CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
5685 |
++# CONFIG_KERNEL_GZIP is not set |
5686 |
++# CONFIG_KERNEL_BZIP2 is not set |
5687 |
++# CONFIG_KERNEL_LZMA is not set |
5688 |
+ CONFIG_KERNEL_XZ=y |
5689 |
++# CONFIG_KERNEL_LZO is not set |
5690 |
++# CONFIG_KERNEL_LZ4 is not set |
5691 |
+ CONFIG_OPTIMIZE_INLINING=y |
5692 |
++# CONFIG_SLAB is not set |
5693 |
++# CONFIG_SLUB is not set |
5694 |
+ CONFIG_SLOB=y |
5695 |
+diff --git a/kernel/cpuset.c b/kernel/cpuset.c |
5696 |
+index 73e93e53884d..40b6ed559448 100644 |
5697 |
+--- a/kernel/cpuset.c |
5698 |
++++ b/kernel/cpuset.c |
5699 |
+@@ -2078,6 +2078,20 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) |
5700 |
+ mutex_unlock(&cpuset_mutex); |
5701 |
+ } |
5702 |
+ |
5703 |
++/* |
5704 |
++ * Make sure the new task conform to the current state of its parent, |
5705 |
++ * which could have been changed by cpuset just after it inherits the |
5706 |
++ * state from the parent and before it sits on the cgroup's task list. |
5707 |
++ */ |
5708 |
++void cpuset_fork(struct task_struct *task) |
5709 |
++{ |
5710 |
++ if (task_css_is_root(task, cpuset_cgrp_id)) |
5711 |
++ return; |
5712 |
++ |
5713 |
++ set_cpus_allowed_ptr(task, ¤t->cpus_allowed); |
5714 |
++ task->mems_allowed = current->mems_allowed; |
5715 |
++} |
5716 |
++ |
5717 |
+ struct cgroup_subsys cpuset_cgrp_subsys = { |
5718 |
+ .css_alloc = cpuset_css_alloc, |
5719 |
+ .css_online = cpuset_css_online, |
5720 |
+@@ -2088,6 +2102,7 @@ struct cgroup_subsys cpuset_cgrp_subsys = { |
5721 |
+ .attach = cpuset_attach, |
5722 |
+ .post_attach = cpuset_post_attach, |
5723 |
+ .bind = cpuset_bind, |
5724 |
++ .fork = cpuset_fork, |
5725 |
+ .legacy_cftypes = files, |
5726 |
+ .early_init = true, |
5727 |
+ }; |
5728 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
5729 |
+index 9e6e1356e6bb..26a766a7e07e 100644 |
5730 |
+--- a/kernel/exit.c |
5731 |
++++ b/kernel/exit.c |
5732 |
+@@ -768,12 +768,7 @@ void do_exit(long code) |
5733 |
+ TASKS_RCU(preempt_enable()); |
5734 |
+ exit_notify(tsk, group_dead); |
5735 |
+ proc_exit_connector(tsk); |
5736 |
+-#ifdef CONFIG_NUMA |
5737 |
+- task_lock(tsk); |
5738 |
+- mpol_put(tsk->mempolicy); |
5739 |
+- tsk->mempolicy = NULL; |
5740 |
+- task_unlock(tsk); |
5741 |
+-#endif |
5742 |
++ mpol_put_task_policy(tsk); |
5743 |
+ #ifdef CONFIG_FUTEX |
5744 |
+ if (unlikely(current->pi_state_cache)) |
5745 |
+ kfree(current->pi_state_cache); |
5746 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
5747 |
+index aea4f4da3836..74fd39079031 100644 |
5748 |
+--- a/kernel/fork.c |
5749 |
++++ b/kernel/fork.c |
5750 |
+@@ -801,6 +801,29 @@ struct file *get_mm_exe_file(struct mm_struct *mm) |
5751 |
+ EXPORT_SYMBOL(get_mm_exe_file); |
5752 |
+ |
5753 |
+ /** |
5754 |
++ * get_task_exe_file - acquire a reference to the task's executable file |
5755 |
++ * |
5756 |
++ * Returns %NULL if task's mm (if any) has no associated executable file or |
5757 |
++ * this is a kernel thread with borrowed mm (see the comment above get_task_mm). |
5758 |
++ * User must release file via fput(). |
5759 |
++ */ |
5760 |
++struct file *get_task_exe_file(struct task_struct *task) |
5761 |
++{ |
5762 |
++ struct file *exe_file = NULL; |
5763 |
++ struct mm_struct *mm; |
5764 |
++ |
5765 |
++ task_lock(task); |
5766 |
++ mm = task->mm; |
5767 |
++ if (mm) { |
5768 |
++ if (!(task->flags & PF_KTHREAD)) |
5769 |
++ exe_file = get_mm_exe_file(mm); |
5770 |
++ } |
5771 |
++ task_unlock(task); |
5772 |
++ return exe_file; |
5773 |
++} |
5774 |
++EXPORT_SYMBOL(get_task_exe_file); |
5775 |
++ |
5776 |
++/** |
5777 |
+ * get_task_mm - acquire a reference to the task's mm |
5778 |
+ * |
5779 |
+ * Returns %NULL if the task has no mm. Checks PF_KTHREAD (meaning |
5780 |
+diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c |
5781 |
+index 0afe671f1770..6143b2f64b95 100644 |
5782 |
+--- a/kernel/irq/msi.c |
5783 |
++++ b/kernel/irq/msi.c |
5784 |
+@@ -352,6 +352,7 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, |
5785 |
+ ops->msi_finish(&arg, 0); |
5786 |
+ |
5787 |
+ for_each_msi_entry(desc, dev) { |
5788 |
++ virq = desc->irq; |
5789 |
+ if (desc->nvec_used == 1) |
5790 |
+ dev_dbg(dev, "irq %d for MSI\n", virq); |
5791 |
+ else |
5792 |
+diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c |
5793 |
+index 503bc2d348e5..037c321c5618 100644 |
5794 |
+--- a/kernel/kexec_file.c |
5795 |
++++ b/kernel/kexec_file.c |
5796 |
+@@ -887,7 +887,10 @@ int kexec_load_purgatory(struct kimage *image, unsigned long min, |
5797 |
+ return 0; |
5798 |
+ out: |
5799 |
+ vfree(pi->sechdrs); |
5800 |
++ pi->sechdrs = NULL; |
5801 |
++ |
5802 |
+ vfree(pi->purgatory_buf); |
5803 |
++ pi->purgatory_buf = NULL; |
5804 |
+ return ret; |
5805 |
+ } |
5806 |
+ |
5807 |
+diff --git a/kernel/memremap.c b/kernel/memremap.c |
5808 |
+index 017532193fb1..c2eb3a057764 100644 |
5809 |
+--- a/kernel/memremap.c |
5810 |
++++ b/kernel/memremap.c |
5811 |
+@@ -253,6 +253,7 @@ static void devm_memremap_pages_release(struct device *dev, void *data) |
5812 |
+ align_start = res->start & ~(SECTION_SIZE - 1); |
5813 |
+ align_size = ALIGN(resource_size(res), SECTION_SIZE); |
5814 |
+ arch_remove_memory(align_start, align_size); |
5815 |
++ untrack_pfn(NULL, PHYS_PFN(align_start), align_size); |
5816 |
+ pgmap_radix_release(res); |
5817 |
+ dev_WARN_ONCE(dev, pgmap->altmap && pgmap->altmap->alloc, |
5818 |
+ "%s: failed to free all reserved pages\n", __func__); |
5819 |
+@@ -288,6 +289,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, |
5820 |
+ struct percpu_ref *ref, struct vmem_altmap *altmap) |
5821 |
+ { |
5822 |
+ resource_size_t key, align_start, align_size, align_end; |
5823 |
++ pgprot_t pgprot = PAGE_KERNEL; |
5824 |
+ struct dev_pagemap *pgmap; |
5825 |
+ struct page_map *page_map; |
5826 |
+ int error, nid, is_ram; |
5827 |
+@@ -363,6 +365,11 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, |
5828 |
+ if (nid < 0) |
5829 |
+ nid = numa_mem_id(); |
5830 |
+ |
5831 |
++ error = track_pfn_remap(NULL, &pgprot, PHYS_PFN(align_start), 0, |
5832 |
++ align_size); |
5833 |
++ if (error) |
5834 |
++ goto err_pfn_remap; |
5835 |
++ |
5836 |
+ error = arch_add_memory(nid, align_start, align_size, true); |
5837 |
+ if (error) |
5838 |
+ goto err_add_memory; |
5839 |
+@@ -383,6 +390,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, |
5840 |
+ return __va(res->start); |
5841 |
+ |
5842 |
+ err_add_memory: |
5843 |
++ untrack_pfn(NULL, PHYS_PFN(align_start), align_size); |
5844 |
++ err_pfn_remap: |
5845 |
+ err_radix: |
5846 |
+ pgmap_radix_release(res); |
5847 |
+ devres_free(page_map); |
5848 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
5849 |
+index 97ee9ac7e97c..38eacc323fdd 100644 |
5850 |
+--- a/kernel/sched/core.c |
5851 |
++++ b/kernel/sched/core.c |
5852 |
+@@ -2015,6 +2015,28 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) |
5853 |
+ success = 1; /* we're going to change ->state */ |
5854 |
+ cpu = task_cpu(p); |
5855 |
+ |
5856 |
++ /* |
5857 |
++ * Ensure we load p->on_rq _after_ p->state, otherwise it would |
5858 |
++ * be possible to, falsely, observe p->on_rq == 0 and get stuck |
5859 |
++ * in smp_cond_load_acquire() below. |
5860 |
++ * |
5861 |
++ * sched_ttwu_pending() try_to_wake_up() |
5862 |
++ * [S] p->on_rq = 1; [L] P->state |
5863 |
++ * UNLOCK rq->lock -----. |
5864 |
++ * \ |
5865 |
++ * +--- RMB |
5866 |
++ * schedule() / |
5867 |
++ * LOCK rq->lock -----' |
5868 |
++ * UNLOCK rq->lock |
5869 |
++ * |
5870 |
++ * [task p] |
5871 |
++ * [S] p->state = UNINTERRUPTIBLE [L] p->on_rq |
5872 |
++ * |
5873 |
++ * Pairs with the UNLOCK+LOCK on rq->lock from the |
5874 |
++ * last wakeup of our task and the schedule that got our task |
5875 |
++ * current. |
5876 |
++ */ |
5877 |
++ smp_rmb(); |
5878 |
+ if (p->on_rq && ttwu_remote(p, wake_flags)) |
5879 |
+ goto stat; |
5880 |
+ |
5881 |
+diff --git a/lib/iov_iter.c b/lib/iov_iter.c |
5882 |
+index 0cd522753ff5..eaaf73032441 100644 |
5883 |
+--- a/lib/iov_iter.c |
5884 |
++++ b/lib/iov_iter.c |
5885 |
+@@ -302,33 +302,13 @@ done: |
5886 |
+ } |
5887 |
+ |
5888 |
+ /* |
5889 |
+- * Fault in the first iovec of the given iov_iter, to a maximum length |
5890 |
+- * of bytes. Returns 0 on success, or non-zero if the memory could not be |
5891 |
+- * accessed (ie. because it is an invalid address). |
5892 |
+- * |
5893 |
+- * writev-intensive code may want this to prefault several iovecs -- that |
5894 |
+- * would be possible (callers must not rely on the fact that _only_ the |
5895 |
+- * first iovec will be faulted with the current implementation). |
5896 |
+- */ |
5897 |
+-int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
5898 |
+-{ |
5899 |
+- if (!(i->type & (ITER_BVEC|ITER_KVEC))) { |
5900 |
+- char __user *buf = i->iov->iov_base + i->iov_offset; |
5901 |
+- bytes = min(bytes, i->iov->iov_len - i->iov_offset); |
5902 |
+- return fault_in_pages_readable(buf, bytes); |
5903 |
+- } |
5904 |
+- return 0; |
5905 |
+-} |
5906 |
+-EXPORT_SYMBOL(iov_iter_fault_in_readable); |
5907 |
+- |
5908 |
+-/* |
5909 |
+ * Fault in one or more iovecs of the given iov_iter, to a maximum length of |
5910 |
+ * bytes. For each iovec, fault in each page that constitutes the iovec. |
5911 |
+ * |
5912 |
+ * Return 0 on success, or non-zero if the memory could not be accessed (i.e. |
5913 |
+ * because it is an invalid address). |
5914 |
+ */ |
5915 |
+-int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) |
5916 |
++int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
5917 |
+ { |
5918 |
+ size_t skip = i->iov_offset; |
5919 |
+ const struct iovec *iov; |
5920 |
+@@ -345,7 +325,7 @@ int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) |
5921 |
+ } |
5922 |
+ return 0; |
5923 |
+ } |
5924 |
+-EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable); |
5925 |
++EXPORT_SYMBOL(iov_iter_fault_in_readable); |
5926 |
+ |
5927 |
+ void iov_iter_init(struct iov_iter *i, int direction, |
5928 |
+ const struct iovec *iov, unsigned long nr_segs, |
5929 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
5930 |
+index 297d6854f849..e682861215b0 100644 |
5931 |
+--- a/mm/mempolicy.c |
5932 |
++++ b/mm/mempolicy.c |
5933 |
+@@ -2334,6 +2334,23 @@ out: |
5934 |
+ return ret; |
5935 |
+ } |
5936 |
+ |
5937 |
++/* |
5938 |
++ * Drop the (possibly final) reference to task->mempolicy. It needs to be |
5939 |
++ * dropped after task->mempolicy is set to NULL so that any allocation done as |
5940 |
++ * part of its kmem_cache_free(), such as by KASAN, doesn't reference a freed |
5941 |
++ * policy. |
5942 |
++ */ |
5943 |
++void mpol_put_task_policy(struct task_struct *task) |
5944 |
++{ |
5945 |
++ struct mempolicy *pol; |
5946 |
++ |
5947 |
++ task_lock(task); |
5948 |
++ pol = task->mempolicy; |
5949 |
++ task->mempolicy = NULL; |
5950 |
++ task_unlock(task); |
5951 |
++ mpol_put(pol); |
5952 |
++} |
5953 |
++ |
5954 |
+ static void sp_delete(struct shared_policy *sp, struct sp_node *n) |
5955 |
+ { |
5956 |
+ pr_debug("deleting %lx-l%lx\n", n->start, n->end); |
5957 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
5958 |
+index 8b3e1341b754..6e354199151b 100644 |
5959 |
+--- a/mm/page_alloc.c |
5960 |
++++ b/mm/page_alloc.c |
5961 |
+@@ -3254,53 +3254,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, |
5962 |
+ return NULL; |
5963 |
+ } |
5964 |
+ |
5965 |
+-static inline bool |
5966 |
+-should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, |
5967 |
+- enum compact_result compact_result, enum migrate_mode *migrate_mode, |
5968 |
+- int compaction_retries) |
5969 |
+-{ |
5970 |
+- int max_retries = MAX_COMPACT_RETRIES; |
5971 |
+- |
5972 |
+- if (!order) |
5973 |
+- return false; |
5974 |
+- |
5975 |
+- /* |
5976 |
+- * compaction considers all the zone as desperately out of memory |
5977 |
+- * so it doesn't really make much sense to retry except when the |
5978 |
+- * failure could be caused by weak migration mode. |
5979 |
+- */ |
5980 |
+- if (compaction_failed(compact_result)) { |
5981 |
+- if (*migrate_mode == MIGRATE_ASYNC) { |
5982 |
+- *migrate_mode = MIGRATE_SYNC_LIGHT; |
5983 |
+- return true; |
5984 |
+- } |
5985 |
+- return false; |
5986 |
+- } |
5987 |
+- |
5988 |
+- /* |
5989 |
+- * make sure the compaction wasn't deferred or didn't bail out early |
5990 |
+- * due to locks contention before we declare that we should give up. |
5991 |
+- * But do not retry if the given zonelist is not suitable for |
5992 |
+- * compaction. |
5993 |
+- */ |
5994 |
+- if (compaction_withdrawn(compact_result)) |
5995 |
+- return compaction_zonelist_suitable(ac, order, alloc_flags); |
5996 |
+- |
5997 |
+- /* |
5998 |
+- * !costly requests are much more important than __GFP_REPEAT |
5999 |
+- * costly ones because they are de facto nofail and invoke OOM |
6000 |
+- * killer to move on while costly can fail and users are ready |
6001 |
+- * to cope with that. 1/4 retries is rather arbitrary but we |
6002 |
+- * would need much more detailed feedback from compaction to |
6003 |
+- * make a better decision. |
6004 |
+- */ |
6005 |
+- if (order > PAGE_ALLOC_COSTLY_ORDER) |
6006 |
+- max_retries /= 4; |
6007 |
+- if (compaction_retries <= max_retries) |
6008 |
+- return true; |
6009 |
+- |
6010 |
+- return false; |
6011 |
+-} |
6012 |
+ #else |
6013 |
+ static inline struct page * |
6014 |
+ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, |
6015 |
+@@ -3311,6 +3264,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, |
6016 |
+ return NULL; |
6017 |
+ } |
6018 |
+ |
6019 |
++#endif /* CONFIG_COMPACTION */ |
6020 |
++ |
6021 |
+ static inline bool |
6022 |
+ should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, |
6023 |
+ enum compact_result compact_result, |
6024 |
+@@ -3337,7 +3292,6 @@ should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_fla |
6025 |
+ } |
6026 |
+ return false; |
6027 |
+ } |
6028 |
+-#endif /* CONFIG_COMPACTION */ |
6029 |
+ |
6030 |
+ /* Perform direct synchronous page reclaim */ |
6031 |
+ static int |
6032 |
+diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c |
6033 |
+index 43844144c9c4..d3abdaefe392 100644 |
6034 |
+--- a/net/bridge/br_multicast.c |
6035 |
++++ b/net/bridge/br_multicast.c |
6036 |
+@@ -1121,7 +1121,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, |
6037 |
+ } else { |
6038 |
+ err = br_ip6_multicast_add_group(br, port, |
6039 |
+ &grec->grec_mca, vid); |
6040 |
+- if (!err) |
6041 |
++ if (err) |
6042 |
+ break; |
6043 |
+ } |
6044 |
+ } |
6045 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
6046 |
+index 904ff431d570..97fb3da5093a 100644 |
6047 |
+--- a/net/core/dev.c |
6048 |
++++ b/net/core/dev.c |
6049 |
+@@ -3979,6 +3979,22 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, |
6050 |
+ } |
6051 |
+ |
6052 |
+ /** |
6053 |
++ * netdev_is_rx_handler_busy - check if receive handler is registered |
6054 |
++ * @dev: device to check |
6055 |
++ * |
6056 |
++ * Check if a receive handler is already registered for a given device. |
6057 |
++ * Return true if there one. |
6058 |
++ * |
6059 |
++ * The caller must hold the rtnl_mutex. |
6060 |
++ */ |
6061 |
++bool netdev_is_rx_handler_busy(struct net_device *dev) |
6062 |
++{ |
6063 |
++ ASSERT_RTNL(); |
6064 |
++ return dev && rtnl_dereference(dev->rx_handler); |
6065 |
++} |
6066 |
++EXPORT_SYMBOL_GPL(netdev_is_rx_handler_busy); |
6067 |
++ |
6068 |
++/** |
6069 |
+ * netdev_rx_handler_register - register receive handler |
6070 |
+ * @dev: device to register a handler for |
6071 |
+ * @rx_handler: receive handler to register |
6072 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
6073 |
+index e759d90e8cef..bca32d63ab43 100644 |
6074 |
+--- a/net/core/filter.c |
6075 |
++++ b/net/core/filter.c |
6076 |
+@@ -1353,54 +1353,33 @@ static inline int bpf_try_make_writable(struct sk_buff *skb, |
6077 |
+ { |
6078 |
+ int err; |
6079 |
+ |
6080 |
+- if (!skb_cloned(skb)) |
6081 |
+- return 0; |
6082 |
+- if (skb_clone_writable(skb, write_len)) |
6083 |
+- return 0; |
6084 |
+- err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
6085 |
+- if (!err) |
6086 |
+- bpf_compute_data_end(skb); |
6087 |
++ err = skb_ensure_writable(skb, write_len); |
6088 |
++ bpf_compute_data_end(skb); |
6089 |
++ |
6090 |
+ return err; |
6091 |
+ } |
6092 |
+ |
6093 |
+ static u64 bpf_skb_store_bytes(u64 r1, u64 r2, u64 r3, u64 r4, u64 flags) |
6094 |
+ { |
6095 |
+- struct bpf_scratchpad *sp = this_cpu_ptr(&bpf_sp); |
6096 |
+ struct sk_buff *skb = (struct sk_buff *) (long) r1; |
6097 |
+- int offset = (int) r2; |
6098 |
++ unsigned int offset = (unsigned int) r2; |
6099 |
+ void *from = (void *) (long) r3; |
6100 |
+ unsigned int len = (unsigned int) r4; |
6101 |
+ void *ptr; |
6102 |
+ |
6103 |
+ if (unlikely(flags & ~(BPF_F_RECOMPUTE_CSUM | BPF_F_INVALIDATE_HASH))) |
6104 |
+ return -EINVAL; |
6105 |
+- |
6106 |
+- /* bpf verifier guarantees that: |
6107 |
+- * 'from' pointer points to bpf program stack |
6108 |
+- * 'len' bytes of it were initialized |
6109 |
+- * 'len' > 0 |
6110 |
+- * 'skb' is a valid pointer to 'struct sk_buff' |
6111 |
+- * |
6112 |
+- * so check for invalid 'offset' and too large 'len' |
6113 |
+- */ |
6114 |
+- if (unlikely((u32) offset > 0xffff || len > sizeof(sp->buff))) |
6115 |
++ if (unlikely(offset > 0xffff)) |
6116 |
+ return -EFAULT; |
6117 |
+ if (unlikely(bpf_try_make_writable(skb, offset + len))) |
6118 |
+ return -EFAULT; |
6119 |
+ |
6120 |
+- ptr = skb_header_pointer(skb, offset, len, sp->buff); |
6121 |
+- if (unlikely(!ptr)) |
6122 |
+- return -EFAULT; |
6123 |
+- |
6124 |
++ ptr = skb->data + offset; |
6125 |
+ if (flags & BPF_F_RECOMPUTE_CSUM) |
6126 |
+ skb_postpull_rcsum(skb, ptr, len); |
6127 |
+ |
6128 |
+ memcpy(ptr, from, len); |
6129 |
+ |
6130 |
+- if (ptr == sp->buff) |
6131 |
+- /* skb_store_bits cannot return -EFAULT here */ |
6132 |
+- skb_store_bits(skb, offset, ptr, len); |
6133 |
+- |
6134 |
+ if (flags & BPF_F_RECOMPUTE_CSUM) |
6135 |
+ skb_postpush_rcsum(skb, ptr, len); |
6136 |
+ if (flags & BPF_F_INVALIDATE_HASH) |
6137 |
+@@ -1423,12 +1402,12 @@ static const struct bpf_func_proto bpf_skb_store_bytes_proto = { |
6138 |
+ static u64 bpf_skb_load_bytes(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5) |
6139 |
+ { |
6140 |
+ const struct sk_buff *skb = (const struct sk_buff *)(unsigned long) r1; |
6141 |
+- int offset = (int) r2; |
6142 |
++ unsigned int offset = (unsigned int) r2; |
6143 |
+ void *to = (void *)(unsigned long) r3; |
6144 |
+ unsigned int len = (unsigned int) r4; |
6145 |
+ void *ptr; |
6146 |
+ |
6147 |
+- if (unlikely((u32) offset > 0xffff)) |
6148 |
++ if (unlikely(offset > 0xffff)) |
6149 |
+ goto err_clear; |
6150 |
+ |
6151 |
+ ptr = skb_header_pointer(skb, offset, len, to); |
6152 |
+@@ -1456,20 +1435,17 @@ static const struct bpf_func_proto bpf_skb_load_bytes_proto = { |
6153 |
+ static u64 bpf_l3_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags) |
6154 |
+ { |
6155 |
+ struct sk_buff *skb = (struct sk_buff *) (long) r1; |
6156 |
+- int offset = (int) r2; |
6157 |
+- __sum16 sum, *ptr; |
6158 |
++ unsigned int offset = (unsigned int) r2; |
6159 |
++ __sum16 *ptr; |
6160 |
+ |
6161 |
+ if (unlikely(flags & ~(BPF_F_HDR_FIELD_MASK))) |
6162 |
+ return -EINVAL; |
6163 |
+- if (unlikely((u32) offset > 0xffff)) |
6164 |
+- return -EFAULT; |
6165 |
+- if (unlikely(bpf_try_make_writable(skb, offset + sizeof(sum)))) |
6166 |
++ if (unlikely(offset > 0xffff || offset & 1)) |
6167 |
+ return -EFAULT; |
6168 |
+- |
6169 |
+- ptr = skb_header_pointer(skb, offset, sizeof(sum), &sum); |
6170 |
+- if (unlikely(!ptr)) |
6171 |
++ if (unlikely(bpf_try_make_writable(skb, offset + sizeof(*ptr)))) |
6172 |
+ return -EFAULT; |
6173 |
+ |
6174 |
++ ptr = (__sum16 *)(skb->data + offset); |
6175 |
+ switch (flags & BPF_F_HDR_FIELD_MASK) { |
6176 |
+ case 0: |
6177 |
+ if (unlikely(from != 0)) |
6178 |
+@@ -1487,10 +1463,6 @@ static u64 bpf_l3_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags) |
6179 |
+ return -EINVAL; |
6180 |
+ } |
6181 |
+ |
6182 |
+- if (ptr == &sum) |
6183 |
+- /* skb_store_bits guaranteed to not return -EFAULT here */ |
6184 |
+- skb_store_bits(skb, offset, ptr, sizeof(sum)); |
6185 |
+- |
6186 |
+ return 0; |
6187 |
+ } |
6188 |
+ |
6189 |
+@@ -1510,20 +1482,18 @@ static u64 bpf_l4_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags) |
6190 |
+ struct sk_buff *skb = (struct sk_buff *) (long) r1; |
6191 |
+ bool is_pseudo = flags & BPF_F_PSEUDO_HDR; |
6192 |
+ bool is_mmzero = flags & BPF_F_MARK_MANGLED_0; |
6193 |
+- int offset = (int) r2; |
6194 |
+- __sum16 sum, *ptr; |
6195 |
++ unsigned int offset = (unsigned int) r2; |
6196 |
++ __sum16 *ptr; |
6197 |
+ |
6198 |
+ if (unlikely(flags & ~(BPF_F_MARK_MANGLED_0 | BPF_F_PSEUDO_HDR | |
6199 |
+ BPF_F_HDR_FIELD_MASK))) |
6200 |
+ return -EINVAL; |
6201 |
+- if (unlikely((u32) offset > 0xffff)) |
6202 |
++ if (unlikely(offset > 0xffff || offset & 1)) |
6203 |
+ return -EFAULT; |
6204 |
+- if (unlikely(bpf_try_make_writable(skb, offset + sizeof(sum)))) |
6205 |
++ if (unlikely(bpf_try_make_writable(skb, offset + sizeof(*ptr)))) |
6206 |
+ return -EFAULT; |
6207 |
+ |
6208 |
+- ptr = skb_header_pointer(skb, offset, sizeof(sum), &sum); |
6209 |
+- if (unlikely(!ptr)) |
6210 |
+- return -EFAULT; |
6211 |
++ ptr = (__sum16 *)(skb->data + offset); |
6212 |
+ if (is_mmzero && !*ptr) |
6213 |
+ return 0; |
6214 |
+ |
6215 |
+@@ -1546,10 +1516,6 @@ static u64 bpf_l4_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags) |
6216 |
+ |
6217 |
+ if (is_mmzero && !*ptr) |
6218 |
+ *ptr = CSUM_MANGLED_0; |
6219 |
+- if (ptr == &sum) |
6220 |
+- /* skb_store_bits guaranteed to not return -EFAULT here */ |
6221 |
+- skb_store_bits(skb, offset, ptr, sizeof(sum)); |
6222 |
+- |
6223 |
+ return 0; |
6224 |
+ } |
6225 |
+ |
6226 |
+diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c |
6227 |
+index d07fc076bea0..febca0f1008c 100644 |
6228 |
+--- a/net/ipv4/fib_trie.c |
6229 |
++++ b/net/ipv4/fib_trie.c |
6230 |
+@@ -2452,9 +2452,7 @@ struct fib_route_iter { |
6231 |
+ static struct key_vector *fib_route_get_idx(struct fib_route_iter *iter, |
6232 |
+ loff_t pos) |
6233 |
+ { |
6234 |
+- struct fib_table *tb = iter->main_tb; |
6235 |
+ struct key_vector *l, **tp = &iter->tnode; |
6236 |
+- struct trie *t; |
6237 |
+ t_key key; |
6238 |
+ |
6239 |
+ /* use cache location of next-to-find key */ |
6240 |
+@@ -2462,8 +2460,6 @@ static struct key_vector *fib_route_get_idx(struct fib_route_iter *iter, |
6241 |
+ pos -= iter->pos; |
6242 |
+ key = iter->key; |
6243 |
+ } else { |
6244 |
+- t = (struct trie *)tb->tb_data; |
6245 |
+- iter->tnode = t->kv; |
6246 |
+ iter->pos = 0; |
6247 |
+ key = 0; |
6248 |
+ } |
6249 |
+@@ -2504,12 +2500,12 @@ static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos) |
6250 |
+ return NULL; |
6251 |
+ |
6252 |
+ iter->main_tb = tb; |
6253 |
++ t = (struct trie *)tb->tb_data; |
6254 |
++ iter->tnode = t->kv; |
6255 |
+ |
6256 |
+ if (*pos != 0) |
6257 |
+ return fib_route_get_idx(iter, *pos); |
6258 |
+ |
6259 |
+- t = (struct trie *)tb->tb_data; |
6260 |
+- iter->tnode = t->kv; |
6261 |
+ iter->pos = 0; |
6262 |
+ iter->key = 0; |
6263 |
+ |
6264 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
6265 |
+index a917903d5e97..cc701fa70b12 100644 |
6266 |
+--- a/net/ipv4/ip_vti.c |
6267 |
++++ b/net/ipv4/ip_vti.c |
6268 |
+@@ -557,6 +557,33 @@ static struct rtnl_link_ops vti_link_ops __read_mostly = { |
6269 |
+ .get_link_net = ip_tunnel_get_link_net, |
6270 |
+ }; |
6271 |
+ |
6272 |
++static bool is_vti_tunnel(const struct net_device *dev) |
6273 |
++{ |
6274 |
++ return dev->netdev_ops == &vti_netdev_ops; |
6275 |
++} |
6276 |
++ |
6277 |
++static int vti_device_event(struct notifier_block *unused, |
6278 |
++ unsigned long event, void *ptr) |
6279 |
++{ |
6280 |
++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
6281 |
++ struct ip_tunnel *tunnel = netdev_priv(dev); |
6282 |
++ |
6283 |
++ if (!is_vti_tunnel(dev)) |
6284 |
++ return NOTIFY_DONE; |
6285 |
++ |
6286 |
++ switch (event) { |
6287 |
++ case NETDEV_DOWN: |
6288 |
++ if (!net_eq(tunnel->net, dev_net(dev))) |
6289 |
++ xfrm_garbage_collect(tunnel->net); |
6290 |
++ break; |
6291 |
++ } |
6292 |
++ return NOTIFY_DONE; |
6293 |
++} |
6294 |
++ |
6295 |
++static struct notifier_block vti_notifier_block __read_mostly = { |
6296 |
++ .notifier_call = vti_device_event, |
6297 |
++}; |
6298 |
++ |
6299 |
+ static int __init vti_init(void) |
6300 |
+ { |
6301 |
+ const char *msg; |
6302 |
+@@ -564,6 +591,8 @@ static int __init vti_init(void) |
6303 |
+ |
6304 |
+ pr_info("IPv4 over IPsec tunneling driver\n"); |
6305 |
+ |
6306 |
++ register_netdevice_notifier(&vti_notifier_block); |
6307 |
++ |
6308 |
+ msg = "tunnel device"; |
6309 |
+ err = register_pernet_device(&vti_net_ops); |
6310 |
+ if (err < 0) |
6311 |
+@@ -596,6 +625,7 @@ xfrm_proto_ah_failed: |
6312 |
+ xfrm_proto_esp_failed: |
6313 |
+ unregister_pernet_device(&vti_net_ops); |
6314 |
+ pernet_dev_failed: |
6315 |
++ unregister_netdevice_notifier(&vti_notifier_block); |
6316 |
+ pr_err("vti init: failed to register %s\n", msg); |
6317 |
+ return err; |
6318 |
+ } |
6319 |
+@@ -607,6 +637,7 @@ static void __exit vti_fini(void) |
6320 |
+ xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
6321 |
+ xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP); |
6322 |
+ unregister_pernet_device(&vti_net_ops); |
6323 |
++ unregister_netdevice_notifier(&vti_notifier_block); |
6324 |
+ } |
6325 |
+ |
6326 |
+ module_init(vti_init); |
6327 |
+diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c |
6328 |
+index 54d9f9b0120f..478114b366d8 100644 |
6329 |
+--- a/net/ipv4/tcp_fastopen.c |
6330 |
++++ b/net/ipv4/tcp_fastopen.c |
6331 |
+@@ -150,6 +150,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) |
6332 |
+ tp->segs_in = 0; |
6333 |
+ tcp_segs_in(tp, skb); |
6334 |
+ __skb_pull(skb, tcp_hdrlen(skb)); |
6335 |
++ sk_forced_mem_schedule(sk, skb->truesize); |
6336 |
+ skb_set_owner_r(skb, sk); |
6337 |
+ |
6338 |
+ TCP_SKB_CB(skb)->seq++; |
6339 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
6340 |
+index 3708de2a6683..ba7ce3ffa0e3 100644 |
6341 |
+--- a/net/ipv4/tcp_ipv4.c |
6342 |
++++ b/net/ipv4/tcp_ipv4.c |
6343 |
+@@ -814,8 +814,14 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, |
6344 |
+ u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 : |
6345 |
+ tcp_sk(sk)->snd_nxt; |
6346 |
+ |
6347 |
++ /* RFC 7323 2.3 |
6348 |
++ * The window field (SEG.WND) of every outgoing segment, with the |
6349 |
++ * exception of <SYN> segments, MUST be right-shifted by |
6350 |
++ * Rcv.Wind.Shift bits: |
6351 |
++ */ |
6352 |
+ tcp_v4_send_ack(sock_net(sk), skb, seq, |
6353 |
+- tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, |
6354 |
++ tcp_rsk(req)->rcv_nxt, |
6355 |
++ req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, |
6356 |
+ tcp_time_stamp, |
6357 |
+ req->ts_recent, |
6358 |
+ 0, |
6359 |
+diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c |
6360 |
+index 028eb046ea40..9c5fc973267f 100644 |
6361 |
+--- a/net/ipv4/tcp_yeah.c |
6362 |
++++ b/net/ipv4/tcp_yeah.c |
6363 |
+@@ -76,7 +76,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) |
6364 |
+ if (!tcp_is_cwnd_limited(sk)) |
6365 |
+ return; |
6366 |
+ |
6367 |
+- if (tp->snd_cwnd <= tp->snd_ssthresh) |
6368 |
++ if (tcp_in_slow_start(tp)) |
6369 |
+ tcp_slow_start(tp, acked); |
6370 |
+ |
6371 |
+ else if (!yeah->doing_reno_now) { |
6372 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
6373 |
+index e61f7cd65d08..00d18c57c83c 100644 |
6374 |
+--- a/net/ipv4/udp.c |
6375 |
++++ b/net/ipv4/udp.c |
6376 |
+@@ -1182,13 +1182,13 @@ out: |
6377 |
+ * @sk: socket |
6378 |
+ * |
6379 |
+ * Drops all bad checksum frames, until a valid one is found. |
6380 |
+- * Returns the length of found skb, or 0 if none is found. |
6381 |
++ * Returns the length of found skb, or -1 if none is found. |
6382 |
+ */ |
6383 |
+-static unsigned int first_packet_length(struct sock *sk) |
6384 |
++static int first_packet_length(struct sock *sk) |
6385 |
+ { |
6386 |
+ struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue; |
6387 |
+ struct sk_buff *skb; |
6388 |
+- unsigned int res; |
6389 |
++ int res; |
6390 |
+ |
6391 |
+ __skb_queue_head_init(&list_kill); |
6392 |
+ |
6393 |
+@@ -1203,7 +1203,7 @@ static unsigned int first_packet_length(struct sock *sk) |
6394 |
+ __skb_unlink(skb, rcvq); |
6395 |
+ __skb_queue_tail(&list_kill, skb); |
6396 |
+ } |
6397 |
+- res = skb ? skb->len : 0; |
6398 |
++ res = skb ? skb->len : -1; |
6399 |
+ spin_unlock_bh(&rcvq->lock); |
6400 |
+ |
6401 |
+ if (!skb_queue_empty(&list_kill)) { |
6402 |
+@@ -1232,7 +1232,7 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) |
6403 |
+ |
6404 |
+ case SIOCINQ: |
6405 |
+ { |
6406 |
+- unsigned int amount = first_packet_length(sk); |
6407 |
++ int amount = max_t(int, 0, first_packet_length(sk)); |
6408 |
+ |
6409 |
+ return put_user(amount, (int __user *)arg); |
6410 |
+ } |
6411 |
+@@ -2184,7 +2184,7 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) |
6412 |
+ |
6413 |
+ /* Check for false positives due to checksum errors */ |
6414 |
+ if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) && |
6415 |
+- !(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk)) |
6416 |
++ !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1) |
6417 |
+ mask &= ~(POLLIN | POLLRDNORM); |
6418 |
+ |
6419 |
+ return mask; |
6420 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
6421 |
+index 047c75a798b1..82e367b9e685 100644 |
6422 |
+--- a/net/ipv6/addrconf.c |
6423 |
++++ b/net/ipv6/addrconf.c |
6424 |
+@@ -1906,6 +1906,7 @@ errdad: |
6425 |
+ spin_unlock_bh(&ifp->lock); |
6426 |
+ |
6427 |
+ addrconf_mod_dad_work(ifp, 0); |
6428 |
++ in6_ifa_put(ifp); |
6429 |
+ } |
6430 |
+ |
6431 |
+ /* Join to solicited addr multicast group. |
6432 |
+@@ -3469,7 +3470,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) |
6433 |
+ /* combine the user config with event to determine if permanent |
6434 |
+ * addresses are to be removed from address hash table |
6435 |
+ */ |
6436 |
+- keep_addr = !(how || _keep_addr <= 0); |
6437 |
++ keep_addr = !(how || _keep_addr <= 0 || idev->cnf.disable_ipv6); |
6438 |
+ |
6439 |
+ /* Step 2: clear hash table */ |
6440 |
+ for (i = 0; i < IN6_ADDR_HSIZE; i++) { |
6441 |
+@@ -3525,7 +3526,7 @@ restart: |
6442 |
+ /* re-combine the user config with event to determine if permanent |
6443 |
+ * addresses are to be removed from the interface list |
6444 |
+ */ |
6445 |
+- keep_addr = (!how && _keep_addr > 0); |
6446 |
++ keep_addr = (!how && _keep_addr > 0 && !idev->cnf.disable_ipv6); |
6447 |
+ |
6448 |
+ INIT_LIST_HEAD(&del_list); |
6449 |
+ list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { |
6450 |
+@@ -3771,6 +3772,7 @@ static void addrconf_dad_work(struct work_struct *w) |
6451 |
+ addrconf_dad_begin(ifp); |
6452 |
+ goto out; |
6453 |
+ } else if (action == DAD_ABORT) { |
6454 |
++ in6_ifa_hold(ifp); |
6455 |
+ addrconf_dad_stop(ifp, 1); |
6456 |
+ goto out; |
6457 |
+ } |
6458 |
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
6459 |
+index 7b0481e3738f..888543debe4e 100644 |
6460 |
+--- a/net/ipv6/ip6_tunnel.c |
6461 |
++++ b/net/ipv6/ip6_tunnel.c |
6462 |
+@@ -1174,6 +1174,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
6463 |
+ encap_limit = t->parms.encap_limit; |
6464 |
+ |
6465 |
+ memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
6466 |
++ fl6.flowi6_proto = IPPROTO_IPIP; |
6467 |
+ |
6468 |
+ dsfield = ipv4_get_dsfield(iph); |
6469 |
+ |
6470 |
+@@ -1233,6 +1234,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
6471 |
+ encap_limit = t->parms.encap_limit; |
6472 |
+ |
6473 |
+ memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
6474 |
++ fl6.flowi6_proto = IPPROTO_IPV6; |
6475 |
+ |
6476 |
+ dsfield = ipv6_get_dsfield(ipv6h); |
6477 |
+ if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) |
6478 |
+diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c |
6479 |
+index 3ee3e444a66b..408660477ba6 100644 |
6480 |
+--- a/net/ipv6/ping.c |
6481 |
++++ b/net/ipv6/ping.c |
6482 |
+@@ -122,8 +122,10 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
6483 |
+ rt = (struct rt6_info *) dst; |
6484 |
+ |
6485 |
+ np = inet6_sk(sk); |
6486 |
+- if (!np) |
6487 |
+- return -EBADF; |
6488 |
++ if (!np) { |
6489 |
++ err = -EBADF; |
6490 |
++ goto dst_err_out; |
6491 |
++ } |
6492 |
+ |
6493 |
+ if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) |
6494 |
+ fl6.flowi6_oif = np->mcast_oif; |
6495 |
+@@ -160,6 +162,9 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
6496 |
+ } |
6497 |
+ release_sock(sk); |
6498 |
+ |
6499 |
++dst_err_out: |
6500 |
++ dst_release(dst); |
6501 |
++ |
6502 |
+ if (err) |
6503 |
+ return err; |
6504 |
+ |
6505 |
+diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
6506 |
+index 2255d2bf5f6b..889acc471720 100644 |
6507 |
+--- a/net/ipv6/tcp_ipv6.c |
6508 |
++++ b/net/ipv6/tcp_ipv6.c |
6509 |
+@@ -937,9 +937,15 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, |
6510 |
+ /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV |
6511 |
+ * sk->sk_state == TCP_SYN_RECV -> for Fast Open. |
6512 |
+ */ |
6513 |
++ /* RFC 7323 2.3 |
6514 |
++ * The window field (SEG.WND) of every outgoing segment, with the |
6515 |
++ * exception of <SYN> segments, MUST be right-shifted by |
6516 |
++ * Rcv.Wind.Shift bits: |
6517 |
++ */ |
6518 |
+ tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ? |
6519 |
+ tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, |
6520 |
+- tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, |
6521 |
++ tcp_rsk(req)->rcv_nxt, |
6522 |
++ req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, |
6523 |
+ tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if, |
6524 |
+ tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), |
6525 |
+ 0, 0); |
6526 |
+diff --git a/net/irda/iriap.c b/net/irda/iriap.c |
6527 |
+index 4a7ae32afa09..1138eaf5c682 100644 |
6528 |
+--- a/net/irda/iriap.c |
6529 |
++++ b/net/irda/iriap.c |
6530 |
+@@ -185,8 +185,12 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv, |
6531 |
+ |
6532 |
+ self->magic = IAS_MAGIC; |
6533 |
+ self->mode = mode; |
6534 |
+- if (mode == IAS_CLIENT) |
6535 |
+- iriap_register_lsap(self, slsap_sel, mode); |
6536 |
++ if (mode == IAS_CLIENT) { |
6537 |
++ if (iriap_register_lsap(self, slsap_sel, mode)) { |
6538 |
++ kfree(self); |
6539 |
++ return NULL; |
6540 |
++ } |
6541 |
++ } |
6542 |
+ |
6543 |
+ self->confirm = callback; |
6544 |
+ self->priv = priv; |
6545 |
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c |
6546 |
+index 0b68ba730a06..48613f5dd952 100644 |
6547 |
+--- a/net/kcm/kcmsock.c |
6548 |
++++ b/net/kcm/kcmsock.c |
6549 |
+@@ -13,6 +13,7 @@ |
6550 |
+ #include <linux/socket.h> |
6551 |
+ #include <linux/uaccess.h> |
6552 |
+ #include <linux/workqueue.h> |
6553 |
++#include <linux/syscalls.h> |
6554 |
+ #include <net/kcm.h> |
6555 |
+ #include <net/netns/generic.h> |
6556 |
+ #include <net/sock.h> |
6557 |
+@@ -2035,7 +2036,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
6558 |
+ if (copy_to_user((void __user *)arg, &info, |
6559 |
+ sizeof(info))) { |
6560 |
+ err = -EFAULT; |
6561 |
+- sock_release(newsock); |
6562 |
++ sys_close(info.fd); |
6563 |
+ } |
6564 |
+ } |
6565 |
+ |
6566 |
+diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c |
6567 |
+index ea4a2fef1b71..5c4cdea216fd 100644 |
6568 |
+--- a/net/sched/act_ife.c |
6569 |
++++ b/net/sched/act_ife.c |
6570 |
+@@ -52,7 +52,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval) |
6571 |
+ u32 *tlv = (u32 *)(skbdata); |
6572 |
+ u16 totlen = nla_total_size(dlen); /*alignment + hdr */ |
6573 |
+ char *dptr = (char *)tlv + NLA_HDRLEN; |
6574 |
+- u32 htlv = attrtype << 16 | totlen; |
6575 |
++ u32 htlv = attrtype << 16 | dlen; |
6576 |
+ |
6577 |
+ *tlv = htonl(htlv); |
6578 |
+ memset(dptr, 0, totlen - NLA_HDRLEN); |
6579 |
+@@ -134,7 +134,7 @@ EXPORT_SYMBOL_GPL(ife_release_meta_gen); |
6580 |
+ |
6581 |
+ int ife_validate_meta_u32(void *val, int len) |
6582 |
+ { |
6583 |
+- if (len == 4) |
6584 |
++ if (len == sizeof(u32)) |
6585 |
+ return 0; |
6586 |
+ |
6587 |
+ return -EINVAL; |
6588 |
+@@ -143,8 +143,8 @@ EXPORT_SYMBOL_GPL(ife_validate_meta_u32); |
6589 |
+ |
6590 |
+ int ife_validate_meta_u16(void *val, int len) |
6591 |
+ { |
6592 |
+- /* length will include padding */ |
6593 |
+- if (len == NLA_ALIGN(2)) |
6594 |
++ /* length will not include padding */ |
6595 |
++ if (len == sizeof(u16)) |
6596 |
+ return 0; |
6597 |
+ |
6598 |
+ return -EINVAL; |
6599 |
+@@ -652,12 +652,14 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, |
6600 |
+ u8 *tlvdata = (u8 *)tlv; |
6601 |
+ u16 mtype = tlv->type; |
6602 |
+ u16 mlen = tlv->len; |
6603 |
++ u16 alen; |
6604 |
+ |
6605 |
+ mtype = ntohs(mtype); |
6606 |
+ mlen = ntohs(mlen); |
6607 |
++ alen = NLA_ALIGN(mlen); |
6608 |
+ |
6609 |
+- if (find_decode_metaid(skb, ife, mtype, (mlen - 4), |
6610 |
+- (void *)(tlvdata + 4))) { |
6611 |
++ if (find_decode_metaid(skb, ife, mtype, (mlen - NLA_HDRLEN), |
6612 |
++ (void *)(tlvdata + NLA_HDRLEN))) { |
6613 |
+ /* abuse overlimits to count when we receive metadata |
6614 |
+ * but dont have an ops for it |
6615 |
+ */ |
6616 |
+@@ -666,8 +668,8 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, |
6617 |
+ ife->tcf_qstats.overlimits++; |
6618 |
+ } |
6619 |
+ |
6620 |
+- tlvdata += mlen; |
6621 |
+- ifehdrln -= mlen; |
6622 |
++ tlvdata += alen; |
6623 |
++ ifehdrln -= alen; |
6624 |
+ tlv = (struct meta_tlvhdr *)tlvdata; |
6625 |
+ } |
6626 |
+ |
6627 |
+diff --git a/net/sctp/proc.c b/net/sctp/proc.c |
6628 |
+index 4cb5aedfe3ee..ef8ba77a5bea 100644 |
6629 |
+--- a/net/sctp/proc.c |
6630 |
++++ b/net/sctp/proc.c |
6631 |
+@@ -293,6 +293,7 @@ static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) |
6632 |
+ return ERR_PTR(err); |
6633 |
+ } |
6634 |
+ |
6635 |
++ iter->start_fail = 0; |
6636 |
+ return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); |
6637 |
+ } |
6638 |
+ |
6639 |
+diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c |
6640 |
+index f69edcf219e5..10bae2201c6f 100644 |
6641 |
+--- a/net/sctp/sctp_diag.c |
6642 |
++++ b/net/sctp/sctp_diag.c |
6643 |
+@@ -418,11 +418,13 @@ static int sctp_diag_dump_one(struct sk_buff *in_skb, |
6644 |
+ paddr.v4.sin_family = AF_INET; |
6645 |
+ } else { |
6646 |
+ laddr.v6.sin6_port = req->id.idiag_sport; |
6647 |
+- memcpy(&laddr.v6.sin6_addr, req->id.idiag_src, 64); |
6648 |
++ memcpy(&laddr.v6.sin6_addr, req->id.idiag_src, |
6649 |
++ sizeof(laddr.v6.sin6_addr)); |
6650 |
+ laddr.v6.sin6_family = AF_INET6; |
6651 |
+ |
6652 |
+ paddr.v6.sin6_port = req->id.idiag_dport; |
6653 |
+- memcpy(&paddr.v6.sin6_addr, req->id.idiag_dst, 64); |
6654 |
++ memcpy(&paddr.v6.sin6_addr, req->id.idiag_dst, |
6655 |
++ sizeof(paddr.v6.sin6_addr)); |
6656 |
+ paddr.v6.sin6_family = AF_INET6; |
6657 |
+ } |
6658 |
+ |
6659 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
6660 |
+index e085f5ae1548..4605dc73def6 100644 |
6661 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
6662 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
6663 |
+@@ -569,9 +569,10 @@ gss_svc_searchbyctx(struct cache_detail *cd, struct xdr_netobj *handle) |
6664 |
+ struct rsc *found; |
6665 |
+ |
6666 |
+ memset(&rsci, 0, sizeof(rsci)); |
6667 |
+- rsci.handle.data = handle->data; |
6668 |
+- rsci.handle.len = handle->len; |
6669 |
++ if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) |
6670 |
++ return NULL; |
6671 |
+ found = rsc_lookup(cd, &rsci); |
6672 |
++ rsc_free(&rsci); |
6673 |
+ if (!found) |
6674 |
+ return NULL; |
6675 |
+ if (cache_check(cd, &found->h, NULL)) |
6676 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
6677 |
+index c49b8df438cb..f9f5f3c3dab5 100644 |
6678 |
+--- a/net/tipc/socket.c |
6679 |
++++ b/net/tipc/socket.c |
6680 |
+@@ -2180,7 +2180,8 @@ restart: |
6681 |
+ TIPC_CONN_MSG, SHORT_H_SIZE, |
6682 |
+ 0, dnode, onode, dport, oport, |
6683 |
+ TIPC_CONN_SHUTDOWN); |
6684 |
+- tipc_node_xmit_skb(net, skb, dnode, tsk->portid); |
6685 |
++ if (skb) |
6686 |
++ tipc_node_xmit_skb(net, skb, dnode, tsk->portid); |
6687 |
+ } |
6688 |
+ tsk->connected = 0; |
6689 |
+ sock->state = SS_DISCONNECTING; |
6690 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
6691 |
+index 735362c26c8e..e444fa47ea46 100644 |
6692 |
+--- a/net/unix/af_unix.c |
6693 |
++++ b/net/unix/af_unix.c |
6694 |
+@@ -661,11 +661,11 @@ static int unix_set_peek_off(struct sock *sk, int val) |
6695 |
+ { |
6696 |
+ struct unix_sock *u = unix_sk(sk); |
6697 |
+ |
6698 |
+- if (mutex_lock_interruptible(&u->readlock)) |
6699 |
++ if (mutex_lock_interruptible(&u->iolock)) |
6700 |
+ return -EINTR; |
6701 |
+ |
6702 |
+ sk->sk_peek_off = val; |
6703 |
+- mutex_unlock(&u->readlock); |
6704 |
++ mutex_unlock(&u->iolock); |
6705 |
+ |
6706 |
+ return 0; |
6707 |
+ } |
6708 |
+@@ -778,7 +778,8 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) |
6709 |
+ spin_lock_init(&u->lock); |
6710 |
+ atomic_long_set(&u->inflight, 0); |
6711 |
+ INIT_LIST_HEAD(&u->link); |
6712 |
+- mutex_init(&u->readlock); /* single task reading lock */ |
6713 |
++ mutex_init(&u->iolock); /* single task reading lock */ |
6714 |
++ mutex_init(&u->bindlock); /* single task binding lock */ |
6715 |
+ init_waitqueue_head(&u->peer_wait); |
6716 |
+ init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); |
6717 |
+ unix_insert_socket(unix_sockets_unbound(sk), sk); |
6718 |
+@@ -847,7 +848,7 @@ static int unix_autobind(struct socket *sock) |
6719 |
+ int err; |
6720 |
+ unsigned int retries = 0; |
6721 |
+ |
6722 |
+- err = mutex_lock_interruptible(&u->readlock); |
6723 |
++ err = mutex_lock_interruptible(&u->bindlock); |
6724 |
+ if (err) |
6725 |
+ return err; |
6726 |
+ |
6727 |
+@@ -894,7 +895,7 @@ retry: |
6728 |
+ spin_unlock(&unix_table_lock); |
6729 |
+ err = 0; |
6730 |
+ |
6731 |
+-out: mutex_unlock(&u->readlock); |
6732 |
++out: mutex_unlock(&u->bindlock); |
6733 |
+ return err; |
6734 |
+ } |
6735 |
+ |
6736 |
+@@ -953,20 +954,32 @@ fail: |
6737 |
+ return NULL; |
6738 |
+ } |
6739 |
+ |
6740 |
+-static int unix_mknod(struct dentry *dentry, const struct path *path, umode_t mode, |
6741 |
+- struct path *res) |
6742 |
++static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) |
6743 |
+ { |
6744 |
+- int err; |
6745 |
++ struct dentry *dentry; |
6746 |
++ struct path path; |
6747 |
++ int err = 0; |
6748 |
++ /* |
6749 |
++ * Get the parent directory, calculate the hash for last |
6750 |
++ * component. |
6751 |
++ */ |
6752 |
++ dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); |
6753 |
++ err = PTR_ERR(dentry); |
6754 |
++ if (IS_ERR(dentry)) |
6755 |
++ return err; |
6756 |
+ |
6757 |
+- err = security_path_mknod(path, dentry, mode, 0); |
6758 |
++ /* |
6759 |
++ * All right, let's create it. |
6760 |
++ */ |
6761 |
++ err = security_path_mknod(&path, dentry, mode, 0); |
6762 |
+ if (!err) { |
6763 |
+- err = vfs_mknod(d_inode(path->dentry), dentry, mode, 0); |
6764 |
++ err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); |
6765 |
+ if (!err) { |
6766 |
+- res->mnt = mntget(path->mnt); |
6767 |
++ res->mnt = mntget(path.mnt); |
6768 |
+ res->dentry = dget(dentry); |
6769 |
+ } |
6770 |
+ } |
6771 |
+- |
6772 |
++ done_path_create(&path, dentry); |
6773 |
+ return err; |
6774 |
+ } |
6775 |
+ |
6776 |
+@@ -977,12 +990,10 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6777 |
+ struct unix_sock *u = unix_sk(sk); |
6778 |
+ struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
6779 |
+ char *sun_path = sunaddr->sun_path; |
6780 |
+- int err, name_err; |
6781 |
++ int err; |
6782 |
+ unsigned int hash; |
6783 |
+ struct unix_address *addr; |
6784 |
+ struct hlist_head *list; |
6785 |
+- struct path path; |
6786 |
+- struct dentry *dentry; |
6787 |
+ |
6788 |
+ err = -EINVAL; |
6789 |
+ if (sunaddr->sun_family != AF_UNIX) |
6790 |
+@@ -998,34 +1009,14 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6791 |
+ goto out; |
6792 |
+ addr_len = err; |
6793 |
+ |
6794 |
+- name_err = 0; |
6795 |
+- dentry = NULL; |
6796 |
+- if (sun_path[0]) { |
6797 |
+- /* Get the parent directory, calculate the hash for last |
6798 |
+- * component. |
6799 |
+- */ |
6800 |
+- dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); |
6801 |
+- |
6802 |
+- if (IS_ERR(dentry)) { |
6803 |
+- /* delay report until after 'already bound' check */ |
6804 |
+- name_err = PTR_ERR(dentry); |
6805 |
+- dentry = NULL; |
6806 |
+- } |
6807 |
+- } |
6808 |
+- |
6809 |
+- err = mutex_lock_interruptible(&u->readlock); |
6810 |
++ err = mutex_lock_interruptible(&u->bindlock); |
6811 |
+ if (err) |
6812 |
+- goto out_path; |
6813 |
++ goto out; |
6814 |
+ |
6815 |
+ err = -EINVAL; |
6816 |
+ if (u->addr) |
6817 |
+ goto out_up; |
6818 |
+ |
6819 |
+- if (name_err) { |
6820 |
+- err = name_err == -EEXIST ? -EADDRINUSE : name_err; |
6821 |
+- goto out_up; |
6822 |
+- } |
6823 |
+- |
6824 |
+ err = -ENOMEM; |
6825 |
+ addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); |
6826 |
+ if (!addr) |
6827 |
+@@ -1036,11 +1027,11 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6828 |
+ addr->hash = hash ^ sk->sk_type; |
6829 |
+ atomic_set(&addr->refcnt, 1); |
6830 |
+ |
6831 |
+- if (dentry) { |
6832 |
+- struct path u_path; |
6833 |
++ if (sun_path[0]) { |
6834 |
++ struct path path; |
6835 |
+ umode_t mode = S_IFSOCK | |
6836 |
+ (SOCK_INODE(sock)->i_mode & ~current_umask()); |
6837 |
+- err = unix_mknod(dentry, &path, mode, &u_path); |
6838 |
++ err = unix_mknod(sun_path, mode, &path); |
6839 |
+ if (err) { |
6840 |
+ if (err == -EEXIST) |
6841 |
+ err = -EADDRINUSE; |
6842 |
+@@ -1048,9 +1039,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6843 |
+ goto out_up; |
6844 |
+ } |
6845 |
+ addr->hash = UNIX_HASH_SIZE; |
6846 |
+- hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
6847 |
++ hash = d_real_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
6848 |
+ spin_lock(&unix_table_lock); |
6849 |
+- u->path = u_path; |
6850 |
++ u->path = path; |
6851 |
+ list = &unix_socket_table[hash]; |
6852 |
+ } else { |
6853 |
+ spin_lock(&unix_table_lock); |
6854 |
+@@ -1072,11 +1063,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6855 |
+ out_unlock: |
6856 |
+ spin_unlock(&unix_table_lock); |
6857 |
+ out_up: |
6858 |
+- mutex_unlock(&u->readlock); |
6859 |
+-out_path: |
6860 |
+- if (dentry) |
6861 |
+- done_path_create(&path, dentry); |
6862 |
+- |
6863 |
++ mutex_unlock(&u->bindlock); |
6864 |
+ out: |
6865 |
+ return err; |
6866 |
+ } |
6867 |
+@@ -1968,17 +1955,17 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, |
6868 |
+ if (false) { |
6869 |
+ alloc_skb: |
6870 |
+ unix_state_unlock(other); |
6871 |
+- mutex_unlock(&unix_sk(other)->readlock); |
6872 |
++ mutex_unlock(&unix_sk(other)->iolock); |
6873 |
+ newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, |
6874 |
+ &err, 0); |
6875 |
+ if (!newskb) |
6876 |
+ goto err; |
6877 |
+ } |
6878 |
+ |
6879 |
+- /* we must acquire readlock as we modify already present |
6880 |
++ /* we must acquire iolock as we modify already present |
6881 |
+ * skbs in the sk_receive_queue and mess with skb->len |
6882 |
+ */ |
6883 |
+- err = mutex_lock_interruptible(&unix_sk(other)->readlock); |
6884 |
++ err = mutex_lock_interruptible(&unix_sk(other)->iolock); |
6885 |
+ if (err) { |
6886 |
+ err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; |
6887 |
+ goto err; |
6888 |
+@@ -2045,7 +2032,7 @@ alloc_skb: |
6889 |
+ } |
6890 |
+ |
6891 |
+ unix_state_unlock(other); |
6892 |
+- mutex_unlock(&unix_sk(other)->readlock); |
6893 |
++ mutex_unlock(&unix_sk(other)->iolock); |
6894 |
+ |
6895 |
+ other->sk_data_ready(other); |
6896 |
+ scm_destroy(&scm); |
6897 |
+@@ -2054,7 +2041,7 @@ alloc_skb: |
6898 |
+ err_state_unlock: |
6899 |
+ unix_state_unlock(other); |
6900 |
+ err_unlock: |
6901 |
+- mutex_unlock(&unix_sk(other)->readlock); |
6902 |
++ mutex_unlock(&unix_sk(other)->iolock); |
6903 |
+ err: |
6904 |
+ kfree_skb(newskb); |
6905 |
+ if (send_sigpipe && !(flags & MSG_NOSIGNAL)) |
6906 |
+@@ -2122,7 +2109,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, |
6907 |
+ timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); |
6908 |
+ |
6909 |
+ do { |
6910 |
+- mutex_lock(&u->readlock); |
6911 |
++ mutex_lock(&u->iolock); |
6912 |
+ |
6913 |
+ skip = sk_peek_offset(sk, flags); |
6914 |
+ skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, |
6915 |
+@@ -2130,14 +2117,14 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, |
6916 |
+ if (skb) |
6917 |
+ break; |
6918 |
+ |
6919 |
+- mutex_unlock(&u->readlock); |
6920 |
++ mutex_unlock(&u->iolock); |
6921 |
+ |
6922 |
+ if (err != -EAGAIN) |
6923 |
+ break; |
6924 |
+ } while (timeo && |
6925 |
+ !__skb_wait_for_more_packets(sk, &err, &timeo, last)); |
6926 |
+ |
6927 |
+- if (!skb) { /* implies readlock unlocked */ |
6928 |
++ if (!skb) { /* implies iolock unlocked */ |
6929 |
+ unix_state_lock(sk); |
6930 |
+ /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ |
6931 |
+ if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && |
6932 |
+@@ -2202,7 +2189,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, |
6933 |
+ |
6934 |
+ out_free: |
6935 |
+ skb_free_datagram(sk, skb); |
6936 |
+- mutex_unlock(&u->readlock); |
6937 |
++ mutex_unlock(&u->iolock); |
6938 |
+ out: |
6939 |
+ return err; |
6940 |
+ } |
6941 |
+@@ -2297,7 +2284,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) |
6942 |
+ /* Lock the socket to prevent queue disordering |
6943 |
+ * while sleeps in memcpy_tomsg |
6944 |
+ */ |
6945 |
+- mutex_lock(&u->readlock); |
6946 |
++ mutex_lock(&u->iolock); |
6947 |
+ |
6948 |
+ if (flags & MSG_PEEK) |
6949 |
+ skip = sk_peek_offset(sk, flags); |
6950 |
+@@ -2339,7 +2326,7 @@ again: |
6951 |
+ break; |
6952 |
+ } |
6953 |
+ |
6954 |
+- mutex_unlock(&u->readlock); |
6955 |
++ mutex_unlock(&u->iolock); |
6956 |
+ |
6957 |
+ timeo = unix_stream_data_wait(sk, timeo, last, |
6958 |
+ last_len); |
6959 |
+@@ -2350,7 +2337,7 @@ again: |
6960 |
+ goto out; |
6961 |
+ } |
6962 |
+ |
6963 |
+- mutex_lock(&u->readlock); |
6964 |
++ mutex_lock(&u->iolock); |
6965 |
+ goto redo; |
6966 |
+ unlock: |
6967 |
+ unix_state_unlock(sk); |
6968 |
+@@ -2453,7 +2440,7 @@ unlock: |
6969 |
+ } |
6970 |
+ } while (size); |
6971 |
+ |
6972 |
+- mutex_unlock(&u->readlock); |
6973 |
++ mutex_unlock(&u->iolock); |
6974 |
+ if (state->msg) |
6975 |
+ scm_recv(sock, state->msg, &scm, flags); |
6976 |
+ else |
6977 |
+@@ -2494,9 +2481,9 @@ static ssize_t skb_unix_socket_splice(struct sock *sk, |
6978 |
+ int ret; |
6979 |
+ struct unix_sock *u = unix_sk(sk); |
6980 |
+ |
6981 |
+- mutex_unlock(&u->readlock); |
6982 |
++ mutex_unlock(&u->iolock); |
6983 |
+ ret = splice_to_pipe(pipe, spd); |
6984 |
+- mutex_lock(&u->readlock); |
6985 |
++ mutex_lock(&u->iolock); |
6986 |
+ |
6987 |
+ return ret; |
6988 |
+ } |
6989 |
+diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c |
6990 |
+index dbb2738e356a..6250b1cfcde5 100644 |
6991 |
+--- a/net/wireless/wext-core.c |
6992 |
++++ b/net/wireless/wext-core.c |
6993 |
+@@ -958,29 +958,8 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, |
6994 |
+ return private(dev, iwr, cmd, info, handler); |
6995 |
+ } |
6996 |
+ /* Old driver API : call driver ioctl handler */ |
6997 |
+- if (dev->netdev_ops->ndo_do_ioctl) { |
6998 |
+-#ifdef CONFIG_COMPAT |
6999 |
+- if (info->flags & IW_REQUEST_FLAG_COMPAT) { |
7000 |
+- int ret = 0; |
7001 |
+- struct iwreq iwr_lcl; |
7002 |
+- struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; |
7003 |
+- |
7004 |
+- memcpy(&iwr_lcl, iwr, sizeof(struct iwreq)); |
7005 |
+- iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer); |
7006 |
+- iwr_lcl.u.data.length = iwp_compat->length; |
7007 |
+- iwr_lcl.u.data.flags = iwp_compat->flags; |
7008 |
+- |
7009 |
+- ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd); |
7010 |
+- |
7011 |
+- iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer); |
7012 |
+- iwp_compat->length = iwr_lcl.u.data.length; |
7013 |
+- iwp_compat->flags = iwr_lcl.u.data.flags; |
7014 |
+- |
7015 |
+- return ret; |
7016 |
+- } else |
7017 |
+-#endif |
7018 |
+- return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); |
7019 |
+- } |
7020 |
++ if (dev->netdev_ops->ndo_do_ioctl) |
7021 |
++ return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); |
7022 |
+ return -EOPNOTSUPP; |
7023 |
+ } |
7024 |
+ |