Contents of /trunk/kernel-alx/patches-5.4/0239-5.4.140-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (19 months ago) by niro
File size: 94325 byte(s)
Mon Oct 24 12:40:44 2022 UTC (19 months ago) by niro
File size: 94325 byte(s)
-add missing
1 | diff --git a/Makefile b/Makefile |
2 | index 1174536034b38..1cb8f72d4dcea 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 139 |
10 | +SUBLEVEL = 140 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c |
15 | index 5f90df30be20a..06fd42417aa96 100644 |
16 | --- a/arch/alpha/kernel/smp.c |
17 | +++ b/arch/alpha/kernel/smp.c |
18 | @@ -585,7 +585,7 @@ void |
19 | smp_send_stop(void) |
20 | { |
21 | cpumask_t to_whom; |
22 | - cpumask_copy(&to_whom, cpu_possible_mask); |
23 | + cpumask_copy(&to_whom, cpu_online_mask); |
24 | cpumask_clear_cpu(smp_processor_id(), &to_whom); |
25 | #ifdef DEBUG_IPI_MSG |
26 | if (hard_smp_processor_id() != boot_cpu_id) |
27 | diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi |
28 | index 6c2949991e297..64fdd5079d49b 100644 |
29 | --- a/arch/arm/boot/dts/am437x-l4.dtsi |
30 | +++ b/arch/arm/boot/dts/am437x-l4.dtsi |
31 | @@ -1611,7 +1611,7 @@ |
32 | compatible = "ti,am4372-d_can", "ti,am3352-d_can"; |
33 | reg = <0x0 0x2000>; |
34 | clocks = <&dcan1_fck>; |
35 | - clock-name = "fck"; |
36 | + clock-names = "fck"; |
37 | syscon-raminit = <&scm_conf 0x644 1>; |
38 | interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; |
39 | status = "disabled"; |
40 | diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts |
41 | index 719ed5ca454af..64faf5b46d92f 100644 |
42 | --- a/arch/arm/boot/dts/imx53-m53menlo.dts |
43 | +++ b/arch/arm/boot/dts/imx53-m53menlo.dts |
44 | @@ -388,13 +388,13 @@ |
45 | |
46 | pinctrl_power_button: powerbutgrp { |
47 | fsl,pins = < |
48 | - MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4 |
49 | + MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4 |
50 | >; |
51 | }; |
52 | |
53 | pinctrl_power_out: poweroutgrp { |
54 | fsl,pins = < |
55 | - MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4 |
56 | + MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4 |
57 | >; |
58 | }; |
59 | |
60 | diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi |
61 | index 6d7f6b9035bc1..f2649241167ec 100644 |
62 | --- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi |
63 | +++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi |
64 | @@ -54,7 +54,13 @@ |
65 | pinctrl-names = "default"; |
66 | pinctrl-0 = <&pinctrl_microsom_enet_ar8035>; |
67 | phy-mode = "rgmii-id"; |
68 | - phy-reset-duration = <2>; |
69 | + |
70 | + /* |
71 | + * The PHY seems to require a long-enough reset duration to avoid |
72 | + * some rare issues where the PHY gets stuck in an inconsistent and |
73 | + * non-functional state at boot-up. 10ms proved to be fine . |
74 | + */ |
75 | + phy-reset-duration = <10>; |
76 | phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; |
77 | status = "okay"; |
78 | }; |
79 | diff --git a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi |
80 | index 038d8c90f6dfe..621396884c318 100644 |
81 | --- a/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi |
82 | +++ b/arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi |
83 | @@ -43,6 +43,7 @@ |
84 | assigned-clock-rates = <0>, <198000000>; |
85 | cap-power-off-card; |
86 | keep-power-in-suspend; |
87 | + max-frequency = <25000000>; |
88 | mmc-pwrseq = <&wifi_pwrseq>; |
89 | no-1-8-v; |
90 | non-removable; |
91 | diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi |
92 | index 68ac04641bdb1..c7bf68c90ea8f 100644 |
93 | --- a/arch/arm/boot/dts/omap5-board-common.dtsi |
94 | +++ b/arch/arm/boot/dts/omap5-board-common.dtsi |
95 | @@ -30,14 +30,6 @@ |
96 | regulator-max-microvolt = <5000000>; |
97 | }; |
98 | |
99 | - vdds_1v8_main: fixedregulator-vdds_1v8_main { |
100 | - compatible = "regulator-fixed"; |
101 | - regulator-name = "vdds_1v8_main"; |
102 | - vin-supply = <&smps7_reg>; |
103 | - regulator-min-microvolt = <1800000>; |
104 | - regulator-max-microvolt = <1800000>; |
105 | - }; |
106 | - |
107 | vmmcsd_fixed: fixedregulator-mmcsd { |
108 | compatible = "regulator-fixed"; |
109 | regulator-name = "vmmcsd_fixed"; |
110 | @@ -487,6 +479,7 @@ |
111 | regulator-boot-on; |
112 | }; |
113 | |
114 | + vdds_1v8_main: |
115 | smps7_reg: smps7 { |
116 | /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ |
117 | regulator-name = "smps7"; |
118 | diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c |
119 | index 0dfd0ae7a63dd..af12668d0bf51 100644 |
120 | --- a/arch/arm/mach-imx/mmdc.c |
121 | +++ b/arch/arm/mach-imx/mmdc.c |
122 | @@ -103,6 +103,7 @@ struct mmdc_pmu { |
123 | struct perf_event *mmdc_events[MMDC_NUM_COUNTERS]; |
124 | struct hlist_node node; |
125 | struct fsl_mmdc_devtype_data *devtype_data; |
126 | + struct clk *mmdc_ipg_clk; |
127 | }; |
128 | |
129 | /* |
130 | @@ -462,11 +463,14 @@ static int imx_mmdc_remove(struct platform_device *pdev) |
131 | |
132 | cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); |
133 | perf_pmu_unregister(&pmu_mmdc->pmu); |
134 | + iounmap(pmu_mmdc->mmdc_base); |
135 | + clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk); |
136 | kfree(pmu_mmdc); |
137 | return 0; |
138 | } |
139 | |
140 | -static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base) |
141 | +static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base, |
142 | + struct clk *mmdc_ipg_clk) |
143 | { |
144 | struct mmdc_pmu *pmu_mmdc; |
145 | char *name; |
146 | @@ -494,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b |
147 | } |
148 | |
149 | mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev); |
150 | + pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk; |
151 | if (mmdc_num == 0) |
152 | name = "mmdc"; |
153 | else |
154 | @@ -529,7 +534,7 @@ pmu_free: |
155 | |
156 | #else |
157 | #define imx_mmdc_remove NULL |
158 | -#define imx_mmdc_perf_init(pdev, mmdc_base) 0 |
159 | +#define imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk) 0 |
160 | #endif |
161 | |
162 | static int imx_mmdc_probe(struct platform_device *pdev) |
163 | @@ -567,7 +572,13 @@ static int imx_mmdc_probe(struct platform_device *pdev) |
164 | val &= ~(1 << BP_MMDC_MAPSR_PSD); |
165 | writel_relaxed(val, reg); |
166 | |
167 | - return imx_mmdc_perf_init(pdev, mmdc_base); |
168 | + err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk); |
169 | + if (err) { |
170 | + iounmap(mmdc_base); |
171 | + clk_disable_unprepare(mmdc_ipg_clk); |
172 | + } |
173 | + |
174 | + return err; |
175 | } |
176 | |
177 | int imx_mmdc_get_ddr_type(void) |
178 | diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
179 | index 5a2a188debd1d..5716ac20bddd1 100644 |
180 | --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
181 | +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
182 | @@ -65,7 +65,7 @@ |
183 | }; |
184 | }; |
185 | |
186 | - sysclk: clock-sysclk { |
187 | + sysclk: sysclk { |
188 | compatible = "fixed-clock"; |
189 | #clock-cells = <0>; |
190 | clock-frequency = <100000000>; |
191 | diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
192 | index 874bc3954c8e6..025e02d23da9b 100644 |
193 | --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
194 | +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
195 | @@ -118,6 +118,7 @@ |
196 | pinctrl-names = "default"; |
197 | pinctrl-0 = <&i2c1_pins>; |
198 | clock-frequency = <100000>; |
199 | + /delete-property/ mrvl,i2c-fast-mode; |
200 | status = "okay"; |
201 | |
202 | rtc@6f { |
203 | diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h |
204 | index 9f0ec21d6327f..88d20f04c64a5 100644 |
205 | --- a/arch/arm64/include/asm/arch_timer.h |
206 | +++ b/arch/arm64/include/asm/arch_timer.h |
207 | @@ -165,25 +165,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) |
208 | isb(); |
209 | } |
210 | |
211 | -/* |
212 | - * Ensure that reads of the counter are treated the same as memory reads |
213 | - * for the purposes of ordering by subsequent memory barriers. |
214 | - * |
215 | - * This insanity brought to you by speculative system register reads, |
216 | - * out-of-order memory accesses, sequence locks and Thomas Gleixner. |
217 | - * |
218 | - * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html |
219 | - */ |
220 | -#define arch_counter_enforce_ordering(val) do { \ |
221 | - u64 tmp, _val = (val); \ |
222 | - \ |
223 | - asm volatile( \ |
224 | - " eor %0, %1, %1\n" \ |
225 | - " add %0, sp, %0\n" \ |
226 | - " ldr xzr, [%0]" \ |
227 | - : "=r" (tmp) : "r" (_val)); \ |
228 | -} while (0) |
229 | - |
230 | static __always_inline u64 __arch_counter_get_cntpct_stable(void) |
231 | { |
232 | u64 cnt; |
233 | @@ -224,8 +205,6 @@ static __always_inline u64 __arch_counter_get_cntvct(void) |
234 | return cnt; |
235 | } |
236 | |
237 | -#undef arch_counter_enforce_ordering |
238 | - |
239 | static inline int arch_timer_arch_init(void) |
240 | { |
241 | return 0; |
242 | diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h |
243 | index e0e2b1946f42b..0fcd854fc95f3 100644 |
244 | --- a/arch/arm64/include/asm/barrier.h |
245 | +++ b/arch/arm64/include/asm/barrier.h |
246 | @@ -57,6 +57,25 @@ static inline unsigned long array_index_mask_nospec(unsigned long idx, |
247 | return mask; |
248 | } |
249 | |
250 | +/* |
251 | + * Ensure that reads of the counter are treated the same as memory reads |
252 | + * for the purposes of ordering by subsequent memory barriers. |
253 | + * |
254 | + * This insanity brought to you by speculative system register reads, |
255 | + * out-of-order memory accesses, sequence locks and Thomas Gleixner. |
256 | + * |
257 | + * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html |
258 | + */ |
259 | +#define arch_counter_enforce_ordering(val) do { \ |
260 | + u64 tmp, _val = (val); \ |
261 | + \ |
262 | + asm volatile( \ |
263 | + " eor %0, %1, %1\n" \ |
264 | + " add %0, sp, %0\n" \ |
265 | + " ldr xzr, [%0]" \ |
266 | + : "=r" (tmp) : "r" (_val)); \ |
267 | +} while (0) |
268 | + |
269 | #define __smp_mb() dmb(ish) |
270 | #define __smp_rmb() dmb(ishld) |
271 | #define __smp_wmb() dmb(ishst) |
272 | diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h |
273 | index bf57308fcd635..92b2575b01918 100644 |
274 | --- a/arch/arm64/include/asm/ptrace.h |
275 | +++ b/arch/arm64/include/asm/ptrace.h |
276 | @@ -299,7 +299,17 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) |
277 | |
278 | static inline unsigned long regs_return_value(struct pt_regs *regs) |
279 | { |
280 | - return regs->regs[0]; |
281 | + unsigned long val = regs->regs[0]; |
282 | + |
283 | + /* |
284 | + * Audit currently uses regs_return_value() instead of |
285 | + * syscall_get_return_value(). Apply the same sign-extension here until |
286 | + * audit is updated to use syscall_get_return_value(). |
287 | + */ |
288 | + if (compat_user_mode(regs)) |
289 | + val = sign_extend64(val, 31); |
290 | + |
291 | + return val; |
292 | } |
293 | |
294 | static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) |
295 | diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h |
296 | index cfc0672013f67..03e20895453a7 100644 |
297 | --- a/arch/arm64/include/asm/syscall.h |
298 | +++ b/arch/arm64/include/asm/syscall.h |
299 | @@ -29,22 +29,23 @@ static inline void syscall_rollback(struct task_struct *task, |
300 | regs->regs[0] = regs->orig_x0; |
301 | } |
302 | |
303 | - |
304 | -static inline long syscall_get_error(struct task_struct *task, |
305 | - struct pt_regs *regs) |
306 | +static inline long syscall_get_return_value(struct task_struct *task, |
307 | + struct pt_regs *regs) |
308 | { |
309 | - unsigned long error = regs->regs[0]; |
310 | + unsigned long val = regs->regs[0]; |
311 | |
312 | if (is_compat_thread(task_thread_info(task))) |
313 | - error = sign_extend64(error, 31); |
314 | + val = sign_extend64(val, 31); |
315 | |
316 | - return IS_ERR_VALUE(error) ? error : 0; |
317 | + return val; |
318 | } |
319 | |
320 | -static inline long syscall_get_return_value(struct task_struct *task, |
321 | - struct pt_regs *regs) |
322 | +static inline long syscall_get_error(struct task_struct *task, |
323 | + struct pt_regs *regs) |
324 | { |
325 | - return regs->regs[0]; |
326 | + unsigned long error = syscall_get_return_value(task, regs); |
327 | + |
328 | + return IS_ERR_VALUE(error) ? error : 0; |
329 | } |
330 | |
331 | static inline void syscall_set_return_value(struct task_struct *task, |
332 | diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h |
333 | index ff83b8b574fc7..d7361faa42dea 100644 |
334 | --- a/arch/arm64/include/asm/vdso/gettimeofday.h |
335 | +++ b/arch/arm64/include/asm/vdso/gettimeofday.h |
336 | @@ -85,11 +85,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) |
337 | */ |
338 | isb(); |
339 | asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); |
340 | - /* |
341 | - * This isb() is required to prevent that the seq lock is |
342 | - * speculated.# |
343 | - */ |
344 | - isb(); |
345 | + arch_counter_enforce_ordering(res); |
346 | |
347 | return res; |
348 | } |
349 | diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c |
350 | index 0cfd685774891..8a95a013dfd3c 100644 |
351 | --- a/arch/arm64/kernel/ptrace.c |
352 | +++ b/arch/arm64/kernel/ptrace.c |
353 | @@ -1868,7 +1868,7 @@ void syscall_trace_exit(struct pt_regs *regs) |
354 | audit_syscall_exit(regs); |
355 | |
356 | if (flags & _TIF_SYSCALL_TRACEPOINT) |
357 | - trace_sys_exit(regs, regs_return_value(regs)); |
358 | + trace_sys_exit(regs, syscall_get_return_value(current, regs)); |
359 | |
360 | if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)) |
361 | tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT); |
362 | diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c |
363 | index ddb757b2c3e5b..f6d3278c1a4e0 100644 |
364 | --- a/arch/arm64/kernel/signal.c |
365 | +++ b/arch/arm64/kernel/signal.c |
366 | @@ -29,6 +29,7 @@ |
367 | #include <asm/unistd.h> |
368 | #include <asm/fpsimd.h> |
369 | #include <asm/ptrace.h> |
370 | +#include <asm/syscall.h> |
371 | #include <asm/signal32.h> |
372 | #include <asm/traps.h> |
373 | #include <asm/vdso.h> |
374 | @@ -868,7 +869,7 @@ static void do_signal(struct pt_regs *regs) |
375 | retval == -ERESTART_RESTARTBLOCK || |
376 | (retval == -ERESTARTSYS && |
377 | !(ksig.ka.sa.sa_flags & SA_RESTART)))) { |
378 | - regs->regs[0] = -EINTR; |
379 | + syscall_set_return_value(current, regs, -EINTR, 0); |
380 | regs->pc = continue_addr; |
381 | } |
382 | |
383 | diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c |
384 | index f2d2dbbbfca20..091c11521108a 100644 |
385 | --- a/arch/arm64/kernel/syscall.c |
386 | +++ b/arch/arm64/kernel/syscall.c |
387 | @@ -50,10 +50,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno, |
388 | ret = do_ni_syscall(regs, scno); |
389 | } |
390 | |
391 | - if (is_compat_task()) |
392 | - ret = lower_32_bits(ret); |
393 | - |
394 | - regs->regs[0] = ret; |
395 | + syscall_set_return_value(current, regs, 0, ret); |
396 | } |
397 | |
398 | static inline bool has_syscall_work(unsigned long flags) |
399 | @@ -108,7 +105,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
400 | if (has_syscall_work(flags)) { |
401 | /* set default errno for user-issued syscall(-1) */ |
402 | if (scno == NO_SYSCALL) |
403 | - regs->regs[0] = -ENOSYS; |
404 | + syscall_set_return_value(current, regs, -ENOSYS, 0); |
405 | scno = syscall_trace_enter(regs); |
406 | if (scno == NO_SYSCALL) |
407 | goto trace_exit; |
408 | diff --git a/arch/mips/Makefile b/arch/mips/Makefile |
409 | index 5403a91ce098d..9ff2c70763a0c 100644 |
410 | --- a/arch/mips/Makefile |
411 | +++ b/arch/mips/Makefile |
412 | @@ -320,7 +320,7 @@ KBUILD_LDFLAGS += -m $(ld-emul) |
413 | |
414 | ifdef CONFIG_MIPS |
415 | CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ |
416 | - egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ |
417 | + egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ |
418 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') |
419 | endif |
420 | |
421 | diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c |
422 | index 11e9527c6e441..62ffac500eb52 100644 |
423 | --- a/arch/mips/mti-malta/malta-platform.c |
424 | +++ b/arch/mips/mti-malta/malta-platform.c |
425 | @@ -47,7 +47,8 @@ static struct plat_serial8250_port uart8250_data[] = { |
426 | .mapbase = 0x1f000900, /* The CBUS UART */ |
427 | .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2, |
428 | .uartclk = 3686400, /* Twice the usual clk! */ |
429 | - .iotype = UPIO_MEM32, |
430 | + .iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ? |
431 | + UPIO_MEM32BE : UPIO_MEM32, |
432 | .flags = CBUS_UART_FLAGS, |
433 | .regshift = 3, |
434 | }, |
435 | diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
436 | index 0ed910237c4d8..834e53e538d44 100644 |
437 | --- a/arch/x86/events/perf_event.h |
438 | +++ b/arch/x86/events/perf_event.h |
439 | @@ -852,9 +852,10 @@ void x86_pmu_stop(struct perf_event *event, int flags); |
440 | |
441 | static inline void x86_pmu_disable_event(struct perf_event *event) |
442 | { |
443 | + u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); |
444 | struct hw_perf_event *hwc = &event->hw; |
445 | |
446 | - wrmsrl(hwc->config_base, hwc->config); |
447 | + wrmsrl(hwc->config_base, hwc->config & ~disable_mask); |
448 | } |
449 | |
450 | void x86_pmu_enable_event(struct perf_event *event); |
451 | diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c |
452 | index b9400087141df..260c64c205b8c 100644 |
453 | --- a/arch/x86/kvm/mmu.c |
454 | +++ b/arch/x86/kvm/mmu.c |
455 | @@ -2143,7 +2143,7 @@ static int is_empty_shadow_page(u64 *spt) |
456 | * aggregate version in order to make the slab shrinker |
457 | * faster |
458 | */ |
459 | -static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, unsigned long nr) |
460 | +static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, long nr) |
461 | { |
462 | kvm->arch.n_used_mmu_pages += nr; |
463 | percpu_counter_add(&kvm_total_used_mmu_pages, nr); |
464 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
465 | index 5d35b9656b67d..364e96e508d90 100644 |
466 | --- a/arch/x86/kvm/x86.c |
467 | +++ b/arch/x86/kvm/x86.c |
468 | @@ -3638,8 +3638,17 @@ static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu) |
469 | |
470 | static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) |
471 | { |
472 | - return kvm_arch_interrupt_allowed(vcpu) && |
473 | - kvm_cpu_accept_dm_intr(vcpu); |
474 | + /* |
475 | + * Do not cause an interrupt window exit if an exception |
476 | + * is pending or an event needs reinjection; userspace |
477 | + * might want to inject the interrupt manually using KVM_SET_REGS |
478 | + * or KVM_SET_SREGS. For that to work, we must be at an |
479 | + * instruction boundary and with no events half-injected. |
480 | + */ |
481 | + return (kvm_arch_interrupt_allowed(vcpu) && |
482 | + kvm_cpu_accept_dm_intr(vcpu) && |
483 | + !kvm_event_needs_reinjection(vcpu) && |
484 | + !vcpu->arch.exception.pending); |
485 | } |
486 | |
487 | static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, |
488 | diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c |
489 | index c128d50cb4107..71a82528d4bfe 100644 |
490 | --- a/block/blk-iolatency.c |
491 | +++ b/block/blk-iolatency.c |
492 | @@ -832,7 +832,11 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, |
493 | |
494 | enable = iolatency_set_min_lat_nsec(blkg, lat_val); |
495 | if (enable) { |
496 | - WARN_ON_ONCE(!blk_get_queue(blkg->q)); |
497 | + if (!blk_get_queue(blkg->q)) { |
498 | + ret = -ENODEV; |
499 | + goto out; |
500 | + } |
501 | + |
502 | blkg_get(blkg); |
503 | } |
504 | |
505 | diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c |
506 | index b7c408ce340c9..663d85e0adba9 100644 |
507 | --- a/drivers/acpi/acpica/nsrepair2.c |
508 | +++ b/drivers/acpi/acpica/nsrepair2.c |
509 | @@ -375,13 +375,6 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, |
510 | |
511 | (*element_ptr)->common.reference_count = |
512 | original_ref_count; |
513 | - |
514 | - /* |
515 | - * The original_element holds a reference from the package object |
516 | - * that represents _HID. Since a new element was created by _HID, |
517 | - * remove the reference from the _CID package. |
518 | - */ |
519 | - acpi_ut_remove_reference(original_element); |
520 | } |
521 | |
522 | element_ptr++; |
523 | diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c |
524 | index 038db94216a91..454f9d7d42fe1 100644 |
525 | --- a/drivers/ata/libata-sff.c |
526 | +++ b/drivers/ata/libata-sff.c |
527 | @@ -641,6 +641,20 @@ unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, unsigned char *buf, |
528 | } |
529 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); |
530 | |
531 | +static void ata_pio_xfer(struct ata_queued_cmd *qc, struct page *page, |
532 | + unsigned int offset, size_t xfer_size) |
533 | +{ |
534 | + bool do_write = (qc->tf.flags & ATA_TFLAG_WRITE); |
535 | + unsigned char *buf; |
536 | + |
537 | + buf = kmap_atomic(page); |
538 | + qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); |
539 | + kunmap_atomic(buf); |
540 | + |
541 | + if (!do_write && !PageSlab(page)) |
542 | + flush_dcache_page(page); |
543 | +} |
544 | + |
545 | /** |
546 | * ata_pio_sector - Transfer a sector of data. |
547 | * @qc: Command on going |
548 | @@ -652,11 +666,9 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); |
549 | */ |
550 | static void ata_pio_sector(struct ata_queued_cmd *qc) |
551 | { |
552 | - int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); |
553 | struct ata_port *ap = qc->ap; |
554 | struct page *page; |
555 | unsigned int offset; |
556 | - unsigned char *buf; |
557 | |
558 | if (!qc->cursg) { |
559 | qc->curbytes = qc->nbytes; |
560 | @@ -674,13 +686,20 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) |
561 | |
562 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
563 | |
564 | - /* do the actual data transfer */ |
565 | - buf = kmap_atomic(page); |
566 | - ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, do_write); |
567 | - kunmap_atomic(buf); |
568 | + /* |
569 | + * Split the transfer when it splits a page boundary. Note that the |
570 | + * split still has to be dword aligned like all ATA data transfers. |
571 | + */ |
572 | + WARN_ON_ONCE(offset % 4); |
573 | + if (offset + qc->sect_size > PAGE_SIZE) { |
574 | + unsigned int split_len = PAGE_SIZE - offset; |
575 | |
576 | - if (!do_write && !PageSlab(page)) |
577 | - flush_dcache_page(page); |
578 | + ata_pio_xfer(qc, page, offset, split_len); |
579 | + ata_pio_xfer(qc, nth_page(page, 1), 0, |
580 | + qc->sect_size - split_len); |
581 | + } else { |
582 | + ata_pio_xfer(qc, page, offset, qc->sect_size); |
583 | + } |
584 | |
585 | qc->curbytes += qc->sect_size; |
586 | qc->cursg_ofs += qc->sect_size; |
587 | diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c |
588 | index 70efbb22dfc30..5f3e5d8372590 100644 |
589 | --- a/drivers/base/firmware_loader/fallback.c |
590 | +++ b/drivers/base/firmware_loader/fallback.c |
591 | @@ -86,12 +86,11 @@ static void __fw_load_abort(struct fw_priv *fw_priv) |
592 | { |
593 | /* |
594 | * There is a small window in which user can write to 'loading' |
595 | - * between loading done and disappearance of 'loading' |
596 | + * between loading done/aborted and disappearance of 'loading' |
597 | */ |
598 | - if (fw_sysfs_done(fw_priv)) |
599 | + if (fw_state_is_aborted(fw_priv) || fw_sysfs_done(fw_priv)) |
600 | return; |
601 | |
602 | - list_del_init(&fw_priv->pending_list); |
603 | fw_state_aborted(fw_priv); |
604 | } |
605 | |
606 | @@ -277,7 +276,6 @@ static ssize_t firmware_loading_store(struct device *dev, |
607 | * Same logic as fw_load_abort, only the DONE bit |
608 | * is ignored and we set ABORT only on failure. |
609 | */ |
610 | - list_del_init(&fw_priv->pending_list); |
611 | if (rc) { |
612 | fw_state_aborted(fw_priv); |
613 | written = rc; |
614 | @@ -512,6 +510,11 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, |
615 | } |
616 | |
617 | mutex_lock(&fw_lock); |
618 | + if (fw_state_is_aborted(fw_priv)) { |
619 | + mutex_unlock(&fw_lock); |
620 | + retval = -EINTR; |
621 | + goto out; |
622 | + } |
623 | list_add(&fw_priv->pending_list, &pending_fw_head); |
624 | mutex_unlock(&fw_lock); |
625 | |
626 | @@ -534,11 +537,10 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, |
627 | if (fw_state_is_aborted(fw_priv)) { |
628 | if (retval == -ERESTARTSYS) |
629 | retval = -EINTR; |
630 | - else |
631 | - retval = -EAGAIN; |
632 | } else if (fw_priv->is_paged_buf && !fw_priv->data) |
633 | retval = -ENOMEM; |
634 | |
635 | +out: |
636 | device_del(f_dev); |
637 | err_put_dev: |
638 | put_device(f_dev); |
639 | diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h |
640 | index 9bef6c35f344a..ffb2a2724cc5a 100644 |
641 | --- a/drivers/base/firmware_loader/firmware.h |
642 | +++ b/drivers/base/firmware_loader/firmware.h |
643 | @@ -108,8 +108,16 @@ static inline void __fw_state_set(struct fw_priv *fw_priv, |
644 | |
645 | WRITE_ONCE(fw_st->status, status); |
646 | |
647 | - if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED) |
648 | + if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED) { |
649 | +#ifdef CONFIG_FW_LOADER_USER_HELPER |
650 | + /* |
651 | + * Doing this here ensures that the fw_priv is deleted from |
652 | + * the pending list in all abort/done paths. |
653 | + */ |
654 | + list_del_init(&fw_priv->pending_list); |
655 | +#endif |
656 | complete_all(&fw_st->completion); |
657 | + } |
658 | } |
659 | |
660 | static inline void fw_state_aborted(struct fw_priv *fw_priv) |
661 | diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c |
662 | index 95d21b4af9045..249349f64bfe9 100644 |
663 | --- a/drivers/base/firmware_loader/main.c |
664 | +++ b/drivers/base/firmware_loader/main.c |
665 | @@ -747,8 +747,10 @@ static void fw_abort_batch_reqs(struct firmware *fw) |
666 | return; |
667 | |
668 | fw_priv = fw->priv; |
669 | + mutex_lock(&fw_lock); |
670 | if (!fw_state_is_aborted(fw_priv)) |
671 | fw_state_aborted(fw_priv); |
672 | + mutex_unlock(&fw_lock); |
673 | } |
674 | |
675 | /* called from request_firmware() and request_firmware_work_func() */ |
676 | diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c |
677 | index 22bf553ccf9df..69937be2032b1 100644 |
678 | --- a/drivers/char/tpm/tpm_ftpm_tee.c |
679 | +++ b/drivers/char/tpm/tpm_ftpm_tee.c |
680 | @@ -255,11 +255,11 @@ static int ftpm_tee_probe(struct platform_device *pdev) |
681 | pvt_data->session = sess_arg.session; |
682 | |
683 | /* Allocate dynamic shared memory with fTPM TA */ |
684 | - pvt_data->shm = tee_shm_alloc(pvt_data->ctx, |
685 | - MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE, |
686 | - TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); |
687 | + pvt_data->shm = tee_shm_alloc_kernel_buf(pvt_data->ctx, |
688 | + MAX_COMMAND_SIZE + |
689 | + MAX_RESPONSE_SIZE); |
690 | if (IS_ERR(pvt_data->shm)) { |
691 | - dev_err(dev, "%s: tee_shm_alloc failed\n", __func__); |
692 | + dev_err(dev, "%s: tee_shm_alloc_kernel_buf failed\n", __func__); |
693 | rc = -ENOMEM; |
694 | goto out_shm_alloc; |
695 | } |
696 | diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c |
697 | index be160764911bf..f9d5b73343417 100644 |
698 | --- a/drivers/clk/clk-devres.c |
699 | +++ b/drivers/clk/clk-devres.c |
700 | @@ -92,13 +92,20 @@ int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, |
701 | } |
702 | EXPORT_SYMBOL_GPL(devm_clk_bulk_get_optional); |
703 | |
704 | +static void devm_clk_bulk_release_all(struct device *dev, void *res) |
705 | +{ |
706 | + struct clk_bulk_devres *devres = res; |
707 | + |
708 | + clk_bulk_put_all(devres->num_clks, devres->clks); |
709 | +} |
710 | + |
711 | int __must_check devm_clk_bulk_get_all(struct device *dev, |
712 | struct clk_bulk_data **clks) |
713 | { |
714 | struct clk_bulk_devres *devres; |
715 | int ret; |
716 | |
717 | - devres = devres_alloc(devm_clk_bulk_release, |
718 | + devres = devres_alloc(devm_clk_bulk_release_all, |
719 | sizeof(*devres), GFP_KERNEL); |
720 | if (!devres) |
721 | return -ENOMEM; |
722 | diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c |
723 | index 18117ce5ff85f..5c75e3d906c20 100644 |
724 | --- a/drivers/clk/clk-stm32f4.c |
725 | +++ b/drivers/clk/clk-stm32f4.c |
726 | @@ -526,7 +526,7 @@ struct stm32f4_pll { |
727 | |
728 | struct stm32f4_pll_post_div_data { |
729 | int idx; |
730 | - u8 pll_num; |
731 | + int pll_idx; |
732 | const char *name; |
733 | const char *parent; |
734 | u8 flag; |
735 | @@ -557,13 +557,13 @@ static const struct clk_div_table post_divr_table[] = { |
736 | |
737 | #define MAX_POST_DIV 3 |
738 | static const struct stm32f4_pll_post_div_data post_div_data[MAX_POST_DIV] = { |
739 | - { CLK_I2SQ_PDIV, PLL_I2S, "plli2s-q-div", "plli2s-q", |
740 | + { CLK_I2SQ_PDIV, PLL_VCO_I2S, "plli2s-q-div", "plli2s-q", |
741 | CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 0, 5, 0, NULL}, |
742 | |
743 | - { CLK_SAIQ_PDIV, PLL_SAI, "pllsai-q-div", "pllsai-q", |
744 | + { CLK_SAIQ_PDIV, PLL_VCO_SAI, "pllsai-q-div", "pllsai-q", |
745 | CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 8, 5, 0, NULL }, |
746 | |
747 | - { NO_IDX, PLL_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT, |
748 | + { NO_IDX, PLL_VCO_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT, |
749 | STM32F4_RCC_DCKCFGR, 16, 2, 0, post_divr_table }, |
750 | }; |
751 | |
752 | @@ -1774,7 +1774,7 @@ static void __init stm32f4_rcc_init(struct device_node *np) |
753 | post_div->width, |
754 | post_div->flag_div, |
755 | post_div->div_table, |
756 | - clks[post_div->pll_num], |
757 | + clks[post_div->pll_idx], |
758 | &stm32f4_clk_lock); |
759 | |
760 | if (post_div->idx != NO_IDX) |
761 | diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c |
762 | index 5c0fb3134825f..5265182674eb7 100644 |
763 | --- a/drivers/dma/imx-dma.c |
764 | +++ b/drivers/dma/imx-dma.c |
765 | @@ -832,6 +832,8 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( |
766 | dma_length += sg_dma_len(sg); |
767 | } |
768 | |
769 | + imxdma_config_write(chan, &imxdmac->config, direction); |
770 | + |
771 | switch (imxdmac->word_size) { |
772 | case DMA_SLAVE_BUSWIDTH_4_BYTES: |
773 | if (sg_dma_len(sgl) & 3 || sgl->dma_address & 3) |
774 | diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c |
775 | index a3109bcaa0ac2..09ca493b36176 100644 |
776 | --- a/drivers/gpio/gpio-tqmx86.c |
777 | +++ b/drivers/gpio/gpio-tqmx86.c |
778 | @@ -235,8 +235,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) |
779 | struct resource *res; |
780 | int ret, irq; |
781 | |
782 | - irq = platform_get_irq(pdev, 0); |
783 | - if (irq < 0) |
784 | + irq = platform_get_irq_optional(pdev, 0); |
785 | + if (irq < 0 && irq != -ENXIO) |
786 | return irq; |
787 | |
788 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
789 | @@ -275,7 +275,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) |
790 | |
791 | pm_runtime_enable(&pdev->dev); |
792 | |
793 | - if (irq) { |
794 | + if (irq > 0) { |
795 | struct irq_chip *irq_chip = &gpio->irq_chip; |
796 | u8 irq_status; |
797 | |
798 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
799 | index a715cb88052c2..e87184645c540 100644 |
800 | --- a/drivers/md/raid1.c |
801 | +++ b/drivers/md/raid1.c |
802 | @@ -452,8 +452,6 @@ static void raid1_end_write_request(struct bio *bio) |
803 | /* |
804 | * When the device is faulty, it is not necessary to |
805 | * handle write error. |
806 | - * For failfast, this is the only remaining device, |
807 | - * We need to retry the write without FailFast. |
808 | */ |
809 | if (!test_bit(Faulty, &rdev->flags)) |
810 | set_bit(R1BIO_WriteError, &r1_bio->state); |
811 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
812 | index a195a85cc366a..deddabfb07d79 100644 |
813 | --- a/drivers/md/raid10.c |
814 | +++ b/drivers/md/raid10.c |
815 | @@ -470,12 +470,12 @@ static void raid10_end_write_request(struct bio *bio) |
816 | /* |
817 | * When the device is faulty, it is not necessary to |
818 | * handle write error. |
819 | - * For failfast, this is the only remaining device, |
820 | - * We need to retry the write without FailFast. |
821 | */ |
822 | if (!test_bit(Faulty, &rdev->flags)) |
823 | set_bit(R10BIO_WriteError, &r10_bio->state); |
824 | else { |
825 | + /* Fail the request */ |
826 | + set_bit(R10BIO_Degraded, &r10_bio->state); |
827 | r10_bio->devs[slot].bio = NULL; |
828 | to_put = bio; |
829 | dec_rdev = 1; |
830 | diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c |
831 | index 4489744fbbd95..13602939906fc 100644 |
832 | --- a/drivers/media/common/videobuf2/videobuf2-core.c |
833 | +++ b/drivers/media/common/videobuf2/videobuf2-core.c |
834 | @@ -1512,6 +1512,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, |
835 | struct media_request *req) |
836 | { |
837 | struct vb2_buffer *vb; |
838 | + enum vb2_buffer_state orig_state; |
839 | int ret; |
840 | |
841 | if (q->error) { |
842 | @@ -1611,6 +1612,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, |
843 | * Add to the queued buffers list, a buffer will stay on it until |
844 | * dequeued in dqbuf. |
845 | */ |
846 | + orig_state = vb->state; |
847 | list_add_tail(&vb->queued_entry, &q->queued_list); |
848 | q->queued_count++; |
849 | q->waiting_for_buffers = false; |
850 | @@ -1641,8 +1643,17 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, |
851 | if (q->streaming && !q->start_streaming_called && |
852 | q->queued_count >= q->min_buffers_needed) { |
853 | ret = vb2_start_streaming(q); |
854 | - if (ret) |
855 | + if (ret) { |
856 | + /* |
857 | + * Since vb2_core_qbuf will return with an error, |
858 | + * we should return it to state DEQUEUED since |
859 | + * the error indicates that the buffer wasn't queued. |
860 | + */ |
861 | + list_del(&vb->queued_entry); |
862 | + q->queued_count--; |
863 | + vb->state = orig_state; |
864 | return ret; |
865 | + } |
866 | } |
867 | |
868 | dprintk(2, "qbuf of buffer %d succeeded\n", vb->index); |
869 | diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c |
870 | index 1a36bda285421..0fe71437601e7 100644 |
871 | --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c |
872 | +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c |
873 | @@ -37,7 +37,16 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) |
874 | } else { |
875 | /* read */ |
876 | requesttype = (USB_TYPE_VENDOR | USB_DIR_IN); |
877 | - pipe = usb_rcvctrlpipe(d->udev, 0); |
878 | + |
879 | + /* |
880 | + * Zero-length transfers must use usb_sndctrlpipe() and |
881 | + * rtl28xxu_identify_state() uses a zero-length i2c read |
882 | + * command to determine the chip type. |
883 | + */ |
884 | + if (req->size) |
885 | + pipe = usb_rcvctrlpipe(d->udev, 0); |
886 | + else |
887 | + pipe = usb_sndctrlpipe(d->udev, 0); |
888 | } |
889 | |
890 | ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value, |
891 | diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c |
892 | index 034f1b50ab287..a07d8051ec3e8 100644 |
893 | --- a/drivers/net/dsa/sja1105/sja1105_main.c |
894 | +++ b/drivers/net/dsa/sja1105/sja1105_main.c |
895 | @@ -992,10 +992,11 @@ static int sja1105et_is_fdb_entry_in_bin(struct sja1105_private *priv, int bin, |
896 | int sja1105et_fdb_add(struct dsa_switch *ds, int port, |
897 | const unsigned char *addr, u16 vid) |
898 | { |
899 | - struct sja1105_l2_lookup_entry l2_lookup = {0}; |
900 | + struct sja1105_l2_lookup_entry l2_lookup = {0}, tmp; |
901 | struct sja1105_private *priv = ds->priv; |
902 | struct device *dev = ds->dev; |
903 | int last_unused = -1; |
904 | + int start, end, i; |
905 | int bin, way, rc; |
906 | |
907 | bin = sja1105et_fdb_hash(priv, addr, vid); |
908 | @@ -1007,7 +1008,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, |
909 | * mask? If yes, we need to do nothing. If not, we need |
910 | * to rewrite the entry by adding this port to it. |
911 | */ |
912 | - if (l2_lookup.destports & BIT(port)) |
913 | + if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) |
914 | return 0; |
915 | l2_lookup.destports |= BIT(port); |
916 | } else { |
917 | @@ -1038,6 +1039,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, |
918 | index, NULL, false); |
919 | } |
920 | } |
921 | + l2_lookup.lockeds = true; |
922 | l2_lookup.index = sja1105et_fdb_index(bin, way); |
923 | |
924 | rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, |
925 | @@ -1046,6 +1048,29 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, |
926 | if (rc < 0) |
927 | return rc; |
928 | |
929 | + /* Invalidate a dynamically learned entry if that exists */ |
930 | + start = sja1105et_fdb_index(bin, 0); |
931 | + end = sja1105et_fdb_index(bin, way); |
932 | + |
933 | + for (i = start; i < end; i++) { |
934 | + rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, |
935 | + i, &tmp); |
936 | + if (rc == -ENOENT) |
937 | + continue; |
938 | + if (rc) |
939 | + return rc; |
940 | + |
941 | + if (tmp.macaddr != ether_addr_to_u64(addr) || tmp.vlanid != vid) |
942 | + continue; |
943 | + |
944 | + rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, |
945 | + i, NULL, false); |
946 | + if (rc) |
947 | + return rc; |
948 | + |
949 | + break; |
950 | + } |
951 | + |
952 | return sja1105_static_fdb_change(priv, port, &l2_lookup, true); |
953 | } |
954 | |
955 | @@ -1087,7 +1112,7 @@ int sja1105et_fdb_del(struct dsa_switch *ds, int port, |
956 | int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, |
957 | const unsigned char *addr, u16 vid) |
958 | { |
959 | - struct sja1105_l2_lookup_entry l2_lookup = {0}; |
960 | + struct sja1105_l2_lookup_entry l2_lookup = {0}, tmp; |
961 | struct sja1105_private *priv = ds->priv; |
962 | int rc, i; |
963 | |
964 | @@ -1108,10 +1133,10 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, |
965 | rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, |
966 | SJA1105_SEARCH, &l2_lookup); |
967 | if (rc == 0) { |
968 | - /* Found and this port is already in the entry's |
969 | + /* Found a static entry and this port is already in the entry's |
970 | * port mask => job done |
971 | */ |
972 | - if (l2_lookup.destports & BIT(port)) |
973 | + if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) |
974 | return 0; |
975 | /* l2_lookup.index is populated by the switch in case it |
976 | * found something. |
977 | @@ -1134,16 +1159,46 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, |
978 | dev_err(ds->dev, "FDB is full, cannot add entry.\n"); |
979 | return -EINVAL; |
980 | } |
981 | - l2_lookup.lockeds = true; |
982 | l2_lookup.index = i; |
983 | |
984 | skip_finding_an_index: |
985 | + l2_lookup.lockeds = true; |
986 | + |
987 | rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, |
988 | l2_lookup.index, &l2_lookup, |
989 | true); |
990 | if (rc < 0) |
991 | return rc; |
992 | |
993 | + /* The switch learns dynamic entries and looks up the FDB left to |
994 | + * right. It is possible that our addition was concurrent with the |
995 | + * dynamic learning of the same address, so now that the static entry |
996 | + * has been installed, we are certain that address learning for this |
997 | + * particular address has been turned off, so the dynamic entry either |
998 | + * is in the FDB at an index smaller than the static one, or isn't (it |
999 | + * can also be at a larger index, but in that case it is inactive |
1000 | + * because the static FDB entry will match first, and the dynamic one |
1001 | + * will eventually age out). Search for a dynamically learned address |
1002 | + * prior to our static one and invalidate it. |
1003 | + */ |
1004 | + tmp = l2_lookup; |
1005 | + |
1006 | + rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, |
1007 | + SJA1105_SEARCH, &tmp); |
1008 | + if (rc < 0) { |
1009 | + dev_err(ds->dev, |
1010 | + "port %d failed to read back entry for %pM vid %d: %pe\n", |
1011 | + port, addr, vid, ERR_PTR(rc)); |
1012 | + return rc; |
1013 | + } |
1014 | + |
1015 | + if (tmp.index < l2_lookup.index) { |
1016 | + rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, |
1017 | + tmp.index, NULL, false); |
1018 | + if (rc < 0) |
1019 | + return rc; |
1020 | + } |
1021 | + |
1022 | return sja1105_static_fdb_change(priv, port, &l2_lookup, true); |
1023 | } |
1024 | |
1025 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
1026 | index d10b421ed1f19..9af8afd7ae89d 100644 |
1027 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
1028 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
1029 | @@ -2666,7 +2666,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
1030 | } |
1031 | |
1032 | /* Allocated memory for FW statistics */ |
1033 | - if (bnx2x_alloc_fw_stats_mem(bp)) |
1034 | + rc = bnx2x_alloc_fw_stats_mem(bp); |
1035 | + if (rc) |
1036 | LOAD_ERROR_EXIT(bp, load_error0); |
1037 | |
1038 | /* request pf to initialize status blocks */ |
1039 | diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
1040 | index b1856552ab813..a53c2d637a971 100644 |
1041 | --- a/drivers/net/ethernet/freescale/fec_main.c |
1042 | +++ b/drivers/net/ethernet/freescale/fec_main.c |
1043 | @@ -3781,13 +3781,13 @@ fec_drv_remove(struct platform_device *pdev) |
1044 | if (of_phy_is_fixed_link(np)) |
1045 | of_phy_deregister_fixed_link(np); |
1046 | of_node_put(fep->phy_node); |
1047 | - free_netdev(ndev); |
1048 | |
1049 | clk_disable_unprepare(fep->clk_ahb); |
1050 | clk_disable_unprepare(fep->clk_ipg); |
1051 | pm_runtime_put_noidle(&pdev->dev); |
1052 | pm_runtime_disable(&pdev->dev); |
1053 | |
1054 | + free_netdev(ndev); |
1055 | return 0; |
1056 | } |
1057 | |
1058 | diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c |
1059 | index 1a2634cbbb691..a653502c5d6f9 100644 |
1060 | --- a/drivers/net/ethernet/natsemi/natsemi.c |
1061 | +++ b/drivers/net/ethernet/natsemi/natsemi.c |
1062 | @@ -819,7 +819,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) |
1063 | printk(version); |
1064 | #endif |
1065 | |
1066 | - i = pci_enable_device(pdev); |
1067 | + i = pcim_enable_device(pdev); |
1068 | if (i) return i; |
1069 | |
1070 | /* natsemi has a non-standard PM control register |
1071 | @@ -852,7 +852,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) |
1072 | ioaddr = ioremap(iostart, iosize); |
1073 | if (!ioaddr) { |
1074 | i = -ENOMEM; |
1075 | - goto err_ioremap; |
1076 | + goto err_pci_request_regions; |
1077 | } |
1078 | |
1079 | /* Work around the dropped serial bit. */ |
1080 | @@ -974,9 +974,6 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) |
1081 | err_register_netdev: |
1082 | iounmap(ioaddr); |
1083 | |
1084 | - err_ioremap: |
1085 | - pci_release_regions(pdev); |
1086 | - |
1087 | err_pci_request_regions: |
1088 | free_netdev(dev); |
1089 | return i; |
1090 | @@ -3242,7 +3239,6 @@ static void natsemi_remove1(struct pci_dev *pdev) |
1091 | |
1092 | NATSEMI_REMOVE_FILE(pdev, dspcfg_workaround); |
1093 | unregister_netdev (dev); |
1094 | - pci_release_regions (pdev); |
1095 | iounmap(ioaddr); |
1096 | free_netdev (dev); |
1097 | } |
1098 | diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c |
1099 | index 1d334f2e0a568..607e2ff272dc0 100644 |
1100 | --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c |
1101 | +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c |
1102 | @@ -3524,13 +3524,13 @@ static void vxge_device_unregister(struct __vxge_hw_device *hldev) |
1103 | |
1104 | kfree(vdev->vpaths); |
1105 | |
1106 | - /* we are safe to free it now */ |
1107 | - free_netdev(dev); |
1108 | - |
1109 | vxge_debug_init(vdev->level_trace, "%s: ethernet device unregistered", |
1110 | buf); |
1111 | vxge_debug_entryexit(vdev->level_trace, "%s: %s:%d Exiting...", buf, |
1112 | __func__, __LINE__); |
1113 | + |
1114 | + /* we are safe to free it now */ |
1115 | + free_netdev(dev); |
1116 | } |
1117 | |
1118 | /* |
1119 | diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c |
1120 | index 17b91ed39369c..2354dec994184 100644 |
1121 | --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c |
1122 | +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c |
1123 | @@ -266,6 +266,8 @@ nfp_net_get_link_ksettings(struct net_device *netdev, |
1124 | |
1125 | /* Init to unknowns */ |
1126 | ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE); |
1127 | + ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); |
1128 | + ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause); |
1129 | cmd->base.port = PORT_OTHER; |
1130 | cmd->base.speed = SPEED_UNKNOWN; |
1131 | cmd->base.duplex = DUPLEX_UNKNOWN; |
1132 | diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
1133 | index 5dc36c51636c4..6ca2216e40585 100644 |
1134 | --- a/drivers/net/ethernet/qlogic/qla3xxx.c |
1135 | +++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
1136 | @@ -155,7 +155,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) |
1137 | "driver lock acquired\n"); |
1138 | return 1; |
1139 | } |
1140 | - ssleep(1); |
1141 | + mdelay(1000); |
1142 | } while (++i < 10); |
1143 | |
1144 | netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); |
1145 | @@ -3291,7 +3291,7 @@ static int ql_adapter_reset(struct ql3_adapter *qdev) |
1146 | if ((value & ISP_CONTROL_SR) == 0) |
1147 | break; |
1148 | |
1149 | - ssleep(1); |
1150 | + mdelay(1000); |
1151 | } while ((--max_wait_time)); |
1152 | |
1153 | /* |
1154 | @@ -3327,7 +3327,7 @@ static int ql_adapter_reset(struct ql3_adapter *qdev) |
1155 | ispControlStatus); |
1156 | if ((value & ISP_CONTROL_FSR) == 0) |
1157 | break; |
1158 | - ssleep(1); |
1159 | + mdelay(1000); |
1160 | } while ((--max_wait_time)); |
1161 | } |
1162 | if (max_wait_time == 0) |
1163 | diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c |
1164 | index 663c68ed6ef96..910ab2182158d 100644 |
1165 | --- a/drivers/net/phy/micrel.c |
1166 | +++ b/drivers/net/phy/micrel.c |
1167 | @@ -343,11 +343,11 @@ static int ksz8041_config_aneg(struct phy_device *phydev) |
1168 | } |
1169 | |
1170 | static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, |
1171 | - const u32 ksz_phy_id) |
1172 | + const bool ksz_8051) |
1173 | { |
1174 | int ret; |
1175 | |
1176 | - if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id) |
1177 | + if ((phydev->phy_id & MICREL_PHY_ID_MASK) != PHY_ID_KSZ8051) |
1178 | return 0; |
1179 | |
1180 | ret = phy_read(phydev, MII_BMSR); |
1181 | @@ -360,7 +360,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, |
1182 | * the switch does not. |
1183 | */ |
1184 | ret &= BMSR_ERCAP; |
1185 | - if (ksz_phy_id == PHY_ID_KSZ8051) |
1186 | + if (ksz_8051) |
1187 | return ret; |
1188 | else |
1189 | return !ret; |
1190 | @@ -368,7 +368,7 @@ static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, |
1191 | |
1192 | static int ksz8051_match_phy_device(struct phy_device *phydev) |
1193 | { |
1194 | - return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051); |
1195 | + return ksz8051_ksz8795_match_phy_device(phydev, true); |
1196 | } |
1197 | |
1198 | static int ksz8081_config_init(struct phy_device *phydev) |
1199 | @@ -396,7 +396,7 @@ static int ksz8061_config_init(struct phy_device *phydev) |
1200 | |
1201 | static int ksz8795_match_phy_device(struct phy_device *phydev) |
1202 | { |
1203 | - return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX); |
1204 | + return ksz8051_ksz8795_match_phy_device(phydev, false); |
1205 | } |
1206 | |
1207 | static int ksz9021_load_values_from_of(struct phy_device *phydev, |
1208 | diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c |
1209 | index f7d117d80cfbb..b744c09346a7c 100644 |
1210 | --- a/drivers/net/usb/pegasus.c |
1211 | +++ b/drivers/net/usb/pegasus.c |
1212 | @@ -747,12 +747,16 @@ static inline void disable_net_traffic(pegasus_t *pegasus) |
1213 | set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp); |
1214 | } |
1215 | |
1216 | -static inline void get_interrupt_interval(pegasus_t *pegasus) |
1217 | +static inline int get_interrupt_interval(pegasus_t *pegasus) |
1218 | { |
1219 | u16 data; |
1220 | u8 interval; |
1221 | + int ret; |
1222 | + |
1223 | + ret = read_eprom_word(pegasus, 4, &data); |
1224 | + if (ret < 0) |
1225 | + return ret; |
1226 | |
1227 | - read_eprom_word(pegasus, 4, &data); |
1228 | interval = data >> 8; |
1229 | if (pegasus->usb->speed != USB_SPEED_HIGH) { |
1230 | if (interval < 0x80) { |
1231 | @@ -767,6 +771,8 @@ static inline void get_interrupt_interval(pegasus_t *pegasus) |
1232 | } |
1233 | } |
1234 | pegasus->intr_interval = interval; |
1235 | + |
1236 | + return 0; |
1237 | } |
1238 | |
1239 | static void set_carrier(struct net_device *net) |
1240 | @@ -1186,7 +1192,9 @@ static int pegasus_probe(struct usb_interface *intf, |
1241 | | NETIF_MSG_PROBE | NETIF_MSG_LINK); |
1242 | |
1243 | pegasus->features = usb_dev_id[dev_index].private; |
1244 | - get_interrupt_interval(pegasus); |
1245 | + res = get_interrupt_interval(pegasus); |
1246 | + if (res) |
1247 | + goto out2; |
1248 | if (reset_mac(pegasus)) { |
1249 | dev_err(&intf->dev, "can't reset MAC\n"); |
1250 | res = -EIO; |
1251 | diff --git a/drivers/net/wireless/virt_wifi.c b/drivers/net/wireless/virt_wifi.c |
1252 | index 9d04ca53229b5..4e906910f110b 100644 |
1253 | --- a/drivers/net/wireless/virt_wifi.c |
1254 | +++ b/drivers/net/wireless/virt_wifi.c |
1255 | @@ -136,6 +136,29 @@ static struct ieee80211_supported_band band_5ghz = { |
1256 | /* Assigned at module init. Guaranteed locally-administered and unicast. */ |
1257 | static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {}; |
1258 | |
1259 | +static void virt_wifi_inform_bss(struct wiphy *wiphy) |
1260 | +{ |
1261 | + u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); |
1262 | + struct cfg80211_bss *informed_bss; |
1263 | + static const struct { |
1264 | + u8 tag; |
1265 | + u8 len; |
1266 | + u8 ssid[8]; |
1267 | + } __packed ssid = { |
1268 | + .tag = WLAN_EID_SSID, |
1269 | + .len = 8, |
1270 | + .ssid = "VirtWifi", |
1271 | + }; |
1272 | + |
1273 | + informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, |
1274 | + CFG80211_BSS_FTYPE_PRESP, |
1275 | + fake_router_bssid, tsf, |
1276 | + WLAN_CAPABILITY_ESS, 0, |
1277 | + (void *)&ssid, sizeof(ssid), |
1278 | + DBM_TO_MBM(-50), GFP_KERNEL); |
1279 | + cfg80211_put_bss(wiphy, informed_bss); |
1280 | +} |
1281 | + |
1282 | /* Called with the rtnl lock held. */ |
1283 | static int virt_wifi_scan(struct wiphy *wiphy, |
1284 | struct cfg80211_scan_request *request) |
1285 | @@ -156,28 +179,13 @@ static int virt_wifi_scan(struct wiphy *wiphy, |
1286 | /* Acquires and releases the rdev BSS lock. */ |
1287 | static void virt_wifi_scan_result(struct work_struct *work) |
1288 | { |
1289 | - struct { |
1290 | - u8 tag; |
1291 | - u8 len; |
1292 | - u8 ssid[8]; |
1293 | - } __packed ssid = { |
1294 | - .tag = WLAN_EID_SSID, .len = 8, .ssid = "VirtWifi", |
1295 | - }; |
1296 | - struct cfg80211_bss *informed_bss; |
1297 | struct virt_wifi_wiphy_priv *priv = |
1298 | container_of(work, struct virt_wifi_wiphy_priv, |
1299 | scan_result.work); |
1300 | struct wiphy *wiphy = priv_to_wiphy(priv); |
1301 | struct cfg80211_scan_info scan_info = { .aborted = false }; |
1302 | - u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); |
1303 | |
1304 | - informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, |
1305 | - CFG80211_BSS_FTYPE_PRESP, |
1306 | - fake_router_bssid, tsf, |
1307 | - WLAN_CAPABILITY_ESS, 0, |
1308 | - (void *)&ssid, sizeof(ssid), |
1309 | - DBM_TO_MBM(-50), GFP_KERNEL); |
1310 | - cfg80211_put_bss(wiphy, informed_bss); |
1311 | + virt_wifi_inform_bss(wiphy); |
1312 | |
1313 | /* Schedules work which acquires and releases the rtnl lock. */ |
1314 | cfg80211_scan_done(priv->scan_request, &scan_info); |
1315 | @@ -225,10 +233,12 @@ static int virt_wifi_connect(struct wiphy *wiphy, struct net_device *netdev, |
1316 | if (!could_schedule) |
1317 | return -EBUSY; |
1318 | |
1319 | - if (sme->bssid) |
1320 | + if (sme->bssid) { |
1321 | ether_addr_copy(priv->connect_requested_bss, sme->bssid); |
1322 | - else |
1323 | + } else { |
1324 | + virt_wifi_inform_bss(wiphy); |
1325 | eth_zero_addr(priv->connect_requested_bss); |
1326 | + } |
1327 | |
1328 | wiphy_debug(wiphy, "connect\n"); |
1329 | |
1330 | @@ -241,11 +251,13 @@ static void virt_wifi_connect_complete(struct work_struct *work) |
1331 | struct virt_wifi_netdev_priv *priv = |
1332 | container_of(work, struct virt_wifi_netdev_priv, connect.work); |
1333 | u8 *requested_bss = priv->connect_requested_bss; |
1334 | - bool has_addr = !is_zero_ether_addr(requested_bss); |
1335 | bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid); |
1336 | u16 status = WLAN_STATUS_SUCCESS; |
1337 | |
1338 | - if (!priv->is_up || (has_addr && !right_addr)) |
1339 | + if (is_zero_ether_addr(requested_bss)) |
1340 | + requested_bss = NULL; |
1341 | + |
1342 | + if (!priv->is_up || (requested_bss && !right_addr)) |
1343 | status = WLAN_STATUS_UNSPECIFIED_FAILURE; |
1344 | else |
1345 | priv->is_connected = true; |
1346 | diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c |
1347 | index 245d60189375a..7a43d4ca79292 100644 |
1348 | --- a/drivers/pcmcia/i82092.c |
1349 | +++ b/drivers/pcmcia/i82092.c |
1350 | @@ -106,6 +106,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i |
1351 | for (i = 0;i<socket_count;i++) { |
1352 | sockets[i].card_state = 1; /* 1 = present but empty */ |
1353 | sockets[i].io_base = pci_resource_start(dev, 0); |
1354 | + sockets[i].dev = dev; |
1355 | sockets[i].socket.features |= SS_CAP_PCCARD; |
1356 | sockets[i].socket.map_size = 0x1000; |
1357 | sockets[i].socket.irq_mask = 0; |
1358 | diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
1359 | index 2332b245b182d..279dea628620d 100644 |
1360 | --- a/drivers/scsi/sr.c |
1361 | +++ b/drivers/scsi/sr.c |
1362 | @@ -219,7 +219,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev) |
1363 | else if (med->media_event_code == 2) |
1364 | return DISK_EVENT_MEDIA_CHANGE; |
1365 | else if (med->media_event_code == 3) |
1366 | - return DISK_EVENT_EJECT_REQUEST; |
1367 | + return DISK_EVENT_MEDIA_CHANGE; |
1368 | return 0; |
1369 | } |
1370 | |
1371 | diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c |
1372 | index ec90b44fa0cd3..6065aaab67403 100644 |
1373 | --- a/drivers/soc/ixp4xx/ixp4xx-npe.c |
1374 | +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c |
1375 | @@ -690,8 +690,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) |
1376 | |
1377 | if (!(ixp4xx_read_feature_bits() & |
1378 | (IXP4XX_FEATURE_RESET_NPEA << i))) { |
1379 | - dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", |
1380 | - i, res->start, res->end); |
1381 | + dev_info(dev, "NPE%d at %pR not available\n", |
1382 | + i, res); |
1383 | continue; /* NPE already disabled or not present */ |
1384 | } |
1385 | npe->regs = devm_ioremap_resource(dev, res); |
1386 | @@ -699,13 +699,12 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) |
1387 | return PTR_ERR(npe->regs); |
1388 | |
1389 | if (npe_reset(npe)) { |
1390 | - dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", |
1391 | - i, res->start, res->end); |
1392 | + dev_info(dev, "NPE%d at %pR does not reset\n", |
1393 | + i, res); |
1394 | continue; |
1395 | } |
1396 | npe->valid = 1; |
1397 | - dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", |
1398 | - i, res->start, res->end); |
1399 | + dev_info(dev, "NPE%d at %pR registered\n", i, res); |
1400 | found++; |
1401 | } |
1402 | |
1403 | diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c |
1404 | index 8c968382cea76..065a800717bd5 100644 |
1405 | --- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c |
1406 | +++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c |
1407 | @@ -145,12 +145,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev) |
1408 | /* ACK - it may clear any bits so don't rely on it */ |
1409 | __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]); |
1410 | |
1411 | - en_bitmap = qmgr_regs->irqen[0]; |
1412 | + en_bitmap = __raw_readl(&qmgr_regs->irqen[0]); |
1413 | while (en_bitmap) { |
1414 | i = __fls(en_bitmap); /* number of the last "low" queue */ |
1415 | en_bitmap &= ~BIT(i); |
1416 | - src = qmgr_regs->irqsrc[i >> 3]; |
1417 | - stat = qmgr_regs->stat1[i >> 3]; |
1418 | + src = __raw_readl(&qmgr_regs->irqsrc[i >> 3]); |
1419 | + stat = __raw_readl(&qmgr_regs->stat1[i >> 3]); |
1420 | if (src & 4) /* the IRQ condition is inverted */ |
1421 | stat = ~stat; |
1422 | if (stat & BIT(src & 3)) { |
1423 | @@ -170,7 +170,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev) |
1424 | /* ACK - it may clear any bits so don't rely on it */ |
1425 | __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]); |
1426 | |
1427 | - req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h; |
1428 | + req_bitmap = __raw_readl(&qmgr_regs->irqen[1]) & |
1429 | + __raw_readl(&qmgr_regs->statne_h); |
1430 | while (req_bitmap) { |
1431 | i = __fls(req_bitmap); /* number of the last "high" queue */ |
1432 | req_bitmap &= ~BIT(i); |
1433 | diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c |
1434 | index e237481dbbbbf..474d5a7fa95e3 100644 |
1435 | --- a/drivers/spi/spi-imx.c |
1436 | +++ b/drivers/spi/spi-imx.c |
1437 | @@ -497,8 +497,10 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, |
1438 | struct spi_message *msg) |
1439 | { |
1440 | struct spi_device *spi = msg->spi; |
1441 | + struct spi_transfer *xfer; |
1442 | u32 ctrl = MX51_ECSPI_CTRL_ENABLE; |
1443 | - u32 testreg; |
1444 | + u32 min_speed_hz = ~0U; |
1445 | + u32 testreg, delay; |
1446 | u32 cfg = readl(spi_imx->base + MX51_ECSPI_CONFIG); |
1447 | |
1448 | /* set Master or Slave mode */ |
1449 | @@ -559,6 +561,35 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, |
1450 | |
1451 | writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); |
1452 | |
1453 | + /* |
1454 | + * Wait until the changes in the configuration register CONFIGREG |
1455 | + * propagate into the hardware. It takes exactly one tick of the |
1456 | + * SCLK clock, but we will wait two SCLK clock just to be sure. The |
1457 | + * effect of the delay it takes for the hardware to apply changes |
1458 | + * is noticable if the SCLK clock run very slow. In such a case, if |
1459 | + * the polarity of SCLK should be inverted, the GPIO ChipSelect might |
1460 | + * be asserted before the SCLK polarity changes, which would disrupt |
1461 | + * the SPI communication as the device on the other end would consider |
1462 | + * the change of SCLK polarity as a clock tick already. |
1463 | + * |
1464 | + * Because spi_imx->spi_bus_clk is only set in bitbang prepare_message |
1465 | + * callback, iterate over all the transfers in spi_message, find the |
1466 | + * one with lowest bus frequency, and use that bus frequency for the |
1467 | + * delay calculation. In case all transfers have speed_hz == 0, then |
1468 | + * min_speed_hz is ~0 and the resulting delay is zero. |
1469 | + */ |
1470 | + list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
1471 | + if (!xfer->speed_hz) |
1472 | + continue; |
1473 | + min_speed_hz = min(xfer->speed_hz, min_speed_hz); |
1474 | + } |
1475 | + |
1476 | + delay = (2 * 1000000) / min_speed_hz; |
1477 | + if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ |
1478 | + udelay(delay); |
1479 | + else /* SCLK is _very_ slow */ |
1480 | + usleep_range(delay, delay + 10); |
1481 | + |
1482 | return 0; |
1483 | } |
1484 | |
1485 | @@ -566,7 +597,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, |
1486 | struct spi_device *spi) |
1487 | { |
1488 | u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); |
1489 | - u32 clk, delay; |
1490 | + u32 clk; |
1491 | |
1492 | /* Clear BL field and set the right value */ |
1493 | ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; |
1494 | @@ -588,23 +619,6 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, |
1495 | |
1496 | writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); |
1497 | |
1498 | - /* |
1499 | - * Wait until the changes in the configuration register CONFIGREG |
1500 | - * propagate into the hardware. It takes exactly one tick of the |
1501 | - * SCLK clock, but we will wait two SCLK clock just to be sure. The |
1502 | - * effect of the delay it takes for the hardware to apply changes |
1503 | - * is noticable if the SCLK clock run very slow. In such a case, if |
1504 | - * the polarity of SCLK should be inverted, the GPIO ChipSelect might |
1505 | - * be asserted before the SCLK polarity changes, which would disrupt |
1506 | - * the SPI communication as the device on the other end would consider |
1507 | - * the change of SCLK polarity as a clock tick already. |
1508 | - */ |
1509 | - delay = (2 * 1000000) / clk; |
1510 | - if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ |
1511 | - udelay(delay); |
1512 | - else /* SCLK is _very_ slow */ |
1513 | - usleep_range(delay, delay + 10); |
1514 | - |
1515 | return 0; |
1516 | } |
1517 | |
1518 | diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c |
1519 | index f3f10443f9e26..3c841ae0a3e91 100644 |
1520 | --- a/drivers/spi/spi-meson-spicc.c |
1521 | +++ b/drivers/spi/spi-meson-spicc.c |
1522 | @@ -597,6 +597,8 @@ static int meson_spicc_remove(struct platform_device *pdev) |
1523 | |
1524 | clk_disable_unprepare(spicc->core); |
1525 | |
1526 | + spi_master_put(spicc->master); |
1527 | + |
1528 | return 0; |
1529 | } |
1530 | |
1531 | diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c |
1532 | index db99129d31695..4305178243891 100644 |
1533 | --- a/drivers/staging/rtl8712/rtl8712_led.c |
1534 | +++ b/drivers/staging/rtl8712/rtl8712_led.c |
1535 | @@ -1820,3 +1820,11 @@ void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction) |
1536 | break; |
1537 | } |
1538 | } |
1539 | + |
1540 | +void r8712_flush_led_works(struct _adapter *padapter) |
1541 | +{ |
1542 | + struct led_priv *pledpriv = &padapter->ledpriv; |
1543 | + |
1544 | + flush_work(&pledpriv->SwLed0.BlinkWorkItem); |
1545 | + flush_work(&pledpriv->SwLed1.BlinkWorkItem); |
1546 | +} |
1547 | diff --git a/drivers/staging/rtl8712/rtl871x_led.h b/drivers/staging/rtl8712/rtl871x_led.h |
1548 | index ee19c873cf010..2f0768132ad8f 100644 |
1549 | --- a/drivers/staging/rtl8712/rtl871x_led.h |
1550 | +++ b/drivers/staging/rtl8712/rtl871x_led.h |
1551 | @@ -112,6 +112,7 @@ struct led_priv { |
1552 | void r8712_InitSwLeds(struct _adapter *padapter); |
1553 | void r8712_DeInitSwLeds(struct _adapter *padapter); |
1554 | void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction); |
1555 | +void r8712_flush_led_works(struct _adapter *padapter); |
1556 | |
1557 | #endif |
1558 | |
1559 | diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c |
1560 | index 23cff43437e21..cd6d9ff0bebca 100644 |
1561 | --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c |
1562 | +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c |
1563 | @@ -224,3 +224,11 @@ void r8712_unregister_cmd_alive(struct _adapter *padapter) |
1564 | } |
1565 | mutex_unlock(&pwrctrl->mutex_lock); |
1566 | } |
1567 | + |
1568 | +void r8712_flush_rwctrl_works(struct _adapter *padapter) |
1569 | +{ |
1570 | + struct pwrctrl_priv *pwrctrl = &padapter->pwrctrlpriv; |
1571 | + |
1572 | + flush_work(&pwrctrl->SetPSModeWorkItem); |
1573 | + flush_work(&pwrctrl->rpwm_workitem); |
1574 | +} |
1575 | diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.h b/drivers/staging/rtl8712/rtl871x_pwrctrl.h |
1576 | index dd5a79f90b1a6..6eee6f1bdba4d 100644 |
1577 | --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.h |
1578 | +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.h |
1579 | @@ -111,5 +111,6 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter, |
1580 | void r8712_set_ps_mode(struct _adapter *padapter, uint ps_mode, |
1581 | uint smart_ps); |
1582 | void r8712_set_rpwm(struct _adapter *padapter, u8 val8); |
1583 | +void r8712_flush_rwctrl_works(struct _adapter *padapter); |
1584 | |
1585 | #endif /* __RTL871X_PWRCTRL_H_ */ |
1586 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
1587 | index bc421925e84c2..49188ab046123 100644 |
1588 | --- a/drivers/staging/rtl8712/usb_intf.c |
1589 | +++ b/drivers/staging/rtl8712/usb_intf.c |
1590 | @@ -604,7 +604,8 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf) |
1591 | padapter->surprise_removed = true; |
1592 | if (pnetdev->reg_state != NETREG_UNINITIALIZED) |
1593 | unregister_netdev(pnetdev); /* will call netdev_close() */ |
1594 | - flush_scheduled_work(); |
1595 | + r8712_flush_rwctrl_works(padapter); |
1596 | + r8712_flush_led_works(padapter); |
1597 | udelay(1); |
1598 | /* Stop driver mlme relation timer */ |
1599 | r8712_stop_drv_timers(padapter); |
1600 | diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c |
1601 | index 301d327d06244..e6ca03aa6830d 100644 |
1602 | --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c |
1603 | +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c |
1604 | @@ -1033,6 +1033,8 @@ void sd_int_dpc(struct adapter *adapter) |
1605 | } else { |
1606 | rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt); |
1607 | } |
1608 | + } else { |
1609 | + kfree(c2h_evt); |
1610 | } |
1611 | } else { |
1612 | /* Error handling for malloc fail */ |
1613 | diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c |
1614 | index ea79482ebda46..4b5069f88d786 100644 |
1615 | --- a/drivers/tee/optee/call.c |
1616 | +++ b/drivers/tee/optee/call.c |
1617 | @@ -407,11 +407,13 @@ void optee_enable_shm_cache(struct optee *optee) |
1618 | } |
1619 | |
1620 | /** |
1621 | - * optee_disable_shm_cache() - Disables caching of some shared memory allocation |
1622 | - * in OP-TEE |
1623 | + * __optee_disable_shm_cache() - Disables caching of some shared memory |
1624 | + * allocation in OP-TEE |
1625 | * @optee: main service struct |
1626 | + * @is_mapped: true if the cached shared memory addresses were mapped by this |
1627 | + * kernel, are safe to dereference, and should be freed |
1628 | */ |
1629 | -void optee_disable_shm_cache(struct optee *optee) |
1630 | +static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped) |
1631 | { |
1632 | struct optee_call_waiter w; |
1633 | |
1634 | @@ -430,6 +432,13 @@ void optee_disable_shm_cache(struct optee *optee) |
1635 | if (res.result.status == OPTEE_SMC_RETURN_OK) { |
1636 | struct tee_shm *shm; |
1637 | |
1638 | + /* |
1639 | + * Shared memory references that were not mapped by |
1640 | + * this kernel must be ignored to prevent a crash. |
1641 | + */ |
1642 | + if (!is_mapped) |
1643 | + continue; |
1644 | + |
1645 | shm = reg_pair_to_ptr(res.result.shm_upper32, |
1646 | res.result.shm_lower32); |
1647 | tee_shm_free(shm); |
1648 | @@ -440,6 +449,27 @@ void optee_disable_shm_cache(struct optee *optee) |
1649 | optee_cq_wait_final(&optee->call_queue, &w); |
1650 | } |
1651 | |
1652 | +/** |
1653 | + * optee_disable_shm_cache() - Disables caching of mapped shared memory |
1654 | + * allocations in OP-TEE |
1655 | + * @optee: main service struct |
1656 | + */ |
1657 | +void optee_disable_shm_cache(struct optee *optee) |
1658 | +{ |
1659 | + return __optee_disable_shm_cache(optee, true); |
1660 | +} |
1661 | + |
1662 | +/** |
1663 | + * optee_disable_unmapped_shm_cache() - Disables caching of shared memory |
1664 | + * allocations in OP-TEE which are not |
1665 | + * currently mapped |
1666 | + * @optee: main service struct |
1667 | + */ |
1668 | +void optee_disable_unmapped_shm_cache(struct optee *optee) |
1669 | +{ |
1670 | + return __optee_disable_shm_cache(optee, false); |
1671 | +} |
1672 | + |
1673 | #define PAGELIST_ENTRIES_PER_PAGE \ |
1674 | ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1) |
1675 | |
1676 | diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c |
1677 | index ba6cfba589a69..432dd38921dd9 100644 |
1678 | --- a/drivers/tee/optee/core.c |
1679 | +++ b/drivers/tee/optee/core.c |
1680 | @@ -628,6 +628,15 @@ static struct optee *optee_probe(struct device_node *np) |
1681 | optee->memremaped_shm = memremaped_shm; |
1682 | optee->pool = pool; |
1683 | |
1684 | + /* |
1685 | + * Ensure that there are no pre-existing shm objects before enabling |
1686 | + * the shm cache so that there's no chance of receiving an invalid |
1687 | + * address during shutdown. This could occur, for example, if we're |
1688 | + * kexec booting from an older kernel that did not properly cleanup the |
1689 | + * shm cache. |
1690 | + */ |
1691 | + optee_disable_unmapped_shm_cache(optee); |
1692 | + |
1693 | optee_enable_shm_cache(optee); |
1694 | |
1695 | if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) |
1696 | diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h |
1697 | index d9c5037b4e03e..3eeaad2a28686 100644 |
1698 | --- a/drivers/tee/optee/optee_private.h |
1699 | +++ b/drivers/tee/optee/optee_private.h |
1700 | @@ -152,6 +152,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session); |
1701 | |
1702 | void optee_enable_shm_cache(struct optee *optee); |
1703 | void optee_disable_shm_cache(struct optee *optee); |
1704 | +void optee_disable_unmapped_shm_cache(struct optee *optee); |
1705 | |
1706 | int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, |
1707 | struct page **pages, size_t num_pages, |
1708 | diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c |
1709 | index d767eebf30bdd..da06ce9b9313e 100644 |
1710 | --- a/drivers/tee/optee/shm_pool.c |
1711 | +++ b/drivers/tee/optee/shm_pool.c |
1712 | @@ -32,8 +32,10 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, |
1713 | struct page **pages; |
1714 | |
1715 | pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL); |
1716 | - if (!pages) |
1717 | - return -ENOMEM; |
1718 | + if (!pages) { |
1719 | + rc = -ENOMEM; |
1720 | + goto err; |
1721 | + } |
1722 | |
1723 | for (i = 0; i < nr_pages; i++) { |
1724 | pages[i] = page; |
1725 | @@ -44,8 +46,14 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, |
1726 | rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, |
1727 | (unsigned long)shm->kaddr); |
1728 | kfree(pages); |
1729 | + if (rc) |
1730 | + goto err; |
1731 | } |
1732 | |
1733 | + return 0; |
1734 | + |
1735 | +err: |
1736 | + __free_pages(page, order); |
1737 | return rc; |
1738 | } |
1739 | |
1740 | diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c |
1741 | index 09ddcd06c7152..1b4b4a1ba91d9 100644 |
1742 | --- a/drivers/tee/tee_shm.c |
1743 | +++ b/drivers/tee/tee_shm.c |
1744 | @@ -219,6 +219,24 @@ struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size) |
1745 | } |
1746 | EXPORT_SYMBOL_GPL(tee_shm_priv_alloc); |
1747 | |
1748 | +/** |
1749 | + * tee_shm_alloc_kernel_buf() - Allocate shared memory for kernel buffer |
1750 | + * @ctx: Context that allocates the shared memory |
1751 | + * @size: Requested size of shared memory |
1752 | + * |
1753 | + * The returned memory registered in secure world and is suitable to be |
1754 | + * passed as a memory buffer in parameter argument to |
1755 | + * tee_client_invoke_func(). The memory allocated is later freed with a |
1756 | + * call to tee_shm_free(). |
1757 | + * |
1758 | + * @returns a pointer to 'struct tee_shm' |
1759 | + */ |
1760 | +struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size) |
1761 | +{ |
1762 | + return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); |
1763 | +} |
1764 | +EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf); |
1765 | + |
1766 | struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, |
1767 | size_t length, u32 flags) |
1768 | { |
1769 | diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c |
1770 | index e9eb454c24728..98e68f25a5f34 100644 |
1771 | --- a/drivers/tty/serial/8250/8250_mtk.c |
1772 | +++ b/drivers/tty/serial/8250/8250_mtk.c |
1773 | @@ -92,10 +92,13 @@ static void mtk8250_dma_rx_complete(void *param) |
1774 | struct dma_tx_state state; |
1775 | int copied, total, cnt; |
1776 | unsigned char *ptr; |
1777 | + unsigned long flags; |
1778 | |
1779 | if (data->rx_status == DMA_RX_SHUTDOWN) |
1780 | return; |
1781 | |
1782 | + spin_lock_irqsave(&up->port.lock, flags); |
1783 | + |
1784 | dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); |
1785 | total = dma->rx_size - state.residue; |
1786 | cnt = total; |
1787 | @@ -119,6 +122,8 @@ static void mtk8250_dma_rx_complete(void *param) |
1788 | tty_flip_buffer_push(tty_port); |
1789 | |
1790 | mtk8250_rx_dma(up); |
1791 | + |
1792 | + spin_unlock_irqrestore(&up->port.lock, flags); |
1793 | } |
1794 | |
1795 | static void mtk8250_rx_dma(struct uart_8250_port *up) |
1796 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
1797 | index 51346ca91c45c..43fc5b6a25d35 100644 |
1798 | --- a/drivers/tty/serial/8250/8250_pci.c |
1799 | +++ b/drivers/tty/serial/8250/8250_pci.c |
1800 | @@ -3763,6 +3763,12 @@ static const struct pci_device_id blacklist[] = { |
1801 | { PCI_VDEVICE(INTEL, 0x0f0c), }, |
1802 | { PCI_VDEVICE(INTEL, 0x228a), }, |
1803 | { PCI_VDEVICE(INTEL, 0x228c), }, |
1804 | + { PCI_VDEVICE(INTEL, 0x4b96), }, |
1805 | + { PCI_VDEVICE(INTEL, 0x4b97), }, |
1806 | + { PCI_VDEVICE(INTEL, 0x4b98), }, |
1807 | + { PCI_VDEVICE(INTEL, 0x4b99), }, |
1808 | + { PCI_VDEVICE(INTEL, 0x4b9a), }, |
1809 | + { PCI_VDEVICE(INTEL, 0x4b9b), }, |
1810 | { PCI_VDEVICE(INTEL, 0x9ce3), }, |
1811 | { PCI_VDEVICE(INTEL, 0x9ce4), }, |
1812 | |
1813 | @@ -3923,6 +3929,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) |
1814 | if (pci_match_id(pci_use_msi, dev)) { |
1815 | dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); |
1816 | pci_set_master(dev); |
1817 | + uart.port.flags &= ~UPF_SHARE_IRQ; |
1818 | rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); |
1819 | } else { |
1820 | dev_dbg(&dev->dev, "Using legacy interrupts\n"); |
1821 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
1822 | index 6e93aa3623d9b..8a7c6d65f10ef 100644 |
1823 | --- a/drivers/tty/serial/8250/8250_port.c |
1824 | +++ b/drivers/tty/serial/8250/8250_port.c |
1825 | @@ -314,7 +314,11 @@ static const struct serial8250_config uart_config[] = { |
1826 | /* Uart divisor latch read */ |
1827 | static int default_serial_dl_read(struct uart_8250_port *up) |
1828 | { |
1829 | - return serial_in(up, UART_DLL) | serial_in(up, UART_DLM) << 8; |
1830 | + /* Assign these in pieces to truncate any bits above 7. */ |
1831 | + unsigned char dll = serial_in(up, UART_DLL); |
1832 | + unsigned char dlm = serial_in(up, UART_DLM); |
1833 | + |
1834 | + return dll | dlm << 8; |
1835 | } |
1836 | |
1837 | /* Uart divisor latch write */ |
1838 | @@ -1258,9 +1262,11 @@ static void autoconfig(struct uart_8250_port *up) |
1839 | serial_out(up, UART_LCR, 0); |
1840 | |
1841 | serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); |
1842 | - scratch = serial_in(up, UART_IIR) >> 6; |
1843 | |
1844 | - switch (scratch) { |
1845 | + /* Assign this as it is to truncate any bits above 7. */ |
1846 | + scratch = serial_in(up, UART_IIR); |
1847 | + |
1848 | + switch (scratch >> 6) { |
1849 | case 0: |
1850 | autoconfig_8250(up); |
1851 | break; |
1852 | diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c |
1853 | index 2007a40feef9d..64f18bf1e694a 100644 |
1854 | --- a/drivers/tty/serial/serial-tegra.c |
1855 | +++ b/drivers/tty/serial/serial-tegra.c |
1856 | @@ -1028,9 +1028,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) |
1857 | |
1858 | if (tup->cdata->fifo_mode_enable_status) { |
1859 | ret = tegra_uart_wait_fifo_mode_enabled(tup); |
1860 | - dev_err(tup->uport.dev, "FIFO mode not enabled\n"); |
1861 | - if (ret < 0) |
1862 | + if (ret < 0) { |
1863 | + dev_err(tup->uport.dev, |
1864 | + "Failed to enable FIFO mode: %d\n", ret); |
1865 | return ret; |
1866 | + } |
1867 | } else { |
1868 | /* |
1869 | * For all tegra devices (up to t210), there is a hardware |
1870 | diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c |
1871 | index 666cebd9c5f29..390779e2294d9 100644 |
1872 | --- a/drivers/usb/cdns3/ep0.c |
1873 | +++ b/drivers/usb/cdns3/ep0.c |
1874 | @@ -736,6 +736,7 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, |
1875 | request->actual = 0; |
1876 | priv_dev->status_completion_no_call = true; |
1877 | priv_dev->pending_status_request = request; |
1878 | + usb_gadget_set_state(&priv_dev->gadget, USB_STATE_CONFIGURED); |
1879 | spin_unlock_irqrestore(&priv_dev->lock, flags); |
1880 | |
1881 | /* |
1882 | diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c |
1883 | index dcd7066ffba22..3922a6f8c50a6 100644 |
1884 | --- a/drivers/usb/class/usbtmc.c |
1885 | +++ b/drivers/usb/class/usbtmc.c |
1886 | @@ -2285,17 +2285,10 @@ static void usbtmc_interrupt(struct urb *urb) |
1887 | dev_err(dev, "overflow with length %d, actual length is %d\n", |
1888 | data->iin_wMaxPacketSize, urb->actual_length); |
1889 | /* fall through */ |
1890 | - case -ECONNRESET: |
1891 | - case -ENOENT: |
1892 | - case -ESHUTDOWN: |
1893 | - case -EILSEQ: |
1894 | - case -ETIME: |
1895 | - case -EPIPE: |
1896 | + default: |
1897 | /* urb terminated, clean up */ |
1898 | dev_dbg(dev, "urb terminated, status: %d\n", status); |
1899 | return; |
1900 | - default: |
1901 | - dev_err(dev, "unknown status received: %d\n", status); |
1902 | } |
1903 | exit: |
1904 | rv = usb_submit_urb(urb, GFP_ATOMIC); |
1905 | diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c |
1906 | index 3740cf95560e9..0697fde51d00f 100644 |
1907 | --- a/drivers/usb/common/usb-otg-fsm.c |
1908 | +++ b/drivers/usb/common/usb-otg-fsm.c |
1909 | @@ -193,7 +193,11 @@ static void otg_start_hnp_polling(struct otg_fsm *fsm) |
1910 | if (!fsm->host_req_flag) |
1911 | return; |
1912 | |
1913 | - INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); |
1914 | + if (!fsm->hnp_work_inited) { |
1915 | + INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); |
1916 | + fsm->hnp_work_inited = true; |
1917 | + } |
1918 | + |
1919 | schedule_delayed_work(&fsm->hnp_polling_work, |
1920 | msecs_to_jiffies(T_HOST_REQ_POLL)); |
1921 | } |
1922 | diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c |
1923 | index 3d540b0d93687..e4d71410a4b1c 100644 |
1924 | --- a/drivers/usb/gadget/function/f_hid.c |
1925 | +++ b/drivers/usb/gadget/function/f_hid.c |
1926 | @@ -41,6 +41,7 @@ struct f_hidg { |
1927 | unsigned char bInterfaceSubClass; |
1928 | unsigned char bInterfaceProtocol; |
1929 | unsigned char protocol; |
1930 | + unsigned char idle; |
1931 | unsigned short report_desc_length; |
1932 | char *report_desc; |
1933 | unsigned short report_length; |
1934 | @@ -344,6 +345,11 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, |
1935 | |
1936 | spin_lock_irqsave(&hidg->write_spinlock, flags); |
1937 | |
1938 | + if (!hidg->req) { |
1939 | + spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
1940 | + return -ESHUTDOWN; |
1941 | + } |
1942 | + |
1943 | #define WRITE_COND (!hidg->write_pending) |
1944 | try_again: |
1945 | /* write queue */ |
1946 | @@ -364,8 +370,14 @@ try_again: |
1947 | count = min_t(unsigned, count, hidg->report_length); |
1948 | |
1949 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
1950 | - status = copy_from_user(req->buf, buffer, count); |
1951 | |
1952 | + if (!req) { |
1953 | + ERROR(hidg->func.config->cdev, "hidg->req is NULL\n"); |
1954 | + status = -ESHUTDOWN; |
1955 | + goto release_write_pending; |
1956 | + } |
1957 | + |
1958 | + status = copy_from_user(req->buf, buffer, count); |
1959 | if (status != 0) { |
1960 | ERROR(hidg->func.config->cdev, |
1961 | "copy_from_user error\n"); |
1962 | @@ -393,14 +405,17 @@ try_again: |
1963 | |
1964 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
1965 | |
1966 | + if (!hidg->in_ep->enabled) { |
1967 | + ERROR(hidg->func.config->cdev, "in_ep is disabled\n"); |
1968 | + status = -ESHUTDOWN; |
1969 | + goto release_write_pending; |
1970 | + } |
1971 | + |
1972 | status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); |
1973 | - if (status < 0) { |
1974 | - ERROR(hidg->func.config->cdev, |
1975 | - "usb_ep_queue error on int endpoint %zd\n", status); |
1976 | + if (status < 0) |
1977 | goto release_write_pending; |
1978 | - } else { |
1979 | + else |
1980 | status = count; |
1981 | - } |
1982 | |
1983 | return status; |
1984 | release_write_pending: |
1985 | @@ -529,6 +544,14 @@ static int hidg_setup(struct usb_function *f, |
1986 | goto respond; |
1987 | break; |
1988 | |
1989 | + case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 |
1990 | + | HID_REQ_GET_IDLE): |
1991 | + VDBG(cdev, "get_idle\n"); |
1992 | + length = min_t(unsigned int, length, 1); |
1993 | + ((u8 *) req->buf)[0] = hidg->idle; |
1994 | + goto respond; |
1995 | + break; |
1996 | + |
1997 | case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 |
1998 | | HID_REQ_SET_REPORT): |
1999 | VDBG(cdev, "set_report | wLength=%d\n", ctrl->wLength); |
2000 | @@ -552,6 +575,14 @@ static int hidg_setup(struct usb_function *f, |
2001 | goto stall; |
2002 | break; |
2003 | |
2004 | + case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 |
2005 | + | HID_REQ_SET_IDLE): |
2006 | + VDBG(cdev, "set_idle\n"); |
2007 | + length = 0; |
2008 | + hidg->idle = value >> 8; |
2009 | + goto respond; |
2010 | + break; |
2011 | + |
2012 | case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8 |
2013 | | USB_REQ_GET_DESCRIPTOR): |
2014 | switch (value >> 8) { |
2015 | @@ -779,6 +810,7 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) |
2016 | hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass; |
2017 | hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol; |
2018 | hidg->protocol = HID_REPORT_PROTOCOL; |
2019 | + hidg->idle = 1; |
2020 | hidg_ss_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); |
2021 | hidg_ss_in_comp_desc.wBytesPerInterval = |
2022 | cpu_to_le16(hidg->report_length); |
2023 | diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
2024 | index a82ba9cc0c724..e9c39a41faae9 100644 |
2025 | --- a/drivers/usb/serial/ch341.c |
2026 | +++ b/drivers/usb/serial/ch341.c |
2027 | @@ -678,6 +678,7 @@ static struct usb_serial_driver ch341_device = { |
2028 | .owner = THIS_MODULE, |
2029 | .name = "ch341-uart", |
2030 | }, |
2031 | + .bulk_in_size = 512, |
2032 | .id_table = id_table, |
2033 | .num_ports = 1, |
2034 | .open = ch341_open, |
2035 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
2036 | index 6bd1a2f6cbd0a..1ec623e46214b 100644 |
2037 | --- a/drivers/usb/serial/ftdi_sio.c |
2038 | +++ b/drivers/usb/serial/ftdi_sio.c |
2039 | @@ -219,6 +219,7 @@ static const struct usb_device_id id_table_combined[] = { |
2040 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
2041 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, |
2042 | { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, |
2043 | + { USB_DEVICE(FTDI_VID, FTDI_AUTO_M3_OP_COM_V2_PID) }, |
2044 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
2045 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
2046 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
2047 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
2048 | index add602bebd820..755858ca20bac 100644 |
2049 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
2050 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
2051 | @@ -159,6 +159,9 @@ |
2052 | /* Vardaan Enterprises Serial Interface VEUSB422R3 */ |
2053 | #define FTDI_VARDAAN_PID 0xF070 |
2054 | |
2055 | +/* Auto-M3 Ltd. - OP-COM USB V2 - OBD interface Adapter */ |
2056 | +#define FTDI_AUTO_M3_OP_COM_V2_PID 0x4f50 |
2057 | + |
2058 | /* |
2059 | * Xsens Technologies BV products (http://www.xsens.com). |
2060 | */ |
2061 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2062 | index d6d10ba1e1e80..793530f241ceb 100644 |
2063 | --- a/drivers/usb/serial/option.c |
2064 | +++ b/drivers/usb/serial/option.c |
2065 | @@ -1203,6 +1203,8 @@ static const struct usb_device_id option_ids[] = { |
2066 | .driver_info = NCTRL(2) | RSVD(3) }, |
2067 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff), /* Telit FN980 (PCIe) */ |
2068 | .driver_info = NCTRL(0) | RSVD(1) }, |
2069 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ |
2070 | + .driver_info = NCTRL(2) | RSVD(3) }, |
2071 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
2072 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
2073 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
2074 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
2075 | index 4c37abe768512..9905720df9248 100644 |
2076 | --- a/fs/ext4/namei.c |
2077 | +++ b/fs/ext4/namei.c |
2078 | @@ -2407,7 +2407,7 @@ again: |
2079 | goto journal_error; |
2080 | err = ext4_handle_dirty_dx_node(handle, dir, |
2081 | frame->bh); |
2082 | - if (err) |
2083 | + if (restart || err) |
2084 | goto journal_error; |
2085 | } else { |
2086 | struct dx_root *dxroot; |
2087 | diff --git a/fs/pipe.c b/fs/pipe.c |
2088 | index 8a2ab2f974bd4..30a43b1956742 100644 |
2089 | --- a/fs/pipe.c |
2090 | +++ b/fs/pipe.c |
2091 | @@ -30,6 +30,21 @@ |
2092 | |
2093 | #include "internal.h" |
2094 | |
2095 | +/* |
2096 | + * New pipe buffers will be restricted to this size while the user is exceeding |
2097 | + * their pipe buffer quota. The general pipe use case needs at least two |
2098 | + * buffers: one for data yet to be read, and one for new data. If this is less |
2099 | + * than two, then a write to a non-empty pipe may block even if the pipe is not |
2100 | + * full. This can occur with GNU make jobserver or similar uses of pipes as |
2101 | + * semaphores: multiple processes may be waiting to write tokens back to the |
2102 | + * pipe before reading tokens: https://lore.kernel.org/lkml/1628086770.5rn8p04n6j.none@localhost/. |
2103 | + * |
2104 | + * Users can reduce their pipe buffers with F_SETPIPE_SZ below this at their |
2105 | + * own risk, namely: pipe writes to non-full pipes may block until the pipe is |
2106 | + * emptied. |
2107 | + */ |
2108 | +#define PIPE_MIN_DEF_BUFFERS 2 |
2109 | + |
2110 | /* |
2111 | * The max size that a non-root user is allowed to grow the pipe. Can |
2112 | * be set by root in /proc/sys/fs/pipe-max-size |
2113 | @@ -666,8 +681,8 @@ struct pipe_inode_info *alloc_pipe_info(void) |
2114 | user_bufs = account_pipe_buffers(user, 0, pipe_bufs); |
2115 | |
2116 | if (too_many_pipe_buffers_soft(user_bufs) && is_unprivileged_user()) { |
2117 | - user_bufs = account_pipe_buffers(user, pipe_bufs, 1); |
2118 | - pipe_bufs = 1; |
2119 | + user_bufs = account_pipe_buffers(user, pipe_bufs, PIPE_MIN_DEF_BUFFERS); |
2120 | + pipe_bufs = PIPE_MIN_DEF_BUFFERS; |
2121 | } |
2122 | |
2123 | if (too_many_pipe_buffers_hard(user_bufs) && is_unprivileged_user()) |
2124 | diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c |
2125 | index 9e64e23014e8e..07d787145cc36 100644 |
2126 | --- a/fs/reiserfs/stree.c |
2127 | +++ b/fs/reiserfs/stree.c |
2128 | @@ -387,6 +387,24 @@ void pathrelse(struct treepath *search_path) |
2129 | search_path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET; |
2130 | } |
2131 | |
2132 | +static int has_valid_deh_location(struct buffer_head *bh, struct item_head *ih) |
2133 | +{ |
2134 | + struct reiserfs_de_head *deh; |
2135 | + int i; |
2136 | + |
2137 | + deh = B_I_DEH(bh, ih); |
2138 | + for (i = 0; i < ih_entry_count(ih); i++) { |
2139 | + if (deh_location(&deh[i]) > ih_item_len(ih)) { |
2140 | + reiserfs_warning(NULL, "reiserfs-5094", |
2141 | + "directory entry location seems wrong %h", |
2142 | + &deh[i]); |
2143 | + return 0; |
2144 | + } |
2145 | + } |
2146 | + |
2147 | + return 1; |
2148 | +} |
2149 | + |
2150 | static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) |
2151 | { |
2152 | struct block_head *blkh; |
2153 | @@ -454,11 +472,14 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) |
2154 | "(second one): %h", ih); |
2155 | return 0; |
2156 | } |
2157 | - if (is_direntry_le_ih(ih) && (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE))) { |
2158 | - reiserfs_warning(NULL, "reiserfs-5093", |
2159 | - "item entry count seems wrong %h", |
2160 | - ih); |
2161 | - return 0; |
2162 | + if (is_direntry_le_ih(ih)) { |
2163 | + if (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE)) { |
2164 | + reiserfs_warning(NULL, "reiserfs-5093", |
2165 | + "item entry count seems wrong %h", |
2166 | + ih); |
2167 | + return 0; |
2168 | + } |
2169 | + return has_valid_deh_location(bh, ih); |
2170 | } |
2171 | prev_location = ih_location(ih); |
2172 | } |
2173 | diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
2174 | index 1b9c7a387dc71..913f5af9bf248 100644 |
2175 | --- a/fs/reiserfs/super.c |
2176 | +++ b/fs/reiserfs/super.c |
2177 | @@ -2082,6 +2082,14 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) |
2178 | unlock_new_inode(root_inode); |
2179 | } |
2180 | |
2181 | + if (!S_ISDIR(root_inode->i_mode) || !inode_get_bytes(root_inode) || |
2182 | + !root_inode->i_size) { |
2183 | + SWARN(silent, s, "", "corrupt root inode, run fsck"); |
2184 | + iput(root_inode); |
2185 | + errval = -EUCLEAN; |
2186 | + goto error; |
2187 | + } |
2188 | + |
2189 | s->s_root = d_make_root(root_inode); |
2190 | if (!s->s_root) |
2191 | goto error; |
2192 | diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h |
2193 | index 7a03f68fb982d..91677f2fa2e8b 100644 |
2194 | --- a/include/linux/tee_drv.h |
2195 | +++ b/include/linux/tee_drv.h |
2196 | @@ -317,6 +317,7 @@ void *tee_get_drvdata(struct tee_device *teedev); |
2197 | * @returns a pointer to 'struct tee_shm' |
2198 | */ |
2199 | struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags); |
2200 | +struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size); |
2201 | |
2202 | /** |
2203 | * tee_shm_priv_alloc() - Allocate shared memory privately |
2204 | diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h |
2205 | index e78eb577d0fa1..8ef7d148c1493 100644 |
2206 | --- a/include/linux/usb/otg-fsm.h |
2207 | +++ b/include/linux/usb/otg-fsm.h |
2208 | @@ -196,6 +196,7 @@ struct otg_fsm { |
2209 | struct mutex lock; |
2210 | u8 *host_req_flag; |
2211 | struct delayed_work hnp_polling_work; |
2212 | + bool hnp_work_inited; |
2213 | bool state_changed; |
2214 | }; |
2215 | |
2216 | diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
2217 | index 325e8efb5b368..14d00cc10e22e 100644 |
2218 | --- a/include/net/bluetooth/hci_core.h |
2219 | +++ b/include/net/bluetooth/hci_core.h |
2220 | @@ -1056,6 +1056,7 @@ struct hci_dev *hci_alloc_dev(void); |
2221 | void hci_free_dev(struct hci_dev *hdev); |
2222 | int hci_register_dev(struct hci_dev *hdev); |
2223 | void hci_unregister_dev(struct hci_dev *hdev); |
2224 | +void hci_cleanup_dev(struct hci_dev *hdev); |
2225 | int hci_suspend_dev(struct hci_dev *hdev); |
2226 | int hci_resume_dev(struct hci_dev *hdev); |
2227 | int hci_reset_dev(struct hci_dev *hdev); |
2228 | diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h |
2229 | index feeecbc80e727..2c739fc752e1a 100644 |
2230 | --- a/include/net/ip6_route.h |
2231 | +++ b/include/net/ip6_route.h |
2232 | @@ -263,7 +263,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
2233 | |
2234 | static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb) |
2235 | { |
2236 | - int mtu; |
2237 | + unsigned int mtu; |
2238 | |
2239 | struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ? |
2240 | inet6_sk(skb->sk) : NULL; |
2241 | diff --git a/kernel/time/timer.c b/kernel/time/timer.c |
2242 | index 87fa73cdb90f6..16a2b62f5f74c 100644 |
2243 | --- a/kernel/time/timer.c |
2244 | +++ b/kernel/time/timer.c |
2245 | @@ -1269,8 +1269,10 @@ static inline void timer_base_unlock_expiry(struct timer_base *base) |
2246 | static void timer_sync_wait_running(struct timer_base *base) |
2247 | { |
2248 | if (atomic_read(&base->timer_waiters)) { |
2249 | + raw_spin_unlock_irq(&base->lock); |
2250 | spin_unlock(&base->expiry_lock); |
2251 | spin_lock(&base->expiry_lock); |
2252 | + raw_spin_lock_irq(&base->lock); |
2253 | } |
2254 | } |
2255 | |
2256 | @@ -1454,14 +1456,14 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head) |
2257 | if (timer->flags & TIMER_IRQSAFE) { |
2258 | raw_spin_unlock(&base->lock); |
2259 | call_timer_fn(timer, fn, baseclk); |
2260 | - base->running_timer = NULL; |
2261 | raw_spin_lock(&base->lock); |
2262 | + base->running_timer = NULL; |
2263 | } else { |
2264 | raw_spin_unlock_irq(&base->lock); |
2265 | call_timer_fn(timer, fn, baseclk); |
2266 | + raw_spin_lock_irq(&base->lock); |
2267 | base->running_timer = NULL; |
2268 | timer_sync_wait_running(base); |
2269 | - raw_spin_lock_irq(&base->lock); |
2270 | } |
2271 | } |
2272 | } |
2273 | diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
2274 | index 553add1eb457f..db2b10c718ba2 100644 |
2275 | --- a/kernel/trace/trace_events_hist.c |
2276 | +++ b/kernel/trace/trace_events_hist.c |
2277 | @@ -3169,6 +3169,10 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, |
2278 | |
2279 | expr->operands[0] = operand1; |
2280 | expr->operands[1] = operand2; |
2281 | + |
2282 | + /* The operand sizes should be the same, so just pick one */ |
2283 | + expr->size = operand1->size; |
2284 | + |
2285 | expr->operator = field_op; |
2286 | expr->name = expr_str(expr, 0); |
2287 | expr->type = kstrdup(operand1->type, GFP_KERNEL); |
2288 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
2289 | index 21a7ea9b70c8a..83a07fca9000f 100644 |
2290 | --- a/net/bluetooth/hci_core.c |
2291 | +++ b/net/bluetooth/hci_core.c |
2292 | @@ -3393,14 +3393,10 @@ EXPORT_SYMBOL(hci_register_dev); |
2293 | /* Unregister HCI device */ |
2294 | void hci_unregister_dev(struct hci_dev *hdev) |
2295 | { |
2296 | - int id; |
2297 | - |
2298 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
2299 | |
2300 | hci_dev_set_flag(hdev, HCI_UNREGISTER); |
2301 | |
2302 | - id = hdev->id; |
2303 | - |
2304 | write_lock(&hci_dev_list_lock); |
2305 | list_del(&hdev->list); |
2306 | write_unlock(&hci_dev_list_lock); |
2307 | @@ -3429,7 +3425,14 @@ void hci_unregister_dev(struct hci_dev *hdev) |
2308 | } |
2309 | |
2310 | device_del(&hdev->dev); |
2311 | + /* Actual cleanup is deferred until hci_cleanup_dev(). */ |
2312 | + hci_dev_put(hdev); |
2313 | +} |
2314 | +EXPORT_SYMBOL(hci_unregister_dev); |
2315 | |
2316 | +/* Cleanup HCI device */ |
2317 | +void hci_cleanup_dev(struct hci_dev *hdev) |
2318 | +{ |
2319 | debugfs_remove_recursive(hdev->debugfs); |
2320 | kfree_const(hdev->hw_info); |
2321 | kfree_const(hdev->fw_info); |
2322 | @@ -3452,11 +3455,8 @@ void hci_unregister_dev(struct hci_dev *hdev) |
2323 | hci_discovery_filter_clear(hdev); |
2324 | hci_dev_unlock(hdev); |
2325 | |
2326 | - hci_dev_put(hdev); |
2327 | - |
2328 | - ida_simple_remove(&hci_index_ida, id); |
2329 | + ida_simple_remove(&hci_index_ida, hdev->id); |
2330 | } |
2331 | -EXPORT_SYMBOL(hci_unregister_dev); |
2332 | |
2333 | /* Suspend HCI device */ |
2334 | int hci_suspend_dev(struct hci_dev *hdev) |
2335 | diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c |
2336 | index 8d2c26c4b6d3d..befab857a39be 100644 |
2337 | --- a/net/bluetooth/hci_sock.c |
2338 | +++ b/net/bluetooth/hci_sock.c |
2339 | @@ -59,6 +59,17 @@ struct hci_pinfo { |
2340 | char comm[TASK_COMM_LEN]; |
2341 | }; |
2342 | |
2343 | +static struct hci_dev *hci_hdev_from_sock(struct sock *sk) |
2344 | +{ |
2345 | + struct hci_dev *hdev = hci_pi(sk)->hdev; |
2346 | + |
2347 | + if (!hdev) |
2348 | + return ERR_PTR(-EBADFD); |
2349 | + if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) |
2350 | + return ERR_PTR(-EPIPE); |
2351 | + return hdev; |
2352 | +} |
2353 | + |
2354 | void hci_sock_set_flag(struct sock *sk, int nr) |
2355 | { |
2356 | set_bit(nr, &hci_pi(sk)->flags); |
2357 | @@ -752,19 +763,13 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) |
2358 | if (event == HCI_DEV_UNREG) { |
2359 | struct sock *sk; |
2360 | |
2361 | - /* Detach sockets from device */ |
2362 | + /* Wake up sockets using this dead device */ |
2363 | read_lock(&hci_sk_list.lock); |
2364 | sk_for_each(sk, &hci_sk_list.head) { |
2365 | - lock_sock(sk); |
2366 | if (hci_pi(sk)->hdev == hdev) { |
2367 | - hci_pi(sk)->hdev = NULL; |
2368 | sk->sk_err = EPIPE; |
2369 | - sk->sk_state = BT_OPEN; |
2370 | sk->sk_state_change(sk); |
2371 | - |
2372 | - hci_dev_put(hdev); |
2373 | } |
2374 | - release_sock(sk); |
2375 | } |
2376 | read_unlock(&hci_sk_list.lock); |
2377 | } |
2378 | @@ -923,10 +928,10 @@ static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg) |
2379 | static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, |
2380 | unsigned long arg) |
2381 | { |
2382 | - struct hci_dev *hdev = hci_pi(sk)->hdev; |
2383 | + struct hci_dev *hdev = hci_hdev_from_sock(sk); |
2384 | |
2385 | - if (!hdev) |
2386 | - return -EBADFD; |
2387 | + if (IS_ERR(hdev)) |
2388 | + return PTR_ERR(hdev); |
2389 | |
2390 | if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) |
2391 | return -EBUSY; |
2392 | @@ -1080,6 +1085,18 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, |
2393 | |
2394 | lock_sock(sk); |
2395 | |
2396 | + /* Allow detaching from dead device and attaching to alive device, if |
2397 | + * the caller wants to re-bind (instead of close) this socket in |
2398 | + * response to hci_sock_dev_event(HCI_DEV_UNREG) notification. |
2399 | + */ |
2400 | + hdev = hci_pi(sk)->hdev; |
2401 | + if (hdev && hci_dev_test_flag(hdev, HCI_UNREGISTER)) { |
2402 | + hci_pi(sk)->hdev = NULL; |
2403 | + sk->sk_state = BT_OPEN; |
2404 | + hci_dev_put(hdev); |
2405 | + } |
2406 | + hdev = NULL; |
2407 | + |
2408 | if (sk->sk_state == BT_BOUND) { |
2409 | err = -EALREADY; |
2410 | goto done; |
2411 | @@ -1356,9 +1373,9 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, |
2412 | |
2413 | lock_sock(sk); |
2414 | |
2415 | - hdev = hci_pi(sk)->hdev; |
2416 | - if (!hdev) { |
2417 | - err = -EBADFD; |
2418 | + hdev = hci_hdev_from_sock(sk); |
2419 | + if (IS_ERR(hdev)) { |
2420 | + err = PTR_ERR(hdev); |
2421 | goto done; |
2422 | } |
2423 | |
2424 | @@ -1718,9 +1735,9 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
2425 | goto done; |
2426 | } |
2427 | |
2428 | - hdev = hci_pi(sk)->hdev; |
2429 | - if (!hdev) { |
2430 | - err = -EBADFD; |
2431 | + hdev = hci_hdev_from_sock(sk); |
2432 | + if (IS_ERR(hdev)) { |
2433 | + err = PTR_ERR(hdev); |
2434 | goto done; |
2435 | } |
2436 | |
2437 | diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c |
2438 | index 9874844a95a98..b69d88b88d2e4 100644 |
2439 | --- a/net/bluetooth/hci_sysfs.c |
2440 | +++ b/net/bluetooth/hci_sysfs.c |
2441 | @@ -83,6 +83,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn) |
2442 | static void bt_host_release(struct device *dev) |
2443 | { |
2444 | struct hci_dev *hdev = to_hci_dev(dev); |
2445 | + |
2446 | + if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) |
2447 | + hci_cleanup_dev(hdev); |
2448 | kfree(hdev); |
2449 | module_put(THIS_MODULE); |
2450 | } |
2451 | diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c |
2452 | index e09147ac9a990..fc61cd3fea652 100644 |
2453 | --- a/net/ipv4/tcp_offload.c |
2454 | +++ b/net/ipv4/tcp_offload.c |
2455 | @@ -298,6 +298,9 @@ int tcp_gro_complete(struct sk_buff *skb) |
2456 | if (th->cwr) |
2457 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; |
2458 | |
2459 | + if (skb->encapsulation) |
2460 | + skb->inner_transport_header = skb->transport_header; |
2461 | + |
2462 | return 0; |
2463 | } |
2464 | EXPORT_SYMBOL(tcp_gro_complete); |
2465 | diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c |
2466 | index c463eebdc8fe2..487a92d75c703 100644 |
2467 | --- a/net/ipv4/udp_offload.c |
2468 | +++ b/net/ipv4/udp_offload.c |
2469 | @@ -501,6 +501,10 @@ static int udp_gro_complete_segment(struct sk_buff *skb) |
2470 | |
2471 | skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; |
2472 | skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_L4; |
2473 | + |
2474 | + if (skb->encapsulation) |
2475 | + skb->inner_transport_header = skb->transport_header; |
2476 | + |
2477 | return 0; |
2478 | } |
2479 | |
2480 | diff --git a/net/sctp/auth.c b/net/sctp/auth.c |
2481 | index 7eced1e523a5e..3b2d0bd616dd4 100644 |
2482 | --- a/net/sctp/auth.c |
2483 | +++ b/net/sctp/auth.c |
2484 | @@ -863,14 +863,18 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, |
2485 | memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylength); |
2486 | cur_key->key = key; |
2487 | |
2488 | - if (replace) { |
2489 | - list_del_init(&shkey->key_list); |
2490 | - sctp_auth_shkey_release(shkey); |
2491 | - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) |
2492 | - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); |
2493 | + if (!replace) { |
2494 | + list_add(&cur_key->key_list, sh_keys); |
2495 | + return 0; |
2496 | } |
2497 | + |
2498 | + list_del_init(&shkey->key_list); |
2499 | + sctp_auth_shkey_release(shkey); |
2500 | list_add(&cur_key->key_list, sh_keys); |
2501 | |
2502 | + if (asoc && asoc->active_key_id == auth_key->sca_keynumber) |
2503 | + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); |
2504 | + |
2505 | return 0; |
2506 | } |
2507 | |
2508 | diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py |
2509 | index 74f8aadfd4cbc..7011fbe003ff2 100755 |
2510 | --- a/scripts/tracing/draw_functrace.py |
2511 | +++ b/scripts/tracing/draw_functrace.py |
2512 | @@ -17,7 +17,7 @@ Usage: |
2513 | $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func |
2514 | Wait some times but not too much, the script is a bit slow. |
2515 | Break the pipe (Ctrl + Z) |
2516 | - $ scripts/draw_functrace.py < raw_trace_func > draw_functrace |
2517 | + $ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace |
2518 | Then you have your drawn trace in draw_functrace |
2519 | """ |
2520 | |
2521 | @@ -103,10 +103,10 @@ def parseLine(line): |
2522 | line = line.strip() |
2523 | if line.startswith("#"): |
2524 | raise CommentLineException |
2525 | - m = re.match("[^]]+?\\] +([0-9.]+): (\\w+) <-(\\w+)", line) |
2526 | + m = re.match("[^]]+?\\] +([a-z.]+) +([0-9.]+): (\\w+) <-(\\w+)", line) |
2527 | if m is None: |
2528 | raise BrokenLineException |
2529 | - return (m.group(1), m.group(2), m.group(3)) |
2530 | + return (m.group(2), m.group(3), m.group(4)) |
2531 | |
2532 | |
2533 | def main(): |
2534 | diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c |
2535 | index 83be6b982a87c..97e8eb38b0961 100644 |
2536 | --- a/sound/core/seq/seq_ports.c |
2537 | +++ b/sound/core/seq/seq_ports.c |
2538 | @@ -514,10 +514,11 @@ static int check_and_subscribe_port(struct snd_seq_client *client, |
2539 | return err; |
2540 | } |
2541 | |
2542 | -static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
2543 | - struct snd_seq_client_port *port, |
2544 | - struct snd_seq_subscribers *subs, |
2545 | - bool is_src, bool ack) |
2546 | +/* called with grp->list_mutex held */ |
2547 | +static void __delete_and_unsubscribe_port(struct snd_seq_client *client, |
2548 | + struct snd_seq_client_port *port, |
2549 | + struct snd_seq_subscribers *subs, |
2550 | + bool is_src, bool ack) |
2551 | { |
2552 | struct snd_seq_port_subs_info *grp; |
2553 | struct list_head *list; |
2554 | @@ -525,7 +526,6 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
2555 | |
2556 | grp = is_src ? &port->c_src : &port->c_dest; |
2557 | list = is_src ? &subs->src_list : &subs->dest_list; |
2558 | - down_write(&grp->list_mutex); |
2559 | write_lock_irq(&grp->list_lock); |
2560 | empty = list_empty(list); |
2561 | if (!empty) |
2562 | @@ -535,6 +535,18 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
2563 | |
2564 | if (!empty) |
2565 | unsubscribe_port(client, port, grp, &subs->info, ack); |
2566 | +} |
2567 | + |
2568 | +static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
2569 | + struct snd_seq_client_port *port, |
2570 | + struct snd_seq_subscribers *subs, |
2571 | + bool is_src, bool ack) |
2572 | +{ |
2573 | + struct snd_seq_port_subs_info *grp; |
2574 | + |
2575 | + grp = is_src ? &port->c_src : &port->c_dest; |
2576 | + down_write(&grp->list_mutex); |
2577 | + __delete_and_unsubscribe_port(client, port, subs, is_src, ack); |
2578 | up_write(&grp->list_mutex); |
2579 | } |
2580 | |
2581 | @@ -590,27 +602,30 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, |
2582 | struct snd_seq_client_port *dest_port, |
2583 | struct snd_seq_port_subscribe *info) |
2584 | { |
2585 | - struct snd_seq_port_subs_info *src = &src_port->c_src; |
2586 | + struct snd_seq_port_subs_info *dest = &dest_port->c_dest; |
2587 | struct snd_seq_subscribers *subs; |
2588 | int err = -ENOENT; |
2589 | |
2590 | - down_write(&src->list_mutex); |
2591 | + /* always start from deleting the dest port for avoiding concurrent |
2592 | + * deletions |
2593 | + */ |
2594 | + down_write(&dest->list_mutex); |
2595 | /* look for the connection */ |
2596 | - list_for_each_entry(subs, &src->list_head, src_list) { |
2597 | + list_for_each_entry(subs, &dest->list_head, dest_list) { |
2598 | if (match_subs_info(info, &subs->info)) { |
2599 | - atomic_dec(&subs->ref_count); /* mark as not ready */ |
2600 | + __delete_and_unsubscribe_port(dest_client, dest_port, |
2601 | + subs, false, |
2602 | + connector->number != dest_client->number); |
2603 | err = 0; |
2604 | break; |
2605 | } |
2606 | } |
2607 | - up_write(&src->list_mutex); |
2608 | + up_write(&dest->list_mutex); |
2609 | if (err < 0) |
2610 | return err; |
2611 | |
2612 | delete_and_unsubscribe_port(src_client, src_port, subs, true, |
2613 | connector->number != src_client->number); |
2614 | - delete_and_unsubscribe_port(dest_client, dest_port, subs, false, |
2615 | - connector->number != dest_client->number); |
2616 | kfree(subs); |
2617 | return 0; |
2618 | } |
2619 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2620 | index f5606036b6a29..a0d1561eeb532 100644 |
2621 | --- a/sound/pci/hda/patch_realtek.c |
2622 | +++ b/sound/pci/hda/patch_realtek.c |
2623 | @@ -7971,6 +7971,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
2624 | SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), |
2625 | SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), |
2626 | SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), |
2627 | + SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), |
2628 | SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), |
2629 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
2630 | SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), |
2631 | diff --git a/sound/usb/clock.c b/sound/usb/clock.c |
2632 | index 6a51b9d20eebf..3d1c0ec117536 100644 |
2633 | --- a/sound/usb/clock.c |
2634 | +++ b/sound/usb/clock.c |
2635 | @@ -319,6 +319,12 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, |
2636 | selector->baCSourceID[ret - 1], |
2637 | visited, validate); |
2638 | if (ret > 0) { |
2639 | + /* |
2640 | + * For Samsung USBC Headset (AKG), setting clock selector again |
2641 | + * will result in incorrect default clock setting problems |
2642 | + */ |
2643 | + if (chip->usb_id == USB_ID(0x04e8, 0xa051)) |
2644 | + return ret; |
2645 | err = uac_clock_selector_set_val(chip, entity_id, cur); |
2646 | if (err < 0) |
2647 | return err; |
2648 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
2649 | index 5b17a5c5785c0..4d20f3f45f7e2 100644 |
2650 | --- a/sound/usb/quirks.c |
2651 | +++ b/sound/usb/quirks.c |
2652 | @@ -1842,6 +1842,7 @@ static const struct registration_quirk registration_quirks[] = { |
2653 | REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ |
2654 | REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ |
2655 | REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ |
2656 | + REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ |
2657 | REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ |
2658 | { 0 } /* terminator */ |
2659 | }; |
2660 | diff --git a/tools/testing/selftests/bpf/verifier/stack_ptr.c b/tools/testing/selftests/bpf/verifier/stack_ptr.c |
2661 | index 7276620ef242a..53d2a5a5ec582 100644 |
2662 | --- a/tools/testing/selftests/bpf/verifier/stack_ptr.c |
2663 | +++ b/tools/testing/selftests/bpf/verifier/stack_ptr.c |
2664 | @@ -291,8 +291,6 @@ |
2665 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), |
2666 | BPF_EXIT_INSN(), |
2667 | }, |
2668 | - .result_unpriv = REJECT, |
2669 | - .errstr_unpriv = "invalid stack off=0 size=1", |
2670 | .result = ACCEPT, |
2671 | .retval = 42, |
2672 | }, |
2673 | diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
2674 | index a8dab0f58462e..188ac92c56d1b 100644 |
2675 | --- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
2676 | +++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
2677 | @@ -301,8 +301,6 @@ |
2678 | }, |
2679 | .fixup_map_array_48b = { 3 }, |
2680 | .result = ACCEPT, |
2681 | - .result_unpriv = REJECT, |
2682 | - .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", |
2683 | .retval = 1, |
2684 | }, |
2685 | { |
2686 | @@ -372,8 +370,6 @@ |
2687 | }, |
2688 | .fixup_map_array_48b = { 3 }, |
2689 | .result = ACCEPT, |
2690 | - .result_unpriv = REJECT, |
2691 | - .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", |
2692 | .retval = 1, |
2693 | }, |
2694 | { |
2695 | @@ -473,8 +469,6 @@ |
2696 | }, |
2697 | .fixup_map_array_48b = { 3 }, |
2698 | .result = ACCEPT, |
2699 | - .result_unpriv = REJECT, |
2700 | - .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", |
2701 | .retval = 1, |
2702 | }, |
2703 | { |
2704 | @@ -767,8 +761,6 @@ |
2705 | }, |
2706 | .fixup_map_array_48b = { 3 }, |
2707 | .result = ACCEPT, |
2708 | - .result_unpriv = REJECT, |
2709 | - .errstr_unpriv = "R0 pointer arithmetic of map value goes out of range", |
2710 | .retval = 1, |
2711 | }, |
2712 | { |
2713 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
2714 | index 862c0708f58df..fc48298649c6c 100644 |
2715 | --- a/virt/kvm/kvm_main.c |
2716 | +++ b/virt/kvm/kvm_main.c |
2717 | @@ -635,6 +635,8 @@ static void kvm_destroy_vm_debugfs(struct kvm *kvm) |
2718 | |
2719 | static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) |
2720 | { |
2721 | + static DEFINE_MUTEX(kvm_debugfs_lock); |
2722 | + struct dentry *dent; |
2723 | char dir_name[ITOA_MAX_LEN * 2]; |
2724 | struct kvm_stat_data *stat_data; |
2725 | struct kvm_stats_debugfs_item *p; |
2726 | @@ -643,8 +645,20 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) |
2727 | return 0; |
2728 | |
2729 | snprintf(dir_name, sizeof(dir_name), "%d-%d", task_pid_nr(current), fd); |
2730 | - kvm->debugfs_dentry = debugfs_create_dir(dir_name, kvm_debugfs_dir); |
2731 | + mutex_lock(&kvm_debugfs_lock); |
2732 | + dent = debugfs_lookup(dir_name, kvm_debugfs_dir); |
2733 | + if (dent) { |
2734 | + pr_warn_ratelimited("KVM: debugfs: duplicate directory %s\n", dir_name); |
2735 | + dput(dent); |
2736 | + mutex_unlock(&kvm_debugfs_lock); |
2737 | + return 0; |
2738 | + } |
2739 | + dent = debugfs_create_dir(dir_name, kvm_debugfs_dir); |
2740 | + mutex_unlock(&kvm_debugfs_lock); |
2741 | + if (IS_ERR(dent)) |
2742 | + return 0; |
2743 | |
2744 | + kvm->debugfs_dentry = dent; |
2745 | kvm->debugfs_stat_data = kcalloc(kvm_debugfs_num_entries, |
2746 | sizeof(*kvm->debugfs_stat_data), |
2747 | GFP_KERNEL_ACCOUNT); |
2748 | @@ -4367,7 +4381,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) |
2749 | } |
2750 | add_uevent_var(env, "PID=%d", kvm->userspace_pid); |
2751 | |
2752 | - if (!IS_ERR_OR_NULL(kvm->debugfs_dentry)) { |
2753 | + if (kvm->debugfs_dentry) { |
2754 | char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL_ACCOUNT); |
2755 | |
2756 | if (p) { |