1 |
commit: 41b998757415c5917867b58dae4a2b76c8a28988 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Nov 1 20:29:16 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Nov 1 20:29:16 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=41b99875 |
7 |
|
8 |
Linux patch 4.19.154 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1153_linux-4.19.154.patch | 3490 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3494 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index f3a1010..ea0813a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -651,6 +651,10 @@ Patch: 1152_linux-4.19.153.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.153 |
23 |
|
24 |
+Patch: 1153_linux-4.19.154.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.154 |
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/1153_linux-4.19.154.patch b/1153_linux-4.19.154.patch |
33 |
new file mode 100644 |
34 |
index 0000000..8691528 |
35 |
--- /dev/null |
36 |
+++ b/1153_linux-4.19.154.patch |
37 |
@@ -0,0 +1,3490 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index d5e93bf207998..a7056e26947c3 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 19 |
46 |
+-SUBLEVEL = 153 |
47 |
++SUBLEVEL = 154 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = "People's Front" |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi |
52 |
+index 55d1872aa81a8..9d19183f40e15 100644 |
53 |
+--- a/arch/arm/boot/dts/imx6sl.dtsi |
54 |
++++ b/arch/arm/boot/dts/imx6sl.dtsi |
55 |
+@@ -922,8 +922,10 @@ |
56 |
+ }; |
57 |
+ |
58 |
+ rngb: rngb@21b4000 { |
59 |
++ compatible = "fsl,imx6sl-rngb", "fsl,imx25-rngb"; |
60 |
+ reg = <0x021b4000 0x4000>; |
61 |
+ interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>; |
62 |
++ clocks = <&clks IMX6SL_CLK_DUMMY>; |
63 |
+ }; |
64 |
+ |
65 |
+ weim: weim@21b8000 { |
66 |
+diff --git a/arch/arm/boot/dts/owl-s500.dtsi b/arch/arm/boot/dts/owl-s500.dtsi |
67 |
+index 43c9980a4260c..75a76842c2700 100644 |
68 |
+--- a/arch/arm/boot/dts/owl-s500.dtsi |
69 |
++++ b/arch/arm/boot/dts/owl-s500.dtsi |
70 |
+@@ -85,21 +85,21 @@ |
71 |
+ global_timer: timer@b0020200 { |
72 |
+ compatible = "arm,cortex-a9-global-timer"; |
73 |
+ reg = <0xb0020200 0x100>; |
74 |
+- interrupts = <GIC_PPI 0 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
75 |
++ interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
76 |
+ status = "disabled"; |
77 |
+ }; |
78 |
+ |
79 |
+ twd_timer: timer@b0020600 { |
80 |
+ compatible = "arm,cortex-a9-twd-timer"; |
81 |
+ reg = <0xb0020600 0x20>; |
82 |
+- interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
83 |
++ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
84 |
+ status = "disabled"; |
85 |
+ }; |
86 |
+ |
87 |
+ twd_wdt: wdt@b0020620 { |
88 |
+ compatible = "arm,cortex-a9-twd-wdt"; |
89 |
+ reg = <0xb0020620 0xe0>; |
90 |
+- interrupts = <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
91 |
++ interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; |
92 |
+ status = "disabled"; |
93 |
+ }; |
94 |
+ |
95 |
+diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts |
96 |
+index c39b9169ea641..b2a773a718e16 100644 |
97 |
+--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts |
98 |
++++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts |
99 |
+@@ -206,16 +206,16 @@ |
100 |
+ }; |
101 |
+ |
102 |
+ ®_dc1sw { |
103 |
+- regulator-min-microvolt = <3000000>; |
104 |
+- regulator-max-microvolt = <3000000>; |
105 |
++ regulator-min-microvolt = <3300000>; |
106 |
++ regulator-max-microvolt = <3300000>; |
107 |
+ regulator-name = "vcc-gmac-phy"; |
108 |
+ }; |
109 |
+ |
110 |
+ ®_dcdc1 { |
111 |
+ regulator-always-on; |
112 |
+- regulator-min-microvolt = <3000000>; |
113 |
+- regulator-max-microvolt = <3000000>; |
114 |
+- regulator-name = "vcc-3v0"; |
115 |
++ regulator-min-microvolt = <3300000>; |
116 |
++ regulator-max-microvolt = <3300000>; |
117 |
++ regulator-name = "vcc-3v3"; |
118 |
+ }; |
119 |
+ |
120 |
+ ®_dcdc2 { |
121 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
122 |
+index 8011e564a234b..2c5193ae20277 100644 |
123 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
124 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
125 |
+@@ -877,7 +877,7 @@ |
126 |
+ reg-names = "mdp_phys"; |
127 |
+ |
128 |
+ interrupt-parent = <&mdss>; |
129 |
+- interrupts = <0 0>; |
130 |
++ interrupts = <0>; |
131 |
+ |
132 |
+ clocks = <&gcc GCC_MDSS_AHB_CLK>, |
133 |
+ <&gcc GCC_MDSS_AXI_CLK>, |
134 |
+@@ -909,7 +909,7 @@ |
135 |
+ reg-names = "dsi_ctrl"; |
136 |
+ |
137 |
+ interrupt-parent = <&mdss>; |
138 |
+- interrupts = <4 0>; |
139 |
++ interrupts = <4>; |
140 |
+ |
141 |
+ assigned-clocks = <&gcc BYTE0_CLK_SRC>, |
142 |
+ <&gcc PCLK0_CLK_SRC>; |
143 |
+diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi |
144 |
+index 196b1c0ceb9b0..b968afa8da175 100644 |
145 |
+--- a/arch/arm64/boot/dts/qcom/pm8916.dtsi |
146 |
++++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi |
147 |
+@@ -99,7 +99,7 @@ |
148 |
+ |
149 |
+ wcd_codec: codec@f000 { |
150 |
+ compatible = "qcom,pm8916-wcd-analog-codec"; |
151 |
+- reg = <0xf000 0x200>; |
152 |
++ reg = <0xf000>; |
153 |
+ reg-names = "pmic-codec-core"; |
154 |
+ clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>; |
155 |
+ clock-names = "mclk"; |
156 |
+diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi |
157 |
+index a516c0e01429a..8a885ae647b7e 100644 |
158 |
+--- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi |
159 |
++++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi |
160 |
+@@ -411,7 +411,7 @@ |
161 |
+ }; |
162 |
+ |
163 |
+ i2c0: i2c@ff020000 { |
164 |
+- compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; |
165 |
++ compatible = "cdns,i2c-r1p14"; |
166 |
+ status = "disabled"; |
167 |
+ interrupt-parent = <&gic>; |
168 |
+ interrupts = <0 17 4>; |
169 |
+@@ -421,7 +421,7 @@ |
170 |
+ }; |
171 |
+ |
172 |
+ i2c1: i2c@ff030000 { |
173 |
+- compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; |
174 |
++ compatible = "cdns,i2c-r1p14"; |
175 |
+ status = "disabled"; |
176 |
+ interrupt-parent = <&gic>; |
177 |
+ interrupts = <0 18 4>; |
178 |
+diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h |
179 |
+index f0e571b2dc7c8..a6073fecdacd3 100644 |
180 |
+--- a/arch/powerpc/include/asm/tlb.h |
181 |
++++ b/arch/powerpc/include/asm/tlb.h |
182 |
+@@ -76,19 +76,6 @@ static inline int mm_is_thread_local(struct mm_struct *mm) |
183 |
+ return false; |
184 |
+ return cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)); |
185 |
+ } |
186 |
+-static inline void mm_reset_thread_local(struct mm_struct *mm) |
187 |
+-{ |
188 |
+- WARN_ON(atomic_read(&mm->context.copros) > 0); |
189 |
+- /* |
190 |
+- * It's possible for mm_access to take a reference on mm_users to |
191 |
+- * access the remote mm from another thread, but it's not allowed |
192 |
+- * to set mm_cpumask, so mm_users may be > 1 here. |
193 |
+- */ |
194 |
+- WARN_ON(current->mm != mm); |
195 |
+- atomic_set(&mm->context.active_cpus, 1); |
196 |
+- cpumask_clear(mm_cpumask(mm)); |
197 |
+- cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); |
198 |
+-} |
199 |
+ #else /* CONFIG_PPC_BOOK3S_64 */ |
200 |
+ static inline int mm_is_thread_local(struct mm_struct *mm) |
201 |
+ { |
202 |
+diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c |
203 |
+index a130473f16e5b..8ece45c2a1f64 100644 |
204 |
+--- a/arch/powerpc/kernel/tau_6xx.c |
205 |
++++ b/arch/powerpc/kernel/tau_6xx.c |
206 |
+@@ -40,7 +40,7 @@ static struct tau_temp |
207 |
+ unsigned char grew; |
208 |
+ } tau[NR_CPUS]; |
209 |
+ |
210 |
+-#undef DEBUG |
211 |
++static bool tau_int_enable; |
212 |
+ |
213 |
+ /* TODO: put these in a /proc interface, with some sanity checks, and maybe |
214 |
+ * dynamic adjustment to minimize # of interrupts */ |
215 |
+@@ -54,62 +54,44 @@ static struct tau_temp |
216 |
+ |
217 |
+ static void set_thresholds(unsigned long cpu) |
218 |
+ { |
219 |
+-#ifdef CONFIG_TAU_INT |
220 |
+- /* |
221 |
+- * setup THRM1, |
222 |
+- * threshold, valid bit, enable interrupts, interrupt when below threshold |
223 |
+- */ |
224 |
+- mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TIE | THRM1_TID); |
225 |
++ u32 maybe_tie = tau_int_enable ? THRM1_TIE : 0; |
226 |
+ |
227 |
+- /* setup THRM2, |
228 |
+- * threshold, valid bit, enable interrupts, interrupt when above threshold |
229 |
+- */ |
230 |
+- mtspr (SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | THRM1_TIE); |
231 |
+-#else |
232 |
+- /* same thing but don't enable interrupts */ |
233 |
+- mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TID); |
234 |
+- mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V); |
235 |
+-#endif |
236 |
++ /* setup THRM1, threshold, valid bit, interrupt when below threshold */ |
237 |
++ mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | maybe_tie | THRM1_TID); |
238 |
++ |
239 |
++ /* setup THRM2, threshold, valid bit, interrupt when above threshold */ |
240 |
++ mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | maybe_tie); |
241 |
+ } |
242 |
+ |
243 |
+ static void TAUupdate(int cpu) |
244 |
+ { |
245 |
+- unsigned thrm; |
246 |
+- |
247 |
+-#ifdef DEBUG |
248 |
+- printk("TAUupdate "); |
249 |
+-#endif |
250 |
++ u32 thrm; |
251 |
++ u32 bits = THRM1_TIV | THRM1_TIN | THRM1_V; |
252 |
+ |
253 |
+ /* if both thresholds are crossed, the step_sizes cancel out |
254 |
+ * and the window winds up getting expanded twice. */ |
255 |
+- if((thrm = mfspr(SPRN_THRM1)) & THRM1_TIV){ /* is valid? */ |
256 |
+- if(thrm & THRM1_TIN){ /* crossed low threshold */ |
257 |
+- if (tau[cpu].low >= step_size){ |
258 |
+- tau[cpu].low -= step_size; |
259 |
+- tau[cpu].high -= (step_size - window_expand); |
260 |
+- } |
261 |
+- tau[cpu].grew = 1; |
262 |
+-#ifdef DEBUG |
263 |
+- printk("low threshold crossed "); |
264 |
+-#endif |
265 |
++ thrm = mfspr(SPRN_THRM1); |
266 |
++ if ((thrm & bits) == bits) { |
267 |
++ mtspr(SPRN_THRM1, 0); |
268 |
++ |
269 |
++ if (tau[cpu].low >= step_size) { |
270 |
++ tau[cpu].low -= step_size; |
271 |
++ tau[cpu].high -= (step_size - window_expand); |
272 |
+ } |
273 |
++ tau[cpu].grew = 1; |
274 |
++ pr_debug("%s: low threshold crossed\n", __func__); |
275 |
+ } |
276 |
+- if((thrm = mfspr(SPRN_THRM2)) & THRM1_TIV){ /* is valid? */ |
277 |
+- if(thrm & THRM1_TIN){ /* crossed high threshold */ |
278 |
+- if (tau[cpu].high <= 127-step_size){ |
279 |
+- tau[cpu].low += (step_size - window_expand); |
280 |
+- tau[cpu].high += step_size; |
281 |
+- } |
282 |
+- tau[cpu].grew = 1; |
283 |
+-#ifdef DEBUG |
284 |
+- printk("high threshold crossed "); |
285 |
+-#endif |
286 |
++ thrm = mfspr(SPRN_THRM2); |
287 |
++ if ((thrm & bits) == bits) { |
288 |
++ mtspr(SPRN_THRM2, 0); |
289 |
++ |
290 |
++ if (tau[cpu].high <= 127 - step_size) { |
291 |
++ tau[cpu].low += (step_size - window_expand); |
292 |
++ tau[cpu].high += step_size; |
293 |
+ } |
294 |
++ tau[cpu].grew = 1; |
295 |
++ pr_debug("%s: high threshold crossed\n", __func__); |
296 |
+ } |
297 |
+- |
298 |
+-#ifdef DEBUG |
299 |
+- printk("grew = %d\n", tau[cpu].grew); |
300 |
+-#endif |
301 |
+ } |
302 |
+ |
303 |
+ #ifdef CONFIG_TAU_INT |
304 |
+@@ -134,17 +116,16 @@ void TAUException(struct pt_regs * regs) |
305 |
+ static void tau_timeout(void * info) |
306 |
+ { |
307 |
+ int cpu; |
308 |
+- unsigned long flags; |
309 |
+ int size; |
310 |
+ int shrink; |
311 |
+ |
312 |
+- /* disabling interrupts *should* be okay */ |
313 |
+- local_irq_save(flags); |
314 |
+ cpu = smp_processor_id(); |
315 |
+ |
316 |
+-#ifndef CONFIG_TAU_INT |
317 |
+- TAUupdate(cpu); |
318 |
+-#endif |
319 |
++ if (!tau_int_enable) |
320 |
++ TAUupdate(cpu); |
321 |
++ |
322 |
++ /* Stop thermal sensor comparisons and interrupts */ |
323 |
++ mtspr(SPRN_THRM3, 0); |
324 |
+ |
325 |
+ size = tau[cpu].high - tau[cpu].low; |
326 |
+ if (size > min_window && ! tau[cpu].grew) { |
327 |
+@@ -167,18 +148,12 @@ static void tau_timeout(void * info) |
328 |
+ |
329 |
+ set_thresholds(cpu); |
330 |
+ |
331 |
+- /* |
332 |
+- * Do the enable every time, since otherwise a bunch of (relatively) |
333 |
+- * complex sleep code needs to be added. One mtspr every time |
334 |
+- * tau_timeout is called is probably not a big deal. |
335 |
+- * |
336 |
++ /* Restart thermal sensor comparisons and interrupts. |
337 |
+ * The "PowerPC 740 and PowerPC 750 Microprocessor Datasheet" |
338 |
+ * recommends that "the maximum value be set in THRM3 under all |
339 |
+ * conditions." |
340 |
+ */ |
341 |
+ mtspr(SPRN_THRM3, THRM3_SITV(0x1fff) | THRM3_E); |
342 |
+- |
343 |
+- local_irq_restore(flags); |
344 |
+ } |
345 |
+ |
346 |
+ static struct workqueue_struct *tau_workq; |
347 |
+@@ -225,6 +200,9 @@ static int __init TAU_init(void) |
348 |
+ return 1; |
349 |
+ } |
350 |
+ |
351 |
++ tau_int_enable = IS_ENABLED(CONFIG_TAU_INT) && |
352 |
++ !strcmp(cur_cpu_spec->platform, "ppc750"); |
353 |
++ |
354 |
+ tau_workq = alloc_workqueue("tau", WQ_UNBOUND, 1); |
355 |
+ if (!tau_workq) |
356 |
+ return -ENOMEM; |
357 |
+@@ -234,7 +212,7 @@ static int __init TAU_init(void) |
358 |
+ queue_work(tau_workq, &tau_work); |
359 |
+ |
360 |
+ pr_info("Thermal assist unit using %s, shrink_timer: %d ms\n", |
361 |
+- IS_ENABLED(CONFIG_TAU_INT) ? "interrupts" : "workqueue", shrink_timer); |
362 |
++ tau_int_enable ? "interrupts" : "workqueue", shrink_timer); |
363 |
+ tau_initialized = 1; |
364 |
+ |
365 |
+ return 0; |
366 |
+diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c |
367 |
+index 1749f15fc0705..80b8fc4173de6 100644 |
368 |
+--- a/arch/powerpc/mm/tlb-radix.c |
369 |
++++ b/arch/powerpc/mm/tlb-radix.c |
370 |
+@@ -598,19 +598,29 @@ static void do_exit_flush_lazy_tlb(void *arg) |
371 |
+ struct mm_struct *mm = arg; |
372 |
+ unsigned long pid = mm->context.id; |
373 |
+ |
374 |
++ /* |
375 |
++ * A kthread could have done a mmget_not_zero() after the flushing CPU |
376 |
++ * checked mm_is_singlethreaded, and be in the process of |
377 |
++ * kthread_use_mm when interrupted here. In that case, current->mm will |
378 |
++ * be set to mm, because kthread_use_mm() setting ->mm and switching to |
379 |
++ * the mm is done with interrupts off. |
380 |
++ */ |
381 |
+ if (current->mm == mm) |
382 |
+- return; /* Local CPU */ |
383 |
++ goto out_flush; |
384 |
+ |
385 |
+ if (current->active_mm == mm) { |
386 |
+- /* |
387 |
+- * Must be a kernel thread because sender is single-threaded. |
388 |
+- */ |
389 |
+- BUG_ON(current->mm); |
390 |
++ WARN_ON_ONCE(current->mm != NULL); |
391 |
++ /* Is a kernel thread and is using mm as the lazy tlb */ |
392 |
+ mmgrab(&init_mm); |
393 |
+- switch_mm(mm, &init_mm, current); |
394 |
+ current->active_mm = &init_mm; |
395 |
++ switch_mm_irqs_off(mm, &init_mm, current); |
396 |
+ mmdrop(mm); |
397 |
+ } |
398 |
++ |
399 |
++ atomic_dec(&mm->context.active_cpus); |
400 |
++ cpumask_clear_cpu(smp_processor_id(), mm_cpumask(mm)); |
401 |
++ |
402 |
++out_flush: |
403 |
+ _tlbiel_pid(pid, RIC_FLUSH_ALL); |
404 |
+ } |
405 |
+ |
406 |
+@@ -625,7 +635,6 @@ static void exit_flush_lazy_tlbs(struct mm_struct *mm) |
407 |
+ */ |
408 |
+ smp_call_function_many(mm_cpumask(mm), do_exit_flush_lazy_tlb, |
409 |
+ (void *)mm, 1); |
410 |
+- mm_reset_thread_local(mm); |
411 |
+ } |
412 |
+ |
413 |
+ void radix__flush_tlb_mm(struct mm_struct *mm) |
414 |
+diff --git a/arch/powerpc/perf/hv-gpci-requests.h b/arch/powerpc/perf/hv-gpci-requests.h |
415 |
+index e608f9db12ddc..8965b4463d433 100644 |
416 |
+--- a/arch/powerpc/perf/hv-gpci-requests.h |
417 |
++++ b/arch/powerpc/perf/hv-gpci-requests.h |
418 |
+@@ -95,7 +95,7 @@ REQUEST(__field(0, 8, partition_id) |
419 |
+ |
420 |
+ #define REQUEST_NAME system_performance_capabilities |
421 |
+ #define REQUEST_NUM 0x40 |
422 |
+-#define REQUEST_IDX_KIND "starting_index=0xffffffffffffffff" |
423 |
++#define REQUEST_IDX_KIND "starting_index=0xffffffff" |
424 |
+ #include I(REQUEST_BEGIN) |
425 |
+ REQUEST(__field(0, 1, perf_collect_privileged) |
426 |
+ __field(0x1, 1, capability_mask) |
427 |
+@@ -223,7 +223,7 @@ REQUEST(__field(0, 2, partition_id) |
428 |
+ |
429 |
+ #define REQUEST_NAME system_hypervisor_times |
430 |
+ #define REQUEST_NUM 0xF0 |
431 |
+-#define REQUEST_IDX_KIND "starting_index=0xffffffffffffffff" |
432 |
++#define REQUEST_IDX_KIND "starting_index=0xffffffff" |
433 |
+ #include I(REQUEST_BEGIN) |
434 |
+ REQUEST(__count(0, 8, time_spent_to_dispatch_virtual_processors) |
435 |
+ __count(0x8, 8, time_spent_processing_virtual_processor_timers) |
436 |
+@@ -234,7 +234,7 @@ REQUEST(__count(0, 8, time_spent_to_dispatch_virtual_processors) |
437 |
+ |
438 |
+ #define REQUEST_NAME system_tlbie_count_and_time |
439 |
+ #define REQUEST_NUM 0xF4 |
440 |
+-#define REQUEST_IDX_KIND "starting_index=0xffffffffffffffff" |
441 |
++#define REQUEST_IDX_KIND "starting_index=0xffffffff" |
442 |
+ #include I(REQUEST_BEGIN) |
443 |
+ REQUEST(__count(0, 8, tlbie_instructions_issued) |
444 |
+ /* |
445 |
+diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c |
446 |
+index 053b8e9aa9e75..69a2dc2b16cf1 100644 |
447 |
+--- a/arch/powerpc/perf/isa207-common.c |
448 |
++++ b/arch/powerpc/perf/isa207-common.c |
449 |
+@@ -273,6 +273,15 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) |
450 |
+ |
451 |
+ mask |= CNST_PMC_MASK(pmc); |
452 |
+ value |= CNST_PMC_VAL(pmc); |
453 |
++ |
454 |
++ /* |
455 |
++ * PMC5 and PMC6 are used to count cycles and instructions and |
456 |
++ * they do not support most of the constraint bits. Add a check |
457 |
++ * to exclude PMC5/6 from most of the constraints except for |
458 |
++ * EBB/BHRB. |
459 |
++ */ |
460 |
++ if (pmc >= 5) |
461 |
++ goto ebb_bhrb; |
462 |
+ } |
463 |
+ |
464 |
+ if (pmc <= 4) { |
465 |
+@@ -331,6 +340,7 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) |
466 |
+ } |
467 |
+ } |
468 |
+ |
469 |
++ebb_bhrb: |
470 |
+ if (!pmc && ebb) |
471 |
+ /* EBB events must specify the PMC */ |
472 |
+ return -1; |
473 |
+diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig |
474 |
+index 14ef17e10ec9a..9914544e66774 100644 |
475 |
+--- a/arch/powerpc/platforms/Kconfig |
476 |
++++ b/arch/powerpc/platforms/Kconfig |
477 |
+@@ -238,12 +238,11 @@ config TAU |
478 |
+ temperature within 2-4 degrees Celsius. This option shows the current |
479 |
+ on-die temperature in /proc/cpuinfo if the cpu supports it. |
480 |
+ |
481 |
+- Unfortunately, on some chip revisions, this sensor is very inaccurate |
482 |
+- and in many cases, does not work at all, so don't assume the cpu |
483 |
+- temp is actually what /proc/cpuinfo says it is. |
484 |
++ Unfortunately, this sensor is very inaccurate when uncalibrated, so |
485 |
++ don't assume the cpu temp is actually what /proc/cpuinfo says it is. |
486 |
+ |
487 |
+ config TAU_INT |
488 |
+- bool "Interrupt driven TAU driver (DANGEROUS)" |
489 |
++ bool "Interrupt driven TAU driver (EXPERIMENTAL)" |
490 |
+ depends on TAU |
491 |
+ ---help--- |
492 |
+ The TAU supports an interrupt driven mode which causes an interrupt |
493 |
+@@ -251,12 +250,7 @@ config TAU_INT |
494 |
+ to get notified the temp has exceeded a range. With this option off, |
495 |
+ a timer is used to re-check the temperature periodically. |
496 |
+ |
497 |
+- However, on some cpus it appears that the TAU interrupt hardware |
498 |
+- is buggy and can cause a situation which would lead unexplained hard |
499 |
+- lockups. |
500 |
+- |
501 |
+- Unless you are extending the TAU driver, or enjoy kernel/hardware |
502 |
+- debugging, leave this option off. |
503 |
++ If in doubt, say N here. |
504 |
+ |
505 |
+ config TAU_AVERAGE |
506 |
+ bool "Average high and low temp" |
507 |
+diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c |
508 |
+index 198143833f00d..1dc2122a3cf51 100644 |
509 |
+--- a/arch/powerpc/platforms/powernv/opal-dump.c |
510 |
++++ b/arch/powerpc/platforms/powernv/opal-dump.c |
511 |
+@@ -322,15 +322,14 @@ static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj, |
512 |
+ return count; |
513 |
+ } |
514 |
+ |
515 |
+-static struct dump_obj *create_dump_obj(uint32_t id, size_t size, |
516 |
+- uint32_t type) |
517 |
++static void create_dump_obj(uint32_t id, size_t size, uint32_t type) |
518 |
+ { |
519 |
+ struct dump_obj *dump; |
520 |
+ int rc; |
521 |
+ |
522 |
+ dump = kzalloc(sizeof(*dump), GFP_KERNEL); |
523 |
+ if (!dump) |
524 |
+- return NULL; |
525 |
++ return; |
526 |
+ |
527 |
+ dump->kobj.kset = dump_kset; |
528 |
+ |
529 |
+@@ -350,21 +349,39 @@ static struct dump_obj *create_dump_obj(uint32_t id, size_t size, |
530 |
+ rc = kobject_add(&dump->kobj, NULL, "0x%x-0x%x", type, id); |
531 |
+ if (rc) { |
532 |
+ kobject_put(&dump->kobj); |
533 |
+- return NULL; |
534 |
++ return; |
535 |
+ } |
536 |
+ |
537 |
++ /* |
538 |
++ * As soon as the sysfs file for this dump is created/activated there is |
539 |
++ * a chance the opal_errd daemon (or any userspace) might read and |
540 |
++ * acknowledge the dump before kobject_uevent() is called. If that |
541 |
++ * happens then there is a potential race between |
542 |
++ * dump_ack_store->kobject_put() and kobject_uevent() which leads to a |
543 |
++ * use-after-free of a kernfs object resulting in a kernel crash. |
544 |
++ * |
545 |
++ * To avoid that, we need to take a reference on behalf of the bin file, |
546 |
++ * so that our reference remains valid while we call kobject_uevent(). |
547 |
++ * We then drop our reference before exiting the function, leaving the |
548 |
++ * bin file to drop the last reference (if it hasn't already). |
549 |
++ */ |
550 |
++ |
551 |
++ /* Take a reference for the bin file */ |
552 |
++ kobject_get(&dump->kobj); |
553 |
+ rc = sysfs_create_bin_file(&dump->kobj, &dump->dump_attr); |
554 |
+- if (rc) { |
555 |
++ if (rc == 0) { |
556 |
++ kobject_uevent(&dump->kobj, KOBJ_ADD); |
557 |
++ |
558 |
++ pr_info("%s: New platform dump. ID = 0x%x Size %u\n", |
559 |
++ __func__, dump->id, dump->size); |
560 |
++ } else { |
561 |
++ /* Drop reference count taken for bin file */ |
562 |
+ kobject_put(&dump->kobj); |
563 |
+- return NULL; |
564 |
+ } |
565 |
+ |
566 |
+- pr_info("%s: New platform dump. ID = 0x%x Size %u\n", |
567 |
+- __func__, dump->id, dump->size); |
568 |
+- |
569 |
+- kobject_uevent(&dump->kobj, KOBJ_ADD); |
570 |
+- |
571 |
+- return dump; |
572 |
++ /* Drop our reference */ |
573 |
++ kobject_put(&dump->kobj); |
574 |
++ return; |
575 |
+ } |
576 |
+ |
577 |
+ static irqreturn_t process_dump(int irq, void *data) |
578 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
579 |
+index 210eabd71ab23..670c2aedcefab 100644 |
580 |
+--- a/arch/x86/kvm/emulate.c |
581 |
++++ b/arch/x86/kvm/emulate.c |
582 |
+@@ -3561,7 +3561,7 @@ static int em_rdpid(struct x86_emulate_ctxt *ctxt) |
583 |
+ u64 tsc_aux = 0; |
584 |
+ |
585 |
+ if (ctxt->ops->get_msr(ctxt, MSR_TSC_AUX, &tsc_aux)) |
586 |
+- return emulate_gp(ctxt, 0); |
587 |
++ return emulate_ud(ctxt); |
588 |
+ ctxt->dst.val = tsc_aux; |
589 |
+ return X86EMUL_CONTINUE; |
590 |
+ } |
591 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
592 |
+index ce3710404544c..445b878e35194 100644 |
593 |
+--- a/block/blk-core.c |
594 |
++++ b/block/blk-core.c |
595 |
+@@ -2127,11 +2127,10 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector) |
596 |
+ { |
597 |
+ char b[BDEVNAME_SIZE]; |
598 |
+ |
599 |
+- printk(KERN_INFO "attempt to access beyond end of device\n"); |
600 |
+- printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n", |
601 |
+- bio_devname(bio, b), bio->bi_opf, |
602 |
+- (unsigned long long)bio_end_sector(bio), |
603 |
+- (long long)maxsector); |
604 |
++ pr_info_ratelimited("attempt to access beyond end of device\n" |
605 |
++ "%s: rw=%d, want=%llu, limit=%llu\n", |
606 |
++ bio_devname(bio, b), bio->bi_opf, |
607 |
++ bio_end_sector(bio), maxsector); |
608 |
+ } |
609 |
+ |
610 |
+ #ifdef CONFIG_FAIL_MAKE_REQUEST |
611 |
+diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c |
612 |
+index 90988e7a5b47f..2e7da9b379d48 100644 |
613 |
+--- a/drivers/clk/at91/clk-main.c |
614 |
++++ b/drivers/clk/at91/clk-main.c |
615 |
+@@ -517,12 +517,17 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index) |
616 |
+ return -EINVAL; |
617 |
+ |
618 |
+ regmap_read(regmap, AT91_CKGR_MOR, &tmp); |
619 |
+- tmp &= ~MOR_KEY_MASK; |
620 |
+ |
621 |
+ if (index && !(tmp & AT91_PMC_MOSCSEL)) |
622 |
+- regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL); |
623 |
++ tmp = AT91_PMC_MOSCSEL; |
624 |
+ else if (!index && (tmp & AT91_PMC_MOSCSEL)) |
625 |
+- regmap_write(regmap, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL); |
626 |
++ tmp = 0; |
627 |
++ else |
628 |
++ return 0; |
629 |
++ |
630 |
++ regmap_update_bits(regmap, AT91_CKGR_MOR, |
631 |
++ AT91_PMC_MOSCSEL | MOR_KEY_MASK, |
632 |
++ tmp | AT91_PMC_KEY); |
633 |
+ |
634 |
+ while (!clk_sam9x5_main_ready(regmap)) |
635 |
+ cpu_relax(); |
636 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
637 |
+index 1c093fb35ebee..e4fee233849d2 100644 |
638 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
639 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
640 |
+@@ -1319,8 +1319,10 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman, |
641 |
+ pll->hw.init = &init; |
642 |
+ |
643 |
+ ret = devm_clk_hw_register(cprman->dev, &pll->hw); |
644 |
+- if (ret) |
645 |
++ if (ret) { |
646 |
++ kfree(pll); |
647 |
+ return NULL; |
648 |
++ } |
649 |
+ return &pll->hw; |
650 |
+ } |
651 |
+ |
652 |
+diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c |
653 |
+index b8da6e799423a..6a371d05218da 100644 |
654 |
+--- a/drivers/clk/rockchip/clk-half-divider.c |
655 |
++++ b/drivers/clk/rockchip/clk-half-divider.c |
656 |
+@@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name, |
657 |
+ unsigned long flags, |
658 |
+ spinlock_t *lock) |
659 |
+ { |
660 |
+- struct clk *clk; |
661 |
++ struct clk *clk = ERR_PTR(-ENOMEM); |
662 |
+ struct clk_mux *mux = NULL; |
663 |
+ struct clk_gate *gate = NULL; |
664 |
+ struct clk_divider *div = NULL; |
665 |
+diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c |
666 |
+index 79942f7057576..5da985604692f 100644 |
667 |
+--- a/drivers/cpufreq/powernv-cpufreq.c |
668 |
++++ b/drivers/cpufreq/powernv-cpufreq.c |
669 |
+@@ -885,12 +885,15 @@ static int powernv_cpufreq_reboot_notifier(struct notifier_block *nb, |
670 |
+ unsigned long action, void *unused) |
671 |
+ { |
672 |
+ int cpu; |
673 |
+- struct cpufreq_policy cpu_policy; |
674 |
++ struct cpufreq_policy *cpu_policy; |
675 |
+ |
676 |
+ rebooting = true; |
677 |
+ for_each_online_cpu(cpu) { |
678 |
+- cpufreq_get_policy(&cpu_policy, cpu); |
679 |
+- powernv_cpufreq_target_index(&cpu_policy, get_nominal_index()); |
680 |
++ cpu_policy = cpufreq_cpu_get(cpu); |
681 |
++ if (!cpu_policy) |
682 |
++ continue; |
683 |
++ powernv_cpufreq_target_index(cpu_policy, get_nominal_index()); |
684 |
++ cpufreq_cpu_put(cpu_policy); |
685 |
+ } |
686 |
+ |
687 |
+ return NOTIFY_DONE; |
688 |
+diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
689 |
+index 626b643d610eb..20ca9c9e109e0 100644 |
690 |
+--- a/drivers/crypto/ccp/ccp-ops.c |
691 |
++++ b/drivers/crypto/ccp/ccp-ops.c |
692 |
+@@ -1752,7 +1752,7 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
693 |
+ break; |
694 |
+ default: |
695 |
+ ret = -EINVAL; |
696 |
+- goto e_ctx; |
697 |
++ goto e_data; |
698 |
+ } |
699 |
+ } else { |
700 |
+ /* Stash the context */ |
701 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c |
702 |
+index 65060c08522d7..22397a23780c0 100644 |
703 |
+--- a/drivers/gpu/drm/virtio/virtgpu_kms.c |
704 |
++++ b/drivers/gpu/drm/virtio/virtgpu_kms.c |
705 |
+@@ -113,8 +113,10 @@ static void virtio_gpu_get_capsets(struct virtio_gpu_device *vgdev, |
706 |
+ vgdev->capsets[i].id > 0, 5 * HZ); |
707 |
+ if (ret == 0) { |
708 |
+ DRM_ERROR("timed out waiting for cap set %d\n", i); |
709 |
++ spin_lock(&vgdev->display_info_lock); |
710 |
+ kfree(vgdev->capsets); |
711 |
+ vgdev->capsets = NULL; |
712 |
++ spin_unlock(&vgdev->display_info_lock); |
713 |
+ return; |
714 |
+ } |
715 |
+ DRM_INFO("cap set %d: id %d, max-version %d, max-size %d\n", |
716 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c |
717 |
+index 608906f06cedd..3e72c6dac0ffe 100644 |
718 |
+--- a/drivers/gpu/drm/virtio/virtgpu_vq.c |
719 |
++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c |
720 |
+@@ -566,9 +566,13 @@ static void virtio_gpu_cmd_get_capset_info_cb(struct virtio_gpu_device *vgdev, |
721 |
+ int i = le32_to_cpu(cmd->capset_index); |
722 |
+ |
723 |
+ spin_lock(&vgdev->display_info_lock); |
724 |
+- vgdev->capsets[i].id = le32_to_cpu(resp->capset_id); |
725 |
+- vgdev->capsets[i].max_version = le32_to_cpu(resp->capset_max_version); |
726 |
+- vgdev->capsets[i].max_size = le32_to_cpu(resp->capset_max_size); |
727 |
++ if (vgdev->capsets) { |
728 |
++ vgdev->capsets[i].id = le32_to_cpu(resp->capset_id); |
729 |
++ vgdev->capsets[i].max_version = le32_to_cpu(resp->capset_max_version); |
730 |
++ vgdev->capsets[i].max_size = le32_to_cpu(resp->capset_max_size); |
731 |
++ } else { |
732 |
++ DRM_ERROR("invalid capset memory."); |
733 |
++ } |
734 |
+ spin_unlock(&vgdev->display_info_lock); |
735 |
+ wake_up(&vgdev->resp_wq); |
736 |
+ } |
737 |
+diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
738 |
+index ee6dd1b84fac8..017aec34a238d 100644 |
739 |
+--- a/drivers/i2c/busses/Kconfig |
740 |
++++ b/drivers/i2c/busses/Kconfig |
741 |
+@@ -1117,6 +1117,7 @@ config I2C_RCAR |
742 |
+ tristate "Renesas R-Car I2C Controller" |
743 |
+ depends on ARCH_RENESAS || COMPILE_TEST |
744 |
+ select I2C_SLAVE |
745 |
++ select RESET_CONTROLLER if ARCH_RCAR_GEN3 |
746 |
+ help |
747 |
+ If you say yes to this option, support will be included for the |
748 |
+ R-Car I2C controller. |
749 |
+diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c |
750 |
+index eb05693593875..8ba4122fb3404 100644 |
751 |
+--- a/drivers/i2c/i2c-core-acpi.c |
752 |
++++ b/drivers/i2c/i2c-core-acpi.c |
753 |
+@@ -219,6 +219,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level, |
754 |
+ void i2c_acpi_register_devices(struct i2c_adapter *adap) |
755 |
+ { |
756 |
+ acpi_status status; |
757 |
++ acpi_handle handle; |
758 |
+ |
759 |
+ if (!has_acpi_companion(&adap->dev)) |
760 |
+ return; |
761 |
+@@ -229,6 +230,15 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap) |
762 |
+ adap, NULL); |
763 |
+ if (ACPI_FAILURE(status)) |
764 |
+ dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); |
765 |
++ |
766 |
++ if (!adap->dev.parent) |
767 |
++ return; |
768 |
++ |
769 |
++ handle = ACPI_HANDLE(adap->dev.parent); |
770 |
++ if (!handle) |
771 |
++ return; |
772 |
++ |
773 |
++ acpi_walk_dep_device_list(handle); |
774 |
+ } |
775 |
+ |
776 |
+ const struct acpi_device_id * |
777 |
+@@ -693,7 +703,6 @@ int i2c_acpi_install_space_handler(struct i2c_adapter *adapter) |
778 |
+ return -ENOMEM; |
779 |
+ } |
780 |
+ |
781 |
+- acpi_walk_dep_device_list(handle); |
782 |
+ return 0; |
783 |
+ } |
784 |
+ |
785 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
786 |
+index 1f14cd4ce3db5..8cdf933310d15 100644 |
787 |
+--- a/drivers/infiniband/core/cma.c |
788 |
++++ b/drivers/infiniband/core/cma.c |
789 |
+@@ -1678,19 +1678,30 @@ static void cma_release_port(struct rdma_id_private *id_priv) |
790 |
+ mutex_unlock(&lock); |
791 |
+ } |
792 |
+ |
793 |
+-static void cma_leave_roce_mc_group(struct rdma_id_private *id_priv, |
794 |
+- struct cma_multicast *mc) |
795 |
++static void destroy_mc(struct rdma_id_private *id_priv, |
796 |
++ struct cma_multicast *mc) |
797 |
+ { |
798 |
+- struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; |
799 |
+- struct net_device *ndev = NULL; |
800 |
++ if (rdma_cap_ib_mcast(id_priv->id.device, id_priv->id.port_num)) { |
801 |
++ ib_sa_free_multicast(mc->multicast.ib); |
802 |
++ kfree(mc); |
803 |
++ return; |
804 |
++ } |
805 |
+ |
806 |
+- if (dev_addr->bound_dev_if) |
807 |
+- ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); |
808 |
+- if (ndev) { |
809 |
+- cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid, false); |
810 |
+- dev_put(ndev); |
811 |
++ if (rdma_protocol_roce(id_priv->id.device, |
812 |
++ id_priv->id.port_num)) { |
813 |
++ struct rdma_dev_addr *dev_addr = |
814 |
++ &id_priv->id.route.addr.dev_addr; |
815 |
++ struct net_device *ndev = NULL; |
816 |
++ |
817 |
++ if (dev_addr->bound_dev_if) |
818 |
++ ndev = dev_get_by_index(dev_addr->net, |
819 |
++ dev_addr->bound_dev_if); |
820 |
++ if (ndev) { |
821 |
++ cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid, false); |
822 |
++ dev_put(ndev); |
823 |
++ } |
824 |
++ kref_put(&mc->mcref, release_mc); |
825 |
+ } |
826 |
+- kref_put(&mc->mcref, release_mc); |
827 |
+ } |
828 |
+ |
829 |
+ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) |
830 |
+@@ -1698,16 +1709,10 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) |
831 |
+ struct cma_multicast *mc; |
832 |
+ |
833 |
+ while (!list_empty(&id_priv->mc_list)) { |
834 |
+- mc = container_of(id_priv->mc_list.next, |
835 |
+- struct cma_multicast, list); |
836 |
++ mc = list_first_entry(&id_priv->mc_list, struct cma_multicast, |
837 |
++ list); |
838 |
+ list_del(&mc->list); |
839 |
+- if (rdma_cap_ib_mcast(id_priv->cma_dev->device, |
840 |
+- id_priv->id.port_num)) { |
841 |
+- ib_sa_free_multicast(mc->multicast.ib); |
842 |
+- kfree(mc); |
843 |
+- } else { |
844 |
+- cma_leave_roce_mc_group(id_priv, mc); |
845 |
+- } |
846 |
++ destroy_mc(id_priv, mc); |
847 |
+ } |
848 |
+ } |
849 |
+ |
850 |
+@@ -4020,16 +4025,6 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) |
851 |
+ else |
852 |
+ pr_debug_ratelimited("RDMA CM: MULTICAST_ERROR: failed to join multicast. status %d\n", |
853 |
+ status); |
854 |
+- mutex_lock(&id_priv->qp_mutex); |
855 |
+- if (!status && id_priv->id.qp) { |
856 |
+- status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid, |
857 |
+- be16_to_cpu(multicast->rec.mlid)); |
858 |
+- if (status) |
859 |
+- pr_debug_ratelimited("RDMA CM: MULTICAST_ERROR: failed to attach QP. status %d\n", |
860 |
+- status); |
861 |
+- } |
862 |
+- mutex_unlock(&id_priv->qp_mutex); |
863 |
+- |
864 |
+ event.status = status; |
865 |
+ event.param.ud.private_data = mc->context; |
866 |
+ if (!status) { |
867 |
+@@ -4283,6 +4278,10 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr, |
868 |
+ struct cma_multicast *mc; |
869 |
+ int ret; |
870 |
+ |
871 |
++ /* Not supported for kernel QPs */ |
872 |
++ if (WARN_ON(id->qp)) |
873 |
++ return -EINVAL; |
874 |
++ |
875 |
+ if (!id->device) |
876 |
+ return -EINVAL; |
877 |
+ |
878 |
+@@ -4333,25 +4332,14 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) |
879 |
+ id_priv = container_of(id, struct rdma_id_private, id); |
880 |
+ spin_lock_irq(&id_priv->lock); |
881 |
+ list_for_each_entry(mc, &id_priv->mc_list, list) { |
882 |
+- if (!memcmp(&mc->addr, addr, rdma_addr_size(addr))) { |
883 |
+- list_del(&mc->list); |
884 |
+- spin_unlock_irq(&id_priv->lock); |
885 |
+- |
886 |
+- if (id->qp) |
887 |
+- ib_detach_mcast(id->qp, |
888 |
+- &mc->multicast.ib->rec.mgid, |
889 |
+- be16_to_cpu(mc->multicast.ib->rec.mlid)); |
890 |
+- |
891 |
+- BUG_ON(id_priv->cma_dev->device != id->device); |
892 |
+- |
893 |
+- if (rdma_cap_ib_mcast(id->device, id->port_num)) { |
894 |
+- ib_sa_free_multicast(mc->multicast.ib); |
895 |
+- kfree(mc); |
896 |
+- } else if (rdma_protocol_roce(id->device, id->port_num)) { |
897 |
+- cma_leave_roce_mc_group(id_priv, mc); |
898 |
+- } |
899 |
+- return; |
900 |
+- } |
901 |
++ if (memcmp(&mc->addr, addr, rdma_addr_size(addr)) != 0) |
902 |
++ continue; |
903 |
++ list_del(&mc->list); |
904 |
++ spin_unlock_irq(&id_priv->lock); |
905 |
++ |
906 |
++ WARN_ON(id_priv->cma_dev->device != id->device); |
907 |
++ destroy_mc(id_priv, mc); |
908 |
++ return; |
909 |
+ } |
910 |
+ spin_unlock_irq(&id_priv->lock); |
911 |
+ } |
912 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c |
913 |
+index 081aa91fc162d..620eaca2b8314 100644 |
914 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c |
915 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c |
916 |
+@@ -274,7 +274,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp, |
917 |
+ ps_opcode = HNS_ROCE_WQE_OPCODE_SEND; |
918 |
+ break; |
919 |
+ case IB_WR_LOCAL_INV: |
920 |
+- break; |
921 |
+ case IB_WR_ATOMIC_CMP_AND_SWP: |
922 |
+ case IB_WR_ATOMIC_FETCH_AND_ADD: |
923 |
+ case IB_WR_LSO: |
924 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
925 |
+index 417de7ac0d5e2..2a203e08d4c1a 100644 |
926 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
927 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
928 |
+@@ -3821,6 +3821,7 @@ done: |
929 |
+ } |
930 |
+ |
931 |
+ qp_init_attr->cap = qp_attr->cap; |
932 |
++ qp_init_attr->sq_sig_type = hr_qp->sq_signal_bits; |
933 |
+ |
934 |
+ out: |
935 |
+ mutex_unlock(&hr_qp->mutex); |
936 |
+diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c |
937 |
+index 17e4abc067afa..541ee30727aa0 100644 |
938 |
+--- a/drivers/infiniband/sw/rdmavt/vt.c |
939 |
++++ b/drivers/infiniband/sw/rdmavt/vt.c |
940 |
+@@ -95,9 +95,7 @@ struct rvt_dev_info *rvt_alloc_device(size_t size, int nports) |
941 |
+ if (!rdi) |
942 |
+ return rdi; |
943 |
+ |
944 |
+- rdi->ports = kcalloc(nports, |
945 |
+- sizeof(struct rvt_ibport **), |
946 |
+- GFP_KERNEL); |
947 |
++ rdi->ports = kcalloc(nports, sizeof(*rdi->ports), GFP_KERNEL); |
948 |
+ if (!rdi->ports) |
949 |
+ ib_dealloc_device(&rdi->ibdev); |
950 |
+ |
951 |
+diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c |
952 |
+index f77b295e0123e..01788a78041b3 100644 |
953 |
+--- a/drivers/input/keyboard/ep93xx_keypad.c |
954 |
++++ b/drivers/input/keyboard/ep93xx_keypad.c |
955 |
+@@ -257,8 +257,8 @@ static int ep93xx_keypad_probe(struct platform_device *pdev) |
956 |
+ } |
957 |
+ |
958 |
+ keypad->irq = platform_get_irq(pdev, 0); |
959 |
+- if (!keypad->irq) { |
960 |
+- err = -ENXIO; |
961 |
++ if (keypad->irq < 0) { |
962 |
++ err = keypad->irq; |
963 |
+ goto failed_free; |
964 |
+ } |
965 |
+ |
966 |
+diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c |
967 |
+index 840e53732753f..aeeef50cef9bb 100644 |
968 |
+--- a/drivers/input/keyboard/omap4-keypad.c |
969 |
++++ b/drivers/input/keyboard/omap4-keypad.c |
970 |
+@@ -253,10 +253,8 @@ static int omap4_keypad_probe(struct platform_device *pdev) |
971 |
+ } |
972 |
+ |
973 |
+ irq = platform_get_irq(pdev, 0); |
974 |
+- if (!irq) { |
975 |
+- dev_err(&pdev->dev, "no keyboard irq assigned\n"); |
976 |
+- return -EINVAL; |
977 |
+- } |
978 |
++ if (irq < 0) |
979 |
++ return irq; |
980 |
+ |
981 |
+ keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL); |
982 |
+ if (!keypad_data) { |
983 |
+diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c |
984 |
+index f9f98ef1d98e3..8677dbe0fd209 100644 |
985 |
+--- a/drivers/input/keyboard/twl4030_keypad.c |
986 |
++++ b/drivers/input/keyboard/twl4030_keypad.c |
987 |
+@@ -63,7 +63,7 @@ struct twl4030_keypad { |
988 |
+ bool autorepeat; |
989 |
+ unsigned int n_rows; |
990 |
+ unsigned int n_cols; |
991 |
+- unsigned int irq; |
992 |
++ int irq; |
993 |
+ |
994 |
+ struct device *dbg_dev; |
995 |
+ struct input_dev *input; |
996 |
+@@ -389,10 +389,8 @@ static int twl4030_kp_probe(struct platform_device *pdev) |
997 |
+ } |
998 |
+ |
999 |
+ kp->irq = platform_get_irq(pdev, 0); |
1000 |
+- if (!kp->irq) { |
1001 |
+- dev_err(&pdev->dev, "no keyboard irq assigned\n"); |
1002 |
+- return -EINVAL; |
1003 |
+- } |
1004 |
++ if (kp->irq < 0) |
1005 |
++ return kp->irq; |
1006 |
+ |
1007 |
+ error = matrix_keypad_build_keymap(keymap_data, NULL, |
1008 |
+ TWL4030_MAX_ROWS, |
1009 |
+diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c |
1010 |
+index 04b96fe393397..46512b4d686a8 100644 |
1011 |
+--- a/drivers/input/serio/sun4i-ps2.c |
1012 |
++++ b/drivers/input/serio/sun4i-ps2.c |
1013 |
+@@ -210,7 +210,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev) |
1014 |
+ struct sun4i_ps2data *drvdata; |
1015 |
+ struct serio *serio; |
1016 |
+ struct device *dev = &pdev->dev; |
1017 |
+- unsigned int irq; |
1018 |
+ int error; |
1019 |
+ |
1020 |
+ drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL); |
1021 |
+@@ -263,14 +262,12 @@ static int sun4i_ps2_probe(struct platform_device *pdev) |
1022 |
+ writel(0, drvdata->reg_base + PS2_REG_GCTL); |
1023 |
+ |
1024 |
+ /* Get IRQ for the device */ |
1025 |
+- irq = platform_get_irq(pdev, 0); |
1026 |
+- if (!irq) { |
1027 |
+- dev_err(dev, "no IRQ found\n"); |
1028 |
+- error = -ENXIO; |
1029 |
++ drvdata->irq = platform_get_irq(pdev, 0); |
1030 |
++ if (drvdata->irq < 0) { |
1031 |
++ error = drvdata->irq; |
1032 |
+ goto err_disable_clk; |
1033 |
+ } |
1034 |
+ |
1035 |
+- drvdata->irq = irq; |
1036 |
+ drvdata->serio = serio; |
1037 |
+ drvdata->dev = dev; |
1038 |
+ |
1039 |
+diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c |
1040 |
+index c10fc594f94d9..6bfe42a11452a 100644 |
1041 |
+--- a/drivers/input/touchscreen/imx6ul_tsc.c |
1042 |
++++ b/drivers/input/touchscreen/imx6ul_tsc.c |
1043 |
+@@ -538,20 +538,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) |
1044 |
+ |
1045 |
+ mutex_lock(&input_dev->mutex); |
1046 |
+ |
1047 |
+- if (input_dev->users) { |
1048 |
+- retval = clk_prepare_enable(tsc->adc_clk); |
1049 |
+- if (retval) |
1050 |
+- goto out; |
1051 |
+- |
1052 |
+- retval = clk_prepare_enable(tsc->tsc_clk); |
1053 |
+- if (retval) { |
1054 |
+- clk_disable_unprepare(tsc->adc_clk); |
1055 |
+- goto out; |
1056 |
+- } |
1057 |
++ if (!input_dev->users) |
1058 |
++ goto out; |
1059 |
+ |
1060 |
+- retval = imx6ul_tsc_init(tsc); |
1061 |
++ retval = clk_prepare_enable(tsc->adc_clk); |
1062 |
++ if (retval) |
1063 |
++ goto out; |
1064 |
++ |
1065 |
++ retval = clk_prepare_enable(tsc->tsc_clk); |
1066 |
++ if (retval) { |
1067 |
++ clk_disable_unprepare(tsc->adc_clk); |
1068 |
++ goto out; |
1069 |
+ } |
1070 |
+ |
1071 |
++ retval = imx6ul_tsc_init(tsc); |
1072 |
++ if (retval) { |
1073 |
++ clk_disable_unprepare(tsc->tsc_clk); |
1074 |
++ clk_disable_unprepare(tsc->adc_clk); |
1075 |
++ goto out; |
1076 |
++ } |
1077 |
+ out: |
1078 |
+ mutex_unlock(&input_dev->mutex); |
1079 |
+ return retval; |
1080 |
+diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c |
1081 |
+index b6f95f20f9244..cd8805d71d977 100644 |
1082 |
+--- a/drivers/input/touchscreen/stmfts.c |
1083 |
++++ b/drivers/input/touchscreen/stmfts.c |
1084 |
+@@ -479,7 +479,7 @@ static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev, |
1085 |
+ |
1086 |
+ mutex_lock(&sdata->mutex); |
1087 |
+ |
1088 |
+- if (value & sdata->hover_enabled) |
1089 |
++ if (value && sdata->hover_enabled) |
1090 |
+ goto out; |
1091 |
+ |
1092 |
+ if (sdata->running) |
1093 |
+diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c |
1094 |
+index 055c90b8253cb..10a559cfb7ea3 100644 |
1095 |
+--- a/drivers/mailbox/mailbox.c |
1096 |
++++ b/drivers/mailbox/mailbox.c |
1097 |
+@@ -85,9 +85,12 @@ static void msg_submit(struct mbox_chan *chan) |
1098 |
+ exit: |
1099 |
+ spin_unlock_irqrestore(&chan->lock, flags); |
1100 |
+ |
1101 |
+- if (!err && (chan->txdone_method & TXDONE_BY_POLL)) |
1102 |
+- /* kick start the timer immediately to avoid delays */ |
1103 |
+- hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); |
1104 |
++ /* kick start the timer immediately to avoid delays */ |
1105 |
++ if (!err && (chan->txdone_method & TXDONE_BY_POLL)) { |
1106 |
++ /* but only if not already active */ |
1107 |
++ if (!hrtimer_active(&chan->mbox->poll_hrt)) |
1108 |
++ hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); |
1109 |
++ } |
1110 |
+ } |
1111 |
+ |
1112 |
+ static void tx_tick(struct mbox_chan *chan, int r) |
1113 |
+@@ -125,11 +128,10 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer) |
1114 |
+ struct mbox_chan *chan = &mbox->chans[i]; |
1115 |
+ |
1116 |
+ if (chan->active_req && chan->cl) { |
1117 |
++ resched = true; |
1118 |
+ txdone = chan->mbox->ops->last_tx_done(chan); |
1119 |
+ if (txdone) |
1120 |
+ tx_tick(chan, 0); |
1121 |
+- else |
1122 |
+- resched = true; |
1123 |
+ } |
1124 |
+ } |
1125 |
+ |
1126 |
+diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c |
1127 |
+index eaf94b817dbc0..2ac9d24d3f0cd 100644 |
1128 |
+--- a/drivers/media/firewire/firedtv-fw.c |
1129 |
++++ b/drivers/media/firewire/firedtv-fw.c |
1130 |
+@@ -271,8 +271,10 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
1131 |
+ |
1132 |
+ name_len = fw_csr_string(unit->directory, CSR_MODEL, |
1133 |
+ name, sizeof(name)); |
1134 |
+- if (name_len < 0) |
1135 |
+- return name_len; |
1136 |
++ if (name_len < 0) { |
1137 |
++ err = name_len; |
1138 |
++ goto fail_free; |
1139 |
++ } |
1140 |
+ for (i = ARRAY_SIZE(model_names); --i; ) |
1141 |
+ if (strlen(model_names[i]) <= name_len && |
1142 |
+ strncmp(name, model_names[i], name_len) == 0) |
1143 |
+diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c |
1144 |
+index cf05e11da01b0..4c042ba6de918 100644 |
1145 |
+--- a/drivers/media/pci/bt8xx/bttv-driver.c |
1146 |
++++ b/drivers/media/pci/bt8xx/bttv-driver.c |
1147 |
+@@ -4055,11 +4055,13 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
1148 |
+ btv->id = dev->device; |
1149 |
+ if (pci_enable_device(dev)) { |
1150 |
+ pr_warn("%d: Can't enable device\n", btv->c.nr); |
1151 |
+- return -EIO; |
1152 |
++ result = -EIO; |
1153 |
++ goto free_mem; |
1154 |
+ } |
1155 |
+ if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { |
1156 |
+ pr_warn("%d: No suitable DMA available\n", btv->c.nr); |
1157 |
+- return -EIO; |
1158 |
++ result = -EIO; |
1159 |
++ goto free_mem; |
1160 |
+ } |
1161 |
+ if (!request_mem_region(pci_resource_start(dev,0), |
1162 |
+ pci_resource_len(dev,0), |
1163 |
+@@ -4067,7 +4069,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
1164 |
+ pr_warn("%d: can't request iomem (0x%llx)\n", |
1165 |
+ btv->c.nr, |
1166 |
+ (unsigned long long)pci_resource_start(dev, 0)); |
1167 |
+- return -EBUSY; |
1168 |
++ result = -EBUSY; |
1169 |
++ goto free_mem; |
1170 |
+ } |
1171 |
+ pci_set_master(dev); |
1172 |
+ pci_set_command(dev); |
1173 |
+@@ -4253,6 +4256,10 @@ fail0: |
1174 |
+ release_mem_region(pci_resource_start(btv->c.pci,0), |
1175 |
+ pci_resource_len(btv->c.pci,0)); |
1176 |
+ pci_disable_device(btv->c.pci); |
1177 |
++ |
1178 |
++free_mem: |
1179 |
++ bttvs[btv->c.nr] = NULL; |
1180 |
++ kfree(btv); |
1181 |
+ return result; |
1182 |
+ } |
1183 |
+ |
1184 |
+diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c b/drivers/media/pci/saa7134/saa7134-tvaudio.c |
1185 |
+index 68d400e1e240e..8c3da6f7a60f1 100644 |
1186 |
+--- a/drivers/media/pci/saa7134/saa7134-tvaudio.c |
1187 |
++++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c |
1188 |
+@@ -693,7 +693,8 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) |
1189 |
+ { |
1190 |
+ int err; |
1191 |
+ |
1192 |
+- audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", reg << 2, value); |
1193 |
++ audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", |
1194 |
++ (reg << 2) & 0xffffffff, value); |
1195 |
+ err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR); |
1196 |
+ if (err < 0) |
1197 |
+ return err; |
1198 |
+diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c |
1199 |
+index 9a48c0f69320b..1dbebdc1c2f87 100644 |
1200 |
+--- a/drivers/media/platform/exynos4-is/fimc-isp.c |
1201 |
++++ b/drivers/media/platform/exynos4-is/fimc-isp.c |
1202 |
+@@ -311,8 +311,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on) |
1203 |
+ |
1204 |
+ if (on) { |
1205 |
+ ret = pm_runtime_get_sync(&is->pdev->dev); |
1206 |
+- if (ret < 0) |
1207 |
++ if (ret < 0) { |
1208 |
++ pm_runtime_put(&is->pdev->dev); |
1209 |
+ return ret; |
1210 |
++ } |
1211 |
+ set_bit(IS_ST_PWR_ON, &is->state); |
1212 |
+ |
1213 |
+ ret = fimc_is_start_firmware(is); |
1214 |
+diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c |
1215 |
+index 70d5f5586a5d5..10fe7d2e8790c 100644 |
1216 |
+--- a/drivers/media/platform/exynos4-is/fimc-lite.c |
1217 |
++++ b/drivers/media/platform/exynos4-is/fimc-lite.c |
1218 |
+@@ -480,7 +480,7 @@ static int fimc_lite_open(struct file *file) |
1219 |
+ set_bit(ST_FLITE_IN_USE, &fimc->state); |
1220 |
+ ret = pm_runtime_get_sync(&fimc->pdev->dev); |
1221 |
+ if (ret < 0) |
1222 |
+- goto unlock; |
1223 |
++ goto err_pm; |
1224 |
+ |
1225 |
+ ret = v4l2_fh_open(file); |
1226 |
+ if (ret < 0) |
1227 |
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
1228 |
+index f5fca01f3248e..3261dc72cc614 100644 |
1229 |
+--- a/drivers/media/platform/exynos4-is/media-dev.c |
1230 |
++++ b/drivers/media/platform/exynos4-is/media-dev.c |
1231 |
+@@ -481,8 +481,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) |
1232 |
+ return -ENXIO; |
1233 |
+ |
1234 |
+ ret = pm_runtime_get_sync(fmd->pmf); |
1235 |
+- if (ret < 0) |
1236 |
++ if (ret < 0) { |
1237 |
++ pm_runtime_put(fmd->pmf); |
1238 |
+ return ret; |
1239 |
++ } |
1240 |
+ |
1241 |
+ fmd->num_sensors = 0; |
1242 |
+ |
1243 |
+diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c |
1244 |
+index b4e28a299e26e..efab3ebc67564 100644 |
1245 |
+--- a/drivers/media/platform/exynos4-is/mipi-csis.c |
1246 |
++++ b/drivers/media/platform/exynos4-is/mipi-csis.c |
1247 |
+@@ -513,8 +513,10 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable) |
1248 |
+ if (enable) { |
1249 |
+ s5pcsis_clear_counters(state); |
1250 |
+ ret = pm_runtime_get_sync(&state->pdev->dev); |
1251 |
+- if (ret && ret != 1) |
1252 |
++ if (ret && ret != 1) { |
1253 |
++ pm_runtime_put_noidle(&state->pdev->dev); |
1254 |
+ return ret; |
1255 |
++ } |
1256 |
+ } |
1257 |
+ |
1258 |
+ mutex_lock(&state->lock); |
1259 |
+diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c |
1260 |
+index 60069869596cb..168f5af6abcc2 100644 |
1261 |
+--- a/drivers/media/platform/qcom/venus/core.c |
1262 |
++++ b/drivers/media/platform/qcom/venus/core.c |
1263 |
+@@ -321,8 +321,10 @@ static int venus_probe(struct platform_device *pdev) |
1264 |
+ goto err_dev_unregister; |
1265 |
+ |
1266 |
+ ret = pm_runtime_put_sync(dev); |
1267 |
+- if (ret) |
1268 |
++ if (ret) { |
1269 |
++ pm_runtime_get_noresume(dev); |
1270 |
+ goto err_dev_unregister; |
1271 |
++ } |
1272 |
+ |
1273 |
+ return 0; |
1274 |
+ |
1275 |
+@@ -333,6 +335,7 @@ err_core_deinit: |
1276 |
+ err_venus_shutdown: |
1277 |
+ venus_shutdown(dev); |
1278 |
+ err_runtime_disable: |
1279 |
++ pm_runtime_put_noidle(dev); |
1280 |
+ pm_runtime_set_suspended(dev); |
1281 |
+ pm_runtime_disable(dev); |
1282 |
+ hfi_destroy(core); |
1283 |
+diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c |
1284 |
+index 79bc0ef6bb413..8d8ed72bd0aaf 100644 |
1285 |
+--- a/drivers/media/platform/s3c-camif/camif-core.c |
1286 |
++++ b/drivers/media/platform/s3c-camif/camif-core.c |
1287 |
+@@ -476,7 +476,7 @@ static int s3c_camif_probe(struct platform_device *pdev) |
1288 |
+ |
1289 |
+ ret = camif_media_dev_init(camif); |
1290 |
+ if (ret < 0) |
1291 |
+- goto err_alloc; |
1292 |
++ goto err_pm; |
1293 |
+ |
1294 |
+ ret = camif_register_sensor(camif); |
1295 |
+ if (ret < 0) |
1296 |
+@@ -510,10 +510,9 @@ err_sens: |
1297 |
+ media_device_unregister(&camif->media_dev); |
1298 |
+ media_device_cleanup(&camif->media_dev); |
1299 |
+ camif_unregister_media_entities(camif); |
1300 |
+-err_alloc: |
1301 |
++err_pm: |
1302 |
+ pm_runtime_put(dev); |
1303 |
+ pm_runtime_disable(dev); |
1304 |
+-err_pm: |
1305 |
+ camif_clk_put(camif); |
1306 |
+ err_clk: |
1307 |
+ s3c_camif_unregister_subdev(camif); |
1308 |
+diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
1309 |
+index 40c4eef71c34c..00f6e3f06dac5 100644 |
1310 |
+--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
1311 |
++++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
1312 |
+@@ -1371,7 +1371,7 @@ static int bdisp_probe(struct platform_device *pdev) |
1313 |
+ ret = pm_runtime_get_sync(dev); |
1314 |
+ if (ret < 0) { |
1315 |
+ dev_err(dev, "failed to set PM\n"); |
1316 |
+- goto err_dbg; |
1317 |
++ goto err_pm; |
1318 |
+ } |
1319 |
+ |
1320 |
+ /* Filters */ |
1321 |
+@@ -1399,7 +1399,6 @@ err_filter: |
1322 |
+ bdisp_hw_free_filters(bdisp->dev); |
1323 |
+ err_pm: |
1324 |
+ pm_runtime_put(dev); |
1325 |
+-err_dbg: |
1326 |
+ bdisp_debugfs_remove(bdisp); |
1327 |
+ err_v4l2: |
1328 |
+ v4l2_device_unregister(&bdisp->v4l2_dev); |
1329 |
+diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c |
1330 |
+index 0b42acd4e3a6e..53dc6da2b09e2 100644 |
1331 |
+--- a/drivers/media/platform/sti/delta/delta-v4l2.c |
1332 |
++++ b/drivers/media/platform/sti/delta/delta-v4l2.c |
1333 |
+@@ -954,8 +954,10 @@ static void delta_run_work(struct work_struct *work) |
1334 |
+ /* enable the hardware */ |
1335 |
+ if (!dec->pm) { |
1336 |
+ ret = delta_get_sync(ctx); |
1337 |
+- if (ret) |
1338 |
++ if (ret) { |
1339 |
++ delta_put_autosuspend(ctx); |
1340 |
+ goto err; |
1341 |
++ } |
1342 |
+ } |
1343 |
+ |
1344 |
+ /* decode this access unit */ |
1345 |
+diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c |
1346 |
+index 7917fd2c4bd4b..d826c011c0952 100644 |
1347 |
+--- a/drivers/media/platform/sti/hva/hva-hw.c |
1348 |
++++ b/drivers/media/platform/sti/hva/hva-hw.c |
1349 |
+@@ -272,6 +272,7 @@ static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva) |
1350 |
+ |
1351 |
+ if (pm_runtime_get_sync(dev) < 0) { |
1352 |
+ dev_err(dev, "%s failed to get pm_runtime\n", HVA_PREFIX); |
1353 |
++ pm_runtime_put_noidle(dev); |
1354 |
+ mutex_unlock(&hva->protect_mutex); |
1355 |
+ return -EFAULT; |
1356 |
+ } |
1357 |
+@@ -392,7 +393,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) |
1358 |
+ ret = pm_runtime_get_sync(dev); |
1359 |
+ if (ret < 0) { |
1360 |
+ dev_err(dev, "%s failed to set PM\n", HVA_PREFIX); |
1361 |
+- goto err_clk; |
1362 |
++ goto err_pm; |
1363 |
+ } |
1364 |
+ |
1365 |
+ /* check IP hardware version */ |
1366 |
+@@ -557,6 +558,7 @@ void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s) |
1367 |
+ |
1368 |
+ if (pm_runtime_get_sync(dev) < 0) { |
1369 |
+ seq_puts(s, "Cannot wake up IP\n"); |
1370 |
++ pm_runtime_put_noidle(dev); |
1371 |
+ mutex_unlock(&hva->protect_mutex); |
1372 |
+ return; |
1373 |
+ } |
1374 |
+diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c |
1375 |
+index b6619c9c18bb4..4e6530ee809af 100644 |
1376 |
+--- a/drivers/media/platform/vsp1/vsp1_drv.c |
1377 |
++++ b/drivers/media/platform/vsp1/vsp1_drv.c |
1378 |
+@@ -562,7 +562,12 @@ int vsp1_device_get(struct vsp1_device *vsp1) |
1379 |
+ int ret; |
1380 |
+ |
1381 |
+ ret = pm_runtime_get_sync(vsp1->dev); |
1382 |
+- return ret < 0 ? ret : 0; |
1383 |
++ if (ret < 0) { |
1384 |
++ pm_runtime_put_noidle(vsp1->dev); |
1385 |
++ return ret; |
1386 |
++ } |
1387 |
++ |
1388 |
++ return 0; |
1389 |
+ } |
1390 |
+ |
1391 |
+ /* |
1392 |
+@@ -845,12 +850,12 @@ static int vsp1_probe(struct platform_device *pdev) |
1393 |
+ /* Configure device parameters based on the version register. */ |
1394 |
+ pm_runtime_enable(&pdev->dev); |
1395 |
+ |
1396 |
+- ret = pm_runtime_get_sync(&pdev->dev); |
1397 |
++ ret = vsp1_device_get(vsp1); |
1398 |
+ if (ret < 0) |
1399 |
+ goto done; |
1400 |
+ |
1401 |
+ vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); |
1402 |
+- pm_runtime_put_sync(&pdev->dev); |
1403 |
++ vsp1_device_put(vsp1); |
1404 |
+ |
1405 |
+ for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { |
1406 |
+ if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == |
1407 |
+diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c |
1408 |
+index 8e82610ffaad5..01c82da8e9aa2 100644 |
1409 |
+--- a/drivers/media/rc/ati_remote.c |
1410 |
++++ b/drivers/media/rc/ati_remote.c |
1411 |
+@@ -845,6 +845,10 @@ static int ati_remote_probe(struct usb_interface *interface, |
1412 |
+ err("%s: endpoint_in message size==0? \n", __func__); |
1413 |
+ return -ENODEV; |
1414 |
+ } |
1415 |
++ if (!usb_endpoint_is_int_out(endpoint_out)) { |
1416 |
++ err("%s: Unexpected endpoint_out\n", __func__); |
1417 |
++ return -ENODEV; |
1418 |
++ } |
1419 |
+ |
1420 |
+ ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); |
1421 |
+ rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); |
1422 |
+diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c |
1423 |
+index 18a7384b50ee9..0921c95a1dca5 100644 |
1424 |
+--- a/drivers/media/usb/uvc/uvc_v4l2.c |
1425 |
++++ b/drivers/media/usb/uvc/uvc_v4l2.c |
1426 |
+@@ -252,11 +252,41 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, |
1427 |
+ if (ret < 0) |
1428 |
+ goto done; |
1429 |
+ |
1430 |
++ /* After the probe, update fmt with the values returned from |
1431 |
++ * negotiation with the device. |
1432 |
++ */ |
1433 |
++ for (i = 0; i < stream->nformats; ++i) { |
1434 |
++ if (probe->bFormatIndex == stream->format[i].index) { |
1435 |
++ format = &stream->format[i]; |
1436 |
++ break; |
1437 |
++ } |
1438 |
++ } |
1439 |
++ |
1440 |
++ if (i == stream->nformats) { |
1441 |
++ uvc_trace(UVC_TRACE_FORMAT, "Unknown bFormatIndex %u\n", |
1442 |
++ probe->bFormatIndex); |
1443 |
++ return -EINVAL; |
1444 |
++ } |
1445 |
++ |
1446 |
++ for (i = 0; i < format->nframes; ++i) { |
1447 |
++ if (probe->bFrameIndex == format->frame[i].bFrameIndex) { |
1448 |
++ frame = &format->frame[i]; |
1449 |
++ break; |
1450 |
++ } |
1451 |
++ } |
1452 |
++ |
1453 |
++ if (i == format->nframes) { |
1454 |
++ uvc_trace(UVC_TRACE_FORMAT, "Unknown bFrameIndex %u\n", |
1455 |
++ probe->bFrameIndex); |
1456 |
++ return -EINVAL; |
1457 |
++ } |
1458 |
++ |
1459 |
+ fmt->fmt.pix.width = frame->wWidth; |
1460 |
+ fmt->fmt.pix.height = frame->wHeight; |
1461 |
+ fmt->fmt.pix.field = V4L2_FIELD_NONE; |
1462 |
+ fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame); |
1463 |
+ fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize; |
1464 |
++ fmt->fmt.pix.pixelformat = format->fcc; |
1465 |
+ fmt->fmt.pix.colorspace = format->colorspace; |
1466 |
+ fmt->fmt.pix.priv = 0; |
1467 |
+ |
1468 |
+diff --git a/drivers/memory/fsl-corenet-cf.c b/drivers/memory/fsl-corenet-cf.c |
1469 |
+index 662d050243bec..2fbf8d09af36b 100644 |
1470 |
+--- a/drivers/memory/fsl-corenet-cf.c |
1471 |
++++ b/drivers/memory/fsl-corenet-cf.c |
1472 |
+@@ -215,10 +215,8 @@ static int ccf_probe(struct platform_device *pdev) |
1473 |
+ dev_set_drvdata(&pdev->dev, ccf); |
1474 |
+ |
1475 |
+ irq = platform_get_irq(pdev, 0); |
1476 |
+- if (!irq) { |
1477 |
+- dev_err(&pdev->dev, "%s: no irq\n", __func__); |
1478 |
+- return -ENXIO; |
1479 |
+- } |
1480 |
++ if (irq < 0) |
1481 |
++ return irq; |
1482 |
+ |
1483 |
+ ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf); |
1484 |
+ if (ret) { |
1485 |
+diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c |
1486 |
+index 1c6a7c16e0c17..2ca507f3a58c3 100644 |
1487 |
+--- a/drivers/memory/omap-gpmc.c |
1488 |
++++ b/drivers/memory/omap-gpmc.c |
1489 |
+@@ -951,7 +951,7 @@ static int gpmc_cs_remap(int cs, u32 base) |
1490 |
+ int ret; |
1491 |
+ u32 old_base, size; |
1492 |
+ |
1493 |
+- if (cs > gpmc_cs_num) { |
1494 |
++ if (cs >= gpmc_cs_num) { |
1495 |
+ pr_err("%s: requested chip-select is disabled\n", __func__); |
1496 |
+ return -ENODEV; |
1497 |
+ } |
1498 |
+@@ -986,7 +986,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) |
1499 |
+ struct resource *res = &gpmc->mem; |
1500 |
+ int r = -1; |
1501 |
+ |
1502 |
+- if (cs > gpmc_cs_num) { |
1503 |
++ if (cs >= gpmc_cs_num) { |
1504 |
+ pr_err("%s: requested chip-select is disabled\n", __func__); |
1505 |
+ return -ENODEV; |
1506 |
+ } |
1507 |
+@@ -2278,6 +2278,10 @@ static void gpmc_probe_dt_children(struct platform_device *pdev) |
1508 |
+ } |
1509 |
+ } |
1510 |
+ #else |
1511 |
++void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) |
1512 |
++{ |
1513 |
++ memset(p, 0, sizeof(*p)); |
1514 |
++} |
1515 |
+ static int gpmc_probe_dt(struct platform_device *pdev) |
1516 |
+ { |
1517 |
+ return 0; |
1518 |
+diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c |
1519 |
+index 5c5d0241603a3..3eb3c237f3398 100644 |
1520 |
+--- a/drivers/misc/cardreader/rtsx_pcr.c |
1521 |
++++ b/drivers/misc/cardreader/rtsx_pcr.c |
1522 |
+@@ -1524,12 +1524,14 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, |
1523 |
+ ret = mfd_add_devices(&pcidev->dev, pcr->id, rtsx_pcr_cells, |
1524 |
+ ARRAY_SIZE(rtsx_pcr_cells), NULL, 0, NULL); |
1525 |
+ if (ret < 0) |
1526 |
+- goto disable_irq; |
1527 |
++ goto free_slots; |
1528 |
+ |
1529 |
+ schedule_delayed_work(&pcr->idle_work, msecs_to_jiffies(200)); |
1530 |
+ |
1531 |
+ return 0; |
1532 |
+ |
1533 |
++free_slots: |
1534 |
++ kfree(pcr->slots); |
1535 |
+ disable_irq: |
1536 |
+ free_irq(pcr->irq, (void *)pcr); |
1537 |
+ disable_msi: |
1538 |
+diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c |
1539 |
+index 840afb398f9e4..8dd5c610c438d 100644 |
1540 |
+--- a/drivers/misc/eeprom/at25.c |
1541 |
++++ b/drivers/misc/eeprom/at25.c |
1542 |
+@@ -362,7 +362,7 @@ static int at25_probe(struct spi_device *spi) |
1543 |
+ at25->nvmem_config.reg_read = at25_ee_read; |
1544 |
+ at25->nvmem_config.reg_write = at25_ee_write; |
1545 |
+ at25->nvmem_config.priv = at25; |
1546 |
+- at25->nvmem_config.stride = 4; |
1547 |
++ at25->nvmem_config.stride = 1; |
1548 |
+ at25->nvmem_config.word_size = 1; |
1549 |
+ at25->nvmem_config.size = chip.byte_len; |
1550 |
+ |
1551 |
+diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c |
1552 |
+index de7f035a176df..f4332a97c6917 100644 |
1553 |
+--- a/drivers/misc/mic/vop/vop_main.c |
1554 |
++++ b/drivers/misc/mic/vop/vop_main.c |
1555 |
+@@ -301,7 +301,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, |
1556 |
+ /* First assign the vring's allocated in host memory */ |
1557 |
+ vqconfig = _vop_vq_config(vdev->desc) + index; |
1558 |
+ memcpy_fromio(&config, vqconfig, sizeof(config)); |
1559 |
+- _vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN); |
1560 |
++ _vr_size = round_up(vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN), 4); |
1561 |
+ vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info)); |
1562 |
+ va = vpdev->hw_ops->ioremap(vpdev, le64_to_cpu(config.address), |
1563 |
+ vr_size); |
1564 |
+diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c |
1565 |
+index cbc8ebcff5cfe..a252c2199b937 100644 |
1566 |
+--- a/drivers/misc/mic/vop/vop_vringh.c |
1567 |
++++ b/drivers/misc/mic/vop/vop_vringh.c |
1568 |
+@@ -308,7 +308,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, |
1569 |
+ |
1570 |
+ num = le16_to_cpu(vqconfig[i].num); |
1571 |
+ mutex_init(&vvr->vr_mutex); |
1572 |
+- vr_size = PAGE_ALIGN(vring_size(num, MIC_VIRTIO_RING_ALIGN) + |
1573 |
++ vr_size = PAGE_ALIGN(round_up(vring_size(num, MIC_VIRTIO_RING_ALIGN), 4) + |
1574 |
+ sizeof(struct _mic_vring_info)); |
1575 |
+ vr->va = (void *) |
1576 |
+ __get_free_pages(GFP_KERNEL | __GFP_ZERO, |
1577 |
+@@ -320,7 +320,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, |
1578 |
+ goto err; |
1579 |
+ } |
1580 |
+ vr->len = vr_size; |
1581 |
+- vr->info = vr->va + vring_size(num, MIC_VIRTIO_RING_ALIGN); |
1582 |
++ vr->info = vr->va + round_up(vring_size(num, MIC_VIRTIO_RING_ALIGN), 4); |
1583 |
+ vr->info->magic = cpu_to_le32(MIC_MAGIC + vdev->virtio_id + i); |
1584 |
+ vr_addr = dma_map_single(&vpdev->dev, vr->va, vr_size, |
1585 |
+ DMA_BIDIRECTIONAL); |
1586 |
+@@ -611,6 +611,7 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf, |
1587 |
+ size_t partlen; |
1588 |
+ bool dma = VOP_USE_DMA; |
1589 |
+ int err = 0; |
1590 |
++ size_t offset = 0; |
1591 |
+ |
1592 |
+ if (daddr & (dma_alignment - 1)) { |
1593 |
+ vdev->tx_dst_unaligned += len; |
1594 |
+@@ -659,13 +660,20 @@ memcpy: |
1595 |
+ * We are copying to IO below and should ideally use something |
1596 |
+ * like copy_from_user_toio(..) if it existed. |
1597 |
+ */ |
1598 |
+- if (copy_from_user((void __force *)dbuf, ubuf, len)) { |
1599 |
+- err = -EFAULT; |
1600 |
+- dev_err(vop_dev(vdev), "%s %d err %d\n", |
1601 |
+- __func__, __LINE__, err); |
1602 |
+- goto err; |
1603 |
++ while (len) { |
1604 |
++ partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE); |
1605 |
++ |
1606 |
++ if (copy_from_user(vvr->buf, ubuf + offset, partlen)) { |
1607 |
++ err = -EFAULT; |
1608 |
++ dev_err(vop_dev(vdev), "%s %d err %d\n", |
1609 |
++ __func__, __LINE__, err); |
1610 |
++ goto err; |
1611 |
++ } |
1612 |
++ memcpy_toio(dbuf + offset, vvr->buf, partlen); |
1613 |
++ offset += partlen; |
1614 |
++ vdev->out_bytes += partlen; |
1615 |
++ len -= partlen; |
1616 |
+ } |
1617 |
+- vdev->out_bytes += len; |
1618 |
+ err = 0; |
1619 |
+ err: |
1620 |
+ vpdev->hw_ops->iounmap(vpdev, dbuf); |
1621 |
+diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c |
1622 |
+index f8c372839d244..2ca5cd79018b4 100644 |
1623 |
+--- a/drivers/mmc/core/sdio_cis.c |
1624 |
++++ b/drivers/mmc/core/sdio_cis.c |
1625 |
+@@ -30,6 +30,9 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, |
1626 |
+ unsigned i, nr_strings; |
1627 |
+ char **buffer, *string; |
1628 |
+ |
1629 |
++ if (size < 2) |
1630 |
++ return 0; |
1631 |
++ |
1632 |
+ /* Find all null-terminated (including zero length) strings in |
1633 |
+ the TPLLV1_INFO field. Trailing garbage is ignored. */ |
1634 |
+ buf += 2; |
1635 |
+diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c |
1636 |
+index bfe13c6627bed..0be8db6ab3195 100644 |
1637 |
+--- a/drivers/net/can/flexcan.c |
1638 |
++++ b/drivers/net/can/flexcan.c |
1639 |
+@@ -1091,18 +1091,23 @@ static int flexcan_chip_start(struct net_device *dev) |
1640 |
+ return err; |
1641 |
+ } |
1642 |
+ |
1643 |
+-/* flexcan_chip_stop |
1644 |
++/* __flexcan_chip_stop |
1645 |
+ * |
1646 |
+- * this functions is entered with clocks enabled |
1647 |
++ * this function is entered with clocks enabled |
1648 |
+ */ |
1649 |
+-static void flexcan_chip_stop(struct net_device *dev) |
1650 |
++static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) |
1651 |
+ { |
1652 |
+ struct flexcan_priv *priv = netdev_priv(dev); |
1653 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
1654 |
++ int err; |
1655 |
+ |
1656 |
+ /* freeze + disable module */ |
1657 |
+- flexcan_chip_freeze(priv); |
1658 |
+- flexcan_chip_disable(priv); |
1659 |
++ err = flexcan_chip_freeze(priv); |
1660 |
++ if (err && !disable_on_error) |
1661 |
++ return err; |
1662 |
++ err = flexcan_chip_disable(priv); |
1663 |
++ if (err && !disable_on_error) |
1664 |
++ goto out_chip_unfreeze; |
1665 |
+ |
1666 |
+ /* Disable all interrupts */ |
1667 |
+ priv->write(0, ®s->imask2); |
1668 |
+@@ -1112,6 +1117,23 @@ static void flexcan_chip_stop(struct net_device *dev) |
1669 |
+ |
1670 |
+ flexcan_transceiver_disable(priv); |
1671 |
+ priv->can.state = CAN_STATE_STOPPED; |
1672 |
++ |
1673 |
++ return 0; |
1674 |
++ |
1675 |
++ out_chip_unfreeze: |
1676 |
++ flexcan_chip_unfreeze(priv); |
1677 |
++ |
1678 |
++ return err; |
1679 |
++} |
1680 |
++ |
1681 |
++static inline int flexcan_chip_stop_disable_on_error(struct net_device *dev) |
1682 |
++{ |
1683 |
++ return __flexcan_chip_stop(dev, true); |
1684 |
++} |
1685 |
++ |
1686 |
++static inline int flexcan_chip_stop(struct net_device *dev) |
1687 |
++{ |
1688 |
++ return __flexcan_chip_stop(dev, false); |
1689 |
+ } |
1690 |
+ |
1691 |
+ static int flexcan_open(struct net_device *dev) |
1692 |
+@@ -1165,7 +1187,7 @@ static int flexcan_close(struct net_device *dev) |
1693 |
+ |
1694 |
+ netif_stop_queue(dev); |
1695 |
+ can_rx_offload_disable(&priv->offload); |
1696 |
+- flexcan_chip_stop(dev); |
1697 |
++ flexcan_chip_stop_disable_on_error(dev); |
1698 |
+ |
1699 |
+ free_irq(dev->irq, dev); |
1700 |
+ clk_disable_unprepare(priv->clk_per); |
1701 |
+diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c |
1702 |
+index 5bdff77c0ad10..993f495e2bf7b 100644 |
1703 |
+--- a/drivers/net/ethernet/korina.c |
1704 |
++++ b/drivers/net/ethernet/korina.c |
1705 |
+@@ -1113,7 +1113,7 @@ out: |
1706 |
+ return rc; |
1707 |
+ |
1708 |
+ probe_err_register: |
1709 |
+- kfree(KSEG0ADDR(lp->td_ring)); |
1710 |
++ kfree((struct dma_desc *)KSEG0ADDR(lp->td_ring)); |
1711 |
+ probe_err_td_ring: |
1712 |
+ iounmap(lp->tx_dma_regs); |
1713 |
+ probe_err_dma_tx: |
1714 |
+@@ -1133,7 +1133,7 @@ static int korina_remove(struct platform_device *pdev) |
1715 |
+ iounmap(lp->eth_regs); |
1716 |
+ iounmap(lp->rx_dma_regs); |
1717 |
+ iounmap(lp->tx_dma_regs); |
1718 |
+- kfree(KSEG0ADDR(lp->td_ring)); |
1719 |
++ kfree((struct dma_desc *)KSEG0ADDR(lp->td_ring)); |
1720 |
+ |
1721 |
+ unregister_netdev(bif->dev); |
1722 |
+ free_netdev(bif->dev); |
1723 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c |
1724 |
+index 03d4cc6f35bcd..7d15f6208b463 100644 |
1725 |
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c |
1726 |
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c |
1727 |
+@@ -153,6 +153,14 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) |
1728 |
+ BUILD_BUG_ON(HTT_RX_RING_FILL_LEVEL >= HTT_RX_RING_SIZE / 2); |
1729 |
+ |
1730 |
+ idx = __le32_to_cpu(*htt->rx_ring.alloc_idx.vaddr); |
1731 |
++ |
1732 |
++ if (idx < 0 || idx >= htt->rx_ring.size) { |
1733 |
++ ath10k_err(htt->ar, "rx ring index is not valid, firmware malfunctioning?\n"); |
1734 |
++ idx &= htt->rx_ring.size_mask; |
1735 |
++ ret = -ENOMEM; |
1736 |
++ goto fail; |
1737 |
++ } |
1738 |
++ |
1739 |
+ while (num > 0) { |
1740 |
+ skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN); |
1741 |
+ if (!skb) { |
1742 |
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
1743 |
+index 3f563e02d17da..2ed98aaed6fb5 100644 |
1744 |
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
1745 |
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
1746 |
+@@ -449,10 +449,19 @@ static void hif_usb_stop(void *hif_handle) |
1747 |
+ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1748 |
+ |
1749 |
+ /* The pending URBs have to be canceled. */ |
1750 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1751 |
+ list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
1752 |
+ &hif_dev->tx.tx_pending, list) { |
1753 |
++ usb_get_urb(tx_buf->urb); |
1754 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1755 |
+ usb_kill_urb(tx_buf->urb); |
1756 |
++ list_del(&tx_buf->list); |
1757 |
++ usb_free_urb(tx_buf->urb); |
1758 |
++ kfree(tx_buf->buf); |
1759 |
++ kfree(tx_buf); |
1760 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1761 |
+ } |
1762 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1763 |
+ |
1764 |
+ usb_kill_anchored_urbs(&hif_dev->mgmt_submitted); |
1765 |
+ } |
1766 |
+@@ -762,27 +771,37 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) |
1767 |
+ struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; |
1768 |
+ unsigned long flags; |
1769 |
+ |
1770 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1771 |
+ list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
1772 |
+ &hif_dev->tx.tx_buf, list) { |
1773 |
++ usb_get_urb(tx_buf->urb); |
1774 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1775 |
+ usb_kill_urb(tx_buf->urb); |
1776 |
+ list_del(&tx_buf->list); |
1777 |
+ usb_free_urb(tx_buf->urb); |
1778 |
+ kfree(tx_buf->buf); |
1779 |
+ kfree(tx_buf); |
1780 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1781 |
+ } |
1782 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1783 |
+ |
1784 |
+ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1785 |
+ hif_dev->tx.flags |= HIF_USB_TX_FLUSH; |
1786 |
+ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1787 |
+ |
1788 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1789 |
+ list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
1790 |
+ &hif_dev->tx.tx_pending, list) { |
1791 |
++ usb_get_urb(tx_buf->urb); |
1792 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1793 |
+ usb_kill_urb(tx_buf->urb); |
1794 |
+ list_del(&tx_buf->list); |
1795 |
+ usb_free_urb(tx_buf->urb); |
1796 |
+ kfree(tx_buf->buf); |
1797 |
+ kfree(tx_buf); |
1798 |
++ spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
1799 |
+ } |
1800 |
++ spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
1801 |
+ |
1802 |
+ usb_kill_anchored_urbs(&hif_dev->mgmt_submitted); |
1803 |
+ } |
1804 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
1805 |
+index ee922b0525610..768a99c15c08b 100644 |
1806 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
1807 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
1808 |
+@@ -1563,6 +1563,8 @@ fail: |
1809 |
+ BRCMF_TX_IOCTL_MAX_MSG_SIZE, |
1810 |
+ msgbuf->ioctbuf, |
1811 |
+ msgbuf->ioctbuf_handle); |
1812 |
++ if (msgbuf->txflow_wq) |
1813 |
++ destroy_workqueue(msgbuf->txflow_wq); |
1814 |
+ kfree(msgbuf); |
1815 |
+ } |
1816 |
+ return -ENOMEM; |
1817 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c |
1818 |
+index 9fb0d9fbd9395..d532decc15383 100644 |
1819 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c |
1820 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c |
1821 |
+@@ -5085,8 +5085,10 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) |
1822 |
+ pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft; |
1823 |
+ pi->pi_fptr.detach = wlc_phy_detach_lcnphy; |
1824 |
+ |
1825 |
+- if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) |
1826 |
++ if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) { |
1827 |
++ kfree(pi->u.pi_lcnphy); |
1828 |
+ return false; |
1829 |
++ } |
1830 |
+ |
1831 |
+ if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { |
1832 |
+ if (pi_lcn->lcnphy_tempsense_option == 3) { |
1833 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c |
1834 |
+index d445acc4786b7..2a8d40ce463d5 100644 |
1835 |
+--- a/drivers/net/wireless/marvell/mwifiex/usb.c |
1836 |
++++ b/drivers/net/wireless/marvell/mwifiex/usb.c |
1837 |
+@@ -1355,7 +1355,8 @@ static void mwifiex_usb_cleanup_tx_aggr(struct mwifiex_adapter *adapter) |
1838 |
+ skb_dequeue(&port->tx_aggr.aggr_list))) |
1839 |
+ mwifiex_write_data_complete(adapter, skb_tmp, |
1840 |
+ 0, -1); |
1841 |
+- del_timer_sync(&port->tx_aggr.timer_cnxt.hold_timer); |
1842 |
++ if (port->tx_aggr.timer_cnxt.hold_timer.function) |
1843 |
++ del_timer_sync(&port->tx_aggr.timer_cnxt.hold_timer); |
1844 |
+ port->tx_aggr.timer_cnxt.is_hold_timer_set = false; |
1845 |
+ port->tx_aggr.timer_cnxt.hold_tmo_msecs = 0; |
1846 |
+ } |
1847 |
+diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1848 |
+index 070ea0f456abd..b80cff96dea1e 100644 |
1849 |
+--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1850 |
++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1851 |
+@@ -5453,7 +5453,6 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) |
1852 |
+ ret = usb_submit_urb(urb, GFP_KERNEL); |
1853 |
+ if (ret) { |
1854 |
+ usb_unanchor_urb(urb); |
1855 |
+- usb_free_urb(urb); |
1856 |
+ goto error; |
1857 |
+ } |
1858 |
+ |
1859 |
+@@ -5462,6 +5461,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) |
1860 |
+ rtl8xxxu_write32(priv, REG_USB_HIMR, val32); |
1861 |
+ |
1862 |
+ error: |
1863 |
++ usb_free_urb(urb); |
1864 |
+ return ret; |
1865 |
+ } |
1866 |
+ |
1867 |
+@@ -5787,6 +5787,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) |
1868 |
+ struct rtl8xxxu_priv *priv = hw->priv; |
1869 |
+ struct rtl8xxxu_rx_urb *rx_urb; |
1870 |
+ struct rtl8xxxu_tx_urb *tx_urb; |
1871 |
++ struct sk_buff *skb; |
1872 |
+ unsigned long flags; |
1873 |
+ int ret, i; |
1874 |
+ |
1875 |
+@@ -5837,6 +5838,13 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) |
1876 |
+ rx_urb->hw = hw; |
1877 |
+ |
1878 |
+ ret = rtl8xxxu_submit_rx_urb(priv, rx_urb); |
1879 |
++ if (ret) { |
1880 |
++ if (ret != -ENOMEM) { |
1881 |
++ skb = (struct sk_buff *)rx_urb->urb.context; |
1882 |
++ dev_kfree_skb(skb); |
1883 |
++ } |
1884 |
++ rtl8xxxu_queue_rx_urb(priv, rx_urb); |
1885 |
++ } |
1886 |
+ } |
1887 |
+ exit: |
1888 |
+ /* |
1889 |
+diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c |
1890 |
+index efb214fc545a2..0b1fbb5dba9b6 100644 |
1891 |
+--- a/drivers/ntb/hw/amd/ntb_hw_amd.c |
1892 |
++++ b/drivers/ntb/hw/amd/ntb_hw_amd.c |
1893 |
+@@ -1036,6 +1036,7 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev, |
1894 |
+ |
1895 |
+ err_dma_mask: |
1896 |
+ pci_clear_master(pdev); |
1897 |
++ pci_release_regions(pdev); |
1898 |
+ err_pci_regions: |
1899 |
+ pci_disable_device(pdev); |
1900 |
+ err_pci_enable: |
1901 |
+diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c |
1902 |
+index f28df233dfcd0..2b492ad55f0e4 100644 |
1903 |
+--- a/drivers/nvme/target/core.c |
1904 |
++++ b/drivers/nvme/target/core.c |
1905 |
+@@ -787,7 +787,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) |
1906 |
+ * in case a host died before it enabled the controller. Hence, simply |
1907 |
+ * reset the keep alive timer when the controller is enabled. |
1908 |
+ */ |
1909 |
+- mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); |
1910 |
++ if (ctrl->kato) |
1911 |
++ mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); |
1912 |
+ } |
1913 |
+ |
1914 |
+ static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl) |
1915 |
+diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c |
1916 |
+index 9deb56989d726..ea612382599cf 100644 |
1917 |
+--- a/drivers/pci/controller/pcie-iproc-msi.c |
1918 |
++++ b/drivers/pci/controller/pcie-iproc-msi.c |
1919 |
+@@ -209,15 +209,20 @@ static int iproc_msi_irq_set_affinity(struct irq_data *data, |
1920 |
+ struct iproc_msi *msi = irq_data_get_irq_chip_data(data); |
1921 |
+ int target_cpu = cpumask_first(mask); |
1922 |
+ int curr_cpu; |
1923 |
++ int ret; |
1924 |
+ |
1925 |
+ curr_cpu = hwirq_to_cpu(msi, data->hwirq); |
1926 |
+ if (curr_cpu == target_cpu) |
1927 |
+- return IRQ_SET_MASK_OK_DONE; |
1928 |
++ ret = IRQ_SET_MASK_OK_DONE; |
1929 |
++ else { |
1930 |
++ /* steer MSI to the target CPU */ |
1931 |
++ data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu; |
1932 |
++ ret = IRQ_SET_MASK_OK; |
1933 |
++ } |
1934 |
+ |
1935 |
+- /* steer MSI to the target CPU */ |
1936 |
+- data->hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq) + target_cpu; |
1937 |
++ irq_data_update_effective_affinity(data, cpumask_of(target_cpu)); |
1938 |
+ |
1939 |
+- return IRQ_SET_MASK_OK; |
1940 |
++ return ret; |
1941 |
+ } |
1942 |
+ |
1943 |
+ static void iproc_msi_irq_compose_msi_msg(struct irq_data *data, |
1944 |
+diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c |
1945 |
+index da72b2866e88e..3b0a097ce2abd 100644 |
1946 |
+--- a/drivers/pwm/pwm-img.c |
1947 |
++++ b/drivers/pwm/pwm-img.c |
1948 |
+@@ -280,6 +280,8 @@ static int img_pwm_probe(struct platform_device *pdev) |
1949 |
+ return PTR_ERR(pwm->pwm_clk); |
1950 |
+ } |
1951 |
+ |
1952 |
++ platform_set_drvdata(pdev, pwm); |
1953 |
++ |
1954 |
+ pm_runtime_set_autosuspend_delay(&pdev->dev, IMG_PWM_PM_TIMEOUT); |
1955 |
+ pm_runtime_use_autosuspend(&pdev->dev); |
1956 |
+ pm_runtime_enable(&pdev->dev); |
1957 |
+@@ -316,7 +318,6 @@ static int img_pwm_probe(struct platform_device *pdev) |
1958 |
+ goto err_suspend; |
1959 |
+ } |
1960 |
+ |
1961 |
+- platform_set_drvdata(pdev, pwm); |
1962 |
+ return 0; |
1963 |
+ |
1964 |
+ err_suspend: |
1965 |
+diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c |
1966 |
+index f36a8a5261a13..a136a7ae77140 100644 |
1967 |
+--- a/drivers/rapidio/devices/rio_mport_cdev.c |
1968 |
++++ b/drivers/rapidio/devices/rio_mport_cdev.c |
1969 |
+@@ -875,15 +875,16 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, |
1970 |
+ rmcd_error("get_user_pages_unlocked err=%ld", |
1971 |
+ pinned); |
1972 |
+ nr_pages = 0; |
1973 |
+- } else |
1974 |
++ } else { |
1975 |
+ rmcd_error("pinned %ld out of %ld pages", |
1976 |
+ pinned, nr_pages); |
1977 |
++ /* |
1978 |
++ * Set nr_pages up to mean "how many pages to unpin, in |
1979 |
++ * the error handler: |
1980 |
++ */ |
1981 |
++ nr_pages = pinned; |
1982 |
++ } |
1983 |
+ ret = -EFAULT; |
1984 |
+- /* |
1985 |
+- * Set nr_pages up to mean "how many pages to unpin, in |
1986 |
+- * the error handler: |
1987 |
+- */ |
1988 |
+- nr_pages = pinned; |
1989 |
+ goto err_pg; |
1990 |
+ } |
1991 |
+ |
1992 |
+@@ -1684,6 +1685,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, |
1993 |
+ struct rio_dev *rdev; |
1994 |
+ struct rio_switch *rswitch = NULL; |
1995 |
+ struct rio_mport *mport; |
1996 |
++ struct device *dev; |
1997 |
+ size_t size; |
1998 |
+ u32 rval; |
1999 |
+ u32 swpinfo = 0; |
2000 |
+@@ -1698,8 +1700,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, |
2001 |
+ rmcd_debug(RDEV, "name:%s ct:0x%x did:0x%x hc:0x%x", dev_info.name, |
2002 |
+ dev_info.comptag, dev_info.destid, dev_info.hopcount); |
2003 |
+ |
2004 |
+- if (bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name)) { |
2005 |
++ dev = bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name); |
2006 |
++ if (dev) { |
2007 |
+ rmcd_debug(RDEV, "device %s already exists", dev_info.name); |
2008 |
++ put_device(dev); |
2009 |
+ return -EEXIST; |
2010 |
+ } |
2011 |
+ |
2012 |
+diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c |
2013 |
+index b2e5a6abf7d5c..aa008fa11002e 100644 |
2014 |
+--- a/drivers/rpmsg/qcom_smd.c |
2015 |
++++ b/drivers/rpmsg/qcom_smd.c |
2016 |
+@@ -1338,7 +1338,7 @@ static int qcom_smd_parse_edge(struct device *dev, |
2017 |
+ ret = of_property_read_u32(node, key, &edge->edge_id); |
2018 |
+ if (ret) { |
2019 |
+ dev_err(dev, "edge missing %s property\n", key); |
2020 |
+- return -EINVAL; |
2021 |
++ goto put_node; |
2022 |
+ } |
2023 |
+ |
2024 |
+ edge->remote_pid = QCOM_SMEM_HOST_ANY; |
2025 |
+@@ -1349,32 +1349,37 @@ static int qcom_smd_parse_edge(struct device *dev, |
2026 |
+ edge->mbox_client.knows_txdone = true; |
2027 |
+ edge->mbox_chan = mbox_request_channel(&edge->mbox_client, 0); |
2028 |
+ if (IS_ERR(edge->mbox_chan)) { |
2029 |
+- if (PTR_ERR(edge->mbox_chan) != -ENODEV) |
2030 |
+- return PTR_ERR(edge->mbox_chan); |
2031 |
++ if (PTR_ERR(edge->mbox_chan) != -ENODEV) { |
2032 |
++ ret = PTR_ERR(edge->mbox_chan); |
2033 |
++ goto put_node; |
2034 |
++ } |
2035 |
+ |
2036 |
+ edge->mbox_chan = NULL; |
2037 |
+ |
2038 |
+ syscon_np = of_parse_phandle(node, "qcom,ipc", 0); |
2039 |
+ if (!syscon_np) { |
2040 |
+ dev_err(dev, "no qcom,ipc node\n"); |
2041 |
+- return -ENODEV; |
2042 |
++ ret = -ENODEV; |
2043 |
++ goto put_node; |
2044 |
+ } |
2045 |
+ |
2046 |
+ edge->ipc_regmap = syscon_node_to_regmap(syscon_np); |
2047 |
+- if (IS_ERR(edge->ipc_regmap)) |
2048 |
+- return PTR_ERR(edge->ipc_regmap); |
2049 |
++ if (IS_ERR(edge->ipc_regmap)) { |
2050 |
++ ret = PTR_ERR(edge->ipc_regmap); |
2051 |
++ goto put_node; |
2052 |
++ } |
2053 |
+ |
2054 |
+ key = "qcom,ipc"; |
2055 |
+ ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset); |
2056 |
+ if (ret < 0) { |
2057 |
+ dev_err(dev, "no offset in %s\n", key); |
2058 |
+- return -EINVAL; |
2059 |
++ goto put_node; |
2060 |
+ } |
2061 |
+ |
2062 |
+ ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit); |
2063 |
+ if (ret < 0) { |
2064 |
+ dev_err(dev, "no bit in %s\n", key); |
2065 |
+- return -EINVAL; |
2066 |
++ goto put_node; |
2067 |
+ } |
2068 |
+ } |
2069 |
+ |
2070 |
+@@ -1385,7 +1390,8 @@ static int qcom_smd_parse_edge(struct device *dev, |
2071 |
+ irq = irq_of_parse_and_map(node, 0); |
2072 |
+ if (irq < 0) { |
2073 |
+ dev_err(dev, "required smd interrupt missing\n"); |
2074 |
+- return -EINVAL; |
2075 |
++ ret = irq; |
2076 |
++ goto put_node; |
2077 |
+ } |
2078 |
+ |
2079 |
+ ret = devm_request_irq(dev, irq, |
2080 |
+@@ -1393,12 +1399,18 @@ static int qcom_smd_parse_edge(struct device *dev, |
2081 |
+ node->name, edge); |
2082 |
+ if (ret) { |
2083 |
+ dev_err(dev, "failed to request smd irq\n"); |
2084 |
+- return ret; |
2085 |
++ goto put_node; |
2086 |
+ } |
2087 |
+ |
2088 |
+ edge->irq = irq; |
2089 |
+ |
2090 |
+ return 0; |
2091 |
++ |
2092 |
++put_node: |
2093 |
++ of_node_put(node); |
2094 |
++ edge->of_node = NULL; |
2095 |
++ |
2096 |
++ return ret; |
2097 |
+ } |
2098 |
+ |
2099 |
+ /* |
2100 |
+diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c |
2101 |
+index 71d53bb239e25..090ab377f65e5 100644 |
2102 |
+--- a/drivers/scsi/ibmvscsi/ibmvfc.c |
2103 |
++++ b/drivers/scsi/ibmvscsi/ibmvfc.c |
2104 |
+@@ -4795,6 +4795,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) |
2105 |
+ if (IS_ERR(vhost->work_thread)) { |
2106 |
+ dev_err(dev, "Couldn't create kernel thread: %ld\n", |
2107 |
+ PTR_ERR(vhost->work_thread)); |
2108 |
++ rc = PTR_ERR(vhost->work_thread); |
2109 |
+ goto free_host_mem; |
2110 |
+ } |
2111 |
+ |
2112 |
+diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c |
2113 |
+index b3cd9a6b1d306..b3df114a1200f 100644 |
2114 |
+--- a/drivers/scsi/mvumi.c |
2115 |
++++ b/drivers/scsi/mvumi.c |
2116 |
+@@ -2439,6 +2439,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba) |
2117 |
+ if (IS_ERR(mhba->dm_thread)) { |
2118 |
+ dev_err(&mhba->pdev->dev, |
2119 |
+ "failed to create device scan thread\n"); |
2120 |
++ ret = PTR_ERR(mhba->dm_thread); |
2121 |
+ mutex_unlock(&mhba->sas_discovery_mutex); |
2122 |
+ goto fail_create_thread; |
2123 |
+ } |
2124 |
+diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c |
2125 |
+index 25d763ae5d5a6..357a0acc5ed2f 100644 |
2126 |
+--- a/drivers/scsi/qedi/qedi_fw.c |
2127 |
++++ b/drivers/scsi/qedi/qedi_fw.c |
2128 |
+@@ -62,6 +62,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, |
2129 |
+ "Freeing tid=0x%x for cid=0x%x\n", |
2130 |
+ cmd->task_id, qedi_conn->iscsi_conn_id); |
2131 |
+ |
2132 |
++ spin_lock(&qedi_conn->list_lock); |
2133 |
+ if (likely(cmd->io_cmd_in_list)) { |
2134 |
+ cmd->io_cmd_in_list = false; |
2135 |
+ list_del_init(&cmd->io_cmd); |
2136 |
+@@ -72,6 +73,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, |
2137 |
+ cmd->task_id, qedi_conn->iscsi_conn_id, |
2138 |
+ &cmd->io_cmd); |
2139 |
+ } |
2140 |
++ spin_unlock(&qedi_conn->list_lock); |
2141 |
+ |
2142 |
+ cmd->state = RESPONSE_RECEIVED; |
2143 |
+ qedi_clear_task_idx(qedi, cmd->task_id); |
2144 |
+@@ -125,6 +127,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, |
2145 |
+ "Freeing tid=0x%x for cid=0x%x\n", |
2146 |
+ cmd->task_id, qedi_conn->iscsi_conn_id); |
2147 |
+ |
2148 |
++ spin_lock(&qedi_conn->list_lock); |
2149 |
+ if (likely(cmd->io_cmd_in_list)) { |
2150 |
+ cmd->io_cmd_in_list = false; |
2151 |
+ list_del_init(&cmd->io_cmd); |
2152 |
+@@ -135,6 +138,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, |
2153 |
+ cmd->task_id, qedi_conn->iscsi_conn_id, |
2154 |
+ &cmd->io_cmd); |
2155 |
+ } |
2156 |
++ spin_unlock(&qedi_conn->list_lock); |
2157 |
+ |
2158 |
+ cmd->state = RESPONSE_RECEIVED; |
2159 |
+ qedi_clear_task_idx(qedi, cmd->task_id); |
2160 |
+@@ -227,11 +231,13 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, |
2161 |
+ |
2162 |
+ tmf_hdr = (struct iscsi_tm *)qedi_cmd->task->hdr; |
2163 |
+ |
2164 |
++ spin_lock(&qedi_conn->list_lock); |
2165 |
+ if (likely(qedi_cmd->io_cmd_in_list)) { |
2166 |
+ qedi_cmd->io_cmd_in_list = false; |
2167 |
+ list_del_init(&qedi_cmd->io_cmd); |
2168 |
+ qedi_conn->active_cmd_count--; |
2169 |
+ } |
2170 |
++ spin_unlock(&qedi_conn->list_lock); |
2171 |
+ |
2172 |
+ if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == |
2173 |
+ ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) || |
2174 |
+@@ -293,11 +299,13 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi, |
2175 |
+ ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK; |
2176 |
+ qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len; |
2177 |
+ |
2178 |
++ spin_lock(&qedi_conn->list_lock); |
2179 |
+ if (likely(cmd->io_cmd_in_list)) { |
2180 |
+ cmd->io_cmd_in_list = false; |
2181 |
+ list_del_init(&cmd->io_cmd); |
2182 |
+ qedi_conn->active_cmd_count--; |
2183 |
+ } |
2184 |
++ spin_unlock(&qedi_conn->list_lock); |
2185 |
+ |
2186 |
+ memset(task_ctx, '\0', sizeof(*task_ctx)); |
2187 |
+ |
2188 |
+@@ -829,8 +837,11 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, |
2189 |
+ qedi_clear_task_idx(qedi_conn->qedi, rtid); |
2190 |
+ |
2191 |
+ spin_lock(&qedi_conn->list_lock); |
2192 |
+- list_del_init(&dbg_cmd->io_cmd); |
2193 |
+- qedi_conn->active_cmd_count--; |
2194 |
++ if (likely(dbg_cmd->io_cmd_in_list)) { |
2195 |
++ dbg_cmd->io_cmd_in_list = false; |
2196 |
++ list_del_init(&dbg_cmd->io_cmd); |
2197 |
++ qedi_conn->active_cmd_count--; |
2198 |
++ } |
2199 |
+ spin_unlock(&qedi_conn->list_lock); |
2200 |
+ qedi_cmd->state = CLEANUP_RECV; |
2201 |
+ wake_up_interruptible(&qedi_conn->wait_queue); |
2202 |
+@@ -1249,6 +1260,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, |
2203 |
+ qedi_conn->cmd_cleanup_req++; |
2204 |
+ qedi_iscsi_cleanup_task(ctask, true); |
2205 |
+ |
2206 |
++ cmd->io_cmd_in_list = false; |
2207 |
+ list_del_init(&cmd->io_cmd); |
2208 |
+ qedi_conn->active_cmd_count--; |
2209 |
+ QEDI_WARN(&qedi->dbg_ctx, |
2210 |
+@@ -1462,8 +1474,11 @@ ldel_exit: |
2211 |
+ spin_unlock_bh(&qedi_conn->tmf_work_lock); |
2212 |
+ |
2213 |
+ spin_lock(&qedi_conn->list_lock); |
2214 |
+- list_del_init(&cmd->io_cmd); |
2215 |
+- qedi_conn->active_cmd_count--; |
2216 |
++ if (likely(cmd->io_cmd_in_list)) { |
2217 |
++ cmd->io_cmd_in_list = false; |
2218 |
++ list_del_init(&cmd->io_cmd); |
2219 |
++ qedi_conn->active_cmd_count--; |
2220 |
++ } |
2221 |
+ spin_unlock(&qedi_conn->list_lock); |
2222 |
+ |
2223 |
+ clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); |
2224 |
+diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
2225 |
+index aa451c8b49e56..4e8c5fcbded6a 100644 |
2226 |
+--- a/drivers/scsi/qedi/qedi_iscsi.c |
2227 |
++++ b/drivers/scsi/qedi/qedi_iscsi.c |
2228 |
+@@ -976,11 +976,13 @@ static void qedi_cleanup_active_cmd_list(struct qedi_conn *qedi_conn) |
2229 |
+ { |
2230 |
+ struct qedi_cmd *cmd, *cmd_tmp; |
2231 |
+ |
2232 |
++ spin_lock(&qedi_conn->list_lock); |
2233 |
+ list_for_each_entry_safe(cmd, cmd_tmp, &qedi_conn->active_cmd_list, |
2234 |
+ io_cmd) { |
2235 |
+ list_del_init(&cmd->io_cmd); |
2236 |
+ qedi_conn->active_cmd_count--; |
2237 |
+ } |
2238 |
++ spin_unlock(&qedi_conn->list_lock); |
2239 |
+ } |
2240 |
+ |
2241 |
+ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
2242 |
+diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c |
2243 |
+index 21e3ff590ec91..798a74535ea7b 100644 |
2244 |
+--- a/drivers/scsi/ufs/ufs-qcom.c |
2245 |
++++ b/drivers/scsi/ufs/ufs-qcom.c |
2246 |
+@@ -1581,9 +1581,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) |
2247 |
+ */ |
2248 |
+ } |
2249 |
+ mask <<= offset; |
2250 |
+- |
2251 |
+- pm_runtime_get_sync(host->hba->dev); |
2252 |
+- ufshcd_hold(host->hba, false); |
2253 |
+ ufshcd_rmwl(host->hba, TEST_BUS_SEL, |
2254 |
+ (u32)host->testbus.select_major << 19, |
2255 |
+ REG_UFS_CFG1); |
2256 |
+@@ -1596,8 +1593,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) |
2257 |
+ * committed before returning. |
2258 |
+ */ |
2259 |
+ mb(); |
2260 |
+- ufshcd_release(host->hba); |
2261 |
+- pm_runtime_put_sync(host->hba->dev); |
2262 |
+ |
2263 |
+ return 0; |
2264 |
+ } |
2265 |
+diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c |
2266 |
+index cf20616340a1a..fe569f6294a24 100644 |
2267 |
+--- a/drivers/tty/ipwireless/network.c |
2268 |
++++ b/drivers/tty/ipwireless/network.c |
2269 |
+@@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, |
2270 |
+ skb->len, |
2271 |
+ notify_packet_sent, |
2272 |
+ network); |
2273 |
+- if (ret == -1) { |
2274 |
++ if (ret < 0) { |
2275 |
+ skb_pull(skb, 2); |
2276 |
+ return 0; |
2277 |
+ } |
2278 |
+@@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, |
2279 |
+ notify_packet_sent, |
2280 |
+ network); |
2281 |
+ kfree(buf); |
2282 |
+- if (ret == -1) |
2283 |
++ if (ret < 0) |
2284 |
+ return 0; |
2285 |
+ } |
2286 |
+ kfree_skb(skb); |
2287 |
+diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c |
2288 |
+index 1ef751c27ac6d..cb04971843306 100644 |
2289 |
+--- a/drivers/tty/ipwireless/tty.c |
2290 |
++++ b/drivers/tty/ipwireless/tty.c |
2291 |
+@@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty, |
2292 |
+ ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS, |
2293 |
+ buf, count, |
2294 |
+ ipw_write_packet_sent_callback, tty); |
2295 |
+- if (ret == -1) { |
2296 |
++ if (ret < 0) { |
2297 |
+ mutex_unlock(&tty->ipw_tty_mutex); |
2298 |
+ return 0; |
2299 |
+ } |
2300 |
+diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
2301 |
+index 2daccb10ae2f3..4b9f422694779 100644 |
2302 |
+--- a/drivers/tty/serial/fsl_lpuart.c |
2303 |
++++ b/drivers/tty/serial/fsl_lpuart.c |
2304 |
+@@ -563,7 +563,7 @@ static void lpuart32_poll_put_char(struct uart_port *port, unsigned char c) |
2305 |
+ |
2306 |
+ static int lpuart32_poll_get_char(struct uart_port *port) |
2307 |
+ { |
2308 |
+- if (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_RDRF)) |
2309 |
++ if (!(lpuart32_read(port, UARTWATER) >> UARTWATER_RXCNT_OFF)) |
2310 |
+ return NO_POLL_CHAR; |
2311 |
+ |
2312 |
+ return lpuart32_read(port, UARTDATA); |
2313 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
2314 |
+index 41453bf6fc0bd..7376f74a4f049 100644 |
2315 |
+--- a/drivers/usb/class/cdc-acm.c |
2316 |
++++ b/drivers/usb/class/cdc-acm.c |
2317 |
+@@ -1275,9 +1275,21 @@ static int acm_probe(struct usb_interface *intf, |
2318 |
+ } |
2319 |
+ } |
2320 |
+ } else { |
2321 |
++ int class = -1; |
2322 |
++ |
2323 |
+ data_intf_num = union_header->bSlaveInterface0; |
2324 |
+ control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); |
2325 |
+ data_interface = usb_ifnum_to_if(usb_dev, data_intf_num); |
2326 |
++ |
2327 |
++ if (control_interface) |
2328 |
++ class = control_interface->cur_altsetting->desc.bInterfaceClass; |
2329 |
++ |
2330 |
++ if (class != USB_CLASS_COMM && class != USB_CLASS_CDC_DATA) { |
2331 |
++ dev_dbg(&intf->dev, "Broken union descriptor, assuming single interface\n"); |
2332 |
++ combined_interfaces = 1; |
2333 |
++ control_interface = data_interface = intf; |
2334 |
++ goto look_for_collapsed_interface; |
2335 |
++ } |
2336 |
+ } |
2337 |
+ |
2338 |
+ if (!control_interface || !data_interface) { |
2339 |
+@@ -1932,6 +1944,17 @@ static const struct usb_device_id acm_ids[] = { |
2340 |
+ .driver_info = IGNORE_DEVICE, |
2341 |
+ }, |
2342 |
+ |
2343 |
++ /* Exclude ETAS ES58x */ |
2344 |
++ { USB_DEVICE(0x108c, 0x0159), /* ES581.4 */ |
2345 |
++ .driver_info = IGNORE_DEVICE, |
2346 |
++ }, |
2347 |
++ { USB_DEVICE(0x108c, 0x0168), /* ES582.1 */ |
2348 |
++ .driver_info = IGNORE_DEVICE, |
2349 |
++ }, |
2350 |
++ { USB_DEVICE(0x108c, 0x0169), /* ES584.1 */ |
2351 |
++ .driver_info = IGNORE_DEVICE, |
2352 |
++ }, |
2353 |
++ |
2354 |
+ { USB_DEVICE(0x1bc7, 0x0021), /* Telit 3G ACM only composition */ |
2355 |
+ .driver_info = SEND_ZERO_PACKET, |
2356 |
+ }, |
2357 |
+diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
2358 |
+index 4929c58830688..55ad4c43b3804 100644 |
2359 |
+--- a/drivers/usb/class/cdc-wdm.c |
2360 |
++++ b/drivers/usb/class/cdc-wdm.c |
2361 |
+@@ -58,6 +58,9 @@ MODULE_DEVICE_TABLE (usb, wdm_ids); |
2362 |
+ |
2363 |
+ #define WDM_MAX 16 |
2364 |
+ |
2365 |
++/* we cannot wait forever at flush() */ |
2366 |
++#define WDM_FLUSH_TIMEOUT (30 * HZ) |
2367 |
++ |
2368 |
+ /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */ |
2369 |
+ #define WDM_DEFAULT_BUFSIZE 256 |
2370 |
+ |
2371 |
+@@ -151,7 +154,7 @@ static void wdm_out_callback(struct urb *urb) |
2372 |
+ kfree(desc->outbuf); |
2373 |
+ desc->outbuf = NULL; |
2374 |
+ clear_bit(WDM_IN_USE, &desc->flags); |
2375 |
+- wake_up(&desc->wait); |
2376 |
++ wake_up_all(&desc->wait); |
2377 |
+ } |
2378 |
+ |
2379 |
+ static void wdm_in_callback(struct urb *urb) |
2380 |
+@@ -393,6 +396,9 @@ static ssize_t wdm_write |
2381 |
+ if (test_bit(WDM_RESETTING, &desc->flags)) |
2382 |
+ r = -EIO; |
2383 |
+ |
2384 |
++ if (test_bit(WDM_DISCONNECTING, &desc->flags)) |
2385 |
++ r = -ENODEV; |
2386 |
++ |
2387 |
+ if (r < 0) { |
2388 |
+ rv = r; |
2389 |
+ goto out_free_mem_pm; |
2390 |
+@@ -424,6 +430,7 @@ static ssize_t wdm_write |
2391 |
+ if (rv < 0) { |
2392 |
+ desc->outbuf = NULL; |
2393 |
+ clear_bit(WDM_IN_USE, &desc->flags); |
2394 |
++ wake_up_all(&desc->wait); /* for wdm_wait_for_response() */ |
2395 |
+ dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); |
2396 |
+ rv = usb_translate_errors(rv); |
2397 |
+ goto out_free_mem_pm; |
2398 |
+@@ -583,28 +590,58 @@ err: |
2399 |
+ return rv; |
2400 |
+ } |
2401 |
+ |
2402 |
+-static int wdm_flush(struct file *file, fl_owner_t id) |
2403 |
++static int wdm_wait_for_response(struct file *file, long timeout) |
2404 |
+ { |
2405 |
+ struct wdm_device *desc = file->private_data; |
2406 |
++ long rv; /* Use long here because (int) MAX_SCHEDULE_TIMEOUT < 0. */ |
2407 |
++ |
2408 |
++ /* |
2409 |
++ * Needs both flags. We cannot do with one because resetting it would |
2410 |
++ * cause a race with write() yet we need to signal a disconnect. |
2411 |
++ */ |
2412 |
++ rv = wait_event_interruptible_timeout(desc->wait, |
2413 |
++ !test_bit(WDM_IN_USE, &desc->flags) || |
2414 |
++ test_bit(WDM_DISCONNECTING, &desc->flags), |
2415 |
++ timeout); |
2416 |
+ |
2417 |
+- wait_event(desc->wait, |
2418 |
+- /* |
2419 |
+- * needs both flags. We cannot do with one |
2420 |
+- * because resetting it would cause a race |
2421 |
+- * with write() yet we need to signal |
2422 |
+- * a disconnect |
2423 |
+- */ |
2424 |
+- !test_bit(WDM_IN_USE, &desc->flags) || |
2425 |
+- test_bit(WDM_DISCONNECTING, &desc->flags)); |
2426 |
+- |
2427 |
+- /* cannot dereference desc->intf if WDM_DISCONNECTING */ |
2428 |
++ /* |
2429 |
++ * To report the correct error. This is best effort. |
2430 |
++ * We are inevitably racing with the hardware. |
2431 |
++ */ |
2432 |
+ if (test_bit(WDM_DISCONNECTING, &desc->flags)) |
2433 |
+ return -ENODEV; |
2434 |
+- if (desc->werr < 0) |
2435 |
+- dev_err(&desc->intf->dev, "Error in flush path: %d\n", |
2436 |
+- desc->werr); |
2437 |
++ if (!rv) |
2438 |
++ return -EIO; |
2439 |
++ if (rv < 0) |
2440 |
++ return -EINTR; |
2441 |
++ |
2442 |
++ spin_lock_irq(&desc->iuspin); |
2443 |
++ rv = desc->werr; |
2444 |
++ desc->werr = 0; |
2445 |
++ spin_unlock_irq(&desc->iuspin); |
2446 |
++ |
2447 |
++ return usb_translate_errors(rv); |
2448 |
++ |
2449 |
++} |
2450 |
++ |
2451 |
++/* |
2452 |
++ * You need to send a signal when you react to malicious or defective hardware. |
2453 |
++ * Also, don't abort when fsync() returned -EINVAL, for older kernels which do |
2454 |
++ * not implement wdm_flush() will return -EINVAL. |
2455 |
++ */ |
2456 |
++static int wdm_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
2457 |
++{ |
2458 |
++ return wdm_wait_for_response(file, MAX_SCHEDULE_TIMEOUT); |
2459 |
++} |
2460 |
+ |
2461 |
+- return usb_translate_errors(desc->werr); |
2462 |
++/* |
2463 |
++ * Same with wdm_fsync(), except it uses finite timeout in order to react to |
2464 |
++ * malicious or defective hardware which ceased communication after close() was |
2465 |
++ * implicitly called due to process termination. |
2466 |
++ */ |
2467 |
++static int wdm_flush(struct file *file, fl_owner_t id) |
2468 |
++{ |
2469 |
++ return wdm_wait_for_response(file, WDM_FLUSH_TIMEOUT); |
2470 |
+ } |
2471 |
+ |
2472 |
+ static __poll_t wdm_poll(struct file *file, struct poll_table_struct *wait) |
2473 |
+@@ -729,6 +766,7 @@ static const struct file_operations wdm_fops = { |
2474 |
+ .owner = THIS_MODULE, |
2475 |
+ .read = wdm_read, |
2476 |
+ .write = wdm_write, |
2477 |
++ .fsync = wdm_fsync, |
2478 |
+ .open = wdm_open, |
2479 |
+ .flush = wdm_flush, |
2480 |
+ .release = wdm_release, |
2481 |
+diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c |
2482 |
+index 5e844097a9e30..3cd7732c086e0 100644 |
2483 |
+--- a/drivers/usb/core/urb.c |
2484 |
++++ b/drivers/usb/core/urb.c |
2485 |
+@@ -773,11 +773,12 @@ void usb_block_urb(struct urb *urb) |
2486 |
+ EXPORT_SYMBOL_GPL(usb_block_urb); |
2487 |
+ |
2488 |
+ /** |
2489 |
+- * usb_kill_anchored_urbs - cancel transfer requests en masse |
2490 |
++ * usb_kill_anchored_urbs - kill all URBs associated with an anchor |
2491 |
+ * @anchor: anchor the requests are bound to |
2492 |
+ * |
2493 |
+- * this allows all outstanding URBs to be killed starting |
2494 |
+- * from the back of the queue |
2495 |
++ * This kills all outstanding URBs starting from the back of the queue, |
2496 |
++ * with guarantee that no completer callbacks will take place from the |
2497 |
++ * anchor after this function returns. |
2498 |
+ * |
2499 |
+ * This routine should not be called by a driver after its disconnect |
2500 |
+ * method has returned. |
2501 |
+@@ -785,20 +786,26 @@ EXPORT_SYMBOL_GPL(usb_block_urb); |
2502 |
+ void usb_kill_anchored_urbs(struct usb_anchor *anchor) |
2503 |
+ { |
2504 |
+ struct urb *victim; |
2505 |
++ int surely_empty; |
2506 |
+ |
2507 |
+- spin_lock_irq(&anchor->lock); |
2508 |
+- while (!list_empty(&anchor->urb_list)) { |
2509 |
+- victim = list_entry(anchor->urb_list.prev, struct urb, |
2510 |
+- anchor_list); |
2511 |
+- /* we must make sure the URB isn't freed before we kill it*/ |
2512 |
+- usb_get_urb(victim); |
2513 |
+- spin_unlock_irq(&anchor->lock); |
2514 |
+- /* this will unanchor the URB */ |
2515 |
+- usb_kill_urb(victim); |
2516 |
+- usb_put_urb(victim); |
2517 |
++ do { |
2518 |
+ spin_lock_irq(&anchor->lock); |
2519 |
+- } |
2520 |
+- spin_unlock_irq(&anchor->lock); |
2521 |
++ while (!list_empty(&anchor->urb_list)) { |
2522 |
++ victim = list_entry(anchor->urb_list.prev, |
2523 |
++ struct urb, anchor_list); |
2524 |
++ /* make sure the URB isn't freed before we kill it */ |
2525 |
++ usb_get_urb(victim); |
2526 |
++ spin_unlock_irq(&anchor->lock); |
2527 |
++ /* this will unanchor the URB */ |
2528 |
++ usb_kill_urb(victim); |
2529 |
++ usb_put_urb(victim); |
2530 |
++ spin_lock_irq(&anchor->lock); |
2531 |
++ } |
2532 |
++ surely_empty = usb_anchor_check_wakeup(anchor); |
2533 |
++ |
2534 |
++ spin_unlock_irq(&anchor->lock); |
2535 |
++ cpu_relax(); |
2536 |
++ } while (!surely_empty); |
2537 |
+ } |
2538 |
+ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); |
2539 |
+ |
2540 |
+@@ -817,21 +824,27 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); |
2541 |
+ void usb_poison_anchored_urbs(struct usb_anchor *anchor) |
2542 |
+ { |
2543 |
+ struct urb *victim; |
2544 |
++ int surely_empty; |
2545 |
+ |
2546 |
+- spin_lock_irq(&anchor->lock); |
2547 |
+- anchor->poisoned = 1; |
2548 |
+- while (!list_empty(&anchor->urb_list)) { |
2549 |
+- victim = list_entry(anchor->urb_list.prev, struct urb, |
2550 |
+- anchor_list); |
2551 |
+- /* we must make sure the URB isn't freed before we kill it*/ |
2552 |
+- usb_get_urb(victim); |
2553 |
+- spin_unlock_irq(&anchor->lock); |
2554 |
+- /* this will unanchor the URB */ |
2555 |
+- usb_poison_urb(victim); |
2556 |
+- usb_put_urb(victim); |
2557 |
++ do { |
2558 |
+ spin_lock_irq(&anchor->lock); |
2559 |
+- } |
2560 |
+- spin_unlock_irq(&anchor->lock); |
2561 |
++ anchor->poisoned = 1; |
2562 |
++ while (!list_empty(&anchor->urb_list)) { |
2563 |
++ victim = list_entry(anchor->urb_list.prev, |
2564 |
++ struct urb, anchor_list); |
2565 |
++ /* make sure the URB isn't freed before we kill it */ |
2566 |
++ usb_get_urb(victim); |
2567 |
++ spin_unlock_irq(&anchor->lock); |
2568 |
++ /* this will unanchor the URB */ |
2569 |
++ usb_poison_urb(victim); |
2570 |
++ usb_put_urb(victim); |
2571 |
++ spin_lock_irq(&anchor->lock); |
2572 |
++ } |
2573 |
++ surely_empty = usb_anchor_check_wakeup(anchor); |
2574 |
++ |
2575 |
++ spin_unlock_irq(&anchor->lock); |
2576 |
++ cpu_relax(); |
2577 |
++ } while (!surely_empty); |
2578 |
+ } |
2579 |
+ EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); |
2580 |
+ |
2581 |
+@@ -971,14 +984,20 @@ void usb_scuttle_anchored_urbs(struct usb_anchor *anchor) |
2582 |
+ { |
2583 |
+ struct urb *victim; |
2584 |
+ unsigned long flags; |
2585 |
++ int surely_empty; |
2586 |
++ |
2587 |
++ do { |
2588 |
++ spin_lock_irqsave(&anchor->lock, flags); |
2589 |
++ while (!list_empty(&anchor->urb_list)) { |
2590 |
++ victim = list_entry(anchor->urb_list.prev, |
2591 |
++ struct urb, anchor_list); |
2592 |
++ __usb_unanchor_urb(victim, anchor); |
2593 |
++ } |
2594 |
++ surely_empty = usb_anchor_check_wakeup(anchor); |
2595 |
+ |
2596 |
+- spin_lock_irqsave(&anchor->lock, flags); |
2597 |
+- while (!list_empty(&anchor->urb_list)) { |
2598 |
+- victim = list_entry(anchor->urb_list.prev, struct urb, |
2599 |
+- anchor_list); |
2600 |
+- __usb_unanchor_urb(victim, anchor); |
2601 |
+- } |
2602 |
+- spin_unlock_irqrestore(&anchor->lock, flags); |
2603 |
++ spin_unlock_irqrestore(&anchor->lock, flags); |
2604 |
++ cpu_relax(); |
2605 |
++ } while (!surely_empty); |
2606 |
+ } |
2607 |
+ |
2608 |
+ EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs); |
2609 |
+diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c |
2610 |
+index 4c2771c5e7276..1ef89a4317c87 100644 |
2611 |
+--- a/drivers/usb/dwc3/dwc3-of-simple.c |
2612 |
++++ b/drivers/usb/dwc3/dwc3-of-simple.c |
2613 |
+@@ -243,6 +243,7 @@ static const struct of_device_id of_dwc3_simple_match[] = { |
2614 |
+ { .compatible = "amlogic,meson-axg-dwc3" }, |
2615 |
+ { .compatible = "amlogic,meson-gxl-dwc3" }, |
2616 |
+ { .compatible = "allwinner,sun50i-h6-dwc3" }, |
2617 |
++ { .compatible = "hisilicon,hi3670-dwc3" }, |
2618 |
+ { /* Sentinel */ } |
2619 |
+ }; |
2620 |
+ MODULE_DEVICE_TABLE(of, of_dwc3_simple_match); |
2621 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
2622 |
+index 09bc917d407d4..e4aa370e86a9e 100644 |
2623 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
2624 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
2625 |
+@@ -1523,7 +1523,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) |
2626 |
+ fs_ncm_notify_desc.bEndpointAddress; |
2627 |
+ |
2628 |
+ status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function, |
2629 |
+- ncm_ss_function, NULL); |
2630 |
++ ncm_ss_function, ncm_ss_function); |
2631 |
+ if (status) |
2632 |
+ goto fail; |
2633 |
+ |
2634 |
+diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c |
2635 |
+index 9c7ed2539ff77..8ed1295d7e350 100644 |
2636 |
+--- a/drivers/usb/gadget/function/f_printer.c |
2637 |
++++ b/drivers/usb/gadget/function/f_printer.c |
2638 |
+@@ -31,6 +31,7 @@ |
2639 |
+ #include <linux/types.h> |
2640 |
+ #include <linux/ctype.h> |
2641 |
+ #include <linux/cdev.h> |
2642 |
++#include <linux/kref.h> |
2643 |
+ |
2644 |
+ #include <asm/byteorder.h> |
2645 |
+ #include <linux/io.h> |
2646 |
+@@ -64,7 +65,7 @@ struct printer_dev { |
2647 |
+ struct usb_gadget *gadget; |
2648 |
+ s8 interface; |
2649 |
+ struct usb_ep *in_ep, *out_ep; |
2650 |
+- |
2651 |
++ struct kref kref; |
2652 |
+ struct list_head rx_reqs; /* List of free RX structs */ |
2653 |
+ struct list_head rx_reqs_active; /* List of Active RX xfers */ |
2654 |
+ struct list_head rx_buffers; /* List of completed xfers */ |
2655 |
+@@ -218,6 +219,13 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget, |
2656 |
+ |
2657 |
+ /*-------------------------------------------------------------------------*/ |
2658 |
+ |
2659 |
++static void printer_dev_free(struct kref *kref) |
2660 |
++{ |
2661 |
++ struct printer_dev *dev = container_of(kref, struct printer_dev, kref); |
2662 |
++ |
2663 |
++ kfree(dev); |
2664 |
++} |
2665 |
++ |
2666 |
+ static struct usb_request * |
2667 |
+ printer_req_alloc(struct usb_ep *ep, unsigned len, gfp_t gfp_flags) |
2668 |
+ { |
2669 |
+@@ -348,6 +356,7 @@ printer_open(struct inode *inode, struct file *fd) |
2670 |
+ |
2671 |
+ spin_unlock_irqrestore(&dev->lock, flags); |
2672 |
+ |
2673 |
++ kref_get(&dev->kref); |
2674 |
+ DBG(dev, "printer_open returned %x\n", ret); |
2675 |
+ return ret; |
2676 |
+ } |
2677 |
+@@ -365,6 +374,7 @@ printer_close(struct inode *inode, struct file *fd) |
2678 |
+ dev->printer_status &= ~PRINTER_SELECTED; |
2679 |
+ spin_unlock_irqrestore(&dev->lock, flags); |
2680 |
+ |
2681 |
++ kref_put(&dev->kref, printer_dev_free); |
2682 |
+ DBG(dev, "printer_close\n"); |
2683 |
+ |
2684 |
+ return 0; |
2685 |
+@@ -1350,7 +1360,8 @@ static void gprinter_free(struct usb_function *f) |
2686 |
+ struct f_printer_opts *opts; |
2687 |
+ |
2688 |
+ opts = container_of(f->fi, struct f_printer_opts, func_inst); |
2689 |
+- kfree(dev); |
2690 |
++ |
2691 |
++ kref_put(&dev->kref, printer_dev_free); |
2692 |
+ mutex_lock(&opts->lock); |
2693 |
+ --opts->refcnt; |
2694 |
+ mutex_unlock(&opts->lock); |
2695 |
+@@ -1419,6 +1430,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi) |
2696 |
+ return ERR_PTR(-ENOMEM); |
2697 |
+ } |
2698 |
+ |
2699 |
++ kref_init(&dev->kref); |
2700 |
+ ++opts->refcnt; |
2701 |
+ dev->minor = opts->minor; |
2702 |
+ dev->pnp_string = opts->pnp_string; |
2703 |
+diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c |
2704 |
+index af11887f5f9e4..e88486d8084af 100644 |
2705 |
+--- a/drivers/usb/host/ohci-hcd.c |
2706 |
++++ b/drivers/usb/host/ohci-hcd.c |
2707 |
+@@ -665,20 +665,24 @@ retry: |
2708 |
+ |
2709 |
+ /* handle root hub init quirks ... */ |
2710 |
+ val = roothub_a (ohci); |
2711 |
+- val &= ~(RH_A_PSM | RH_A_OCPM); |
2712 |
++ /* Configure for per-port over-current protection by default */ |
2713 |
++ val &= ~RH_A_NOCP; |
2714 |
++ val |= RH_A_OCPM; |
2715 |
+ if (ohci->flags & OHCI_QUIRK_SUPERIO) { |
2716 |
+- /* NSC 87560 and maybe others */ |
2717 |
++ /* NSC 87560 and maybe others. |
2718 |
++ * Ganged power switching, no over-current protection. |
2719 |
++ */ |
2720 |
+ val |= RH_A_NOCP; |
2721 |
+- val &= ~(RH_A_POTPGT | RH_A_NPS); |
2722 |
+- ohci_writel (ohci, val, &ohci->regs->roothub.a); |
2723 |
++ val &= ~(RH_A_POTPGT | RH_A_NPS | RH_A_PSM | RH_A_OCPM); |
2724 |
+ } else if ((ohci->flags & OHCI_QUIRK_AMD756) || |
2725 |
+ (ohci->flags & OHCI_QUIRK_HUB_POWER)) { |
2726 |
+ /* hub power always on; required for AMD-756 and some |
2727 |
+- * Mac platforms. ganged overcurrent reporting, if any. |
2728 |
++ * Mac platforms. |
2729 |
+ */ |
2730 |
+ val |= RH_A_NPS; |
2731 |
+- ohci_writel (ohci, val, &ohci->regs->roothub.a); |
2732 |
+ } |
2733 |
++ ohci_writel(ohci, val, &ohci->regs->roothub.a); |
2734 |
++ |
2735 |
+ ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status); |
2736 |
+ ohci_writel (ohci, (val & RH_A_NPS) ? 0 : RH_B_PPCM, |
2737 |
+ &ohci->regs->roothub.b); |
2738 |
+diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c |
2739 |
+index bdfdd506bc588..c989f777bf771 100644 |
2740 |
+--- a/drivers/vfio/pci/vfio_pci_intrs.c |
2741 |
++++ b/drivers/vfio/pci/vfio_pci_intrs.c |
2742 |
+@@ -355,11 +355,13 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, |
2743 |
+ vdev->ctx[vector].producer.token = trigger; |
2744 |
+ vdev->ctx[vector].producer.irq = irq; |
2745 |
+ ret = irq_bypass_register_producer(&vdev->ctx[vector].producer); |
2746 |
+- if (unlikely(ret)) |
2747 |
++ if (unlikely(ret)) { |
2748 |
+ dev_info(&pdev->dev, |
2749 |
+ "irq bypass producer (token %p) registration fails: %d\n", |
2750 |
+ vdev->ctx[vector].producer.token, ret); |
2751 |
+ |
2752 |
++ vdev->ctx[vector].producer.token = NULL; |
2753 |
++ } |
2754 |
+ vdev->ctx[vector].trigger = trigger; |
2755 |
+ |
2756 |
+ return 0; |
2757 |
+diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c |
2758 |
+index 05d8553635ee7..95ce167a8ad92 100644 |
2759 |
+--- a/drivers/vfio/vfio_iommu_type1.c |
2760 |
++++ b/drivers/vfio/vfio_iommu_type1.c |
2761 |
+@@ -636,7 +636,8 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, |
2762 |
+ |
2763 |
+ ret = vfio_add_to_pfn_list(dma, iova, phys_pfn[i]); |
2764 |
+ if (ret) { |
2765 |
+- vfio_unpin_page_external(dma, iova, do_accounting); |
2766 |
++ if (put_pfn(phys_pfn[i], dma->prot) && do_accounting) |
2767 |
++ vfio_lock_acct(dma, -1, true); |
2768 |
+ goto pin_unwind; |
2769 |
+ } |
2770 |
+ } |
2771 |
+diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h |
2772 |
+index 87eaf357ae01f..adf015aa4126f 100644 |
2773 |
+--- a/drivers/watchdog/sp5100_tco.h |
2774 |
++++ b/drivers/watchdog/sp5100_tco.h |
2775 |
+@@ -70,7 +70,7 @@ |
2776 |
+ #define EFCH_PM_DECODEEN_WDT_TMREN BIT(7) |
2777 |
+ |
2778 |
+ |
2779 |
+-#define EFCH_PM_DECODEEN3 0x00 |
2780 |
++#define EFCH_PM_DECODEEN3 0x03 |
2781 |
+ #define EFCH_PM_DECODEEN_SECOND_RES GENMASK(1, 0) |
2782 |
+ #define EFCH_PM_WATCHDOG_DISABLE ((u8)GENMASK(3, 2)) |
2783 |
+ |
2784 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
2785 |
+index 1c322caecf7f1..8fe59b7d8eec8 100644 |
2786 |
+--- a/drivers/watchdog/watchdog_dev.c |
2787 |
++++ b/drivers/watchdog/watchdog_dev.c |
2788 |
+@@ -944,8 +944,10 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) |
2789 |
+ wd_data->wdd = wdd; |
2790 |
+ wdd->wd_data = wd_data; |
2791 |
+ |
2792 |
+- if (IS_ERR_OR_NULL(watchdog_kworker)) |
2793 |
++ if (IS_ERR_OR_NULL(watchdog_kworker)) { |
2794 |
++ kfree(wd_data); |
2795 |
+ return -ENODEV; |
2796 |
++ } |
2797 |
+ |
2798 |
+ device_initialize(&wd_data->dev); |
2799 |
+ wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id); |
2800 |
+@@ -971,7 +973,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) |
2801 |
+ pr_err("%s: a legacy watchdog module is probably present.\n", |
2802 |
+ wdd->info->identity); |
2803 |
+ old_wd_data = NULL; |
2804 |
+- kfree(wd_data); |
2805 |
++ put_device(&wd_data->dev); |
2806 |
+ return err; |
2807 |
+ } |
2808 |
+ } |
2809 |
+diff --git a/fs/dlm/config.c b/fs/dlm/config.c |
2810 |
+index 1270551d24e38..f13d865244501 100644 |
2811 |
+--- a/fs/dlm/config.c |
2812 |
++++ b/fs/dlm/config.c |
2813 |
+@@ -218,6 +218,7 @@ struct dlm_space { |
2814 |
+ struct list_head members; |
2815 |
+ struct mutex members_lock; |
2816 |
+ int members_count; |
2817 |
++ struct dlm_nodes *nds; |
2818 |
+ }; |
2819 |
+ |
2820 |
+ struct dlm_comms { |
2821 |
+@@ -426,6 +427,7 @@ static struct config_group *make_space(struct config_group *g, const char *name) |
2822 |
+ INIT_LIST_HEAD(&sp->members); |
2823 |
+ mutex_init(&sp->members_lock); |
2824 |
+ sp->members_count = 0; |
2825 |
++ sp->nds = nds; |
2826 |
+ return &sp->group; |
2827 |
+ |
2828 |
+ fail: |
2829 |
+@@ -447,6 +449,7 @@ static void drop_space(struct config_group *g, struct config_item *i) |
2830 |
+ static void release_space(struct config_item *i) |
2831 |
+ { |
2832 |
+ struct dlm_space *sp = config_item_to_space(i); |
2833 |
++ kfree(sp->nds); |
2834 |
+ kfree(sp); |
2835 |
+ } |
2836 |
+ |
2837 |
+diff --git a/fs/ext4/fsmap.c b/fs/ext4/fsmap.c |
2838 |
+index 4b99e2db95b8b..6f3f245f3a803 100644 |
2839 |
+--- a/fs/ext4/fsmap.c |
2840 |
++++ b/fs/ext4/fsmap.c |
2841 |
+@@ -108,6 +108,9 @@ static int ext4_getfsmap_helper(struct super_block *sb, |
2842 |
+ |
2843 |
+ /* Are we just counting mappings? */ |
2844 |
+ if (info->gfi_head->fmh_count == 0) { |
2845 |
++ if (info->gfi_head->fmh_entries == UINT_MAX) |
2846 |
++ return EXT4_QUERY_RANGE_ABORT; |
2847 |
++ |
2848 |
+ if (rec_fsblk > info->gfi_next_fsblk) |
2849 |
+ info->gfi_head->fmh_entries++; |
2850 |
+ |
2851 |
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c |
2852 |
+index 9a59f49ba4050..89b6c33ba6a42 100644 |
2853 |
+--- a/fs/f2fs/sysfs.c |
2854 |
++++ b/fs/f2fs/sysfs.c |
2855 |
+@@ -717,4 +717,5 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) |
2856 |
+ } |
2857 |
+ kobject_del(&sbi->s_kobj); |
2858 |
+ kobject_put(&sbi->s_kobj); |
2859 |
++ wait_for_completion(&sbi->s_kobj_unregister); |
2860 |
+ } |
2861 |
+diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c |
2862 |
+index bd3221cbdd956..0d4b5b9843b62 100644 |
2863 |
+--- a/fs/ntfs/inode.c |
2864 |
++++ b/fs/ntfs/inode.c |
2865 |
+@@ -1835,6 +1835,12 @@ int ntfs_read_inode_mount(struct inode *vi) |
2866 |
+ brelse(bh); |
2867 |
+ } |
2868 |
+ |
2869 |
++ if (le32_to_cpu(m->bytes_allocated) != vol->mft_record_size) { |
2870 |
++ ntfs_error(sb, "Incorrect mft record size %u in superblock, should be %u.", |
2871 |
++ le32_to_cpu(m->bytes_allocated), vol->mft_record_size); |
2872 |
++ goto err_out; |
2873 |
++ } |
2874 |
++ |
2875 |
+ /* Apply the mst fixups. */ |
2876 |
+ if (post_read_mst_fixup((NTFS_RECORD*)m, vol->mft_record_size)) { |
2877 |
+ /* FIXME: Try to use the $MFTMirr now. */ |
2878 |
+diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c |
2879 |
+index 3ac1f23870837..5e1ebbe639ebf 100644 |
2880 |
+--- a/fs/ramfs/file-nommu.c |
2881 |
++++ b/fs/ramfs/file-nommu.c |
2882 |
+@@ -228,7 +228,7 @@ static unsigned long ramfs_nommu_get_unmapped_area(struct file *file, |
2883 |
+ if (!pages) |
2884 |
+ goto out_free; |
2885 |
+ |
2886 |
+- nr = find_get_pages(inode->i_mapping, &pgoff, lpages, pages); |
2887 |
++ nr = find_get_pages_contig(inode->i_mapping, pgoff, lpages, pages); |
2888 |
+ if (nr != lpages) |
2889 |
+ goto out_free_pages; /* leave if some pages were missing */ |
2890 |
+ |
2891 |
+diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c |
2892 |
+index 70387650436cf..ac35ddf0dd603 100644 |
2893 |
+--- a/fs/reiserfs/inode.c |
2894 |
++++ b/fs/reiserfs/inode.c |
2895 |
+@@ -2161,7 +2161,8 @@ out_end_trans: |
2896 |
+ out_inserted_sd: |
2897 |
+ clear_nlink(inode); |
2898 |
+ th->t_trans_id = 0; /* so the caller can't use this handle later */ |
2899 |
+- unlock_new_inode(inode); /* OK to do even if we hadn't locked it */ |
2900 |
++ if (inode->i_state & I_NEW) |
2901 |
++ unlock_new_inode(inode); |
2902 |
+ iput(inode); |
2903 |
+ return err; |
2904 |
+ } |
2905 |
+diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
2906 |
+index de5eda33c92a0..ec5716dd58c23 100644 |
2907 |
+--- a/fs/reiserfs/super.c |
2908 |
++++ b/fs/reiserfs/super.c |
2909 |
+@@ -1264,6 +1264,10 @@ static int reiserfs_parse_options(struct super_block *s, |
2910 |
+ "turned on."); |
2911 |
+ return 0; |
2912 |
+ } |
2913 |
++ if (qf_names[qtype] != |
2914 |
++ REISERFS_SB(s)->s_qf_names[qtype]) |
2915 |
++ kfree(qf_names[qtype]); |
2916 |
++ qf_names[qtype] = NULL; |
2917 |
+ if (*arg) { /* Some filename specified? */ |
2918 |
+ if (REISERFS_SB(s)->s_qf_names[qtype] |
2919 |
+ && strcmp(REISERFS_SB(s)->s_qf_names[qtype], |
2920 |
+@@ -1293,10 +1297,6 @@ static int reiserfs_parse_options(struct super_block *s, |
2921 |
+ else |
2922 |
+ *mount_options |= 1 << REISERFS_GRPQUOTA; |
2923 |
+ } else { |
2924 |
+- if (qf_names[qtype] != |
2925 |
+- REISERFS_SB(s)->s_qf_names[qtype]) |
2926 |
+- kfree(qf_names[qtype]); |
2927 |
+- qf_names[qtype] = NULL; |
2928 |
+ if (qtype == USRQUOTA) |
2929 |
+ *mount_options &= ~(1 << REISERFS_USRQUOTA); |
2930 |
+ else |
2931 |
+diff --git a/fs/udf/inode.c b/fs/udf/inode.c |
2932 |
+index 4c46ebf0e773b..3bf89a6338367 100644 |
2933 |
+--- a/fs/udf/inode.c |
2934 |
++++ b/fs/udf/inode.c |
2935 |
+@@ -132,21 +132,24 @@ void udf_evict_inode(struct inode *inode) |
2936 |
+ struct udf_inode_info *iinfo = UDF_I(inode); |
2937 |
+ int want_delete = 0; |
2938 |
+ |
2939 |
+- if (!inode->i_nlink && !is_bad_inode(inode)) { |
2940 |
+- want_delete = 1; |
2941 |
+- udf_setsize(inode, 0); |
2942 |
+- udf_update_inode(inode, IS_SYNC(inode)); |
2943 |
++ if (!is_bad_inode(inode)) { |
2944 |
++ if (!inode->i_nlink) { |
2945 |
++ want_delete = 1; |
2946 |
++ udf_setsize(inode, 0); |
2947 |
++ udf_update_inode(inode, IS_SYNC(inode)); |
2948 |
++ } |
2949 |
++ if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && |
2950 |
++ inode->i_size != iinfo->i_lenExtents) { |
2951 |
++ udf_warn(inode->i_sb, |
2952 |
++ "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n", |
2953 |
++ inode->i_ino, inode->i_mode, |
2954 |
++ (unsigned long long)inode->i_size, |
2955 |
++ (unsigned long long)iinfo->i_lenExtents); |
2956 |
++ } |
2957 |
+ } |
2958 |
+ truncate_inode_pages_final(&inode->i_data); |
2959 |
+ invalidate_inode_buffers(inode); |
2960 |
+ clear_inode(inode); |
2961 |
+- if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && |
2962 |
+- inode->i_size != iinfo->i_lenExtents) { |
2963 |
+- udf_warn(inode->i_sb, "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n", |
2964 |
+- inode->i_ino, inode->i_mode, |
2965 |
+- (unsigned long long)inode->i_size, |
2966 |
+- (unsigned long long)iinfo->i_lenExtents); |
2967 |
+- } |
2968 |
+ kfree(iinfo->i_ext.i_data); |
2969 |
+ iinfo->i_ext.i_data = NULL; |
2970 |
+ udf_clear_extent_cache(inode); |
2971 |
+diff --git a/fs/udf/super.c b/fs/udf/super.c |
2972 |
+index 1676a175cd7a8..caeb01ca039b7 100644 |
2973 |
+--- a/fs/udf/super.c |
2974 |
++++ b/fs/udf/super.c |
2975 |
+@@ -1349,6 +1349,12 @@ static int udf_load_sparable_map(struct super_block *sb, |
2976 |
+ (int)spm->numSparingTables); |
2977 |
+ return -EIO; |
2978 |
+ } |
2979 |
++ if (le32_to_cpu(spm->sizeSparingTable) > sb->s_blocksize) { |
2980 |
++ udf_err(sb, "error loading logical volume descriptor: " |
2981 |
++ "Too big sparing table size (%u)\n", |
2982 |
++ le32_to_cpu(spm->sizeSparingTable)); |
2983 |
++ return -EIO; |
2984 |
++ } |
2985 |
+ |
2986 |
+ for (i = 0; i < spm->numSparingTables; i++) { |
2987 |
+ loc = le32_to_cpu(spm->locSparingTable[i]); |
2988 |
+diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c |
2989 |
+index 484eb0adcefb2..08da48b662358 100644 |
2990 |
+--- a/fs/xfs/xfs_rtalloc.c |
2991 |
++++ b/fs/xfs/xfs_rtalloc.c |
2992 |
+@@ -245,6 +245,9 @@ xfs_rtallocate_extent_block( |
2993 |
+ end = XFS_BLOCKTOBIT(mp, bbno + 1) - 1; |
2994 |
+ i <= end; |
2995 |
+ i++) { |
2996 |
++ /* Make sure we don't scan off the end of the rt volume. */ |
2997 |
++ maxlen = min(mp->m_sb.sb_rextents, i + maxlen) - i; |
2998 |
++ |
2999 |
+ /* |
3000 |
+ * See if there's a free extent of maxlen starting at i. |
3001 |
+ * If it's not so then next will contain the first non-free. |
3002 |
+@@ -440,6 +443,14 @@ xfs_rtallocate_extent_near( |
3003 |
+ */ |
3004 |
+ if (bno >= mp->m_sb.sb_rextents) |
3005 |
+ bno = mp->m_sb.sb_rextents - 1; |
3006 |
++ |
3007 |
++ /* Make sure we don't run off the end of the rt volume. */ |
3008 |
++ maxlen = min(mp->m_sb.sb_rextents, bno + maxlen) - bno; |
3009 |
++ if (maxlen < minlen) { |
3010 |
++ *rtblock = NULLRTBLOCK; |
3011 |
++ return 0; |
3012 |
++ } |
3013 |
++ |
3014 |
+ /* |
3015 |
+ * Try the exact allocation first. |
3016 |
+ */ |
3017 |
+diff --git a/include/linux/overflow.h b/include/linux/overflow.h |
3018 |
+index 15eb85de92269..4564a175e6814 100644 |
3019 |
+--- a/include/linux/overflow.h |
3020 |
++++ b/include/linux/overflow.h |
3021 |
+@@ -3,6 +3,7 @@ |
3022 |
+ #define __LINUX_OVERFLOW_H |
3023 |
+ |
3024 |
+ #include <linux/compiler.h> |
3025 |
++#include <linux/limits.h> |
3026 |
+ |
3027 |
+ /* |
3028 |
+ * In the fallback code below, we need to compute the minimum and |
3029 |
+diff --git a/include/scsi/scsi_common.h b/include/scsi/scsi_common.h |
3030 |
+index 731ac09ed2313..5b567b43e1b16 100644 |
3031 |
+--- a/include/scsi/scsi_common.h |
3032 |
++++ b/include/scsi/scsi_common.h |
3033 |
+@@ -25,6 +25,13 @@ scsi_command_size(const unsigned char *cmnd) |
3034 |
+ scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]); |
3035 |
+ } |
3036 |
+ |
3037 |
++static inline unsigned char |
3038 |
++scsi_command_control(const unsigned char *cmnd) |
3039 |
++{ |
3040 |
++ return (cmnd[0] == VARIABLE_LENGTH_CMD) ? |
3041 |
++ cmnd[1] : cmnd[COMMAND_SIZE(cmnd[0]) - 1]; |
3042 |
++} |
3043 |
++ |
3044 |
+ /* Returns a human-readable name for the device */ |
3045 |
+ extern const char *scsi_device_type(unsigned type); |
3046 |
+ |
3047 |
+diff --git a/include/trace/events/target.h b/include/trace/events/target.h |
3048 |
+index 914a872dd3435..e87a3716b0ac9 100644 |
3049 |
+--- a/include/trace/events/target.h |
3050 |
++++ b/include/trace/events/target.h |
3051 |
+@@ -140,6 +140,7 @@ TRACE_EVENT(target_sequencer_start, |
3052 |
+ __field( unsigned int, opcode ) |
3053 |
+ __field( unsigned int, data_length ) |
3054 |
+ __field( unsigned int, task_attribute ) |
3055 |
++ __field( unsigned char, control ) |
3056 |
+ __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE ) |
3057 |
+ __string( initiator, cmd->se_sess->se_node_acl->initiatorname ) |
3058 |
+ ), |
3059 |
+@@ -149,6 +150,7 @@ TRACE_EVENT(target_sequencer_start, |
3060 |
+ __entry->opcode = cmd->t_task_cdb[0]; |
3061 |
+ __entry->data_length = cmd->data_length; |
3062 |
+ __entry->task_attribute = cmd->sam_task_attr; |
3063 |
++ __entry->control = scsi_command_control(cmd->t_task_cdb); |
3064 |
+ memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE); |
3065 |
+ __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname); |
3066 |
+ ), |
3067 |
+@@ -158,9 +160,7 @@ TRACE_EVENT(target_sequencer_start, |
3068 |
+ show_opcode_name(__entry->opcode), |
3069 |
+ __entry->data_length, __print_hex(__entry->cdb, 16), |
3070 |
+ show_task_attribute_name(__entry->task_attribute), |
3071 |
+- scsi_command_size(__entry->cdb) <= 16 ? |
3072 |
+- __entry->cdb[scsi_command_size(__entry->cdb) - 1] : |
3073 |
+- __entry->cdb[1] |
3074 |
++ __entry->control |
3075 |
+ ) |
3076 |
+ ); |
3077 |
+ |
3078 |
+@@ -175,6 +175,7 @@ TRACE_EVENT(target_cmd_complete, |
3079 |
+ __field( unsigned int, opcode ) |
3080 |
+ __field( unsigned int, data_length ) |
3081 |
+ __field( unsigned int, task_attribute ) |
3082 |
++ __field( unsigned char, control ) |
3083 |
+ __field( unsigned char, scsi_status ) |
3084 |
+ __field( unsigned char, sense_length ) |
3085 |
+ __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE ) |
3086 |
+@@ -187,6 +188,7 @@ TRACE_EVENT(target_cmd_complete, |
3087 |
+ __entry->opcode = cmd->t_task_cdb[0]; |
3088 |
+ __entry->data_length = cmd->data_length; |
3089 |
+ __entry->task_attribute = cmd->sam_task_attr; |
3090 |
++ __entry->control = scsi_command_control(cmd->t_task_cdb); |
3091 |
+ __entry->scsi_status = cmd->scsi_status; |
3092 |
+ __entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ? |
3093 |
+ min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0; |
3094 |
+@@ -203,9 +205,7 @@ TRACE_EVENT(target_cmd_complete, |
3095 |
+ show_opcode_name(__entry->opcode), |
3096 |
+ __entry->data_length, __print_hex(__entry->cdb, 16), |
3097 |
+ show_task_attribute_name(__entry->task_attribute), |
3098 |
+- scsi_command_size(__entry->cdb) <= 16 ? |
3099 |
+- __entry->cdb[scsi_command_size(__entry->cdb) - 1] : |
3100 |
+- __entry->cdb[1] |
3101 |
++ __entry->control |
3102 |
+ ) |
3103 |
+ ); |
3104 |
+ |
3105 |
+diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h |
3106 |
+index f35eb72739c09..5fb4cdf37100c 100644 |
3107 |
+--- a/include/uapi/linux/perf_event.h |
3108 |
++++ b/include/uapi/linux/perf_event.h |
3109 |
+@@ -1079,7 +1079,7 @@ union perf_mem_data_src { |
3110 |
+ |
3111 |
+ #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ |
3112 |
+ /* 1 free */ |
3113 |
+-#define PERF_MEM_SNOOPX_SHIFT 37 |
3114 |
++#define PERF_MEM_SNOOPX_SHIFT 38 |
3115 |
+ |
3116 |
+ /* locked instruction */ |
3117 |
+ #define PERF_MEM_LOCK_NA 0x01 /* not available */ |
3118 |
+diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c |
3119 |
+index 6a4b41484afe6..b45576ca3b0da 100644 |
3120 |
+--- a/kernel/debug/kdb/kdb_io.c |
3121 |
++++ b/kernel/debug/kdb/kdb_io.c |
3122 |
+@@ -679,12 +679,16 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap) |
3123 |
+ size_avail = sizeof(kdb_buffer) - len; |
3124 |
+ goto kdb_print_out; |
3125 |
+ } |
3126 |
+- if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) |
3127 |
++ if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) { |
3128 |
+ /* |
3129 |
+ * This was a interactive search (using '/' at more |
3130 |
+- * prompt) and it has completed. Clear the flag. |
3131 |
++ * prompt) and it has completed. Replace the \0 with |
3132 |
++ * its original value to ensure multi-line strings |
3133 |
++ * are handled properly, and return to normal mode. |
3134 |
+ */ |
3135 |
++ *cphold = replaced_byte; |
3136 |
+ kdb_grepping_flag = 0; |
3137 |
++ } |
3138 |
+ /* |
3139 |
+ * at this point the string is a full line and |
3140 |
+ * should be printed, up to the null. |
3141 |
+diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c |
3142 |
+index 537a2a3c1dea2..28db51274ed0e 100644 |
3143 |
+--- a/kernel/power/hibernate.c |
3144 |
++++ b/kernel/power/hibernate.c |
3145 |
+@@ -842,17 +842,6 @@ static int software_resume(void) |
3146 |
+ |
3147 |
+ /* Check if the device is there */ |
3148 |
+ swsusp_resume_device = name_to_dev_t(resume_file); |
3149 |
+- |
3150 |
+- /* |
3151 |
+- * name_to_dev_t is ineffective to verify parition if resume_file is in |
3152 |
+- * integer format. (e.g. major:minor) |
3153 |
+- */ |
3154 |
+- if (isdigit(resume_file[0]) && resume_wait) { |
3155 |
+- int partno; |
3156 |
+- while (!get_gendisk(swsusp_resume_device, &partno)) |
3157 |
+- msleep(10); |
3158 |
+- } |
3159 |
+- |
3160 |
+ if (!swsusp_resume_device) { |
3161 |
+ /* |
3162 |
+ * Some device discovery might still be in progress; we need |
3163 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
3164 |
+index faef74f632620..b166320f7633e 100644 |
3165 |
+--- a/kernel/sched/core.c |
3166 |
++++ b/kernel/sched/core.c |
3167 |
+@@ -24,7 +24,7 @@ |
3168 |
+ |
3169 |
+ DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); |
3170 |
+ |
3171 |
+-#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
3172 |
++#ifdef CONFIG_SCHED_DEBUG |
3173 |
+ /* |
3174 |
+ * Debugging: various feature bits |
3175 |
+ * |
3176 |
+diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
3177 |
+index 5f0eb4565957f..41b7954be68b7 100644 |
3178 |
+--- a/kernel/sched/sched.h |
3179 |
++++ b/kernel/sched/sched.h |
3180 |
+@@ -1361,7 +1361,7 @@ enum { |
3181 |
+ |
3182 |
+ #undef SCHED_FEAT |
3183 |
+ |
3184 |
+-#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) |
3185 |
++#ifdef CONFIG_SCHED_DEBUG |
3186 |
+ |
3187 |
+ /* |
3188 |
+ * To support run-time toggling of sched features, all the translation units |
3189 |
+@@ -1369,6 +1369,7 @@ enum { |
3190 |
+ */ |
3191 |
+ extern const_debug unsigned int sysctl_sched_features; |
3192 |
+ |
3193 |
++#ifdef CONFIG_JUMP_LABEL |
3194 |
+ #define SCHED_FEAT(name, enabled) \ |
3195 |
+ static __always_inline bool static_branch_##name(struct static_key *key) \ |
3196 |
+ { \ |
3197 |
+@@ -1381,7 +1382,13 @@ static __always_inline bool static_branch_##name(struct static_key *key) \ |
3198 |
+ extern struct static_key sched_feat_keys[__SCHED_FEAT_NR]; |
3199 |
+ #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) |
3200 |
+ |
3201 |
+-#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ |
3202 |
++#else /* !CONFIG_JUMP_LABEL */ |
3203 |
++ |
3204 |
++#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) |
3205 |
++ |
3206 |
++#endif /* CONFIG_JUMP_LABEL */ |
3207 |
++ |
3208 |
++#else /* !SCHED_DEBUG */ |
3209 |
+ |
3210 |
+ /* |
3211 |
+ * Each translation unit has its own copy of sysctl_sched_features to allow |
3212 |
+@@ -1397,7 +1404,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features = |
3213 |
+ |
3214 |
+ #define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) |
3215 |
+ |
3216 |
+-#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ |
3217 |
++#endif /* SCHED_DEBUG */ |
3218 |
+ |
3219 |
+ extern struct static_key_false sched_numa_balancing; |
3220 |
+ extern struct static_key_false sched_schedstats; |
3221 |
+diff --git a/lib/crc32.c b/lib/crc32.c |
3222 |
+index a6c9afafc8c85..1a5d08470044e 100644 |
3223 |
+--- a/lib/crc32.c |
3224 |
++++ b/lib/crc32.c |
3225 |
+@@ -328,7 +328,7 @@ static inline u32 __pure crc32_be_generic(u32 crc, unsigned char const *p, |
3226 |
+ return crc; |
3227 |
+ } |
3228 |
+ |
3229 |
+-#if CRC_LE_BITS == 1 |
3230 |
++#if CRC_BE_BITS == 1 |
3231 |
+ u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) |
3232 |
+ { |
3233 |
+ return crc32_be_generic(crc, p, len, NULL, CRC32_POLY_BE); |
3234 |
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c |
3235 |
+index 2a85dc3be8bf3..198a1fdd6709e 100644 |
3236 |
+--- a/net/bluetooth/l2cap_sock.c |
3237 |
++++ b/net/bluetooth/l2cap_sock.c |
3238 |
+@@ -1341,8 +1341,6 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err) |
3239 |
+ |
3240 |
+ parent = bt_sk(sk)->parent; |
3241 |
+ |
3242 |
+- sock_set_flag(sk, SOCK_ZAPPED); |
3243 |
+- |
3244 |
+ switch (chan->state) { |
3245 |
+ case BT_OPEN: |
3246 |
+ case BT_BOUND: |
3247 |
+@@ -1369,8 +1367,11 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err) |
3248 |
+ |
3249 |
+ break; |
3250 |
+ } |
3251 |
+- |
3252 |
+ release_sock(sk); |
3253 |
++ |
3254 |
++ /* Only zap after cleanup to avoid use after free race */ |
3255 |
++ sock_set_flag(sk, SOCK_ZAPPED); |
3256 |
++ |
3257 |
+ } |
3258 |
+ |
3259 |
+ static void l2cap_sock_state_change_cb(struct l2cap_chan *chan, int state, |
3260 |
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
3261 |
+index ffcb5983107db..de6f89511a216 100644 |
3262 |
+--- a/net/ipv4/ip_gre.c |
3263 |
++++ b/net/ipv4/ip_gre.c |
3264 |
+@@ -680,9 +680,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, |
3265 |
+ } |
3266 |
+ |
3267 |
+ if (dev->header_ops) { |
3268 |
+- /* Need space for new headers */ |
3269 |
+- if (skb_cow_head(skb, dev->needed_headroom - |
3270 |
+- (tunnel->hlen + sizeof(struct iphdr)))) |
3271 |
++ if (skb_cow_head(skb, 0)) |
3272 |
+ goto free_skb; |
3273 |
+ |
3274 |
+ tnl_params = (const struct iphdr *)skb->data; |
3275 |
+@@ -800,7 +798,11 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) |
3276 |
+ len = tunnel->tun_hlen - len; |
3277 |
+ tunnel->hlen = tunnel->hlen + len; |
3278 |
+ |
3279 |
+- dev->needed_headroom = dev->needed_headroom + len; |
3280 |
++ if (dev->header_ops) |
3281 |
++ dev->hard_header_len += len; |
3282 |
++ else |
3283 |
++ dev->needed_headroom += len; |
3284 |
++ |
3285 |
+ if (set_mtu) |
3286 |
+ dev->mtu = max_t(int, dev->mtu - len, 68); |
3287 |
+ |
3288 |
+@@ -1003,6 +1005,7 @@ static void __gre_tunnel_init(struct net_device *dev) |
3289 |
+ tunnel->parms.iph.protocol = IPPROTO_GRE; |
3290 |
+ |
3291 |
+ tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; |
3292 |
++ dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph); |
3293 |
+ |
3294 |
+ dev->features |= GRE_FEATURES; |
3295 |
+ dev->hw_features |= GRE_FEATURES; |
3296 |
+@@ -1046,10 +1049,14 @@ static int ipgre_tunnel_init(struct net_device *dev) |
3297 |
+ return -EINVAL; |
3298 |
+ dev->flags = IFF_BROADCAST; |
3299 |
+ dev->header_ops = &ipgre_header_ops; |
3300 |
++ dev->hard_header_len = tunnel->hlen + sizeof(*iph); |
3301 |
++ dev->needed_headroom = 0; |
3302 |
+ } |
3303 |
+ #endif |
3304 |
+ } else if (!tunnel->collect_md) { |
3305 |
+ dev->header_ops = &ipgre_header_ops; |
3306 |
++ dev->hard_header_len = tunnel->hlen + sizeof(*iph); |
3307 |
++ dev->needed_headroom = 0; |
3308 |
+ } |
3309 |
+ |
3310 |
+ return ip_tunnel_init(dev); |
3311 |
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
3312 |
+index b6670e74aeb7b..9926455dd546d 100644 |
3313 |
+--- a/net/mac80211/cfg.c |
3314 |
++++ b/net/mac80211/cfg.c |
3315 |
+@@ -664,7 +664,8 @@ void sta_set_rate_info_tx(struct sta_info *sta, |
3316 |
+ u16 brate; |
3317 |
+ |
3318 |
+ sband = ieee80211_get_sband(sta->sdata); |
3319 |
+- if (sband) { |
3320 |
++ WARN_ON_ONCE(sband && !sband->bitrates); |
3321 |
++ if (sband && sband->bitrates) { |
3322 |
+ brate = sband->bitrates[rate->idx].bitrate; |
3323 |
+ rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); |
3324 |
+ } |
3325 |
+diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
3326 |
+index 2a82d438991b5..9968b8a976f19 100644 |
3327 |
+--- a/net/mac80211/sta_info.c |
3328 |
++++ b/net/mac80211/sta_info.c |
3329 |
+@@ -2009,6 +2009,10 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate, |
3330 |
+ int rate_idx = STA_STATS_GET(LEGACY_IDX, rate); |
3331 |
+ |
3332 |
+ sband = local->hw.wiphy->bands[band]; |
3333 |
++ |
3334 |
++ if (WARN_ON_ONCE(!sband->bitrates)) |
3335 |
++ break; |
3336 |
++ |
3337 |
+ brate = sband->bitrates[rate_idx].bitrate; |
3338 |
+ if (rinfo->bw == RATE_INFO_BW_5) |
3339 |
+ shift = 2; |
3340 |
+diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
3341 |
+index c339b5e386b78..3ad1de081e3c7 100644 |
3342 |
+--- a/net/netfilter/ipvs/ip_vs_ctl.c |
3343 |
++++ b/net/netfilter/ipvs/ip_vs_ctl.c |
3344 |
+@@ -2393,6 +2393,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) |
3345 |
+ /* Set timeout values for (tcp tcpfin udp) */ |
3346 |
+ ret = ip_vs_set_timeout(ipvs, (struct ip_vs_timeout_user *)arg); |
3347 |
+ goto out_unlock; |
3348 |
++ } else if (!len) { |
3349 |
++ /* No more commands with len == 0 below */ |
3350 |
++ ret = -EINVAL; |
3351 |
++ goto out_unlock; |
3352 |
+ } |
3353 |
+ |
3354 |
+ usvc_compat = (struct ip_vs_service_user *)arg; |
3355 |
+@@ -2469,9 +2473,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) |
3356 |
+ break; |
3357 |
+ case IP_VS_SO_SET_DELDEST: |
3358 |
+ ret = ip_vs_del_dest(svc, &udest); |
3359 |
+- break; |
3360 |
+- default: |
3361 |
+- ret = -EINVAL; |
3362 |
+ } |
3363 |
+ |
3364 |
+ out_unlock: |
3365 |
+diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c |
3366 |
+index 7011ab27c4371..40f8a1252394b 100644 |
3367 |
+--- a/net/netfilter/nf_conntrack_proto_tcp.c |
3368 |
++++ b/net/netfilter/nf_conntrack_proto_tcp.c |
3369 |
+@@ -549,13 +549,20 @@ static bool tcp_in_window(const struct nf_conn *ct, |
3370 |
+ swin = win << sender->td_scale; |
3371 |
+ sender->td_maxwin = (swin == 0 ? 1 : swin); |
3372 |
+ sender->td_maxend = end + sender->td_maxwin; |
3373 |
+- /* |
3374 |
+- * We haven't seen traffic in the other direction yet |
3375 |
+- * but we have to tweak window tracking to pass III |
3376 |
+- * and IV until that happens. |
3377 |
+- */ |
3378 |
+- if (receiver->td_maxwin == 0) |
3379 |
++ if (receiver->td_maxwin == 0) { |
3380 |
++ /* We haven't seen traffic in the other |
3381 |
++ * direction yet but we have to tweak window |
3382 |
++ * tracking to pass III and IV until that |
3383 |
++ * happens. |
3384 |
++ */ |
3385 |
+ receiver->td_end = receiver->td_maxend = sack; |
3386 |
++ } else if (sack == receiver->td_end + 1) { |
3387 |
++ /* Likely a reply to a keepalive. |
3388 |
++ * Needed for III. |
3389 |
++ */ |
3390 |
++ receiver->td_end++; |
3391 |
++ } |
3392 |
++ |
3393 |
+ } |
3394 |
+ } else if (((state->state == TCP_CONNTRACK_SYN_SENT |
3395 |
+ && dir == IP_CT_DIR_ORIGINAL) |
3396 |
+diff --git a/net/netfilter/nf_dup_netdev.c b/net/netfilter/nf_dup_netdev.c |
3397 |
+index f4a566e672135..98d117f3340ce 100644 |
3398 |
+--- a/net/netfilter/nf_dup_netdev.c |
3399 |
++++ b/net/netfilter/nf_dup_netdev.c |
3400 |
+@@ -21,6 +21,7 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev) |
3401 |
+ skb_push(skb, skb->mac_len); |
3402 |
+ |
3403 |
+ skb->dev = dev; |
3404 |
++ skb->tstamp = 0; |
3405 |
+ dev_queue_xmit(skb); |
3406 |
+ } |
3407 |
+ |
3408 |
+diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c |
3409 |
+index 649edbe77a205..10a12e0949299 100644 |
3410 |
+--- a/net/netfilter/nft_fwd_netdev.c |
3411 |
++++ b/net/netfilter/nft_fwd_netdev.c |
3412 |
+@@ -129,6 +129,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr, |
3413 |
+ return; |
3414 |
+ |
3415 |
+ skb->dev = dev; |
3416 |
++ skb->tstamp = 0; |
3417 |
+ neigh_xmit(neigh_table, dev, addr, skb); |
3418 |
+ out: |
3419 |
+ regs->verdict.code = verdict; |
3420 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
3421 |
+index 68259eec6afd1..ab086081be9c7 100644 |
3422 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
3423 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
3424 |
+@@ -1079,9 +1079,9 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp, |
3425 |
+ struct gssp_in_token *in_token) |
3426 |
+ { |
3427 |
+ struct kvec *argv = &rqstp->rq_arg.head[0]; |
3428 |
+- unsigned int page_base, length; |
3429 |
+- int pages, i, res; |
3430 |
+- size_t inlen; |
3431 |
++ unsigned int length, pgto_offs, pgfrom_offs; |
3432 |
++ int pages, i, res, pgto, pgfrom; |
3433 |
++ size_t inlen, to_offs, from_offs; |
3434 |
+ |
3435 |
+ res = gss_read_common_verf(gc, argv, authp, in_handle); |
3436 |
+ if (res) |
3437 |
+@@ -1109,17 +1109,24 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp, |
3438 |
+ memcpy(page_address(in_token->pages[0]), argv->iov_base, length); |
3439 |
+ inlen -= length; |
3440 |
+ |
3441 |
+- i = 1; |
3442 |
+- page_base = rqstp->rq_arg.page_base; |
3443 |
++ to_offs = length; |
3444 |
++ from_offs = rqstp->rq_arg.page_base; |
3445 |
+ while (inlen) { |
3446 |
+- length = min_t(unsigned int, inlen, PAGE_SIZE); |
3447 |
+- memcpy(page_address(in_token->pages[i]), |
3448 |
+- page_address(rqstp->rq_arg.pages[i]) + page_base, |
3449 |
++ pgto = to_offs >> PAGE_SHIFT; |
3450 |
++ pgfrom = from_offs >> PAGE_SHIFT; |
3451 |
++ pgto_offs = to_offs & ~PAGE_MASK; |
3452 |
++ pgfrom_offs = from_offs & ~PAGE_MASK; |
3453 |
++ |
3454 |
++ length = min_t(unsigned int, inlen, |
3455 |
++ min_t(unsigned int, PAGE_SIZE - pgto_offs, |
3456 |
++ PAGE_SIZE - pgfrom_offs)); |
3457 |
++ memcpy(page_address(in_token->pages[pgto]) + pgto_offs, |
3458 |
++ page_address(rqstp->rq_arg.pages[pgfrom]) + pgfrom_offs, |
3459 |
+ length); |
3460 |
+ |
3461 |
++ to_offs += length; |
3462 |
++ from_offs += length; |
3463 |
+ inlen -= length; |
3464 |
+- page_base = 0; |
3465 |
+- i++; |
3466 |
+ } |
3467 |
+ return 0; |
3468 |
+ } |
3469 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3470 |
+index aa4d19a780d78..4062cd624b26f 100644 |
3471 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3472 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3473 |
+@@ -639,10 +639,11 @@ static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma, |
3474 |
+ while (remaining) { |
3475 |
+ len = min_t(u32, PAGE_SIZE - pageoff, remaining); |
3476 |
+ |
3477 |
+- memcpy(dst, page_address(*ppages), len); |
3478 |
++ memcpy(dst, page_address(*ppages) + pageoff, len); |
3479 |
+ remaining -= len; |
3480 |
+ dst += len; |
3481 |
+ pageoff = 0; |
3482 |
++ ppages++; |
3483 |
+ } |
3484 |
+ } |
3485 |
+ |
3486 |
+diff --git a/samples/mic/mpssd/mpssd.c b/samples/mic/mpssd/mpssd.c |
3487 |
+index f42ce551bb48f..a50d27473e125 100644 |
3488 |
+--- a/samples/mic/mpssd/mpssd.c |
3489 |
++++ b/samples/mic/mpssd/mpssd.c |
3490 |
+@@ -414,9 +414,9 @@ mic_virtio_copy(struct mic_info *mic, int fd, |
3491 |
+ |
3492 |
+ static inline unsigned _vring_size(unsigned int num, unsigned long align) |
3493 |
+ { |
3494 |
+- return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num) |
3495 |
++ return _ALIGN_UP(((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num) |
3496 |
+ + align - 1) & ~(align - 1)) |
3497 |
+- + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num; |
3498 |
++ + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num, 4); |
3499 |
+ } |
3500 |
+ |
3501 |
+ /* |
3502 |
+diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c |
3503 |
+index ff2c41ea94c8c..2434a0014491f 100644 |
3504 |
+--- a/tools/perf/util/intel-pt.c |
3505 |
++++ b/tools/perf/util/intel-pt.c |
3506 |
+@@ -876,6 +876,8 @@ static void intel_pt_set_pid_tid_cpu(struct intel_pt *pt, |
3507 |
+ |
3508 |
+ if (queue->tid == -1 || pt->have_sched_switch) { |
3509 |
+ ptq->tid = machine__get_current_tid(pt->machine, ptq->cpu); |
3510 |
++ if (ptq->tid == -1) |
3511 |
++ ptq->pid = -1; |
3512 |
+ thread__zput(ptq->thread); |
3513 |
+ } |
3514 |
+ |
3515 |
+@@ -1915,10 +1917,8 @@ static int intel_pt_context_switch(struct intel_pt *pt, union perf_event *event, |
3516 |
+ tid = sample->tid; |
3517 |
+ } |
3518 |
+ |
3519 |
+- if (tid == -1) { |
3520 |
+- pr_err("context_switch event has no tid\n"); |
3521 |
+- return -EINVAL; |
3522 |
+- } |
3523 |
++ if (tid == -1) |
3524 |
++ intel_pt_log("context_switch event has no tid\n"); |
3525 |
+ |
3526 |
+ intel_pt_log("context_switch: cpu %d pid %d tid %d time %"PRIu64" tsc %#"PRIx64"\n", |
3527 |
+ cpu, pid, tid, sample->time, perf_time_to_tsc(sample->time, |