1 |
commit: fc5d873f0679105e1f87129504df3ac472b55a05 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 27 11:39:36 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 27 11:39:36 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=fc5d873f |
7 |
|
8 |
Linux patch 4.19.226 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1225_linux-4.19.226.patch | 7434 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 7438 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 2d48f74d..263aac7b 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -939,6 +939,10 @@ Patch: 1224_linux-4.19.225.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.225 |
23 |
|
24 |
+Patch: 1225_linux-4.19.226.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.226 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1225_linux-4.19.226.patch b/1225_linux-4.19.226.patch |
33 |
new file mode 100644 |
34 |
index 00000000..b3670843 |
35 |
--- /dev/null |
36 |
+++ b/1225_linux-4.19.226.patch |
37 |
@@ -0,0 +1,7434 @@ |
38 |
+diff --git a/Documentation/admin-guide/hw-vuln/spectre.rst b/Documentation/admin-guide/hw-vuln/spectre.rst |
39 |
+index e05e581af5cfe..985181dba0bac 100644 |
40 |
+--- a/Documentation/admin-guide/hw-vuln/spectre.rst |
41 |
++++ b/Documentation/admin-guide/hw-vuln/spectre.rst |
42 |
+@@ -468,7 +468,7 @@ Spectre variant 2 |
43 |
+ before invoking any firmware code to prevent Spectre variant 2 exploits |
44 |
+ using the firmware. |
45 |
+ |
46 |
+- Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y |
47 |
++ Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y |
48 |
+ and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes |
49 |
+ attacks on the kernel generally more difficult. |
50 |
+ |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index 891dcd4eadc5b..72399555ce886 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 19 |
59 |
+-SUBLEVEL = 225 |
60 |
++SUBLEVEL = 226 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = "People's Front" |
63 |
+ |
64 |
+@@ -972,7 +972,7 @@ HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf) |
65 |
+ |
66 |
+ ifdef CONFIG_STACK_VALIDATION |
67 |
+ has_libelf := $(call try-run,\ |
68 |
+- echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) |
69 |
++ echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) |
70 |
+ ifeq ($(has_libelf),1) |
71 |
+ objtool_target := tools/objtool FORCE |
72 |
+ else |
73 |
+diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi |
74 |
+index 929459c427605..6f32f12332824 100644 |
75 |
+--- a/arch/arm/boot/dts/armada-38x.dtsi |
76 |
++++ b/arch/arm/boot/dts/armada-38x.dtsi |
77 |
+@@ -163,7 +163,7 @@ |
78 |
+ }; |
79 |
+ |
80 |
+ uart0: serial@12000 { |
81 |
+- compatible = "marvell,armada-38x-uart"; |
82 |
++ compatible = "marvell,armada-38x-uart", "ns16550a"; |
83 |
+ reg = <0x12000 0x100>; |
84 |
+ reg-shift = <2>; |
85 |
+ interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; |
86 |
+@@ -173,7 +173,7 @@ |
87 |
+ }; |
88 |
+ |
89 |
+ uart1: serial@12100 { |
90 |
+- compatible = "marvell,armada-38x-uart"; |
91 |
++ compatible = "marvell,armada-38x-uart", "ns16550a"; |
92 |
+ reg = <0x12100 0x100>; |
93 |
+ reg-shift = <2>; |
94 |
+ interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; |
95 |
+diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
96 |
+index 75de8134b1d1f..e479bfe681bd9 100644 |
97 |
+--- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
98 |
++++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
99 |
+@@ -165,12 +165,12 @@ |
100 |
+ regulator-enable-ramp-delay = <1000>; |
101 |
+ }; |
102 |
+ |
103 |
+- /* Used by DSS */ |
104 |
++ /* Used by DSS and is the "zerov_regulator" trigger for SoC off mode */ |
105 |
+ vcsi: VCSI { |
106 |
+ regulator-min-microvolt = <1800000>; |
107 |
+ regulator-max-microvolt = <1800000>; |
108 |
+ regulator-enable-ramp-delay = <1000>; |
109 |
+- regulator-boot-on; |
110 |
++ regulator-always-on; |
111 |
+ }; |
112 |
+ |
113 |
+ vdac: VDAC { |
114 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
115 |
+index 70325b273bd2b..c7f06692d6c2a 100644 |
116 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
117 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
118 |
+@@ -6,6 +6,7 @@ |
119 |
+ */ |
120 |
+ |
121 |
+ #include "meson-gxbb.dtsi" |
122 |
++#include <dt-bindings/gpio/gpio.h> |
123 |
+ |
124 |
+ / { |
125 |
+ aliases { |
126 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
127 |
+index b762227f6aa18..fc5d047ca50bc 100644 |
128 |
+--- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
129 |
++++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
130 |
+@@ -372,7 +372,7 @@ |
131 |
+ |
132 |
+ ccplex@e000000 { |
133 |
+ compatible = "nvidia,tegra186-ccplex-cluster"; |
134 |
+- reg = <0x0 0x0e000000 0x0 0x3fffff>; |
135 |
++ reg = <0x0 0x0e000000 0x0 0x400000>; |
136 |
+ |
137 |
+ nvidia,bpmp = <&bpmp>; |
138 |
+ }; |
139 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
140 |
+index ba42c62399226..078ae020a77b8 100644 |
141 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
142 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
143 |
+@@ -27,8 +27,8 @@ |
144 |
+ #size-cells = <2>; |
145 |
+ |
146 |
+ aliases { |
147 |
+- sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ |
148 |
+- sdhc2 = &sdhc_2; /* SDC2 SD card slot */ |
149 |
++ mmc0 = &sdhc_1; /* SDC1 eMMC slot */ |
150 |
++ mmc1 = &sdhc_2; /* SDC2 SD card slot */ |
151 |
+ }; |
152 |
+ |
153 |
+ chosen { }; |
154 |
+diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c |
155 |
+index aba6e2d6a736c..dcfa0ea912fe1 100644 |
156 |
+--- a/arch/mips/bcm63xx/clk.c |
157 |
++++ b/arch/mips/bcm63xx/clk.c |
158 |
+@@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) |
159 |
+ } |
160 |
+ EXPORT_SYMBOL(clk_get_parent); |
161 |
+ |
162 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
163 |
++{ |
164 |
++ return 0; |
165 |
++} |
166 |
++EXPORT_SYMBOL(clk_set_parent); |
167 |
++ |
168 |
+ unsigned long clk_get_rate(struct clk *clk) |
169 |
+ { |
170 |
+ if (!clk) |
171 |
+diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c |
172 |
+index 5ba181e87d2c1..4d83f5bc7211c 100644 |
173 |
+--- a/arch/mips/cavium-octeon/octeon-platform.c |
174 |
++++ b/arch/mips/cavium-octeon/octeon-platform.c |
175 |
+@@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) |
176 |
+ |
177 |
+ pd->dev.platform_data = &octeon_ehci_pdata; |
178 |
+ octeon_ehci_hw_start(&pd->dev); |
179 |
++ put_device(&pd->dev); |
180 |
+ |
181 |
+ return ret; |
182 |
+ } |
183 |
+@@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) |
184 |
+ |
185 |
+ pd->dev.platform_data = &octeon_ohci_pdata; |
186 |
+ octeon_ohci_hw_start(&pd->dev); |
187 |
++ put_device(&pd->dev); |
188 |
+ |
189 |
+ return ret; |
190 |
+ } |
191 |
+diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c |
192 |
+index 75189ff2f3c78..3465452e28195 100644 |
193 |
+--- a/arch/mips/cavium-octeon/octeon-usb.c |
194 |
++++ b/arch/mips/cavium-octeon/octeon-usb.c |
195 |
+@@ -543,6 +543,7 @@ static int __init dwc3_octeon_device_init(void) |
196 |
+ devm_iounmap(&pdev->dev, base); |
197 |
+ devm_release_mem_region(&pdev->dev, res->start, |
198 |
+ resource_size(res)); |
199 |
++ put_device(&pdev->dev); |
200 |
+ } |
201 |
+ } while (node != NULL); |
202 |
+ |
203 |
+diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
204 |
+index 62787765575ef..ce6e5fddce0bf 100644 |
205 |
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
206 |
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
207 |
+@@ -315,7 +315,7 @@ enum cvmx_chip_types_enum { |
208 |
+ |
209 |
+ /* Functions to return string based on type */ |
210 |
+ #define ENUM_BRD_TYPE_CASE(x) \ |
211 |
+- case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ |
212 |
++ case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ |
213 |
+ static inline const char *cvmx_board_type_to_string(enum |
214 |
+ cvmx_board_types_enum type) |
215 |
+ { |
216 |
+@@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum |
217 |
+ } |
218 |
+ |
219 |
+ #define ENUM_CHIP_TYPE_CASE(x) \ |
220 |
+- case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ |
221 |
++ case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ |
222 |
+ static inline const char *cvmx_chip_type_to_string(enum |
223 |
+ cvmx_chip_types_enum type) |
224 |
+ { |
225 |
+diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
226 |
+index a8e309dcd38d7..f5fab99d1751c 100644 |
227 |
+--- a/arch/mips/lantiq/clk.c |
228 |
++++ b/arch/mips/lantiq/clk.c |
229 |
+@@ -166,6 +166,12 @@ struct clk *clk_get_parent(struct clk *clk) |
230 |
+ } |
231 |
+ EXPORT_SYMBOL(clk_get_parent); |
232 |
+ |
233 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
234 |
++{ |
235 |
++ return 0; |
236 |
++} |
237 |
++EXPORT_SYMBOL(clk_set_parent); |
238 |
++ |
239 |
+ static inline u32 get_counter_resolution(void) |
240 |
+ { |
241 |
+ u32 res; |
242 |
+diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c |
243 |
+index 5a4875cac1ec9..2e7a0d201c09e 100644 |
244 |
+--- a/arch/mips/mm/gup.c |
245 |
++++ b/arch/mips/mm/gup.c |
246 |
+@@ -274,7 +274,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
247 |
+ next = pgd_addr_end(addr, end); |
248 |
+ if (pgd_none(pgd)) |
249 |
+ goto slow; |
250 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
251 |
++ /* |
252 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
253 |
++ * because get_user_pages() may need to cause an early COW in |
254 |
++ * order to avoid confusing the normal COW routines. So only |
255 |
++ * targets that are already writable are safe to do by just |
256 |
++ * looking at the page tables. |
257 |
++ */ |
258 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
259 |
+ goto slow; |
260 |
+ } while (pgdp++, addr = next, addr != end); |
261 |
+ local_irq_enable(); |
262 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
263 |
+index abeb5321a83fc..d7a66d8525091 100644 |
264 |
+--- a/arch/parisc/kernel/traps.c |
265 |
++++ b/arch/parisc/kernel/traps.c |
266 |
+@@ -750,7 +750,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
267 |
+ * unless pagefault_disable() was called before. |
268 |
+ */ |
269 |
+ |
270 |
+- if (fault_space == 0 && !faulthandler_disabled()) |
271 |
++ if (faulthandler_disabled() || fault_space == 0) |
272 |
+ { |
273 |
+ /* Clean up and return if in exception table. */ |
274 |
+ if (fixup_exception(regs)) |
275 |
+diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
276 |
+index c90702b04a530..48e5cd61599c6 100644 |
277 |
+--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
278 |
++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
279 |
+@@ -79,6 +79,7 @@ fman0: fman@400000 { |
280 |
+ #size-cells = <0>; |
281 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
282 |
+ reg = <0xfc000 0x1000>; |
283 |
++ fsl,erratum-a009885; |
284 |
+ }; |
285 |
+ |
286 |
+ xmdio0: mdio@fd000 { |
287 |
+@@ -86,6 +87,7 @@ fman0: fman@400000 { |
288 |
+ #size-cells = <0>; |
289 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
290 |
+ reg = <0xfd000 0x1000>; |
291 |
++ fsl,erratum-a009885; |
292 |
+ }; |
293 |
+ }; |
294 |
+ |
295 |
+diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c |
296 |
+index b2072d5bbf2bb..a046504d8bfaf 100644 |
297 |
+--- a/arch/powerpc/kernel/btext.c |
298 |
++++ b/arch/powerpc/kernel/btext.c |
299 |
+@@ -258,8 +258,10 @@ int __init btext_find_display(int allow_nonstdout) |
300 |
+ rc = btext_initialize(np); |
301 |
+ printk("result: %d\n", rc); |
302 |
+ } |
303 |
+- if (rc == 0) |
304 |
++ if (rc == 0) { |
305 |
++ of_node_put(np); |
306 |
+ break; |
307 |
++ } |
308 |
+ } |
309 |
+ return rc; |
310 |
+ } |
311 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
312 |
+index af1e38febe496..29a8087a49010 100644 |
313 |
+--- a/arch/powerpc/kernel/prom_init.c |
314 |
++++ b/arch/powerpc/kernel/prom_init.c |
315 |
+@@ -2805,7 +2805,7 @@ static void __init fixup_device_tree_efika_add_phy(void) |
316 |
+ |
317 |
+ /* Check if the phy-handle property exists - bail if it does */ |
318 |
+ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); |
319 |
+- if (!rv) |
320 |
++ if (rv <= 0) |
321 |
+ return; |
322 |
+ |
323 |
+ /* |
324 |
+diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
325 |
+index 14adfeacfa46e..60fc3c71aa7b0 100644 |
326 |
+--- a/arch/powerpc/kernel/smp.c |
327 |
++++ b/arch/powerpc/kernel/smp.c |
328 |
+@@ -564,6 +564,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) |
329 |
+ } |
330 |
+ #endif |
331 |
+ |
332 |
++#ifdef CONFIG_NMI_IPI |
333 |
++static void crash_stop_this_cpu(struct pt_regs *regs) |
334 |
++#else |
335 |
++static void crash_stop_this_cpu(void *dummy) |
336 |
++#endif |
337 |
++{ |
338 |
++ /* |
339 |
++ * Just busy wait here and avoid marking CPU as offline to ensure |
340 |
++ * register data is captured appropriately. |
341 |
++ */ |
342 |
++ while (1) |
343 |
++ cpu_relax(); |
344 |
++} |
345 |
++ |
346 |
++void crash_smp_send_stop(void) |
347 |
++{ |
348 |
++ static bool stopped = false; |
349 |
++ |
350 |
++ if (stopped) |
351 |
++ return; |
352 |
++ |
353 |
++ stopped = true; |
354 |
++ |
355 |
++#ifdef CONFIG_NMI_IPI |
356 |
++ smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); |
357 |
++#else |
358 |
++ smp_call_function(crash_stop_this_cpu, NULL, 0); |
359 |
++#endif /* CONFIG_NMI_IPI */ |
360 |
++} |
361 |
++ |
362 |
+ #ifdef CONFIG_NMI_IPI |
363 |
+ static void nmi_stop_this_cpu(struct pt_regs *regs) |
364 |
+ { |
365 |
+@@ -1070,10 +1100,12 @@ void start_secondary(void *unused) |
366 |
+ BUG(); |
367 |
+ } |
368 |
+ |
369 |
++#ifdef CONFIG_PROFILING |
370 |
+ int setup_profiling_timer(unsigned int multiplier) |
371 |
+ { |
372 |
+ return 0; |
373 |
+ } |
374 |
++#endif |
375 |
+ |
376 |
+ #ifdef CONFIG_SCHED_SMT |
377 |
+ /* cpumask of CPUs with asymetric SMT dependancy */ |
378 |
+diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c |
379 |
+index af3c15a1d41eb..75b2a6c4db5a5 100644 |
380 |
+--- a/arch/powerpc/kernel/watchdog.c |
381 |
++++ b/arch/powerpc/kernel/watchdog.c |
382 |
+@@ -132,6 +132,10 @@ static void set_cpumask_stuck(const struct cpumask *cpumask, u64 tb) |
383 |
+ { |
384 |
+ cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); |
385 |
+ cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); |
386 |
++ /* |
387 |
++ * See wd_smp_clear_cpu_pending() |
388 |
++ */ |
389 |
++ smp_mb(); |
390 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
391 |
+ wd_smp_last_reset_tb = tb; |
392 |
+ cpumask_andnot(&wd_smp_cpus_pending, |
393 |
+@@ -217,13 +221,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) |
394 |
+ |
395 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); |
396 |
+ wd_smp_unlock(&flags); |
397 |
++ } else { |
398 |
++ /* |
399 |
++ * The last CPU to clear pending should have reset the |
400 |
++ * watchdog so we generally should not find it empty |
401 |
++ * here if our CPU was clear. However it could happen |
402 |
++ * due to a rare race with another CPU taking the |
403 |
++ * last CPU out of the mask concurrently. |
404 |
++ * |
405 |
++ * We can't add a warning for it. But just in case |
406 |
++ * there is a problem with the watchdog that is causing |
407 |
++ * the mask to not be reset, try to kick it along here. |
408 |
++ */ |
409 |
++ if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) |
410 |
++ goto none_pending; |
411 |
+ } |
412 |
+ return; |
413 |
+ } |
414 |
++ |
415 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); |
416 |
++ |
417 |
++ /* |
418 |
++ * Order the store to clear pending with the load(s) to check all |
419 |
++ * words in the pending mask to check they are all empty. This orders |
420 |
++ * with the same barrier on another CPU. This prevents two CPUs |
421 |
++ * clearing the last 2 pending bits, but neither seeing the other's |
422 |
++ * store when checking if the mask is empty, and missing an empty |
423 |
++ * mask, which ends with a false positive. |
424 |
++ */ |
425 |
++ smp_mb(); |
426 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
427 |
+ unsigned long flags; |
428 |
+ |
429 |
++none_pending: |
430 |
++ /* |
431 |
++ * Double check under lock because more than one CPU could see |
432 |
++ * a clear mask with the lockless check after clearing their |
433 |
++ * pending bits. |
434 |
++ */ |
435 |
+ wd_smp_lock(&flags); |
436 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
437 |
+ wd_smp_last_reset_tb = tb; |
438 |
+@@ -314,8 +349,12 @@ void arch_touch_nmi_watchdog(void) |
439 |
+ { |
440 |
+ unsigned long ticks = tb_ticks_per_usec * wd_timer_period_ms * 1000; |
441 |
+ int cpu = smp_processor_id(); |
442 |
+- u64 tb = get_tb(); |
443 |
++ u64 tb; |
444 |
+ |
445 |
++ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
446 |
++ return; |
447 |
++ |
448 |
++ tb = get_tb(); |
449 |
+ if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { |
450 |
+ per_cpu(wd_timer_tb, cpu) = tb; |
451 |
+ wd_smp_clear_cpu_pending(cpu, tb); |
452 |
+diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c |
453 |
+index 12352a58072ab..d9c2c4cc60be1 100644 |
454 |
+--- a/arch/powerpc/platforms/cell/iommu.c |
455 |
++++ b/arch/powerpc/platforms/cell/iommu.c |
456 |
+@@ -1088,6 +1088,7 @@ static int __init cell_iommu_fixed_mapping_init(void) |
457 |
+ if (hbase < dbase || (hend > (dbase + dsize))) { |
458 |
+ pr_debug("iommu: hash window doesn't fit in" |
459 |
+ "real DMA window\n"); |
460 |
++ of_node_put(np); |
461 |
+ return -1; |
462 |
+ } |
463 |
+ } |
464 |
+diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c |
465 |
+index a88944db9fc39..97ac2622ee4e3 100644 |
466 |
+--- a/arch/powerpc/platforms/cell/pervasive.c |
467 |
++++ b/arch/powerpc/platforms/cell/pervasive.c |
468 |
+@@ -90,6 +90,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs) |
469 |
+ switch (regs->msr & SRR1_WAKEMASK) { |
470 |
+ case SRR1_WAKEDEC: |
471 |
+ set_dec(1); |
472 |
++ break; |
473 |
+ case SRR1_WAKEEE: |
474 |
+ /* |
475 |
+ * Handle these when interrupts get re-enabled and we take |
476 |
+diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
477 |
+index 8112b39879d67..7b4edf1cb2c8d 100644 |
478 |
+--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
479 |
++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
480 |
+@@ -220,6 +220,7 @@ void hlwd_pic_probe(void) |
481 |
+ irq_set_chained_handler(cascade_virq, |
482 |
+ hlwd_pic_irq_cascade); |
483 |
+ hlwd_irq_host = host; |
484 |
++ of_node_put(np); |
485 |
+ break; |
486 |
+ } |
487 |
+ } |
488 |
+diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c |
489 |
+index 6c7ad1d8b32ed..21f0edcfb84ad 100644 |
490 |
+--- a/arch/powerpc/platforms/powernv/opal-lpc.c |
491 |
++++ b/arch/powerpc/platforms/powernv/opal-lpc.c |
492 |
+@@ -400,6 +400,7 @@ void __init opal_lpc_init(void) |
493 |
+ if (!of_get_property(np, "primary", NULL)) |
494 |
+ continue; |
495 |
+ opal_lpc_chip_id = of_get_ibm_chip_id(np); |
496 |
++ of_node_put(np); |
497 |
+ break; |
498 |
+ } |
499 |
+ if (opal_lpc_chip_id < 0) |
500 |
+diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c |
501 |
+index dc5ecaea30d71..3dcfe98f70f52 100644 |
502 |
+--- a/arch/s390/kvm/interrupt.c |
503 |
++++ b/arch/s390/kvm/interrupt.c |
504 |
+@@ -1900,6 +1900,13 @@ int kvm_s390_is_stop_irq_pending(struct kvm_vcpu *vcpu) |
505 |
+ return test_bit(IRQ_PEND_SIGP_STOP, &li->pending_irqs); |
506 |
+ } |
507 |
+ |
508 |
++int kvm_s390_is_restart_irq_pending(struct kvm_vcpu *vcpu) |
509 |
++{ |
510 |
++ struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; |
511 |
++ |
512 |
++ return test_bit(IRQ_PEND_RESTART, &li->pending_irqs); |
513 |
++} |
514 |
++ |
515 |
+ void kvm_s390_clear_stop_irq(struct kvm_vcpu *vcpu) |
516 |
+ { |
517 |
+ struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; |
518 |
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
519 |
+index 71c67a1d2849a..3aade928c18dd 100644 |
520 |
+--- a/arch/s390/kvm/kvm-s390.c |
521 |
++++ b/arch/s390/kvm/kvm-s390.c |
522 |
+@@ -3844,10 +3844,15 @@ void kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu) |
523 |
+ spin_lock(&vcpu->kvm->arch.start_stop_lock); |
524 |
+ online_vcpus = atomic_read(&vcpu->kvm->online_vcpus); |
525 |
+ |
526 |
+- /* SIGP STOP and SIGP STOP AND STORE STATUS has been fully processed */ |
527 |
++ /* |
528 |
++ * Set the VCPU to STOPPED and THEN clear the interrupt flag, |
529 |
++ * now that the SIGP STOP and SIGP STOP AND STORE STATUS orders |
530 |
++ * have been fully processed. This will ensure that the VCPU |
531 |
++ * is kept BUSY if another VCPU is inquiring with SIGP SENSE. |
532 |
++ */ |
533 |
++ kvm_s390_set_cpuflags(vcpu, CPUSTAT_STOPPED); |
534 |
+ kvm_s390_clear_stop_irq(vcpu); |
535 |
+ |
536 |
+- kvm_s390_set_cpuflags(vcpu, CPUSTAT_STOPPED); |
537 |
+ __disable_ibs_on_vcpu(vcpu); |
538 |
+ |
539 |
+ for (i = 0; i < online_vcpus; i++) { |
540 |
+diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h |
541 |
+index 0a2ffd5378be2..a7264c1136e14 100644 |
542 |
+--- a/arch/s390/kvm/kvm-s390.h |
543 |
++++ b/arch/s390/kvm/kvm-s390.h |
544 |
+@@ -372,6 +372,7 @@ void kvm_s390_destroy_adapters(struct kvm *kvm); |
545 |
+ int kvm_s390_ext_call_pending(struct kvm_vcpu *vcpu); |
546 |
+ extern struct kvm_device_ops kvm_flic_ops; |
547 |
+ int kvm_s390_is_stop_irq_pending(struct kvm_vcpu *vcpu); |
548 |
++int kvm_s390_is_restart_irq_pending(struct kvm_vcpu *vcpu); |
549 |
+ void kvm_s390_clear_stop_irq(struct kvm_vcpu *vcpu); |
550 |
+ int kvm_s390_set_irq_state(struct kvm_vcpu *vcpu, |
551 |
+ void __user *buf, int len); |
552 |
+diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c |
553 |
+index 683036c1c92a8..3dc921e853b6e 100644 |
554 |
+--- a/arch/s390/kvm/sigp.c |
555 |
++++ b/arch/s390/kvm/sigp.c |
556 |
+@@ -288,6 +288,34 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, |
557 |
+ if (!dst_vcpu) |
558 |
+ return SIGP_CC_NOT_OPERATIONAL; |
559 |
+ |
560 |
++ /* |
561 |
++ * SIGP RESTART, SIGP STOP, and SIGP STOP AND STORE STATUS orders |
562 |
++ * are processed asynchronously. Until the affected VCPU finishes |
563 |
++ * its work and calls back into KVM to clear the (RESTART or STOP) |
564 |
++ * interrupt, we need to return any new non-reset orders "busy". |
565 |
++ * |
566 |
++ * This is important because a single VCPU could issue: |
567 |
++ * 1) SIGP STOP $DESTINATION |
568 |
++ * 2) SIGP SENSE $DESTINATION |
569 |
++ * |
570 |
++ * If the SIGP SENSE would not be rejected as "busy", it could |
571 |
++ * return an incorrect answer as to whether the VCPU is STOPPED |
572 |
++ * or OPERATING. |
573 |
++ */ |
574 |
++ if (order_code != SIGP_INITIAL_CPU_RESET && |
575 |
++ order_code != SIGP_CPU_RESET) { |
576 |
++ /* |
577 |
++ * Lockless check. Both SIGP STOP and SIGP (RE)START |
578 |
++ * properly synchronize everything while processing |
579 |
++ * their orders, while the guest cannot observe a |
580 |
++ * difference when issuing other orders from two |
581 |
++ * different VCPUs. |
582 |
++ */ |
583 |
++ if (kvm_s390_is_stop_irq_pending(dst_vcpu) || |
584 |
++ kvm_s390_is_restart_irq_pending(dst_vcpu)) |
585 |
++ return SIGP_CC_BUSY; |
586 |
++ } |
587 |
++ |
588 |
+ switch (order_code) { |
589 |
+ case SIGP_SENSE: |
590 |
+ vcpu->stat.instruction_sigp_sense++; |
591 |
+diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c |
592 |
+index 9b5b866d8adf1..5389bf5bc8283 100644 |
593 |
+--- a/arch/s390/mm/gup.c |
594 |
++++ b/arch/s390/mm/gup.c |
595 |
+@@ -287,7 +287,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
596 |
+ |
597 |
+ might_sleep(); |
598 |
+ start &= PAGE_MASK; |
599 |
+- nr = __get_user_pages_fast(start, nr_pages, write, pages); |
600 |
++ /* |
601 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
602 |
++ * because get_user_pages() may need to cause an early COW in |
603 |
++ * order to avoid confusing the normal COW routines. So only |
604 |
++ * targets that are already writable are safe to do by just |
605 |
++ * looking at the page tables. |
606 |
++ */ |
607 |
++ nr = __get_user_pages_fast(start, nr_pages, 1, pages); |
608 |
+ if (nr == nr_pages) |
609 |
+ return nr; |
610 |
+ |
611 |
+diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c |
612 |
+index f3bc9c9305da6..3f3c13a4dd0b6 100644 |
613 |
+--- a/arch/s390/mm/pgalloc.c |
614 |
++++ b/arch/s390/mm/pgalloc.c |
615 |
+@@ -256,13 +256,15 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) |
616 |
+ /* Free 2K page table fragment of a 4K page */ |
617 |
+ bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); |
618 |
+ spin_lock_bh(&mm->context.lock); |
619 |
+- mask = atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); |
620 |
++ mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); |
621 |
+ mask >>= 24; |
622 |
+ if (mask & 3) |
623 |
+ list_add(&page->lru, &mm->context.pgtable_list); |
624 |
+ else |
625 |
+ list_del(&page->lru); |
626 |
+ spin_unlock_bh(&mm->context.lock); |
627 |
++ mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); |
628 |
++ mask >>= 24; |
629 |
+ if (mask != 0) |
630 |
+ return; |
631 |
+ } else { |
632 |
+diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c |
633 |
+index 56c86ca98ecfe..23fa2fc8aabc4 100644 |
634 |
+--- a/arch/sh/mm/gup.c |
635 |
++++ b/arch/sh/mm/gup.c |
636 |
+@@ -242,7 +242,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
637 |
+ next = pgd_addr_end(addr, end); |
638 |
+ if (pgd_none(pgd)) |
639 |
+ goto slow; |
640 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
641 |
++ /* |
642 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
643 |
++ * because get_user_pages() may need to cause an early COW in |
644 |
++ * order to avoid confusing the normal COW routines. So only |
645 |
++ * targets that are already writable are safe to do by just |
646 |
++ * looking at the page tables. |
647 |
++ */ |
648 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
649 |
+ goto slow; |
650 |
+ } while (pgdp++, addr = next, addr != end); |
651 |
+ local_irq_enable(); |
652 |
+diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c |
653 |
+index aee6dba83d0ec..f291d34a1cd5e 100644 |
654 |
+--- a/arch/sparc/mm/gup.c |
655 |
++++ b/arch/sparc/mm/gup.c |
656 |
+@@ -303,7 +303,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
657 |
+ next = pgd_addr_end(addr, end); |
658 |
+ if (pgd_none(pgd)) |
659 |
+ goto slow; |
660 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
661 |
++ /* |
662 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
663 |
++ * because get_user_pages() may need to cause an early COW in |
664 |
++ * order to avoid confusing the normal COW routines. So only |
665 |
++ * targets that are already writable are safe to do by just |
666 |
++ * looking at the page tables. |
667 |
++ */ |
668 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
669 |
+ goto slow; |
670 |
+ } while (pgdp++, addr = next, addr != end); |
671 |
+ |
672 |
+diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h |
673 |
+index a74449b5b0e31..12ad7c435e97f 100644 |
674 |
+--- a/arch/um/include/shared/registers.h |
675 |
++++ b/arch/um/include/shared/registers.h |
676 |
+@@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); |
677 |
+ extern int save_fpx_registers(int pid, unsigned long *fp_regs); |
678 |
+ extern int restore_fpx_registers(int pid, unsigned long *fp_regs); |
679 |
+ extern int save_registers(int pid, struct uml_pt_regs *regs); |
680 |
+-extern int restore_registers(int pid, struct uml_pt_regs *regs); |
681 |
+-extern int init_registers(int pid); |
682 |
++extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); |
683 |
++extern int init_pid_registers(int pid); |
684 |
+ extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); |
685 |
+ extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
686 |
+ extern int get_fp_registers(int pid, unsigned long *regs); |
687 |
+diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c |
688 |
+index 2ff8d4fe83c4f..34a5963bd7efd 100644 |
689 |
+--- a/arch/um/os-Linux/registers.c |
690 |
++++ b/arch/um/os-Linux/registers.c |
691 |
+@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) |
692 |
+ return 0; |
693 |
+ } |
694 |
+ |
695 |
+-int restore_registers(int pid, struct uml_pt_regs *regs) |
696 |
++int restore_pid_registers(int pid, struct uml_pt_regs *regs) |
697 |
+ { |
698 |
+ int err; |
699 |
+ |
700 |
+@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) |
701 |
+ static unsigned long exec_regs[MAX_REG_NR]; |
702 |
+ static unsigned long exec_fp_regs[FP_SIZE]; |
703 |
+ |
704 |
+-int init_registers(int pid) |
705 |
++int init_pid_registers(int pid) |
706 |
+ { |
707 |
+ int err; |
708 |
+ |
709 |
+diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c |
710 |
+index 82bf5f8442ba4..2c75f2d638681 100644 |
711 |
+--- a/arch/um/os-Linux/start_up.c |
712 |
++++ b/arch/um/os-Linux/start_up.c |
713 |
+@@ -336,7 +336,7 @@ void __init os_early_checks(void) |
714 |
+ check_tmpexec(); |
715 |
+ |
716 |
+ pid = start_ptraced_child(); |
717 |
+- if (init_registers(pid)) |
718 |
++ if (init_pid_registers(pid)) |
719 |
+ fatal("Failed to initialize default registers"); |
720 |
+ stop_ptraced_child(pid, 1, 1); |
721 |
+ } |
722 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
723 |
+index 9cc524be3c949..14dc3c1f7fb43 100644 |
724 |
+--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c |
725 |
++++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
726 |
+@@ -354,7 +354,7 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf, |
727 |
+ char buf[MAX_FLAG_OPT_SIZE], *__buf; |
728 |
+ int err; |
729 |
+ |
730 |
+- if (cnt > MAX_FLAG_OPT_SIZE) |
731 |
++ if (!cnt || cnt > MAX_FLAG_OPT_SIZE) |
732 |
+ return -EINVAL; |
733 |
+ |
734 |
+ if (copy_from_user(&buf, ubuf, cnt)) |
735 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
736 |
+index 2a13468f87739..8f36ccf26ceca 100644 |
737 |
+--- a/arch/x86/kernel/cpu/mcheck/mce.c |
738 |
++++ b/arch/x86/kernel/cpu/mcheck/mce.c |
739 |
+@@ -295,11 +295,17 @@ static void wait_for_panic(void) |
740 |
+ panic("Panicing machine check CPU died"); |
741 |
+ } |
742 |
+ |
743 |
+-static void mce_panic(const char *msg, struct mce *final, char *exp) |
744 |
++static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) |
745 |
+ { |
746 |
+- int apei_err = 0; |
747 |
+ struct llist_node *pending; |
748 |
+ struct mce_evt_llist *l; |
749 |
++ int apei_err = 0; |
750 |
++ |
751 |
++ /* |
752 |
++ * Allow instrumentation around external facilities usage. Not that it |
753 |
++ * matters a whole lot since the machine is going to panic anyway. |
754 |
++ */ |
755 |
++ instrumentation_begin(); |
756 |
+ |
757 |
+ if (!fake_panic) { |
758 |
+ /* |
759 |
+@@ -314,7 +320,7 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) |
760 |
+ } else { |
761 |
+ /* Don't log too much for fake panic */ |
762 |
+ if (atomic_inc_return(&mce_fake_panicked) > 1) |
763 |
+- return; |
764 |
++ goto out; |
765 |
+ } |
766 |
+ pending = mce_gen_pool_prepare_records(); |
767 |
+ /* First print corrected ones that are still unlogged */ |
768 |
+@@ -352,6 +358,9 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) |
769 |
+ panic(msg); |
770 |
+ } else |
771 |
+ pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); |
772 |
++ |
773 |
++out: |
774 |
++ instrumentation_end(); |
775 |
+ } |
776 |
+ |
777 |
+ /* Support code for software error injection */ |
778 |
+@@ -642,7 +651,7 @@ static struct notifier_block mce_default_nb = { |
779 |
+ /* |
780 |
+ * Read ADDR and MISC registers. |
781 |
+ */ |
782 |
+-static void mce_read_aux(struct mce *m, int i) |
783 |
++static noinstr void mce_read_aux(struct mce *m, int i) |
784 |
+ { |
785 |
+ if (m->status & MCI_STATUS_MISCV) |
786 |
+ m->misc = mce_rdmsrl(msr_ops.misc(i)); |
787 |
+@@ -1021,10 +1030,13 @@ static int mce_start(int *no_way_out) |
788 |
+ * Synchronize between CPUs after main scanning loop. |
789 |
+ * This invokes the bulk of the Monarch processing. |
790 |
+ */ |
791 |
+-static int mce_end(int order) |
792 |
++static noinstr int mce_end(int order) |
793 |
+ { |
794 |
+- int ret = -1; |
795 |
+ u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; |
796 |
++ int ret = -1; |
797 |
++ |
798 |
++ /* Allow instrumentation around external facilities. */ |
799 |
++ instrumentation_begin(); |
800 |
+ |
801 |
+ if (!timeout) |
802 |
+ goto reset; |
803 |
+@@ -1068,7 +1080,8 @@ static int mce_end(int order) |
804 |
+ /* |
805 |
+ * Don't reset anything. That's done by the Monarch. |
806 |
+ */ |
807 |
+- return 0; |
808 |
++ ret = 0; |
809 |
++ goto out; |
810 |
+ } |
811 |
+ |
812 |
+ /* |
813 |
+@@ -1083,6 +1096,10 @@ reset: |
814 |
+ * Let others run again. |
815 |
+ */ |
816 |
+ atomic_set(&mce_executing, 0); |
817 |
++ |
818 |
++out: |
819 |
++ instrumentation_end(); |
820 |
++ |
821 |
+ return ret; |
822 |
+ } |
823 |
+ |
824 |
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c |
825 |
+index 50d5848bf22ef..d5352b0ae0914 100644 |
826 |
+--- a/arch/x86/kernel/early-quirks.c |
827 |
++++ b/arch/x86/kernel/early-quirks.c |
828 |
+@@ -515,6 +515,7 @@ static const struct intel_early_ops gen11_early_ops __initconst = { |
829 |
+ .stolen_size = gen9_stolen_size, |
830 |
+ }; |
831 |
+ |
832 |
++/* Intel integrated GPUs for which we need to reserve "stolen memory" */ |
833 |
+ static const struct pci_device_id intel_early_ids[] __initconst = { |
834 |
+ INTEL_I830_IDS(&i830_early_ops), |
835 |
+ INTEL_I845G_IDS(&i845_early_ops), |
836 |
+@@ -584,6 +585,13 @@ static void __init intel_graphics_quirks(int num, int slot, int func) |
837 |
+ u16 device; |
838 |
+ int i; |
839 |
+ |
840 |
++ /* |
841 |
++ * Reserve "stolen memory" for an integrated GPU. If we've already |
842 |
++ * found one, there's nothing to do for other (discrete) GPUs. |
843 |
++ */ |
844 |
++ if (resource_size(&intel_graphics_stolen_res)) |
845 |
++ return; |
846 |
++ |
847 |
+ device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); |
848 |
+ |
849 |
+ for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) { |
850 |
+@@ -696,7 +704,7 @@ static struct chipset early_qrk[] __initdata = { |
851 |
+ { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, |
852 |
+ PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, |
853 |
+ { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, |
854 |
+- QFLAG_APPLY_ONCE, intel_graphics_quirks }, |
855 |
++ 0, intel_graphics_quirks }, |
856 |
+ /* |
857 |
+ * HPET on the current version of the Baytrail platform has accuracy |
858 |
+ * problems: it will halt in deep idle state - so we disable it. |
859 |
+diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c |
860 |
+index 58f51667e2e4b..8249685b40960 100644 |
861 |
+--- a/arch/x86/um/syscalls_64.c |
862 |
++++ b/arch/x86/um/syscalls_64.c |
863 |
+@@ -11,6 +11,7 @@ |
864 |
+ #include <linux/uaccess.h> |
865 |
+ #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
866 |
+ #include <os.h> |
867 |
++#include <registers.h> |
868 |
+ |
869 |
+ long arch_prctl(struct task_struct *task, int option, |
870 |
+ unsigned long __user *arg2) |
871 |
+@@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, |
872 |
+ switch (option) { |
873 |
+ case ARCH_SET_FS: |
874 |
+ case ARCH_SET_GS: |
875 |
+- ret = restore_registers(pid, ¤t->thread.regs.regs); |
876 |
++ ret = restore_pid_registers(pid, ¤t->thread.regs.regs); |
877 |
+ if (ret) |
878 |
+ return ret; |
879 |
+ break; |
880 |
+diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c |
881 |
+index ba9fbae0cf91f..319f4bc6a8394 100644 |
882 |
+--- a/drivers/acpi/acpica/exoparg1.c |
883 |
++++ b/drivers/acpi/acpica/exoparg1.c |
884 |
+@@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
885 |
+ (walk_state, return_desc, |
886 |
+ &temp_desc); |
887 |
+ if (ACPI_FAILURE(status)) { |
888 |
+- goto cleanup; |
889 |
++ return_ACPI_STATUS |
890 |
++ (status); |
891 |
+ } |
892 |
+ |
893 |
+ return_desc = temp_desc; |
894 |
+diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c |
895 |
+index 9516966124ae3..9380a5e214da4 100644 |
896 |
+--- a/drivers/acpi/acpica/hwesleep.c |
897 |
++++ b/drivers/acpi/acpica/hwesleep.c |
898 |
+@@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) |
899 |
+ |
900 |
+ /* Flush caches, as per ACPI specification */ |
901 |
+ |
902 |
+- ACPI_FLUSH_CPU_CACHE(); |
903 |
++ if (sleep_state < ACPI_STATE_S4) { |
904 |
++ ACPI_FLUSH_CPU_CACHE(); |
905 |
++ } |
906 |
+ |
907 |
+ status = acpi_os_enter_sleep(sleep_state, sleep_control, 0); |
908 |
+ if (status == AE_CTRL_TERMINATE) { |
909 |
+diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c |
910 |
+index f4282370947c8..6368ff544af1a 100644 |
911 |
+--- a/drivers/acpi/acpica/hwsleep.c |
912 |
++++ b/drivers/acpi/acpica/hwsleep.c |
913 |
+@@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) |
914 |
+ |
915 |
+ /* Flush caches, as per ACPI specification */ |
916 |
+ |
917 |
+- ACPI_FLUSH_CPU_CACHE(); |
918 |
++ if (sleep_state < ACPI_STATE_S4) { |
919 |
++ ACPI_FLUSH_CPU_CACHE(); |
920 |
++ } |
921 |
+ |
922 |
+ status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); |
923 |
+ if (status == AE_CTRL_TERMINATE) { |
924 |
+diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c |
925 |
+index dc1e44ccaae20..d0dca7dae080c 100644 |
926 |
+--- a/drivers/acpi/acpica/hwxfsleep.c |
927 |
++++ b/drivers/acpi/acpica/hwxfsleep.c |
928 |
+@@ -189,8 +189,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) |
929 |
+ return_ACPI_STATUS(status); |
930 |
+ } |
931 |
+ |
932 |
+- ACPI_FLUSH_CPU_CACHE(); |
933 |
+- |
934 |
+ status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
935 |
+ (u32)acpi_gbl_FADT.s4_bios_request, 8); |
936 |
+ |
937 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
938 |
+index 0dc8dea815823..db79a826e6b8d 100644 |
939 |
+--- a/drivers/acpi/acpica/utdelete.c |
940 |
++++ b/drivers/acpi/acpica/utdelete.c |
941 |
+@@ -410,6 +410,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
942 |
+ ACPI_WARNING((AE_INFO, |
943 |
+ "Obj %p, Reference Count is already zero, cannot decrement\n", |
944 |
+ object)); |
945 |
++ return; |
946 |
+ } |
947 |
+ |
948 |
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, |
949 |
+diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c |
950 |
+index 0bbf8b453ebf2..d4e42a578e186 100644 |
951 |
+--- a/drivers/acpi/battery.c |
952 |
++++ b/drivers/acpi/battery.c |
953 |
+@@ -78,6 +78,7 @@ static int battery_bix_broken_package; |
954 |
+ static int battery_notification_delay_ms; |
955 |
+ static int battery_ac_is_broken; |
956 |
+ static int battery_check_pmic = 1; |
957 |
++static int battery_quirk_notcharging; |
958 |
+ static unsigned int cache_time = 1000; |
959 |
+ module_param(cache_time, uint, 0644); |
960 |
+ MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
961 |
+@@ -246,6 +247,8 @@ static int acpi_battery_get_property(struct power_supply *psy, |
962 |
+ val->intval = POWER_SUPPLY_STATUS_CHARGING; |
963 |
+ else if (acpi_battery_is_charged(battery)) |
964 |
+ val->intval = POWER_SUPPLY_STATUS_FULL; |
965 |
++ else if (battery_quirk_notcharging) |
966 |
++ val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; |
967 |
+ else |
968 |
+ val->intval = POWER_SUPPLY_STATUS_UNKNOWN; |
969 |
+ break; |
970 |
+@@ -1350,6 +1353,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_system_id *d) |
971 |
+ return 0; |
972 |
+ } |
973 |
+ |
974 |
++static int __init battery_quirk_not_charging(const struct dmi_system_id *d) |
975 |
++{ |
976 |
++ battery_quirk_notcharging = 1; |
977 |
++ return 0; |
978 |
++} |
979 |
++ |
980 |
+ static const struct dmi_system_id bat_dmi_table[] __initconst = { |
981 |
+ { |
982 |
+ /* NEC LZ750/LS */ |
983 |
+@@ -1394,6 +1403,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { |
984 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), |
985 |
+ }, |
986 |
+ }, |
987 |
++ { |
988 |
++ /* |
989 |
++ * On Lenovo ThinkPads the BIOS specification defines |
990 |
++ * a state when the bits for charging and discharging |
991 |
++ * are both set to 0. That state is "Not Charging". |
992 |
++ */ |
993 |
++ .callback = battery_quirk_not_charging, |
994 |
++ .ident = "Lenovo ThinkPad", |
995 |
++ .matches = { |
996 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
997 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), |
998 |
++ }, |
999 |
++ }, |
1000 |
+ {}, |
1001 |
+ }; |
1002 |
+ |
1003 |
+diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
1004 |
+index 8f444b375761c..e6e95e67c40ee 100644 |
1005 |
+--- a/drivers/block/floppy.c |
1006 |
++++ b/drivers/block/floppy.c |
1007 |
+@@ -1002,7 +1002,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); |
1008 |
+ static void cancel_activity(void) |
1009 |
+ { |
1010 |
+ do_floppy = NULL; |
1011 |
+- cancel_delayed_work_sync(&fd_timer); |
1012 |
++ cancel_delayed_work(&fd_timer); |
1013 |
+ cancel_work_sync(&floppy_work); |
1014 |
+ } |
1015 |
+ |
1016 |
+@@ -3123,6 +3123,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
1017 |
+ } |
1018 |
+ } |
1019 |
+ |
1020 |
++#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) |
1021 |
++ |
1022 |
+ static int raw_cmd_copyin(int cmd, void __user *param, |
1023 |
+ struct floppy_raw_cmd **rcmd) |
1024 |
+ { |
1025 |
+@@ -3160,7 +3162,7 @@ loop: |
1026 |
+ ptr->resultcode = 0; |
1027 |
+ |
1028 |
+ if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { |
1029 |
+- if (ptr->length <= 0) |
1030 |
++ if (ptr->length <= 0 || ptr->length >= MAX_LEN) |
1031 |
+ return -EINVAL; |
1032 |
+ ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); |
1033 |
+ fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); |
1034 |
+diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c |
1035 |
+index 0588639b899aa..ef7ed471b6418 100644 |
1036 |
+--- a/drivers/bluetooth/bfusb.c |
1037 |
++++ b/drivers/bluetooth/bfusb.c |
1038 |
+@@ -644,6 +644,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i |
1039 |
+ data->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; |
1040 |
+ data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize); |
1041 |
+ |
1042 |
++ if (!data->bulk_pkt_size) |
1043 |
++ goto done; |
1044 |
++ |
1045 |
+ rwlock_init(&data->lock); |
1046 |
+ |
1047 |
+ data->reassembly = NULL; |
1048 |
+diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c |
1049 |
+index 3e386f68faa02..1a298f13bcc87 100644 |
1050 |
+--- a/drivers/bluetooth/hci_bcm.c |
1051 |
++++ b/drivers/bluetooth/hci_bcm.c |
1052 |
+@@ -1052,7 +1052,12 @@ static int bcm_probe(struct platform_device *pdev) |
1053 |
+ return -ENOMEM; |
1054 |
+ |
1055 |
+ dev->dev = &pdev->dev; |
1056 |
+- dev->irq = platform_get_irq(pdev, 0); |
1057 |
++ |
1058 |
++ ret = platform_get_irq(pdev, 0); |
1059 |
++ if (ret < 0) |
1060 |
++ return ret; |
1061 |
++ |
1062 |
++ dev->irq = ret; |
1063 |
+ |
1064 |
+ if (has_acpi_companion(&pdev->dev)) { |
1065 |
+ ret = bcm_acpi_probe(dev); |
1066 |
+diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h |
1067 |
+index 9ccb6b270b071..95164246afd1a 100644 |
1068 |
+--- a/drivers/char/mwave/3780i.h |
1069 |
++++ b/drivers/char/mwave/3780i.h |
1070 |
+@@ -68,7 +68,7 @@ typedef struct { |
1071 |
+ unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ |
1072 |
+ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ |
1073 |
+ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ |
1074 |
+- unsigned char Reserved:5; /* 0: Reserved */ |
1075 |
++ unsigned short Reserved:13; /* 0: Reserved */ |
1076 |
+ } DSP_ISA_SLAVE_CONTROL; |
1077 |
+ |
1078 |
+ |
1079 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
1080 |
+index 297a716f5a560..1127343781465 100644 |
1081 |
+--- a/drivers/char/random.c |
1082 |
++++ b/drivers/char/random.c |
1083 |
+@@ -831,8 +831,8 @@ static void do_numa_crng_init(struct work_struct *work) |
1084 |
+ crng_initialize(crng); |
1085 |
+ pool[i] = crng; |
1086 |
+ } |
1087 |
+- mb(); |
1088 |
+- if (cmpxchg(&crng_node_pool, NULL, pool)) { |
1089 |
++ /* pairs with READ_ONCE() in select_crng() */ |
1090 |
++ if (cmpxchg_release(&crng_node_pool, NULL, pool) != NULL) { |
1091 |
+ for_each_node(i) |
1092 |
+ kfree(pool[i]); |
1093 |
+ kfree(pool); |
1094 |
+@@ -845,8 +845,26 @@ static void numa_crng_init(void) |
1095 |
+ { |
1096 |
+ schedule_work(&numa_crng_init_work); |
1097 |
+ } |
1098 |
++ |
1099 |
++static struct crng_state *select_crng(void) |
1100 |
++{ |
1101 |
++ struct crng_state **pool; |
1102 |
++ int nid = numa_node_id(); |
1103 |
++ |
1104 |
++ /* pairs with cmpxchg_release() in do_numa_crng_init() */ |
1105 |
++ pool = READ_ONCE(crng_node_pool); |
1106 |
++ if (pool && pool[nid]) |
1107 |
++ return pool[nid]; |
1108 |
++ |
1109 |
++ return &primary_crng; |
1110 |
++} |
1111 |
+ #else |
1112 |
+ static void numa_crng_init(void) {} |
1113 |
++ |
1114 |
++static struct crng_state *select_crng(void) |
1115 |
++{ |
1116 |
++ return &primary_crng; |
1117 |
++} |
1118 |
+ #endif |
1119 |
+ |
1120 |
+ /* |
1121 |
+@@ -951,7 +969,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) |
1122 |
+ crng->state[i+4] ^= buf.key[i] ^ rv; |
1123 |
+ } |
1124 |
+ memzero_explicit(&buf, sizeof(buf)); |
1125 |
+- crng->init_time = jiffies; |
1126 |
++ WRITE_ONCE(crng->init_time, jiffies); |
1127 |
+ spin_unlock_irqrestore(&crng->lock, flags); |
1128 |
+ if (crng == &primary_crng && crng_init < 2) { |
1129 |
+ invalidate_batched_entropy(); |
1130 |
+@@ -978,12 +996,15 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) |
1131 |
+ static void _extract_crng(struct crng_state *crng, |
1132 |
+ __u8 out[CHACHA20_BLOCK_SIZE]) |
1133 |
+ { |
1134 |
+- unsigned long v, flags; |
1135 |
+- |
1136 |
+- if (crng_ready() && |
1137 |
+- (time_after(crng_global_init_time, crng->init_time) || |
1138 |
+- time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL))) |
1139 |
+- crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL); |
1140 |
++ unsigned long v, flags, init_time; |
1141 |
++ |
1142 |
++ if (crng_ready()) { |
1143 |
++ init_time = READ_ONCE(crng->init_time); |
1144 |
++ if (time_after(READ_ONCE(crng_global_init_time), init_time) || |
1145 |
++ time_after(jiffies, init_time + CRNG_RESEED_INTERVAL)) |
1146 |
++ crng_reseed(crng, crng == &primary_crng ? |
1147 |
++ &input_pool : NULL); |
1148 |
++ } |
1149 |
+ spin_lock_irqsave(&crng->lock, flags); |
1150 |
+ if (arch_get_random_long(&v)) |
1151 |
+ crng->state[14] ^= v; |
1152 |
+@@ -995,15 +1016,7 @@ static void _extract_crng(struct crng_state *crng, |
1153 |
+ |
1154 |
+ static void extract_crng(__u8 out[CHACHA20_BLOCK_SIZE]) |
1155 |
+ { |
1156 |
+- struct crng_state *crng = NULL; |
1157 |
+- |
1158 |
+-#ifdef CONFIG_NUMA |
1159 |
+- if (crng_node_pool) |
1160 |
+- crng = crng_node_pool[numa_node_id()]; |
1161 |
+- if (crng == NULL) |
1162 |
+-#endif |
1163 |
+- crng = &primary_crng; |
1164 |
+- _extract_crng(crng, out); |
1165 |
++ _extract_crng(select_crng(), out); |
1166 |
+ } |
1167 |
+ |
1168 |
+ /* |
1169 |
+@@ -1032,15 +1045,7 @@ static void _crng_backtrack_protect(struct crng_state *crng, |
1170 |
+ |
1171 |
+ static void crng_backtrack_protect(__u8 tmp[CHACHA20_BLOCK_SIZE], int used) |
1172 |
+ { |
1173 |
+- struct crng_state *crng = NULL; |
1174 |
+- |
1175 |
+-#ifdef CONFIG_NUMA |
1176 |
+- if (crng_node_pool) |
1177 |
+- crng = crng_node_pool[numa_node_id()]; |
1178 |
+- if (crng == NULL) |
1179 |
+-#endif |
1180 |
+- crng = &primary_crng; |
1181 |
+- _crng_backtrack_protect(crng, tmp, used); |
1182 |
++ _crng_backtrack_protect(select_crng(), tmp, used); |
1183 |
+ } |
1184 |
+ |
1185 |
+ static ssize_t extract_crng_user(void __user *buf, size_t nbytes) |
1186 |
+@@ -2072,7 +2077,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) |
1187 |
+ if (crng_init < 2) |
1188 |
+ return -ENODATA; |
1189 |
+ crng_reseed(&primary_crng, &input_pool); |
1190 |
+- crng_global_init_time = jiffies - 1; |
1191 |
++ WRITE_ONCE(crng_global_init_time, jiffies - 1); |
1192 |
+ return 0; |
1193 |
+ default: |
1194 |
+ return -EINVAL; |
1195 |
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
1196 |
+index c9a5f34097df5..c95ce9323d77a 100644 |
1197 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
1198 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
1199 |
+@@ -874,7 +874,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1200 |
+ intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | |
1201 |
+ TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; |
1202 |
+ intmask &= ~TPM_GLOBAL_INT_ENABLE; |
1203 |
++ |
1204 |
++ rc = request_locality(chip, 0); |
1205 |
++ if (rc < 0) { |
1206 |
++ rc = -ENODEV; |
1207 |
++ goto out_err; |
1208 |
++ } |
1209 |
++ |
1210 |
+ tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); |
1211 |
++ release_locality(chip, 0); |
1212 |
+ |
1213 |
+ rc = tpm2_probe(chip); |
1214 |
+ if (rc) |
1215 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
1216 |
+index e4fee233849d2..fd78dd5356ed7 100644 |
1217 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
1218 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
1219 |
+@@ -915,8 +915,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) |
1220 |
+ |
1221 |
+ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1222 |
+ unsigned long rate, |
1223 |
+- unsigned long parent_rate, |
1224 |
+- bool round_up) |
1225 |
++ unsigned long parent_rate) |
1226 |
+ { |
1227 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
1228 |
+ const struct bcm2835_clock_data *data = clock->data; |
1229 |
+@@ -928,10 +927,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1230 |
+ |
1231 |
+ rem = do_div(temp, rate); |
1232 |
+ div = temp; |
1233 |
+- |
1234 |
+- /* Round up and mask off the unused bits */ |
1235 |
+- if (round_up && ((div & unused_frac_mask) != 0 || rem != 0)) |
1236 |
+- div += unused_frac_mask + 1; |
1237 |
+ div &= ~unused_frac_mask; |
1238 |
+ |
1239 |
+ /* different clamping limits apply for a mash clock */ |
1240 |
+@@ -1062,7 +1057,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, |
1241 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
1242 |
+ struct bcm2835_cprman *cprman = clock->cprman; |
1243 |
+ const struct bcm2835_clock_data *data = clock->data; |
1244 |
+- u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); |
1245 |
++ u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate); |
1246 |
+ u32 ctl; |
1247 |
+ |
1248 |
+ spin_lock(&cprman->regs_lock); |
1249 |
+@@ -1113,7 +1108,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw, |
1250 |
+ |
1251 |
+ if (!(BIT(parent_idx) & data->set_rate_parent)) { |
1252 |
+ *prate = clk_hw_get_rate(parent); |
1253 |
+- *div = bcm2835_clock_choose_div(hw, rate, *prate, true); |
1254 |
++ *div = bcm2835_clock_choose_div(hw, rate, *prate); |
1255 |
+ |
1256 |
+ *avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div); |
1257 |
+ |
1258 |
+@@ -1199,7 +1194,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw, |
1259 |
+ rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate, |
1260 |
+ &div, &prate, |
1261 |
+ &avgrate); |
1262 |
+- if (rate > best_rate && rate <= req->rate) { |
1263 |
++ if (abs(req->rate - rate) < abs(req->rate - best_rate)) { |
1264 |
+ best_parent = parent; |
1265 |
+ best_prate = prate; |
1266 |
+ best_rate = rate; |
1267 |
+diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c |
1268 |
+index d8a5db11b7ea1..bffd4d15145d9 100644 |
1269 |
+--- a/drivers/crypto/qce/sha.c |
1270 |
++++ b/drivers/crypto/qce/sha.c |
1271 |
+@@ -521,8 +521,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, |
1272 |
+ |
1273 |
+ ret = crypto_register_ahash(alg); |
1274 |
+ if (ret) { |
1275 |
+- kfree(tmpl); |
1276 |
+ dev_err(qce->dev, "%s registration failed\n", base->cra_name); |
1277 |
++ kfree(tmpl); |
1278 |
+ return ret; |
1279 |
+ } |
1280 |
+ |
1281 |
+diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c |
1282 |
+index 23b0b7bd64c7f..b3b49dce11369 100644 |
1283 |
+--- a/drivers/crypto/stm32/stm32-cryp.c |
1284 |
++++ b/drivers/crypto/stm32/stm32-cryp.c |
1285 |
+@@ -2036,8 +2036,6 @@ err_engine1: |
1286 |
+ list_del(&cryp->list); |
1287 |
+ spin_unlock(&cryp_list.lock); |
1288 |
+ |
1289 |
+- pm_runtime_disable(dev); |
1290 |
+- pm_runtime_put_noidle(dev); |
1291 |
+ pm_runtime_disable(dev); |
1292 |
+ pm_runtime_put_noidle(dev); |
1293 |
+ |
1294 |
+diff --git a/drivers/crypto/stm32/stm32_crc32.c b/drivers/crypto/stm32/stm32_crc32.c |
1295 |
+index 47d31335c2d42..6848f34a9e66a 100644 |
1296 |
+--- a/drivers/crypto/stm32/stm32_crc32.c |
1297 |
++++ b/drivers/crypto/stm32/stm32_crc32.c |
1298 |
+@@ -230,7 +230,7 @@ static struct shash_alg algs[] = { |
1299 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
1300 |
+ .base = { |
1301 |
+ .cra_name = "crc32", |
1302 |
+- .cra_driver_name = DRIVER_NAME, |
1303 |
++ .cra_driver_name = "stm32-crc32-crc32", |
1304 |
+ .cra_priority = 200, |
1305 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
1306 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
1307 |
+@@ -252,7 +252,7 @@ static struct shash_alg algs[] = { |
1308 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
1309 |
+ .base = { |
1310 |
+ .cra_name = "crc32c", |
1311 |
+- .cra_driver_name = DRIVER_NAME, |
1312 |
++ .cra_driver_name = "stm32-crc32-crc32c", |
1313 |
+ .cra_priority = 200, |
1314 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
1315 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
1316 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
1317 |
+index 1624eee76f96a..04704c6376baf 100644 |
1318 |
+--- a/drivers/dma/at_xdmac.c |
1319 |
++++ b/drivers/dma/at_xdmac.c |
1320 |
+@@ -100,6 +100,7 @@ |
1321 |
+ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ |
1322 |
+ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ |
1323 |
+ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ |
1324 |
++#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) |
1325 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ |
1326 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ |
1327 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ |
1328 |
+@@ -231,15 +232,15 @@ struct at_xdmac { |
1329 |
+ |
1330 |
+ /* Linked List Descriptor */ |
1331 |
+ struct at_xdmac_lld { |
1332 |
+- dma_addr_t mbr_nda; /* Next Descriptor Member */ |
1333 |
+- u32 mbr_ubc; /* Microblock Control Member */ |
1334 |
+- dma_addr_t mbr_sa; /* Source Address Member */ |
1335 |
+- dma_addr_t mbr_da; /* Destination Address Member */ |
1336 |
+- u32 mbr_cfg; /* Configuration Register */ |
1337 |
+- u32 mbr_bc; /* Block Control Register */ |
1338 |
+- u32 mbr_ds; /* Data Stride Register */ |
1339 |
+- u32 mbr_sus; /* Source Microblock Stride Register */ |
1340 |
+- u32 mbr_dus; /* Destination Microblock Stride Register */ |
1341 |
++ u32 mbr_nda; /* Next Descriptor Member */ |
1342 |
++ u32 mbr_ubc; /* Microblock Control Member */ |
1343 |
++ u32 mbr_sa; /* Source Address Member */ |
1344 |
++ u32 mbr_da; /* Destination Address Member */ |
1345 |
++ u32 mbr_cfg; /* Configuration Register */ |
1346 |
++ u32 mbr_bc; /* Block Control Register */ |
1347 |
++ u32 mbr_ds; /* Data Stride Register */ |
1348 |
++ u32 mbr_sus; /* Source Microblock Stride Register */ |
1349 |
++ u32 mbr_dus; /* Destination Microblock Stride Register */ |
1350 |
+ }; |
1351 |
+ |
1352 |
+ /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ |
1353 |
+@@ -344,9 +345,6 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
1354 |
+ |
1355 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); |
1356 |
+ |
1357 |
+- if (at_xdmac_chan_is_enabled(atchan)) |
1358 |
+- return; |
1359 |
+- |
1360 |
+ /* Set transfer as active to not try to start it again. */ |
1361 |
+ first->active_xfer = true; |
1362 |
+ |
1363 |
+@@ -362,7 +360,8 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
1364 |
+ */ |
1365 |
+ if (at_xdmac_chan_is_cyclic(atchan)) |
1366 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV1; |
1367 |
+- else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) |
1368 |
++ else if ((first->lld.mbr_ubc & |
1369 |
++ AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) |
1370 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV3; |
1371 |
+ else |
1372 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV2; |
1373 |
+@@ -427,13 +426,12 @@ static dma_cookie_t at_xdmac_tx_submit(struct dma_async_tx_descriptor *tx) |
1374 |
+ spin_lock_irqsave(&atchan->lock, irqflags); |
1375 |
+ cookie = dma_cookie_assign(tx); |
1376 |
+ |
1377 |
++ list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
1378 |
++ spin_unlock_irqrestore(&atchan->lock, irqflags); |
1379 |
++ |
1380 |
+ dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", |
1381 |
+ __func__, atchan, desc); |
1382 |
+- list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
1383 |
+- if (list_is_singular(&atchan->xfers_list)) |
1384 |
+- at_xdmac_start_xfer(atchan, desc); |
1385 |
+ |
1386 |
+- spin_unlock_irqrestore(&atchan->lock, irqflags); |
1387 |
+ return cookie; |
1388 |
+ } |
1389 |
+ |
1390 |
+diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c |
1391 |
+index eb3a1f42ab065..e8b2d3e31de80 100644 |
1392 |
+--- a/drivers/dma/mmp_pdma.c |
1393 |
++++ b/drivers/dma/mmp_pdma.c |
1394 |
+@@ -722,12 +722,6 @@ static int mmp_pdma_config(struct dma_chan *dchan, |
1395 |
+ |
1396 |
+ chan->dir = cfg->direction; |
1397 |
+ chan->dev_addr = addr; |
1398 |
+- /* FIXME: drivers should be ported over to use the filter |
1399 |
+- * function. Once that's done, the following two lines can |
1400 |
+- * be removed. |
1401 |
+- */ |
1402 |
+- if (cfg->slave_id) |
1403 |
+- chan->drcmr = cfg->slave_id; |
1404 |
+ |
1405 |
+ return 0; |
1406 |
+ } |
1407 |
+diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c |
1408 |
+index b31c28b67ad3e..c54986902b9d2 100644 |
1409 |
+--- a/drivers/dma/pxa_dma.c |
1410 |
++++ b/drivers/dma/pxa_dma.c |
1411 |
+@@ -960,13 +960,6 @@ static void pxad_get_config(struct pxad_chan *chan, |
1412 |
+ *dcmd |= PXA_DCMD_BURST16; |
1413 |
+ else if (maxburst == 32) |
1414 |
+ *dcmd |= PXA_DCMD_BURST32; |
1415 |
+- |
1416 |
+- /* FIXME: drivers should be ported over to use the filter |
1417 |
+- * function. Once that's done, the following two lines can |
1418 |
+- * be removed. |
1419 |
+- */ |
1420 |
+- if (chan->cfg.slave_id) |
1421 |
+- chan->drcmr = chan->cfg.slave_id; |
1422 |
+ } |
1423 |
+ |
1424 |
+ static struct dma_async_tx_descriptor * |
1425 |
+diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c |
1426 |
+index 9c6867916e890..8585fed84e836 100644 |
1427 |
+--- a/drivers/dma/stm32-mdma.c |
1428 |
++++ b/drivers/dma/stm32-mdma.c |
1429 |
+@@ -194,7 +194,7 @@ |
1430 |
+ #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) |
1431 |
+ #define STM32_MDMA_CTBR_DBUS BIT(17) |
1432 |
+ #define STM32_MDMA_CTBR_SBUS BIT(16) |
1433 |
+-#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) |
1434 |
++#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) |
1435 |
+ #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ |
1436 |
+ STM32_MDMA_CTBR_TSEL_MASK) |
1437 |
+ |
1438 |
+diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig |
1439 |
+index a456a000048b9..5a2e2d2a0fff6 100644 |
1440 |
+--- a/drivers/firmware/google/Kconfig |
1441 |
++++ b/drivers/firmware/google/Kconfig |
1442 |
+@@ -2,9 +2,9 @@ menuconfig GOOGLE_FIRMWARE |
1443 |
+ bool "Google Firmware Drivers" |
1444 |
+ default n |
1445 |
+ help |
1446 |
+- These firmware drivers are used by Google's servers. They are |
1447 |
+- only useful if you are working directly on one of their |
1448 |
+- proprietary servers. If in doubt, say "N". |
1449 |
++ These firmware drivers are used by Google servers, |
1450 |
++ Chromebooks and other devices using coreboot firmware. |
1451 |
++ If in doubt, say "N". |
1452 |
+ |
1453 |
+ if GOOGLE_FIRMWARE |
1454 |
+ |
1455 |
+diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c |
1456 |
+index 59db70fb45614..314b9bb78e437 100644 |
1457 |
+--- a/drivers/firmware/qemu_fw_cfg.c |
1458 |
++++ b/drivers/firmware/qemu_fw_cfg.c |
1459 |
+@@ -385,9 +385,7 @@ static void fw_cfg_sysfs_cache_cleanup(void) |
1460 |
+ struct fw_cfg_sysfs_entry *entry, *next; |
1461 |
+ |
1462 |
+ list_for_each_entry_safe(entry, next, &fw_cfg_entry_cache, list) { |
1463 |
+- /* will end up invoking fw_cfg_sysfs_cache_delist() |
1464 |
+- * via each object's release() method (i.e. destructor) |
1465 |
+- */ |
1466 |
++ fw_cfg_sysfs_cache_delist(entry); |
1467 |
+ kobject_put(&entry->kobj); |
1468 |
+ } |
1469 |
+ } |
1470 |
+@@ -445,7 +443,6 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj) |
1471 |
+ { |
1472 |
+ struct fw_cfg_sysfs_entry *entry = to_entry(kobj); |
1473 |
+ |
1474 |
+- fw_cfg_sysfs_cache_delist(entry); |
1475 |
+ kfree(entry); |
1476 |
+ } |
1477 |
+ |
1478 |
+@@ -598,20 +595,18 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) |
1479 |
+ /* set file entry information */ |
1480 |
+ entry->size = be32_to_cpu(f->size); |
1481 |
+ entry->select = be16_to_cpu(f->select); |
1482 |
+- memcpy(entry->name, f->name, FW_CFG_MAX_FILE_PATH); |
1483 |
++ strscpy(entry->name, f->name, FW_CFG_MAX_FILE_PATH); |
1484 |
+ |
1485 |
+ /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */ |
1486 |
+ err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, |
1487 |
+ fw_cfg_sel_ko, "%d", entry->select); |
1488 |
+- if (err) { |
1489 |
+- kobject_put(&entry->kobj); |
1490 |
+- return err; |
1491 |
+- } |
1492 |
++ if (err) |
1493 |
++ goto err_put_entry; |
1494 |
+ |
1495 |
+ /* add raw binary content access */ |
1496 |
+ err = sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw); |
1497 |
+ if (err) |
1498 |
+- goto err_add_raw; |
1499 |
++ goto err_del_entry; |
1500 |
+ |
1501 |
+ /* try adding "/sys/firmware/qemu_fw_cfg/by_name/" symlink */ |
1502 |
+ fw_cfg_build_symlink(fw_cfg_fname_kset, &entry->kobj, entry->name); |
1503 |
+@@ -620,9 +615,10 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) |
1504 |
+ fw_cfg_sysfs_cache_enlist(entry); |
1505 |
+ return 0; |
1506 |
+ |
1507 |
+-err_add_raw: |
1508 |
++err_del_entry: |
1509 |
+ kobject_del(&entry->kobj); |
1510 |
+- kfree(entry); |
1511 |
++err_put_entry: |
1512 |
++ kobject_put(&entry->kobj); |
1513 |
+ return err; |
1514 |
+ } |
1515 |
+ |
1516 |
+diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c |
1517 |
+index b018909a4e46c..47cdc1f89e3fb 100644 |
1518 |
+--- a/drivers/gpio/gpiolib-acpi.c |
1519 |
++++ b/drivers/gpio/gpiolib-acpi.c |
1520 |
+@@ -904,10 +904,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
1521 |
+ irq_flags = acpi_dev_get_irq_type(info.triggering, |
1522 |
+ info.polarity); |
1523 |
+ |
1524 |
+- /* Set type if specified and different than the current one */ |
1525 |
+- if (irq_flags != IRQ_TYPE_NONE && |
1526 |
+- irq_flags != irq_get_trigger_type(irq)) |
1527 |
+- irq_set_irq_type(irq, irq_flags); |
1528 |
++ /* |
1529 |
++ * If the IRQ is not already in use then set type |
1530 |
++ * if specified and different than the current one. |
1531 |
++ */ |
1532 |
++ if (can_request_irq(irq, irq_flags)) { |
1533 |
++ if (irq_flags != IRQ_TYPE_NONE && |
1534 |
++ irq_flags != irq_get_trigger_type(irq)) |
1535 |
++ irq_set_irq_type(irq, irq_flags); |
1536 |
++ } else { |
1537 |
++ dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); |
1538 |
++ } |
1539 |
+ |
1540 |
+ return irq; |
1541 |
+ } |
1542 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1543 |
+index e1be3fd4d7a45..3e4305c3c9831 100644 |
1544 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1545 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1546 |
+@@ -388,6 +388,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
1547 |
+ native_mode->vdisplay != 0 && |
1548 |
+ native_mode->clock != 0) { |
1549 |
+ mode = drm_mode_duplicate(dev, native_mode); |
1550 |
++ if (!mode) |
1551 |
++ return NULL; |
1552 |
++ |
1553 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
1554 |
+ drm_mode_set_name(mode); |
1555 |
+ |
1556 |
+@@ -402,6 +405,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
1557 |
+ * simpler. |
1558 |
+ */ |
1559 |
+ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); |
1560 |
++ if (!mode) |
1561 |
++ return NULL; |
1562 |
++ |
1563 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
1564 |
+ DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); |
1565 |
+ } |
1566 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
1567 |
+index 1a744f964b301..358004a4650b6 100644 |
1568 |
+--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
1569 |
++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
1570 |
+@@ -520,10 +520,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev) |
1571 |
+ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) |
1572 |
+ { |
1573 |
+ int r; |
1574 |
++ u32 tmp; |
1575 |
+ |
1576 |
+ adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); |
1577 |
+ if (!adev->gmc.vram_width) { |
1578 |
+- u32 tmp; |
1579 |
+ int chansize, numchan; |
1580 |
+ |
1581 |
+ /* Get VRAM informations */ |
1582 |
+@@ -567,8 +567,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) |
1583 |
+ adev->gmc.vram_width = numchan * chansize; |
1584 |
+ } |
1585 |
+ /* size in MB on si */ |
1586 |
+- adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
1587 |
+- adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
1588 |
++ tmp = RREG32(mmCONFIG_MEMSIZE); |
1589 |
++ /* some boards may have garbage in the upper 16 bits */ |
1590 |
++ if (tmp & 0xffff0000) { |
1591 |
++ DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); |
1592 |
++ if (tmp & 0xffff) |
1593 |
++ tmp &= 0xffff; |
1594 |
++ } |
1595 |
++ adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; |
1596 |
++ adev->gmc.real_vram_size = adev->gmc.mc_vram_size; |
1597 |
+ |
1598 |
+ if (!(adev->flags & AMD_IS_APU)) { |
1599 |
+ r = amdgpu_device_resize_fb_bar(adev); |
1600 |
+diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1601 |
+index dcf091f9d843f..a8d776edccc15 100644 |
1602 |
+--- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1603 |
++++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1604 |
+@@ -302,19 +302,10 @@ out: |
1605 |
+ mutex_unlock(&ge_b850v3_lvds_dev_mutex); |
1606 |
+ } |
1607 |
+ |
1608 |
+-static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1609 |
+- const struct i2c_device_id *id) |
1610 |
++static int ge_b850v3_register(void) |
1611 |
+ { |
1612 |
++ struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c; |
1613 |
+ struct device *dev = &stdp4028_i2c->dev; |
1614 |
+- int ret; |
1615 |
+- |
1616 |
+- ret = ge_b850v3_lvds_init(dev); |
1617 |
+- |
1618 |
+- if (ret) |
1619 |
+- return ret; |
1620 |
+- |
1621 |
+- ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
1622 |
+- i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
1623 |
+ |
1624 |
+ /* drm bridge initialization */ |
1625 |
+ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; |
1626 |
+@@ -336,6 +327,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1627 |
+ "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); |
1628 |
+ } |
1629 |
+ |
1630 |
++static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1631 |
++ const struct i2c_device_id *id) |
1632 |
++{ |
1633 |
++ struct device *dev = &stdp4028_i2c->dev; |
1634 |
++ int ret; |
1635 |
++ |
1636 |
++ ret = ge_b850v3_lvds_init(dev); |
1637 |
++ |
1638 |
++ if (ret) |
1639 |
++ return ret; |
1640 |
++ |
1641 |
++ ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
1642 |
++ i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
1643 |
++ |
1644 |
++ /* Only register after both bridges are probed */ |
1645 |
++ if (!ge_b850v3_lvds_ptr->stdp2690_i2c) |
1646 |
++ return 0; |
1647 |
++ |
1648 |
++ return ge_b850v3_register(); |
1649 |
++} |
1650 |
++ |
1651 |
+ static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) |
1652 |
+ { |
1653 |
+ ge_b850v3_lvds_remove(); |
1654 |
+@@ -379,7 +391,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, |
1655 |
+ ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; |
1656 |
+ i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); |
1657 |
+ |
1658 |
+- return 0; |
1659 |
++ /* Only register after both bridges are probed */ |
1660 |
++ if (!ge_b850v3_lvds_ptr->stdp4028_i2c) |
1661 |
++ return 0; |
1662 |
++ |
1663 |
++ return ge_b850v3_register(); |
1664 |
+ } |
1665 |
+ |
1666 |
+ static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) |
1667 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1668 |
+index 983e67f19e450..2b57a581b29e2 100644 |
1669 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1670 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1671 |
+@@ -444,6 +444,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, |
1672 |
+ return -EINVAL; |
1673 |
+ } |
1674 |
+ |
1675 |
++ if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || |
1676 |
++ args->nr_bos > SZ_64K || args->nr_pmrs > 128) { |
1677 |
++ DRM_ERROR("submit arguments out of size limits\n"); |
1678 |
++ return -EINVAL; |
1679 |
++ } |
1680 |
++ |
1681 |
+ /* |
1682 |
+ * Copy the command submission and bo array to kernel space in |
1683 |
+ * one go, and do this outside of any locks. |
1684 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
1685 |
+index aa8d2aca0f02f..1847faa45d370 100644 |
1686 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
1687 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
1688 |
+@@ -3002,9 +3002,9 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv) |
1689 |
+ * The BIOS provided WM memory latency values are often |
1690 |
+ * inadequate for high resolution displays. Adjust them. |
1691 |
+ */ |
1692 |
+- changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) | |
1693 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) | |
1694 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
1695 |
++ changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12); |
1696 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12); |
1697 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
1698 |
+ |
1699 |
+ if (!changed) |
1700 |
+ return; |
1701 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
1702 |
+index 2d9b7b5fb49c8..52474dcd25738 100644 |
1703 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
1704 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
1705 |
+@@ -97,8 +97,8 @@ static int _dpu_danger_signal_status(struct seq_file *s, |
1706 |
+ &status); |
1707 |
+ } else { |
1708 |
+ seq_puts(s, "\nSafe signal status:\n"); |
1709 |
+- if (kms->hw_mdp->ops.get_danger_status) |
1710 |
+- kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, |
1711 |
++ if (kms->hw_mdp->ops.get_safe_status) |
1712 |
++ kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, |
1713 |
+ &status); |
1714 |
+ } |
1715 |
+ pm_runtime_put_sync(&kms->pdev->dev); |
1716 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1717 |
+index ce70a193caa7f..8cf3d1b4662de 100644 |
1718 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1719 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1720 |
+@@ -70,20 +70,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) |
1721 |
+ return 0; |
1722 |
+ } |
1723 |
+ |
1724 |
+-static int |
1725 |
++static void |
1726 |
+ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
1727 |
+ { |
1728 |
+ struct nvkm_device *device = pmu->subdev.device; |
1729 |
+ |
1730 |
+ if (!pmu->func->enabled(pmu)) |
1731 |
+- return 0; |
1732 |
+- |
1733 |
+- /* Inhibit interrupts, and wait for idle. */ |
1734 |
+- nvkm_wr32(device, 0x10a014, 0x0000ffff); |
1735 |
+- nvkm_msec(device, 2000, |
1736 |
+- if (!nvkm_rd32(device, 0x10a04c)) |
1737 |
+- break; |
1738 |
+- ); |
1739 |
++ return; |
1740 |
+ |
1741 |
+ /* Reset. */ |
1742 |
+ if (pmu->func->reset) |
1743 |
+@@ -94,25 +87,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
1744 |
+ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) |
1745 |
+ break; |
1746 |
+ ); |
1747 |
+- |
1748 |
+- return 0; |
1749 |
+ } |
1750 |
+ |
1751 |
+ static int |
1752 |
+ nvkm_pmu_preinit(struct nvkm_subdev *subdev) |
1753 |
+ { |
1754 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
1755 |
+- return nvkm_pmu_reset(pmu); |
1756 |
++ nvkm_pmu_reset(pmu); |
1757 |
++ return 0; |
1758 |
+ } |
1759 |
+ |
1760 |
+ static int |
1761 |
+ nvkm_pmu_init(struct nvkm_subdev *subdev) |
1762 |
+ { |
1763 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
1764 |
+- int ret = nvkm_pmu_reset(pmu); |
1765 |
+- if (ret == 0 && pmu->func->init) |
1766 |
+- ret = pmu->func->init(pmu); |
1767 |
+- return ret; |
1768 |
++ struct nvkm_device *device = pmu->subdev.device; |
1769 |
++ |
1770 |
++ if (!pmu->func->init) |
1771 |
++ return 0; |
1772 |
++ |
1773 |
++ if (pmu->func->enabled(pmu)) { |
1774 |
++ /* Inhibit interrupts, and wait for idle. */ |
1775 |
++ nvkm_wr32(device, 0x10a014, 0x0000ffff); |
1776 |
++ nvkm_msec(device, 2000, |
1777 |
++ if (!nvkm_rd32(device, 0x10a04c)) |
1778 |
++ break; |
1779 |
++ ); |
1780 |
++ |
1781 |
++ nvkm_pmu_reset(pmu); |
1782 |
++ } |
1783 |
++ |
1784 |
++ return pmu->func->init(pmu); |
1785 |
+ } |
1786 |
+ |
1787 |
+ static int |
1788 |
+diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
1789 |
+index 88c7d035ace66..362ff5555d2e7 100644 |
1790 |
+--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
1791 |
++++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
1792 |
+@@ -512,6 +512,7 @@ static void innolux_panel_del(struct innolux_panel *innolux) |
1793 |
+ static int innolux_panel_probe(struct mipi_dsi_device *dsi) |
1794 |
+ { |
1795 |
+ const struct panel_desc *desc; |
1796 |
++ struct innolux_panel *innolux; |
1797 |
+ int err; |
1798 |
+ |
1799 |
+ desc = of_device_get_match_data(&dsi->dev); |
1800 |
+@@ -523,7 +524,14 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi) |
1801 |
+ if (err < 0) |
1802 |
+ return err; |
1803 |
+ |
1804 |
+- return mipi_dsi_attach(dsi); |
1805 |
++ err = mipi_dsi_attach(dsi); |
1806 |
++ if (err < 0) { |
1807 |
++ innolux = mipi_dsi_get_drvdata(dsi); |
1808 |
++ innolux_panel_del(innolux); |
1809 |
++ return err; |
1810 |
++ } |
1811 |
++ |
1812 |
++ return 0; |
1813 |
+ } |
1814 |
+ |
1815 |
+ static int innolux_panel_remove(struct mipi_dsi_device *dsi) |
1816 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
1817 |
+index 3f75b4be7fa4a..36c7d0d26e884 100644 |
1818 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
1819 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
1820 |
+@@ -623,6 +623,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) |
1821 |
+ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
1822 |
+ { |
1823 |
+ struct radeon_device *rdev = dev->dev_private; |
1824 |
++ struct radeon_fpriv *fpriv; |
1825 |
++ struct radeon_vm *vm; |
1826 |
+ int r; |
1827 |
+ |
1828 |
+ file_priv->driver_priv = NULL; |
1829 |
+@@ -635,48 +637,52 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
1830 |
+ |
1831 |
+ /* new gpu have virtual address space support */ |
1832 |
+ if (rdev->family >= CHIP_CAYMAN) { |
1833 |
+- struct radeon_fpriv *fpriv; |
1834 |
+- struct radeon_vm *vm; |
1835 |
+ |
1836 |
+ fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
1837 |
+ if (unlikely(!fpriv)) { |
1838 |
+ r = -ENOMEM; |
1839 |
+- goto out_suspend; |
1840 |
++ goto err_suspend; |
1841 |
+ } |
1842 |
+ |
1843 |
+ if (rdev->accel_working) { |
1844 |
+ vm = &fpriv->vm; |
1845 |
+ r = radeon_vm_init(rdev, vm); |
1846 |
+- if (r) { |
1847 |
+- kfree(fpriv); |
1848 |
+- goto out_suspend; |
1849 |
+- } |
1850 |
++ if (r) |
1851 |
++ goto err_fpriv; |
1852 |
+ |
1853 |
+ r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
1854 |
+- if (r) { |
1855 |
+- radeon_vm_fini(rdev, vm); |
1856 |
+- kfree(fpriv); |
1857 |
+- goto out_suspend; |
1858 |
+- } |
1859 |
++ if (r) |
1860 |
++ goto err_vm_fini; |
1861 |
+ |
1862 |
+ /* map the ib pool buffer read only into |
1863 |
+ * virtual address space */ |
1864 |
+ vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, |
1865 |
+ rdev->ring_tmp_bo.bo); |
1866 |
++ if (!vm->ib_bo_va) { |
1867 |
++ r = -ENOMEM; |
1868 |
++ goto err_vm_fini; |
1869 |
++ } |
1870 |
++ |
1871 |
+ r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, |
1872 |
+ RADEON_VA_IB_OFFSET, |
1873 |
+ RADEON_VM_PAGE_READABLE | |
1874 |
+ RADEON_VM_PAGE_SNOOPED); |
1875 |
+- if (r) { |
1876 |
+- radeon_vm_fini(rdev, vm); |
1877 |
+- kfree(fpriv); |
1878 |
+- goto out_suspend; |
1879 |
+- } |
1880 |
++ if (r) |
1881 |
++ goto err_vm_fini; |
1882 |
+ } |
1883 |
+ file_priv->driver_priv = fpriv; |
1884 |
+ } |
1885 |
+ |
1886 |
+-out_suspend: |
1887 |
++ pm_runtime_mark_last_busy(dev->dev); |
1888 |
++ pm_runtime_put_autosuspend(dev->dev); |
1889 |
++ return 0; |
1890 |
++ |
1891 |
++err_vm_fini: |
1892 |
++ radeon_vm_fini(rdev, vm); |
1893 |
++err_fpriv: |
1894 |
++ kfree(fpriv); |
1895 |
++ |
1896 |
++err_suspend: |
1897 |
+ pm_runtime_mark_last_busy(dev->dev); |
1898 |
+ pm_runtime_put_autosuspend(dev->dev); |
1899 |
+ return r; |
1900 |
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c |
1901 |
+index 4e3dd3f55a963..80ecbf14d3c82 100644 |
1902 |
+--- a/drivers/hid/hid-apple.c |
1903 |
++++ b/drivers/hid/hid-apple.c |
1904 |
+@@ -392,7 +392,7 @@ static int apple_input_configured(struct hid_device *hdev, |
1905 |
+ |
1906 |
+ if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { |
1907 |
+ hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); |
1908 |
+- asc->quirks = 0; |
1909 |
++ asc->quirks &= ~APPLE_HAS_FN; |
1910 |
+ } |
1911 |
+ |
1912 |
+ return 0; |
1913 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
1914 |
+index d56ef395eb693..dd3f4aa052980 100644 |
1915 |
+--- a/drivers/hid/hid-input.c |
1916 |
++++ b/drivers/hid/hid-input.c |
1917 |
+@@ -1246,6 +1246,12 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct |
1918 |
+ |
1919 |
+ input = field->hidinput->input; |
1920 |
+ |
1921 |
++ if (usage->type == EV_ABS && |
1922 |
++ (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || |
1923 |
++ ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) { |
1924 |
++ value = field->logical_maximum - value; |
1925 |
++ } |
1926 |
++ |
1927 |
+ if (usage->hat_min < usage->hat_max || usage->hat_dir) { |
1928 |
+ int hat_dir = usage->hat_dir; |
1929 |
+ if (!hat_dir) |
1930 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
1931 |
+index 29e63330c1b53..e128b9ce156df 100644 |
1932 |
+--- a/drivers/hid/uhid.c |
1933 |
++++ b/drivers/hid/uhid.c |
1934 |
+@@ -31,11 +31,22 @@ |
1935 |
+ |
1936 |
+ struct uhid_device { |
1937 |
+ struct mutex devlock; |
1938 |
++ |
1939 |
++ /* This flag tracks whether the HID device is usable for commands from |
1940 |
++ * userspace. The flag is already set before hid_add_device(), which |
1941 |
++ * runs in workqueue context, to allow hid_add_device() to communicate |
1942 |
++ * with userspace. |
1943 |
++ * However, if hid_add_device() fails, the flag is cleared without |
1944 |
++ * holding devlock. |
1945 |
++ * We guarantee that if @running changes from true to false while you're |
1946 |
++ * holding @devlock, it's still fine to access @hid. |
1947 |
++ */ |
1948 |
+ bool running; |
1949 |
+ |
1950 |
+ __u8 *rd_data; |
1951 |
+ uint rd_size; |
1952 |
+ |
1953 |
++ /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ |
1954 |
+ struct hid_device *hid; |
1955 |
+ struct uhid_event input_buf; |
1956 |
+ |
1957 |
+@@ -66,9 +77,18 @@ static void uhid_device_add_worker(struct work_struct *work) |
1958 |
+ if (ret) { |
1959 |
+ hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); |
1960 |
+ |
1961 |
+- hid_destroy_device(uhid->hid); |
1962 |
+- uhid->hid = NULL; |
1963 |
++ /* We used to call hid_destroy_device() here, but that's really |
1964 |
++ * messy to get right because we have to coordinate with |
1965 |
++ * concurrent writes from userspace that might be in the middle |
1966 |
++ * of using uhid->hid. |
1967 |
++ * Just leave uhid->hid as-is for now, and clean it up when |
1968 |
++ * userspace tries to close or reinitialize the uhid instance. |
1969 |
++ * |
1970 |
++ * However, we do have to clear the ->running flag and do a |
1971 |
++ * wakeup to make sure userspace knows that the device is gone. |
1972 |
++ */ |
1973 |
+ uhid->running = false; |
1974 |
++ wake_up_interruptible(&uhid->report_wait); |
1975 |
+ } |
1976 |
+ } |
1977 |
+ |
1978 |
+@@ -477,7 +497,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, |
1979 |
+ void *rd_data; |
1980 |
+ int ret; |
1981 |
+ |
1982 |
+- if (uhid->running) |
1983 |
++ if (uhid->hid) |
1984 |
+ return -EALREADY; |
1985 |
+ |
1986 |
+ rd_size = ev->u.create2.rd_size; |
1987 |
+@@ -559,7 +579,7 @@ static int uhid_dev_create(struct uhid_device *uhid, |
1988 |
+ |
1989 |
+ static int uhid_dev_destroy(struct uhid_device *uhid) |
1990 |
+ { |
1991 |
+- if (!uhid->running) |
1992 |
++ if (!uhid->hid) |
1993 |
+ return -EINVAL; |
1994 |
+ |
1995 |
+ uhid->running = false; |
1996 |
+@@ -568,6 +588,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) |
1997 |
+ cancel_work_sync(&uhid->worker); |
1998 |
+ |
1999 |
+ hid_destroy_device(uhid->hid); |
2000 |
++ uhid->hid = NULL; |
2001 |
+ kfree(uhid->rd_data); |
2002 |
+ |
2003 |
+ return 0; |
2004 |
+diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
2005 |
+index f22f59df02601..254afea67cf37 100644 |
2006 |
+--- a/drivers/hid/wacom_wac.c |
2007 |
++++ b/drivers/hid/wacom_wac.c |
2008 |
+@@ -2529,6 +2529,24 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
2009 |
+ } |
2010 |
+ } |
2011 |
+ |
2012 |
++static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) |
2013 |
++{ |
2014 |
++ struct input_mt *mt = dev->mt; |
2015 |
++ struct input_mt_slot *s; |
2016 |
++ |
2017 |
++ if (!mt) |
2018 |
++ return false; |
2019 |
++ |
2020 |
++ for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { |
2021 |
++ if (s->key == key && |
2022 |
++ input_mt_get_value(s, ABS_MT_TRACKING_ID) >= 0) { |
2023 |
++ return true; |
2024 |
++ } |
2025 |
++ } |
2026 |
++ |
2027 |
++ return false; |
2028 |
++} |
2029 |
++ |
2030 |
+ static void wacom_wac_finger_event(struct hid_device *hdev, |
2031 |
+ struct hid_field *field, struct hid_usage *usage, __s32 value) |
2032 |
+ { |
2033 |
+@@ -2571,9 +2589,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev, |
2034 |
+ |
2035 |
+ |
2036 |
+ if (usage->usage_index + 1 == field->report_count) { |
2037 |
+- if (equivalent_usage == wacom_wac->hid_data.last_slot_field && |
2038 |
+- wacom_wac->hid_data.confidence) |
2039 |
+- wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
2040 |
++ if (equivalent_usage == wacom_wac->hid_data.last_slot_field) { |
2041 |
++ bool touch_removed = wacom_wac_slot_is_active(wacom_wac->touch_input, |
2042 |
++ wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; |
2043 |
++ |
2044 |
++ if (wacom_wac->hid_data.confidence || touch_removed) { |
2045 |
++ wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
2046 |
++ } |
2047 |
++ } |
2048 |
+ } |
2049 |
+ } |
2050 |
+ |
2051 |
+@@ -2587,6 +2610,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
2052 |
+ |
2053 |
+ hid_data->confidence = true; |
2054 |
+ |
2055 |
++ hid_data->cc_report = 0; |
2056 |
++ hid_data->cc_index = -1; |
2057 |
++ hid_data->cc_value_index = -1; |
2058 |
++ |
2059 |
+ for (i = 0; i < report->maxfield; i++) { |
2060 |
+ struct hid_field *field = report->field[i]; |
2061 |
+ int j; |
2062 |
+@@ -2620,11 +2647,14 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
2063 |
+ hid_data->cc_index >= 0) { |
2064 |
+ struct hid_field *field = report->field[hid_data->cc_index]; |
2065 |
+ int value = field->value[hid_data->cc_value_index]; |
2066 |
+- if (value) |
2067 |
++ if (value) { |
2068 |
+ hid_data->num_expected = value; |
2069 |
++ hid_data->num_received = 0; |
2070 |
++ } |
2071 |
+ } |
2072 |
+ else { |
2073 |
+ hid_data->num_expected = wacom_wac->features.touch_max; |
2074 |
++ hid_data->num_received = 0; |
2075 |
+ } |
2076 |
+ } |
2077 |
+ |
2078 |
+@@ -2648,6 +2678,7 @@ static void wacom_wac_finger_report(struct hid_device *hdev, |
2079 |
+ |
2080 |
+ input_sync(input); |
2081 |
+ wacom_wac->hid_data.num_received = 0; |
2082 |
++ wacom_wac->hid_data.num_expected = 0; |
2083 |
+ |
2084 |
+ /* keep touch state for pen event */ |
2085 |
+ wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); |
2086 |
+diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c |
2087 |
+index 71895da63810b..daf2de837a30a 100644 |
2088 |
+--- a/drivers/hsi/hsi_core.c |
2089 |
++++ b/drivers/hsi/hsi_core.c |
2090 |
+@@ -115,6 +115,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, |
2091 |
+ if (device_register(&cl->device) < 0) { |
2092 |
+ pr_err("hsi: failed to register client: %s\n", info->name); |
2093 |
+ put_device(&cl->device); |
2094 |
++ goto err; |
2095 |
+ } |
2096 |
+ |
2097 |
+ return cl; |
2098 |
+diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c |
2099 |
+index d50f804872149..4e6b3fb01c7a6 100644 |
2100 |
+--- a/drivers/i2c/busses/i2c-designware-pcidrv.c |
2101 |
++++ b/drivers/i2c/busses/i2c-designware-pcidrv.c |
2102 |
+@@ -36,10 +36,10 @@ enum dw_pci_ctl_id_t { |
2103 |
+ }; |
2104 |
+ |
2105 |
+ struct dw_scl_sda_cfg { |
2106 |
+- u32 ss_hcnt; |
2107 |
+- u32 fs_hcnt; |
2108 |
+- u32 ss_lcnt; |
2109 |
+- u32 fs_lcnt; |
2110 |
++ u16 ss_hcnt; |
2111 |
++ u16 fs_hcnt; |
2112 |
++ u16 ss_lcnt; |
2113 |
++ u16 fs_lcnt; |
2114 |
+ u32 sda_hold; |
2115 |
+ }; |
2116 |
+ |
2117 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
2118 |
+index efafd028c5d16..fb0ddaad87d2e 100644 |
2119 |
+--- a/drivers/i2c/busses/i2c-i801.c |
2120 |
++++ b/drivers/i2c/busses/i2c-i801.c |
2121 |
+@@ -774,6 +774,11 @@ static int i801_block_transaction(struct i801_priv *priv, |
2122 |
+ int result = 0; |
2123 |
+ unsigned char hostc; |
2124 |
+ |
2125 |
++ if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) |
2126 |
++ data->block[0] = I2C_SMBUS_BLOCK_MAX; |
2127 |
++ else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) |
2128 |
++ return -EPROTO; |
2129 |
++ |
2130 |
+ if (command == I2C_SMBUS_I2C_BLOCK_DATA) { |
2131 |
+ if (read_write == I2C_SMBUS_WRITE) { |
2132 |
+ /* set I2C_EN bit in configuration register */ |
2133 |
+@@ -787,16 +792,6 @@ static int i801_block_transaction(struct i801_priv *priv, |
2134 |
+ } |
2135 |
+ } |
2136 |
+ |
2137 |
+- if (read_write == I2C_SMBUS_WRITE |
2138 |
+- || command == I2C_SMBUS_I2C_BLOCK_DATA) { |
2139 |
+- if (data->block[0] < 1) |
2140 |
+- data->block[0] = 1; |
2141 |
+- if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
2142 |
+- data->block[0] = I2C_SMBUS_BLOCK_MAX; |
2143 |
+- } else { |
2144 |
+- data->block[0] = 32; /* max for SMBus block reads */ |
2145 |
+- } |
2146 |
+- |
2147 |
+ /* Experience has shown that the block buffer can only be used for |
2148 |
+ SMBus (not I2C) block transactions, even though the datasheet |
2149 |
+ doesn't mention this limitation. */ |
2150 |
+diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
2151 |
+index af349661fd769..8de8296d25831 100644 |
2152 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
2153 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
2154 |
+@@ -105,23 +105,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) |
2155 |
+ /* Sometimes 9th clock pulse isn't generated, and slave doesn't release |
2156 |
+ * the bus, because it wants to send ACK. |
2157 |
+ * Following sequence of enabling/disabling and sending start/stop generates |
2158 |
+- * the 9 pulses, so it's all OK. |
2159 |
++ * the 9 pulses, each with a START then ending with STOP, so it's all OK. |
2160 |
+ */ |
2161 |
+ static void mpc_i2c_fixup(struct mpc_i2c *i2c) |
2162 |
+ { |
2163 |
+ int k; |
2164 |
+- u32 delay_val = 1000000 / i2c->real_clk + 1; |
2165 |
+- |
2166 |
+- if (delay_val < 2) |
2167 |
+- delay_val = 2; |
2168 |
++ unsigned long flags; |
2169 |
+ |
2170 |
+ for (k = 9; k; k--) { |
2171 |
+ writeccr(i2c, 0); |
2172 |
+- writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); |
2173 |
++ writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ |
2174 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ |
2175 |
++ readb(i2c->base + MPC_I2C_DR); /* init xfer */ |
2176 |
++ udelay(15); /* let it hit the bus */ |
2177 |
++ local_irq_save(flags); /* should not be delayed further */ |
2178 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ |
2179 |
+ readb(i2c->base + MPC_I2C_DR); |
2180 |
+- writeccr(i2c, CCR_MEN); |
2181 |
+- udelay(delay_val << 1); |
2182 |
++ if (k != 1) |
2183 |
++ udelay(5); |
2184 |
++ local_irq_restore(flags); |
2185 |
+ } |
2186 |
++ writeccr(i2c, CCR_MEN); /* Initiate STOP */ |
2187 |
++ readb(i2c->base + MPC_I2C_DR); |
2188 |
++ udelay(15); /* Let STOP propagate */ |
2189 |
++ writeccr(i2c, 0); |
2190 |
+ } |
2191 |
+ |
2192 |
+ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
2193 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
2194 |
+index 6a585c3e21923..ffd0f43e2129f 100644 |
2195 |
+--- a/drivers/infiniband/core/device.c |
2196 |
++++ b/drivers/infiniband/core/device.c |
2197 |
+@@ -1039,7 +1039,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
2198 |
+ for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { |
2199 |
+ ret = rdma_query_gid(device, port, i, &tmp_gid); |
2200 |
+ if (ret) |
2201 |
+- return ret; |
2202 |
++ continue; |
2203 |
++ |
2204 |
+ if (!memcmp(&tmp_gid, gid, sizeof *gid)) { |
2205 |
+ *port_num = port; |
2206 |
+ if (index) |
2207 |
+diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
2208 |
+index 20e3128f59b14..aa48627fc0bfa 100644 |
2209 |
+--- a/drivers/infiniband/hw/cxgb4/qp.c |
2210 |
++++ b/drivers/infiniband/hw/cxgb4/qp.c |
2211 |
+@@ -2483,6 +2483,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
2212 |
+ memset(attr, 0, sizeof *attr); |
2213 |
+ memset(init_attr, 0, sizeof *init_attr); |
2214 |
+ attr->qp_state = to_ib_qp_state(qhp->attr.state); |
2215 |
++ attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); |
2216 |
+ init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; |
2217 |
+ init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; |
2218 |
+ init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; |
2219 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c |
2220 |
+index c5cae9a38c044..456c622d7c5c9 100644 |
2221 |
+--- a/drivers/infiniband/hw/hns/hns_roce_main.c |
2222 |
++++ b/drivers/infiniband/hw/hns/hns_roce_main.c |
2223 |
+@@ -295,6 +295,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device, |
2224 |
+ static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index, |
2225 |
+ u16 *pkey) |
2226 |
+ { |
2227 |
++ if (index > 0) |
2228 |
++ return -EINVAL; |
2229 |
++ |
2230 |
+ *pkey = PKEY_ID; |
2231 |
+ |
2232 |
+ return 0; |
2233 |
+@@ -429,7 +432,7 @@ static int hns_roce_mmap(struct ib_ucontext *context, |
2234 |
+ return -EINVAL; |
2235 |
+ |
2236 |
+ if (vma->vm_pgoff == 0) { |
2237 |
+- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
2238 |
++ vma->vm_page_prot = pgprot_device(vma->vm_page_prot); |
2239 |
+ if (io_remap_pfn_range(vma, vma->vm_start, |
2240 |
+ to_hr_ucontext(context)->uar.pfn, |
2241 |
+ PAGE_SIZE, vma->vm_page_prot)) |
2242 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c |
2243 |
+index 4cf11063e0b59..0f166d6d0ccb0 100644 |
2244 |
+--- a/drivers/infiniband/sw/rxe/rxe_opcode.c |
2245 |
++++ b/drivers/infiniband/sw/rxe/rxe_opcode.c |
2246 |
+@@ -137,7 +137,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { |
2247 |
+ } |
2248 |
+ }, |
2249 |
+ [IB_OPCODE_RC_SEND_MIDDLE] = { |
2250 |
+- .name = "IB_OPCODE_RC_SEND_MIDDLE]", |
2251 |
++ .name = "IB_OPCODE_RC_SEND_MIDDLE", |
2252 |
+ .mask = RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK |
2253 |
+ | RXE_MIDDLE_MASK, |
2254 |
+ .length = RXE_BTH_BYTES, |
2255 |
+diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c |
2256 |
+index 2f79efd16a052..4bd2dd70acaec 100644 |
2257 |
+--- a/drivers/iommu/io-pgtable-arm.c |
2258 |
++++ b/drivers/iommu/io-pgtable-arm.c |
2259 |
+@@ -346,11 +346,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data, |
2260 |
+ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, |
2261 |
+ arm_lpae_iopte *ptep, |
2262 |
+ arm_lpae_iopte curr, |
2263 |
+- struct io_pgtable_cfg *cfg) |
2264 |
++ struct arm_lpae_io_pgtable *data) |
2265 |
+ { |
2266 |
+ arm_lpae_iopte old, new; |
2267 |
++ struct io_pgtable_cfg *cfg = &data->iop.cfg; |
2268 |
+ |
2269 |
+- new = __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; |
2270 |
++ new = paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; |
2271 |
+ if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) |
2272 |
+ new |= ARM_LPAE_PTE_NSTABLE; |
2273 |
+ |
2274 |
+@@ -402,7 +403,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, |
2275 |
+ if (!cptep) |
2276 |
+ return -ENOMEM; |
2277 |
+ |
2278 |
+- pte = arm_lpae_install_table(cptep, ptep, 0, cfg); |
2279 |
++ pte = arm_lpae_install_table(cptep, ptep, 0, data); |
2280 |
+ if (pte) |
2281 |
+ __arm_lpae_free_pages(cptep, tblsz, cfg); |
2282 |
+ } else if (!(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA) && |
2283 |
+@@ -562,7 +563,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data, |
2284 |
+ __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &tablep[i]); |
2285 |
+ } |
2286 |
+ |
2287 |
+- pte = arm_lpae_install_table(tablep, ptep, blk_pte, cfg); |
2288 |
++ pte = arm_lpae_install_table(tablep, ptep, blk_pte, data); |
2289 |
+ if (pte != blk_pte) { |
2290 |
+ __arm_lpae_free_pages(tablep, tablesz, cfg); |
2291 |
+ /* |
2292 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
2293 |
+index ce5cd05253db9..fdd68d8e8adc6 100644 |
2294 |
+--- a/drivers/iommu/iova.c |
2295 |
++++ b/drivers/iommu/iova.c |
2296 |
+@@ -75,8 +75,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad) |
2297 |
+ if (!has_iova_flush_queue(iovad)) |
2298 |
+ return; |
2299 |
+ |
2300 |
+- if (timer_pending(&iovad->fq_timer)) |
2301 |
+- del_timer(&iovad->fq_timer); |
2302 |
++ del_timer_sync(&iovad->fq_timer); |
2303 |
+ |
2304 |
+ fq_destroy_all_entries(iovad); |
2305 |
+ |
2306 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
2307 |
+index 8aae0624a2971..6383afb88f319 100644 |
2308 |
+--- a/drivers/md/persistent-data/dm-btree.c |
2309 |
++++ b/drivers/md/persistent-data/dm-btree.c |
2310 |
+@@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
2311 |
+ } |
2312 |
+ |
2313 |
+ static int insert_at(size_t value_size, struct btree_node *node, unsigned index, |
2314 |
+- uint64_t key, void *value) |
2315 |
+- __dm_written_to_disk(value) |
2316 |
++ uint64_t key, void *value) |
2317 |
++ __dm_written_to_disk(value) |
2318 |
+ { |
2319 |
+ uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); |
2320 |
++ uint32_t max_entries = le32_to_cpu(node->header.max_entries); |
2321 |
+ __le64 key_le = cpu_to_le64(key); |
2322 |
+ |
2323 |
+ if (index > nr_entries || |
2324 |
+- index >= le32_to_cpu(node->header.max_entries)) { |
2325 |
++ index >= max_entries || |
2326 |
++ nr_entries >= max_entries) { |
2327 |
+ DMERR("too many entries in btree node for insert"); |
2328 |
+ __dm_unbless_for_disk(value); |
2329 |
+ return -ENOMEM; |
2330 |
+diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c |
2331 |
+index a284762e548e1..5115a27196038 100644 |
2332 |
+--- a/drivers/md/persistent-data/dm-space-map-common.c |
2333 |
++++ b/drivers/md/persistent-data/dm-space-map-common.c |
2334 |
+@@ -279,6 +279,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result) |
2335 |
+ struct disk_index_entry ie_disk; |
2336 |
+ struct dm_block *blk; |
2337 |
+ |
2338 |
++ if (b >= ll->nr_blocks) { |
2339 |
++ DMERR_LIMIT("metadata block out of bounds"); |
2340 |
++ return -EINVAL; |
2341 |
++ } |
2342 |
++ |
2343 |
+ b = do_div(index, ll->entries_per_block); |
2344 |
+ r = ll->load_ie(ll, index, &ie_disk); |
2345 |
+ if (r < 0) |
2346 |
+diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c |
2347 |
+index d4987fd05d05f..d91bd32bd1f04 100644 |
2348 |
+--- a/drivers/media/common/saa7146/saa7146_fops.c |
2349 |
++++ b/drivers/media/common/saa7146/saa7146_fops.c |
2350 |
+@@ -524,7 +524,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
2351 |
+ ERR("out of memory. aborting.\n"); |
2352 |
+ kfree(vv); |
2353 |
+ v4l2_ctrl_handler_free(hdl); |
2354 |
+- return -1; |
2355 |
++ return -ENOMEM; |
2356 |
+ } |
2357 |
+ |
2358 |
+ saa7146_video_uops.init(dev,vv); |
2359 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
2360 |
+index aff0ab7bf83d5..bbd5716d4c9cb 100644 |
2361 |
+--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
2362 |
++++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
2363 |
+@@ -154,7 +154,7 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs, |
2364 |
+ buf->cookie = dma_alloc_attrs(dev, size, &buf->dma_addr, |
2365 |
+ GFP_KERNEL | gfp_flags, buf->attrs); |
2366 |
+ if (!buf->cookie) { |
2367 |
+- dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); |
2368 |
++ dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); |
2369 |
+ kfree(buf); |
2370 |
+ return ERR_PTR(-ENOMEM); |
2371 |
+ } |
2372 |
+@@ -206,9 +206,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) |
2373 |
+ |
2374 |
+ vma->vm_ops->open(vma); |
2375 |
+ |
2376 |
+- pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", |
2377 |
+- __func__, (unsigned long)buf->dma_addr, vma->vm_start, |
2378 |
+- buf->size); |
2379 |
++ pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", |
2380 |
++ __func__, (unsigned long)buf->dma_addr, vma->vm_start, |
2381 |
++ buf->size); |
2382 |
+ |
2383 |
+ return 0; |
2384 |
+ } |
2385 |
+diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c |
2386 |
+index d548f98c7a67d..9e0ef3934fa3d 100644 |
2387 |
+--- a/drivers/media/dvb-core/dmxdev.c |
2388 |
++++ b/drivers/media/dvb-core/dmxdev.c |
2389 |
+@@ -1412,7 +1412,7 @@ static const struct dvb_device dvbdev_dvr = { |
2390 |
+ }; |
2391 |
+ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
2392 |
+ { |
2393 |
+- int i; |
2394 |
++ int i, ret; |
2395 |
+ |
2396 |
+ if (dmxdev->demux->open(dmxdev->demux) < 0) |
2397 |
+ return -EUSERS; |
2398 |
+@@ -1431,14 +1431,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
2399 |
+ DMXDEV_STATE_FREE); |
2400 |
+ } |
2401 |
+ |
2402 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
2403 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
2404 |
+ DVB_DEVICE_DEMUX, dmxdev->filternum); |
2405 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
2406 |
++ if (ret < 0) |
2407 |
++ goto err_register_dvbdev; |
2408 |
++ |
2409 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
2410 |
+ dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); |
2411 |
++ if (ret < 0) |
2412 |
++ goto err_register_dvr_dvbdev; |
2413 |
+ |
2414 |
+ dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); |
2415 |
+ |
2416 |
+ return 0; |
2417 |
++ |
2418 |
++err_register_dvr_dvbdev: |
2419 |
++ dvb_unregister_device(dmxdev->dvbdev); |
2420 |
++err_register_dvbdev: |
2421 |
++ vfree(dmxdev->filter); |
2422 |
++ dmxdev->filter = NULL; |
2423 |
++ return ret; |
2424 |
+ } |
2425 |
+ |
2426 |
+ EXPORT_SYMBOL(dvb_dmxdev_init); |
2427 |
+diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c |
2428 |
+index 5fa787e023c7e..4b9e4afa4c61f 100644 |
2429 |
+--- a/drivers/media/dvb-frontends/dib8000.c |
2430 |
++++ b/drivers/media/dvb-frontends/dib8000.c |
2431 |
+@@ -4476,8 +4476,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad |
2432 |
+ |
2433 |
+ state->timf_default = cfg->pll->timf; |
2434 |
+ |
2435 |
+- if (dib8000_identify(&state->i2c) == 0) |
2436 |
++ if (dib8000_identify(&state->i2c) == 0) { |
2437 |
++ kfree(fe); |
2438 |
+ goto error; |
2439 |
++ } |
2440 |
+ |
2441 |
+ dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); |
2442 |
+ |
2443 |
+diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c |
2444 |
+index cc6527e355373..b7d8e34ffd5da 100644 |
2445 |
+--- a/drivers/media/pci/b2c2/flexcop-pci.c |
2446 |
++++ b/drivers/media/pci/b2c2/flexcop-pci.c |
2447 |
+@@ -184,6 +184,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
2448 |
+ dma_addr_t cur_addr = |
2449 |
+ fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
2450 |
+ u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
2451 |
++ if (cur_pos > fc_pci->dma[0].size * 2) |
2452 |
++ goto error; |
2453 |
+ |
2454 |
+ deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", |
2455 |
+ jiffies_to_usecs(jiffies - fc_pci->last_irq), |
2456 |
+@@ -224,6 +226,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
2457 |
+ ret = IRQ_NONE; |
2458 |
+ } |
2459 |
+ |
2460 |
++error: |
2461 |
+ spin_unlock_irqrestore(&fc_pci->irq_lock, flags); |
2462 |
+ return ret; |
2463 |
+ } |
2464 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
2465 |
+index 8c56d4c37a525..3513b1a6fcee9 100644 |
2466 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
2467 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
2468 |
+@@ -296,7 +296,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
2469 |
+ hexium_set_input(hexium, 0); |
2470 |
+ hexium->cur_input = 0; |
2471 |
+ |
2472 |
+- saa7146_vv_init(dev, &vv_data); |
2473 |
++ ret = saa7146_vv_init(dev, &vv_data); |
2474 |
++ if (ret) { |
2475 |
++ i2c_del_adapter(&hexium->i2c_adapter); |
2476 |
++ kfree(hexium); |
2477 |
++ return ret; |
2478 |
++ } |
2479 |
+ |
2480 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
2481 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
2482 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
2483 |
+index a794f9e5f9908..b88aa1feb7df2 100644 |
2484 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
2485 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
2486 |
+@@ -367,10 +367,16 @@ static struct saa7146_ext_vv vv_data; |
2487 |
+ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
2488 |
+ { |
2489 |
+ struct hexium *hexium = (struct hexium *) dev->ext_priv; |
2490 |
++ int ret; |
2491 |
+ |
2492 |
+ DEB_EE("\n"); |
2493 |
+ |
2494 |
+- saa7146_vv_init(dev, &vv_data); |
2495 |
++ ret = saa7146_vv_init(dev, &vv_data); |
2496 |
++ if (ret) { |
2497 |
++ pr_err("Error in saa7146_vv_init()\n"); |
2498 |
++ return ret; |
2499 |
++ } |
2500 |
++ |
2501 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
2502 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
2503 |
+ vv_data.vid_ops.vidioc_s_input = vidioc_s_input; |
2504 |
+diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
2505 |
+index 6e25654da2567..bfa7a7d15dbf6 100644 |
2506 |
+--- a/drivers/media/pci/saa7146/mxb.c |
2507 |
++++ b/drivers/media/pci/saa7146/mxb.c |
2508 |
+@@ -695,10 +695,16 @@ static struct saa7146_ext_vv vv_data; |
2509 |
+ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
2510 |
+ { |
2511 |
+ struct mxb *mxb; |
2512 |
++ int ret; |
2513 |
+ |
2514 |
+ DEB_EE("dev:%p\n", dev); |
2515 |
+ |
2516 |
+- saa7146_vv_init(dev, &vv_data); |
2517 |
++ ret = saa7146_vv_init(dev, &vv_data); |
2518 |
++ if (ret) { |
2519 |
++ ERR("Error in saa7146_vv_init()"); |
2520 |
++ return ret; |
2521 |
++ } |
2522 |
++ |
2523 |
+ if (mxb_probe(dev)) { |
2524 |
+ saa7146_vv_release(dev); |
2525 |
+ return -1; |
2526 |
+diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c |
2527 |
+index 96ab4b61669a3..36d50c3f9b08a 100644 |
2528 |
+--- a/drivers/media/platform/coda/imx-vdoa.c |
2529 |
++++ b/drivers/media/platform/coda/imx-vdoa.c |
2530 |
+@@ -295,7 +295,11 @@ static int vdoa_probe(struct platform_device *pdev) |
2531 |
+ struct resource *res; |
2532 |
+ int ret; |
2533 |
+ |
2534 |
+- dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
2535 |
++ ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
2536 |
++ if (ret) { |
2537 |
++ dev_err(&pdev->dev, "DMA enable failed\n"); |
2538 |
++ return ret; |
2539 |
++ } |
2540 |
+ |
2541 |
+ vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); |
2542 |
+ if (!vdoa) |
2543 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
2544 |
+index 83f859e8509c9..b95006a864c26 100644 |
2545 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
2546 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
2547 |
+@@ -217,11 +217,11 @@ static int fops_vcodec_release(struct file *file) |
2548 |
+ mtk_v4l2_debug(1, "[%d] encoder", ctx->id); |
2549 |
+ mutex_lock(&dev->dev_mutex); |
2550 |
+ |
2551 |
++ v4l2_m2m_ctx_release(ctx->m2m_ctx); |
2552 |
+ mtk_vcodec_enc_release(ctx); |
2553 |
+ v4l2_fh_del(&ctx->fh); |
2554 |
+ v4l2_fh_exit(&ctx->fh); |
2555 |
+ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); |
2556 |
+- v4l2_m2m_ctx_release(ctx->m2m_ctx); |
2557 |
+ |
2558 |
+ list_del_init(&ctx->list); |
2559 |
+ kfree(ctx); |
2560 |
+diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c |
2561 |
+index 23f55514b002a..127658c28a09e 100644 |
2562 |
+--- a/drivers/media/platform/rcar-vin/rcar-csi2.c |
2563 |
++++ b/drivers/media/platform/rcar-vin/rcar-csi2.c |
2564 |
+@@ -416,16 +416,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *priv) |
2565 |
+ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) |
2566 |
+ { |
2567 |
+ const struct rcsi2_mbps_reg *hsfreq; |
2568 |
++ const struct rcsi2_mbps_reg *hsfreq_prev = NULL; |
2569 |
+ |
2570 |
+- for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) |
2571 |
++ for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) { |
2572 |
+ if (hsfreq->mbps >= mbps) |
2573 |
+ break; |
2574 |
++ hsfreq_prev = hsfreq; |
2575 |
++ } |
2576 |
+ |
2577 |
+ if (!hsfreq->mbps) { |
2578 |
+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); |
2579 |
+ return -ERANGE; |
2580 |
+ } |
2581 |
+ |
2582 |
++ if (hsfreq_prev && |
2583 |
++ ((mbps - hsfreq_prev->mbps) <= (hsfreq->mbps - mbps))) |
2584 |
++ hsfreq = hsfreq_prev; |
2585 |
++ |
2586 |
+ rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); |
2587 |
+ |
2588 |
+ return 0; |
2589 |
+@@ -836,10 +843,17 @@ static int rcsi2_phtw_write_mbps(struct rcar_csi2 *priv, unsigned int mbps, |
2590 |
+ const struct rcsi2_mbps_reg *values, u16 code) |
2591 |
+ { |
2592 |
+ const struct rcsi2_mbps_reg *value; |
2593 |
++ const struct rcsi2_mbps_reg *prev_value = NULL; |
2594 |
+ |
2595 |
+- for (value = values; value->mbps; value++) |
2596 |
++ for (value = values; value->mbps; value++) { |
2597 |
+ if (value->mbps >= mbps) |
2598 |
+ break; |
2599 |
++ prev_value = value; |
2600 |
++ } |
2601 |
++ |
2602 |
++ if (prev_value && |
2603 |
++ ((mbps - prev_value->mbps) <= (value->mbps - mbps))) |
2604 |
++ value = prev_value; |
2605 |
+ |
2606 |
+ if (!value->mbps) { |
2607 |
+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); |
2608 |
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
2609 |
+index cc68bdac0c367..7c49eaee67f36 100644 |
2610 |
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
2611 |
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
2612 |
+@@ -381,7 +381,7 @@ static int si470x_i2c_probe(struct i2c_client *client, |
2613 |
+ if (radio->hdl.error) { |
2614 |
+ retval = radio->hdl.error; |
2615 |
+ dev_err(&client->dev, "couldn't register control\n"); |
2616 |
+- goto err_dev; |
2617 |
++ goto err_all; |
2618 |
+ } |
2619 |
+ |
2620 |
+ /* video device initialization */ |
2621 |
+@@ -465,7 +465,6 @@ err_rds: |
2622 |
+ kfree(radio->buffer); |
2623 |
+ err_ctrl: |
2624 |
+ v4l2_ctrl_handler_free(&radio->hdl); |
2625 |
+-err_dev: |
2626 |
+ v4l2_device_unregister(&radio->v4l2_dev); |
2627 |
+ err_radio: |
2628 |
+ kfree(radio); |
2629 |
+diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c |
2630 |
+index f563ddd7f7392..98a13532a5968 100644 |
2631 |
+--- a/drivers/media/rc/igorplugusb.c |
2632 |
++++ b/drivers/media/rc/igorplugusb.c |
2633 |
+@@ -73,9 +73,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) |
2634 |
+ if (start >= len) { |
2635 |
+ dev_err(ir->dev, "receive overflow invalid: %u", overflow); |
2636 |
+ } else { |
2637 |
+- if (overflow > 0) |
2638 |
++ if (overflow > 0) { |
2639 |
+ dev_warn(ir->dev, "receive overflow, at least %u lost", |
2640 |
+ overflow); |
2641 |
++ ir_raw_event_reset(ir->rc); |
2642 |
++ } |
2643 |
+ |
2644 |
+ do { |
2645 |
+ rawir.duration = ir->buf_in[i] * 85333; |
2646 |
+diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c |
2647 |
+index cf4bcf7c62f2e..0b619a2c146eb 100644 |
2648 |
+--- a/drivers/media/rc/mceusb.c |
2649 |
++++ b/drivers/media/rc/mceusb.c |
2650 |
+@@ -1367,7 +1367,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
2651 |
+ */ |
2652 |
+ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), |
2653 |
+ USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, |
2654 |
+- data, USB_CTRL_MSG_SZ, HZ * 3); |
2655 |
++ data, USB_CTRL_MSG_SZ, 3000); |
2656 |
+ dev_dbg(dev, "set address - ret = %d", ret); |
2657 |
+ dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", |
2658 |
+ data[0], data[1]); |
2659 |
+@@ -1375,20 +1375,20 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
2660 |
+ /* set feature: bit rate 38400 bps */ |
2661 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
2662 |
+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, |
2663 |
+- 0xc04e, 0x0000, NULL, 0, HZ * 3); |
2664 |
++ 0xc04e, 0x0000, NULL, 0, 3000); |
2665 |
+ |
2666 |
+ dev_dbg(dev, "set feature - ret = %d", ret); |
2667 |
+ |
2668 |
+ /* bRequest 4: set char length to 8 bits */ |
2669 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
2670 |
+ 4, USB_TYPE_VENDOR, |
2671 |
+- 0x0808, 0x0000, NULL, 0, HZ * 3); |
2672 |
++ 0x0808, 0x0000, NULL, 0, 3000); |
2673 |
+ dev_dbg(dev, "set char length - retB = %d", ret); |
2674 |
+ |
2675 |
+ /* bRequest 2: set handshaking to use DTR/DSR */ |
2676 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
2677 |
+ 2, USB_TYPE_VENDOR, |
2678 |
+- 0x0000, 0x0100, NULL, 0, HZ * 3); |
2679 |
++ 0x0000, 0x0100, NULL, 0, 3000); |
2680 |
+ dev_dbg(dev, "set handshake - retC = %d", ret); |
2681 |
+ |
2682 |
+ /* device resume */ |
2683 |
+diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c |
2684 |
+index 6bfc24885b5c4..14be14b0b0b0e 100644 |
2685 |
+--- a/drivers/media/rc/redrat3.c |
2686 |
++++ b/drivers/media/rc/redrat3.c |
2687 |
+@@ -415,7 +415,7 @@ static int redrat3_send_cmd(int cmd, struct redrat3_dev *rr3) |
2688 |
+ udev = rr3->udev; |
2689 |
+ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, |
2690 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2691 |
+- 0x0000, 0x0000, data, sizeof(u8), HZ * 10); |
2692 |
++ 0x0000, 0x0000, data, sizeof(u8), 10000); |
2693 |
+ |
2694 |
+ if (res < 0) { |
2695 |
+ dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", |
2696 |
+@@ -491,7 +491,7 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) |
2697 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
2698 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, |
2699 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2700 |
+- RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); |
2701 |
++ RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); |
2702 |
+ if (ret != len) |
2703 |
+ dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); |
2704 |
+ else { |
2705 |
+@@ -521,7 +521,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) |
2706 |
+ ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, |
2707 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2708 |
+ RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), |
2709 |
+- HZ * 25); |
2710 |
++ 25000); |
2711 |
+ dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", |
2712 |
+ be32_to_cpu(*timeout), ret); |
2713 |
+ |
2714 |
+@@ -553,32 +553,32 @@ static void redrat3_reset(struct redrat3_dev *rr3) |
2715 |
+ *val = 0x01; |
2716 |
+ rc = usb_control_msg(udev, rxpipe, RR3_RESET, |
2717 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2718 |
+- RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); |
2719 |
++ RR3_CPUCS_REG_ADDR, 0, val, len, 25000); |
2720 |
+ dev_dbg(dev, "reset returned 0x%02x\n", rc); |
2721 |
+ |
2722 |
+ *val = length_fuzz; |
2723 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2724 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2725 |
+- RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); |
2726 |
++ RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); |
2727 |
+ dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); |
2728 |
+ |
2729 |
+ *val = (65536 - (minimum_pause * 2000)) / 256; |
2730 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2731 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2732 |
+- RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); |
2733 |
++ RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); |
2734 |
+ dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); |
2735 |
+ |
2736 |
+ *val = periods_measure_carrier; |
2737 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2738 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2739 |
+- RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); |
2740 |
++ RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); |
2741 |
+ dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, |
2742 |
+ rc); |
2743 |
+ |
2744 |
+ *val = RR3_DRIVER_MAXLENS; |
2745 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2746 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2747 |
+- RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); |
2748 |
++ RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); |
2749 |
+ dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); |
2750 |
+ |
2751 |
+ kfree(val); |
2752 |
+@@ -596,7 +596,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) |
2753 |
+ rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), |
2754 |
+ RR3_FW_VERSION, |
2755 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2756 |
+- 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); |
2757 |
++ 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); |
2758 |
+ |
2759 |
+ if (rc >= 0) |
2760 |
+ dev_info(rr3->dev, "Firmware rev: %s", buffer); |
2761 |
+@@ -836,14 +836,14 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, |
2762 |
+ |
2763 |
+ pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); |
2764 |
+ ret = usb_bulk_msg(rr3->udev, pipe, irdata, |
2765 |
+- sendbuf_len, &ret_len, 10 * HZ); |
2766 |
++ sendbuf_len, &ret_len, 10000); |
2767 |
+ dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); |
2768 |
+ |
2769 |
+ /* now tell the hardware to transmit what we sent it */ |
2770 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
2771 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, |
2772 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2773 |
+- 0, 0, irdata, 2, HZ * 10); |
2774 |
++ 0, 0, irdata, 2, 10000); |
2775 |
+ |
2776 |
+ if (ret < 0) |
2777 |
+ dev_err(dev, "Error: control msg send failed, rc %d\n", ret); |
2778 |
+diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c |
2779 |
+index 5de6ed7287085..13ffe196b7a42 100644 |
2780 |
+--- a/drivers/media/tuners/msi001.c |
2781 |
++++ b/drivers/media/tuners/msi001.c |
2782 |
+@@ -451,6 +451,13 @@ static int msi001_probe(struct spi_device *spi) |
2783 |
+ V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); |
2784 |
+ dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
2785 |
+ V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); |
2786 |
++ if (dev->hdl.error) { |
2787 |
++ ret = dev->hdl.error; |
2788 |
++ dev_err(&spi->dev, "Could not initialize controls\n"); |
2789 |
++ /* control init failed, free handler */ |
2790 |
++ goto err_ctrl_handler_free; |
2791 |
++ } |
2792 |
++ |
2793 |
+ v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); |
2794 |
+ dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
2795 |
+ V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); |
2796 |
+diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c |
2797 |
+index 13770b038048e..a4bba669f234d 100644 |
2798 |
+--- a/drivers/media/tuners/si2157.c |
2799 |
++++ b/drivers/media/tuners/si2157.c |
2800 |
+@@ -89,7 +89,7 @@ static int si2157_init(struct dvb_frontend *fe) |
2801 |
+ dev_dbg(&client->dev, "\n"); |
2802 |
+ |
2803 |
+ /* Try to get Xtal trim property, to verify tuner still running */ |
2804 |
+- memcpy(cmd.args, "\x15\x00\x04\x02", 4); |
2805 |
++ memcpy(cmd.args, "\x15\x00\x02\x04", 4); |
2806 |
+ cmd.wlen = 4; |
2807 |
+ cmd.rlen = 4; |
2808 |
+ ret = si2157_cmd_execute(client, &cmd); |
2809 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
2810 |
+index 5104678f29b76..9dd6e30749fd2 100644 |
2811 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
2812 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
2813 |
+@@ -86,7 +86,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, |
2814 |
+ 0, |
2815 |
+ fc_usb->data, |
2816 |
+ sizeof(u32), |
2817 |
+- B2C2_WAIT_FOR_OPERATION_RDW * HZ); |
2818 |
++ B2C2_WAIT_FOR_OPERATION_RDW); |
2819 |
+ |
2820 |
+ if (ret != sizeof(u32)) { |
2821 |
+ err("error while %s dword from %d (%d).", read ? "reading" : |
2822 |
+@@ -154,7 +154,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, |
2823 |
+ wIndex, |
2824 |
+ fc_usb->data, |
2825 |
+ buflen, |
2826 |
+- nWaitTime * HZ); |
2827 |
++ nWaitTime); |
2828 |
+ if (ret != buflen) |
2829 |
+ ret = -EIO; |
2830 |
+ |
2831 |
+@@ -248,13 +248,13 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
2832 |
+ /* DKT 020208 - add this to support special case of DiSEqC */ |
2833 |
+ case USB_FUNC_I2C_CHECKWRITE: |
2834 |
+ pipe = B2C2_USB_CTRL_PIPE_OUT; |
2835 |
+- nWaitTime = 2; |
2836 |
++ nWaitTime = 2000; |
2837 |
+ request_type |= USB_DIR_OUT; |
2838 |
+ break; |
2839 |
+ case USB_FUNC_I2C_READ: |
2840 |
+ case USB_FUNC_I2C_REPEATREAD: |
2841 |
+ pipe = B2C2_USB_CTRL_PIPE_IN; |
2842 |
+- nWaitTime = 2; |
2843 |
++ nWaitTime = 2000; |
2844 |
+ request_type |= USB_DIR_IN; |
2845 |
+ break; |
2846 |
+ default: |
2847 |
+@@ -281,7 +281,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
2848 |
+ wIndex, |
2849 |
+ fc_usb->data, |
2850 |
+ buflen, |
2851 |
+- nWaitTime * HZ); |
2852 |
++ nWaitTime); |
2853 |
+ |
2854 |
+ if (ret != buflen) |
2855 |
+ ret = -EIO; |
2856 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.h b/drivers/media/usb/b2c2/flexcop-usb.h |
2857 |
+index e86faa0e06ca6..3dfd25fa4750f 100644 |
2858 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.h |
2859 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.h |
2860 |
+@@ -91,13 +91,13 @@ typedef enum { |
2861 |
+ UTILITY_SRAM_TESTVERIFY = 0x16, |
2862 |
+ } flexcop_usb_utility_function_t; |
2863 |
+ |
2864 |
+-#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) |
2865 |
+-#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) |
2866 |
+-#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) |
2867 |
++#define B2C2_WAIT_FOR_OPERATION_RW 1000 |
2868 |
++#define B2C2_WAIT_FOR_OPERATION_RDW 3000 |
2869 |
++#define B2C2_WAIT_FOR_OPERATION_WDW 1000 |
2870 |
+ |
2871 |
+-#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) |
2872 |
+-#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) |
2873 |
+-#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) |
2874 |
++#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 |
2875 |
++#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 |
2876 |
++#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 |
2877 |
+ |
2878 |
+ typedef enum { |
2879 |
+ V8_MEMORY_PAGE_DVB_CI = 0x20, |
2880 |
+diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c |
2881 |
+index 8392175740695..d9cac7064bb47 100644 |
2882 |
+--- a/drivers/media/usb/cpia2/cpia2_usb.c |
2883 |
++++ b/drivers/media/usb/cpia2/cpia2_usb.c |
2884 |
+@@ -559,7 +559,7 @@ static int write_packet(struct usb_device *udev, |
2885 |
+ 0, /* index */ |
2886 |
+ buf, /* buffer */ |
2887 |
+ size, |
2888 |
+- HZ); |
2889 |
++ 1000); |
2890 |
+ |
2891 |
+ kfree(buf); |
2892 |
+ return ret; |
2893 |
+@@ -591,7 +591,7 @@ static int read_packet(struct usb_device *udev, |
2894 |
+ 0, /* index */ |
2895 |
+ buf, /* buffer */ |
2896 |
+ size, |
2897 |
+- HZ); |
2898 |
++ 1000); |
2899 |
+ |
2900 |
+ if (ret >= 0) |
2901 |
+ memcpy(registers, buf, size); |
2902 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c |
2903 |
+index 6a53ff93c4d8b..c4c4119cb306b 100644 |
2904 |
+--- a/drivers/media/usb/dvb-usb/dib0700_core.c |
2905 |
++++ b/drivers/media/usb/dvb-usb/dib0700_core.c |
2906 |
+@@ -619,8 +619,6 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
2907 |
+ deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); |
2908 |
+ if (onoff) |
2909 |
+ st->channel_state |= 1 << (adap->id); |
2910 |
+- else |
2911 |
+- st->channel_state |= 1 << ~(adap->id); |
2912 |
+ } else { |
2913 |
+ if (onoff) |
2914 |
+ st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); |
2915 |
+diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c |
2916 |
+index 9ce8b4d79d1fa..ebb0c982a6f21 100644 |
2917 |
+--- a/drivers/media/usb/dvb-usb/dw2102.c |
2918 |
++++ b/drivers/media/usb/dvb-usb/dw2102.c |
2919 |
+@@ -2101,46 +2101,153 @@ static struct dvb_usb_device_properties s6x0_properties = { |
2920 |
+ } |
2921 |
+ }; |
2922 |
+ |
2923 |
+-static const struct dvb_usb_device_description d1100 = { |
2924 |
+- "Prof 1100 USB ", |
2925 |
+- {&dw2102_table[PROF_1100], NULL}, |
2926 |
+- {NULL}, |
2927 |
+-}; |
2928 |
++static struct dvb_usb_device_properties p1100_properties = { |
2929 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2930 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2931 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2932 |
++ .firmware = P1100_FIRMWARE, |
2933 |
++ .no_reconnect = 1, |
2934 |
+ |
2935 |
+-static const struct dvb_usb_device_description d660 = { |
2936 |
+- "TeVii S660 USB", |
2937 |
+- {&dw2102_table[TEVII_S660], NULL}, |
2938 |
+- {NULL}, |
2939 |
+-}; |
2940 |
++ .i2c_algo = &s6x0_i2c_algo, |
2941 |
++ .rc.core = { |
2942 |
++ .rc_interval = 150, |
2943 |
++ .rc_codes = RC_MAP_TBS_NEC, |
2944 |
++ .module_name = "dw2102", |
2945 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
2946 |
++ .rc_query = prof_rc_query, |
2947 |
++ }, |
2948 |
+ |
2949 |
+-static const struct dvb_usb_device_description d480_1 = { |
2950 |
+- "TeVii S480.1 USB", |
2951 |
+- {&dw2102_table[TEVII_S480_1], NULL}, |
2952 |
+- {NULL}, |
2953 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
2954 |
++ .num_adapters = 1, |
2955 |
++ .download_firmware = dw2102_load_firmware, |
2956 |
++ .read_mac_address = s6x0_read_mac_address, |
2957 |
++ .adapter = { |
2958 |
++ { |
2959 |
++ .num_frontends = 1, |
2960 |
++ .fe = {{ |
2961 |
++ .frontend_attach = stv0288_frontend_attach, |
2962 |
++ .stream = { |
2963 |
++ .type = USB_BULK, |
2964 |
++ .count = 8, |
2965 |
++ .endpoint = 0x82, |
2966 |
++ .u = { |
2967 |
++ .bulk = { |
2968 |
++ .buffersize = 4096, |
2969 |
++ } |
2970 |
++ } |
2971 |
++ }, |
2972 |
++ } }, |
2973 |
++ } |
2974 |
++ }, |
2975 |
++ .num_device_descs = 1, |
2976 |
++ .devices = { |
2977 |
++ {"Prof 1100 USB ", |
2978 |
++ {&dw2102_table[PROF_1100], NULL}, |
2979 |
++ {NULL}, |
2980 |
++ }, |
2981 |
++ } |
2982 |
+ }; |
2983 |
+ |
2984 |
+-static const struct dvb_usb_device_description d480_2 = { |
2985 |
+- "TeVii S480.2 USB", |
2986 |
+- {&dw2102_table[TEVII_S480_2], NULL}, |
2987 |
+- {NULL}, |
2988 |
+-}; |
2989 |
++static struct dvb_usb_device_properties s660_properties = { |
2990 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2991 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2992 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2993 |
++ .firmware = S660_FIRMWARE, |
2994 |
++ .no_reconnect = 1, |
2995 |
+ |
2996 |
+-static const struct dvb_usb_device_description d7500 = { |
2997 |
+- "Prof 7500 USB DVB-S2", |
2998 |
+- {&dw2102_table[PROF_7500], NULL}, |
2999 |
+- {NULL}, |
3000 |
+-}; |
3001 |
++ .i2c_algo = &s6x0_i2c_algo, |
3002 |
++ .rc.core = { |
3003 |
++ .rc_interval = 150, |
3004 |
++ .rc_codes = RC_MAP_TEVII_NEC, |
3005 |
++ .module_name = "dw2102", |
3006 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
3007 |
++ .rc_query = dw2102_rc_query, |
3008 |
++ }, |
3009 |
+ |
3010 |
+-static const struct dvb_usb_device_description d421 = { |
3011 |
+- "TeVii S421 PCI", |
3012 |
+- {&dw2102_table[TEVII_S421], NULL}, |
3013 |
+- {NULL}, |
3014 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
3015 |
++ .num_adapters = 1, |
3016 |
++ .download_firmware = dw2102_load_firmware, |
3017 |
++ .read_mac_address = s6x0_read_mac_address, |
3018 |
++ .adapter = { |
3019 |
++ { |
3020 |
++ .num_frontends = 1, |
3021 |
++ .fe = {{ |
3022 |
++ .frontend_attach = ds3000_frontend_attach, |
3023 |
++ .stream = { |
3024 |
++ .type = USB_BULK, |
3025 |
++ .count = 8, |
3026 |
++ .endpoint = 0x82, |
3027 |
++ .u = { |
3028 |
++ .bulk = { |
3029 |
++ .buffersize = 4096, |
3030 |
++ } |
3031 |
++ } |
3032 |
++ }, |
3033 |
++ } }, |
3034 |
++ } |
3035 |
++ }, |
3036 |
++ .num_device_descs = 3, |
3037 |
++ .devices = { |
3038 |
++ {"TeVii S660 USB", |
3039 |
++ {&dw2102_table[TEVII_S660], NULL}, |
3040 |
++ {NULL}, |
3041 |
++ }, |
3042 |
++ {"TeVii S480.1 USB", |
3043 |
++ {&dw2102_table[TEVII_S480_1], NULL}, |
3044 |
++ {NULL}, |
3045 |
++ }, |
3046 |
++ {"TeVii S480.2 USB", |
3047 |
++ {&dw2102_table[TEVII_S480_2], NULL}, |
3048 |
++ {NULL}, |
3049 |
++ }, |
3050 |
++ } |
3051 |
+ }; |
3052 |
+ |
3053 |
+-static const struct dvb_usb_device_description d632 = { |
3054 |
+- "TeVii S632 USB", |
3055 |
+- {&dw2102_table[TEVII_S632], NULL}, |
3056 |
+- {NULL}, |
3057 |
++static struct dvb_usb_device_properties p7500_properties = { |
3058 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
3059 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
3060 |
++ .size_of_priv = sizeof(struct dw2102_state), |
3061 |
++ .firmware = P7500_FIRMWARE, |
3062 |
++ .no_reconnect = 1, |
3063 |
++ |
3064 |
++ .i2c_algo = &s6x0_i2c_algo, |
3065 |
++ .rc.core = { |
3066 |
++ .rc_interval = 150, |
3067 |
++ .rc_codes = RC_MAP_TBS_NEC, |
3068 |
++ .module_name = "dw2102", |
3069 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
3070 |
++ .rc_query = prof_rc_query, |
3071 |
++ }, |
3072 |
++ |
3073 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
3074 |
++ .num_adapters = 1, |
3075 |
++ .download_firmware = dw2102_load_firmware, |
3076 |
++ .read_mac_address = s6x0_read_mac_address, |
3077 |
++ .adapter = { |
3078 |
++ { |
3079 |
++ .num_frontends = 1, |
3080 |
++ .fe = {{ |
3081 |
++ .frontend_attach = prof_7500_frontend_attach, |
3082 |
++ .stream = { |
3083 |
++ .type = USB_BULK, |
3084 |
++ .count = 8, |
3085 |
++ .endpoint = 0x82, |
3086 |
++ .u = { |
3087 |
++ .bulk = { |
3088 |
++ .buffersize = 4096, |
3089 |
++ } |
3090 |
++ } |
3091 |
++ }, |
3092 |
++ } }, |
3093 |
++ } |
3094 |
++ }, |
3095 |
++ .num_device_descs = 1, |
3096 |
++ .devices = { |
3097 |
++ {"Prof 7500 USB DVB-S2", |
3098 |
++ {&dw2102_table[PROF_7500], NULL}, |
3099 |
++ {NULL}, |
3100 |
++ }, |
3101 |
++ } |
3102 |
+ }; |
3103 |
+ |
3104 |
+ static struct dvb_usb_device_properties su3000_properties = { |
3105 |
+@@ -2212,6 +2319,59 @@ static struct dvb_usb_device_properties su3000_properties = { |
3106 |
+ } |
3107 |
+ }; |
3108 |
+ |
3109 |
++static struct dvb_usb_device_properties s421_properties = { |
3110 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
3111 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
3112 |
++ .size_of_priv = sizeof(struct dw2102_state), |
3113 |
++ .power_ctrl = su3000_power_ctrl, |
3114 |
++ .num_adapters = 1, |
3115 |
++ .identify_state = su3000_identify_state, |
3116 |
++ .i2c_algo = &su3000_i2c_algo, |
3117 |
++ |
3118 |
++ .rc.core = { |
3119 |
++ .rc_interval = 150, |
3120 |
++ .rc_codes = RC_MAP_SU3000, |
3121 |
++ .module_name = "dw2102", |
3122 |
++ .allowed_protos = RC_PROTO_BIT_RC5, |
3123 |
++ .rc_query = su3000_rc_query, |
3124 |
++ }, |
3125 |
++ |
3126 |
++ .read_mac_address = su3000_read_mac_address, |
3127 |
++ |
3128 |
++ .generic_bulk_ctrl_endpoint = 0x01, |
3129 |
++ |
3130 |
++ .adapter = { |
3131 |
++ { |
3132 |
++ .num_frontends = 1, |
3133 |
++ .fe = {{ |
3134 |
++ .streaming_ctrl = su3000_streaming_ctrl, |
3135 |
++ .frontend_attach = m88rs2000_frontend_attach, |
3136 |
++ .stream = { |
3137 |
++ .type = USB_BULK, |
3138 |
++ .count = 8, |
3139 |
++ .endpoint = 0x82, |
3140 |
++ .u = { |
3141 |
++ .bulk = { |
3142 |
++ .buffersize = 4096, |
3143 |
++ } |
3144 |
++ } |
3145 |
++ } |
3146 |
++ } }, |
3147 |
++ } |
3148 |
++ }, |
3149 |
++ .num_device_descs = 2, |
3150 |
++ .devices = { |
3151 |
++ { "TeVii S421 PCI", |
3152 |
++ { &dw2102_table[TEVII_S421], NULL }, |
3153 |
++ { NULL }, |
3154 |
++ }, |
3155 |
++ { "TeVii S632 USB", |
3156 |
++ { &dw2102_table[TEVII_S632], NULL }, |
3157 |
++ { NULL }, |
3158 |
++ }, |
3159 |
++ } |
3160 |
++}; |
3161 |
++ |
3162 |
+ static struct dvb_usb_device_properties t220_properties = { |
3163 |
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
3164 |
+ .usb_ctrl = DEVICE_SPECIFIC, |
3165 |
+@@ -2329,101 +2489,33 @@ static struct dvb_usb_device_properties tt_s2_4600_properties = { |
3166 |
+ static int dw2102_probe(struct usb_interface *intf, |
3167 |
+ const struct usb_device_id *id) |
3168 |
+ { |
3169 |
+- int retval = -ENOMEM; |
3170 |
+- struct dvb_usb_device_properties *p1100; |
3171 |
+- struct dvb_usb_device_properties *s660; |
3172 |
+- struct dvb_usb_device_properties *p7500; |
3173 |
+- struct dvb_usb_device_properties *s421; |
3174 |
+- |
3175 |
+- p1100 = kmemdup(&s6x0_properties, |
3176 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
3177 |
+- if (!p1100) |
3178 |
+- goto err0; |
3179 |
+- |
3180 |
+- /* copy default structure */ |
3181 |
+- /* fill only different fields */ |
3182 |
+- p1100->firmware = P1100_FIRMWARE; |
3183 |
+- p1100->devices[0] = d1100; |
3184 |
+- p1100->rc.core.rc_query = prof_rc_query; |
3185 |
+- p1100->rc.core.rc_codes = RC_MAP_TBS_NEC; |
3186 |
+- p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach; |
3187 |
+- |
3188 |
+- s660 = kmemdup(&s6x0_properties, |
3189 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
3190 |
+- if (!s660) |
3191 |
+- goto err1; |
3192 |
+- |
3193 |
+- s660->firmware = S660_FIRMWARE; |
3194 |
+- s660->num_device_descs = 3; |
3195 |
+- s660->devices[0] = d660; |
3196 |
+- s660->devices[1] = d480_1; |
3197 |
+- s660->devices[2] = d480_2; |
3198 |
+- s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach; |
3199 |
+- |
3200 |
+- p7500 = kmemdup(&s6x0_properties, |
3201 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
3202 |
+- if (!p7500) |
3203 |
+- goto err2; |
3204 |
+- |
3205 |
+- p7500->firmware = P7500_FIRMWARE; |
3206 |
+- p7500->devices[0] = d7500; |
3207 |
+- p7500->rc.core.rc_query = prof_rc_query; |
3208 |
+- p7500->rc.core.rc_codes = RC_MAP_TBS_NEC; |
3209 |
+- p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach; |
3210 |
+- |
3211 |
+- |
3212 |
+- s421 = kmemdup(&su3000_properties, |
3213 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
3214 |
+- if (!s421) |
3215 |
+- goto err3; |
3216 |
+- |
3217 |
+- s421->num_device_descs = 2; |
3218 |
+- s421->devices[0] = d421; |
3219 |
+- s421->devices[1] = d632; |
3220 |
+- s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach; |
3221 |
+- |
3222 |
+- if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
3223 |
+- THIS_MODULE, NULL, adapter_nr) || |
3224 |
+- 0 == dvb_usb_device_init(intf, &dw2104_properties, |
3225 |
+- THIS_MODULE, NULL, adapter_nr) || |
3226 |
+- 0 == dvb_usb_device_init(intf, &dw3101_properties, |
3227 |
+- THIS_MODULE, NULL, adapter_nr) || |
3228 |
+- 0 == dvb_usb_device_init(intf, &s6x0_properties, |
3229 |
+- THIS_MODULE, NULL, adapter_nr) || |
3230 |
+- 0 == dvb_usb_device_init(intf, p1100, |
3231 |
+- THIS_MODULE, NULL, adapter_nr) || |
3232 |
+- 0 == dvb_usb_device_init(intf, s660, |
3233 |
+- THIS_MODULE, NULL, adapter_nr) || |
3234 |
+- 0 == dvb_usb_device_init(intf, p7500, |
3235 |
+- THIS_MODULE, NULL, adapter_nr) || |
3236 |
+- 0 == dvb_usb_device_init(intf, s421, |
3237 |
+- THIS_MODULE, NULL, adapter_nr) || |
3238 |
+- 0 == dvb_usb_device_init(intf, &su3000_properties, |
3239 |
+- THIS_MODULE, NULL, adapter_nr) || |
3240 |
+- 0 == dvb_usb_device_init(intf, &t220_properties, |
3241 |
+- THIS_MODULE, NULL, adapter_nr) || |
3242 |
+- 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, |
3243 |
+- THIS_MODULE, NULL, adapter_nr)) { |
3244 |
+- |
3245 |
+- /* clean up copied properties */ |
3246 |
+- kfree(s421); |
3247 |
+- kfree(p7500); |
3248 |
+- kfree(s660); |
3249 |
+- kfree(p1100); |
3250 |
++ if (!(dvb_usb_device_init(intf, &dw2102_properties, |
3251 |
++ THIS_MODULE, NULL, adapter_nr) && |
3252 |
++ dvb_usb_device_init(intf, &dw2104_properties, |
3253 |
++ THIS_MODULE, NULL, adapter_nr) && |
3254 |
++ dvb_usb_device_init(intf, &dw3101_properties, |
3255 |
++ THIS_MODULE, NULL, adapter_nr) && |
3256 |
++ dvb_usb_device_init(intf, &s6x0_properties, |
3257 |
++ THIS_MODULE, NULL, adapter_nr) && |
3258 |
++ dvb_usb_device_init(intf, &p1100_properties, |
3259 |
++ THIS_MODULE, NULL, adapter_nr) && |
3260 |
++ dvb_usb_device_init(intf, &s660_properties, |
3261 |
++ THIS_MODULE, NULL, adapter_nr) && |
3262 |
++ dvb_usb_device_init(intf, &p7500_properties, |
3263 |
++ THIS_MODULE, NULL, adapter_nr) && |
3264 |
++ dvb_usb_device_init(intf, &s421_properties, |
3265 |
++ THIS_MODULE, NULL, adapter_nr) && |
3266 |
++ dvb_usb_device_init(intf, &su3000_properties, |
3267 |
++ THIS_MODULE, NULL, adapter_nr) && |
3268 |
++ dvb_usb_device_init(intf, &t220_properties, |
3269 |
++ THIS_MODULE, NULL, adapter_nr) && |
3270 |
++ dvb_usb_device_init(intf, &tt_s2_4600_properties, |
3271 |
++ THIS_MODULE, NULL, adapter_nr))) { |
3272 |
+ |
3273 |
+ return 0; |
3274 |
+ } |
3275 |
+ |
3276 |
+- retval = -ENODEV; |
3277 |
+- kfree(s421); |
3278 |
+-err3: |
3279 |
+- kfree(p7500); |
3280 |
+-err2: |
3281 |
+- kfree(s660); |
3282 |
+-err1: |
3283 |
+- kfree(p1100); |
3284 |
+-err0: |
3285 |
+- return retval; |
3286 |
++ return -ENODEV; |
3287 |
+ } |
3288 |
+ |
3289 |
+ static void dw2102_disconnect(struct usb_interface *intf) |
3290 |
+diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c |
3291 |
+index 22554d9abd432..3b2a0f36fc38e 100644 |
3292 |
+--- a/drivers/media/usb/dvb-usb/m920x.c |
3293 |
++++ b/drivers/media/usb/dvb-usb/m920x.c |
3294 |
+@@ -277,6 +277,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
3295 |
+ /* Should check for ack here, if we knew how. */ |
3296 |
+ } |
3297 |
+ if (msg[i].flags & I2C_M_RD) { |
3298 |
++ char *read = kmalloc(1, GFP_KERNEL); |
3299 |
++ if (!read) { |
3300 |
++ ret = -ENOMEM; |
3301 |
++ kfree(read); |
3302 |
++ goto unlock; |
3303 |
++ } |
3304 |
++ |
3305 |
+ for (j = 0; j < msg[i].len; j++) { |
3306 |
+ /* Last byte of transaction? |
3307 |
+ * Send STOP, otherwise send ACK. */ |
3308 |
+@@ -284,9 +291,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
3309 |
+ |
3310 |
+ if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
3311 |
+ 0x20 | stop, |
3312 |
+- &msg[i].buf[j], 1)) != 0) |
3313 |
++ read, 1)) != 0) |
3314 |
+ goto unlock; |
3315 |
++ msg[i].buf[j] = read[0]; |
3316 |
+ } |
3317 |
++ |
3318 |
++ kfree(read); |
3319 |
+ } else { |
3320 |
+ for (j = 0; j < msg[i].len; j++) { |
3321 |
+ /* Last byte of transaction? Then send STOP. */ |
3322 |
+diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c |
3323 |
+index ec608f60d2c75..06da08f8efdb1 100644 |
3324 |
+--- a/drivers/media/usb/em28xx/em28xx-cards.c |
3325 |
++++ b/drivers/media/usb/em28xx/em28xx-cards.c |
3326 |
+@@ -3515,8 +3515,10 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
3327 |
+ |
3328 |
+ if (dev->is_audio_only) { |
3329 |
+ retval = em28xx_audio_setup(dev); |
3330 |
+- if (retval) |
3331 |
+- return -ENODEV; |
3332 |
++ if (retval) { |
3333 |
++ retval = -ENODEV; |
3334 |
++ goto err_deinit_media; |
3335 |
++ } |
3336 |
+ em28xx_init_extension(dev); |
3337 |
+ |
3338 |
+ return 0; |
3339 |
+@@ -3535,7 +3537,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
3340 |
+ dev_err(&dev->intf->dev, |
3341 |
+ "%s: em28xx_i2c_register bus 0 - error [%d]!\n", |
3342 |
+ __func__, retval); |
3343 |
+- return retval; |
3344 |
++ goto err_deinit_media; |
3345 |
+ } |
3346 |
+ |
3347 |
+ /* register i2c bus 1 */ |
3348 |
+@@ -3551,9 +3553,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
3349 |
+ "%s: em28xx_i2c_register bus 1 - error [%d]!\n", |
3350 |
+ __func__, retval); |
3351 |
+ |
3352 |
+- em28xx_i2c_unregister(dev, 0); |
3353 |
+- |
3354 |
+- return retval; |
3355 |
++ goto err_unreg_i2c; |
3356 |
+ } |
3357 |
+ } |
3358 |
+ |
3359 |
+@@ -3561,6 +3561,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
3360 |
+ em28xx_card_setup(dev); |
3361 |
+ |
3362 |
+ return 0; |
3363 |
++ |
3364 |
++err_unreg_i2c: |
3365 |
++ em28xx_i2c_unregister(dev, 0); |
3366 |
++err_deinit_media: |
3367 |
++ em28xx_unregister_media_device(dev); |
3368 |
++ return retval; |
3369 |
+ } |
3370 |
+ |
3371 |
+ static int em28xx_duplicate_dev(struct em28xx *dev) |
3372 |
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c |
3373 |
+index 437651307056f..334a82add53f3 100644 |
3374 |
+--- a/drivers/media/usb/em28xx/em28xx-core.c |
3375 |
++++ b/drivers/media/usb/em28xx/em28xx-core.c |
3376 |
+@@ -89,7 +89,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, |
3377 |
+ mutex_lock(&dev->ctrl_urb_lock); |
3378 |
+ ret = usb_control_msg(udev, pipe, req, |
3379 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3380 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
3381 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
3382 |
+ if (ret < 0) { |
3383 |
+ em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %02x failed with error %i\n", |
3384 |
+ pipe, |
3385 |
+@@ -158,7 +158,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, |
3386 |
+ memcpy(dev->urb_buf, buf, len); |
3387 |
+ ret = usb_control_msg(udev, pipe, req, |
3388 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3389 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
3390 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
3391 |
+ mutex_unlock(&dev->ctrl_urb_lock); |
3392 |
+ |
3393 |
+ if (ret < 0) { |
3394 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
3395 |
+index d1bbfe4000ddc..21ccbbd70dcee 100644 |
3396 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
3397 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
3398 |
+@@ -1476,7 +1476,7 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) |
3399 |
+ for (address = 0; address < fwsize; address += 0x800) { |
3400 |
+ memcpy(fw_ptr, fw_entry->data + address, 0x800); |
3401 |
+ ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, |
3402 |
+- 0, fw_ptr, 0x800, HZ); |
3403 |
++ 0, fw_ptr, 0x800, 1000); |
3404 |
+ } |
3405 |
+ |
3406 |
+ trace_firmware("Upload done, releasing device's CPU"); |
3407 |
+@@ -1614,7 +1614,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) |
3408 |
+ ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); |
3409 |
+ |
3410 |
+ ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, |
3411 |
+- &actual_length, HZ); |
3412 |
++ &actual_length, 1000); |
3413 |
+ ret |= (actual_length != bcnt); |
3414 |
+ if (ret) break; |
3415 |
+ fw_done += bcnt; |
3416 |
+@@ -3431,7 +3431,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, |
3417 |
+ 0xa0,0xc0, |
3418 |
+ address,0, |
3419 |
+ hdw->fw_buffer+address, |
3420 |
+- 0x800,HZ); |
3421 |
++ 0x800,1000); |
3422 |
+ if (ret < 0) break; |
3423 |
+ } |
3424 |
+ |
3425 |
+@@ -3970,7 +3970,7 @@ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) |
3426 |
+ /* Write the CPUCS register on the 8051. The lsb of the register |
3427 |
+ is the reset bit; a 1 asserts reset while a 0 clears it. */ |
3428 |
+ pipe = usb_sndctrlpipe(hdw->usb_dev, 0); |
3429 |
+- ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); |
3430 |
++ ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); |
3431 |
+ if (ret < 0) { |
3432 |
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
3433 |
+ "cpureset_assert(%d) error=%d",val,ret); |
3434 |
+diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c |
3435 |
+index 82927eb334c48..3e3ecf214762a 100644 |
3436 |
+--- a/drivers/media/usb/s2255/s2255drv.c |
3437 |
++++ b/drivers/media/usb/s2255/s2255drv.c |
3438 |
+@@ -1904,7 +1904,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
3439 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
3440 |
+ USB_DIR_IN, |
3441 |
+ Value, Index, buf, |
3442 |
+- TransferBufferLength, HZ * 5); |
3443 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
3444 |
+ |
3445 |
+ if (r >= 0) |
3446 |
+ memcpy(TransferBuffer, buf, TransferBufferLength); |
3447 |
+@@ -1913,7 +1913,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
3448 |
+ r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
3449 |
+ Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3450 |
+ Value, Index, buf, |
3451 |
+- TransferBufferLength, HZ * 5); |
3452 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
3453 |
+ } |
3454 |
+ kfree(buf); |
3455 |
+ return r; |
3456 |
+diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
3457 |
+index 468f5ccf4ae6c..bb0db4cdc6c75 100644 |
3458 |
+--- a/drivers/media/usb/stk1160/stk1160-core.c |
3459 |
++++ b/drivers/media/usb/stk1160/stk1160-core.c |
3460 |
+@@ -75,7 +75,7 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) |
3461 |
+ return -ENOMEM; |
3462 |
+ ret = usb_control_msg(dev->udev, pipe, 0x00, |
3463 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3464 |
+- 0x00, reg, buf, sizeof(u8), HZ); |
3465 |
++ 0x00, reg, buf, sizeof(u8), 1000); |
3466 |
+ if (ret < 0) { |
3467 |
+ stk1160_err("read failed on reg 0x%x (%d)\n", |
3468 |
+ reg, ret); |
3469 |
+@@ -95,7 +95,7 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) |
3470 |
+ |
3471 |
+ ret = usb_control_msg(dev->udev, pipe, 0x01, |
3472 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3473 |
+- value, reg, NULL, 0, HZ); |
3474 |
++ value, reg, NULL, 0, 1000); |
3475 |
+ if (ret < 0) { |
3476 |
+ stk1160_err("write failed on reg 0x%x (%d)\n", |
3477 |
+ reg, ret); |
3478 |
+diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c |
3479 |
+index 9c26e586bb01d..b431f06d5a1f5 100644 |
3480 |
+--- a/drivers/media/usb/uvc/uvc_video.c |
3481 |
++++ b/drivers/media/usb/uvc/uvc_video.c |
3482 |
+@@ -1854,6 +1854,10 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) |
3483 |
+ if (ep == NULL) |
3484 |
+ return -EIO; |
3485 |
+ |
3486 |
++ /* Reject broken descriptors. */ |
3487 |
++ if (usb_endpoint_maxp(&ep->desc) == 0) |
3488 |
++ return -EIO; |
3489 |
++ |
3490 |
+ ret = uvc_init_video_bulk(stream, ep, gfp_flags); |
3491 |
+ } |
3492 |
+ |
3493 |
+diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h |
3494 |
+index a738486fd9d64..839ba3cc53119 100644 |
3495 |
+--- a/drivers/media/usb/uvc/uvcvideo.h |
3496 |
++++ b/drivers/media/usb/uvc/uvcvideo.h |
3497 |
+@@ -176,7 +176,7 @@ |
3498 |
+ /* Maximum status buffer size in bytes of interrupt URB. */ |
3499 |
+ #define UVC_MAX_STATUS_SIZE 16 |
3500 |
+ |
3501 |
+-#define UVC_CTRL_CONTROL_TIMEOUT 500 |
3502 |
++#define UVC_CTRL_CONTROL_TIMEOUT 5000 |
3503 |
+ #define UVC_CTRL_STREAMING_TIMEOUT 5000 |
3504 |
+ |
3505 |
+ /* Maximum allowed number of control mappings per device */ |
3506 |
+diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c |
3507 |
+index 7911b0a14a6d0..fc44fb7c595bc 100644 |
3508 |
+--- a/drivers/mfd/intel-lpss-acpi.c |
3509 |
++++ b/drivers/mfd/intel-lpss-acpi.c |
3510 |
+@@ -80,6 +80,7 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
3511 |
+ { |
3512 |
+ struct intel_lpss_platform_info *info; |
3513 |
+ const struct acpi_device_id *id; |
3514 |
++ int ret; |
3515 |
+ |
3516 |
+ id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev); |
3517 |
+ if (!id) |
3518 |
+@@ -93,10 +94,14 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
3519 |
+ info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
3520 |
+ info->irq = platform_get_irq(pdev, 0); |
3521 |
+ |
3522 |
++ ret = intel_lpss_probe(&pdev->dev, info); |
3523 |
++ if (ret) |
3524 |
++ return ret; |
3525 |
++ |
3526 |
+ pm_runtime_set_active(&pdev->dev); |
3527 |
+ pm_runtime_enable(&pdev->dev); |
3528 |
+ |
3529 |
+- return intel_lpss_probe(&pdev->dev, info); |
3530 |
++ return 0; |
3531 |
+ } |
3532 |
+ |
3533 |
+ static int intel_lpss_acpi_remove(struct platform_device *pdev) |
3534 |
+diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c |
3535 |
+index 626fdcaf25101..645d26536114f 100644 |
3536 |
+--- a/drivers/misc/lattice-ecp3-config.c |
3537 |
++++ b/drivers/misc/lattice-ecp3-config.c |
3538 |
+@@ -81,12 +81,12 @@ static void firmware_load(const struct firmware *fw, void *context) |
3539 |
+ |
3540 |
+ if (fw == NULL) { |
3541 |
+ dev_err(&spi->dev, "Cannot load firmware, aborting\n"); |
3542 |
+- return; |
3543 |
++ goto out; |
3544 |
+ } |
3545 |
+ |
3546 |
+ if (fw->size == 0) { |
3547 |
+ dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
3548 |
+- return; |
3549 |
++ goto out; |
3550 |
+ } |
3551 |
+ |
3552 |
+ /* Fill dummy data (24 stuffing bits for commands) */ |
3553 |
+@@ -108,7 +108,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
3554 |
+ dev_err(&spi->dev, |
3555 |
+ "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", |
3556 |
+ jedec_id); |
3557 |
+- return; |
3558 |
++ goto out; |
3559 |
+ } |
3560 |
+ |
3561 |
+ dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); |
3562 |
+@@ -121,7 +121,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
3563 |
+ buffer = kzalloc(fw->size + 8, GFP_KERNEL); |
3564 |
+ if (!buffer) { |
3565 |
+ dev_err(&spi->dev, "Error: Can't allocate memory!\n"); |
3566 |
+- return; |
3567 |
++ goto out; |
3568 |
+ } |
3569 |
+ |
3570 |
+ /* |
3571 |
+@@ -160,7 +160,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
3572 |
+ "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", |
3573 |
+ status); |
3574 |
+ kfree(buffer); |
3575 |
+- return; |
3576 |
++ goto out; |
3577 |
+ } |
3578 |
+ |
3579 |
+ dev_info(&spi->dev, "Configuring the FPGA...\n"); |
3580 |
+@@ -186,7 +186,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
3581 |
+ release_firmware(fw); |
3582 |
+ |
3583 |
+ kfree(buffer); |
3584 |
+- |
3585 |
++out: |
3586 |
+ complete(&data->fw_loaded); |
3587 |
+ } |
3588 |
+ |
3589 |
+diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile |
3590 |
+index aeb960cb096d6..b7ceb5f22c266 100644 |
3591 |
+--- a/drivers/misc/lkdtm/Makefile |
3592 |
++++ b/drivers/misc/lkdtm/Makefile |
3593 |
+@@ -13,7 +13,7 @@ KCOV_INSTRUMENT_rodata.o := n |
3594 |
+ |
3595 |
+ OBJCOPYFLAGS := |
3596 |
+ OBJCOPYFLAGS_rodata_objcopy.o := \ |
3597 |
+- --rename-section .noinstr.text=.rodata,alloc,readonly,load |
3598 |
++ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents |
3599 |
+ targets += rodata.o rodata_objcopy.o |
3600 |
+ $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE |
3601 |
+ $(call if_changed,objcopy) |
3602 |
+diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c |
3603 |
+index 4e72ad24322f7..5f1ee88aa7615 100644 |
3604 |
+--- a/drivers/mmc/core/sdio.c |
3605 |
++++ b/drivers/mmc/core/sdio.c |
3606 |
+@@ -634,6 +634,8 @@ try_again: |
3607 |
+ if (host->ops->init_card) |
3608 |
+ host->ops->init_card(host, card); |
3609 |
+ |
3610 |
++ card->ocr = ocr_card; |
3611 |
++ |
3612 |
+ /* |
3613 |
+ * If the host and card support UHS-I mode request the card |
3614 |
+ * to switch to 1.8V signaling level. No 1.8v signalling if |
3615 |
+@@ -740,7 +742,7 @@ try_again: |
3616 |
+ |
3617 |
+ card = oldcard; |
3618 |
+ } |
3619 |
+- card->ocr = ocr_card; |
3620 |
++ |
3621 |
+ mmc_fixup_device(card, sdio_fixup_methods); |
3622 |
+ |
3623 |
+ if (card->type == MMC_TYPE_SD_COMBO) { |
3624 |
+diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c |
3625 |
+index 27837a794e7b3..1f7e4352b0677 100644 |
3626 |
+--- a/drivers/mmc/host/meson-mx-sdio.c |
3627 |
++++ b/drivers/mmc/host/meson-mx-sdio.c |
3628 |
+@@ -668,6 +668,11 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) |
3629 |
+ } |
3630 |
+ |
3631 |
+ irq = platform_get_irq(pdev, 0); |
3632 |
++ if (irq < 0) { |
3633 |
++ ret = irq; |
3634 |
++ goto error_free_mmc; |
3635 |
++ } |
3636 |
++ |
3637 |
+ ret = devm_request_threaded_irq(host->controller_dev, irq, |
3638 |
+ meson_mx_mmc_irq, |
3639 |
+ meson_mx_mmc_irq_thread, IRQF_ONESHOT, |
3640 |
+diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c |
3641 |
+index 044adf9138546..64af6898131d6 100644 |
3642 |
+--- a/drivers/mtd/nand/bbt.c |
3643 |
++++ b/drivers/mtd/nand/bbt.c |
3644 |
+@@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry, |
3645 |
+ unsigned int rbits = bits_per_block + offs - BITS_PER_LONG; |
3646 |
+ |
3647 |
+ pos[1] &= ~GENMASK(rbits - 1, 0); |
3648 |
+- pos[1] |= val >> rbits; |
3649 |
++ pos[1] |= val >> (bits_per_block - rbits); |
3650 |
+ } |
3651 |
+ |
3652 |
+ return 0; |
3653 |
+diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
3654 |
+index 6bd414bac34d1..6370a59a25790 100644 |
3655 |
+--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
3656 |
++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
3657 |
+@@ -612,15 +612,6 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) |
3658 |
+ r->clock[i] = clk; |
3659 |
+ } |
3660 |
+ |
3661 |
+- if (GPMI_IS_MX6(this)) |
3662 |
+- /* |
3663 |
+- * Set the default value for the gpmi clock. |
3664 |
+- * |
3665 |
+- * If you want to use the ONFI nand which is in the |
3666 |
+- * Synchronous Mode, you should change the clock as you need. |
3667 |
+- */ |
3668 |
+- clk_set_rate(r->clock[0], 22000000); |
3669 |
+- |
3670 |
+ return 0; |
3671 |
+ |
3672 |
+ err_clock: |
3673 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
3674 |
+index d6c5f41b17f7e..2d70cdd26f89d 100644 |
3675 |
+--- a/drivers/net/bonding/bond_main.c |
3676 |
++++ b/drivers/net/bonding/bond_main.c |
3677 |
+@@ -782,14 +782,14 @@ static bool bond_should_notify_peers(struct bonding *bond) |
3678 |
+ slave = rcu_dereference(bond->curr_active_slave); |
3679 |
+ rcu_read_unlock(); |
3680 |
+ |
3681 |
+- netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
3682 |
+- slave ? slave->dev->name : "NULL"); |
3683 |
+- |
3684 |
+ if (!slave || !bond->send_peer_notif || |
3685 |
+ !netif_carrier_ok(bond->dev) || |
3686 |
+ test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
3687 |
+ return false; |
3688 |
+ |
3689 |
++ netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
3690 |
++ slave ? slave->dev->name : "NULL"); |
3691 |
++ |
3692 |
+ return true; |
3693 |
+ } |
3694 |
+ |
3695 |
+diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c |
3696 |
+index 4d4492884e0b0..efe7d576afa5c 100644 |
3697 |
+--- a/drivers/net/can/softing/softing_cs.c |
3698 |
++++ b/drivers/net/can/softing/softing_cs.c |
3699 |
+@@ -304,7 +304,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia) |
3700 |
+ return 0; |
3701 |
+ |
3702 |
+ platform_failed: |
3703 |
+- kfree(dev); |
3704 |
++ platform_device_put(pdev); |
3705 |
+ mem_failed: |
3706 |
+ pcmcia_bad: |
3707 |
+ pcmcia_failed: |
3708 |
+diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c |
3709 |
+index aac58ce6e371a..209eddeb822e5 100644 |
3710 |
+--- a/drivers/net/can/softing/softing_fw.c |
3711 |
++++ b/drivers/net/can/softing/softing_fw.c |
3712 |
+@@ -576,18 +576,19 @@ int softing_startstop(struct net_device *dev, int up) |
3713 |
+ if (ret < 0) |
3714 |
+ goto failed; |
3715 |
+ } |
3716 |
+- /* enable_error_frame */ |
3717 |
+- /* |
3718 |
++ |
3719 |
++ /* enable_error_frame |
3720 |
++ * |
3721 |
+ * Error reporting is switched off at the moment since |
3722 |
+ * the receiving of them is not yet 100% verified |
3723 |
+ * This should be enabled sooner or later |
3724 |
+- * |
3725 |
+- if (error_reporting) { |
3726 |
++ */ |
3727 |
++ if (0 && error_reporting) { |
3728 |
+ ret = softing_fct_cmd(card, 51, "enable_error_frame"); |
3729 |
+ if (ret < 0) |
3730 |
+ goto failed; |
3731 |
+ } |
3732 |
+- */ |
3733 |
++ |
3734 |
+ /* initialize interface */ |
3735 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); |
3736 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); |
3737 |
+diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
3738 |
+index 6a57169c27158..8fa5836e54875 100644 |
3739 |
+--- a/drivers/net/can/usb/gs_usb.c |
3740 |
++++ b/drivers/net/can/usb/gs_usb.c |
3741 |
+@@ -328,7 +328,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
3742 |
+ |
3743 |
+ /* device reports out of range channel id */ |
3744 |
+ if (hf->channel >= GS_MAX_INTF) |
3745 |
+- goto resubmit_urb; |
3746 |
++ goto device_detach; |
3747 |
+ |
3748 |
+ dev = usbcan->canch[hf->channel]; |
3749 |
+ |
3750 |
+@@ -413,6 +413,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
3751 |
+ |
3752 |
+ /* USB failure take down all interfaces */ |
3753 |
+ if (rc == -ENODEV) { |
3754 |
++ device_detach: |
3755 |
+ for (rc = 0; rc < GS_MAX_INTF; rc++) { |
3756 |
+ if (usbcan->canch[rc]) |
3757 |
+ netif_device_detach(usbcan->canch[rc]->netdev); |
3758 |
+@@ -514,6 +515,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, |
3759 |
+ |
3760 |
+ hf->echo_id = idx; |
3761 |
+ hf->channel = dev->channel; |
3762 |
++ hf->flags = 0; |
3763 |
++ hf->reserved = 0; |
3764 |
+ |
3765 |
+ cf = (struct can_frame *)skb->data; |
3766 |
+ |
3767 |
+diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c |
3768 |
+index b01c6da4dd814..90447a420ec7c 100644 |
3769 |
+--- a/drivers/net/can/xilinx_can.c |
3770 |
++++ b/drivers/net/can/xilinx_can.c |
3771 |
+@@ -1536,7 +1536,12 @@ static int xcan_probe(struct platform_device *pdev) |
3772 |
+ spin_lock_init(&priv->tx_lock); |
3773 |
+ |
3774 |
+ /* Get IRQ for the device */ |
3775 |
+- ndev->irq = platform_get_irq(pdev, 0); |
3776 |
++ ret = platform_get_irq(pdev, 0); |
3777 |
++ if (ret < 0) |
3778 |
++ goto err_free; |
3779 |
++ |
3780 |
++ ndev->irq = ret; |
3781 |
++ |
3782 |
+ ndev->flags |= IFF_ECHO; /* We support local echo */ |
3783 |
+ |
3784 |
+ platform_set_drvdata(pdev, ndev); |
3785 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
3786 |
+index 79e156e2ad6a0..d4be107ea4cdf 100644 |
3787 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
3788 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
3789 |
+@@ -3516,10 +3516,12 @@ static int bcmgenet_probe(struct platform_device *pdev) |
3790 |
+ |
3791 |
+ /* Request the WOL interrupt and advertise suspend if available */ |
3792 |
+ priv->wol_irq_disabled = true; |
3793 |
+- err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, |
3794 |
+- dev->name, priv); |
3795 |
+- if (!err) |
3796 |
+- device_set_wakeup_capable(&pdev->dev, 1); |
3797 |
++ if (priv->wol_irq > 0) { |
3798 |
++ err = devm_request_irq(&pdev->dev, priv->wol_irq, |
3799 |
++ bcmgenet_wol_isr, 0, dev->name, priv); |
3800 |
++ if (!err) |
3801 |
++ device_set_wakeup_capable(&pdev->dev, 1); |
3802 |
++ } |
3803 |
+ |
3804 |
+ /* Set the needed headroom to account for any possible |
3805 |
+ * features enabling/disabling at runtime |
3806 |
+diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3807 |
+index d04a6c1634452..da8d10475a08e 100644 |
3808 |
+--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3809 |
++++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3810 |
+@@ -32,6 +32,7 @@ |
3811 |
+ |
3812 |
+ #include <linux/tcp.h> |
3813 |
+ #include <linux/ipv6.h> |
3814 |
++#include <net/inet_ecn.h> |
3815 |
+ #include <net/route.h> |
3816 |
+ #include <net/ip6_route.h> |
3817 |
+ |
3818 |
+@@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *lldi, |
3819 |
+ |
3820 |
+ rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, |
3821 |
+ peer_port, local_port, IPPROTO_TCP, |
3822 |
+- tos, 0); |
3823 |
++ tos & ~INET_ECN_MASK, 0); |
3824 |
+ if (IS_ERR(rt)) |
3825 |
+ return NULL; |
3826 |
+ n = dst_neigh_lookup(&rt->dst, &peer_ip); |
3827 |
+diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c |
3828 |
+index 5242687060b44..f8a3d1fecb0a5 100644 |
3829 |
+--- a/drivers/net/ethernet/cortina/gemini.c |
3830 |
++++ b/drivers/net/ethernet/cortina/gemini.c |
3831 |
+@@ -304,21 +304,21 @@ static void gmac_speed_set(struct net_device *netdev) |
3832 |
+ switch (phydev->speed) { |
3833 |
+ case 1000: |
3834 |
+ status.bits.speed = GMAC_SPEED_1000; |
3835 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
3836 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
3837 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_1000; |
3838 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", |
3839 |
+ phydev_name(phydev)); |
3840 |
+ break; |
3841 |
+ case 100: |
3842 |
+ status.bits.speed = GMAC_SPEED_100; |
3843 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
3844 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
3845 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
3846 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", |
3847 |
+ phydev_name(phydev)); |
3848 |
+ break; |
3849 |
+ case 10: |
3850 |
+ status.bits.speed = GMAC_SPEED_10; |
3851 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
3852 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
3853 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
3854 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", |
3855 |
+ phydev_name(phydev)); |
3856 |
+@@ -389,6 +389,9 @@ static int gmac_setup_phy(struct net_device *netdev) |
3857 |
+ status.bits.mii_rmii = GMAC_PHY_GMII; |
3858 |
+ break; |
3859 |
+ case PHY_INTERFACE_MODE_RGMII: |
3860 |
++ case PHY_INTERFACE_MODE_RGMII_ID: |
3861 |
++ case PHY_INTERFACE_MODE_RGMII_TXID: |
3862 |
++ case PHY_INTERFACE_MODE_RGMII_RXID: |
3863 |
+ netdev_dbg(netdev, |
3864 |
+ "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); |
3865 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
3866 |
+diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c |
3867 |
+index a847b9c3b31a9..713abcd9371fa 100644 |
3868 |
+--- a/drivers/net/ethernet/freescale/fman/mac.c |
3869 |
++++ b/drivers/net/ethernet/freescale/fman/mac.c |
3870 |
+@@ -94,14 +94,17 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) |
3871 |
+ __func__, ex); |
3872 |
+ } |
3873 |
+ |
3874 |
+-static void set_fman_mac_params(struct mac_device *mac_dev, |
3875 |
+- struct fman_mac_params *params) |
3876 |
++static int set_fman_mac_params(struct mac_device *mac_dev, |
3877 |
++ struct fman_mac_params *params) |
3878 |
+ { |
3879 |
+ struct mac_priv_s *priv = mac_dev->priv; |
3880 |
+ |
3881 |
+ params->base_addr = (typeof(params->base_addr)) |
3882 |
+ devm_ioremap(priv->dev, mac_dev->res->start, |
3883 |
+ resource_size(mac_dev->res)); |
3884 |
++ if (!params->base_addr) |
3885 |
++ return -ENOMEM; |
3886 |
++ |
3887 |
+ memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); |
3888 |
+ params->max_speed = priv->max_speed; |
3889 |
+ params->phy_if = mac_dev->phy_if; |
3890 |
+@@ -112,6 +115,8 @@ static void set_fman_mac_params(struct mac_device *mac_dev, |
3891 |
+ params->event_cb = mac_exception; |
3892 |
+ params->dev_id = mac_dev; |
3893 |
+ params->internal_phy_node = priv->internal_phy_node; |
3894 |
++ |
3895 |
++ return 0; |
3896 |
+ } |
3897 |
+ |
3898 |
+ static int tgec_initialization(struct mac_device *mac_dev) |
3899 |
+@@ -123,7 +128,9 @@ static int tgec_initialization(struct mac_device *mac_dev) |
3900 |
+ |
3901 |
+ priv = mac_dev->priv; |
3902 |
+ |
3903 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3904 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3905 |
++ if (err) |
3906 |
++ goto _return; |
3907 |
+ |
3908 |
+ mac_dev->fman_mac = tgec_config(¶ms); |
3909 |
+ if (!mac_dev->fman_mac) { |
3910 |
+@@ -169,7 +176,9 @@ static int dtsec_initialization(struct mac_device *mac_dev) |
3911 |
+ |
3912 |
+ priv = mac_dev->priv; |
3913 |
+ |
3914 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3915 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3916 |
++ if (err) |
3917 |
++ goto _return; |
3918 |
+ |
3919 |
+ mac_dev->fman_mac = dtsec_config(¶ms); |
3920 |
+ if (!mac_dev->fman_mac) { |
3921 |
+@@ -218,7 +227,9 @@ static int memac_initialization(struct mac_device *mac_dev) |
3922 |
+ |
3923 |
+ priv = mac_dev->priv; |
3924 |
+ |
3925 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3926 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3927 |
++ if (err) |
3928 |
++ goto _return; |
3929 |
+ |
3930 |
+ if (priv->max_speed == SPEED_10000) |
3931 |
+ params.phy_if = PHY_INTERFACE_MODE_XGMII; |
3932 |
+diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c |
3933 |
+index c82c85ef5fb34..c37aea7ba8502 100644 |
3934 |
+--- a/drivers/net/ethernet/freescale/xgmac_mdio.c |
3935 |
++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c |
3936 |
+@@ -301,9 +301,10 @@ err_ioremap: |
3937 |
+ static int xgmac_mdio_remove(struct platform_device *pdev) |
3938 |
+ { |
3939 |
+ struct mii_bus *bus = platform_get_drvdata(pdev); |
3940 |
++ struct mdio_fsl_priv *priv = bus->priv; |
3941 |
+ |
3942 |
+ mdiobus_unregister(bus); |
3943 |
+- iounmap(bus->priv); |
3944 |
++ iounmap(priv->mdio_base); |
3945 |
+ mdiobus_free(bus); |
3946 |
+ |
3947 |
+ return 0; |
3948 |
+diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c |
3949 |
+index 43c1fd18670b0..a990e606ecaa8 100644 |
3950 |
+--- a/drivers/net/ethernet/i825xx/sni_82596.c |
3951 |
++++ b/drivers/net/ethernet/i825xx/sni_82596.c |
3952 |
+@@ -122,9 +122,10 @@ static int sni_82596_probe(struct platform_device *dev) |
3953 |
+ netdevice->dev_addr[5] = readb(eth_addr + 0x06); |
3954 |
+ iounmap(eth_addr); |
3955 |
+ |
3956 |
+- if (!netdevice->irq) { |
3957 |
++ if (netdevice->irq < 0) { |
3958 |
+ printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", |
3959 |
+ __FILE__, netdevice->base_addr); |
3960 |
++ retval = netdevice->irq; |
3961 |
+ goto probe_failed; |
3962 |
+ } |
3963 |
+ |
3964 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3965 |
+index a903e97793f9a..addd5765576d9 100644 |
3966 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3967 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3968 |
+@@ -1825,6 +1825,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) |
3969 |
+ { |
3970 |
+ pci_driver->probe = mlxsw_pci_probe; |
3971 |
+ pci_driver->remove = mlxsw_pci_remove; |
3972 |
++ pci_driver->shutdown = mlxsw_pci_remove; |
3973 |
+ return pci_register_driver(pci_driver); |
3974 |
+ } |
3975 |
+ EXPORT_SYMBOL(mlxsw_pci_driver_register); |
3976 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3977 |
+index b093f14eeec39..5190402f779ec 100644 |
3978 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3979 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3980 |
+@@ -279,6 +279,16 @@ static int axienet_dma_bd_init(struct net_device *ndev) |
3981 |
+ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, |
3982 |
+ cr | XAXIDMA_CR_RUNSTOP_MASK); |
3983 |
+ |
3984 |
++ /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ |
3985 |
++ ret = read_poll_timeout(axienet_ior, value, |
3986 |
++ value & XAE_INT_PHYRSTCMPLT_MASK, |
3987 |
++ DELAY_OF_ONE_MILLISEC, 50000, false, lp, |
3988 |
++ XAE_IS_OFFSET); |
3989 |
++ if (ret) { |
3990 |
++ dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); |
3991 |
++ return ret; |
3992 |
++ } |
3993 |
++ |
3994 |
+ return 0; |
3995 |
+ out: |
3996 |
+ axienet_dma_bd_release(ndev); |
3997 |
+@@ -672,7 +682,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
3998 |
+ num_frag = skb_shinfo(skb)->nr_frags; |
3999 |
+ cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
4000 |
+ |
4001 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) { |
4002 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) { |
4003 |
+ if (netif_queue_stopped(ndev)) |
4004 |
+ return NETDEV_TX_BUSY; |
4005 |
+ |
4006 |
+@@ -682,7 +692,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
4007 |
+ smp_mb(); |
4008 |
+ |
4009 |
+ /* Space might have just been freed - check again */ |
4010 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) |
4011 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) |
4012 |
+ return NETDEV_TX_BUSY; |
4013 |
+ |
4014 |
+ netif_wake_queue(ndev); |
4015 |
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
4016 |
+index 832a401c5fa56..484f6691b9c9f 100644 |
4017 |
+--- a/drivers/net/phy/marvell.c |
4018 |
++++ b/drivers/net/phy/marvell.c |
4019 |
+@@ -930,6 +930,12 @@ static int m88e1118_config_init(struct phy_device *phydev) |
4020 |
+ if (err < 0) |
4021 |
+ return err; |
4022 |
+ |
4023 |
++ if (phy_interface_is_rgmii(phydev)) { |
4024 |
++ err = m88e1121_config_aneg_rgmii_delays(phydev); |
4025 |
++ if (err < 0) |
4026 |
++ return err; |
4027 |
++ } |
4028 |
++ |
4029 |
+ /* Adjust LED Control */ |
4030 |
+ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) |
4031 |
+ err = phy_write(phydev, 0x10, 0x1100); |
4032 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
4033 |
+index 3207da2224f67..eaa890a6a5d21 100644 |
4034 |
+--- a/drivers/net/phy/mdio_bus.c |
4035 |
++++ b/drivers/net/phy/mdio_bus.c |
4036 |
+@@ -426,7 +426,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) |
4037 |
+ mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); |
4038 |
+ |
4039 |
+ bus->state = MDIOBUS_REGISTERED; |
4040 |
+- pr_info("%s: probed\n", bus->name); |
4041 |
++ dev_dbg(&bus->dev, "probed\n"); |
4042 |
+ return 0; |
4043 |
+ |
4044 |
+ error: |
4045 |
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
4046 |
+index dc9de8731c564..3f335b57d5cde 100644 |
4047 |
+--- a/drivers/net/ppp/ppp_generic.c |
4048 |
++++ b/drivers/net/ppp/ppp_generic.c |
4049 |
+@@ -73,6 +73,8 @@ |
4050 |
+ #define MPHDRLEN 6 /* multilink protocol header length */ |
4051 |
+ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ |
4052 |
+ |
4053 |
++#define PPP_PROTO_LEN 2 |
4054 |
++ |
4055 |
+ /* |
4056 |
+ * An instance of /dev/ppp can be associated with either a ppp |
4057 |
+ * interface unit or a ppp channel. In both cases, file->private_data |
4058 |
+@@ -502,6 +504,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, |
4059 |
+ |
4060 |
+ if (!pf) |
4061 |
+ return -ENXIO; |
4062 |
++ /* All PPP packets should start with the 2-byte protocol */ |
4063 |
++ if (count < PPP_PROTO_LEN) |
4064 |
++ return -EINVAL; |
4065 |
+ ret = -ENOMEM; |
4066 |
+ skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
4067 |
+ if (!skb) |
4068 |
+@@ -1550,7 +1555,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) |
4069 |
+ } |
4070 |
+ |
4071 |
+ ++ppp->stats64.tx_packets; |
4072 |
+- ppp->stats64.tx_bytes += skb->len - 2; |
4073 |
++ ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; |
4074 |
+ |
4075 |
+ switch (proto) { |
4076 |
+ case PPP_IP: |
4077 |
+diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c |
4078 |
+index 5a47e5510ca82..c0f52a622964f 100644 |
4079 |
+--- a/drivers/net/usb/mcs7830.c |
4080 |
++++ b/drivers/net/usb/mcs7830.c |
4081 |
+@@ -121,8 +121,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver"; |
4082 |
+ |
4083 |
+ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) |
4084 |
+ { |
4085 |
+- return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
4086 |
+- 0x0000, index, data, size); |
4087 |
++ int ret; |
4088 |
++ |
4089 |
++ ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
4090 |
++ 0x0000, index, data, size); |
4091 |
++ if (ret < 0) |
4092 |
++ return ret; |
4093 |
++ else if (ret < size) |
4094 |
++ return -ENODATA; |
4095 |
++ |
4096 |
++ return ret; |
4097 |
+ } |
4098 |
+ |
4099 |
+ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) |
4100 |
+diff --git a/drivers/net/veth.c b/drivers/net/veth.c |
4101 |
+index fd1843fd256bb..5e988f7ec1743 100644 |
4102 |
+--- a/drivers/net/veth.c |
4103 |
++++ b/drivers/net/veth.c |
4104 |
+@@ -197,7 +197,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) |
4105 |
+ if (rxq < rcv->real_num_rx_queues) { |
4106 |
+ rq = &rcv_priv->rq[rxq]; |
4107 |
+ rcv_xdp = rcu_access_pointer(rq->xdp_prog); |
4108 |
+- skb_record_rx_queue(skb, rxq); |
4109 |
+ } |
4110 |
+ |
4111 |
+ if (likely(veth_forward_skb(rcv, skb, rq, rcv_xdp) == NET_RX_SUCCESS)) { |
4112 |
+diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c |
4113 |
+index 4c57e79e5779a..58e189ec672f9 100644 |
4114 |
+--- a/drivers/net/wireless/ath/ar5523/ar5523.c |
4115 |
++++ b/drivers/net/wireless/ath/ar5523/ar5523.c |
4116 |
+@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) |
4117 |
+ ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); |
4118 |
+ return; |
4119 |
+ } |
4120 |
++ if (!cmd->odata) { |
4121 |
++ ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); |
4122 |
++ return; |
4123 |
++ } |
4124 |
+ memcpy(cmd->odata, hdr + 1, sizeof(u32)); |
4125 |
+ cmd->olen = sizeof(u32); |
4126 |
+ cmd->res = 0; |
4127 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c |
4128 |
+index fd011bdabb963..3718d4dfc6d60 100644 |
4129 |
+--- a/drivers/net/wireless/ath/ath10k/htt_tx.c |
4130 |
++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c |
4131 |
+@@ -158,6 +158,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) |
4132 |
+ htt->num_pending_tx--; |
4133 |
+ if (htt->num_pending_tx == htt->max_num_pending_tx - 1) |
4134 |
+ ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); |
4135 |
++ |
4136 |
++ if (htt->num_pending_tx == 0) |
4137 |
++ wake_up(&htt->empty_tx_wq); |
4138 |
+ } |
4139 |
+ |
4140 |
+ int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) |
4141 |
+diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
4142 |
+index 6c47e4b6aa6cd..888a8f4aff5d8 100644 |
4143 |
+--- a/drivers/net/wireless/ath/ath10k/txrx.c |
4144 |
++++ b/drivers/net/wireless/ath/ath10k/txrx.c |
4145 |
+@@ -91,8 +91,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
4146 |
+ |
4147 |
+ ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); |
4148 |
+ ath10k_htt_tx_dec_pending(htt); |
4149 |
+- if (htt->num_pending_tx == 0) |
4150 |
+- wake_up(&htt->empty_tx_wq); |
4151 |
+ spin_unlock_bh(&htt->tx_lock); |
4152 |
+ |
4153 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
4154 |
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
4155 |
+index 2ed98aaed6fb5..c8c7afe0e343e 100644 |
4156 |
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
4157 |
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
4158 |
+@@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, |
4159 |
+ return; |
4160 |
+ } |
4161 |
+ |
4162 |
++ if (pkt_len > 2 * MAX_RX_BUF_SIZE) { |
4163 |
++ dev_err(&hif_dev->udev->dev, |
4164 |
++ "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); |
4165 |
++ RX_STAT_INC(skb_dropped); |
4166 |
++ return; |
4167 |
++ } |
4168 |
++ |
4169 |
+ pad_len = 4 - (pkt_len & 0x3); |
4170 |
+ if (pad_len == 4) |
4171 |
+ pad_len = 0; |
4172 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c |
4173 |
+index 657525988d1ee..38eef1579db2d 100644 |
4174 |
+--- a/drivers/net/wireless/ath/wcn36xx/dxe.c |
4175 |
++++ b/drivers/net/wireless/ath/wcn36xx/dxe.c |
4176 |
+@@ -954,4 +954,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) |
4177 |
+ |
4178 |
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); |
4179 |
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); |
4180 |
++ |
4181 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); |
4182 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); |
4183 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); |
4184 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); |
4185 |
+ } |
4186 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c |
4187 |
+index e75c1cfd85e63..741a830d9773b 100644 |
4188 |
+--- a/drivers/net/wireless/ath/wcn36xx/smd.c |
4189 |
++++ b/drivers/net/wireless/ath/wcn36xx/smd.c |
4190 |
+@@ -2311,7 +2311,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
4191 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
4192 |
+ tmp->bss_index); |
4193 |
+ vif = wcn36xx_priv_to_vif(tmp); |
4194 |
+- ieee80211_connection_loss(vif); |
4195 |
++ ieee80211_beacon_loss(vif); |
4196 |
+ } |
4197 |
+ return 0; |
4198 |
+ } |
4199 |
+@@ -2326,7 +2326,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
4200 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
4201 |
+ rsp->bss_index); |
4202 |
+ vif = wcn36xx_priv_to_vif(tmp); |
4203 |
+- ieee80211_connection_loss(vif); |
4204 |
++ ieee80211_beacon_loss(vif); |
4205 |
+ return 0; |
4206 |
+ } |
4207 |
+ } |
4208 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
4209 |
+index db6628d390a2a..c44108823f796 100644 |
4210 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
4211 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
4212 |
+@@ -183,6 +183,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) |
4213 |
+ |
4214 |
+ for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) |
4215 |
+ iwl_free_fw_img(drv, drv->fw.img + i); |
4216 |
++ |
4217 |
++ /* clear the data for the aborted load case */ |
4218 |
++ memset(&drv->fw, 0, sizeof(drv->fw)); |
4219 |
+ } |
4220 |
+ |
4221 |
+ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, |
4222 |
+@@ -1270,6 +1273,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
4223 |
+ int i; |
4224 |
+ bool load_module = false; |
4225 |
+ bool usniffer_images = false; |
4226 |
++ bool failure = true; |
4227 |
+ |
4228 |
+ fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; |
4229 |
+ fw->ucode_capa.standard_phy_calibration_size = |
4230 |
+@@ -1528,15 +1532,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
4231 |
+ * else from proceeding if the module fails to load |
4232 |
+ * or hangs loading. |
4233 |
+ */ |
4234 |
+- if (load_module) { |
4235 |
++ if (load_module) |
4236 |
+ request_module("%s", op->name); |
4237 |
+-#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR |
4238 |
+- if (err) |
4239 |
+- IWL_ERR(drv, |
4240 |
+- "failed to load module %s (error %d), is dynamic loading enabled?\n", |
4241 |
+- op->name, err); |
4242 |
+-#endif |
4243 |
+- } |
4244 |
++ failure = false; |
4245 |
+ goto free; |
4246 |
+ |
4247 |
+ try_again: |
4248 |
+@@ -1552,6 +1550,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
4249 |
+ complete(&drv->request_firmware_complete); |
4250 |
+ device_release_driver(drv->trans->dev); |
4251 |
+ free: |
4252 |
++ if (failure) |
4253 |
++ iwl_dealloc_ucode(drv); |
4254 |
++ |
4255 |
+ if (pieces) { |
4256 |
+ for (i = 0; i < ARRAY_SIZE(pieces->img); i++) |
4257 |
+ kfree(pieces->img[i].sec); |
4258 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
4259 |
+index 697a66acba9ce..3f37fb64e71c2 100644 |
4260 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
4261 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
4262 |
+@@ -1623,6 +1623,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
4263 |
+ struct iwl_mvm_mc_iter_data iter_data = { |
4264 |
+ .mvm = mvm, |
4265 |
+ }; |
4266 |
++ int ret; |
4267 |
+ |
4268 |
+ lockdep_assert_held(&mvm->mutex); |
4269 |
+ |
4270 |
+@@ -1632,6 +1633,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
4271 |
+ ieee80211_iterate_active_interfaces_atomic( |
4272 |
+ mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
4273 |
+ iwl_mvm_mc_iface_iterator, &iter_data); |
4274 |
++ |
4275 |
++ /* |
4276 |
++ * Send a (synchronous) ech command so that we wait for the |
4277 |
++ * multiple asynchronous MCAST_FILTER_CMD commands sent by |
4278 |
++ * the interface iterator. Otherwise, we might get here over |
4279 |
++ * and over again (by userspace just sending a lot of these) |
4280 |
++ * and the CPU can send them faster than the firmware can |
4281 |
++ * process them. |
4282 |
++ * Note that the CPU is still faster - but with this we'll |
4283 |
++ * actually send fewer commands overall because the CPU will |
4284 |
++ * not schedule the work in mac80211 as frequently if it's |
4285 |
++ * still running when rescheduled (possibly multiple times). |
4286 |
++ */ |
4287 |
++ ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); |
4288 |
++ if (ret) |
4289 |
++ IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); |
4290 |
+ } |
4291 |
+ |
4292 |
+ static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, |
4293 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
4294 |
+index 77e3694536421..9a4848d69e9e1 100644 |
4295 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
4296 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
4297 |
+@@ -151,12 +151,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, |
4298 |
+ struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; |
4299 |
+ unsigned int headlen, fraglen, pad_len = 0; |
4300 |
+ unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
4301 |
++ u8 mic_crc_len = u8_get_bits(desc->mac_flags1, |
4302 |
++ IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; |
4303 |
+ |
4304 |
+ if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { |
4305 |
+ len -= 2; |
4306 |
+ pad_len = 2; |
4307 |
+ } |
4308 |
+ |
4309 |
++ /* |
4310 |
++ * For non monitor interface strip the bytes the RADA might not have |
4311 |
++ * removed. As monitor interface cannot exist with other interfaces |
4312 |
++ * this removal is safe. |
4313 |
++ */ |
4314 |
++ if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { |
4315 |
++ u32 pkt_flags = le32_to_cpu(pkt->len_n_flags); |
4316 |
++ |
4317 |
++ /* |
4318 |
++ * If RADA was not enabled then decryption was not performed so |
4319 |
++ * the MIC cannot be removed. |
4320 |
++ */ |
4321 |
++ if (!(pkt_flags & FH_RSCSR_RADA_EN)) { |
4322 |
++ if (WARN_ON(crypt_len > mic_crc_len)) |
4323 |
++ return -EINVAL; |
4324 |
++ |
4325 |
++ mic_crc_len -= crypt_len; |
4326 |
++ } |
4327 |
++ |
4328 |
++ if (WARN_ON(mic_crc_len > len)) |
4329 |
++ return -EINVAL; |
4330 |
++ |
4331 |
++ len -= mic_crc_len; |
4332 |
++ } |
4333 |
++ |
4334 |
+ /* If frame is small enough to fit in skb->head, pull it completely. |
4335 |
+ * If not, only pull ieee80211_hdr (including crypto if present, and |
4336 |
+ * an additional 8 bytes for SNAP/ethertype, see below) so that |
4337 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
4338 |
+index 11ecdf63b7325..16b614cc16ab5 100644 |
4339 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
4340 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
4341 |
+@@ -1555,7 +1555,7 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) |
4342 |
+ return -EIO; |
4343 |
+ } |
4344 |
+ |
4345 |
+-#define SCAN_TIMEOUT 20000 |
4346 |
++#define SCAN_TIMEOUT 30000 |
4347 |
+ |
4348 |
+ void iwl_mvm_scan_timeout_wk(struct work_struct *work) |
4349 |
+ { |
4350 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c |
4351 |
+index e6234b53a5ca2..90490d2c6d177 100644 |
4352 |
+--- a/drivers/net/wireless/marvell/mwifiex/usb.c |
4353 |
++++ b/drivers/net/wireless/marvell/mwifiex/usb.c |
4354 |
+@@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, |
4355 |
+ default: |
4356 |
+ mwifiex_dbg(adapter, ERROR, |
4357 |
+ "unknown recv_type %#x\n", recv_type); |
4358 |
+- return -1; |
4359 |
++ ret = -1; |
4360 |
++ goto exit_restore_skb; |
4361 |
+ } |
4362 |
+ break; |
4363 |
+ case MWIFIEX_USB_EP_DATA: |
4364 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
4365 |
+index 8c60a84941d55..e823634287629 100644 |
4366 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
4367 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
4368 |
+@@ -1020,6 +1020,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) |
4369 |
+ _InitPABias(hw); |
4370 |
+ rtl92c_dm_init(hw); |
4371 |
+ exit: |
4372 |
++ local_irq_disable(); |
4373 |
+ local_irq_restore(flags); |
4374 |
+ return err; |
4375 |
+ } |
4376 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c |
4377 |
+index d90d8ab56fa28..c6f5c46cc88e7 100644 |
4378 |
+--- a/drivers/net/wireless/rsi/rsi_91x_main.c |
4379 |
++++ b/drivers/net/wireless/rsi/rsi_91x_main.c |
4380 |
+@@ -23,6 +23,7 @@ |
4381 |
+ #include "rsi_common.h" |
4382 |
+ #include "rsi_coex.h" |
4383 |
+ #include "rsi_hal.h" |
4384 |
++#include "rsi_usb.h" |
4385 |
+ |
4386 |
+ u32 rsi_zone_enabled = /* INFO_ZONE | |
4387 |
+ INIT_ZONE | |
4388 |
+@@ -173,6 +174,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) |
4389 |
+ frame_desc = &rx_pkt[index]; |
4390 |
+ actual_length = *(u16 *)&frame_desc[0]; |
4391 |
+ offset = *(u16 *)&frame_desc[2]; |
4392 |
++ if (!rcv_pkt_len && offset > |
4393 |
++ RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) |
4394 |
++ goto fail; |
4395 |
+ |
4396 |
+ queueno = rsi_get_queueno(frame_desc, offset); |
4397 |
+ length = rsi_get_length(frame_desc, offset); |
4398 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
4399 |
+index 984f99ad40960..da09e130710e0 100644 |
4400 |
+--- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
4401 |
++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
4402 |
+@@ -312,7 +312,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) |
4403 |
+ struct sk_buff *skb; |
4404 |
+ u8 dword_align_bytes = 0; |
4405 |
+ |
4406 |
+-#define RSI_MAX_RX_USB_PKT_SIZE 3000 |
4407 |
+ skb = dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); |
4408 |
+ if (!skb) |
4409 |
+ return -ENOMEM; |
4410 |
+diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/rsi_usb.h |
4411 |
+index 5b2eddd1a2ee5..3d3d2643088d0 100644 |
4412 |
+--- a/drivers/net/wireless/rsi/rsi_usb.h |
4413 |
++++ b/drivers/net/wireless/rsi/rsi_usb.h |
4414 |
+@@ -43,6 +43,8 @@ |
4415 |
+ #define RSI_USB_BUF_SIZE 4096 |
4416 |
+ #define RSI_USB_CTRL_BUF_SIZE 0x04 |
4417 |
+ |
4418 |
++#define RSI_MAX_RX_USB_PKT_SIZE 3000 |
4419 |
++ |
4420 |
+ struct rx_usb_ctrl_block { |
4421 |
+ u8 *data; |
4422 |
+ struct urb *rx_urb; |
4423 |
+diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c |
4424 |
+index b1ff46fe45478..bbc59d329e9df 100644 |
4425 |
+--- a/drivers/parisc/pdc_stable.c |
4426 |
++++ b/drivers/parisc/pdc_stable.c |
4427 |
+@@ -992,8 +992,10 @@ pdcs_register_pathentries(void) |
4428 |
+ entry->kobj.kset = paths_kset; |
4429 |
+ err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, |
4430 |
+ "%s", entry->name); |
4431 |
+- if (err) |
4432 |
++ if (err) { |
4433 |
++ kobject_put(&entry->kobj); |
4434 |
+ return err; |
4435 |
++ } |
4436 |
+ |
4437 |
+ /* kobject is now registered */ |
4438 |
+ write_lock(&entry->rw_lock); |
4439 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
4440 |
+index 315e96ba651a2..7cd38c9eaa020 100644 |
4441 |
+--- a/drivers/pci/quirks.c |
4442 |
++++ b/drivers/pci/quirks.c |
4443 |
+@@ -4040,6 +4040,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, |
4444 |
+ quirk_dma_func1_alias); |
4445 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, |
4446 |
+ quirk_dma_func1_alias); |
4447 |
++/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ |
4448 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, |
4449 |
++ quirk_dma_func1_alias); |
4450 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, |
4451 |
+ quirk_dma_func1_alias); |
4452 |
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ |
4453 |
+diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c |
4454 |
+index 8c8caec3a72cc..182e5ef4ab83d 100644 |
4455 |
+--- a/drivers/pcmcia/cs.c |
4456 |
++++ b/drivers/pcmcia/cs.c |
4457 |
+@@ -669,18 +669,16 @@ static int pccardd(void *__skt) |
4458 |
+ if (events || sysfs_events) |
4459 |
+ continue; |
4460 |
+ |
4461 |
++ set_current_state(TASK_INTERRUPTIBLE); |
4462 |
+ if (kthread_should_stop()) |
4463 |
+ break; |
4464 |
+ |
4465 |
+- set_current_state(TASK_INTERRUPTIBLE); |
4466 |
+- |
4467 |
+ schedule(); |
4468 |
+ |
4469 |
+- /* make sure we are running */ |
4470 |
+- __set_current_state(TASK_RUNNING); |
4471 |
+- |
4472 |
+ try_to_freeze(); |
4473 |
+ } |
4474 |
++ /* make sure we are running before we exit */ |
4475 |
++ __set_current_state(TASK_RUNNING); |
4476 |
+ |
4477 |
+ /* shut down socket, if a device is still present */ |
4478 |
+ if (skt->state & SOCKET_PRESENT) { |
4479 |
+diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c |
4480 |
+index 49377d502b740..123420cac6b54 100644 |
4481 |
+--- a/drivers/pcmcia/rsrc_nonstatic.c |
4482 |
++++ b/drivers/pcmcia/rsrc_nonstatic.c |
4483 |
+@@ -693,6 +693,9 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, |
4484 |
+ unsigned long min = base; |
4485 |
+ int ret; |
4486 |
+ |
4487 |
++ if (!res) |
4488 |
++ return NULL; |
4489 |
++ |
4490 |
+ data.mask = align - 1; |
4491 |
+ data.offset = base & data.mask; |
4492 |
+ data.map = &s_data->io_db; |
4493 |
+@@ -812,6 +815,9 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num, |
4494 |
+ unsigned long min, max; |
4495 |
+ int ret, i, j; |
4496 |
+ |
4497 |
++ if (!res) |
4498 |
++ return NULL; |
4499 |
++ |
4500 |
+ low = low || !(s->features & SS_CAP_PAGE_REGS); |
4501 |
+ |
4502 |
+ data.mask = align - 1; |
4503 |
+diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c |
4504 |
+index 8e2c41ded171c..e90253b3f6561 100644 |
4505 |
+--- a/drivers/power/supply/bq25890_charger.c |
4506 |
++++ b/drivers/power/supply/bq25890_charger.c |
4507 |
+@@ -521,12 +521,12 @@ static void bq25890_handle_state_change(struct bq25890_device *bq, |
4508 |
+ |
4509 |
+ if (!new_state->online) { /* power removed */ |
4510 |
+ /* disable ADC */ |
4511 |
+- ret = bq25890_field_write(bq, F_CONV_START, 0); |
4512 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 0); |
4513 |
+ if (ret < 0) |
4514 |
+ goto error; |
4515 |
+ } else if (!old_state.online) { /* power inserted */ |
4516 |
+ /* enable ADC, to have control of charge current/voltage */ |
4517 |
+- ret = bq25890_field_write(bq, F_CONV_START, 1); |
4518 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 1); |
4519 |
+ if (ret < 0) |
4520 |
+ goto error; |
4521 |
+ } |
4522 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
4523 |
+index 088ed4ee6d83e..045075cd256ce 100644 |
4524 |
+--- a/drivers/regulator/core.c |
4525 |
++++ b/drivers/regulator/core.c |
4526 |
+@@ -1211,7 +1211,9 @@ static int set_machine_constraints(struct regulator_dev *rdev) |
4527 |
+ rdev_err(rdev, "failed to enable\n"); |
4528 |
+ return ret; |
4529 |
+ } |
4530 |
+- rdev->use_count++; |
4531 |
++ |
4532 |
++ if (rdev->constraints->always_on) |
4533 |
++ rdev->use_count++; |
4534 |
+ } |
4535 |
+ |
4536 |
+ print_constraints(rdev); |
4537 |
+diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c |
4538 |
+index fe2fb36803e0b..8d920a3ad40b8 100644 |
4539 |
+--- a/drivers/regulator/qcom_smd-regulator.c |
4540 |
++++ b/drivers/regulator/qcom_smd-regulator.c |
4541 |
+@@ -17,6 +17,7 @@ |
4542 |
+ #include <linux/of_device.h> |
4543 |
+ #include <linux/platform_device.h> |
4544 |
+ #include <linux/regulator/driver.h> |
4545 |
++#include <linux/regulator/of_regulator.h> |
4546 |
+ #include <linux/soc/qcom/smd-rpm.h> |
4547 |
+ |
4548 |
+ struct qcom_rpm_reg { |
4549 |
+@@ -673,52 +674,91 @@ static const struct of_device_id rpm_of_match[] = { |
4550 |
+ }; |
4551 |
+ MODULE_DEVICE_TABLE(of, rpm_of_match); |
4552 |
+ |
4553 |
+-static int rpm_reg_probe(struct platform_device *pdev) |
4554 |
++/** |
4555 |
++ * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-regulator |
4556 |
++ * @vreg: Pointer to the individual qcom_smd-regulator resource |
4557 |
++ * @dev: Pointer to the top level qcom_smd-regulator PMIC device |
4558 |
++ * @node: Pointer to the individual qcom_smd-regulator resource |
4559 |
++ * device node |
4560 |
++ * @rpm: Pointer to the rpm bus node |
4561 |
++ * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator |
4562 |
++ * resources defined for the top level PMIC device |
4563 |
++ * |
4564 |
++ * Return: 0 on success, errno on failure |
4565 |
++ */ |
4566 |
++static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct device *dev, |
4567 |
++ struct device_node *node, struct qcom_smd_rpm *rpm, |
4568 |
++ const struct rpm_regulator_data *pmic_rpm_data) |
4569 |
+ { |
4570 |
+- const struct rpm_regulator_data *reg; |
4571 |
+- const struct of_device_id *match; |
4572 |
+- struct regulator_config config = { }; |
4573 |
++ struct regulator_config config = {}; |
4574 |
++ const struct rpm_regulator_data *rpm_data; |
4575 |
+ struct regulator_dev *rdev; |
4576 |
++ int ret; |
4577 |
++ |
4578 |
++ for (rpm_data = pmic_rpm_data; rpm_data->name; rpm_data++) |
4579 |
++ if (of_node_name_eq(node, rpm_data->name)) |
4580 |
++ break; |
4581 |
++ |
4582 |
++ if (!rpm_data->name) { |
4583 |
++ dev_err(dev, "Unknown regulator %pOFn\n", node); |
4584 |
++ return -EINVAL; |
4585 |
++ } |
4586 |
++ |
4587 |
++ vreg->dev = dev; |
4588 |
++ vreg->rpm = rpm; |
4589 |
++ vreg->type = rpm_data->type; |
4590 |
++ vreg->id = rpm_data->id; |
4591 |
++ |
4592 |
++ memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); |
4593 |
++ vreg->desc.name = rpm_data->name; |
4594 |
++ vreg->desc.supply_name = rpm_data->supply; |
4595 |
++ vreg->desc.owner = THIS_MODULE; |
4596 |
++ vreg->desc.type = REGULATOR_VOLTAGE; |
4597 |
++ vreg->desc.of_match = rpm_data->name; |
4598 |
++ |
4599 |
++ config.dev = dev; |
4600 |
++ config.of_node = node; |
4601 |
++ config.driver_data = vreg; |
4602 |
++ |
4603 |
++ rdev = devm_regulator_register(dev, &vreg->desc, &config); |
4604 |
++ if (IS_ERR(rdev)) { |
4605 |
++ ret = PTR_ERR(rdev); |
4606 |
++ dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=%d\n", node, ret); |
4607 |
++ return ret; |
4608 |
++ } |
4609 |
++ |
4610 |
++ return 0; |
4611 |
++} |
4612 |
++ |
4613 |
++static int rpm_reg_probe(struct platform_device *pdev) |
4614 |
++{ |
4615 |
++ struct device *dev = &pdev->dev; |
4616 |
++ const struct rpm_regulator_data *vreg_data; |
4617 |
++ struct device_node *node; |
4618 |
+ struct qcom_rpm_reg *vreg; |
4619 |
+ struct qcom_smd_rpm *rpm; |
4620 |
++ int ret; |
4621 |
+ |
4622 |
+ rpm = dev_get_drvdata(pdev->dev.parent); |
4623 |
+ if (!rpm) { |
4624 |
+- dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); |
4625 |
++ dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); |
4626 |
+ return -ENODEV; |
4627 |
+ } |
4628 |
+ |
4629 |
+- match = of_match_device(rpm_of_match, &pdev->dev); |
4630 |
+- if (!match) { |
4631 |
+- dev_err(&pdev->dev, "failed to match device\n"); |
4632 |
++ vreg_data = of_device_get_match_data(dev); |
4633 |
++ if (!vreg_data) |
4634 |
+ return -ENODEV; |
4635 |
+- } |
4636 |
+ |
4637 |
+- for (reg = match->data; reg->name; reg++) { |
4638 |
++ for_each_available_child_of_node(dev->of_node, node) { |
4639 |
+ vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); |
4640 |
+ if (!vreg) |
4641 |
+ return -ENOMEM; |
4642 |
+ |
4643 |
+- vreg->dev = &pdev->dev; |
4644 |
+- vreg->type = reg->type; |
4645 |
+- vreg->id = reg->id; |
4646 |
+- vreg->rpm = rpm; |
4647 |
+- |
4648 |
+- memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); |
4649 |
+- |
4650 |
+- vreg->desc.id = -1; |
4651 |
+- vreg->desc.owner = THIS_MODULE; |
4652 |
+- vreg->desc.type = REGULATOR_VOLTAGE; |
4653 |
+- vreg->desc.name = reg->name; |
4654 |
+- vreg->desc.supply_name = reg->supply; |
4655 |
+- vreg->desc.of_match = reg->name; |
4656 |
+- |
4657 |
+- config.dev = &pdev->dev; |
4658 |
+- config.driver_data = vreg; |
4659 |
+- rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); |
4660 |
+- if (IS_ERR(rdev)) { |
4661 |
+- dev_err(&pdev->dev, "failed to register %s\n", reg->name); |
4662 |
+- return PTR_ERR(rdev); |
4663 |
++ ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); |
4664 |
++ |
4665 |
++ if (ret < 0) { |
4666 |
++ of_node_put(node); |
4667 |
++ return ret; |
4668 |
+ } |
4669 |
+ } |
4670 |
+ |
4671 |
+diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c |
4672 |
+index 8122807db3809..65834153ba977 100644 |
4673 |
+--- a/drivers/rpmsg/rpmsg_core.c |
4674 |
++++ b/drivers/rpmsg/rpmsg_core.c |
4675 |
+@@ -473,13 +473,25 @@ static int rpmsg_dev_probe(struct device *dev) |
4676 |
+ err = rpdrv->probe(rpdev); |
4677 |
+ if (err) { |
4678 |
+ dev_err(dev, "%s: failed: %d\n", __func__, err); |
4679 |
+- if (ept) |
4680 |
+- rpmsg_destroy_ept(ept); |
4681 |
+- goto out; |
4682 |
++ goto destroy_ept; |
4683 |
+ } |
4684 |
+ |
4685 |
+- if (ept && rpdev->ops->announce_create) |
4686 |
++ if (ept && rpdev->ops->announce_create) { |
4687 |
+ err = rpdev->ops->announce_create(rpdev); |
4688 |
++ if (err) { |
4689 |
++ dev_err(dev, "failed to announce creation\n"); |
4690 |
++ goto remove_rpdev; |
4691 |
++ } |
4692 |
++ } |
4693 |
++ |
4694 |
++ return 0; |
4695 |
++ |
4696 |
++remove_rpdev: |
4697 |
++ if (rpdrv->remove) |
4698 |
++ rpdrv->remove(rpdev); |
4699 |
++destroy_ept: |
4700 |
++ if (ept) |
4701 |
++ rpmsg_destroy_ept(ept); |
4702 |
+ out: |
4703 |
+ return err; |
4704 |
+ } |
4705 |
+diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
4706 |
+index 0fa94d9e8d44d..8545f0da57fef 100644 |
4707 |
+--- a/drivers/rtc/rtc-cmos.c |
4708 |
++++ b/drivers/rtc/rtc-cmos.c |
4709 |
+@@ -467,7 +467,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
4710 |
+ min = t->time.tm_min; |
4711 |
+ sec = t->time.tm_sec; |
4712 |
+ |
4713 |
++ spin_lock_irq(&rtc_lock); |
4714 |
+ rtc_control = CMOS_READ(RTC_CONTROL); |
4715 |
++ spin_unlock_irq(&rtc_lock); |
4716 |
++ |
4717 |
+ if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
4718 |
+ /* Writing 0xff means "don't care" or "match all". */ |
4719 |
+ mon = (mon <= 12) ? bin2bcd(mon) : 0xff; |
4720 |
+diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c |
4721 |
+index e1887b86fdc74..140c58b160998 100644 |
4722 |
+--- a/drivers/rtc/rtc-pxa.c |
4723 |
++++ b/drivers/rtc/rtc-pxa.c |
4724 |
+@@ -349,6 +349,10 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) |
4725 |
+ return -ENXIO; |
4726 |
+ } |
4727 |
+ |
4728 |
++ sa1100_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
4729 |
++ if (IS_ERR(sa1100_rtc->rtc)) |
4730 |
++ return PTR_ERR(sa1100_rtc->rtc); |
4731 |
++ |
4732 |
+ pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start, |
4733 |
+ resource_size(pxa_rtc->ress)); |
4734 |
+ if (!pxa_rtc->base) { |
4735 |
+diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
4736 |
+index 84dd776d36c33..fdbd5c691d333 100644 |
4737 |
+--- a/drivers/scsi/sr.c |
4738 |
++++ b/drivers/scsi/sr.c |
4739 |
+@@ -885,7 +885,7 @@ static void get_capabilities(struct scsi_cd *cd) |
4740 |
+ |
4741 |
+ |
4742 |
+ /* allocate transfer buffer */ |
4743 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
4744 |
++ buffer = kmalloc(512, GFP_KERNEL); |
4745 |
+ if (!buffer) { |
4746 |
+ sr_printk(KERN_ERR, cd, "out of memory.\n"); |
4747 |
+ return; |
4748 |
+diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c |
4749 |
+index b9db2ec6d0361..996bccadd3866 100644 |
4750 |
+--- a/drivers/scsi/sr_vendor.c |
4751 |
++++ b/drivers/scsi/sr_vendor.c |
4752 |
+@@ -113,7 +113,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) |
4753 |
+ if (cd->vendor == VENDOR_TOSHIBA) |
4754 |
+ density = (blocklength > 2048) ? 0x81 : 0x83; |
4755 |
+ |
4756 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
4757 |
++ buffer = kmalloc(512, GFP_KERNEL); |
4758 |
+ if (!buffer) |
4759 |
+ return -ENOMEM; |
4760 |
+ |
4761 |
+@@ -161,7 +161,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) |
4762 |
+ if (cd->cdi.mask & CDC_MULTI_SESSION) |
4763 |
+ return 0; |
4764 |
+ |
4765 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
4766 |
++ buffer = kmalloc(512, GFP_KERNEL); |
4767 |
+ if (!buffer) |
4768 |
+ return -ENOMEM; |
4769 |
+ |
4770 |
+diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
4771 |
+index 2f41722a8c28d..2c6cb7f6b61a6 100644 |
4772 |
+--- a/drivers/scsi/ufs/tc-dwc-g210-pci.c |
4773 |
++++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
4774 |
+@@ -138,7 +138,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
4775 |
+ return err; |
4776 |
+ } |
4777 |
+ |
4778 |
+- pci_set_drvdata(pdev, hba); |
4779 |
+ pm_runtime_put_noidle(&pdev->dev); |
4780 |
+ pm_runtime_allow(&pdev->dev); |
4781 |
+ |
4782 |
+diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c |
4783 |
+index 30c22e16b1e34..57985841a879e 100644 |
4784 |
+--- a/drivers/scsi/ufs/ufshcd-pltfrm.c |
4785 |
++++ b/drivers/scsi/ufs/ufshcd-pltfrm.c |
4786 |
+@@ -348,8 +348,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, |
4787 |
+ goto dealloc_host; |
4788 |
+ } |
4789 |
+ |
4790 |
+- platform_set_drvdata(pdev, hba); |
4791 |
+- |
4792 |
+ pm_runtime_set_active(&pdev->dev); |
4793 |
+ pm_runtime_enable(&pdev->dev); |
4794 |
+ |
4795 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
4796 |
+index b18430efb00fb..fee1989e23f01 100644 |
4797 |
+--- a/drivers/scsi/ufs/ufshcd.c |
4798 |
++++ b/drivers/scsi/ufs/ufshcd.c |
4799 |
+@@ -8046,6 +8046,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) |
4800 |
+ struct Scsi_Host *host = hba->host; |
4801 |
+ struct device *dev = hba->dev; |
4802 |
+ |
4803 |
++ /* |
4804 |
++ * dev_set_drvdata() must be called before any callbacks are registered |
4805 |
++ * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, |
4806 |
++ * sysfs). |
4807 |
++ */ |
4808 |
++ dev_set_drvdata(dev, hba); |
4809 |
++ |
4810 |
+ if (!mmio_base) { |
4811 |
+ dev_err(hba->dev, |
4812 |
+ "Invalid memory reference for mmio_base is NULL\n"); |
4813 |
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c |
4814 |
+index ef54f1638d207..01fcad7c8fae8 100644 |
4815 |
+--- a/drivers/soc/mediatek/mtk-scpsys.c |
4816 |
++++ b/drivers/soc/mediatek/mtk-scpsys.c |
4817 |
+@@ -341,12 +341,17 @@ out: |
4818 |
+ return ret; |
4819 |
+ } |
4820 |
+ |
4821 |
+-static void init_clks(struct platform_device *pdev, struct clk **clk) |
4822 |
++static int init_clks(struct platform_device *pdev, struct clk **clk) |
4823 |
+ { |
4824 |
+ int i; |
4825 |
+ |
4826 |
+- for (i = CLK_NONE + 1; i < CLK_MAX; i++) |
4827 |
++ for (i = CLK_NONE + 1; i < CLK_MAX; i++) { |
4828 |
+ clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); |
4829 |
++ if (IS_ERR(clk[i])) |
4830 |
++ return PTR_ERR(clk[i]); |
4831 |
++ } |
4832 |
++ |
4833 |
++ return 0; |
4834 |
+ } |
4835 |
+ |
4836 |
+ static struct scp *init_scp(struct platform_device *pdev, |
4837 |
+@@ -356,7 +361,7 @@ static struct scp *init_scp(struct platform_device *pdev, |
4838 |
+ { |
4839 |
+ struct genpd_onecell_data *pd_data; |
4840 |
+ struct resource *res; |
4841 |
+- int i, j; |
4842 |
++ int i, j, ret; |
4843 |
+ struct scp *scp; |
4844 |
+ struct clk *clk[CLK_MAX]; |
4845 |
+ |
4846 |
+@@ -411,7 +416,9 @@ static struct scp *init_scp(struct platform_device *pdev, |
4847 |
+ |
4848 |
+ pd_data->num_domains = num; |
4849 |
+ |
4850 |
+- init_clks(pdev, clk); |
4851 |
++ ret = init_clks(pdev, clk); |
4852 |
++ if (ret) |
4853 |
++ return ERR_PTR(ret); |
4854 |
+ |
4855 |
+ for (i = 0; i < num; i++) { |
4856 |
+ struct scp_domain *scpd = &scp->domains[i]; |
4857 |
+diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c |
4858 |
+index 616566e793c62..28975b6f054fa 100644 |
4859 |
+--- a/drivers/spi/spi-meson-spifc.c |
4860 |
++++ b/drivers/spi/spi-meson-spifc.c |
4861 |
+@@ -357,6 +357,7 @@ static int meson_spifc_probe(struct platform_device *pdev) |
4862 |
+ return 0; |
4863 |
+ out_clk: |
4864 |
+ clk_disable_unprepare(spifc->clk); |
4865 |
++ pm_runtime_disable(spifc->dev); |
4866 |
+ out_err: |
4867 |
+ spi_master_put(master); |
4868 |
+ return ret; |
4869 |
+diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c |
4870 |
+index 860247d718184..a48e59fe18e81 100644 |
4871 |
+--- a/drivers/staging/greybus/audio_topology.c |
4872 |
++++ b/drivers/staging/greybus/audio_topology.c |
4873 |
+@@ -145,6 +145,9 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb, |
4874 |
+ |
4875 |
+ items = le32_to_cpu(gbenum->items); |
4876 |
+ strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); |
4877 |
++ if (!strings) |
4878 |
++ return NULL; |
4879 |
++ |
4880 |
+ data = gbenum->names; |
4881 |
+ |
4882 |
+ for (i = 0; i < items; i++) { |
4883 |
+@@ -662,6 +665,8 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb, |
4884 |
+ /* since count=1, and reg is dummy */ |
4885 |
+ gbe->max = le32_to_cpu(gb_enum->items); |
4886 |
+ gbe->texts = gb_generate_enum_strings(gb, gb_enum); |
4887 |
++ if (!gbe->texts) |
4888 |
++ return -ENOMEM; |
4889 |
+ |
4890 |
+ /* debug enum info */ |
4891 |
+ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, |
4892 |
+@@ -871,6 +876,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, |
4893 |
+ /* since count=1, and reg is dummy */ |
4894 |
+ gbe->max = le32_to_cpu(gb_enum->items); |
4895 |
+ gbe->texts = gb_generate_enum_strings(gb, gb_enum); |
4896 |
++ if (!gbe->texts) |
4897 |
++ return -ENOMEM; |
4898 |
+ |
4899 |
+ /* debug enum info */ |
4900 |
+ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, |
4901 |
+@@ -1044,6 +1051,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, |
4902 |
+ csize += le16_to_cpu(gbenum->names_length); |
4903 |
+ control->texts = (const char * const *) |
4904 |
+ gb_generate_enum_strings(module, gbenum); |
4905 |
++ if (!control->texts) { |
4906 |
++ ret = -ENOMEM; |
4907 |
++ goto error; |
4908 |
++ } |
4909 |
+ control->items = le32_to_cpu(gbenum->items); |
4910 |
+ } else { |
4911 |
+ csize = sizeof(struct gb_audio_control); |
4912 |
+@@ -1192,6 +1203,10 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, |
4913 |
+ csize += le16_to_cpu(gbenum->names_length); |
4914 |
+ control->texts = (const char * const *) |
4915 |
+ gb_generate_enum_strings(module, gbenum); |
4916 |
++ if (!control->texts) { |
4917 |
++ ret = -ENOMEM; |
4918 |
++ goto error; |
4919 |
++ } |
4920 |
+ control->items = le32_to_cpu(gbenum->items); |
4921 |
+ } else { |
4922 |
+ csize = sizeof(struct gb_audio_control); |
4923 |
+diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c |
4924 |
+index 7686805dfe0f2..99f9f71f35ea1 100644 |
4925 |
+--- a/drivers/staging/wlan-ng/hfa384x_usb.c |
4926 |
++++ b/drivers/staging/wlan-ng/hfa384x_usb.c |
4927 |
+@@ -3903,18 +3903,18 @@ static void hfa384x_usb_throttlefn(struct timer_list *t) |
4928 |
+ |
4929 |
+ spin_lock_irqsave(&hw->ctlxq.lock, flags); |
4930 |
+ |
4931 |
+- /* |
4932 |
+- * We need to check BOTH the RX and the TX throttle controls, |
4933 |
+- * so we use the bitwise OR instead of the logical OR. |
4934 |
+- */ |
4935 |
+ pr_debug("flags=0x%lx\n", hw->usb_flags); |
4936 |
+- if (!hw->wlandev->hwremoved && |
4937 |
+- ((test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && |
4938 |
+- !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags)) | |
4939 |
+- (test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) && |
4940 |
+- !test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags)) |
4941 |
+- )) { |
4942 |
+- schedule_work(&hw->usb_work); |
4943 |
++ if (!hw->wlandev->hwremoved) { |
4944 |
++ bool rx_throttle = test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && |
4945 |
++ !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags); |
4946 |
++ bool tx_throttle = test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) && |
4947 |
++ !test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags); |
4948 |
++ /* |
4949 |
++ * We need to check BOTH the RX and the TX throttle controls, |
4950 |
++ * so we use the bitwise OR instead of the logical OR. |
4951 |
++ */ |
4952 |
++ if (rx_throttle | tx_throttle) |
4953 |
++ schedule_work(&hw->usb_work); |
4954 |
+ } |
4955 |
+ |
4956 |
+ spin_unlock_irqrestore(&hw->ctlxq.lock, flags); |
4957 |
+diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c |
4958 |
+index dd46b758852aa..d42fc2ae8592e 100644 |
4959 |
+--- a/drivers/tee/tee_core.c |
4960 |
++++ b/drivers/tee/tee_core.c |
4961 |
+@@ -96,8 +96,10 @@ void teedev_ctx_put(struct tee_context *ctx) |
4962 |
+ |
4963 |
+ static void teedev_close_context(struct tee_context *ctx) |
4964 |
+ { |
4965 |
+- tee_device_put(ctx->teedev); |
4966 |
++ struct tee_device *teedev = ctx->teedev; |
4967 |
++ |
4968 |
+ teedev_ctx_put(ctx); |
4969 |
++ tee_device_put(teedev); |
4970 |
+ } |
4971 |
+ |
4972 |
+ static int tee_release(struct inode *inode, struct file *filp) |
4973 |
+diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c |
4974 |
+index 2c37d11726aba..13f882e5e7b76 100644 |
4975 |
+--- a/drivers/tty/serial/amba-pl010.c |
4976 |
++++ b/drivers/tty/serial/amba-pl010.c |
4977 |
+@@ -452,14 +452,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, |
4978 |
+ if ((termios->c_cflag & CREAD) == 0) |
4979 |
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; |
4980 |
+ |
4981 |
+- /* first, disable everything */ |
4982 |
+ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; |
4983 |
+ |
4984 |
+ if (UART_ENABLE_MS(port, termios->c_cflag)) |
4985 |
+ old_cr |= UART010_CR_MSIE; |
4986 |
+ |
4987 |
+- writel(0, uap->port.membase + UART010_CR); |
4988 |
+- |
4989 |
+ /* Set baud rate */ |
4990 |
+ quot -= 1; |
4991 |
+ writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); |
4992 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
4993 |
+index 3d63e9a71c376..5edc3813a9b99 100644 |
4994 |
+--- a/drivers/tty/serial/amba-pl011.c |
4995 |
++++ b/drivers/tty/serial/amba-pl011.c |
4996 |
+@@ -2094,32 +2094,13 @@ static const char *pl011_type(struct uart_port *port) |
4997 |
+ return uap->port.type == PORT_AMBA ? uap->type : NULL; |
4998 |
+ } |
4999 |
+ |
5000 |
+-/* |
5001 |
+- * Release the memory region(s) being used by 'port' |
5002 |
+- */ |
5003 |
+-static void pl011_release_port(struct uart_port *port) |
5004 |
+-{ |
5005 |
+- release_mem_region(port->mapbase, SZ_4K); |
5006 |
+-} |
5007 |
+- |
5008 |
+-/* |
5009 |
+- * Request the memory region(s) being used by 'port' |
5010 |
+- */ |
5011 |
+-static int pl011_request_port(struct uart_port *port) |
5012 |
+-{ |
5013 |
+- return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") |
5014 |
+- != NULL ? 0 : -EBUSY; |
5015 |
+-} |
5016 |
+- |
5017 |
+ /* |
5018 |
+ * Configure/autoconfigure the port. |
5019 |
+ */ |
5020 |
+ static void pl011_config_port(struct uart_port *port, int flags) |
5021 |
+ { |
5022 |
+- if (flags & UART_CONFIG_TYPE) { |
5023 |
++ if (flags & UART_CONFIG_TYPE) |
5024 |
+ port->type = PORT_AMBA; |
5025 |
+- pl011_request_port(port); |
5026 |
+- } |
5027 |
+ } |
5028 |
+ |
5029 |
+ /* |
5030 |
+@@ -2134,6 +2115,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) |
5031 |
+ ret = -EINVAL; |
5032 |
+ if (ser->baud_base < 9600) |
5033 |
+ ret = -EINVAL; |
5034 |
++ if (port->mapbase != (unsigned long) ser->iomem_base) |
5035 |
++ ret = -EINVAL; |
5036 |
+ return ret; |
5037 |
+ } |
5038 |
+ |
5039 |
+@@ -2151,8 +2134,6 @@ static const struct uart_ops amba_pl011_pops = { |
5040 |
+ .flush_buffer = pl011_dma_flush_buffer, |
5041 |
+ .set_termios = pl011_set_termios, |
5042 |
+ .type = pl011_type, |
5043 |
+- .release_port = pl011_release_port, |
5044 |
+- .request_port = pl011_request_port, |
5045 |
+ .config_port = pl011_config_port, |
5046 |
+ .verify_port = pl011_verify_port, |
5047 |
+ #ifdef CONFIG_CONSOLE_POLL |
5048 |
+@@ -2182,8 +2163,6 @@ static const struct uart_ops sbsa_uart_pops = { |
5049 |
+ .shutdown = sbsa_uart_shutdown, |
5050 |
+ .set_termios = sbsa_uart_set_termios, |
5051 |
+ .type = pl011_type, |
5052 |
+- .release_port = pl011_release_port, |
5053 |
+- .request_port = pl011_request_port, |
5054 |
+ .config_port = pl011_config_port, |
5055 |
+ .verify_port = pl011_verify_port, |
5056 |
+ #ifdef CONFIG_CONSOLE_POLL |
5057 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
5058 |
+index 936d401f20b95..3ba9ed36d6362 100644 |
5059 |
+--- a/drivers/tty/serial/atmel_serial.c |
5060 |
++++ b/drivers/tty/serial/atmel_serial.c |
5061 |
+@@ -918,6 +918,13 @@ static void atmel_tx_dma(struct uart_port *port) |
5062 |
+ desc->callback = atmel_complete_tx_dma; |
5063 |
+ desc->callback_param = atmel_port; |
5064 |
+ atmel_port->cookie_tx = dmaengine_submit(desc); |
5065 |
++ if (dma_submit_error(atmel_port->cookie_tx)) { |
5066 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
5067 |
++ atmel_port->cookie_tx); |
5068 |
++ return; |
5069 |
++ } |
5070 |
++ |
5071 |
++ dma_async_issue_pending(chan); |
5072 |
+ } |
5073 |
+ |
5074 |
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
5075 |
+@@ -1176,6 +1183,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) |
5076 |
+ desc->callback_param = port; |
5077 |
+ atmel_port->desc_rx = desc; |
5078 |
+ atmel_port->cookie_rx = dmaengine_submit(desc); |
5079 |
++ if (dma_submit_error(atmel_port->cookie_rx)) { |
5080 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
5081 |
++ atmel_port->cookie_rx); |
5082 |
++ goto chan_err; |
5083 |
++ } |
5084 |
++ |
5085 |
++ dma_async_issue_pending(atmel_port->chan_rx); |
5086 |
+ |
5087 |
+ return 0; |
5088 |
+ |
5089 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
5090 |
+index 63aefe7e91be1..eb1b95522c8f2 100644 |
5091 |
+--- a/drivers/tty/serial/serial_core.c |
5092 |
++++ b/drivers/tty/serial/serial_core.c |
5093 |
+@@ -159,7 +159,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
5094 |
+ int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); |
5095 |
+ |
5096 |
+ if (raise) { |
5097 |
+- if (rs485_on && !RTS_after_send) { |
5098 |
++ if (rs485_on && RTS_after_send) { |
5099 |
+ uart_set_mctrl(uport, TIOCM_DTR); |
5100 |
+ uart_clear_mctrl(uport, TIOCM_RTS); |
5101 |
+ } else { |
5102 |
+@@ -168,7 +168,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
5103 |
+ } else { |
5104 |
+ unsigned int clear = TIOCM_DTR; |
5105 |
+ |
5106 |
+- clear |= (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; |
5107 |
++ clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; |
5108 |
+ uart_clear_mctrl(uport, clear); |
5109 |
+ } |
5110 |
+ } |
5111 |
+@@ -2347,7 +2347,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, |
5112 |
+ * We probably don't need a spinlock around this, but |
5113 |
+ */ |
5114 |
+ spin_lock_irqsave(&port->lock, flags); |
5115 |
+- port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); |
5116 |
++ port->mctrl &= TIOCM_DTR; |
5117 |
++ port->ops->set_mctrl(port, port->mctrl); |
5118 |
+ spin_unlock_irqrestore(&port->lock, flags); |
5119 |
+ |
5120 |
+ /* |
5121 |
+diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c |
5122 |
+index 8df3058226687..5d1b7455e627d 100644 |
5123 |
+--- a/drivers/tty/serial/uartlite.c |
5124 |
++++ b/drivers/tty/serial/uartlite.c |
5125 |
+@@ -618,7 +618,7 @@ static struct uart_driver ulite_uart_driver = { |
5126 |
+ * |
5127 |
+ * Returns: 0 on success, <0 otherwise |
5128 |
+ */ |
5129 |
+-static int ulite_assign(struct device *dev, int id, u32 base, int irq, |
5130 |
++static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq, |
5131 |
+ struct uartlite_data *pdata) |
5132 |
+ { |
5133 |
+ struct uart_port *port; |
5134 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
5135 |
+index b82a7d787add8..11cc189bf1055 100644 |
5136 |
+--- a/drivers/usb/core/hcd.c |
5137 |
++++ b/drivers/usb/core/hcd.c |
5138 |
+@@ -750,6 +750,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
5139 |
+ { |
5140 |
+ struct urb *urb; |
5141 |
+ int length; |
5142 |
++ int status; |
5143 |
+ unsigned long flags; |
5144 |
+ char buffer[6]; /* Any root hubs with > 31 ports? */ |
5145 |
+ |
5146 |
+@@ -767,11 +768,17 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
5147 |
+ if (urb) { |
5148 |
+ clear_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
5149 |
+ hcd->status_urb = NULL; |
5150 |
++ if (urb->transfer_buffer_length >= length) { |
5151 |
++ status = 0; |
5152 |
++ } else { |
5153 |
++ status = -EOVERFLOW; |
5154 |
++ length = urb->transfer_buffer_length; |
5155 |
++ } |
5156 |
+ urb->actual_length = length; |
5157 |
+ memcpy(urb->transfer_buffer, buffer, length); |
5158 |
+ |
5159 |
+ usb_hcd_unlink_urb_from_ep(hcd, urb); |
5160 |
+- usb_hcd_giveback_urb(hcd, urb, 0); |
5161 |
++ usb_hcd_giveback_urb(hcd, urb, status); |
5162 |
+ } else { |
5163 |
+ length = 0; |
5164 |
+ set_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
5165 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
5166 |
+index 73ad4af487039..29cc2aa5abff5 100644 |
5167 |
+--- a/drivers/usb/core/hub.c |
5168 |
++++ b/drivers/usb/core/hub.c |
5169 |
+@@ -1082,7 +1082,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
5170 |
+ } else { |
5171 |
+ hub_power_on(hub, true); |
5172 |
+ } |
5173 |
+- } |
5174 |
++ /* Give some time on remote wakeup to let links to transit to U0 */ |
5175 |
++ } else if (hub_is_superspeed(hub->hdev)) |
5176 |
++ msleep(20); |
5177 |
++ |
5178 |
+ init2: |
5179 |
+ |
5180 |
+ /* |
5181 |
+@@ -1197,7 +1200,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
5182 |
+ */ |
5183 |
+ if (portchange || (hub_is_superspeed(hub->hdev) && |
5184 |
+ port_resumed)) |
5185 |
+- set_bit(port1, hub->change_bits); |
5186 |
++ set_bit(port1, hub->event_bits); |
5187 |
+ |
5188 |
+ } else if (udev->persist_enabled) { |
5189 |
+ #ifdef CONFIG_PM |
5190 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
5191 |
+index f070082124742..9271a7009a00f 100644 |
5192 |
+--- a/drivers/usb/gadget/function/f_fs.c |
5193 |
++++ b/drivers/usb/gadget/function/f_fs.c |
5194 |
+@@ -607,7 +607,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) |
5195 |
+ file->private_data = ffs; |
5196 |
+ ffs_data_opened(ffs); |
5197 |
+ |
5198 |
+- return 0; |
5199 |
++ return stream_open(inode, file); |
5200 |
+ } |
5201 |
+ |
5202 |
+ static int ffs_ep0_release(struct inode *inode, struct file *file) |
5203 |
+@@ -1071,7 +1071,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) |
5204 |
+ file->private_data = epfile; |
5205 |
+ ffs_data_opened(epfile->ffs); |
5206 |
+ |
5207 |
+- return 0; |
5208 |
++ return stream_open(inode, file); |
5209 |
+ } |
5210 |
+ |
5211 |
+ static int ffs_aio_cancel(struct kiocb *kiocb) |
5212 |
+diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c |
5213 |
+index 89700e26fb296..813ff3660e9f1 100644 |
5214 |
+--- a/drivers/usb/host/uhci-platform.c |
5215 |
++++ b/drivers/usb/host/uhci-platform.c |
5216 |
+@@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) |
5217 |
+ num_ports); |
5218 |
+ } |
5219 |
+ if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || |
5220 |
+- of_device_is_compatible(np, "aspeed,ast2500-uhci")) { |
5221 |
++ of_device_is_compatible(np, "aspeed,ast2500-uhci") || |
5222 |
++ of_device_is_compatible(np, "aspeed,ast2600-uhci")) { |
5223 |
+ uhci->is_aspeed = 1; |
5224 |
+ dev_info(&pdev->dev, |
5225 |
+ "Enabled Aspeed implementation workarounds\n"); |
5226 |
+diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c |
5227 |
+index 76c718ac8c78d..adc2a380be79f 100644 |
5228 |
+--- a/drivers/usb/misc/ftdi-elan.c |
5229 |
++++ b/drivers/usb/misc/ftdi-elan.c |
5230 |
+@@ -202,6 +202,7 @@ static void ftdi_elan_delete(struct kref *kref) |
5231 |
+ mutex_unlock(&ftdi_module_lock); |
5232 |
+ kfree(ftdi->bulk_in_buffer); |
5233 |
+ ftdi->bulk_in_buffer = NULL; |
5234 |
++ kfree(ftdi); |
5235 |
+ } |
5236 |
+ |
5237 |
+ static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) |
5238 |
+diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c |
5239 |
+index ec234b846eb3c..e5eb19a34ee2a 100644 |
5240 |
+--- a/drivers/w1/slaves/w1_ds28e04.c |
5241 |
++++ b/drivers/w1/slaves/w1_ds28e04.c |
5242 |
+@@ -34,7 +34,7 @@ static int w1_strong_pullup = 1; |
5243 |
+ module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
5244 |
+ |
5245 |
+ /* enable/disable CRC checking on DS28E04-100 memory accesses */ |
5246 |
+-static char w1_enable_crccheck = 1; |
5247 |
++static bool w1_enable_crccheck = true; |
5248 |
+ |
5249 |
+ #define W1_EEPROM_SIZE 512 |
5250 |
+ #define W1_PAGE_COUNT 16 |
5251 |
+@@ -341,32 +341,18 @@ static BIN_ATTR_RW(pio, 1); |
5252 |
+ static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, |
5253 |
+ char *buf) |
5254 |
+ { |
5255 |
+- if (put_user(w1_enable_crccheck + 0x30, buf)) |
5256 |
+- return -EFAULT; |
5257 |
+- |
5258 |
+- return sizeof(w1_enable_crccheck); |
5259 |
++ return sysfs_emit(buf, "%d\n", w1_enable_crccheck); |
5260 |
+ } |
5261 |
+ |
5262 |
+ static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, |
5263 |
+ const char *buf, size_t count) |
5264 |
+ { |
5265 |
+- char val; |
5266 |
+- |
5267 |
+- if (count != 1 || !buf) |
5268 |
+- return -EINVAL; |
5269 |
++ int err = kstrtobool(buf, &w1_enable_crccheck); |
5270 |
+ |
5271 |
+- if (get_user(val, buf)) |
5272 |
+- return -EFAULT; |
5273 |
++ if (err) |
5274 |
++ return err; |
5275 |
+ |
5276 |
+- /* convert to decimal */ |
5277 |
+- val = val - 0x30; |
5278 |
+- if (val != 0 && val != 1) |
5279 |
+- return -EINVAL; |
5280 |
+- |
5281 |
+- /* set the new value */ |
5282 |
+- w1_enable_crccheck = val; |
5283 |
+- |
5284 |
+- return sizeof(w1_enable_crccheck); |
5285 |
++ return count; |
5286 |
+ } |
5287 |
+ |
5288 |
+ static DEVICE_ATTR_RW(crccheck); |
5289 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
5290 |
+index 6b8824de2abb2..3fe15d6f40873 100644 |
5291 |
+--- a/fs/btrfs/backref.c |
5292 |
++++ b/fs/btrfs/backref.c |
5293 |
+@@ -1160,7 +1160,12 @@ again: |
5294 |
+ ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); |
5295 |
+ if (ret < 0) |
5296 |
+ goto out; |
5297 |
+- BUG_ON(ret == 0); |
5298 |
++ if (ret == 0) { |
5299 |
++ /* This shouldn't happen, indicates a bug or fs corruption. */ |
5300 |
++ ASSERT(ret != 0); |
5301 |
++ ret = -EUCLEAN; |
5302 |
++ goto out; |
5303 |
++ } |
5304 |
+ |
5305 |
+ #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS |
5306 |
+ if (trans && likely(trans->type != __TRANS_DUMMY) && |
5307 |
+@@ -1308,10 +1313,18 @@ again: |
5308 |
+ goto out; |
5309 |
+ if (!ret && extent_item_pos) { |
5310 |
+ /* |
5311 |
+- * we've recorded that parent, so we must extend |
5312 |
+- * its inode list here |
5313 |
++ * We've recorded that parent, so we must extend |
5314 |
++ * its inode list here. |
5315 |
++ * |
5316 |
++ * However if there was corruption we may not |
5317 |
++ * have found an eie, return an error in this |
5318 |
++ * case. |
5319 |
+ */ |
5320 |
+- BUG_ON(!eie); |
5321 |
++ ASSERT(eie); |
5322 |
++ if (!eie) { |
5323 |
++ ret = -EUCLEAN; |
5324 |
++ goto out; |
5325 |
++ } |
5326 |
+ while (eie->next) |
5327 |
+ eie = eie->next; |
5328 |
+ eie->next = ref->inode_list; |
5329 |
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c |
5330 |
+index a928ba008d7d7..26a4847efccca 100644 |
5331 |
+--- a/fs/dlm/lock.c |
5332 |
++++ b/fs/dlm/lock.c |
5333 |
+@@ -3977,6 +3977,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
5334 |
+ int from = ms->m_header.h_nodeid; |
5335 |
+ int error = 0; |
5336 |
+ |
5337 |
++ /* currently mixing of user/kernel locks are not supported */ |
5338 |
++ if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { |
5339 |
++ log_error(lkb->lkb_resource->res_ls, |
5340 |
++ "got user dlm message for a kernel lock"); |
5341 |
++ error = -EINVAL; |
5342 |
++ goto out; |
5343 |
++ } |
5344 |
++ |
5345 |
+ switch (ms->m_type) { |
5346 |
+ case DLM_MSG_CONVERT: |
5347 |
+ case DLM_MSG_UNLOCK: |
5348 |
+@@ -4005,6 +4013,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
5349 |
+ error = -EINVAL; |
5350 |
+ } |
5351 |
+ |
5352 |
++out: |
5353 |
+ if (error) |
5354 |
+ log_error(lkb->lkb_resource->res_ls, |
5355 |
+ "ignore invalid message %d from %d %x %x %x %d", |
5356 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
5357 |
+index 21c9ebfe83478..484cb68c34d92 100644 |
5358 |
+--- a/fs/ext4/ioctl.c |
5359 |
++++ b/fs/ext4/ioctl.c |
5360 |
+@@ -1052,8 +1052,6 @@ resizefs_out: |
5361 |
+ sizeof(range))) |
5362 |
+ return -EFAULT; |
5363 |
+ |
5364 |
+- range.minlen = max((unsigned int)range.minlen, |
5365 |
+- q->limits.discard_granularity); |
5366 |
+ ret = ext4_trim_fs(sb, &range); |
5367 |
+ if (ret < 0) |
5368 |
+ return ret; |
5369 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
5370 |
+index 447aa17c804e2..db8243627b085 100644 |
5371 |
+--- a/fs/ext4/mballoc.c |
5372 |
++++ b/fs/ext4/mballoc.c |
5373 |
+@@ -5260,6 +5260,7 @@ out: |
5374 |
+ */ |
5375 |
+ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
5376 |
+ { |
5377 |
++ struct request_queue *q = bdev_get_queue(sb->s_bdev); |
5378 |
+ struct ext4_group_info *grp; |
5379 |
+ ext4_group_t group, first_group, last_group; |
5380 |
+ ext4_grpblk_t cnt = 0, first_cluster, last_cluster; |
5381 |
+@@ -5278,6 +5279,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
5382 |
+ start >= max_blks || |
5383 |
+ range->len < sb->s_blocksize) |
5384 |
+ return -EINVAL; |
5385 |
++ /* No point to try to trim less than discard granularity */ |
5386 |
++ if (range->minlen < q->limits.discard_granularity) { |
5387 |
++ minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
5388 |
++ q->limits.discard_granularity >> sb->s_blocksize_bits); |
5389 |
++ if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) |
5390 |
++ goto out; |
5391 |
++ } |
5392 |
+ if (end >= max_blks) |
5393 |
+ end = max_blks - 1; |
5394 |
+ if (end <= first_data_blk) |
5395 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
5396 |
+index bec4ad787c7d8..9adfe217b39d2 100644 |
5397 |
+--- a/fs/ext4/migrate.c |
5398 |
++++ b/fs/ext4/migrate.c |
5399 |
+@@ -455,12 +455,12 @@ int ext4_ext_migrate(struct inode *inode) |
5400 |
+ percpu_down_write(&sbi->s_writepages_rwsem); |
5401 |
+ |
5402 |
+ /* |
5403 |
+- * Worst case we can touch the allocation bitmaps, a bgd |
5404 |
+- * block, and a block to link in the orphan list. We do need |
5405 |
+- * need to worry about credits for modifying the quota inode. |
5406 |
++ * Worst case we can touch the allocation bitmaps and a block |
5407 |
++ * group descriptor block. We do need need to worry about |
5408 |
++ * credits for modifying the quota inode. |
5409 |
+ */ |
5410 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, |
5411 |
+- 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
5412 |
++ 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
5413 |
+ |
5414 |
+ if (IS_ERR(handle)) { |
5415 |
+ retval = PTR_ERR(handle); |
5416 |
+@@ -477,6 +477,13 @@ int ext4_ext_migrate(struct inode *inode) |
5417 |
+ ext4_journal_stop(handle); |
5418 |
+ goto out_unlock; |
5419 |
+ } |
5420 |
++ /* |
5421 |
++ * Use the correct seed for checksum (i.e. the seed from 'inode'). This |
5422 |
++ * is so that the metadata blocks will have the correct checksum after |
5423 |
++ * the migration. |
5424 |
++ */ |
5425 |
++ ei = EXT4_I(inode); |
5426 |
++ EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; |
5427 |
+ i_size_write(tmp_inode, i_size_read(inode)); |
5428 |
+ /* |
5429 |
+ * Set the i_nlink to zero so it will be deleted later |
5430 |
+@@ -485,7 +492,6 @@ int ext4_ext_migrate(struct inode *inode) |
5431 |
+ clear_nlink(tmp_inode); |
5432 |
+ |
5433 |
+ ext4_ext_tree_init(handle, tmp_inode); |
5434 |
+- ext4_orphan_add(handle, tmp_inode); |
5435 |
+ ext4_journal_stop(handle); |
5436 |
+ |
5437 |
+ /* |
5438 |
+@@ -510,17 +516,10 @@ int ext4_ext_migrate(struct inode *inode) |
5439 |
+ |
5440 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); |
5441 |
+ if (IS_ERR(handle)) { |
5442 |
+- /* |
5443 |
+- * It is impossible to update on-disk structures without |
5444 |
+- * a handle, so just rollback in-core changes and live other |
5445 |
+- * work to orphan_list_cleanup() |
5446 |
+- */ |
5447 |
+- ext4_orphan_del(NULL, tmp_inode); |
5448 |
+ retval = PTR_ERR(handle); |
5449 |
+ goto out_tmp_inode; |
5450 |
+ } |
5451 |
+ |
5452 |
+- ei = EXT4_I(inode); |
5453 |
+ i_data = ei->i_data; |
5454 |
+ memset(&lb, 0, sizeof(lb)); |
5455 |
+ |
5456 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
5457 |
+index fab2092856a27..648eb6a24e3a3 100644 |
5458 |
+--- a/fs/ext4/super.c |
5459 |
++++ b/fs/ext4/super.c |
5460 |
+@@ -5797,10 +5797,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
5461 |
+ |
5462 |
+ lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); |
5463 |
+ err = dquot_quota_on(sb, type, format_id, path); |
5464 |
+- if (err) { |
5465 |
+- lockdep_set_quota_inode(path->dentry->d_inode, |
5466 |
+- I_DATA_SEM_NORMAL); |
5467 |
+- } else { |
5468 |
++ if (!err) { |
5469 |
+ struct inode *inode = d_inode(path->dentry); |
5470 |
+ handle_t *handle; |
5471 |
+ |
5472 |
+@@ -5820,7 +5817,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
5473 |
+ ext4_journal_stop(handle); |
5474 |
+ unlock_inode: |
5475 |
+ inode_unlock(inode); |
5476 |
++ if (err) |
5477 |
++ dquot_quota_off(sb, type); |
5478 |
+ } |
5479 |
++ if (err) |
5480 |
++ lockdep_set_quota_inode(path->dentry->d_inode, |
5481 |
++ I_DATA_SEM_NORMAL); |
5482 |
+ return err; |
5483 |
+ } |
5484 |
+ |
5485 |
+@@ -5883,8 +5885,19 @@ static int ext4_enable_quotas(struct super_block *sb) |
5486 |
+ "Failed to enable quota tracking " |
5487 |
+ "(type=%d, err=%d). Please run " |
5488 |
+ "e2fsck to fix.", type, err); |
5489 |
+- for (type--; type >= 0; type--) |
5490 |
++ for (type--; type >= 0; type--) { |
5491 |
++ struct inode *inode; |
5492 |
++ |
5493 |
++ inode = sb_dqopt(sb)->files[type]; |
5494 |
++ if (inode) |
5495 |
++ inode = igrab(inode); |
5496 |
+ dquot_quota_off(sb, type); |
5497 |
++ if (inode) { |
5498 |
++ lockdep_set_quota_inode(inode, |
5499 |
++ I_DATA_SEM_NORMAL); |
5500 |
++ iput(inode); |
5501 |
++ } |
5502 |
++ } |
5503 |
+ |
5504 |
+ return err; |
5505 |
+ } |
5506 |
+@@ -5986,7 +5999,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
5507 |
+ struct buffer_head *bh; |
5508 |
+ handle_t *handle = journal_current_handle(); |
5509 |
+ |
5510 |
+- if (EXT4_SB(sb)->s_journal && !handle) { |
5511 |
++ if (!handle) { |
5512 |
+ ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" |
5513 |
+ " cancelled because transaction is not started", |
5514 |
+ (unsigned long long)off, (unsigned long long)len); |
5515 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
5516 |
+index 38299ccfdf6ef..bd377ff0b403f 100644 |
5517 |
+--- a/fs/f2fs/gc.c |
5518 |
++++ b/fs/f2fs/gc.c |
5519 |
+@@ -589,6 +589,9 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
5520 |
+ set_sbi_flag(sbi, SBI_NEED_FSCK); |
5521 |
+ } |
5522 |
+ |
5523 |
++ if (f2fs_check_nid_range(sbi, dni->ino)) |
5524 |
++ return false; |
5525 |
++ |
5526 |
+ *nofs = ofs_of_node(node_page); |
5527 |
+ source_blkaddr = datablock_addr(NULL, node_page, ofs_in_node); |
5528 |
+ f2fs_put_page(node_page, 1); |
5529 |
+diff --git a/fs/fuse/acl.c b/fs/fuse/acl.c |
5530 |
+index 5a48cee6d7d33..f529075a2ce87 100644 |
5531 |
+--- a/fs/fuse/acl.c |
5532 |
++++ b/fs/fuse/acl.c |
5533 |
+@@ -19,6 +19,9 @@ struct posix_acl *fuse_get_acl(struct inode *inode, int type) |
5534 |
+ void *value = NULL; |
5535 |
+ struct posix_acl *acl; |
5536 |
+ |
5537 |
++ if (fuse_is_bad(inode)) |
5538 |
++ return ERR_PTR(-EIO); |
5539 |
++ |
5540 |
+ if (!fc->posix_acl || fc->no_getxattr) |
5541 |
+ return NULL; |
5542 |
+ |
5543 |
+@@ -53,6 +56,9 @@ int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
5544 |
+ const char *name; |
5545 |
+ int ret; |
5546 |
+ |
5547 |
++ if (fuse_is_bad(inode)) |
5548 |
++ return -EIO; |
5549 |
++ |
5550 |
+ if (!fc->posix_acl || fc->no_setxattr) |
5551 |
+ return -EOPNOTSUPP; |
5552 |
+ |
5553 |
+diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
5554 |
+index f01ecc197a45b..6098e0c7f87b3 100644 |
5555 |
+--- a/fs/fuse/dir.c |
5556 |
++++ b/fs/fuse/dir.c |
5557 |
+@@ -187,7 +187,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) |
5558 |
+ int ret; |
5559 |
+ |
5560 |
+ inode = d_inode_rcu(entry); |
5561 |
+- if (inode && is_bad_inode(inode)) |
5562 |
++ if (inode && fuse_is_bad(inode)) |
5563 |
+ goto invalid; |
5564 |
+ else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || |
5565 |
+ (flags & LOOKUP_REVAL)) { |
5566 |
+@@ -364,6 +364,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, |
5567 |
+ bool outarg_valid = true; |
5568 |
+ bool locked; |
5569 |
+ |
5570 |
++ if (fuse_is_bad(dir)) |
5571 |
++ return ERR_PTR(-EIO); |
5572 |
++ |
5573 |
+ locked = fuse_lock_inode(dir); |
5574 |
+ err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name, |
5575 |
+ &outarg, &inode); |
5576 |
+@@ -504,6 +507,9 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry, |
5577 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
5578 |
+ struct dentry *res = NULL; |
5579 |
+ |
5580 |
++ if (fuse_is_bad(dir)) |
5581 |
++ return -EIO; |
5582 |
++ |
5583 |
+ if (d_in_lookup(entry)) { |
5584 |
+ res = fuse_lookup(dir, entry, 0); |
5585 |
+ if (IS_ERR(res)) |
5586 |
+@@ -552,6 +558,9 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args, |
5587 |
+ int err; |
5588 |
+ struct fuse_forget_link *forget; |
5589 |
+ |
5590 |
++ if (fuse_is_bad(dir)) |
5591 |
++ return -EIO; |
5592 |
++ |
5593 |
+ forget = fuse_alloc_forget(); |
5594 |
+ if (!forget) |
5595 |
+ return -ENOMEM; |
5596 |
+@@ -679,6 +688,9 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) |
5597 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
5598 |
+ FUSE_ARGS(args); |
5599 |
+ |
5600 |
++ if (fuse_is_bad(dir)) |
5601 |
++ return -EIO; |
5602 |
++ |
5603 |
+ args.in.h.opcode = FUSE_UNLINK; |
5604 |
+ args.in.h.nodeid = get_node_id(dir); |
5605 |
+ args.in.numargs = 1; |
5606 |
+@@ -715,6 +727,9 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) |
5607 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
5608 |
+ FUSE_ARGS(args); |
5609 |
+ |
5610 |
++ if (fuse_is_bad(dir)) |
5611 |
++ return -EIO; |
5612 |
++ |
5613 |
+ args.in.h.opcode = FUSE_RMDIR; |
5614 |
+ args.in.h.nodeid = get_node_id(dir); |
5615 |
+ args.in.numargs = 1; |
5616 |
+@@ -793,6 +808,9 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, |
5617 |
+ struct fuse_conn *fc = get_fuse_conn(olddir); |
5618 |
+ int err; |
5619 |
+ |
5620 |
++ if (fuse_is_bad(olddir)) |
5621 |
++ return -EIO; |
5622 |
++ |
5623 |
+ if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) |
5624 |
+ return -EINVAL; |
5625 |
+ |
5626 |
+@@ -928,7 +946,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, |
5627 |
+ if (!err) { |
5628 |
+ if (fuse_invalid_attr(&outarg.attr) || |
5629 |
+ (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
5630 |
+- make_bad_inode(inode); |
5631 |
++ fuse_make_bad(inode); |
5632 |
+ err = -EIO; |
5633 |
+ } else { |
5634 |
+ fuse_change_attributes(inode, &outarg.attr, |
5635 |
+@@ -1125,6 +1143,9 @@ static int fuse_permission(struct inode *inode, int mask) |
5636 |
+ bool refreshed = false; |
5637 |
+ int err = 0; |
5638 |
+ |
5639 |
++ if (fuse_is_bad(inode)) |
5640 |
++ return -EIO; |
5641 |
++ |
5642 |
+ if (!fuse_allow_current_process(fc)) |
5643 |
+ return -EACCES; |
5644 |
+ |
5645 |
+@@ -1262,7 +1283,7 @@ retry: |
5646 |
+ dput(dentry); |
5647 |
+ goto retry; |
5648 |
+ } |
5649 |
+- if (is_bad_inode(inode)) { |
5650 |
++ if (fuse_is_bad(inode)) { |
5651 |
+ dput(dentry); |
5652 |
+ return -EIO; |
5653 |
+ } |
5654 |
+@@ -1360,7 +1381,7 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx) |
5655 |
+ u64 attr_version = 0; |
5656 |
+ bool locked; |
5657 |
+ |
5658 |
+- if (is_bad_inode(inode)) |
5659 |
++ if (fuse_is_bad(inode)) |
5660 |
+ return -EIO; |
5661 |
+ |
5662 |
+ req = fuse_get_req(fc, 1); |
5663 |
+@@ -1420,6 +1441,9 @@ static const char *fuse_get_link(struct dentry *dentry, |
5664 |
+ if (!dentry) |
5665 |
+ return ERR_PTR(-ECHILD); |
5666 |
+ |
5667 |
++ if (fuse_is_bad(inode)) |
5668 |
++ return ERR_PTR(-EIO); |
5669 |
++ |
5670 |
+ link = kmalloc(PAGE_SIZE, GFP_KERNEL); |
5671 |
+ if (!link) |
5672 |
+ return ERR_PTR(-ENOMEM); |
5673 |
+@@ -1718,7 +1742,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, |
5674 |
+ |
5675 |
+ if (fuse_invalid_attr(&outarg.attr) || |
5676 |
+ (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
5677 |
+- make_bad_inode(inode); |
5678 |
++ fuse_make_bad(inode); |
5679 |
+ err = -EIO; |
5680 |
+ goto error; |
5681 |
+ } |
5682 |
+@@ -1774,6 +1798,9 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) |
5683 |
+ struct file *file = (attr->ia_valid & ATTR_FILE) ? attr->ia_file : NULL; |
5684 |
+ int ret; |
5685 |
+ |
5686 |
++ if (fuse_is_bad(inode)) |
5687 |
++ return -EIO; |
5688 |
++ |
5689 |
+ if (!fuse_allow_current_process(get_fuse_conn(inode))) |
5690 |
+ return -EACCES; |
5691 |
+ |
5692 |
+@@ -1832,6 +1859,9 @@ static int fuse_getattr(const struct path *path, struct kstat *stat, |
5693 |
+ struct inode *inode = d_inode(path->dentry); |
5694 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
5695 |
+ |
5696 |
++ if (fuse_is_bad(inode)) |
5697 |
++ return -EIO; |
5698 |
++ |
5699 |
+ if (!fuse_allow_current_process(fc)) |
5700 |
+ return -EACCES; |
5701 |
+ |
5702 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
5703 |
+index 13371a40f7a15..ed9b3ebc0cca4 100644 |
5704 |
+--- a/fs/fuse/file.c |
5705 |
++++ b/fs/fuse/file.c |
5706 |
+@@ -210,6 +210,9 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
5707 |
+ fc->atomic_o_trunc && |
5708 |
+ fc->writeback_cache; |
5709 |
+ |
5710 |
++ if (fuse_is_bad(inode)) |
5711 |
++ return -EIO; |
5712 |
++ |
5713 |
+ err = generic_file_open(inode, file); |
5714 |
+ if (err) |
5715 |
+ return err; |
5716 |
+@@ -411,7 +414,7 @@ static int fuse_flush(struct file *file, fl_owner_t id) |
5717 |
+ struct fuse_flush_in inarg; |
5718 |
+ int err; |
5719 |
+ |
5720 |
+- if (is_bad_inode(inode)) |
5721 |
++ if (fuse_is_bad(inode)) |
5722 |
+ return -EIO; |
5723 |
+ |
5724 |
+ if (fc->no_flush) |
5725 |
+@@ -459,7 +462,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, |
5726 |
+ struct fuse_fsync_in inarg; |
5727 |
+ int err; |
5728 |
+ |
5729 |
+- if (is_bad_inode(inode)) |
5730 |
++ if (fuse_is_bad(inode)) |
5731 |
+ return -EIO; |
5732 |
+ |
5733 |
+ inode_lock(inode); |
5734 |
+@@ -774,7 +777,7 @@ static int fuse_readpage(struct file *file, struct page *page) |
5735 |
+ int err; |
5736 |
+ |
5737 |
+ err = -EIO; |
5738 |
+- if (is_bad_inode(inode)) |
5739 |
++ if (fuse_is_bad(inode)) |
5740 |
+ goto out; |
5741 |
+ |
5742 |
+ err = fuse_do_readpage(file, page); |
5743 |
+@@ -901,7 +904,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, |
5744 |
+ int nr_alloc = min_t(unsigned, nr_pages, FUSE_MAX_PAGES_PER_REQ); |
5745 |
+ |
5746 |
+ err = -EIO; |
5747 |
+- if (is_bad_inode(inode)) |
5748 |
++ if (fuse_is_bad(inode)) |
5749 |
+ goto out; |
5750 |
+ |
5751 |
+ data.file = file; |
5752 |
+@@ -931,6 +934,9 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) |
5753 |
+ struct inode *inode = iocb->ki_filp->f_mapping->host; |
5754 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
5755 |
+ |
5756 |
++ if (fuse_is_bad(inode)) |
5757 |
++ return -EIO; |
5758 |
++ |
5759 |
+ /* |
5760 |
+ * In auto invalidate mode, always update attributes on read. |
5761 |
+ * Otherwise, only update if we attempt to read past EOF (to ensure |
5762 |
+@@ -1131,7 +1137,7 @@ static ssize_t fuse_perform_write(struct kiocb *iocb, |
5763 |
+ int err = 0; |
5764 |
+ ssize_t res = 0; |
5765 |
+ |
5766 |
+- if (is_bad_inode(inode)) |
5767 |
++ if (fuse_is_bad(inode)) |
5768 |
+ return -EIO; |
5769 |
+ |
5770 |
+ if (inode->i_size < pos + iov_iter_count(ii)) |
5771 |
+@@ -1188,6 +1194,9 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
5772 |
+ ssize_t err; |
5773 |
+ loff_t endbyte = 0; |
5774 |
+ |
5775 |
++ if (fuse_is_bad(inode)) |
5776 |
++ return -EIO; |
5777 |
++ |
5778 |
+ if (get_fuse_conn(inode)->writeback_cache) { |
5779 |
+ /* Update size (EOF optimization) and mode (SUID clearing) */ |
5780 |
+ err = fuse_update_attributes(mapping->host, file); |
5781 |
+@@ -1424,7 +1433,7 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io, |
5782 |
+ ssize_t res; |
5783 |
+ struct inode *inode = file_inode(io->iocb->ki_filp); |
5784 |
+ |
5785 |
+- if (is_bad_inode(inode)) |
5786 |
++ if (fuse_is_bad(inode)) |
5787 |
+ return -EIO; |
5788 |
+ |
5789 |
+ res = fuse_direct_io(io, iter, ppos, 0); |
5790 |
+@@ -1446,7 +1455,7 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from) |
5791 |
+ struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb); |
5792 |
+ ssize_t res; |
5793 |
+ |
5794 |
+- if (is_bad_inode(inode)) |
5795 |
++ if (fuse_is_bad(inode)) |
5796 |
+ return -EIO; |
5797 |
+ |
5798 |
+ /* Don't allow parallel writes to the same file */ |
5799 |
+@@ -1920,7 +1929,7 @@ static int fuse_writepages(struct address_space *mapping, |
5800 |
+ int err; |
5801 |
+ |
5802 |
+ err = -EIO; |
5803 |
+- if (is_bad_inode(inode)) |
5804 |
++ if (fuse_is_bad(inode)) |
5805 |
+ goto out; |
5806 |
+ |
5807 |
+ data.inode = inode; |
5808 |
+@@ -2705,7 +2714,7 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd, |
5809 |
+ if (!fuse_allow_current_process(fc)) |
5810 |
+ return -EACCES; |
5811 |
+ |
5812 |
+- if (is_bad_inode(inode)) |
5813 |
++ if (fuse_is_bad(inode)) |
5814 |
+ return -EIO; |
5815 |
+ |
5816 |
+ return fuse_do_ioctl(file, cmd, arg, flags); |
5817 |
+diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
5818 |
+index dbfc35efbefb6..853d37ec81e0c 100644 |
5819 |
+--- a/fs/fuse/fuse_i.h |
5820 |
++++ b/fs/fuse/fuse_i.h |
5821 |
+@@ -118,6 +118,8 @@ enum { |
5822 |
+ FUSE_I_INIT_RDPLUS, |
5823 |
+ /** An operation changing file size is in progress */ |
5824 |
+ FUSE_I_SIZE_UNSTABLE, |
5825 |
++ /* Bad inode */ |
5826 |
++ FUSE_I_BAD, |
5827 |
+ }; |
5828 |
+ |
5829 |
+ struct fuse_conn; |
5830 |
+@@ -700,6 +702,17 @@ static inline u64 get_node_id(struct inode *inode) |
5831 |
+ return get_fuse_inode(inode)->nodeid; |
5832 |
+ } |
5833 |
+ |
5834 |
++static inline void fuse_make_bad(struct inode *inode) |
5835 |
++{ |
5836 |
++ remove_inode_hash(inode); |
5837 |
++ set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state); |
5838 |
++} |
5839 |
++ |
5840 |
++static inline bool fuse_is_bad(struct inode *inode) |
5841 |
++{ |
5842 |
++ return unlikely(test_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state)); |
5843 |
++} |
5844 |
++ |
5845 |
+ /** Device operations */ |
5846 |
+ extern const struct file_operations fuse_dev_operations; |
5847 |
+ |
5848 |
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
5849 |
+index cb018315ecaf5..821597c618843 100644 |
5850 |
+--- a/fs/fuse/inode.c |
5851 |
++++ b/fs/fuse/inode.c |
5852 |
+@@ -317,7 +317,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, |
5853 |
+ unlock_new_inode(inode); |
5854 |
+ } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { |
5855 |
+ /* Inode has changed type, any I/O on the old should fail */ |
5856 |
+- make_bad_inode(inode); |
5857 |
++ fuse_make_bad(inode); |
5858 |
+ iput(inode); |
5859 |
+ goto retry; |
5860 |
+ } |
5861 |
+diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c |
5862 |
+index 433717640f78d..a4b65374bced4 100644 |
5863 |
+--- a/fs/fuse/xattr.c |
5864 |
++++ b/fs/fuse/xattr.c |
5865 |
+@@ -113,6 +113,9 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) |
5866 |
+ struct fuse_getxattr_out outarg; |
5867 |
+ ssize_t ret; |
5868 |
+ |
5869 |
++ if (fuse_is_bad(inode)) |
5870 |
++ return -EIO; |
5871 |
++ |
5872 |
+ if (!fuse_allow_current_process(fc)) |
5873 |
+ return -EACCES; |
5874 |
+ |
5875 |
+@@ -178,6 +181,9 @@ static int fuse_xattr_get(const struct xattr_handler *handler, |
5876 |
+ struct dentry *dentry, struct inode *inode, |
5877 |
+ const char *name, void *value, size_t size) |
5878 |
+ { |
5879 |
++ if (fuse_is_bad(inode)) |
5880 |
++ return -EIO; |
5881 |
++ |
5882 |
+ return fuse_getxattr(inode, name, value, size); |
5883 |
+ } |
5884 |
+ |
5885 |
+@@ -186,6 +192,9 @@ static int fuse_xattr_set(const struct xattr_handler *handler, |
5886 |
+ const char *name, const void *value, size_t size, |
5887 |
+ int flags) |
5888 |
+ { |
5889 |
++ if (fuse_is_bad(inode)) |
5890 |
++ return -EIO; |
5891 |
++ |
5892 |
+ if (!value) |
5893 |
+ return fuse_removexattr(inode, name); |
5894 |
+ |
5895 |
+diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c |
5896 |
+index 7d8654a1472ef..3047872fdac9b 100644 |
5897 |
+--- a/fs/jffs2/file.c |
5898 |
++++ b/fs/jffs2/file.c |
5899 |
+@@ -135,20 +135,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
5900 |
+ struct page *pg; |
5901 |
+ struct inode *inode = mapping->host; |
5902 |
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
5903 |
++ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
5904 |
+ pgoff_t index = pos >> PAGE_SHIFT; |
5905 |
+ uint32_t pageofs = index << PAGE_SHIFT; |
5906 |
+ int ret = 0; |
5907 |
+ |
5908 |
+- pg = grab_cache_page_write_begin(mapping, index, flags); |
5909 |
+- if (!pg) |
5910 |
+- return -ENOMEM; |
5911 |
+- *pagep = pg; |
5912 |
+- |
5913 |
+ jffs2_dbg(1, "%s()\n", __func__); |
5914 |
+ |
5915 |
+ if (pageofs > inode->i_size) { |
5916 |
+ /* Make new hole frag from old EOF to new page */ |
5917 |
+- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
5918 |
+ struct jffs2_raw_inode ri; |
5919 |
+ struct jffs2_full_dnode *fn; |
5920 |
+ uint32_t alloc_len; |
5921 |
+@@ -159,7 +154,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
5922 |
+ ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, |
5923 |
+ ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
5924 |
+ if (ret) |
5925 |
+- goto out_page; |
5926 |
++ goto out_err; |
5927 |
+ |
5928 |
+ mutex_lock(&f->sem); |
5929 |
+ memset(&ri, 0, sizeof(ri)); |
5930 |
+@@ -189,7 +184,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
5931 |
+ ret = PTR_ERR(fn); |
5932 |
+ jffs2_complete_reservation(c); |
5933 |
+ mutex_unlock(&f->sem); |
5934 |
+- goto out_page; |
5935 |
++ goto out_err; |
5936 |
+ } |
5937 |
+ ret = jffs2_add_full_dnode_to_inode(c, f, fn); |
5938 |
+ if (f->metadata) { |
5939 |
+@@ -204,13 +199,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
5940 |
+ jffs2_free_full_dnode(fn); |
5941 |
+ jffs2_complete_reservation(c); |
5942 |
+ mutex_unlock(&f->sem); |
5943 |
+- goto out_page; |
5944 |
++ goto out_err; |
5945 |
+ } |
5946 |
+ jffs2_complete_reservation(c); |
5947 |
+ inode->i_size = pageofs; |
5948 |
+ mutex_unlock(&f->sem); |
5949 |
+ } |
5950 |
+ |
5951 |
++ /* |
5952 |
++ * While getting a page and reading data in, lock c->alloc_sem until |
5953 |
++ * the page is Uptodate. Otherwise GC task may attempt to read the same |
5954 |
++ * page in read_cache_page(), which causes a deadlock. |
5955 |
++ */ |
5956 |
++ mutex_lock(&c->alloc_sem); |
5957 |
++ pg = grab_cache_page_write_begin(mapping, index, flags); |
5958 |
++ if (!pg) { |
5959 |
++ ret = -ENOMEM; |
5960 |
++ goto release_sem; |
5961 |
++ } |
5962 |
++ *pagep = pg; |
5963 |
++ |
5964 |
+ /* |
5965 |
+ * Read in the page if it wasn't already present. Cannot optimize away |
5966 |
+ * the whole page write case until jffs2_write_end can handle the |
5967 |
+@@ -220,15 +228,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
5968 |
+ mutex_lock(&f->sem); |
5969 |
+ ret = jffs2_do_readpage_nolock(inode, pg); |
5970 |
+ mutex_unlock(&f->sem); |
5971 |
+- if (ret) |
5972 |
+- goto out_page; |
5973 |
++ if (ret) { |
5974 |
++ unlock_page(pg); |
5975 |
++ put_page(pg); |
5976 |
++ goto release_sem; |
5977 |
++ } |
5978 |
+ } |
5979 |
+ jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); |
5980 |
+- return ret; |
5981 |
+ |
5982 |
+-out_page: |
5983 |
+- unlock_page(pg); |
5984 |
+- put_page(pg); |
5985 |
++release_sem: |
5986 |
++ mutex_unlock(&c->alloc_sem); |
5987 |
++out_err: |
5988 |
+ return ret; |
5989 |
+ } |
5990 |
+ |
5991 |
+diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c |
5992 |
+index c4e98c9c16217..6d20b1b3a5815 100644 |
5993 |
+--- a/fs/orangefs/orangefs-bufmap.c |
5994 |
++++ b/fs/orangefs/orangefs-bufmap.c |
5995 |
+@@ -179,7 +179,7 @@ orangefs_bufmap_free(struct orangefs_bufmap *bufmap) |
5996 |
+ { |
5997 |
+ kfree(bufmap->page_array); |
5998 |
+ kfree(bufmap->desc_array); |
5999 |
+- kfree(bufmap->buffer_index_array); |
6000 |
++ bitmap_free(bufmap->buffer_index_array); |
6001 |
+ kfree(bufmap); |
6002 |
+ } |
6003 |
+ |
6004 |
+@@ -229,8 +229,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc) |
6005 |
+ bufmap->desc_size = user_desc->size; |
6006 |
+ bufmap->desc_shift = ilog2(bufmap->desc_size); |
6007 |
+ |
6008 |
+- bufmap->buffer_index_array = |
6009 |
+- kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL); |
6010 |
++ bufmap->buffer_index_array = bitmap_zalloc(bufmap->desc_count, GFP_KERNEL); |
6011 |
+ if (!bufmap->buffer_index_array) |
6012 |
+ goto out_free_bufmap; |
6013 |
+ |
6014 |
+@@ -253,7 +252,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc) |
6015 |
+ out_free_desc_array: |
6016 |
+ kfree(bufmap->desc_array); |
6017 |
+ out_free_index_array: |
6018 |
+- kfree(bufmap->buffer_index_array); |
6019 |
++ bitmap_free(bufmap->buffer_index_array); |
6020 |
+ out_free_bufmap: |
6021 |
+ kfree(bufmap); |
6022 |
+ out: |
6023 |
+diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c |
6024 |
+index fec62e9dfbe6a..f5b663d70826c 100644 |
6025 |
+--- a/fs/ubifs/super.c |
6026 |
++++ b/fs/ubifs/super.c |
6027 |
+@@ -1730,7 +1730,6 @@ out: |
6028 |
+ kthread_stop(c->bgt); |
6029 |
+ c->bgt = NULL; |
6030 |
+ } |
6031 |
+- free_wbufs(c); |
6032 |
+ kfree(c->write_reserve_buf); |
6033 |
+ c->write_reserve_buf = NULL; |
6034 |
+ vfree(c->ileb_buf); |
6035 |
+diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h |
6036 |
+index 2939a6cd7fecb..9fc1dfc7f4c32 100644 |
6037 |
+--- a/include/acpi/actypes.h |
6038 |
++++ b/include/acpi/actypes.h |
6039 |
+@@ -532,8 +532,14 @@ typedef u64 acpi_integer; |
6040 |
+ * Can be used with access_width of struct acpi_generic_address and access_size of |
6041 |
+ * struct acpi_resource_generic_register. |
6042 |
+ */ |
6043 |
+-#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) |
6044 |
+-#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) |
6045 |
++#define ACPI_ACCESS_BIT_SHIFT 2 |
6046 |
++#define ACPI_ACCESS_BYTE_SHIFT -1 |
6047 |
++#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) |
6048 |
++#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) |
6049 |
++#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) |
6050 |
++#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) |
6051 |
++#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) |
6052 |
++#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) |
6053 |
+ |
6054 |
+ /******************************************************************************* |
6055 |
+ * |
6056 |
+diff --git a/include/linux/hid.h b/include/linux/hid.h |
6057 |
+index da824ba9fb9a2..c51ebce2197e0 100644 |
6058 |
+--- a/include/linux/hid.h |
6059 |
++++ b/include/linux/hid.h |
6060 |
+@@ -353,6 +353,8 @@ struct hid_item { |
6061 |
+ /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ |
6062 |
+ #define HID_QUIRK_ALWAYS_POLL BIT(10) |
6063 |
+ #define HID_QUIRK_INPUT_PER_APP BIT(11) |
6064 |
++#define HID_QUIRK_X_INVERT BIT(12) |
6065 |
++#define HID_QUIRK_Y_INVERT BIT(13) |
6066 |
+ #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) |
6067 |
+ #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) |
6068 |
+ #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) |
6069 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
6070 |
+index c0147888b1555..483303adf3df8 100644 |
6071 |
+--- a/include/net/sch_generic.h |
6072 |
++++ b/include/net/sch_generic.h |
6073 |
+@@ -1077,6 +1077,7 @@ struct psched_ratecfg { |
6074 |
+ u64 rate_bytes_ps; /* bytes per second */ |
6075 |
+ u32 mult; |
6076 |
+ u16 overhead; |
6077 |
++ u16 mpu; |
6078 |
+ u8 linklayer; |
6079 |
+ u8 shift; |
6080 |
+ }; |
6081 |
+@@ -1086,6 +1087,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, |
6082 |
+ { |
6083 |
+ len += r->overhead; |
6084 |
+ |
6085 |
++ if (len < r->mpu) |
6086 |
++ len = r->mpu; |
6087 |
++ |
6088 |
+ if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) |
6089 |
+ return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; |
6090 |
+ |
6091 |
+@@ -1108,6 +1112,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, |
6092 |
+ res->rate = min_t(u64, r->rate_bytes_ps, ~0U); |
6093 |
+ |
6094 |
+ res->overhead = r->overhead; |
6095 |
++ res->mpu = r->mpu; |
6096 |
+ res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); |
6097 |
+ } |
6098 |
+ |
6099 |
+diff --git a/include/sound/soc.h b/include/sound/soc.h |
6100 |
+index 88aa48e5485f9..7abd8d4746ef2 100644 |
6101 |
+--- a/include/sound/soc.h |
6102 |
++++ b/include/sound/soc.h |
6103 |
+@@ -1113,6 +1113,8 @@ struct snd_soc_card { |
6104 |
+ u32 pop_time; |
6105 |
+ |
6106 |
+ void *drvdata; |
6107 |
++ |
6108 |
++ spinlock_t dpcm_lock; |
6109 |
+ }; |
6110 |
+ |
6111 |
+ /* SoC machine DAI configuration, glues a codec and cpu DAI together */ |
6112 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
6113 |
+index 968921d376b98..c5e034fe14bbb 100644 |
6114 |
+--- a/kernel/audit.c |
6115 |
++++ b/kernel/audit.c |
6116 |
+@@ -1528,6 +1528,20 @@ static void audit_receive(struct sk_buff *skb) |
6117 |
+ nlh = nlmsg_next(nlh, &len); |
6118 |
+ } |
6119 |
+ audit_ctl_unlock(); |
6120 |
++ |
6121 |
++ /* can't block with the ctrl lock, so penalize the sender now */ |
6122 |
++ if (audit_backlog_limit && |
6123 |
++ (skb_queue_len(&audit_queue) > audit_backlog_limit)) { |
6124 |
++ DECLARE_WAITQUEUE(wait, current); |
6125 |
++ |
6126 |
++ /* wake kauditd to try and flush the queue */ |
6127 |
++ wake_up_interruptible(&kauditd_wait); |
6128 |
++ |
6129 |
++ add_wait_queue_exclusive(&audit_backlog_wait, &wait); |
6130 |
++ set_current_state(TASK_UNINTERRUPTIBLE); |
6131 |
++ schedule_timeout(audit_backlog_wait_time); |
6132 |
++ remove_wait_queue(&audit_backlog_wait, &wait); |
6133 |
++ } |
6134 |
+ } |
6135 |
+ |
6136 |
+ /* Run custom bind function on netlink socket group connect or bind requests. */ |
6137 |
+@@ -1772,7 +1786,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, |
6138 |
+ * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() |
6139 |
+ * using a PID anchored in the caller's namespace |
6140 |
+ * 2. generator holding the audit_cmd_mutex - we don't want to block |
6141 |
+- * while holding the mutex */ |
6142 |
++ * while holding the mutex, although we do penalize the sender |
6143 |
++ * later in audit_receive() when it is safe to block |
6144 |
++ */ |
6145 |
+ if (!(auditd_test_task(current) || audit_ctl_owner_current())) { |
6146 |
+ long stime = audit_backlog_wait_time; |
6147 |
+ |
6148 |
+diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c |
6149 |
+index 54eb9457b21d3..532682125ef68 100644 |
6150 |
+--- a/kernel/sched/cputime.c |
6151 |
++++ b/kernel/sched/cputime.c |
6152 |
+@@ -146,10 +146,10 @@ void account_guest_time(struct task_struct *p, u64 cputime) |
6153 |
+ |
6154 |
+ /* Add guest time to cpustat. */ |
6155 |
+ if (task_nice(p) > 0) { |
6156 |
+- cpustat[CPUTIME_NICE] += cputime; |
6157 |
++ task_group_account_field(p, CPUTIME_NICE, cputime); |
6158 |
+ cpustat[CPUTIME_GUEST_NICE] += cputime; |
6159 |
+ } else { |
6160 |
+- cpustat[CPUTIME_USER] += cputime; |
6161 |
++ task_group_account_field(p, CPUTIME_USER, cputime); |
6162 |
+ cpustat[CPUTIME_GUEST] += cputime; |
6163 |
+ } |
6164 |
+ } |
6165 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
6166 |
+index b980cc96604fa..70e8cd3954745 100644 |
6167 |
+--- a/kernel/sched/rt.c |
6168 |
++++ b/kernel/sched/rt.c |
6169 |
+@@ -50,11 +50,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime) |
6170 |
+ rt_b->rt_period_timer.function = sched_rt_period_timer; |
6171 |
+ } |
6172 |
+ |
6173 |
+-static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
6174 |
++static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) |
6175 |
+ { |
6176 |
+- if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
6177 |
+- return; |
6178 |
+- |
6179 |
+ raw_spin_lock(&rt_b->rt_runtime_lock); |
6180 |
+ if (!rt_b->rt_period_active) { |
6181 |
+ rt_b->rt_period_active = 1; |
6182 |
+@@ -72,6 +69,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
6183 |
+ raw_spin_unlock(&rt_b->rt_runtime_lock); |
6184 |
+ } |
6185 |
+ |
6186 |
++static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
6187 |
++{ |
6188 |
++ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
6189 |
++ return; |
6190 |
++ |
6191 |
++ do_start_rt_bandwidth(rt_b); |
6192 |
++} |
6193 |
++ |
6194 |
+ void init_rt_rq(struct rt_rq *rt_rq) |
6195 |
+ { |
6196 |
+ struct rt_prio_array *array; |
6197 |
+@@ -980,13 +985,17 @@ static void update_curr_rt(struct rq *rq) |
6198 |
+ |
6199 |
+ for_each_sched_rt_entity(rt_se) { |
6200 |
+ struct rt_rq *rt_rq = rt_rq_of_se(rt_se); |
6201 |
++ int exceeded; |
6202 |
+ |
6203 |
+ if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { |
6204 |
+ raw_spin_lock(&rt_rq->rt_runtime_lock); |
6205 |
+ rt_rq->rt_time += delta_exec; |
6206 |
+- if (sched_rt_runtime_exceeded(rt_rq)) |
6207 |
++ exceeded = sched_rt_runtime_exceeded(rt_rq); |
6208 |
++ if (exceeded) |
6209 |
+ resched_curr(rq); |
6210 |
+ raw_spin_unlock(&rt_rq->rt_runtime_lock); |
6211 |
++ if (exceeded) |
6212 |
++ do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); |
6213 |
+ } |
6214 |
+ } |
6215 |
+ } |
6216 |
+@@ -2655,8 +2664,12 @@ static int sched_rt_global_validate(void) |
6217 |
+ |
6218 |
+ static void sched_rt_do_global(void) |
6219 |
+ { |
6220 |
++ unsigned long flags; |
6221 |
++ |
6222 |
++ raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); |
6223 |
+ def_rt_bandwidth.rt_runtime = global_rt_runtime(); |
6224 |
+ def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); |
6225 |
++ raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); |
6226 |
+ } |
6227 |
+ |
6228 |
+ int sched_rt_handler(struct ctl_table *table, int write, |
6229 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
6230 |
+index 9fd0e72757cfa..0788616696dc4 100644 |
6231 |
+--- a/mm/shmem.c |
6232 |
++++ b/mm/shmem.c |
6233 |
+@@ -451,7 +451,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
6234 |
+ struct shmem_inode_info *info; |
6235 |
+ struct page *page; |
6236 |
+ unsigned long batch = sc ? sc->nr_to_scan : 128; |
6237 |
+- int removed = 0, split = 0; |
6238 |
++ int split = 0; |
6239 |
+ |
6240 |
+ if (list_empty(&sbinfo->shrinklist)) |
6241 |
+ return SHRINK_STOP; |
6242 |
+@@ -466,7 +466,6 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
6243 |
+ /* inode is about to be evicted */ |
6244 |
+ if (!inode) { |
6245 |
+ list_del_init(&info->shrinklist); |
6246 |
+- removed++; |
6247 |
+ goto next; |
6248 |
+ } |
6249 |
+ |
6250 |
+@@ -474,12 +473,12 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
6251 |
+ if (round_up(inode->i_size, PAGE_SIZE) == |
6252 |
+ round_up(inode->i_size, HPAGE_PMD_SIZE)) { |
6253 |
+ list_move(&info->shrinklist, &to_remove); |
6254 |
+- removed++; |
6255 |
+ goto next; |
6256 |
+ } |
6257 |
+ |
6258 |
+ list_move(&info->shrinklist, &list); |
6259 |
+ next: |
6260 |
++ sbinfo->shrinklist_len--; |
6261 |
+ if (!--batch) |
6262 |
+ break; |
6263 |
+ } |
6264 |
+@@ -499,7 +498,7 @@ next: |
6265 |
+ inode = &info->vfs_inode; |
6266 |
+ |
6267 |
+ if (nr_to_split && split >= nr_to_split) |
6268 |
+- goto leave; |
6269 |
++ goto move_back; |
6270 |
+ |
6271 |
+ page = find_get_page(inode->i_mapping, |
6272 |
+ (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); |
6273 |
+@@ -513,38 +512,44 @@ next: |
6274 |
+ } |
6275 |
+ |
6276 |
+ /* |
6277 |
+- * Leave the inode on the list if we failed to lock |
6278 |
+- * the page at this time. |
6279 |
++ * Move the inode on the list back to shrinklist if we failed |
6280 |
++ * to lock the page at this time. |
6281 |
+ * |
6282 |
+ * Waiting for the lock may lead to deadlock in the |
6283 |
+ * reclaim path. |
6284 |
+ */ |
6285 |
+ if (!trylock_page(page)) { |
6286 |
+ put_page(page); |
6287 |
+- goto leave; |
6288 |
++ goto move_back; |
6289 |
+ } |
6290 |
+ |
6291 |
+ ret = split_huge_page(page); |
6292 |
+ unlock_page(page); |
6293 |
+ put_page(page); |
6294 |
+ |
6295 |
+- /* If split failed leave the inode on the list */ |
6296 |
++ /* If split failed move the inode on the list back to shrinklist */ |
6297 |
+ if (ret) |
6298 |
+- goto leave; |
6299 |
++ goto move_back; |
6300 |
+ |
6301 |
+ split++; |
6302 |
+ drop: |
6303 |
+ list_del_init(&info->shrinklist); |
6304 |
+- removed++; |
6305 |
+-leave: |
6306 |
++ goto put; |
6307 |
++move_back: |
6308 |
++ /* |
6309 |
++ * Make sure the inode is either on the global list or deleted |
6310 |
++ * from any local list before iput() since it could be deleted |
6311 |
++ * in another thread once we put the inode (then the local list |
6312 |
++ * is corrupted). |
6313 |
++ */ |
6314 |
++ spin_lock(&sbinfo->shrinklist_lock); |
6315 |
++ list_move(&info->shrinklist, &sbinfo->shrinklist); |
6316 |
++ sbinfo->shrinklist_len++; |
6317 |
++ spin_unlock(&sbinfo->shrinklist_lock); |
6318 |
++put: |
6319 |
+ iput(inode); |
6320 |
+ } |
6321 |
+ |
6322 |
+- spin_lock(&sbinfo->shrinklist_lock); |
6323 |
+- list_splice_tail(&list, &sbinfo->shrinklist); |
6324 |
+- sbinfo->shrinklist_len -= removed; |
6325 |
+- spin_unlock(&sbinfo->shrinklist_lock); |
6326 |
+- |
6327 |
+ return split; |
6328 |
+ } |
6329 |
+ |
6330 |
+diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c |
6331 |
+index 9873684a9d8ff..4764ed73f33bf 100644 |
6332 |
+--- a/net/bluetooth/cmtp/core.c |
6333 |
++++ b/net/bluetooth/cmtp/core.c |
6334 |
+@@ -499,9 +499,7 @@ static int __init cmtp_init(void) |
6335 |
+ { |
6336 |
+ BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); |
6337 |
+ |
6338 |
+- cmtp_init_sockets(); |
6339 |
+- |
6340 |
+- return 0; |
6341 |
++ return cmtp_init_sockets(); |
6342 |
+ } |
6343 |
+ |
6344 |
+ static void __exit cmtp_exit(void) |
6345 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
6346 |
+index 26acacb2fa95f..a5755e0645439 100644 |
6347 |
+--- a/net/bluetooth/hci_core.c |
6348 |
++++ b/net/bluetooth/hci_core.c |
6349 |
+@@ -3263,6 +3263,7 @@ int hci_register_dev(struct hci_dev *hdev) |
6350 |
+ return id; |
6351 |
+ |
6352 |
+ err_wqueue: |
6353 |
++ debugfs_remove_recursive(hdev->debugfs); |
6354 |
+ destroy_workqueue(hdev->workqueue); |
6355 |
+ destroy_workqueue(hdev->req_workqueue); |
6356 |
+ err: |
6357 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
6358 |
+index 937cada5595ee..c0dbb8ad00376 100644 |
6359 |
+--- a/net/bluetooth/hci_event.c |
6360 |
++++ b/net/bluetooth/hci_event.c |
6361 |
+@@ -5391,7 +5391,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
6362 |
+ struct hci_ev_le_advertising_info *ev = ptr; |
6363 |
+ s8 rssi; |
6364 |
+ |
6365 |
+- if (ev->length <= HCI_MAX_AD_LENGTH) { |
6366 |
++ if (ev->length <= HCI_MAX_AD_LENGTH && |
6367 |
++ ev->data + ev->length <= skb_tail_pointer(skb)) { |
6368 |
+ rssi = ev->data[ev->length]; |
6369 |
+ process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
6370 |
+ ev->bdaddr_type, NULL, 0, rssi, |
6371 |
+@@ -5401,6 +5402,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
6372 |
+ } |
6373 |
+ |
6374 |
+ ptr += sizeof(*ev) + ev->length + 1; |
6375 |
++ |
6376 |
++ if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { |
6377 |
++ bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); |
6378 |
++ break; |
6379 |
++ } |
6380 |
+ } |
6381 |
+ |
6382 |
+ hci_dev_unlock(hdev); |
6383 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
6384 |
+index c5380c6baf2e7..4b9d1d6bbf6f9 100644 |
6385 |
+--- a/net/bridge/br_netfilter_hooks.c |
6386 |
++++ b/net/bridge/br_netfilter_hooks.c |
6387 |
+@@ -727,6 +727,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
6388 |
+ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) |
6389 |
+ mtu = nf_bridge->frag_max_size; |
6390 |
+ |
6391 |
++ nf_bridge_update_protocol(skb); |
6392 |
++ nf_bridge_push_encap_header(skb); |
6393 |
++ |
6394 |
+ if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { |
6395 |
+ nf_bridge_info_free(skb); |
6396 |
+ return br_dev_queue_push_xmit(net, sk, skb); |
6397 |
+@@ -744,8 +747,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
6398 |
+ |
6399 |
+ IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; |
6400 |
+ |
6401 |
+- nf_bridge_update_protocol(skb); |
6402 |
+- |
6403 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
6404 |
+ |
6405 |
+ data->vlan_tci = skb->vlan_tci; |
6406 |
+@@ -768,8 +769,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
6407 |
+ |
6408 |
+ IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; |
6409 |
+ |
6410 |
+- nf_bridge_update_protocol(skb); |
6411 |
+- |
6412 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
6413 |
+ data->encap_size = nf_bridge_encap_header_len(skb); |
6414 |
+ data->size = ETH_HLEN + data->encap_size; |
6415 |
+diff --git a/net/can/bcm.c b/net/can/bcm.c |
6416 |
+index e75d3fd7da4f9..353098166031b 100644 |
6417 |
+--- a/net/can/bcm.c |
6418 |
++++ b/net/can/bcm.c |
6419 |
+@@ -105,7 +105,6 @@ struct bcm_op { |
6420 |
+ unsigned long frames_abs, frames_filtered; |
6421 |
+ struct bcm_timeval ival1, ival2; |
6422 |
+ struct hrtimer timer, thrtimer; |
6423 |
+- struct tasklet_struct tsklet, thrtsklet; |
6424 |
+ ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg; |
6425 |
+ int rx_ifindex; |
6426 |
+ int cfsiz; |
6427 |
+@@ -374,25 +373,34 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, |
6428 |
+ } |
6429 |
+ } |
6430 |
+ |
6431 |
+-static void bcm_tx_start_timer(struct bcm_op *op) |
6432 |
++static bool bcm_tx_set_expiry(struct bcm_op *op, struct hrtimer *hrt) |
6433 |
+ { |
6434 |
++ ktime_t ival; |
6435 |
++ |
6436 |
+ if (op->kt_ival1 && op->count) |
6437 |
+- hrtimer_start(&op->timer, |
6438 |
+- ktime_add(ktime_get(), op->kt_ival1), |
6439 |
+- HRTIMER_MODE_ABS); |
6440 |
++ ival = op->kt_ival1; |
6441 |
+ else if (op->kt_ival2) |
6442 |
+- hrtimer_start(&op->timer, |
6443 |
+- ktime_add(ktime_get(), op->kt_ival2), |
6444 |
+- HRTIMER_MODE_ABS); |
6445 |
++ ival = op->kt_ival2; |
6446 |
++ else |
6447 |
++ return false; |
6448 |
++ |
6449 |
++ hrtimer_set_expires(hrt, ktime_add(ktime_get(), ival)); |
6450 |
++ return true; |
6451 |
+ } |
6452 |
+ |
6453 |
+-static void bcm_tx_timeout_tsklet(unsigned long data) |
6454 |
++static void bcm_tx_start_timer(struct bcm_op *op) |
6455 |
+ { |
6456 |
+- struct bcm_op *op = (struct bcm_op *)data; |
6457 |
++ if (bcm_tx_set_expiry(op, &op->timer)) |
6458 |
++ hrtimer_start_expires(&op->timer, HRTIMER_MODE_ABS_SOFT); |
6459 |
++} |
6460 |
++ |
6461 |
++/* bcm_tx_timeout_handler - performs cyclic CAN frame transmissions */ |
6462 |
++static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer) |
6463 |
++{ |
6464 |
++ struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); |
6465 |
+ struct bcm_msg_head msg_head; |
6466 |
+ |
6467 |
+ if (op->kt_ival1 && (op->count > 0)) { |
6468 |
+- |
6469 |
+ op->count--; |
6470 |
+ if (!op->count && (op->flags & TX_COUNTEVT)) { |
6471 |
+ |
6472 |
+@@ -410,22 +418,12 @@ static void bcm_tx_timeout_tsklet(unsigned long data) |
6473 |
+ } |
6474 |
+ bcm_can_tx(op); |
6475 |
+ |
6476 |
+- } else if (op->kt_ival2) |
6477 |
++ } else if (op->kt_ival2) { |
6478 |
+ bcm_can_tx(op); |
6479 |
++ } |
6480 |
+ |
6481 |
+- bcm_tx_start_timer(op); |
6482 |
+-} |
6483 |
+- |
6484 |
+-/* |
6485 |
+- * bcm_tx_timeout_handler - performs cyclic CAN frame transmissions |
6486 |
+- */ |
6487 |
+-static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer) |
6488 |
+-{ |
6489 |
+- struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); |
6490 |
+- |
6491 |
+- tasklet_schedule(&op->tsklet); |
6492 |
+- |
6493 |
+- return HRTIMER_NORESTART; |
6494 |
++ return bcm_tx_set_expiry(op, &op->timer) ? |
6495 |
++ HRTIMER_RESTART : HRTIMER_NORESTART; |
6496 |
+ } |
6497 |
+ |
6498 |
+ /* |
6499 |
+@@ -492,7 +490,7 @@ static void bcm_rx_update_and_send(struct bcm_op *op, |
6500 |
+ /* do not send the saved data - only start throttle timer */ |
6501 |
+ hrtimer_start(&op->thrtimer, |
6502 |
+ ktime_add(op->kt_lastmsg, op->kt_ival2), |
6503 |
+- HRTIMER_MODE_ABS); |
6504 |
++ HRTIMER_MODE_ABS_SOFT); |
6505 |
+ return; |
6506 |
+ } |
6507 |
+ |
6508 |
+@@ -551,14 +549,21 @@ static void bcm_rx_starttimer(struct bcm_op *op) |
6509 |
+ return; |
6510 |
+ |
6511 |
+ if (op->kt_ival1) |
6512 |
+- hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL); |
6513 |
++ hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL_SOFT); |
6514 |
+ } |
6515 |
+ |
6516 |
+-static void bcm_rx_timeout_tsklet(unsigned long data) |
6517 |
++/* bcm_rx_timeout_handler - when the (cyclic) CAN frame reception timed out */ |
6518 |
++static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer) |
6519 |
+ { |
6520 |
+- struct bcm_op *op = (struct bcm_op *)data; |
6521 |
++ struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); |
6522 |
+ struct bcm_msg_head msg_head; |
6523 |
+ |
6524 |
++ /* if user wants to be informed, when cyclic CAN-Messages come back */ |
6525 |
++ if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { |
6526 |
++ /* clear received CAN frames to indicate 'nothing received' */ |
6527 |
++ memset(op->last_frames, 0, op->nframes * op->cfsiz); |
6528 |
++ } |
6529 |
++ |
6530 |
+ /* create notification to user */ |
6531 |
+ memset(&msg_head, 0, sizeof(msg_head)); |
6532 |
+ msg_head.opcode = RX_TIMEOUT; |
6533 |
+@@ -570,25 +575,6 @@ static void bcm_rx_timeout_tsklet(unsigned long data) |
6534 |
+ msg_head.nframes = 0; |
6535 |
+ |
6536 |
+ bcm_send_to_user(op, &msg_head, NULL, 0); |
6537 |
+-} |
6538 |
+- |
6539 |
+-/* |
6540 |
+- * bcm_rx_timeout_handler - when the (cyclic) CAN frame reception timed out |
6541 |
+- */ |
6542 |
+-static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer) |
6543 |
+-{ |
6544 |
+- struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); |
6545 |
+- |
6546 |
+- /* schedule before NET_RX_SOFTIRQ */ |
6547 |
+- tasklet_hi_schedule(&op->tsklet); |
6548 |
+- |
6549 |
+- /* no restart of the timer is done here! */ |
6550 |
+- |
6551 |
+- /* if user wants to be informed, when cyclic CAN-Messages come back */ |
6552 |
+- if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { |
6553 |
+- /* clear received CAN frames to indicate 'nothing received' */ |
6554 |
+- memset(op->last_frames, 0, op->nframes * op->cfsiz); |
6555 |
+- } |
6556 |
+ |
6557 |
+ return HRTIMER_NORESTART; |
6558 |
+ } |
6559 |
+@@ -596,14 +582,12 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer) |
6560 |
+ /* |
6561 |
+ * bcm_rx_do_flush - helper for bcm_rx_thr_flush |
6562 |
+ */ |
6563 |
+-static inline int bcm_rx_do_flush(struct bcm_op *op, int update, |
6564 |
+- unsigned int index) |
6565 |
++static inline int bcm_rx_do_flush(struct bcm_op *op, unsigned int index) |
6566 |
+ { |
6567 |
+ struct canfd_frame *lcf = op->last_frames + op->cfsiz * index; |
6568 |
+ |
6569 |
+ if ((op->last_frames) && (lcf->flags & RX_THR)) { |
6570 |
+- if (update) |
6571 |
+- bcm_rx_changed(op, lcf); |
6572 |
++ bcm_rx_changed(op, lcf); |
6573 |
+ return 1; |
6574 |
+ } |
6575 |
+ return 0; |
6576 |
+@@ -611,11 +595,8 @@ static inline int bcm_rx_do_flush(struct bcm_op *op, int update, |
6577 |
+ |
6578 |
+ /* |
6579 |
+ * bcm_rx_thr_flush - Check for throttled data and send it to the userspace |
6580 |
+- * |
6581 |
+- * update == 0 : just check if throttled data is available (any irq context) |
6582 |
+- * update == 1 : check and send throttled data to userspace (soft_irq context) |
6583 |
+ */ |
6584 |
+-static int bcm_rx_thr_flush(struct bcm_op *op, int update) |
6585 |
++static int bcm_rx_thr_flush(struct bcm_op *op) |
6586 |
+ { |
6587 |
+ int updated = 0; |
6588 |
+ |
6589 |
+@@ -624,24 +605,16 @@ static int bcm_rx_thr_flush(struct bcm_op *op, int update) |
6590 |
+ |
6591 |
+ /* for MUX filter we start at index 1 */ |
6592 |
+ for (i = 1; i < op->nframes; i++) |
6593 |
+- updated += bcm_rx_do_flush(op, update, i); |
6594 |
++ updated += bcm_rx_do_flush(op, i); |
6595 |
+ |
6596 |
+ } else { |
6597 |
+ /* for RX_FILTER_ID and simple filter */ |
6598 |
+- updated += bcm_rx_do_flush(op, update, 0); |
6599 |
++ updated += bcm_rx_do_flush(op, 0); |
6600 |
+ } |
6601 |
+ |
6602 |
+ return updated; |
6603 |
+ } |
6604 |
+ |
6605 |
+-static void bcm_rx_thr_tsklet(unsigned long data) |
6606 |
+-{ |
6607 |
+- struct bcm_op *op = (struct bcm_op *)data; |
6608 |
+- |
6609 |
+- /* push the changed data to the userspace */ |
6610 |
+- bcm_rx_thr_flush(op, 1); |
6611 |
+-} |
6612 |
+- |
6613 |
+ /* |
6614 |
+ * bcm_rx_thr_handler - the time for blocked content updates is over now: |
6615 |
+ * Check for throttled data and send it to the userspace |
6616 |
+@@ -650,9 +623,7 @@ static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer) |
6617 |
+ { |
6618 |
+ struct bcm_op *op = container_of(hrtimer, struct bcm_op, thrtimer); |
6619 |
+ |
6620 |
+- tasklet_schedule(&op->thrtsklet); |
6621 |
+- |
6622 |
+- if (bcm_rx_thr_flush(op, 0)) { |
6623 |
++ if (bcm_rx_thr_flush(op)) { |
6624 |
+ hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2); |
6625 |
+ return HRTIMER_RESTART; |
6626 |
+ } else { |
6627 |
+@@ -748,23 +719,8 @@ static struct bcm_op *bcm_find_op(struct list_head *ops, |
6628 |
+ |
6629 |
+ static void bcm_remove_op(struct bcm_op *op) |
6630 |
+ { |
6631 |
+- if (op->tsklet.func) { |
6632 |
+- while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) || |
6633 |
+- test_bit(TASKLET_STATE_RUN, &op->tsklet.state) || |
6634 |
+- hrtimer_active(&op->timer)) { |
6635 |
+- hrtimer_cancel(&op->timer); |
6636 |
+- tasklet_kill(&op->tsklet); |
6637 |
+- } |
6638 |
+- } |
6639 |
+- |
6640 |
+- if (op->thrtsklet.func) { |
6641 |
+- while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) || |
6642 |
+- test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) || |
6643 |
+- hrtimer_active(&op->thrtimer)) { |
6644 |
+- hrtimer_cancel(&op->thrtimer); |
6645 |
+- tasklet_kill(&op->thrtsklet); |
6646 |
+- } |
6647 |
+- } |
6648 |
++ hrtimer_cancel(&op->timer); |
6649 |
++ hrtimer_cancel(&op->thrtimer); |
6650 |
+ |
6651 |
+ if ((op->frames) && (op->frames != &op->sframe)) |
6652 |
+ kfree(op->frames); |
6653 |
+@@ -998,15 +954,13 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, |
6654 |
+ op->ifindex = ifindex; |
6655 |
+ |
6656 |
+ /* initialize uninitialized (kzalloc) structure */ |
6657 |
+- hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
6658 |
++ hrtimer_init(&op->timer, CLOCK_MONOTONIC, |
6659 |
++ HRTIMER_MODE_REL_SOFT); |
6660 |
+ op->timer.function = bcm_tx_timeout_handler; |
6661 |
+ |
6662 |
+- /* initialize tasklet for tx countevent notification */ |
6663 |
+- tasklet_init(&op->tsklet, bcm_tx_timeout_tsklet, |
6664 |
+- (unsigned long) op); |
6665 |
+- |
6666 |
+ /* currently unused in tx_ops */ |
6667 |
+- hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
6668 |
++ hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, |
6669 |
++ HRTIMER_MODE_REL_SOFT); |
6670 |
+ |
6671 |
+ /* add this bcm_op to the list of the tx_ops */ |
6672 |
+ list_add(&op->list, &bo->tx_ops); |
6673 |
+@@ -1175,20 +1129,14 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, |
6674 |
+ op->rx_ifindex = ifindex; |
6675 |
+ |
6676 |
+ /* initialize uninitialized (kzalloc) structure */ |
6677 |
+- hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
6678 |
++ hrtimer_init(&op->timer, CLOCK_MONOTONIC, |
6679 |
++ HRTIMER_MODE_REL_SOFT); |
6680 |
+ op->timer.function = bcm_rx_timeout_handler; |
6681 |
+ |
6682 |
+- /* initialize tasklet for rx timeout notification */ |
6683 |
+- tasklet_init(&op->tsklet, bcm_rx_timeout_tsklet, |
6684 |
+- (unsigned long) op); |
6685 |
+- |
6686 |
+- hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
6687 |
++ hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, |
6688 |
++ HRTIMER_MODE_REL_SOFT); |
6689 |
+ op->thrtimer.function = bcm_rx_thr_handler; |
6690 |
+ |
6691 |
+- /* initialize tasklet for rx throttle handling */ |
6692 |
+- tasklet_init(&op->thrtsklet, bcm_rx_thr_tsklet, |
6693 |
+- (unsigned long) op); |
6694 |
+- |
6695 |
+ /* add this bcm_op to the list of the rx_ops */ |
6696 |
+ list_add(&op->list, &bo->rx_ops); |
6697 |
+ |
6698 |
+@@ -1234,12 +1182,12 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, |
6699 |
+ */ |
6700 |
+ op->kt_lastmsg = 0; |
6701 |
+ hrtimer_cancel(&op->thrtimer); |
6702 |
+- bcm_rx_thr_flush(op, 1); |
6703 |
++ bcm_rx_thr_flush(op); |
6704 |
+ } |
6705 |
+ |
6706 |
+ if ((op->flags & STARTTIMER) && op->kt_ival1) |
6707 |
+ hrtimer_start(&op->timer, op->kt_ival1, |
6708 |
+- HRTIMER_MODE_REL); |
6709 |
++ HRTIMER_MODE_REL_SOFT); |
6710 |
+ } |
6711 |
+ |
6712 |
+ /* now we can register for can_ids, if we added a new bcm_op */ |
6713 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
6714 |
+index 01496c7cb42d7..7d68c98a00aa8 100644 |
6715 |
+--- a/net/core/filter.c |
6716 |
++++ b/net/core/filter.c |
6717 |
+@@ -5534,9 +5534,9 @@ void bpf_warn_invalid_xdp_action(u32 act) |
6718 |
+ { |
6719 |
+ const u32 act_max = XDP_REDIRECT; |
6720 |
+ |
6721 |
+- WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", |
6722 |
+- act > act_max ? "Illegal" : "Driver unsupported", |
6723 |
+- act); |
6724 |
++ pr_warn_once("%s XDP return value %u, expect packet loss!\n", |
6725 |
++ act > act_max ? "Illegal" : "Driver unsupported", |
6726 |
++ act); |
6727 |
+ } |
6728 |
+ EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
6729 |
+ |
6730 |
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c |
6731 |
+index fe0d255d66c8b..e5dc04cb55992 100644 |
6732 |
+--- a/net/core/net-sysfs.c |
6733 |
++++ b/net/core/net-sysfs.c |
6734 |
+@@ -1616,6 +1616,9 @@ static void remove_queue_kobjects(struct net_device *dev) |
6735 |
+ |
6736 |
+ net_rx_queue_update_kobjects(dev, real_rx, 0); |
6737 |
+ netdev_queue_update_kobjects(dev, real_tx, 0); |
6738 |
++ |
6739 |
++ dev->real_num_rx_queues = 0; |
6740 |
++ dev->real_num_tx_queues = 0; |
6741 |
+ #ifdef CONFIG_SYSFS |
6742 |
+ kset_unregister(dev->queues_kset); |
6743 |
+ #endif |
6744 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
6745 |
+index 26d70c00b0545..3368624be5ecd 100644 |
6746 |
+--- a/net/core/net_namespace.c |
6747 |
++++ b/net/core/net_namespace.c |
6748 |
+@@ -149,8 +149,10 @@ static void ops_exit_list(const struct pernet_operations *ops, |
6749 |
+ { |
6750 |
+ struct net *net; |
6751 |
+ if (ops->exit) { |
6752 |
+- list_for_each_entry(net, net_exit_list, exit_list) |
6753 |
++ list_for_each_entry(net, net_exit_list, exit_list) { |
6754 |
+ ops->exit(net); |
6755 |
++ cond_resched(); |
6756 |
++ } |
6757 |
+ } |
6758 |
+ if (ops->exit_batch) |
6759 |
+ ops->exit_batch(net_exit_list); |
6760 |
+diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
6761 |
+index 2fa1963259880..954c96f4ddd0f 100644 |
6762 |
+--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c |
6763 |
++++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
6764 |
+@@ -509,8 +509,11 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) |
6765 |
+ if (IS_ERR(config)) |
6766 |
+ return PTR_ERR(config); |
6767 |
+ } |
6768 |
+- } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) |
6769 |
++ } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { |
6770 |
++ clusterip_config_entry_put(config); |
6771 |
++ clusterip_config_put(config); |
6772 |
+ return -EINVAL; |
6773 |
++ } |
6774 |
+ |
6775 |
+ ret = nf_ct_netns_get(par->net, par->family); |
6776 |
+ if (ret < 0) { |
6777 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
6778 |
+index e0baa563a4dea..c42cc79895202 100644 |
6779 |
+--- a/net/mac80211/rx.c |
6780 |
++++ b/net/mac80211/rx.c |
6781 |
+@@ -4620,7 +4620,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, |
6782 |
+ goto drop; |
6783 |
+ break; |
6784 |
+ case RX_ENC_VHT: |
6785 |
+- if (WARN_ONCE(status->rate_idx > 9 || |
6786 |
++ if (WARN_ONCE(status->rate_idx > 11 || |
6787 |
+ !status->nss || |
6788 |
+ status->nss > 8, |
6789 |
+ "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", |
6790 |
+diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
6791 |
+index 23f7116d122a2..605d7448c3de1 100644 |
6792 |
+--- a/net/nfc/llcp_sock.c |
6793 |
++++ b/net/nfc/llcp_sock.c |
6794 |
+@@ -796,6 +796,11 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
6795 |
+ |
6796 |
+ lock_sock(sk); |
6797 |
+ |
6798 |
++ if (!llcp_sock->local) { |
6799 |
++ release_sock(sk); |
6800 |
++ return -ENODEV; |
6801 |
++ } |
6802 |
++ |
6803 |
+ if (sk->sk_type == SOCK_DGRAM) { |
6804 |
+ DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, |
6805 |
+ msg->msg_name); |
6806 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
6807 |
+index b3ff610d35045..7c1b1eff84f4c 100644 |
6808 |
+--- a/net/sched/sch_generic.c |
6809 |
++++ b/net/sched/sch_generic.c |
6810 |
+@@ -1367,6 +1367,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, |
6811 |
+ { |
6812 |
+ memset(r, 0, sizeof(*r)); |
6813 |
+ r->overhead = conf->overhead; |
6814 |
++ r->mpu = conf->mpu; |
6815 |
+ r->rate_bytes_ps = max_t(u64, conf->rate, rate64); |
6816 |
+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); |
6817 |
+ r->mult = 1; |
6818 |
+diff --git a/net/unix/garbage.c b/net/unix/garbage.c |
6819 |
+index 8bbe1b8e4ff7f..4d283e26d8162 100644 |
6820 |
+--- a/net/unix/garbage.c |
6821 |
++++ b/net/unix/garbage.c |
6822 |
+@@ -197,8 +197,11 @@ void wait_for_unix_gc(void) |
6823 |
+ { |
6824 |
+ /* If number of inflight sockets is insane, |
6825 |
+ * force a garbage collect right now. |
6826 |
++ * Paired with the WRITE_ONCE() in unix_inflight(), |
6827 |
++ * unix_notinflight() and gc_in_progress(). |
6828 |
+ */ |
6829 |
+- if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) |
6830 |
++ if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && |
6831 |
++ !READ_ONCE(gc_in_progress)) |
6832 |
+ unix_gc(); |
6833 |
+ wait_event(unix_gc_wait, gc_in_progress == false); |
6834 |
+ } |
6835 |
+@@ -218,7 +221,9 @@ void unix_gc(void) |
6836 |
+ if (gc_in_progress) |
6837 |
+ goto out; |
6838 |
+ |
6839 |
+- gc_in_progress = true; |
6840 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
6841 |
++ WRITE_ONCE(gc_in_progress, true); |
6842 |
++ |
6843 |
+ /* First, select candidates for garbage collection. Only |
6844 |
+ * in-flight sockets are considered, and from those only ones |
6845 |
+ * which don't have any external reference. |
6846 |
+@@ -304,7 +309,10 @@ void unix_gc(void) |
6847 |
+ |
6848 |
+ /* All candidates should have been detached by now. */ |
6849 |
+ BUG_ON(!list_empty(&gc_candidates)); |
6850 |
+- gc_in_progress = false; |
6851 |
++ |
6852 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
6853 |
++ WRITE_ONCE(gc_in_progress, false); |
6854 |
++ |
6855 |
+ wake_up(&unix_gc_wait); |
6856 |
+ |
6857 |
+ out: |
6858 |
+diff --git a/net/unix/scm.c b/net/unix/scm.c |
6859 |
+index 83413ade79838..a07b2efbf8b5e 100644 |
6860 |
+--- a/net/unix/scm.c |
6861 |
++++ b/net/unix/scm.c |
6862 |
+@@ -56,7 +56,8 @@ void unix_inflight(struct user_struct *user, struct file *fp) |
6863 |
+ } else { |
6864 |
+ BUG_ON(list_empty(&u->link)); |
6865 |
+ } |
6866 |
+- unix_tot_inflight++; |
6867 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
6868 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); |
6869 |
+ } |
6870 |
+ user->unix_inflight++; |
6871 |
+ spin_unlock(&unix_gc_lock); |
6872 |
+@@ -76,7 +77,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) |
6873 |
+ |
6874 |
+ if (atomic_long_dec_and_test(&u->inflight)) |
6875 |
+ list_del_init(&u->link); |
6876 |
+- unix_tot_inflight--; |
6877 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
6878 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); |
6879 |
+ } |
6880 |
+ user->unix_inflight--; |
6881 |
+ spin_unlock(&unix_gc_lock); |
6882 |
+diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
6883 |
+index 35a020a709852..054897358d904 100644 |
6884 |
+--- a/net/xfrm/xfrm_interface.c |
6885 |
++++ b/net/xfrm/xfrm_interface.c |
6886 |
+@@ -662,11 +662,16 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev, |
6887 |
+ struct netlink_ext_ack *extack) |
6888 |
+ { |
6889 |
+ struct net *net = dev_net(dev); |
6890 |
+- struct xfrm_if_parms p; |
6891 |
++ struct xfrm_if_parms p = {}; |
6892 |
+ struct xfrm_if *xi; |
6893 |
+ int err; |
6894 |
+ |
6895 |
+ xfrmi_netlink_parms(data, &p); |
6896 |
++ if (!p.if_id) { |
6897 |
++ NL_SET_ERR_MSG(extack, "if_id must be non zero"); |
6898 |
++ return -EINVAL; |
6899 |
++ } |
6900 |
++ |
6901 |
+ xi = xfrmi_locate(net, &p); |
6902 |
+ if (xi) |
6903 |
+ return -EEXIST; |
6904 |
+@@ -691,7 +696,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[], |
6905 |
+ { |
6906 |
+ struct xfrm_if *xi = netdev_priv(dev); |
6907 |
+ struct net *net = xi->net; |
6908 |
+- struct xfrm_if_parms p; |
6909 |
++ struct xfrm_if_parms p = {}; |
6910 |
++ |
6911 |
++ if (!p.if_id) { |
6912 |
++ NL_SET_ERR_MSG(extack, "if_id must be non zero"); |
6913 |
++ return -EINVAL; |
6914 |
++ } |
6915 |
+ |
6916 |
+ xfrmi_netlink_parms(data, &p); |
6917 |
+ xi = xfrmi_locate(net, &p); |
6918 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
6919 |
+index f94abe1fdd58f..8d8f9e778cd4f 100644 |
6920 |
+--- a/net/xfrm/xfrm_user.c |
6921 |
++++ b/net/xfrm/xfrm_user.c |
6922 |
+@@ -620,8 +620,13 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, |
6923 |
+ |
6924 |
+ xfrm_smark_init(attrs, &x->props.smark); |
6925 |
+ |
6926 |
+- if (attrs[XFRMA_IF_ID]) |
6927 |
++ if (attrs[XFRMA_IF_ID]) { |
6928 |
+ x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
6929 |
++ if (!x->if_id) { |
6930 |
++ err = -EINVAL; |
6931 |
++ goto error; |
6932 |
++ } |
6933 |
++ } |
6934 |
+ |
6935 |
+ err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); |
6936 |
+ if (err) |
6937 |
+@@ -1327,8 +1332,13 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, |
6938 |
+ |
6939 |
+ mark = xfrm_mark_get(attrs, &m); |
6940 |
+ |
6941 |
+- if (attrs[XFRMA_IF_ID]) |
6942 |
++ if (attrs[XFRMA_IF_ID]) { |
6943 |
+ if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
6944 |
++ if (!if_id) { |
6945 |
++ err = -EINVAL; |
6946 |
++ goto out_noput; |
6947 |
++ } |
6948 |
++ } |
6949 |
+ |
6950 |
+ if (p->info.seq) { |
6951 |
+ x = xfrm_find_acq_byseq(net, mark, p->info.seq); |
6952 |
+@@ -1630,8 +1640,13 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us |
6953 |
+ |
6954 |
+ xfrm_mark_get(attrs, &xp->mark); |
6955 |
+ |
6956 |
+- if (attrs[XFRMA_IF_ID]) |
6957 |
++ if (attrs[XFRMA_IF_ID]) { |
6958 |
+ xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
6959 |
++ if (!xp->if_id) { |
6960 |
++ err = -EINVAL; |
6961 |
++ goto error; |
6962 |
++ } |
6963 |
++ } |
6964 |
+ |
6965 |
+ return xp; |
6966 |
+ error: |
6967 |
+@@ -2813,7 +2828,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_state *x) |
6968 |
+ if (x->props.extra_flags) |
6969 |
+ l += nla_total_size(sizeof(x->props.extra_flags)); |
6970 |
+ if (x->xso.dev) |
6971 |
+- l += nla_total_size(sizeof(x->xso)); |
6972 |
++ l += nla_total_size(sizeof(struct xfrm_user_offload)); |
6973 |
+ if (x->props.smark.v | x->props.smark.m) { |
6974 |
+ l += nla_total_size(sizeof(x->props.smark.v)); |
6975 |
+ l += nla_total_size(sizeof(x->props.smark.m)); |
6976 |
+diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff |
6977 |
+index 8c4fbad2055e5..1046bdc0719d2 100755 |
6978 |
+--- a/scripts/dtc/dtx_diff |
6979 |
++++ b/scripts/dtc/dtx_diff |
6980 |
+@@ -56,12 +56,8 @@ Otherwise DTx is treated as a dts source file (aka .dts). |
6981 |
+ or '/include/' to be processed. |
6982 |
+ |
6983 |
+ If DTx_1 and DTx_2 are in different architectures, then this script |
6984 |
+- may not work since \${ARCH} is part of the include path. Two possible |
6985 |
+- workarounds: |
6986 |
+- |
6987 |
+- `basename $0` \\ |
6988 |
+- <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ |
6989 |
+- <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) |
6990 |
++ may not work since \${ARCH} is part of the include path. The following |
6991 |
++ workaround can be used: |
6992 |
+ |
6993 |
+ `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts |
6994 |
+ `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts |
6995 |
+diff --git a/sound/core/jack.c b/sound/core/jack.c |
6996 |
+index 847a8f3fd06ea..acb531749efb0 100644 |
6997 |
+--- a/sound/core/jack.c |
6998 |
++++ b/sound/core/jack.c |
6999 |
+@@ -68,10 +68,13 @@ static int snd_jack_dev_free(struct snd_device *device) |
7000 |
+ struct snd_card *card = device->card; |
7001 |
+ struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; |
7002 |
+ |
7003 |
++ down_write(&card->controls_rwsem); |
7004 |
+ list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { |
7005 |
+ list_del_init(&jack_kctl->list); |
7006 |
+ snd_ctl_remove(card, jack_kctl->kctl); |
7007 |
+ } |
7008 |
++ up_write(&card->controls_rwsem); |
7009 |
++ |
7010 |
+ if (jack->private_free) |
7011 |
+ jack->private_free(jack); |
7012 |
+ |
7013 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
7014 |
+index 2b3bd6f31e4c1..cd68a0ae82d31 100644 |
7015 |
+--- a/sound/core/oss/pcm_oss.c |
7016 |
++++ b/sound/core/oss/pcm_oss.c |
7017 |
+@@ -2070,7 +2070,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr |
7018 |
+ int err, cmd; |
7019 |
+ |
7020 |
+ #ifdef OSS_DEBUG |
7021 |
+- pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); |
7022 |
++ pr_debug("pcm_oss: trigger = 0x%x\n", trigger); |
7023 |
+ #endif |
7024 |
+ |
7025 |
+ psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
7026 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
7027 |
+index 01b9d62eef14d..b6ed38dec4357 100644 |
7028 |
+--- a/sound/core/pcm.c |
7029 |
++++ b/sound/core/pcm.c |
7030 |
+@@ -874,7 +874,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); |
7031 |
+ static void free_chmap(struct snd_pcm_str *pstr) |
7032 |
+ { |
7033 |
+ if (pstr->chmap_kctl) { |
7034 |
+- snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); |
7035 |
++ struct snd_card *card = pstr->pcm->card; |
7036 |
++ |
7037 |
++ down_write(&card->controls_rwsem); |
7038 |
++ snd_ctl_remove(card, pstr->chmap_kctl); |
7039 |
++ up_write(&card->controls_rwsem); |
7040 |
+ pstr->chmap_kctl = NULL; |
7041 |
+ } |
7042 |
+ } |
7043 |
+diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
7044 |
+index 28b4dd45b8d1d..a23ba648db845 100644 |
7045 |
+--- a/sound/core/seq/seq_queue.c |
7046 |
++++ b/sound/core/seq/seq_queue.c |
7047 |
+@@ -247,12 +247,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) |
7048 |
+ |
7049 |
+ /* -------------------------------------------------------- */ |
7050 |
+ |
7051 |
++#define MAX_CELL_PROCESSES_IN_QUEUE 1000 |
7052 |
++ |
7053 |
+ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
7054 |
+ { |
7055 |
+ unsigned long flags; |
7056 |
+ struct snd_seq_event_cell *cell; |
7057 |
+ snd_seq_tick_time_t cur_tick; |
7058 |
+ snd_seq_real_time_t cur_time; |
7059 |
++ int processed = 0; |
7060 |
+ |
7061 |
+ if (q == NULL) |
7062 |
+ return; |
7063 |
+@@ -275,6 +278,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
7064 |
+ if (!cell) |
7065 |
+ break; |
7066 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
7067 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
7068 |
++ goto out; /* the rest processed at the next batch */ |
7069 |
+ } |
7070 |
+ |
7071 |
+ /* Process time queue... */ |
7072 |
+@@ -284,14 +289,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
7073 |
+ if (!cell) |
7074 |
+ break; |
7075 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
7076 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
7077 |
++ goto out; /* the rest processed at the next batch */ |
7078 |
+ } |
7079 |
+ |
7080 |
++ out: |
7081 |
+ /* free lock */ |
7082 |
+ spin_lock_irqsave(&q->check_lock, flags); |
7083 |
+ if (q->check_again) { |
7084 |
+ q->check_again = 0; |
7085 |
+- spin_unlock_irqrestore(&q->check_lock, flags); |
7086 |
+- goto __again; |
7087 |
++ if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { |
7088 |
++ spin_unlock_irqrestore(&q->check_lock, flags); |
7089 |
++ goto __again; |
7090 |
++ } |
7091 |
+ } |
7092 |
+ q->check_blocked = 0; |
7093 |
+ spin_unlock_irqrestore(&q->check_lock, flags); |
7094 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
7095 |
+index 7f1e763ccca88..b43558ffd78ab 100644 |
7096 |
+--- a/sound/pci/hda/hda_codec.c |
7097 |
++++ b/sound/pci/hda/hda_codec.c |
7098 |
+@@ -1705,8 +1705,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) |
7099 |
+ { |
7100 |
+ int i; |
7101 |
+ struct hda_nid_item *items = codec->mixers.list; |
7102 |
++ |
7103 |
++ down_write(&codec->card->controls_rwsem); |
7104 |
+ for (i = 0; i < codec->mixers.used; i++) |
7105 |
+ snd_ctl_remove(codec->card, items[i].kctl); |
7106 |
++ up_write(&codec->card->controls_rwsem); |
7107 |
+ snd_array_free(&codec->mixers); |
7108 |
+ snd_array_free(&codec->nids); |
7109 |
+ } |
7110 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
7111 |
+index 56d87e53346f1..c23993b9c6238 100644 |
7112 |
+--- a/sound/pci/hda/patch_realtek.c |
7113 |
++++ b/sound/pci/hda/patch_realtek.c |
7114 |
+@@ -1910,6 +1910,7 @@ enum { |
7115 |
+ ALC887_FIXUP_ASUS_BASS, |
7116 |
+ ALC887_FIXUP_BASS_CHMAP, |
7117 |
+ ALC1220_FIXUP_GB_DUAL_CODECS, |
7118 |
++ ALC1220_FIXUP_GB_X570, |
7119 |
+ ALC1220_FIXUP_CLEVO_P950, |
7120 |
+ ALC1220_FIXUP_CLEVO_PB51ED, |
7121 |
+ ALC1220_FIXUP_CLEVO_PB51ED_PINS, |
7122 |
+@@ -2099,6 +2100,29 @@ static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, |
7123 |
+ } |
7124 |
+ } |
7125 |
+ |
7126 |
++static void alc1220_fixup_gb_x570(struct hda_codec *codec, |
7127 |
++ const struct hda_fixup *fix, |
7128 |
++ int action) |
7129 |
++{ |
7130 |
++ static const hda_nid_t conn1[] = { 0x0c }; |
7131 |
++ static const struct coef_fw gb_x570_coefs[] = { |
7132 |
++ WRITE_COEF(0x1a, 0x01c1), |
7133 |
++ WRITE_COEF(0x1b, 0x0202), |
7134 |
++ WRITE_COEF(0x43, 0x3005), |
7135 |
++ {} |
7136 |
++ }; |
7137 |
++ |
7138 |
++ switch (action) { |
7139 |
++ case HDA_FIXUP_ACT_PRE_PROBE: |
7140 |
++ snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); |
7141 |
++ snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); |
7142 |
++ break; |
7143 |
++ case HDA_FIXUP_ACT_INIT: |
7144 |
++ alc_process_coef_fw(codec, gb_x570_coefs); |
7145 |
++ break; |
7146 |
++ } |
7147 |
++} |
7148 |
++ |
7149 |
+ static void alc1220_fixup_clevo_p950(struct hda_codec *codec, |
7150 |
+ const struct hda_fixup *fix, |
7151 |
+ int action) |
7152 |
+@@ -2401,6 +2425,10 @@ static const struct hda_fixup alc882_fixups[] = { |
7153 |
+ .type = HDA_FIXUP_FUNC, |
7154 |
+ .v.func = alc1220_fixup_gb_dual_codecs, |
7155 |
+ }, |
7156 |
++ [ALC1220_FIXUP_GB_X570] = { |
7157 |
++ .type = HDA_FIXUP_FUNC, |
7158 |
++ .v.func = alc1220_fixup_gb_x570, |
7159 |
++ }, |
7160 |
+ [ALC1220_FIXUP_CLEVO_P950] = { |
7161 |
+ .type = HDA_FIXUP_FUNC, |
7162 |
+ .v.func = alc1220_fixup_clevo_p950, |
7163 |
+@@ -2503,7 +2531,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
7164 |
+ SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD), |
7165 |
+ SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), |
7166 |
+ SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), |
7167 |
+- SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950), |
7168 |
++ SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), |
7169 |
+ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), |
7170 |
+ SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), |
7171 |
+ SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), |
7172 |
+diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c |
7173 |
+index 9bd24ad422407..dd77f131ce6c5 100644 |
7174 |
+--- a/sound/soc/codecs/rt5663.c |
7175 |
++++ b/sound/soc/codecs/rt5663.c |
7176 |
+@@ -3446,6 +3446,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663) |
7177 |
+ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
7178 |
+ { |
7179 |
+ int table_size; |
7180 |
++ int ret; |
7181 |
+ |
7182 |
+ device_property_read_u32(dev, "realtek,dc_offset_l_manual", |
7183 |
+ &rt5663->pdata.dc_offset_l_manual); |
7184 |
+@@ -3462,9 +3463,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
7185 |
+ table_size = sizeof(struct impedance_mapping_table) * |
7186 |
+ rt5663->pdata.impedance_sensing_num; |
7187 |
+ rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); |
7188 |
+- device_property_read_u32_array(dev, |
7189 |
++ ret = device_property_read_u32_array(dev, |
7190 |
+ "realtek,impedance_sensing_table", |
7191 |
+ (u32 *)rt5663->imp_table, table_size); |
7192 |
++ if (ret) |
7193 |
++ return ret; |
7194 |
+ } |
7195 |
+ |
7196 |
+ return 0; |
7197 |
+@@ -3489,8 +3492,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, |
7198 |
+ |
7199 |
+ if (pdata) |
7200 |
+ rt5663->pdata = *pdata; |
7201 |
+- else |
7202 |
+- rt5663_parse_dp(rt5663, &i2c->dev); |
7203 |
++ else { |
7204 |
++ ret = rt5663_parse_dp(rt5663, &i2c->dev); |
7205 |
++ if (ret) |
7206 |
++ return ret; |
7207 |
++ } |
7208 |
+ |
7209 |
+ regmap = devm_regmap_init_i2c(i2c, &temp_regmap); |
7210 |
+ if (IS_ERR(regmap)) { |
7211 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
7212 |
+index 902d111016d6f..431ba3db17594 100644 |
7213 |
+--- a/sound/soc/mediatek/mt8173/mt8173-max98090.c |
7214 |
++++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
7215 |
+@@ -169,6 +169,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) |
7216 |
+ if (ret) |
7217 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
7218 |
+ __func__, ret); |
7219 |
++ |
7220 |
++ of_node_put(codec_node); |
7221 |
++ of_node_put(platform_node); |
7222 |
+ return ret; |
7223 |
+ } |
7224 |
+ |
7225 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
7226 |
+index 582174d98c6c9..cdb3940710379 100644 |
7227 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
7228 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
7229 |
+@@ -217,6 +217,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) |
7230 |
+ if (ret) |
7231 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
7232 |
+ __func__, ret); |
7233 |
++ |
7234 |
++ of_node_put(platform_node); |
7235 |
+ return ret; |
7236 |
+ } |
7237 |
+ |
7238 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
7239 |
+index b3670c8a5b8de..242f99716c619 100644 |
7240 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
7241 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
7242 |
+@@ -274,6 +274,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) |
7243 |
+ if (ret) |
7244 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
7245 |
+ __func__, ret); |
7246 |
++ |
7247 |
++ of_node_put(platform_node); |
7248 |
+ return ret; |
7249 |
+ } |
7250 |
+ |
7251 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
7252 |
+index 7a89b4aad182f..14011a70bcc41 100644 |
7253 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
7254 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
7255 |
+@@ -301,6 +301,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) |
7256 |
+ if (ret) |
7257 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
7258 |
+ __func__, ret); |
7259 |
++ |
7260 |
++ of_node_put(platform_node); |
7261 |
+ return ret; |
7262 |
+ } |
7263 |
+ |
7264 |
+diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c |
7265 |
+index b1f09b942410d..e397f5e10e33e 100644 |
7266 |
+--- a/sound/soc/samsung/idma.c |
7267 |
++++ b/sound/soc/samsung/idma.c |
7268 |
+@@ -369,6 +369,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) |
7269 |
+ buf->addr = idma.lp_tx_addr; |
7270 |
+ buf->bytes = idma_hardware.buffer_bytes_max; |
7271 |
+ buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); |
7272 |
++ if (!buf->area) |
7273 |
++ return -ENOMEM; |
7274 |
+ |
7275 |
+ return 0; |
7276 |
+ } |
7277 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
7278 |
+index 8531b490f6f66..273898b358c4b 100644 |
7279 |
+--- a/sound/soc/soc-core.c |
7280 |
++++ b/sound/soc/soc-core.c |
7281 |
+@@ -2752,6 +2752,7 @@ int snd_soc_register_card(struct snd_soc_card *card) |
7282 |
+ card->instantiated = 0; |
7283 |
+ mutex_init(&card->mutex); |
7284 |
+ mutex_init(&card->dapm_mutex); |
7285 |
++ spin_lock_init(&card->dpcm_lock); |
7286 |
+ |
7287 |
+ ret = snd_soc_instantiate_card(card); |
7288 |
+ if (ret != 0) |
7289 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
7290 |
+index af14304645ce8..c03b653bf6ff3 100644 |
7291 |
+--- a/sound/soc/soc-pcm.c |
7292 |
++++ b/sound/soc/soc-pcm.c |
7293 |
+@@ -1221,6 +1221,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, |
7294 |
+ struct snd_soc_pcm_runtime *be, int stream) |
7295 |
+ { |
7296 |
+ struct snd_soc_dpcm *dpcm; |
7297 |
++ unsigned long flags; |
7298 |
+ |
7299 |
+ /* only add new dpcms */ |
7300 |
+ list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { |
7301 |
+@@ -1236,8 +1237,10 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, |
7302 |
+ dpcm->fe = fe; |
7303 |
+ be->dpcm[stream].runtime = fe->dpcm[stream].runtime; |
7304 |
+ dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; |
7305 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7306 |
+ list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); |
7307 |
+ list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); |
7308 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7309 |
+ |
7310 |
+ dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", |
7311 |
+ stream ? "capture" : "playback", fe->dai_link->name, |
7312 |
+@@ -1283,6 +1286,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, |
7313 |
+ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) |
7314 |
+ { |
7315 |
+ struct snd_soc_dpcm *dpcm, *d; |
7316 |
++ unsigned long flags; |
7317 |
+ |
7318 |
+ list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { |
7319 |
+ dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", |
7320 |
+@@ -1302,8 +1306,10 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) |
7321 |
+ #ifdef CONFIG_DEBUG_FS |
7322 |
+ debugfs_remove(dpcm->debugfs_state); |
7323 |
+ #endif |
7324 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7325 |
+ list_del(&dpcm->list_be); |
7326 |
+ list_del(&dpcm->list_fe); |
7327 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7328 |
+ kfree(dpcm); |
7329 |
+ } |
7330 |
+ } |
7331 |
+@@ -1557,10 +1563,13 @@ int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, |
7332 |
+ void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) |
7333 |
+ { |
7334 |
+ struct snd_soc_dpcm *dpcm; |
7335 |
++ unsigned long flags; |
7336 |
+ |
7337 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7338 |
+ list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) |
7339 |
+ dpcm->be->dpcm[stream].runtime_update = |
7340 |
+ SND_SOC_DPCM_UPDATE_NO; |
7341 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7342 |
+ } |
7343 |
+ |
7344 |
+ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, |
7345 |
+@@ -2626,6 +2635,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) |
7346 |
+ struct snd_soc_dpcm *dpcm; |
7347 |
+ enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; |
7348 |
+ int ret; |
7349 |
++ unsigned long flags; |
7350 |
+ |
7351 |
+ dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", |
7352 |
+ stream ? "capture" : "playback", fe->dai_link->name); |
7353 |
+@@ -2695,11 +2705,13 @@ close: |
7354 |
+ dpcm_be_dai_shutdown(fe, stream); |
7355 |
+ disconnect: |
7356 |
+ /* disconnect any non started BEs */ |
7357 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7358 |
+ list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { |
7359 |
+ struct snd_soc_pcm_runtime *be = dpcm->be; |
7360 |
+ if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) |
7361 |
+ dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; |
7362 |
+ } |
7363 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7364 |
+ |
7365 |
+ return ret; |
7366 |
+ } |
7367 |
+@@ -3278,7 +3290,10 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, |
7368 |
+ { |
7369 |
+ struct snd_soc_dpcm *dpcm; |
7370 |
+ int state; |
7371 |
++ int ret = 1; |
7372 |
++ unsigned long flags; |
7373 |
+ |
7374 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7375 |
+ list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { |
7376 |
+ |
7377 |
+ if (dpcm->fe == fe) |
7378 |
+@@ -3287,12 +3302,15 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, |
7379 |
+ state = dpcm->fe->dpcm[stream].state; |
7380 |
+ if (state == SND_SOC_DPCM_STATE_START || |
7381 |
+ state == SND_SOC_DPCM_STATE_PAUSED || |
7382 |
+- state == SND_SOC_DPCM_STATE_SUSPEND) |
7383 |
+- return 0; |
7384 |
++ state == SND_SOC_DPCM_STATE_SUSPEND) { |
7385 |
++ ret = 0; |
7386 |
++ break; |
7387 |
++ } |
7388 |
+ } |
7389 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7390 |
+ |
7391 |
+ /* it's safe to free/stop this BE DAI */ |
7392 |
+- return 1; |
7393 |
++ return ret; |
7394 |
+ } |
7395 |
+ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_free_stop); |
7396 |
+ |
7397 |
+@@ -3305,7 +3323,10 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, |
7398 |
+ { |
7399 |
+ struct snd_soc_dpcm *dpcm; |
7400 |
+ int state; |
7401 |
++ int ret = 1; |
7402 |
++ unsigned long flags; |
7403 |
+ |
7404 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7405 |
+ list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { |
7406 |
+ |
7407 |
+ if (dpcm->fe == fe) |
7408 |
+@@ -3315,12 +3336,15 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, |
7409 |
+ if (state == SND_SOC_DPCM_STATE_START || |
7410 |
+ state == SND_SOC_DPCM_STATE_PAUSED || |
7411 |
+ state == SND_SOC_DPCM_STATE_SUSPEND || |
7412 |
+- state == SND_SOC_DPCM_STATE_PREPARE) |
7413 |
+- return 0; |
7414 |
++ state == SND_SOC_DPCM_STATE_PREPARE) { |
7415 |
++ ret = 0; |
7416 |
++ break; |
7417 |
++ } |
7418 |
+ } |
7419 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7420 |
+ |
7421 |
+ /* it's safe to change hw_params */ |
7422 |
+- return 1; |
7423 |
++ return ret; |
7424 |
+ } |
7425 |
+ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); |
7426 |
+ |
7427 |
+@@ -3359,6 +3383,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
7428 |
+ struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; |
7429 |
+ struct snd_soc_dpcm *dpcm; |
7430 |
+ ssize_t offset = 0; |
7431 |
++ unsigned long flags; |
7432 |
+ |
7433 |
+ /* FE state */ |
7434 |
+ offset += scnprintf(buf + offset, size - offset, |
7435 |
+@@ -3386,6 +3411,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
7436 |
+ goto out; |
7437 |
+ } |
7438 |
+ |
7439 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
7440 |
+ list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { |
7441 |
+ struct snd_soc_pcm_runtime *be = dpcm->be; |
7442 |
+ params = &dpcm->hw_params; |
7443 |
+@@ -3406,7 +3432,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
7444 |
+ params_channels(params), |
7445 |
+ params_rate(params)); |
7446 |
+ } |
7447 |
+- |
7448 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
7449 |
+ out: |
7450 |
+ return offset; |
7451 |
+ } |
7452 |
+diff --git a/sound/soc/uniphier/Kconfig b/sound/soc/uniphier/Kconfig |
7453 |
+index aa3592ee1358b..ddfa6424c656b 100644 |
7454 |
+--- a/sound/soc/uniphier/Kconfig |
7455 |
++++ b/sound/soc/uniphier/Kconfig |
7456 |
+@@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 |
7457 |
+ tristate "UniPhier LD11/LD20 Device Driver" |
7458 |
+ depends on SND_SOC_UNIPHIER |
7459 |
+ select SND_SOC_UNIPHIER_AIO |
7460 |
+- select SND_SOC_UNIPHIER_AIO_DMA |
7461 |
+ help |
7462 |
+ This adds ASoC driver for Socionext UniPhier LD11/LD20 |
7463 |
+ input and output that can be used with other codecs. |
7464 |
+@@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 |
7465 |
+ tristate "UniPhier PXs2 Device Driver" |
7466 |
+ depends on SND_SOC_UNIPHIER |
7467 |
+ select SND_SOC_UNIPHIER_AIO |
7468 |
+- select SND_SOC_UNIPHIER_AIO_DMA |
7469 |
+ help |
7470 |
+ This adds ASoC driver for Socionext UniPhier PXs2 |
7471 |
+ input and output that can be used with other codecs. |