Contents of /trunk/kernel-alx/patches-5.4/0202-5.4.103-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: 113665 byte(s)
Mon Oct 24 12:34:12 2022 UTC (19 months, 3 weeks ago) by niro
File size: 113665 byte(s)
-sync kernel patches
1 | diff --git a/Documentation/devicetree/bindings/net/btusb.txt b/Documentation/devicetree/bindings/net/btusb.txt |
2 | index b1ad6ee68e909..c51dd99dc0d3c 100644 |
3 | --- a/Documentation/devicetree/bindings/net/btusb.txt |
4 | +++ b/Documentation/devicetree/bindings/net/btusb.txt |
5 | @@ -38,7 +38,7 @@ Following example uses irq pin number 3 of gpio0 for out of band wake-on-bt: |
6 | compatible = "usb1286,204e"; |
7 | reg = <1>; |
8 | interrupt-parent = <&gpio0>; |
9 | - interrupt-name = "wakeup"; |
10 | + interrupt-names = "wakeup"; |
11 | interrupts = <3 IRQ_TYPE_LEVEL_LOW>; |
12 | }; |
13 | }; |
14 | diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml |
15 | index 0e7c31794ae6c..4f78e9a6da609 100644 |
16 | --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml |
17 | +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml |
18 | @@ -190,6 +190,11 @@ properties: |
19 | Indicates that full-duplex is used. When absent, half |
20 | duplex is assumed. |
21 | |
22 | + pause: |
23 | + $ref: /schemas/types.yaml#definitions/flag |
24 | + description: |
25 | + Indicates that pause should be enabled. |
26 | + |
27 | asym-pause: |
28 | $ref: /schemas/types.yaml#definitions/flag |
29 | description: |
30 | diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt |
31 | index ddf15b1b0d5a4..33ec0a01450dd 100644 |
32 | --- a/Documentation/filesystems/sysfs.txt |
33 | +++ b/Documentation/filesystems/sysfs.txt |
34 | @@ -232,12 +232,10 @@ Other notes: |
35 | is 4096. |
36 | |
37 | - show() methods should return the number of bytes printed into the |
38 | - buffer. This is the return value of scnprintf(). |
39 | + buffer. |
40 | |
41 | -- show() must not use snprintf() when formatting the value to be |
42 | - returned to user space. If you can guarantee that an overflow |
43 | - will never happen you can use sprintf() otherwise you must use |
44 | - scnprintf(). |
45 | +- show() should only use sysfs_emit() or sysfs_emit_at() when formatting |
46 | + the value to be returned to user space. |
47 | |
48 | - store() should return the number of bytes used from the buffer. If the |
49 | entire buffer has been used, just return the count argument. |
50 | diff --git a/Makefile b/Makefile |
51 | index 80ff67e5f73a6..c95435d78fcbb 100644 |
52 | --- a/Makefile |
53 | +++ b/Makefile |
54 | @@ -1,7 +1,7 @@ |
55 | # SPDX-License-Identifier: GPL-2.0 |
56 | VERSION = 5 |
57 | PATCHLEVEL = 4 |
58 | -SUBLEVEL = 102 |
59 | +SUBLEVEL = 103 |
60 | EXTRAVERSION = |
61 | NAME = Kleptomaniac Octopus |
62 | |
63 | diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c |
64 | index fd6e3aafe2724..acb464547a54f 100644 |
65 | --- a/arch/arm/xen/p2m.c |
66 | +++ b/arch/arm/xen/p2m.c |
67 | @@ -93,12 +93,39 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, |
68 | int i; |
69 | |
70 | for (i = 0; i < count; i++) { |
71 | + struct gnttab_unmap_grant_ref unmap; |
72 | + int rc; |
73 | + |
74 | if (map_ops[i].status) |
75 | continue; |
76 | - if (unlikely(!set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT, |
77 | - map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) { |
78 | - return -ENOMEM; |
79 | - } |
80 | + if (likely(set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT, |
81 | + map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) |
82 | + continue; |
83 | + |
84 | + /* |
85 | + * Signal an error for this slot. This in turn requires |
86 | + * immediate unmapping. |
87 | + */ |
88 | + map_ops[i].status = GNTST_general_error; |
89 | + unmap.host_addr = map_ops[i].host_addr, |
90 | + unmap.handle = map_ops[i].handle; |
91 | + map_ops[i].handle = ~0; |
92 | + if (map_ops[i].flags & GNTMAP_device_map) |
93 | + unmap.dev_bus_addr = map_ops[i].dev_bus_addr; |
94 | + else |
95 | + unmap.dev_bus_addr = 0; |
96 | + |
97 | + /* |
98 | + * Pre-populate the status field, to be recognizable in |
99 | + * the log message below. |
100 | + */ |
101 | + unmap.status = 1; |
102 | + |
103 | + rc = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, |
104 | + &unmap, 1); |
105 | + if (rc || unmap.status != GNTST_okay) |
106 | + pr_err_once("gnttab unmap failed: rc=%d st=%d\n", |
107 | + rc, unmap.status); |
108 | } |
109 | |
110 | return 0; |
111 | diff --git a/arch/arm64/kernel/module.lds b/arch/arm64/kernel/module.lds |
112 | index 22e36a21c1134..09a0eef71d12b 100644 |
113 | --- a/arch/arm64/kernel/module.lds |
114 | +++ b/arch/arm64/kernel/module.lds |
115 | @@ -1,5 +1,5 @@ |
116 | SECTIONS { |
117 | - .plt (NOLOAD) : { BYTE(0) } |
118 | - .init.plt (NOLOAD) : { BYTE(0) } |
119 | - .text.ftrace_trampoline (NOLOAD) : { BYTE(0) } |
120 | + .plt 0 (NOLOAD) : { BYTE(0) } |
121 | + .init.plt 0 (NOLOAD) : { BYTE(0) } |
122 | + .text.ftrace_trampoline 0 (NOLOAD) : { BYTE(0) } |
123 | } |
124 | diff --git a/arch/mips/include/asm/string.h b/arch/mips/include/asm/string.h |
125 | index 29030cb398ee5..1de3bbce8e88a 100644 |
126 | --- a/arch/mips/include/asm/string.h |
127 | +++ b/arch/mips/include/asm/string.h |
128 | @@ -10,127 +10,6 @@ |
129 | #ifndef _ASM_STRING_H |
130 | #define _ASM_STRING_H |
131 | |
132 | - |
133 | -/* |
134 | - * Most of the inline functions are rather naive implementations so I just |
135 | - * didn't bother updating them for 64-bit ... |
136 | - */ |
137 | -#ifdef CONFIG_32BIT |
138 | - |
139 | -#ifndef IN_STRING_C |
140 | - |
141 | -#define __HAVE_ARCH_STRCPY |
142 | -static __inline__ char *strcpy(char *__dest, __const__ char *__src) |
143 | -{ |
144 | - char *__xdest = __dest; |
145 | - |
146 | - __asm__ __volatile__( |
147 | - ".set\tnoreorder\n\t" |
148 | - ".set\tnoat\n" |
149 | - "1:\tlbu\t$1,(%1)\n\t" |
150 | - "addiu\t%1,1\n\t" |
151 | - "sb\t$1,(%0)\n\t" |
152 | - "bnez\t$1,1b\n\t" |
153 | - "addiu\t%0,1\n\t" |
154 | - ".set\tat\n\t" |
155 | - ".set\treorder" |
156 | - : "=r" (__dest), "=r" (__src) |
157 | - : "0" (__dest), "1" (__src) |
158 | - : "memory"); |
159 | - |
160 | - return __xdest; |
161 | -} |
162 | - |
163 | -#define __HAVE_ARCH_STRNCPY |
164 | -static __inline__ char *strncpy(char *__dest, __const__ char *__src, size_t __n) |
165 | -{ |
166 | - char *__xdest = __dest; |
167 | - |
168 | - if (__n == 0) |
169 | - return __xdest; |
170 | - |
171 | - __asm__ __volatile__( |
172 | - ".set\tnoreorder\n\t" |
173 | - ".set\tnoat\n" |
174 | - "1:\tlbu\t$1,(%1)\n\t" |
175 | - "subu\t%2,1\n\t" |
176 | - "sb\t$1,(%0)\n\t" |
177 | - "beqz\t$1,2f\n\t" |
178 | - "addiu\t%0,1\n\t" |
179 | - "bnez\t%2,1b\n\t" |
180 | - "addiu\t%1,1\n" |
181 | - "2:\n\t" |
182 | - ".set\tat\n\t" |
183 | - ".set\treorder" |
184 | - : "=r" (__dest), "=r" (__src), "=r" (__n) |
185 | - : "0" (__dest), "1" (__src), "2" (__n) |
186 | - : "memory"); |
187 | - |
188 | - return __xdest; |
189 | -} |
190 | - |
191 | -#define __HAVE_ARCH_STRCMP |
192 | -static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct) |
193 | -{ |
194 | - int __res; |
195 | - |
196 | - __asm__ __volatile__( |
197 | - ".set\tnoreorder\n\t" |
198 | - ".set\tnoat\n\t" |
199 | - "lbu\t%2,(%0)\n" |
200 | - "1:\tlbu\t$1,(%1)\n\t" |
201 | - "addiu\t%0,1\n\t" |
202 | - "bne\t$1,%2,2f\n\t" |
203 | - "addiu\t%1,1\n\t" |
204 | - "bnez\t%2,1b\n\t" |
205 | - "lbu\t%2,(%0)\n\t" |
206 | -#if defined(CONFIG_CPU_R3000) |
207 | - "nop\n\t" |
208 | -#endif |
209 | - "move\t%2,$1\n" |
210 | - "2:\tsubu\t%2,$1\n" |
211 | - "3:\t.set\tat\n\t" |
212 | - ".set\treorder" |
213 | - : "=r" (__cs), "=r" (__ct), "=r" (__res) |
214 | - : "0" (__cs), "1" (__ct)); |
215 | - |
216 | - return __res; |
217 | -} |
218 | - |
219 | -#endif /* !defined(IN_STRING_C) */ |
220 | - |
221 | -#define __HAVE_ARCH_STRNCMP |
222 | -static __inline__ int |
223 | -strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count) |
224 | -{ |
225 | - int __res; |
226 | - |
227 | - __asm__ __volatile__( |
228 | - ".set\tnoreorder\n\t" |
229 | - ".set\tnoat\n" |
230 | - "1:\tlbu\t%3,(%0)\n\t" |
231 | - "beqz\t%2,2f\n\t" |
232 | - "lbu\t$1,(%1)\n\t" |
233 | - "subu\t%2,1\n\t" |
234 | - "bne\t$1,%3,3f\n\t" |
235 | - "addiu\t%0,1\n\t" |
236 | - "bnez\t%3,1b\n\t" |
237 | - "addiu\t%1,1\n" |
238 | - "2:\n\t" |
239 | -#if defined(CONFIG_CPU_R3000) |
240 | - "nop\n\t" |
241 | -#endif |
242 | - "move\t%3,$1\n" |
243 | - "3:\tsubu\t%3,$1\n\t" |
244 | - ".set\tat\n\t" |
245 | - ".set\treorder" |
246 | - : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res) |
247 | - : "0" (__cs), "1" (__ct), "2" (__count)); |
248 | - |
249 | - return __res; |
250 | -} |
251 | -#endif /* CONFIG_32BIT */ |
252 | - |
253 | #define __HAVE_ARCH_MEMSET |
254 | extern void *memset(void *__s, int __c, size_t __count); |
255 | |
256 | diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile |
257 | index 996a934ece7d6..d3cd9c4cadc28 100644 |
258 | --- a/arch/mips/vdso/Makefile |
259 | +++ b/arch/mips/vdso/Makefile |
260 | @@ -16,12 +16,9 @@ ccflags-vdso := \ |
261 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
262 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ |
263 | $(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \ |
264 | + $(CLANG_FLAGS) \ |
265 | -D__VDSO__ |
266 | |
267 | -ifdef CONFIG_CC_IS_CLANG |
268 | -ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS)) |
269 | -endif |
270 | - |
271 | # |
272 | # The -fno-jump-tables flag only prevents the compiler from generating |
273 | # jump tables but does not prevent the compiler from emitting absolute |
274 | diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c |
275 | index e5fcfb70cc7c0..4d54aa70ea5f3 100644 |
276 | --- a/arch/parisc/kernel/irq.c |
277 | +++ b/arch/parisc/kernel/irq.c |
278 | @@ -376,7 +376,11 @@ static inline int eirr_to_irq(unsigned long eirr) |
279 | /* |
280 | * IRQ STACK - used for irq handler |
281 | */ |
282 | +#ifdef CONFIG_64BIT |
283 | +#define IRQ_STACK_SIZE (4096 << 4) /* 64k irq stack size */ |
284 | +#else |
285 | #define IRQ_STACK_SIZE (4096 << 3) /* 32k irq stack size */ |
286 | +#endif |
287 | |
288 | union irq_stack_union { |
289 | unsigned long stack[IRQ_STACK_SIZE/sizeof(unsigned long)]; |
290 | diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
291 | index b24c38090dd99..90760393a9643 100644 |
292 | --- a/arch/x86/events/intel/core.c |
293 | +++ b/arch/x86/events/intel/core.c |
294 | @@ -4002,6 +4002,9 @@ static const struct x86_cpu_desc isolation_ucodes[] = { |
295 | INTEL_CPU_DESC(INTEL_FAM6_BROADWELL_X, 2, 0x0b000014), |
296 | INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 3, 0x00000021), |
297 | INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 4, 0x00000000), |
298 | + INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 5, 0x00000000), |
299 | + INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 6, 0x00000000), |
300 | + INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 7, 0x00000000), |
301 | INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_L, 3, 0x0000007c), |
302 | INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE, 3, 0x0000007c), |
303 | INTEL_CPU_DESC(INTEL_FAM6_KABYLAKE, 9, 0x0000004e), |
304 | diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c |
305 | index d5c72cb877b31..77dabedaa9d12 100644 |
306 | --- a/arch/x86/kernel/module.c |
307 | +++ b/arch/x86/kernel/module.c |
308 | @@ -114,6 +114,7 @@ int apply_relocate(Elf32_Shdr *sechdrs, |
309 | *location += sym->st_value; |
310 | break; |
311 | case R_386_PC32: |
312 | + case R_386_PLT32: |
313 | /* Add the value, subtract its position */ |
314 | *location += sym->st_value - (uint32_t)location; |
315 | break; |
316 | diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
317 | index 835b6fc0c1bbf..b1b96d461bc76 100644 |
318 | --- a/arch/x86/kernel/reboot.c |
319 | +++ b/arch/x86/kernel/reboot.c |
320 | @@ -477,6 +477,15 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = { |
321 | }, |
322 | }, |
323 | |
324 | + { /* PCIe Wifi card isn't detected after reboot otherwise */ |
325 | + .callback = set_pci_reboot, |
326 | + .ident = "Zotac ZBOX CI327 nano", |
327 | + .matches = { |
328 | + DMI_MATCH(DMI_SYS_VENDOR, "NA"), |
329 | + DMI_MATCH(DMI_PRODUCT_NAME, "ZBOX-CI327NANO-GS-01"), |
330 | + }, |
331 | + }, |
332 | + |
333 | /* Sony */ |
334 | { /* Handle problems with rebooting on Sony VGN-Z540N */ |
335 | .callback = set_bios_reboot, |
336 | diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c |
337 | index ce7188cbdae58..1c3a1962cade6 100644 |
338 | --- a/arch/x86/tools/relocs.c |
339 | +++ b/arch/x86/tools/relocs.c |
340 | @@ -867,9 +867,11 @@ static int do_reloc32(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, |
341 | case R_386_PC32: |
342 | case R_386_PC16: |
343 | case R_386_PC8: |
344 | + case R_386_PLT32: |
345 | /* |
346 | - * NONE can be ignored and PC relative relocations don't |
347 | - * need to be adjusted. |
348 | + * NONE can be ignored and PC relative relocations don't need |
349 | + * to be adjusted. Because sym must be defined, R_386_PLT32 can |
350 | + * be treated the same way as R_386_PC32. |
351 | */ |
352 | break; |
353 | |
354 | @@ -910,9 +912,11 @@ static int do_reloc_real(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, |
355 | case R_386_PC32: |
356 | case R_386_PC16: |
357 | case R_386_PC8: |
358 | + case R_386_PLT32: |
359 | /* |
360 | - * NONE can be ignored and PC relative relocations don't |
361 | - * need to be adjusted. |
362 | + * NONE can be ignored and PC relative relocations don't need |
363 | + * to be adjusted. Because sym must be defined, R_386_PLT32 can |
364 | + * be treated the same way as R_386_PC32. |
365 | */ |
366 | break; |
367 | |
368 | diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c |
369 | index 7fe5be8e6d3db..12fcb3858303a 100644 |
370 | --- a/arch/x86/xen/p2m.c |
371 | +++ b/arch/x86/xen/p2m.c |
372 | @@ -714,6 +714,8 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, |
373 | |
374 | for (i = 0; i < count; i++) { |
375 | unsigned long mfn, pfn; |
376 | + struct gnttab_unmap_grant_ref unmap[2]; |
377 | + int rc; |
378 | |
379 | /* Do not add to override if the map failed. */ |
380 | if (map_ops[i].status != GNTST_okay || |
381 | @@ -731,10 +733,46 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, |
382 | |
383 | WARN(pfn_to_mfn(pfn) != INVALID_P2M_ENTRY, "page must be ballooned"); |
384 | |
385 | - if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) { |
386 | - ret = -ENOMEM; |
387 | - goto out; |
388 | + if (likely(set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) |
389 | + continue; |
390 | + |
391 | + /* |
392 | + * Signal an error for this slot. This in turn requires |
393 | + * immediate unmapping. |
394 | + */ |
395 | + map_ops[i].status = GNTST_general_error; |
396 | + unmap[0].host_addr = map_ops[i].host_addr, |
397 | + unmap[0].handle = map_ops[i].handle; |
398 | + map_ops[i].handle = ~0; |
399 | + if (map_ops[i].flags & GNTMAP_device_map) |
400 | + unmap[0].dev_bus_addr = map_ops[i].dev_bus_addr; |
401 | + else |
402 | + unmap[0].dev_bus_addr = 0; |
403 | + |
404 | + if (kmap_ops) { |
405 | + kmap_ops[i].status = GNTST_general_error; |
406 | + unmap[1].host_addr = kmap_ops[i].host_addr, |
407 | + unmap[1].handle = kmap_ops[i].handle; |
408 | + kmap_ops[i].handle = ~0; |
409 | + if (kmap_ops[i].flags & GNTMAP_device_map) |
410 | + unmap[1].dev_bus_addr = kmap_ops[i].dev_bus_addr; |
411 | + else |
412 | + unmap[1].dev_bus_addr = 0; |
413 | } |
414 | + |
415 | + /* |
416 | + * Pre-populate both status fields, to be recognizable in |
417 | + * the log message below. |
418 | + */ |
419 | + unmap[0].status = 1; |
420 | + unmap[1].status = 1; |
421 | + |
422 | + rc = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, |
423 | + unmap, 1 + !!kmap_ops); |
424 | + if (rc || unmap[0].status != GNTST_okay || |
425 | + unmap[1].status != GNTST_okay) |
426 | + pr_err_once("gnttab unmap failed: rc=%d st0=%d st1=%d\n", |
427 | + rc, unmap[0].status, unmap[1].status); |
428 | } |
429 | |
430 | out: |
431 | diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c |
432 | index 83ad0b1fab30a..0cece1f883ebe 100644 |
433 | --- a/crypto/tcrypt.c |
434 | +++ b/crypto/tcrypt.c |
435 | @@ -198,8 +198,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc, |
436 | goto out; |
437 | } |
438 | |
439 | - pr_cont("%d operations in %d seconds (%ld bytes)\n", |
440 | - bcount * num_mb, secs, (long)bcount * blen * num_mb); |
441 | + pr_cont("%d operations in %d seconds (%llu bytes)\n", |
442 | + bcount * num_mb, secs, (u64)bcount * blen * num_mb); |
443 | |
444 | out: |
445 | kfree(rc); |
446 | @@ -468,8 +468,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc, |
447 | return ret; |
448 | } |
449 | |
450 | - printk("%d operations in %d seconds (%ld bytes)\n", |
451 | - bcount, secs, (long)bcount * blen); |
452 | + pr_cont("%d operations in %d seconds (%llu bytes)\n", |
453 | + bcount, secs, (u64)bcount * blen); |
454 | return 0; |
455 | } |
456 | |
457 | @@ -759,8 +759,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen, |
458 | goto out; |
459 | } |
460 | |
461 | - pr_cont("%d operations in %d seconds (%ld bytes)\n", |
462 | - bcount * num_mb, secs, (long)bcount * blen * num_mb); |
463 | + pr_cont("%d operations in %d seconds (%llu bytes)\n", |
464 | + bcount * num_mb, secs, (u64)bcount * blen * num_mb); |
465 | |
466 | out: |
467 | kfree(rc); |
468 | @@ -1196,8 +1196,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc, |
469 | goto out; |
470 | } |
471 | |
472 | - pr_cont("%d operations in %d seconds (%ld bytes)\n", |
473 | - bcount * num_mb, secs, (long)bcount * blen * num_mb); |
474 | + pr_cont("%d operations in %d seconds (%llu bytes)\n", |
475 | + bcount * num_mb, secs, (u64)bcount * blen * num_mb); |
476 | |
477 | out: |
478 | kfree(rc); |
479 | @@ -1434,8 +1434,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc, |
480 | return ret; |
481 | } |
482 | |
483 | - pr_cont("%d operations in %d seconds (%ld bytes)\n", |
484 | - bcount, secs, (long)bcount * blen); |
485 | + pr_cont("%d operations in %d seconds (%llu bytes)\n", |
486 | + bcount, secs, (u64)bcount * blen); |
487 | return 0; |
488 | } |
489 | |
490 | diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
491 | index f068bb5d650eb..e11fddcb73b98 100644 |
492 | --- a/drivers/block/nbd.c |
493 | +++ b/drivers/block/nbd.c |
494 | @@ -78,8 +78,7 @@ struct link_dead_args { |
495 | #define NBD_RT_HAS_PID_FILE 3 |
496 | #define NBD_RT_HAS_CONFIG_REF 4 |
497 | #define NBD_RT_BOUND 5 |
498 | -#define NBD_RT_DESTROY_ON_DISCONNECT 6 |
499 | -#define NBD_RT_DISCONNECT_ON_CLOSE 7 |
500 | +#define NBD_RT_DISCONNECT_ON_CLOSE 6 |
501 | |
502 | #define NBD_DESTROY_ON_DISCONNECT 0 |
503 | #define NBD_DISCONNECT_REQUESTED 1 |
504 | @@ -1940,12 +1939,21 @@ again: |
505 | if (info->attrs[NBD_ATTR_CLIENT_FLAGS]) { |
506 | u64 flags = nla_get_u64(info->attrs[NBD_ATTR_CLIENT_FLAGS]); |
507 | if (flags & NBD_CFLAG_DESTROY_ON_DISCONNECT) { |
508 | - set_bit(NBD_RT_DESTROY_ON_DISCONNECT, |
509 | - &config->runtime_flags); |
510 | - set_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); |
511 | - put_dev = true; |
512 | + /* |
513 | + * We have 1 ref to keep the device around, and then 1 |
514 | + * ref for our current operation here, which will be |
515 | + * inherited by the config. If we already have |
516 | + * DESTROY_ON_DISCONNECT set then we know we don't have |
517 | + * that extra ref already held so we don't need the |
518 | + * put_dev. |
519 | + */ |
520 | + if (!test_and_set_bit(NBD_DESTROY_ON_DISCONNECT, |
521 | + &nbd->flags)) |
522 | + put_dev = true; |
523 | } else { |
524 | - clear_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); |
525 | + if (test_and_clear_bit(NBD_DESTROY_ON_DISCONNECT, |
526 | + &nbd->flags)) |
527 | + refcount_inc(&nbd->refs); |
528 | } |
529 | if (flags & NBD_CFLAG_DISCONNECT_ON_CLOSE) { |
530 | set_bit(NBD_RT_DISCONNECT_ON_CLOSE, |
531 | @@ -2116,15 +2124,13 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info) |
532 | if (info->attrs[NBD_ATTR_CLIENT_FLAGS]) { |
533 | u64 flags = nla_get_u64(info->attrs[NBD_ATTR_CLIENT_FLAGS]); |
534 | if (flags & NBD_CFLAG_DESTROY_ON_DISCONNECT) { |
535 | - if (!test_and_set_bit(NBD_RT_DESTROY_ON_DISCONNECT, |
536 | - &config->runtime_flags)) |
537 | + if (!test_and_set_bit(NBD_DESTROY_ON_DISCONNECT, |
538 | + &nbd->flags)) |
539 | put_dev = true; |
540 | - set_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); |
541 | } else { |
542 | - if (test_and_clear_bit(NBD_RT_DESTROY_ON_DISCONNECT, |
543 | - &config->runtime_flags)) |
544 | + if (test_and_clear_bit(NBD_DESTROY_ON_DISCONNECT, |
545 | + &nbd->flags)) |
546 | refcount_inc(&nbd->refs); |
547 | - clear_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); |
548 | } |
549 | |
550 | if (flags & NBD_CFLAG_DISCONNECT_ON_CLOSE) { |
551 | diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c |
552 | index 36d49159140f4..22aa432a68bf9 100644 |
553 | --- a/drivers/block/zram/zram_drv.c |
554 | +++ b/drivers/block/zram/zram_drv.c |
555 | @@ -1072,7 +1072,7 @@ static ssize_t mm_stat_show(struct device *dev, |
556 | zram->limit_pages << PAGE_SHIFT, |
557 | max_used << PAGE_SHIFT, |
558 | (u64)atomic64_read(&zram->stats.same_pages), |
559 | - pool_stats.pages_compacted, |
560 | + atomic_long_read(&pool_stats.pages_compacted), |
561 | (u64)atomic64_read(&zram->stats.huge_pages)); |
562 | up_read(&zram->init_lock); |
563 | |
564 | diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c |
565 | index e11af747395dd..bf3e23104194a 100644 |
566 | --- a/drivers/bluetooth/hci_h5.c |
567 | +++ b/drivers/bluetooth/hci_h5.c |
568 | @@ -894,6 +894,11 @@ static int h5_btrtl_setup(struct h5 *h5) |
569 | /* Give the device some time before the hci-core sends it a reset */ |
570 | usleep_range(10000, 20000); |
571 | |
572 | + /* Enable controller to do both LE scan and BR/EDR inquiry |
573 | + * simultaneously. |
574 | + */ |
575 | + set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &h5->hu->hdev->quirks); |
576 | + |
577 | out_free: |
578 | btrtl_free(btrtl_dev); |
579 | |
580 | diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c |
581 | index 1dca0cabc326a..13520d173296f 100644 |
582 | --- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c |
583 | +++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c |
584 | @@ -193,19 +193,30 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev, |
585 | |
586 | wptr = le32_to_cpu(*ih->wptr_cpu); |
587 | |
588 | - if (REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) { |
589 | - wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
590 | - /* When a ring buffer overflow happen start parsing interrupt |
591 | - * from the last not overwritten vector (wptr + 16). Hopefully |
592 | - * this should allow us to catchup. |
593 | - */ |
594 | - dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
595 | - wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
596 | - ih->rptr = (wptr + 16) & ih->ptr_mask; |
597 | - tmp = RREG32(mmIH_RB_CNTL); |
598 | - tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
599 | - WREG32(mmIH_RB_CNTL, tmp); |
600 | - } |
601 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
602 | + goto out; |
603 | + |
604 | + /* Double check that the overflow wasn't already cleared. */ |
605 | + wptr = RREG32(mmIH_RB_WPTR); |
606 | + |
607 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
608 | + goto out; |
609 | + |
610 | + wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
611 | + |
612 | + /* When a ring buffer overflow happen start parsing interrupt |
613 | + * from the last not overwritten vector (wptr + 16). Hopefully |
614 | + * this should allow us to catchup. |
615 | + */ |
616 | + dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
617 | + wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
618 | + ih->rptr = (wptr + 16) & ih->ptr_mask; |
619 | + tmp = RREG32(mmIH_RB_CNTL); |
620 | + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
621 | + WREG32(mmIH_RB_CNTL, tmp); |
622 | + |
623 | + |
624 | +out: |
625 | return (wptr & ih->ptr_mask); |
626 | } |
627 | |
628 | diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c |
629 | index a13dd9a51149a..7d165f024f072 100644 |
630 | --- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c |
631 | +++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c |
632 | @@ -193,19 +193,29 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev, |
633 | |
634 | wptr = le32_to_cpu(*ih->wptr_cpu); |
635 | |
636 | - if (REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) { |
637 | - wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
638 | - /* When a ring buffer overflow happen start parsing interrupt |
639 | - * from the last not overwritten vector (wptr + 16). Hopefully |
640 | - * this should allow us to catchup. |
641 | - */ |
642 | - dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
643 | - wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
644 | - ih->rptr = (wptr + 16) & ih->ptr_mask; |
645 | - tmp = RREG32(mmIH_RB_CNTL); |
646 | - tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
647 | - WREG32(mmIH_RB_CNTL, tmp); |
648 | - } |
649 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
650 | + goto out; |
651 | + |
652 | + /* Double check that the overflow wasn't already cleared. */ |
653 | + wptr = RREG32(mmIH_RB_WPTR); |
654 | + |
655 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
656 | + goto out; |
657 | + |
658 | + wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
659 | + /* When a ring buffer overflow happen start parsing interrupt |
660 | + * from the last not overwritten vector (wptr + 16). Hopefully |
661 | + * this should allow us to catchup. |
662 | + */ |
663 | + dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
664 | + wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
665 | + ih->rptr = (wptr + 16) & ih->ptr_mask; |
666 | + tmp = RREG32(mmIH_RB_CNTL); |
667 | + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
668 | + WREG32(mmIH_RB_CNTL, tmp); |
669 | + |
670 | + |
671 | +out: |
672 | return (wptr & ih->ptr_mask); |
673 | } |
674 | |
675 | diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c |
676 | index e40140bf6699c..db0a3bda13fbe 100644 |
677 | --- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c |
678 | +++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c |
679 | @@ -195,19 +195,30 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev, |
680 | |
681 | wptr = le32_to_cpu(*ih->wptr_cpu); |
682 | |
683 | - if (REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) { |
684 | - wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
685 | - /* When a ring buffer overflow happen start parsing interrupt |
686 | - * from the last not overwritten vector (wptr + 16). Hopefully |
687 | - * this should allow us to catchup. |
688 | - */ |
689 | - dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
690 | - wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
691 | - ih->rptr = (wptr + 16) & ih->ptr_mask; |
692 | - tmp = RREG32(mmIH_RB_CNTL); |
693 | - tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
694 | - WREG32(mmIH_RB_CNTL, tmp); |
695 | - } |
696 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
697 | + goto out; |
698 | + |
699 | + /* Double check that the overflow wasn't already cleared. */ |
700 | + wptr = RREG32(mmIH_RB_WPTR); |
701 | + |
702 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) |
703 | + goto out; |
704 | + |
705 | + wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); |
706 | + |
707 | + /* When a ring buffer overflow happen start parsing interrupt |
708 | + * from the last not overwritten vector (wptr + 16). Hopefully |
709 | + * this should allow us to catchup. |
710 | + */ |
711 | + |
712 | + dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
713 | + wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
714 | + ih->rptr = (wptr + 16) & ih->ptr_mask; |
715 | + tmp = RREG32(mmIH_RB_CNTL); |
716 | + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); |
717 | + WREG32(mmIH_RB_CNTL, tmp); |
718 | + |
719 | +out: |
720 | return (wptr & ih->ptr_mask); |
721 | } |
722 | |
723 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
724 | index fa92b88bc5a13..40041c61a100e 100644 |
725 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
726 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
727 | @@ -1303,6 +1303,11 @@ static bool construct( |
728 | goto ddc_create_fail; |
729 | } |
730 | |
731 | + if (!link->ddc->ddc_pin) { |
732 | + DC_ERROR("Failed to get I2C info for connector!\n"); |
733 | + goto ddc_create_fail; |
734 | + } |
735 | + |
736 | link->ddc_hw_inst = |
737 | dal_ddc_get_line( |
738 | dal_ddc_service_get_ddc_pin(link->ddc)); |
739 | diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |
740 | index c103005b0a33e..a34ef5ec7d429 100644 |
741 | --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |
742 | +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |
743 | @@ -376,7 +376,6 @@ static void hibmc_pci_remove(struct pci_dev *pdev) |
744 | |
745 | drm_dev_unregister(dev); |
746 | hibmc_unload(dev); |
747 | - drm_dev_put(dev); |
748 | } |
749 | |
750 | static struct pci_device_id hibmc_pci_table[] = { |
751 | diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c |
752 | index 92022a83bbd5e..bb46e7a0f1b5d 100644 |
753 | --- a/drivers/gpu/drm/virtio/virtgpu_vq.c |
754 | +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c |
755 | @@ -992,8 +992,9 @@ int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev, |
756 | } |
757 | |
758 | /* gets freed when the ring has consumed it */ |
759 | - ents = kmalloc_array(nents, sizeof(struct virtio_gpu_mem_entry), |
760 | - GFP_KERNEL); |
761 | + ents = kvmalloc_array(nents, |
762 | + sizeof(struct virtio_gpu_mem_entry), |
763 | + GFP_KERNEL); |
764 | if (!ents) { |
765 | DRM_ERROR("failed to allocate ent list\n"); |
766 | return -ENOMEM; |
767 | diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
768 | index 2d8434b7b6238..053fe2da1e08f 100644 |
769 | --- a/drivers/input/mouse/elantech.c |
770 | +++ b/drivers/input/mouse/elantech.c |
771 | @@ -89,6 +89,47 @@ static int elantech_ps2_command(struct psmouse *psmouse, |
772 | return rc; |
773 | } |
774 | |
775 | +/* |
776 | + * Send an Elantech style special command to read 3 bytes from a register |
777 | + */ |
778 | +static int elantech_read_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) |
779 | +{ |
780 | + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
781 | + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || |
782 | + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
783 | + elantech_ps2_command(psmouse, NULL, reg) || |
784 | + elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) { |
785 | + psmouse_err(psmouse, |
786 | + "failed to read register %#02x\n", reg); |
787 | + return -EIO; |
788 | + } |
789 | + |
790 | + return 0; |
791 | +} |
792 | + |
793 | +/* |
794 | + * Send an Elantech style special command to write a register with a parameter |
795 | + */ |
796 | +static int elantech_write_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) |
797 | +{ |
798 | + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
799 | + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || |
800 | + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
801 | + elantech_ps2_command(psmouse, NULL, reg) || |
802 | + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
803 | + elantech_ps2_command(psmouse, NULL, param[0]) || |
804 | + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || |
805 | + elantech_ps2_command(psmouse, NULL, param[1]) || |
806 | + elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) { |
807 | + psmouse_err(psmouse, |
808 | + "failed to write register %#02x with value %#02x%#02x\n", |
809 | + reg, param[0], param[1]); |
810 | + return -EIO; |
811 | + } |
812 | + |
813 | + return 0; |
814 | +} |
815 | + |
816 | /* |
817 | * Send an Elantech style special command to read a value from a register |
818 | */ |
819 | @@ -1529,19 +1570,35 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = { |
820 | { } |
821 | }; |
822 | |
823 | +/* |
824 | + * Change Report id 0x5E to 0x5F. |
825 | + */ |
826 | +static int elantech_change_report_id(struct psmouse *psmouse) |
827 | +{ |
828 | + unsigned char param[2] = { 0x10, 0x03 }; |
829 | + |
830 | + if (elantech_write_reg_params(psmouse, 0x7, param) || |
831 | + elantech_read_reg_params(psmouse, 0x7, param) || |
832 | + param[0] != 0x10 || param[1] != 0x03) { |
833 | + psmouse_err(psmouse, "Unable to change report ID to 0x5f.\n"); |
834 | + return -EIO; |
835 | + } |
836 | + |
837 | + return 0; |
838 | +} |
839 | /* |
840 | * determine hardware version and set some properties according to it. |
841 | */ |
842 | static int elantech_set_properties(struct elantech_device_info *info) |
843 | { |
844 | /* This represents the version of IC body. */ |
845 | - int ver = (info->fw_version & 0x0f0000) >> 16; |
846 | + info->ic_version = (info->fw_version & 0x0f0000) >> 16; |
847 | |
848 | /* Early version of Elan touchpads doesn't obey the rule. */ |
849 | if (info->fw_version < 0x020030 || info->fw_version == 0x020600) |
850 | info->hw_version = 1; |
851 | else { |
852 | - switch (ver) { |
853 | + switch (info->ic_version) { |
854 | case 2: |
855 | case 4: |
856 | info->hw_version = 2; |
857 | @@ -1557,6 +1614,11 @@ static int elantech_set_properties(struct elantech_device_info *info) |
858 | } |
859 | } |
860 | |
861 | + /* Get information pattern for hw_version 4 */ |
862 | + info->pattern = 0x00; |
863 | + if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02) |
864 | + info->pattern = info->fw_version & 0xff; |
865 | + |
866 | /* decide which send_cmd we're gonna use early */ |
867 | info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : |
868 | synaptics_send_cmd; |
869 | @@ -1598,6 +1660,7 @@ static int elantech_query_info(struct psmouse *psmouse, |
870 | { |
871 | unsigned char param[3]; |
872 | unsigned char traces; |
873 | + unsigned char ic_body[3]; |
874 | |
875 | memset(info, 0, sizeof(*info)); |
876 | |
877 | @@ -1640,6 +1703,21 @@ static int elantech_query_info(struct psmouse *psmouse, |
878 | info->samples[2]); |
879 | } |
880 | |
881 | + if (info->pattern > 0x00 && info->ic_version == 0xf) { |
882 | + if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) { |
883 | + psmouse_err(psmouse, "failed to query ic body\n"); |
884 | + return -EINVAL; |
885 | + } |
886 | + info->ic_version = be16_to_cpup((__be16 *)ic_body); |
887 | + psmouse_info(psmouse, |
888 | + "Elan ic body: %#04x, current fw version: %#02x\n", |
889 | + info->ic_version, ic_body[2]); |
890 | + } |
891 | + |
892 | + info->product_id = be16_to_cpup((__be16 *)info->samples); |
893 | + if (info->pattern == 0x00) |
894 | + info->product_id &= 0xff; |
895 | + |
896 | if (info->samples[1] == 0x74 && info->hw_version == 0x03) { |
897 | /* |
898 | * This module has a bug which makes absolute mode |
899 | @@ -1654,6 +1732,23 @@ static int elantech_query_info(struct psmouse *psmouse, |
900 | /* The MSB indicates the presence of the trackpoint */ |
901 | info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; |
902 | |
903 | + if (info->has_trackpoint && info->ic_version == 0x0011 && |
904 | + (info->product_id == 0x08 || info->product_id == 0x09 || |
905 | + info->product_id == 0x0d || info->product_id == 0x0e)) { |
906 | + /* |
907 | + * This module has a bug which makes trackpoint in SMBus |
908 | + * mode return invalid data unless trackpoint is switched |
909 | + * from using 0x5e reports to 0x5f. If we are not able to |
910 | + * make the switch, let's abort initialization so we'll be |
911 | + * using standard PS/2 protocol. |
912 | + */ |
913 | + if (elantech_change_report_id(psmouse)) { |
914 | + psmouse_info(psmouse, |
915 | + "Trackpoint report is broken, forcing standard PS/2 protocol\n"); |
916 | + return -ENODEV; |
917 | + } |
918 | + } |
919 | + |
920 | info->x_res = 31; |
921 | info->y_res = 31; |
922 | if (info->hw_version == 4) { |
923 | diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h |
924 | index e0a3e59d4f1bb..571e6ca11d33b 100644 |
925 | --- a/drivers/input/mouse/elantech.h |
926 | +++ b/drivers/input/mouse/elantech.h |
927 | @@ -18,6 +18,7 @@ |
928 | #define ETP_CAPABILITIES_QUERY 0x02 |
929 | #define ETP_SAMPLE_QUERY 0x03 |
930 | #define ETP_RESOLUTION_QUERY 0x04 |
931 | +#define ETP_ICBODY_QUERY 0x05 |
932 | |
933 | /* |
934 | * Command values for register reading or writing |
935 | @@ -140,7 +141,10 @@ struct elantech_device_info { |
936 | unsigned char samples[3]; |
937 | unsigned char debug; |
938 | unsigned char hw_version; |
939 | + unsigned char pattern; |
940 | unsigned int fw_version; |
941 | + unsigned int ic_version; |
942 | + unsigned int product_id; |
943 | unsigned int x_min; |
944 | unsigned int y_min; |
945 | unsigned int x_max; |
946 | diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c |
947 | index 867f5fb6fbe11..c68e52c17ae13 100644 |
948 | --- a/drivers/media/rc/mceusb.c |
949 | +++ b/drivers/media/rc/mceusb.c |
950 | @@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len, |
951 | data[0], data[1]); |
952 | break; |
953 | case MCE_RSP_EQIRCFS: |
954 | + if (!data[0] && !data[1]) { |
955 | + dev_dbg(dev, "%s: no carrier", inout); |
956 | + break; |
957 | + } |
958 | + // prescaler should make sense |
959 | + if (data[0] > 8) |
960 | + break; |
961 | period = DIV_ROUND_CLOSEST((1U << data[0] * 2) * |
962 | (data[1] + 1), 10); |
963 | if (!period) |
964 | break; |
965 | - carrier = (1000 * 1000) / period; |
966 | + carrier = USEC_PER_SEC / period; |
967 | dev_dbg(dev, "%s carrier of %u Hz (period %uus)", |
968 | inout, carrier, period); |
969 | break; |
970 | diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c |
971 | index 99883550375e9..40ca1d4e03483 100644 |
972 | --- a/drivers/media/usb/uvc/uvc_driver.c |
973 | +++ b/drivers/media/usb/uvc/uvc_driver.c |
974 | @@ -967,7 +967,10 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id, |
975 | unsigned int i; |
976 | |
977 | extra_size = roundup(extra_size, sizeof(*entity->pads)); |
978 | - num_inputs = (type & UVC_TERM_OUTPUT) ? num_pads : num_pads - 1; |
979 | + if (num_pads) |
980 | + num_inputs = type & UVC_TERM_OUTPUT ? num_pads : num_pads - 1; |
981 | + else |
982 | + num_inputs = 0; |
983 | size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads |
984 | + num_inputs; |
985 | entity = kzalloc(size, GFP_KERNEL); |
986 | @@ -983,7 +986,7 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id, |
987 | |
988 | for (i = 0; i < num_inputs; ++i) |
989 | entity->pads[i].flags = MEDIA_PAD_FL_SINK; |
990 | - if (!UVC_ENTITY_IS_OTERM(entity)) |
991 | + if (!UVC_ENTITY_IS_OTERM(entity) && num_pads) |
992 | entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE; |
993 | |
994 | entity->bNrInPins = num_inputs; |
995 | diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c |
996 | index cd84dbbf6a890..3fe99519fedfb 100644 |
997 | --- a/drivers/media/v4l2-core/v4l2-ctrls.c |
998 | +++ b/drivers/media/v4l2-core/v4l2-ctrls.c |
999 | @@ -1795,7 +1795,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, |
1000 | case V4L2_CTRL_TYPE_INTEGER_MENU: |
1001 | if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum) |
1002 | return -ERANGE; |
1003 | - if (ctrl->menu_skip_mask & (1ULL << ptr.p_s32[idx])) |
1004 | + if (ptr.p_s32[idx] < BITS_PER_LONG_LONG && |
1005 | + (ctrl->menu_skip_mask & BIT_ULL(ptr.p_s32[idx]))) |
1006 | return -EINVAL; |
1007 | if (ctrl->type == V4L2_CTRL_TYPE_MENU && |
1008 | ctrl->qmenu[ptr.p_s32[idx]][0] == '\0') |
1009 | diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c |
1010 | index 58868d7129ebd..24db33f803c06 100644 |
1011 | --- a/drivers/media/v4l2-core/v4l2-ioctl.c |
1012 | +++ b/drivers/media/v4l2-core/v4l2-ioctl.c |
1013 | @@ -3016,7 +3016,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, |
1014 | v4l2_kioctl func) |
1015 | { |
1016 | char sbuf[128]; |
1017 | - void *mbuf = NULL; |
1018 | + void *mbuf = NULL, *array_buf = NULL; |
1019 | void *parg = (void *)arg; |
1020 | long err = -EINVAL; |
1021 | bool has_array_args; |
1022 | @@ -3075,20 +3075,14 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, |
1023 | has_array_args = err; |
1024 | |
1025 | if (has_array_args) { |
1026 | - /* |
1027 | - * When adding new types of array args, make sure that the |
1028 | - * parent argument to ioctl (which contains the pointer to the |
1029 | - * array) fits into sbuf (so that mbuf will still remain |
1030 | - * unused up to here). |
1031 | - */ |
1032 | - mbuf = kvmalloc(array_size, GFP_KERNEL); |
1033 | + array_buf = kvmalloc(array_size, GFP_KERNEL); |
1034 | err = -ENOMEM; |
1035 | - if (NULL == mbuf) |
1036 | + if (array_buf == NULL) |
1037 | goto out_array_args; |
1038 | err = -EFAULT; |
1039 | - if (copy_from_user(mbuf, user_ptr, array_size)) |
1040 | + if (copy_from_user(array_buf, user_ptr, array_size)) |
1041 | goto out_array_args; |
1042 | - *kernel_ptr = mbuf; |
1043 | + *kernel_ptr = array_buf; |
1044 | } |
1045 | |
1046 | /* Handles IOCTL */ |
1047 | @@ -3107,7 +3101,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, |
1048 | |
1049 | if (has_array_args) { |
1050 | *kernel_ptr = (void __force *)user_ptr; |
1051 | - if (copy_to_user(user_ptr, mbuf, array_size)) |
1052 | + if (copy_to_user(user_ptr, array_buf, array_size)) |
1053 | err = -EFAULT; |
1054 | goto out_array_args; |
1055 | } |
1056 | @@ -3129,6 +3123,7 @@ out_array_args: |
1057 | } |
1058 | |
1059 | out: |
1060 | + kvfree(array_buf); |
1061 | kvfree(mbuf); |
1062 | return err; |
1063 | } |
1064 | diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c |
1065 | index 78e20f53677d5..58a002dd758cd 100644 |
1066 | --- a/drivers/net/ethernet/atheros/ag71xx.c |
1067 | +++ b/drivers/net/ethernet/atheros/ag71xx.c |
1068 | @@ -222,8 +222,6 @@ |
1069 | #define AG71XX_REG_RX_SM 0x01b0 |
1070 | #define AG71XX_REG_TX_SM 0x01b4 |
1071 | |
1072 | -#define ETH_SWITCH_HEADER_LEN 2 |
1073 | - |
1074 | #define AG71XX_DEFAULT_MSG_ENABLE \ |
1075 | (NETIF_MSG_DRV \ |
1076 | | NETIF_MSG_PROBE \ |
1077 | @@ -784,7 +782,7 @@ static void ag71xx_hw_setup(struct ag71xx *ag) |
1078 | |
1079 | static unsigned int ag71xx_max_frame_len(unsigned int mtu) |
1080 | { |
1081 | - return ETH_SWITCH_HEADER_LEN + ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; |
1082 | + return ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; |
1083 | } |
1084 | |
1085 | static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) |
1086 | diff --git a/drivers/net/tap.c b/drivers/net/tap.c |
1087 | index 3ae70c7e6860c..f285422a80717 100644 |
1088 | --- a/drivers/net/tap.c |
1089 | +++ b/drivers/net/tap.c |
1090 | @@ -1095,10 +1095,9 @@ static long tap_ioctl(struct file *file, unsigned int cmd, |
1091 | return -ENOLINK; |
1092 | } |
1093 | ret = 0; |
1094 | - u = tap->dev->type; |
1095 | + dev_get_mac_address(&sa, dev_net(tap->dev), tap->dev->name); |
1096 | if (copy_to_user(&ifr->ifr_name, tap->dev->name, IFNAMSIZ) || |
1097 | - copy_to_user(&ifr->ifr_hwaddr.sa_data, tap->dev->dev_addr, ETH_ALEN) || |
1098 | - put_user(u, &ifr->ifr_hwaddr.sa_family)) |
1099 | + copy_to_user(&ifr->ifr_hwaddr, &sa, sizeof(sa))) |
1100 | ret = -EFAULT; |
1101 | tap_put_tap_dev(tap); |
1102 | rtnl_unlock(); |
1103 | @@ -1113,7 +1112,7 @@ static long tap_ioctl(struct file *file, unsigned int cmd, |
1104 | rtnl_unlock(); |
1105 | return -ENOLINK; |
1106 | } |
1107 | - ret = dev_set_mac_address(tap->dev, &sa, NULL); |
1108 | + ret = dev_set_mac_address_user(tap->dev, &sa, NULL); |
1109 | tap_put_tap_dev(tap); |
1110 | rtnl_unlock(); |
1111 | return ret; |
1112 | diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
1113 | index 84e779f93f0a4..fe6ec22bf3d51 100644 |
1114 | --- a/drivers/net/tun.c |
1115 | +++ b/drivers/net/tun.c |
1116 | @@ -3224,7 +3224,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, |
1117 | case SIOCGIFHWADDR: |
1118 | /* Get hw address */ |
1119 | memcpy(ifr.ifr_hwaddr.sa_data, tun->dev->dev_addr, ETH_ALEN); |
1120 | - ifr.ifr_hwaddr.sa_family = tun->dev->type; |
1121 | + dev_get_mac_address(&ifr.ifr_hwaddr, net, tun->dev->name); |
1122 | if (copy_to_user(argp, &ifr, ifreq_len)) |
1123 | ret = -EFAULT; |
1124 | break; |
1125 | @@ -3234,7 +3234,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, |
1126 | tun_debug(KERN_DEBUG, tun, "set hw address: %pM\n", |
1127 | ifr.ifr_hwaddr.sa_data); |
1128 | |
1129 | - ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr, NULL); |
1130 | + ret = dev_set_mac_address_user(tun->dev, &ifr.ifr_hwaddr, NULL); |
1131 | break; |
1132 | |
1133 | case TUNGETSNDBUF: |
1134 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1135 | index 5a1d21aae2a9e..05b85b94d9518 100644 |
1136 | --- a/drivers/net/usb/qmi_wwan.c |
1137 | +++ b/drivers/net/usb/qmi_wwan.c |
1138 | @@ -1280,6 +1280,7 @@ static const struct usb_device_id products[] = { |
1139 | {QMI_FIXED_INTF(0x19d2, 0x1255, 4)}, |
1140 | {QMI_FIXED_INTF(0x19d2, 0x1256, 4)}, |
1141 | {QMI_FIXED_INTF(0x19d2, 0x1270, 5)}, /* ZTE MF667 */ |
1142 | + {QMI_FIXED_INTF(0x19d2, 0x1275, 3)}, /* ZTE P685M */ |
1143 | {QMI_FIXED_INTF(0x19d2, 0x1401, 2)}, |
1144 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ |
1145 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, |
1146 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
1147 | index 915ba2a7f7448..47b733fdf4fcb 100644 |
1148 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
1149 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
1150 | @@ -3624,23 +3624,16 @@ bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar) |
1151 | static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb) |
1152 | { |
1153 | struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; |
1154 | - int ret = 0; |
1155 | - |
1156 | - spin_lock_bh(&ar->data_lock); |
1157 | |
1158 | - if (skb_queue_len(q) == ATH10K_MAX_NUM_MGMT_PENDING) { |
1159 | + if (skb_queue_len_lockless(q) >= ATH10K_MAX_NUM_MGMT_PENDING) { |
1160 | ath10k_warn(ar, "wmi mgmt tx queue is full\n"); |
1161 | - ret = -ENOSPC; |
1162 | - goto unlock; |
1163 | + return -ENOSPC; |
1164 | } |
1165 | |
1166 | - __skb_queue_tail(q, skb); |
1167 | + skb_queue_tail(q, skb); |
1168 | ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); |
1169 | |
1170 | -unlock: |
1171 | - spin_unlock_bh(&ar->data_lock); |
1172 | - |
1173 | - return ret; |
1174 | + return 0; |
1175 | } |
1176 | |
1177 | static enum ath10k_mac_tx_path |
1178 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c |
1179 | index 4aa2561934d77..6d5188b78f2de 100644 |
1180 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c |
1181 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c |
1182 | @@ -40,6 +40,18 @@ static const struct brcmf_dmi_data pov_tab_p1006w_data = { |
1183 | BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data" |
1184 | }; |
1185 | |
1186 | +static const struct brcmf_dmi_data predia_basic_data = { |
1187 | + BRCM_CC_43341_CHIP_ID, 2, "predia-basic" |
1188 | +}; |
1189 | + |
1190 | +/* Note the Voyo winpad A15 tablet uses the same Ampak AP6330 module, with the |
1191 | + * exact same nvram file as the Prowise-PT301 tablet. Since the nvram for the |
1192 | + * Prowise-PT301 is already in linux-firmware we just point to that here. |
1193 | + */ |
1194 | +static const struct brcmf_dmi_data voyo_winpad_a15_data = { |
1195 | + BRCM_CC_4330_CHIP_ID, 4, "Prowise-PT301" |
1196 | +}; |
1197 | + |
1198 | static const struct dmi_system_id dmi_platform_data[] = { |
1199 | { |
1200 | /* ACEPC T8 Cherry Trail Z8350 mini PC */ |
1201 | @@ -111,6 +123,26 @@ static const struct dmi_system_id dmi_platform_data[] = { |
1202 | }, |
1203 | .driver_data = (void *)&pov_tab_p1006w_data, |
1204 | }, |
1205 | + { |
1206 | + /* Predia Basic tablet (+ with keyboard dock) */ |
1207 | + .matches = { |
1208 | + DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), |
1209 | + DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), |
1210 | + /* Mx.WT107.KUBNGEA02 with the version-nr dropped */ |
1211 | + DMI_MATCH(DMI_BIOS_VERSION, "Mx.WT107.KUBNGEA"), |
1212 | + }, |
1213 | + .driver_data = (void *)&predia_basic_data, |
1214 | + }, |
1215 | + { |
1216 | + /* Voyo winpad A15 tablet */ |
1217 | + .matches = { |
1218 | + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), |
1219 | + DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), |
1220 | + /* Above strings are too generic, also match on BIOS date */ |
1221 | + DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"), |
1222 | + }, |
1223 | + .driver_data = (void *)&voyo_winpad_a15_data, |
1224 | + }, |
1225 | {} |
1226 | }; |
1227 | |
1228 | diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c |
1229 | index 6f8d5f9a9f7e6..a07304405b2cc 100644 |
1230 | --- a/drivers/net/wireless/rsi/rsi_91x_hal.c |
1231 | +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c |
1232 | @@ -248,7 +248,8 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) |
1233 | rsi_set_len_qno(&data_desc->len_qno, |
1234 | (skb->len - FRAME_DESC_SZ), |
1235 | RSI_WIFI_MGMT_Q); |
1236 | - if ((skb->len - header_size) == EAPOL4_PACKET_LEN) { |
1237 | + if (((skb->len - header_size) == EAPOL4_PACKET_LEN) || |
1238 | + ((skb->len - header_size) == EAPOL4_PACKET_LEN - 2)) { |
1239 | data_desc->misc_flags |= |
1240 | RSI_DESC_REQUIRE_CFM_TO_HOST; |
1241 | xtend_desc->confirm_frame_type = EAPOL4_CONFIRM; |
1242 | diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c |
1243 | index 1bebba4e85273..d1e8c6593ef51 100644 |
1244 | --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c |
1245 | +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c |
1246 | @@ -153,9 +153,7 @@ static void rsi_handle_interrupt(struct sdio_func *function) |
1247 | if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED) |
1248 | return; |
1249 | |
1250 | - dev->sdio_irq_task = current; |
1251 | - rsi_interrupt_handler(adapter); |
1252 | - dev->sdio_irq_task = NULL; |
1253 | + rsi_set_event(&dev->rx_thread.event); |
1254 | } |
1255 | |
1256 | /** |
1257 | @@ -1059,8 +1057,6 @@ static int rsi_probe(struct sdio_func *pfunction, |
1258 | rsi_dbg(ERR_ZONE, "%s: Unable to init rx thrd\n", __func__); |
1259 | goto fail_kill_thread; |
1260 | } |
1261 | - skb_queue_head_init(&sdev->rx_q.head); |
1262 | - sdev->rx_q.num_rx_pkts = 0; |
1263 | |
1264 | sdio_claim_host(pfunction); |
1265 | if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) { |
1266 | diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |
1267 | index 449f6d23c5e36..7c77b09240da2 100644 |
1268 | --- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |
1269 | +++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |
1270 | @@ -60,39 +60,20 @@ int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word) |
1271 | return status; |
1272 | } |
1273 | |
1274 | +static void rsi_rx_handler(struct rsi_hw *adapter); |
1275 | + |
1276 | void rsi_sdio_rx_thread(struct rsi_common *common) |
1277 | { |
1278 | struct rsi_hw *adapter = common->priv; |
1279 | struct rsi_91x_sdiodev *sdev = adapter->rsi_dev; |
1280 | - struct sk_buff *skb; |
1281 | - int status; |
1282 | |
1283 | do { |
1284 | rsi_wait_event(&sdev->rx_thread.event, EVENT_WAIT_FOREVER); |
1285 | rsi_reset_event(&sdev->rx_thread.event); |
1286 | + rsi_rx_handler(adapter); |
1287 | + } while (!atomic_read(&sdev->rx_thread.thread_done)); |
1288 | |
1289 | - while (true) { |
1290 | - if (atomic_read(&sdev->rx_thread.thread_done)) |
1291 | - goto out; |
1292 | - |
1293 | - skb = skb_dequeue(&sdev->rx_q.head); |
1294 | - if (!skb) |
1295 | - break; |
1296 | - if (sdev->rx_q.num_rx_pkts > 0) |
1297 | - sdev->rx_q.num_rx_pkts--; |
1298 | - status = rsi_read_pkt(common, skb->data, skb->len); |
1299 | - if (status) { |
1300 | - rsi_dbg(ERR_ZONE, "Failed to read the packet\n"); |
1301 | - dev_kfree_skb(skb); |
1302 | - break; |
1303 | - } |
1304 | - dev_kfree_skb(skb); |
1305 | - } |
1306 | - } while (1); |
1307 | - |
1308 | -out: |
1309 | rsi_dbg(INFO_ZONE, "%s: Terminated SDIO RX thread\n", __func__); |
1310 | - skb_queue_purge(&sdev->rx_q.head); |
1311 | atomic_inc(&sdev->rx_thread.thread_done); |
1312 | complete_and_exit(&sdev->rx_thread.completion, 0); |
1313 | } |
1314 | @@ -113,10 +94,6 @@ static int rsi_process_pkt(struct rsi_common *common) |
1315 | u32 rcv_pkt_len = 0; |
1316 | int status = 0; |
1317 | u8 value = 0; |
1318 | - struct sk_buff *skb; |
1319 | - |
1320 | - if (dev->rx_q.num_rx_pkts >= RSI_MAX_RX_PKTS) |
1321 | - return 0; |
1322 | |
1323 | num_blks = ((adapter->interrupt_status & 1) | |
1324 | ((adapter->interrupt_status >> RECV_NUM_BLOCKS) << 1)); |
1325 | @@ -144,22 +121,19 @@ static int rsi_process_pkt(struct rsi_common *common) |
1326 | |
1327 | rcv_pkt_len = (num_blks * 256); |
1328 | |
1329 | - skb = dev_alloc_skb(rcv_pkt_len); |
1330 | - if (!skb) |
1331 | - return -ENOMEM; |
1332 | - |
1333 | - status = rsi_sdio_host_intf_read_pkt(adapter, skb->data, rcv_pkt_len); |
1334 | + status = rsi_sdio_host_intf_read_pkt(adapter, dev->pktbuffer, |
1335 | + rcv_pkt_len); |
1336 | if (status) { |
1337 | rsi_dbg(ERR_ZONE, "%s: Failed to read packet from card\n", |
1338 | __func__); |
1339 | - dev_kfree_skb(skb); |
1340 | return status; |
1341 | } |
1342 | - skb_put(skb, rcv_pkt_len); |
1343 | - skb_queue_tail(&dev->rx_q.head, skb); |
1344 | - dev->rx_q.num_rx_pkts++; |
1345 | |
1346 | - rsi_set_event(&dev->rx_thread.event); |
1347 | + status = rsi_read_pkt(common, dev->pktbuffer, rcv_pkt_len); |
1348 | + if (status) { |
1349 | + rsi_dbg(ERR_ZONE, "Failed to read the packet\n"); |
1350 | + return status; |
1351 | + } |
1352 | |
1353 | return 0; |
1354 | } |
1355 | @@ -251,12 +225,12 @@ int rsi_init_sdio_slave_regs(struct rsi_hw *adapter) |
1356 | } |
1357 | |
1358 | /** |
1359 | - * rsi_interrupt_handler() - This function read and process SDIO interrupts. |
1360 | + * rsi_rx_handler() - Read and process SDIO interrupts. |
1361 | * @adapter: Pointer to the adapter structure. |
1362 | * |
1363 | * Return: None. |
1364 | */ |
1365 | -void rsi_interrupt_handler(struct rsi_hw *adapter) |
1366 | +static void rsi_rx_handler(struct rsi_hw *adapter) |
1367 | { |
1368 | struct rsi_common *common = adapter->priv; |
1369 | struct rsi_91x_sdiodev *dev = |
1370 | diff --git a/drivers/net/wireless/rsi/rsi_sdio.h b/drivers/net/wireless/rsi/rsi_sdio.h |
1371 | index c5cfb6238f737..ce6cf65a577a4 100644 |
1372 | --- a/drivers/net/wireless/rsi/rsi_sdio.h |
1373 | +++ b/drivers/net/wireless/rsi/rsi_sdio.h |
1374 | @@ -111,11 +111,6 @@ struct receive_info { |
1375 | u32 buf_available_counter; |
1376 | }; |
1377 | |
1378 | -struct rsi_sdio_rx_q { |
1379 | - u8 num_rx_pkts; |
1380 | - struct sk_buff_head head; |
1381 | -}; |
1382 | - |
1383 | struct rsi_91x_sdiodev { |
1384 | struct sdio_func *pfunction; |
1385 | struct task_struct *sdio_irq_task; |
1386 | @@ -128,11 +123,10 @@ struct rsi_91x_sdiodev { |
1387 | u16 tx_blk_size; |
1388 | u8 write_fail; |
1389 | bool buff_status_updated; |
1390 | - struct rsi_sdio_rx_q rx_q; |
1391 | struct rsi_thread rx_thread; |
1392 | + u8 pktbuffer[8192] __aligned(4); |
1393 | }; |
1394 | |
1395 | -void rsi_interrupt_handler(struct rsi_hw *adapter); |
1396 | int rsi_init_sdio_slave_regs(struct rsi_hw *adapter); |
1397 | int rsi_sdio_read_register(struct rsi_hw *adapter, u32 addr, u8 *data); |
1398 | int rsi_sdio_host_intf_read_pkt(struct rsi_hw *adapter, u8 *pkt, u32 length); |
1399 | diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c |
1400 | index 3c9c623bb4283..9d7dbfe7fe0c3 100644 |
1401 | --- a/drivers/net/wireless/ti/wl12xx/main.c |
1402 | +++ b/drivers/net/wireless/ti/wl12xx/main.c |
1403 | @@ -635,7 +635,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl) |
1404 | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | |
1405 | WLCORE_QUIRK_DUAL_PROBE_TMPL | |
1406 | WLCORE_QUIRK_TKIP_HEADER_SPACE | |
1407 | - WLCORE_QUIRK_START_STA_FAILS | |
1408 | WLCORE_QUIRK_AP_ZERO_SESSION_ID; |
1409 | wl->sr_fw_name = WL127X_FW_NAME_SINGLE; |
1410 | wl->mr_fw_name = WL127X_FW_NAME_MULTI; |
1411 | @@ -659,7 +658,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl) |
1412 | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | |
1413 | WLCORE_QUIRK_DUAL_PROBE_TMPL | |
1414 | WLCORE_QUIRK_TKIP_HEADER_SPACE | |
1415 | - WLCORE_QUIRK_START_STA_FAILS | |
1416 | WLCORE_QUIRK_AP_ZERO_SESSION_ID; |
1417 | wl->plt_fw_name = WL127X_PLT_FW_NAME; |
1418 | wl->sr_fw_name = WL127X_FW_NAME_SINGLE; |
1419 | @@ -688,7 +686,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl) |
1420 | wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | |
1421 | WLCORE_QUIRK_DUAL_PROBE_TMPL | |
1422 | WLCORE_QUIRK_TKIP_HEADER_SPACE | |
1423 | - WLCORE_QUIRK_START_STA_FAILS | |
1424 | WLCORE_QUIRK_AP_ZERO_SESSION_ID; |
1425 | |
1426 | wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, |
1427 | diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c |
1428 | index 5f74cf821068d..be0ed19f93569 100644 |
1429 | --- a/drivers/net/wireless/ti/wlcore/main.c |
1430 | +++ b/drivers/net/wireless/ti/wlcore/main.c |
1431 | @@ -2862,21 +2862,8 @@ static int wlcore_join(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
1432 | |
1433 | if (is_ibss) |
1434 | ret = wl12xx_cmd_role_start_ibss(wl, wlvif); |
1435 | - else { |
1436 | - if (wl->quirks & WLCORE_QUIRK_START_STA_FAILS) { |
1437 | - /* |
1438 | - * TODO: this is an ugly workaround for wl12xx fw |
1439 | - * bug - we are not able to tx/rx after the first |
1440 | - * start_sta, so make dummy start+stop calls, |
1441 | - * and then call start_sta again. |
1442 | - * this should be fixed in the fw. |
1443 | - */ |
1444 | - wl12xx_cmd_role_start_sta(wl, wlvif); |
1445 | - wl12xx_cmd_role_stop_sta(wl, wlvif); |
1446 | - } |
1447 | - |
1448 | + else |
1449 | ret = wl12xx_cmd_role_start_sta(wl, wlvif); |
1450 | - } |
1451 | |
1452 | return ret; |
1453 | } |
1454 | diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h |
1455 | index b7821311ac75b..81c94d390623b 100644 |
1456 | --- a/drivers/net/wireless/ti/wlcore/wlcore.h |
1457 | +++ b/drivers/net/wireless/ti/wlcore/wlcore.h |
1458 | @@ -547,9 +547,6 @@ wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip, |
1459 | /* Each RX/TX transaction requires an end-of-transaction transfer */ |
1460 | #define WLCORE_QUIRK_END_OF_TRANSACTION BIT(0) |
1461 | |
1462 | -/* the first start_role(sta) sometimes doesn't work on wl12xx */ |
1463 | -#define WLCORE_QUIRK_START_STA_FAILS BIT(1) |
1464 | - |
1465 | /* wl127x and SPI don't support SDIO block size alignment */ |
1466 | #define WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN BIT(2) |
1467 | |
1468 | diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c |
1469 | index 4bfafcd6317f4..c213f2b812691 100644 |
1470 | --- a/drivers/net/xen-netback/netback.c |
1471 | +++ b/drivers/net/xen-netback/netback.c |
1472 | @@ -1335,11 +1335,21 @@ int xenvif_tx_action(struct xenvif_queue *queue, int budget) |
1473 | return 0; |
1474 | |
1475 | gnttab_batch_copy(queue->tx_copy_ops, nr_cops); |
1476 | - if (nr_mops != 0) |
1477 | + if (nr_mops != 0) { |
1478 | ret = gnttab_map_refs(queue->tx_map_ops, |
1479 | NULL, |
1480 | queue->pages_to_map, |
1481 | nr_mops); |
1482 | + if (ret) { |
1483 | + unsigned int i; |
1484 | + |
1485 | + netdev_err(queue->vif->dev, "Map fail: nr %u ret %d\n", |
1486 | + nr_mops, ret); |
1487 | + for (i = 0; i < nr_mops; ++i) |
1488 | + WARN_ON_ONCE(queue->tx_map_ops[i].status == |
1489 | + GNTST_okay); |
1490 | + } |
1491 | + } |
1492 | |
1493 | work_done = xenvif_tx_submit(queue); |
1494 | |
1495 | diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1496 | index c2cabd77884bf..95d77a17375e1 100644 |
1497 | --- a/drivers/nvme/host/core.c |
1498 | +++ b/drivers/nvme/host/core.c |
1499 | @@ -317,6 +317,26 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) |
1500 | } |
1501 | EXPORT_SYMBOL_GPL(nvme_cancel_request); |
1502 | |
1503 | +void nvme_cancel_tagset(struct nvme_ctrl *ctrl) |
1504 | +{ |
1505 | + if (ctrl->tagset) { |
1506 | + blk_mq_tagset_busy_iter(ctrl->tagset, |
1507 | + nvme_cancel_request, ctrl); |
1508 | + blk_mq_tagset_wait_completed_request(ctrl->tagset); |
1509 | + } |
1510 | +} |
1511 | +EXPORT_SYMBOL_GPL(nvme_cancel_tagset); |
1512 | + |
1513 | +void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl) |
1514 | +{ |
1515 | + if (ctrl->admin_tagset) { |
1516 | + blk_mq_tagset_busy_iter(ctrl->admin_tagset, |
1517 | + nvme_cancel_request, ctrl); |
1518 | + blk_mq_tagset_wait_completed_request(ctrl->admin_tagset); |
1519 | + } |
1520 | +} |
1521 | +EXPORT_SYMBOL_GPL(nvme_cancel_admin_tagset); |
1522 | + |
1523 | bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, |
1524 | enum nvme_ctrl_state new_state) |
1525 | { |
1526 | diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h |
1527 | index e392d6cd92ced..62e5401865fee 100644 |
1528 | --- a/drivers/nvme/host/nvme.h |
1529 | +++ b/drivers/nvme/host/nvme.h |
1530 | @@ -468,6 +468,8 @@ static inline void nvme_put_ctrl(struct nvme_ctrl *ctrl) |
1531 | |
1532 | void nvme_complete_rq(struct request *req); |
1533 | bool nvme_cancel_request(struct request *req, void *data, bool reserved); |
1534 | +void nvme_cancel_tagset(struct nvme_ctrl *ctrl); |
1535 | +void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl); |
1536 | bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, |
1537 | enum nvme_ctrl_state new_state); |
1538 | bool nvme_wait_reset(struct nvme_ctrl *ctrl); |
1539 | diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1540 | index 19e375b59f407..abc342db3b337 100644 |
1541 | --- a/drivers/nvme/host/pci.c |
1542 | +++ b/drivers/nvme/host/pci.c |
1543 | @@ -528,50 +528,71 @@ static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req) |
1544 | return true; |
1545 | } |
1546 | |
1547 | -static void nvme_unmap_data(struct nvme_dev *dev, struct request *req) |
1548 | +static void nvme_free_prps(struct nvme_dev *dev, struct request *req) |
1549 | { |
1550 | - struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
1551 | const int last_prp = dev->ctrl.page_size / sizeof(__le64) - 1; |
1552 | - dma_addr_t dma_addr = iod->first_dma, next_dma_addr; |
1553 | + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
1554 | + dma_addr_t dma_addr = iod->first_dma; |
1555 | int i; |
1556 | |
1557 | - if (iod->dma_len) { |
1558 | - dma_unmap_page(dev->dev, dma_addr, iod->dma_len, |
1559 | - rq_dma_dir(req)); |
1560 | - return; |
1561 | + for (i = 0; i < iod->npages; i++) { |
1562 | + __le64 *prp_list = nvme_pci_iod_list(req)[i]; |
1563 | + dma_addr_t next_dma_addr = le64_to_cpu(prp_list[last_prp]); |
1564 | + |
1565 | + dma_pool_free(dev->prp_page_pool, prp_list, dma_addr); |
1566 | + dma_addr = next_dma_addr; |
1567 | } |
1568 | |
1569 | - WARN_ON_ONCE(!iod->nents); |
1570 | +} |
1571 | |
1572 | - if (is_pci_p2pdma_page(sg_page(iod->sg))) |
1573 | - pci_p2pdma_unmap_sg(dev->dev, iod->sg, iod->nents, |
1574 | - rq_dma_dir(req)); |
1575 | - else |
1576 | - dma_unmap_sg(dev->dev, iod->sg, iod->nents, rq_dma_dir(req)); |
1577 | +static void nvme_free_sgls(struct nvme_dev *dev, struct request *req) |
1578 | +{ |
1579 | + const int last_sg = SGES_PER_PAGE - 1; |
1580 | + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
1581 | + dma_addr_t dma_addr = iod->first_dma; |
1582 | + int i; |
1583 | |
1584 | + for (i = 0; i < iod->npages; i++) { |
1585 | + struct nvme_sgl_desc *sg_list = nvme_pci_iod_list(req)[i]; |
1586 | + dma_addr_t next_dma_addr = le64_to_cpu((sg_list[last_sg]).addr); |
1587 | |
1588 | - if (iod->npages == 0) |
1589 | - dma_pool_free(dev->prp_small_pool, nvme_pci_iod_list(req)[0], |
1590 | - dma_addr); |
1591 | + dma_pool_free(dev->prp_page_pool, sg_list, dma_addr); |
1592 | + dma_addr = next_dma_addr; |
1593 | + } |
1594 | |
1595 | - for (i = 0; i < iod->npages; i++) { |
1596 | - void *addr = nvme_pci_iod_list(req)[i]; |
1597 | +} |
1598 | |
1599 | - if (iod->use_sgl) { |
1600 | - struct nvme_sgl_desc *sg_list = addr; |
1601 | +static void nvme_unmap_sg(struct nvme_dev *dev, struct request *req) |
1602 | +{ |
1603 | + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
1604 | |
1605 | - next_dma_addr = |
1606 | - le64_to_cpu((sg_list[SGES_PER_PAGE - 1]).addr); |
1607 | - } else { |
1608 | - __le64 *prp_list = addr; |
1609 | + if (is_pci_p2pdma_page(sg_page(iod->sg))) |
1610 | + pci_p2pdma_unmap_sg(dev->dev, iod->sg, iod->nents, |
1611 | + rq_dma_dir(req)); |
1612 | + else |
1613 | + dma_unmap_sg(dev->dev, iod->sg, iod->nents, rq_dma_dir(req)); |
1614 | +} |
1615 | |
1616 | - next_dma_addr = le64_to_cpu(prp_list[last_prp]); |
1617 | - } |
1618 | +static void nvme_unmap_data(struct nvme_dev *dev, struct request *req) |
1619 | +{ |
1620 | + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
1621 | |
1622 | - dma_pool_free(dev->prp_page_pool, addr, dma_addr); |
1623 | - dma_addr = next_dma_addr; |
1624 | + if (iod->dma_len) { |
1625 | + dma_unmap_page(dev->dev, iod->first_dma, iod->dma_len, |
1626 | + rq_dma_dir(req)); |
1627 | + return; |
1628 | } |
1629 | |
1630 | + WARN_ON_ONCE(!iod->nents); |
1631 | + |
1632 | + nvme_unmap_sg(dev, req); |
1633 | + if (iod->npages == 0) |
1634 | + dma_pool_free(dev->prp_small_pool, nvme_pci_iod_list(req)[0], |
1635 | + iod->first_dma); |
1636 | + else if (iod->use_sgl) |
1637 | + nvme_free_sgls(dev, req); |
1638 | + else |
1639 | + nvme_free_prps(dev, req); |
1640 | mempool_free(iod->sg, dev->iod_mempool); |
1641 | } |
1642 | |
1643 | @@ -648,7 +669,7 @@ static blk_status_t nvme_pci_setup_prps(struct nvme_dev *dev, |
1644 | __le64 *old_prp_list = prp_list; |
1645 | prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma); |
1646 | if (!prp_list) |
1647 | - return BLK_STS_RESOURCE; |
1648 | + goto free_prps; |
1649 | list[iod->npages++] = prp_list; |
1650 | prp_list[0] = old_prp_list[i - 1]; |
1651 | old_prp_list[i - 1] = cpu_to_le64(prp_dma); |
1652 | @@ -668,14 +689,14 @@ static blk_status_t nvme_pci_setup_prps(struct nvme_dev *dev, |
1653 | dma_addr = sg_dma_address(sg); |
1654 | dma_len = sg_dma_len(sg); |
1655 | } |
1656 | - |
1657 | done: |
1658 | cmnd->dptr.prp1 = cpu_to_le64(sg_dma_address(iod->sg)); |
1659 | cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma); |
1660 | - |
1661 | return BLK_STS_OK; |
1662 | - |
1663 | - bad_sgl: |
1664 | +free_prps: |
1665 | + nvme_free_prps(dev, req); |
1666 | + return BLK_STS_RESOURCE; |
1667 | +bad_sgl: |
1668 | WARN(DO_ONCE(nvme_print_sgl, iod->sg, iod->nents), |
1669 | "Invalid SGL for payload:%d nents:%d\n", |
1670 | blk_rq_payload_bytes(req), iod->nents); |
1671 | @@ -747,7 +768,7 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, |
1672 | |
1673 | sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); |
1674 | if (!sg_list) |
1675 | - return BLK_STS_RESOURCE; |
1676 | + goto free_sgls; |
1677 | |
1678 | i = 0; |
1679 | nvme_pci_iod_list(req)[iod->npages++] = sg_list; |
1680 | @@ -760,6 +781,9 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, |
1681 | } while (--entries > 0); |
1682 | |
1683 | return BLK_STS_OK; |
1684 | +free_sgls: |
1685 | + nvme_free_sgls(dev, req); |
1686 | + return BLK_STS_RESOURCE; |
1687 | } |
1688 | |
1689 | static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev, |
1690 | @@ -828,7 +852,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, |
1691 | sg_init_table(iod->sg, blk_rq_nr_phys_segments(req)); |
1692 | iod->nents = blk_rq_map_sg(req->q, req, iod->sg); |
1693 | if (!iod->nents) |
1694 | - goto out; |
1695 | + goto out_free_sg; |
1696 | |
1697 | if (is_pci_p2pdma_page(sg_page(iod->sg))) |
1698 | nr_mapped = pci_p2pdma_map_sg_attrs(dev->dev, iod->sg, |
1699 | @@ -837,16 +861,21 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, |
1700 | nr_mapped = dma_map_sg_attrs(dev->dev, iod->sg, iod->nents, |
1701 | rq_dma_dir(req), DMA_ATTR_NO_WARN); |
1702 | if (!nr_mapped) |
1703 | - goto out; |
1704 | + goto out_free_sg; |
1705 | |
1706 | iod->use_sgl = nvme_pci_use_sgls(dev, req); |
1707 | if (iod->use_sgl) |
1708 | ret = nvme_pci_setup_sgls(dev, req, &cmnd->rw, nr_mapped); |
1709 | else |
1710 | ret = nvme_pci_setup_prps(dev, req, &cmnd->rw); |
1711 | -out: |
1712 | if (ret != BLK_STS_OK) |
1713 | - nvme_unmap_data(dev, req); |
1714 | + goto out_unmap_sg; |
1715 | + return BLK_STS_OK; |
1716 | + |
1717 | +out_unmap_sg: |
1718 | + nvme_unmap_sg(dev, req); |
1719 | +out_free_sg: |
1720 | + mempool_free(iod->sg, dev->iod_mempool); |
1721 | return ret; |
1722 | } |
1723 | |
1724 | diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
1725 | index 8a62c2fe5a5ec..da60300104322 100644 |
1726 | --- a/drivers/nvme/host/rdma.c |
1727 | +++ b/drivers/nvme/host/rdma.c |
1728 | @@ -835,12 +835,16 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, |
1729 | |
1730 | error = nvme_init_identify(&ctrl->ctrl); |
1731 | if (error) |
1732 | - goto out_stop_queue; |
1733 | + goto out_quiesce_queue; |
1734 | |
1735 | return 0; |
1736 | |
1737 | +out_quiesce_queue: |
1738 | + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
1739 | + blk_sync_queue(ctrl->ctrl.admin_q); |
1740 | out_stop_queue: |
1741 | nvme_rdma_stop_queue(&ctrl->queues[0]); |
1742 | + nvme_cancel_admin_tagset(&ctrl->ctrl); |
1743 | out_cleanup_queue: |
1744 | if (new) |
1745 | blk_cleanup_queue(ctrl->ctrl.admin_q); |
1746 | @@ -917,8 +921,10 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) |
1747 | |
1748 | out_wait_freeze_timed_out: |
1749 | nvme_stop_queues(&ctrl->ctrl); |
1750 | + nvme_sync_io_queues(&ctrl->ctrl); |
1751 | nvme_rdma_stop_io_queues(ctrl); |
1752 | out_cleanup_connect_q: |
1753 | + nvme_cancel_tagset(&ctrl->ctrl); |
1754 | if (new) |
1755 | blk_cleanup_queue(ctrl->ctrl.connect_q); |
1756 | out_free_tag_set: |
1757 | @@ -1054,10 +1060,18 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new) |
1758 | return 0; |
1759 | |
1760 | destroy_io: |
1761 | - if (ctrl->ctrl.queue_count > 1) |
1762 | + if (ctrl->ctrl.queue_count > 1) { |
1763 | + nvme_stop_queues(&ctrl->ctrl); |
1764 | + nvme_sync_io_queues(&ctrl->ctrl); |
1765 | + nvme_rdma_stop_io_queues(ctrl); |
1766 | + nvme_cancel_tagset(&ctrl->ctrl); |
1767 | nvme_rdma_destroy_io_queues(ctrl, new); |
1768 | + } |
1769 | destroy_admin: |
1770 | + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
1771 | + blk_sync_queue(ctrl->ctrl.admin_q); |
1772 | nvme_rdma_stop_queue(&ctrl->queues[0]); |
1773 | + nvme_cancel_admin_tagset(&ctrl->ctrl); |
1774 | nvme_rdma_destroy_admin_queue(ctrl, new); |
1775 | return ret; |
1776 | } |
1777 | diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
1778 | index a554021e1ab92..77a3c488ec120 100644 |
1779 | --- a/drivers/nvme/host/tcp.c |
1780 | +++ b/drivers/nvme/host/tcp.c |
1781 | @@ -1710,8 +1710,10 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) |
1782 | |
1783 | out_wait_freeze_timed_out: |
1784 | nvme_stop_queues(ctrl); |
1785 | + nvme_sync_io_queues(ctrl); |
1786 | nvme_tcp_stop_io_queues(ctrl); |
1787 | out_cleanup_connect_q: |
1788 | + nvme_cancel_tagset(ctrl); |
1789 | if (new) |
1790 | blk_cleanup_queue(ctrl->connect_q); |
1791 | out_free_tag_set: |
1792 | @@ -1773,12 +1775,16 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new) |
1793 | |
1794 | error = nvme_init_identify(ctrl); |
1795 | if (error) |
1796 | - goto out_stop_queue; |
1797 | + goto out_quiesce_queue; |
1798 | |
1799 | return 0; |
1800 | |
1801 | +out_quiesce_queue: |
1802 | + blk_mq_quiesce_queue(ctrl->admin_q); |
1803 | + blk_sync_queue(ctrl->admin_q); |
1804 | out_stop_queue: |
1805 | nvme_tcp_stop_queue(ctrl, 0); |
1806 | + nvme_cancel_admin_tagset(ctrl); |
1807 | out_cleanup_queue: |
1808 | if (new) |
1809 | blk_cleanup_queue(ctrl->admin_q); |
1810 | @@ -1892,10 +1898,18 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new) |
1811 | return 0; |
1812 | |
1813 | destroy_io: |
1814 | - if (ctrl->queue_count > 1) |
1815 | + if (ctrl->queue_count > 1) { |
1816 | + nvme_stop_queues(ctrl); |
1817 | + nvme_sync_io_queues(ctrl); |
1818 | + nvme_tcp_stop_io_queues(ctrl); |
1819 | + nvme_cancel_tagset(ctrl); |
1820 | nvme_tcp_destroy_io_queues(ctrl, new); |
1821 | + } |
1822 | destroy_admin: |
1823 | + blk_mq_quiesce_queue(ctrl->admin_q); |
1824 | + blk_sync_queue(ctrl->admin_q); |
1825 | nvme_tcp_stop_queue(ctrl, 0); |
1826 | + nvme_cancel_admin_tagset(ctrl); |
1827 | nvme_tcp_destroy_admin_queue(ctrl, new); |
1828 | return ret; |
1829 | } |
1830 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
1831 | index 89dece8a41321..9add26438be50 100644 |
1832 | --- a/drivers/pci/pci.c |
1833 | +++ b/drivers/pci/pci.c |
1834 | @@ -3471,7 +3471,14 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) |
1835 | return 0; |
1836 | |
1837 | pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); |
1838 | - return (cap & PCI_REBAR_CAP_SIZES) >> 4; |
1839 | + cap &= PCI_REBAR_CAP_SIZES; |
1840 | + |
1841 | + /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ |
1842 | + if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && |
1843 | + bar == 0 && cap == 0x7000) |
1844 | + cap = 0x3f000; |
1845 | + |
1846 | + return cap >> 4; |
1847 | } |
1848 | |
1849 | /** |
1850 | diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
1851 | index f954be3d5ee22..a14057c67a12a 100644 |
1852 | --- a/drivers/scsi/libiscsi.c |
1853 | +++ b/drivers/scsi/libiscsi.c |
1854 | @@ -3331,125 +3331,125 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session, |
1855 | |
1856 | switch(param) { |
1857 | case ISCSI_PARAM_FAST_ABORT: |
1858 | - len = sprintf(buf, "%d\n", session->fast_abort); |
1859 | + len = sysfs_emit(buf, "%d\n", session->fast_abort); |
1860 | break; |
1861 | case ISCSI_PARAM_ABORT_TMO: |
1862 | - len = sprintf(buf, "%d\n", session->abort_timeout); |
1863 | + len = sysfs_emit(buf, "%d\n", session->abort_timeout); |
1864 | break; |
1865 | case ISCSI_PARAM_LU_RESET_TMO: |
1866 | - len = sprintf(buf, "%d\n", session->lu_reset_timeout); |
1867 | + len = sysfs_emit(buf, "%d\n", session->lu_reset_timeout); |
1868 | break; |
1869 | case ISCSI_PARAM_TGT_RESET_TMO: |
1870 | - len = sprintf(buf, "%d\n", session->tgt_reset_timeout); |
1871 | + len = sysfs_emit(buf, "%d\n", session->tgt_reset_timeout); |
1872 | break; |
1873 | case ISCSI_PARAM_INITIAL_R2T_EN: |
1874 | - len = sprintf(buf, "%d\n", session->initial_r2t_en); |
1875 | + len = sysfs_emit(buf, "%d\n", session->initial_r2t_en); |
1876 | break; |
1877 | case ISCSI_PARAM_MAX_R2T: |
1878 | - len = sprintf(buf, "%hu\n", session->max_r2t); |
1879 | + len = sysfs_emit(buf, "%hu\n", session->max_r2t); |
1880 | break; |
1881 | case ISCSI_PARAM_IMM_DATA_EN: |
1882 | - len = sprintf(buf, "%d\n", session->imm_data_en); |
1883 | + len = sysfs_emit(buf, "%d\n", session->imm_data_en); |
1884 | break; |
1885 | case ISCSI_PARAM_FIRST_BURST: |
1886 | - len = sprintf(buf, "%u\n", session->first_burst); |
1887 | + len = sysfs_emit(buf, "%u\n", session->first_burst); |
1888 | break; |
1889 | case ISCSI_PARAM_MAX_BURST: |
1890 | - len = sprintf(buf, "%u\n", session->max_burst); |
1891 | + len = sysfs_emit(buf, "%u\n", session->max_burst); |
1892 | break; |
1893 | case ISCSI_PARAM_PDU_INORDER_EN: |
1894 | - len = sprintf(buf, "%d\n", session->pdu_inorder_en); |
1895 | + len = sysfs_emit(buf, "%d\n", session->pdu_inorder_en); |
1896 | break; |
1897 | case ISCSI_PARAM_DATASEQ_INORDER_EN: |
1898 | - len = sprintf(buf, "%d\n", session->dataseq_inorder_en); |
1899 | + len = sysfs_emit(buf, "%d\n", session->dataseq_inorder_en); |
1900 | break; |
1901 | case ISCSI_PARAM_DEF_TASKMGMT_TMO: |
1902 | - len = sprintf(buf, "%d\n", session->def_taskmgmt_tmo); |
1903 | + len = sysfs_emit(buf, "%d\n", session->def_taskmgmt_tmo); |
1904 | break; |
1905 | case ISCSI_PARAM_ERL: |
1906 | - len = sprintf(buf, "%d\n", session->erl); |
1907 | + len = sysfs_emit(buf, "%d\n", session->erl); |
1908 | break; |
1909 | case ISCSI_PARAM_TARGET_NAME: |
1910 | - len = sprintf(buf, "%s\n", session->targetname); |
1911 | + len = sysfs_emit(buf, "%s\n", session->targetname); |
1912 | break; |
1913 | case ISCSI_PARAM_TARGET_ALIAS: |
1914 | - len = sprintf(buf, "%s\n", session->targetalias); |
1915 | + len = sysfs_emit(buf, "%s\n", session->targetalias); |
1916 | break; |
1917 | case ISCSI_PARAM_TPGT: |
1918 | - len = sprintf(buf, "%d\n", session->tpgt); |
1919 | + len = sysfs_emit(buf, "%d\n", session->tpgt); |
1920 | break; |
1921 | case ISCSI_PARAM_USERNAME: |
1922 | - len = sprintf(buf, "%s\n", session->username); |
1923 | + len = sysfs_emit(buf, "%s\n", session->username); |
1924 | break; |
1925 | case ISCSI_PARAM_USERNAME_IN: |
1926 | - len = sprintf(buf, "%s\n", session->username_in); |
1927 | + len = sysfs_emit(buf, "%s\n", session->username_in); |
1928 | break; |
1929 | case ISCSI_PARAM_PASSWORD: |
1930 | - len = sprintf(buf, "%s\n", session->password); |
1931 | + len = sysfs_emit(buf, "%s\n", session->password); |
1932 | break; |
1933 | case ISCSI_PARAM_PASSWORD_IN: |
1934 | - len = sprintf(buf, "%s\n", session->password_in); |
1935 | + len = sysfs_emit(buf, "%s\n", session->password_in); |
1936 | break; |
1937 | case ISCSI_PARAM_IFACE_NAME: |
1938 | - len = sprintf(buf, "%s\n", session->ifacename); |
1939 | + len = sysfs_emit(buf, "%s\n", session->ifacename); |
1940 | break; |
1941 | case ISCSI_PARAM_INITIATOR_NAME: |
1942 | - len = sprintf(buf, "%s\n", session->initiatorname); |
1943 | + len = sysfs_emit(buf, "%s\n", session->initiatorname); |
1944 | break; |
1945 | case ISCSI_PARAM_BOOT_ROOT: |
1946 | - len = sprintf(buf, "%s\n", session->boot_root); |
1947 | + len = sysfs_emit(buf, "%s\n", session->boot_root); |
1948 | break; |
1949 | case ISCSI_PARAM_BOOT_NIC: |
1950 | - len = sprintf(buf, "%s\n", session->boot_nic); |
1951 | + len = sysfs_emit(buf, "%s\n", session->boot_nic); |
1952 | break; |
1953 | case ISCSI_PARAM_BOOT_TARGET: |
1954 | - len = sprintf(buf, "%s\n", session->boot_target); |
1955 | + len = sysfs_emit(buf, "%s\n", session->boot_target); |
1956 | break; |
1957 | case ISCSI_PARAM_AUTO_SND_TGT_DISABLE: |
1958 | - len = sprintf(buf, "%u\n", session->auto_snd_tgt_disable); |
1959 | + len = sysfs_emit(buf, "%u\n", session->auto_snd_tgt_disable); |
1960 | break; |
1961 | case ISCSI_PARAM_DISCOVERY_SESS: |
1962 | - len = sprintf(buf, "%u\n", session->discovery_sess); |
1963 | + len = sysfs_emit(buf, "%u\n", session->discovery_sess); |
1964 | break; |
1965 | case ISCSI_PARAM_PORTAL_TYPE: |
1966 | - len = sprintf(buf, "%s\n", session->portal_type); |
1967 | + len = sysfs_emit(buf, "%s\n", session->portal_type); |
1968 | break; |
1969 | case ISCSI_PARAM_CHAP_AUTH_EN: |
1970 | - len = sprintf(buf, "%u\n", session->chap_auth_en); |
1971 | + len = sysfs_emit(buf, "%u\n", session->chap_auth_en); |
1972 | break; |
1973 | case ISCSI_PARAM_DISCOVERY_LOGOUT_EN: |
1974 | - len = sprintf(buf, "%u\n", session->discovery_logout_en); |
1975 | + len = sysfs_emit(buf, "%u\n", session->discovery_logout_en); |
1976 | break; |
1977 | case ISCSI_PARAM_BIDI_CHAP_EN: |
1978 | - len = sprintf(buf, "%u\n", session->bidi_chap_en); |
1979 | + len = sysfs_emit(buf, "%u\n", session->bidi_chap_en); |
1980 | break; |
1981 | case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL: |
1982 | - len = sprintf(buf, "%u\n", session->discovery_auth_optional); |
1983 | + len = sysfs_emit(buf, "%u\n", session->discovery_auth_optional); |
1984 | break; |
1985 | case ISCSI_PARAM_DEF_TIME2WAIT: |
1986 | - len = sprintf(buf, "%d\n", session->time2wait); |
1987 | + len = sysfs_emit(buf, "%d\n", session->time2wait); |
1988 | break; |
1989 | case ISCSI_PARAM_DEF_TIME2RETAIN: |
1990 | - len = sprintf(buf, "%d\n", session->time2retain); |
1991 | + len = sysfs_emit(buf, "%d\n", session->time2retain); |
1992 | break; |
1993 | case ISCSI_PARAM_TSID: |
1994 | - len = sprintf(buf, "%u\n", session->tsid); |
1995 | + len = sysfs_emit(buf, "%u\n", session->tsid); |
1996 | break; |
1997 | case ISCSI_PARAM_ISID: |
1998 | - len = sprintf(buf, "%02x%02x%02x%02x%02x%02x\n", |
1999 | + len = sysfs_emit(buf, "%02x%02x%02x%02x%02x%02x\n", |
2000 | session->isid[0], session->isid[1], |
2001 | session->isid[2], session->isid[3], |
2002 | session->isid[4], session->isid[5]); |
2003 | break; |
2004 | case ISCSI_PARAM_DISCOVERY_PARENT_IDX: |
2005 | - len = sprintf(buf, "%u\n", session->discovery_parent_idx); |
2006 | + len = sysfs_emit(buf, "%u\n", session->discovery_parent_idx); |
2007 | break; |
2008 | case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: |
2009 | if (session->discovery_parent_type) |
2010 | - len = sprintf(buf, "%s\n", |
2011 | + len = sysfs_emit(buf, "%s\n", |
2012 | session->discovery_parent_type); |
2013 | else |
2014 | - len = sprintf(buf, "\n"); |
2015 | + len = sysfs_emit(buf, "\n"); |
2016 | break; |
2017 | default: |
2018 | return -ENOSYS; |
2019 | @@ -3481,16 +3481,16 @@ int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, |
2020 | case ISCSI_PARAM_CONN_ADDRESS: |
2021 | case ISCSI_HOST_PARAM_IPADDRESS: |
2022 | if (sin) |
2023 | - len = sprintf(buf, "%pI4\n", &sin->sin_addr.s_addr); |
2024 | + len = sysfs_emit(buf, "%pI4\n", &sin->sin_addr.s_addr); |
2025 | else |
2026 | - len = sprintf(buf, "%pI6\n", &sin6->sin6_addr); |
2027 | + len = sysfs_emit(buf, "%pI6\n", &sin6->sin6_addr); |
2028 | break; |
2029 | case ISCSI_PARAM_CONN_PORT: |
2030 | case ISCSI_PARAM_LOCAL_PORT: |
2031 | if (sin) |
2032 | - len = sprintf(buf, "%hu\n", be16_to_cpu(sin->sin_port)); |
2033 | + len = sysfs_emit(buf, "%hu\n", be16_to_cpu(sin->sin_port)); |
2034 | else |
2035 | - len = sprintf(buf, "%hu\n", |
2036 | + len = sysfs_emit(buf, "%hu\n", |
2037 | be16_to_cpu(sin6->sin6_port)); |
2038 | break; |
2039 | default: |
2040 | @@ -3509,88 +3509,88 @@ int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, |
2041 | |
2042 | switch(param) { |
2043 | case ISCSI_PARAM_PING_TMO: |
2044 | - len = sprintf(buf, "%u\n", conn->ping_timeout); |
2045 | + len = sysfs_emit(buf, "%u\n", conn->ping_timeout); |
2046 | break; |
2047 | case ISCSI_PARAM_RECV_TMO: |
2048 | - len = sprintf(buf, "%u\n", conn->recv_timeout); |
2049 | + len = sysfs_emit(buf, "%u\n", conn->recv_timeout); |
2050 | break; |
2051 | case ISCSI_PARAM_MAX_RECV_DLENGTH: |
2052 | - len = sprintf(buf, "%u\n", conn->max_recv_dlength); |
2053 | + len = sysfs_emit(buf, "%u\n", conn->max_recv_dlength); |
2054 | break; |
2055 | case ISCSI_PARAM_MAX_XMIT_DLENGTH: |
2056 | - len = sprintf(buf, "%u\n", conn->max_xmit_dlength); |
2057 | + len = sysfs_emit(buf, "%u\n", conn->max_xmit_dlength); |
2058 | break; |
2059 | case ISCSI_PARAM_HDRDGST_EN: |
2060 | - len = sprintf(buf, "%d\n", conn->hdrdgst_en); |
2061 | + len = sysfs_emit(buf, "%d\n", conn->hdrdgst_en); |
2062 | break; |
2063 | case ISCSI_PARAM_DATADGST_EN: |
2064 | - len = sprintf(buf, "%d\n", conn->datadgst_en); |
2065 | + len = sysfs_emit(buf, "%d\n", conn->datadgst_en); |
2066 | break; |
2067 | case ISCSI_PARAM_IFMARKER_EN: |
2068 | - len = sprintf(buf, "%d\n", conn->ifmarker_en); |
2069 | + len = sysfs_emit(buf, "%d\n", conn->ifmarker_en); |
2070 | break; |
2071 | case ISCSI_PARAM_OFMARKER_EN: |
2072 | - len = sprintf(buf, "%d\n", conn->ofmarker_en); |
2073 | + len = sysfs_emit(buf, "%d\n", conn->ofmarker_en); |
2074 | break; |
2075 | case ISCSI_PARAM_EXP_STATSN: |
2076 | - len = sprintf(buf, "%u\n", conn->exp_statsn); |
2077 | + len = sysfs_emit(buf, "%u\n", conn->exp_statsn); |
2078 | break; |
2079 | case ISCSI_PARAM_PERSISTENT_PORT: |
2080 | - len = sprintf(buf, "%d\n", conn->persistent_port); |
2081 | + len = sysfs_emit(buf, "%d\n", conn->persistent_port); |
2082 | break; |
2083 | case ISCSI_PARAM_PERSISTENT_ADDRESS: |
2084 | - len = sprintf(buf, "%s\n", conn->persistent_address); |
2085 | + len = sysfs_emit(buf, "%s\n", conn->persistent_address); |
2086 | break; |
2087 | case ISCSI_PARAM_STATSN: |
2088 | - len = sprintf(buf, "%u\n", conn->statsn); |
2089 | + len = sysfs_emit(buf, "%u\n", conn->statsn); |
2090 | break; |
2091 | case ISCSI_PARAM_MAX_SEGMENT_SIZE: |
2092 | - len = sprintf(buf, "%u\n", conn->max_segment_size); |
2093 | + len = sysfs_emit(buf, "%u\n", conn->max_segment_size); |
2094 | break; |
2095 | case ISCSI_PARAM_KEEPALIVE_TMO: |
2096 | - len = sprintf(buf, "%u\n", conn->keepalive_tmo); |
2097 | + len = sysfs_emit(buf, "%u\n", conn->keepalive_tmo); |
2098 | break; |
2099 | case ISCSI_PARAM_LOCAL_PORT: |
2100 | - len = sprintf(buf, "%u\n", conn->local_port); |
2101 | + len = sysfs_emit(buf, "%u\n", conn->local_port); |
2102 | break; |
2103 | case ISCSI_PARAM_TCP_TIMESTAMP_STAT: |
2104 | - len = sprintf(buf, "%u\n", conn->tcp_timestamp_stat); |
2105 | + len = sysfs_emit(buf, "%u\n", conn->tcp_timestamp_stat); |
2106 | break; |
2107 | case ISCSI_PARAM_TCP_NAGLE_DISABLE: |
2108 | - len = sprintf(buf, "%u\n", conn->tcp_nagle_disable); |
2109 | + len = sysfs_emit(buf, "%u\n", conn->tcp_nagle_disable); |
2110 | break; |
2111 | case ISCSI_PARAM_TCP_WSF_DISABLE: |
2112 | - len = sprintf(buf, "%u\n", conn->tcp_wsf_disable); |
2113 | + len = sysfs_emit(buf, "%u\n", conn->tcp_wsf_disable); |
2114 | break; |
2115 | case ISCSI_PARAM_TCP_TIMER_SCALE: |
2116 | - len = sprintf(buf, "%u\n", conn->tcp_timer_scale); |
2117 | + len = sysfs_emit(buf, "%u\n", conn->tcp_timer_scale); |
2118 | break; |
2119 | case ISCSI_PARAM_TCP_TIMESTAMP_EN: |
2120 | - len = sprintf(buf, "%u\n", conn->tcp_timestamp_en); |
2121 | + len = sysfs_emit(buf, "%u\n", conn->tcp_timestamp_en); |
2122 | break; |
2123 | case ISCSI_PARAM_IP_FRAGMENT_DISABLE: |
2124 | - len = sprintf(buf, "%u\n", conn->fragment_disable); |
2125 | + len = sysfs_emit(buf, "%u\n", conn->fragment_disable); |
2126 | break; |
2127 | case ISCSI_PARAM_IPV4_TOS: |
2128 | - len = sprintf(buf, "%u\n", conn->ipv4_tos); |
2129 | + len = sysfs_emit(buf, "%u\n", conn->ipv4_tos); |
2130 | break; |
2131 | case ISCSI_PARAM_IPV6_TC: |
2132 | - len = sprintf(buf, "%u\n", conn->ipv6_traffic_class); |
2133 | + len = sysfs_emit(buf, "%u\n", conn->ipv6_traffic_class); |
2134 | break; |
2135 | case ISCSI_PARAM_IPV6_FLOW_LABEL: |
2136 | - len = sprintf(buf, "%u\n", conn->ipv6_flow_label); |
2137 | + len = sysfs_emit(buf, "%u\n", conn->ipv6_flow_label); |
2138 | break; |
2139 | case ISCSI_PARAM_IS_FW_ASSIGNED_IPV6: |
2140 | - len = sprintf(buf, "%u\n", conn->is_fw_assigned_ipv6); |
2141 | + len = sysfs_emit(buf, "%u\n", conn->is_fw_assigned_ipv6); |
2142 | break; |
2143 | case ISCSI_PARAM_TCP_XMIT_WSF: |
2144 | - len = sprintf(buf, "%u\n", conn->tcp_xmit_wsf); |
2145 | + len = sysfs_emit(buf, "%u\n", conn->tcp_xmit_wsf); |
2146 | break; |
2147 | case ISCSI_PARAM_TCP_RECV_WSF: |
2148 | - len = sprintf(buf, "%u\n", conn->tcp_recv_wsf); |
2149 | + len = sysfs_emit(buf, "%u\n", conn->tcp_recv_wsf); |
2150 | break; |
2151 | case ISCSI_PARAM_LOCAL_IPADDR: |
2152 | - len = sprintf(buf, "%s\n", conn->local_ipaddr); |
2153 | + len = sysfs_emit(buf, "%s\n", conn->local_ipaddr); |
2154 | break; |
2155 | default: |
2156 | return -ENOSYS; |
2157 | @@ -3608,13 +3608,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, |
2158 | |
2159 | switch (param) { |
2160 | case ISCSI_HOST_PARAM_NETDEV_NAME: |
2161 | - len = sprintf(buf, "%s\n", ihost->netdev); |
2162 | + len = sysfs_emit(buf, "%s\n", ihost->netdev); |
2163 | break; |
2164 | case ISCSI_HOST_PARAM_HWADDRESS: |
2165 | - len = sprintf(buf, "%s\n", ihost->hwaddress); |
2166 | + len = sysfs_emit(buf, "%s\n", ihost->hwaddress); |
2167 | break; |
2168 | case ISCSI_HOST_PARAM_INITIATOR_NAME: |
2169 | - len = sprintf(buf, "%s\n", ihost->initiatorname); |
2170 | + len = sysfs_emit(buf, "%s\n", ihost->initiatorname); |
2171 | break; |
2172 | default: |
2173 | return -ENOSYS; |
2174 | diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
2175 | index dbad926e8f87f..a26df7d6d5d18 100644 |
2176 | --- a/drivers/scsi/scsi_transport_iscsi.c |
2177 | +++ b/drivers/scsi/scsi_transport_iscsi.c |
2178 | @@ -124,7 +124,11 @@ show_transport_handle(struct device *dev, struct device_attribute *attr, |
2179 | char *buf) |
2180 | { |
2181 | struct iscsi_internal *priv = dev_to_iscsi_internal(dev); |
2182 | - return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport)); |
2183 | + |
2184 | + if (!capable(CAP_SYS_ADMIN)) |
2185 | + return -EACCES; |
2186 | + return sysfs_emit(buf, "%llu\n", |
2187 | + (unsigned long long)iscsi_handle(priv->iscsi_transport)); |
2188 | } |
2189 | static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); |
2190 | |
2191 | @@ -134,7 +138,7 @@ show_transport_##name(struct device *dev, \ |
2192 | struct device_attribute *attr,char *buf) \ |
2193 | { \ |
2194 | struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \ |
2195 | - return sprintf(buf, format"\n", priv->iscsi_transport->name); \ |
2196 | + return sysfs_emit(buf, format"\n", priv->iscsi_transport->name);\ |
2197 | } \ |
2198 | static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); |
2199 | |
2200 | @@ -175,7 +179,7 @@ static ssize_t |
2201 | show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf) |
2202 | { |
2203 | struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); |
2204 | - return sprintf(buf, "%llu\n", (unsigned long long) ep->id); |
2205 | + return sysfs_emit(buf, "%llu\n", (unsigned long long) ep->id); |
2206 | } |
2207 | static ISCSI_ATTR(ep, handle, S_IRUGO, show_ep_handle, NULL); |
2208 | |
2209 | @@ -2765,6 +2769,9 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev) |
2210 | struct iscsi_cls_session *session; |
2211 | int err = 0, value = 0; |
2212 | |
2213 | + if (ev->u.set_param.len > PAGE_SIZE) |
2214 | + return -EINVAL; |
2215 | + |
2216 | session = iscsi_session_lookup(ev->u.set_param.sid); |
2217 | conn = iscsi_conn_lookup(ev->u.set_param.sid, ev->u.set_param.cid); |
2218 | if (!conn || !session) |
2219 | @@ -2912,6 +2919,9 @@ iscsi_set_host_param(struct iscsi_transport *transport, |
2220 | if (!transport->set_host_param) |
2221 | return -ENOSYS; |
2222 | |
2223 | + if (ev->u.set_host_param.len > PAGE_SIZE) |
2224 | + return -EINVAL; |
2225 | + |
2226 | shost = scsi_host_lookup(ev->u.set_host_param.host_no); |
2227 | if (!shost) { |
2228 | printk(KERN_ERR "set_host_param could not find host no %u\n", |
2229 | @@ -3499,6 +3509,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
2230 | { |
2231 | int err = 0; |
2232 | u32 portid; |
2233 | + u32 pdu_len; |
2234 | struct iscsi_uevent *ev = nlmsg_data(nlh); |
2235 | struct iscsi_transport *transport = NULL; |
2236 | struct iscsi_internal *priv; |
2237 | @@ -3506,6 +3517,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
2238 | struct iscsi_cls_conn *conn; |
2239 | struct iscsi_endpoint *ep = NULL; |
2240 | |
2241 | + if (!netlink_capable(skb, CAP_SYS_ADMIN)) |
2242 | + return -EPERM; |
2243 | + |
2244 | if (nlh->nlmsg_type == ISCSI_UEVENT_PATH_UPDATE) |
2245 | *group = ISCSI_NL_GRP_UIP; |
2246 | else |
2247 | @@ -3613,6 +3627,14 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
2248 | err = -EINVAL; |
2249 | break; |
2250 | case ISCSI_UEVENT_SEND_PDU: |
2251 | + pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev); |
2252 | + |
2253 | + if ((ev->u.send_pdu.hdr_size > pdu_len) || |
2254 | + (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { |
2255 | + err = -EINVAL; |
2256 | + break; |
2257 | + } |
2258 | + |
2259 | conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); |
2260 | if (conn) |
2261 | ev->r.retcode = transport->send_pdu(conn, |
2262 | @@ -4019,7 +4041,7 @@ show_priv_session_state(struct device *dev, struct device_attribute *attr, |
2263 | char *buf) |
2264 | { |
2265 | struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); |
2266 | - return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); |
2267 | + return sysfs_emit(buf, "%s\n", iscsi_session_state_name(session->state)); |
2268 | } |
2269 | static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, |
2270 | NULL); |
2271 | @@ -4028,7 +4050,7 @@ show_priv_session_creator(struct device *dev, struct device_attribute *attr, |
2272 | char *buf) |
2273 | { |
2274 | struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); |
2275 | - return sprintf(buf, "%d\n", session->creator); |
2276 | + return sysfs_emit(buf, "%d\n", session->creator); |
2277 | } |
2278 | static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator, |
2279 | NULL); |
2280 | @@ -4037,7 +4059,7 @@ show_priv_session_target_id(struct device *dev, struct device_attribute *attr, |
2281 | char *buf) |
2282 | { |
2283 | struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); |
2284 | - return sprintf(buf, "%d\n", session->target_id); |
2285 | + return sysfs_emit(buf, "%d\n", session->target_id); |
2286 | } |
2287 | static ISCSI_CLASS_ATTR(priv_sess, target_id, S_IRUGO, |
2288 | show_priv_session_target_id, NULL); |
2289 | @@ -4050,8 +4072,8 @@ show_priv_session_##field(struct device *dev, \ |
2290 | struct iscsi_cls_session *session = \ |
2291 | iscsi_dev_to_session(dev->parent); \ |
2292 | if (session->field == -1) \ |
2293 | - return sprintf(buf, "off\n"); \ |
2294 | - return sprintf(buf, format"\n", session->field); \ |
2295 | + return sysfs_emit(buf, "off\n"); \ |
2296 | + return sysfs_emit(buf, format"\n", session->field); \ |
2297 | } |
2298 | |
2299 | #define iscsi_priv_session_attr_store(field) \ |
2300 | diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c |
2301 | index aec0f19597a94..4df6e3c1ea96c 100644 |
2302 | --- a/drivers/staging/fwserial/fwserial.c |
2303 | +++ b/drivers/staging/fwserial/fwserial.c |
2304 | @@ -2189,6 +2189,7 @@ static int fwserial_create(struct fw_unit *unit) |
2305 | err = fw_core_add_address_handler(&port->rx_handler, |
2306 | &fw_high_memory_region); |
2307 | if (err) { |
2308 | + tty_port_destroy(&port->port); |
2309 | kfree(port); |
2310 | goto free_ports; |
2311 | } |
2312 | @@ -2271,6 +2272,7 @@ unregister_ttys: |
2313 | |
2314 | free_ports: |
2315 | for (--i; i >= 0; --i) { |
2316 | + fw_core_remove_address_handler(&serial->ports[i]->rx_handler); |
2317 | tty_port_destroy(&serial->ports[i]->port); |
2318 | kfree(serial->ports[i]); |
2319 | } |
2320 | diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c |
2321 | index 79817061fcfa4..4225ee9fcf7bf 100644 |
2322 | --- a/drivers/staging/most/sound/sound.c |
2323 | +++ b/drivers/staging/most/sound/sound.c |
2324 | @@ -98,6 +98,8 @@ static void swap_copy24(u8 *dest, const u8 *source, unsigned int bytes) |
2325 | { |
2326 | unsigned int i = 0; |
2327 | |
2328 | + if (bytes < 2) |
2329 | + return; |
2330 | while (i < bytes - 2) { |
2331 | dest[i] = source[i + 2]; |
2332 | dest[i + 1] = source[i + 1]; |
2333 | diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c |
2334 | index 4c2cae99776b9..3703409715dab 100644 |
2335 | --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c |
2336 | +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c |
2337 | @@ -224,7 +224,7 @@ int snd_bcm2835_new_ctl(struct bcm2835_chip *chip) |
2338 | { |
2339 | int err; |
2340 | |
2341 | - strcpy(chip->card->mixername, "Broadcom Mixer"); |
2342 | + strscpy(chip->card->mixername, "Broadcom Mixer", sizeof(chip->card->mixername)); |
2343 | err = create_ctls(chip, ARRAY_SIZE(snd_bcm2835_ctl), snd_bcm2835_ctl); |
2344 | if (err < 0) |
2345 | return err; |
2346 | @@ -261,7 +261,7 @@ static const struct snd_kcontrol_new snd_bcm2835_headphones_ctl[] = { |
2347 | |
2348 | int snd_bcm2835_new_headphones_ctl(struct bcm2835_chip *chip) |
2349 | { |
2350 | - strcpy(chip->card->mixername, "Broadcom Mixer"); |
2351 | + strscpy(chip->card->mixername, "Broadcom Mixer", sizeof(chip->card->mixername)); |
2352 | return create_ctls(chip, ARRAY_SIZE(snd_bcm2835_headphones_ctl), |
2353 | snd_bcm2835_headphones_ctl); |
2354 | } |
2355 | @@ -295,7 +295,7 @@ static const struct snd_kcontrol_new snd_bcm2835_hdmi[] = { |
2356 | |
2357 | int snd_bcm2835_new_hdmi_ctl(struct bcm2835_chip *chip) |
2358 | { |
2359 | - strcpy(chip->card->mixername, "Broadcom Mixer"); |
2360 | + strscpy(chip->card->mixername, "Broadcom Mixer", sizeof(chip->card->mixername)); |
2361 | return create_ctls(chip, ARRAY_SIZE(snd_bcm2835_hdmi), |
2362 | snd_bcm2835_hdmi); |
2363 | } |
2364 | diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c |
2365 | index 826016c3431a1..8708f97b46f3a 100644 |
2366 | --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c |
2367 | +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c |
2368 | @@ -351,7 +351,7 @@ int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, const char *name, |
2369 | |
2370 | pcm->private_data = chip; |
2371 | pcm->nonatomic = true; |
2372 | - strcpy(pcm->name, name); |
2373 | + strscpy(pcm->name, name, sizeof(pcm->name)); |
2374 | if (!spdif) { |
2375 | chip->dest = route; |
2376 | chip->volume = 0; |
2377 | diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c |
2378 | index cf5f80f5ca6b0..c250fbef2fa3d 100644 |
2379 | --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c |
2380 | +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c |
2381 | @@ -185,9 +185,9 @@ static int snd_add_child_device(struct device *dev, |
2382 | goto error; |
2383 | } |
2384 | |
2385 | - strcpy(card->driver, audio_driver->driver.name); |
2386 | - strcpy(card->shortname, audio_driver->shortname); |
2387 | - strcpy(card->longname, audio_driver->longname); |
2388 | + strscpy(card->driver, audio_driver->driver.name, sizeof(card->driver)); |
2389 | + strscpy(card->shortname, audio_driver->shortname, sizeof(card->shortname)); |
2390 | + strscpy(card->longname, audio_driver->longname, sizeof(card->longname)); |
2391 | |
2392 | err = audio_driver->newpcm(chip, audio_driver->shortname, |
2393 | audio_driver->route, |
2394 | diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c |
2395 | index b28aa0d289f89..251c02af1fc3e 100644 |
2396 | --- a/drivers/tty/vt/consolemap.c |
2397 | +++ b/drivers/tty/vt/consolemap.c |
2398 | @@ -495,7 +495,7 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos) |
2399 | |
2400 | p2[unicode & 0x3f] = fontpos; |
2401 | |
2402 | - p->sum += (fontpos << 20) + unicode; |
2403 | + p->sum += (fontpos << 20U) + unicode; |
2404 | |
2405 | return 0; |
2406 | } |
2407 | diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
2408 | index fe373b63ddd6d..ecbfbbf1c1a79 100644 |
2409 | --- a/drivers/video/fbdev/udlfb.c |
2410 | +++ b/drivers/video/fbdev/udlfb.c |
2411 | @@ -1017,6 +1017,7 @@ static void dlfb_ops_destroy(struct fb_info *info) |
2412 | } |
2413 | vfree(dlfb->backing_buffer); |
2414 | kfree(dlfb->edid); |
2415 | + dlfb_free_urb_list(dlfb); |
2416 | usb_put_dev(dlfb->udev); |
2417 | kfree(dlfb); |
2418 | |
2419 | diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
2420 | index c346ee7ec18d4..aca6c467d7761 100644 |
2421 | --- a/fs/btrfs/transaction.c |
2422 | +++ b/fs/btrfs/transaction.c |
2423 | @@ -1212,7 +1212,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans) |
2424 | struct btrfs_root *gang[8]; |
2425 | int i; |
2426 | int ret; |
2427 | - int err = 0; |
2428 | |
2429 | spin_lock(&fs_info->fs_roots_radix_lock); |
2430 | while (1) { |
2431 | @@ -1224,6 +1223,8 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans) |
2432 | break; |
2433 | for (i = 0; i < ret; i++) { |
2434 | struct btrfs_root *root = gang[i]; |
2435 | + int ret2; |
2436 | + |
2437 | radix_tree_tag_clear(&fs_info->fs_roots_radix, |
2438 | (unsigned long)root->root_key.objectid, |
2439 | BTRFS_ROOT_TRANS_TAG); |
2440 | @@ -1245,17 +1246,17 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans) |
2441 | root->node); |
2442 | } |
2443 | |
2444 | - err = btrfs_update_root(trans, fs_info->tree_root, |
2445 | + ret2 = btrfs_update_root(trans, fs_info->tree_root, |
2446 | &root->root_key, |
2447 | &root->root_item); |
2448 | + if (ret2) |
2449 | + return ret2; |
2450 | spin_lock(&fs_info->fs_roots_radix_lock); |
2451 | - if (err) |
2452 | - break; |
2453 | btrfs_qgroup_free_meta_all_pertrans(root); |
2454 | } |
2455 | } |
2456 | spin_unlock(&fs_info->fs_roots_radix_lock); |
2457 | - return err; |
2458 | + return 0; |
2459 | } |
2460 | |
2461 | /* |
2462 | diff --git a/fs/erofs/super.c b/fs/erofs/super.c |
2463 | index 0e369494f2f2c..22e059b4f745c 100644 |
2464 | --- a/fs/erofs/super.c |
2465 | +++ b/fs/erofs/super.c |
2466 | @@ -124,8 +124,8 @@ static int erofs_read_superblock(struct super_block *sb) |
2467 | blkszbits = dsb->blkszbits; |
2468 | /* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ |
2469 | if (blkszbits != LOG_BLOCK_SIZE) { |
2470 | - erofs_err(sb, "blksize %u isn't supported on this platform", |
2471 | - 1 << blkszbits); |
2472 | + erofs_err(sb, "blkszbits %u isn't supported on this platform", |
2473 | + blkszbits); |
2474 | goto out; |
2475 | } |
2476 | |
2477 | diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c |
2478 | index 5d9584281935f..3a97ac56821ba 100644 |
2479 | --- a/fs/f2fs/namei.c |
2480 | +++ b/fs/f2fs/namei.c |
2481 | @@ -797,7 +797,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry, |
2482 | |
2483 | if (whiteout) { |
2484 | f2fs_i_links_write(inode, false); |
2485 | + |
2486 | + spin_lock(&inode->i_lock); |
2487 | inode->i_state |= I_LINKABLE; |
2488 | + spin_unlock(&inode->i_lock); |
2489 | + |
2490 | *whiteout = inode; |
2491 | } else { |
2492 | d_tmpfile(dentry, inode); |
2493 | @@ -996,7 +1000,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2494 | err = f2fs_add_link(old_dentry, whiteout); |
2495 | if (err) |
2496 | goto put_out_dir; |
2497 | + |
2498 | + spin_lock(&whiteout->i_lock); |
2499 | whiteout->i_state &= ~I_LINKABLE; |
2500 | + spin_unlock(&whiteout->i_lock); |
2501 | + |
2502 | iput(whiteout); |
2503 | } |
2504 | |
2505 | diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h |
2506 | index 325781a1ae4d6..2034b9a07d632 100644 |
2507 | --- a/fs/f2fs/segment.h |
2508 | +++ b/fs/f2fs/segment.h |
2509 | @@ -88,11 +88,11 @@ |
2510 | #define BLKS_PER_SEC(sbi) \ |
2511 | ((sbi)->segs_per_sec * (sbi)->blocks_per_seg) |
2512 | #define GET_SEC_FROM_SEG(sbi, segno) \ |
2513 | - ((segno) / (sbi)->segs_per_sec) |
2514 | + (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec) |
2515 | #define GET_SEG_FROM_SEC(sbi, secno) \ |
2516 | ((secno) * (sbi)->segs_per_sec) |
2517 | #define GET_ZONE_FROM_SEC(sbi, secno) \ |
2518 | - ((secno) / (sbi)->secs_per_zone) |
2519 | + (((secno) == -1) ? -1: (secno) / (sbi)->secs_per_zone) |
2520 | #define GET_ZONE_FROM_SEG(sbi, segno) \ |
2521 | GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno)) |
2522 | |
2523 | diff --git a/fs/jfs/jfs_filsys.h b/fs/jfs/jfs_filsys.h |
2524 | index 1e899298f7f00..b5d702df7111a 100644 |
2525 | --- a/fs/jfs/jfs_filsys.h |
2526 | +++ b/fs/jfs/jfs_filsys.h |
2527 | @@ -268,5 +268,6 @@ |
2528 | * fsck() must be run to repair |
2529 | */ |
2530 | #define FM_EXTENDFS 0x00000008 /* file system extendfs() in progress */ |
2531 | +#define FM_STATE_MAX 0x0000000f /* max value of s_state */ |
2532 | |
2533 | #endif /* _H_JFS_FILSYS */ |
2534 | diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c |
2535 | index eb8b9e233d73d..616de103dccc5 100644 |
2536 | --- a/fs/jfs/jfs_mount.c |
2537 | +++ b/fs/jfs/jfs_mount.c |
2538 | @@ -36,6 +36,7 @@ |
2539 | |
2540 | #include <linux/fs.h> |
2541 | #include <linux/buffer_head.h> |
2542 | +#include <linux/log2.h> |
2543 | |
2544 | #include "jfs_incore.h" |
2545 | #include "jfs_filsys.h" |
2546 | @@ -365,6 +366,15 @@ static int chkSuper(struct super_block *sb) |
2547 | sbi->bsize = bsize; |
2548 | sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize); |
2549 | |
2550 | + /* check some fields for possible corruption */ |
2551 | + if (sbi->l2bsize != ilog2((u32)bsize) || |
2552 | + j_sb->pad != 0 || |
2553 | + le32_to_cpu(j_sb->s_state) > FM_STATE_MAX) { |
2554 | + rc = -EINVAL; |
2555 | + jfs_err("jfs_mount: Mount Failure: superblock is corrupt!"); |
2556 | + goto out; |
2557 | + } |
2558 | + |
2559 | /* |
2560 | * For now, ignore s_pbsize, l2bfactor. All I/O going through buffer |
2561 | * cache. |
2562 | diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c |
2563 | index 130fc6fbcc038..4f7cf975b27c2 100644 |
2564 | --- a/fs/sysfs/file.c |
2565 | +++ b/fs/sysfs/file.c |
2566 | @@ -15,6 +15,7 @@ |
2567 | #include <linux/list.h> |
2568 | #include <linux/mutex.h> |
2569 | #include <linux/seq_file.h> |
2570 | +#include <linux/mm.h> |
2571 | |
2572 | #include "sysfs.h" |
2573 | |
2574 | @@ -558,3 +559,57 @@ void sysfs_remove_bin_file(struct kobject *kobj, |
2575 | kernfs_remove_by_name(kobj->sd, attr->attr.name); |
2576 | } |
2577 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); |
2578 | + |
2579 | +/** |
2580 | + * sysfs_emit - scnprintf equivalent, aware of PAGE_SIZE buffer. |
2581 | + * @buf: start of PAGE_SIZE buffer. |
2582 | + * @fmt: format |
2583 | + * @...: optional arguments to @format |
2584 | + * |
2585 | + * |
2586 | + * Returns number of characters written to @buf. |
2587 | + */ |
2588 | +int sysfs_emit(char *buf, const char *fmt, ...) |
2589 | +{ |
2590 | + va_list args; |
2591 | + int len; |
2592 | + |
2593 | + if (WARN(!buf || offset_in_page(buf), |
2594 | + "invalid sysfs_emit: buf:%p\n", buf)) |
2595 | + return 0; |
2596 | + |
2597 | + va_start(args, fmt); |
2598 | + len = vscnprintf(buf, PAGE_SIZE, fmt, args); |
2599 | + va_end(args); |
2600 | + |
2601 | + return len; |
2602 | +} |
2603 | +EXPORT_SYMBOL_GPL(sysfs_emit); |
2604 | + |
2605 | +/** |
2606 | + * sysfs_emit_at - scnprintf equivalent, aware of PAGE_SIZE buffer. |
2607 | + * @buf: start of PAGE_SIZE buffer. |
2608 | + * @at: offset in @buf to start write in bytes |
2609 | + * @at must be >= 0 && < PAGE_SIZE |
2610 | + * @fmt: format |
2611 | + * @...: optional arguments to @fmt |
2612 | + * |
2613 | + * |
2614 | + * Returns number of characters written starting at &@buf[@at]. |
2615 | + */ |
2616 | +int sysfs_emit_at(char *buf, int at, const char *fmt, ...) |
2617 | +{ |
2618 | + va_list args; |
2619 | + int len; |
2620 | + |
2621 | + if (WARN(!buf || offset_in_page(buf) || at < 0 || at >= PAGE_SIZE, |
2622 | + "invalid sysfs_emit_at: buf:%p at:%d\n", buf, at)) |
2623 | + return 0; |
2624 | + |
2625 | + va_start(args, fmt); |
2626 | + len = vscnprintf(buf + at, PAGE_SIZE - at, fmt, args); |
2627 | + va_end(args); |
2628 | + |
2629 | + return len; |
2630 | +} |
2631 | +EXPORT_SYMBOL_GPL(sysfs_emit_at); |
2632 | diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c |
2633 | index dec511823fcbc..ca8c763902b96 100644 |
2634 | --- a/fs/xfs/xfs_iops.c |
2635 | +++ b/fs/xfs/xfs_iops.c |
2636 | @@ -839,7 +839,7 @@ xfs_setattr_size( |
2637 | ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL)); |
2638 | ASSERT(S_ISREG(inode->i_mode)); |
2639 | ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| |
2640 | - ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); |
2641 | + ATTR_MTIME_SET|ATTR_TIMES_SET)) == 0); |
2642 | |
2643 | oldsize = inode->i_size; |
2644 | newsize = iattr->ia_size; |
2645 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
2646 | index 3e0692fd6282c..db1b9623977c8 100644 |
2647 | --- a/include/linux/netdevice.h |
2648 | +++ b/include/linux/netdevice.h |
2649 | @@ -3679,6 +3679,9 @@ int dev_pre_changeaddr_notify(struct net_device *dev, const char *addr, |
2650 | struct netlink_ext_ack *extack); |
2651 | int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, |
2652 | struct netlink_ext_ack *extack); |
2653 | +int dev_set_mac_address_user(struct net_device *dev, struct sockaddr *sa, |
2654 | + struct netlink_ext_ack *extack); |
2655 | +int dev_get_mac_address(struct sockaddr *sa, struct net *net, char *dev_name); |
2656 | int dev_change_carrier(struct net_device *, bool new_carrier); |
2657 | int dev_get_phys_port_id(struct net_device *dev, |
2658 | struct netdev_phys_item_id *ppid); |
2659 | diff --git a/include/linux/swap.h b/include/linux/swap.h |
2660 | index 063c0c1e112bd..136a929648ef4 100644 |
2661 | --- a/include/linux/swap.h |
2662 | +++ b/include/linux/swap.h |
2663 | @@ -473,6 +473,7 @@ struct backing_dev_info; |
2664 | extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); |
2665 | extern void exit_swap_address_space(unsigned int type); |
2666 | extern struct swap_info_struct *get_swap_device(swp_entry_t entry); |
2667 | +sector_t swap_page_sector(struct page *page); |
2668 | |
2669 | static inline void put_swap_device(struct swap_info_struct *si) |
2670 | { |
2671 | diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h |
2672 | index fa7ee503fb763..428707ac3c0bd 100644 |
2673 | --- a/include/linux/sysfs.h |
2674 | +++ b/include/linux/sysfs.h |
2675 | @@ -310,6 +310,11 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) |
2676 | return kernfs_enable_ns(kn); |
2677 | } |
2678 | |
2679 | +__printf(2, 3) |
2680 | +int sysfs_emit(char *buf, const char *fmt, ...); |
2681 | +__printf(3, 4) |
2682 | +int sysfs_emit_at(char *buf, int at, const char *fmt, ...); |
2683 | + |
2684 | #else /* CONFIG_SYSFS */ |
2685 | |
2686 | static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) |
2687 | @@ -522,6 +527,17 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) |
2688 | { |
2689 | } |
2690 | |
2691 | +__printf(2, 3) |
2692 | +static inline int sysfs_emit(char *buf, const char *fmt, ...) |
2693 | +{ |
2694 | + return 0; |
2695 | +} |
2696 | + |
2697 | +__printf(3, 4) |
2698 | +static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...) |
2699 | +{ |
2700 | + return 0; |
2701 | +} |
2702 | #endif /* CONFIG_SYSFS */ |
2703 | |
2704 | static inline int __must_check sysfs_create_file(struct kobject *kobj, |
2705 | diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h |
2706 | index 4807ca4d52e03..2a430e713ce51 100644 |
2707 | --- a/include/linux/zsmalloc.h |
2708 | +++ b/include/linux/zsmalloc.h |
2709 | @@ -35,7 +35,7 @@ enum zs_mapmode { |
2710 | |
2711 | struct zs_pool_stats { |
2712 | /* How many pages were migrated (freed) */ |
2713 | - unsigned long pages_compacted; |
2714 | + atomic_long_t pages_compacted; |
2715 | }; |
2716 | |
2717 | struct zs_pool; |
2718 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
2719 | index 7841e738e38f0..2ce61018e33b6 100644 |
2720 | --- a/kernel/sched/core.c |
2721 | +++ b/kernel/sched/core.c |
2722 | @@ -254,8 +254,9 @@ static enum hrtimer_restart hrtick(struct hrtimer *timer) |
2723 | static void __hrtick_restart(struct rq *rq) |
2724 | { |
2725 | struct hrtimer *timer = &rq->hrtick_timer; |
2726 | + ktime_t time = rq->hrtick_time; |
2727 | |
2728 | - hrtimer_start_expires(timer, HRTIMER_MODE_ABS_PINNED_HARD); |
2729 | + hrtimer_start(timer, time, HRTIMER_MODE_ABS_PINNED_HARD); |
2730 | } |
2731 | |
2732 | /* |
2733 | @@ -280,7 +281,6 @@ static void __hrtick_start(void *arg) |
2734 | void hrtick_start(struct rq *rq, u64 delay) |
2735 | { |
2736 | struct hrtimer *timer = &rq->hrtick_timer; |
2737 | - ktime_t time; |
2738 | s64 delta; |
2739 | |
2740 | /* |
2741 | @@ -288,9 +288,7 @@ void hrtick_start(struct rq *rq, u64 delay) |
2742 | * doesn't make sense and can cause timer DoS. |
2743 | */ |
2744 | delta = max_t(s64, delay, 10000LL); |
2745 | - time = ktime_add_ns(timer->base->get_time(), delta); |
2746 | - |
2747 | - hrtimer_set_expires(timer, time); |
2748 | + rq->hrtick_time = ktime_add_ns(timer->base->get_time(), delta); |
2749 | |
2750 | if (rq == this_rq()) { |
2751 | __hrtick_restart(rq); |
2752 | diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
2753 | index e10fb9bf2988c..4e490e3db2f86 100644 |
2754 | --- a/kernel/sched/sched.h |
2755 | +++ b/kernel/sched/sched.h |
2756 | @@ -973,6 +973,7 @@ struct rq { |
2757 | call_single_data_t hrtick_csd; |
2758 | #endif |
2759 | struct hrtimer hrtick_timer; |
2760 | + ktime_t hrtick_time; |
2761 | #endif |
2762 | |
2763 | #ifdef CONFIG_SCHEDSTATS |
2764 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
2765 | index 2cd4c7f43dcd9..4033b6ce01c40 100644 |
2766 | --- a/mm/hugetlb.c |
2767 | +++ b/mm/hugetlb.c |
2768 | @@ -4902,21 +4902,23 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr) |
2769 | void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, |
2770 | unsigned long *start, unsigned long *end) |
2771 | { |
2772 | - unsigned long a_start, a_end; |
2773 | + unsigned long v_start = ALIGN(vma->vm_start, PUD_SIZE), |
2774 | + v_end = ALIGN_DOWN(vma->vm_end, PUD_SIZE); |
2775 | |
2776 | - if (!(vma->vm_flags & VM_MAYSHARE)) |
2777 | + /* |
2778 | + * vma need span at least one aligned PUD size and the start,end range |
2779 | + * must at least partialy within it. |
2780 | + */ |
2781 | + if (!(vma->vm_flags & VM_MAYSHARE) || !(v_end > v_start) || |
2782 | + (*end <= v_start) || (*start >= v_end)) |
2783 | return; |
2784 | |
2785 | /* Extend the range to be PUD aligned for a worst case scenario */ |
2786 | - a_start = ALIGN_DOWN(*start, PUD_SIZE); |
2787 | - a_end = ALIGN(*end, PUD_SIZE); |
2788 | + if (*start > v_start) |
2789 | + *start = ALIGN_DOWN(*start, PUD_SIZE); |
2790 | |
2791 | - /* |
2792 | - * Intersect the range with the vma range, since pmd sharing won't be |
2793 | - * across vma after all |
2794 | - */ |
2795 | - *start = max(vma->vm_start, a_start); |
2796 | - *end = min(vma->vm_end, a_end); |
2797 | + if (*end < v_end) |
2798 | + *end = ALIGN(*end, PUD_SIZE); |
2799 | } |
2800 | |
2801 | /* |
2802 | diff --git a/mm/page_io.c b/mm/page_io.c |
2803 | index 60a66a58b9bf9..bcf27d0572534 100644 |
2804 | --- a/mm/page_io.c |
2805 | +++ b/mm/page_io.c |
2806 | @@ -260,11 +260,6 @@ out: |
2807 | return ret; |
2808 | } |
2809 | |
2810 | -static sector_t swap_page_sector(struct page *page) |
2811 | -{ |
2812 | - return (sector_t)__page_file_index(page) << (PAGE_SHIFT - 9); |
2813 | -} |
2814 | - |
2815 | static inline void count_swpout_vm_event(struct page *page) |
2816 | { |
2817 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2818 | diff --git a/mm/swapfile.c b/mm/swapfile.c |
2819 | index 7947633d3cede..f6964212c6c8f 100644 |
2820 | --- a/mm/swapfile.c |
2821 | +++ b/mm/swapfile.c |
2822 | @@ -221,6 +221,19 @@ offset_to_swap_extent(struct swap_info_struct *sis, unsigned long offset) |
2823 | BUG(); |
2824 | } |
2825 | |
2826 | +sector_t swap_page_sector(struct page *page) |
2827 | +{ |
2828 | + struct swap_info_struct *sis = page_swap_info(page); |
2829 | + struct swap_extent *se; |
2830 | + sector_t sector; |
2831 | + pgoff_t offset; |
2832 | + |
2833 | + offset = __page_file_index(page); |
2834 | + se = offset_to_swap_extent(sis, offset); |
2835 | + sector = se->start_block + (offset - se->start_page); |
2836 | + return sector << (PAGE_SHIFT - 9); |
2837 | +} |
2838 | + |
2839 | /* |
2840 | * swap allocation tell device that a cluster of swap can now be discarded, |
2841 | * to allow the swap device to optimize its wear-levelling. |
2842 | diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c |
2843 | index 8a72a3b3837b4..443b3b1c95818 100644 |
2844 | --- a/mm/zsmalloc.c |
2845 | +++ b/mm/zsmalloc.c |
2846 | @@ -2216,11 +2216,13 @@ static unsigned long zs_can_compact(struct size_class *class) |
2847 | return obj_wasted * class->pages_per_zspage; |
2848 | } |
2849 | |
2850 | -static void __zs_compact(struct zs_pool *pool, struct size_class *class) |
2851 | +static unsigned long __zs_compact(struct zs_pool *pool, |
2852 | + struct size_class *class) |
2853 | { |
2854 | struct zs_compact_control cc; |
2855 | struct zspage *src_zspage; |
2856 | struct zspage *dst_zspage = NULL; |
2857 | + unsigned long pages_freed = 0; |
2858 | |
2859 | spin_lock(&class->lock); |
2860 | while ((src_zspage = isolate_zspage(class, true))) { |
2861 | @@ -2250,7 +2252,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class) |
2862 | putback_zspage(class, dst_zspage); |
2863 | if (putback_zspage(class, src_zspage) == ZS_EMPTY) { |
2864 | free_zspage(pool, class, src_zspage); |
2865 | - pool->stats.pages_compacted += class->pages_per_zspage; |
2866 | + pages_freed += class->pages_per_zspage; |
2867 | } |
2868 | spin_unlock(&class->lock); |
2869 | cond_resched(); |
2870 | @@ -2261,12 +2263,15 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class) |
2871 | putback_zspage(class, src_zspage); |
2872 | |
2873 | spin_unlock(&class->lock); |
2874 | + |
2875 | + return pages_freed; |
2876 | } |
2877 | |
2878 | unsigned long zs_compact(struct zs_pool *pool) |
2879 | { |
2880 | int i; |
2881 | struct size_class *class; |
2882 | + unsigned long pages_freed = 0; |
2883 | |
2884 | for (i = ZS_SIZE_CLASSES - 1; i >= 0; i--) { |
2885 | class = pool->size_class[i]; |
2886 | @@ -2274,10 +2279,11 @@ unsigned long zs_compact(struct zs_pool *pool) |
2887 | continue; |
2888 | if (class->index != i) |
2889 | continue; |
2890 | - __zs_compact(pool, class); |
2891 | + pages_freed += __zs_compact(pool, class); |
2892 | } |
2893 | + atomic_long_add(pages_freed, &pool->stats.pages_compacted); |
2894 | |
2895 | - return pool->stats.pages_compacted; |
2896 | + return pages_freed; |
2897 | } |
2898 | EXPORT_SYMBOL_GPL(zs_compact); |
2899 | |
2900 | @@ -2294,13 +2300,12 @@ static unsigned long zs_shrinker_scan(struct shrinker *shrinker, |
2901 | struct zs_pool *pool = container_of(shrinker, struct zs_pool, |
2902 | shrinker); |
2903 | |
2904 | - pages_freed = pool->stats.pages_compacted; |
2905 | /* |
2906 | * Compact classes and calculate compaction delta. |
2907 | * Can run concurrently with a manually triggered |
2908 | * (by user) compaction. |
2909 | */ |
2910 | - pages_freed = zs_compact(pool) - pages_freed; |
2911 | + pages_freed = zs_compact(pool); |
2912 | |
2913 | return pages_freed ? pages_freed : SHRINK_STOP; |
2914 | } |
2915 | diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c |
2916 | index 9c711f0dfae35..be2d469d6369d 100644 |
2917 | --- a/net/bluetooth/amp.c |
2918 | +++ b/net/bluetooth/amp.c |
2919 | @@ -297,6 +297,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, |
2920 | struct hci_request req; |
2921 | int err; |
2922 | |
2923 | + if (!mgr) |
2924 | + return; |
2925 | + |
2926 | cp.phy_handle = hcon->handle; |
2927 | cp.len_so_far = cpu_to_le16(0); |
2928 | cp.max_len = cpu_to_le16(hdev->amp_assoc_size); |
2929 | diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c |
2930 | index 7a59cdddd3ce3..5047e9c2333a2 100644 |
2931 | --- a/net/bridge/br_sysfs_if.c |
2932 | +++ b/net/bridge/br_sysfs_if.c |
2933 | @@ -55,9 +55,8 @@ static BRPORT_ATTR(_name, 0644, \ |
2934 | static int store_flag(struct net_bridge_port *p, unsigned long v, |
2935 | unsigned long mask) |
2936 | { |
2937 | - unsigned long flags; |
2938 | - |
2939 | - flags = p->flags; |
2940 | + unsigned long flags = p->flags; |
2941 | + int err; |
2942 | |
2943 | if (v) |
2944 | flags |= mask; |
2945 | @@ -65,6 +64,10 @@ static int store_flag(struct net_bridge_port *p, unsigned long v, |
2946 | flags &= ~mask; |
2947 | |
2948 | if (flags != p->flags) { |
2949 | + err = br_switchdev_set_port_flag(p, flags, mask); |
2950 | + if (err) |
2951 | + return err; |
2952 | + |
2953 | p->flags = flags; |
2954 | br_port_flags_change(p, mask); |
2955 | } |
2956 | diff --git a/net/core/dev.c b/net/core/dev.c |
2957 | index d90e8bd87df83..e732faade5dca 100644 |
2958 | --- a/net/core/dev.c |
2959 | +++ b/net/core/dev.c |
2960 | @@ -8144,6 +8144,48 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, |
2961 | } |
2962 | EXPORT_SYMBOL(dev_set_mac_address); |
2963 | |
2964 | +static DECLARE_RWSEM(dev_addr_sem); |
2965 | + |
2966 | +int dev_set_mac_address_user(struct net_device *dev, struct sockaddr *sa, |
2967 | + struct netlink_ext_ack *extack) |
2968 | +{ |
2969 | + int ret; |
2970 | + |
2971 | + down_write(&dev_addr_sem); |
2972 | + ret = dev_set_mac_address(dev, sa, extack); |
2973 | + up_write(&dev_addr_sem); |
2974 | + return ret; |
2975 | +} |
2976 | +EXPORT_SYMBOL(dev_set_mac_address_user); |
2977 | + |
2978 | +int dev_get_mac_address(struct sockaddr *sa, struct net *net, char *dev_name) |
2979 | +{ |
2980 | + size_t size = sizeof(sa->sa_data); |
2981 | + struct net_device *dev; |
2982 | + int ret = 0; |
2983 | + |
2984 | + down_read(&dev_addr_sem); |
2985 | + rcu_read_lock(); |
2986 | + |
2987 | + dev = dev_get_by_name_rcu(net, dev_name); |
2988 | + if (!dev) { |
2989 | + ret = -ENODEV; |
2990 | + goto unlock; |
2991 | + } |
2992 | + if (!dev->addr_len) |
2993 | + memset(sa->sa_data, 0, size); |
2994 | + else |
2995 | + memcpy(sa->sa_data, dev->dev_addr, |
2996 | + min_t(size_t, size, dev->addr_len)); |
2997 | + sa->sa_family = dev->type; |
2998 | + |
2999 | +unlock: |
3000 | + rcu_read_unlock(); |
3001 | + up_read(&dev_addr_sem); |
3002 | + return ret; |
3003 | +} |
3004 | +EXPORT_SYMBOL(dev_get_mac_address); |
3005 | + |
3006 | /** |
3007 | * dev_change_carrier - Change device carrier |
3008 | * @dev: device |
3009 | diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c |
3010 | index 5163d900bb4fb..69fb9219d51dd 100644 |
3011 | --- a/net/core/dev_ioctl.c |
3012 | +++ b/net/core/dev_ioctl.c |
3013 | @@ -122,17 +122,6 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm |
3014 | ifr->ifr_mtu = dev->mtu; |
3015 | return 0; |
3016 | |
3017 | - case SIOCGIFHWADDR: |
3018 | - if (!dev->addr_len) |
3019 | - memset(ifr->ifr_hwaddr.sa_data, 0, |
3020 | - sizeof(ifr->ifr_hwaddr.sa_data)); |
3021 | - else |
3022 | - memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, |
3023 | - min(sizeof(ifr->ifr_hwaddr.sa_data), |
3024 | - (size_t)dev->addr_len)); |
3025 | - ifr->ifr_hwaddr.sa_family = dev->type; |
3026 | - return 0; |
3027 | - |
3028 | case SIOCGIFSLAVE: |
3029 | err = -EINVAL; |
3030 | break; |
3031 | @@ -246,7 +235,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) |
3032 | case SIOCSIFHWADDR: |
3033 | if (dev->addr_len > sizeof(struct sockaddr)) |
3034 | return -EINVAL; |
3035 | - return dev_set_mac_address(dev, &ifr->ifr_hwaddr, NULL); |
3036 | + return dev_set_mac_address_user(dev, &ifr->ifr_hwaddr, NULL); |
3037 | |
3038 | case SIOCSIFHWBROADCAST: |
3039 | if (ifr->ifr_hwaddr.sa_family != dev->type) |
3040 | @@ -396,6 +385,12 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c |
3041 | */ |
3042 | |
3043 | switch (cmd) { |
3044 | + case SIOCGIFHWADDR: |
3045 | + dev_load(net, ifr->ifr_name); |
3046 | + ret = dev_get_mac_address(&ifr->ifr_hwaddr, net, ifr->ifr_name); |
3047 | + if (colon) |
3048 | + *colon = ':'; |
3049 | + return ret; |
3050 | /* |
3051 | * These ioctl calls: |
3052 | * - can be done by all. |
3053 | @@ -405,7 +400,6 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c |
3054 | case SIOCGIFFLAGS: |
3055 | case SIOCGIFMETRIC: |
3056 | case SIOCGIFMTU: |
3057 | - case SIOCGIFHWADDR: |
3058 | case SIOCGIFSLAVE: |
3059 | case SIOCGIFMAP: |
3060 | case SIOCGIFINDEX: |
3061 | diff --git a/net/core/pktgen.c b/net/core/pktgen.c |
3062 | index cb3b565ff5adc..1d20dd70879bb 100644 |
3063 | --- a/net/core/pktgen.c |
3064 | +++ b/net/core/pktgen.c |
3065 | @@ -3465,7 +3465,7 @@ static int pktgen_thread_worker(void *arg) |
3066 | struct pktgen_dev *pkt_dev = NULL; |
3067 | int cpu = t->cpu; |
3068 | |
3069 | - BUG_ON(smp_processor_id() != cpu); |
3070 | + WARN_ON(smp_processor_id() != cpu); |
3071 | |
3072 | init_waitqueue_head(&t->queue); |
3073 | complete(&t->start_done); |
3074 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
3075 | index b0c06a0637765..73c09b5864d70 100644 |
3076 | --- a/net/core/rtnetlink.c |
3077 | +++ b/net/core/rtnetlink.c |
3078 | @@ -2471,7 +2471,7 @@ static int do_setlink(const struct sk_buff *skb, |
3079 | sa->sa_family = dev->type; |
3080 | memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]), |
3081 | dev->addr_len); |
3082 | - err = dev_set_mac_address(dev, sa, extack); |
3083 | + err = dev_set_mac_address_user(dev, sa, extack); |
3084 | kfree(sa); |
3085 | if (err) |
3086 | goto errout; |
3087 | diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
3088 | index 45117fa299837..99d6f4d1297ca 100644 |
3089 | --- a/net/core/skbuff.c |
3090 | +++ b/net/core/skbuff.c |
3091 | @@ -3290,7 +3290,19 @@ EXPORT_SYMBOL(skb_split); |
3092 | */ |
3093 | static int skb_prepare_for_shift(struct sk_buff *skb) |
3094 | { |
3095 | - return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
3096 | + int ret = 0; |
3097 | + |
3098 | + if (skb_cloned(skb)) { |
3099 | + /* Save and restore truesize: pskb_expand_head() may reallocate |
3100 | + * memory where ksize(kmalloc(S)) != ksize(kmalloc(S)), but we |
3101 | + * cannot change truesize at this point. |
3102 | + */ |
3103 | + unsigned int save_truesize = skb->truesize; |
3104 | + |
3105 | + ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
3106 | + skb->truesize = save_truesize; |
3107 | + } |
3108 | + return ret; |
3109 | } |
3110 | |
3111 | /** |
3112 | diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c |
3113 | index fdced0a7bd776..bbc1924d64e51 100644 |
3114 | --- a/net/iucv/af_iucv.c |
3115 | +++ b/net/iucv/af_iucv.c |
3116 | @@ -2176,7 +2176,6 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, |
3117 | char nullstring[8]; |
3118 | |
3119 | if (!pskb_may_pull(skb, sizeof(*trans_hdr))) { |
3120 | - WARN_ONCE(1, "AF_IUCV failed to receive skb, len=%u", skb->len); |
3121 | kfree_skb(skb); |
3122 | return NET_RX_SUCCESS; |
3123 | } |
3124 | diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c |
3125 | index 9c4308077574c..5e75ff2e1b14f 100644 |
3126 | --- a/security/smack/smackfs.c |
3127 | +++ b/security/smack/smackfs.c |
3128 | @@ -1163,7 +1163,7 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf, |
3129 | return -EPERM; |
3130 | if (*ppos != 0) |
3131 | return -EINVAL; |
3132 | - if (count < SMK_NETLBLADDRMIN) |
3133 | + if (count < SMK_NETLBLADDRMIN || count > PAGE_SIZE - 1) |
3134 | return -EINVAL; |
3135 | |
3136 | data = memdup_user_nul(buf, count); |
3137 | @@ -1423,7 +1423,7 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf, |
3138 | return -EPERM; |
3139 | if (*ppos != 0) |
3140 | return -EINVAL; |
3141 | - if (count < SMK_NETLBLADDRMIN) |
3142 | + if (count < SMK_NETLBLADDRMIN || count > PAGE_SIZE - 1) |
3143 | return -EINVAL; |
3144 | |
3145 | data = memdup_user_nul(buf, count); |
3146 | @@ -1830,6 +1830,10 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf, |
3147 | if (!smack_privileged(CAP_MAC_ADMIN)) |
3148 | return -EPERM; |
3149 | |
3150 | + /* Enough data must be present */ |
3151 | + if (count == 0 || count > PAGE_SIZE) |
3152 | + return -EINVAL; |
3153 | + |
3154 | data = memdup_user_nul(buf, count); |
3155 | if (IS_ERR(data)) |
3156 | return PTR_ERR(data); |
3157 | @@ -2001,6 +2005,9 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf, |
3158 | if (!smack_privileged(CAP_MAC_ADMIN)) |
3159 | return -EPERM; |
3160 | |
3161 | + if (count > PAGE_SIZE) |
3162 | + return -EINVAL; |
3163 | + |
3164 | data = memdup_user_nul(buf, count); |
3165 | if (IS_ERR(data)) |
3166 | return PTR_ERR(data); |
3167 | @@ -2088,6 +2095,9 @@ static ssize_t smk_write_unconfined(struct file *file, const char __user *buf, |
3168 | if (!smack_privileged(CAP_MAC_ADMIN)) |
3169 | return -EPERM; |
3170 | |
3171 | + if (count > PAGE_SIZE) |
3172 | + return -EINVAL; |
3173 | + |
3174 | data = memdup_user_nul(buf, count); |
3175 | if (IS_ERR(data)) |
3176 | return PTR_ERR(data); |
3177 | @@ -2643,6 +2653,10 @@ static ssize_t smk_write_syslog(struct file *file, const char __user *buf, |
3178 | if (!smack_privileged(CAP_MAC_ADMIN)) |
3179 | return -EPERM; |
3180 | |
3181 | + /* Enough data must be present */ |
3182 | + if (count == 0 || count > PAGE_SIZE) |
3183 | + return -EINVAL; |
3184 | + |
3185 | data = memdup_user_nul(buf, count); |
3186 | if (IS_ERR(data)) |
3187 | return PTR_ERR(data); |
3188 | @@ -2735,10 +2749,13 @@ static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf, |
3189 | return -EPERM; |
3190 | |
3191 | /* |
3192 | + * No partial write. |
3193 | * Enough data must be present. |
3194 | */ |
3195 | if (*ppos != 0) |
3196 | return -EINVAL; |
3197 | + if (count == 0 || count > PAGE_SIZE) |
3198 | + return -EINVAL; |
3199 | |
3200 | data = memdup_user_nul(buf, count); |
3201 | if (IS_ERR(data)) |
3202 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3203 | index a132fe4537a55..1283796316b62 100644 |
3204 | --- a/sound/pci/hda/patch_realtek.c |
3205 | +++ b/sound/pci/hda/patch_realtek.c |
3206 | @@ -2522,6 +2522,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
3207 | SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), |
3208 | SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), |
3209 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
3210 | + SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS), |
3211 | SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), |
3212 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
3213 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
3214 | @@ -6320,6 +6321,7 @@ enum { |
3215 | ALC269_FIXUP_LEMOTE_A1802, |
3216 | ALC269_FIXUP_LEMOTE_A190X, |
3217 | ALC256_FIXUP_INTEL_NUC8_RUGGED, |
3218 | + ALC256_FIXUP_INTEL_NUC10, |
3219 | ALC255_FIXUP_XIAOMI_HEADSET_MIC, |
3220 | ALC274_FIXUP_HP_MIC, |
3221 | ALC274_FIXUP_HP_HEADSET_MIC, |
3222 | @@ -7697,6 +7699,15 @@ static const struct hda_fixup alc269_fixups[] = { |
3223 | .chained = true, |
3224 | .chain_id = ALC269_FIXUP_HEADSET_MODE |
3225 | }, |
3226 | + [ALC256_FIXUP_INTEL_NUC10] = { |
3227 | + .type = HDA_FIXUP_PINS, |
3228 | + .v.pins = (const struct hda_pintbl[]) { |
3229 | + { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
3230 | + { } |
3231 | + }, |
3232 | + .chained = true, |
3233 | + .chain_id = ALC269_FIXUP_HEADSET_MODE |
3234 | + }, |
3235 | [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = { |
3236 | .type = HDA_FIXUP_VERBS, |
3237 | .v.verbs = (const struct hda_verb[]) { |
3238 | @@ -8001,6 +8012,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3239 | SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3240 | SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), |
3241 | SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), |
3242 | + SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC), |
3243 | SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3244 | SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3245 | SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3246 | @@ -8095,6 +8107,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3247 | SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
3248 | SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
3249 | SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), |
3250 | + SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10), |
3251 | |
3252 | #if 0 |
3253 | /* Below is a quirk table taken from the old code. |
3254 | diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
3255 | index 6012367f6fe48..9ee610504bac9 100644 |
3256 | --- a/sound/soc/intel/boards/bytcr_rt5640.c |
3257 | +++ b/sound/soc/intel/boards/bytcr_rt5640.c |
3258 | @@ -400,6 +400,19 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
3259 | BYT_RT5640_SSP0_AIF1 | |
3260 | BYT_RT5640_MCLK_EN), |
3261 | }, |
3262 | + { /* Acer One 10 S1002 */ |
3263 | + .matches = { |
3264 | + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
3265 | + DMI_MATCH(DMI_PRODUCT_NAME, "One S1002"), |
3266 | + }, |
3267 | + .driver_data = (void *)(BYT_RT5640_IN1_MAP | |
3268 | + BYT_RT5640_JD_SRC_JD2_IN4N | |
3269 | + BYT_RT5640_OVCD_TH_2000UA | |
3270 | + BYT_RT5640_OVCD_SF_0P75 | |
3271 | + BYT_RT5640_DIFF_MIC | |
3272 | + BYT_RT5640_SSP0_AIF2 | |
3273 | + BYT_RT5640_MCLK_EN), |
3274 | + }, |
3275 | { |
3276 | .matches = { |
3277 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
3278 | @@ -513,6 +526,16 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
3279 | BYT_RT5640_MONO_SPEAKER | |
3280 | BYT_RT5640_MCLK_EN), |
3281 | }, |
3282 | + { /* Estar Beauty HD MID 7316R */ |
3283 | + .matches = { |
3284 | + DMI_MATCH(DMI_SYS_VENDOR, "Estar"), |
3285 | + DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"), |
3286 | + }, |
3287 | + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | |
3288 | + BYT_RT5640_MONO_SPEAKER | |
3289 | + BYT_RT5640_SSP0_AIF1 | |
3290 | + BYT_RT5640_MCLK_EN), |
3291 | + }, |
3292 | { |
3293 | .matches = { |
3294 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
3295 | @@ -776,6 +799,20 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
3296 | BYT_RT5640_SSP0_AIF2 | |
3297 | BYT_RT5640_MCLK_EN), |
3298 | }, |
3299 | + { /* Voyo Winpad A15 */ |
3300 | + .matches = { |
3301 | + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), |
3302 | + DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), |
3303 | + /* Above strings are too generic, also match on BIOS date */ |
3304 | + DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"), |
3305 | + }, |
3306 | + .driver_data = (void *)(BYT_RT5640_IN1_MAP | |
3307 | + BYT_RT5640_JD_SRC_JD2_IN4N | |
3308 | + BYT_RT5640_OVCD_TH_2000UA | |
3309 | + BYT_RT5640_OVCD_SF_0P75 | |
3310 | + BYT_RT5640_DIFF_MIC | |
3311 | + BYT_RT5640_MCLK_EN), |
3312 | + }, |
3313 | { /* Catch-all for generic Insyde tablets, must be last */ |
3314 | .matches = { |
3315 | DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), |
3316 | diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c |
3317 | index 4606f6f582d6f..921c09cdb4800 100644 |
3318 | --- a/sound/soc/intel/boards/bytcr_rt5651.c |
3319 | +++ b/sound/soc/intel/boards/bytcr_rt5651.c |
3320 | @@ -435,6 +435,19 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = { |
3321 | BYT_RT5651_SSP0_AIF1 | |
3322 | BYT_RT5651_MONO_SPEAKER), |
3323 | }, |
3324 | + { |
3325 | + /* Jumper EZpad 7 */ |
3326 | + .callback = byt_rt5651_quirk_cb, |
3327 | + .matches = { |
3328 | + DMI_MATCH(DMI_SYS_VENDOR, "Jumper"), |
3329 | + DMI_MATCH(DMI_PRODUCT_NAME, "EZpad"), |
3330 | + /* Jumper12x.WJ2012.bsBKRCP05 with the version dropped */ |
3331 | + DMI_MATCH(DMI_BIOS_VERSION, "Jumper12x.WJ2012.bsBKRCP"), |
3332 | + }, |
3333 | + .driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS | |
3334 | + BYT_RT5651_IN2_MAP | |
3335 | + BYT_RT5651_JD_NOT_INV), |
3336 | + }, |
3337 | { |
3338 | /* KIANO SlimNote 14.2 */ |
3339 | .callback = byt_rt5651_quirk_cb, |
3340 | diff --git a/sound/soc/intel/common/soc-intel-quirks.h b/sound/soc/intel/common/soc-intel-quirks.h |
3341 | index 863a477d34051..645baf0ed3dd1 100644 |
3342 | --- a/sound/soc/intel/common/soc-intel-quirks.h |
3343 | +++ b/sound/soc/intel/common/soc-intel-quirks.h |
3344 | @@ -11,6 +11,7 @@ |
3345 | |
3346 | #if IS_ENABLED(CONFIG_X86) |
3347 | |
3348 | +#include <linux/dmi.h> |
3349 | #include <asm/cpu_device_id.h> |
3350 | #include <asm/intel-family.h> |
3351 | #include <asm/iosf_mbi.h> |
3352 | @@ -40,12 +41,36 @@ SOC_INTEL_IS_CPU(cml, INTEL_FAM6_KABYLAKE_L); |
3353 | |
3354 | static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) |
3355 | { |
3356 | + /* |
3357 | + * List of systems which: |
3358 | + * 1. Use a non CR version of the Bay Trail SoC |
3359 | + * 2. Contain at least 6 interrupt resources so that the |
3360 | + * platform_get_resource(pdev, IORESOURCE_IRQ, 5) check below |
3361 | + * succeeds |
3362 | + * 3. Despite 1. and 2. still have their IPC IRQ at index 0 rather then 5 |
3363 | + * |
3364 | + * This needs to be here so that it can be shared between the SST and |
3365 | + * SOF drivers. We rely on the compiler to optimize this out in files |
3366 | + * where soc_intel_is_byt_cr is not used. |
3367 | + */ |
3368 | + static const struct dmi_system_id force_bytcr_table[] = { |
3369 | + { /* Lenovo Yoga Tablet 2 series */ |
3370 | + .matches = { |
3371 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
3372 | + DMI_MATCH(DMI_PRODUCT_FAMILY, "YOGATablet2"), |
3373 | + }, |
3374 | + }, |
3375 | + {} |
3376 | + }; |
3377 | struct device *dev = &pdev->dev; |
3378 | int status = 0; |
3379 | |
3380 | if (!soc_intel_is_byt()) |
3381 | return false; |
3382 | |
3383 | + if (dmi_check_system(force_bytcr_table)) |
3384 | + return true; |
3385 | + |
3386 | if (iosf_mbi_available()) { |
3387 | u32 bios_status; |
3388 |