Contents of /trunk/kernel-alx/patches-5.4/0312-5.4.213-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(show annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (19 months, 3 weeks ago) by niro
File size: 103083 byte(s)
Mon Oct 24 12:34:12 2022 UTC (19 months, 3 weeks ago) by niro
File size: 103083 byte(s)
-sync kernel patches
1 | diff --git a/Makefile b/Makefile |
2 | index cecfe23f521f1..4a4c83d2b3f7c 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 = 212 |
10 | +SUBLEVEL = 213 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
15 | index eea317b41020d..5e454a694b78a 100644 |
16 | --- a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
17 | +++ b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
18 | @@ -51,16 +51,6 @@ |
19 | vin-supply = <®_3p3v_s5>; |
20 | }; |
21 | |
22 | - reg_3p3v_s0: regulator-3p3v-s0 { |
23 | - compatible = "regulator-fixed"; |
24 | - regulator-name = "V_3V3_S0"; |
25 | - regulator-min-microvolt = <3300000>; |
26 | - regulator-max-microvolt = <3300000>; |
27 | - regulator-always-on; |
28 | - regulator-boot-on; |
29 | - vin-supply = <®_3p3v_s5>; |
30 | - }; |
31 | - |
32 | reg_3p3v_s5: regulator-3p3v-s5 { |
33 | compatible = "regulator-fixed"; |
34 | regulator-name = "V_3V3_S5"; |
35 | diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c |
36 | index 587543c6c51cb..97c42be71338a 100644 |
37 | --- a/arch/arm64/kernel/cacheinfo.c |
38 | +++ b/arch/arm64/kernel/cacheinfo.c |
39 | @@ -45,7 +45,8 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, |
40 | |
41 | int init_cache_level(unsigned int cpu) |
42 | { |
43 | - unsigned int ctype, level, leaves, fw_level; |
44 | + unsigned int ctype, level, leaves; |
45 | + int fw_level; |
46 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); |
47 | |
48 | for (level = 1, leaves = 0; level <= MAX_CACHE_LEVEL; level++) { |
49 | @@ -63,6 +64,9 @@ int init_cache_level(unsigned int cpu) |
50 | else |
51 | fw_level = acpi_find_last_cache_level(cpu); |
52 | |
53 | + if (fw_level < 0) |
54 | + return fw_level; |
55 | + |
56 | if (level < fw_level) { |
57 | /* |
58 | * some external caches not specified in CLIDR_EL1 |
59 | diff --git a/arch/mips/loongson32/ls1c/board.c b/arch/mips/loongson32/ls1c/board.c |
60 | index e9de6da0ce51f..9dcfe9de55b0a 100644 |
61 | --- a/arch/mips/loongson32/ls1c/board.c |
62 | +++ b/arch/mips/loongson32/ls1c/board.c |
63 | @@ -15,7 +15,6 @@ static struct platform_device *ls1c_platform_devices[] __initdata = { |
64 | static int __init ls1c_platform_init(void) |
65 | { |
66 | ls1x_serial_set_uartclk(&ls1x_uart_pdev); |
67 | - ls1x_rtc_set_extclk(&ls1x_rtc_pdev); |
68 | |
69 | return platform_add_devices(ls1c_platform_devices, |
70 | ARRAY_SIZE(ls1c_platform_devices)); |
71 | diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S |
72 | index 951a339369dd5..b59a0c3d36921 100644 |
73 | --- a/arch/parisc/kernel/head.S |
74 | +++ b/arch/parisc/kernel/head.S |
75 | @@ -22,7 +22,7 @@ |
76 | #include <linux/linkage.h> |
77 | #include <linux/init.h> |
78 | |
79 | - .level PA_ASM_LEVEL |
80 | + .level 1.1 |
81 | |
82 | __INITDATA |
83 | ENTRY(boot_args) |
84 | @@ -69,6 +69,47 @@ $bss_loop: |
85 | stw,ma %arg2,4(%r1) |
86 | stw,ma %arg3,4(%r1) |
87 | |
88 | +#if !defined(CONFIG_64BIT) && defined(CONFIG_PA20) |
89 | + /* This 32-bit kernel was compiled for PA2.0 CPUs. Check current CPU |
90 | + * and halt kernel if we detect a PA1.x CPU. */ |
91 | + ldi 32,%r10 |
92 | + mtctl %r10,%cr11 |
93 | + .level 2.0 |
94 | + mfctl,w %cr11,%r10 |
95 | + .level 1.1 |
96 | + comib,<>,n 0,%r10,$cpu_ok |
97 | + |
98 | + load32 PA(msg1),%arg0 |
99 | + ldi msg1_end-msg1,%arg1 |
100 | +$iodc_panic: |
101 | + copy %arg0, %r10 |
102 | + copy %arg1, %r11 |
103 | + load32 PA(init_stack),%sp |
104 | +#define MEM_CONS 0x3A0 |
105 | + ldw MEM_CONS+32(%r0),%arg0 // HPA |
106 | + ldi ENTRY_IO_COUT,%arg1 |
107 | + ldw MEM_CONS+36(%r0),%arg2 // SPA |
108 | + ldw MEM_CONS+8(%r0),%arg3 // layers |
109 | + load32 PA(__bss_start),%r1 |
110 | + stw %r1,-52(%sp) // arg4 |
111 | + stw %r0,-56(%sp) // arg5 |
112 | + stw %r10,-60(%sp) // arg6 = ptr to text |
113 | + stw %r11,-64(%sp) // arg7 = len |
114 | + stw %r0,-68(%sp) // arg8 |
115 | + load32 PA(.iodc_panic_ret), %rp |
116 | + ldw MEM_CONS+40(%r0),%r1 // ENTRY_IODC |
117 | + bv,n (%r1) |
118 | +.iodc_panic_ret: |
119 | + b . /* wait endless with ... */ |
120 | + or %r10,%r10,%r10 /* qemu idle sleep */ |
121 | +msg1: .ascii "Can't boot kernel which was built for PA8x00 CPUs on this machine.\r\n" |
122 | +msg1_end: |
123 | + |
124 | +$cpu_ok: |
125 | +#endif |
126 | + |
127 | + .level PA_ASM_LEVEL |
128 | + |
129 | /* Initialize startup VM. Just map first 16/32 MB of memory */ |
130 | load32 PA(swapper_pg_dir),%r4 |
131 | mtctl %r4,%cr24 /* Initialize kernel root pointer */ |
132 | diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S |
133 | index 5b905a2f4e4df..4a8f3526f5a53 100644 |
134 | --- a/arch/powerpc/kernel/systbl.S |
135 | +++ b/arch/powerpc/kernel/systbl.S |
136 | @@ -25,6 +25,7 @@ sys_call_table: |
137 | #include <asm/syscall_table_64.h> |
138 | #undef __SYSCALL |
139 | #else |
140 | + .p2align 2 |
141 | #define __SYSCALL(nr, entry) .long entry |
142 | #include <asm/syscall_table_32.h> |
143 | #undef __SYSCALL |
144 | diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h |
145 | index de8f0bf5f238c..487725e49b961 100644 |
146 | --- a/arch/s390/include/asm/hugetlb.h |
147 | +++ b/arch/s390/include/asm/hugetlb.h |
148 | @@ -35,9 +35,11 @@ static inline bool is_hugepage_only_range(struct mm_struct *mm, |
149 | static inline int prepare_hugepage_range(struct file *file, |
150 | unsigned long addr, unsigned long len) |
151 | { |
152 | - if (len & ~HPAGE_MASK) |
153 | + struct hstate *h = hstate_file(file); |
154 | + |
155 | + if (len & ~huge_page_mask(h)) |
156 | return -EINVAL; |
157 | - if (addr & ~HPAGE_MASK) |
158 | + if (addr & ~huge_page_mask(h)) |
159 | return -EINVAL; |
160 | return 0; |
161 | } |
162 | diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S |
163 | index 7e0eb40209177..4df41695caec8 100644 |
164 | --- a/arch/s390/kernel/vmlinux.lds.S |
165 | +++ b/arch/s390/kernel/vmlinux.lds.S |
166 | @@ -124,6 +124,7 @@ SECTIONS |
167 | /* |
168 | * Table with the patch locations to undo expolines |
169 | */ |
170 | + . = ALIGN(4); |
171 | .nospec_call_table : { |
172 | __nospec_call_start = . ; |
173 | *(.s390_indirect*) |
174 | diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h |
175 | index 1e5df3ccdd5cb..a1ee1a760c3eb 100644 |
176 | --- a/arch/x86/include/asm/nospec-branch.h |
177 | +++ b/arch/x86/include/asm/nospec-branch.h |
178 | @@ -44,6 +44,7 @@ |
179 | * the optimal version — two calls, each with their own speculation |
180 | * trap should their return address end up getting used, in a loop. |
181 | */ |
182 | +#ifdef CONFIG_X86_64 |
183 | #define __FILL_RETURN_BUFFER(reg, nr, sp) \ |
184 | mov $(nr/2), reg; \ |
185 | 771: \ |
186 | @@ -64,6 +65,19 @@ |
187 | add $(BITS_PER_LONG/8) * nr, sp; \ |
188 | /* barrier for jnz misprediction */ \ |
189 | lfence; |
190 | +#else |
191 | +/* |
192 | + * i386 doesn't unconditionally have LFENCE, as such it can't |
193 | + * do a loop. |
194 | + */ |
195 | +#define __FILL_RETURN_BUFFER(reg, nr, sp) \ |
196 | + .rept nr; \ |
197 | + call 772f; \ |
198 | + int3; \ |
199 | +772:; \ |
200 | + .endr; \ |
201 | + add $(BITS_PER_LONG/8) * nr, sp; |
202 | +#endif |
203 | |
204 | #define __ISSUE_UNBALANCED_RET_GUARD(sp) \ |
205 | call 881f; \ |
206 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
207 | index c273d0df69394..807ee97254795 100644 |
208 | --- a/drivers/android/binder.c |
209 | +++ b/drivers/android/binder.c |
210 | @@ -1748,6 +1748,18 @@ static int binder_inc_ref_for_node(struct binder_proc *proc, |
211 | } |
212 | ret = binder_inc_ref_olocked(ref, strong, target_list); |
213 | *rdata = ref->data; |
214 | + if (ret && ref == new_ref) { |
215 | + /* |
216 | + * Cleanup the failed reference here as the target |
217 | + * could now be dead and have already released its |
218 | + * references by now. Calling on the new reference |
219 | + * with strong=0 and a tmp_refs will not decrement |
220 | + * the node. The new_ref gets kfree'd below. |
221 | + */ |
222 | + binder_cleanup_ref_olocked(new_ref); |
223 | + ref = NULL; |
224 | + } |
225 | + |
226 | binder_proc_unlock(proc); |
227 | if (new_ref && ref != new_ref) |
228 | /* |
229 | diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
230 | index 4e45c87ed1778..10063d8a1b7d4 100644 |
231 | --- a/drivers/base/dd.c |
232 | +++ b/drivers/base/dd.c |
233 | @@ -818,6 +818,11 @@ static int __device_attach_driver(struct device_driver *drv, void *_data) |
234 | } else if (ret == -EPROBE_DEFER) { |
235 | dev_dbg(dev, "Device match requests probe deferral\n"); |
236 | driver_deferred_probe_add(dev); |
237 | + /* |
238 | + * Device can't match with a driver right now, so don't attempt |
239 | + * to match or bind with other drivers on the bus. |
240 | + */ |
241 | + return ret; |
242 | } else if (ret < 0) { |
243 | dev_dbg(dev, "Bus failed to match device: %d", ret); |
244 | return ret; |
245 | @@ -1057,6 +1062,11 @@ static int __driver_attach(struct device *dev, void *data) |
246 | } else if (ret == -EPROBE_DEFER) { |
247 | dev_dbg(dev, "Device match requests probe deferral\n"); |
248 | driver_deferred_probe_add(dev); |
249 | + /* |
250 | + * Driver could not match with device, but may match with |
251 | + * another device on the bus. |
252 | + */ |
253 | + return 0; |
254 | } else if (ret < 0) { |
255 | dev_dbg(dev, "Bus failed to match device: %d", ret); |
256 | return ret; |
257 | diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c |
258 | index 1654fd0eedc94..a790a8ca02ff4 100644 |
259 | --- a/drivers/clk/bcm/clk-raspberrypi.c |
260 | +++ b/drivers/clk/bcm/clk-raspberrypi.c |
261 | @@ -113,7 +113,7 @@ static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw, |
262 | RPI_FIRMWARE_ARM_CLK_ID, |
263 | &val); |
264 | if (ret) |
265 | - return ret; |
266 | + return 0; |
267 | |
268 | return val * RPI_FIRMWARE_PLLB_ARM_DIV_RATE; |
269 | } |
270 | diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
271 | index 13332f89e034b..c002f83adf573 100644 |
272 | --- a/drivers/clk/clk.c |
273 | +++ b/drivers/clk/clk.c |
274 | @@ -852,10 +852,9 @@ static void clk_core_unprepare(struct clk_core *core) |
275 | if (core->ops->unprepare) |
276 | core->ops->unprepare(core->hw); |
277 | |
278 | - clk_pm_runtime_put(core); |
279 | - |
280 | trace_clk_unprepare_complete(core); |
281 | clk_core_unprepare(core->parent); |
282 | + clk_pm_runtime_put(core); |
283 | } |
284 | |
285 | static void clk_core_unprepare_lock(struct clk_core *core) |
286 | diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c |
287 | index b1395133389ed..b82cc8beac671 100644 |
288 | --- a/drivers/firmware/efi/capsule-loader.c |
289 | +++ b/drivers/firmware/efi/capsule-loader.c |
290 | @@ -241,29 +241,6 @@ failed: |
291 | return ret; |
292 | } |
293 | |
294 | -/** |
295 | - * efi_capsule_flush - called by file close or file flush |
296 | - * @file: file pointer |
297 | - * @id: not used |
298 | - * |
299 | - * If a capsule is being partially uploaded then calling this function |
300 | - * will be treated as upload termination and will free those completed |
301 | - * buffer pages and -ECANCELED will be returned. |
302 | - **/ |
303 | -static int efi_capsule_flush(struct file *file, fl_owner_t id) |
304 | -{ |
305 | - int ret = 0; |
306 | - struct capsule_info *cap_info = file->private_data; |
307 | - |
308 | - if (cap_info->index > 0) { |
309 | - pr_err("capsule upload not complete\n"); |
310 | - efi_free_all_buff_pages(cap_info); |
311 | - ret = -ECANCELED; |
312 | - } |
313 | - |
314 | - return ret; |
315 | -} |
316 | - |
317 | /** |
318 | * efi_capsule_release - called by file close |
319 | * @inode: not used |
320 | @@ -276,6 +253,13 @@ static int efi_capsule_release(struct inode *inode, struct file *file) |
321 | { |
322 | struct capsule_info *cap_info = file->private_data; |
323 | |
324 | + if (cap_info->index > 0 && |
325 | + (cap_info->header.headersize == 0 || |
326 | + cap_info->count < cap_info->total_size)) { |
327 | + pr_err("capsule upload not complete\n"); |
328 | + efi_free_all_buff_pages(cap_info); |
329 | + } |
330 | + |
331 | kfree(cap_info->pages); |
332 | kfree(cap_info->phys); |
333 | kfree(file->private_data); |
334 | @@ -323,7 +307,6 @@ static const struct file_operations efi_capsule_fops = { |
335 | .owner = THIS_MODULE, |
336 | .open = efi_capsule_open, |
337 | .write = efi_capsule_write, |
338 | - .flush = efi_capsule_flush, |
339 | .release = efi_capsule_release, |
340 | .llseek = no_llseek, |
341 | }; |
342 | diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
343 | index 317f54f19477e..c81d73d5e0159 100644 |
344 | --- a/drivers/gpio/gpio-pca953x.c |
345 | +++ b/drivers/gpio/gpio-pca953x.c |
346 | @@ -1198,7 +1198,9 @@ static int pca953x_suspend(struct device *dev) |
347 | { |
348 | struct pca953x_chip *chip = dev_get_drvdata(dev); |
349 | |
350 | + mutex_lock(&chip->i2c_lock); |
351 | regcache_cache_only(chip->regmap, true); |
352 | + mutex_unlock(&chip->i2c_lock); |
353 | |
354 | if (atomic_read(&chip->wakeup_path)) |
355 | device_set_wakeup_path(dev); |
356 | @@ -1221,13 +1223,17 @@ static int pca953x_resume(struct device *dev) |
357 | } |
358 | } |
359 | |
360 | + mutex_lock(&chip->i2c_lock); |
361 | regcache_cache_only(chip->regmap, false); |
362 | regcache_mark_dirty(chip->regmap); |
363 | ret = pca953x_regcache_sync(dev); |
364 | - if (ret) |
365 | + if (ret) { |
366 | + mutex_unlock(&chip->i2c_lock); |
367 | return ret; |
368 | + } |
369 | |
370 | ret = regcache_sync(chip->regmap); |
371 | + mutex_unlock(&chip->i2c_lock); |
372 | if (ret) { |
373 | dev_err(dev, "Failed to restore register map: %d\n", ret); |
374 | return ret; |
375 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
376 | index 5906a8951a6c6..685a2df01d096 100644 |
377 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
378 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
379 | @@ -2472,7 +2472,8 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev) |
380 | |
381 | gfx_v9_0_tiling_mode_table_init(adev); |
382 | |
383 | - gfx_v9_0_setup_rb(adev); |
384 | + if (adev->gfx.num_gfx_rings) |
385 | + gfx_v9_0_setup_rb(adev); |
386 | gfx_v9_0_get_cu_info(adev, &adev->gfx.cu_info); |
387 | adev->gfx.config.db_debug2 = RREG32_SOC15(GC, 0, mmDB_DEBUG2); |
388 | |
389 | diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
390 | index 641f1258f08dc..e60157fe7a7bf 100644 |
391 | --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
392 | +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
393 | @@ -182,6 +182,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) |
394 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); |
395 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2, tmp); |
396 | |
397 | + tmp = mmVM_L2_CNTL3_DEFAULT; |
398 | if (adev->gmc.translate_further) { |
399 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12); |
400 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, |
401 | diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c |
402 | index 25a2d80287d67..d6a72f3cb1fbd 100644 |
403 | --- a/drivers/gpu/drm/drm_gem.c |
404 | +++ b/drivers/gpu/drm/drm_gem.c |
405 | @@ -167,21 +167,6 @@ void drm_gem_private_object_init(struct drm_device *dev, |
406 | } |
407 | EXPORT_SYMBOL(drm_gem_private_object_init); |
408 | |
409 | -static void |
410 | -drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp) |
411 | -{ |
412 | - /* |
413 | - * Note: obj->dma_buf can't disappear as long as we still hold a |
414 | - * handle reference in obj->handle_count. |
415 | - */ |
416 | - mutex_lock(&filp->prime.lock); |
417 | - if (obj->dma_buf) { |
418 | - drm_prime_remove_buf_handle_locked(&filp->prime, |
419 | - obj->dma_buf); |
420 | - } |
421 | - mutex_unlock(&filp->prime.lock); |
422 | -} |
423 | - |
424 | /** |
425 | * drm_gem_object_handle_free - release resources bound to userspace handles |
426 | * @obj: GEM object to clean up. |
427 | @@ -255,7 +240,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) |
428 | else if (dev->driver->gem_close_object) |
429 | dev->driver->gem_close_object(obj, file_priv); |
430 | |
431 | - drm_gem_remove_prime_handles(obj, file_priv); |
432 | + drm_prime_remove_buf_handle(&file_priv->prime, id); |
433 | drm_vma_node_revoke(&obj->vma_node, file_priv); |
434 | |
435 | drm_gem_object_handle_put_unlocked(obj); |
436 | diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h |
437 | index 51a2055c8f18a..41a9a9bae5848 100644 |
438 | --- a/drivers/gpu/drm/drm_internal.h |
439 | +++ b/drivers/gpu/drm/drm_internal.h |
440 | @@ -59,8 +59,8 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, |
441 | |
442 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); |
443 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); |
444 | -void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, |
445 | - struct dma_buf *dma_buf); |
446 | +void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, |
447 | + uint32_t handle); |
448 | |
449 | /* drm_drv.c */ |
450 | struct drm_minor *drm_minor_acquire(unsigned int minor_id); |
451 | diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c |
452 | index 0a2316e0e8121..6b7cf0170f9d1 100644 |
453 | --- a/drivers/gpu/drm/drm_prime.c |
454 | +++ b/drivers/gpu/drm/drm_prime.c |
455 | @@ -187,29 +187,33 @@ static int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fpri |
456 | return -ENOENT; |
457 | } |
458 | |
459 | -void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, |
460 | - struct dma_buf *dma_buf) |
461 | +void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, |
462 | + uint32_t handle) |
463 | { |
464 | struct rb_node *rb; |
465 | |
466 | - rb = prime_fpriv->dmabufs.rb_node; |
467 | + mutex_lock(&prime_fpriv->lock); |
468 | + |
469 | + rb = prime_fpriv->handles.rb_node; |
470 | while (rb) { |
471 | struct drm_prime_member *member; |
472 | |
473 | - member = rb_entry(rb, struct drm_prime_member, dmabuf_rb); |
474 | - if (member->dma_buf == dma_buf) { |
475 | + member = rb_entry(rb, struct drm_prime_member, handle_rb); |
476 | + if (member->handle == handle) { |
477 | rb_erase(&member->handle_rb, &prime_fpriv->handles); |
478 | rb_erase(&member->dmabuf_rb, &prime_fpriv->dmabufs); |
479 | |
480 | - dma_buf_put(dma_buf); |
481 | + dma_buf_put(member->dma_buf); |
482 | kfree(member); |
483 | - return; |
484 | - } else if (member->dma_buf < dma_buf) { |
485 | + break; |
486 | + } else if (member->handle < handle) { |
487 | rb = rb->rb_right; |
488 | } else { |
489 | rb = rb->rb_left; |
490 | } |
491 | } |
492 | + |
493 | + mutex_unlock(&prime_fpriv->lock); |
494 | } |
495 | |
496 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) |
497 | diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c |
498 | index 399b1542509f7..d79314992adad 100644 |
499 | --- a/drivers/gpu/drm/i915/display/intel_quirks.c |
500 | +++ b/drivers/gpu/drm/i915/display/intel_quirks.c |
501 | @@ -146,6 +146,9 @@ static struct intel_quirk intel_quirks[] = { |
502 | /* ASRock ITX*/ |
503 | { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, |
504 | { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, |
505 | + /* ECS Liva Q2 */ |
506 | + { 0x3185, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, |
507 | + { 0x3184, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, |
508 | }; |
509 | |
510 | void intel_init_quirks(struct drm_i915_private *i915) |
511 | diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c |
512 | index 245c20d36f1b2..45ffccdcd50e7 100644 |
513 | --- a/drivers/gpu/drm/i915/gvt/handlers.c |
514 | +++ b/drivers/gpu/drm/i915/gvt/handlers.c |
515 | @@ -654,7 +654,7 @@ static int update_fdi_rx_iir_status(struct intel_vgpu *vgpu, |
516 | else if (FDI_RX_IMR_TO_PIPE(offset) != INVALID_INDEX) |
517 | index = FDI_RX_IMR_TO_PIPE(offset); |
518 | else { |
519 | - gvt_vgpu_err("Unsupport registers %x\n", offset); |
520 | + gvt_vgpu_err("Unsupported registers %x\n", offset); |
521 | return -EINVAL; |
522 | } |
523 | |
524 | diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c |
525 | index b7b7c1a9164ab..726c881394576 100644 |
526 | --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c |
527 | +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c |
528 | @@ -97,7 +97,7 @@ static const char * const dsi_8996_bus_clk_names[] = { |
529 | static const struct msm_dsi_config msm8996_dsi_cfg = { |
530 | .io_offset = DSI_6G_REG_SHIFT, |
531 | .reg_cfg = { |
532 | - .num = 2, |
533 | + .num = 3, |
534 | .regs = { |
535 | {"vdda", 18160, 1 }, /* 1.25 V */ |
536 | {"vcca", 17000, 32 }, /* 0.925 V */ |
537 | diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
538 | index 60d50643d0b5c..08a95c3a94444 100644 |
539 | --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
540 | +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
541 | @@ -347,7 +347,7 @@ int msm_dsi_dphy_timing_calc_v3(struct msm_dsi_dphy_timing *timing, |
542 | } else { |
543 | timing->shared_timings.clk_pre = |
544 | linear_inter(tmax, tmin, pcnt2, 0, false); |
545 | - timing->shared_timings.clk_pre_inc_by_2 = 0; |
546 | + timing->shared_timings.clk_pre_inc_by_2 = 0; |
547 | } |
548 | |
549 | timing->ta_go = 3; |
550 | diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c |
551 | index 5d017f0aec665..e892582e847b5 100644 |
552 | --- a/drivers/gpu/drm/radeon/radeon_device.c |
553 | +++ b/drivers/gpu/drm/radeon/radeon_device.c |
554 | @@ -1623,6 +1623,9 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, |
555 | if (r) { |
556 | /* delay GPU reset to resume */ |
557 | radeon_fence_driver_force_completion(rdev, i); |
558 | + } else { |
559 | + /* finish executing delayed work */ |
560 | + flush_delayed_work(&rdev->fence_drv[i].lockup_work); |
561 | } |
562 | } |
563 | |
564 | diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c |
565 | index 3ea4021f267cf..d96e435cc42b1 100644 |
566 | --- a/drivers/hwmon/gpio-fan.c |
567 | +++ b/drivers/hwmon/gpio-fan.c |
568 | @@ -391,6 +391,9 @@ static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev, |
569 | if (!fan_data) |
570 | return -EINVAL; |
571 | |
572 | + if (state >= fan_data->num_speed) |
573 | + return -EINVAL; |
574 | + |
575 | set_fan_speed(fan_data, state); |
576 | return 0; |
577 | } |
578 | diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c |
579 | index dd52f08ec82e2..4e2e8e819b1e7 100644 |
580 | --- a/drivers/iio/adc/mcp3911.c |
581 | +++ b/drivers/iio/adc/mcp3911.c |
582 | @@ -38,8 +38,8 @@ |
583 | #define MCP3911_CHANNEL(x) (MCP3911_REG_CHANNEL0 + x * 3) |
584 | #define MCP3911_OFFCAL(x) (MCP3911_REG_OFFCAL_CH0 + x * 6) |
585 | |
586 | -/* Internal voltage reference in uV */ |
587 | -#define MCP3911_INT_VREF_UV 1200000 |
588 | +/* Internal voltage reference in mV */ |
589 | +#define MCP3911_INT_VREF_MV 1200 |
590 | |
591 | #define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff) |
592 | #define MCP3911_REG_WRITE(reg, id) ((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff) |
593 | @@ -111,6 +111,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev, |
594 | if (ret) |
595 | goto out; |
596 | |
597 | + *val = sign_extend32(*val, 23); |
598 | + |
599 | ret = IIO_VAL_INT; |
600 | break; |
601 | |
602 | @@ -135,11 +137,18 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev, |
603 | |
604 | *val = ret / 1000; |
605 | } else { |
606 | - *val = MCP3911_INT_VREF_UV; |
607 | + *val = MCP3911_INT_VREF_MV; |
608 | } |
609 | |
610 | - *val2 = 24; |
611 | - ret = IIO_VAL_FRACTIONAL_LOG2; |
612 | + /* |
613 | + * For 24bit Conversion |
614 | + * Raw = ((Voltage)/(Vref) * 2^23 * Gain * 1.5 |
615 | + * Voltage = Raw * (Vref)/(2^23 * Gain * 1.5) |
616 | + */ |
617 | + |
618 | + /* val2 = (2^23 * 1.5) */ |
619 | + *val2 = 12582912; |
620 | + ret = IIO_VAL_FRACTIONAL; |
621 | break; |
622 | } |
623 | |
624 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
625 | index de7df5ab06f3b..cf174aa7fe25b 100644 |
626 | --- a/drivers/infiniband/core/cma.c |
627 | +++ b/drivers/infiniband/core/cma.c |
628 | @@ -1719,8 +1719,8 @@ cma_ib_id_from_event(struct ib_cm_id *cm_id, |
629 | } |
630 | |
631 | if (!validate_net_dev(*net_dev, |
632 | - (struct sockaddr *)&req->listen_addr_storage, |
633 | - (struct sockaddr *)&req->src_addr_storage)) { |
634 | + (struct sockaddr *)&req->src_addr_storage, |
635 | + (struct sockaddr *)&req->listen_addr_storage)) { |
636 | id_priv = ERR_PTR(-EHOSTUNREACH); |
637 | goto err; |
638 | } |
639 | diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
640 | index 76a14db7028dd..b9ab3ca3079c7 100644 |
641 | --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
642 | +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
643 | @@ -89,7 +89,7 @@ |
644 | #define HNS_ROCE_V2_SCCC_ENTRY_SZ 32 |
645 | #define HNS_ROCE_V2_QPC_TIMER_ENTRY_SZ PAGE_SIZE |
646 | #define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ PAGE_SIZE |
647 | -#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFFF000 |
648 | +#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFF000 |
649 | #define HNS_ROCE_V2_MAX_INNER_MTPT_NUM 2 |
650 | #define HNS_ROCE_INVALID_LKEY 0x100 |
651 | #define HNS_ROCE_CMQ_TX_TIMEOUT 30000 |
652 | diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c |
653 | index 348c1df69cdc6..3897a3ce02ad0 100644 |
654 | --- a/drivers/infiniband/hw/mlx5/mad.c |
655 | +++ b/drivers/infiniband/hw/mlx5/mad.c |
656 | @@ -219,6 +219,12 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u8 port_num, |
657 | mdev = dev->mdev; |
658 | mdev_port_num = 1; |
659 | } |
660 | + if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1) { |
661 | + /* set local port to one for Function-Per-Port HCA. */ |
662 | + mdev = dev->mdev; |
663 | + mdev_port_num = 1; |
664 | + } |
665 | + |
666 | /* Declaring support of extended counters */ |
667 | if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) { |
668 | struct ib_class_port_info cpi = {}; |
669 | diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c |
670 | index 424918eb1cd4a..5e6d96bd2eb12 100644 |
671 | --- a/drivers/infiniband/sw/siw/siw_qp_tx.c |
672 | +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c |
673 | @@ -29,7 +29,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem, u64 addr, int *idx) |
674 | dma_addr_t paddr = siw_pbl_get_buffer(pbl, offset, NULL, idx); |
675 | |
676 | if (paddr) |
677 | - return virt_to_page(paddr); |
678 | + return virt_to_page((void *)paddr); |
679 | |
680 | return NULL; |
681 | } |
682 | @@ -523,13 +523,23 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) |
683 | kunmap(p); |
684 | } |
685 | } else { |
686 | - u64 va = sge->laddr + sge_off; |
687 | + /* |
688 | + * Cast to an uintptr_t to preserve all 64 bits |
689 | + * in sge->laddr. |
690 | + */ |
691 | + uintptr_t va = (uintptr_t)(sge->laddr + sge_off); |
692 | |
693 | - page_array[seg] = virt_to_page(va & PAGE_MASK); |
694 | + /* |
695 | + * virt_to_page() takes a (void *) pointer |
696 | + * so cast to a (void *) meaning it will be 64 |
697 | + * bits on a 64 bit platform and 32 bits on a |
698 | + * 32 bit platform. |
699 | + */ |
700 | + page_array[seg] = virt_to_page((void *)(va & PAGE_MASK)); |
701 | if (do_crc) |
702 | crypto_shash_update( |
703 | c_tx->mpa_crc_hd, |
704 | - (void *)(uintptr_t)va, |
705 | + (void *)va, |
706 | plen); |
707 | } |
708 | |
709 | diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c |
710 | index f95a81b9fac72..2380546d79782 100644 |
711 | --- a/drivers/input/joystick/iforce/iforce-serio.c |
712 | +++ b/drivers/input/joystick/iforce/iforce-serio.c |
713 | @@ -39,7 +39,7 @@ static void iforce_serio_xmit(struct iforce *iforce) |
714 | |
715 | again: |
716 | if (iforce->xmit.head == iforce->xmit.tail) { |
717 | - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
718 | + iforce_clear_xmit_and_wake(iforce); |
719 | spin_unlock_irqrestore(&iforce->xmit_lock, flags); |
720 | return; |
721 | } |
722 | @@ -64,7 +64,7 @@ again: |
723 | if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags)) |
724 | goto again; |
725 | |
726 | - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
727 | + iforce_clear_xmit_and_wake(iforce); |
728 | |
729 | spin_unlock_irqrestore(&iforce->xmit_lock, flags); |
730 | } |
731 | @@ -169,7 +169,7 @@ static irqreturn_t iforce_serio_irq(struct serio *serio, |
732 | iforce_serio->cmd_response_len = iforce_serio->len; |
733 | |
734 | /* Signal that command is done */ |
735 | - wake_up(&iforce->wait); |
736 | + wake_up_all(&iforce->wait); |
737 | } else if (likely(iforce->type)) { |
738 | iforce_process_packet(iforce, iforce_serio->id, |
739 | iforce_serio->data_in, |
740 | diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c |
741 | index ea58805c480fa..cba92bd590a8d 100644 |
742 | --- a/drivers/input/joystick/iforce/iforce-usb.c |
743 | +++ b/drivers/input/joystick/iforce/iforce-usb.c |
744 | @@ -30,7 +30,7 @@ static void __iforce_usb_xmit(struct iforce *iforce) |
745 | spin_lock_irqsave(&iforce->xmit_lock, flags); |
746 | |
747 | if (iforce->xmit.head == iforce->xmit.tail) { |
748 | - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
749 | + iforce_clear_xmit_and_wake(iforce); |
750 | spin_unlock_irqrestore(&iforce->xmit_lock, flags); |
751 | return; |
752 | } |
753 | @@ -58,9 +58,9 @@ static void __iforce_usb_xmit(struct iforce *iforce) |
754 | XMIT_INC(iforce->xmit.tail, n); |
755 | |
756 | if ( (n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC)) ) { |
757 | - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
758 | dev_warn(&iforce_usb->intf->dev, |
759 | "usb_submit_urb failed %d\n", n); |
760 | + iforce_clear_xmit_and_wake(iforce); |
761 | } |
762 | |
763 | /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. |
764 | @@ -175,15 +175,15 @@ static void iforce_usb_out(struct urb *urb) |
765 | struct iforce *iforce = &iforce_usb->iforce; |
766 | |
767 | if (urb->status) { |
768 | - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
769 | dev_dbg(&iforce_usb->intf->dev, "urb->status %d, exiting\n", |
770 | urb->status); |
771 | + iforce_clear_xmit_and_wake(iforce); |
772 | return; |
773 | } |
774 | |
775 | __iforce_usb_xmit(iforce); |
776 | |
777 | - wake_up(&iforce->wait); |
778 | + wake_up_all(&iforce->wait); |
779 | } |
780 | |
781 | static int iforce_usb_probe(struct usb_interface *intf, |
782 | diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h |
783 | index 6aa761ebbdf77..9ccb9107ccbef 100644 |
784 | --- a/drivers/input/joystick/iforce/iforce.h |
785 | +++ b/drivers/input/joystick/iforce/iforce.h |
786 | @@ -119,6 +119,12 @@ static inline int iforce_get_id_packet(struct iforce *iforce, u8 id, |
787 | response_data, response_len); |
788 | } |
789 | |
790 | +static inline void iforce_clear_xmit_and_wake(struct iforce *iforce) |
791 | +{ |
792 | + clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
793 | + wake_up_all(&iforce->wait); |
794 | +} |
795 | + |
796 | /* Public functions */ |
797 | /* iforce-main.c */ |
798 | int iforce_init_device(struct device *parent, u16 bustype, |
799 | diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c |
800 | index 3fb64dbda1a21..76873aa005b41 100644 |
801 | --- a/drivers/input/misc/rk805-pwrkey.c |
802 | +++ b/drivers/input/misc/rk805-pwrkey.c |
803 | @@ -98,6 +98,7 @@ static struct platform_driver rk805_pwrkey_driver = { |
804 | }; |
805 | module_platform_driver(rk805_pwrkey_driver); |
806 | |
807 | +MODULE_ALIAS("platform:rk805-pwrkey"); |
808 | MODULE_AUTHOR("Joseph Chen <chenjh@rock-chips.com>"); |
809 | MODULE_DESCRIPTION("RK805 PMIC Power Key driver"); |
810 | MODULE_LICENSE("GPL"); |
811 | diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
812 | index fb5ddf3864fdd..5812ef3345feb 100644 |
813 | --- a/drivers/misc/fastrpc.c |
814 | +++ b/drivers/misc/fastrpc.c |
815 | @@ -1357,7 +1357,12 @@ static int fastrpc_cb_probe(struct platform_device *pdev) |
816 | of_property_read_u32(dev->of_node, "qcom,nsessions", &sessions); |
817 | |
818 | spin_lock_irqsave(&cctx->lock, flags); |
819 | - sess = &cctx->session[cctx->sesscount]; |
820 | + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { |
821 | + dev_err(&pdev->dev, "too many sessions\n"); |
822 | + spin_unlock_irqrestore(&cctx->lock, flags); |
823 | + return -ENOSPC; |
824 | + } |
825 | + sess = &cctx->session[cctx->sesscount++]; |
826 | sess->used = false; |
827 | sess->valid = true; |
828 | sess->dev = dev; |
829 | @@ -1370,13 +1375,12 @@ static int fastrpc_cb_probe(struct platform_device *pdev) |
830 | struct fastrpc_session_ctx *dup_sess; |
831 | |
832 | for (i = 1; i < sessions; i++) { |
833 | - if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) |
834 | + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) |
835 | break; |
836 | - dup_sess = &cctx->session[cctx->sesscount]; |
837 | + dup_sess = &cctx->session[cctx->sesscount++]; |
838 | memcpy(dup_sess, sess, sizeof(*dup_sess)); |
839 | } |
840 | } |
841 | - cctx->sesscount++; |
842 | spin_unlock_irqrestore(&cctx->lock, flags); |
843 | rc = dma_set_mask(dev, DMA_BIT_MASK(32)); |
844 | if (rc) { |
845 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c |
846 | index 5706abb3c0eaa..10125b02d1543 100644 |
847 | --- a/drivers/net/ethernet/intel/i40e/i40e_client.c |
848 | +++ b/drivers/net/ethernet/intel/i40e/i40e_client.c |
849 | @@ -178,6 +178,10 @@ void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset) |
850 | "Cannot locate client instance close routine\n"); |
851 | return; |
852 | } |
853 | + if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) { |
854 | + dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n"); |
855 | + return; |
856 | + } |
857 | cdev->client->ops->close(&cdev->lan_info, cdev->client, reset); |
858 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); |
859 | i40e_client_release_qvlist(&cdev->lan_info); |
860 | @@ -376,7 +380,6 @@ void i40e_client_subtask(struct i40e_pf *pf) |
861 | /* Remove failed client instance */ |
862 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, |
863 | &cdev->state); |
864 | - i40e_client_del_instance(pf); |
865 | return; |
866 | } |
867 | } |
868 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c |
869 | index 4a3baa7e01424..0eec05d905eb0 100644 |
870 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c |
871 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c |
872 | @@ -700,10 +700,10 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) |
873 | |
874 | void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) |
875 | { |
876 | - struct dentry *mvpp2_dir, *mvpp2_root; |
877 | + static struct dentry *mvpp2_root; |
878 | + struct dentry *mvpp2_dir; |
879 | int ret, i; |
880 | |
881 | - mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); |
882 | if (!mvpp2_root) |
883 | mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); |
884 | |
885 | diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c |
886 | index 8157666209798..e4d919de7e3fc 100644 |
887 | --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c |
888 | +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c |
889 | @@ -1273,7 +1273,7 @@ static int ofdpa_port_ipv4_neigh(struct ofdpa_port *ofdpa_port, |
890 | bool removing; |
891 | int err = 0; |
892 | |
893 | - entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
894 | + entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
895 | if (!entry) |
896 | return -ENOMEM; |
897 | |
898 | diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c |
899 | index 5945ac5f38eea..cb29da961e12b 100644 |
900 | --- a/drivers/net/ieee802154/adf7242.c |
901 | +++ b/drivers/net/ieee802154/adf7242.c |
902 | @@ -1310,10 +1310,11 @@ static int adf7242_remove(struct spi_device *spi) |
903 | |
904 | debugfs_remove_recursive(lp->debugfs_root); |
905 | |
906 | + ieee802154_unregister_hw(lp->hw); |
907 | + |
908 | cancel_delayed_work_sync(&lp->work); |
909 | destroy_workqueue(lp->wqueue); |
910 | |
911 | - ieee802154_unregister_hw(lp->hw); |
912 | mutex_destroy(&lp->bmux); |
913 | ieee802154_free_hw(lp->hw); |
914 | |
915 | diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c |
916 | index ae17d2f9d5347..cc1522550f2c4 100644 |
917 | --- a/drivers/net/phy/dp83822.c |
918 | +++ b/drivers/net/phy/dp83822.c |
919 | @@ -198,7 +198,6 @@ static int dp83822_config_intr(struct phy_device *phydev) |
920 | return misr_status; |
921 | |
922 | misr_status |= (DP83822_RX_ERR_HF_INT_EN | |
923 | - DP83822_FALSE_CARRIER_HF_INT_EN | |
924 | DP83822_ANEG_COMPLETE_INT_EN | |
925 | DP83822_DUP_MODE_CHANGE_INT_EN | |
926 | DP83822_SPEED_CHANGED_INT_EN | |
927 | diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
928 | index ce891ac32388f..b79a8aeab4c79 100644 |
929 | --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
930 | +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
931 | @@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, |
932 | /* Repeat initial/next rate. |
933 | * For legacy IL_NUMBER_TRY == 1, this loop will not execute. |
934 | * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ |
935 | - while (repeat_rate > 0) { |
936 | + while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) { |
937 | if (is_legacy(tbl_type.lq_type)) { |
938 | if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) |
939 | ant_toggle_cnt++; |
940 | @@ -2422,8 +2422,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, |
941 | cpu_to_le32(new_rate); |
942 | repeat_rate--; |
943 | idx++; |
944 | - if (idx >= LINK_QUAL_MAX_RETRY_NUM) |
945 | - goto out; |
946 | } |
947 | |
948 | il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, |
949 | @@ -2468,7 +2466,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, |
950 | repeat_rate--; |
951 | } |
952 | |
953 | -out: |
954 | lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; |
955 | lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; |
956 | |
957 | diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
958 | index 2a27ac9aedbaa..3169859cd3906 100644 |
959 | --- a/drivers/nvme/host/tcp.c |
960 | +++ b/drivers/nvme/host/tcp.c |
961 | @@ -1074,7 +1074,7 @@ static void nvme_tcp_io_work(struct work_struct *w) |
962 | if (result > 0) |
963 | pending = true; |
964 | |
965 | - if (!pending) |
966 | + if (!pending || !queue->rd_enabled) |
967 | return; |
968 | |
969 | } while (!time_after(jiffies, deadline)); /* quota is exhausted */ |
970 | diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c |
971 | index ee81d94fe810c..ff206faae775c 100644 |
972 | --- a/drivers/nvme/target/core.c |
973 | +++ b/drivers/nvme/target/core.c |
974 | @@ -709,6 +709,8 @@ static void nvmet_set_error(struct nvmet_req *req, u16 status) |
975 | |
976 | static void __nvmet_req_complete(struct nvmet_req *req, u16 status) |
977 | { |
978 | + struct nvmet_ns *ns = req->ns; |
979 | + |
980 | if (!req->sq->sqhd_disabled) |
981 | nvmet_update_sq_head(req); |
982 | req->cqe->sq_id = cpu_to_le16(req->sq->qid); |
983 | @@ -719,9 +721,9 @@ static void __nvmet_req_complete(struct nvmet_req *req, u16 status) |
984 | |
985 | trace_nvmet_req_complete(req); |
986 | |
987 | - if (req->ns) |
988 | - nvmet_put_namespace(req->ns); |
989 | req->ops->queue_response(req); |
990 | + if (ns) |
991 | + nvmet_put_namespace(ns); |
992 | } |
993 | |
994 | void nvmet_req_complete(struct nvmet_req *req, u16 status) |
995 | diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c |
996 | index 5013568c571e5..6209d58e9492a 100644 |
997 | --- a/drivers/parisc/ccio-dma.c |
998 | +++ b/drivers/parisc/ccio-dma.c |
999 | @@ -1378,15 +1378,17 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr) |
1000 | } |
1001 | } |
1002 | |
1003 | -static void __init ccio_init_resources(struct ioc *ioc) |
1004 | +static int __init ccio_init_resources(struct ioc *ioc) |
1005 | { |
1006 | struct resource *res = ioc->mmio_region; |
1007 | char *name = kmalloc(14, GFP_KERNEL); |
1008 | - |
1009 | + if (unlikely(!name)) |
1010 | + return -ENOMEM; |
1011 | snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path); |
1012 | |
1013 | ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low); |
1014 | ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv); |
1015 | + return 0; |
1016 | } |
1017 | |
1018 | static int new_ioc_area(struct resource *res, unsigned long size, |
1019 | @@ -1541,7 +1543,10 @@ static int __init ccio_probe(struct parisc_device *dev) |
1020 | return -ENOMEM; |
1021 | } |
1022 | ccio_ioc_init(ioc); |
1023 | - ccio_init_resources(ioc); |
1024 | + if (ccio_init_resources(ioc)) { |
1025 | + kfree(ioc); |
1026 | + return -ENOMEM; |
1027 | + } |
1028 | hppa_dma_ops = &ccio_ops; |
1029 | |
1030 | hba = kzalloc(sizeof(*hba), GFP_KERNEL); |
1031 | diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c |
1032 | index 597cfabc0967c..ee349a16b73a4 100644 |
1033 | --- a/drivers/platform/x86/pmc_atom.c |
1034 | +++ b/drivers/platform/x86/pmc_atom.c |
1035 | @@ -244,7 +244,7 @@ static void pmc_power_off(void) |
1036 | pm1_cnt_port = acpi_base_addr + PM1_CNT; |
1037 | |
1038 | pm1_cnt_value = inl(pm1_cnt_port); |
1039 | - pm1_cnt_value &= SLEEP_TYPE_MASK; |
1040 | + pm1_cnt_value &= ~SLEEP_TYPE_MASK; |
1041 | pm1_cnt_value |= SLEEP_TYPE_S5; |
1042 | pm1_cnt_value |= SLEEP_ENABLE; |
1043 | |
1044 | diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
1045 | index ae2addadb36f2..6ba3f6e7ea4f8 100644 |
1046 | --- a/drivers/regulator/core.c |
1047 | +++ b/drivers/regulator/core.c |
1048 | @@ -2486,13 +2486,18 @@ static int _regulator_do_enable(struct regulator_dev *rdev) |
1049 | */ |
1050 | static int _regulator_handle_consumer_enable(struct regulator *regulator) |
1051 | { |
1052 | + int ret; |
1053 | struct regulator_dev *rdev = regulator->rdev; |
1054 | |
1055 | lockdep_assert_held_once(&rdev->mutex.base); |
1056 | |
1057 | regulator->enable_count++; |
1058 | - if (regulator->uA_load && regulator->enable_count == 1) |
1059 | - return drms_uA_update(rdev); |
1060 | + if (regulator->uA_load && regulator->enable_count == 1) { |
1061 | + ret = drms_uA_update(rdev); |
1062 | + if (ret) |
1063 | + regulator->enable_count--; |
1064 | + return ret; |
1065 | + } |
1066 | |
1067 | return 0; |
1068 | } |
1069 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
1070 | index b5cee2a2ac66c..8930696021fbd 100644 |
1071 | --- a/drivers/scsi/lpfc/lpfc_init.c |
1072 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
1073 | @@ -6537,7 +6537,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) |
1074 | /* Allocate device driver memory */ |
1075 | rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); |
1076 | if (rc) |
1077 | - return -ENOMEM; |
1078 | + goto out_destroy_workqueue; |
1079 | |
1080 | /* IF Type 2 ports get initialized now. */ |
1081 | if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= |
1082 | @@ -6911,6 +6911,9 @@ out_free_bsmbx: |
1083 | lpfc_destroy_bootstrap_mbox(phba); |
1084 | out_free_mem: |
1085 | lpfc_mem_free(phba); |
1086 | +out_destroy_workqueue: |
1087 | + destroy_workqueue(phba->wq); |
1088 | + phba->wq = NULL; |
1089 | return rc; |
1090 | } |
1091 | |
1092 | diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
1093 | index a78a702511faa..944273f60d224 100644 |
1094 | --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c |
1095 | +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
1096 | @@ -5182,7 +5182,6 @@ megasas_alloc_fusion_context(struct megasas_instance *instance) |
1097 | if (!fusion->log_to_span) { |
1098 | dev_err(&instance->pdev->dev, "Failed from %s %d\n", |
1099 | __func__, __LINE__); |
1100 | - kfree(instance->ctrl_context); |
1101 | return -ENOMEM; |
1102 | } |
1103 | } |
1104 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1105 | index 97c1f242ef0a3..044a00edb5459 100644 |
1106 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1107 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1108 | @@ -3238,6 +3238,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc) |
1109 | fw_event = list_first_entry(&ioc->fw_event_list, |
1110 | struct fw_event_work, list); |
1111 | list_del_init(&fw_event->list); |
1112 | + fw_event_work_put(fw_event); |
1113 | } |
1114 | spin_unlock_irqrestore(&ioc->fw_event_lock, flags); |
1115 | |
1116 | @@ -3272,7 +3273,6 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc) |
1117 | if (cancel_work_sync(&fw_event->work)) |
1118 | fw_event_work_put(fw_event); |
1119 | |
1120 | - fw_event_work_put(fw_event); |
1121 | } |
1122 | } |
1123 | |
1124 | diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c |
1125 | index c6ec7d95bcfcc..722fd54e537cf 100644 |
1126 | --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c |
1127 | +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c |
1128 | @@ -681,13 +681,14 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1129 | const struct of_device_id *of_id = NULL; |
1130 | struct device_node *dn; |
1131 | void __iomem *base; |
1132 | - int ret, i; |
1133 | + int ret, i, s; |
1134 | |
1135 | /* AON ctrl registers */ |
1136 | base = brcmstb_ioremap_match(aon_ctrl_dt_ids, 0, NULL); |
1137 | if (IS_ERR(base)) { |
1138 | pr_err("error mapping AON_CTRL\n"); |
1139 | - return PTR_ERR(base); |
1140 | + ret = PTR_ERR(base); |
1141 | + goto aon_err; |
1142 | } |
1143 | ctrl.aon_ctrl_base = base; |
1144 | |
1145 | @@ -697,8 +698,10 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1146 | /* Assume standard offset */ |
1147 | ctrl.aon_sram = ctrl.aon_ctrl_base + |
1148 | AON_CTRL_SYSTEM_DATA_RAM_OFS; |
1149 | + s = 0; |
1150 | } else { |
1151 | ctrl.aon_sram = base; |
1152 | + s = 1; |
1153 | } |
1154 | |
1155 | writel_relaxed(0, ctrl.aon_sram + AON_REG_PANIC); |
1156 | @@ -708,7 +711,8 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1157 | (const void **)&ddr_phy_data); |
1158 | if (IS_ERR(base)) { |
1159 | pr_err("error mapping DDR PHY\n"); |
1160 | - return PTR_ERR(base); |
1161 | + ret = PTR_ERR(base); |
1162 | + goto ddr_phy_err; |
1163 | } |
1164 | ctrl.support_warm_boot = ddr_phy_data->supports_warm_boot; |
1165 | ctrl.pll_status_offset = ddr_phy_data->pll_status_offset; |
1166 | @@ -728,17 +732,20 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1167 | for_each_matching_node(dn, ddr_shimphy_dt_ids) { |
1168 | i = ctrl.num_memc; |
1169 | if (i >= MAX_NUM_MEMC) { |
1170 | + of_node_put(dn); |
1171 | pr_warn("too many MEMCs (max %d)\n", MAX_NUM_MEMC); |
1172 | break; |
1173 | } |
1174 | |
1175 | base = of_io_request_and_map(dn, 0, dn->full_name); |
1176 | if (IS_ERR(base)) { |
1177 | + of_node_put(dn); |
1178 | if (!ctrl.support_warm_boot) |
1179 | break; |
1180 | |
1181 | pr_err("error mapping DDR SHIMPHY %d\n", i); |
1182 | - return PTR_ERR(base); |
1183 | + ret = PTR_ERR(base); |
1184 | + goto ddr_shimphy_err; |
1185 | } |
1186 | ctrl.memcs[i].ddr_shimphy_base = base; |
1187 | ctrl.num_memc++; |
1188 | @@ -749,14 +756,18 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1189 | for_each_matching_node(dn, brcmstb_memc_of_match) { |
1190 | base = of_iomap(dn, 0); |
1191 | if (!base) { |
1192 | + of_node_put(dn); |
1193 | pr_err("error mapping DDR Sequencer %d\n", i); |
1194 | - return -ENOMEM; |
1195 | + ret = -ENOMEM; |
1196 | + goto brcmstb_memc_err; |
1197 | } |
1198 | |
1199 | of_id = of_match_node(brcmstb_memc_of_match, dn); |
1200 | if (!of_id) { |
1201 | iounmap(base); |
1202 | - return -EINVAL; |
1203 | + of_node_put(dn); |
1204 | + ret = -EINVAL; |
1205 | + goto brcmstb_memc_err; |
1206 | } |
1207 | |
1208 | ddr_seq_data = of_id->data; |
1209 | @@ -776,21 +787,24 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1210 | dn = of_find_matching_node(NULL, sram_dt_ids); |
1211 | if (!dn) { |
1212 | pr_err("SRAM not found\n"); |
1213 | - return -EINVAL; |
1214 | + ret = -EINVAL; |
1215 | + goto brcmstb_memc_err; |
1216 | } |
1217 | |
1218 | ret = brcmstb_init_sram(dn); |
1219 | of_node_put(dn); |
1220 | if (ret) { |
1221 | pr_err("error setting up SRAM for PM\n"); |
1222 | - return ret; |
1223 | + goto brcmstb_memc_err; |
1224 | } |
1225 | |
1226 | ctrl.pdev = pdev; |
1227 | |
1228 | ctrl.s3_params = kmalloc(sizeof(*ctrl.s3_params), GFP_KERNEL); |
1229 | - if (!ctrl.s3_params) |
1230 | - return -ENOMEM; |
1231 | + if (!ctrl.s3_params) { |
1232 | + ret = -ENOMEM; |
1233 | + goto s3_params_err; |
1234 | + } |
1235 | ctrl.s3_params_pa = dma_map_single(&pdev->dev, ctrl.s3_params, |
1236 | sizeof(*ctrl.s3_params), |
1237 | DMA_TO_DEVICE); |
1238 | @@ -810,7 +824,21 @@ static int brcmstb_pm_probe(struct platform_device *pdev) |
1239 | |
1240 | out: |
1241 | kfree(ctrl.s3_params); |
1242 | - |
1243 | +s3_params_err: |
1244 | + iounmap(ctrl.boot_sram); |
1245 | +brcmstb_memc_err: |
1246 | + for (i--; i >= 0; i--) |
1247 | + iounmap(ctrl.memcs[i].ddr_ctrl); |
1248 | +ddr_shimphy_err: |
1249 | + for (i = 0; i < ctrl.num_memc; i++) |
1250 | + iounmap(ctrl.memcs[i].ddr_shimphy_base); |
1251 | + |
1252 | + iounmap(ctrl.memcs[0].ddr_phy_base); |
1253 | +ddr_phy_err: |
1254 | + iounmap(ctrl.aon_ctrl_base); |
1255 | + if (s) |
1256 | + iounmap(ctrl.aon_sram); |
1257 | +aon_err: |
1258 | pr_warn("PM: initialization failed with code %d\n", ret); |
1259 | |
1260 | return ret; |
1261 | diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c |
1262 | index ff3cb09c57a63..30e965c410ffd 100644 |
1263 | --- a/drivers/staging/rtl8712/rtl8712_cmd.c |
1264 | +++ b/drivers/staging/rtl8712/rtl8712_cmd.c |
1265 | @@ -117,34 +117,6 @@ static void r871x_internal_cmd_hdl(struct _adapter *padapter, u8 *pbuf) |
1266 | kfree(pdrvcmd->pbuf); |
1267 | } |
1268 | |
1269 | -static u8 read_macreg_hdl(struct _adapter *padapter, u8 *pbuf) |
1270 | -{ |
1271 | - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); |
1272 | - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; |
1273 | - |
1274 | - /* invoke cmd->callback function */ |
1275 | - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; |
1276 | - if (!pcmd_callback) |
1277 | - r8712_free_cmd_obj(pcmd); |
1278 | - else |
1279 | - pcmd_callback(padapter, pcmd); |
1280 | - return H2C_SUCCESS; |
1281 | -} |
1282 | - |
1283 | -static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf) |
1284 | -{ |
1285 | - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); |
1286 | - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; |
1287 | - |
1288 | - /* invoke cmd->callback function */ |
1289 | - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; |
1290 | - if (!pcmd_callback) |
1291 | - r8712_free_cmd_obj(pcmd); |
1292 | - else |
1293 | - pcmd_callback(padapter, pcmd); |
1294 | - return H2C_SUCCESS; |
1295 | -} |
1296 | - |
1297 | static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf) |
1298 | { |
1299 | struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; |
1300 | @@ -213,14 +185,6 @@ static struct cmd_obj *cmd_hdl_filter(struct _adapter *padapter, |
1301 | pcmd_r = NULL; |
1302 | |
1303 | switch (pcmd->cmdcode) { |
1304 | - case GEN_CMD_CODE(_Read_MACREG): |
1305 | - read_macreg_hdl(padapter, (u8 *)pcmd); |
1306 | - pcmd_r = pcmd; |
1307 | - break; |
1308 | - case GEN_CMD_CODE(_Write_MACREG): |
1309 | - write_macreg_hdl(padapter, (u8 *)pcmd); |
1310 | - pcmd_r = pcmd; |
1311 | - break; |
1312 | case GEN_CMD_CODE(_Read_BBREG): |
1313 | read_bbreg_hdl(padapter, (u8 *)pcmd); |
1314 | break; |
1315 | diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c |
1316 | index 2ec1af8f7968d..fd074c6ebe0d3 100644 |
1317 | --- a/drivers/thunderbolt/ctl.c |
1318 | +++ b/drivers/thunderbolt/ctl.c |
1319 | @@ -388,7 +388,7 @@ static void tb_ctl_rx_submit(struct ctl_pkg *pkg) |
1320 | |
1321 | static int tb_async_error(const struct ctl_pkg *pkg) |
1322 | { |
1323 | - const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg; |
1324 | + const struct cfg_error_pkg *error = pkg->buffer; |
1325 | |
1326 | if (pkg->frame.eof != TB_CFG_PKG_ERROR) |
1327 | return false; |
1328 | diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
1329 | index 4bdc12908146e..f3f582c3dc874 100644 |
1330 | --- a/drivers/tty/serial/fsl_lpuart.c |
1331 | +++ b/drivers/tty/serial/fsl_lpuart.c |
1332 | @@ -1277,9 +1277,9 @@ static int lpuart_config_rs485(struct uart_port *port, |
1333 | * Note: UART is assumed to be active high. |
1334 | */ |
1335 | if (rs485->flags & SER_RS485_RTS_ON_SEND) |
1336 | - modem &= ~UARTMODEM_TXRTSPOL; |
1337 | - else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) |
1338 | modem |= UARTMODEM_TXRTSPOL; |
1339 | + else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) |
1340 | + modem &= ~UARTMODEM_TXRTSPOL; |
1341 | } |
1342 | |
1343 | /* Store the new configuration */ |
1344 | @@ -1981,6 +1981,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, |
1345 | uart_update_timeout(port, termios->c_cflag, baud); |
1346 | |
1347 | /* wait transmit engin complete */ |
1348 | + lpuart32_write(&sport->port, 0, UARTMODIR); |
1349 | lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); |
1350 | |
1351 | /* disable transmit and receive */ |
1352 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1353 | index b4f97df8e0000..e00ebda492198 100644 |
1354 | --- a/drivers/tty/vt/vt.c |
1355 | +++ b/drivers/tty/vt/vt.c |
1356 | @@ -4587,9 +4587,11 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) |
1357 | console_lock(); |
1358 | if (vc->vc_mode != KD_TEXT) |
1359 | rc = -EINVAL; |
1360 | - else if (vc->vc_sw->con_font_set) |
1361 | + else if (vc->vc_sw->con_font_set) { |
1362 | + if (vc_is_sel(vc)) |
1363 | + clear_selection(); |
1364 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); |
1365 | - else |
1366 | + } else |
1367 | rc = -ENOSYS; |
1368 | console_unlock(); |
1369 | kfree(font.data); |
1370 | @@ -4616,9 +4618,11 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) |
1371 | console_unlock(); |
1372 | return -EINVAL; |
1373 | } |
1374 | - if (vc->vc_sw->con_font_default) |
1375 | + if (vc->vc_sw->con_font_default) { |
1376 | + if (vc_is_sel(vc)) |
1377 | + clear_selection(); |
1378 | rc = vc->vc_sw->con_font_default(vc, &font, s); |
1379 | - else |
1380 | + } else |
1381 | rc = -ENOSYS; |
1382 | console_unlock(); |
1383 | if (!rc) { |
1384 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
1385 | index 5dc8827ede7e8..edb62b49f572e 100644 |
1386 | --- a/drivers/usb/class/cdc-acm.c |
1387 | +++ b/drivers/usb/class/cdc-acm.c |
1388 | @@ -1843,6 +1843,9 @@ static const struct usb_device_id acm_ids[] = { |
1389 | { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */ |
1390 | .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */ |
1391 | }, |
1392 | + { USB_DEVICE(0x0c26, 0x0020), /* Icom ICF3400 Serie */ |
1393 | + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
1394 | + }, |
1395 | { USB_DEVICE(0x0ca6, 0xa050), /* Castles VEGA3000 */ |
1396 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
1397 | }, |
1398 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
1399 | index 4cf0dc7f330dd..68d860a3fd617 100644 |
1400 | --- a/drivers/usb/core/hub.c |
1401 | +++ b/drivers/usb/core/hub.c |
1402 | @@ -5923,6 +5923,11 @@ re_enumerate_no_bos: |
1403 | * the reset is over (using their post_reset method). |
1404 | * |
1405 | * Return: The same as for usb_reset_and_verify_device(). |
1406 | + * However, if a reset is already in progress (for instance, if a |
1407 | + * driver doesn't have pre_ or post_reset() callbacks, and while |
1408 | + * being unbound or re-bound during the ongoing reset its disconnect() |
1409 | + * or probe() routine tries to perform a second, nested reset), the |
1410 | + * routine returns -EINPROGRESS. |
1411 | * |
1412 | * Note: |
1413 | * The caller must own the device lock. For example, it's safe to use |
1414 | @@ -5956,6 +5961,10 @@ int usb_reset_device(struct usb_device *udev) |
1415 | return -EISDIR; |
1416 | } |
1417 | |
1418 | + if (udev->reset_in_progress) |
1419 | + return -EINPROGRESS; |
1420 | + udev->reset_in_progress = 1; |
1421 | + |
1422 | port_dev = hub->ports[udev->portnum - 1]; |
1423 | |
1424 | /* |
1425 | @@ -6020,6 +6029,7 @@ int usb_reset_device(struct usb_device *udev) |
1426 | |
1427 | usb_autosuspend_device(udev); |
1428 | memalloc_noio_restore(noio_flag); |
1429 | + udev->reset_in_progress = 0; |
1430 | return ret; |
1431 | } |
1432 | EXPORT_SYMBOL_GPL(usb_reset_device); |
1433 | diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c |
1434 | index 34bb6124f1e2f..4f640c0c51b39 100644 |
1435 | --- a/drivers/usb/dwc2/platform.c |
1436 | +++ b/drivers/usb/dwc2/platform.c |
1437 | @@ -142,9 +142,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) |
1438 | } else if (hsotg->plat && hsotg->plat->phy_init) { |
1439 | ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); |
1440 | } else { |
1441 | - ret = phy_power_on(hsotg->phy); |
1442 | + ret = phy_init(hsotg->phy); |
1443 | if (ret == 0) |
1444 | - ret = phy_init(hsotg->phy); |
1445 | + ret = phy_power_on(hsotg->phy); |
1446 | } |
1447 | |
1448 | return ret; |
1449 | @@ -176,9 +176,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) |
1450 | } else if (hsotg->plat && hsotg->plat->phy_exit) { |
1451 | ret = hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); |
1452 | } else { |
1453 | - ret = phy_exit(hsotg->phy); |
1454 | + ret = phy_power_off(hsotg->phy); |
1455 | if (ret == 0) |
1456 | - ret = phy_power_off(hsotg->phy); |
1457 | + ret = phy_exit(hsotg->phy); |
1458 | } |
1459 | if (ret) |
1460 | return ret; |
1461 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
1462 | index 8cc81f193e9c1..f4655665a1b5c 100644 |
1463 | --- a/drivers/usb/dwc3/core.c |
1464 | +++ b/drivers/usb/dwc3/core.c |
1465 | @@ -694,15 +694,16 @@ static void dwc3_core_exit(struct dwc3 *dwc) |
1466 | { |
1467 | dwc3_event_buffers_cleanup(dwc); |
1468 | |
1469 | + usb_phy_set_suspend(dwc->usb2_phy, 1); |
1470 | + usb_phy_set_suspend(dwc->usb3_phy, 1); |
1471 | + phy_power_off(dwc->usb2_generic_phy); |
1472 | + phy_power_off(dwc->usb3_generic_phy); |
1473 | + |
1474 | usb_phy_shutdown(dwc->usb2_phy); |
1475 | usb_phy_shutdown(dwc->usb3_phy); |
1476 | phy_exit(dwc->usb2_generic_phy); |
1477 | phy_exit(dwc->usb3_generic_phy); |
1478 | |
1479 | - usb_phy_set_suspend(dwc->usb2_phy, 1); |
1480 | - usb_phy_set_suspend(dwc->usb3_phy, 1); |
1481 | - phy_power_off(dwc->usb2_generic_phy); |
1482 | - phy_power_off(dwc->usb3_generic_phy); |
1483 | clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); |
1484 | reset_control_assert(dwc->reset); |
1485 | } |
1486 | @@ -1537,16 +1538,16 @@ err5: |
1487 | dwc3_debugfs_exit(dwc); |
1488 | dwc3_event_buffers_cleanup(dwc); |
1489 | |
1490 | - usb_phy_shutdown(dwc->usb2_phy); |
1491 | - usb_phy_shutdown(dwc->usb3_phy); |
1492 | - phy_exit(dwc->usb2_generic_phy); |
1493 | - phy_exit(dwc->usb3_generic_phy); |
1494 | - |
1495 | usb_phy_set_suspend(dwc->usb2_phy, 1); |
1496 | usb_phy_set_suspend(dwc->usb3_phy, 1); |
1497 | phy_power_off(dwc->usb2_generic_phy); |
1498 | phy_power_off(dwc->usb3_generic_phy); |
1499 | |
1500 | + usb_phy_shutdown(dwc->usb2_phy); |
1501 | + usb_phy_shutdown(dwc->usb3_phy); |
1502 | + phy_exit(dwc->usb2_generic_phy); |
1503 | + phy_exit(dwc->usb3_generic_phy); |
1504 | + |
1505 | dwc3_ulpi_exit(dwc); |
1506 | |
1507 | err4: |
1508 | diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c |
1509 | index 7874b97e33227..aed35276e0e0c 100644 |
1510 | --- a/drivers/usb/dwc3/dwc3-qcom.c |
1511 | +++ b/drivers/usb/dwc3/dwc3-qcom.c |
1512 | @@ -190,6 +190,14 @@ static int dwc3_qcom_register_extcon(struct dwc3_qcom *qcom) |
1513 | return 0; |
1514 | } |
1515 | |
1516 | +/* Only usable in contexts where the role can not change. */ |
1517 | +static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom) |
1518 | +{ |
1519 | + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); |
1520 | + |
1521 | + return dwc->xhci; |
1522 | +} |
1523 | + |
1524 | static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom) |
1525 | { |
1526 | if (qcom->hs_phy_irq) { |
1527 | @@ -297,7 +305,11 @@ static irqreturn_t qcom_dwc3_resume_irq(int irq, void *data) |
1528 | if (qcom->pm_suspended) |
1529 | return IRQ_HANDLED; |
1530 | |
1531 | - if (dwc->xhci) |
1532 | + /* |
1533 | + * This is safe as role switching is done from a freezable workqueue |
1534 | + * and the wakeup interrupts are disabled as part of resume. |
1535 | + */ |
1536 | + if (dwc3_qcom_is_host(qcom)) |
1537 | pm_runtime_resume(&dwc->xhci->dev); |
1538 | |
1539 | return IRQ_HANDLED; |
1540 | diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c |
1541 | index fa252870c926f..a4eacc5cf58af 100644 |
1542 | --- a/drivers/usb/dwc3/host.c |
1543 | +++ b/drivers/usb/dwc3/host.c |
1544 | @@ -9,8 +9,13 @@ |
1545 | |
1546 | #include <linux/platform_device.h> |
1547 | |
1548 | +#include "../host/xhci-plat.h" |
1549 | #include "core.h" |
1550 | |
1551 | +static const struct xhci_plat_priv dwc3_xhci_plat_priv = { |
1552 | + .quirks = XHCI_SKIP_PHY_INIT, |
1553 | +}; |
1554 | + |
1555 | static int dwc3_host_get_irq(struct dwc3 *dwc) |
1556 | { |
1557 | struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); |
1558 | @@ -85,6 +90,11 @@ int dwc3_host_init(struct dwc3 *dwc) |
1559 | goto err; |
1560 | } |
1561 | |
1562 | + ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, |
1563 | + sizeof(dwc3_xhci_plat_priv)); |
1564 | + if (ret) |
1565 | + goto err; |
1566 | + |
1567 | memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); |
1568 | |
1569 | if (dwc->usb3_lpm_capable) |
1570 | @@ -128,4 +138,5 @@ err: |
1571 | void dwc3_host_exit(struct dwc3 *dwc) |
1572 | { |
1573 | platform_device_unregister(dwc->xhci); |
1574 | + dwc->xhci = NULL; |
1575 | } |
1576 | diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c |
1577 | index f7e6c42558eb7..021984921f919 100644 |
1578 | --- a/drivers/usb/gadget/function/storage_common.c |
1579 | +++ b/drivers/usb/gadget/function/storage_common.c |
1580 | @@ -294,8 +294,10 @@ EXPORT_SYMBOL_GPL(fsg_lun_fsync_sub); |
1581 | void store_cdrom_address(u8 *dest, int msf, u32 addr) |
1582 | { |
1583 | if (msf) { |
1584 | - /* Convert to Minutes-Seconds-Frames */ |
1585 | - addr >>= 2; /* Convert to 2048-byte frames */ |
1586 | + /* |
1587 | + * Convert to Minutes-Seconds-Frames. |
1588 | + * Sector size is already set to 2048 bytes. |
1589 | + */ |
1590 | addr += 2*75; /* Lead-in occupies 2 seconds */ |
1591 | dest[3] = addr % 75; /* Frames */ |
1592 | addr /= 75; |
1593 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
1594 | index 9c066d1c512b1..66cb9f08bff10 100644 |
1595 | --- a/drivers/usb/host/xhci-hub.c |
1596 | +++ b/drivers/usb/host/xhci-hub.c |
1597 | @@ -566,7 +566,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd) |
1598 | * It will release and re-aquire the lock while calling ACPI |
1599 | * method. |
1600 | */ |
1601 | -void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, |
1602 | +static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, |
1603 | u16 index, bool on, unsigned long *flags) |
1604 | { |
1605 | struct xhci_hub *rhub; |
1606 | @@ -1555,6 +1555,17 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) |
1607 | |
1608 | status = bus_state->resuming_ports; |
1609 | |
1610 | + /* |
1611 | + * SS devices are only visible to roothub after link training completes. |
1612 | + * Keep polling roothubs for a grace period after xHC start |
1613 | + */ |
1614 | + if (xhci->run_graceperiod) { |
1615 | + if (time_before(jiffies, xhci->run_graceperiod)) |
1616 | + status = 1; |
1617 | + else |
1618 | + xhci->run_graceperiod = 0; |
1619 | + } |
1620 | + |
1621 | mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; |
1622 | |
1623 | /* For each port, did anything change? If so, set that bit in buf. */ |
1624 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
1625 | index 9fe35bb67731e..5ce16a259e612 100644 |
1626 | --- a/drivers/usb/host/xhci.c |
1627 | +++ b/drivers/usb/host/xhci.c |
1628 | @@ -149,9 +149,11 @@ int xhci_start(struct xhci_hcd *xhci) |
1629 | xhci_err(xhci, "Host took too long to start, " |
1630 | "waited %u microseconds.\n", |
1631 | XHCI_MAX_HALT_USEC); |
1632 | - if (!ret) |
1633 | + if (!ret) { |
1634 | /* clear state flags. Including dying, halted or removing */ |
1635 | xhci->xhc_state = 0; |
1636 | + xhci->run_graceperiod = jiffies + msecs_to_jiffies(500); |
1637 | + } |
1638 | |
1639 | return ret; |
1640 | } |
1641 | @@ -775,8 +777,6 @@ static void xhci_stop(struct usb_hcd *hcd) |
1642 | void xhci_shutdown(struct usb_hcd *hcd) |
1643 | { |
1644 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
1645 | - unsigned long flags; |
1646 | - int i; |
1647 | |
1648 | if (xhci->quirks & XHCI_SPURIOUS_REBOOT) |
1649 | usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); |
1650 | @@ -792,21 +792,12 @@ void xhci_shutdown(struct usb_hcd *hcd) |
1651 | del_timer_sync(&xhci->shared_hcd->rh_timer); |
1652 | } |
1653 | |
1654 | - spin_lock_irqsave(&xhci->lock, flags); |
1655 | + spin_lock_irq(&xhci->lock); |
1656 | xhci_halt(xhci); |
1657 | - |
1658 | - /* Power off USB2 ports*/ |
1659 | - for (i = 0; i < xhci->usb2_rhub.num_ports; i++) |
1660 | - xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags); |
1661 | - |
1662 | - /* Power off USB3 ports*/ |
1663 | - for (i = 0; i < xhci->usb3_rhub.num_ports; i++) |
1664 | - xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags); |
1665 | - |
1666 | /* Workaround for spurious wakeups at shutdown with HSW */ |
1667 | if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
1668 | xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
1669 | - spin_unlock_irqrestore(&xhci->lock, flags); |
1670 | + spin_unlock_irq(&xhci->lock); |
1671 | |
1672 | xhci_cleanup_msix(xhci); |
1673 | |
1674 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
1675 | index 5a6ad776858e3..0dc448630197c 100644 |
1676 | --- a/drivers/usb/host/xhci.h |
1677 | +++ b/drivers/usb/host/xhci.h |
1678 | @@ -1814,7 +1814,7 @@ struct xhci_hcd { |
1679 | |
1680 | /* Host controller watchdog timer structures */ |
1681 | unsigned int xhc_state; |
1682 | - |
1683 | + unsigned long run_graceperiod; |
1684 | u32 command; |
1685 | struct s3_save s3; |
1686 | /* Host controller is dying - not responding to commands. "I'm not dead yet!" |
1687 | @@ -2155,8 +2155,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, |
1688 | int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); |
1689 | int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); |
1690 | struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd); |
1691 | -void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index, |
1692 | - bool on, unsigned long *flags); |
1693 | |
1694 | void xhci_hc_died(struct xhci_hcd *xhci); |
1695 | |
1696 | diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
1697 | index f06a09e59d8ba..f37bde88eb5d5 100644 |
1698 | --- a/drivers/usb/serial/ch341.c |
1699 | +++ b/drivers/usb/serial/ch341.c |
1700 | @@ -96,7 +96,9 @@ struct ch341_private { |
1701 | u8 mcr; |
1702 | u8 msr; |
1703 | u8 lcr; |
1704 | + |
1705 | unsigned long quirks; |
1706 | + u8 version; |
1707 | }; |
1708 | |
1709 | static void ch341_set_termios(struct tty_struct *tty, |
1710 | @@ -175,13 +177,20 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev, |
1711 | /* |
1712 | * CH341A buffers data until a full endpoint-size packet (32 bytes) |
1713 | * has been received unless bit 7 is set. |
1714 | + * |
1715 | + * At least one device with version 0x27 appears to have this bit |
1716 | + * inverted. |
1717 | */ |
1718 | - a |= BIT(7); |
1719 | + if (priv->version > 0x27) |
1720 | + a |= BIT(7); |
1721 | |
1722 | r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 0x1312, a); |
1723 | if (r) |
1724 | return r; |
1725 | |
1726 | + if (priv->version < 0x30) |
1727 | + return 0; |
1728 | + |
1729 | r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 0x2518, lcr); |
1730 | if (r) |
1731 | return r; |
1732 | @@ -233,7 +242,9 @@ static int ch341_configure(struct usb_device *dev, struct ch341_private *priv) |
1733 | r = ch341_control_in(dev, CH341_REQ_READ_VERSION, 0, 0, buffer, size); |
1734 | if (r < 0) |
1735 | goto out; |
1736 | - dev_dbg(&dev->dev, "Chip version: 0x%02x\n", buffer[0]); |
1737 | + |
1738 | + priv->version = buffer[0]; |
1739 | + dev_dbg(&dev->dev, "Chip version: 0x%02x\n", priv->version); |
1740 | |
1741 | r = ch341_control_out(dev, CH341_REQ_SERIAL_INIT, 0, 0); |
1742 | if (r < 0) |
1743 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1744 | index d5a1832aa48eb..bc4fd79a13dbe 100644 |
1745 | --- a/drivers/usb/serial/cp210x.c |
1746 | +++ b/drivers/usb/serial/cp210x.c |
1747 | @@ -131,6 +131,7 @@ static const struct usb_device_id id_table[] = { |
1748 | { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */ |
1749 | { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ |
1750 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
1751 | + { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */ |
1752 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ |
1753 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
1754 | { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */ |
1755 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1756 | index d671e096594bb..ed1b26193d7a3 100644 |
1757 | --- a/drivers/usb/serial/ftdi_sio.c |
1758 | +++ b/drivers/usb/serial/ftdi_sio.c |
1759 | @@ -1045,6 +1045,8 @@ static const struct usb_device_id id_table_combined[] = { |
1760 | /* IDS GmbH devices */ |
1761 | { USB_DEVICE(IDS_VID, IDS_SI31A_PID) }, |
1762 | { USB_DEVICE(IDS_VID, IDS_CM31A_PID) }, |
1763 | + /* Omron devices */ |
1764 | + { USB_DEVICE(OMRON_VID, OMRON_CS1W_CIF31_PID) }, |
1765 | /* U-Blox devices */ |
1766 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, |
1767 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, |
1768 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
1769 | index 4e92c165c86bf..31c8ccabbbb78 100644 |
1770 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
1771 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
1772 | @@ -661,6 +661,12 @@ |
1773 | #define INFINEON_TRIBOARD_TC1798_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ |
1774 | #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */ |
1775 | |
1776 | +/* |
1777 | + * Omron corporation (https://www.omron.com) |
1778 | + */ |
1779 | + #define OMRON_VID 0x0590 |
1780 | + #define OMRON_CS1W_CIF31_PID 0x00b2 |
1781 | + |
1782 | /* |
1783 | * Acton Research Corp. |
1784 | */ |
1785 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1786 | index 2317ed357d8ef..cbe8ad3cd61fd 100644 |
1787 | --- a/drivers/usb/serial/option.c |
1788 | +++ b/drivers/usb/serial/option.c |
1789 | @@ -253,6 +253,7 @@ static void option_instat_callback(struct urb *urb); |
1790 | #define QUECTEL_PRODUCT_BG96 0x0296 |
1791 | #define QUECTEL_PRODUCT_EP06 0x0306 |
1792 | #define QUECTEL_PRODUCT_EM05G 0x030a |
1793 | +#define QUECTEL_PRODUCT_EM060K 0x030b |
1794 | #define QUECTEL_PRODUCT_EM12 0x0512 |
1795 | #define QUECTEL_PRODUCT_RM500Q 0x0800 |
1796 | #define QUECTEL_PRODUCT_EC200S_CN 0x6002 |
1797 | @@ -438,6 +439,8 @@ static void option_instat_callback(struct urb *urb); |
1798 | #define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9 |
1799 | #define CINTERION_PRODUCT_MV32_WA 0x00f1 |
1800 | #define CINTERION_PRODUCT_MV32_WB 0x00f2 |
1801 | +#define CINTERION_PRODUCT_MV32_WA_RMNET 0x00f3 |
1802 | +#define CINTERION_PRODUCT_MV32_WB_RMNET 0x00f4 |
1803 | |
1804 | /* Olivetti products */ |
1805 | #define OLIVETTI_VENDOR_ID 0x0b3c |
1806 | @@ -573,6 +576,10 @@ static void option_instat_callback(struct urb *urb); |
1807 | #define WETELECOM_PRODUCT_6802 0x6802 |
1808 | #define WETELECOM_PRODUCT_WMD300 0x6803 |
1809 | |
1810 | +/* OPPO products */ |
1811 | +#define OPPO_VENDOR_ID 0x22d9 |
1812 | +#define OPPO_PRODUCT_R11 0x276c |
1813 | + |
1814 | |
1815 | /* Device flags */ |
1816 | |
1817 | @@ -1138,6 +1145,9 @@ static const struct usb_device_id option_ids[] = { |
1818 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, |
1819 | { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff), |
1820 | .driver_info = RSVD(6) | ZLP }, |
1821 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) }, |
1822 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) }, |
1823 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) }, |
1824 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), |
1825 | .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, |
1826 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, |
1827 | @@ -1993,8 +2003,12 @@ static const struct usb_device_id option_ids[] = { |
1828 | .driver_info = RSVD(0)}, |
1829 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), |
1830 | .driver_info = RSVD(3)}, |
1831 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA_RMNET, 0xff), |
1832 | + .driver_info = RSVD(0) }, |
1833 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff), |
1834 | .driver_info = RSVD(3)}, |
1835 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB_RMNET, 0xff), |
1836 | + .driver_info = RSVD(0) }, |
1837 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), |
1838 | .driver_info = RSVD(4) }, |
1839 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), |
1840 | @@ -2155,6 +2169,7 @@ static const struct usb_device_id option_ids[] = { |
1841 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ |
1842 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ |
1843 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ |
1844 | + { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, |
1845 | { } /* Terminating entry */ |
1846 | }; |
1847 | MODULE_DEVICE_TABLE(usb, option_ids); |
1848 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
1849 | index 66e7f5d123c46..6a59950a63a03 100644 |
1850 | --- a/drivers/usb/storage/unusual_devs.h |
1851 | +++ b/drivers/usb/storage/unusual_devs.h |
1852 | @@ -2294,6 +2294,13 @@ UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000, |
1853 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1854 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), |
1855 | |
1856 | +/* Reported by Witold Lipieta <witold.lipieta@thaumatec.com> */ |
1857 | +UNUSUAL_DEV( 0x1fc9, 0x0117, 0x0100, 0x0100, |
1858 | + "NXP Semiconductors", |
1859 | + "PN7462AU", |
1860 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1861 | + US_FL_IGNORE_RESIDUE ), |
1862 | + |
1863 | /* Supplied with some Castlewood ORB removable drives */ |
1864 | UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, |
1865 | "Double-H Technology", |
1866 | diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c |
1867 | index 4092248a5936d..0b5cbf5ed1ca6 100644 |
1868 | --- a/drivers/usb/typec/altmodes/displayport.c |
1869 | +++ b/drivers/usb/typec/altmodes/displayport.c |
1870 | @@ -87,8 +87,8 @@ static int dp_altmode_configure(struct dp_altmode *dp, u8 con) |
1871 | case DP_STATUS_CON_UFP_D: |
1872 | case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */ |
1873 | conf |= DP_CONF_UFP_U_AS_UFP_D; |
1874 | - pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) & |
1875 | - DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo); |
1876 | + pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) & |
1877 | + DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo); |
1878 | break; |
1879 | default: |
1880 | break; |
1881 | diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c |
1882 | index 80fdd3ee0565f..57b1e011d2d34 100644 |
1883 | --- a/drivers/video/fbdev/chipsfb.c |
1884 | +++ b/drivers/video/fbdev/chipsfb.c |
1885 | @@ -430,6 +430,7 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) |
1886 | err_release_fb: |
1887 | framebuffer_release(p); |
1888 | err_disable: |
1889 | + pci_disable_device(dp); |
1890 | err_out: |
1891 | return rc; |
1892 | } |
1893 | diff --git a/fs/afs/flock.c b/fs/afs/flock.c |
1894 | index d5e5a6ddc8478..0fa05998a24d2 100644 |
1895 | --- a/fs/afs/flock.c |
1896 | +++ b/fs/afs/flock.c |
1897 | @@ -75,7 +75,7 @@ void afs_lock_op_done(struct afs_call *call) |
1898 | if (call->error == 0) { |
1899 | spin_lock(&vnode->lock); |
1900 | trace_afs_flock_ev(vnode, NULL, afs_flock_timestamp, 0); |
1901 | - vnode->locked_at = call->reply_time; |
1902 | + vnode->locked_at = call->issue_time; |
1903 | afs_schedule_lock_extension(vnode); |
1904 | spin_unlock(&vnode->lock); |
1905 | } |
1906 | diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
1907 | index 5c2729fc07e52..254580b1dc74c 100644 |
1908 | --- a/fs/afs/fsclient.c |
1909 | +++ b/fs/afs/fsclient.c |
1910 | @@ -136,7 +136,7 @@ bad: |
1911 | |
1912 | static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) |
1913 | { |
1914 | - return ktime_divns(call->reply_time, NSEC_PER_SEC) + expiry; |
1915 | + return ktime_divns(call->issue_time, NSEC_PER_SEC) + expiry; |
1916 | } |
1917 | |
1918 | static void xdr_decode_AFSCallBack(const __be32 **_bp, |
1919 | diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
1920 | index c3ad582f9fd0e..8d6582713fe72 100644 |
1921 | --- a/fs/afs/internal.h |
1922 | +++ b/fs/afs/internal.h |
1923 | @@ -159,7 +159,6 @@ struct afs_call { |
1924 | bool need_attention; /* T if RxRPC poked us */ |
1925 | bool async; /* T if asynchronous */ |
1926 | bool upgrade; /* T to request service upgrade */ |
1927 | - bool have_reply_time; /* T if have got reply_time */ |
1928 | bool intr; /* T if interruptible */ |
1929 | bool unmarshalling_error; /* T if an unmarshalling error occurred */ |
1930 | u16 service_id; /* Actual service ID (after upgrade) */ |
1931 | @@ -173,7 +172,7 @@ struct afs_call { |
1932 | } __attribute__((packed)); |
1933 | __be64 tmp64; |
1934 | }; |
1935 | - ktime_t reply_time; /* Time of first reply packet */ |
1936 | + ktime_t issue_time; /* Time of issue of operation */ |
1937 | }; |
1938 | |
1939 | struct afs_call_type { |
1940 | diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
1941 | index 6adab30a83993..49fcce6529a60 100644 |
1942 | --- a/fs/afs/rxrpc.c |
1943 | +++ b/fs/afs/rxrpc.c |
1944 | @@ -428,6 +428,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) |
1945 | if (call->max_lifespan) |
1946 | rxrpc_kernel_set_max_life(call->net->socket, rxcall, |
1947 | call->max_lifespan); |
1948 | + call->issue_time = ktime_get_real(); |
1949 | |
1950 | /* send the request */ |
1951 | iov[0].iov_base = call->request; |
1952 | @@ -532,12 +533,6 @@ static void afs_deliver_to_call(struct afs_call *call) |
1953 | return; |
1954 | } |
1955 | |
1956 | - if (!call->have_reply_time && |
1957 | - rxrpc_kernel_get_reply_time(call->net->socket, |
1958 | - call->rxcall, |
1959 | - &call->reply_time)) |
1960 | - call->have_reply_time = true; |
1961 | - |
1962 | ret = call->type->deliver(call); |
1963 | state = READ_ONCE(call->state); |
1964 | if (ret == 0 && call->unmarshalling_error) |
1965 | diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
1966 | index 3b19b009452a2..fa85b359f325b 100644 |
1967 | --- a/fs/afs/yfsclient.c |
1968 | +++ b/fs/afs/yfsclient.c |
1969 | @@ -241,8 +241,7 @@ static void xdr_decode_YFSCallBack(const __be32 **_bp, |
1970 | struct afs_callback *cb = &scb->callback; |
1971 | ktime_t cb_expiry; |
1972 | |
1973 | - cb_expiry = call->reply_time; |
1974 | - cb_expiry = ktime_add(cb_expiry, xdr_to_u64(x->expiration_time) * 100); |
1975 | + cb_expiry = ktime_add(call->issue_time, xdr_to_u64(x->expiration_time) * 100); |
1976 | cb->expires_at = ktime_divns(cb_expiry, NSEC_PER_SEC); |
1977 | scb->have_cb = true; |
1978 | *_bp += xdr_size(x); |
1979 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1980 | index c7706a769de12..548de841cee53 100644 |
1981 | --- a/fs/btrfs/volumes.c |
1982 | +++ b/fs/btrfs/volumes.c |
1983 | @@ -713,15 +713,47 @@ static void pending_bios_fn(struct btrfs_work *work) |
1984 | run_scheduled_bios(device); |
1985 | } |
1986 | |
1987 | -static bool device_path_matched(const char *path, struct btrfs_device *device) |
1988 | +/* |
1989 | + * Check if the device in the path matches the device in the given struct device. |
1990 | + * |
1991 | + * Returns: |
1992 | + * true If it is the same device. |
1993 | + * false If it is not the same device or on error. |
1994 | + */ |
1995 | +static bool device_matched(const struct btrfs_device *device, const char *path) |
1996 | { |
1997 | - int found; |
1998 | + char *device_name; |
1999 | + struct block_device *bdev_old; |
2000 | + struct block_device *bdev_new; |
2001 | + |
2002 | + /* |
2003 | + * If we are looking for a device with the matching dev_t, then skip |
2004 | + * device without a name (a missing device). |
2005 | + */ |
2006 | + if (!device->name) |
2007 | + return false; |
2008 | + |
2009 | + device_name = kzalloc(BTRFS_PATH_NAME_MAX, GFP_KERNEL); |
2010 | + if (!device_name) |
2011 | + return false; |
2012 | |
2013 | rcu_read_lock(); |
2014 | - found = strcmp(rcu_str_deref(device->name), path); |
2015 | + scnprintf(device_name, BTRFS_PATH_NAME_MAX, "%s", rcu_str_deref(device->name)); |
2016 | rcu_read_unlock(); |
2017 | |
2018 | - return found == 0; |
2019 | + bdev_old = lookup_bdev(device_name); |
2020 | + kfree(device_name); |
2021 | + if (IS_ERR(bdev_old)) |
2022 | + return false; |
2023 | + |
2024 | + bdev_new = lookup_bdev(path); |
2025 | + if (IS_ERR(bdev_new)) |
2026 | + return false; |
2027 | + |
2028 | + if (bdev_old == bdev_new) |
2029 | + return true; |
2030 | + |
2031 | + return false; |
2032 | } |
2033 | |
2034 | /* |
2035 | @@ -754,9 +786,7 @@ static int btrfs_free_stale_devices(const char *path, |
2036 | &fs_devices->devices, dev_list) { |
2037 | if (skip_device && skip_device == device) |
2038 | continue; |
2039 | - if (path && !device->name) |
2040 | - continue; |
2041 | - if (path && !device_path_matched(path, device)) |
2042 | + if (path && !device_matched(device, path)) |
2043 | continue; |
2044 | if (fs_devices->opened) { |
2045 | /* for an already deleted device return 0 */ |
2046 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
2047 | index 6ae281cff0d50..6039b0cdfe04e 100644 |
2048 | --- a/fs/cifs/smb2ops.c |
2049 | +++ b/fs/cifs/smb2ops.c |
2050 | @@ -3051,7 +3051,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, |
2051 | static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, |
2052 | loff_t offset, loff_t len) |
2053 | { |
2054 | - struct inode *inode; |
2055 | + struct inode *inode = file_inode(file); |
2056 | struct cifsFileInfo *cfile = file->private_data; |
2057 | struct file_zero_data_information fsctl_buf; |
2058 | long rc; |
2059 | @@ -3060,14 +3060,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, |
2060 | |
2061 | xid = get_xid(); |
2062 | |
2063 | - inode = d_inode(cfile->dentry); |
2064 | - |
2065 | + inode_lock(inode); |
2066 | /* Need to make file sparse, if not already, before freeing range. */ |
2067 | /* Consider adding equivalent for compressed since it could also work */ |
2068 | if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) { |
2069 | rc = -EOPNOTSUPP; |
2070 | - free_xid(xid); |
2071 | - return rc; |
2072 | + goto out; |
2073 | } |
2074 | |
2075 | /* |
2076 | @@ -3086,6 +3084,8 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, |
2077 | true /* is_fctl */, (char *)&fsctl_buf, |
2078 | sizeof(struct file_zero_data_information), |
2079 | CIFSMaxBufSize, NULL, NULL); |
2080 | +out: |
2081 | + inode_unlock(inode); |
2082 | free_xid(xid); |
2083 | return rc; |
2084 | } |
2085 | diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c |
2086 | index e595a29bf46e3..e0f07382ebebc 100644 |
2087 | --- a/fs/debugfs/inode.c |
2088 | +++ b/fs/debugfs/inode.c |
2089 | @@ -742,6 +742,28 @@ void debugfs_remove(struct dentry *dentry) |
2090 | } |
2091 | EXPORT_SYMBOL_GPL(debugfs_remove); |
2092 | |
2093 | +/** |
2094 | + * debugfs_lookup_and_remove - lookup a directory or file and recursively remove it |
2095 | + * @name: a pointer to a string containing the name of the item to look up. |
2096 | + * @parent: a pointer to the parent dentry of the item. |
2097 | + * |
2098 | + * This is the equlivant of doing something like |
2099 | + * debugfs_remove(debugfs_lookup(..)) but with the proper reference counting |
2100 | + * handled for the directory being looked up. |
2101 | + */ |
2102 | +void debugfs_lookup_and_remove(const char *name, struct dentry *parent) |
2103 | +{ |
2104 | + struct dentry *dentry; |
2105 | + |
2106 | + dentry = debugfs_lookup(name, parent); |
2107 | + if (!dentry) |
2108 | + return; |
2109 | + |
2110 | + debugfs_remove(dentry); |
2111 | + dput(dentry); |
2112 | +} |
2113 | +EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove); |
2114 | + |
2115 | /** |
2116 | * debugfs_remove_recursive - recursively removes a directory |
2117 | * @dentry: a pointer to a the dentry of the directory to be removed. If this |
2118 | diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h |
2119 | index 8fab480a8e4e4..0575ad84cc555 100644 |
2120 | --- a/include/linux/buffer_head.h |
2121 | +++ b/include/linux/buffer_head.h |
2122 | @@ -136,6 +136,17 @@ BUFFER_FNS(Defer_Completion, defer_completion) |
2123 | |
2124 | static __always_inline void set_buffer_uptodate(struct buffer_head *bh) |
2125 | { |
2126 | + /* |
2127 | + * If somebody else already set this uptodate, they will |
2128 | + * have done the memory barrier, and a reader will thus |
2129 | + * see *some* valid buffer state. |
2130 | + * |
2131 | + * Any other serialization (with IO errors or whatever that |
2132 | + * might clear the bit) has to come from other state (eg BH_Lock). |
2133 | + */ |
2134 | + if (test_bit(BH_Uptodate, &bh->b_state)) |
2135 | + return; |
2136 | + |
2137 | /* |
2138 | * make it consistent with folio_mark_uptodate |
2139 | * pairs with smp_load_acquire in buffer_uptodate |
2140 | diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h |
2141 | index 798f0b9b43aee..7e4f156acc2f7 100644 |
2142 | --- a/include/linux/debugfs.h |
2143 | +++ b/include/linux/debugfs.h |
2144 | @@ -85,6 +85,8 @@ struct dentry *debugfs_create_automount(const char *name, |
2145 | void debugfs_remove(struct dentry *dentry); |
2146 | void debugfs_remove_recursive(struct dentry *dentry); |
2147 | |
2148 | +void debugfs_lookup_and_remove(const char *name, struct dentry *parent); |
2149 | + |
2150 | const struct file_operations *debugfs_real_fops(const struct file *filp); |
2151 | |
2152 | int debugfs_file_get(struct dentry *dentry); |
2153 | @@ -216,6 +218,10 @@ static inline void debugfs_remove(struct dentry *dentry) |
2154 | static inline void debugfs_remove_recursive(struct dentry *dentry) |
2155 | { } |
2156 | |
2157 | +static inline void debugfs_lookup_and_remove(const char *name, |
2158 | + struct dentry *parent) |
2159 | +{ } |
2160 | + |
2161 | const struct file_operations *debugfs_real_fops(const struct file *filp); |
2162 | |
2163 | static inline int debugfs_file_get(struct dentry *dentry) |
2164 | diff --git a/include/linux/platform_data/x86/pmc_atom.h b/include/linux/platform_data/x86/pmc_atom.h |
2165 | index 022bcea9edec5..99a9b09dc839d 100644 |
2166 | --- a/include/linux/platform_data/x86/pmc_atom.h |
2167 | +++ b/include/linux/platform_data/x86/pmc_atom.h |
2168 | @@ -7,6 +7,8 @@ |
2169 | #ifndef PMC_ATOM_H |
2170 | #define PMC_ATOM_H |
2171 | |
2172 | +#include <linux/bits.h> |
2173 | + |
2174 | /* ValleyView Power Control Unit PCI Device ID */ |
2175 | #define PCI_DEVICE_ID_VLV_PMC 0x0F1C |
2176 | /* CherryTrail Power Control Unit PCI Device ID */ |
2177 | @@ -139,9 +141,9 @@ |
2178 | #define ACPI_MMIO_REG_LEN 0x100 |
2179 | |
2180 | #define PM1_CNT 0x4 |
2181 | -#define SLEEP_TYPE_MASK 0xFFFFECFF |
2182 | +#define SLEEP_TYPE_MASK GENMASK(12, 10) |
2183 | #define SLEEP_TYPE_S5 0x1C00 |
2184 | -#define SLEEP_ENABLE 0x2000 |
2185 | +#define SLEEP_ENABLE BIT(13) |
2186 | |
2187 | extern int pmc_atom_read(int offset, u32 *value); |
2188 | extern int pmc_atom_write(int offset, u32 value); |
2189 | diff --git a/include/linux/usb.h b/include/linux/usb.h |
2190 | index e656e7b4b1e44..703c7464d8957 100644 |
2191 | --- a/include/linux/usb.h |
2192 | +++ b/include/linux/usb.h |
2193 | @@ -580,6 +580,7 @@ struct usb3_lpm_parameters { |
2194 | * @devaddr: device address, XHCI: assigned by HW, others: same as devnum |
2195 | * @can_submit: URBs may be submitted |
2196 | * @persist_enabled: USB_PERSIST enabled for this device |
2197 | + * @reset_in_progress: the device is being reset |
2198 | * @have_langid: whether string_langid is valid |
2199 | * @authorized: policy has said we can use it; |
2200 | * (user space) policy determines if we authorize this device to be |
2201 | @@ -665,6 +666,7 @@ struct usb_device { |
2202 | |
2203 | unsigned can_submit:1; |
2204 | unsigned persist_enabled:1; |
2205 | + unsigned reset_in_progress:1; |
2206 | unsigned have_langid:1; |
2207 | unsigned authorized:1; |
2208 | unsigned authenticated:1; |
2209 | diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h |
2210 | index fc4c7edb2e8a4..296909ea04f26 100644 |
2211 | --- a/include/linux/usb/typec_dp.h |
2212 | +++ b/include/linux/usb/typec_dp.h |
2213 | @@ -73,6 +73,11 @@ enum { |
2214 | #define DP_CAP_USB BIT(7) |
2215 | #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8) |
2216 | #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16) |
2217 | +/* Get pin assignment taking plug & receptacle into consideration */ |
2218 | +#define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ |
2219 | + DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_)) |
2220 | +#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ |
2221 | + DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_)) |
2222 | |
2223 | /* DisplayPort Status Update VDO bits */ |
2224 | #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3) |
2225 | diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h |
2226 | index 236f290224aae..8dfb2526b3aa2 100644 |
2227 | --- a/kernel/cgroup/cgroup-internal.h |
2228 | +++ b/kernel/cgroup/cgroup-internal.h |
2229 | @@ -250,9 +250,10 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup, |
2230 | |
2231 | int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, |
2232 | bool threadgroup); |
2233 | -struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) |
2234 | +struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, |
2235 | + bool *locked) |
2236 | __acquires(&cgroup_threadgroup_rwsem); |
2237 | -void cgroup_procs_write_finish(struct task_struct *task) |
2238 | +void cgroup_procs_write_finish(struct task_struct *task, bool locked) |
2239 | __releases(&cgroup_threadgroup_rwsem); |
2240 | |
2241 | void cgroup_lock_and_drain_offline(struct cgroup *cgrp); |
2242 | diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c |
2243 | index 117d70098cd49..aa7577b189e92 100644 |
2244 | --- a/kernel/cgroup/cgroup-v1.c |
2245 | +++ b/kernel/cgroup/cgroup-v1.c |
2246 | @@ -498,12 +498,13 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, |
2247 | struct task_struct *task; |
2248 | const struct cred *cred, *tcred; |
2249 | ssize_t ret; |
2250 | + bool locked; |
2251 | |
2252 | cgrp = cgroup_kn_lock_live(of->kn, false); |
2253 | if (!cgrp) |
2254 | return -ENODEV; |
2255 | |
2256 | - task = cgroup_procs_write_start(buf, threadgroup); |
2257 | + task = cgroup_procs_write_start(buf, threadgroup, &locked); |
2258 | ret = PTR_ERR_OR_ZERO(task); |
2259 | if (ret) |
2260 | goto out_unlock; |
2261 | @@ -526,7 +527,7 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, |
2262 | ret = cgroup_attach_task(cgrp, task, threadgroup); |
2263 | |
2264 | out_finish: |
2265 | - cgroup_procs_write_finish(task); |
2266 | + cgroup_procs_write_finish(task, locked); |
2267 | out_unlock: |
2268 | cgroup_kn_unlock(of->kn); |
2269 | |
2270 | diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
2271 | index 23f0db2900e4b..d14575c0e4640 100644 |
2272 | --- a/kernel/cgroup/cgroup.c |
2273 | +++ b/kernel/cgroup/cgroup.c |
2274 | @@ -30,6 +30,7 @@ |
2275 | |
2276 | #include "cgroup-internal.h" |
2277 | |
2278 | +#include <linux/cpu.h> |
2279 | #include <linux/cred.h> |
2280 | #include <linux/errno.h> |
2281 | #include <linux/init_task.h> |
2282 | @@ -2376,6 +2377,47 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) |
2283 | } |
2284 | EXPORT_SYMBOL_GPL(task_cgroup_path); |
2285 | |
2286 | +/** |
2287 | + * cgroup_attach_lock - Lock for ->attach() |
2288 | + * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem |
2289 | + * |
2290 | + * cgroup migration sometimes needs to stabilize threadgroups against forks and |
2291 | + * exits by write-locking cgroup_threadgroup_rwsem. However, some ->attach() |
2292 | + * implementations (e.g. cpuset), also need to disable CPU hotplug. |
2293 | + * Unfortunately, letting ->attach() operations acquire cpus_read_lock() can |
2294 | + * lead to deadlocks. |
2295 | + * |
2296 | + * Bringing up a CPU may involve creating and destroying tasks which requires |
2297 | + * read-locking threadgroup_rwsem, so threadgroup_rwsem nests inside |
2298 | + * cpus_read_lock(). If we call an ->attach() which acquires the cpus lock while |
2299 | + * write-locking threadgroup_rwsem, the locking order is reversed and we end up |
2300 | + * waiting for an on-going CPU hotplug operation which in turn is waiting for |
2301 | + * the threadgroup_rwsem to be released to create new tasks. For more details: |
2302 | + * |
2303 | + * http://lkml.kernel.org/r/20220711174629.uehfmqegcwn2lqzu@wubuntu |
2304 | + * |
2305 | + * Resolve the situation by always acquiring cpus_read_lock() before optionally |
2306 | + * write-locking cgroup_threadgroup_rwsem. This allows ->attach() to assume that |
2307 | + * CPU hotplug is disabled on entry. |
2308 | + */ |
2309 | +static void cgroup_attach_lock(bool lock_threadgroup) |
2310 | +{ |
2311 | + cpus_read_lock(); |
2312 | + if (lock_threadgroup) |
2313 | + percpu_down_write(&cgroup_threadgroup_rwsem); |
2314 | +} |
2315 | + |
2316 | +/** |
2317 | + * cgroup_attach_unlock - Undo cgroup_attach_lock() |
2318 | + * @lock_threadgroup: whether to up_write cgroup_threadgroup_rwsem |
2319 | + */ |
2320 | +static void cgroup_attach_unlock(bool lock_threadgroup) |
2321 | +{ |
2322 | + if (lock_threadgroup) |
2323 | + percpu_up_write(&cgroup_threadgroup_rwsem); |
2324 | + cpus_read_unlock(); |
2325 | +} |
2326 | + |
2327 | /** |
2328 | * cgroup_migrate_add_task - add a migration target task to a migration context |
2329 | * @task: target task |
2330 | @@ -2856,8 +2898,8 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, |
2331 | return ret; |
2332 | } |
2333 | |
2334 | -struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) |
2335 | - __acquires(&cgroup_threadgroup_rwsem) |
2336 | +struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, |
2337 | + bool *threadgroup_locked) |
2338 | { |
2339 | struct task_struct *tsk; |
2340 | pid_t pid; |
2341 | @@ -2865,7 +2907,17 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) |
2342 | if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) |
2343 | return ERR_PTR(-EINVAL); |
2344 | |
2345 | - percpu_down_write(&cgroup_threadgroup_rwsem); |
2346 | + /* |
2347 | + * If we migrate a single thread, we don't care about threadgroup |
2348 | + * stability. If the thread is `current`, it won't exit(2) under our |
2349 | + * hands or change PID through exec(2). We exclude |
2350 | + * cgroup_update_dfl_csses and other cgroup_{proc,thread}s_write |
2351 | + * callers by cgroup_mutex. |
2352 | + * Therefore, we can skip the global lock. |
2353 | + */ |
2354 | + lockdep_assert_held(&cgroup_mutex); |
2355 | + *threadgroup_locked = pid || threadgroup; |
2356 | + cgroup_attach_lock(*threadgroup_locked); |
2357 | |
2358 | rcu_read_lock(); |
2359 | if (pid) { |
2360 | @@ -2896,14 +2948,14 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) |
2361 | goto out_unlock_rcu; |
2362 | |
2363 | out_unlock_threadgroup: |
2364 | - percpu_up_write(&cgroup_threadgroup_rwsem); |
2365 | + cgroup_attach_unlock(*threadgroup_locked); |
2366 | + *threadgroup_locked = false; |
2367 | out_unlock_rcu: |
2368 | rcu_read_unlock(); |
2369 | return tsk; |
2370 | } |
2371 | |
2372 | -void cgroup_procs_write_finish(struct task_struct *task) |
2373 | - __releases(&cgroup_threadgroup_rwsem) |
2374 | +void cgroup_procs_write_finish(struct task_struct *task, bool threadgroup_locked) |
2375 | { |
2376 | struct cgroup_subsys *ss; |
2377 | int ssid; |
2378 | @@ -2911,7 +2963,8 @@ void cgroup_procs_write_finish(struct task_struct *task) |
2379 | /* release reference from cgroup_procs_write_start() */ |
2380 | put_task_struct(task); |
2381 | |
2382 | - percpu_up_write(&cgroup_threadgroup_rwsem); |
2383 | + cgroup_attach_unlock(threadgroup_locked); |
2384 | + |
2385 | for_each_subsys(ss, ssid) |
2386 | if (ss->post_attach) |
2387 | ss->post_attach(); |
2388 | @@ -2966,12 +3019,11 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp) |
2389 | struct cgroup_subsys_state *d_css; |
2390 | struct cgroup *dsct; |
2391 | struct css_set *src_cset; |
2392 | + bool has_tasks; |
2393 | int ret; |
2394 | |
2395 | lockdep_assert_held(&cgroup_mutex); |
2396 | |
2397 | - percpu_down_write(&cgroup_threadgroup_rwsem); |
2398 | - |
2399 | /* look up all csses currently attached to @cgrp's subtree */ |
2400 | spin_lock_irq(&css_set_lock); |
2401 | cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) { |
2402 | @@ -2982,6 +3034,15 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp) |
2403 | } |
2404 | spin_unlock_irq(&css_set_lock); |
2405 | |
2406 | + /* |
2407 | + * We need to write-lock threadgroup_rwsem while migrating tasks. |
2408 | + * However, if there are no source csets for @cgrp, changing its |
2409 | + * controllers isn't gonna produce any task migrations and the |
2410 | + * write-locking can be skipped safely. |
2411 | + */ |
2412 | + has_tasks = !list_empty(&mgctx.preloaded_src_csets); |
2413 | + cgroup_attach_lock(has_tasks); |
2414 | + |
2415 | /* NULL dst indicates self on default hierarchy */ |
2416 | ret = cgroup_migrate_prepare_dst(&mgctx); |
2417 | if (ret) |
2418 | @@ -3001,7 +3062,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp) |
2419 | ret = cgroup_migrate_execute(&mgctx); |
2420 | out_finish: |
2421 | cgroup_migrate_finish(&mgctx); |
2422 | - percpu_up_write(&cgroup_threadgroup_rwsem); |
2423 | + cgroup_attach_unlock(has_tasks); |
2424 | return ret; |
2425 | } |
2426 | |
2427 | @@ -4830,12 +4891,13 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, |
2428 | struct task_struct *task; |
2429 | const struct cred *saved_cred; |
2430 | ssize_t ret; |
2431 | + bool threadgroup_locked; |
2432 | |
2433 | dst_cgrp = cgroup_kn_lock_live(of->kn, false); |
2434 | if (!dst_cgrp) |
2435 | return -ENODEV; |
2436 | |
2437 | - task = cgroup_procs_write_start(buf, true); |
2438 | + task = cgroup_procs_write_start(buf, true, &threadgroup_locked); |
2439 | ret = PTR_ERR_OR_ZERO(task); |
2440 | if (ret) |
2441 | goto out_unlock; |
2442 | @@ -4861,7 +4923,7 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, |
2443 | ret = cgroup_attach_task(dst_cgrp, task, true); |
2444 | |
2445 | out_finish: |
2446 | - cgroup_procs_write_finish(task); |
2447 | + cgroup_procs_write_finish(task, threadgroup_locked); |
2448 | out_unlock: |
2449 | cgroup_kn_unlock(of->kn); |
2450 | |
2451 | @@ -4881,6 +4943,7 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, |
2452 | struct task_struct *task; |
2453 | const struct cred *saved_cred; |
2454 | ssize_t ret; |
2455 | + bool locked; |
2456 | |
2457 | buf = strstrip(buf); |
2458 | |
2459 | @@ -4888,7 +4951,7 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, |
2460 | if (!dst_cgrp) |
2461 | return -ENODEV; |
2462 | |
2463 | - task = cgroup_procs_write_start(buf, false); |
2464 | + task = cgroup_procs_write_start(buf, false, &locked); |
2465 | ret = PTR_ERR_OR_ZERO(task); |
2466 | if (ret) |
2467 | goto out_unlock; |
2468 | @@ -4919,7 +4982,7 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, |
2469 | ret = cgroup_attach_task(dst_cgrp, task, false); |
2470 | |
2471 | out_finish: |
2472 | - cgroup_procs_write_finish(task); |
2473 | + cgroup_procs_write_finish(task, locked); |
2474 | out_unlock: |
2475 | cgroup_kn_unlock(of->kn); |
2476 | |
2477 | diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
2478 | index b02eca235ba3f..9ba94a9a67aa4 100644 |
2479 | --- a/kernel/cgroup/cpuset.c |
2480 | +++ b/kernel/cgroup/cpuset.c |
2481 | @@ -2204,7 +2204,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
2482 | cgroup_taskset_first(tset, &css); |
2483 | cs = css_cs(css); |
2484 | |
2485 | - cpus_read_lock(); |
2486 | + lockdep_assert_cpus_held(); /* see cgroup_attach_lock() */ |
2487 | percpu_down_write(&cpuset_rwsem); |
2488 | |
2489 | /* prepare for attach */ |
2490 | @@ -2260,7 +2260,6 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
2491 | wake_up(&cpuset_attach_wq); |
2492 | |
2493 | percpu_up_write(&cpuset_rwsem); |
2494 | - cpus_read_unlock(); |
2495 | } |
2496 | |
2497 | /* The various types of files and directories in a cpuset file system */ |
2498 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
2499 | index 9631ecc8a34c9..6e9f5a10e04ae 100644 |
2500 | --- a/kernel/kprobes.c |
2501 | +++ b/kernel/kprobes.c |
2502 | @@ -1596,6 +1596,7 @@ static int check_kprobe_address_safe(struct kprobe *p, |
2503 | /* Ensure it is not in reserved area nor out of text */ |
2504 | if (!(core_kernel_text((unsigned long) p->addr) || |
2505 | is_module_text_address((unsigned long) p->addr)) || |
2506 | + in_gate_area_no_mm((unsigned long) p->addr) || |
2507 | within_kprobe_blacklist((unsigned long) p->addr) || |
2508 | jump_label_text_reserved(p->addr, p->addr) || |
2509 | find_bug((unsigned long)p->addr)) { |
2510 | diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
2511 | index 3761c79137b17..d8cde7292bf92 100644 |
2512 | --- a/mm/kmemleak.c |
2513 | +++ b/mm/kmemleak.c |
2514 | @@ -1123,7 +1123,7 @@ EXPORT_SYMBOL(kmemleak_no_scan); |
2515 | void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, int min_count, |
2516 | gfp_t gfp) |
2517 | { |
2518 | - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) |
2519 | + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) |
2520 | kmemleak_alloc(__va(phys), size, min_count, gfp); |
2521 | } |
2522 | EXPORT_SYMBOL(kmemleak_alloc_phys); |
2523 | @@ -1137,7 +1137,7 @@ EXPORT_SYMBOL(kmemleak_alloc_phys); |
2524 | */ |
2525 | void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size) |
2526 | { |
2527 | - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) |
2528 | + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) |
2529 | kmemleak_free_part(__va(phys), size); |
2530 | } |
2531 | EXPORT_SYMBOL(kmemleak_free_part_phys); |
2532 | @@ -1149,7 +1149,7 @@ EXPORT_SYMBOL(kmemleak_free_part_phys); |
2533 | */ |
2534 | void __ref kmemleak_not_leak_phys(phys_addr_t phys) |
2535 | { |
2536 | - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) |
2537 | + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) |
2538 | kmemleak_not_leak(__va(phys)); |
2539 | } |
2540 | EXPORT_SYMBOL(kmemleak_not_leak_phys); |
2541 | @@ -1161,7 +1161,7 @@ EXPORT_SYMBOL(kmemleak_not_leak_phys); |
2542 | */ |
2543 | void __ref kmemleak_ignore_phys(phys_addr_t phys) |
2544 | { |
2545 | - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) |
2546 | + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) |
2547 | kmemleak_ignore(__va(phys)); |
2548 | } |
2549 | EXPORT_SYMBOL(kmemleak_ignore_phys); |
2550 | diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
2551 | index 19726d81025d5..01e33724d10c3 100644 |
2552 | --- a/net/bridge/br_netfilter_hooks.c |
2553 | +++ b/net/bridge/br_netfilter_hooks.c |
2554 | @@ -384,6 +384,7 @@ static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_ |
2555 | /* - Bridged-and-DNAT'ed traffic doesn't |
2556 | * require ip_forwarding. */ |
2557 | if (rt->dst.dev == dev) { |
2558 | + skb_dst_drop(skb); |
2559 | skb_dst_set(skb, &rt->dst); |
2560 | goto bridged_dnat; |
2561 | } |
2562 | @@ -413,6 +414,7 @@ bridged_dnat: |
2563 | kfree_skb(skb); |
2564 | return 0; |
2565 | } |
2566 | + skb_dst_drop(skb); |
2567 | skb_dst_set_noref(skb, &rt->dst); |
2568 | } |
2569 | |
2570 | diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c |
2571 | index e4e0c836c3f51..6b07f30675bb0 100644 |
2572 | --- a/net/bridge/br_netfilter_ipv6.c |
2573 | +++ b/net/bridge/br_netfilter_ipv6.c |
2574 | @@ -197,6 +197,7 @@ static int br_nf_pre_routing_finish_ipv6(struct net *net, struct sock *sk, struc |
2575 | kfree_skb(skb); |
2576 | return 0; |
2577 | } |
2578 | + skb_dst_drop(skb); |
2579 | skb_dst_set_noref(skb, &rt->dst); |
2580 | } |
2581 | |
2582 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
2583 | index ef3e7a3e3a29e..d38c8ca93ba09 100644 |
2584 | --- a/net/ipv4/fib_frontend.c |
2585 | +++ b/net/ipv4/fib_frontend.c |
2586 | @@ -399,7 +399,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, |
2587 | dev_match = dev_match || (res.type == RTN_LOCAL && |
2588 | dev == net->loopback_dev); |
2589 | if (dev_match) { |
2590 | - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; |
2591 | + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; |
2592 | return ret; |
2593 | } |
2594 | if (no_addr) |
2595 | @@ -411,7 +411,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, |
2596 | ret = 0; |
2597 | if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) { |
2598 | if (res.type == RTN_UNICAST) |
2599 | - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; |
2600 | + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; |
2601 | } |
2602 | return ret; |
2603 | |
2604 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
2605 | index f4e00ff909da3..0ebba83dbe220 100644 |
2606 | --- a/net/ipv4/tcp_input.c |
2607 | +++ b/net/ipv4/tcp_input.c |
2608 | @@ -2384,6 +2384,21 @@ static inline bool tcp_may_undo(const struct tcp_sock *tp) |
2609 | return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp)); |
2610 | } |
2611 | |
2612 | +static bool tcp_is_non_sack_preventing_reopen(struct sock *sk) |
2613 | +{ |
2614 | + struct tcp_sock *tp = tcp_sk(sk); |
2615 | + |
2616 | + if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { |
2617 | + /* Hold old state until something *above* high_seq |
2618 | + * is ACKed. For Reno it is MUST to prevent false |
2619 | + * fast retransmits (RFC2582). SACK TCP is safe. */ |
2620 | + if (!tcp_any_retrans_done(sk)) |
2621 | + tp->retrans_stamp = 0; |
2622 | + return true; |
2623 | + } |
2624 | + return false; |
2625 | +} |
2626 | + |
2627 | /* People celebrate: "We love our President!" */ |
2628 | static bool tcp_try_undo_recovery(struct sock *sk) |
2629 | { |
2630 | @@ -2406,14 +2421,8 @@ static bool tcp_try_undo_recovery(struct sock *sk) |
2631 | } else if (tp->rack.reo_wnd_persist) { |
2632 | tp->rack.reo_wnd_persist--; |
2633 | } |
2634 | - if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { |
2635 | - /* Hold old state until something *above* high_seq |
2636 | - * is ACKed. For Reno it is MUST to prevent false |
2637 | - * fast retransmits (RFC2582). SACK TCP is safe. */ |
2638 | - if (!tcp_any_retrans_done(sk)) |
2639 | - tp->retrans_stamp = 0; |
2640 | + if (tcp_is_non_sack_preventing_reopen(sk)) |
2641 | return true; |
2642 | - } |
2643 | tcp_set_ca_state(sk, TCP_CA_Open); |
2644 | tp->is_sack_reneg = 0; |
2645 | return false; |
2646 | @@ -2449,6 +2458,8 @@ static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo) |
2647 | NET_INC_STATS(sock_net(sk), |
2648 | LINUX_MIB_TCPSPURIOUSRTOS); |
2649 | inet_csk(sk)->icsk_retransmits = 0; |
2650 | + if (tcp_is_non_sack_preventing_reopen(sk)) |
2651 | + return true; |
2652 | if (frto_undo || tcp_is_sack(tp)) { |
2653 | tcp_set_ca_state(sk, TCP_CA_Open); |
2654 | tp->is_sack_reneg = 0; |
2655 | @@ -3484,11 +3495,11 @@ static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb) |
2656 | |
2657 | /* Then check host-wide RFC 5961 rate limit. */ |
2658 | now = jiffies / HZ; |
2659 | - if (now != challenge_timestamp) { |
2660 | + if (now != READ_ONCE(challenge_timestamp)) { |
2661 | u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit); |
2662 | u32 half = (ack_limit + 1) >> 1; |
2663 | |
2664 | - challenge_timestamp = now; |
2665 | + WRITE_ONCE(challenge_timestamp, now); |
2666 | WRITE_ONCE(challenge_count, half + prandom_u32_max(ack_limit)); |
2667 | } |
2668 | count = READ_ONCE(challenge_count); |
2669 | diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c |
2670 | index 75421a472d25a..f5c448c276fef 100644 |
2671 | --- a/net/ipv6/seg6.c |
2672 | +++ b/net/ipv6/seg6.c |
2673 | @@ -125,6 +125,11 @@ static int seg6_genl_sethmac(struct sk_buff *skb, struct genl_info *info) |
2674 | goto out_unlock; |
2675 | } |
2676 | |
2677 | + if (slen > nla_len(info->attrs[SEG6_ATTR_SECRET])) { |
2678 | + err = -EINVAL; |
2679 | + goto out_unlock; |
2680 | + } |
2681 | + |
2682 | if (hinfo) { |
2683 | err = seg6_hmac_info_del(net, hmackeyid); |
2684 | if (err) |
2685 | diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c |
2686 | index ea9e73428ed9c..659a589b1fad1 100644 |
2687 | --- a/net/kcm/kcmsock.c |
2688 | +++ b/net/kcm/kcmsock.c |
2689 | @@ -1413,12 +1413,6 @@ static int kcm_attach(struct socket *sock, struct socket *csock, |
2690 | psock->sk = csk; |
2691 | psock->bpf_prog = prog; |
2692 | |
2693 | - err = strp_init(&psock->strp, csk, &cb); |
2694 | - if (err) { |
2695 | - kmem_cache_free(kcm_psockp, psock); |
2696 | - goto out; |
2697 | - } |
2698 | - |
2699 | write_lock_bh(&csk->sk_callback_lock); |
2700 | |
2701 | /* Check if sk_user_data is aready by KCM or someone else. |
2702 | @@ -1426,13 +1420,18 @@ static int kcm_attach(struct socket *sock, struct socket *csock, |
2703 | */ |
2704 | if (csk->sk_user_data) { |
2705 | write_unlock_bh(&csk->sk_callback_lock); |
2706 | - strp_stop(&psock->strp); |
2707 | - strp_done(&psock->strp); |
2708 | kmem_cache_free(kcm_psockp, psock); |
2709 | err = -EALREADY; |
2710 | goto out; |
2711 | } |
2712 | |
2713 | + err = strp_init(&psock->strp, csk, &cb); |
2714 | + if (err) { |
2715 | + write_unlock_bh(&csk->sk_callback_lock); |
2716 | + kmem_cache_free(kcm_psockp, psock); |
2717 | + goto out; |
2718 | + } |
2719 | + |
2720 | psock->save_data_ready = csk->sk_data_ready; |
2721 | psock->save_write_space = csk->sk_write_space; |
2722 | psock->save_state_change = csk->sk_state_change; |
2723 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
2724 | index 0e26c83b6b412..d5b8568591d4c 100644 |
2725 | --- a/net/mac80211/ibss.c |
2726 | +++ b/net/mac80211/ibss.c |
2727 | @@ -542,6 +542,10 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata) |
2728 | |
2729 | sdata_assert_lock(sdata); |
2730 | |
2731 | + /* When not connected/joined, sending CSA doesn't make sense. */ |
2732 | + if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) |
2733 | + return -ENOLINK; |
2734 | + |
2735 | /* update cfg80211 bss information with the new channel */ |
2736 | if (!is_zero_ether_addr(ifibss->bssid)) { |
2737 | cbss = cfg80211_get_bss(sdata->local->hw.wiphy, |
2738 | diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c |
2739 | index b8ce84618a55b..c439125ef2b91 100644 |
2740 | --- a/net/mac802154/rx.c |
2741 | +++ b/net/mac802154/rx.c |
2742 | @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata, |
2743 | |
2744 | switch (mac_cb(skb)->dest.mode) { |
2745 | case IEEE802154_ADDR_NONE: |
2746 | - if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE) |
2747 | + if (hdr->source.mode != IEEE802154_ADDR_NONE) |
2748 | /* FIXME: check if we are PAN coordinator */ |
2749 | skb->pkt_type = PACKET_OTHERHOST; |
2750 | else |
2751 | diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c |
2752 | index e40988a2f22fb..26245419ef4a9 100644 |
2753 | --- a/net/netfilter/nf_conntrack_irc.c |
2754 | +++ b/net/netfilter/nf_conntrack_irc.c |
2755 | @@ -185,8 +185,9 @@ static int help(struct sk_buff *skb, unsigned int protoff, |
2756 | |
2757 | /* dcc_ip can be the internal OR external (NAT'ed) IP */ |
2758 | tuple = &ct->tuplehash[dir].tuple; |
2759 | - if (tuple->src.u3.ip != dcc_ip && |
2760 | - tuple->dst.u3.ip != dcc_ip) { |
2761 | + if ((tuple->src.u3.ip != dcc_ip && |
2762 | + ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) || |
2763 | + dcc_port == 0) { |
2764 | net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n", |
2765 | &tuple->src.u3.ip, |
2766 | &dcc_ip, dcc_port); |
2767 | diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c |
2768 | index 52a24d4ef5d8a..2ba61971f6231 100644 |
2769 | --- a/net/rxrpc/rxkad.c |
2770 | +++ b/net/rxrpc/rxkad.c |
2771 | @@ -451,7 +451,7 @@ static int rxkad_verify_packet_2(struct rxrpc_call *call, struct sk_buff *skb, |
2772 | * directly into the target buffer. |
2773 | */ |
2774 | sg = _sg; |
2775 | - nsg = skb_shinfo(skb)->nr_frags; |
2776 | + nsg = skb_shinfo(skb)->nr_frags + 1; |
2777 | if (nsg <= 4) { |
2778 | nsg = 4; |
2779 | } else { |
2780 | diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c |
2781 | index 4074c50ac3d73..3aa6b4dcb1c8e 100644 |
2782 | --- a/net/sched/sch_sfb.c |
2783 | +++ b/net/sched/sch_sfb.c |
2784 | @@ -135,15 +135,15 @@ static void increment_one_qlen(u32 sfbhash, u32 slot, struct sfb_sched_data *q) |
2785 | } |
2786 | } |
2787 | |
2788 | -static void increment_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) |
2789 | +static void increment_qlen(const struct sfb_skb_cb *cb, struct sfb_sched_data *q) |
2790 | { |
2791 | u32 sfbhash; |
2792 | |
2793 | - sfbhash = sfb_hash(skb, 0); |
2794 | + sfbhash = cb->hashes[0]; |
2795 | if (sfbhash) |
2796 | increment_one_qlen(sfbhash, 0, q); |
2797 | |
2798 | - sfbhash = sfb_hash(skb, 1); |
2799 | + sfbhash = cb->hashes[1]; |
2800 | if (sfbhash) |
2801 | increment_one_qlen(sfbhash, 1, q); |
2802 | } |
2803 | @@ -281,8 +281,10 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2804 | { |
2805 | |
2806 | struct sfb_sched_data *q = qdisc_priv(sch); |
2807 | + unsigned int len = qdisc_pkt_len(skb); |
2808 | struct Qdisc *child = q->qdisc; |
2809 | struct tcf_proto *fl; |
2810 | + struct sfb_skb_cb cb; |
2811 | int i; |
2812 | u32 p_min = ~0; |
2813 | u32 minqlen = ~0; |
2814 | @@ -399,11 +401,12 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
2815 | } |
2816 | |
2817 | enqueue: |
2818 | + memcpy(&cb, sfb_skb_cb(skb), sizeof(cb)); |
2819 | ret = qdisc_enqueue(skb, child, to_free); |
2820 | if (likely(ret == NET_XMIT_SUCCESS)) { |
2821 | - qdisc_qstats_backlog_inc(sch, skb); |
2822 | + sch->qstats.backlog += len; |
2823 | sch->q.qlen++; |
2824 | - increment_qlen(skb, q); |
2825 | + increment_qlen(&cb, q); |
2826 | } else if (net_xmit_drop_count(ret)) { |
2827 | q->stats.childdrop++; |
2828 | qdisc_qstats_drop(sch); |
2829 | diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c |
2830 | index 5f72f3f916a5a..a7f60bb2dd513 100644 |
2831 | --- a/net/sched/sch_tbf.c |
2832 | +++ b/net/sched/sch_tbf.c |
2833 | @@ -297,6 +297,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, |
2834 | struct nlattr *tb[TCA_TBF_MAX + 1]; |
2835 | struct tc_tbf_qopt *qopt; |
2836 | struct Qdisc *child = NULL; |
2837 | + struct Qdisc *old = NULL; |
2838 | struct psched_ratecfg rate; |
2839 | struct psched_ratecfg peak; |
2840 | u64 max_size; |
2841 | @@ -388,7 +389,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, |
2842 | sch_tree_lock(sch); |
2843 | if (child) { |
2844 | qdisc_tree_flush_backlog(q->qdisc); |
2845 | - qdisc_put(q->qdisc); |
2846 | + old = q->qdisc; |
2847 | q->qdisc = child; |
2848 | } |
2849 | q->limit = qopt->limit; |
2850 | @@ -408,6 +409,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, |
2851 | memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); |
2852 | |
2853 | sch_tree_unlock(sch); |
2854 | + qdisc_put(old); |
2855 | err = 0; |
2856 | done: |
2857 | return err; |
2858 | diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
2859 | index 394491692a078..5d696b7fb47e1 100644 |
2860 | --- a/net/smc/af_smc.c |
2861 | +++ b/net/smc/af_smc.c |
2862 | @@ -1093,7 +1093,6 @@ static void smc_listen_out_connected(struct smc_sock *new_smc) |
2863 | { |
2864 | struct sock *newsmcsk = &new_smc->sk; |
2865 | |
2866 | - sk_refcnt_debug_inc(newsmcsk); |
2867 | if (newsmcsk->sk_state == SMC_INIT) |
2868 | newsmcsk->sk_state = SMC_ACTIVE; |
2869 | |
2870 | diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c |
2871 | index e7155a7743001..0b9ad3b5ff18a 100644 |
2872 | --- a/net/tipc/monitor.c |
2873 | +++ b/net/tipc/monitor.c |
2874 | @@ -130,7 +130,7 @@ static void map_set(u64 *up_map, int i, unsigned int v) |
2875 | |
2876 | static int map_get(u64 up_map, int i) |
2877 | { |
2878 | - return (up_map & (1 << i)) >> i; |
2879 | + return (up_map & (1ULL << i)) >> i; |
2880 | } |
2881 | |
2882 | static struct tipc_peer *peer_prev(struct tipc_peer *peer) |
2883 | diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c |
2884 | index 76b845f68ac89..d80b06d669593 100644 |
2885 | --- a/net/wireless/debugfs.c |
2886 | +++ b/net/wireless/debugfs.c |
2887 | @@ -65,9 +65,10 @@ static ssize_t ht40allow_map_read(struct file *file, |
2888 | { |
2889 | struct wiphy *wiphy = file->private_data; |
2890 | char *buf; |
2891 | - unsigned int offset = 0, buf_size = PAGE_SIZE, i, r; |
2892 | + unsigned int offset = 0, buf_size = PAGE_SIZE, i; |
2893 | enum nl80211_band band; |
2894 | struct ieee80211_supported_band *sband; |
2895 | + ssize_t r; |
2896 | |
2897 | buf = kzalloc(buf_size, GFP_KERNEL); |
2898 | if (!buf) |
2899 | diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c |
2900 | index 2ddfe22266517..f73ee0798aeab 100644 |
2901 | --- a/sound/core/seq/oss/seq_oss_midi.c |
2902 | +++ b/sound/core/seq/oss/seq_oss_midi.c |
2903 | @@ -267,7 +267,9 @@ snd_seq_oss_midi_clear_all(void) |
2904 | void |
2905 | snd_seq_oss_midi_setup(struct seq_oss_devinfo *dp) |
2906 | { |
2907 | + spin_lock_irq(®ister_lock); |
2908 | dp->max_mididev = max_midi_devs; |
2909 | + spin_unlock_irq(®ister_lock); |
2910 | } |
2911 | |
2912 | /* |
2913 | diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c |
2914 | index cc93157fa9500..0363670a56e7c 100644 |
2915 | --- a/sound/core/seq/seq_clientmgr.c |
2916 | +++ b/sound/core/seq/seq_clientmgr.c |
2917 | @@ -121,13 +121,13 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid) |
2918 | spin_unlock_irqrestore(&clients_lock, flags); |
2919 | #ifdef CONFIG_MODULES |
2920 | if (!in_interrupt()) { |
2921 | - static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS]; |
2922 | - static char card_requested[SNDRV_CARDS]; |
2923 | + static DECLARE_BITMAP(client_requested, SNDRV_SEQ_GLOBAL_CLIENTS); |
2924 | + static DECLARE_BITMAP(card_requested, SNDRV_CARDS); |
2925 | + |
2926 | if (clientid < SNDRV_SEQ_GLOBAL_CLIENTS) { |
2927 | int idx; |
2928 | |
2929 | - if (!client_requested[clientid]) { |
2930 | - client_requested[clientid] = 1; |
2931 | + if (!test_and_set_bit(clientid, client_requested)) { |
2932 | for (idx = 0; idx < 15; idx++) { |
2933 | if (seq_client_load[idx] < 0) |
2934 | break; |
2935 | @@ -142,10 +142,8 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid) |
2936 | int card = (clientid - SNDRV_SEQ_GLOBAL_CLIENTS) / |
2937 | SNDRV_SEQ_CLIENTS_PER_CARD; |
2938 | if (card < snd_ecards_limit) { |
2939 | - if (! card_requested[card]) { |
2940 | - card_requested[card] = 1; |
2941 | + if (!test_and_set_bit(card, card_requested)) |
2942 | snd_request_card(card); |
2943 | - } |
2944 | snd_seq_device_load_drivers(); |
2945 | } |
2946 | } |
2947 | diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c |
2948 | index 452b9eaca815b..474347aba50e6 100644 |
2949 | --- a/sound/drivers/aloop.c |
2950 | +++ b/sound/drivers/aloop.c |
2951 | @@ -463,17 +463,18 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) |
2952 | cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
2953 | struct loopback_pcm *dpcm_capt = |
2954 | cable->streams[SNDRV_PCM_STREAM_CAPTURE]; |
2955 | - unsigned long delta_play = 0, delta_capt = 0; |
2956 | + unsigned long delta_play = 0, delta_capt = 0, cur_jiffies; |
2957 | unsigned int running, count1, count2; |
2958 | |
2959 | + cur_jiffies = jiffies; |
2960 | running = cable->running ^ cable->pause; |
2961 | if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { |
2962 | - delta_play = jiffies - dpcm_play->last_jiffies; |
2963 | + delta_play = cur_jiffies - dpcm_play->last_jiffies; |
2964 | dpcm_play->last_jiffies += delta_play; |
2965 | } |
2966 | |
2967 | if (running & (1 << SNDRV_PCM_STREAM_CAPTURE)) { |
2968 | - delta_capt = jiffies - dpcm_capt->last_jiffies; |
2969 | + delta_capt = cur_jiffies - dpcm_capt->last_jiffies; |
2970 | dpcm_capt->last_jiffies += delta_capt; |
2971 | } |
2972 | |
2973 | diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c |
2974 | index 6530a55fb8780..2cea3d3ee54dc 100644 |
2975 | --- a/sound/pci/emu10k1/emupcm.c |
2976 | +++ b/sound/pci/emu10k1/emupcm.c |
2977 | @@ -123,7 +123,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic |
2978 | epcm->voices[0]->epcm = epcm; |
2979 | if (voices > 1) { |
2980 | for (i = 1; i < voices; i++) { |
2981 | - epcm->voices[i] = &epcm->emu->voices[epcm->voices[0]->number + i]; |
2982 | + epcm->voices[i] = &epcm->emu->voices[(epcm->voices[0]->number + i) % NUM_G]; |
2983 | epcm->voices[i]->epcm = epcm; |
2984 | } |
2985 | } |
2986 | diff --git a/sound/usb/stream.c b/sound/usb/stream.c |
2987 | index eff1ac1dc9ba3..d35684e5f07f0 100644 |
2988 | --- a/sound/usb/stream.c |
2989 | +++ b/sound/usb/stream.c |
2990 | @@ -1103,7 +1103,7 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip, |
2991 | * Dallas DS4201 workaround: It presents 5 altsettings, but the last |
2992 | * one misses syncpipe, and does not produce any sound. |
2993 | */ |
2994 | - if (chip->usb_id == USB_ID(0x04fa, 0x4201)) |
2995 | + if (chip->usb_id == USB_ID(0x04fa, 0x4201) && num >= 4) |
2996 | num = 4; |
2997 | |
2998 | for (i = 0; i < num; i++) { |