1 |
commit: d637b296d34e7ab9fa87c0049d8bc35f5e0a088f |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 27 11:40:29 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 27 11:40:29 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d637b296 |
7 |
|
8 |
Linux patch 4.14.263 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1262_linux-4.14.263.patch | 5609 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 5613 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 2d45cc2a..7ba8ed5f 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1095,6 +1095,10 @@ Patch: 1261_linux-4.14.262.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.262 |
23 |
|
24 |
+Patch: 1262_linux-4.14.263.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.263 |
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/1262_linux-4.14.263.patch b/1262_linux-4.14.263.patch |
33 |
new file mode 100644 |
34 |
index 00000000..2058dddb |
35 |
--- /dev/null |
36 |
+++ b/1262_linux-4.14.263.patch |
37 |
@@ -0,0 +1,5609 @@ |
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 33ffaa163c2bc..0d754c4d8925f 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 14 |
59 |
+-SUBLEVEL = 262 |
60 |
++SUBLEVEL = 263 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = Petit Gorille |
63 |
+ |
64 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
65 |
+index a9c3eef6c4e09..3307d816050fe 100644 |
66 |
+--- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
67 |
++++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
68 |
+@@ -351,7 +351,7 @@ |
69 |
+ |
70 |
+ ccplex@e000000 { |
71 |
+ compatible = "nvidia,tegra186-ccplex-cluster"; |
72 |
+- reg = <0x0 0x0e000000 0x0 0x3fffff>; |
73 |
++ reg = <0x0 0x0e000000 0x0 0x400000>; |
74 |
+ |
75 |
+ nvidia,bpmp = <&bpmp>; |
76 |
+ }; |
77 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
78 |
+index 94697bab3805f..a961b81060004 100644 |
79 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
80 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
81 |
+@@ -26,8 +26,8 @@ |
82 |
+ #size-cells = <2>; |
83 |
+ |
84 |
+ aliases { |
85 |
+- sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ |
86 |
+- sdhc2 = &sdhc_2; /* SDC2 SD card slot */ |
87 |
++ mmc0 = &sdhc_1; /* SDC1 eMMC slot */ |
88 |
++ mmc1 = &sdhc_2; /* SDC2 SD card slot */ |
89 |
+ }; |
90 |
+ |
91 |
+ chosen { }; |
92 |
+diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c |
93 |
+index d2a5054b0492b..73f2534b9676d 100644 |
94 |
+--- a/arch/mips/bcm63xx/clk.c |
95 |
++++ b/arch/mips/bcm63xx/clk.c |
96 |
+@@ -343,6 +343,12 @@ struct clk *clk_get_parent(struct clk *clk) |
97 |
+ } |
98 |
+ EXPORT_SYMBOL(clk_get_parent); |
99 |
+ |
100 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
101 |
++{ |
102 |
++ return 0; |
103 |
++} |
104 |
++EXPORT_SYMBOL(clk_set_parent); |
105 |
++ |
106 |
+ unsigned long clk_get_rate(struct clk *clk) |
107 |
+ { |
108 |
+ if (!clk) |
109 |
+diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c |
110 |
+index e1e24118c169e..ed42fc27033c4 100644 |
111 |
+--- a/arch/mips/cavium-octeon/octeon-platform.c |
112 |
++++ b/arch/mips/cavium-octeon/octeon-platform.c |
113 |
+@@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) |
114 |
+ |
115 |
+ pd->dev.platform_data = &octeon_ehci_pdata; |
116 |
+ octeon_ehci_hw_start(&pd->dev); |
117 |
++ put_device(&pd->dev); |
118 |
+ |
119 |
+ return ret; |
120 |
+ } |
121 |
+@@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) |
122 |
+ |
123 |
+ pd->dev.platform_data = &octeon_ohci_pdata; |
124 |
+ octeon_ohci_hw_start(&pd->dev); |
125 |
++ put_device(&pd->dev); |
126 |
+ |
127 |
+ return ret; |
128 |
+ } |
129 |
+diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c |
130 |
+index 75189ff2f3c78..3465452e28195 100644 |
131 |
+--- a/arch/mips/cavium-octeon/octeon-usb.c |
132 |
++++ b/arch/mips/cavium-octeon/octeon-usb.c |
133 |
+@@ -543,6 +543,7 @@ static int __init dwc3_octeon_device_init(void) |
134 |
+ devm_iounmap(&pdev->dev, base); |
135 |
+ devm_release_mem_region(&pdev->dev, res->start, |
136 |
+ resource_size(res)); |
137 |
++ put_device(&pdev->dev); |
138 |
+ } |
139 |
+ } while (node != NULL); |
140 |
+ |
141 |
+diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
142 |
+index 62787765575ef..ce6e5fddce0bf 100644 |
143 |
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
144 |
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
145 |
+@@ -315,7 +315,7 @@ enum cvmx_chip_types_enum { |
146 |
+ |
147 |
+ /* Functions to return string based on type */ |
148 |
+ #define ENUM_BRD_TYPE_CASE(x) \ |
149 |
+- case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ |
150 |
++ case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ |
151 |
+ static inline const char *cvmx_board_type_to_string(enum |
152 |
+ cvmx_board_types_enum type) |
153 |
+ { |
154 |
+@@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum |
155 |
+ } |
156 |
+ |
157 |
+ #define ENUM_CHIP_TYPE_CASE(x) \ |
158 |
+- case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ |
159 |
++ case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ |
160 |
+ static inline const char *cvmx_chip_type_to_string(enum |
161 |
+ cvmx_chip_types_enum type) |
162 |
+ { |
163 |
+diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
164 |
+index a8e309dcd38d7..f5fab99d1751c 100644 |
165 |
+--- a/arch/mips/lantiq/clk.c |
166 |
++++ b/arch/mips/lantiq/clk.c |
167 |
+@@ -166,6 +166,12 @@ struct clk *clk_get_parent(struct clk *clk) |
168 |
+ } |
169 |
+ EXPORT_SYMBOL(clk_get_parent); |
170 |
+ |
171 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
172 |
++{ |
173 |
++ return 0; |
174 |
++} |
175 |
++EXPORT_SYMBOL(clk_set_parent); |
176 |
++ |
177 |
+ static inline u32 get_counter_resolution(void) |
178 |
+ { |
179 |
+ u32 res; |
180 |
+diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c |
181 |
+index 1e4658eee13fb..5a535220d7cd8 100644 |
182 |
+--- a/arch/mips/mm/gup.c |
183 |
++++ b/arch/mips/mm/gup.c |
184 |
+@@ -272,7 +272,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
185 |
+ next = pgd_addr_end(addr, end); |
186 |
+ if (pgd_none(pgd)) |
187 |
+ goto slow; |
188 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
189 |
++ /* |
190 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
191 |
++ * because get_user_pages() may need to cause an early COW in |
192 |
++ * order to avoid confusing the normal COW routines. So only |
193 |
++ * targets that are already writable are safe to do by just |
194 |
++ * looking at the page tables. |
195 |
++ */ |
196 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
197 |
+ goto slow; |
198 |
+ } while (pgdp++, addr = next, addr != end); |
199 |
+ local_irq_enable(); |
200 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
201 |
+index 9a898d68f4a0d..346456c43aa0b 100644 |
202 |
+--- a/arch/parisc/kernel/traps.c |
203 |
++++ b/arch/parisc/kernel/traps.c |
204 |
+@@ -795,7 +795,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
205 |
+ * unless pagefault_disable() was called before. |
206 |
+ */ |
207 |
+ |
208 |
+- if (fault_space == 0 && !faulthandler_disabled()) |
209 |
++ if (faulthandler_disabled() || fault_space == 0) |
210 |
+ { |
211 |
+ /* Clean up and return if in exception table. */ |
212 |
+ if (fixup_exception(regs)) |
213 |
+diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
214 |
+index 7f60b60601764..39b1c1fa0c81f 100644 |
215 |
+--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
216 |
++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
217 |
+@@ -78,6 +78,7 @@ fman0: fman@400000 { |
218 |
+ #size-cells = <0>; |
219 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
220 |
+ reg = <0xfc000 0x1000>; |
221 |
++ fsl,erratum-a009885; |
222 |
+ }; |
223 |
+ |
224 |
+ xmdio0: mdio@fd000 { |
225 |
+@@ -85,6 +86,7 @@ fman0: fman@400000 { |
226 |
+ #size-cells = <0>; |
227 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
228 |
+ reg = <0xfd000 0x1000>; |
229 |
++ fsl,erratum-a009885; |
230 |
+ }; |
231 |
+ |
232 |
+ ptp_timer0: ptp-timer@fe000 { |
233 |
+diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c |
234 |
+index 6537cba1a7580..d1a2fc7186ce7 100644 |
235 |
+--- a/arch/powerpc/kernel/btext.c |
236 |
++++ b/arch/powerpc/kernel/btext.c |
237 |
+@@ -258,8 +258,10 @@ int __init btext_find_display(int allow_nonstdout) |
238 |
+ rc = btext_initialize(np); |
239 |
+ printk("result: %d\n", rc); |
240 |
+ } |
241 |
+- if (rc == 0) |
242 |
++ if (rc == 0) { |
243 |
++ of_node_put(np); |
244 |
+ break; |
245 |
++ } |
246 |
+ } |
247 |
+ return rc; |
248 |
+ } |
249 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
250 |
+index f8782c7ef50f1..7f049a60747e9 100644 |
251 |
+--- a/arch/powerpc/kernel/prom_init.c |
252 |
++++ b/arch/powerpc/kernel/prom_init.c |
253 |
+@@ -2774,7 +2774,7 @@ static void __init fixup_device_tree_efika_add_phy(void) |
254 |
+ |
255 |
+ /* Check if the phy-handle property exists - bail if it does */ |
256 |
+ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); |
257 |
+- if (!rv) |
258 |
++ if (rv <= 0) |
259 |
+ return; |
260 |
+ |
261 |
+ /* |
262 |
+diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
263 |
+index 7c7aa7c98ba31..cf25b95ceee13 100644 |
264 |
+--- a/arch/powerpc/kernel/smp.c |
265 |
++++ b/arch/powerpc/kernel/smp.c |
266 |
+@@ -1009,10 +1009,12 @@ void start_secondary(void *unused) |
267 |
+ BUG(); |
268 |
+ } |
269 |
+ |
270 |
++#ifdef CONFIG_PROFILING |
271 |
+ int setup_profiling_timer(unsigned int multiplier) |
272 |
+ { |
273 |
+ return 0; |
274 |
+ } |
275 |
++#endif |
276 |
+ |
277 |
+ #ifdef CONFIG_SCHED_SMT |
278 |
+ /* cpumask of CPUs with asymetric SMT dependancy */ |
279 |
+diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c |
280 |
+index ce848ff84eddf..1617767ebc9ae 100644 |
281 |
+--- a/arch/powerpc/kernel/watchdog.c |
282 |
++++ b/arch/powerpc/kernel/watchdog.c |
283 |
+@@ -106,6 +106,10 @@ static void set_cpumask_stuck(const struct cpumask *cpumask, u64 tb) |
284 |
+ { |
285 |
+ cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); |
286 |
+ cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); |
287 |
++ /* |
288 |
++ * See wd_smp_clear_cpu_pending() |
289 |
++ */ |
290 |
++ smp_mb(); |
291 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
292 |
+ wd_smp_last_reset_tb = tb; |
293 |
+ cpumask_andnot(&wd_smp_cpus_pending, |
294 |
+@@ -177,13 +181,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) |
295 |
+ wd_smp_lock(&flags); |
296 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); |
297 |
+ wd_smp_unlock(&flags); |
298 |
++ } else { |
299 |
++ /* |
300 |
++ * The last CPU to clear pending should have reset the |
301 |
++ * watchdog so we generally should not find it empty |
302 |
++ * here if our CPU was clear. However it could happen |
303 |
++ * due to a rare race with another CPU taking the |
304 |
++ * last CPU out of the mask concurrently. |
305 |
++ * |
306 |
++ * We can't add a warning for it. But just in case |
307 |
++ * there is a problem with the watchdog that is causing |
308 |
++ * the mask to not be reset, try to kick it along here. |
309 |
++ */ |
310 |
++ if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) |
311 |
++ goto none_pending; |
312 |
+ } |
313 |
+ return; |
314 |
+ } |
315 |
++ |
316 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); |
317 |
++ |
318 |
++ /* |
319 |
++ * Order the store to clear pending with the load(s) to check all |
320 |
++ * words in the pending mask to check they are all empty. This orders |
321 |
++ * with the same barrier on another CPU. This prevents two CPUs |
322 |
++ * clearing the last 2 pending bits, but neither seeing the other's |
323 |
++ * store when checking if the mask is empty, and missing an empty |
324 |
++ * mask, which ends with a false positive. |
325 |
++ */ |
326 |
++ smp_mb(); |
327 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
328 |
+ unsigned long flags; |
329 |
+ |
330 |
++none_pending: |
331 |
++ /* |
332 |
++ * Double check under lock because more than one CPU could see |
333 |
++ * a clear mask with the lockless check after clearing their |
334 |
++ * pending bits. |
335 |
++ */ |
336 |
+ wd_smp_lock(&flags); |
337 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
338 |
+ wd_smp_last_reset_tb = tb; |
339 |
+@@ -276,8 +311,12 @@ void arch_touch_nmi_watchdog(void) |
340 |
+ { |
341 |
+ unsigned long ticks = tb_ticks_per_usec * wd_timer_period_ms * 1000; |
342 |
+ int cpu = smp_processor_id(); |
343 |
+- u64 tb = get_tb(); |
344 |
++ u64 tb; |
345 |
++ |
346 |
++ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
347 |
++ return; |
348 |
+ |
349 |
++ tb = get_tb(); |
350 |
+ if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { |
351 |
+ per_cpu(wd_timer_tb, cpu) = tb; |
352 |
+ wd_smp_clear_cpu_pending(cpu, tb); |
353 |
+diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c |
354 |
+index 4b91ad08eefd9..c4f352387aec3 100644 |
355 |
+--- a/arch/powerpc/platforms/cell/iommu.c |
356 |
++++ b/arch/powerpc/platforms/cell/iommu.c |
357 |
+@@ -1088,6 +1088,7 @@ static int __init cell_iommu_fixed_mapping_init(void) |
358 |
+ if (hbase < dbase || (hend > (dbase + dsize))) { |
359 |
+ pr_debug("iommu: hash window doesn't fit in" |
360 |
+ "real DMA window\n"); |
361 |
++ of_node_put(np); |
362 |
+ return -1; |
363 |
+ } |
364 |
+ } |
365 |
+diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c |
366 |
+index a88944db9fc39..97ac2622ee4e3 100644 |
367 |
+--- a/arch/powerpc/platforms/cell/pervasive.c |
368 |
++++ b/arch/powerpc/platforms/cell/pervasive.c |
369 |
+@@ -90,6 +90,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs) |
370 |
+ switch (regs->msr & SRR1_WAKEMASK) { |
371 |
+ case SRR1_WAKEDEC: |
372 |
+ set_dec(1); |
373 |
++ break; |
374 |
+ case SRR1_WAKEEE: |
375 |
+ /* |
376 |
+ * Handle these when interrupts get re-enabled and we take |
377 |
+diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
378 |
+index bf4a125faec66..db2ea6b6889de 100644 |
379 |
+--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
380 |
++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
381 |
+@@ -220,6 +220,7 @@ void hlwd_pic_probe(void) |
382 |
+ irq_set_chained_handler(cascade_virq, |
383 |
+ hlwd_pic_irq_cascade); |
384 |
+ hlwd_irq_host = host; |
385 |
++ of_node_put(np); |
386 |
+ break; |
387 |
+ } |
388 |
+ } |
389 |
+diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c |
390 |
+index 6c7ad1d8b32ed..21f0edcfb84ad 100644 |
391 |
+--- a/arch/powerpc/platforms/powernv/opal-lpc.c |
392 |
++++ b/arch/powerpc/platforms/powernv/opal-lpc.c |
393 |
+@@ -400,6 +400,7 @@ void __init opal_lpc_init(void) |
394 |
+ if (!of_get_property(np, "primary", NULL)) |
395 |
+ continue; |
396 |
+ opal_lpc_chip_id = of_get_ibm_chip_id(np); |
397 |
++ of_node_put(np); |
398 |
+ break; |
399 |
+ } |
400 |
+ if (opal_lpc_chip_id < 0) |
401 |
+diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c |
402 |
+index 9bce54eac0b07..f26ca7fbd44ef 100644 |
403 |
+--- a/arch/s390/mm/gup.c |
404 |
++++ b/arch/s390/mm/gup.c |
405 |
+@@ -285,7 +285,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
406 |
+ |
407 |
+ might_sleep(); |
408 |
+ start &= PAGE_MASK; |
409 |
+- nr = __get_user_pages_fast(start, nr_pages, write, pages); |
410 |
++ /* |
411 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
412 |
++ * because get_user_pages() may need to cause an early COW in |
413 |
++ * order to avoid confusing the normal COW routines. So only |
414 |
++ * targets that are already writable are safe to do by just |
415 |
++ * looking at the page tables. |
416 |
++ */ |
417 |
++ nr = __get_user_pages_fast(start, nr_pages, 1, pages); |
418 |
+ if (nr == nr_pages) |
419 |
+ return nr; |
420 |
+ |
421 |
+diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c |
422 |
+index 8045b5bb7075e..4abfc37dd7fe8 100644 |
423 |
+--- a/arch/sh/mm/gup.c |
424 |
++++ b/arch/sh/mm/gup.c |
425 |
+@@ -240,7 +240,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
426 |
+ next = pgd_addr_end(addr, end); |
427 |
+ if (pgd_none(pgd)) |
428 |
+ goto slow; |
429 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
430 |
++ /* |
431 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
432 |
++ * because get_user_pages() may need to cause an early COW in |
433 |
++ * order to avoid confusing the normal COW routines. So only |
434 |
++ * targets that are already writable are safe to do by just |
435 |
++ * looking at the page tables. |
436 |
++ */ |
437 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
438 |
+ goto slow; |
439 |
+ } while (pgdp++, addr = next, addr != end); |
440 |
+ local_irq_enable(); |
441 |
+diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c |
442 |
+index 5335ba3c850ed..50593ca021449 100644 |
443 |
+--- a/arch/sparc/mm/gup.c |
444 |
++++ b/arch/sparc/mm/gup.c |
445 |
+@@ -262,7 +262,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
446 |
+ next = pgd_addr_end(addr, end); |
447 |
+ if (pgd_none(pgd)) |
448 |
+ goto slow; |
449 |
+- if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) |
450 |
++ /* |
451 |
++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, |
452 |
++ * because get_user_pages() may need to cause an early COW in |
453 |
++ * order to avoid confusing the normal COW routines. So only |
454 |
++ * targets that are already writable are safe to do by just |
455 |
++ * looking at the page tables. |
456 |
++ */ |
457 |
++ if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) |
458 |
+ goto slow; |
459 |
+ } while (pgdp++, addr = next, addr != end); |
460 |
+ |
461 |
+diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h |
462 |
+index a74449b5b0e31..12ad7c435e97f 100644 |
463 |
+--- a/arch/um/include/shared/registers.h |
464 |
++++ b/arch/um/include/shared/registers.h |
465 |
+@@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); |
466 |
+ extern int save_fpx_registers(int pid, unsigned long *fp_regs); |
467 |
+ extern int restore_fpx_registers(int pid, unsigned long *fp_regs); |
468 |
+ extern int save_registers(int pid, struct uml_pt_regs *regs); |
469 |
+-extern int restore_registers(int pid, struct uml_pt_regs *regs); |
470 |
+-extern int init_registers(int pid); |
471 |
++extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); |
472 |
++extern int init_pid_registers(int pid); |
473 |
+ extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); |
474 |
+ extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
475 |
+ extern int get_fp_registers(int pid, unsigned long *regs); |
476 |
+diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c |
477 |
+index 2ff8d4fe83c4f..34a5963bd7efd 100644 |
478 |
+--- a/arch/um/os-Linux/registers.c |
479 |
++++ b/arch/um/os-Linux/registers.c |
480 |
+@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) |
481 |
+ return 0; |
482 |
+ } |
483 |
+ |
484 |
+-int restore_registers(int pid, struct uml_pt_regs *regs) |
485 |
++int restore_pid_registers(int pid, struct uml_pt_regs *regs) |
486 |
+ { |
487 |
+ int err; |
488 |
+ |
489 |
+@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) |
490 |
+ static unsigned long exec_regs[MAX_REG_NR]; |
491 |
+ static unsigned long exec_fp_regs[FP_SIZE]; |
492 |
+ |
493 |
+-int init_registers(int pid) |
494 |
++int init_pid_registers(int pid) |
495 |
+ { |
496 |
+ int err; |
497 |
+ |
498 |
+diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c |
499 |
+index 82bf5f8442ba4..2c75f2d638681 100644 |
500 |
+--- a/arch/um/os-Linux/start_up.c |
501 |
++++ b/arch/um/os-Linux/start_up.c |
502 |
+@@ -336,7 +336,7 @@ void __init os_early_checks(void) |
503 |
+ check_tmpexec(); |
504 |
+ |
505 |
+ pid = start_ptraced_child(); |
506 |
+- if (init_registers(pid)) |
507 |
++ if (init_pid_registers(pid)) |
508 |
+ fatal("Failed to initialize default registers"); |
509 |
+ stop_ptraced_child(pid, 1, 1); |
510 |
+ } |
511 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
512 |
+index 94aa91b09c288..2778b66aee8fc 100644 |
513 |
+--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c |
514 |
++++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
515 |
+@@ -354,7 +354,7 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf, |
516 |
+ char buf[MAX_FLAG_OPT_SIZE], *__buf; |
517 |
+ int err; |
518 |
+ |
519 |
+- if (cnt > MAX_FLAG_OPT_SIZE) |
520 |
++ if (!cnt || cnt > MAX_FLAG_OPT_SIZE) |
521 |
+ return -EINVAL; |
522 |
+ |
523 |
+ if (copy_from_user(&buf, ubuf, cnt)) |
524 |
+diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c |
525 |
+index 58f51667e2e4b..8249685b40960 100644 |
526 |
+--- a/arch/x86/um/syscalls_64.c |
527 |
++++ b/arch/x86/um/syscalls_64.c |
528 |
+@@ -11,6 +11,7 @@ |
529 |
+ #include <linux/uaccess.h> |
530 |
+ #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
531 |
+ #include <os.h> |
532 |
++#include <registers.h> |
533 |
+ |
534 |
+ long arch_prctl(struct task_struct *task, int option, |
535 |
+ unsigned long __user *arg2) |
536 |
+@@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, |
537 |
+ switch (option) { |
538 |
+ case ARCH_SET_FS: |
539 |
+ case ARCH_SET_GS: |
540 |
+- ret = restore_registers(pid, ¤t->thread.regs.regs); |
541 |
++ ret = restore_pid_registers(pid, ¤t->thread.regs.regs); |
542 |
+ if (ret) |
543 |
+ return ret; |
544 |
+ break; |
545 |
+diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c |
546 |
+index f787651348c11..9f4dbdb70111a 100644 |
547 |
+--- a/drivers/acpi/acpica/exoparg1.c |
548 |
++++ b/drivers/acpi/acpica/exoparg1.c |
549 |
+@@ -1041,7 +1041,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
550 |
+ (walk_state, return_desc, |
551 |
+ &temp_desc); |
552 |
+ if (ACPI_FAILURE(status)) { |
553 |
+- goto cleanup; |
554 |
++ return_ACPI_STATUS |
555 |
++ (status); |
556 |
+ } |
557 |
+ |
558 |
+ return_desc = temp_desc; |
559 |
+diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c |
560 |
+index 7f8c57177819f..45b392fa36657 100644 |
561 |
+--- a/drivers/acpi/acpica/hwesleep.c |
562 |
++++ b/drivers/acpi/acpica/hwesleep.c |
563 |
+@@ -138,7 +138,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) |
564 |
+ |
565 |
+ /* Flush caches, as per ACPI specification */ |
566 |
+ |
567 |
+- ACPI_FLUSH_CPU_CACHE(); |
568 |
++ if (sleep_state < ACPI_STATE_S4) { |
569 |
++ ACPI_FLUSH_CPU_CACHE(); |
570 |
++ } |
571 |
+ |
572 |
+ status = acpi_os_enter_sleep(sleep_state, sleep_control, 0); |
573 |
+ if (status == AE_CTRL_TERMINATE) { |
574 |
+diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c |
575 |
+index 2c54d08b20ca6..9e50529bb3cc9 100644 |
576 |
+--- a/drivers/acpi/acpica/hwsleep.c |
577 |
++++ b/drivers/acpi/acpica/hwsleep.c |
578 |
+@@ -149,7 +149,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) |
579 |
+ |
580 |
+ /* Flush caches, as per ACPI specification */ |
581 |
+ |
582 |
+- ACPI_FLUSH_CPU_CACHE(); |
583 |
++ if (sleep_state < ACPI_STATE_S4) { |
584 |
++ ACPI_FLUSH_CPU_CACHE(); |
585 |
++ } |
586 |
+ |
587 |
+ status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); |
588 |
+ if (status == AE_CTRL_TERMINATE) { |
589 |
+diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c |
590 |
+index 827c3242225d9..b3c7736611908 100644 |
591 |
+--- a/drivers/acpi/acpica/hwxfsleep.c |
592 |
++++ b/drivers/acpi/acpica/hwxfsleep.c |
593 |
+@@ -223,8 +223,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) |
594 |
+ return_ACPI_STATUS(status); |
595 |
+ } |
596 |
+ |
597 |
+- ACPI_FLUSH_CPU_CACHE(); |
598 |
+- |
599 |
+ status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
600 |
+ (u32)acpi_gbl_FADT.s4_bios_request, 8); |
601 |
+ |
602 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
603 |
+index 61a979d0fbc5a..64a90ba71f18c 100644 |
604 |
+--- a/drivers/acpi/acpica/utdelete.c |
605 |
++++ b/drivers/acpi/acpica/utdelete.c |
606 |
+@@ -442,6 +442,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
607 |
+ ACPI_WARNING((AE_INFO, |
608 |
+ "Obj %p, Reference Count is already zero, cannot decrement\n", |
609 |
+ object)); |
610 |
++ return; |
611 |
+ } |
612 |
+ |
613 |
+ ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
614 |
+diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
615 |
+index cbf74731cfce6..057bedeaacab5 100644 |
616 |
+--- a/drivers/block/floppy.c |
617 |
++++ b/drivers/block/floppy.c |
618 |
+@@ -994,7 +994,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); |
619 |
+ static void cancel_activity(void) |
620 |
+ { |
621 |
+ do_floppy = NULL; |
622 |
+- cancel_delayed_work_sync(&fd_timer); |
623 |
++ cancel_delayed_work(&fd_timer); |
624 |
+ cancel_work_sync(&floppy_work); |
625 |
+ } |
626 |
+ |
627 |
+@@ -3118,6 +3118,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
628 |
+ } |
629 |
+ } |
630 |
+ |
631 |
++#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) |
632 |
++ |
633 |
+ static int raw_cmd_copyin(int cmd, void __user *param, |
634 |
+ struct floppy_raw_cmd **rcmd) |
635 |
+ { |
636 |
+@@ -3155,7 +3157,7 @@ loop: |
637 |
+ ptr->resultcode = 0; |
638 |
+ |
639 |
+ if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { |
640 |
+- if (ptr->length <= 0) |
641 |
++ if (ptr->length <= 0 || ptr->length >= MAX_LEN) |
642 |
+ return -EINVAL; |
643 |
+ ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); |
644 |
+ fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); |
645 |
+diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c |
646 |
+index ab090a313a5f1..099d1ec343103 100644 |
647 |
+--- a/drivers/bluetooth/bfusb.c |
648 |
++++ b/drivers/bluetooth/bfusb.c |
649 |
+@@ -644,6 +644,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i |
650 |
+ data->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; |
651 |
+ data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize); |
652 |
+ |
653 |
++ if (!data->bulk_pkt_size) |
654 |
++ goto done; |
655 |
++ |
656 |
+ rwlock_init(&data->lock); |
657 |
+ |
658 |
+ data->reassembly = NULL; |
659 |
+diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h |
660 |
+index 9ccb6b270b071..95164246afd1a 100644 |
661 |
+--- a/drivers/char/mwave/3780i.h |
662 |
++++ b/drivers/char/mwave/3780i.h |
663 |
+@@ -68,7 +68,7 @@ typedef struct { |
664 |
+ unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ |
665 |
+ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ |
666 |
+ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ |
667 |
+- unsigned char Reserved:5; /* 0: Reserved */ |
668 |
++ unsigned short Reserved:13; /* 0: Reserved */ |
669 |
+ } DSP_ISA_SLAVE_CONTROL; |
670 |
+ |
671 |
+ |
672 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
673 |
+index a7ec07e499ba9..1eb0cdbe87866 100644 |
674 |
+--- a/drivers/char/random.c |
675 |
++++ b/drivers/char/random.c |
676 |
+@@ -813,8 +813,8 @@ static void do_numa_crng_init(struct work_struct *work) |
677 |
+ crng_initialize(crng); |
678 |
+ pool[i] = crng; |
679 |
+ } |
680 |
+- mb(); |
681 |
+- if (cmpxchg(&crng_node_pool, NULL, pool)) { |
682 |
++ /* pairs with READ_ONCE() in select_crng() */ |
683 |
++ if (cmpxchg_release(&crng_node_pool, NULL, pool) != NULL) { |
684 |
+ for_each_node(i) |
685 |
+ kfree(pool[i]); |
686 |
+ kfree(pool); |
687 |
+@@ -827,8 +827,26 @@ static void numa_crng_init(void) |
688 |
+ { |
689 |
+ schedule_work(&numa_crng_init_work); |
690 |
+ } |
691 |
++ |
692 |
++static struct crng_state *select_crng(void) |
693 |
++{ |
694 |
++ struct crng_state **pool; |
695 |
++ int nid = numa_node_id(); |
696 |
++ |
697 |
++ /* pairs with cmpxchg_release() in do_numa_crng_init() */ |
698 |
++ pool = READ_ONCE(crng_node_pool); |
699 |
++ if (pool && pool[nid]) |
700 |
++ return pool[nid]; |
701 |
++ |
702 |
++ return &primary_crng; |
703 |
++} |
704 |
+ #else |
705 |
+ static void numa_crng_init(void) {} |
706 |
++ |
707 |
++static struct crng_state *select_crng(void) |
708 |
++{ |
709 |
++ return &primary_crng; |
710 |
++} |
711 |
+ #endif |
712 |
+ |
713 |
+ /* |
714 |
+@@ -933,7 +951,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) |
715 |
+ crng->state[i+4] ^= buf.key[i] ^ rv; |
716 |
+ } |
717 |
+ memzero_explicit(&buf, sizeof(buf)); |
718 |
+- crng->init_time = jiffies; |
719 |
++ WRITE_ONCE(crng->init_time, jiffies); |
720 |
+ spin_unlock_irqrestore(&crng->lock, flags); |
721 |
+ if (crng == &primary_crng && crng_init < 2) { |
722 |
+ invalidate_batched_entropy(); |
723 |
+@@ -960,12 +978,15 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) |
724 |
+ static void _extract_crng(struct crng_state *crng, |
725 |
+ __u8 out[CHACHA20_BLOCK_SIZE]) |
726 |
+ { |
727 |
+- unsigned long v, flags; |
728 |
+- |
729 |
+- if (crng_ready() && |
730 |
+- (time_after(crng_global_init_time, crng->init_time) || |
731 |
+- time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL))) |
732 |
+- crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL); |
733 |
++ unsigned long v, flags, init_time; |
734 |
++ |
735 |
++ if (crng_ready()) { |
736 |
++ init_time = READ_ONCE(crng->init_time); |
737 |
++ if (time_after(READ_ONCE(crng_global_init_time), init_time) || |
738 |
++ time_after(jiffies, init_time + CRNG_RESEED_INTERVAL)) |
739 |
++ crng_reseed(crng, crng == &primary_crng ? |
740 |
++ &input_pool : NULL); |
741 |
++ } |
742 |
+ spin_lock_irqsave(&crng->lock, flags); |
743 |
+ if (arch_get_random_long(&v)) |
744 |
+ crng->state[14] ^= v; |
745 |
+@@ -977,15 +998,7 @@ static void _extract_crng(struct crng_state *crng, |
746 |
+ |
747 |
+ static void extract_crng(__u8 out[CHACHA20_BLOCK_SIZE]) |
748 |
+ { |
749 |
+- struct crng_state *crng = NULL; |
750 |
+- |
751 |
+-#ifdef CONFIG_NUMA |
752 |
+- if (crng_node_pool) |
753 |
+- crng = crng_node_pool[numa_node_id()]; |
754 |
+- if (crng == NULL) |
755 |
+-#endif |
756 |
+- crng = &primary_crng; |
757 |
+- _extract_crng(crng, out); |
758 |
++ _extract_crng(select_crng(), out); |
759 |
+ } |
760 |
+ |
761 |
+ /* |
762 |
+@@ -1014,15 +1027,7 @@ static void _crng_backtrack_protect(struct crng_state *crng, |
763 |
+ |
764 |
+ static void crng_backtrack_protect(__u8 tmp[CHACHA20_BLOCK_SIZE], int used) |
765 |
+ { |
766 |
+- struct crng_state *crng = NULL; |
767 |
+- |
768 |
+-#ifdef CONFIG_NUMA |
769 |
+- if (crng_node_pool) |
770 |
+- crng = crng_node_pool[numa_node_id()]; |
771 |
+- if (crng == NULL) |
772 |
+-#endif |
773 |
+- crng = &primary_crng; |
774 |
+- _crng_backtrack_protect(crng, tmp, used); |
775 |
++ _crng_backtrack_protect(select_crng(), tmp, used); |
776 |
+ } |
777 |
+ |
778 |
+ static ssize_t extract_crng_user(void __user *buf, size_t nbytes) |
779 |
+@@ -1985,7 +1990,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) |
780 |
+ if (crng_init < 2) |
781 |
+ return -ENODATA; |
782 |
+ crng_reseed(&primary_crng, &input_pool); |
783 |
+- crng_global_init_time = jiffies - 1; |
784 |
++ WRITE_ONCE(crng_global_init_time, jiffies - 1); |
785 |
+ return 0; |
786 |
+ default: |
787 |
+ return -EINVAL; |
788 |
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
789 |
+index 1ac9abcdad52a..9e42943f6a599 100644 |
790 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
791 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
792 |
+@@ -809,7 +809,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
793 |
+ intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | |
794 |
+ TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; |
795 |
+ intmask &= ~TPM_GLOBAL_INT_ENABLE; |
796 |
++ |
797 |
++ rc = request_locality(chip, 0); |
798 |
++ if (rc < 0) { |
799 |
++ rc = -ENODEV; |
800 |
++ goto out_err; |
801 |
++ } |
802 |
++ |
803 |
+ tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); |
804 |
++ release_locality(chip, 0); |
805 |
+ |
806 |
+ rc = tpm2_probe(chip); |
807 |
+ if (rc) |
808 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
809 |
+index 98295b9703178..8ccd72cc66bab 100644 |
810 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
811 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
812 |
+@@ -949,8 +949,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) |
813 |
+ |
814 |
+ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
815 |
+ unsigned long rate, |
816 |
+- unsigned long parent_rate, |
817 |
+- bool round_up) |
818 |
++ unsigned long parent_rate) |
819 |
+ { |
820 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
821 |
+ const struct bcm2835_clock_data *data = clock->data; |
822 |
+@@ -962,10 +961,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
823 |
+ |
824 |
+ rem = do_div(temp, rate); |
825 |
+ div = temp; |
826 |
+- |
827 |
+- /* Round up and mask off the unused bits */ |
828 |
+- if (round_up && ((div & unused_frac_mask) != 0 || rem != 0)) |
829 |
+- div += unused_frac_mask + 1; |
830 |
+ div &= ~unused_frac_mask; |
831 |
+ |
832 |
+ /* different clamping limits apply for a mash clock */ |
833 |
+@@ -1096,7 +1091,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, |
834 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
835 |
+ struct bcm2835_cprman *cprman = clock->cprman; |
836 |
+ const struct bcm2835_clock_data *data = clock->data; |
837 |
+- u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); |
838 |
++ u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate); |
839 |
+ u32 ctl; |
840 |
+ |
841 |
+ spin_lock(&cprman->regs_lock); |
842 |
+@@ -1147,7 +1142,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw, |
843 |
+ |
844 |
+ if (!(BIT(parent_idx) & data->set_rate_parent)) { |
845 |
+ *prate = clk_hw_get_rate(parent); |
846 |
+- *div = bcm2835_clock_choose_div(hw, rate, *prate, true); |
847 |
++ *div = bcm2835_clock_choose_div(hw, rate, *prate); |
848 |
+ |
849 |
+ *avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div); |
850 |
+ |
851 |
+@@ -1233,7 +1228,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw, |
852 |
+ rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate, |
853 |
+ &div, &prate, |
854 |
+ &avgrate); |
855 |
+- if (rate > best_rate && rate <= req->rate) { |
856 |
++ if (abs(req->rate - rate) < abs(req->rate - best_rate)) { |
857 |
+ best_parent = parent; |
858 |
+ best_prate = prate; |
859 |
+ best_rate = rate; |
860 |
+diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c |
861 |
+index 47e114ac09d01..ff1e788f92767 100644 |
862 |
+--- a/drivers/crypto/qce/sha.c |
863 |
++++ b/drivers/crypto/qce/sha.c |
864 |
+@@ -544,8 +544,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, |
865 |
+ |
866 |
+ ret = crypto_register_ahash(alg); |
867 |
+ if (ret) { |
868 |
+- kfree(tmpl); |
869 |
+ dev_err(qce->dev, "%s registration failed\n", base->cra_name); |
870 |
++ kfree(tmpl); |
871 |
+ return ret; |
872 |
+ } |
873 |
+ |
874 |
+diff --git a/drivers/crypto/stm32/stm32_crc32.c b/drivers/crypto/stm32/stm32_crc32.c |
875 |
+index 8f09b8430893c..d5a5b768ef44c 100644 |
876 |
+--- a/drivers/crypto/stm32/stm32_crc32.c |
877 |
++++ b/drivers/crypto/stm32/stm32_crc32.c |
878 |
+@@ -206,7 +206,7 @@ static struct shash_alg algs[] = { |
879 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
880 |
+ .base = { |
881 |
+ .cra_name = "crc32", |
882 |
+- .cra_driver_name = DRIVER_NAME, |
883 |
++ .cra_driver_name = "stm32-crc32-crc32", |
884 |
+ .cra_priority = 200, |
885 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
886 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
887 |
+@@ -228,7 +228,7 @@ static struct shash_alg algs[] = { |
888 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
889 |
+ .base = { |
890 |
+ .cra_name = "crc32c", |
891 |
+- .cra_driver_name = DRIVER_NAME, |
892 |
++ .cra_driver_name = "stm32-crc32-crc32c", |
893 |
+ .cra_priority = 200, |
894 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
895 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
896 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
897 |
+index 8c2da523a8ff6..5b182061da221 100644 |
898 |
+--- a/drivers/dma/at_xdmac.c |
899 |
++++ b/drivers/dma/at_xdmac.c |
900 |
+@@ -100,6 +100,7 @@ |
901 |
+ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ |
902 |
+ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ |
903 |
+ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ |
904 |
++#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) |
905 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ |
906 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ |
907 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ |
908 |
+@@ -231,15 +232,15 @@ struct at_xdmac { |
909 |
+ |
910 |
+ /* Linked List Descriptor */ |
911 |
+ struct at_xdmac_lld { |
912 |
+- dma_addr_t mbr_nda; /* Next Descriptor Member */ |
913 |
+- u32 mbr_ubc; /* Microblock Control Member */ |
914 |
+- dma_addr_t mbr_sa; /* Source Address Member */ |
915 |
+- dma_addr_t mbr_da; /* Destination Address Member */ |
916 |
+- u32 mbr_cfg; /* Configuration Register */ |
917 |
+- u32 mbr_bc; /* Block Control Register */ |
918 |
+- u32 mbr_ds; /* Data Stride Register */ |
919 |
+- u32 mbr_sus; /* Source Microblock Stride Register */ |
920 |
+- u32 mbr_dus; /* Destination Microblock Stride Register */ |
921 |
++ u32 mbr_nda; /* Next Descriptor Member */ |
922 |
++ u32 mbr_ubc; /* Microblock Control Member */ |
923 |
++ u32 mbr_sa; /* Source Address Member */ |
924 |
++ u32 mbr_da; /* Destination Address Member */ |
925 |
++ u32 mbr_cfg; /* Configuration Register */ |
926 |
++ u32 mbr_bc; /* Block Control Register */ |
927 |
++ u32 mbr_ds; /* Data Stride Register */ |
928 |
++ u32 mbr_sus; /* Source Microblock Stride Register */ |
929 |
++ u32 mbr_dus; /* Destination Microblock Stride Register */ |
930 |
+ }; |
931 |
+ |
932 |
+ /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ |
933 |
+@@ -344,9 +345,6 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
934 |
+ |
935 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); |
936 |
+ |
937 |
+- if (at_xdmac_chan_is_enabled(atchan)) |
938 |
+- return; |
939 |
+- |
940 |
+ /* Set transfer as active to not try to start it again. */ |
941 |
+ first->active_xfer = true; |
942 |
+ |
943 |
+@@ -362,7 +360,8 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
944 |
+ */ |
945 |
+ if (at_xdmac_chan_is_cyclic(atchan)) |
946 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV1; |
947 |
+- else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) |
948 |
++ else if ((first->lld.mbr_ubc & |
949 |
++ AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) |
950 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV3; |
951 |
+ else |
952 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV2; |
953 |
+@@ -427,13 +426,12 @@ static dma_cookie_t at_xdmac_tx_submit(struct dma_async_tx_descriptor *tx) |
954 |
+ spin_lock_irqsave(&atchan->lock, irqflags); |
955 |
+ cookie = dma_cookie_assign(tx); |
956 |
+ |
957 |
++ list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
958 |
++ spin_unlock_irqrestore(&atchan->lock, irqflags); |
959 |
++ |
960 |
+ dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", |
961 |
+ __func__, atchan, desc); |
962 |
+- list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
963 |
+- if (list_is_singular(&atchan->xfers_list)) |
964 |
+- at_xdmac_start_xfer(atchan, desc); |
965 |
+ |
966 |
+- spin_unlock_irqrestore(&atchan->lock, irqflags); |
967 |
+ return cookie; |
968 |
+ } |
969 |
+ |
970 |
+diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c |
971 |
+index eb3a1f42ab065..e8b2d3e31de80 100644 |
972 |
+--- a/drivers/dma/mmp_pdma.c |
973 |
++++ b/drivers/dma/mmp_pdma.c |
974 |
+@@ -722,12 +722,6 @@ static int mmp_pdma_config(struct dma_chan *dchan, |
975 |
+ |
976 |
+ chan->dir = cfg->direction; |
977 |
+ chan->dev_addr = addr; |
978 |
+- /* FIXME: drivers should be ported over to use the filter |
979 |
+- * function. Once that's done, the following two lines can |
980 |
+- * be removed. |
981 |
+- */ |
982 |
+- if (cfg->slave_id) |
983 |
+- chan->drcmr = cfg->slave_id; |
984 |
+ |
985 |
+ return 0; |
986 |
+ } |
987 |
+diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c |
988 |
+index b53fb618bbf6b..99a8ff130ad51 100644 |
989 |
+--- a/drivers/dma/pxa_dma.c |
990 |
++++ b/drivers/dma/pxa_dma.c |
991 |
+@@ -956,13 +956,6 @@ static void pxad_get_config(struct pxad_chan *chan, |
992 |
+ *dcmd |= PXA_DCMD_BURST16; |
993 |
+ else if (maxburst == 32) |
994 |
+ *dcmd |= PXA_DCMD_BURST32; |
995 |
+- |
996 |
+- /* FIXME: drivers should be ported over to use the filter |
997 |
+- * function. Once that's done, the following two lines can |
998 |
+- * be removed. |
999 |
+- */ |
1000 |
+- if (chan->cfg.slave_id) |
1001 |
+- chan->drcmr = chan->cfg.slave_id; |
1002 |
+ } |
1003 |
+ |
1004 |
+ static struct dma_async_tx_descriptor * |
1005 |
+diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig |
1006 |
+index f16b381a569cb..ca049ecf5cfd9 100644 |
1007 |
+--- a/drivers/firmware/google/Kconfig |
1008 |
++++ b/drivers/firmware/google/Kconfig |
1009 |
+@@ -2,9 +2,9 @@ menuconfig GOOGLE_FIRMWARE |
1010 |
+ bool "Google Firmware Drivers" |
1011 |
+ default n |
1012 |
+ help |
1013 |
+- These firmware drivers are used by Google's servers. They are |
1014 |
+- only useful if you are working directly on one of their |
1015 |
+- proprietary servers. If in doubt, say "N". |
1016 |
++ These firmware drivers are used by Google servers, |
1017 |
++ Chromebooks and other devices using coreboot firmware. |
1018 |
++ If in doubt, say "N". |
1019 |
+ |
1020 |
+ if GOOGLE_FIRMWARE |
1021 |
+ |
1022 |
+diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c |
1023 |
+index c380ce957d8da..60e394da97098 100644 |
1024 |
+--- a/drivers/gpio/gpiolib-acpi.c |
1025 |
++++ b/drivers/gpio/gpiolib-acpi.c |
1026 |
+@@ -943,10 +943,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
1027 |
+ irq_flags = acpi_dev_get_irq_type(info.triggering, |
1028 |
+ info.polarity); |
1029 |
+ |
1030 |
+- /* Set type if specified and different than the current one */ |
1031 |
+- if (irq_flags != IRQ_TYPE_NONE && |
1032 |
+- irq_flags != irq_get_trigger_type(irq)) |
1033 |
+- irq_set_irq_type(irq, irq_flags); |
1034 |
++ /* |
1035 |
++ * If the IRQ is not already in use then set type |
1036 |
++ * if specified and different than the current one. |
1037 |
++ */ |
1038 |
++ if (can_request_irq(irq, irq_flags)) { |
1039 |
++ if (irq_flags != IRQ_TYPE_NONE && |
1040 |
++ irq_flags != irq_get_trigger_type(irq)) |
1041 |
++ irq_set_irq_type(irq, irq_flags); |
1042 |
++ } else { |
1043 |
++ dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); |
1044 |
++ } |
1045 |
+ |
1046 |
+ return irq; |
1047 |
+ } |
1048 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1049 |
+index 54f414279037e..0894bb98dc517 100644 |
1050 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1051 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1052 |
+@@ -404,6 +404,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
1053 |
+ native_mode->vdisplay != 0 && |
1054 |
+ native_mode->clock != 0) { |
1055 |
+ mode = drm_mode_duplicate(dev, native_mode); |
1056 |
++ if (!mode) |
1057 |
++ return NULL; |
1058 |
++ |
1059 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
1060 |
+ drm_mode_set_name(mode); |
1061 |
+ |
1062 |
+@@ -418,6 +421,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
1063 |
+ * simpler. |
1064 |
+ */ |
1065 |
+ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); |
1066 |
++ if (!mode) |
1067 |
++ return NULL; |
1068 |
++ |
1069 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
1070 |
+ DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); |
1071 |
+ } |
1072 |
+diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1073 |
+index 9f522372a4884..4ab7b034bfec8 100644 |
1074 |
+--- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1075 |
++++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
1076 |
+@@ -302,19 +302,10 @@ out: |
1077 |
+ mutex_unlock(&ge_b850v3_lvds_dev_mutex); |
1078 |
+ } |
1079 |
+ |
1080 |
+-static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1081 |
+- const struct i2c_device_id *id) |
1082 |
++static int ge_b850v3_register(void) |
1083 |
+ { |
1084 |
++ struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c; |
1085 |
+ struct device *dev = &stdp4028_i2c->dev; |
1086 |
+- int ret; |
1087 |
+- |
1088 |
+- ret = ge_b850v3_lvds_init(dev); |
1089 |
+- |
1090 |
+- if (ret) |
1091 |
+- return ret; |
1092 |
+- |
1093 |
+- ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
1094 |
+- i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
1095 |
+ |
1096 |
+ /* drm bridge initialization */ |
1097 |
+ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; |
1098 |
+@@ -336,6 +327,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1099 |
+ "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); |
1100 |
+ } |
1101 |
+ |
1102 |
++static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
1103 |
++ const struct i2c_device_id *id) |
1104 |
++{ |
1105 |
++ struct device *dev = &stdp4028_i2c->dev; |
1106 |
++ int ret; |
1107 |
++ |
1108 |
++ ret = ge_b850v3_lvds_init(dev); |
1109 |
++ |
1110 |
++ if (ret) |
1111 |
++ return ret; |
1112 |
++ |
1113 |
++ ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
1114 |
++ i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
1115 |
++ |
1116 |
++ /* Only register after both bridges are probed */ |
1117 |
++ if (!ge_b850v3_lvds_ptr->stdp2690_i2c) |
1118 |
++ return 0; |
1119 |
++ |
1120 |
++ return ge_b850v3_register(); |
1121 |
++} |
1122 |
++ |
1123 |
+ static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) |
1124 |
+ { |
1125 |
+ ge_b850v3_lvds_remove(); |
1126 |
+@@ -379,7 +391,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, |
1127 |
+ ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; |
1128 |
+ i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); |
1129 |
+ |
1130 |
+- return 0; |
1131 |
++ /* Only register after both bridges are probed */ |
1132 |
++ if (!ge_b850v3_lvds_ptr->stdp4028_i2c) |
1133 |
++ return 0; |
1134 |
++ |
1135 |
++ return ge_b850v3_register(); |
1136 |
+ } |
1137 |
+ |
1138 |
+ static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) |
1139 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
1140 |
+index fd60804377634..0876346933460 100644 |
1141 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
1142 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
1143 |
+@@ -2985,9 +2985,9 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv) |
1144 |
+ * The BIOS provided WM memory latency values are often |
1145 |
+ * inadequate for high resolution displays. Adjust them. |
1146 |
+ */ |
1147 |
+- changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) | |
1148 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) | |
1149 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
1150 |
++ changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12); |
1151 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12); |
1152 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
1153 |
+ |
1154 |
+ if (!changed) |
1155 |
+ return; |
1156 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
1157 |
+index fde11ce466e45..495c4043467e8 100644 |
1158 |
+--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
1159 |
++++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
1160 |
+@@ -106,12 +106,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, |
1161 |
+ else |
1162 |
+ nvbe->ttm.ttm.func = &nv50_sgdma_backend; |
1163 |
+ |
1164 |
+- if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) |
1165 |
+- /* |
1166 |
+- * A failing ttm_dma_tt_init() will call ttm_tt_destroy() |
1167 |
+- * and thus our nouveau_sgdma_destroy() hook, so we don't need |
1168 |
+- * to free nvbe here. |
1169 |
+- */ |
1170 |
++ if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { |
1171 |
++ kfree(nvbe); |
1172 |
+ return NULL; |
1173 |
++ } |
1174 |
+ return &nvbe->ttm.ttm; |
1175 |
+ } |
1176 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1177 |
+index ce70a193caa7f..8cf3d1b4662de 100644 |
1178 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1179 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
1180 |
+@@ -70,20 +70,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) |
1181 |
+ return 0; |
1182 |
+ } |
1183 |
+ |
1184 |
+-static int |
1185 |
++static void |
1186 |
+ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
1187 |
+ { |
1188 |
+ struct nvkm_device *device = pmu->subdev.device; |
1189 |
+ |
1190 |
+ if (!pmu->func->enabled(pmu)) |
1191 |
+- return 0; |
1192 |
+- |
1193 |
+- /* Inhibit interrupts, and wait for idle. */ |
1194 |
+- nvkm_wr32(device, 0x10a014, 0x0000ffff); |
1195 |
+- nvkm_msec(device, 2000, |
1196 |
+- if (!nvkm_rd32(device, 0x10a04c)) |
1197 |
+- break; |
1198 |
+- ); |
1199 |
++ return; |
1200 |
+ |
1201 |
+ /* Reset. */ |
1202 |
+ if (pmu->func->reset) |
1203 |
+@@ -94,25 +87,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
1204 |
+ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) |
1205 |
+ break; |
1206 |
+ ); |
1207 |
+- |
1208 |
+- return 0; |
1209 |
+ } |
1210 |
+ |
1211 |
+ static int |
1212 |
+ nvkm_pmu_preinit(struct nvkm_subdev *subdev) |
1213 |
+ { |
1214 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
1215 |
+- return nvkm_pmu_reset(pmu); |
1216 |
++ nvkm_pmu_reset(pmu); |
1217 |
++ return 0; |
1218 |
+ } |
1219 |
+ |
1220 |
+ static int |
1221 |
+ nvkm_pmu_init(struct nvkm_subdev *subdev) |
1222 |
+ { |
1223 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
1224 |
+- int ret = nvkm_pmu_reset(pmu); |
1225 |
+- if (ret == 0 && pmu->func->init) |
1226 |
+- ret = pmu->func->init(pmu); |
1227 |
+- return ret; |
1228 |
++ struct nvkm_device *device = pmu->subdev.device; |
1229 |
++ |
1230 |
++ if (!pmu->func->init) |
1231 |
++ return 0; |
1232 |
++ |
1233 |
++ if (pmu->func->enabled(pmu)) { |
1234 |
++ /* Inhibit interrupts, and wait for idle. */ |
1235 |
++ nvkm_wr32(device, 0x10a014, 0x0000ffff); |
1236 |
++ nvkm_msec(device, 2000, |
1237 |
++ if (!nvkm_rd32(device, 0x10a04c)) |
1238 |
++ break; |
1239 |
++ ); |
1240 |
++ |
1241 |
++ nvkm_pmu_reset(pmu); |
1242 |
++ } |
1243 |
++ |
1244 |
++ return pmu->func->init(pmu); |
1245 |
+ } |
1246 |
+ |
1247 |
+ static int |
1248 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
1249 |
+index 4973bd241aec3..b067ed26b9f54 100644 |
1250 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
1251 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
1252 |
+@@ -655,6 +655,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) |
1253 |
+ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
1254 |
+ { |
1255 |
+ struct radeon_device *rdev = dev->dev_private; |
1256 |
++ struct radeon_fpriv *fpriv; |
1257 |
++ struct radeon_vm *vm; |
1258 |
+ int r; |
1259 |
+ |
1260 |
+ file_priv->driver_priv = NULL; |
1261 |
+@@ -667,48 +669,52 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
1262 |
+ |
1263 |
+ /* new gpu have virtual address space support */ |
1264 |
+ if (rdev->family >= CHIP_CAYMAN) { |
1265 |
+- struct radeon_fpriv *fpriv; |
1266 |
+- struct radeon_vm *vm; |
1267 |
+ |
1268 |
+ fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
1269 |
+ if (unlikely(!fpriv)) { |
1270 |
+ r = -ENOMEM; |
1271 |
+- goto out_suspend; |
1272 |
++ goto err_suspend; |
1273 |
+ } |
1274 |
+ |
1275 |
+ if (rdev->accel_working) { |
1276 |
+ vm = &fpriv->vm; |
1277 |
+ r = radeon_vm_init(rdev, vm); |
1278 |
+- if (r) { |
1279 |
+- kfree(fpriv); |
1280 |
+- goto out_suspend; |
1281 |
+- } |
1282 |
++ if (r) |
1283 |
++ goto err_fpriv; |
1284 |
+ |
1285 |
+ r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
1286 |
+- if (r) { |
1287 |
+- radeon_vm_fini(rdev, vm); |
1288 |
+- kfree(fpriv); |
1289 |
+- goto out_suspend; |
1290 |
+- } |
1291 |
++ if (r) |
1292 |
++ goto err_vm_fini; |
1293 |
+ |
1294 |
+ /* map the ib pool buffer read only into |
1295 |
+ * virtual address space */ |
1296 |
+ vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, |
1297 |
+ rdev->ring_tmp_bo.bo); |
1298 |
++ if (!vm->ib_bo_va) { |
1299 |
++ r = -ENOMEM; |
1300 |
++ goto err_vm_fini; |
1301 |
++ } |
1302 |
++ |
1303 |
+ r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, |
1304 |
+ RADEON_VA_IB_OFFSET, |
1305 |
+ RADEON_VM_PAGE_READABLE | |
1306 |
+ RADEON_VM_PAGE_SNOOPED); |
1307 |
+- if (r) { |
1308 |
+- radeon_vm_fini(rdev, vm); |
1309 |
+- kfree(fpriv); |
1310 |
+- goto out_suspend; |
1311 |
+- } |
1312 |
++ if (r) |
1313 |
++ goto err_vm_fini; |
1314 |
+ } |
1315 |
+ file_priv->driver_priv = fpriv; |
1316 |
+ } |
1317 |
+ |
1318 |
+-out_suspend: |
1319 |
++ pm_runtime_mark_last_busy(dev->dev); |
1320 |
++ pm_runtime_put_autosuspend(dev->dev); |
1321 |
++ return 0; |
1322 |
++ |
1323 |
++err_vm_fini: |
1324 |
++ radeon_vm_fini(rdev, vm); |
1325 |
++err_fpriv: |
1326 |
++ kfree(fpriv); |
1327 |
++ |
1328 |
++err_suspend: |
1329 |
+ pm_runtime_mark_last_busy(dev->dev); |
1330 |
+ pm_runtime_put_autosuspend(dev->dev); |
1331 |
+ return r; |
1332 |
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c |
1333 |
+index 8ebc8d3560c36..fc8bdcc1541b6 100644 |
1334 |
+--- a/drivers/gpu/drm/ttm/ttm_tt.c |
1335 |
++++ b/drivers/gpu/drm/ttm/ttm_tt.c |
1336 |
+@@ -199,7 +199,6 @@ int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev, |
1337 |
+ |
1338 |
+ ttm_tt_alloc_page_directory(ttm); |
1339 |
+ if (!ttm->pages) { |
1340 |
+- ttm_tt_destroy(ttm); |
1341 |
+ pr_err("Failed allocating page table\n"); |
1342 |
+ return -ENOMEM; |
1343 |
+ } |
1344 |
+@@ -232,7 +231,6 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev, |
1345 |
+ INIT_LIST_HEAD(&ttm_dma->pages_list); |
1346 |
+ ttm_dma_tt_alloc_page_directory(ttm_dma); |
1347 |
+ if (!ttm->pages) { |
1348 |
+- ttm_tt_destroy(ttm); |
1349 |
+ pr_err("Failed allocating page table\n"); |
1350 |
+ return -ENOMEM; |
1351 |
+ } |
1352 |
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c |
1353 |
+index 4e3dd3f55a963..80ecbf14d3c82 100644 |
1354 |
+--- a/drivers/hid/hid-apple.c |
1355 |
++++ b/drivers/hid/hid-apple.c |
1356 |
+@@ -392,7 +392,7 @@ static int apple_input_configured(struct hid_device *hdev, |
1357 |
+ |
1358 |
+ if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { |
1359 |
+ hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); |
1360 |
+- asc->quirks = 0; |
1361 |
++ asc->quirks &= ~APPLE_HAS_FN; |
1362 |
+ } |
1363 |
+ |
1364 |
+ return 0; |
1365 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
1366 |
+index c749f449c7cb3..333b6a769189c 100644 |
1367 |
+--- a/drivers/hid/uhid.c |
1368 |
++++ b/drivers/hid/uhid.c |
1369 |
+@@ -32,11 +32,22 @@ |
1370 |
+ |
1371 |
+ struct uhid_device { |
1372 |
+ struct mutex devlock; |
1373 |
++ |
1374 |
++ /* This flag tracks whether the HID device is usable for commands from |
1375 |
++ * userspace. The flag is already set before hid_add_device(), which |
1376 |
++ * runs in workqueue context, to allow hid_add_device() to communicate |
1377 |
++ * with userspace. |
1378 |
++ * However, if hid_add_device() fails, the flag is cleared without |
1379 |
++ * holding devlock. |
1380 |
++ * We guarantee that if @running changes from true to false while you're |
1381 |
++ * holding @devlock, it's still fine to access @hid. |
1382 |
++ */ |
1383 |
+ bool running; |
1384 |
+ |
1385 |
+ __u8 *rd_data; |
1386 |
+ uint rd_size; |
1387 |
+ |
1388 |
++ /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ |
1389 |
+ struct hid_device *hid; |
1390 |
+ struct uhid_event input_buf; |
1391 |
+ |
1392 |
+@@ -67,9 +78,18 @@ static void uhid_device_add_worker(struct work_struct *work) |
1393 |
+ if (ret) { |
1394 |
+ hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); |
1395 |
+ |
1396 |
+- hid_destroy_device(uhid->hid); |
1397 |
+- uhid->hid = NULL; |
1398 |
++ /* We used to call hid_destroy_device() here, but that's really |
1399 |
++ * messy to get right because we have to coordinate with |
1400 |
++ * concurrent writes from userspace that might be in the middle |
1401 |
++ * of using uhid->hid. |
1402 |
++ * Just leave uhid->hid as-is for now, and clean it up when |
1403 |
++ * userspace tries to close or reinitialize the uhid instance. |
1404 |
++ * |
1405 |
++ * However, we do have to clear the ->running flag and do a |
1406 |
++ * wakeup to make sure userspace knows that the device is gone. |
1407 |
++ */ |
1408 |
+ uhid->running = false; |
1409 |
++ wake_up_interruptible(&uhid->report_wait); |
1410 |
+ } |
1411 |
+ } |
1412 |
+ |
1413 |
+@@ -478,7 +498,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, |
1414 |
+ void *rd_data; |
1415 |
+ int ret; |
1416 |
+ |
1417 |
+- if (uhid->running) |
1418 |
++ if (uhid->hid) |
1419 |
+ return -EALREADY; |
1420 |
+ |
1421 |
+ rd_size = ev->u.create2.rd_size; |
1422 |
+@@ -559,7 +579,7 @@ static int uhid_dev_create(struct uhid_device *uhid, |
1423 |
+ |
1424 |
+ static int uhid_dev_destroy(struct uhid_device *uhid) |
1425 |
+ { |
1426 |
+- if (!uhid->running) |
1427 |
++ if (!uhid->hid) |
1428 |
+ return -EINVAL; |
1429 |
+ |
1430 |
+ uhid->running = false; |
1431 |
+@@ -568,6 +588,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) |
1432 |
+ cancel_work_sync(&uhid->worker); |
1433 |
+ |
1434 |
+ hid_destroy_device(uhid->hid); |
1435 |
++ uhid->hid = NULL; |
1436 |
+ kfree(uhid->rd_data); |
1437 |
+ |
1438 |
+ return 0; |
1439 |
+diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
1440 |
+index 14373b06e63dc..3511933429dae 100644 |
1441 |
+--- a/drivers/hid/wacom_wac.c |
1442 |
++++ b/drivers/hid/wacom_wac.c |
1443 |
+@@ -2424,6 +2424,24 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
1444 |
+ } |
1445 |
+ } |
1446 |
+ |
1447 |
++static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) |
1448 |
++{ |
1449 |
++ struct input_mt *mt = dev->mt; |
1450 |
++ struct input_mt_slot *s; |
1451 |
++ |
1452 |
++ if (!mt) |
1453 |
++ return false; |
1454 |
++ |
1455 |
++ for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { |
1456 |
++ if (s->key == key && |
1457 |
++ input_mt_get_value(s, ABS_MT_TRACKING_ID) >= 0) { |
1458 |
++ return true; |
1459 |
++ } |
1460 |
++ } |
1461 |
++ |
1462 |
++ return false; |
1463 |
++} |
1464 |
++ |
1465 |
+ static void wacom_wac_finger_event(struct hid_device *hdev, |
1466 |
+ struct hid_field *field, struct hid_usage *usage, __s32 value) |
1467 |
+ { |
1468 |
+@@ -2466,9 +2484,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev, |
1469 |
+ |
1470 |
+ |
1471 |
+ if (usage->usage_index + 1 == field->report_count) { |
1472 |
+- if (equivalent_usage == wacom_wac->hid_data.last_slot_field && |
1473 |
+- wacom_wac->hid_data.confidence) |
1474 |
+- wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
1475 |
++ if (equivalent_usage == wacom_wac->hid_data.last_slot_field) { |
1476 |
++ bool touch_removed = wacom_wac_slot_is_active(wacom_wac->touch_input, |
1477 |
++ wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; |
1478 |
++ |
1479 |
++ if (wacom_wac->hid_data.confidence || touch_removed) { |
1480 |
++ wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
1481 |
++ } |
1482 |
++ } |
1483 |
+ } |
1484 |
+ } |
1485 |
+ |
1486 |
+@@ -2482,6 +2505,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
1487 |
+ |
1488 |
+ hid_data->confidence = true; |
1489 |
+ |
1490 |
++ hid_data->cc_report = 0; |
1491 |
++ hid_data->cc_index = -1; |
1492 |
++ hid_data->cc_value_index = -1; |
1493 |
++ |
1494 |
+ for (i = 0; i < report->maxfield; i++) { |
1495 |
+ struct hid_field *field = report->field[i]; |
1496 |
+ int j; |
1497 |
+diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c |
1498 |
+index 71895da63810b..daf2de837a30a 100644 |
1499 |
+--- a/drivers/hsi/hsi_core.c |
1500 |
++++ b/drivers/hsi/hsi_core.c |
1501 |
+@@ -115,6 +115,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, |
1502 |
+ if (device_register(&cl->device) < 0) { |
1503 |
+ pr_err("hsi: failed to register client: %s\n", info->name); |
1504 |
+ put_device(&cl->device); |
1505 |
++ goto err; |
1506 |
+ } |
1507 |
+ |
1508 |
+ return cl; |
1509 |
+diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c |
1510 |
+index 86e1bd0b82e91..347d82dff67c0 100644 |
1511 |
+--- a/drivers/i2c/busses/i2c-designware-pcidrv.c |
1512 |
++++ b/drivers/i2c/busses/i2c-designware-pcidrv.c |
1513 |
+@@ -50,10 +50,10 @@ enum dw_pci_ctl_id_t { |
1514 |
+ }; |
1515 |
+ |
1516 |
+ struct dw_scl_sda_cfg { |
1517 |
+- u32 ss_hcnt; |
1518 |
+- u32 fs_hcnt; |
1519 |
+- u32 ss_lcnt; |
1520 |
+- u32 fs_lcnt; |
1521 |
++ u16 ss_hcnt; |
1522 |
++ u16 fs_hcnt; |
1523 |
++ u16 ss_lcnt; |
1524 |
++ u16 fs_lcnt; |
1525 |
+ u32 sda_hold; |
1526 |
+ }; |
1527 |
+ |
1528 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
1529 |
+index 7b1654b0fb6db..c817e3d4b52b8 100644 |
1530 |
+--- a/drivers/i2c/busses/i2c-i801.c |
1531 |
++++ b/drivers/i2c/busses/i2c-i801.c |
1532 |
+@@ -769,6 +769,11 @@ static int i801_block_transaction(struct i801_priv *priv, |
1533 |
+ int result = 0; |
1534 |
+ unsigned char hostc; |
1535 |
+ |
1536 |
++ if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) |
1537 |
++ data->block[0] = I2C_SMBUS_BLOCK_MAX; |
1538 |
++ else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) |
1539 |
++ return -EPROTO; |
1540 |
++ |
1541 |
+ if (command == I2C_SMBUS_I2C_BLOCK_DATA) { |
1542 |
+ if (read_write == I2C_SMBUS_WRITE) { |
1543 |
+ /* set I2C_EN bit in configuration register */ |
1544 |
+@@ -782,16 +787,6 @@ static int i801_block_transaction(struct i801_priv *priv, |
1545 |
+ } |
1546 |
+ } |
1547 |
+ |
1548 |
+- if (read_write == I2C_SMBUS_WRITE |
1549 |
+- || command == I2C_SMBUS_I2C_BLOCK_DATA) { |
1550 |
+- if (data->block[0] < 1) |
1551 |
+- data->block[0] = 1; |
1552 |
+- if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
1553 |
+- data->block[0] = I2C_SMBUS_BLOCK_MAX; |
1554 |
+- } else { |
1555 |
+- data->block[0] = 32; /* max for SMBus block reads */ |
1556 |
+- } |
1557 |
+- |
1558 |
+ /* Experience has shown that the block buffer can only be used for |
1559 |
+ SMBus (not I2C) block transactions, even though the datasheet |
1560 |
+ doesn't mention this limitation. */ |
1561 |
+diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
1562 |
+index 7db5554d2b4e7..194bf06ecb25e 100644 |
1563 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
1564 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
1565 |
+@@ -107,23 +107,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) |
1566 |
+ /* Sometimes 9th clock pulse isn't generated, and slave doesn't release |
1567 |
+ * the bus, because it wants to send ACK. |
1568 |
+ * Following sequence of enabling/disabling and sending start/stop generates |
1569 |
+- * the 9 pulses, so it's all OK. |
1570 |
++ * the 9 pulses, each with a START then ending with STOP, so it's all OK. |
1571 |
+ */ |
1572 |
+ static void mpc_i2c_fixup(struct mpc_i2c *i2c) |
1573 |
+ { |
1574 |
+ int k; |
1575 |
+- u32 delay_val = 1000000 / i2c->real_clk + 1; |
1576 |
+- |
1577 |
+- if (delay_val < 2) |
1578 |
+- delay_val = 2; |
1579 |
++ unsigned long flags; |
1580 |
+ |
1581 |
+ for (k = 9; k; k--) { |
1582 |
+ writeccr(i2c, 0); |
1583 |
+- writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); |
1584 |
++ writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ |
1585 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ |
1586 |
++ readb(i2c->base + MPC_I2C_DR); /* init xfer */ |
1587 |
++ udelay(15); /* let it hit the bus */ |
1588 |
++ local_irq_save(flags); /* should not be delayed further */ |
1589 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ |
1590 |
+ readb(i2c->base + MPC_I2C_DR); |
1591 |
+- writeccr(i2c, CCR_MEN); |
1592 |
+- udelay(delay_val << 1); |
1593 |
++ if (k != 1) |
1594 |
++ udelay(5); |
1595 |
++ local_irq_restore(flags); |
1596 |
+ } |
1597 |
++ writeccr(i2c, CCR_MEN); /* Initiate STOP */ |
1598 |
++ readb(i2c->base + MPC_I2C_DR); |
1599 |
++ udelay(15); /* Let STOP propagate */ |
1600 |
++ writeccr(i2c, 0); |
1601 |
+ } |
1602 |
+ |
1603 |
+ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
1604 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
1605 |
+index 6b0d1d8609cad..b230f156a9964 100644 |
1606 |
+--- a/drivers/infiniband/core/device.c |
1607 |
++++ b/drivers/infiniband/core/device.c |
1608 |
+@@ -1075,7 +1075,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
1609 |
+ for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { |
1610 |
+ ret = ib_query_gid(device, port, i, &tmp_gid, NULL); |
1611 |
+ if (ret) |
1612 |
+- return ret; |
1613 |
++ continue; |
1614 |
++ |
1615 |
+ if (!memcmp(&tmp_gid, gid, sizeof *gid)) { |
1616 |
+ *port_num = port; |
1617 |
+ if (index) |
1618 |
+diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
1619 |
+index 3255615807299..225d4466fcb24 100644 |
1620 |
+--- a/drivers/infiniband/hw/cxgb4/qp.c |
1621 |
++++ b/drivers/infiniband/hw/cxgb4/qp.c |
1622 |
+@@ -2115,6 +2115,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
1623 |
+ memset(attr, 0, sizeof *attr); |
1624 |
+ memset(init_attr, 0, sizeof *init_attr); |
1625 |
+ attr->qp_state = to_ib_qp_state(qhp->attr.state); |
1626 |
++ attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); |
1627 |
+ init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; |
1628 |
+ init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; |
1629 |
+ init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; |
1630 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c |
1631 |
+index d9777b662eba9..f4db0418a39f5 100644 |
1632 |
+--- a/drivers/infiniband/hw/hns/hns_roce_main.c |
1633 |
++++ b/drivers/infiniband/hw/hns/hns_roce_main.c |
1634 |
+@@ -294,6 +294,9 @@ static int hns_roce_query_gid(struct ib_device *ib_dev, u8 port_num, int index, |
1635 |
+ static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index, |
1636 |
+ u16 *pkey) |
1637 |
+ { |
1638 |
++ if (index > 0) |
1639 |
++ return -EINVAL; |
1640 |
++ |
1641 |
+ *pkey = PKEY_ID; |
1642 |
+ |
1643 |
+ return 0; |
1644 |
+@@ -374,7 +377,7 @@ static int hns_roce_mmap(struct ib_ucontext *context, |
1645 |
+ return -EINVAL; |
1646 |
+ |
1647 |
+ if (vma->vm_pgoff == 0) { |
1648 |
+- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
1649 |
++ vma->vm_page_prot = pgprot_device(vma->vm_page_prot); |
1650 |
+ if (io_remap_pfn_range(vma, vma->vm_start, |
1651 |
+ to_hr_ucontext(context)->uar.pfn, |
1652 |
+ PAGE_SIZE, vma->vm_page_prot)) |
1653 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c |
1654 |
+index 4cf11063e0b59..0f166d6d0ccb0 100644 |
1655 |
+--- a/drivers/infiniband/sw/rxe/rxe_opcode.c |
1656 |
++++ b/drivers/infiniband/sw/rxe/rxe_opcode.c |
1657 |
+@@ -137,7 +137,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { |
1658 |
+ } |
1659 |
+ }, |
1660 |
+ [IB_OPCODE_RC_SEND_MIDDLE] = { |
1661 |
+- .name = "IB_OPCODE_RC_SEND_MIDDLE]", |
1662 |
++ .name = "IB_OPCODE_RC_SEND_MIDDLE", |
1663 |
+ .mask = RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK |
1664 |
+ | RXE_MIDDLE_MASK, |
1665 |
+ .length = RXE_BTH_BYTES, |
1666 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
1667 |
+index 2c97d2552c5bd..ebee9e191b3ee 100644 |
1668 |
+--- a/drivers/iommu/iova.c |
1669 |
++++ b/drivers/iommu/iova.c |
1670 |
+@@ -68,8 +68,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad) |
1671 |
+ if (!has_iova_flush_queue(iovad)) |
1672 |
+ return; |
1673 |
+ |
1674 |
+- if (timer_pending(&iovad->fq_timer)) |
1675 |
+- del_timer(&iovad->fq_timer); |
1676 |
++ del_timer_sync(&iovad->fq_timer); |
1677 |
+ |
1678 |
+ fq_destroy_all_entries(iovad); |
1679 |
+ |
1680 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
1681 |
+index 8aae0624a2971..6383afb88f319 100644 |
1682 |
+--- a/drivers/md/persistent-data/dm-btree.c |
1683 |
++++ b/drivers/md/persistent-data/dm-btree.c |
1684 |
+@@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
1685 |
+ } |
1686 |
+ |
1687 |
+ static int insert_at(size_t value_size, struct btree_node *node, unsigned index, |
1688 |
+- uint64_t key, void *value) |
1689 |
+- __dm_written_to_disk(value) |
1690 |
++ uint64_t key, void *value) |
1691 |
++ __dm_written_to_disk(value) |
1692 |
+ { |
1693 |
+ uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); |
1694 |
++ uint32_t max_entries = le32_to_cpu(node->header.max_entries); |
1695 |
+ __le64 key_le = cpu_to_le64(key); |
1696 |
+ |
1697 |
+ if (index > nr_entries || |
1698 |
+- index >= le32_to_cpu(node->header.max_entries)) { |
1699 |
++ index >= max_entries || |
1700 |
++ nr_entries >= max_entries) { |
1701 |
+ DMERR("too many entries in btree node for insert"); |
1702 |
+ __dm_unbless_for_disk(value); |
1703 |
+ return -ENOMEM; |
1704 |
+diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c |
1705 |
+index a2eceb12f01d4..1095b90307aed 100644 |
1706 |
+--- a/drivers/md/persistent-data/dm-space-map-common.c |
1707 |
++++ b/drivers/md/persistent-data/dm-space-map-common.c |
1708 |
+@@ -279,6 +279,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result) |
1709 |
+ struct disk_index_entry ie_disk; |
1710 |
+ struct dm_block *blk; |
1711 |
+ |
1712 |
++ if (b >= ll->nr_blocks) { |
1713 |
++ DMERR_LIMIT("metadata block out of bounds"); |
1714 |
++ return -EINVAL; |
1715 |
++ } |
1716 |
++ |
1717 |
+ b = do_div(index, ll->entries_per_block); |
1718 |
+ r = ll->load_ie(ll, index, &ie_disk); |
1719 |
+ if (r < 0) |
1720 |
+diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c |
1721 |
+index 930d2c94d5d30..2c9365a39270a 100644 |
1722 |
+--- a/drivers/media/common/saa7146/saa7146_fops.c |
1723 |
++++ b/drivers/media/common/saa7146/saa7146_fops.c |
1724 |
+@@ -524,7 +524,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
1725 |
+ ERR("out of memory. aborting.\n"); |
1726 |
+ kfree(vv); |
1727 |
+ v4l2_ctrl_handler_free(hdl); |
1728 |
+- return -1; |
1729 |
++ return -ENOMEM; |
1730 |
+ } |
1731 |
+ |
1732 |
+ saa7146_video_uops.init(dev,vv); |
1733 |
+diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c |
1734 |
+index 51009b2718a3e..ab9c4dba2a695 100644 |
1735 |
+--- a/drivers/media/dvb-core/dmxdev.c |
1736 |
++++ b/drivers/media/dvb-core/dmxdev.c |
1737 |
+@@ -1209,7 +1209,7 @@ static const struct dvb_device dvbdev_dvr = { |
1738 |
+ }; |
1739 |
+ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
1740 |
+ { |
1741 |
+- int i; |
1742 |
++ int i, ret; |
1743 |
+ |
1744 |
+ if (dmxdev->demux->open(dmxdev->demux) < 0) |
1745 |
+ return -EUSERS; |
1746 |
+@@ -1227,14 +1227,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
1747 |
+ DMXDEV_STATE_FREE); |
1748 |
+ } |
1749 |
+ |
1750 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
1751 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
1752 |
+ DVB_DEVICE_DEMUX, dmxdev->filternum); |
1753 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
1754 |
++ if (ret < 0) |
1755 |
++ goto err_register_dvbdev; |
1756 |
++ |
1757 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
1758 |
+ dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); |
1759 |
++ if (ret < 0) |
1760 |
++ goto err_register_dvr_dvbdev; |
1761 |
+ |
1762 |
+ dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); |
1763 |
+ |
1764 |
+ return 0; |
1765 |
++ |
1766 |
++err_register_dvr_dvbdev: |
1767 |
++ dvb_unregister_device(dmxdev->dvbdev); |
1768 |
++err_register_dvbdev: |
1769 |
++ vfree(dmxdev->filter); |
1770 |
++ dmxdev->filter = NULL; |
1771 |
++ return ret; |
1772 |
+ } |
1773 |
+ |
1774 |
+ EXPORT_SYMBOL(dvb_dmxdev_init); |
1775 |
+diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c |
1776 |
+index 59ab01dc62b19..c429392ebbe63 100644 |
1777 |
+--- a/drivers/media/dvb-frontends/dib8000.c |
1778 |
++++ b/drivers/media/dvb-frontends/dib8000.c |
1779 |
+@@ -4476,8 +4476,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad |
1780 |
+ |
1781 |
+ state->timf_default = cfg->pll->timf; |
1782 |
+ |
1783 |
+- if (dib8000_identify(&state->i2c) == 0) |
1784 |
++ if (dib8000_identify(&state->i2c) == 0) { |
1785 |
++ kfree(fe); |
1786 |
+ goto error; |
1787 |
++ } |
1788 |
+ |
1789 |
+ dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); |
1790 |
+ |
1791 |
+diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c |
1792 |
+index cc6527e355373..b7d8e34ffd5da 100644 |
1793 |
+--- a/drivers/media/pci/b2c2/flexcop-pci.c |
1794 |
++++ b/drivers/media/pci/b2c2/flexcop-pci.c |
1795 |
+@@ -184,6 +184,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
1796 |
+ dma_addr_t cur_addr = |
1797 |
+ fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
1798 |
+ u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
1799 |
++ if (cur_pos > fc_pci->dma[0].size * 2) |
1800 |
++ goto error; |
1801 |
+ |
1802 |
+ deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", |
1803 |
+ jiffies_to_usecs(jiffies - fc_pci->last_irq), |
1804 |
+@@ -224,6 +226,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
1805 |
+ ret = IRQ_NONE; |
1806 |
+ } |
1807 |
+ |
1808 |
++error: |
1809 |
+ spin_unlock_irqrestore(&fc_pci->irq_lock, flags); |
1810 |
+ return ret; |
1811 |
+ } |
1812 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
1813 |
+index a527d86b93a77..7f498aebb4112 100644 |
1814 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
1815 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
1816 |
+@@ -296,7 +296,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
1817 |
+ hexium_set_input(hexium, 0); |
1818 |
+ hexium->cur_input = 0; |
1819 |
+ |
1820 |
+- saa7146_vv_init(dev, &vv_data); |
1821 |
++ ret = saa7146_vv_init(dev, &vv_data); |
1822 |
++ if (ret) { |
1823 |
++ i2c_del_adapter(&hexium->i2c_adapter); |
1824 |
++ kfree(hexium); |
1825 |
++ return ret; |
1826 |
++ } |
1827 |
+ |
1828 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
1829 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
1830 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
1831 |
+index cb71653a66694..908de2f768441 100644 |
1832 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
1833 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
1834 |
+@@ -366,10 +366,16 @@ static struct saa7146_ext_vv vv_data; |
1835 |
+ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
1836 |
+ { |
1837 |
+ struct hexium *hexium = (struct hexium *) dev->ext_priv; |
1838 |
++ int ret; |
1839 |
+ |
1840 |
+ DEB_EE("\n"); |
1841 |
+ |
1842 |
+- saa7146_vv_init(dev, &vv_data); |
1843 |
++ ret = saa7146_vv_init(dev, &vv_data); |
1844 |
++ if (ret) { |
1845 |
++ pr_err("Error in saa7146_vv_init()\n"); |
1846 |
++ return ret; |
1847 |
++ } |
1848 |
++ |
1849 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
1850 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
1851 |
+ vv_data.vid_ops.vidioc_s_input = vidioc_s_input; |
1852 |
+diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
1853 |
+index 2e7bd82282caa..b2260deab94cc 100644 |
1854 |
+--- a/drivers/media/pci/saa7146/mxb.c |
1855 |
++++ b/drivers/media/pci/saa7146/mxb.c |
1856 |
+@@ -694,10 +694,16 @@ static struct saa7146_ext_vv vv_data; |
1857 |
+ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
1858 |
+ { |
1859 |
+ struct mxb *mxb; |
1860 |
++ int ret; |
1861 |
+ |
1862 |
+ DEB_EE("dev:%p\n", dev); |
1863 |
+ |
1864 |
+- saa7146_vv_init(dev, &vv_data); |
1865 |
++ ret = saa7146_vv_init(dev, &vv_data); |
1866 |
++ if (ret) { |
1867 |
++ ERR("Error in saa7146_vv_init()"); |
1868 |
++ return ret; |
1869 |
++ } |
1870 |
++ |
1871 |
+ if (mxb_probe(dev)) { |
1872 |
+ saa7146_vv_release(dev); |
1873 |
+ return -1; |
1874 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
1875 |
+index 83f859e8509c9..b95006a864c26 100644 |
1876 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
1877 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
1878 |
+@@ -217,11 +217,11 @@ static int fops_vcodec_release(struct file *file) |
1879 |
+ mtk_v4l2_debug(1, "[%d] encoder", ctx->id); |
1880 |
+ mutex_lock(&dev->dev_mutex); |
1881 |
+ |
1882 |
++ v4l2_m2m_ctx_release(ctx->m2m_ctx); |
1883 |
+ mtk_vcodec_enc_release(ctx); |
1884 |
+ v4l2_fh_del(&ctx->fh); |
1885 |
+ v4l2_fh_exit(&ctx->fh); |
1886 |
+ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); |
1887 |
+- v4l2_m2m_ctx_release(ctx->m2m_ctx); |
1888 |
+ |
1889 |
+ list_del_init(&ctx->list); |
1890 |
+ kfree(ctx); |
1891 |
+diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c |
1892 |
+index a5ea86be8f449..2a0325d1f9def 100644 |
1893 |
+--- a/drivers/media/rc/igorplugusb.c |
1894 |
++++ b/drivers/media/rc/igorplugusb.c |
1895 |
+@@ -73,9 +73,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) |
1896 |
+ if (start >= len) { |
1897 |
+ dev_err(ir->dev, "receive overflow invalid: %u", overflow); |
1898 |
+ } else { |
1899 |
+- if (overflow > 0) |
1900 |
++ if (overflow > 0) { |
1901 |
+ dev_warn(ir->dev, "receive overflow, at least %u lost", |
1902 |
+ overflow); |
1903 |
++ ir_raw_event_reset(ir->rc); |
1904 |
++ } |
1905 |
+ |
1906 |
+ do { |
1907 |
+ rawir.duration = ir->buf_in[i] * 85333; |
1908 |
+diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c |
1909 |
+index 035b2455b26aa..53e68d02763c3 100644 |
1910 |
+--- a/drivers/media/rc/mceusb.c |
1911 |
++++ b/drivers/media/rc/mceusb.c |
1912 |
+@@ -1124,7 +1124,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
1913 |
+ */ |
1914 |
+ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), |
1915 |
+ USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, |
1916 |
+- data, USB_CTRL_MSG_SZ, HZ * 3); |
1917 |
++ data, USB_CTRL_MSG_SZ, 3000); |
1918 |
+ dev_dbg(dev, "set address - ret = %d", ret); |
1919 |
+ dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", |
1920 |
+ data[0], data[1]); |
1921 |
+@@ -1132,20 +1132,20 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
1922 |
+ /* set feature: bit rate 38400 bps */ |
1923 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
1924 |
+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, |
1925 |
+- 0xc04e, 0x0000, NULL, 0, HZ * 3); |
1926 |
++ 0xc04e, 0x0000, NULL, 0, 3000); |
1927 |
+ |
1928 |
+ dev_dbg(dev, "set feature - ret = %d", ret); |
1929 |
+ |
1930 |
+ /* bRequest 4: set char length to 8 bits */ |
1931 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
1932 |
+ 4, USB_TYPE_VENDOR, |
1933 |
+- 0x0808, 0x0000, NULL, 0, HZ * 3); |
1934 |
++ 0x0808, 0x0000, NULL, 0, 3000); |
1935 |
+ dev_dbg(dev, "set char length - retB = %d", ret); |
1936 |
+ |
1937 |
+ /* bRequest 2: set handshaking to use DTR/DSR */ |
1938 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
1939 |
+ 2, USB_TYPE_VENDOR, |
1940 |
+- 0x0000, 0x0100, NULL, 0, HZ * 3); |
1941 |
++ 0x0000, 0x0100, NULL, 0, 3000); |
1942 |
+ dev_dbg(dev, "set handshake - retC = %d", ret); |
1943 |
+ |
1944 |
+ /* device resume */ |
1945 |
+diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c |
1946 |
+index 6784cb9fc4e76..d6fd924fea53b 100644 |
1947 |
+--- a/drivers/media/rc/redrat3.c |
1948 |
++++ b/drivers/media/rc/redrat3.c |
1949 |
+@@ -415,7 +415,7 @@ static int redrat3_send_cmd(int cmd, struct redrat3_dev *rr3) |
1950 |
+ udev = rr3->udev; |
1951 |
+ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, |
1952 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
1953 |
+- 0x0000, 0x0000, data, sizeof(u8), HZ * 10); |
1954 |
++ 0x0000, 0x0000, data, sizeof(u8), 10000); |
1955 |
+ |
1956 |
+ if (res < 0) { |
1957 |
+ dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", |
1958 |
+@@ -491,7 +491,7 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) |
1959 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
1960 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, |
1961 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
1962 |
+- RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); |
1963 |
++ RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); |
1964 |
+ if (ret != len) |
1965 |
+ dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); |
1966 |
+ else { |
1967 |
+@@ -521,7 +521,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) |
1968 |
+ ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, |
1969 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
1970 |
+ RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), |
1971 |
+- HZ * 25); |
1972 |
++ 25000); |
1973 |
+ dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", |
1974 |
+ be32_to_cpu(*timeout), ret); |
1975 |
+ |
1976 |
+@@ -553,32 +553,32 @@ static void redrat3_reset(struct redrat3_dev *rr3) |
1977 |
+ *val = 0x01; |
1978 |
+ rc = usb_control_msg(udev, rxpipe, RR3_RESET, |
1979 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
1980 |
+- RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); |
1981 |
++ RR3_CPUCS_REG_ADDR, 0, val, len, 25000); |
1982 |
+ dev_dbg(dev, "reset returned 0x%02x\n", rc); |
1983 |
+ |
1984 |
+ *val = length_fuzz; |
1985 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
1986 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
1987 |
+- RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); |
1988 |
++ RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); |
1989 |
+ dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); |
1990 |
+ |
1991 |
+ *val = (65536 - (minimum_pause * 2000)) / 256; |
1992 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
1993 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
1994 |
+- RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); |
1995 |
++ RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); |
1996 |
+ dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); |
1997 |
+ |
1998 |
+ *val = periods_measure_carrier; |
1999 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2000 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2001 |
+- RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); |
2002 |
++ RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); |
2003 |
+ dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, |
2004 |
+ rc); |
2005 |
+ |
2006 |
+ *val = RR3_DRIVER_MAXLENS; |
2007 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
2008 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2009 |
+- RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); |
2010 |
++ RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); |
2011 |
+ dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); |
2012 |
+ |
2013 |
+ kfree(val); |
2014 |
+@@ -596,7 +596,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) |
2015 |
+ rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), |
2016 |
+ RR3_FW_VERSION, |
2017 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2018 |
+- 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); |
2019 |
++ 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); |
2020 |
+ |
2021 |
+ if (rc >= 0) |
2022 |
+ dev_info(rr3->dev, "Firmware rev: %s", buffer); |
2023 |
+@@ -836,14 +836,14 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, |
2024 |
+ |
2025 |
+ pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); |
2026 |
+ ret = usb_bulk_msg(rr3->udev, pipe, irdata, |
2027 |
+- sendbuf_len, &ret_len, 10 * HZ); |
2028 |
++ sendbuf_len, &ret_len, 10000); |
2029 |
+ dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); |
2030 |
+ |
2031 |
+ /* now tell the hardware to transmit what we sent it */ |
2032 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
2033 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, |
2034 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2035 |
+- 0, 0, irdata, 2, HZ * 10); |
2036 |
++ 0, 0, irdata, 2, 10000); |
2037 |
+ |
2038 |
+ if (ret < 0) |
2039 |
+ dev_err(dev, "Error: control msg send failed, rc %d\n", ret); |
2040 |
+diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c |
2041 |
+index 3a12ef35682b5..64d98517f470f 100644 |
2042 |
+--- a/drivers/media/tuners/msi001.c |
2043 |
++++ b/drivers/media/tuners/msi001.c |
2044 |
+@@ -464,6 +464,13 @@ static int msi001_probe(struct spi_device *spi) |
2045 |
+ V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); |
2046 |
+ dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
2047 |
+ V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); |
2048 |
++ if (dev->hdl.error) { |
2049 |
++ ret = dev->hdl.error; |
2050 |
++ dev_err(&spi->dev, "Could not initialize controls\n"); |
2051 |
++ /* control init failed, free handler */ |
2052 |
++ goto err_ctrl_handler_free; |
2053 |
++ } |
2054 |
++ |
2055 |
+ v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); |
2056 |
+ dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
2057 |
+ V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); |
2058 |
+diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c |
2059 |
+index c826997f54330..229fea019e99e 100644 |
2060 |
+--- a/drivers/media/tuners/si2157.c |
2061 |
++++ b/drivers/media/tuners/si2157.c |
2062 |
+@@ -89,7 +89,7 @@ static int si2157_init(struct dvb_frontend *fe) |
2063 |
+ dev_dbg(&client->dev, "\n"); |
2064 |
+ |
2065 |
+ /* Try to get Xtal trim property, to verify tuner still running */ |
2066 |
+- memcpy(cmd.args, "\x15\x00\x04\x02", 4); |
2067 |
++ memcpy(cmd.args, "\x15\x00\x02\x04", 4); |
2068 |
+ cmd.wlen = 4; |
2069 |
+ cmd.rlen = 4; |
2070 |
+ ret = si2157_cmd_execute(client, &cmd); |
2071 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
2072 |
+index 5104678f29b76..9dd6e30749fd2 100644 |
2073 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
2074 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
2075 |
+@@ -86,7 +86,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, |
2076 |
+ 0, |
2077 |
+ fc_usb->data, |
2078 |
+ sizeof(u32), |
2079 |
+- B2C2_WAIT_FOR_OPERATION_RDW * HZ); |
2080 |
++ B2C2_WAIT_FOR_OPERATION_RDW); |
2081 |
+ |
2082 |
+ if (ret != sizeof(u32)) { |
2083 |
+ err("error while %s dword from %d (%d).", read ? "reading" : |
2084 |
+@@ -154,7 +154,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, |
2085 |
+ wIndex, |
2086 |
+ fc_usb->data, |
2087 |
+ buflen, |
2088 |
+- nWaitTime * HZ); |
2089 |
++ nWaitTime); |
2090 |
+ if (ret != buflen) |
2091 |
+ ret = -EIO; |
2092 |
+ |
2093 |
+@@ -248,13 +248,13 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
2094 |
+ /* DKT 020208 - add this to support special case of DiSEqC */ |
2095 |
+ case USB_FUNC_I2C_CHECKWRITE: |
2096 |
+ pipe = B2C2_USB_CTRL_PIPE_OUT; |
2097 |
+- nWaitTime = 2; |
2098 |
++ nWaitTime = 2000; |
2099 |
+ request_type |= USB_DIR_OUT; |
2100 |
+ break; |
2101 |
+ case USB_FUNC_I2C_READ: |
2102 |
+ case USB_FUNC_I2C_REPEATREAD: |
2103 |
+ pipe = B2C2_USB_CTRL_PIPE_IN; |
2104 |
+- nWaitTime = 2; |
2105 |
++ nWaitTime = 2000; |
2106 |
+ request_type |= USB_DIR_IN; |
2107 |
+ break; |
2108 |
+ default: |
2109 |
+@@ -281,7 +281,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
2110 |
+ wIndex, |
2111 |
+ fc_usb->data, |
2112 |
+ buflen, |
2113 |
+- nWaitTime * HZ); |
2114 |
++ nWaitTime); |
2115 |
+ |
2116 |
+ if (ret != buflen) |
2117 |
+ ret = -EIO; |
2118 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.h b/drivers/media/usb/b2c2/flexcop-usb.h |
2119 |
+index e86faa0e06ca6..3dfd25fa4750f 100644 |
2120 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.h |
2121 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.h |
2122 |
+@@ -91,13 +91,13 @@ typedef enum { |
2123 |
+ UTILITY_SRAM_TESTVERIFY = 0x16, |
2124 |
+ } flexcop_usb_utility_function_t; |
2125 |
+ |
2126 |
+-#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) |
2127 |
+-#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) |
2128 |
+-#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) |
2129 |
++#define B2C2_WAIT_FOR_OPERATION_RW 1000 |
2130 |
++#define B2C2_WAIT_FOR_OPERATION_RDW 3000 |
2131 |
++#define B2C2_WAIT_FOR_OPERATION_WDW 1000 |
2132 |
+ |
2133 |
+-#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) |
2134 |
+-#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) |
2135 |
+-#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) |
2136 |
++#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 |
2137 |
++#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 |
2138 |
++#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 |
2139 |
+ |
2140 |
+ typedef enum { |
2141 |
+ V8_MEMORY_PAGE_DVB_CI = 0x20, |
2142 |
+diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c |
2143 |
+index 6475f992c2b25..6d96c329f4f70 100644 |
2144 |
+--- a/drivers/media/usb/cpia2/cpia2_usb.c |
2145 |
++++ b/drivers/media/usb/cpia2/cpia2_usb.c |
2146 |
+@@ -559,7 +559,7 @@ static int write_packet(struct usb_device *udev, |
2147 |
+ 0, /* index */ |
2148 |
+ buf, /* buffer */ |
2149 |
+ size, |
2150 |
+- HZ); |
2151 |
++ 1000); |
2152 |
+ |
2153 |
+ kfree(buf); |
2154 |
+ return ret; |
2155 |
+@@ -591,7 +591,7 @@ static int read_packet(struct usb_device *udev, |
2156 |
+ 0, /* index */ |
2157 |
+ buf, /* buffer */ |
2158 |
+ size, |
2159 |
+- HZ); |
2160 |
++ 1000); |
2161 |
+ |
2162 |
+ if (ret >= 0) |
2163 |
+ memcpy(registers, buf, size); |
2164 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c |
2165 |
+index 33dd54c8fa041..9cd4c03bbb42e 100644 |
2166 |
+--- a/drivers/media/usb/dvb-usb/dib0700_core.c |
2167 |
++++ b/drivers/media/usb/dvb-usb/dib0700_core.c |
2168 |
+@@ -619,8 +619,6 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
2169 |
+ deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); |
2170 |
+ if (onoff) |
2171 |
+ st->channel_state |= 1 << (adap->id); |
2172 |
+- else |
2173 |
+- st->channel_state |= 1 << ~(adap->id); |
2174 |
+ } else { |
2175 |
+ if (onoff) |
2176 |
+ st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); |
2177 |
+diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c |
2178 |
+index 3d09e1c879217..98770a95721b9 100644 |
2179 |
+--- a/drivers/media/usb/dvb-usb/dw2102.c |
2180 |
++++ b/drivers/media/usb/dvb-usb/dw2102.c |
2181 |
+@@ -2103,46 +2103,153 @@ static struct dvb_usb_device_properties s6x0_properties = { |
2182 |
+ } |
2183 |
+ }; |
2184 |
+ |
2185 |
+-static const struct dvb_usb_device_description d1100 = { |
2186 |
+- "Prof 1100 USB ", |
2187 |
+- {&dw2102_table[PROF_1100], NULL}, |
2188 |
+- {NULL}, |
2189 |
+-}; |
2190 |
++static struct dvb_usb_device_properties p1100_properties = { |
2191 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2192 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2193 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2194 |
++ .firmware = P1100_FIRMWARE, |
2195 |
++ .no_reconnect = 1, |
2196 |
+ |
2197 |
+-static const struct dvb_usb_device_description d660 = { |
2198 |
+- "TeVii S660 USB", |
2199 |
+- {&dw2102_table[TEVII_S660], NULL}, |
2200 |
+- {NULL}, |
2201 |
+-}; |
2202 |
++ .i2c_algo = &s6x0_i2c_algo, |
2203 |
++ .rc.core = { |
2204 |
++ .rc_interval = 150, |
2205 |
++ .rc_codes = RC_MAP_TBS_NEC, |
2206 |
++ .module_name = "dw2102", |
2207 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
2208 |
++ .rc_query = prof_rc_query, |
2209 |
++ }, |
2210 |
+ |
2211 |
+-static const struct dvb_usb_device_description d480_1 = { |
2212 |
+- "TeVii S480.1 USB", |
2213 |
+- {&dw2102_table[TEVII_S480_1], NULL}, |
2214 |
+- {NULL}, |
2215 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
2216 |
++ .num_adapters = 1, |
2217 |
++ .download_firmware = dw2102_load_firmware, |
2218 |
++ .read_mac_address = s6x0_read_mac_address, |
2219 |
++ .adapter = { |
2220 |
++ { |
2221 |
++ .num_frontends = 1, |
2222 |
++ .fe = {{ |
2223 |
++ .frontend_attach = stv0288_frontend_attach, |
2224 |
++ .stream = { |
2225 |
++ .type = USB_BULK, |
2226 |
++ .count = 8, |
2227 |
++ .endpoint = 0x82, |
2228 |
++ .u = { |
2229 |
++ .bulk = { |
2230 |
++ .buffersize = 4096, |
2231 |
++ } |
2232 |
++ } |
2233 |
++ }, |
2234 |
++ } }, |
2235 |
++ } |
2236 |
++ }, |
2237 |
++ .num_device_descs = 1, |
2238 |
++ .devices = { |
2239 |
++ {"Prof 1100 USB ", |
2240 |
++ {&dw2102_table[PROF_1100], NULL}, |
2241 |
++ {NULL}, |
2242 |
++ }, |
2243 |
++ } |
2244 |
+ }; |
2245 |
+ |
2246 |
+-static const struct dvb_usb_device_description d480_2 = { |
2247 |
+- "TeVii S480.2 USB", |
2248 |
+- {&dw2102_table[TEVII_S480_2], NULL}, |
2249 |
+- {NULL}, |
2250 |
+-}; |
2251 |
++static struct dvb_usb_device_properties s660_properties = { |
2252 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2253 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2254 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2255 |
++ .firmware = S660_FIRMWARE, |
2256 |
++ .no_reconnect = 1, |
2257 |
+ |
2258 |
+-static const struct dvb_usb_device_description d7500 = { |
2259 |
+- "Prof 7500 USB DVB-S2", |
2260 |
+- {&dw2102_table[PROF_7500], NULL}, |
2261 |
+- {NULL}, |
2262 |
+-}; |
2263 |
++ .i2c_algo = &s6x0_i2c_algo, |
2264 |
++ .rc.core = { |
2265 |
++ .rc_interval = 150, |
2266 |
++ .rc_codes = RC_MAP_TEVII_NEC, |
2267 |
++ .module_name = "dw2102", |
2268 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
2269 |
++ .rc_query = dw2102_rc_query, |
2270 |
++ }, |
2271 |
+ |
2272 |
+-static const struct dvb_usb_device_description d421 = { |
2273 |
+- "TeVii S421 PCI", |
2274 |
+- {&dw2102_table[TEVII_S421], NULL}, |
2275 |
+- {NULL}, |
2276 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
2277 |
++ .num_adapters = 1, |
2278 |
++ .download_firmware = dw2102_load_firmware, |
2279 |
++ .read_mac_address = s6x0_read_mac_address, |
2280 |
++ .adapter = { |
2281 |
++ { |
2282 |
++ .num_frontends = 1, |
2283 |
++ .fe = {{ |
2284 |
++ .frontend_attach = ds3000_frontend_attach, |
2285 |
++ .stream = { |
2286 |
++ .type = USB_BULK, |
2287 |
++ .count = 8, |
2288 |
++ .endpoint = 0x82, |
2289 |
++ .u = { |
2290 |
++ .bulk = { |
2291 |
++ .buffersize = 4096, |
2292 |
++ } |
2293 |
++ } |
2294 |
++ }, |
2295 |
++ } }, |
2296 |
++ } |
2297 |
++ }, |
2298 |
++ .num_device_descs = 3, |
2299 |
++ .devices = { |
2300 |
++ {"TeVii S660 USB", |
2301 |
++ {&dw2102_table[TEVII_S660], NULL}, |
2302 |
++ {NULL}, |
2303 |
++ }, |
2304 |
++ {"TeVii S480.1 USB", |
2305 |
++ {&dw2102_table[TEVII_S480_1], NULL}, |
2306 |
++ {NULL}, |
2307 |
++ }, |
2308 |
++ {"TeVii S480.2 USB", |
2309 |
++ {&dw2102_table[TEVII_S480_2], NULL}, |
2310 |
++ {NULL}, |
2311 |
++ }, |
2312 |
++ } |
2313 |
+ }; |
2314 |
+ |
2315 |
+-static const struct dvb_usb_device_description d632 = { |
2316 |
+- "TeVii S632 USB", |
2317 |
+- {&dw2102_table[TEVII_S632], NULL}, |
2318 |
+- {NULL}, |
2319 |
++static struct dvb_usb_device_properties p7500_properties = { |
2320 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2321 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2322 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2323 |
++ .firmware = P7500_FIRMWARE, |
2324 |
++ .no_reconnect = 1, |
2325 |
++ |
2326 |
++ .i2c_algo = &s6x0_i2c_algo, |
2327 |
++ .rc.core = { |
2328 |
++ .rc_interval = 150, |
2329 |
++ .rc_codes = RC_MAP_TBS_NEC, |
2330 |
++ .module_name = "dw2102", |
2331 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
2332 |
++ .rc_query = prof_rc_query, |
2333 |
++ }, |
2334 |
++ |
2335 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
2336 |
++ .num_adapters = 1, |
2337 |
++ .download_firmware = dw2102_load_firmware, |
2338 |
++ .read_mac_address = s6x0_read_mac_address, |
2339 |
++ .adapter = { |
2340 |
++ { |
2341 |
++ .num_frontends = 1, |
2342 |
++ .fe = {{ |
2343 |
++ .frontend_attach = prof_7500_frontend_attach, |
2344 |
++ .stream = { |
2345 |
++ .type = USB_BULK, |
2346 |
++ .count = 8, |
2347 |
++ .endpoint = 0x82, |
2348 |
++ .u = { |
2349 |
++ .bulk = { |
2350 |
++ .buffersize = 4096, |
2351 |
++ } |
2352 |
++ } |
2353 |
++ }, |
2354 |
++ } }, |
2355 |
++ } |
2356 |
++ }, |
2357 |
++ .num_device_descs = 1, |
2358 |
++ .devices = { |
2359 |
++ {"Prof 7500 USB DVB-S2", |
2360 |
++ {&dw2102_table[PROF_7500], NULL}, |
2361 |
++ {NULL}, |
2362 |
++ }, |
2363 |
++ } |
2364 |
+ }; |
2365 |
+ |
2366 |
+ static struct dvb_usb_device_properties su3000_properties = { |
2367 |
+@@ -2214,6 +2321,59 @@ static struct dvb_usb_device_properties su3000_properties = { |
2368 |
+ } |
2369 |
+ }; |
2370 |
+ |
2371 |
++static struct dvb_usb_device_properties s421_properties = { |
2372 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2373 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
2374 |
++ .size_of_priv = sizeof(struct dw2102_state), |
2375 |
++ .power_ctrl = su3000_power_ctrl, |
2376 |
++ .num_adapters = 1, |
2377 |
++ .identify_state = su3000_identify_state, |
2378 |
++ .i2c_algo = &su3000_i2c_algo, |
2379 |
++ |
2380 |
++ .rc.core = { |
2381 |
++ .rc_interval = 150, |
2382 |
++ .rc_codes = RC_MAP_SU3000, |
2383 |
++ .module_name = "dw2102", |
2384 |
++ .allowed_protos = RC_PROTO_BIT_RC5, |
2385 |
++ .rc_query = su3000_rc_query, |
2386 |
++ }, |
2387 |
++ |
2388 |
++ .read_mac_address = su3000_read_mac_address, |
2389 |
++ |
2390 |
++ .generic_bulk_ctrl_endpoint = 0x01, |
2391 |
++ |
2392 |
++ .adapter = { |
2393 |
++ { |
2394 |
++ .num_frontends = 1, |
2395 |
++ .fe = {{ |
2396 |
++ .streaming_ctrl = su3000_streaming_ctrl, |
2397 |
++ .frontend_attach = m88rs2000_frontend_attach, |
2398 |
++ .stream = { |
2399 |
++ .type = USB_BULK, |
2400 |
++ .count = 8, |
2401 |
++ .endpoint = 0x82, |
2402 |
++ .u = { |
2403 |
++ .bulk = { |
2404 |
++ .buffersize = 4096, |
2405 |
++ } |
2406 |
++ } |
2407 |
++ } |
2408 |
++ } }, |
2409 |
++ } |
2410 |
++ }, |
2411 |
++ .num_device_descs = 2, |
2412 |
++ .devices = { |
2413 |
++ { "TeVii S421 PCI", |
2414 |
++ { &dw2102_table[TEVII_S421], NULL }, |
2415 |
++ { NULL }, |
2416 |
++ }, |
2417 |
++ { "TeVii S632 USB", |
2418 |
++ { &dw2102_table[TEVII_S632], NULL }, |
2419 |
++ { NULL }, |
2420 |
++ }, |
2421 |
++ } |
2422 |
++}; |
2423 |
++ |
2424 |
+ static struct dvb_usb_device_properties t220_properties = { |
2425 |
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
2426 |
+ .usb_ctrl = DEVICE_SPECIFIC, |
2427 |
+@@ -2331,101 +2491,33 @@ static struct dvb_usb_device_properties tt_s2_4600_properties = { |
2428 |
+ static int dw2102_probe(struct usb_interface *intf, |
2429 |
+ const struct usb_device_id *id) |
2430 |
+ { |
2431 |
+- int retval = -ENOMEM; |
2432 |
+- struct dvb_usb_device_properties *p1100; |
2433 |
+- struct dvb_usb_device_properties *s660; |
2434 |
+- struct dvb_usb_device_properties *p7500; |
2435 |
+- struct dvb_usb_device_properties *s421; |
2436 |
+- |
2437 |
+- p1100 = kmemdup(&s6x0_properties, |
2438 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
2439 |
+- if (!p1100) |
2440 |
+- goto err0; |
2441 |
+- |
2442 |
+- /* copy default structure */ |
2443 |
+- /* fill only different fields */ |
2444 |
+- p1100->firmware = P1100_FIRMWARE; |
2445 |
+- p1100->devices[0] = d1100; |
2446 |
+- p1100->rc.core.rc_query = prof_rc_query; |
2447 |
+- p1100->rc.core.rc_codes = RC_MAP_TBS_NEC; |
2448 |
+- p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach; |
2449 |
+- |
2450 |
+- s660 = kmemdup(&s6x0_properties, |
2451 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
2452 |
+- if (!s660) |
2453 |
+- goto err1; |
2454 |
+- |
2455 |
+- s660->firmware = S660_FIRMWARE; |
2456 |
+- s660->num_device_descs = 3; |
2457 |
+- s660->devices[0] = d660; |
2458 |
+- s660->devices[1] = d480_1; |
2459 |
+- s660->devices[2] = d480_2; |
2460 |
+- s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach; |
2461 |
+- |
2462 |
+- p7500 = kmemdup(&s6x0_properties, |
2463 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
2464 |
+- if (!p7500) |
2465 |
+- goto err2; |
2466 |
+- |
2467 |
+- p7500->firmware = P7500_FIRMWARE; |
2468 |
+- p7500->devices[0] = d7500; |
2469 |
+- p7500->rc.core.rc_query = prof_rc_query; |
2470 |
+- p7500->rc.core.rc_codes = RC_MAP_TBS_NEC; |
2471 |
+- p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach; |
2472 |
+- |
2473 |
+- |
2474 |
+- s421 = kmemdup(&su3000_properties, |
2475 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
2476 |
+- if (!s421) |
2477 |
+- goto err3; |
2478 |
+- |
2479 |
+- s421->num_device_descs = 2; |
2480 |
+- s421->devices[0] = d421; |
2481 |
+- s421->devices[1] = d632; |
2482 |
+- s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach; |
2483 |
+- |
2484 |
+- if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
2485 |
+- THIS_MODULE, NULL, adapter_nr) || |
2486 |
+- 0 == dvb_usb_device_init(intf, &dw2104_properties, |
2487 |
+- THIS_MODULE, NULL, adapter_nr) || |
2488 |
+- 0 == dvb_usb_device_init(intf, &dw3101_properties, |
2489 |
+- THIS_MODULE, NULL, adapter_nr) || |
2490 |
+- 0 == dvb_usb_device_init(intf, &s6x0_properties, |
2491 |
+- THIS_MODULE, NULL, adapter_nr) || |
2492 |
+- 0 == dvb_usb_device_init(intf, p1100, |
2493 |
+- THIS_MODULE, NULL, adapter_nr) || |
2494 |
+- 0 == dvb_usb_device_init(intf, s660, |
2495 |
+- THIS_MODULE, NULL, adapter_nr) || |
2496 |
+- 0 == dvb_usb_device_init(intf, p7500, |
2497 |
+- THIS_MODULE, NULL, adapter_nr) || |
2498 |
+- 0 == dvb_usb_device_init(intf, s421, |
2499 |
+- THIS_MODULE, NULL, adapter_nr) || |
2500 |
+- 0 == dvb_usb_device_init(intf, &su3000_properties, |
2501 |
+- THIS_MODULE, NULL, adapter_nr) || |
2502 |
+- 0 == dvb_usb_device_init(intf, &t220_properties, |
2503 |
+- THIS_MODULE, NULL, adapter_nr) || |
2504 |
+- 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, |
2505 |
+- THIS_MODULE, NULL, adapter_nr)) { |
2506 |
+- |
2507 |
+- /* clean up copied properties */ |
2508 |
+- kfree(s421); |
2509 |
+- kfree(p7500); |
2510 |
+- kfree(s660); |
2511 |
+- kfree(p1100); |
2512 |
++ if (!(dvb_usb_device_init(intf, &dw2102_properties, |
2513 |
++ THIS_MODULE, NULL, adapter_nr) && |
2514 |
++ dvb_usb_device_init(intf, &dw2104_properties, |
2515 |
++ THIS_MODULE, NULL, adapter_nr) && |
2516 |
++ dvb_usb_device_init(intf, &dw3101_properties, |
2517 |
++ THIS_MODULE, NULL, adapter_nr) && |
2518 |
++ dvb_usb_device_init(intf, &s6x0_properties, |
2519 |
++ THIS_MODULE, NULL, adapter_nr) && |
2520 |
++ dvb_usb_device_init(intf, &p1100_properties, |
2521 |
++ THIS_MODULE, NULL, adapter_nr) && |
2522 |
++ dvb_usb_device_init(intf, &s660_properties, |
2523 |
++ THIS_MODULE, NULL, adapter_nr) && |
2524 |
++ dvb_usb_device_init(intf, &p7500_properties, |
2525 |
++ THIS_MODULE, NULL, adapter_nr) && |
2526 |
++ dvb_usb_device_init(intf, &s421_properties, |
2527 |
++ THIS_MODULE, NULL, adapter_nr) && |
2528 |
++ dvb_usb_device_init(intf, &su3000_properties, |
2529 |
++ THIS_MODULE, NULL, adapter_nr) && |
2530 |
++ dvb_usb_device_init(intf, &t220_properties, |
2531 |
++ THIS_MODULE, NULL, adapter_nr) && |
2532 |
++ dvb_usb_device_init(intf, &tt_s2_4600_properties, |
2533 |
++ THIS_MODULE, NULL, adapter_nr))) { |
2534 |
+ |
2535 |
+ return 0; |
2536 |
+ } |
2537 |
+ |
2538 |
+- retval = -ENODEV; |
2539 |
+- kfree(s421); |
2540 |
+-err3: |
2541 |
+- kfree(p7500); |
2542 |
+-err2: |
2543 |
+- kfree(s660); |
2544 |
+-err1: |
2545 |
+- kfree(p1100); |
2546 |
+-err0: |
2547 |
+- return retval; |
2548 |
++ return -ENODEV; |
2549 |
+ } |
2550 |
+ |
2551 |
+ static void dw2102_disconnect(struct usb_interface *intf) |
2552 |
+diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c |
2553 |
+index 32081c2ce0da8..8a43e2415686a 100644 |
2554 |
+--- a/drivers/media/usb/dvb-usb/m920x.c |
2555 |
++++ b/drivers/media/usb/dvb-usb/m920x.c |
2556 |
+@@ -280,6 +280,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
2557 |
+ /* Should check for ack here, if we knew how. */ |
2558 |
+ } |
2559 |
+ if (msg[i].flags & I2C_M_RD) { |
2560 |
++ char *read = kmalloc(1, GFP_KERNEL); |
2561 |
++ if (!read) { |
2562 |
++ ret = -ENOMEM; |
2563 |
++ kfree(read); |
2564 |
++ goto unlock; |
2565 |
++ } |
2566 |
++ |
2567 |
+ for (j = 0; j < msg[i].len; j++) { |
2568 |
+ /* Last byte of transaction? |
2569 |
+ * Send STOP, otherwise send ACK. */ |
2570 |
+@@ -287,9 +294,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
2571 |
+ |
2572 |
+ if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
2573 |
+ 0x20 | stop, |
2574 |
+- &msg[i].buf[j], 1)) != 0) |
2575 |
++ read, 1)) != 0) |
2576 |
+ goto unlock; |
2577 |
++ msg[i].buf[j] = read[0]; |
2578 |
+ } |
2579 |
++ |
2580 |
++ kfree(read); |
2581 |
+ } else { |
2582 |
+ for (j = 0; j < msg[i].len; j++) { |
2583 |
+ /* Last byte of transaction? Then send STOP. */ |
2584 |
+diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c |
2585 |
+index 9747e23aad271..b736c027a0bd0 100644 |
2586 |
+--- a/drivers/media/usb/em28xx/em28xx-cards.c |
2587 |
++++ b/drivers/media/usb/em28xx/em28xx-cards.c |
2588 |
+@@ -3386,8 +3386,10 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
2589 |
+ |
2590 |
+ if (dev->is_audio_only) { |
2591 |
+ retval = em28xx_audio_setup(dev); |
2592 |
+- if (retval) |
2593 |
+- return -ENODEV; |
2594 |
++ if (retval) { |
2595 |
++ retval = -ENODEV; |
2596 |
++ goto err_deinit_media; |
2597 |
++ } |
2598 |
+ em28xx_init_extension(dev); |
2599 |
+ |
2600 |
+ return 0; |
2601 |
+@@ -3417,7 +3419,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
2602 |
+ dev_err(&dev->intf->dev, |
2603 |
+ "%s: em28xx_i2c_register bus 0 - error [%d]!\n", |
2604 |
+ __func__, retval); |
2605 |
+- return retval; |
2606 |
++ goto err_deinit_media; |
2607 |
+ } |
2608 |
+ |
2609 |
+ /* register i2c bus 1 */ |
2610 |
+@@ -3433,9 +3435,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
2611 |
+ "%s: em28xx_i2c_register bus 1 - error [%d]!\n", |
2612 |
+ __func__, retval); |
2613 |
+ |
2614 |
+- em28xx_i2c_unregister(dev, 0); |
2615 |
+- |
2616 |
+- return retval; |
2617 |
++ goto err_unreg_i2c; |
2618 |
+ } |
2619 |
+ } |
2620 |
+ |
2621 |
+@@ -3443,6 +3443,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
2622 |
+ em28xx_card_setup(dev); |
2623 |
+ |
2624 |
+ return 0; |
2625 |
++ |
2626 |
++err_unreg_i2c: |
2627 |
++ em28xx_i2c_unregister(dev, 0); |
2628 |
++err_deinit_media: |
2629 |
++ em28xx_unregister_media_device(dev); |
2630 |
++ return retval; |
2631 |
+ } |
2632 |
+ |
2633 |
+ /* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ |
2634 |
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c |
2635 |
+index 1d0d8cc061038..0fea2b5e9fcbb 100644 |
2636 |
+--- a/drivers/media/usb/em28xx/em28xx-core.c |
2637 |
++++ b/drivers/media/usb/em28xx/em28xx-core.c |
2638 |
+@@ -94,7 +94,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, |
2639 |
+ mutex_lock(&dev->ctrl_urb_lock); |
2640 |
+ ret = usb_control_msg(udev, pipe, req, |
2641 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2642 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
2643 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
2644 |
+ if (ret < 0) { |
2645 |
+ em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %02x failed with error %i\n", |
2646 |
+ pipe, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2647 |
+@@ -162,7 +162,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, |
2648 |
+ memcpy(dev->urb_buf, buf, len); |
2649 |
+ ret = usb_control_msg(udev, pipe, req, |
2650 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2651 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
2652 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
2653 |
+ mutex_unlock(&dev->ctrl_urb_lock); |
2654 |
+ |
2655 |
+ if (ret < 0) { |
2656 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
2657 |
+index fd1bd94cd78f6..4ca7e1fad08b1 100644 |
2658 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
2659 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
2660 |
+@@ -1476,7 +1476,7 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) |
2661 |
+ for (address = 0; address < fwsize; address += 0x800) { |
2662 |
+ memcpy(fw_ptr, fw_entry->data + address, 0x800); |
2663 |
+ ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, |
2664 |
+- 0, fw_ptr, 0x800, HZ); |
2665 |
++ 0, fw_ptr, 0x800, 1000); |
2666 |
+ } |
2667 |
+ |
2668 |
+ trace_firmware("Upload done, releasing device's CPU"); |
2669 |
+@@ -1614,7 +1614,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) |
2670 |
+ ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); |
2671 |
+ |
2672 |
+ ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, |
2673 |
+- &actual_length, HZ); |
2674 |
++ &actual_length, 1000); |
2675 |
+ ret |= (actual_length != bcnt); |
2676 |
+ if (ret) break; |
2677 |
+ fw_done += bcnt; |
2678 |
+@@ -3433,7 +3433,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, |
2679 |
+ 0xa0,0xc0, |
2680 |
+ address,0, |
2681 |
+ hdw->fw_buffer+address, |
2682 |
+- 0x800,HZ); |
2683 |
++ 0x800,1000); |
2684 |
+ if (ret < 0) break; |
2685 |
+ } |
2686 |
+ |
2687 |
+@@ -3961,7 +3961,7 @@ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) |
2688 |
+ /* Write the CPUCS register on the 8051. The lsb of the register |
2689 |
+ is the reset bit; a 1 asserts reset while a 0 clears it. */ |
2690 |
+ pipe = usb_sndctrlpipe(hdw->usb_dev, 0); |
2691 |
+- ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); |
2692 |
++ ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); |
2693 |
+ if (ret < 0) { |
2694 |
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
2695 |
+ "cpureset_assert(%d) error=%d",val,ret); |
2696 |
+diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c |
2697 |
+index b2f239c4ba426..08106d3866b41 100644 |
2698 |
+--- a/drivers/media/usb/s2255/s2255drv.c |
2699 |
++++ b/drivers/media/usb/s2255/s2255drv.c |
2700 |
+@@ -1911,7 +1911,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
2701 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
2702 |
+ USB_DIR_IN, |
2703 |
+ Value, Index, buf, |
2704 |
+- TransferBufferLength, HZ * 5); |
2705 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
2706 |
+ |
2707 |
+ if (r >= 0) |
2708 |
+ memcpy(TransferBuffer, buf, TransferBufferLength); |
2709 |
+@@ -1920,7 +1920,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
2710 |
+ r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
2711 |
+ Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2712 |
+ Value, Index, buf, |
2713 |
+- TransferBufferLength, HZ * 5); |
2714 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
2715 |
+ } |
2716 |
+ kfree(buf); |
2717 |
+ return r; |
2718 |
+diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
2719 |
+index bea8bbbb84fba..8e434b31cb988 100644 |
2720 |
+--- a/drivers/media/usb/stk1160/stk1160-core.c |
2721 |
++++ b/drivers/media/usb/stk1160/stk1160-core.c |
2722 |
+@@ -75,7 +75,7 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) |
2723 |
+ return -ENOMEM; |
2724 |
+ ret = usb_control_msg(dev->udev, pipe, 0x00, |
2725 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2726 |
+- 0x00, reg, buf, sizeof(u8), HZ); |
2727 |
++ 0x00, reg, buf, sizeof(u8), 1000); |
2728 |
+ if (ret < 0) { |
2729 |
+ stk1160_err("read failed on reg 0x%x (%d)\n", |
2730 |
+ reg, ret); |
2731 |
+@@ -95,7 +95,7 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) |
2732 |
+ |
2733 |
+ ret = usb_control_msg(dev->udev, pipe, 0x01, |
2734 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
2735 |
+- value, reg, NULL, 0, HZ); |
2736 |
++ value, reg, NULL, 0, 1000); |
2737 |
+ if (ret < 0) { |
2738 |
+ stk1160_err("write failed on reg 0x%x (%d)\n", |
2739 |
+ reg, ret); |
2740 |
+diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c |
2741 |
+index ce0a180191447..6017826638710 100644 |
2742 |
+--- a/drivers/media/usb/uvc/uvc_video.c |
2743 |
++++ b/drivers/media/usb/uvc/uvc_video.c |
2744 |
+@@ -1711,6 +1711,10 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) |
2745 |
+ if (ep == NULL) |
2746 |
+ return -EIO; |
2747 |
+ |
2748 |
++ /* Reject broken descriptors. */ |
2749 |
++ if (usb_endpoint_maxp(&ep->desc) == 0) |
2750 |
++ return -EIO; |
2751 |
++ |
2752 |
+ ret = uvc_init_video_bulk(stream, ep, gfp_flags); |
2753 |
+ } |
2754 |
+ |
2755 |
+diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h |
2756 |
+index 05398784d1c89..acb9f95127eb2 100644 |
2757 |
+--- a/drivers/media/usb/uvc/uvcvideo.h |
2758 |
++++ b/drivers/media/usb/uvc/uvcvideo.h |
2759 |
+@@ -167,7 +167,7 @@ |
2760 |
+ /* Maximum status buffer size in bytes of interrupt URB. */ |
2761 |
+ #define UVC_MAX_STATUS_SIZE 16 |
2762 |
+ |
2763 |
+-#define UVC_CTRL_CONTROL_TIMEOUT 500 |
2764 |
++#define UVC_CTRL_CONTROL_TIMEOUT 5000 |
2765 |
+ #define UVC_CTRL_STREAMING_TIMEOUT 5000 |
2766 |
+ |
2767 |
+ /* Maximum allowed number of control mappings per device */ |
2768 |
+diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c |
2769 |
+index 7911b0a14a6d0..fc44fb7c595bc 100644 |
2770 |
+--- a/drivers/mfd/intel-lpss-acpi.c |
2771 |
++++ b/drivers/mfd/intel-lpss-acpi.c |
2772 |
+@@ -80,6 +80,7 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
2773 |
+ { |
2774 |
+ struct intel_lpss_platform_info *info; |
2775 |
+ const struct acpi_device_id *id; |
2776 |
++ int ret; |
2777 |
+ |
2778 |
+ id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev); |
2779 |
+ if (!id) |
2780 |
+@@ -93,10 +94,14 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
2781 |
+ info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2782 |
+ info->irq = platform_get_irq(pdev, 0); |
2783 |
+ |
2784 |
++ ret = intel_lpss_probe(&pdev->dev, info); |
2785 |
++ if (ret) |
2786 |
++ return ret; |
2787 |
++ |
2788 |
+ pm_runtime_set_active(&pdev->dev); |
2789 |
+ pm_runtime_enable(&pdev->dev); |
2790 |
+ |
2791 |
+- return intel_lpss_probe(&pdev->dev, info); |
2792 |
++ return 0; |
2793 |
+ } |
2794 |
+ |
2795 |
+ static int intel_lpss_acpi_remove(struct platform_device *pdev) |
2796 |
+diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c |
2797 |
+index 626fdcaf25101..645d26536114f 100644 |
2798 |
+--- a/drivers/misc/lattice-ecp3-config.c |
2799 |
++++ b/drivers/misc/lattice-ecp3-config.c |
2800 |
+@@ -81,12 +81,12 @@ static void firmware_load(const struct firmware *fw, void *context) |
2801 |
+ |
2802 |
+ if (fw == NULL) { |
2803 |
+ dev_err(&spi->dev, "Cannot load firmware, aborting\n"); |
2804 |
+- return; |
2805 |
++ goto out; |
2806 |
+ } |
2807 |
+ |
2808 |
+ if (fw->size == 0) { |
2809 |
+ dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
2810 |
+- return; |
2811 |
++ goto out; |
2812 |
+ } |
2813 |
+ |
2814 |
+ /* Fill dummy data (24 stuffing bits for commands) */ |
2815 |
+@@ -108,7 +108,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
2816 |
+ dev_err(&spi->dev, |
2817 |
+ "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", |
2818 |
+ jedec_id); |
2819 |
+- return; |
2820 |
++ goto out; |
2821 |
+ } |
2822 |
+ |
2823 |
+ dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); |
2824 |
+@@ -121,7 +121,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
2825 |
+ buffer = kzalloc(fw->size + 8, GFP_KERNEL); |
2826 |
+ if (!buffer) { |
2827 |
+ dev_err(&spi->dev, "Error: Can't allocate memory!\n"); |
2828 |
+- return; |
2829 |
++ goto out; |
2830 |
+ } |
2831 |
+ |
2832 |
+ /* |
2833 |
+@@ -160,7 +160,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
2834 |
+ "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", |
2835 |
+ status); |
2836 |
+ kfree(buffer); |
2837 |
+- return; |
2838 |
++ goto out; |
2839 |
+ } |
2840 |
+ |
2841 |
+ dev_info(&spi->dev, "Configuring the FPGA...\n"); |
2842 |
+@@ -186,7 +186,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
2843 |
+ release_firmware(fw); |
2844 |
+ |
2845 |
+ kfree(buffer); |
2846 |
+- |
2847 |
++out: |
2848 |
+ complete(&data->fw_loaded); |
2849 |
+ } |
2850 |
+ |
2851 |
+diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c |
2852 |
+index 7568cea559220..bf0a0ef60d6b4 100644 |
2853 |
+--- a/drivers/mmc/core/sdio.c |
2854 |
++++ b/drivers/mmc/core/sdio.c |
2855 |
+@@ -631,6 +631,8 @@ try_again: |
2856 |
+ if (host->ops->init_card) |
2857 |
+ host->ops->init_card(host, card); |
2858 |
+ |
2859 |
++ card->ocr = ocr_card; |
2860 |
++ |
2861 |
+ /* |
2862 |
+ * If the host and card support UHS-I mode request the card |
2863 |
+ * to switch to 1.8V signaling level. No 1.8v signalling if |
2864 |
+@@ -737,7 +739,7 @@ try_again: |
2865 |
+ |
2866 |
+ card = oldcard; |
2867 |
+ } |
2868 |
+- card->ocr = ocr_card; |
2869 |
++ |
2870 |
+ mmc_fixup_device(card, sdio_fixup_methods); |
2871 |
+ |
2872 |
+ if (card->type == MMC_TYPE_SD_COMBO) { |
2873 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
2874 |
+index 340e7bf6463ec..7096fcbf699c0 100644 |
2875 |
+--- a/drivers/net/bonding/bond_main.c |
2876 |
++++ b/drivers/net/bonding/bond_main.c |
2877 |
+@@ -782,14 +782,14 @@ static bool bond_should_notify_peers(struct bonding *bond) |
2878 |
+ slave = rcu_dereference(bond->curr_active_slave); |
2879 |
+ rcu_read_unlock(); |
2880 |
+ |
2881 |
+- netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
2882 |
+- slave ? slave->dev->name : "NULL"); |
2883 |
+- |
2884 |
+ if (!slave || !bond->send_peer_notif || |
2885 |
+ !netif_carrier_ok(bond->dev) || |
2886 |
+ test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
2887 |
+ return false; |
2888 |
+ |
2889 |
++ netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
2890 |
++ slave ? slave->dev->name : "NULL"); |
2891 |
++ |
2892 |
+ return true; |
2893 |
+ } |
2894 |
+ |
2895 |
+diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c |
2896 |
+index 4d4492884e0b0..efe7d576afa5c 100644 |
2897 |
+--- a/drivers/net/can/softing/softing_cs.c |
2898 |
++++ b/drivers/net/can/softing/softing_cs.c |
2899 |
+@@ -304,7 +304,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia) |
2900 |
+ return 0; |
2901 |
+ |
2902 |
+ platform_failed: |
2903 |
+- kfree(dev); |
2904 |
++ platform_device_put(pdev); |
2905 |
+ mem_failed: |
2906 |
+ pcmcia_bad: |
2907 |
+ pcmcia_failed: |
2908 |
+diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c |
2909 |
+index aac58ce6e371a..209eddeb822e5 100644 |
2910 |
+--- a/drivers/net/can/softing/softing_fw.c |
2911 |
++++ b/drivers/net/can/softing/softing_fw.c |
2912 |
+@@ -576,18 +576,19 @@ int softing_startstop(struct net_device *dev, int up) |
2913 |
+ if (ret < 0) |
2914 |
+ goto failed; |
2915 |
+ } |
2916 |
+- /* enable_error_frame */ |
2917 |
+- /* |
2918 |
++ |
2919 |
++ /* enable_error_frame |
2920 |
++ * |
2921 |
+ * Error reporting is switched off at the moment since |
2922 |
+ * the receiving of them is not yet 100% verified |
2923 |
+ * This should be enabled sooner or later |
2924 |
+- * |
2925 |
+- if (error_reporting) { |
2926 |
++ */ |
2927 |
++ if (0 && error_reporting) { |
2928 |
+ ret = softing_fct_cmd(card, 51, "enable_error_frame"); |
2929 |
+ if (ret < 0) |
2930 |
+ goto failed; |
2931 |
+ } |
2932 |
+- */ |
2933 |
++ |
2934 |
+ /* initialize interface */ |
2935 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); |
2936 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); |
2937 |
+diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
2938 |
+index 99c42f297afdf..6b6fe0fba74ff 100644 |
2939 |
+--- a/drivers/net/can/usb/gs_usb.c |
2940 |
++++ b/drivers/net/can/usb/gs_usb.c |
2941 |
+@@ -328,7 +328,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
2942 |
+ |
2943 |
+ /* device reports out of range channel id */ |
2944 |
+ if (hf->channel >= GS_MAX_INTF) |
2945 |
+- goto resubmit_urb; |
2946 |
++ goto device_detach; |
2947 |
+ |
2948 |
+ dev = usbcan->canch[hf->channel]; |
2949 |
+ |
2950 |
+@@ -413,6 +413,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
2951 |
+ |
2952 |
+ /* USB failure take down all interfaces */ |
2953 |
+ if (rc == -ENODEV) { |
2954 |
++ device_detach: |
2955 |
+ for (rc = 0; rc < GS_MAX_INTF; rc++) { |
2956 |
+ if (usbcan->canch[rc]) |
2957 |
+ netif_device_detach(usbcan->canch[rc]->netdev); |
2958 |
+@@ -514,6 +515,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, |
2959 |
+ |
2960 |
+ hf->echo_id = idx; |
2961 |
+ hf->channel = dev->channel; |
2962 |
++ hf->flags = 0; |
2963 |
++ hf->reserved = 0; |
2964 |
+ |
2965 |
+ cf = (struct can_frame *)skb->data; |
2966 |
+ |
2967 |
+diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c |
2968 |
+index 5a24039733efd..caab0df7b368f 100644 |
2969 |
+--- a/drivers/net/can/xilinx_can.c |
2970 |
++++ b/drivers/net/can/xilinx_can.c |
2971 |
+@@ -1302,7 +1302,12 @@ static int xcan_probe(struct platform_device *pdev) |
2972 |
+ spin_lock_init(&priv->tx_lock); |
2973 |
+ |
2974 |
+ /* Get IRQ for the device */ |
2975 |
+- ndev->irq = platform_get_irq(pdev, 0); |
2976 |
++ ret = platform_get_irq(pdev, 0); |
2977 |
++ if (ret < 0) |
2978 |
++ goto err_free; |
2979 |
++ |
2980 |
++ ndev->irq = ret; |
2981 |
++ |
2982 |
+ ndev->flags |= IFF_ECHO; /* We support local echo */ |
2983 |
+ |
2984 |
+ platform_set_drvdata(pdev, ndev); |
2985 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2986 |
+index 23ff3ec666cdd..b819a9bde6cc3 100644 |
2987 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2988 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2989 |
+@@ -3519,10 +3519,12 @@ static int bcmgenet_probe(struct platform_device *pdev) |
2990 |
+ |
2991 |
+ /* Request the WOL interrupt and advertise suspend if available */ |
2992 |
+ priv->wol_irq_disabled = true; |
2993 |
+- err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, |
2994 |
+- dev->name, priv); |
2995 |
+- if (!err) |
2996 |
+- device_set_wakeup_capable(&pdev->dev, 1); |
2997 |
++ if (priv->wol_irq > 0) { |
2998 |
++ err = devm_request_irq(&pdev->dev, priv->wol_irq, |
2999 |
++ bcmgenet_wol_isr, 0, dev->name, priv); |
3000 |
++ if (!err) |
3001 |
++ device_set_wakeup_capable(&pdev->dev, 1); |
3002 |
++ } |
3003 |
+ |
3004 |
+ /* Set the needed headroom to account for any possible |
3005 |
+ * features enabling/disabling at runtime |
3006 |
+diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3007 |
+index d04a6c1634452..da8d10475a08e 100644 |
3008 |
+--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3009 |
++++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
3010 |
+@@ -32,6 +32,7 @@ |
3011 |
+ |
3012 |
+ #include <linux/tcp.h> |
3013 |
+ #include <linux/ipv6.h> |
3014 |
++#include <net/inet_ecn.h> |
3015 |
+ #include <net/route.h> |
3016 |
+ #include <net/ip6_route.h> |
3017 |
+ |
3018 |
+@@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *lldi, |
3019 |
+ |
3020 |
+ rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, |
3021 |
+ peer_port, local_port, IPPROTO_TCP, |
3022 |
+- tos, 0); |
3023 |
++ tos & ~INET_ECN_MASK, 0); |
3024 |
+ if (IS_ERR(rt)) |
3025 |
+ return NULL; |
3026 |
+ n = dst_neigh_lookup(&rt->dst, &peer_ip); |
3027 |
+diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c |
3028 |
+index 387eb4a88b723..3221a54202638 100644 |
3029 |
+--- a/drivers/net/ethernet/freescale/fman/mac.c |
3030 |
++++ b/drivers/net/ethernet/freescale/fman/mac.c |
3031 |
+@@ -96,14 +96,17 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) |
3032 |
+ __func__, ex); |
3033 |
+ } |
3034 |
+ |
3035 |
+-static void set_fman_mac_params(struct mac_device *mac_dev, |
3036 |
+- struct fman_mac_params *params) |
3037 |
++static int set_fman_mac_params(struct mac_device *mac_dev, |
3038 |
++ struct fman_mac_params *params) |
3039 |
+ { |
3040 |
+ struct mac_priv_s *priv = mac_dev->priv; |
3041 |
+ |
3042 |
+ params->base_addr = (typeof(params->base_addr)) |
3043 |
+ devm_ioremap(priv->dev, mac_dev->res->start, |
3044 |
+ resource_size(mac_dev->res)); |
3045 |
++ if (!params->base_addr) |
3046 |
++ return -ENOMEM; |
3047 |
++ |
3048 |
+ memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); |
3049 |
+ params->max_speed = priv->max_speed; |
3050 |
+ params->phy_if = priv->phy_if; |
3051 |
+@@ -114,6 +117,8 @@ static void set_fman_mac_params(struct mac_device *mac_dev, |
3052 |
+ params->event_cb = mac_exception; |
3053 |
+ params->dev_id = mac_dev; |
3054 |
+ params->internal_phy_node = priv->internal_phy_node; |
3055 |
++ |
3056 |
++ return 0; |
3057 |
+ } |
3058 |
+ |
3059 |
+ static int tgec_initialization(struct mac_device *mac_dev) |
3060 |
+@@ -125,7 +130,9 @@ static int tgec_initialization(struct mac_device *mac_dev) |
3061 |
+ |
3062 |
+ priv = mac_dev->priv; |
3063 |
+ |
3064 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3065 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3066 |
++ if (err) |
3067 |
++ goto _return; |
3068 |
+ |
3069 |
+ mac_dev->fman_mac = tgec_config(¶ms); |
3070 |
+ if (!mac_dev->fman_mac) { |
3071 |
+@@ -171,7 +178,9 @@ static int dtsec_initialization(struct mac_device *mac_dev) |
3072 |
+ |
3073 |
+ priv = mac_dev->priv; |
3074 |
+ |
3075 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3076 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3077 |
++ if (err) |
3078 |
++ goto _return; |
3079 |
+ |
3080 |
+ mac_dev->fman_mac = dtsec_config(¶ms); |
3081 |
+ if (!mac_dev->fman_mac) { |
3082 |
+@@ -220,7 +229,9 @@ static int memac_initialization(struct mac_device *mac_dev) |
3083 |
+ |
3084 |
+ priv = mac_dev->priv; |
3085 |
+ |
3086 |
+- set_fman_mac_params(mac_dev, ¶ms); |
3087 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
3088 |
++ if (err) |
3089 |
++ goto _return; |
3090 |
+ |
3091 |
+ if (priv->max_speed == SPEED_10000) |
3092 |
+ params.phy_if = PHY_INTERFACE_MODE_XGMII; |
3093 |
+diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c |
3094 |
+index c89a5a80c9c8b..4feab06b7ad7a 100644 |
3095 |
+--- a/drivers/net/ethernet/freescale/gianfar.c |
3096 |
++++ b/drivers/net/ethernet/freescale/gianfar.c |
3097 |
+@@ -2936,29 +2936,21 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus, |
3098 |
+ { |
3099 |
+ int size = lstatus & BD_LENGTH_MASK; |
3100 |
+ struct page *page = rxb->page; |
3101 |
+- bool last = !!(lstatus & BD_LFLAG(RXBD_LAST)); |
3102 |
+- |
3103 |
+- /* Remove the FCS from the packet length */ |
3104 |
+- if (last) |
3105 |
+- size -= ETH_FCS_LEN; |
3106 |
+ |
3107 |
+ if (likely(first)) { |
3108 |
+ skb_put(skb, size); |
3109 |
+ } else { |
3110 |
+ /* the last fragments' length contains the full frame length */ |
3111 |
+- if (last) |
3112 |
++ if (lstatus & BD_LFLAG(RXBD_LAST)) |
3113 |
+ size -= skb->len; |
3114 |
+ |
3115 |
+- /* Add the last fragment if it contains something other than |
3116 |
+- * the FCS, otherwise drop it and trim off any part of the FCS |
3117 |
+- * that was already received. |
3118 |
+- */ |
3119 |
+- if (size > 0) |
3120 |
+- skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
3121 |
+- rxb->page_offset + RXBUF_ALIGNMENT, |
3122 |
+- size, GFAR_RXB_TRUESIZE); |
3123 |
+- else if (size < 0) |
3124 |
+- pskb_trim(skb, skb->len + size); |
3125 |
++ WARN(size < 0, "gianfar: rx fragment size underflow"); |
3126 |
++ if (size < 0) |
3127 |
++ return false; |
3128 |
++ |
3129 |
++ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
3130 |
++ rxb->page_offset + RXBUF_ALIGNMENT, |
3131 |
++ size, GFAR_RXB_TRUESIZE); |
3132 |
+ } |
3133 |
+ |
3134 |
+ /* try reuse page */ |
3135 |
+@@ -3071,6 +3063,9 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb) |
3136 |
+ if (priv->padding) |
3137 |
+ skb_pull(skb, priv->padding); |
3138 |
+ |
3139 |
++ /* Trim off the FCS */ |
3140 |
++ pskb_trim(skb, skb->len - ETH_FCS_LEN); |
3141 |
++ |
3142 |
+ if (ndev->features & NETIF_F_RXCSUM) |
3143 |
+ gfar_rx_checksum(skb, fcb); |
3144 |
+ |
3145 |
+@@ -3114,6 +3109,17 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) |
3146 |
+ if (lstatus & BD_LFLAG(RXBD_EMPTY)) |
3147 |
+ break; |
3148 |
+ |
3149 |
++ /* lost RXBD_LAST descriptor due to overrun */ |
3150 |
++ if (skb && |
3151 |
++ (lstatus & BD_LFLAG(RXBD_FIRST))) { |
3152 |
++ /* discard faulty buffer */ |
3153 |
++ dev_kfree_skb(skb); |
3154 |
++ skb = NULL; |
3155 |
++ rx_queue->stats.rx_dropped++; |
3156 |
++ |
3157 |
++ /* can continue normally */ |
3158 |
++ } |
3159 |
++ |
3160 |
+ /* order rx buffer descriptor reads */ |
3161 |
+ rmb(); |
3162 |
+ |
3163 |
+diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c |
3164 |
+index c82c85ef5fb34..c37aea7ba8502 100644 |
3165 |
+--- a/drivers/net/ethernet/freescale/xgmac_mdio.c |
3166 |
++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c |
3167 |
+@@ -301,9 +301,10 @@ err_ioremap: |
3168 |
+ static int xgmac_mdio_remove(struct platform_device *pdev) |
3169 |
+ { |
3170 |
+ struct mii_bus *bus = platform_get_drvdata(pdev); |
3171 |
++ struct mdio_fsl_priv *priv = bus->priv; |
3172 |
+ |
3173 |
+ mdiobus_unregister(bus); |
3174 |
+- iounmap(bus->priv); |
3175 |
++ iounmap(priv->mdio_base); |
3176 |
+ mdiobus_free(bus); |
3177 |
+ |
3178 |
+ return 0; |
3179 |
+diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c |
3180 |
+index 43c1fd18670b0..a990e606ecaa8 100644 |
3181 |
+--- a/drivers/net/ethernet/i825xx/sni_82596.c |
3182 |
++++ b/drivers/net/ethernet/i825xx/sni_82596.c |
3183 |
+@@ -122,9 +122,10 @@ static int sni_82596_probe(struct platform_device *dev) |
3184 |
+ netdevice->dev_addr[5] = readb(eth_addr + 0x06); |
3185 |
+ iounmap(eth_addr); |
3186 |
+ |
3187 |
+- if (!netdevice->irq) { |
3188 |
++ if (netdevice->irq < 0) { |
3189 |
+ printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", |
3190 |
+ __FILE__, netdevice->base_addr); |
3191 |
++ retval = netdevice->irq; |
3192 |
+ goto probe_failed; |
3193 |
+ } |
3194 |
+ |
3195 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3196 |
+index 6ef20e5cc77dd..de93c77148684 100644 |
3197 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3198 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
3199 |
+@@ -1772,6 +1772,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) |
3200 |
+ { |
3201 |
+ pci_driver->probe = mlxsw_pci_probe; |
3202 |
+ pci_driver->remove = mlxsw_pci_remove; |
3203 |
++ pci_driver->shutdown = mlxsw_pci_remove; |
3204 |
+ return pci_register_driver(pci_driver); |
3205 |
+ } |
3206 |
+ EXPORT_SYMBOL(mlxsw_pci_driver_register); |
3207 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3208 |
+index 1152d74433f6e..d2ba466613c0a 100644 |
3209 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3210 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
3211 |
+@@ -279,6 +279,16 @@ static int axienet_dma_bd_init(struct net_device *ndev) |
3212 |
+ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, |
3213 |
+ cr | XAXIDMA_CR_RUNSTOP_MASK); |
3214 |
+ |
3215 |
++ /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ |
3216 |
++ ret = read_poll_timeout(axienet_ior, value, |
3217 |
++ value & XAE_INT_PHYRSTCMPLT_MASK, |
3218 |
++ DELAY_OF_ONE_MILLISEC, 50000, false, lp, |
3219 |
++ XAE_IS_OFFSET); |
3220 |
++ if (ret) { |
3221 |
++ dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); |
3222 |
++ return ret; |
3223 |
++ } |
3224 |
++ |
3225 |
+ return 0; |
3226 |
+ out: |
3227 |
+ axienet_dma_bd_release(ndev); |
3228 |
+@@ -672,7 +682,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
3229 |
+ num_frag = skb_shinfo(skb)->nr_frags; |
3230 |
+ cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
3231 |
+ |
3232 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) { |
3233 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) { |
3234 |
+ if (netif_queue_stopped(ndev)) |
3235 |
+ return NETDEV_TX_BUSY; |
3236 |
+ |
3237 |
+@@ -682,7 +692,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
3238 |
+ smp_mb(); |
3239 |
+ |
3240 |
+ /* Space might have just been freed - check again */ |
3241 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) |
3242 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) |
3243 |
+ return NETDEV_TX_BUSY; |
3244 |
+ |
3245 |
+ netif_wake_queue(ndev); |
3246 |
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
3247 |
+index 727b991312a4e..3d8d765932934 100644 |
3248 |
+--- a/drivers/net/phy/marvell.c |
3249 |
++++ b/drivers/net/phy/marvell.c |
3250 |
+@@ -938,6 +938,12 @@ static int m88e1118_config_init(struct phy_device *phydev) |
3251 |
+ if (err < 0) |
3252 |
+ return err; |
3253 |
+ |
3254 |
++ if (phy_interface_is_rgmii(phydev)) { |
3255 |
++ err = m88e1121_config_aneg_rgmii_delays(phydev); |
3256 |
++ if (err < 0) |
3257 |
++ return err; |
3258 |
++ } |
3259 |
++ |
3260 |
+ /* Adjust LED Control */ |
3261 |
+ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) |
3262 |
+ err = phy_write(phydev, 0x10, 0x1100); |
3263 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
3264 |
+index 5ef9bbbab3dbb..7b9480ce21a21 100644 |
3265 |
+--- a/drivers/net/phy/mdio_bus.c |
3266 |
++++ b/drivers/net/phy/mdio_bus.c |
3267 |
+@@ -392,7 +392,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) |
3268 |
+ mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); |
3269 |
+ |
3270 |
+ bus->state = MDIOBUS_REGISTERED; |
3271 |
+- pr_info("%s: probed\n", bus->name); |
3272 |
++ dev_dbg(&bus->dev, "probed\n"); |
3273 |
+ return 0; |
3274 |
+ |
3275 |
+ error: |
3276 |
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
3277 |
+index c6e067aae9551..81a4fe9706be6 100644 |
3278 |
+--- a/drivers/net/ppp/ppp_generic.c |
3279 |
++++ b/drivers/net/ppp/ppp_generic.c |
3280 |
+@@ -72,6 +72,8 @@ |
3281 |
+ #define MPHDRLEN 6 /* multilink protocol header length */ |
3282 |
+ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ |
3283 |
+ |
3284 |
++#define PPP_PROTO_LEN 2 |
3285 |
++ |
3286 |
+ /* |
3287 |
+ * An instance of /dev/ppp can be associated with either a ppp |
3288 |
+ * interface unit or a ppp channel. In both cases, file->private_data |
3289 |
+@@ -501,6 +503,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, |
3290 |
+ |
3291 |
+ if (!pf) |
3292 |
+ return -ENXIO; |
3293 |
++ /* All PPP packets should start with the 2-byte protocol */ |
3294 |
++ if (count < PPP_PROTO_LEN) |
3295 |
++ return -EINVAL; |
3296 |
+ ret = -ENOMEM; |
3297 |
+ skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
3298 |
+ if (!skb) |
3299 |
+@@ -1564,7 +1569,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) |
3300 |
+ } |
3301 |
+ |
3302 |
+ ++ppp->stats64.tx_packets; |
3303 |
+- ppp->stats64.tx_bytes += skb->len - 2; |
3304 |
++ ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; |
3305 |
+ |
3306 |
+ switch (proto) { |
3307 |
+ case PPP_IP: |
3308 |
+diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c |
3309 |
+index 5a47e5510ca82..c0f52a622964f 100644 |
3310 |
+--- a/drivers/net/usb/mcs7830.c |
3311 |
++++ b/drivers/net/usb/mcs7830.c |
3312 |
+@@ -121,8 +121,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver"; |
3313 |
+ |
3314 |
+ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) |
3315 |
+ { |
3316 |
+- return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
3317 |
+- 0x0000, index, data, size); |
3318 |
++ int ret; |
3319 |
++ |
3320 |
++ ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
3321 |
++ 0x0000, index, data, size); |
3322 |
++ if (ret < 0) |
3323 |
++ return ret; |
3324 |
++ else if (ret < size) |
3325 |
++ return -ENODATA; |
3326 |
++ |
3327 |
++ return ret; |
3328 |
+ } |
3329 |
+ |
3330 |
+ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) |
3331 |
+diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c |
3332 |
+index e1a1d27427cc9..bf43244f051c5 100644 |
3333 |
+--- a/drivers/net/wireless/ath/ar5523/ar5523.c |
3334 |
++++ b/drivers/net/wireless/ath/ar5523/ar5523.c |
3335 |
+@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) |
3336 |
+ ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); |
3337 |
+ return; |
3338 |
+ } |
3339 |
++ if (!cmd->odata) { |
3340 |
++ ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); |
3341 |
++ return; |
3342 |
++ } |
3343 |
+ memcpy(cmd->odata, hdr + 1, sizeof(u32)); |
3344 |
+ cmd->olen = sizeof(u32); |
3345 |
+ cmd->res = 0; |
3346 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c |
3347 |
+index 685faac1368fd..21f5fb68b2046 100644 |
3348 |
+--- a/drivers/net/wireless/ath/ath10k/htt_tx.c |
3349 |
++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c |
3350 |
+@@ -158,6 +158,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) |
3351 |
+ htt->num_pending_tx--; |
3352 |
+ if (htt->num_pending_tx == htt->max_num_pending_tx - 1) |
3353 |
+ ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); |
3354 |
++ |
3355 |
++ if (htt->num_pending_tx == 0) |
3356 |
++ wake_up(&htt->empty_tx_wq); |
3357 |
+ } |
3358 |
+ |
3359 |
+ int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) |
3360 |
+diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
3361 |
+index 9999c8c40269d..e6705a30f3799 100644 |
3362 |
+--- a/drivers/net/wireless/ath/ath10k/txrx.c |
3363 |
++++ b/drivers/net/wireless/ath/ath10k/txrx.c |
3364 |
+@@ -90,8 +90,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
3365 |
+ |
3366 |
+ ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); |
3367 |
+ ath10k_htt_tx_dec_pending(htt); |
3368 |
+- if (htt->num_pending_tx == 0) |
3369 |
+- wake_up(&htt->empty_tx_wq); |
3370 |
+ spin_unlock_bh(&htt->tx_lock); |
3371 |
+ |
3372 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
3373 |
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3374 |
+index ce3a785212740..8125f17526519 100644 |
3375 |
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
3376 |
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3377 |
+@@ -588,6 +588,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, |
3378 |
+ return; |
3379 |
+ } |
3380 |
+ |
3381 |
++ if (pkt_len > 2 * MAX_RX_BUF_SIZE) { |
3382 |
++ dev_err(&hif_dev->udev->dev, |
3383 |
++ "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); |
3384 |
++ RX_STAT_INC(skb_dropped); |
3385 |
++ return; |
3386 |
++ } |
3387 |
++ |
3388 |
+ pad_len = 4 - (pkt_len & 0x3); |
3389 |
+ if (pad_len == 4) |
3390 |
+ pad_len = 0; |
3391 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c |
3392 |
+index c5b5fbcd2066c..3073c5af7dae8 100644 |
3393 |
+--- a/drivers/net/wireless/ath/wcn36xx/smd.c |
3394 |
++++ b/drivers/net/wireless/ath/wcn36xx/smd.c |
3395 |
+@@ -2053,7 +2053,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
3396 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
3397 |
+ tmp->bss_index); |
3398 |
+ vif = wcn36xx_priv_to_vif(tmp); |
3399 |
+- ieee80211_connection_loss(vif); |
3400 |
++ ieee80211_beacon_loss(vif); |
3401 |
+ } |
3402 |
+ return 0; |
3403 |
+ } |
3404 |
+@@ -2068,7 +2068,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
3405 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
3406 |
+ rsp->bss_index); |
3407 |
+ vif = wcn36xx_priv_to_vif(tmp); |
3408 |
+- ieee80211_connection_loss(vif); |
3409 |
++ ieee80211_beacon_loss(vif); |
3410 |
+ return 0; |
3411 |
+ } |
3412 |
+ } |
3413 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
3414 |
+index 6c10b8c4ddbe5..ade3c27050471 100644 |
3415 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
3416 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
3417 |
+@@ -182,6 +182,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) |
3418 |
+ |
3419 |
+ for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) |
3420 |
+ iwl_free_fw_img(drv, drv->fw.img + i); |
3421 |
++ |
3422 |
++ /* clear the data for the aborted load case */ |
3423 |
++ memset(&drv->fw, 0, sizeof(drv->fw)); |
3424 |
+ } |
3425 |
+ |
3426 |
+ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, |
3427 |
+@@ -1271,6 +1274,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
3428 |
+ int i; |
3429 |
+ bool load_module = false; |
3430 |
+ bool usniffer_images = false; |
3431 |
++ bool failure = true; |
3432 |
+ |
3433 |
+ fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; |
3434 |
+ fw->ucode_capa.standard_phy_calibration_size = |
3435 |
+@@ -1490,15 +1494,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
3436 |
+ * else from proceeding if the module fails to load |
3437 |
+ * or hangs loading. |
3438 |
+ */ |
3439 |
+- if (load_module) { |
3440 |
++ if (load_module) |
3441 |
+ request_module("%s", op->name); |
3442 |
+-#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR |
3443 |
+- if (err) |
3444 |
+- IWL_ERR(drv, |
3445 |
+- "failed to load module %s (error %d), is dynamic loading enabled?\n", |
3446 |
+- op->name, err); |
3447 |
+-#endif |
3448 |
+- } |
3449 |
++ failure = false; |
3450 |
+ goto free; |
3451 |
+ |
3452 |
+ try_again: |
3453 |
+@@ -1514,6 +1512,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
3454 |
+ complete(&drv->request_firmware_complete); |
3455 |
+ device_release_driver(drv->trans->dev); |
3456 |
+ free: |
3457 |
++ if (failure) |
3458 |
++ iwl_dealloc_ucode(drv); |
3459 |
++ |
3460 |
+ if (pieces) { |
3461 |
+ for (i = 0; i < ARRAY_SIZE(pieces->img); i++) |
3462 |
+ kfree(pieces->img[i].sec); |
3463 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
3464 |
+index d82d8cfe2e41c..f896758a3fa31 100644 |
3465 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
3466 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
3467 |
+@@ -1608,6 +1608,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
3468 |
+ struct iwl_mvm_mc_iter_data iter_data = { |
3469 |
+ .mvm = mvm, |
3470 |
+ }; |
3471 |
++ int ret; |
3472 |
+ |
3473 |
+ lockdep_assert_held(&mvm->mutex); |
3474 |
+ |
3475 |
+@@ -1617,6 +1618,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
3476 |
+ ieee80211_iterate_active_interfaces_atomic( |
3477 |
+ mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
3478 |
+ iwl_mvm_mc_iface_iterator, &iter_data); |
3479 |
++ |
3480 |
++ /* |
3481 |
++ * Send a (synchronous) ech command so that we wait for the |
3482 |
++ * multiple asynchronous MCAST_FILTER_CMD commands sent by |
3483 |
++ * the interface iterator. Otherwise, we might get here over |
3484 |
++ * and over again (by userspace just sending a lot of these) |
3485 |
++ * and the CPU can send them faster than the firmware can |
3486 |
++ * process them. |
3487 |
++ * Note that the CPU is still faster - but with this we'll |
3488 |
++ * actually send fewer commands overall because the CPU will |
3489 |
++ * not schedule the work in mac80211 as frequently if it's |
3490 |
++ * still running when rescheduled (possibly multiple times). |
3491 |
++ */ |
3492 |
++ ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); |
3493 |
++ if (ret) |
3494 |
++ IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); |
3495 |
+ } |
3496 |
+ |
3497 |
+ static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, |
3498 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
3499 |
+index e4fd476e9ccb0..713f3c13fa522 100644 |
3500 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
3501 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
3502 |
+@@ -1364,7 +1364,7 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) |
3503 |
+ return -EIO; |
3504 |
+ } |
3505 |
+ |
3506 |
+-#define SCAN_TIMEOUT 20000 |
3507 |
++#define SCAN_TIMEOUT 30000 |
3508 |
+ |
3509 |
+ void iwl_mvm_scan_timeout_wk(struct work_struct *work) |
3510 |
+ { |
3511 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c |
3512 |
+index 202ce83cb7948..f279cd4e78ff9 100644 |
3513 |
+--- a/drivers/net/wireless/marvell/mwifiex/usb.c |
3514 |
++++ b/drivers/net/wireless/marvell/mwifiex/usb.c |
3515 |
+@@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, |
3516 |
+ default: |
3517 |
+ mwifiex_dbg(adapter, ERROR, |
3518 |
+ "unknown recv_type %#x\n", recv_type); |
3519 |
+- return -1; |
3520 |
++ ret = -1; |
3521 |
++ goto exit_restore_skb; |
3522 |
+ } |
3523 |
+ break; |
3524 |
+ case MWIFIEX_USB_EP_DATA: |
3525 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
3526 |
+index 1ee7f796113bc..d2f1a6ef32dee 100644 |
3527 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
3528 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
3529 |
+@@ -1020,6 +1020,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) |
3530 |
+ _InitPABias(hw); |
3531 |
+ rtl92c_dm_init(hw); |
3532 |
+ exit: |
3533 |
++ local_irq_disable(); |
3534 |
+ local_irq_restore(flags); |
3535 |
+ return err; |
3536 |
+ } |
3537 |
+diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c |
3538 |
+index b1ff46fe45478..bbc59d329e9df 100644 |
3539 |
+--- a/drivers/parisc/pdc_stable.c |
3540 |
++++ b/drivers/parisc/pdc_stable.c |
3541 |
+@@ -992,8 +992,10 @@ pdcs_register_pathentries(void) |
3542 |
+ entry->kobj.kset = paths_kset; |
3543 |
+ err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, |
3544 |
+ "%s", entry->name); |
3545 |
+- if (err) |
3546 |
++ if (err) { |
3547 |
++ kobject_put(&entry->kobj); |
3548 |
+ return err; |
3549 |
++ } |
3550 |
+ |
3551 |
+ /* kobject is now registered */ |
3552 |
+ write_lock(&entry->rw_lock); |
3553 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
3554 |
+index 1bfc24654b581..98327966e5b43 100644 |
3555 |
+--- a/drivers/pci/quirks.c |
3556 |
++++ b/drivers/pci/quirks.c |
3557 |
+@@ -4004,6 +4004,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, |
3558 |
+ quirk_dma_func1_alias); |
3559 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, |
3560 |
+ quirk_dma_func1_alias); |
3561 |
++/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ |
3562 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, |
3563 |
++ quirk_dma_func1_alias); |
3564 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, |
3565 |
+ quirk_dma_func1_alias); |
3566 |
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ |
3567 |
+diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c |
3568 |
+index 8c8caec3a72cc..182e5ef4ab83d 100644 |
3569 |
+--- a/drivers/pcmcia/cs.c |
3570 |
++++ b/drivers/pcmcia/cs.c |
3571 |
+@@ -669,18 +669,16 @@ static int pccardd(void *__skt) |
3572 |
+ if (events || sysfs_events) |
3573 |
+ continue; |
3574 |
+ |
3575 |
++ set_current_state(TASK_INTERRUPTIBLE); |
3576 |
+ if (kthread_should_stop()) |
3577 |
+ break; |
3578 |
+ |
3579 |
+- set_current_state(TASK_INTERRUPTIBLE); |
3580 |
+- |
3581 |
+ schedule(); |
3582 |
+ |
3583 |
+- /* make sure we are running */ |
3584 |
+- __set_current_state(TASK_RUNNING); |
3585 |
+- |
3586 |
+ try_to_freeze(); |
3587 |
+ } |
3588 |
++ /* make sure we are running before we exit */ |
3589 |
++ __set_current_state(TASK_RUNNING); |
3590 |
+ |
3591 |
+ /* shut down socket, if a device is still present */ |
3592 |
+ if (skt->state & SOCKET_PRESENT) { |
3593 |
+diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c |
3594 |
+index 5ef7b46a25786..2e96d9273b780 100644 |
3595 |
+--- a/drivers/pcmcia/rsrc_nonstatic.c |
3596 |
++++ b/drivers/pcmcia/rsrc_nonstatic.c |
3597 |
+@@ -693,6 +693,9 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, |
3598 |
+ unsigned long min = base; |
3599 |
+ int ret; |
3600 |
+ |
3601 |
++ if (!res) |
3602 |
++ return NULL; |
3603 |
++ |
3604 |
+ data.mask = align - 1; |
3605 |
+ data.offset = base & data.mask; |
3606 |
+ data.map = &s_data->io_db; |
3607 |
+@@ -812,6 +815,9 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num, |
3608 |
+ unsigned long min, max; |
3609 |
+ int ret, i, j; |
3610 |
+ |
3611 |
++ if (!res) |
3612 |
++ return NULL; |
3613 |
++ |
3614 |
+ low = low || !(s->features & SS_CAP_PAGE_REGS); |
3615 |
+ |
3616 |
+ data.mask = align - 1; |
3617 |
+diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c |
3618 |
+index 8e2c41ded171c..e90253b3f6561 100644 |
3619 |
+--- a/drivers/power/supply/bq25890_charger.c |
3620 |
++++ b/drivers/power/supply/bq25890_charger.c |
3621 |
+@@ -521,12 +521,12 @@ static void bq25890_handle_state_change(struct bq25890_device *bq, |
3622 |
+ |
3623 |
+ if (!new_state->online) { /* power removed */ |
3624 |
+ /* disable ADC */ |
3625 |
+- ret = bq25890_field_write(bq, F_CONV_START, 0); |
3626 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 0); |
3627 |
+ if (ret < 0) |
3628 |
+ goto error; |
3629 |
+ } else if (!old_state.online) { /* power inserted */ |
3630 |
+ /* enable ADC, to have control of charge current/voltage */ |
3631 |
+- ret = bq25890_field_write(bq, F_CONV_START, 1); |
3632 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 1); |
3633 |
+ if (ret < 0) |
3634 |
+ goto error; |
3635 |
+ } |
3636 |
+diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
3637 |
+index 5b7c16b85dc08..5e2ee430b3f88 100644 |
3638 |
+--- a/drivers/rtc/rtc-cmos.c |
3639 |
++++ b/drivers/rtc/rtc-cmos.c |
3640 |
+@@ -421,7 +421,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
3641 |
+ min = t->time.tm_min; |
3642 |
+ sec = t->time.tm_sec; |
3643 |
+ |
3644 |
++ spin_lock_irq(&rtc_lock); |
3645 |
+ rtc_control = CMOS_READ(RTC_CONTROL); |
3646 |
++ spin_unlock_irq(&rtc_lock); |
3647 |
++ |
3648 |
+ if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
3649 |
+ /* Writing 0xff means "don't care" or "match all". */ |
3650 |
+ mon = (mon <= 12) ? bin2bcd(mon) : 0xff; |
3651 |
+diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
3652 |
+index be2daf5536ff7..180087d1c6cdb 100644 |
3653 |
+--- a/drivers/scsi/sr.c |
3654 |
++++ b/drivers/scsi/sr.c |
3655 |
+@@ -885,7 +885,7 @@ static void get_capabilities(struct scsi_cd *cd) |
3656 |
+ |
3657 |
+ |
3658 |
+ /* allocate transfer buffer */ |
3659 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
3660 |
++ buffer = kmalloc(512, GFP_KERNEL); |
3661 |
+ if (!buffer) { |
3662 |
+ sr_printk(KERN_ERR, cd, "out of memory.\n"); |
3663 |
+ return; |
3664 |
+diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c |
3665 |
+index e3b0ce25162ba..2887be4316be9 100644 |
3666 |
+--- a/drivers/scsi/sr_vendor.c |
3667 |
++++ b/drivers/scsi/sr_vendor.c |
3668 |
+@@ -119,7 +119,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) |
3669 |
+ density = (blocklength > 2048) ? 0x81 : 0x83; |
3670 |
+ #endif |
3671 |
+ |
3672 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
3673 |
++ buffer = kmalloc(512, GFP_KERNEL); |
3674 |
+ if (!buffer) |
3675 |
+ return -ENOMEM; |
3676 |
+ |
3677 |
+@@ -167,7 +167,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) |
3678 |
+ if (cd->cdi.mask & CDC_MULTI_SESSION) |
3679 |
+ return 0; |
3680 |
+ |
3681 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
3682 |
++ buffer = kmalloc(512, GFP_KERNEL); |
3683 |
+ if (!buffer) |
3684 |
+ return -ENOMEM; |
3685 |
+ |
3686 |
+diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
3687 |
+index 325d5e14fc0d8..a8b50fc1960d1 100644 |
3688 |
+--- a/drivers/scsi/ufs/tc-dwc-g210-pci.c |
3689 |
++++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
3690 |
+@@ -138,7 +138,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
3691 |
+ return err; |
3692 |
+ } |
3693 |
+ |
3694 |
+- pci_set_drvdata(pdev, hba); |
3695 |
+ pm_runtime_put_noidle(&pdev->dev); |
3696 |
+ pm_runtime_allow(&pdev->dev); |
3697 |
+ |
3698 |
+diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c |
3699 |
+index 8992354d4e2c7..6f076ff35dd38 100644 |
3700 |
+--- a/drivers/scsi/ufs/ufshcd-pltfrm.c |
3701 |
++++ b/drivers/scsi/ufs/ufshcd-pltfrm.c |
3702 |
+@@ -348,8 +348,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, |
3703 |
+ goto dealloc_host; |
3704 |
+ } |
3705 |
+ |
3706 |
+- platform_set_drvdata(pdev, hba); |
3707 |
+- |
3708 |
+ pm_runtime_set_active(&pdev->dev); |
3709 |
+ pm_runtime_enable(&pdev->dev); |
3710 |
+ |
3711 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
3712 |
+index f46fa8a2f6585..694c0fc31fbf7 100644 |
3713 |
+--- a/drivers/scsi/ufs/ufshcd.c |
3714 |
++++ b/drivers/scsi/ufs/ufshcd.c |
3715 |
+@@ -7904,6 +7904,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) |
3716 |
+ struct Scsi_Host *host = hba->host; |
3717 |
+ struct device *dev = hba->dev; |
3718 |
+ |
3719 |
++ /* |
3720 |
++ * dev_set_drvdata() must be called before any callbacks are registered |
3721 |
++ * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, |
3722 |
++ * sysfs). |
3723 |
++ */ |
3724 |
++ dev_set_drvdata(dev, hba); |
3725 |
++ |
3726 |
+ if (!mmio_base) { |
3727 |
+ dev_err(hba->dev, |
3728 |
+ "Invalid memory reference for mmio_base is NULL\n"); |
3729 |
+diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c |
3730 |
+index 616566e793c62..28975b6f054fa 100644 |
3731 |
+--- a/drivers/spi/spi-meson-spifc.c |
3732 |
++++ b/drivers/spi/spi-meson-spifc.c |
3733 |
+@@ -357,6 +357,7 @@ static int meson_spifc_probe(struct platform_device *pdev) |
3734 |
+ return 0; |
3735 |
+ out_clk: |
3736 |
+ clk_disable_unprepare(spifc->clk); |
3737 |
++ pm_runtime_disable(spifc->dev); |
3738 |
+ out_err: |
3739 |
+ spi_master_put(master); |
3740 |
+ return ret; |
3741 |
+diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c |
3742 |
+index 292ebbce50dc8..3cc180a90cd2a 100644 |
3743 |
+--- a/drivers/staging/wlan-ng/hfa384x_usb.c |
3744 |
++++ b/drivers/staging/wlan-ng/hfa384x_usb.c |
3745 |
+@@ -3904,18 +3904,18 @@ static void hfa384x_usb_throttlefn(unsigned long data) |
3746 |
+ |
3747 |
+ spin_lock_irqsave(&hw->ctlxq.lock, flags); |
3748 |
+ |
3749 |
+- /* |
3750 |
+- * We need to check BOTH the RX and the TX throttle controls, |
3751 |
+- * so we use the bitwise OR instead of the logical OR. |
3752 |
+- */ |
3753 |
+ pr_debug("flags=0x%lx\n", hw->usb_flags); |
3754 |
+- if (!hw->wlandev->hwremoved && |
3755 |
+- ((test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && |
3756 |
+- !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags)) | |
3757 |
+- (test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) && |
3758 |
+- !test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags)) |
3759 |
+- )) { |
3760 |
+- schedule_work(&hw->usb_work); |
3761 |
++ if (!hw->wlandev->hwremoved) { |
3762 |
++ bool rx_throttle = test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && |
3763 |
++ !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags); |
3764 |
++ bool tx_throttle = test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) && |
3765 |
++ !test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags); |
3766 |
++ /* |
3767 |
++ * We need to check BOTH the RX and the TX throttle controls, |
3768 |
++ * so we use the bitwise OR instead of the logical OR. |
3769 |
++ */ |
3770 |
++ if (rx_throttle | tx_throttle) |
3771 |
++ schedule_work(&hw->usb_work); |
3772 |
+ } |
3773 |
+ |
3774 |
+ spin_unlock_irqrestore(&hw->ctlxq.lock, flags); |
3775 |
+diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c |
3776 |
+index 9ec4b8d2879f7..0698fbf3b6d61 100644 |
3777 |
+--- a/drivers/tty/serial/amba-pl010.c |
3778 |
++++ b/drivers/tty/serial/amba-pl010.c |
3779 |
+@@ -465,14 +465,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, |
3780 |
+ if ((termios->c_cflag & CREAD) == 0) |
3781 |
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; |
3782 |
+ |
3783 |
+- /* first, disable everything */ |
3784 |
+ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; |
3785 |
+ |
3786 |
+ if (UART_ENABLE_MS(port, termios->c_cflag)) |
3787 |
+ old_cr |= UART010_CR_MSIE; |
3788 |
+ |
3789 |
+- writel(0, uap->port.membase + UART010_CR); |
3790 |
+- |
3791 |
+ /* Set baud rate */ |
3792 |
+ quot -= 1; |
3793 |
+ writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); |
3794 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
3795 |
+index dcf84d5020c65..a9aa8cd7f29c8 100644 |
3796 |
+--- a/drivers/tty/serial/amba-pl011.c |
3797 |
++++ b/drivers/tty/serial/amba-pl011.c |
3798 |
+@@ -2111,32 +2111,13 @@ static const char *pl011_type(struct uart_port *port) |
3799 |
+ return uap->port.type == PORT_AMBA ? uap->type : NULL; |
3800 |
+ } |
3801 |
+ |
3802 |
+-/* |
3803 |
+- * Release the memory region(s) being used by 'port' |
3804 |
+- */ |
3805 |
+-static void pl011_release_port(struct uart_port *port) |
3806 |
+-{ |
3807 |
+- release_mem_region(port->mapbase, SZ_4K); |
3808 |
+-} |
3809 |
+- |
3810 |
+-/* |
3811 |
+- * Request the memory region(s) being used by 'port' |
3812 |
+- */ |
3813 |
+-static int pl011_request_port(struct uart_port *port) |
3814 |
+-{ |
3815 |
+- return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") |
3816 |
+- != NULL ? 0 : -EBUSY; |
3817 |
+-} |
3818 |
+- |
3819 |
+ /* |
3820 |
+ * Configure/autoconfigure the port. |
3821 |
+ */ |
3822 |
+ static void pl011_config_port(struct uart_port *port, int flags) |
3823 |
+ { |
3824 |
+- if (flags & UART_CONFIG_TYPE) { |
3825 |
++ if (flags & UART_CONFIG_TYPE) |
3826 |
+ port->type = PORT_AMBA; |
3827 |
+- pl011_request_port(port); |
3828 |
+- } |
3829 |
+ } |
3830 |
+ |
3831 |
+ /* |
3832 |
+@@ -2151,6 +2132,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) |
3833 |
+ ret = -EINVAL; |
3834 |
+ if (ser->baud_base < 9600) |
3835 |
+ ret = -EINVAL; |
3836 |
++ if (port->mapbase != (unsigned long) ser->iomem_base) |
3837 |
++ ret = -EINVAL; |
3838 |
+ return ret; |
3839 |
+ } |
3840 |
+ |
3841 |
+@@ -2168,8 +2151,6 @@ static const struct uart_ops amba_pl011_pops = { |
3842 |
+ .flush_buffer = pl011_dma_flush_buffer, |
3843 |
+ .set_termios = pl011_set_termios, |
3844 |
+ .type = pl011_type, |
3845 |
+- .release_port = pl011_release_port, |
3846 |
+- .request_port = pl011_request_port, |
3847 |
+ .config_port = pl011_config_port, |
3848 |
+ .verify_port = pl011_verify_port, |
3849 |
+ #ifdef CONFIG_CONSOLE_POLL |
3850 |
+@@ -2199,8 +2180,6 @@ static const struct uart_ops sbsa_uart_pops = { |
3851 |
+ .shutdown = sbsa_uart_shutdown, |
3852 |
+ .set_termios = sbsa_uart_set_termios, |
3853 |
+ .type = pl011_type, |
3854 |
+- .release_port = pl011_release_port, |
3855 |
+- .request_port = pl011_request_port, |
3856 |
+ .config_port = pl011_config_port, |
3857 |
+ .verify_port = pl011_verify_port, |
3858 |
+ #ifdef CONFIG_CONSOLE_POLL |
3859 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
3860 |
+index a00227d312d3f..4da5604d7385a 100644 |
3861 |
+--- a/drivers/tty/serial/atmel_serial.c |
3862 |
++++ b/drivers/tty/serial/atmel_serial.c |
3863 |
+@@ -925,6 +925,13 @@ static void atmel_tx_dma(struct uart_port *port) |
3864 |
+ desc->callback = atmel_complete_tx_dma; |
3865 |
+ desc->callback_param = atmel_port; |
3866 |
+ atmel_port->cookie_tx = dmaengine_submit(desc); |
3867 |
++ if (dma_submit_error(atmel_port->cookie_tx)) { |
3868 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
3869 |
++ atmel_port->cookie_tx); |
3870 |
++ return; |
3871 |
++ } |
3872 |
++ |
3873 |
++ dma_async_issue_pending(chan); |
3874 |
+ } |
3875 |
+ |
3876 |
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
3877 |
+@@ -1183,6 +1190,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) |
3878 |
+ desc->callback_param = port; |
3879 |
+ atmel_port->desc_rx = desc; |
3880 |
+ atmel_port->cookie_rx = dmaengine_submit(desc); |
3881 |
++ if (dma_submit_error(atmel_port->cookie_rx)) { |
3882 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
3883 |
++ atmel_port->cookie_rx); |
3884 |
++ goto chan_err; |
3885 |
++ } |
3886 |
++ |
3887 |
++ dma_async_issue_pending(atmel_port->chan_rx); |
3888 |
+ |
3889 |
+ return 0; |
3890 |
+ |
3891 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
3892 |
+index 16ce187390d8b..230e515b83c80 100644 |
3893 |
+--- a/drivers/tty/serial/serial_core.c |
3894 |
++++ b/drivers/tty/serial/serial_core.c |
3895 |
+@@ -172,7 +172,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
3896 |
+ int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); |
3897 |
+ |
3898 |
+ if (raise) { |
3899 |
+- if (rs485_on && !RTS_after_send) { |
3900 |
++ if (rs485_on && RTS_after_send) { |
3901 |
+ uart_set_mctrl(uport, TIOCM_DTR); |
3902 |
+ uart_clear_mctrl(uport, TIOCM_RTS); |
3903 |
+ } else { |
3904 |
+@@ -181,7 +181,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
3905 |
+ } else { |
3906 |
+ unsigned int clear = TIOCM_DTR; |
3907 |
+ |
3908 |
+- clear |= (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; |
3909 |
++ clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; |
3910 |
+ uart_clear_mctrl(uport, clear); |
3911 |
+ } |
3912 |
+ } |
3913 |
+@@ -2361,7 +2361,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, |
3914 |
+ * We probably don't need a spinlock around this, but |
3915 |
+ */ |
3916 |
+ spin_lock_irqsave(&port->lock, flags); |
3917 |
+- port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); |
3918 |
++ port->mctrl &= TIOCM_DTR; |
3919 |
++ port->ops->set_mctrl(port, port->mctrl); |
3920 |
+ spin_unlock_irqrestore(&port->lock, flags); |
3921 |
+ |
3922 |
+ /* |
3923 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
3924 |
+index 5fcea1114e2f6..d634db802fbd7 100644 |
3925 |
+--- a/drivers/usb/core/hcd.c |
3926 |
++++ b/drivers/usb/core/hcd.c |
3927 |
+@@ -761,6 +761,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
3928 |
+ { |
3929 |
+ struct urb *urb; |
3930 |
+ int length; |
3931 |
++ int status; |
3932 |
+ unsigned long flags; |
3933 |
+ char buffer[6]; /* Any root hubs with > 31 ports? */ |
3934 |
+ |
3935 |
+@@ -778,11 +779,17 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
3936 |
+ if (urb) { |
3937 |
+ clear_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
3938 |
+ hcd->status_urb = NULL; |
3939 |
++ if (urb->transfer_buffer_length >= length) { |
3940 |
++ status = 0; |
3941 |
++ } else { |
3942 |
++ status = -EOVERFLOW; |
3943 |
++ length = urb->transfer_buffer_length; |
3944 |
++ } |
3945 |
+ urb->actual_length = length; |
3946 |
+ memcpy(urb->transfer_buffer, buffer, length); |
3947 |
+ |
3948 |
+ usb_hcd_unlink_urb_from_ep(hcd, urb); |
3949 |
+- usb_hcd_giveback_urb(hcd, urb, 0); |
3950 |
++ usb_hcd_giveback_urb(hcd, urb, status); |
3951 |
+ } else { |
3952 |
+ length = 0; |
3953 |
+ set_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
3954 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
3955 |
+index 56a0bd05aa2c0..132828b56cf83 100644 |
3956 |
+--- a/drivers/usb/core/hub.c |
3957 |
++++ b/drivers/usb/core/hub.c |
3958 |
+@@ -1077,7 +1077,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
3959 |
+ } else { |
3960 |
+ hub_power_on(hub, true); |
3961 |
+ } |
3962 |
+- } |
3963 |
++ /* Give some time on remote wakeup to let links to transit to U0 */ |
3964 |
++ } else if (hub_is_superspeed(hub->hdev)) |
3965 |
++ msleep(20); |
3966 |
++ |
3967 |
+ init2: |
3968 |
+ |
3969 |
+ /* |
3970 |
+@@ -1192,7 +1195,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
3971 |
+ */ |
3972 |
+ if (portchange || (hub_is_superspeed(hub->hdev) && |
3973 |
+ port_resumed)) |
3974 |
+- set_bit(port1, hub->change_bits); |
3975 |
++ set_bit(port1, hub->event_bits); |
3976 |
+ |
3977 |
+ } else if (udev->persist_enabled) { |
3978 |
+ #ifdef CONFIG_PM |
3979 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
3980 |
+index 6029f9b00b4a0..61795025f11b6 100644 |
3981 |
+--- a/drivers/usb/gadget/function/f_fs.c |
3982 |
++++ b/drivers/usb/gadget/function/f_fs.c |
3983 |
+@@ -608,7 +608,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) |
3984 |
+ file->private_data = ffs; |
3985 |
+ ffs_data_opened(ffs); |
3986 |
+ |
3987 |
+- return 0; |
3988 |
++ return stream_open(inode, file); |
3989 |
+ } |
3990 |
+ |
3991 |
+ static int ffs_ep0_release(struct inode *inode, struct file *file) |
3992 |
+@@ -1072,7 +1072,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) |
3993 |
+ file->private_data = epfile; |
3994 |
+ ffs_data_opened(epfile->ffs); |
3995 |
+ |
3996 |
+- return 0; |
3997 |
++ return stream_open(inode, file); |
3998 |
+ } |
3999 |
+ |
4000 |
+ static int ffs_aio_cancel(struct kiocb *kiocb) |
4001 |
+diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c |
4002 |
+index 6cb16d4b22578..4e91f7b21a796 100644 |
4003 |
+--- a/drivers/usb/host/uhci-platform.c |
4004 |
++++ b/drivers/usb/host/uhci-platform.c |
4005 |
+@@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) |
4006 |
+ num_ports); |
4007 |
+ } |
4008 |
+ if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || |
4009 |
+- of_device_is_compatible(np, "aspeed,ast2500-uhci")) { |
4010 |
++ of_device_is_compatible(np, "aspeed,ast2500-uhci") || |
4011 |
++ of_device_is_compatible(np, "aspeed,ast2600-uhci")) { |
4012 |
+ uhci->is_aspeed = 1; |
4013 |
+ dev_info(&pdev->dev, |
4014 |
+ "Enabled Aspeed implementation workarounds\n"); |
4015 |
+diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c |
4016 |
+index 424ff12f3b51f..0231c0cc6481d 100644 |
4017 |
+--- a/drivers/usb/misc/ftdi-elan.c |
4018 |
++++ b/drivers/usb/misc/ftdi-elan.c |
4019 |
+@@ -206,6 +206,7 @@ static void ftdi_elan_delete(struct kref *kref) |
4020 |
+ mutex_unlock(&ftdi_module_lock); |
4021 |
+ kfree(ftdi->bulk_in_buffer); |
4022 |
+ ftdi->bulk_in_buffer = NULL; |
4023 |
++ kfree(ftdi); |
4024 |
+ } |
4025 |
+ |
4026 |
+ static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) |
4027 |
+diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c |
4028 |
+index ec234b846eb3c..e5eb19a34ee2a 100644 |
4029 |
+--- a/drivers/w1/slaves/w1_ds28e04.c |
4030 |
++++ b/drivers/w1/slaves/w1_ds28e04.c |
4031 |
+@@ -34,7 +34,7 @@ static int w1_strong_pullup = 1; |
4032 |
+ module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
4033 |
+ |
4034 |
+ /* enable/disable CRC checking on DS28E04-100 memory accesses */ |
4035 |
+-static char w1_enable_crccheck = 1; |
4036 |
++static bool w1_enable_crccheck = true; |
4037 |
+ |
4038 |
+ #define W1_EEPROM_SIZE 512 |
4039 |
+ #define W1_PAGE_COUNT 16 |
4040 |
+@@ -341,32 +341,18 @@ static BIN_ATTR_RW(pio, 1); |
4041 |
+ static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, |
4042 |
+ char *buf) |
4043 |
+ { |
4044 |
+- if (put_user(w1_enable_crccheck + 0x30, buf)) |
4045 |
+- return -EFAULT; |
4046 |
+- |
4047 |
+- return sizeof(w1_enable_crccheck); |
4048 |
++ return sysfs_emit(buf, "%d\n", w1_enable_crccheck); |
4049 |
+ } |
4050 |
+ |
4051 |
+ static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, |
4052 |
+ const char *buf, size_t count) |
4053 |
+ { |
4054 |
+- char val; |
4055 |
+- |
4056 |
+- if (count != 1 || !buf) |
4057 |
+- return -EINVAL; |
4058 |
++ int err = kstrtobool(buf, &w1_enable_crccheck); |
4059 |
+ |
4060 |
+- if (get_user(val, buf)) |
4061 |
+- return -EFAULT; |
4062 |
++ if (err) |
4063 |
++ return err; |
4064 |
+ |
4065 |
+- /* convert to decimal */ |
4066 |
+- val = val - 0x30; |
4067 |
+- if (val != 0 && val != 1) |
4068 |
+- return -EINVAL; |
4069 |
+- |
4070 |
+- /* set the new value */ |
4071 |
+- w1_enable_crccheck = val; |
4072 |
+- |
4073 |
+- return sizeof(w1_enable_crccheck); |
4074 |
++ return count; |
4075 |
+ } |
4076 |
+ |
4077 |
+ static DEVICE_ATTR_RW(crccheck); |
4078 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
4079 |
+index 1cf75d1032e17..58dc96d7ecafa 100644 |
4080 |
+--- a/fs/btrfs/backref.c |
4081 |
++++ b/fs/btrfs/backref.c |
4082 |
+@@ -1163,7 +1163,12 @@ again: |
4083 |
+ ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); |
4084 |
+ if (ret < 0) |
4085 |
+ goto out; |
4086 |
+- BUG_ON(ret == 0); |
4087 |
++ if (ret == 0) { |
4088 |
++ /* This shouldn't happen, indicates a bug or fs corruption. */ |
4089 |
++ ASSERT(ret != 0); |
4090 |
++ ret = -EUCLEAN; |
4091 |
++ goto out; |
4092 |
++ } |
4093 |
+ |
4094 |
+ #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS |
4095 |
+ if (trans && likely(trans->type != __TRANS_DUMMY) && |
4096 |
+@@ -1310,10 +1315,18 @@ again: |
4097 |
+ goto out; |
4098 |
+ if (!ret && extent_item_pos) { |
4099 |
+ /* |
4100 |
+- * we've recorded that parent, so we must extend |
4101 |
+- * its inode list here |
4102 |
++ * We've recorded that parent, so we must extend |
4103 |
++ * its inode list here. |
4104 |
++ * |
4105 |
++ * However if there was corruption we may not |
4106 |
++ * have found an eie, return an error in this |
4107 |
++ * case. |
4108 |
+ */ |
4109 |
+- BUG_ON(!eie); |
4110 |
++ ASSERT(eie); |
4111 |
++ if (!eie) { |
4112 |
++ ret = -EUCLEAN; |
4113 |
++ goto out; |
4114 |
++ } |
4115 |
+ while (eie->next) |
4116 |
+ eie = eie->next; |
4117 |
+ eie->next = ref->inode_list; |
4118 |
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c |
4119 |
+index 21643d2b3fee4..8364f170fbb82 100644 |
4120 |
+--- a/fs/dlm/lock.c |
4121 |
++++ b/fs/dlm/lock.c |
4122 |
+@@ -3974,6 +3974,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
4123 |
+ int from = ms->m_header.h_nodeid; |
4124 |
+ int error = 0; |
4125 |
+ |
4126 |
++ /* currently mixing of user/kernel locks are not supported */ |
4127 |
++ if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { |
4128 |
++ log_error(lkb->lkb_resource->res_ls, |
4129 |
++ "got user dlm message for a kernel lock"); |
4130 |
++ error = -EINVAL; |
4131 |
++ goto out; |
4132 |
++ } |
4133 |
++ |
4134 |
+ switch (ms->m_type) { |
4135 |
+ case DLM_MSG_CONVERT: |
4136 |
+ case DLM_MSG_UNLOCK: |
4137 |
+@@ -4002,6 +4010,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
4138 |
+ error = -EINVAL; |
4139 |
+ } |
4140 |
+ |
4141 |
++out: |
4142 |
+ if (error) |
4143 |
+ log_error(lkb->lkb_resource->res_ls, |
4144 |
+ "ignore invalid message %d from %d %x %x %x %d", |
4145 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
4146 |
+index 6718c7ccd6314..3bd79fc4e9487 100644 |
4147 |
+--- a/fs/ext4/ioctl.c |
4148 |
++++ b/fs/ext4/ioctl.c |
4149 |
+@@ -992,8 +992,6 @@ resizefs_out: |
4150 |
+ sizeof(range))) |
4151 |
+ return -EFAULT; |
4152 |
+ |
4153 |
+- range.minlen = max((unsigned int)range.minlen, |
4154 |
+- q->limits.discard_granularity); |
4155 |
+ ret = ext4_trim_fs(sb, &range); |
4156 |
+ if (ret < 0) |
4157 |
+ return ret; |
4158 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
4159 |
+index c40d3c44a1d69..28bee66c5fbf0 100644 |
4160 |
+--- a/fs/ext4/mballoc.c |
4161 |
++++ b/fs/ext4/mballoc.c |
4162 |
+@@ -5284,6 +5284,7 @@ out: |
4163 |
+ */ |
4164 |
+ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
4165 |
+ { |
4166 |
++ struct request_queue *q = bdev_get_queue(sb->s_bdev); |
4167 |
+ struct ext4_group_info *grp; |
4168 |
+ ext4_group_t group, first_group, last_group; |
4169 |
+ ext4_grpblk_t cnt = 0, first_cluster, last_cluster; |
4170 |
+@@ -5302,6 +5303,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
4171 |
+ start >= max_blks || |
4172 |
+ range->len < sb->s_blocksize) |
4173 |
+ return -EINVAL; |
4174 |
++ /* No point to try to trim less than discard granularity */ |
4175 |
++ if (range->minlen < q->limits.discard_granularity) { |
4176 |
++ minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
4177 |
++ q->limits.discard_granularity >> sb->s_blocksize_bits); |
4178 |
++ if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) |
4179 |
++ goto out; |
4180 |
++ } |
4181 |
+ if (end >= max_blks) |
4182 |
+ end = max_blks - 1; |
4183 |
+ if (end <= first_data_blk) |
4184 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
4185 |
+index 0d785868cc503..b6e9d56696ef3 100644 |
4186 |
+--- a/fs/ext4/migrate.c |
4187 |
++++ b/fs/ext4/migrate.c |
4188 |
+@@ -462,12 +462,12 @@ int ext4_ext_migrate(struct inode *inode) |
4189 |
+ percpu_down_write(&sbi->s_writepages_rwsem); |
4190 |
+ |
4191 |
+ /* |
4192 |
+- * Worst case we can touch the allocation bitmaps, a bgd |
4193 |
+- * block, and a block to link in the orphan list. We do need |
4194 |
+- * need to worry about credits for modifying the quota inode. |
4195 |
++ * Worst case we can touch the allocation bitmaps and a block |
4196 |
++ * group descriptor block. We do need need to worry about |
4197 |
++ * credits for modifying the quota inode. |
4198 |
+ */ |
4199 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, |
4200 |
+- 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
4201 |
++ 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
4202 |
+ |
4203 |
+ if (IS_ERR(handle)) { |
4204 |
+ retval = PTR_ERR(handle); |
4205 |
+@@ -484,6 +484,13 @@ int ext4_ext_migrate(struct inode *inode) |
4206 |
+ ext4_journal_stop(handle); |
4207 |
+ goto out_unlock; |
4208 |
+ } |
4209 |
++ /* |
4210 |
++ * Use the correct seed for checksum (i.e. the seed from 'inode'). This |
4211 |
++ * is so that the metadata blocks will have the correct checksum after |
4212 |
++ * the migration. |
4213 |
++ */ |
4214 |
++ ei = EXT4_I(inode); |
4215 |
++ EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; |
4216 |
+ i_size_write(tmp_inode, i_size_read(inode)); |
4217 |
+ /* |
4218 |
+ * Set the i_nlink to zero so it will be deleted later |
4219 |
+@@ -492,7 +499,6 @@ int ext4_ext_migrate(struct inode *inode) |
4220 |
+ clear_nlink(tmp_inode); |
4221 |
+ |
4222 |
+ ext4_ext_tree_init(handle, tmp_inode); |
4223 |
+- ext4_orphan_add(handle, tmp_inode); |
4224 |
+ ext4_journal_stop(handle); |
4225 |
+ |
4226 |
+ /* |
4227 |
+@@ -517,17 +523,10 @@ int ext4_ext_migrate(struct inode *inode) |
4228 |
+ |
4229 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); |
4230 |
+ if (IS_ERR(handle)) { |
4231 |
+- /* |
4232 |
+- * It is impossible to update on-disk structures without |
4233 |
+- * a handle, so just rollback in-core changes and live other |
4234 |
+- * work to orphan_list_cleanup() |
4235 |
+- */ |
4236 |
+- ext4_orphan_del(NULL, tmp_inode); |
4237 |
+ retval = PTR_ERR(handle); |
4238 |
+ goto out_tmp_inode; |
4239 |
+ } |
4240 |
+ |
4241 |
+- ei = EXT4_I(inode); |
4242 |
+ i_data = ei->i_data; |
4243 |
+ memset(&lb, 0, sizeof(lb)); |
4244 |
+ |
4245 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
4246 |
+index 105334ebc102d..dd424958be60c 100644 |
4247 |
+--- a/fs/ext4/super.c |
4248 |
++++ b/fs/ext4/super.c |
4249 |
+@@ -5678,10 +5678,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
4250 |
+ |
4251 |
+ lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); |
4252 |
+ err = dquot_quota_on(sb, type, format_id, path); |
4253 |
+- if (err) { |
4254 |
+- lockdep_set_quota_inode(path->dentry->d_inode, |
4255 |
+- I_DATA_SEM_NORMAL); |
4256 |
+- } else { |
4257 |
++ if (!err) { |
4258 |
+ struct inode *inode = d_inode(path->dentry); |
4259 |
+ handle_t *handle; |
4260 |
+ |
4261 |
+@@ -5701,7 +5698,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
4262 |
+ ext4_journal_stop(handle); |
4263 |
+ unlock_inode: |
4264 |
+ inode_unlock(inode); |
4265 |
++ if (err) |
4266 |
++ dquot_quota_off(sb, type); |
4267 |
+ } |
4268 |
++ if (err) |
4269 |
++ lockdep_set_quota_inode(path->dentry->d_inode, |
4270 |
++ I_DATA_SEM_NORMAL); |
4271 |
+ return err; |
4272 |
+ } |
4273 |
+ |
4274 |
+@@ -5867,7 +5869,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
4275 |
+ struct buffer_head *bh; |
4276 |
+ handle_t *handle = journal_current_handle(); |
4277 |
+ |
4278 |
+- if (EXT4_SB(sb)->s_journal && !handle) { |
4279 |
++ if (!handle) { |
4280 |
+ ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" |
4281 |
+ " cancelled because transaction is not started", |
4282 |
+ (unsigned long long)off, (unsigned long long)len); |
4283 |
+diff --git a/fs/fuse/acl.c b/fs/fuse/acl.c |
4284 |
+index ec85765502f1f..990529da5354d 100644 |
4285 |
+--- a/fs/fuse/acl.c |
4286 |
++++ b/fs/fuse/acl.c |
4287 |
+@@ -19,6 +19,9 @@ struct posix_acl *fuse_get_acl(struct inode *inode, int type) |
4288 |
+ void *value = NULL; |
4289 |
+ struct posix_acl *acl; |
4290 |
+ |
4291 |
++ if (fuse_is_bad(inode)) |
4292 |
++ return ERR_PTR(-EIO); |
4293 |
++ |
4294 |
+ if (!fc->posix_acl || fc->no_getxattr) |
4295 |
+ return NULL; |
4296 |
+ |
4297 |
+@@ -53,6 +56,9 @@ int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
4298 |
+ const char *name; |
4299 |
+ int ret; |
4300 |
+ |
4301 |
++ if (fuse_is_bad(inode)) |
4302 |
++ return -EIO; |
4303 |
++ |
4304 |
+ if (!fc->posix_acl || fc->no_setxattr) |
4305 |
+ return -EOPNOTSUPP; |
4306 |
+ |
4307 |
+diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
4308 |
+index b8d13b69583cc..94ecc67292c71 100644 |
4309 |
+--- a/fs/fuse/dir.c |
4310 |
++++ b/fs/fuse/dir.c |
4311 |
+@@ -187,7 +187,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) |
4312 |
+ int ret; |
4313 |
+ |
4314 |
+ inode = d_inode_rcu(entry); |
4315 |
+- if (inode && is_bad_inode(inode)) |
4316 |
++ if (inode && fuse_is_bad(inode)) |
4317 |
+ goto invalid; |
4318 |
+ else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || |
4319 |
+ (flags & LOOKUP_REVAL)) { |
4320 |
+@@ -364,6 +364,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, |
4321 |
+ bool outarg_valid = true; |
4322 |
+ bool locked; |
4323 |
+ |
4324 |
++ if (fuse_is_bad(dir)) |
4325 |
++ return ERR_PTR(-EIO); |
4326 |
++ |
4327 |
+ locked = fuse_lock_inode(dir); |
4328 |
+ err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name, |
4329 |
+ &outarg, &inode); |
4330 |
+@@ -504,6 +507,9 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry, |
4331 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
4332 |
+ struct dentry *res = NULL; |
4333 |
+ |
4334 |
++ if (fuse_is_bad(dir)) |
4335 |
++ return -EIO; |
4336 |
++ |
4337 |
+ if (d_in_lookup(entry)) { |
4338 |
+ res = fuse_lookup(dir, entry, 0); |
4339 |
+ if (IS_ERR(res)) |
4340 |
+@@ -551,6 +557,9 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args, |
4341 |
+ int err; |
4342 |
+ struct fuse_forget_link *forget; |
4343 |
+ |
4344 |
++ if (fuse_is_bad(dir)) |
4345 |
++ return -EIO; |
4346 |
++ |
4347 |
+ forget = fuse_alloc_forget(); |
4348 |
+ if (!forget) |
4349 |
+ return -ENOMEM; |
4350 |
+@@ -672,6 +681,9 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) |
4351 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
4352 |
+ FUSE_ARGS(args); |
4353 |
+ |
4354 |
++ if (fuse_is_bad(dir)) |
4355 |
++ return -EIO; |
4356 |
++ |
4357 |
+ args.in.h.opcode = FUSE_UNLINK; |
4358 |
+ args.in.h.nodeid = get_node_id(dir); |
4359 |
+ args.in.numargs = 1; |
4360 |
+@@ -708,6 +720,9 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) |
4361 |
+ struct fuse_conn *fc = get_fuse_conn(dir); |
4362 |
+ FUSE_ARGS(args); |
4363 |
+ |
4364 |
++ if (fuse_is_bad(dir)) |
4365 |
++ return -EIO; |
4366 |
++ |
4367 |
+ args.in.h.opcode = FUSE_RMDIR; |
4368 |
+ args.in.h.nodeid = get_node_id(dir); |
4369 |
+ args.in.numargs = 1; |
4370 |
+@@ -786,6 +801,9 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, |
4371 |
+ struct fuse_conn *fc = get_fuse_conn(olddir); |
4372 |
+ int err; |
4373 |
+ |
4374 |
++ if (fuse_is_bad(olddir)) |
4375 |
++ return -EIO; |
4376 |
++ |
4377 |
+ if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) |
4378 |
+ return -EINVAL; |
4379 |
+ |
4380 |
+@@ -921,7 +939,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, |
4381 |
+ if (!err) { |
4382 |
+ if (fuse_invalid_attr(&outarg.attr) || |
4383 |
+ (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4384 |
+- make_bad_inode(inode); |
4385 |
++ fuse_make_bad(inode); |
4386 |
+ err = -EIO; |
4387 |
+ } else { |
4388 |
+ fuse_change_attributes(inode, &outarg.attr, |
4389 |
+@@ -1110,6 +1128,9 @@ static int fuse_permission(struct inode *inode, int mask) |
4390 |
+ bool refreshed = false; |
4391 |
+ int err = 0; |
4392 |
+ |
4393 |
++ if (fuse_is_bad(inode)) |
4394 |
++ return -EIO; |
4395 |
++ |
4396 |
+ if (!fuse_allow_current_process(fc)) |
4397 |
+ return -EACCES; |
4398 |
+ |
4399 |
+@@ -1247,7 +1268,7 @@ retry: |
4400 |
+ dput(dentry); |
4401 |
+ goto retry; |
4402 |
+ } |
4403 |
+- if (is_bad_inode(inode)) { |
4404 |
++ if (fuse_is_bad(inode)) { |
4405 |
+ dput(dentry); |
4406 |
+ return -EIO; |
4407 |
+ } |
4408 |
+@@ -1345,7 +1366,7 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx) |
4409 |
+ u64 attr_version = 0; |
4410 |
+ bool locked; |
4411 |
+ |
4412 |
+- if (is_bad_inode(inode)) |
4413 |
++ if (fuse_is_bad(inode)) |
4414 |
+ return -EIO; |
4415 |
+ |
4416 |
+ req = fuse_get_req(fc, 1); |
4417 |
+@@ -1405,6 +1426,9 @@ static const char *fuse_get_link(struct dentry *dentry, |
4418 |
+ if (!dentry) |
4419 |
+ return ERR_PTR(-ECHILD); |
4420 |
+ |
4421 |
++ if (fuse_is_bad(inode)) |
4422 |
++ return ERR_PTR(-EIO); |
4423 |
++ |
4424 |
+ link = kmalloc(PAGE_SIZE, GFP_KERNEL); |
4425 |
+ if (!link) |
4426 |
+ return ERR_PTR(-ENOMEM); |
4427 |
+@@ -1703,7 +1727,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, |
4428 |
+ |
4429 |
+ if (fuse_invalid_attr(&outarg.attr) || |
4430 |
+ (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4431 |
+- make_bad_inode(inode); |
4432 |
++ fuse_make_bad(inode); |
4433 |
+ err = -EIO; |
4434 |
+ goto error; |
4435 |
+ } |
4436 |
+@@ -1759,6 +1783,9 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) |
4437 |
+ struct file *file = (attr->ia_valid & ATTR_FILE) ? attr->ia_file : NULL; |
4438 |
+ int ret; |
4439 |
+ |
4440 |
++ if (fuse_is_bad(inode)) |
4441 |
++ return -EIO; |
4442 |
++ |
4443 |
+ if (!fuse_allow_current_process(get_fuse_conn(inode))) |
4444 |
+ return -EACCES; |
4445 |
+ |
4446 |
+@@ -1817,6 +1844,9 @@ static int fuse_getattr(const struct path *path, struct kstat *stat, |
4447 |
+ struct inode *inode = d_inode(path->dentry); |
4448 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
4449 |
+ |
4450 |
++ if (fuse_is_bad(inode)) |
4451 |
++ return -EIO; |
4452 |
++ |
4453 |
+ if (!fuse_allow_current_process(fc)) |
4454 |
+ return -EACCES; |
4455 |
+ |
4456 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
4457 |
+index 4238939af2fe8..5f5da2911ceaa 100644 |
4458 |
+--- a/fs/fuse/file.c |
4459 |
++++ b/fs/fuse/file.c |
4460 |
+@@ -206,6 +206,9 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
4461 |
+ fc->atomic_o_trunc && |
4462 |
+ fc->writeback_cache; |
4463 |
+ |
4464 |
++ if (fuse_is_bad(inode)) |
4465 |
++ return -EIO; |
4466 |
++ |
4467 |
+ err = generic_file_open(inode, file); |
4468 |
+ if (err) |
4469 |
+ return err; |
4470 |
+@@ -407,7 +410,7 @@ static int fuse_flush(struct file *file, fl_owner_t id) |
4471 |
+ struct fuse_flush_in inarg; |
4472 |
+ int err; |
4473 |
+ |
4474 |
+- if (is_bad_inode(inode)) |
4475 |
++ if (fuse_is_bad(inode)) |
4476 |
+ return -EIO; |
4477 |
+ |
4478 |
+ if (fc->no_flush) |
4479 |
+@@ -455,7 +458,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, |
4480 |
+ struct fuse_fsync_in inarg; |
4481 |
+ int err; |
4482 |
+ |
4483 |
+- if (is_bad_inode(inode)) |
4484 |
++ if (fuse_is_bad(inode)) |
4485 |
+ return -EIO; |
4486 |
+ |
4487 |
+ inode_lock(inode); |
4488 |
+@@ -770,7 +773,7 @@ static int fuse_readpage(struct file *file, struct page *page) |
4489 |
+ int err; |
4490 |
+ |
4491 |
+ err = -EIO; |
4492 |
+- if (is_bad_inode(inode)) |
4493 |
++ if (fuse_is_bad(inode)) |
4494 |
+ goto out; |
4495 |
+ |
4496 |
+ err = fuse_do_readpage(file, page); |
4497 |
+@@ -897,7 +900,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, |
4498 |
+ int nr_alloc = min_t(unsigned, nr_pages, FUSE_MAX_PAGES_PER_REQ); |
4499 |
+ |
4500 |
+ err = -EIO; |
4501 |
+- if (is_bad_inode(inode)) |
4502 |
++ if (fuse_is_bad(inode)) |
4503 |
+ goto out; |
4504 |
+ |
4505 |
+ data.file = file; |
4506 |
+@@ -927,6 +930,9 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) |
4507 |
+ struct inode *inode = iocb->ki_filp->f_mapping->host; |
4508 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
4509 |
+ |
4510 |
++ if (fuse_is_bad(inode)) |
4511 |
++ return -EIO; |
4512 |
++ |
4513 |
+ /* |
4514 |
+ * In auto invalidate mode, always update attributes on read. |
4515 |
+ * Otherwise, only update if we attempt to read past EOF (to ensure |
4516 |
+@@ -1127,7 +1133,7 @@ static ssize_t fuse_perform_write(struct kiocb *iocb, |
4517 |
+ int err = 0; |
4518 |
+ ssize_t res = 0; |
4519 |
+ |
4520 |
+- if (is_bad_inode(inode)) |
4521 |
++ if (fuse_is_bad(inode)) |
4522 |
+ return -EIO; |
4523 |
+ |
4524 |
+ if (inode->i_size < pos + iov_iter_count(ii)) |
4525 |
+@@ -1184,6 +1190,9 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
4526 |
+ ssize_t err; |
4527 |
+ loff_t endbyte = 0; |
4528 |
+ |
4529 |
++ if (fuse_is_bad(inode)) |
4530 |
++ return -EIO; |
4531 |
++ |
4532 |
+ if (get_fuse_conn(inode)->writeback_cache) { |
4533 |
+ /* Update size (EOF optimization) and mode (SUID clearing) */ |
4534 |
+ err = fuse_update_attributes(mapping->host, file); |
4535 |
+@@ -1420,7 +1429,7 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io, |
4536 |
+ ssize_t res; |
4537 |
+ struct inode *inode = file_inode(io->iocb->ki_filp); |
4538 |
+ |
4539 |
+- if (is_bad_inode(inode)) |
4540 |
++ if (fuse_is_bad(inode)) |
4541 |
+ return -EIO; |
4542 |
+ |
4543 |
+ res = fuse_direct_io(io, iter, ppos, 0); |
4544 |
+@@ -1442,7 +1451,7 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from) |
4545 |
+ struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb); |
4546 |
+ ssize_t res; |
4547 |
+ |
4548 |
+- if (is_bad_inode(inode)) |
4549 |
++ if (fuse_is_bad(inode)) |
4550 |
+ return -EIO; |
4551 |
+ |
4552 |
+ /* Don't allow parallel writes to the same file */ |
4553 |
+@@ -1916,7 +1925,7 @@ static int fuse_writepages(struct address_space *mapping, |
4554 |
+ int err; |
4555 |
+ |
4556 |
+ err = -EIO; |
4557 |
+- if (is_bad_inode(inode)) |
4558 |
++ if (fuse_is_bad(inode)) |
4559 |
+ goto out; |
4560 |
+ |
4561 |
+ data.inode = inode; |
4562 |
+@@ -2701,7 +2710,7 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd, |
4563 |
+ if (!fuse_allow_current_process(fc)) |
4564 |
+ return -EACCES; |
4565 |
+ |
4566 |
+- if (is_bad_inode(inode)) |
4567 |
++ if (fuse_is_bad(inode)) |
4568 |
+ return -EIO; |
4569 |
+ |
4570 |
+ return fuse_do_ioctl(file, cmd, arg, flags); |
4571 |
+diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
4572 |
+index 338aa5e266d67..fac1f08dd32e1 100644 |
4573 |
+--- a/fs/fuse/fuse_i.h |
4574 |
++++ b/fs/fuse/fuse_i.h |
4575 |
+@@ -117,6 +117,8 @@ enum { |
4576 |
+ FUSE_I_INIT_RDPLUS, |
4577 |
+ /** An operation changing file size is in progress */ |
4578 |
+ FUSE_I_SIZE_UNSTABLE, |
4579 |
++ /* Bad inode */ |
4580 |
++ FUSE_I_BAD, |
4581 |
+ }; |
4582 |
+ |
4583 |
+ struct fuse_conn; |
4584 |
+@@ -687,6 +689,17 @@ static inline u64 get_node_id(struct inode *inode) |
4585 |
+ return get_fuse_inode(inode)->nodeid; |
4586 |
+ } |
4587 |
+ |
4588 |
++static inline void fuse_make_bad(struct inode *inode) |
4589 |
++{ |
4590 |
++ remove_inode_hash(inode); |
4591 |
++ set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state); |
4592 |
++} |
4593 |
++ |
4594 |
++static inline bool fuse_is_bad(struct inode *inode) |
4595 |
++{ |
4596 |
++ return unlikely(test_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state)); |
4597 |
++} |
4598 |
++ |
4599 |
+ /** Device operations */ |
4600 |
+ extern const struct file_operations fuse_dev_operations; |
4601 |
+ |
4602 |
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
4603 |
+index ffb61787d77af..747f7a710fb98 100644 |
4604 |
+--- a/fs/fuse/inode.c |
4605 |
++++ b/fs/fuse/inode.c |
4606 |
+@@ -317,7 +317,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, |
4607 |
+ unlock_new_inode(inode); |
4608 |
+ } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { |
4609 |
+ /* Inode has changed type, any I/O on the old should fail */ |
4610 |
+- make_bad_inode(inode); |
4611 |
++ fuse_make_bad(inode); |
4612 |
+ iput(inode); |
4613 |
+ goto retry; |
4614 |
+ } |
4615 |
+diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c |
4616 |
+index 3caac46b08b0e..134bbc432ae60 100644 |
4617 |
+--- a/fs/fuse/xattr.c |
4618 |
++++ b/fs/fuse/xattr.c |
4619 |
+@@ -113,6 +113,9 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) |
4620 |
+ struct fuse_getxattr_out outarg; |
4621 |
+ ssize_t ret; |
4622 |
+ |
4623 |
++ if (fuse_is_bad(inode)) |
4624 |
++ return -EIO; |
4625 |
++ |
4626 |
+ if (!fuse_allow_current_process(fc)) |
4627 |
+ return -EACCES; |
4628 |
+ |
4629 |
+@@ -178,6 +181,9 @@ static int fuse_xattr_get(const struct xattr_handler *handler, |
4630 |
+ struct dentry *dentry, struct inode *inode, |
4631 |
+ const char *name, void *value, size_t size) |
4632 |
+ { |
4633 |
++ if (fuse_is_bad(inode)) |
4634 |
++ return -EIO; |
4635 |
++ |
4636 |
+ return fuse_getxattr(inode, name, value, size); |
4637 |
+ } |
4638 |
+ |
4639 |
+@@ -186,6 +192,9 @@ static int fuse_xattr_set(const struct xattr_handler *handler, |
4640 |
+ const char *name, const void *value, size_t size, |
4641 |
+ int flags) |
4642 |
+ { |
4643 |
++ if (fuse_is_bad(inode)) |
4644 |
++ return -EIO; |
4645 |
++ |
4646 |
+ if (!value) |
4647 |
+ return fuse_removexattr(inode, name); |
4648 |
+ |
4649 |
+diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c |
4650 |
+index bd0428bebe9b7..221eb2bd205e4 100644 |
4651 |
+--- a/fs/jffs2/file.c |
4652 |
++++ b/fs/jffs2/file.c |
4653 |
+@@ -135,20 +135,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
4654 |
+ struct page *pg; |
4655 |
+ struct inode *inode = mapping->host; |
4656 |
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
4657 |
++ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
4658 |
+ pgoff_t index = pos >> PAGE_SHIFT; |
4659 |
+ uint32_t pageofs = index << PAGE_SHIFT; |
4660 |
+ int ret = 0; |
4661 |
+ |
4662 |
+- pg = grab_cache_page_write_begin(mapping, index, flags); |
4663 |
+- if (!pg) |
4664 |
+- return -ENOMEM; |
4665 |
+- *pagep = pg; |
4666 |
+- |
4667 |
+ jffs2_dbg(1, "%s()\n", __func__); |
4668 |
+ |
4669 |
+ if (pageofs > inode->i_size) { |
4670 |
+ /* Make new hole frag from old EOF to new page */ |
4671 |
+- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
4672 |
+ struct jffs2_raw_inode ri; |
4673 |
+ struct jffs2_full_dnode *fn; |
4674 |
+ uint32_t alloc_len; |
4675 |
+@@ -159,7 +154,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
4676 |
+ ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, |
4677 |
+ ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
4678 |
+ if (ret) |
4679 |
+- goto out_page; |
4680 |
++ goto out_err; |
4681 |
+ |
4682 |
+ mutex_lock(&f->sem); |
4683 |
+ memset(&ri, 0, sizeof(ri)); |
4684 |
+@@ -189,7 +184,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
4685 |
+ ret = PTR_ERR(fn); |
4686 |
+ jffs2_complete_reservation(c); |
4687 |
+ mutex_unlock(&f->sem); |
4688 |
+- goto out_page; |
4689 |
++ goto out_err; |
4690 |
+ } |
4691 |
+ ret = jffs2_add_full_dnode_to_inode(c, f, fn); |
4692 |
+ if (f->metadata) { |
4693 |
+@@ -204,13 +199,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
4694 |
+ jffs2_free_full_dnode(fn); |
4695 |
+ jffs2_complete_reservation(c); |
4696 |
+ mutex_unlock(&f->sem); |
4697 |
+- goto out_page; |
4698 |
++ goto out_err; |
4699 |
+ } |
4700 |
+ jffs2_complete_reservation(c); |
4701 |
+ inode->i_size = pageofs; |
4702 |
+ mutex_unlock(&f->sem); |
4703 |
+ } |
4704 |
+ |
4705 |
++ /* |
4706 |
++ * While getting a page and reading data in, lock c->alloc_sem until |
4707 |
++ * the page is Uptodate. Otherwise GC task may attempt to read the same |
4708 |
++ * page in read_cache_page(), which causes a deadlock. |
4709 |
++ */ |
4710 |
++ mutex_lock(&c->alloc_sem); |
4711 |
++ pg = grab_cache_page_write_begin(mapping, index, flags); |
4712 |
++ if (!pg) { |
4713 |
++ ret = -ENOMEM; |
4714 |
++ goto release_sem; |
4715 |
++ } |
4716 |
++ *pagep = pg; |
4717 |
++ |
4718 |
+ /* |
4719 |
+ * Read in the page if it wasn't already present. Cannot optimize away |
4720 |
+ * the whole page write case until jffs2_write_end can handle the |
4721 |
+@@ -220,15 +228,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
4722 |
+ mutex_lock(&f->sem); |
4723 |
+ ret = jffs2_do_readpage_nolock(inode, pg); |
4724 |
+ mutex_unlock(&f->sem); |
4725 |
+- if (ret) |
4726 |
+- goto out_page; |
4727 |
++ if (ret) { |
4728 |
++ unlock_page(pg); |
4729 |
++ put_page(pg); |
4730 |
++ goto release_sem; |
4731 |
++ } |
4732 |
+ } |
4733 |
+ jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); |
4734 |
+- return ret; |
4735 |
+ |
4736 |
+-out_page: |
4737 |
+- unlock_page(pg); |
4738 |
+- put_page(pg); |
4739 |
++release_sem: |
4740 |
++ mutex_unlock(&c->alloc_sem); |
4741 |
++out_err: |
4742 |
+ return ret; |
4743 |
+ } |
4744 |
+ |
4745 |
+diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c |
4746 |
+index 3c8dfab8e958e..02b01b4025f6e 100644 |
4747 |
+--- a/fs/nfs/nfs4client.c |
4748 |
++++ b/fs/nfs/nfs4client.c |
4749 |
+@@ -177,8 +177,11 @@ void nfs40_shutdown_client(struct nfs_client *clp) |
4750 |
+ |
4751 |
+ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) |
4752 |
+ { |
4753 |
+- int err; |
4754 |
++ char buf[INET6_ADDRSTRLEN + 1]; |
4755 |
++ const char *ip_addr = cl_init->ip_addr; |
4756 |
+ struct nfs_client *clp = nfs_alloc_client(cl_init); |
4757 |
++ int err; |
4758 |
++ |
4759 |
+ if (IS_ERR(clp)) |
4760 |
+ return clp; |
4761 |
+ |
4762 |
+@@ -202,6 +205,44 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) |
4763 |
+ #if IS_ENABLED(CONFIG_NFS_V4_1) |
4764 |
+ init_waitqueue_head(&clp->cl_lock_waitq); |
4765 |
+ #endif |
4766 |
++ |
4767 |
++ if (cl_init->minorversion != 0) |
4768 |
++ __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags); |
4769 |
++ __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags); |
4770 |
++ __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags); |
4771 |
++ |
4772 |
++ /* |
4773 |
++ * Set up the connection to the server before we add add to the |
4774 |
++ * global list. |
4775 |
++ */ |
4776 |
++ err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I); |
4777 |
++ if (err == -EINVAL) |
4778 |
++ err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); |
4779 |
++ if (err < 0) |
4780 |
++ goto error; |
4781 |
++ |
4782 |
++ /* If no clientaddr= option was specified, find a usable cb address */ |
4783 |
++ if (ip_addr == NULL) { |
4784 |
++ struct sockaddr_storage cb_addr; |
4785 |
++ struct sockaddr *sap = (struct sockaddr *)&cb_addr; |
4786 |
++ |
4787 |
++ err = rpc_localaddr(clp->cl_rpcclient, sap, sizeof(cb_addr)); |
4788 |
++ if (err < 0) |
4789 |
++ goto error; |
4790 |
++ err = rpc_ntop(sap, buf, sizeof(buf)); |
4791 |
++ if (err < 0) |
4792 |
++ goto error; |
4793 |
++ ip_addr = (const char *)buf; |
4794 |
++ } |
4795 |
++ strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); |
4796 |
++ |
4797 |
++ err = nfs_idmap_new(clp); |
4798 |
++ if (err < 0) { |
4799 |
++ dprintk("%s: failed to create idmapper. Error = %d\n", |
4800 |
++ __func__, err); |
4801 |
++ goto error; |
4802 |
++ } |
4803 |
++ __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); |
4804 |
+ return clp; |
4805 |
+ |
4806 |
+ error: |
4807 |
+@@ -354,8 +395,6 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp) |
4808 |
+ struct nfs_client *nfs4_init_client(struct nfs_client *clp, |
4809 |
+ const struct nfs_client_initdata *cl_init) |
4810 |
+ { |
4811 |
+- char buf[INET6_ADDRSTRLEN + 1]; |
4812 |
+- const char *ip_addr = cl_init->ip_addr; |
4813 |
+ struct nfs_client *old; |
4814 |
+ int error; |
4815 |
+ |
4816 |
+@@ -363,43 +402,6 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, |
4817 |
+ /* the client is initialised already */ |
4818 |
+ return clp; |
4819 |
+ |
4820 |
+- /* Check NFS protocol revision and initialize RPC op vector */ |
4821 |
+- clp->rpc_ops = &nfs_v4_clientops; |
4822 |
+- |
4823 |
+- if (clp->cl_minorversion != 0) |
4824 |
+- __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags); |
4825 |
+- __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags); |
4826 |
+- __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags); |
4827 |
+- |
4828 |
+- error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I); |
4829 |
+- if (error == -EINVAL) |
4830 |
+- error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); |
4831 |
+- if (error < 0) |
4832 |
+- goto error; |
4833 |
+- |
4834 |
+- /* If no clientaddr= option was specified, find a usable cb address */ |
4835 |
+- if (ip_addr == NULL) { |
4836 |
+- struct sockaddr_storage cb_addr; |
4837 |
+- struct sockaddr *sap = (struct sockaddr *)&cb_addr; |
4838 |
+- |
4839 |
+- error = rpc_localaddr(clp->cl_rpcclient, sap, sizeof(cb_addr)); |
4840 |
+- if (error < 0) |
4841 |
+- goto error; |
4842 |
+- error = rpc_ntop(sap, buf, sizeof(buf)); |
4843 |
+- if (error < 0) |
4844 |
+- goto error; |
4845 |
+- ip_addr = (const char *)buf; |
4846 |
+- } |
4847 |
+- strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); |
4848 |
+- |
4849 |
+- error = nfs_idmap_new(clp); |
4850 |
+- if (error < 0) { |
4851 |
+- dprintk("%s: failed to create idmapper. Error = %d\n", |
4852 |
+- __func__, error); |
4853 |
+- goto error; |
4854 |
+- } |
4855 |
+- __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); |
4856 |
+- |
4857 |
+ error = nfs4_init_client_minor_version(clp); |
4858 |
+ if (error < 0) |
4859 |
+ goto error; |
4860 |
+diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c |
4861 |
+index 59f444dced9bc..b46f315183f17 100644 |
4862 |
+--- a/fs/orangefs/orangefs-bufmap.c |
4863 |
++++ b/fs/orangefs/orangefs-bufmap.c |
4864 |
+@@ -179,7 +179,7 @@ orangefs_bufmap_free(struct orangefs_bufmap *bufmap) |
4865 |
+ { |
4866 |
+ kfree(bufmap->page_array); |
4867 |
+ kfree(bufmap->desc_array); |
4868 |
+- kfree(bufmap->buffer_index_array); |
4869 |
++ bitmap_free(bufmap->buffer_index_array); |
4870 |
+ kfree(bufmap); |
4871 |
+ } |
4872 |
+ |
4873 |
+@@ -243,8 +243,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc) |
4874 |
+ bufmap->desc_size = user_desc->size; |
4875 |
+ bufmap->desc_shift = ilog2(bufmap->desc_size); |
4876 |
+ |
4877 |
+- bufmap->buffer_index_array = |
4878 |
+- kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL); |
4879 |
++ bufmap->buffer_index_array = bitmap_zalloc(bufmap->desc_count, GFP_KERNEL); |
4880 |
+ if (!bufmap->buffer_index_array) |
4881 |
+ goto out_free_bufmap; |
4882 |
+ |
4883 |
+@@ -267,7 +266,7 @@ orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc) |
4884 |
+ out_free_desc_array: |
4885 |
+ kfree(bufmap->desc_array); |
4886 |
+ out_free_index_array: |
4887 |
+- kfree(bufmap->buffer_index_array); |
4888 |
++ bitmap_free(bufmap->buffer_index_array); |
4889 |
+ out_free_bufmap: |
4890 |
+ kfree(bufmap); |
4891 |
+ out: |
4892 |
+diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c |
4893 |
+index ad827cf642fe5..c27f5318d36c8 100644 |
4894 |
+--- a/fs/ubifs/super.c |
4895 |
++++ b/fs/ubifs/super.c |
4896 |
+@@ -1706,7 +1706,6 @@ out: |
4897 |
+ kthread_stop(c->bgt); |
4898 |
+ c->bgt = NULL; |
4899 |
+ } |
4900 |
+- free_wbufs(c); |
4901 |
+ kfree(c->write_reserve_buf); |
4902 |
+ c->write_reserve_buf = NULL; |
4903 |
+ vfree(c->ileb_buf); |
4904 |
+diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h |
4905 |
+index 71fadbe77e211..2c5df69e67819 100644 |
4906 |
+--- a/include/acpi/actypes.h |
4907 |
++++ b/include/acpi/actypes.h |
4908 |
+@@ -560,8 +560,14 @@ typedef u64 acpi_integer; |
4909 |
+ * Can be used with access_width of struct acpi_generic_address and access_size of |
4910 |
+ * struct acpi_resource_generic_register. |
4911 |
+ */ |
4912 |
+-#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) |
4913 |
+-#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) |
4914 |
++#define ACPI_ACCESS_BIT_SHIFT 2 |
4915 |
++#define ACPI_ACCESS_BYTE_SHIFT -1 |
4916 |
++#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) |
4917 |
++#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) |
4918 |
++#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) |
4919 |
++#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) |
4920 |
++#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) |
4921 |
++#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) |
4922 |
+ |
4923 |
+ /******************************************************************************* |
4924 |
+ * |
4925 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
4926 |
+index 37876d842f2e6..c4ab9934b41df 100644 |
4927 |
+--- a/include/net/sch_generic.h |
4928 |
++++ b/include/net/sch_generic.h |
4929 |
+@@ -885,6 +885,7 @@ struct psched_ratecfg { |
4930 |
+ u64 rate_bytes_ps; /* bytes per second */ |
4931 |
+ u32 mult; |
4932 |
+ u16 overhead; |
4933 |
++ u16 mpu; |
4934 |
+ u8 linklayer; |
4935 |
+ u8 shift; |
4936 |
+ }; |
4937 |
+@@ -894,6 +895,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, |
4938 |
+ { |
4939 |
+ len += r->overhead; |
4940 |
+ |
4941 |
++ if (len < r->mpu) |
4942 |
++ len = r->mpu; |
4943 |
++ |
4944 |
+ if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) |
4945 |
+ return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; |
4946 |
+ |
4947 |
+@@ -916,6 +920,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, |
4948 |
+ res->rate = min_t(u64, r->rate_bytes_ps, ~0U); |
4949 |
+ |
4950 |
+ res->overhead = r->overhead; |
4951 |
++ res->mpu = r->mpu; |
4952 |
+ res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); |
4953 |
+ } |
4954 |
+ |
4955 |
+diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c |
4956 |
+index 45c2cd37fe6b0..60d4cd6d9c590 100644 |
4957 |
+--- a/kernel/sched/cputime.c |
4958 |
++++ b/kernel/sched/cputime.c |
4959 |
+@@ -150,10 +150,10 @@ void account_guest_time(struct task_struct *p, u64 cputime) |
4960 |
+ |
4961 |
+ /* Add guest time to cpustat. */ |
4962 |
+ if (task_nice(p) > 0) { |
4963 |
+- cpustat[CPUTIME_NICE] += cputime; |
4964 |
++ task_group_account_field(p, CPUTIME_NICE, cputime); |
4965 |
+ cpustat[CPUTIME_GUEST_NICE] += cputime; |
4966 |
+ } else { |
4967 |
+- cpustat[CPUTIME_USER] += cputime; |
4968 |
++ task_group_account_field(p, CPUTIME_USER, cputime); |
4969 |
+ cpustat[CPUTIME_GUEST] += cputime; |
4970 |
+ } |
4971 |
+ } |
4972 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
4973 |
+index cc7dd1aaf08e3..c093bb0f52eb1 100644 |
4974 |
+--- a/kernel/sched/rt.c |
4975 |
++++ b/kernel/sched/rt.c |
4976 |
+@@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime) |
4977 |
+ rt_b->rt_period_timer.function = sched_rt_period_timer; |
4978 |
+ } |
4979 |
+ |
4980 |
+-static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
4981 |
++static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) |
4982 |
+ { |
4983 |
+- if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
4984 |
+- return; |
4985 |
+- |
4986 |
+ raw_spin_lock(&rt_b->rt_runtime_lock); |
4987 |
+ if (!rt_b->rt_period_active) { |
4988 |
+ rt_b->rt_period_active = 1; |
4989 |
+@@ -74,6 +71,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
4990 |
+ raw_spin_unlock(&rt_b->rt_runtime_lock); |
4991 |
+ } |
4992 |
+ |
4993 |
++static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
4994 |
++{ |
4995 |
++ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
4996 |
++ return; |
4997 |
++ |
4998 |
++ do_start_rt_bandwidth(rt_b); |
4999 |
++} |
5000 |
++ |
5001 |
+ void init_rt_rq(struct rt_rq *rt_rq) |
5002 |
+ { |
5003 |
+ struct rt_prio_array *array; |
5004 |
+@@ -982,13 +987,17 @@ static void update_curr_rt(struct rq *rq) |
5005 |
+ |
5006 |
+ for_each_sched_rt_entity(rt_se) { |
5007 |
+ struct rt_rq *rt_rq = rt_rq_of_se(rt_se); |
5008 |
++ int exceeded; |
5009 |
+ |
5010 |
+ if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { |
5011 |
+ raw_spin_lock(&rt_rq->rt_runtime_lock); |
5012 |
+ rt_rq->rt_time += delta_exec; |
5013 |
+- if (sched_rt_runtime_exceeded(rt_rq)) |
5014 |
++ exceeded = sched_rt_runtime_exceeded(rt_rq); |
5015 |
++ if (exceeded) |
5016 |
+ resched_curr(rq); |
5017 |
+ raw_spin_unlock(&rt_rq->rt_runtime_lock); |
5018 |
++ if (exceeded) |
5019 |
++ do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); |
5020 |
+ } |
5021 |
+ } |
5022 |
+ } |
5023 |
+@@ -2629,8 +2638,12 @@ static int sched_rt_global_validate(void) |
5024 |
+ |
5025 |
+ static void sched_rt_do_global(void) |
5026 |
+ { |
5027 |
++ unsigned long flags; |
5028 |
++ |
5029 |
++ raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); |
5030 |
+ def_rt_bandwidth.rt_runtime = global_rt_runtime(); |
5031 |
+ def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); |
5032 |
++ raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); |
5033 |
+ } |
5034 |
+ |
5035 |
+ int sched_rt_handler(struct ctl_table *table, int write, |
5036 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
5037 |
+index cb1003d1159eb..5a7b182f78456 100644 |
5038 |
+--- a/mm/shmem.c |
5039 |
++++ b/mm/shmem.c |
5040 |
+@@ -450,7 +450,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
5041 |
+ struct shmem_inode_info *info; |
5042 |
+ struct page *page; |
5043 |
+ unsigned long batch = sc ? sc->nr_to_scan : 128; |
5044 |
+- int removed = 0, split = 0; |
5045 |
++ int split = 0; |
5046 |
+ |
5047 |
+ if (list_empty(&sbinfo->shrinklist)) |
5048 |
+ return SHRINK_STOP; |
5049 |
+@@ -465,7 +465,6 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
5050 |
+ /* inode is about to be evicted */ |
5051 |
+ if (!inode) { |
5052 |
+ list_del_init(&info->shrinklist); |
5053 |
+- removed++; |
5054 |
+ goto next; |
5055 |
+ } |
5056 |
+ |
5057 |
+@@ -473,12 +472,12 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
5058 |
+ if (round_up(inode->i_size, PAGE_SIZE) == |
5059 |
+ round_up(inode->i_size, HPAGE_PMD_SIZE)) { |
5060 |
+ list_move(&info->shrinklist, &to_remove); |
5061 |
+- removed++; |
5062 |
+ goto next; |
5063 |
+ } |
5064 |
+ |
5065 |
+ list_move(&info->shrinklist, &list); |
5066 |
+ next: |
5067 |
++ sbinfo->shrinklist_len--; |
5068 |
+ if (!--batch) |
5069 |
+ break; |
5070 |
+ } |
5071 |
+@@ -498,7 +497,7 @@ next: |
5072 |
+ inode = &info->vfs_inode; |
5073 |
+ |
5074 |
+ if (nr_to_split && split >= nr_to_split) |
5075 |
+- goto leave; |
5076 |
++ goto move_back; |
5077 |
+ |
5078 |
+ page = find_get_page(inode->i_mapping, |
5079 |
+ (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); |
5080 |
+@@ -512,38 +511,44 @@ next: |
5081 |
+ } |
5082 |
+ |
5083 |
+ /* |
5084 |
+- * Leave the inode on the list if we failed to lock |
5085 |
+- * the page at this time. |
5086 |
++ * Move the inode on the list back to shrinklist if we failed |
5087 |
++ * to lock the page at this time. |
5088 |
+ * |
5089 |
+ * Waiting for the lock may lead to deadlock in the |
5090 |
+ * reclaim path. |
5091 |
+ */ |
5092 |
+ if (!trylock_page(page)) { |
5093 |
+ put_page(page); |
5094 |
+- goto leave; |
5095 |
++ goto move_back; |
5096 |
+ } |
5097 |
+ |
5098 |
+ ret = split_huge_page(page); |
5099 |
+ unlock_page(page); |
5100 |
+ put_page(page); |
5101 |
+ |
5102 |
+- /* If split failed leave the inode on the list */ |
5103 |
++ /* If split failed move the inode on the list back to shrinklist */ |
5104 |
+ if (ret) |
5105 |
+- goto leave; |
5106 |
++ goto move_back; |
5107 |
+ |
5108 |
+ split++; |
5109 |
+ drop: |
5110 |
+ list_del_init(&info->shrinklist); |
5111 |
+- removed++; |
5112 |
+-leave: |
5113 |
++ goto put; |
5114 |
++move_back: |
5115 |
++ /* |
5116 |
++ * Make sure the inode is either on the global list or deleted |
5117 |
++ * from any local list before iput() since it could be deleted |
5118 |
++ * in another thread once we put the inode (then the local list |
5119 |
++ * is corrupted). |
5120 |
++ */ |
5121 |
++ spin_lock(&sbinfo->shrinklist_lock); |
5122 |
++ list_move(&info->shrinklist, &sbinfo->shrinklist); |
5123 |
++ sbinfo->shrinklist_len++; |
5124 |
++ spin_unlock(&sbinfo->shrinklist_lock); |
5125 |
++put: |
5126 |
+ iput(inode); |
5127 |
+ } |
5128 |
+ |
5129 |
+- spin_lock(&sbinfo->shrinklist_lock); |
5130 |
+- list_splice_tail(&list, &sbinfo->shrinklist); |
5131 |
+- sbinfo->shrinklist_len -= removed; |
5132 |
+- spin_unlock(&sbinfo->shrinklist_lock); |
5133 |
+- |
5134 |
+ return split; |
5135 |
+ } |
5136 |
+ |
5137 |
+diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c |
5138 |
+index 9873684a9d8ff..4764ed73f33bf 100644 |
5139 |
+--- a/net/bluetooth/cmtp/core.c |
5140 |
++++ b/net/bluetooth/cmtp/core.c |
5141 |
+@@ -499,9 +499,7 @@ static int __init cmtp_init(void) |
5142 |
+ { |
5143 |
+ BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); |
5144 |
+ |
5145 |
+- cmtp_init_sockets(); |
5146 |
+- |
5147 |
+- return 0; |
5148 |
++ return cmtp_init_sockets(); |
5149 |
+ } |
5150 |
+ |
5151 |
+ static void __exit cmtp_exit(void) |
5152 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
5153 |
+index 1906adfd553ad..687b4d0e4c673 100644 |
5154 |
+--- a/net/bluetooth/hci_core.c |
5155 |
++++ b/net/bluetooth/hci_core.c |
5156 |
+@@ -3183,6 +3183,7 @@ int hci_register_dev(struct hci_dev *hdev) |
5157 |
+ return id; |
5158 |
+ |
5159 |
+ err_wqueue: |
5160 |
++ debugfs_remove_recursive(hdev->debugfs); |
5161 |
+ destroy_workqueue(hdev->workqueue); |
5162 |
+ destroy_workqueue(hdev->req_workqueue); |
5163 |
+ err: |
5164 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
5165 |
+index 5186f199d892c..eca596a56f46b 100644 |
5166 |
+--- a/net/bluetooth/hci_event.c |
5167 |
++++ b/net/bluetooth/hci_event.c |
5168 |
+@@ -4967,7 +4967,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
5169 |
+ struct hci_ev_le_advertising_info *ev = ptr; |
5170 |
+ s8 rssi; |
5171 |
+ |
5172 |
+- if (ev->length <= HCI_MAX_AD_LENGTH) { |
5173 |
++ if (ev->length <= HCI_MAX_AD_LENGTH && |
5174 |
++ ev->data + ev->length <= skb_tail_pointer(skb)) { |
5175 |
+ rssi = ev->data[ev->length]; |
5176 |
+ process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
5177 |
+ ev->bdaddr_type, NULL, 0, rssi, |
5178 |
+@@ -4977,6 +4978,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
5179 |
+ } |
5180 |
+ |
5181 |
+ ptr += sizeof(*ev) + ev->length + 1; |
5182 |
++ |
5183 |
++ if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { |
5184 |
++ bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); |
5185 |
++ break; |
5186 |
++ } |
5187 |
+ } |
5188 |
+ |
5189 |
+ hci_dev_unlock(hdev); |
5190 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
5191 |
+index a5cc8942fc3f8..5c411118b30df 100644 |
5192 |
+--- a/net/bluetooth/sco.c |
5193 |
++++ b/net/bluetooth/sco.c |
5194 |
+@@ -48,6 +48,8 @@ struct sco_conn { |
5195 |
+ spinlock_t lock; |
5196 |
+ struct sock *sk; |
5197 |
+ |
5198 |
++ struct delayed_work timeout_work; |
5199 |
++ |
5200 |
+ unsigned int mtu; |
5201 |
+ }; |
5202 |
+ |
5203 |
+@@ -73,9 +75,20 @@ struct sco_pinfo { |
5204 |
+ #define SCO_CONN_TIMEOUT (HZ * 40) |
5205 |
+ #define SCO_DISCONN_TIMEOUT (HZ * 2) |
5206 |
+ |
5207 |
+-static void sco_sock_timeout(unsigned long arg) |
5208 |
++static void sco_sock_timeout(struct work_struct *work) |
5209 |
+ { |
5210 |
+- struct sock *sk = (struct sock *)arg; |
5211 |
++ struct sco_conn *conn = container_of(work, struct sco_conn, |
5212 |
++ timeout_work.work); |
5213 |
++ struct sock *sk; |
5214 |
++ |
5215 |
++ sco_conn_lock(conn); |
5216 |
++ sk = conn->sk; |
5217 |
++ if (sk) |
5218 |
++ sock_hold(sk); |
5219 |
++ sco_conn_unlock(conn); |
5220 |
++ |
5221 |
++ if (!sk) |
5222 |
++ return; |
5223 |
+ |
5224 |
+ BT_DBG("sock %p state %d", sk, sk->sk_state); |
5225 |
+ |
5226 |
+@@ -89,14 +102,21 @@ static void sco_sock_timeout(unsigned long arg) |
5227 |
+ |
5228 |
+ static void sco_sock_set_timer(struct sock *sk, long timeout) |
5229 |
+ { |
5230 |
++ if (!sco_pi(sk)->conn) |
5231 |
++ return; |
5232 |
++ |
5233 |
+ BT_DBG("sock %p state %d timeout %ld", sk, sk->sk_state, timeout); |
5234 |
+- sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout); |
5235 |
++ cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); |
5236 |
++ schedule_delayed_work(&sco_pi(sk)->conn->timeout_work, timeout); |
5237 |
+ } |
5238 |
+ |
5239 |
+ static void sco_sock_clear_timer(struct sock *sk) |
5240 |
+ { |
5241 |
++ if (!sco_pi(sk)->conn) |
5242 |
++ return; |
5243 |
++ |
5244 |
+ BT_DBG("sock %p state %d", sk, sk->sk_state); |
5245 |
+- sk_stop_timer(sk, &sk->sk_timer); |
5246 |
++ cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); |
5247 |
+ } |
5248 |
+ |
5249 |
+ /* ---- SCO connections ---- */ |
5250 |
+@@ -113,6 +133,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon) |
5251 |
+ return NULL; |
5252 |
+ |
5253 |
+ spin_lock_init(&conn->lock); |
5254 |
++ INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout); |
5255 |
+ |
5256 |
+ hcon->sco_data = conn; |
5257 |
+ conn->hcon = hcon; |
5258 |
+@@ -178,6 +199,9 @@ static void sco_conn_del(struct hci_conn *hcon, int err) |
5259 |
+ sock_put(sk); |
5260 |
+ } |
5261 |
+ |
5262 |
++ /* Ensure no more work items will run before freeing conn. */ |
5263 |
++ cancel_delayed_work_sync(&conn->timeout_work); |
5264 |
++ |
5265 |
+ hcon->sco_data = NULL; |
5266 |
+ kfree(conn); |
5267 |
+ } |
5268 |
+@@ -466,8 +490,6 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, |
5269 |
+ |
5270 |
+ sco_pi(sk)->setting = BT_VOICE_CVSD_16BIT; |
5271 |
+ |
5272 |
+- setup_timer(&sk->sk_timer, sco_sock_timeout, (unsigned long)sk); |
5273 |
+- |
5274 |
+ bt_sock_link(&sco_sk_list, sk); |
5275 |
+ return sk; |
5276 |
+ } |
5277 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
5278 |
+index 8155c3d811a14..7e50bd9f36112 100644 |
5279 |
+--- a/net/bridge/br_netfilter_hooks.c |
5280 |
++++ b/net/bridge/br_netfilter_hooks.c |
5281 |
+@@ -724,6 +724,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
5282 |
+ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) |
5283 |
+ mtu = nf_bridge->frag_max_size; |
5284 |
+ |
5285 |
++ nf_bridge_update_protocol(skb); |
5286 |
++ nf_bridge_push_encap_header(skb); |
5287 |
++ |
5288 |
+ if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { |
5289 |
+ nf_bridge_info_free(skb); |
5290 |
+ return br_dev_queue_push_xmit(net, sk, skb); |
5291 |
+@@ -741,8 +744,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
5292 |
+ |
5293 |
+ IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; |
5294 |
+ |
5295 |
+- nf_bridge_update_protocol(skb); |
5296 |
+- |
5297 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
5298 |
+ |
5299 |
+ data->vlan_tci = skb->vlan_tci; |
5300 |
+@@ -765,8 +766,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
5301 |
+ |
5302 |
+ IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; |
5303 |
+ |
5304 |
+- nf_bridge_update_protocol(skb); |
5305 |
+- |
5306 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
5307 |
+ data->encap_size = nf_bridge_encap_header_len(skb); |
5308 |
+ data->size = ETH_HLEN + data->encap_size; |
5309 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
5310 |
+index 40b378bed6033..729e302bba6e9 100644 |
5311 |
+--- a/net/core/filter.c |
5312 |
++++ b/net/core/filter.c |
5313 |
+@@ -3644,9 +3644,9 @@ void bpf_warn_invalid_xdp_action(u32 act) |
5314 |
+ { |
5315 |
+ const u32 act_max = XDP_REDIRECT; |
5316 |
+ |
5317 |
+- WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", |
5318 |
+- act > act_max ? "Illegal" : "Driver unsupported", |
5319 |
+- act); |
5320 |
++ pr_warn_once("%s XDP return value %u, expect packet loss!\n", |
5321 |
++ act > act_max ? "Illegal" : "Driver unsupported", |
5322 |
++ act); |
5323 |
+ } |
5324 |
+ EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
5325 |
+ |
5326 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
5327 |
+index 37f4313e82d2e..34fd852fe3ca6 100644 |
5328 |
+--- a/net/core/net_namespace.c |
5329 |
++++ b/net/core/net_namespace.c |
5330 |
+@@ -138,8 +138,10 @@ static void ops_exit_list(const struct pernet_operations *ops, |
5331 |
+ { |
5332 |
+ struct net *net; |
5333 |
+ if (ops->exit) { |
5334 |
+- list_for_each_entry(net, net_exit_list, exit_list) |
5335 |
++ list_for_each_entry(net, net_exit_list, exit_list) { |
5336 |
+ ops->exit(net); |
5337 |
++ cond_resched(); |
5338 |
++ } |
5339 |
+ } |
5340 |
+ if (ops->exit_batch) |
5341 |
+ ops->exit_batch(net_exit_list); |
5342 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
5343 |
+index cbe1177d95f9e..13cae95a34662 100644 |
5344 |
+--- a/net/mac80211/rx.c |
5345 |
++++ b/net/mac80211/rx.c |
5346 |
+@@ -4434,7 +4434,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, |
5347 |
+ goto drop; |
5348 |
+ break; |
5349 |
+ case RX_ENC_VHT: |
5350 |
+- if (WARN_ONCE(status->rate_idx > 9 || |
5351 |
++ if (WARN_ONCE(status->rate_idx > 11 || |
5352 |
+ !status->nss || |
5353 |
+ status->nss > 8, |
5354 |
+ "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", |
5355 |
+diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
5356 |
+index 02aebc3187632..5bd6494573942 100644 |
5357 |
+--- a/net/nfc/llcp_sock.c |
5358 |
++++ b/net/nfc/llcp_sock.c |
5359 |
+@@ -797,6 +797,11 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
5360 |
+ |
5361 |
+ lock_sock(sk); |
5362 |
+ |
5363 |
++ if (!llcp_sock->local) { |
5364 |
++ release_sock(sk); |
5365 |
++ return -ENODEV; |
5366 |
++ } |
5367 |
++ |
5368 |
+ if (sk->sk_type == SOCK_DGRAM) { |
5369 |
+ DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, |
5370 |
+ msg->msg_name); |
5371 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
5372 |
+index 091a9746627fa..82752dcbf2a2c 100644 |
5373 |
+--- a/net/sched/sch_generic.c |
5374 |
++++ b/net/sched/sch_generic.c |
5375 |
+@@ -1010,6 +1010,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, |
5376 |
+ { |
5377 |
+ memset(r, 0, sizeof(*r)); |
5378 |
+ r->overhead = conf->overhead; |
5379 |
++ r->mpu = conf->mpu; |
5380 |
+ r->rate_bytes_ps = max_t(u64, conf->rate, rate64); |
5381 |
+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); |
5382 |
+ r->mult = 1; |
5383 |
+diff --git a/net/unix/garbage.c b/net/unix/garbage.c |
5384 |
+index 8bbe1b8e4ff7f..4d283e26d8162 100644 |
5385 |
+--- a/net/unix/garbage.c |
5386 |
++++ b/net/unix/garbage.c |
5387 |
+@@ -197,8 +197,11 @@ void wait_for_unix_gc(void) |
5388 |
+ { |
5389 |
+ /* If number of inflight sockets is insane, |
5390 |
+ * force a garbage collect right now. |
5391 |
++ * Paired with the WRITE_ONCE() in unix_inflight(), |
5392 |
++ * unix_notinflight() and gc_in_progress(). |
5393 |
+ */ |
5394 |
+- if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) |
5395 |
++ if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && |
5396 |
++ !READ_ONCE(gc_in_progress)) |
5397 |
+ unix_gc(); |
5398 |
+ wait_event(unix_gc_wait, gc_in_progress == false); |
5399 |
+ } |
5400 |
+@@ -218,7 +221,9 @@ void unix_gc(void) |
5401 |
+ if (gc_in_progress) |
5402 |
+ goto out; |
5403 |
+ |
5404 |
+- gc_in_progress = true; |
5405 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
5406 |
++ WRITE_ONCE(gc_in_progress, true); |
5407 |
++ |
5408 |
+ /* First, select candidates for garbage collection. Only |
5409 |
+ * in-flight sockets are considered, and from those only ones |
5410 |
+ * which don't have any external reference. |
5411 |
+@@ -304,7 +309,10 @@ void unix_gc(void) |
5412 |
+ |
5413 |
+ /* All candidates should have been detached by now. */ |
5414 |
+ BUG_ON(!list_empty(&gc_candidates)); |
5415 |
+- gc_in_progress = false; |
5416 |
++ |
5417 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
5418 |
++ WRITE_ONCE(gc_in_progress, false); |
5419 |
++ |
5420 |
+ wake_up(&unix_gc_wait); |
5421 |
+ |
5422 |
+ out: |
5423 |
+diff --git a/net/unix/scm.c b/net/unix/scm.c |
5424 |
+index e13d320c41c70..6c10af6037e39 100644 |
5425 |
+--- a/net/unix/scm.c |
5426 |
++++ b/net/unix/scm.c |
5427 |
+@@ -57,7 +57,8 @@ void unix_inflight(struct user_struct *user, struct file *fp) |
5428 |
+ } else { |
5429 |
+ BUG_ON(list_empty(&u->link)); |
5430 |
+ } |
5431 |
+- unix_tot_inflight++; |
5432 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
5433 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); |
5434 |
+ } |
5435 |
+ user->unix_inflight++; |
5436 |
+ spin_unlock(&unix_gc_lock); |
5437 |
+@@ -77,7 +78,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) |
5438 |
+ |
5439 |
+ if (atomic_long_dec_and_test(&u->inflight)) |
5440 |
+ list_del_init(&u->link); |
5441 |
+- unix_tot_inflight--; |
5442 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
5443 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); |
5444 |
+ } |
5445 |
+ user->unix_inflight--; |
5446 |
+ spin_unlock(&unix_gc_lock); |
5447 |
+diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff |
5448 |
+index 8c4fbad2055e5..1046bdc0719d2 100755 |
5449 |
+--- a/scripts/dtc/dtx_diff |
5450 |
++++ b/scripts/dtc/dtx_diff |
5451 |
+@@ -56,12 +56,8 @@ Otherwise DTx is treated as a dts source file (aka .dts). |
5452 |
+ or '/include/' to be processed. |
5453 |
+ |
5454 |
+ If DTx_1 and DTx_2 are in different architectures, then this script |
5455 |
+- may not work since \${ARCH} is part of the include path. Two possible |
5456 |
+- workarounds: |
5457 |
+- |
5458 |
+- `basename $0` \\ |
5459 |
+- <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ |
5460 |
+- <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) |
5461 |
++ may not work since \${ARCH} is part of the include path. The following |
5462 |
++ workaround can be used: |
5463 |
+ |
5464 |
+ `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts |
5465 |
+ `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts |
5466 |
+diff --git a/sound/core/jack.c b/sound/core/jack.c |
5467 |
+index 5ddf81f091fa9..36cfe1c54109d 100644 |
5468 |
+--- a/sound/core/jack.c |
5469 |
++++ b/sound/core/jack.c |
5470 |
+@@ -68,10 +68,13 @@ static int snd_jack_dev_free(struct snd_device *device) |
5471 |
+ struct snd_card *card = device->card; |
5472 |
+ struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; |
5473 |
+ |
5474 |
++ down_write(&card->controls_rwsem); |
5475 |
+ list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { |
5476 |
+ list_del_init(&jack_kctl->list); |
5477 |
+ snd_ctl_remove(card, jack_kctl->kctl); |
5478 |
+ } |
5479 |
++ up_write(&card->controls_rwsem); |
5480 |
++ |
5481 |
+ if (jack->private_free) |
5482 |
+ jack->private_free(jack); |
5483 |
+ |
5484 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
5485 |
+index b092f257c1c69..87806dab321a3 100644 |
5486 |
+--- a/sound/core/oss/pcm_oss.c |
5487 |
++++ b/sound/core/oss/pcm_oss.c |
5488 |
+@@ -2070,7 +2070,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr |
5489 |
+ int err, cmd; |
5490 |
+ |
5491 |
+ #ifdef OSS_DEBUG |
5492 |
+- pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); |
5493 |
++ pr_debug("pcm_oss: trigger = 0x%x\n", trigger); |
5494 |
+ #endif |
5495 |
+ |
5496 |
+ psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
5497 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
5498 |
+index 2b5caa8dea2e2..a228bf9331102 100644 |
5499 |
+--- a/sound/core/pcm.c |
5500 |
++++ b/sound/core/pcm.c |
5501 |
+@@ -875,7 +875,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); |
5502 |
+ static void free_chmap(struct snd_pcm_str *pstr) |
5503 |
+ { |
5504 |
+ if (pstr->chmap_kctl) { |
5505 |
+- snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); |
5506 |
++ struct snd_card *card = pstr->pcm->card; |
5507 |
++ |
5508 |
++ down_write(&card->controls_rwsem); |
5509 |
++ snd_ctl_remove(card, pstr->chmap_kctl); |
5510 |
++ up_write(&card->controls_rwsem); |
5511 |
+ pstr->chmap_kctl = NULL; |
5512 |
+ } |
5513 |
+ } |
5514 |
+diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
5515 |
+index ea1aa07962761..b923059a22276 100644 |
5516 |
+--- a/sound/core/seq/seq_queue.c |
5517 |
++++ b/sound/core/seq/seq_queue.c |
5518 |
+@@ -257,12 +257,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) |
5519 |
+ |
5520 |
+ /* -------------------------------------------------------- */ |
5521 |
+ |
5522 |
++#define MAX_CELL_PROCESSES_IN_QUEUE 1000 |
5523 |
++ |
5524 |
+ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
5525 |
+ { |
5526 |
+ unsigned long flags; |
5527 |
+ struct snd_seq_event_cell *cell; |
5528 |
+ snd_seq_tick_time_t cur_tick; |
5529 |
+ snd_seq_real_time_t cur_time; |
5530 |
++ int processed = 0; |
5531 |
+ |
5532 |
+ if (q == NULL) |
5533 |
+ return; |
5534 |
+@@ -285,6 +288,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
5535 |
+ if (!cell) |
5536 |
+ break; |
5537 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
5538 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
5539 |
++ goto out; /* the rest processed at the next batch */ |
5540 |
+ } |
5541 |
+ |
5542 |
+ /* Process time queue... */ |
5543 |
+@@ -294,14 +299,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
5544 |
+ if (!cell) |
5545 |
+ break; |
5546 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
5547 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
5548 |
++ goto out; /* the rest processed at the next batch */ |
5549 |
+ } |
5550 |
+ |
5551 |
++ out: |
5552 |
+ /* free lock */ |
5553 |
+ spin_lock_irqsave(&q->check_lock, flags); |
5554 |
+ if (q->check_again) { |
5555 |
+ q->check_again = 0; |
5556 |
+- spin_unlock_irqrestore(&q->check_lock, flags); |
5557 |
+- goto __again; |
5558 |
++ if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { |
5559 |
++ spin_unlock_irqrestore(&q->check_lock, flags); |
5560 |
++ goto __again; |
5561 |
++ } |
5562 |
+ } |
5563 |
+ q->check_blocked = 0; |
5564 |
+ spin_unlock_irqrestore(&q->check_lock, flags); |
5565 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
5566 |
+index a56f018d586f5..8ec73955170b4 100644 |
5567 |
+--- a/sound/pci/hda/hda_codec.c |
5568 |
++++ b/sound/pci/hda/hda_codec.c |
5569 |
+@@ -1680,8 +1680,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) |
5570 |
+ { |
5571 |
+ int i; |
5572 |
+ struct hda_nid_item *items = codec->mixers.list; |
5573 |
++ |
5574 |
++ down_write(&codec->card->controls_rwsem); |
5575 |
+ for (i = 0; i < codec->mixers.used; i++) |
5576 |
+ snd_ctl_remove(codec->card, items[i].kctl); |
5577 |
++ up_write(&codec->card->controls_rwsem); |
5578 |
+ snd_array_free(&codec->mixers); |
5579 |
+ snd_array_free(&codec->nids); |
5580 |
+ } |
5581 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
5582 |
+index e0c2b23ec7118..0adb7ded61e9c 100644 |
5583 |
+--- a/sound/soc/mediatek/mt8173/mt8173-max98090.c |
5584 |
++++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
5585 |
+@@ -177,6 +177,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) |
5586 |
+ if (ret) |
5587 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
5588 |
+ __func__, ret); |
5589 |
++ |
5590 |
++ of_node_put(codec_node); |
5591 |
++ of_node_put(platform_node); |
5592 |
+ return ret; |
5593 |
+ } |
5594 |
+ |
5595 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
5596 |
+index 99c15219dbc81..aa52e2f81760a 100644 |
5597 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
5598 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
5599 |
+@@ -227,6 +227,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) |
5600 |
+ if (ret) |
5601 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
5602 |
+ __func__, ret); |
5603 |
++ |
5604 |
++ of_node_put(platform_node); |
5605 |
+ return ret; |
5606 |
+ } |
5607 |
+ |
5608 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
5609 |
+index 42de84ca8c844..61b0d8f8678e9 100644 |
5610 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
5611 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
5612 |
+@@ -284,6 +284,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) |
5613 |
+ if (ret) |
5614 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
5615 |
+ __func__, ret); |
5616 |
++ |
5617 |
++ of_node_put(platform_node); |
5618 |
+ return ret; |
5619 |
+ } |
5620 |
+ |
5621 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
5622 |
+index e69c141d8ed4c..3492c02f72c1a 100644 |
5623 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
5624 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
5625 |
+@@ -316,6 +316,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) |
5626 |
+ if (ret) |
5627 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
5628 |
+ __func__, ret); |
5629 |
++ |
5630 |
++ of_node_put(platform_node); |
5631 |
+ return ret; |
5632 |
+ } |
5633 |
+ |
5634 |
+diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c |
5635 |
+index a635df61f928c..2a6ffb2abb338 100644 |
5636 |
+--- a/sound/soc/samsung/idma.c |
5637 |
++++ b/sound/soc/samsung/idma.c |
5638 |
+@@ -369,6 +369,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) |
5639 |
+ buf->addr = idma.lp_tx_addr; |
5640 |
+ buf->bytes = idma_hardware.buffer_bytes_max; |
5641 |
+ buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); |
5642 |
++ if (!buf->area) |
5643 |
++ return -ENOMEM; |
5644 |
+ |
5645 |
+ return 0; |
5646 |
+ } |