Contents of /trunk/kernel-alx/patches-4.9/0189-4.9.90-all-fixes.patch
Parent Directory | Revision Log
Revision 3166 -
(show annotations)
(download)
Wed Aug 8 14:17:23 2018 UTC (6 years, 1 month ago) by niro
File size: 210324 byte(s)
Wed Aug 8 14:17:23 2018 UTC (6 years, 1 month ago) by niro
File size: 210324 byte(s)
-linux-4.9.90
1 | diff --git a/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt b/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt |
2 | deleted file mode 100644 |
3 | index 7175dc3740ac..000000000000 |
4 | --- a/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt |
5 | +++ /dev/null |
6 | @@ -1,30 +0,0 @@ |
7 | -Toppoly TD028TTEC1 Panel |
8 | -======================== |
9 | - |
10 | -Required properties: |
11 | -- compatible: "toppoly,td028ttec1" |
12 | - |
13 | -Optional properties: |
14 | -- label: a symbolic name for the panel |
15 | - |
16 | -Required nodes: |
17 | -- Video port for DPI input |
18 | - |
19 | -Example |
20 | -------- |
21 | - |
22 | -lcd-panel: td028ttec1@0 { |
23 | - compatible = "toppoly,td028ttec1"; |
24 | - reg = <0>; |
25 | - spi-max-frequency = <100000>; |
26 | - spi-cpol; |
27 | - spi-cpha; |
28 | - |
29 | - label = "lcd"; |
30 | - port { |
31 | - lcd_in: endpoint { |
32 | - remote-endpoint = <&dpi_out>; |
33 | - }; |
34 | - }; |
35 | -}; |
36 | - |
37 | diff --git a/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt b/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt |
38 | new file mode 100644 |
39 | index 000000000000..ed34253d9fb1 |
40 | --- /dev/null |
41 | +++ b/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt |
42 | @@ -0,0 +1,30 @@ |
43 | +Toppoly TD028TTEC1 Panel |
44 | +======================== |
45 | + |
46 | +Required properties: |
47 | +- compatible: "tpo,td028ttec1" |
48 | + |
49 | +Optional properties: |
50 | +- label: a symbolic name for the panel |
51 | + |
52 | +Required nodes: |
53 | +- Video port for DPI input |
54 | + |
55 | +Example |
56 | +------- |
57 | + |
58 | +lcd-panel: td028ttec1@0 { |
59 | + compatible = "tpo,td028ttec1"; |
60 | + reg = <0>; |
61 | + spi-max-frequency = <100000>; |
62 | + spi-cpol; |
63 | + spi-cpha; |
64 | + |
65 | + label = "lcd"; |
66 | + port { |
67 | + lcd_in: endpoint { |
68 | + remote-endpoint = <&dpi_out>; |
69 | + }; |
70 | + }; |
71 | +}; |
72 | + |
73 | diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt |
74 | index 8f3ad9ab4637..b41d2601c6ba 100644 |
75 | --- a/Documentation/devicetree/bindings/mfd/axp20x.txt |
76 | +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt |
77 | @@ -28,6 +28,9 @@ Optional properties: |
78 | regulator to drive the OTG VBus, rather then as an input pin |
79 | which signals whether the board is driving OTG VBus or not. |
80 | |
81 | +- x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is |
82 | + wired for master mode. The default is slave mode. |
83 | + |
84 | - <input>-supply: a phandle to the regulator supply node. May be omitted if |
85 | inputs are unregulated, such as using the IPSOUT output |
86 | from the PMIC. |
87 | diff --git a/Makefile b/Makefile |
88 | index 16dca98900e7..df3b20af0fdb 100644 |
89 | --- a/Makefile |
90 | +++ b/Makefile |
91 | @@ -1,6 +1,6 @@ |
92 | VERSION = 4 |
93 | PATCHLEVEL = 9 |
94 | -SUBLEVEL = 89 |
95 | +SUBLEVEL = 90 |
96 | EXTRAVERSION = |
97 | NAME = Roaring Lionus |
98 | |
99 | diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c |
100 | index 6a61deed4a85..ab228ed45945 100644 |
101 | --- a/arch/alpha/kernel/console.c |
102 | +++ b/arch/alpha/kernel/console.c |
103 | @@ -20,6 +20,7 @@ |
104 | struct pci_controller *pci_vga_hose; |
105 | static struct resource alpha_vga = { |
106 | .name = "alpha-vga+", |
107 | + .flags = IORESOURCE_IO, |
108 | .start = 0x3C0, |
109 | .end = 0x3DF |
110 | }; |
111 | diff --git a/arch/arm/boot/dts/aspeed-ast2500-evb.dts b/arch/arm/boot/dts/aspeed-ast2500-evb.dts |
112 | index 1b7a5ff0e533..d7774d35e466 100644 |
113 | --- a/arch/arm/boot/dts/aspeed-ast2500-evb.dts |
114 | +++ b/arch/arm/boot/dts/aspeed-ast2500-evb.dts |
115 | @@ -15,7 +15,7 @@ |
116 | bootargs = "console=ttyS4,115200 earlyprintk"; |
117 | }; |
118 | |
119 | - memory { |
120 | + memory@80000000 { |
121 | reg = <0x80000000 0x20000000>; |
122 | }; |
123 | }; |
124 | diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c |
125 | index 3f1759411d51..414e60ed0257 100644 |
126 | --- a/arch/arm/kernel/ftrace.c |
127 | +++ b/arch/arm/kernel/ftrace.c |
128 | @@ -29,11 +29,6 @@ |
129 | #endif |
130 | |
131 | #ifdef CONFIG_DYNAMIC_FTRACE |
132 | -#ifdef CONFIG_OLD_MCOUNT |
133 | -#define OLD_MCOUNT_ADDR ((unsigned long) mcount) |
134 | -#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) |
135 | - |
136 | -#define OLD_NOP 0xe1a00000 /* mov r0, r0 */ |
137 | |
138 | static int __ftrace_modify_code(void *data) |
139 | { |
140 | @@ -51,6 +46,12 @@ void arch_ftrace_update_code(int command) |
141 | stop_machine(__ftrace_modify_code, &command, NULL); |
142 | } |
143 | |
144 | +#ifdef CONFIG_OLD_MCOUNT |
145 | +#define OLD_MCOUNT_ADDR ((unsigned long) mcount) |
146 | +#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) |
147 | + |
148 | +#define OLD_NOP 0xe1a00000 /* mov r0, r0 */ |
149 | + |
150 | static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec) |
151 | { |
152 | return rec->arch.old_mcount ? OLD_NOP : NOP; |
153 | diff --git a/arch/arm/mach-omap2/clockdomains7xx_data.c b/arch/arm/mach-omap2/clockdomains7xx_data.c |
154 | index ef9ed36e8a61..e3416b40e82b 100644 |
155 | --- a/arch/arm/mach-omap2/clockdomains7xx_data.c |
156 | +++ b/arch/arm/mach-omap2/clockdomains7xx_data.c |
157 | @@ -524,7 +524,7 @@ static struct clockdomain pcie_7xx_clkdm = { |
158 | .dep_bit = DRA7XX_PCIE_STATDEP_SHIFT, |
159 | .wkdep_srcs = pcie_wkup_sleep_deps, |
160 | .sleepdep_srcs = pcie_wkup_sleep_deps, |
161 | - .flags = CLKDM_CAN_HWSUP_SWSUP, |
162 | + .flags = CLKDM_CAN_SWSUP, |
163 | }; |
164 | |
165 | static struct clockdomain atl_7xx_clkdm = { |
166 | diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c |
167 | index 6ab0ae7d6535..d1d945c6bd05 100644 |
168 | --- a/arch/ia64/kernel/module.c |
169 | +++ b/arch/ia64/kernel/module.c |
170 | @@ -153,7 +153,7 @@ slot (const struct insn *insn) |
171 | static int |
172 | apply_imm64 (struct module *mod, struct insn *insn, uint64_t val) |
173 | { |
174 | - if (slot(insn) != 2) { |
175 | + if (slot(insn) != 1 && slot(insn) != 2) { |
176 | printk(KERN_ERR "%s: invalid slot number %d for IMM64\n", |
177 | mod->name, slot(insn)); |
178 | return 0; |
179 | @@ -165,7 +165,7 @@ apply_imm64 (struct module *mod, struct insn *insn, uint64_t val) |
180 | static int |
181 | apply_imm60 (struct module *mod, struct insn *insn, uint64_t val) |
182 | { |
183 | - if (slot(insn) != 2) { |
184 | + if (slot(insn) != 1 && slot(insn) != 2) { |
185 | printk(KERN_ERR "%s: invalid slot number %d for IMM60\n", |
186 | mod->name, slot(insn)); |
187 | return 0; |
188 | diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h |
189 | index ab68d0ee7725..4e54282c29b4 100644 |
190 | --- a/arch/powerpc/include/asm/cputable.h |
191 | +++ b/arch/powerpc/include/asm/cputable.h |
192 | @@ -474,7 +474,8 @@ enum { |
193 | CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ |
194 | CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ |
195 | CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_ARCH_300) |
196 | -#define CPU_FTRS_POWER9_DD1 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD1) |
197 | +#define CPU_FTRS_POWER9_DD1 ((CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD1) & \ |
198 | + (~CPU_FTR_SAO)) |
199 | #define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
200 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
201 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
202 | diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c |
203 | index a587e8f4fd26..4b4e927c4822 100644 |
204 | --- a/arch/powerpc/kvm/book3s_64_mmu_host.c |
205 | +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c |
206 | @@ -177,12 +177,15 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte, |
207 | ret = mmu_hash_ops.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags, |
208 | hpsize, hpsize, MMU_SEGSIZE_256M); |
209 | |
210 | - if (ret < 0) { |
211 | + if (ret == -1) { |
212 | /* If we couldn't map a primary PTE, try a secondary */ |
213 | hash = ~hash; |
214 | vflags ^= HPTE_V_SECONDARY; |
215 | attempt++; |
216 | goto map_again; |
217 | + } else if (ret < 0) { |
218 | + r = -EIO; |
219 | + goto out_unlock; |
220 | } else { |
221 | trace_kvm_book3s_64_mmu_map(rflags, hpteg, |
222 | vpn, hpaddr, orig_pte); |
223 | diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c |
224 | index 826c541a12af..e0d88d0890aa 100644 |
225 | --- a/arch/powerpc/kvm/book3s_pr.c |
226 | +++ b/arch/powerpc/kvm/book3s_pr.c |
227 | @@ -627,7 +627,11 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu, |
228 | kvmppc_mmu_unmap_page(vcpu, &pte); |
229 | } |
230 | /* The guest's PTE is not mapped yet. Map on the host */ |
231 | - kvmppc_mmu_map_page(vcpu, &pte, iswrite); |
232 | + if (kvmppc_mmu_map_page(vcpu, &pte, iswrite) == -EIO) { |
233 | + /* Exit KVM if mapping failed */ |
234 | + run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
235 | + return RESUME_HOST; |
236 | + } |
237 | if (data) |
238 | vcpu->stat.sp_storage++; |
239 | else if (vcpu->arch.mmu.is_dcbz32(vcpu) && |
240 | diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c |
241 | index 6de58f1bd7ec..eb5ff66b4d7a 100644 |
242 | --- a/arch/x86/boot/compressed/kaslr.c |
243 | +++ b/arch/x86/boot/compressed/kaslr.c |
244 | @@ -460,10 +460,17 @@ void choose_random_location(unsigned long input, |
245 | add_identity_map(random_addr, output_size); |
246 | *output = random_addr; |
247 | } |
248 | + |
249 | + /* |
250 | + * This loads the identity mapping page table. |
251 | + * This should only be done if a new physical address |
252 | + * is found for the kernel, otherwise we should keep |
253 | + * the old page table to make it be like the "nokaslr" |
254 | + * case. |
255 | + */ |
256 | + finalize_identity_maps(); |
257 | } |
258 | |
259 | - /* This actually loads the identity pagetable on x86_64. */ |
260 | - finalize_identity_maps(); |
261 | |
262 | /* Pick random virtual address starting from LOAD_PHYSICAL_ADDR. */ |
263 | if (IS_ENABLED(CONFIG_X86_64)) |
264 | diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c |
265 | index be22f5a2192e..4e3b8a587c88 100644 |
266 | --- a/arch/x86/kernel/i8259.c |
267 | +++ b/arch/x86/kernel/i8259.c |
268 | @@ -418,6 +418,7 @@ struct legacy_pic default_legacy_pic = { |
269 | }; |
270 | |
271 | struct legacy_pic *legacy_pic = &default_legacy_pic; |
272 | +EXPORT_SYMBOL(legacy_pic); |
273 | |
274 | static int __init i8259A_init_ops(void) |
275 | { |
276 | diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c |
277 | index ca699677e288..ea217caa731c 100644 |
278 | --- a/arch/x86/kernel/smp.c |
279 | +++ b/arch/x86/kernel/smp.c |
280 | @@ -33,6 +33,7 @@ |
281 | #include <asm/mce.h> |
282 | #include <asm/trace/irq_vectors.h> |
283 | #include <asm/kexec.h> |
284 | +#include <asm/virtext.h> |
285 | |
286 | /* |
287 | * Some notes on x86 processor bugs affecting SMP operation: |
288 | @@ -162,6 +163,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) |
289 | if (raw_smp_processor_id() == atomic_read(&stopping_cpu)) |
290 | return NMI_HANDLED; |
291 | |
292 | + cpu_emergency_vmxoff(); |
293 | stop_this_cpu(NULL); |
294 | |
295 | return NMI_HANDLED; |
296 | @@ -174,6 +176,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) |
297 | asmlinkage __visible void smp_reboot_interrupt(void) |
298 | { |
299 | ipi_entering_ack_irq(); |
300 | + cpu_emergency_vmxoff(); |
301 | stop_this_cpu(NULL); |
302 | irq_exit(); |
303 | } |
304 | diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c |
305 | index 137afbbd0590..a11540e51f62 100644 |
306 | --- a/arch/x86/xen/smp.c |
307 | +++ b/arch/x86/xen/smp.c |
308 | @@ -299,35 +299,46 @@ static void __init xen_filter_cpu_maps(void) |
309 | |
310 | } |
311 | |
312 | -static void __init xen_smp_prepare_boot_cpu(void) |
313 | +static void __init xen_pv_smp_prepare_boot_cpu(void) |
314 | { |
315 | BUG_ON(smp_processor_id() != 0); |
316 | native_smp_prepare_boot_cpu(); |
317 | |
318 | - if (xen_pv_domain()) { |
319 | - if (!xen_feature(XENFEAT_writable_page_tables)) |
320 | - /* We've switched to the "real" per-cpu gdt, so make |
321 | - * sure the old memory can be recycled. */ |
322 | - make_lowmem_page_readwrite(xen_initial_gdt); |
323 | + if (!xen_feature(XENFEAT_writable_page_tables)) |
324 | + /* We've switched to the "real" per-cpu gdt, so make |
325 | + * sure the old memory can be recycled. */ |
326 | + make_lowmem_page_readwrite(xen_initial_gdt); |
327 | |
328 | #ifdef CONFIG_X86_32 |
329 | - /* |
330 | - * Xen starts us with XEN_FLAT_RING1_DS, but linux code |
331 | - * expects __USER_DS |
332 | - */ |
333 | - loadsegment(ds, __USER_DS); |
334 | - loadsegment(es, __USER_DS); |
335 | + /* |
336 | + * Xen starts us with XEN_FLAT_RING1_DS, but linux code |
337 | + * expects __USER_DS |
338 | + */ |
339 | + loadsegment(ds, __USER_DS); |
340 | + loadsegment(es, __USER_DS); |
341 | #endif |
342 | |
343 | - xen_filter_cpu_maps(); |
344 | - xen_setup_vcpu_info_placement(); |
345 | - } |
346 | + xen_filter_cpu_maps(); |
347 | + xen_setup_vcpu_info_placement(); |
348 | + |
349 | + /* |
350 | + * The alternative logic (which patches the unlock/lock) runs before |
351 | + * the smp bootup up code is activated. Hence we need to set this up |
352 | + * the core kernel is being patched. Otherwise we will have only |
353 | + * modules patched but not core code. |
354 | + */ |
355 | + xen_init_spinlocks(); |
356 | +} |
357 | + |
358 | +static void __init xen_hvm_smp_prepare_boot_cpu(void) |
359 | +{ |
360 | + BUG_ON(smp_processor_id() != 0); |
361 | + native_smp_prepare_boot_cpu(); |
362 | |
363 | /* |
364 | * Setup vcpu_info for boot CPU. |
365 | */ |
366 | - if (xen_hvm_domain()) |
367 | - xen_vcpu_setup(0); |
368 | + xen_vcpu_setup(0); |
369 | |
370 | /* |
371 | * The alternative logic (which patches the unlock/lock) runs before |
372 | @@ -733,7 +744,7 @@ static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id) |
373 | } |
374 | |
375 | static const struct smp_ops xen_smp_ops __initconst = { |
376 | - .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu, |
377 | + .smp_prepare_boot_cpu = xen_pv_smp_prepare_boot_cpu, |
378 | .smp_prepare_cpus = xen_smp_prepare_cpus, |
379 | .smp_cpus_done = xen_smp_cpus_done, |
380 | |
381 | @@ -772,5 +783,5 @@ void __init xen_hvm_smp_init(void) |
382 | smp_ops.cpu_die = xen_cpu_die; |
383 | smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi; |
384 | smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi; |
385 | - smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu; |
386 | + smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu; |
387 | } |
388 | diff --git a/block/blk-mq.c b/block/blk-mq.c |
389 | index 10f8f94b7f20..c6572ffc1e87 100644 |
390 | --- a/block/blk-mq.c |
391 | +++ b/block/blk-mq.c |
392 | @@ -2014,15 +2014,15 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, |
393 | |
394 | blk_mq_init_cpu_queues(q, set->nr_hw_queues); |
395 | |
396 | - get_online_cpus(); |
397 | mutex_lock(&all_q_mutex); |
398 | + get_online_cpus(); |
399 | |
400 | list_add_tail(&q->all_q_node, &all_q_list); |
401 | blk_mq_add_queue_tag_set(set, q); |
402 | blk_mq_map_swqueue(q, cpu_online_mask); |
403 | |
404 | - mutex_unlock(&all_q_mutex); |
405 | put_online_cpus(); |
406 | + mutex_unlock(&all_q_mutex); |
407 | |
408 | return q; |
409 | |
410 | diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c |
411 | index e6e991ac20f3..0c6874e6a9b6 100644 |
412 | --- a/drivers/acpi/pmic/intel_pmic_xpower.c |
413 | +++ b/drivers/acpi/pmic/intel_pmic_xpower.c |
414 | @@ -28,97 +28,97 @@ static struct pmic_table power_table[] = { |
415 | .address = 0x00, |
416 | .reg = 0x13, |
417 | .bit = 0x05, |
418 | - }, |
419 | + }, /* ALD1 */ |
420 | { |
421 | .address = 0x04, |
422 | .reg = 0x13, |
423 | .bit = 0x06, |
424 | - }, |
425 | + }, /* ALD2 */ |
426 | { |
427 | .address = 0x08, |
428 | .reg = 0x13, |
429 | .bit = 0x07, |
430 | - }, |
431 | + }, /* ALD3 */ |
432 | { |
433 | .address = 0x0c, |
434 | .reg = 0x12, |
435 | .bit = 0x03, |
436 | - }, |
437 | + }, /* DLD1 */ |
438 | { |
439 | .address = 0x10, |
440 | .reg = 0x12, |
441 | .bit = 0x04, |
442 | - }, |
443 | + }, /* DLD2 */ |
444 | { |
445 | .address = 0x14, |
446 | .reg = 0x12, |
447 | .bit = 0x05, |
448 | - }, |
449 | + }, /* DLD3 */ |
450 | { |
451 | .address = 0x18, |
452 | .reg = 0x12, |
453 | .bit = 0x06, |
454 | - }, |
455 | + }, /* DLD4 */ |
456 | { |
457 | .address = 0x1c, |
458 | .reg = 0x12, |
459 | .bit = 0x00, |
460 | - }, |
461 | + }, /* ELD1 */ |
462 | { |
463 | .address = 0x20, |
464 | .reg = 0x12, |
465 | .bit = 0x01, |
466 | - }, |
467 | + }, /* ELD2 */ |
468 | { |
469 | .address = 0x24, |
470 | .reg = 0x12, |
471 | .bit = 0x02, |
472 | - }, |
473 | + }, /* ELD3 */ |
474 | { |
475 | .address = 0x28, |
476 | .reg = 0x13, |
477 | .bit = 0x02, |
478 | - }, |
479 | + }, /* FLD1 */ |
480 | { |
481 | .address = 0x2c, |
482 | .reg = 0x13, |
483 | .bit = 0x03, |
484 | - }, |
485 | + }, /* FLD2 */ |
486 | { |
487 | .address = 0x30, |
488 | .reg = 0x13, |
489 | .bit = 0x04, |
490 | - }, |
491 | + }, /* FLD3 */ |
492 | { |
493 | - .address = 0x38, |
494 | + .address = 0x34, |
495 | .reg = 0x10, |
496 | .bit = 0x03, |
497 | - }, |
498 | + }, /* BUC1 */ |
499 | { |
500 | - .address = 0x3c, |
501 | + .address = 0x38, |
502 | .reg = 0x10, |
503 | .bit = 0x06, |
504 | - }, |
505 | + }, /* BUC2 */ |
506 | { |
507 | - .address = 0x40, |
508 | + .address = 0x3c, |
509 | .reg = 0x10, |
510 | .bit = 0x05, |
511 | - }, |
512 | + }, /* BUC3 */ |
513 | { |
514 | - .address = 0x44, |
515 | + .address = 0x40, |
516 | .reg = 0x10, |
517 | .bit = 0x04, |
518 | - }, |
519 | + }, /* BUC4 */ |
520 | { |
521 | - .address = 0x48, |
522 | + .address = 0x44, |
523 | .reg = 0x10, |
524 | .bit = 0x01, |
525 | - }, |
526 | + }, /* BUC5 */ |
527 | { |
528 | - .address = 0x4c, |
529 | + .address = 0x48, |
530 | .reg = 0x10, |
531 | .bit = 0x00 |
532 | - }, |
533 | + }, /* BUC6 */ |
534 | }; |
535 | |
536 | /* TMP0 - TMP5 are the same, all from GPADC */ |
537 | diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c |
538 | index 1c2b846c5776..3a6c9b741b23 100644 |
539 | --- a/drivers/acpi/power.c |
540 | +++ b/drivers/acpi/power.c |
541 | @@ -864,6 +864,16 @@ void acpi_resume_power_resources(void) |
542 | |
543 | mutex_unlock(&resource->resource_lock); |
544 | } |
545 | + |
546 | + mutex_unlock(&power_resource_list_lock); |
547 | +} |
548 | + |
549 | +void acpi_turn_off_unused_power_resources(void) |
550 | +{ |
551 | + struct acpi_power_resource *resource; |
552 | + |
553 | + mutex_lock(&power_resource_list_lock); |
554 | + |
555 | list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) { |
556 | int result, state; |
557 | |
558 | diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c |
559 | index 9d5f0c7ed3f7..8697a82bd465 100644 |
560 | --- a/drivers/acpi/processor_driver.c |
561 | +++ b/drivers/acpi/processor_driver.c |
562 | @@ -251,6 +251,9 @@ static int __acpi_processor_start(struct acpi_device *device) |
563 | if (ACPI_SUCCESS(status)) |
564 | return 0; |
565 | |
566 | + result = -ENODEV; |
567 | + acpi_pss_perf_exit(pr, device); |
568 | + |
569 | err_power_exit: |
570 | acpi_processor_power_exit(pr); |
571 | return result; |
572 | @@ -259,11 +262,16 @@ static int __acpi_processor_start(struct acpi_device *device) |
573 | static int acpi_processor_start(struct device *dev) |
574 | { |
575 | struct acpi_device *device = ACPI_COMPANION(dev); |
576 | + int ret; |
577 | |
578 | if (!device) |
579 | return -ENODEV; |
580 | |
581 | - return __acpi_processor_start(device); |
582 | + /* Protect against concurrent CPU hotplug operations */ |
583 | + get_online_cpus(); |
584 | + ret = __acpi_processor_start(device); |
585 | + put_online_cpus(); |
586 | + return ret; |
587 | } |
588 | |
589 | static int acpi_processor_stop(struct device *dev) |
590 | diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c |
591 | index d51ca1c05619..207e9bbb9490 100644 |
592 | --- a/drivers/acpi/processor_throttling.c |
593 | +++ b/drivers/acpi/processor_throttling.c |
594 | @@ -62,8 +62,8 @@ struct acpi_processor_throttling_arg { |
595 | #define THROTTLING_POSTCHANGE (2) |
596 | |
597 | static int acpi_processor_get_throttling(struct acpi_processor *pr); |
598 | -int acpi_processor_set_throttling(struct acpi_processor *pr, |
599 | - int state, bool force); |
600 | +static int __acpi_processor_set_throttling(struct acpi_processor *pr, |
601 | + int state, bool force, bool direct); |
602 | |
603 | static int acpi_processor_update_tsd_coord(void) |
604 | { |
605 | @@ -891,7 +891,8 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
606 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
607 | "Invalid throttling state, reset\n")); |
608 | state = 0; |
609 | - ret = acpi_processor_set_throttling(pr, state, true); |
610 | + ret = __acpi_processor_set_throttling(pr, state, true, |
611 | + true); |
612 | if (ret) |
613 | return ret; |
614 | } |
615 | @@ -901,36 +902,31 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
616 | return 0; |
617 | } |
618 | |
619 | -static int acpi_processor_get_throttling(struct acpi_processor *pr) |
620 | +static long __acpi_processor_get_throttling(void *data) |
621 | { |
622 | - cpumask_var_t saved_mask; |
623 | - int ret; |
624 | + struct acpi_processor *pr = data; |
625 | + |
626 | + return pr->throttling.acpi_processor_get_throttling(pr); |
627 | +} |
628 | |
629 | +static int acpi_processor_get_throttling(struct acpi_processor *pr) |
630 | +{ |
631 | if (!pr) |
632 | return -EINVAL; |
633 | |
634 | if (!pr->flags.throttling) |
635 | return -ENODEV; |
636 | |
637 | - if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) |
638 | - return -ENOMEM; |
639 | - |
640 | /* |
641 | - * Migrate task to the cpu pointed by pr. |
642 | + * This is either called from the CPU hotplug callback of |
643 | + * processor_driver or via the ACPI probe function. In the latter |
644 | + * case the CPU is not guaranteed to be online. Both call sites are |
645 | + * protected against CPU hotplug. |
646 | */ |
647 | - cpumask_copy(saved_mask, ¤t->cpus_allowed); |
648 | - /* FIXME: use work_on_cpu() */ |
649 | - if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) { |
650 | - /* Can't migrate to the target pr->id CPU. Exit */ |
651 | - free_cpumask_var(saved_mask); |
652 | + if (!cpu_online(pr->id)) |
653 | return -ENODEV; |
654 | - } |
655 | - ret = pr->throttling.acpi_processor_get_throttling(pr); |
656 | - /* restore the previous state */ |
657 | - set_cpus_allowed_ptr(current, saved_mask); |
658 | - free_cpumask_var(saved_mask); |
659 | |
660 | - return ret; |
661 | + return work_on_cpu(pr->id, __acpi_processor_get_throttling, pr); |
662 | } |
663 | |
664 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) |
665 | @@ -1080,8 +1076,15 @@ static long acpi_processor_throttling_fn(void *data) |
666 | arg->target_state, arg->force); |
667 | } |
668 | |
669 | -int acpi_processor_set_throttling(struct acpi_processor *pr, |
670 | - int state, bool force) |
671 | +static int call_on_cpu(int cpu, long (*fn)(void *), void *arg, bool direct) |
672 | +{ |
673 | + if (direct) |
674 | + return fn(arg); |
675 | + return work_on_cpu(cpu, fn, arg); |
676 | +} |
677 | + |
678 | +static int __acpi_processor_set_throttling(struct acpi_processor *pr, |
679 | + int state, bool force, bool direct) |
680 | { |
681 | int ret = 0; |
682 | unsigned int i; |
683 | @@ -1130,7 +1133,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, |
684 | arg.pr = pr; |
685 | arg.target_state = state; |
686 | arg.force = force; |
687 | - ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg); |
688 | + ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, &arg, |
689 | + direct); |
690 | } else { |
691 | /* |
692 | * When the T-state coordination is SW_ALL or HW_ALL, |
693 | @@ -1163,8 +1167,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, |
694 | arg.pr = match_pr; |
695 | arg.target_state = state; |
696 | arg.force = force; |
697 | - ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, |
698 | - &arg); |
699 | + ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, |
700 | + &arg, direct); |
701 | } |
702 | } |
703 | /* |
704 | @@ -1182,6 +1186,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, |
705 | return ret; |
706 | } |
707 | |
708 | +int acpi_processor_set_throttling(struct acpi_processor *pr, int state, |
709 | + bool force) |
710 | +{ |
711 | + return __acpi_processor_set_throttling(pr, state, force, false); |
712 | +} |
713 | + |
714 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
715 | { |
716 | int result = 0; |
717 | diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c |
718 | index a4327af676fe..097d630ab886 100644 |
719 | --- a/drivers/acpi/sleep.c |
720 | +++ b/drivers/acpi/sleep.c |
721 | @@ -474,6 +474,7 @@ static void acpi_pm_start(u32 acpi_state) |
722 | */ |
723 | static void acpi_pm_end(void) |
724 | { |
725 | + acpi_turn_off_unused_power_resources(); |
726 | acpi_scan_lock_release(); |
727 | /* |
728 | * This is necessary in case acpi_pm_finish() is not called during a |
729 | diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h |
730 | index a9cc34e663f9..a82ff74faf7a 100644 |
731 | --- a/drivers/acpi/sleep.h |
732 | +++ b/drivers/acpi/sleep.h |
733 | @@ -6,6 +6,7 @@ extern struct list_head acpi_wakeup_device_list; |
734 | extern struct mutex acpi_device_lock; |
735 | |
736 | extern void acpi_resume_power_resources(void); |
737 | +extern void acpi_turn_off_unused_power_resources(void); |
738 | |
739 | static inline acpi_status acpi_set_waking_vector(u32 wakeup_address) |
740 | { |
741 | diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c |
742 | index 3cfd879267b2..b86273fdf48e 100644 |
743 | --- a/drivers/block/mtip32xx/mtip32xx.c |
744 | +++ b/drivers/block/mtip32xx/mtip32xx.c |
745 | @@ -169,6 +169,25 @@ static bool mtip_check_surprise_removal(struct pci_dev *pdev) |
746 | return false; /* device present */ |
747 | } |
748 | |
749 | +/* we have to use runtime tag to setup command header */ |
750 | +static void mtip_init_cmd_header(struct request *rq) |
751 | +{ |
752 | + struct driver_data *dd = rq->q->queuedata; |
753 | + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
754 | + u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; |
755 | + |
756 | + /* Point the command headers at the command tables. */ |
757 | + cmd->command_header = dd->port->command_list + |
758 | + (sizeof(struct mtip_cmd_hdr) * rq->tag); |
759 | + cmd->command_header_dma = dd->port->command_list_dma + |
760 | + (sizeof(struct mtip_cmd_hdr) * rq->tag); |
761 | + |
762 | + if (host_cap_64) |
763 | + cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16); |
764 | + |
765 | + cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF); |
766 | +} |
767 | + |
768 | static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) |
769 | { |
770 | struct request *rq; |
771 | @@ -180,6 +199,9 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) |
772 | if (IS_ERR(rq)) |
773 | return NULL; |
774 | |
775 | + /* Internal cmd isn't submitted via .queue_rq */ |
776 | + mtip_init_cmd_header(rq); |
777 | + |
778 | return blk_mq_rq_to_pdu(rq); |
779 | } |
780 | |
781 | @@ -3811,6 +3833,8 @@ static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx, |
782 | struct request *rq = bd->rq; |
783 | int ret; |
784 | |
785 | + mtip_init_cmd_header(rq); |
786 | + |
787 | if (unlikely(mtip_check_unal_depth(hctx, rq))) |
788 | return BLK_MQ_RQ_QUEUE_BUSY; |
789 | |
790 | @@ -3842,7 +3866,6 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, |
791 | { |
792 | struct driver_data *dd = data; |
793 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
794 | - u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; |
795 | |
796 | /* |
797 | * For flush requests, request_idx starts at the end of the |
798 | @@ -3859,17 +3882,6 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, |
799 | |
800 | memset(cmd->command, 0, CMD_DMA_ALLOC_SZ); |
801 | |
802 | - /* Point the command headers at the command tables. */ |
803 | - cmd->command_header = dd->port->command_list + |
804 | - (sizeof(struct mtip_cmd_hdr) * request_idx); |
805 | - cmd->command_header_dma = dd->port->command_list_dma + |
806 | - (sizeof(struct mtip_cmd_hdr) * request_idx); |
807 | - |
808 | - if (host_cap_64) |
809 | - cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16); |
810 | - |
811 | - cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF); |
812 | - |
813 | sg_init_table(cmd->sg, MTIP_MAX_SG); |
814 | return 0; |
815 | } |
816 | diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c |
817 | index 08c2c93887c1..3aac78a5091b 100644 |
818 | --- a/drivers/bluetooth/btqcomsmd.c |
819 | +++ b/drivers/bluetooth/btqcomsmd.c |
820 | @@ -85,7 +85,8 @@ static int btqcomsmd_send(struct hci_dev *hdev, struct sk_buff *skb) |
821 | break; |
822 | } |
823 | |
824 | - kfree_skb(skb); |
825 | + if (!ret) |
826 | + kfree_skb(skb); |
827 | |
828 | return ret; |
829 | } |
830 | diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
831 | index 9497c469efd2..2230f9368c21 100644 |
832 | --- a/drivers/bluetooth/hci_ldisc.c |
833 | +++ b/drivers/bluetooth/hci_ldisc.c |
834 | @@ -113,16 +113,21 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) |
835 | { |
836 | struct sk_buff *skb = hu->tx_skb; |
837 | |
838 | - if (!skb) |
839 | - skb = hu->proto->dequeue(hu); |
840 | - else |
841 | + if (!skb) { |
842 | + if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) |
843 | + skb = hu->proto->dequeue(hu); |
844 | + } else { |
845 | hu->tx_skb = NULL; |
846 | + } |
847 | |
848 | return skb; |
849 | } |
850 | |
851 | int hci_uart_tx_wakeup(struct hci_uart *hu) |
852 | { |
853 | + if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) |
854 | + return 0; |
855 | + |
856 | if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) { |
857 | set_bit(HCI_UART_TX_WAKEUP, &hu->tx_state); |
858 | return 0; |
859 | diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
860 | index 6c867fbc56a7..74b2f4a14643 100644 |
861 | --- a/drivers/bluetooth/hci_qca.c |
862 | +++ b/drivers/bluetooth/hci_qca.c |
863 | @@ -936,6 +936,9 @@ static int qca_setup(struct hci_uart *hu) |
864 | if (!ret) { |
865 | set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags); |
866 | qca_debugfs_init(hdev); |
867 | + } else if (ret == -ENOENT) { |
868 | + /* No patch/nvm-config found, run with original fw/config */ |
869 | + ret = 0; |
870 | } |
871 | |
872 | /* Setup bdaddr */ |
873 | diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c |
874 | index 909311016108..055d2ce378a7 100644 |
875 | --- a/drivers/char/ipmi/ipmi_watchdog.c |
876 | +++ b/drivers/char/ipmi/ipmi_watchdog.c |
877 | @@ -515,7 +515,7 @@ static void panic_halt_ipmi_heartbeat(void) |
878 | msg.cmd = IPMI_WDOG_RESET_TIMER; |
879 | msg.data = NULL; |
880 | msg.data_len = 0; |
881 | - atomic_add(2, &panic_done_count); |
882 | + atomic_add(1, &panic_done_count); |
883 | rv = ipmi_request_supply_msgs(watchdog_user, |
884 | (struct ipmi_addr *) &addr, |
885 | 0, |
886 | @@ -525,7 +525,7 @@ static void panic_halt_ipmi_heartbeat(void) |
887 | &panic_halt_heartbeat_recv_msg, |
888 | 1); |
889 | if (rv) |
890 | - atomic_sub(2, &panic_done_count); |
891 | + atomic_sub(1, &panic_done_count); |
892 | } |
893 | |
894 | static struct ipmi_smi_msg panic_halt_smi_msg = { |
895 | @@ -549,12 +549,12 @@ static void panic_halt_ipmi_set_timeout(void) |
896 | /* Wait for the messages to be free. */ |
897 | while (atomic_read(&panic_done_count) != 0) |
898 | ipmi_poll_interface(watchdog_user); |
899 | - atomic_add(2, &panic_done_count); |
900 | + atomic_add(1, &panic_done_count); |
901 | rv = i_ipmi_set_timeout(&panic_halt_smi_msg, |
902 | &panic_halt_recv_msg, |
903 | &send_heartbeat_now); |
904 | if (rv) { |
905 | - atomic_sub(2, &panic_done_count); |
906 | + atomic_sub(1, &panic_done_count); |
907 | printk(KERN_WARNING PFX |
908 | "Unable to extend the watchdog timeout."); |
909 | } else { |
910 | diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c |
911 | index d0ac2d56520f..830d7e30e508 100644 |
912 | --- a/drivers/char/tpm/tpm-interface.c |
913 | +++ b/drivers/char/tpm/tpm-interface.c |
914 | @@ -1078,6 +1078,11 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) |
915 | break; |
916 | |
917 | recd = be32_to_cpu(tpm_cmd.params.getrandom_out.rng_data_len); |
918 | + if (recd > num_bytes) { |
919 | + total = -EFAULT; |
920 | + break; |
921 | + } |
922 | + |
923 | memcpy(dest, tpm_cmd.params.getrandom_out.rng_data, recd); |
924 | |
925 | dest += recd; |
926 | diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c |
927 | index 17896d654033..a5780ebe15ef 100644 |
928 | --- a/drivers/char/tpm/tpm2-cmd.c |
929 | +++ b/drivers/char/tpm/tpm2-cmd.c |
930 | @@ -668,6 +668,11 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip, |
931 | if (!rc) { |
932 | data_len = be16_to_cpup( |
933 | (__be16 *) &buf.data[TPM_HEADER_SIZE + 4]); |
934 | + if (data_len < MIN_KEY_SIZE || data_len > MAX_KEY_SIZE + 1) { |
935 | + rc = -EFAULT; |
936 | + goto out; |
937 | + } |
938 | + |
939 | data = &buf.data[TPM_HEADER_SIZE + 6]; |
940 | |
941 | memcpy(payload->key, data, data_len - 1); |
942 | @@ -675,6 +680,7 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip, |
943 | payload->migratable = data[data_len - 1]; |
944 | } |
945 | |
946 | +out: |
947 | tpm_buf_destroy(&buf); |
948 | return rc; |
949 | } |
950 | diff --git a/drivers/clk/bcm/clk-ns2.c b/drivers/clk/bcm/clk-ns2.c |
951 | index a564e9248814..adc14145861a 100644 |
952 | --- a/drivers/clk/bcm/clk-ns2.c |
953 | +++ b/drivers/clk/bcm/clk-ns2.c |
954 | @@ -103,7 +103,7 @@ CLK_OF_DECLARE(ns2_genpll_src_clk, "brcm,ns2-genpll-scr", |
955 | |
956 | static const struct iproc_pll_ctrl genpll_sw = { |
957 | .flags = IPROC_CLK_AON | IPROC_CLK_PLL_SPLIT_STAT_CTRL, |
958 | - .aon = AON_VAL(0x0, 2, 9, 8), |
959 | + .aon = AON_VAL(0x0, 1, 11, 10), |
960 | .reset = RESET_VAL(0x4, 2, 1), |
961 | .dig_filter = DF_VAL(0x0, 9, 3, 5, 4, 2, 3), |
962 | .ndiv_int = REG_VAL(0x8, 4, 10), |
963 | diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c |
964 | index 5e918e7afaba..95a6e9834392 100644 |
965 | --- a/drivers/clk/clk-axi-clkgen.c |
966 | +++ b/drivers/clk/clk-axi-clkgen.c |
967 | @@ -40,6 +40,10 @@ |
968 | #define MMCM_REG_FILTER1 0x4e |
969 | #define MMCM_REG_FILTER2 0x4f |
970 | |
971 | +#define MMCM_CLKOUT_NOCOUNT BIT(6) |
972 | + |
973 | +#define MMCM_CLK_DIV_NOCOUNT BIT(12) |
974 | + |
975 | struct axi_clkgen { |
976 | void __iomem *base; |
977 | struct clk_hw clk_hw; |
978 | @@ -315,12 +319,27 @@ static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw, |
979 | unsigned int reg; |
980 | unsigned long long tmp; |
981 | |
982 | - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, ®); |
983 | - dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
984 | + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_2, ®); |
985 | + if (reg & MMCM_CLKOUT_NOCOUNT) { |
986 | + dout = 1; |
987 | + } else { |
988 | + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, ®); |
989 | + dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
990 | + } |
991 | + |
992 | axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, ®); |
993 | - d = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
994 | - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, ®); |
995 | - m = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
996 | + if (reg & MMCM_CLK_DIV_NOCOUNT) |
997 | + d = 1; |
998 | + else |
999 | + d = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
1000 | + |
1001 | + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB2, ®); |
1002 | + if (reg & MMCM_CLKOUT_NOCOUNT) { |
1003 | + m = 1; |
1004 | + } else { |
1005 | + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, ®); |
1006 | + m = (reg & 0x3f) + ((reg >> 6) & 0x3f); |
1007 | + } |
1008 | |
1009 | if (d == 0 || dout == 0) |
1010 | return 0; |
1011 | diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c |
1012 | index b051db43fae1..136a86094c53 100644 |
1013 | --- a/drivers/clk/clk-si5351.c |
1014 | +++ b/drivers/clk/clk-si5351.c |
1015 | @@ -72,7 +72,7 @@ static const char * const si5351_input_names[] = { |
1016 | "xtal", "clkin" |
1017 | }; |
1018 | static const char * const si5351_pll_names[] = { |
1019 | - "plla", "pllb", "vxco" |
1020 | + "si5351_plla", "si5351_pllb", "si5351_vxco" |
1021 | }; |
1022 | static const char * const si5351_msynth_names[] = { |
1023 | "ms0", "ms1", "ms2", "ms3", "ms4", "ms5", "ms6", "ms7" |
1024 | diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
1025 | index 0fb39fe217d1..0cdb8550729d 100644 |
1026 | --- a/drivers/clk/clk.c |
1027 | +++ b/drivers/clk/clk.c |
1028 | @@ -2437,6 +2437,21 @@ static int __clk_core_init(struct clk_core *core) |
1029 | rate = 0; |
1030 | core->rate = core->req_rate = rate; |
1031 | |
1032 | + /* |
1033 | + * Enable CLK_IS_CRITICAL clocks so newly added critical clocks |
1034 | + * don't get accidentally disabled when walking the orphan tree and |
1035 | + * reparenting clocks |
1036 | + */ |
1037 | + if (core->flags & CLK_IS_CRITICAL) { |
1038 | + unsigned long flags; |
1039 | + |
1040 | + clk_core_prepare(core); |
1041 | + |
1042 | + flags = clk_enable_lock(); |
1043 | + clk_core_enable(core); |
1044 | + clk_enable_unlock(flags); |
1045 | + } |
1046 | + |
1047 | /* |
1048 | * walk the list of orphan clocks and reparent any that newly finds a |
1049 | * parent. |
1050 | @@ -2445,10 +2460,13 @@ static int __clk_core_init(struct clk_core *core) |
1051 | struct clk_core *parent = __clk_init_parent(orphan); |
1052 | |
1053 | /* |
1054 | - * we could call __clk_set_parent, but that would result in a |
1055 | - * redundant call to the .set_rate op, if it exists |
1056 | + * We need to use __clk_set_parent_before() and _after() to |
1057 | + * to properly migrate any prepare/enable count of the orphan |
1058 | + * clock. This is important for CLK_IS_CRITICAL clocks, which |
1059 | + * are enabled during init but might not have a parent yet. |
1060 | */ |
1061 | if (parent) { |
1062 | + /* update the clk tree topology */ |
1063 | __clk_set_parent_before(orphan, parent); |
1064 | __clk_set_parent_after(orphan, parent, NULL); |
1065 | __clk_recalc_accuracies(orphan); |
1066 | @@ -2467,16 +2485,6 @@ static int __clk_core_init(struct clk_core *core) |
1067 | if (core->ops->init) |
1068 | core->ops->init(core->hw); |
1069 | |
1070 | - if (core->flags & CLK_IS_CRITICAL) { |
1071 | - unsigned long flags; |
1072 | - |
1073 | - clk_core_prepare(core); |
1074 | - |
1075 | - flags = clk_enable_lock(); |
1076 | - clk_core_enable(core); |
1077 | - clk_enable_unlock(flags); |
1078 | - } |
1079 | - |
1080 | kref_init(&core->ref); |
1081 | out: |
1082 | clk_prepare_unlock(); |
1083 | diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c |
1084 | index 86628e22b2a3..719c3d9f07fb 100644 |
1085 | --- a/drivers/cpufreq/sh-cpufreq.c |
1086 | +++ b/drivers/cpufreq/sh-cpufreq.c |
1087 | @@ -30,54 +30,63 @@ |
1088 | |
1089 | static DEFINE_PER_CPU(struct clk, sh_cpuclk); |
1090 | |
1091 | +struct cpufreq_target { |
1092 | + struct cpufreq_policy *policy; |
1093 | + unsigned int freq; |
1094 | +}; |
1095 | + |
1096 | static unsigned int sh_cpufreq_get(unsigned int cpu) |
1097 | { |
1098 | return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000; |
1099 | } |
1100 | |
1101 | -/* |
1102 | - * Here we notify other drivers of the proposed change and the final change. |
1103 | - */ |
1104 | -static int sh_cpufreq_target(struct cpufreq_policy *policy, |
1105 | - unsigned int target_freq, |
1106 | - unsigned int relation) |
1107 | +static long __sh_cpufreq_target(void *arg) |
1108 | { |
1109 | - unsigned int cpu = policy->cpu; |
1110 | + struct cpufreq_target *target = arg; |
1111 | + struct cpufreq_policy *policy = target->policy; |
1112 | + int cpu = policy->cpu; |
1113 | struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); |
1114 | - cpumask_t cpus_allowed; |
1115 | struct cpufreq_freqs freqs; |
1116 | struct device *dev; |
1117 | long freq; |
1118 | |
1119 | - cpus_allowed = current->cpus_allowed; |
1120 | - set_cpus_allowed_ptr(current, cpumask_of(cpu)); |
1121 | - |
1122 | - BUG_ON(smp_processor_id() != cpu); |
1123 | + if (smp_processor_id() != cpu) |
1124 | + return -ENODEV; |
1125 | |
1126 | dev = get_cpu_device(cpu); |
1127 | |
1128 | /* Convert target_freq from kHz to Hz */ |
1129 | - freq = clk_round_rate(cpuclk, target_freq * 1000); |
1130 | + freq = clk_round_rate(cpuclk, target->freq * 1000); |
1131 | |
1132 | if (freq < (policy->min * 1000) || freq > (policy->max * 1000)) |
1133 | return -EINVAL; |
1134 | |
1135 | - dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000); |
1136 | + dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000); |
1137 | |
1138 | freqs.old = sh_cpufreq_get(cpu); |
1139 | freqs.new = (freq + 500) / 1000; |
1140 | freqs.flags = 0; |
1141 | |
1142 | - cpufreq_freq_transition_begin(policy, &freqs); |
1143 | - set_cpus_allowed_ptr(current, &cpus_allowed); |
1144 | + cpufreq_freq_transition_begin(target->policy, &freqs); |
1145 | clk_set_rate(cpuclk, freq); |
1146 | - cpufreq_freq_transition_end(policy, &freqs, 0); |
1147 | + cpufreq_freq_transition_end(target->policy, &freqs, 0); |
1148 | |
1149 | dev_dbg(dev, "set frequency %lu Hz\n", freq); |
1150 | - |
1151 | return 0; |
1152 | } |
1153 | |
1154 | +/* |
1155 | + * Here we notify other drivers of the proposed change and the final change. |
1156 | + */ |
1157 | +static int sh_cpufreq_target(struct cpufreq_policy *policy, |
1158 | + unsigned int target_freq, |
1159 | + unsigned int relation) |
1160 | +{ |
1161 | + struct cpufreq_target data = { .policy = policy, .freq = target_freq }; |
1162 | + |
1163 | + return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data); |
1164 | +} |
1165 | + |
1166 | static int sh_cpufreq_verify(struct cpufreq_policy *policy) |
1167 | { |
1168 | struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu); |
1169 | diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c |
1170 | index 43e88d85129e..8c3c588834d2 100644 |
1171 | --- a/drivers/dma/ti-dma-crossbar.c |
1172 | +++ b/drivers/dma/ti-dma-crossbar.c |
1173 | @@ -54,7 +54,15 @@ struct ti_am335x_xbar_map { |
1174 | |
1175 | static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val) |
1176 | { |
1177 | - writeb_relaxed(val, iomem + event); |
1178 | + /* |
1179 | + * TPCC_EVT_MUX_60_63 register layout is different than the |
1180 | + * rest, in the sense, that event 63 is mapped to lowest byte |
1181 | + * and event 60 is mapped to highest, handle it separately. |
1182 | + */ |
1183 | + if (event >= 60 && event <= 63) |
1184 | + writeb_relaxed(val, iomem + (63 - event % 4)); |
1185 | + else |
1186 | + writeb_relaxed(val, iomem + event); |
1187 | } |
1188 | |
1189 | static void ti_am335x_xbar_free(struct device *dev, void *route_data) |
1190 | diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c |
1191 | index 6d221e5c72ee..22658057fe27 100644 |
1192 | --- a/drivers/dma/xilinx/zynqmp_dma.c |
1193 | +++ b/drivers/dma/xilinx/zynqmp_dma.c |
1194 | @@ -933,7 +933,8 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan) |
1195 | if (!chan) |
1196 | return; |
1197 | |
1198 | - devm_free_irq(chan->zdev->dev, chan->irq, chan); |
1199 | + if (chan->irq) |
1200 | + devm_free_irq(chan->zdev->dev, chan->irq, chan); |
1201 | tasklet_kill(&chan->tasklet); |
1202 | list_del(&chan->common.device_node); |
1203 | clk_disable_unprepare(chan->clk_apb); |
1204 | diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c |
1205 | index d0ddba7a9d08..5ef4980f3f14 100644 |
1206 | --- a/drivers/gpio/gpio-wcove.c |
1207 | +++ b/drivers/gpio/gpio-wcove.c |
1208 | @@ -51,6 +51,8 @@ |
1209 | #define GROUP1_NR_IRQS 6 |
1210 | #define IRQ_MASK_BASE 0x4e19 |
1211 | #define IRQ_STATUS_BASE 0x4e0b |
1212 | +#define GPIO_IRQ0_MASK GENMASK(6, 0) |
1213 | +#define GPIO_IRQ1_MASK GENMASK(5, 0) |
1214 | #define UPDATE_IRQ_TYPE BIT(0) |
1215 | #define UPDATE_IRQ_MASK BIT(1) |
1216 | |
1217 | @@ -310,7 +312,7 @@ static irqreturn_t wcove_gpio_irq_handler(int irq, void *data) |
1218 | return IRQ_NONE; |
1219 | } |
1220 | |
1221 | - pending = p[0] | (p[1] << 8); |
1222 | + pending = (p[0] & GPIO_IRQ0_MASK) | ((p[1] & GPIO_IRQ1_MASK) << 7); |
1223 | if (!pending) |
1224 | return IRQ_NONE; |
1225 | |
1226 | @@ -318,7 +320,7 @@ static irqreturn_t wcove_gpio_irq_handler(int irq, void *data) |
1227 | while (pending) { |
1228 | /* One iteration is for all pending bits */ |
1229 | for_each_set_bit(gpio, (const unsigned long *)&pending, |
1230 | - GROUP0_NR_IRQS) { |
1231 | + WCOVE_GPIO_NUM) { |
1232 | offset = (gpio > GROUP0_NR_IRQS) ? 1 : 0; |
1233 | mask = (offset == 1) ? BIT(gpio - GROUP0_NR_IRQS) : |
1234 | BIT(gpio); |
1235 | @@ -334,7 +336,7 @@ static irqreturn_t wcove_gpio_irq_handler(int irq, void *data) |
1236 | break; |
1237 | } |
1238 | |
1239 | - pending = p[0] | (p[1] << 8); |
1240 | + pending = (p[0] & GPIO_IRQ0_MASK) | ((p[1] & GPIO_IRQ1_MASK) << 7); |
1241 | } |
1242 | |
1243 | return IRQ_HANDLED; |
1244 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1245 | index 50f18f666d67..d0c3e56ece74 100644 |
1246 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1247 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1248 | @@ -2237,7 +2237,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) |
1249 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
1250 | struct amdgpu_ring *ring = adev->rings[i]; |
1251 | |
1252 | - if (!ring) |
1253 | + if (!ring || !ring->sched.thread) |
1254 | continue; |
1255 | kthread_park(ring->sched.thread); |
1256 | amd_sched_hw_job_reset(&ring->sched); |
1257 | @@ -2326,7 +2326,8 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) |
1258 | } |
1259 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
1260 | struct amdgpu_ring *ring = adev->rings[i]; |
1261 | - if (!ring) |
1262 | + |
1263 | + if (!ring || !ring->sched.thread) |
1264 | continue; |
1265 | |
1266 | amd_sched_job_recovery(&ring->sched); |
1267 | @@ -2335,7 +2336,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) |
1268 | } else { |
1269 | dev_err(adev->dev, "asic resume failed (%d).\n", r); |
1270 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
1271 | - if (adev->rings[i]) { |
1272 | + if (adev->rings[i] && adev->rings[i]->sched.thread) { |
1273 | kthread_unpark(adev->rings[i]->sched.thread); |
1274 | } |
1275 | } |
1276 | diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c |
1277 | index b6ac27e31929..797d1f8340b9 100644 |
1278 | --- a/drivers/gpu/drm/msm/msm_gem.c |
1279 | +++ b/drivers/gpu/drm/msm/msm_gem.c |
1280 | @@ -91,14 +91,17 @@ static struct page **get_pages(struct drm_gem_object *obj) |
1281 | return p; |
1282 | } |
1283 | |
1284 | + msm_obj->pages = p; |
1285 | + |
1286 | msm_obj->sgt = drm_prime_pages_to_sg(p, npages); |
1287 | if (IS_ERR(msm_obj->sgt)) { |
1288 | + void *ptr = ERR_CAST(msm_obj->sgt); |
1289 | + |
1290 | dev_err(dev->dev, "failed to allocate sgt\n"); |
1291 | - return ERR_CAST(msm_obj->sgt); |
1292 | + msm_obj->sgt = NULL; |
1293 | + return ptr; |
1294 | } |
1295 | |
1296 | - msm_obj->pages = p; |
1297 | - |
1298 | /* For non-cached buffers, ensure the new pages are clean |
1299 | * because display controller, GPU, etc. are not coherent: |
1300 | */ |
1301 | @@ -121,7 +124,10 @@ static void put_pages(struct drm_gem_object *obj) |
1302 | if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) |
1303 | dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl, |
1304 | msm_obj->sgt->nents, DMA_BIDIRECTIONAL); |
1305 | - sg_free_table(msm_obj->sgt); |
1306 | + |
1307 | + if (msm_obj->sgt) |
1308 | + sg_free_table(msm_obj->sgt); |
1309 | + |
1310 | kfree(msm_obj->sgt); |
1311 | |
1312 | if (use_pages(obj)) |
1313 | diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c |
1314 | index 2c2b86d68129..6526a3366087 100644 |
1315 | --- a/drivers/gpu/drm/nouveau/nouveau_display.c |
1316 | +++ b/drivers/gpu/drm/nouveau/nouveau_display.c |
1317 | @@ -106,7 +106,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, |
1318 | }; |
1319 | struct nouveau_display *disp = nouveau_display(crtc->dev); |
1320 | struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)]; |
1321 | - int ret, retry = 1; |
1322 | + int ret, retry = 20; |
1323 | |
1324 | do { |
1325 | ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args)); |
1326 | diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |
1327 | index e859b3f893f7..6112c32b994f 100644 |
1328 | --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |
1329 | +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |
1330 | @@ -456,6 +456,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi) |
1331 | } |
1332 | |
1333 | static const struct of_device_id td028ttec1_of_match[] = { |
1334 | + { .compatible = "omapdss,tpo,td028ttec1", }, |
1335 | + /* keep to not break older DTB */ |
1336 | { .compatible = "omapdss,toppoly,td028ttec1", }, |
1337 | {}, |
1338 | }; |
1339 | @@ -475,6 +477,7 @@ static struct spi_driver td028ttec1_spi_driver = { |
1340 | |
1341 | module_spi_driver(td028ttec1_spi_driver); |
1342 | |
1343 | +MODULE_ALIAS("spi:tpo,td028ttec1"); |
1344 | MODULE_ALIAS("spi:toppoly,td028ttec1"); |
1345 | MODULE_AUTHOR("H. Nikolaus Schaller <hns@goldelico.com>"); |
1346 | MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver"); |
1347 | diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1348 | index 4b83e9eeab06..7def04049498 100644 |
1349 | --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1350 | +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1351 | @@ -298,7 +298,12 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) |
1352 | msecs_to_jiffies(100))) { |
1353 | dev_err(dmm->dev, "timed out waiting for done\n"); |
1354 | ret = -ETIMEDOUT; |
1355 | + goto cleanup; |
1356 | } |
1357 | + |
1358 | + /* Check the engine status before continue */ |
1359 | + ret = wait_status(engine, DMM_PATSTATUS_READY | |
1360 | + DMM_PATSTATUS_VALID | DMM_PATSTATUS_DONE); |
1361 | } |
1362 | |
1363 | cleanup: |
1364 | diff --git a/drivers/gpu/drm/tilcdc/tilcdc_regs.h b/drivers/gpu/drm/tilcdc/tilcdc_regs.h |
1365 | index f57c0d62c76a..19d8dc3cdd40 100644 |
1366 | --- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h |
1367 | +++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h |
1368 | @@ -124,7 +124,7 @@ static inline void tilcdc_write64(struct drm_device *dev, u32 reg, u64 data) |
1369 | struct tilcdc_drm_private *priv = dev->dev_private; |
1370 | volatile void __iomem *addr = priv->mmio + reg; |
1371 | |
1372 | -#ifdef iowrite64 |
1373 | +#if defined(iowrite64) && !defined(iowrite64_is_nonatomic) |
1374 | iowrite64(data, addr); |
1375 | #else |
1376 | __iowmb(); |
1377 | diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c |
1378 | index 6031cd146556..802afc98e8bd 100644 |
1379 | --- a/drivers/hsi/clients/ssi_protocol.c |
1380 | +++ b/drivers/hsi/clients/ssi_protocol.c |
1381 | @@ -989,7 +989,7 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev) |
1382 | goto drop; |
1383 | /* Pad to 32-bits - FIXME: Revisit*/ |
1384 | if ((skb->len & 3) && skb_pad(skb, 4 - (skb->len & 3))) |
1385 | - goto drop; |
1386 | + goto inc_dropped; |
1387 | |
1388 | /* |
1389 | * Modem sends Phonet messages over SSI with its own endianess... |
1390 | @@ -1041,8 +1041,9 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev) |
1391 | drop2: |
1392 | hsi_free_msg(msg); |
1393 | drop: |
1394 | - dev->stats.tx_dropped++; |
1395 | dev_kfree_skb(skb); |
1396 | +inc_dropped: |
1397 | + dev->stats.tx_dropped++; |
1398 | |
1399 | return 0; |
1400 | } |
1401 | diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c |
1402 | index 0673baf0f2f5..ff579a7c6d00 100644 |
1403 | --- a/drivers/hwtracing/coresight/coresight-tpiu.c |
1404 | +++ b/drivers/hwtracing/coresight/coresight-tpiu.c |
1405 | @@ -46,8 +46,11 @@ |
1406 | #define TPIU_ITATBCTR0 0xef8 |
1407 | |
1408 | /** register definition **/ |
1409 | +/* FFSR - 0x300 */ |
1410 | +#define FFSR_FT_STOPPED BIT(1) |
1411 | /* FFCR - 0x304 */ |
1412 | #define FFCR_FON_MAN BIT(6) |
1413 | +#define FFCR_STOP_FI BIT(12) |
1414 | |
1415 | /** |
1416 | * @base: memory mapped base address for this component. |
1417 | @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata) |
1418 | { |
1419 | CS_UNLOCK(drvdata->base); |
1420 | |
1421 | - /* Clear formatter controle reg. */ |
1422 | - writel_relaxed(0x0, drvdata->base + TPIU_FFCR); |
1423 | + /* Clear formatter and stop on flush */ |
1424 | + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR); |
1425 | /* Generate manual flush */ |
1426 | - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR); |
1427 | + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); |
1428 | + /* Wait for flush to complete */ |
1429 | + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0); |
1430 | + /* Wait for formatter to stop */ |
1431 | + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1); |
1432 | |
1433 | CS_LOCK(drvdata->base); |
1434 | } |
1435 | diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c |
1436 | index dfc98df7b1b6..7aa7b9cb6203 100644 |
1437 | --- a/drivers/i2c/busses/i2c-scmi.c |
1438 | +++ b/drivers/i2c/busses/i2c-scmi.c |
1439 | @@ -18,6 +18,9 @@ |
1440 | #define ACPI_SMBUS_HC_CLASS "smbus" |
1441 | #define ACPI_SMBUS_HC_DEVICE_NAME "cmi" |
1442 | |
1443 | +/* SMBUS HID definition as supported by Microsoft Windows */ |
1444 | +#define ACPI_SMBUS_MS_HID "SMB0001" |
1445 | + |
1446 | ACPI_MODULE_NAME("smbus_cmi"); |
1447 | |
1448 | struct smbus_methods_t { |
1449 | @@ -51,6 +54,7 @@ static const struct smbus_methods_t ibm_smbus_methods = { |
1450 | static const struct acpi_device_id acpi_smbus_cmi_ids[] = { |
1451 | {"SMBUS01", (kernel_ulong_t)&smbus_methods}, |
1452 | {ACPI_SMBUS_IBM_HID, (kernel_ulong_t)&ibm_smbus_methods}, |
1453 | + {ACPI_SMBUS_MS_HID, (kernel_ulong_t)&smbus_methods}, |
1454 | {"", 0} |
1455 | }; |
1456 | MODULE_DEVICE_TABLE(acpi, acpi_smbus_cmi_ids); |
1457 | diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c |
1458 | index 3a557e3181ea..fe94415a0bc7 100644 |
1459 | --- a/drivers/iio/accel/st_accel_core.c |
1460 | +++ b/drivers/iio/accel/st_accel_core.c |
1461 | @@ -827,6 +827,8 @@ static const struct iio_trigger_ops st_accel_trigger_ops = { |
1462 | int st_accel_common_probe(struct iio_dev *indio_dev) |
1463 | { |
1464 | struct st_sensor_data *adata = iio_priv(indio_dev); |
1465 | + struct st_sensors_platform_data *pdata = |
1466 | + (struct st_sensors_platform_data *)adata->dev->platform_data; |
1467 | int irq = adata->get_irq_data_ready(indio_dev); |
1468 | int err; |
1469 | |
1470 | @@ -853,9 +855,8 @@ int st_accel_common_probe(struct iio_dev *indio_dev) |
1471 | &adata->sensor_settings->fs.fs_avl[0]; |
1472 | adata->odr = adata->sensor_settings->odr.odr_avl[0].hz; |
1473 | |
1474 | - if (!adata->dev->platform_data) |
1475 | - adata->dev->platform_data = |
1476 | - (struct st_sensors_platform_data *)&default_accel_pdata; |
1477 | + if (!pdata) |
1478 | + pdata = (struct st_sensors_platform_data *)&default_accel_pdata; |
1479 | |
1480 | err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data); |
1481 | if (err < 0) |
1482 | diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
1483 | index ab646a90e3da..af85db50412e 100644 |
1484 | --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
1485 | +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c |
1486 | @@ -215,7 +215,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, |
1487 | ret = sensor_hub_set_feature(st->hsdev, st->poll.report_id, |
1488 | st->poll.index, sizeof(value), &value); |
1489 | if (ret < 0 || value < 0) |
1490 | - ret = -EINVAL; |
1491 | + return -EINVAL; |
1492 | |
1493 | ret = sensor_hub_get_feature(st->hsdev, |
1494 | st->poll.report_id, |
1495 | @@ -265,7 +265,7 @@ int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st, |
1496 | st->sensitivity.index, sizeof(value), |
1497 | &value); |
1498 | if (ret < 0 || value < 0) |
1499 | - ret = -EINVAL; |
1500 | + return -EINVAL; |
1501 | |
1502 | ret = sensor_hub_get_feature(st->hsdev, |
1503 | st->sensitivity.report_id, |
1504 | diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c |
1505 | index 44e46c159a7e..bec60299b6ec 100644 |
1506 | --- a/drivers/iio/pressure/st_pressure_core.c |
1507 | +++ b/drivers/iio/pressure/st_pressure_core.c |
1508 | @@ -638,6 +638,8 @@ static const struct iio_trigger_ops st_press_trigger_ops = { |
1509 | int st_press_common_probe(struct iio_dev *indio_dev) |
1510 | { |
1511 | struct st_sensor_data *press_data = iio_priv(indio_dev); |
1512 | + struct st_sensors_platform_data *pdata = |
1513 | + (struct st_sensors_platform_data *)press_data->dev->platform_data; |
1514 | int irq = press_data->get_irq_data_ready(indio_dev); |
1515 | int err; |
1516 | |
1517 | @@ -673,10 +675,8 @@ int st_press_common_probe(struct iio_dev *indio_dev) |
1518 | press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz; |
1519 | |
1520 | /* Some devices don't support a data ready pin. */ |
1521 | - if (!press_data->dev->platform_data && |
1522 | - press_data->sensor_settings->drdy_irq.addr) |
1523 | - press_data->dev->platform_data = |
1524 | - (struct st_sensors_platform_data *)&default_press_pdata; |
1525 | + if (!pdata && press_data->sensor_settings->drdy_irq.addr) |
1526 | + pdata = (struct st_sensors_platform_data *)&default_press_pdata; |
1527 | |
1528 | err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data); |
1529 | if (err < 0) |
1530 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
1531 | index 30f01613b518..cbe5324c4331 100644 |
1532 | --- a/drivers/infiniband/core/cma.c |
1533 | +++ b/drivers/infiniband/core/cma.c |
1534 | @@ -4039,6 +4039,9 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr, |
1535 | struct cma_multicast *mc; |
1536 | int ret; |
1537 | |
1538 | + if (!id->device) |
1539 | + return -EINVAL; |
1540 | + |
1541 | id_priv = container_of(id, struct rdma_id_private, id); |
1542 | if (!cma_comp(id_priv, RDMA_CM_ADDR_BOUND) && |
1543 | !cma_comp(id_priv, RDMA_CM_ADDR_RESOLVED)) |
1544 | @@ -4336,7 +4339,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb) |
1545 | RDMA_NL_RDMA_CM_ATTR_SRC_ADDR)) |
1546 | goto out; |
1547 | if (ibnl_put_attr(skb, nlh, |
1548 | - rdma_addr_size(cma_src_addr(id_priv)), |
1549 | + rdma_addr_size(cma_dst_addr(id_priv)), |
1550 | cma_dst_addr(id_priv), |
1551 | RDMA_NL_RDMA_CM_ATTR_DST_ADDR)) |
1552 | goto out; |
1553 | diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c |
1554 | index ade71e7f0131..2fe4c2c921de 100644 |
1555 | --- a/drivers/infiniband/core/iwpm_util.c |
1556 | +++ b/drivers/infiniband/core/iwpm_util.c |
1557 | @@ -664,6 +664,7 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid) |
1558 | } |
1559 | skb_num++; |
1560 | spin_lock_irqsave(&iwpm_mapinfo_lock, flags); |
1561 | + ret = -EINVAL; |
1562 | for (i = 0; i < IWPM_MAPINFO_HASH_SIZE; i++) { |
1563 | hlist_for_each_entry(map_info, &iwpm_hash_bucket[i], |
1564 | hlist_node) { |
1565 | diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
1566 | index 6840d3c5cd64..017a09ceba3f 100644 |
1567 | --- a/drivers/infiniband/core/ucma.c |
1568 | +++ b/drivers/infiniband/core/ucma.c |
1569 | @@ -1330,7 +1330,7 @@ static ssize_t ucma_process_join(struct ucma_file *file, |
1570 | return -ENOSPC; |
1571 | |
1572 | addr = (struct sockaddr *) &cmd->addr; |
1573 | - if (!cmd->addr_size || (cmd->addr_size != rdma_addr_size(addr))) |
1574 | + if (cmd->addr_size != rdma_addr_size(addr)) |
1575 | return -EINVAL; |
1576 | |
1577 | if (cmd->join_flags == RDMA_MC_JOIN_FLAG_FULLMEMBER) |
1578 | @@ -1398,6 +1398,9 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file, |
1579 | join_cmd.uid = cmd.uid; |
1580 | join_cmd.id = cmd.id; |
1581 | join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr); |
1582 | + if (!join_cmd.addr_size) |
1583 | + return -EINVAL; |
1584 | + |
1585 | join_cmd.join_flags = RDMA_MC_JOIN_FLAG_FULLMEMBER; |
1586 | memcpy(&join_cmd.addr, &cmd.addr, join_cmd.addr_size); |
1587 | |
1588 | @@ -1413,6 +1416,9 @@ static ssize_t ucma_join_multicast(struct ucma_file *file, |
1589 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1590 | return -EFAULT; |
1591 | |
1592 | + if (!rdma_addr_size((struct sockaddr *)&cmd.addr)) |
1593 | + return -EINVAL; |
1594 | + |
1595 | return ucma_process_join(file, &cmd, out_len); |
1596 | } |
1597 | |
1598 | diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c |
1599 | index 8e973a2993a6..e74aa1d60fdb 100644 |
1600 | --- a/drivers/infiniband/core/umem.c |
1601 | +++ b/drivers/infiniband/core/umem.c |
1602 | @@ -357,7 +357,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset, |
1603 | return -EINVAL; |
1604 | } |
1605 | |
1606 | - ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length, |
1607 | + ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length, |
1608 | offset + ib_umem_offset(umem)); |
1609 | |
1610 | if (ret < 0) |
1611 | diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
1612 | index d118ffe0bfb6..4b717cf50d27 100644 |
1613 | --- a/drivers/infiniband/core/uverbs_cmd.c |
1614 | +++ b/drivers/infiniband/core/uverbs_cmd.c |
1615 | @@ -2491,9 +2491,13 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file, |
1616 | |
1617 | static void *alloc_wr(size_t wr_size, __u32 num_sge) |
1618 | { |
1619 | + if (num_sge >= (U32_MAX - ALIGN(wr_size, sizeof (struct ib_sge))) / |
1620 | + sizeof (struct ib_sge)) |
1621 | + return NULL; |
1622 | + |
1623 | return kmalloc(ALIGN(wr_size, sizeof (struct ib_sge)) + |
1624 | num_sge * sizeof (struct ib_sge), GFP_KERNEL); |
1625 | -}; |
1626 | +} |
1627 | |
1628 | ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, |
1629 | struct ib_device *ib_dev, |
1630 | @@ -2720,6 +2724,13 @@ static struct ib_recv_wr *ib_uverbs_unmarshall_recv(const char __user *buf, |
1631 | goto err; |
1632 | } |
1633 | |
1634 | + if (user_wr->num_sge >= |
1635 | + (U32_MAX - ALIGN(sizeof *next, sizeof (struct ib_sge))) / |
1636 | + sizeof (struct ib_sge)) { |
1637 | + ret = -EINVAL; |
1638 | + goto err; |
1639 | + } |
1640 | + |
1641 | next = kmalloc(ALIGN(sizeof *next, sizeof (struct ib_sge)) + |
1642 | user_wr->num_sge * sizeof (struct ib_sge), |
1643 | GFP_KERNEL); |
1644 | diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c |
1645 | index 3be62ef154d1..7853b0caad32 100644 |
1646 | --- a/drivers/infiniband/hw/hfi1/chip.c |
1647 | +++ b/drivers/infiniband/hw/hfi1/chip.c |
1648 | @@ -6379,18 +6379,17 @@ static void lcb_shutdown(struct hfi1_devdata *dd, int abort) |
1649 | * |
1650 | * The expectation is that the caller of this routine would have taken |
1651 | * care of properly transitioning the link into the correct state. |
1652 | + * NOTE: the caller needs to acquire the dd->dc8051_lock lock |
1653 | + * before calling this function. |
1654 | */ |
1655 | -static void dc_shutdown(struct hfi1_devdata *dd) |
1656 | +static void _dc_shutdown(struct hfi1_devdata *dd) |
1657 | { |
1658 | - unsigned long flags; |
1659 | + lockdep_assert_held(&dd->dc8051_lock); |
1660 | |
1661 | - spin_lock_irqsave(&dd->dc8051_lock, flags); |
1662 | - if (dd->dc_shutdown) { |
1663 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1664 | + if (dd->dc_shutdown) |
1665 | return; |
1666 | - } |
1667 | + |
1668 | dd->dc_shutdown = 1; |
1669 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1670 | /* Shutdown the LCB */ |
1671 | lcb_shutdown(dd, 1); |
1672 | /* |
1673 | @@ -6401,35 +6400,45 @@ static void dc_shutdown(struct hfi1_devdata *dd) |
1674 | write_csr(dd, DC_DC8051_CFG_RST, 0x1); |
1675 | } |
1676 | |
1677 | +static void dc_shutdown(struct hfi1_devdata *dd) |
1678 | +{ |
1679 | + mutex_lock(&dd->dc8051_lock); |
1680 | + _dc_shutdown(dd); |
1681 | + mutex_unlock(&dd->dc8051_lock); |
1682 | +} |
1683 | + |
1684 | /* |
1685 | * Calling this after the DC has been brought out of reset should not |
1686 | * do any damage. |
1687 | + * NOTE: the caller needs to acquire the dd->dc8051_lock lock |
1688 | + * before calling this function. |
1689 | */ |
1690 | -static void dc_start(struct hfi1_devdata *dd) |
1691 | +static void _dc_start(struct hfi1_devdata *dd) |
1692 | { |
1693 | - unsigned long flags; |
1694 | - int ret; |
1695 | + lockdep_assert_held(&dd->dc8051_lock); |
1696 | |
1697 | - spin_lock_irqsave(&dd->dc8051_lock, flags); |
1698 | if (!dd->dc_shutdown) |
1699 | - goto done; |
1700 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1701 | + return; |
1702 | + |
1703 | /* Take the 8051 out of reset */ |
1704 | write_csr(dd, DC_DC8051_CFG_RST, 0ull); |
1705 | /* Wait until 8051 is ready */ |
1706 | - ret = wait_fm_ready(dd, TIMEOUT_8051_START); |
1707 | - if (ret) { |
1708 | + if (wait_fm_ready(dd, TIMEOUT_8051_START)) |
1709 | dd_dev_err(dd, "%s: timeout starting 8051 firmware\n", |
1710 | __func__); |
1711 | - } |
1712 | + |
1713 | /* Take away reset for LCB and RX FPE (set in lcb_shutdown). */ |
1714 | write_csr(dd, DCC_CFG_RESET, 0x10); |
1715 | /* lcb_shutdown() with abort=1 does not restore these */ |
1716 | write_csr(dd, DC_LCB_ERR_EN, dd->lcb_err_en); |
1717 | - spin_lock_irqsave(&dd->dc8051_lock, flags); |
1718 | dd->dc_shutdown = 0; |
1719 | -done: |
1720 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1721 | +} |
1722 | + |
1723 | +static void dc_start(struct hfi1_devdata *dd) |
1724 | +{ |
1725 | + mutex_lock(&dd->dc8051_lock); |
1726 | + _dc_start(dd); |
1727 | + mutex_unlock(&dd->dc8051_lock); |
1728 | } |
1729 | |
1730 | /* |
1731 | @@ -8418,16 +8427,11 @@ static int do_8051_command( |
1732 | { |
1733 | u64 reg, completed; |
1734 | int return_code; |
1735 | - unsigned long flags; |
1736 | unsigned long timeout; |
1737 | |
1738 | hfi1_cdbg(DC8051, "type %d, data 0x%012llx", type, in_data); |
1739 | |
1740 | - /* |
1741 | - * Alternative to holding the lock for a long time: |
1742 | - * - keep busy wait - have other users bounce off |
1743 | - */ |
1744 | - spin_lock_irqsave(&dd->dc8051_lock, flags); |
1745 | + mutex_lock(&dd->dc8051_lock); |
1746 | |
1747 | /* We can't send any commands to the 8051 if it's in reset */ |
1748 | if (dd->dc_shutdown) { |
1749 | @@ -8453,10 +8457,8 @@ static int do_8051_command( |
1750 | return_code = -ENXIO; |
1751 | goto fail; |
1752 | } |
1753 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1754 | - dc_shutdown(dd); |
1755 | - dc_start(dd); |
1756 | - spin_lock_irqsave(&dd->dc8051_lock, flags); |
1757 | + _dc_shutdown(dd); |
1758 | + _dc_start(dd); |
1759 | } |
1760 | |
1761 | /* |
1762 | @@ -8534,8 +8536,7 @@ static int do_8051_command( |
1763 | write_csr(dd, DC_DC8051_CFG_HOST_CMD_0, 0); |
1764 | |
1765 | fail: |
1766 | - spin_unlock_irqrestore(&dd->dc8051_lock, flags); |
1767 | - |
1768 | + mutex_unlock(&dd->dc8051_lock); |
1769 | return return_code; |
1770 | } |
1771 | |
1772 | @@ -11849,6 +11850,10 @@ static void free_cntrs(struct hfi1_devdata *dd) |
1773 | dd->scntrs = NULL; |
1774 | kfree(dd->cntrnames); |
1775 | dd->cntrnames = NULL; |
1776 | + if (dd->update_cntr_wq) { |
1777 | + destroy_workqueue(dd->update_cntr_wq); |
1778 | + dd->update_cntr_wq = NULL; |
1779 | + } |
1780 | } |
1781 | |
1782 | static u64 read_dev_port_cntr(struct hfi1_devdata *dd, struct cntr_entry *entry, |
1783 | @@ -12004,7 +12009,7 @@ u64 write_port_cntr(struct hfi1_pportdata *ppd, int index, int vl, u64 data) |
1784 | return write_dev_port_cntr(ppd->dd, entry, sval, ppd, vl, data); |
1785 | } |
1786 | |
1787 | -static void update_synth_timer(unsigned long opaque) |
1788 | +static void do_update_synth_timer(struct work_struct *work) |
1789 | { |
1790 | u64 cur_tx; |
1791 | u64 cur_rx; |
1792 | @@ -12013,8 +12018,8 @@ static void update_synth_timer(unsigned long opaque) |
1793 | int i, j, vl; |
1794 | struct hfi1_pportdata *ppd; |
1795 | struct cntr_entry *entry; |
1796 | - |
1797 | - struct hfi1_devdata *dd = (struct hfi1_devdata *)opaque; |
1798 | + struct hfi1_devdata *dd = container_of(work, struct hfi1_devdata, |
1799 | + update_cntr_work); |
1800 | |
1801 | /* |
1802 | * Rather than keep beating on the CSRs pick a minimal set that we can |
1803 | @@ -12097,7 +12102,13 @@ static void update_synth_timer(unsigned long opaque) |
1804 | } else { |
1805 | hfi1_cdbg(CNTR, "[%d] No update necessary", dd->unit); |
1806 | } |
1807 | +} |
1808 | + |
1809 | +static void update_synth_timer(unsigned long opaque) |
1810 | +{ |
1811 | + struct hfi1_devdata *dd = (struct hfi1_devdata *)opaque; |
1812 | |
1813 | + queue_work(dd->update_cntr_wq, &dd->update_cntr_work); |
1814 | mod_timer(&dd->synth_stats_timer, jiffies + HZ * SYNTH_CNT_TIME); |
1815 | } |
1816 | |
1817 | @@ -12333,6 +12344,13 @@ static int init_cntrs(struct hfi1_devdata *dd) |
1818 | if (init_cpu_counters(dd)) |
1819 | goto bail; |
1820 | |
1821 | + dd->update_cntr_wq = alloc_ordered_workqueue("hfi1_update_cntr_%d", |
1822 | + WQ_MEM_RECLAIM, dd->unit); |
1823 | + if (!dd->update_cntr_wq) |
1824 | + goto bail; |
1825 | + |
1826 | + INIT_WORK(&dd->update_cntr_work, do_update_synth_timer); |
1827 | + |
1828 | mod_timer(&dd->synth_stats_timer, jiffies + HZ * SYNTH_CNT_TIME); |
1829 | return 0; |
1830 | bail: |
1831 | diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h |
1832 | index cc87fd4e534b..a3279f3d2578 100644 |
1833 | --- a/drivers/infiniband/hw/hfi1/hfi.h |
1834 | +++ b/drivers/infiniband/hw/hfi1/hfi.h |
1835 | @@ -475,7 +475,7 @@ struct rvt_sge_state; |
1836 | #define HFI1_PART_ENFORCE_OUT 0x2 |
1837 | |
1838 | /* how often we check for synthetic counter wrap around */ |
1839 | -#define SYNTH_CNT_TIME 2 |
1840 | +#define SYNTH_CNT_TIME 3 |
1841 | |
1842 | /* Counter flags */ |
1843 | #define CNTR_NORMAL 0x0 /* Normal counters, just read register */ |
1844 | @@ -929,8 +929,9 @@ struct hfi1_devdata { |
1845 | spinlock_t rcvctrl_lock; /* protect changes to RcvCtrl */ |
1846 | /* around rcd and (user ctxts) ctxt_cnt use (intr vs free) */ |
1847 | spinlock_t uctxt_lock; /* rcd and user context changes */ |
1848 | - /* exclusive access to 8051 */ |
1849 | - spinlock_t dc8051_lock; |
1850 | + struct mutex dc8051_lock; /* exclusive access to 8051 */ |
1851 | + struct workqueue_struct *update_cntr_wq; |
1852 | + struct work_struct update_cntr_work; |
1853 | /* exclusive access to 8051 memory */ |
1854 | spinlock_t dc8051_memlock; |
1855 | int dc8051_timed_out; /* remember if the 8051 timed out */ |
1856 | diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c |
1857 | index a3dd27b1305d..84a97f3f9299 100644 |
1858 | --- a/drivers/infiniband/hw/hfi1/init.c |
1859 | +++ b/drivers/infiniband/hw/hfi1/init.c |
1860 | @@ -1078,11 +1078,11 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra) |
1861 | spin_lock_init(&dd->uctxt_lock); |
1862 | spin_lock_init(&dd->hfi1_diag_trans_lock); |
1863 | spin_lock_init(&dd->sc_init_lock); |
1864 | - spin_lock_init(&dd->dc8051_lock); |
1865 | spin_lock_init(&dd->dc8051_memlock); |
1866 | seqlock_init(&dd->sc2vl_lock); |
1867 | spin_lock_init(&dd->sde_map_lock); |
1868 | spin_lock_init(&dd->pio_map_lock); |
1869 | + mutex_init(&dd->dc8051_lock); |
1870 | init_waitqueue_head(&dd->event_queue); |
1871 | |
1872 | dd->int_counter = alloc_percpu(u64); |
1873 | diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
1874 | index c41c8d0a4ac0..19bc1c2186ff 100644 |
1875 | --- a/drivers/infiniband/hw/mlx4/main.c |
1876 | +++ b/drivers/infiniband/hw/mlx4/main.c |
1877 | @@ -1168,7 +1168,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) |
1878 | /* need to protect from a race on closing the vma as part of |
1879 | * mlx4_ib_vma_close(). |
1880 | */ |
1881 | - down_read(&owning_mm->mmap_sem); |
1882 | + down_write(&owning_mm->mmap_sem); |
1883 | for (i = 0; i < HW_BAR_COUNT; i++) { |
1884 | vma = context->hw_bar_info[i].vma; |
1885 | if (!vma) |
1886 | @@ -1182,11 +1182,13 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) |
1887 | BUG_ON(1); |
1888 | } |
1889 | |
1890 | + context->hw_bar_info[i].vma->vm_flags &= |
1891 | + ~(VM_SHARED | VM_MAYSHARE); |
1892 | /* context going to be destroyed, should not access ops any more */ |
1893 | context->hw_bar_info[i].vma->vm_ops = NULL; |
1894 | } |
1895 | |
1896 | - up_read(&owning_mm->mmap_sem); |
1897 | + up_write(&owning_mm->mmap_sem); |
1898 | mmput(owning_mm); |
1899 | put_task_struct(owning_process); |
1900 | } |
1901 | diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c |
1902 | index 9cdcff77b9a8..fc62a7ded734 100644 |
1903 | --- a/drivers/infiniband/hw/mlx5/cq.c |
1904 | +++ b/drivers/infiniband/hw/mlx5/cq.c |
1905 | @@ -172,6 +172,8 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, |
1906 | struct mlx5_ib_srq *srq; |
1907 | struct mlx5_ib_wq *wq; |
1908 | u16 wqe_ctr; |
1909 | + u8 roce_packet_type; |
1910 | + bool vlan_present; |
1911 | u8 g; |
1912 | |
1913 | if (qp->ibqp.srq || qp->ibqp.xrcd) { |
1914 | @@ -223,7 +225,6 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, |
1915 | break; |
1916 | } |
1917 | wc->slid = be16_to_cpu(cqe->slid); |
1918 | - wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf; |
1919 | wc->src_qp = be32_to_cpu(cqe->flags_rqpn) & 0xffffff; |
1920 | wc->dlid_path_bits = cqe->ml_path; |
1921 | g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3; |
1922 | @@ -237,10 +238,22 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, |
1923 | wc->pkey_index = 0; |
1924 | } |
1925 | |
1926 | - if (ll != IB_LINK_LAYER_ETHERNET) |
1927 | + if (ll != IB_LINK_LAYER_ETHERNET) { |
1928 | + wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf; |
1929 | return; |
1930 | + } |
1931 | + |
1932 | + vlan_present = cqe->l4_l3_hdr_type & 0x1; |
1933 | + roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3; |
1934 | + if (vlan_present) { |
1935 | + wc->vlan_id = (be16_to_cpu(cqe->vlan_info)) & 0xfff; |
1936 | + wc->sl = (be16_to_cpu(cqe->vlan_info) >> 13) & 0x7; |
1937 | + wc->wc_flags |= IB_WC_WITH_VLAN; |
1938 | + } else { |
1939 | + wc->sl = 0; |
1940 | + } |
1941 | |
1942 | - switch (wc->sl & 0x3) { |
1943 | + switch (roce_packet_type) { |
1944 | case MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH: |
1945 | wc->network_hdr_type = RDMA_NETWORK_IB; |
1946 | break; |
1947 | diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1948 | index 5e29fbd3a5a0..d7da1dca765f 100644 |
1949 | --- a/drivers/infiniband/hw/mlx5/main.c |
1950 | +++ b/drivers/infiniband/hw/mlx5/main.c |
1951 | @@ -1313,7 +1313,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) |
1952 | /* need to protect from a race on closing the vma as part of |
1953 | * mlx5_ib_vma_close. |
1954 | */ |
1955 | - down_read(&owning_mm->mmap_sem); |
1956 | + down_write(&owning_mm->mmap_sem); |
1957 | list_for_each_entry_safe(vma_private, n, &context->vma_private_list, |
1958 | list) { |
1959 | vma = vma_private->vma; |
1960 | @@ -1323,11 +1323,12 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) |
1961 | /* context going to be destroyed, should |
1962 | * not access ops any more. |
1963 | */ |
1964 | + vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); |
1965 | vma->vm_ops = NULL; |
1966 | list_del(&vma_private->list); |
1967 | kfree(vma_private); |
1968 | } |
1969 | - up_read(&owning_mm->mmap_sem); |
1970 | + up_write(&owning_mm->mmap_sem); |
1971 | mmput(owning_mm); |
1972 | put_task_struct(owning_process); |
1973 | } |
1974 | diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c |
1975 | index fdd156101a72..403df3591d29 100644 |
1976 | --- a/drivers/infiniband/hw/mlx5/qp.c |
1977 | +++ b/drivers/infiniband/hw/mlx5/qp.c |
1978 | @@ -1130,7 +1130,7 @@ static void destroy_raw_packet_qp_sq(struct mlx5_ib_dev *dev, |
1979 | ib_umem_release(sq->ubuffer.umem); |
1980 | } |
1981 | |
1982 | -static int get_rq_pas_size(void *qpc) |
1983 | +static size_t get_rq_pas_size(void *qpc) |
1984 | { |
1985 | u32 log_page_size = MLX5_GET(qpc, qpc, log_page_size) + 12; |
1986 | u32 log_rq_stride = MLX5_GET(qpc, qpc, log_rq_stride); |
1987 | @@ -1146,7 +1146,8 @@ static int get_rq_pas_size(void *qpc) |
1988 | } |
1989 | |
1990 | static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, |
1991 | - struct mlx5_ib_rq *rq, void *qpin) |
1992 | + struct mlx5_ib_rq *rq, void *qpin, |
1993 | + size_t qpinlen) |
1994 | { |
1995 | struct mlx5_ib_qp *mqp = rq->base.container_mibqp; |
1996 | __be64 *pas; |
1997 | @@ -1155,9 +1156,12 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, |
1998 | void *rqc; |
1999 | void *wq; |
2000 | void *qpc = MLX5_ADDR_OF(create_qp_in, qpin, qpc); |
2001 | - int inlen; |
2002 | + size_t rq_pas_size = get_rq_pas_size(qpc); |
2003 | + size_t inlen; |
2004 | int err; |
2005 | - u32 rq_pas_size = get_rq_pas_size(qpc); |
2006 | + |
2007 | + if (qpinlen < rq_pas_size + MLX5_BYTE_OFF(create_qp_in, pas)) |
2008 | + return -EINVAL; |
2009 | |
2010 | inlen = MLX5_ST_SZ_BYTES(create_rq_in) + rq_pas_size; |
2011 | in = mlx5_vzalloc(inlen); |
2012 | @@ -1235,7 +1239,7 @@ static void destroy_raw_packet_qp_tir(struct mlx5_ib_dev *dev, |
2013 | } |
2014 | |
2015 | static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, |
2016 | - u32 *in, |
2017 | + u32 *in, size_t inlen, |
2018 | struct ib_pd *pd) |
2019 | { |
2020 | struct mlx5_ib_raw_packet_qp *raw_packet_qp = &qp->raw_packet_qp; |
2021 | @@ -1262,7 +1266,7 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, |
2022 | if (qp->rq.wqe_cnt) { |
2023 | rq->base.container_mibqp = qp; |
2024 | |
2025 | - err = create_raw_packet_qp_rq(dev, rq, in); |
2026 | + err = create_raw_packet_qp_rq(dev, rq, in, inlen); |
2027 | if (err) |
2028 | goto err_destroy_sq; |
2029 | |
2030 | @@ -1753,10 +1757,15 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, |
2031 | qp->flags |= MLX5_IB_QP_LSO; |
2032 | } |
2033 | |
2034 | + if (inlen < 0) { |
2035 | + err = -EINVAL; |
2036 | + goto err; |
2037 | + } |
2038 | + |
2039 | if (init_attr->qp_type == IB_QPT_RAW_PACKET) { |
2040 | qp->raw_packet_qp.sq.ubuffer.buf_addr = ucmd.sq_buf_addr; |
2041 | raw_packet_qp_copy_info(qp, &qp->raw_packet_qp); |
2042 | - err = create_raw_packet_qp(dev, qp, in, pd); |
2043 | + err = create_raw_packet_qp(dev, qp, in, inlen, pd); |
2044 | } else { |
2045 | err = mlx5_core_create_qp(dev->mdev, &base->mqp, in, inlen); |
2046 | } |
2047 | @@ -1796,6 +1805,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, |
2048 | else if (qp->create_type == MLX5_QP_KERNEL) |
2049 | destroy_qp_kernel(dev, qp); |
2050 | |
2051 | +err: |
2052 | kvfree(in); |
2053 | return err; |
2054 | } |
2055 | diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c |
2056 | index d61fd2c727c0..5c1dbe2f8757 100644 |
2057 | --- a/drivers/infiniband/hw/mlx5/srq.c |
2058 | +++ b/drivers/infiniband/hw/mlx5/srq.c |
2059 | @@ -243,8 +243,8 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, |
2060 | { |
2061 | struct mlx5_ib_dev *dev = to_mdev(pd->device); |
2062 | struct mlx5_ib_srq *srq; |
2063 | - int desc_size; |
2064 | - int buf_size; |
2065 | + size_t desc_size; |
2066 | + size_t buf_size; |
2067 | int err; |
2068 | struct mlx5_srq_attr in = {0}; |
2069 | __u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); |
2070 | @@ -268,15 +268,18 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, |
2071 | |
2072 | desc_size = sizeof(struct mlx5_wqe_srq_next_seg) + |
2073 | srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg); |
2074 | + if (desc_size == 0 || srq->msrq.max_gs > desc_size) |
2075 | + return ERR_PTR(-EINVAL); |
2076 | desc_size = roundup_pow_of_two(desc_size); |
2077 | - desc_size = max_t(int, 32, desc_size); |
2078 | + desc_size = max_t(size_t, 32, desc_size); |
2079 | + if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg)) |
2080 | + return ERR_PTR(-EINVAL); |
2081 | srq->msrq.max_avail_gather = (desc_size - sizeof(struct mlx5_wqe_srq_next_seg)) / |
2082 | sizeof(struct mlx5_wqe_data_seg); |
2083 | srq->msrq.wqe_shift = ilog2(desc_size); |
2084 | buf_size = srq->msrq.max * desc_size; |
2085 | - mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n", |
2086 | - desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs, |
2087 | - srq->msrq.max_avail_gather); |
2088 | + if (buf_size < desc_size) |
2089 | + return ERR_PTR(-EINVAL); |
2090 | in.type = init_attr->srq_type; |
2091 | |
2092 | if (pd->uobject) |
2093 | diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c |
2094 | index 8bef09a8c49f..265943069b35 100644 |
2095 | --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c |
2096 | +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c |
2097 | @@ -836,7 +836,7 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev) |
2098 | |
2099 | dev->reset_stats.type = OCRDMA_RESET_STATS; |
2100 | dev->reset_stats.dev = dev; |
2101 | - if (!debugfs_create_file("reset_stats", S_IRUSR, dev->dir, |
2102 | + if (!debugfs_create_file("reset_stats", 0200, dev->dir, |
2103 | &dev->reset_stats, &ocrdma_dbg_ops)) |
2104 | goto err; |
2105 | |
2106 | diff --git a/drivers/infiniband/sw/rdmavt/ah.c b/drivers/infiniband/sw/rdmavt/ah.c |
2107 | index 16c446142c2a..b0f09fb45c72 100644 |
2108 | --- a/drivers/infiniband/sw/rdmavt/ah.c |
2109 | +++ b/drivers/infiniband/sw/rdmavt/ah.c |
2110 | @@ -119,7 +119,7 @@ struct ib_ah *rvt_create_ah(struct ib_pd *pd, |
2111 | |
2112 | spin_lock_irqsave(&dev->n_ahs_lock, flags); |
2113 | if (dev->n_ahs_allocated == dev->dparms.props.max_ah) { |
2114 | - spin_unlock(&dev->n_ahs_lock); |
2115 | + spin_unlock_irqrestore(&dev->n_ahs_lock, flags); |
2116 | kfree(ah); |
2117 | return ERR_PTR(-ENOMEM); |
2118 | } |
2119 | diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c |
2120 | index 8c0ddd7165ae..0d25dc84d294 100644 |
2121 | --- a/drivers/infiniband/sw/rxe/rxe_resp.c |
2122 | +++ b/drivers/infiniband/sw/rxe/rxe_resp.c |
2123 | @@ -471,8 +471,6 @@ static enum resp_states check_rkey(struct rxe_qp *qp, |
2124 | state = RESPST_ERR_LENGTH; |
2125 | goto err; |
2126 | } |
2127 | - |
2128 | - qp->resp.resid = mtu; |
2129 | } else { |
2130 | if (pktlen != resid) { |
2131 | state = RESPST_ERR_LENGTH; |
2132 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
2133 | index 335bd2c9e16e..34122c96522b 100644 |
2134 | --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
2135 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
2136 | @@ -974,6 +974,19 @@ static inline int update_parent_pkey(struct ipoib_dev_priv *priv) |
2137 | */ |
2138 | priv->dev->broadcast[8] = priv->pkey >> 8; |
2139 | priv->dev->broadcast[9] = priv->pkey & 0xff; |
2140 | + |
2141 | + /* |
2142 | + * Update the broadcast address in the priv->broadcast object, |
2143 | + * in case it already exists, otherwise no one will do that. |
2144 | + */ |
2145 | + if (priv->broadcast) { |
2146 | + spin_lock_irq(&priv->lock); |
2147 | + memcpy(priv->broadcast->mcmember.mgid.raw, |
2148 | + priv->dev->broadcast + 4, |
2149 | + sizeof(union ib_gid)); |
2150 | + spin_unlock_irq(&priv->lock); |
2151 | + } |
2152 | + |
2153 | return 0; |
2154 | } |
2155 | |
2156 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2157 | index e37e918cb935..0df7d4504c06 100644 |
2158 | --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2159 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2160 | @@ -799,6 +799,22 @@ static void path_rec_completion(int status, |
2161 | spin_lock_irqsave(&priv->lock, flags); |
2162 | |
2163 | if (!IS_ERR_OR_NULL(ah)) { |
2164 | + /* |
2165 | + * pathrec.dgid is used as the database key from the LLADDR, |
2166 | + * it must remain unchanged even if the SA returns a different |
2167 | + * GID to use in the AH. |
2168 | + */ |
2169 | + if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw, |
2170 | + sizeof(union ib_gid))) { |
2171 | + ipoib_dbg( |
2172 | + priv, |
2173 | + "%s got PathRec for gid %pI6 while asked for %pI6\n", |
2174 | + dev->name, pathrec->dgid.raw, |
2175 | + path->pathrec.dgid.raw); |
2176 | + memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw, |
2177 | + sizeof(union ib_gid)); |
2178 | + } |
2179 | + |
2180 | path->pathrec = *pathrec; |
2181 | |
2182 | old_ah = path->ah; |
2183 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c |
2184 | index 6b6826f3e446..8f79caedf905 100644 |
2185 | --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c |
2186 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c |
2187 | @@ -487,6 +487,9 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) |
2188 | !test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) |
2189 | return -EINVAL; |
2190 | |
2191 | + init_completion(&mcast->done); |
2192 | + set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
2193 | + |
2194 | ipoib_dbg_mcast(priv, "joining MGID %pI6\n", mcast->mcmember.mgid.raw); |
2195 | |
2196 | rec.mgid = mcast->mcmember.mgid; |
2197 | @@ -645,8 +648,6 @@ void ipoib_mcast_join_task(struct work_struct *work) |
2198 | if (mcast->backoff == 1 || |
2199 | time_after_eq(jiffies, mcast->delay_until)) { |
2200 | /* Found the next unjoined group */ |
2201 | - init_completion(&mcast->done); |
2202 | - set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
2203 | if (ipoib_mcast_join(dev, mcast)) { |
2204 | spin_unlock_irq(&priv->lock); |
2205 | return; |
2206 | @@ -666,11 +667,9 @@ void ipoib_mcast_join_task(struct work_struct *work) |
2207 | queue_delayed_work(priv->wq, &priv->mcast_task, |
2208 | delay_until - jiffies); |
2209 | } |
2210 | - if (mcast) { |
2211 | - init_completion(&mcast->done); |
2212 | - set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
2213 | + if (mcast) |
2214 | ipoib_mcast_join(dev, mcast); |
2215 | - } |
2216 | + |
2217 | spin_unlock_irq(&priv->lock); |
2218 | } |
2219 | |
2220 | diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c |
2221 | index 0983470929bd..b879d21b7548 100644 |
2222 | --- a/drivers/infiniband/ulp/isert/ib_isert.c |
2223 | +++ b/drivers/infiniband/ulp/isert/ib_isert.c |
2224 | @@ -2098,6 +2098,9 @@ isert_rdma_rw_ctx_post(struct isert_cmd *cmd, struct isert_conn *conn, |
2225 | u32 rkey, offset; |
2226 | int ret; |
2227 | |
2228 | + if (cmd->ctx_init_done) |
2229 | + goto rdma_ctx_post; |
2230 | + |
2231 | if (dir == DMA_FROM_DEVICE) { |
2232 | addr = cmd->write_va; |
2233 | rkey = cmd->write_stag; |
2234 | @@ -2125,11 +2128,15 @@ isert_rdma_rw_ctx_post(struct isert_cmd *cmd, struct isert_conn *conn, |
2235 | se_cmd->t_data_sg, se_cmd->t_data_nents, |
2236 | offset, addr, rkey, dir); |
2237 | } |
2238 | + |
2239 | if (ret < 0) { |
2240 | isert_err("Cmd: %p failed to prepare RDMA res\n", cmd); |
2241 | return ret; |
2242 | } |
2243 | |
2244 | + cmd->ctx_init_done = true; |
2245 | + |
2246 | +rdma_ctx_post: |
2247 | ret = rdma_rw_ctx_post(&cmd->rw, conn->qp, port_num, cqe, chain_wr); |
2248 | if (ret < 0) |
2249 | isert_err("Cmd: %p failed to post RDMA res\n", cmd); |
2250 | diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h |
2251 | index c02ada57d7f5..85bd19753d55 100644 |
2252 | --- a/drivers/infiniband/ulp/isert/ib_isert.h |
2253 | +++ b/drivers/infiniband/ulp/isert/ib_isert.h |
2254 | @@ -124,6 +124,7 @@ struct isert_cmd { |
2255 | struct rdma_rw_ctx rw; |
2256 | struct work_struct comp_work; |
2257 | struct scatterlist sg; |
2258 | + bool ctx_init_done; |
2259 | }; |
2260 | |
2261 | static inline struct isert_cmd *tx_desc_to_cmd(struct iser_tx_desc *desc) |
2262 | diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c |
2263 | index 603fc2fadf05..12b20840fb74 100644 |
2264 | --- a/drivers/input/misc/twl4030-pwrbutton.c |
2265 | +++ b/drivers/input/misc/twl4030-pwrbutton.c |
2266 | @@ -70,7 +70,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev) |
2267 | pwr->phys = "twl4030_pwrbutton/input0"; |
2268 | pwr->dev.parent = &pdev->dev; |
2269 | |
2270 | - err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq, |
2271 | + err = devm_request_threaded_irq(&pdev->dev, irq, NULL, powerbutton_irq, |
2272 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | |
2273 | IRQF_ONESHOT, |
2274 | "twl4030_pwrbutton", pwr); |
2275 | diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c |
2276 | index 71b5a634cf6d..e7bb155911d0 100644 |
2277 | --- a/drivers/input/touchscreen/ar1021_i2c.c |
2278 | +++ b/drivers/input/touchscreen/ar1021_i2c.c |
2279 | @@ -152,7 +152,7 @@ static int __maybe_unused ar1021_i2c_resume(struct device *dev) |
2280 | static SIMPLE_DEV_PM_OPS(ar1021_i2c_pm, ar1021_i2c_suspend, ar1021_i2c_resume); |
2281 | |
2282 | static const struct i2c_device_id ar1021_i2c_id[] = { |
2283 | - { "MICROCHIP_AR1021_I2C", 0 }, |
2284 | + { "ar1021", 0 }, |
2285 | { }, |
2286 | }; |
2287 | MODULE_DEVICE_TABLE(i2c, ar1021_i2c_id); |
2288 | diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c |
2289 | index cb72e0011310..3a1c40684213 100644 |
2290 | --- a/drivers/iommu/intel-svm.c |
2291 | +++ b/drivers/iommu/intel-svm.c |
2292 | @@ -127,6 +127,7 @@ int intel_svm_enable_prq(struct intel_iommu *iommu) |
2293 | pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n", |
2294 | iommu->name); |
2295 | dmar_free_hwirq(irq); |
2296 | + iommu->pr_irq = 0; |
2297 | goto err; |
2298 | } |
2299 | dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL); |
2300 | @@ -142,9 +143,11 @@ int intel_svm_finish_prq(struct intel_iommu *iommu) |
2301 | dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL); |
2302 | dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL); |
2303 | |
2304 | - free_irq(iommu->pr_irq, iommu); |
2305 | - dmar_free_hwirq(iommu->pr_irq); |
2306 | - iommu->pr_irq = 0; |
2307 | + if (iommu->pr_irq) { |
2308 | + free_irq(iommu->pr_irq, iommu); |
2309 | + dmar_free_hwirq(iommu->pr_irq); |
2310 | + iommu->pr_irq = 0; |
2311 | + } |
2312 | |
2313 | free_pages((unsigned long)iommu->prq, PRQ_ORDER); |
2314 | iommu->prq = NULL; |
2315 | diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c |
2316 | index e2583cce2cc1..54556713c8d1 100644 |
2317 | --- a/drivers/iommu/omap-iommu.c |
2318 | +++ b/drivers/iommu/omap-iommu.c |
2319 | @@ -1299,6 +1299,7 @@ static int __init omap_iommu_init(void) |
2320 | const unsigned long flags = SLAB_HWCACHE_ALIGN; |
2321 | size_t align = 1 << 10; /* L2 pagetable alignement */ |
2322 | struct device_node *np; |
2323 | + int ret; |
2324 | |
2325 | np = of_find_matching_node(NULL, omap_iommu_of_match); |
2326 | if (!np) |
2327 | @@ -1312,11 +1313,25 @@ static int __init omap_iommu_init(void) |
2328 | return -ENOMEM; |
2329 | iopte_cachep = p; |
2330 | |
2331 | - bus_set_iommu(&platform_bus_type, &omap_iommu_ops); |
2332 | - |
2333 | omap_iommu_debugfs_init(); |
2334 | |
2335 | - return platform_driver_register(&omap_iommu_driver); |
2336 | + ret = platform_driver_register(&omap_iommu_driver); |
2337 | + if (ret) { |
2338 | + pr_err("%s: failed to register driver\n", __func__); |
2339 | + goto fail_driver; |
2340 | + } |
2341 | + |
2342 | + ret = bus_set_iommu(&platform_bus_type, &omap_iommu_ops); |
2343 | + if (ret) |
2344 | + goto fail_bus; |
2345 | + |
2346 | + return 0; |
2347 | + |
2348 | +fail_bus: |
2349 | + platform_driver_unregister(&omap_iommu_driver); |
2350 | +fail_driver: |
2351 | + kmem_cache_destroy(iopte_cachep); |
2352 | + return ret; |
2353 | } |
2354 | subsys_initcall(omap_iommu_init); |
2355 | /* must be ready before omap3isp is probed */ |
2356 | diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c |
2357 | index d74374f25392..abf696b49dd7 100644 |
2358 | --- a/drivers/irqchip/irq-mips-gic.c |
2359 | +++ b/drivers/irqchip/irq-mips-gic.c |
2360 | @@ -55,6 +55,7 @@ static unsigned int gic_cpu_pin; |
2361 | static unsigned int timer_cpu_pin; |
2362 | static struct irq_chip gic_level_irq_controller, gic_edge_irq_controller; |
2363 | DECLARE_BITMAP(ipi_resrv, GIC_MAX_INTRS); |
2364 | +DECLARE_BITMAP(ipi_available, GIC_MAX_INTRS); |
2365 | |
2366 | static void __gic_irq_dispatch(void); |
2367 | |
2368 | @@ -746,17 +747,17 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, |
2369 | |
2370 | return gic_setup_dev_chip(d, virq, spec->hwirq); |
2371 | } else { |
2372 | - base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs); |
2373 | + base_hwirq = find_first_bit(ipi_available, gic_shared_intrs); |
2374 | if (base_hwirq == gic_shared_intrs) { |
2375 | return -ENOMEM; |
2376 | } |
2377 | |
2378 | /* check that we have enough space */ |
2379 | for (i = base_hwirq; i < nr_irqs; i++) { |
2380 | - if (!test_bit(i, ipi_resrv)) |
2381 | + if (!test_bit(i, ipi_available)) |
2382 | return -EBUSY; |
2383 | } |
2384 | - bitmap_clear(ipi_resrv, base_hwirq, nr_irqs); |
2385 | + bitmap_clear(ipi_available, base_hwirq, nr_irqs); |
2386 | |
2387 | /* map the hwirq for each cpu consecutively */ |
2388 | i = 0; |
2389 | @@ -787,7 +788,7 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, |
2390 | |
2391 | return 0; |
2392 | error: |
2393 | - bitmap_set(ipi_resrv, base_hwirq, nr_irqs); |
2394 | + bitmap_set(ipi_available, base_hwirq, nr_irqs); |
2395 | return ret; |
2396 | } |
2397 | |
2398 | @@ -802,7 +803,7 @@ void gic_irq_domain_free(struct irq_domain *d, unsigned int virq, |
2399 | return; |
2400 | |
2401 | base_hwirq = GIC_HWIRQ_TO_SHARED(irqd_to_hwirq(data)); |
2402 | - bitmap_set(ipi_resrv, base_hwirq, nr_irqs); |
2403 | + bitmap_set(ipi_available, base_hwirq, nr_irqs); |
2404 | } |
2405 | |
2406 | int gic_irq_domain_match(struct irq_domain *d, struct device_node *node, |
2407 | @@ -1066,6 +1067,7 @@ static void __init __gic_init(unsigned long gic_base_addr, |
2408 | 2 * gic_vpes); |
2409 | } |
2410 | |
2411 | + bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); |
2412 | gic_basic_init(); |
2413 | } |
2414 | |
2415 | diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c |
2416 | index d70d4a5273b8..454ed4dc6ec1 100644 |
2417 | --- a/drivers/leds/led-core.c |
2418 | +++ b/drivers/leds/led-core.c |
2419 | @@ -186,8 +186,9 @@ void led_blink_set(struct led_classdev *led_cdev, |
2420 | unsigned long *delay_on, |
2421 | unsigned long *delay_off) |
2422 | { |
2423 | - led_stop_software_blink(led_cdev); |
2424 | + del_timer_sync(&led_cdev->blink_timer); |
2425 | |
2426 | + led_cdev->flags &= ~LED_BLINK_SW; |
2427 | led_cdev->flags &= ~LED_BLINK_ONESHOT; |
2428 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; |
2429 | |
2430 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
2431 | index b19b551bb34b..18a4271bf569 100644 |
2432 | --- a/drivers/md/raid10.c |
2433 | +++ b/drivers/md/raid10.c |
2434 | @@ -2704,6 +2704,11 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio) |
2435 | list_add(&r10_bio->retry_list, &conf->bio_end_io_list); |
2436 | conf->nr_queued++; |
2437 | spin_unlock_irq(&conf->device_lock); |
2438 | + /* |
2439 | + * In case freeze_array() is waiting for condition |
2440 | + * nr_pending == nr_queued + extra to be true. |
2441 | + */ |
2442 | + wake_up(&conf->wait_barrier); |
2443 | md_wakeup_thread(conf->mddev->thread); |
2444 | } else { |
2445 | if (test_bit(R10BIO_WriteError, |
2446 | @@ -4084,6 +4089,7 @@ static int raid10_start_reshape(struct mddev *mddev) |
2447 | diff = 0; |
2448 | if (first || diff < min_offset_diff) |
2449 | min_offset_diff = diff; |
2450 | + first = 0; |
2451 | } |
2452 | } |
2453 | |
2454 | diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c |
2455 | index b5b5b195ea7f..42ce88ceac66 100644 |
2456 | --- a/drivers/media/dvb-core/dvb_ca_en50221.c |
2457 | +++ b/drivers/media/dvb-core/dvb_ca_en50221.c |
2458 | @@ -779,6 +779,29 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * b |
2459 | goto exit; |
2460 | } |
2461 | |
2462 | + /* |
2463 | + * It may need some time for the CAM to settle down, or there might |
2464 | + * be a race condition between the CAM, writing HC and our last |
2465 | + * check for DA. This happens, if the CAM asserts DA, just after |
2466 | + * checking DA before we are setting HC. In this case it might be |
2467 | + * a bug in the CAM to keep the FR bit, the lower layer/HW |
2468 | + * communication requires a longer timeout or the CAM needs more |
2469 | + * time internally. But this happens in reality! |
2470 | + * We need to read the status from the HW again and do the same |
2471 | + * we did for the previous check for DA |
2472 | + */ |
2473 | + status = ca->pub->read_cam_control(ca->pub, slot, CTRLIF_STATUS); |
2474 | + if (status < 0) |
2475 | + goto exit; |
2476 | + |
2477 | + if (status & (STATUSREG_DA | STATUSREG_RE)) { |
2478 | + if (status & STATUSREG_DA) |
2479 | + dvb_ca_en50221_thread_wakeup(ca); |
2480 | + |
2481 | + status = -EAGAIN; |
2482 | + goto exit; |
2483 | + } |
2484 | + |
2485 | /* send the amount of data */ |
2486 | if ((status = ca->pub->write_cam_control(ca->pub, slot, CTRLIF_SIZE_HIGH, bytes_write >> 8)) != 0) |
2487 | goto exit; |
2488 | diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c |
2489 | index 20b4a659e2e4..0fe69f79a24d 100644 |
2490 | --- a/drivers/media/dvb-frontends/si2168.c |
2491 | +++ b/drivers/media/dvb-frontends/si2168.c |
2492 | @@ -14,6 +14,8 @@ |
2493 | * GNU General Public License for more details. |
2494 | */ |
2495 | |
2496 | +#include <linux/delay.h> |
2497 | + |
2498 | #include "si2168_priv.h" |
2499 | |
2500 | static const struct dvb_frontend_ops si2168_ops; |
2501 | @@ -378,6 +380,7 @@ static int si2168_init(struct dvb_frontend *fe) |
2502 | if (ret) |
2503 | goto err; |
2504 | |
2505 | + udelay(100); |
2506 | memcpy(cmd.args, "\x85", 1); |
2507 | cmd.wlen = 1; |
2508 | cmd.rlen = 1; |
2509 | diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c |
2510 | index 8aa726651630..90fcccc05b56 100644 |
2511 | --- a/drivers/media/pci/bt8xx/bt878.c |
2512 | +++ b/drivers/media/pci/bt8xx/bt878.c |
2513 | @@ -422,8 +422,7 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
2514 | bt878_num); |
2515 | if (bt878_num >= BT878_MAX) { |
2516 | printk(KERN_ERR "bt878: Too many devices inserted\n"); |
2517 | - result = -ENOMEM; |
2518 | - goto fail0; |
2519 | + return -ENOMEM; |
2520 | } |
2521 | if (pci_enable_device(dev)) |
2522 | return -EIO; |
2523 | diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2524 | index 30c148b9d65e..06e2cfd09855 100644 |
2525 | --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2526 | +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2527 | @@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(unsigned long ac8sectpfei) |
2528 | static void channel_swdemux_tsklet(unsigned long data) |
2529 | { |
2530 | struct channel_info *channel = (struct channel_info *)data; |
2531 | - struct c8sectpfei *fei = channel->fei; |
2532 | + struct c8sectpfei *fei; |
2533 | unsigned long wp, rp; |
2534 | int pos, num_packets, n, size; |
2535 | u8 *buf; |
2536 | @@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsigned long data) |
2537 | if (unlikely(!channel || !channel->irec)) |
2538 | return; |
2539 | |
2540 | + fei = channel->fei; |
2541 | + |
2542 | wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0)); |
2543 | rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0)); |
2544 | |
2545 | diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c |
2546 | index 8f8bacb67a15..a6b5259ffbdd 100644 |
2547 | --- a/drivers/mfd/palmas.c |
2548 | +++ b/drivers/mfd/palmas.c |
2549 | @@ -430,6 +430,20 @@ static void palmas_power_off(void) |
2550 | { |
2551 | unsigned int addr; |
2552 | int ret, slave; |
2553 | + struct device_node *np = palmas_dev->dev->of_node; |
2554 | + |
2555 | + if (of_property_read_bool(np, "ti,palmas-override-powerhold")) { |
2556 | + addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE, |
2557 | + PALMAS_PRIMARY_SECONDARY_PAD2); |
2558 | + slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); |
2559 | + |
2560 | + ret = regmap_update_bits(palmas_dev->regmap[slave], addr, |
2561 | + PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0); |
2562 | + if (ret) |
2563 | + dev_err(palmas_dev->dev, |
2564 | + "Unable to write PRIMARY_SECONDARY_PAD2 %d\n", |
2565 | + ret); |
2566 | + } |
2567 | |
2568 | if (!palmas_dev) |
2569 | return; |
2570 | diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c |
2571 | index 2553d903a82b..cff5829790c9 100644 |
2572 | --- a/drivers/mmc/core/core.c |
2573 | +++ b/drivers/mmc/core/core.c |
2574 | @@ -2974,6 +2974,14 @@ static int mmc_pm_notify(struct notifier_block *notify_block, |
2575 | if (!err) |
2576 | break; |
2577 | |
2578 | + if (!mmc_card_is_removable(host)) { |
2579 | + dev_warn(mmc_dev(host), |
2580 | + "pre_suspend failed for non-removable host: " |
2581 | + "%d\n", err); |
2582 | + /* Avoid removing non-removable hosts */ |
2583 | + break; |
2584 | + } |
2585 | + |
2586 | /* Calling bus_ops->remove() with a claimed host can deadlock */ |
2587 | host->bus_ops->remove(host); |
2588 | mmc_claim_host(host); |
2589 | diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c |
2590 | index 5f2f24a7360d..a082aa330f47 100644 |
2591 | --- a/drivers/mmc/host/omap_hsmmc.c |
2592 | +++ b/drivers/mmc/host/omap_hsmmc.c |
2593 | @@ -1762,8 +1762,8 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host) |
2594 | */ |
2595 | if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) { |
2596 | struct pinctrl *p = devm_pinctrl_get(host->dev); |
2597 | - if (!p) { |
2598 | - ret = -ENODEV; |
2599 | + if (IS_ERR(p)) { |
2600 | + ret = PTR_ERR(p); |
2601 | goto err_free_irq; |
2602 | } |
2603 | if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) { |
2604 | diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
2605 | index 3c27401cf7fe..a51d636c2312 100644 |
2606 | --- a/drivers/mmc/host/sdhci-of-esdhc.c |
2607 | +++ b/drivers/mmc/host/sdhci-of-esdhc.c |
2608 | @@ -432,6 +432,20 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) |
2609 | if (esdhc->vendor_ver < VENDOR_V_23) |
2610 | pre_div = 2; |
2611 | |
2612 | + /* |
2613 | + * Limit SD clock to 167MHz for ls1046a according to its datasheet |
2614 | + */ |
2615 | + if (clock > 167000000 && |
2616 | + of_find_compatible_node(NULL, NULL, "fsl,ls1046a-esdhc")) |
2617 | + clock = 167000000; |
2618 | + |
2619 | + /* |
2620 | + * Limit SD clock to 125MHz for ls1012a according to its datasheet |
2621 | + */ |
2622 | + if (clock > 125000000 && |
2623 | + of_find_compatible_node(NULL, NULL, "fsl,ls1012a-esdhc")) |
2624 | + clock = 125000000; |
2625 | + |
2626 | /* Workaround to reduce the clock frequency for p1010 esdhc */ |
2627 | if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) { |
2628 | if (clock > 20000000) |
2629 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
2630 | index c3f3096b24ae..4907c9b57565 100644 |
2631 | --- a/drivers/net/bonding/bond_main.c |
2632 | +++ b/drivers/net/bonding/bond_main.c |
2633 | @@ -2067,6 +2067,7 @@ static int bond_miimon_inspect(struct bonding *bond) |
2634 | (bond->params.downdelay - slave->delay) * |
2635 | bond->params.miimon, |
2636 | slave->dev->name); |
2637 | + commit++; |
2638 | continue; |
2639 | } |
2640 | |
2641 | @@ -2104,7 +2105,7 @@ static int bond_miimon_inspect(struct bonding *bond) |
2642 | (bond->params.updelay - slave->delay) * |
2643 | bond->params.miimon, |
2644 | slave->dev->name); |
2645 | - |
2646 | + commit++; |
2647 | continue; |
2648 | } |
2649 | |
2650 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
2651 | index 596f88b693ef..ca6c4718000f 100644 |
2652 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
2653 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |
2654 | @@ -2026,6 +2026,7 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp) |
2655 | ETH_OVREHEAD + |
2656 | mtu + |
2657 | BNX2X_FW_RX_ALIGN_END; |
2658 | + fp->rx_buf_size = SKB_DATA_ALIGN(fp->rx_buf_size); |
2659 | /* Note : rx_buf_size doesn't take into account NET_SKB_PAD */ |
2660 | if (fp->rx_buf_size + NET_SKB_PAD <= PAGE_SIZE) |
2661 | fp->rx_frag_size = fp->rx_buf_size + NET_SKB_PAD; |
2662 | diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c |
2663 | index f76d33279454..ef9bc26ebc1a 100644 |
2664 | --- a/drivers/net/ethernet/freescale/ucc_geth.c |
2665 | +++ b/drivers/net/ethernet/freescale/ucc_geth.c |
2666 | @@ -2594,11 +2594,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) |
2667 | } else if (ugeth->ug_info->uf_info.bd_mem_part == |
2668 | MEM_PART_MURAM) { |
2669 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, |
2670 | - (u32) immrbar_virt_to_phys(ugeth-> |
2671 | - p_tx_bd_ring[i])); |
2672 | + (u32)qe_muram_dma(ugeth->p_tx_bd_ring[i])); |
2673 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. |
2674 | last_bd_completed_address, |
2675 | - (u32) immrbar_virt_to_phys(endOfRing)); |
2676 | + (u32)qe_muram_dma(endOfRing)); |
2677 | } |
2678 | } |
2679 | |
2680 | @@ -2844,8 +2843,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) |
2681 | } else if (ugeth->ug_info->uf_info.bd_mem_part == |
2682 | MEM_PART_MURAM) { |
2683 | out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, |
2684 | - (u32) immrbar_virt_to_phys(ugeth-> |
2685 | - p_rx_bd_ring[i])); |
2686 | + (u32)qe_muram_dma(ugeth->p_rx_bd_ring[i])); |
2687 | } |
2688 | /* rest of fields handled by QE */ |
2689 | } |
2690 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2691 | index 02a03bccde7b..34b5e699a1d5 100644 |
2692 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2693 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2694 | @@ -671,7 +671,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data) |
2695 | |
2696 | static int hns_gmac_get_sset_count(int stringset) |
2697 | { |
2698 | - if (stringset == ETH_SS_STATS) |
2699 | + if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
2700 | return ARRAY_SIZE(g_gmac_stats_string); |
2701 | |
2702 | return 0; |
2703 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
2704 | index 6ea872287307..4ecb809785f9 100644 |
2705 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
2706 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
2707 | @@ -422,7 +422,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb) |
2708 | |
2709 | int hns_ppe_get_sset_count(int stringset) |
2710 | { |
2711 | - if (stringset == ETH_SS_STATS) |
2712 | + if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
2713 | return ETH_PPE_STATIC_NUM; |
2714 | return 0; |
2715 | } |
2716 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2717 | index f3be9ac47bfb..fbbbbffd58dc 100644 |
2718 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2719 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2720 | @@ -798,7 +798,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data) |
2721 | */ |
2722 | int hns_rcb_get_ring_sset_count(int stringset) |
2723 | { |
2724 | - if (stringset == ETH_SS_STATS) |
2725 | + if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
2726 | return HNS_RING_STATIC_REG_NUM; |
2727 | |
2728 | return 0; |
2729 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |
2730 | index 8f4f0e8da984..d1c868c800f9 100644 |
2731 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |
2732 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c |
2733 | @@ -776,7 +776,7 @@ static void hns_xgmac_get_strings(u32 stringset, u8 *data) |
2734 | */ |
2735 | static int hns_xgmac_get_sset_count(int stringset) |
2736 | { |
2737 | - if (stringset == ETH_SS_STATS) |
2738 | + if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
2739 | return ARRAY_SIZE(g_xgmac_stats_string); |
2740 | |
2741 | return 0; |
2742 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
2743 | index 7c6c1468628b..49094c965697 100644 |
2744 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
2745 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
2746 | @@ -511,6 +511,23 @@ static int ibmvnic_open(struct net_device *netdev) |
2747 | return -ENOMEM; |
2748 | } |
2749 | |
2750 | +static void disable_sub_crqs(struct ibmvnic_adapter *adapter) |
2751 | +{ |
2752 | + int i; |
2753 | + |
2754 | + if (adapter->tx_scrq) { |
2755 | + for (i = 0; i < adapter->req_tx_queues; i++) |
2756 | + if (adapter->tx_scrq[i]) |
2757 | + disable_irq(adapter->tx_scrq[i]->irq); |
2758 | + } |
2759 | + |
2760 | + if (adapter->rx_scrq) { |
2761 | + for (i = 0; i < adapter->req_rx_queues; i++) |
2762 | + if (adapter->rx_scrq[i]) |
2763 | + disable_irq(adapter->rx_scrq[i]->irq); |
2764 | + } |
2765 | +} |
2766 | + |
2767 | static int ibmvnic_close(struct net_device *netdev) |
2768 | { |
2769 | struct ibmvnic_adapter *adapter = netdev_priv(netdev); |
2770 | @@ -519,6 +536,7 @@ static int ibmvnic_close(struct net_device *netdev) |
2771 | int i; |
2772 | |
2773 | adapter->closing = true; |
2774 | + disable_sub_crqs(adapter); |
2775 | |
2776 | for (i = 0; i < adapter->req_rx_queues; i++) |
2777 | napi_disable(&adapter->napi[i]); |
2778 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
2779 | index 0feddf3393f9..528a926dd979 100644 |
2780 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c |
2781 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
2782 | @@ -3528,6 +3528,12 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca) |
2783 | |
2784 | switch (hw->mac.type) { |
2785 | case e1000_pch2lan: |
2786 | + /* Stable 96MHz frequency */ |
2787 | + incperiod = INCPERIOD_96MHz; |
2788 | + incvalue = INCVALUE_96MHz; |
2789 | + shift = INCVALUE_SHIFT_96MHz; |
2790 | + adapter->cc.shift = shift + INCPERIOD_SHIFT_96MHz; |
2791 | + break; |
2792 | case e1000_pch_lpt: |
2793 | if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) { |
2794 | /* Stable 96MHz frequency */ |
2795 | diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c |
2796 | index 508e72c5f1c2..d665de8849a2 100644 |
2797 | --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c |
2798 | +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c |
2799 | @@ -80,7 +80,7 @@ static struct ixgbe_stats ixgbevf_gstrings_stats[] = { |
2800 | #define IXGBEVF_QUEUE_STATS_LEN ( \ |
2801 | (((struct ixgbevf_adapter *)netdev_priv(netdev))->num_tx_queues + \ |
2802 | ((struct ixgbevf_adapter *)netdev_priv(netdev))->num_rx_queues) * \ |
2803 | - (sizeof(struct ixgbe_stats) / sizeof(u64))) |
2804 | + (sizeof(struct ixgbevf_stats) / sizeof(u64))) |
2805 | #define IXGBEVF_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbevf_gstrings_stats) |
2806 | |
2807 | #define IXGBEVF_STATS_LEN (IXGBEVF_GLOBAL_STATS_LEN + IXGBEVF_QUEUE_STATS_LEN) |
2808 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
2809 | index abf5bf11f865..0645124a887b 100644 |
2810 | --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c |
2811 | +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c |
2812 | @@ -204,7 +204,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) |
2813 | /* send acquire request */ |
2814 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
2815 | if (rc) |
2816 | - return rc; |
2817 | + goto exit; |
2818 | |
2819 | /* copy acquire response from buffer to p_hwfn */ |
2820 | memcpy(&p_iov->acquire_resp, resp, sizeof(p_iov->acquire_resp)); |
2821 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c |
2822 | index d7107055ec60..2f656f395f39 100644 |
2823 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c |
2824 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c |
2825 | @@ -128,6 +128,8 @@ static int qlcnic_sriov_virtid_fn(struct qlcnic_adapter *adapter, int vf_id) |
2826 | return 0; |
2827 | |
2828 | pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV); |
2829 | + if (!pos) |
2830 | + return 0; |
2831 | pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset); |
2832 | pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, &stride); |
2833 | |
2834 | diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c |
2835 | index c2ac39a940f7..14f58b60d1b5 100644 |
2836 | --- a/drivers/net/hyperv/netvsc.c |
2837 | +++ b/drivers/net/hyperv/netvsc.c |
2838 | @@ -151,6 +151,13 @@ static void netvsc_destroy_buf(struct hv_device *device) |
2839 | sizeof(struct nvsp_message), |
2840 | (unsigned long)revoke_packet, |
2841 | VM_PKT_DATA_INBAND, 0); |
2842 | + /* If the failure is because the channel is rescinded; |
2843 | + * ignore the failure since we cannot send on a rescinded |
2844 | + * channel. This would allow us to properly cleanup |
2845 | + * even when the channel is rescinded. |
2846 | + */ |
2847 | + if (device->channel->rescind) |
2848 | + ret = 0; |
2849 | /* |
2850 | * If we failed here, we might as well return and |
2851 | * have a leak rather than continue and a bugchk |
2852 | @@ -211,6 +218,15 @@ static void netvsc_destroy_buf(struct hv_device *device) |
2853 | sizeof(struct nvsp_message), |
2854 | (unsigned long)revoke_packet, |
2855 | VM_PKT_DATA_INBAND, 0); |
2856 | + |
2857 | + /* If the failure is because the channel is rescinded; |
2858 | + * ignore the failure since we cannot send on a rescinded |
2859 | + * channel. This would allow us to properly cleanup |
2860 | + * even when the channel is rescinded. |
2861 | + */ |
2862 | + if (device->channel->rescind) |
2863 | + ret = 0; |
2864 | + |
2865 | /* If we failed here, we might as well return and |
2866 | * have a leak rather than continue and a bugchk |
2867 | */ |
2868 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
2869 | index a30d6a6dbd95..973e90fb4a24 100644 |
2870 | --- a/drivers/net/usb/qmi_wwan.c |
2871 | +++ b/drivers/net/usb/qmi_wwan.c |
2872 | @@ -531,7 +531,7 @@ static int qmi_wwan_resume(struct usb_interface *intf) |
2873 | |
2874 | static const struct driver_info qmi_wwan_info = { |
2875 | .description = "WWAN/QMI device", |
2876 | - .flags = FLAG_WWAN, |
2877 | + .flags = FLAG_WWAN | FLAG_SEND_ZLP, |
2878 | .bind = qmi_wwan_bind, |
2879 | .unbind = qmi_wwan_unbind, |
2880 | .manage_power = qmi_wwan_manage_power, |
2881 | @@ -540,7 +540,7 @@ static const struct driver_info qmi_wwan_info = { |
2882 | |
2883 | static const struct driver_info qmi_wwan_info_quirk_dtr = { |
2884 | .description = "WWAN/QMI device", |
2885 | - .flags = FLAG_WWAN, |
2886 | + .flags = FLAG_WWAN | FLAG_SEND_ZLP, |
2887 | .bind = qmi_wwan_bind, |
2888 | .unbind = qmi_wwan_unbind, |
2889 | .manage_power = qmi_wwan_manage_power, |
2890 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
2891 | index 50570d779b01..0f5dfb8a545d 100644 |
2892 | --- a/drivers/net/vxlan.c |
2893 | +++ b/drivers/net/vxlan.c |
2894 | @@ -2816,17 +2816,21 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6) |
2895 | |
2896 | static int vxlan_sock_add(struct vxlan_dev *vxlan) |
2897 | { |
2898 | - bool ipv6 = vxlan->flags & VXLAN_F_IPV6; |
2899 | bool metadata = vxlan->flags & VXLAN_F_COLLECT_METADATA; |
2900 | + bool ipv6 = vxlan->flags & VXLAN_F_IPV6 || metadata; |
2901 | + bool ipv4 = !ipv6 || metadata; |
2902 | int ret = 0; |
2903 | |
2904 | RCU_INIT_POINTER(vxlan->vn4_sock, NULL); |
2905 | #if IS_ENABLED(CONFIG_IPV6) |
2906 | RCU_INIT_POINTER(vxlan->vn6_sock, NULL); |
2907 | - if (ipv6 || metadata) |
2908 | + if (ipv6) { |
2909 | ret = __vxlan_sock_add(vxlan, true); |
2910 | + if (ret < 0 && ret != -EAFNOSUPPORT) |
2911 | + ipv4 = false; |
2912 | + } |
2913 | #endif |
2914 | - if (!ret && (!ipv6 || metadata)) |
2915 | + if (ipv4) |
2916 | ret = __vxlan_sock_add(vxlan, false); |
2917 | if (ret < 0) |
2918 | vxlan_sock_release(vxlan); |
2919 | diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c |
2920 | index db363856e0b5..2b064998915f 100644 |
2921 | --- a/drivers/net/wan/pc300too.c |
2922 | +++ b/drivers/net/wan/pc300too.c |
2923 | @@ -347,6 +347,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev, |
2924 | card->rambase == NULL) { |
2925 | pr_err("ioremap() failed\n"); |
2926 | pc300_pci_remove_one(pdev); |
2927 | + return -ENOMEM; |
2928 | } |
2929 | |
2930 | /* PLX PCI 9050 workaround for local configuration register read bug */ |
2931 | diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c |
2932 | index 6aa2b93497dd..0dadc6044dba 100644 |
2933 | --- a/drivers/net/wireless/ath/ath10k/debug.c |
2934 | +++ b/drivers/net/wireless/ath/ath10k/debug.c |
2935 | @@ -624,17 +624,21 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, |
2936 | size_t count, loff_t *ppos) |
2937 | { |
2938 | struct ath10k *ar = file->private_data; |
2939 | - char buf[32]; |
2940 | + char buf[32] = {0}; |
2941 | + ssize_t rc; |
2942 | int ret; |
2943 | |
2944 | - simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); |
2945 | + /* filter partial writes and invalid commands */ |
2946 | + if (*ppos != 0 || count >= sizeof(buf) || count == 0) |
2947 | + return -EINVAL; |
2948 | |
2949 | - /* make sure that buf is null terminated */ |
2950 | - buf[sizeof(buf) - 1] = 0; |
2951 | + rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); |
2952 | + if (rc < 0) |
2953 | + return rc; |
2954 | |
2955 | /* drop the possible '\n' from the end */ |
2956 | - if (buf[count - 1] == '\n') |
2957 | - buf[count - 1] = 0; |
2958 | + if (buf[*ppos - 1] == '\n') |
2959 | + buf[*ppos - 1] = '\0'; |
2960 | |
2961 | mutex_lock(&ar->conf_mutex); |
2962 | |
2963 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
2964 | index 1e6e63dbd61c..a497bf31953d 100644 |
2965 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
2966 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
2967 | @@ -2505,7 +2505,7 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar, |
2968 | } |
2969 | break; |
2970 | case WMI_VDEV_TYPE_STA: |
2971 | - if (vif->bss_conf.qos) |
2972 | + if (sta->wme) |
2973 | arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; |
2974 | break; |
2975 | case WMI_VDEV_TYPE_IBSS: |
2976 | diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c |
2977 | index f8506037736f..404fc306cb2a 100644 |
2978 | --- a/drivers/net/wireless/ath/regd.c |
2979 | +++ b/drivers/net/wireless/ath/regd.c |
2980 | @@ -254,8 +254,12 @@ bool ath_is_49ghz_allowed(u16 regdomain) |
2981 | EXPORT_SYMBOL(ath_is_49ghz_allowed); |
2982 | |
2983 | /* Frequency is one where radar detection is required */ |
2984 | -static bool ath_is_radar_freq(u16 center_freq) |
2985 | +static bool ath_is_radar_freq(u16 center_freq, |
2986 | + struct ath_regulatory *reg) |
2987 | + |
2988 | { |
2989 | + if (reg->country_code == CTRY_INDIA) |
2990 | + return (center_freq >= 5500 && center_freq <= 5700); |
2991 | return (center_freq >= 5260 && center_freq <= 5700); |
2992 | } |
2993 | |
2994 | @@ -306,7 +310,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy, |
2995 | enum nl80211_reg_initiator initiator, |
2996 | struct ieee80211_channel *ch) |
2997 | { |
2998 | - if (ath_is_radar_freq(ch->center_freq) || |
2999 | + if (ath_is_radar_freq(ch->center_freq, reg) || |
3000 | (ch->flags & IEEE80211_CHAN_RADAR)) |
3001 | return; |
3002 | |
3003 | @@ -395,8 +399,9 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy, |
3004 | } |
3005 | } |
3006 | |
3007 | -/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ |
3008 | -static void ath_reg_apply_radar_flags(struct wiphy *wiphy) |
3009 | +/* Always apply Radar/DFS rules on freq range 5500 MHz - 5700 MHz */ |
3010 | +static void ath_reg_apply_radar_flags(struct wiphy *wiphy, |
3011 | + struct ath_regulatory *reg) |
3012 | { |
3013 | struct ieee80211_supported_band *sband; |
3014 | struct ieee80211_channel *ch; |
3015 | @@ -409,7 +414,7 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy) |
3016 | |
3017 | for (i = 0; i < sband->n_channels; i++) { |
3018 | ch = &sband->channels[i]; |
3019 | - if (!ath_is_radar_freq(ch->center_freq)) |
3020 | + if (!ath_is_radar_freq(ch->center_freq, reg)) |
3021 | continue; |
3022 | /* We always enable radar detection/DFS on this |
3023 | * frequency range. Additionally we also apply on |
3024 | @@ -505,7 +510,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy, |
3025 | struct ath_common *common = container_of(reg, struct ath_common, |
3026 | regulatory); |
3027 | /* We always apply this */ |
3028 | - ath_reg_apply_radar_flags(wiphy); |
3029 | + ath_reg_apply_radar_flags(wiphy, reg); |
3030 | |
3031 | /* |
3032 | * This would happen when we have sent a custom regulatory request |
3033 | @@ -653,7 +658,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, |
3034 | } |
3035 | |
3036 | wiphy_apply_custom_regulatory(wiphy, regd); |
3037 | - ath_reg_apply_radar_flags(wiphy); |
3038 | + ath_reg_apply_radar_flags(wiphy, reg); |
3039 | ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); |
3040 | return 0; |
3041 | } |
3042 | diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c |
3043 | index ea1618525878..e267377edbe7 100644 |
3044 | --- a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c |
3045 | +++ b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c |
3046 | @@ -65,12 +65,12 @@ |
3047 | #define IWL_A000_TX_POWER_VERSION 0xffff /* meaningless */ |
3048 | |
3049 | /* Memory offsets and lengths */ |
3050 | -#define IWL_A000_DCCM_OFFSET 0x800000 |
3051 | -#define IWL_A000_DCCM_LEN 0x18000 |
3052 | +#define IWL_A000_DCCM_OFFSET 0x800000 /* LMAC1 */ |
3053 | +#define IWL_A000_DCCM_LEN 0x10000 /* LMAC1 */ |
3054 | #define IWL_A000_DCCM2_OFFSET 0x880000 |
3055 | #define IWL_A000_DCCM2_LEN 0x8000 |
3056 | #define IWL_A000_SMEM_OFFSET 0x400000 |
3057 | -#define IWL_A000_SMEM_LEN 0x68000 |
3058 | +#define IWL_A000_SMEM_LEN 0xD0000 |
3059 | |
3060 | #define IWL_A000_FW_PRE "iwlwifi-Qu-a0-jf-b0-" |
3061 | #define IWL_A000_MODULE_FIRMWARE(api) \ |
3062 | diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c b/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c |
3063 | index 88f260db3744..68412ff2112e 100644 |
3064 | --- a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c |
3065 | +++ b/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c |
3066 | @@ -76,8 +76,8 @@ void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_wait) |
3067 | } |
3068 | IWL_EXPORT_SYMBOL(iwl_notification_wait_init); |
3069 | |
3070 | -void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait, |
3071 | - struct iwl_rx_packet *pkt) |
3072 | +bool iwl_notification_wait(struct iwl_notif_wait_data *notif_wait, |
3073 | + struct iwl_rx_packet *pkt) |
3074 | { |
3075 | bool triggered = false; |
3076 | |
3077 | @@ -118,13 +118,11 @@ void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait, |
3078 | } |
3079 | } |
3080 | spin_unlock(¬if_wait->notif_wait_lock); |
3081 | - |
3082 | } |
3083 | |
3084 | - if (triggered) |
3085 | - wake_up_all(¬if_wait->notif_waitq); |
3086 | + return triggered; |
3087 | } |
3088 | -IWL_EXPORT_SYMBOL(iwl_notification_wait_notify); |
3089 | +IWL_EXPORT_SYMBOL(iwl_notification_wait); |
3090 | |
3091 | void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait) |
3092 | { |
3093 | diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h b/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h |
3094 | index 0f9995ed71cd..368884be4e7c 100644 |
3095 | --- a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h |
3096 | +++ b/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h |
3097 | @@ -6,7 +6,7 @@ |
3098 | * GPL LICENSE SUMMARY |
3099 | * |
3100 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. |
3101 | - * Copyright(c) 2015 Intel Deutschland GmbH |
3102 | + * Copyright(c) 2015 - 2017 Intel Deutschland GmbH |
3103 | * |
3104 | * This program is free software; you can redistribute it and/or modify |
3105 | * it under the terms of version 2 of the GNU General Public License as |
3106 | @@ -32,6 +32,7 @@ |
3107 | * BSD LICENSE |
3108 | * |
3109 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
3110 | + * Copyright(c) 2015 - 2017 Intel Deutschland GmbH |
3111 | * All rights reserved. |
3112 | * |
3113 | * Redistribution and use in source and binary forms, with or without |
3114 | @@ -89,10 +90,10 @@ struct iwl_notif_wait_data { |
3115 | * |
3116 | * This structure is not used directly, to wait for a |
3117 | * notification declare it on the stack, and call |
3118 | - * iwlagn_init_notification_wait() with appropriate |
3119 | + * iwl_init_notification_wait() with appropriate |
3120 | * parameters. Then do whatever will cause the ucode |
3121 | * to notify the driver, and to wait for that then |
3122 | - * call iwlagn_wait_notification(). |
3123 | + * call iwl_wait_notification(). |
3124 | * |
3125 | * Each notification is one-shot. If at some point we |
3126 | * need to support multi-shot notifications (which |
3127 | @@ -114,10 +115,24 @@ struct iwl_notification_wait { |
3128 | |
3129 | /* caller functions */ |
3130 | void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_data); |
3131 | -void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_data, |
3132 | - struct iwl_rx_packet *pkt); |
3133 | +bool iwl_notification_wait(struct iwl_notif_wait_data *notif_data, |
3134 | + struct iwl_rx_packet *pkt); |
3135 | void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_data); |
3136 | |
3137 | +static inline void |
3138 | +iwl_notification_notify(struct iwl_notif_wait_data *notif_data) |
3139 | +{ |
3140 | + wake_up_all(¬if_data->notif_waitq); |
3141 | +} |
3142 | + |
3143 | +static inline void |
3144 | +iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_data, |
3145 | + struct iwl_rx_packet *pkt) |
3146 | +{ |
3147 | + if (iwl_notification_wait(notif_data, pkt)) |
3148 | + iwl_notification_notify(notif_data); |
3149 | +} |
3150 | + |
3151 | /* user functions */ |
3152 | void __acquires(wait_entry) |
3153 | iwl_init_notification_wait(struct iwl_notif_wait_data *notif_data, |
3154 | diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c b/drivers/net/wireless/marvell/libertas/if_spi.c |
3155 | index c3a53cd6988e..7b4955cc38db 100644 |
3156 | --- a/drivers/net/wireless/marvell/libertas/if_spi.c |
3157 | +++ b/drivers/net/wireless/marvell/libertas/if_spi.c |
3158 | @@ -1181,6 +1181,10 @@ static int if_spi_probe(struct spi_device *spi) |
3159 | |
3160 | /* Initialize interrupt handling stuff. */ |
3161 | card->workqueue = alloc_workqueue("libertas_spi", WQ_MEM_RECLAIM, 0); |
3162 | + if (!card->workqueue) { |
3163 | + err = -ENOMEM; |
3164 | + goto remove_card; |
3165 | + } |
3166 | INIT_WORK(&card->packet_work, if_spi_host_to_card_worker); |
3167 | INIT_WORK(&card->resume_work, if_spi_resume_worker); |
3168 | |
3169 | @@ -1209,6 +1213,7 @@ static int if_spi_probe(struct spi_device *spi) |
3170 | free_irq(spi->irq, card); |
3171 | terminate_workqueue: |
3172 | destroy_workqueue(card->workqueue); |
3173 | +remove_card: |
3174 | lbs_remove_card(priv); /* will call free_netdev */ |
3175 | free_card: |
3176 | free_if_spi_card(card); |
3177 | diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c |
3178 | index 2478ccd6f2d9..1e36f11831a9 100644 |
3179 | --- a/drivers/net/wireless/marvell/mwifiex/main.c |
3180 | +++ b/drivers/net/wireless/marvell/mwifiex/main.c |
3181 | @@ -146,7 +146,6 @@ static int mwifiex_unregister(struct mwifiex_adapter *adapter) |
3182 | |
3183 | kfree(adapter->regd); |
3184 | |
3185 | - vfree(adapter->chan_stats); |
3186 | kfree(adapter); |
3187 | return 0; |
3188 | } |
3189 | @@ -636,6 +635,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) |
3190 | goto done; |
3191 | |
3192 | err_add_intf: |
3193 | + vfree(adapter->chan_stats); |
3194 | wiphy_unregister(adapter->wiphy); |
3195 | wiphy_free(adapter->wiphy); |
3196 | err_init_fw: |
3197 | @@ -1429,6 +1429,7 @@ mwifiex_shutdown_sw(struct mwifiex_adapter *adapter, struct semaphore *sem) |
3198 | mwifiex_del_virtual_intf(adapter->wiphy, &priv->wdev); |
3199 | rtnl_unlock(); |
3200 | } |
3201 | + vfree(adapter->chan_stats); |
3202 | |
3203 | up(sem); |
3204 | exit_sem_err: |
3205 | @@ -1729,6 +1730,7 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) |
3206 | mwifiex_del_virtual_intf(adapter->wiphy, &priv->wdev); |
3207 | rtnl_unlock(); |
3208 | } |
3209 | + vfree(adapter->chan_stats); |
3210 | |
3211 | wiphy_unregister(adapter->wiphy); |
3212 | wiphy_free(adapter->wiphy); |
3213 | diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c |
3214 | index dbdfb3f5c507..a9f5f398b2f8 100644 |
3215 | --- a/drivers/net/wireless/mediatek/mt7601u/mcu.c |
3216 | +++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c |
3217 | @@ -66,8 +66,10 @@ mt7601u_mcu_msg_alloc(struct mt7601u_dev *dev, const void *data, int len) |
3218 | WARN_ON(len % 4); /* if length is not divisible by 4 we need to pad */ |
3219 | |
3220 | skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL); |
3221 | - skb_reserve(skb, MT_DMA_HDR_LEN); |
3222 | - memcpy(skb_put(skb, len), data, len); |
3223 | + if (skb) { |
3224 | + skb_reserve(skb, MT_DMA_HDR_LEN); |
3225 | + memcpy(skb_put(skb, len), data, len); |
3226 | + } |
3227 | |
3228 | return skb; |
3229 | } |
3230 | @@ -170,6 +172,8 @@ static int mt7601u_mcu_function_select(struct mt7601u_dev *dev, |
3231 | }; |
3232 | |
3233 | skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg)); |
3234 | + if (!skb) |
3235 | + return -ENOMEM; |
3236 | return mt7601u_mcu_msg_send(dev, skb, CMD_FUN_SET_OP, func == 5); |
3237 | } |
3238 | |
3239 | @@ -205,6 +209,8 @@ mt7601u_mcu_calibrate(struct mt7601u_dev *dev, enum mcu_calibrate cal, u32 val) |
3240 | }; |
3241 | |
3242 | skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg)); |
3243 | + if (!skb) |
3244 | + return -ENOMEM; |
3245 | return mt7601u_mcu_msg_send(dev, skb, CMD_CALIBRATION_OP, true); |
3246 | } |
3247 | |
3248 | diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c |
3249 | index 75ffeaa54ed8..e15b462d096b 100644 |
3250 | --- a/drivers/net/wireless/realtek/rtlwifi/pci.c |
3251 | +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c |
3252 | @@ -1572,7 +1572,14 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) |
3253 | dev_kfree_skb_irq(skb); |
3254 | ring->idx = (ring->idx + 1) % ring->entries; |
3255 | } |
3256 | + |
3257 | + if (rtlpriv->use_new_trx_flow) { |
3258 | + rtlpci->tx_ring[i].cur_tx_rp = 0; |
3259 | + rtlpci->tx_ring[i].cur_tx_wp = 0; |
3260 | + } |
3261 | + |
3262 | ring->idx = 0; |
3263 | + ring->entries = rtlpci->txringcount[i]; |
3264 | } |
3265 | } |
3266 | spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); |
3267 | diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c |
3268 | index 603c90470225..15b2350d9f45 100644 |
3269 | --- a/drivers/net/wireless/rndis_wlan.c |
3270 | +++ b/drivers/net/wireless/rndis_wlan.c |
3271 | @@ -3427,6 +3427,10 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) |
3272 | |
3273 | /* because rndis_command() sleeps we need to use workqueue */ |
3274 | priv->workqueue = create_singlethread_workqueue("rndis_wlan"); |
3275 | + if (!priv->workqueue) { |
3276 | + wiphy_free(wiphy); |
3277 | + return -ENOMEM; |
3278 | + } |
3279 | INIT_WORK(&priv->work, rndis_wlan_worker); |
3280 | INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller); |
3281 | INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results); |
3282 | diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c |
3283 | index fb38e208f32d..735d8f7f9d71 100644 |
3284 | --- a/drivers/pinctrl/core.c |
3285 | +++ b/drivers/pinctrl/core.c |
3286 | @@ -992,19 +992,16 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, |
3287 | EXPORT_SYMBOL_GPL(pinctrl_lookup_state); |
3288 | |
3289 | /** |
3290 | - * pinctrl_select_state() - select/activate/program a pinctrl state to HW |
3291 | + * pinctrl_commit_state() - select/activate/program a pinctrl state to HW |
3292 | * @p: the pinctrl handle for the device that requests configuration |
3293 | * @state: the state handle to select/activate/program |
3294 | */ |
3295 | -int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) |
3296 | +static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) |
3297 | { |
3298 | struct pinctrl_setting *setting, *setting2; |
3299 | struct pinctrl_state *old_state = p->state; |
3300 | int ret; |
3301 | |
3302 | - if (p->state == state) |
3303 | - return 0; |
3304 | - |
3305 | if (p->state) { |
3306 | /* |
3307 | * For each pinmux setting in the old state, forget SW's record |
3308 | @@ -1068,6 +1065,19 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) |
3309 | |
3310 | return ret; |
3311 | } |
3312 | + |
3313 | +/** |
3314 | + * pinctrl_select_state() - select/activate/program a pinctrl state to HW |
3315 | + * @p: the pinctrl handle for the device that requests configuration |
3316 | + * @state: the state handle to select/activate/program |
3317 | + */ |
3318 | +int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) |
3319 | +{ |
3320 | + if (p->state == state) |
3321 | + return 0; |
3322 | + |
3323 | + return pinctrl_commit_state(p, state); |
3324 | +} |
3325 | EXPORT_SYMBOL_GPL(pinctrl_select_state); |
3326 | |
3327 | static void devm_pinctrl_release(struct device *dev, void *res) |
3328 | @@ -1236,7 +1246,7 @@ void pinctrl_unregister_map(struct pinctrl_map const *map) |
3329 | int pinctrl_force_sleep(struct pinctrl_dev *pctldev) |
3330 | { |
3331 | if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep)) |
3332 | - return pinctrl_select_state(pctldev->p, pctldev->hog_sleep); |
3333 | + return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep); |
3334 | return 0; |
3335 | } |
3336 | EXPORT_SYMBOL_GPL(pinctrl_force_sleep); |
3337 | @@ -1248,7 +1258,7 @@ EXPORT_SYMBOL_GPL(pinctrl_force_sleep); |
3338 | int pinctrl_force_default(struct pinctrl_dev *pctldev) |
3339 | { |
3340 | if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default)) |
3341 | - return pinctrl_select_state(pctldev->p, pctldev->hog_default); |
3342 | + return pinctrl_commit_state(pctldev->p, pctldev->hog_default); |
3343 | return 0; |
3344 | } |
3345 | EXPORT_SYMBOL_GPL(pinctrl_force_default); |
3346 | diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
3347 | index 49bf7dcb7ed8..f826793e972c 100644 |
3348 | --- a/drivers/pinctrl/pinctrl-rockchip.c |
3349 | +++ b/drivers/pinctrl/pinctrl-rockchip.c |
3350 | @@ -1278,8 +1278,16 @@ static int rockchip_gpio_get_direction(struct gpio_chip *chip, unsigned offset) |
3351 | { |
3352 | struct rockchip_pin_bank *bank = gpiochip_get_data(chip); |
3353 | u32 data; |
3354 | + int ret; |
3355 | |
3356 | + ret = clk_enable(bank->clk); |
3357 | + if (ret < 0) { |
3358 | + dev_err(bank->drvdata->dev, |
3359 | + "failed to enable clock for bank %s\n", bank->name); |
3360 | + return ret; |
3361 | + } |
3362 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); |
3363 | + clk_disable(bank->clk); |
3364 | |
3365 | return !(data & BIT(offset)); |
3366 | } |
3367 | diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c |
3368 | index 04053fe1e980..cfa3e850c49f 100644 |
3369 | --- a/drivers/platform/chrome/cros_ec_proto.c |
3370 | +++ b/drivers/platform/chrome/cros_ec_proto.c |
3371 | @@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev, |
3372 | struct cros_ec_command *msg) |
3373 | { |
3374 | int ret; |
3375 | + int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); |
3376 | |
3377 | if (ec_dev->proto_version > 2) |
3378 | - ret = ec_dev->pkt_xfer(ec_dev, msg); |
3379 | + xfer_fxn = ec_dev->pkt_xfer; |
3380 | else |
3381 | - ret = ec_dev->cmd_xfer(ec_dev, msg); |
3382 | + xfer_fxn = ec_dev->cmd_xfer; |
3383 | |
3384 | + ret = (*xfer_fxn)(ec_dev, msg); |
3385 | if (msg->result == EC_RES_IN_PROGRESS) { |
3386 | int i; |
3387 | struct cros_ec_command *status_msg; |
3388 | @@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev, |
3389 | for (i = 0; i < EC_COMMAND_RETRIES; i++) { |
3390 | usleep_range(10000, 11000); |
3391 | |
3392 | - ret = ec_dev->cmd_xfer(ec_dev, status_msg); |
3393 | + ret = (*xfer_fxn)(ec_dev, status_msg); |
3394 | if (ret < 0) |
3395 | break; |
3396 | |
3397 | diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c |
3398 | index f3baf9973989..24f1630a8b3f 100644 |
3399 | --- a/drivers/platform/chrome/cros_ec_sysfs.c |
3400 | +++ b/drivers/platform/chrome/cros_ec_sysfs.c |
3401 | @@ -187,7 +187,7 @@ static ssize_t show_ec_version(struct device *dev, |
3402 | count += scnprintf(buf + count, PAGE_SIZE - count, |
3403 | "Build info: EC error %d\n", msg->result); |
3404 | else { |
3405 | - msg->data[sizeof(msg->data) - 1] = '\0'; |
3406 | + msg->data[EC_HOST_PARAM_SIZE - 1] = '\0'; |
3407 | count += scnprintf(buf + count, PAGE_SIZE - count, |
3408 | "Build info: %s\n", msg->data); |
3409 | } |
3410 | diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
3411 | index 6eb2837f6b89..687cc5b922ee 100644 |
3412 | --- a/drivers/platform/x86/asus-nb-wmi.c |
3413 | +++ b/drivers/platform/x86/asus-nb-wmi.c |
3414 | @@ -120,6 +120,10 @@ static struct quirk_entry quirk_asus_x550lb = { |
3415 | .xusb2pr = 0x01D9, |
3416 | }; |
3417 | |
3418 | +static struct quirk_entry quirk_asus_ux330uak = { |
3419 | + .wmi_force_als_set = true, |
3420 | +}; |
3421 | + |
3422 | static int dmi_matched(const struct dmi_system_id *dmi) |
3423 | { |
3424 | quirks = dmi->driver_data; |
3425 | @@ -150,6 +154,15 @@ static const struct dmi_system_id asus_quirks[] = { |
3426 | */ |
3427 | .driver_data = &quirk_asus_wapf4, |
3428 | }, |
3429 | + { |
3430 | + .callback = dmi_matched, |
3431 | + .ident = "ASUSTeK COMPUTER INC. X302UA", |
3432 | + .matches = { |
3433 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
3434 | + DMI_MATCH(DMI_PRODUCT_NAME, "X302UA"), |
3435 | + }, |
3436 | + .driver_data = &quirk_asus_wapf4, |
3437 | + }, |
3438 | { |
3439 | .callback = dmi_matched, |
3440 | .ident = "ASUSTeK COMPUTER INC. X401U", |
3441 | @@ -411,6 +424,15 @@ static const struct dmi_system_id asus_quirks[] = { |
3442 | }, |
3443 | .driver_data = &quirk_asus_ux303ub, |
3444 | }, |
3445 | + { |
3446 | + .callback = dmi_matched, |
3447 | + .ident = "ASUSTeK COMPUTER INC. UX330UAK", |
3448 | + .matches = { |
3449 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
3450 | + DMI_MATCH(DMI_PRODUCT_NAME, "UX330UAK"), |
3451 | + }, |
3452 | + .driver_data = &quirk_asus_ux330uak, |
3453 | + }, |
3454 | { |
3455 | .callback = dmi_matched, |
3456 | .ident = "ASUSTeK COMPUTER INC. X550LB", |
3457 | diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c |
3458 | index 8499d3ae4257..8a1bfd489c26 100644 |
3459 | --- a/drivers/platform/x86/asus-wmi.c |
3460 | +++ b/drivers/platform/x86/asus-wmi.c |
3461 | @@ -1108,6 +1108,15 @@ static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) |
3462 | orig_ports_available, ports_available); |
3463 | } |
3464 | |
3465 | +/* |
3466 | + * Some devices dont support or have borcken get_als method |
3467 | + * but still support set method. |
3468 | + */ |
3469 | +static void asus_wmi_set_als(void) |
3470 | +{ |
3471 | + asus_wmi_set_devstate(ASUS_WMI_DEVID_ALS_ENABLE, 1, NULL); |
3472 | +} |
3473 | + |
3474 | /* |
3475 | * Hwmon device |
3476 | */ |
3477 | @@ -2120,6 +2129,9 @@ static int asus_wmi_add(struct platform_device *pdev) |
3478 | goto fail_rfkill; |
3479 | } |
3480 | |
3481 | + if (asus->driver->quirks->wmi_force_als_set) |
3482 | + asus_wmi_set_als(); |
3483 | + |
3484 | /* Some Asus desktop boards export an acpi-video backlight interface, |
3485 | stop this from showing up */ |
3486 | chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); |
3487 | diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h |
3488 | index fdff626c3b51..5db052d1de1e 100644 |
3489 | --- a/drivers/platform/x86/asus-wmi.h |
3490 | +++ b/drivers/platform/x86/asus-wmi.h |
3491 | @@ -45,6 +45,7 @@ struct quirk_entry { |
3492 | bool store_backlight_power; |
3493 | bool wmi_backlight_power; |
3494 | bool wmi_backlight_native; |
3495 | + bool wmi_force_als_set; |
3496 | int wapf; |
3497 | /* |
3498 | * For machines with AMD graphic chips, it will send out WMI event |
3499 | diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
3500 | index 78080763df51..a74340dff530 100644 |
3501 | --- a/drivers/platform/x86/intel-vbtn.c |
3502 | +++ b/drivers/platform/x86/intel-vbtn.c |
3503 | @@ -37,6 +37,10 @@ static const struct acpi_device_id intel_vbtn_ids[] = { |
3504 | static const struct key_entry intel_vbtn_keymap[] = { |
3505 | { KE_IGNORE, 0xC0, { KEY_POWER } }, /* power key press */ |
3506 | { KE_KEY, 0xC1, { KEY_POWER } }, /* power key release */ |
3507 | + { KE_KEY, 0xC4, { KEY_VOLUMEUP } }, /* volume-up key press */ |
3508 | + { KE_IGNORE, 0xC5, { KEY_VOLUMEUP } }, /* volume-up key release */ |
3509 | + { KE_KEY, 0xC6, { KEY_VOLUMEDOWN } }, /* volume-down key press */ |
3510 | + { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* volume-down key release */ |
3511 | { KE_END }, |
3512 | }; |
3513 | |
3514 | diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c |
3515 | index 50171fd3cc6d..8ed2782d1bb1 100644 |
3516 | --- a/drivers/power/supply/bq24190_charger.c |
3517 | +++ b/drivers/power/supply/bq24190_charger.c |
3518 | @@ -506,6 +506,9 @@ static int bq24190_register_reset(struct bq24190_dev_info *bdi) |
3519 | int ret, limit = 100; |
3520 | u8 v; |
3521 | |
3522 | + if (device_property_read_bool(bdi->dev, "disable-reset")) |
3523 | + return 0; |
3524 | + |
3525 | /* Reset the registers */ |
3526 | ret = bq24190_write_mask(bdi, BQ24190_REG_POC, |
3527 | BQ24190_REG_POC_RESET_MASK, |
3528 | @@ -1184,8 +1187,13 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data) |
3529 | } |
3530 | } while (f_reg && ++i < 2); |
3531 | |
3532 | + /* ignore over/under voltage fault after disconnect */ |
3533 | + if (f_reg == (1 << BQ24190_REG_F_CHRG_FAULT_SHIFT) && |
3534 | + !(ss_reg & BQ24190_REG_SS_PG_STAT_MASK)) |
3535 | + f_reg = 0; |
3536 | + |
3537 | if (f_reg != bdi->f_reg) { |
3538 | - dev_info(bdi->dev, |
3539 | + dev_warn(bdi->dev, |
3540 | "Fault: boost %d, charge %d, battery %d, ntc %d\n", |
3541 | !!(f_reg & BQ24190_REG_F_BOOST_FAULT_MASK), |
3542 | !!(f_reg & BQ24190_REG_F_CHRG_FAULT_MASK), |
3543 | diff --git a/drivers/power/supply/isp1704_charger.c b/drivers/power/supply/isp1704_charger.c |
3544 | index 4cd6899b961e..95af5f305838 100644 |
3545 | --- a/drivers/power/supply/isp1704_charger.c |
3546 | +++ b/drivers/power/supply/isp1704_charger.c |
3547 | @@ -418,6 +418,10 @@ static int isp1704_charger_probe(struct platform_device *pdev) |
3548 | |
3549 | pdata = devm_kzalloc(&pdev->dev, |
3550 | sizeof(struct isp1704_charger_data), GFP_KERNEL); |
3551 | + if (!pdata) { |
3552 | + ret = -ENOMEM; |
3553 | + goto fail0; |
3554 | + } |
3555 | pdata->enable_gpio = gpio; |
3556 | |
3557 | dev_info(&pdev->dev, "init gpio %d\n", pdata->enable_gpio); |
3558 | diff --git a/drivers/power/supply/pda_power.c b/drivers/power/supply/pda_power.c |
3559 | index dfe1ee89f7c7..922a86787c5c 100644 |
3560 | --- a/drivers/power/supply/pda_power.c |
3561 | +++ b/drivers/power/supply/pda_power.c |
3562 | @@ -30,9 +30,9 @@ static inline unsigned int get_irq_flags(struct resource *res) |
3563 | static struct device *dev; |
3564 | static struct pda_power_pdata *pdata; |
3565 | static struct resource *ac_irq, *usb_irq; |
3566 | -static struct timer_list charger_timer; |
3567 | -static struct timer_list supply_timer; |
3568 | -static struct timer_list polling_timer; |
3569 | +static struct delayed_work charger_work; |
3570 | +static struct delayed_work polling_work; |
3571 | +static struct delayed_work supply_work; |
3572 | static int polling; |
3573 | static struct power_supply *pda_psy_ac, *pda_psy_usb; |
3574 | |
3575 | @@ -140,7 +140,7 @@ static void update_charger(void) |
3576 | } |
3577 | } |
3578 | |
3579 | -static void supply_timer_func(unsigned long unused) |
3580 | +static void supply_work_func(struct work_struct *work) |
3581 | { |
3582 | if (ac_status == PDA_PSY_TO_CHANGE) { |
3583 | ac_status = new_ac_status; |
3584 | @@ -161,11 +161,12 @@ static void psy_changed(void) |
3585 | * Okay, charger set. Now wait a bit before notifying supplicants, |
3586 | * charge power should stabilize. |
3587 | */ |
3588 | - mod_timer(&supply_timer, |
3589 | - jiffies + msecs_to_jiffies(pdata->wait_for_charger)); |
3590 | + cancel_delayed_work(&supply_work); |
3591 | + schedule_delayed_work(&supply_work, |
3592 | + msecs_to_jiffies(pdata->wait_for_charger)); |
3593 | } |
3594 | |
3595 | -static void charger_timer_func(unsigned long unused) |
3596 | +static void charger_work_func(struct work_struct *work) |
3597 | { |
3598 | update_status(); |
3599 | psy_changed(); |
3600 | @@ -184,13 +185,14 @@ static irqreturn_t power_changed_isr(int irq, void *power_supply) |
3601 | * Wait a bit before reading ac/usb line status and setting charger, |
3602 | * because ac/usb status readings may lag from irq. |
3603 | */ |
3604 | - mod_timer(&charger_timer, |
3605 | - jiffies + msecs_to_jiffies(pdata->wait_for_status)); |
3606 | + cancel_delayed_work(&charger_work); |
3607 | + schedule_delayed_work(&charger_work, |
3608 | + msecs_to_jiffies(pdata->wait_for_status)); |
3609 | |
3610 | return IRQ_HANDLED; |
3611 | } |
3612 | |
3613 | -static void polling_timer_func(unsigned long unused) |
3614 | +static void polling_work_func(struct work_struct *work) |
3615 | { |
3616 | int changed = 0; |
3617 | |
3618 | @@ -211,8 +213,9 @@ static void polling_timer_func(unsigned long unused) |
3619 | if (changed) |
3620 | psy_changed(); |
3621 | |
3622 | - mod_timer(&polling_timer, |
3623 | - jiffies + msecs_to_jiffies(pdata->polling_interval)); |
3624 | + cancel_delayed_work(&polling_work); |
3625 | + schedule_delayed_work(&polling_work, |
3626 | + msecs_to_jiffies(pdata->polling_interval)); |
3627 | } |
3628 | |
3629 | #if IS_ENABLED(CONFIG_USB_PHY) |
3630 | @@ -250,8 +253,9 @@ static int otg_handle_notification(struct notifier_block *nb, |
3631 | * Wait a bit before reading ac/usb line status and setting charger, |
3632 | * because ac/usb status readings may lag from irq. |
3633 | */ |
3634 | - mod_timer(&charger_timer, |
3635 | - jiffies + msecs_to_jiffies(pdata->wait_for_status)); |
3636 | + cancel_delayed_work(&charger_work); |
3637 | + schedule_delayed_work(&charger_work, |
3638 | + msecs_to_jiffies(pdata->wait_for_status)); |
3639 | |
3640 | return NOTIFY_OK; |
3641 | } |
3642 | @@ -300,8 +304,8 @@ static int pda_power_probe(struct platform_device *pdev) |
3643 | if (!pdata->ac_max_uA) |
3644 | pdata->ac_max_uA = 500000; |
3645 | |
3646 | - setup_timer(&charger_timer, charger_timer_func, 0); |
3647 | - setup_timer(&supply_timer, supply_timer_func, 0); |
3648 | + INIT_DELAYED_WORK(&charger_work, charger_work_func); |
3649 | + INIT_DELAYED_WORK(&supply_work, supply_work_func); |
3650 | |
3651 | ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac"); |
3652 | usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb"); |
3653 | @@ -385,9 +389,10 @@ static int pda_power_probe(struct platform_device *pdev) |
3654 | |
3655 | if (polling) { |
3656 | dev_dbg(dev, "will poll for status\n"); |
3657 | - setup_timer(&polling_timer, polling_timer_func, 0); |
3658 | - mod_timer(&polling_timer, |
3659 | - jiffies + msecs_to_jiffies(pdata->polling_interval)); |
3660 | + INIT_DELAYED_WORK(&polling_work, polling_work_func); |
3661 | + cancel_delayed_work(&polling_work); |
3662 | + schedule_delayed_work(&polling_work, |
3663 | + msecs_to_jiffies(pdata->polling_interval)); |
3664 | } |
3665 | |
3666 | if (ac_irq || usb_irq) |
3667 | @@ -433,9 +438,9 @@ static int pda_power_remove(struct platform_device *pdev) |
3668 | free_irq(ac_irq->start, pda_psy_ac); |
3669 | |
3670 | if (polling) |
3671 | - del_timer_sync(&polling_timer); |
3672 | - del_timer_sync(&charger_timer); |
3673 | - del_timer_sync(&supply_timer); |
3674 | + cancel_delayed_work_sync(&polling_work); |
3675 | + cancel_delayed_work_sync(&charger_work); |
3676 | + cancel_delayed_work_sync(&supply_work); |
3677 | |
3678 | if (pdata->is_usb_online) |
3679 | power_supply_unregister(pda_psy_usb); |
3680 | diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c |
3681 | index 86280b7e41f3..2aa5b37cc6d2 100644 |
3682 | --- a/drivers/ptp/ptp_clock.c |
3683 | +++ b/drivers/ptp/ptp_clock.c |
3684 | @@ -97,30 +97,26 @@ static s32 scaled_ppm_to_ppb(long ppm) |
3685 | |
3686 | /* posix clock implementation */ |
3687 | |
3688 | -static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) |
3689 | +static int ptp_clock_getres(struct posix_clock *pc, struct timespec64 *tp) |
3690 | { |
3691 | tp->tv_sec = 0; |
3692 | tp->tv_nsec = 1; |
3693 | return 0; |
3694 | } |
3695 | |
3696 | -static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) |
3697 | +static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp) |
3698 | { |
3699 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
3700 | - struct timespec64 ts = timespec_to_timespec64(*tp); |
3701 | |
3702 | - return ptp->info->settime64(ptp->info, &ts); |
3703 | + return ptp->info->settime64(ptp->info, tp); |
3704 | } |
3705 | |
3706 | -static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp) |
3707 | +static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp) |
3708 | { |
3709 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
3710 | - struct timespec64 ts; |
3711 | int err; |
3712 | |
3713 | - err = ptp->info->gettime64(ptp->info, &ts); |
3714 | - if (!err) |
3715 | - *tp = timespec64_to_timespec(ts); |
3716 | + err = ptp->info->gettime64(ptp->info, tp); |
3717 | return err; |
3718 | } |
3719 | |
3720 | @@ -133,7 +129,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) |
3721 | ops = ptp->info; |
3722 | |
3723 | if (tx->modes & ADJ_SETOFFSET) { |
3724 | - struct timespec ts; |
3725 | + struct timespec64 ts; |
3726 | ktime_t kt; |
3727 | s64 delta; |
3728 | |
3729 | @@ -146,7 +142,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) |
3730 | if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC) |
3731 | return -EINVAL; |
3732 | |
3733 | - kt = timespec_to_ktime(ts); |
3734 | + kt = timespec64_to_ktime(ts); |
3735 | delta = ktime_to_ns(kt); |
3736 | err = ops->adjtime(ops, delta); |
3737 | } else if (tx->modes & ADJ_FREQUENCY) { |
3738 | diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c |
3739 | index 3a6d0290c54c..c5e272ea4372 100644 |
3740 | --- a/drivers/regulator/anatop-regulator.c |
3741 | +++ b/drivers/regulator/anatop-regulator.c |
3742 | @@ -296,6 +296,11 @@ static int anatop_regulator_probe(struct platform_device *pdev) |
3743 | if (!sreg->sel && !strcmp(sreg->name, "vddpu")) |
3744 | sreg->sel = 22; |
3745 | |
3746 | + /* set the default voltage of the pcie phy to be 1.100v */ |
3747 | + if (!sreg->sel && rdesc->name && |
3748 | + !strcmp(rdesc->name, "vddpcie")) |
3749 | + sreg->sel = 0x10; |
3750 | + |
3751 | if (!sreg->bypass && !sreg->sel) { |
3752 | dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n"); |
3753 | return -EINVAL; |
3754 | diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
3755 | index 7030d7cd3861..c554e529fc4e 100644 |
3756 | --- a/drivers/rtc/rtc-cmos.c |
3757 | +++ b/drivers/rtc/rtc-cmos.c |
3758 | @@ -41,6 +41,9 @@ |
3759 | #include <linux/pm.h> |
3760 | #include <linux/of.h> |
3761 | #include <linux/of_platform.h> |
3762 | +#ifdef CONFIG_X86 |
3763 | +#include <asm/i8259.h> |
3764 | +#endif |
3765 | |
3766 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ |
3767 | #include <linux/mc146818rtc.h> |
3768 | @@ -1117,17 +1120,23 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) |
3769 | { |
3770 | cmos_wake_setup(&pnp->dev); |
3771 | |
3772 | - if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) |
3773 | + if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) { |
3774 | + unsigned int irq = 0; |
3775 | +#ifdef CONFIG_X86 |
3776 | /* Some machines contain a PNP entry for the RTC, but |
3777 | * don't define the IRQ. It should always be safe to |
3778 | - * hardcode it in these cases |
3779 | + * hardcode it on systems with a legacy PIC. |
3780 | */ |
3781 | + if (nr_legacy_irqs()) |
3782 | + irq = 8; |
3783 | +#endif |
3784 | return cmos_do_probe(&pnp->dev, |
3785 | - pnp_get_resource(pnp, IORESOURCE_IO, 0), 8); |
3786 | - else |
3787 | + pnp_get_resource(pnp, IORESOURCE_IO, 0), irq); |
3788 | + } else { |
3789 | return cmos_do_probe(&pnp->dev, |
3790 | pnp_get_resource(pnp, IORESOURCE_IO, 0), |
3791 | pnp_irq(pnp, 0)); |
3792 | + } |
3793 | } |
3794 | |
3795 | static void cmos_pnp_remove(struct pnp_dev *pnp) |
3796 | diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c |
3797 | index 3b3049c8c9e0..c0eb113588ff 100644 |
3798 | --- a/drivers/rtc/rtc-ds1374.c |
3799 | +++ b/drivers/rtc/rtc-ds1374.c |
3800 | @@ -527,6 +527,10 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd, |
3801 | if (get_user(new_margin, (int __user *)arg)) |
3802 | return -EFAULT; |
3803 | |
3804 | + /* the hardware's tick rate is 4096 Hz, so |
3805 | + * the counter value needs to be scaled accordingly |
3806 | + */ |
3807 | + new_margin <<= 12; |
3808 | if (new_margin < 1 || new_margin > 16777216) |
3809 | return -EINVAL; |
3810 | |
3811 | @@ -535,7 +539,8 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd, |
3812 | ds1374_wdt_ping(); |
3813 | /* fallthrough */ |
3814 | case WDIOC_GETTIMEOUT: |
3815 | - return put_user(wdt_margin, (int __user *)arg); |
3816 | + /* when returning ... inverse is true */ |
3817 | + return put_user((wdt_margin >> 12), (int __user *)arg); |
3818 | case WDIOC_SETOPTIONS: |
3819 | if (copy_from_user(&options, (int __user *)arg, sizeof(int))) |
3820 | return -EFAULT; |
3821 | @@ -543,14 +548,15 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd, |
3822 | if (options & WDIOS_DISABLECARD) { |
3823 | pr_info("disable watchdog\n"); |
3824 | ds1374_wdt_disable(); |
3825 | + return 0; |
3826 | } |
3827 | |
3828 | if (options & WDIOS_ENABLECARD) { |
3829 | pr_info("enable watchdog\n"); |
3830 | ds1374_wdt_settimeout(wdt_margin); |
3831 | ds1374_wdt_ping(); |
3832 | + return 0; |
3833 | } |
3834 | - |
3835 | return -EINVAL; |
3836 | } |
3837 | return -ENOTTY; |
3838 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
3839 | index f7e3f27bb5c5..e9ea8f4ea2c9 100644 |
3840 | --- a/drivers/scsi/lpfc/lpfc_init.c |
3841 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
3842 | @@ -11312,6 +11312,7 @@ int |
3843 | lpfc_fof_queue_create(struct lpfc_hba *phba) |
3844 | { |
3845 | struct lpfc_queue *qdesc; |
3846 | + uint32_t wqesize; |
3847 | |
3848 | /* Create FOF EQ */ |
3849 | qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.eq_esize, |
3850 | @@ -11332,8 +11333,11 @@ lpfc_fof_queue_create(struct lpfc_hba *phba) |
3851 | phba->sli4_hba.oas_cq = qdesc; |
3852 | |
3853 | /* Create OAS WQ */ |
3854 | - qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.wq_esize, |
3855 | + wqesize = (phba->fcp_embed_io) ? |
3856 | + LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; |
3857 | + qdesc = lpfc_sli4_queue_alloc(phba, wqesize, |
3858 | phba->sli4_hba.wq_ecount); |
3859 | + |
3860 | if (!qdesc) |
3861 | goto out_error; |
3862 | |
3863 | diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
3864 | index 8f1df76a77b6..0902ed204ba8 100644 |
3865 | --- a/drivers/scsi/lpfc/lpfc_sli.c |
3866 | +++ b/drivers/scsi/lpfc/lpfc_sli.c |
3867 | @@ -13696,6 +13696,9 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, |
3868 | case LPFC_Q_CREATE_VERSION_1: |
3869 | bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1, |
3870 | wq->entry_count); |
3871 | + bf_set(lpfc_mbox_hdr_version, &shdr->request, |
3872 | + LPFC_Q_CREATE_VERSION_1); |
3873 | + |
3874 | switch (wq->entry_size) { |
3875 | default: |
3876 | case 64: |
3877 | diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c |
3878 | index 14c0334f41e4..26c67c42985c 100644 |
3879 | --- a/drivers/scsi/mac_esp.c |
3880 | +++ b/drivers/scsi/mac_esp.c |
3881 | @@ -55,6 +55,7 @@ struct mac_esp_priv { |
3882 | int error; |
3883 | }; |
3884 | static struct esp *esp_chips[2]; |
3885 | +static DEFINE_SPINLOCK(esp_chips_lock); |
3886 | |
3887 | #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \ |
3888 | platform_get_drvdata((struct platform_device *) \ |
3889 | @@ -562,15 +563,18 @@ static int esp_mac_probe(struct platform_device *dev) |
3890 | } |
3891 | |
3892 | host->irq = IRQ_MAC_SCSI; |
3893 | - esp_chips[dev->id] = esp; |
3894 | - mb(); |
3895 | - if (esp_chips[!dev->id] == NULL) { |
3896 | - err = request_irq(host->irq, mac_scsi_esp_intr, 0, "ESP", NULL); |
3897 | - if (err < 0) { |
3898 | - esp_chips[dev->id] = NULL; |
3899 | - goto fail_free_priv; |
3900 | - } |
3901 | + |
3902 | + /* The request_irq() call is intended to succeed for the first device |
3903 | + * and fail for the second device. |
3904 | + */ |
3905 | + err = request_irq(host->irq, mac_scsi_esp_intr, 0, "ESP", NULL); |
3906 | + spin_lock(&esp_chips_lock); |
3907 | + if (err < 0 && esp_chips[!dev->id] == NULL) { |
3908 | + spin_unlock(&esp_chips_lock); |
3909 | + goto fail_free_priv; |
3910 | } |
3911 | + esp_chips[dev->id] = esp; |
3912 | + spin_unlock(&esp_chips_lock); |
3913 | |
3914 | err = scsi_esp_register(esp, &dev->dev); |
3915 | if (err) |
3916 | @@ -579,8 +583,13 @@ static int esp_mac_probe(struct platform_device *dev) |
3917 | return 0; |
3918 | |
3919 | fail_free_irq: |
3920 | - if (esp_chips[!dev->id] == NULL) |
3921 | + spin_lock(&esp_chips_lock); |
3922 | + esp_chips[dev->id] = NULL; |
3923 | + if (esp_chips[!dev->id] == NULL) { |
3924 | + spin_unlock(&esp_chips_lock); |
3925 | free_irq(host->irq, esp); |
3926 | + } else |
3927 | + spin_unlock(&esp_chips_lock); |
3928 | fail_free_priv: |
3929 | kfree(mep); |
3930 | fail_free_command_block: |
3931 | @@ -599,9 +608,13 @@ static int esp_mac_remove(struct platform_device *dev) |
3932 | |
3933 | scsi_esp_unregister(esp); |
3934 | |
3935 | + spin_lock(&esp_chips_lock); |
3936 | esp_chips[dev->id] = NULL; |
3937 | - if (!(esp_chips[0] || esp_chips[1])) |
3938 | + if (esp_chips[!dev->id] == NULL) { |
3939 | + spin_unlock(&esp_chips_lock); |
3940 | free_irq(irq, NULL); |
3941 | + } else |
3942 | + spin_unlock(&esp_chips_lock); |
3943 | |
3944 | kfree(mep); |
3945 | |
3946 | diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c |
3947 | index c680d7641311..8f4adc1d9588 100644 |
3948 | --- a/drivers/scsi/virtio_scsi.c |
3949 | +++ b/drivers/scsi/virtio_scsi.c |
3950 | @@ -28,6 +28,7 @@ |
3951 | #include <scsi/scsi_device.h> |
3952 | #include <scsi/scsi_cmnd.h> |
3953 | #include <scsi/scsi_tcq.h> |
3954 | +#include <scsi/scsi_devinfo.h> |
3955 | #include <linux/seqlock.h> |
3956 | |
3957 | #define VIRTIO_SCSI_MEMPOOL_SZ 64 |
3958 | @@ -705,6 +706,28 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc) |
3959 | return virtscsi_tmf(vscsi, cmd); |
3960 | } |
3961 | |
3962 | +static int virtscsi_device_alloc(struct scsi_device *sdevice) |
3963 | +{ |
3964 | + /* |
3965 | + * Passed through SCSI targets (e.g. with qemu's 'scsi-block') |
3966 | + * may have transfer limits which come from the host SCSI |
3967 | + * controller or something on the host side other than the |
3968 | + * target itself. |
3969 | + * |
3970 | + * To make this work properly, the hypervisor can adjust the |
3971 | + * target's VPD information to advertise these limits. But |
3972 | + * for that to work, the guest has to look at the VPD pages, |
3973 | + * which we won't do by default if it is an SPC-2 device, even |
3974 | + * if it does actually support it. |
3975 | + * |
3976 | + * So, set the blist to always try to read the VPD pages. |
3977 | + */ |
3978 | + sdevice->sdev_bflags = BLIST_TRY_VPD_PAGES; |
3979 | + |
3980 | + return 0; |
3981 | +} |
3982 | + |
3983 | + |
3984 | /** |
3985 | * virtscsi_change_queue_depth() - Change a virtscsi target's queue depth |
3986 | * @sdev: Virtscsi target whose queue depth to change |
3987 | @@ -776,6 +799,7 @@ static struct scsi_host_template virtscsi_host_template_single = { |
3988 | .change_queue_depth = virtscsi_change_queue_depth, |
3989 | .eh_abort_handler = virtscsi_abort, |
3990 | .eh_device_reset_handler = virtscsi_device_reset, |
3991 | + .slave_alloc = virtscsi_device_alloc, |
3992 | |
3993 | .can_queue = 1024, |
3994 | .dma_boundary = UINT_MAX, |
3995 | diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c |
3996 | index 2707a827261b..5482302d3d9e 100644 |
3997 | --- a/drivers/soc/fsl/qe/qe.c |
3998 | +++ b/drivers/soc/fsl/qe/qe.c |
3999 | @@ -163,11 +163,15 @@ EXPORT_SYMBOL(qe_issue_cmd); |
4000 | */ |
4001 | static unsigned int brg_clk = 0; |
4002 | |
4003 | +#define CLK_GRAN (1000) |
4004 | +#define CLK_GRAN_LIMIT (5) |
4005 | + |
4006 | unsigned int qe_get_brg_clk(void) |
4007 | { |
4008 | struct device_node *qe; |
4009 | int size; |
4010 | const u32 *prop; |
4011 | + unsigned int mod; |
4012 | |
4013 | if (brg_clk) |
4014 | return brg_clk; |
4015 | @@ -185,6 +189,15 @@ unsigned int qe_get_brg_clk(void) |
4016 | |
4017 | of_node_put(qe); |
4018 | |
4019 | + /* round this if near to a multiple of CLK_GRAN */ |
4020 | + mod = brg_clk % CLK_GRAN; |
4021 | + if (mod) { |
4022 | + if (mod < CLK_GRAN_LIMIT) |
4023 | + brg_clk -= mod; |
4024 | + else if (mod > (CLK_GRAN - CLK_GRAN_LIMIT)) |
4025 | + brg_clk += CLK_GRAN - mod; |
4026 | + } |
4027 | + |
4028 | return brg_clk; |
4029 | } |
4030 | EXPORT_SYMBOL(qe_get_brg_clk); |
4031 | diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c |
4032 | index 447497e9124c..d25cc4037e23 100644 |
4033 | --- a/drivers/spi/spi-dw-mmio.c |
4034 | +++ b/drivers/spi/spi-dw-mmio.c |
4035 | @@ -115,8 +115,8 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) |
4036 | { |
4037 | struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev); |
4038 | |
4039 | - clk_disable_unprepare(dwsmmio->clk); |
4040 | dw_spi_remove_host(&dwsmmio->dws); |
4041 | + clk_disable_unprepare(dwsmmio->clk); |
4042 | |
4043 | return 0; |
4044 | } |
4045 | diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c |
4046 | index db100154f85c..6d690e5fa9bb 100644 |
4047 | --- a/drivers/staging/android/ashmem.c |
4048 | +++ b/drivers/staging/android/ashmem.c |
4049 | @@ -718,16 +718,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, |
4050 | size_t pgstart, pgend; |
4051 | int ret = -EINVAL; |
4052 | |
4053 | + if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) |
4054 | + return -EFAULT; |
4055 | + |
4056 | mutex_lock(&ashmem_mutex); |
4057 | |
4058 | if (unlikely(!asma->file)) |
4059 | goto out_unlock; |
4060 | |
4061 | - if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) { |
4062 | - ret = -EFAULT; |
4063 | - goto out_unlock; |
4064 | - } |
4065 | - |
4066 | /* per custom, you can pass zero for len to mean "everything onward" */ |
4067 | if (!pin.len) |
4068 | pin.len = PAGE_ALIGN(asma->size) - pin.offset; |
4069 | diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c |
4070 | index 5a7a87efed27..28b5392153a8 100644 |
4071 | --- a/drivers/staging/unisys/visorhba/visorhba_main.c |
4072 | +++ b/drivers/staging/unisys/visorhba/visorhba_main.c |
4073 | @@ -842,7 +842,7 @@ static void |
4074 | do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) |
4075 | { |
4076 | struct scsi_device *scsidev; |
4077 | - unsigned char buf[36]; |
4078 | + unsigned char *buf; |
4079 | struct scatterlist *sg; |
4080 | unsigned int i; |
4081 | char *this_page; |
4082 | @@ -857,6 +857,10 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) |
4083 | if (cmdrsp->scsi.no_disk_result == 0) |
4084 | return; |
4085 | |
4086 | + buf = kzalloc(sizeof(char) * 36, GFP_KERNEL); |
4087 | + if (!buf) |
4088 | + return; |
4089 | + |
4090 | /* Linux scsi code wants a device at Lun 0 |
4091 | * to issue report luns, but we don't want |
4092 | * a disk there so we'll present a processor |
4093 | @@ -868,6 +872,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) |
4094 | if (scsi_sg_count(scsicmd) == 0) { |
4095 | memcpy(scsi_sglist(scsicmd), buf, |
4096 | cmdrsp->scsi.bufflen); |
4097 | + kfree(buf); |
4098 | return; |
4099 | } |
4100 | |
4101 | @@ -879,6 +884,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) |
4102 | memcpy(this_page, buf + bufind, sg[i].length); |
4103 | kunmap_atomic(this_page_orig); |
4104 | } |
4105 | + kfree(buf); |
4106 | } else { |
4107 | devdata = (struct visorhba_devdata *)scsidev->host->hostdata; |
4108 | for_each_vdisk_match(vdisk, devdata, scsidev) { |
4109 | diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c |
4110 | index 242f82f4d24f..d8ab4cb11289 100644 |
4111 | --- a/drivers/staging/wilc1000/linux_mon.c |
4112 | +++ b/drivers/staging/wilc1000/linux_mon.c |
4113 | @@ -197,6 +197,8 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, |
4114 | |
4115 | if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) { |
4116 | skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr)); |
4117 | + if (!skb2) |
4118 | + return -ENOMEM; |
4119 | |
4120 | memcpy(skb_put(skb2, skb->len), skb->data, skb->len); |
4121 | |
4122 | diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c |
4123 | index 97928b42ad62..57a3d3936364 100644 |
4124 | --- a/drivers/target/target_core_file.c |
4125 | +++ b/drivers/target/target_core_file.c |
4126 | @@ -276,12 +276,11 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd, |
4127 | else |
4128 | ret = vfs_iter_read(fd, &iter, &pos); |
4129 | |
4130 | - kfree(bvec); |
4131 | - |
4132 | if (is_write) { |
4133 | if (ret < 0 || ret != data_length) { |
4134 | pr_err("%s() write returned %d\n", __func__, ret); |
4135 | - return (ret < 0 ? ret : -EINVAL); |
4136 | + if (ret >= 0) |
4137 | + ret = -EINVAL; |
4138 | } |
4139 | } else { |
4140 | /* |
4141 | @@ -294,17 +293,29 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd, |
4142 | pr_err("%s() returned %d, expecting %u for " |
4143 | "S_ISBLK\n", __func__, ret, |
4144 | data_length); |
4145 | - return (ret < 0 ? ret : -EINVAL); |
4146 | + if (ret >= 0) |
4147 | + ret = -EINVAL; |
4148 | } |
4149 | } else { |
4150 | if (ret < 0) { |
4151 | pr_err("%s() returned %d for non S_ISBLK\n", |
4152 | __func__, ret); |
4153 | - return ret; |
4154 | + } else if (ret != data_length) { |
4155 | + /* |
4156 | + * Short read case: |
4157 | + * Probably some one truncate file under us. |
4158 | + * We must explicitly zero sg-pages to prevent |
4159 | + * expose uninizialized pages to userspace. |
4160 | + */ |
4161 | + if (ret < data_length) |
4162 | + ret += iov_iter_zero(data_length - ret, &iter); |
4163 | + else |
4164 | + ret = -EINVAL; |
4165 | } |
4166 | } |
4167 | } |
4168 | - return 1; |
4169 | + kfree(bvec); |
4170 | + return ret; |
4171 | } |
4172 | |
4173 | static sense_reason_t |
4174 | diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c |
4175 | index 459d726f9d59..3eb01a719d22 100644 |
4176 | --- a/drivers/tty/serial/8250/8250_dw.c |
4177 | +++ b/drivers/tty/serial/8250/8250_dw.c |
4178 | @@ -464,7 +464,8 @@ static int dw8250_probe(struct platform_device *pdev) |
4179 | /* If no clock rate is defined, fail. */ |
4180 | if (!p->uartclk) { |
4181 | dev_err(dev, "clock rate not defined\n"); |
4182 | - return -EINVAL; |
4183 | + err = -EINVAL; |
4184 | + goto err_clk; |
4185 | } |
4186 | |
4187 | data->pclk = devm_clk_get(dev, "apb_pclk"); |
4188 | diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
4189 | index 8d9f9a803b42..fb9bada5f1d5 100644 |
4190 | --- a/drivers/tty/tty_io.c |
4191 | +++ b/drivers/tty/tty_io.c |
4192 | @@ -1702,6 +1702,8 @@ static void release_tty(struct tty_struct *tty, int idx) |
4193 | if (tty->link) |
4194 | tty->link->port->itty = NULL; |
4195 | tty_buffer_cancel_work(tty->port); |
4196 | + if (tty->link) |
4197 | + tty_buffer_cancel_work(tty->link->port); |
4198 | |
4199 | tty_kref_put(tty->link); |
4200 | tty_kref_put(tty); |
4201 | diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c |
4202 | index b6d4b484c51a..5815120c0402 100644 |
4203 | --- a/drivers/usb/gadget/function/f_hid.c |
4204 | +++ b/drivers/usb/gadget/function/f_hid.c |
4205 | @@ -284,6 +284,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, |
4206 | size_t count, loff_t *offp) |
4207 | { |
4208 | struct f_hidg *hidg = file->private_data; |
4209 | + struct usb_request *req; |
4210 | unsigned long flags; |
4211 | ssize_t status = -ENOMEM; |
4212 | |
4213 | @@ -293,7 +294,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, |
4214 | spin_lock_irqsave(&hidg->write_spinlock, flags); |
4215 | |
4216 | #define WRITE_COND (!hidg->write_pending) |
4217 | - |
4218 | +try_again: |
4219 | /* write queue */ |
4220 | while (!WRITE_COND) { |
4221 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4222 | @@ -308,6 +309,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, |
4223 | } |
4224 | |
4225 | hidg->write_pending = 1; |
4226 | + req = hidg->req; |
4227 | count = min_t(unsigned, count, hidg->report_length); |
4228 | |
4229 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4230 | @@ -320,24 +322,38 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, |
4231 | goto release_write_pending; |
4232 | } |
4233 | |
4234 | - hidg->req->status = 0; |
4235 | - hidg->req->zero = 0; |
4236 | - hidg->req->length = count; |
4237 | - hidg->req->complete = f_hidg_req_complete; |
4238 | - hidg->req->context = hidg; |
4239 | + spin_lock_irqsave(&hidg->write_spinlock, flags); |
4240 | + |
4241 | + /* we our function has been disabled by host */ |
4242 | + if (!hidg->req) { |
4243 | + free_ep_req(hidg->in_ep, hidg->req); |
4244 | + /* |
4245 | + * TODO |
4246 | + * Should we fail with error here? |
4247 | + */ |
4248 | + goto try_again; |
4249 | + } |
4250 | + |
4251 | + req->status = 0; |
4252 | + req->zero = 0; |
4253 | + req->length = count; |
4254 | + req->complete = f_hidg_req_complete; |
4255 | + req->context = hidg; |
4256 | |
4257 | status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC); |
4258 | if (status < 0) { |
4259 | ERROR(hidg->func.config->cdev, |
4260 | "usb_ep_queue error on int endpoint %zd\n", status); |
4261 | - goto release_write_pending; |
4262 | + goto release_write_pending_unlocked; |
4263 | } else { |
4264 | status = count; |
4265 | } |
4266 | + spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4267 | |
4268 | return status; |
4269 | release_write_pending: |
4270 | spin_lock_irqsave(&hidg->write_spinlock, flags); |
4271 | +release_write_pending_unlocked: |
4272 | hidg->write_pending = 0; |
4273 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4274 | |
4275 | @@ -541,12 +557,23 @@ static void hidg_disable(struct usb_function *f) |
4276 | kfree(list); |
4277 | } |
4278 | spin_unlock_irqrestore(&hidg->read_spinlock, flags); |
4279 | + |
4280 | + spin_lock_irqsave(&hidg->write_spinlock, flags); |
4281 | + if (!hidg->write_pending) { |
4282 | + free_ep_req(hidg->in_ep, hidg->req); |
4283 | + hidg->write_pending = 1; |
4284 | + } |
4285 | + |
4286 | + hidg->req = NULL; |
4287 | + spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4288 | } |
4289 | |
4290 | static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
4291 | { |
4292 | struct usb_composite_dev *cdev = f->config->cdev; |
4293 | struct f_hidg *hidg = func_to_hidg(f); |
4294 | + struct usb_request *req_in = NULL; |
4295 | + unsigned long flags; |
4296 | int i, status = 0; |
4297 | |
4298 | VDBG(cdev, "hidg_set_alt intf:%d alt:%d\n", intf, alt); |
4299 | @@ -567,6 +594,12 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
4300 | goto fail; |
4301 | } |
4302 | hidg->in_ep->driver_data = hidg; |
4303 | + |
4304 | + req_in = hidg_alloc_ep_req(hidg->in_ep, hidg->report_length); |
4305 | + if (!req_in) { |
4306 | + status = -ENOMEM; |
4307 | + goto disable_ep_in; |
4308 | + } |
4309 | } |
4310 | |
4311 | |
4312 | @@ -578,12 +611,12 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
4313 | hidg->out_ep); |
4314 | if (status) { |
4315 | ERROR(cdev, "config_ep_by_speed FAILED!\n"); |
4316 | - goto fail; |
4317 | + goto free_req_in; |
4318 | } |
4319 | status = usb_ep_enable(hidg->out_ep); |
4320 | if (status < 0) { |
4321 | ERROR(cdev, "Enable OUT endpoint FAILED!\n"); |
4322 | - goto fail; |
4323 | + goto free_req_in; |
4324 | } |
4325 | hidg->out_ep->driver_data = hidg; |
4326 | |
4327 | @@ -599,17 +632,37 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
4328 | req->context = hidg; |
4329 | status = usb_ep_queue(hidg->out_ep, req, |
4330 | GFP_ATOMIC); |
4331 | - if (status) |
4332 | + if (status) { |
4333 | ERROR(cdev, "%s queue req --> %d\n", |
4334 | hidg->out_ep->name, status); |
4335 | + free_ep_req(hidg->out_ep, req); |
4336 | + } |
4337 | } else { |
4338 | - usb_ep_disable(hidg->out_ep); |
4339 | status = -ENOMEM; |
4340 | - goto fail; |
4341 | + goto disable_out_ep; |
4342 | } |
4343 | } |
4344 | } |
4345 | |
4346 | + if (hidg->in_ep != NULL) { |
4347 | + spin_lock_irqsave(&hidg->write_spinlock, flags); |
4348 | + hidg->req = req_in; |
4349 | + hidg->write_pending = 0; |
4350 | + spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
4351 | + |
4352 | + wake_up(&hidg->write_queue); |
4353 | + } |
4354 | + return 0; |
4355 | +disable_out_ep: |
4356 | + usb_ep_disable(hidg->out_ep); |
4357 | +free_req_in: |
4358 | + if (req_in) |
4359 | + free_ep_req(hidg->in_ep, req_in); |
4360 | + |
4361 | +disable_ep_in: |
4362 | + if (hidg->in_ep) |
4363 | + usb_ep_disable(hidg->in_ep); |
4364 | + |
4365 | fail: |
4366 | return status; |
4367 | } |
4368 | @@ -658,12 +711,6 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) |
4369 | goto fail; |
4370 | hidg->out_ep = ep; |
4371 | |
4372 | - /* preallocate request and buffer */ |
4373 | - status = -ENOMEM; |
4374 | - hidg->req = alloc_ep_req(hidg->in_ep, hidg->report_length); |
4375 | - if (!hidg->req) |
4376 | - goto fail; |
4377 | - |
4378 | /* set descriptor dynamic values */ |
4379 | hidg_interface_desc.bInterfaceSubClass = hidg->bInterfaceSubClass; |
4380 | hidg_interface_desc.bInterfaceProtocol = hidg->bInterfaceProtocol; |
4381 | @@ -690,6 +737,8 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) |
4382 | goto fail; |
4383 | |
4384 | spin_lock_init(&hidg->write_spinlock); |
4385 | + hidg->write_pending = 1; |
4386 | + hidg->req = NULL; |
4387 | spin_lock_init(&hidg->read_spinlock); |
4388 | init_waitqueue_head(&hidg->write_queue); |
4389 | init_waitqueue_head(&hidg->read_queue); |
4390 | @@ -954,10 +1003,6 @@ static void hidg_unbind(struct usb_configuration *c, struct usb_function *f) |
4391 | device_destroy(hidg_class, MKDEV(major, hidg->minor)); |
4392 | cdev_del(&hidg->cdev); |
4393 | |
4394 | - /* disable/free request and end point */ |
4395 | - usb_ep_disable(hidg->in_ep); |
4396 | - free_ep_req(hidg->in_ep, hidg->req); |
4397 | - |
4398 | usb_free_all_descriptors(f); |
4399 | } |
4400 | |
4401 | diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c |
4402 | index 11576611a974..dda1c4b3a229 100644 |
4403 | --- a/drivers/video/console/vgacon.c |
4404 | +++ b/drivers/video/console/vgacon.c |
4405 | @@ -405,7 +405,10 @@ static const char *vgacon_startup(void) |
4406 | vga_video_port_val = VGA_CRT_DM; |
4407 | if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { |
4408 | static struct resource ega_console_resource = |
4409 | - { .name = "ega", .start = 0x3B0, .end = 0x3BF }; |
4410 | + { .name = "ega", |
4411 | + .flags = IORESOURCE_IO, |
4412 | + .start = 0x3B0, |
4413 | + .end = 0x3BF }; |
4414 | vga_video_type = VIDEO_TYPE_EGAM; |
4415 | vga_vram_size = 0x8000; |
4416 | display_desc = "EGA+"; |
4417 | @@ -413,9 +416,15 @@ static const char *vgacon_startup(void) |
4418 | &ega_console_resource); |
4419 | } else { |
4420 | static struct resource mda1_console_resource = |
4421 | - { .name = "mda", .start = 0x3B0, .end = 0x3BB }; |
4422 | + { .name = "mda", |
4423 | + .flags = IORESOURCE_IO, |
4424 | + .start = 0x3B0, |
4425 | + .end = 0x3BB }; |
4426 | static struct resource mda2_console_resource = |
4427 | - { .name = "mda", .start = 0x3BF, .end = 0x3BF }; |
4428 | + { .name = "mda", |
4429 | + .flags = IORESOURCE_IO, |
4430 | + .start = 0x3BF, |
4431 | + .end = 0x3BF }; |
4432 | vga_video_type = VIDEO_TYPE_MDA; |
4433 | vga_vram_size = 0x2000; |
4434 | display_desc = "*MDA"; |
4435 | @@ -437,15 +446,21 @@ static const char *vgacon_startup(void) |
4436 | vga_vram_size = 0x8000; |
4437 | |
4438 | if (!screen_info.orig_video_isVGA) { |
4439 | - static struct resource ega_console_resource |
4440 | - = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; |
4441 | + static struct resource ega_console_resource = |
4442 | + { .name = "ega", |
4443 | + .flags = IORESOURCE_IO, |
4444 | + .start = 0x3C0, |
4445 | + .end = 0x3DF }; |
4446 | vga_video_type = VIDEO_TYPE_EGAC; |
4447 | display_desc = "EGA"; |
4448 | request_resource(&ioport_resource, |
4449 | &ega_console_resource); |
4450 | } else { |
4451 | - static struct resource vga_console_resource |
4452 | - = { .name = "vga+", .start = 0x3C0, .end = 0x3DF }; |
4453 | + static struct resource vga_console_resource = |
4454 | + { .name = "vga+", |
4455 | + .flags = IORESOURCE_IO, |
4456 | + .start = 0x3C0, |
4457 | + .end = 0x3DF }; |
4458 | vga_video_type = VIDEO_TYPE_VGAC; |
4459 | display_desc = "VGA+"; |
4460 | request_resource(&ioport_resource, |
4461 | @@ -489,7 +504,10 @@ static const char *vgacon_startup(void) |
4462 | } |
4463 | } else { |
4464 | static struct resource cga_console_resource = |
4465 | - { .name = "cga", .start = 0x3D4, .end = 0x3D5 }; |
4466 | + { .name = "cga", |
4467 | + .flags = IORESOURCE_IO, |
4468 | + .start = 0x3D4, |
4469 | + .end = 0x3D5 }; |
4470 | vga_video_type = VIDEO_TYPE_CGA; |
4471 | vga_vram_size = 0x2000; |
4472 | display_desc = "*CGA"; |
4473 | diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c |
4474 | index b529a8c2b652..3984716096aa 100644 |
4475 | --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c |
4476 | +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c |
4477 | @@ -455,6 +455,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi) |
4478 | } |
4479 | |
4480 | static const struct of_device_id td028ttec1_of_match[] = { |
4481 | + { .compatible = "omapdss,tpo,td028ttec1", }, |
4482 | + /* keep to not break older DTB */ |
4483 | { .compatible = "omapdss,toppoly,td028ttec1", }, |
4484 | {}, |
4485 | }; |
4486 | @@ -474,6 +476,7 @@ static struct spi_driver td028ttec1_spi_driver = { |
4487 | |
4488 | module_spi_driver(td028ttec1_spi_driver); |
4489 | |
4490 | +MODULE_ALIAS("spi:tpo,td028ttec1"); |
4491 | MODULE_ALIAS("spi:toppoly,td028ttec1"); |
4492 | MODULE_AUTHOR("H. Nikolaus Schaller <hns@goldelico.com>"); |
4493 | MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver"); |
4494 | diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c |
4495 | index d0a4e2f79a57..d215faacce04 100644 |
4496 | --- a/drivers/video/fbdev/sm501fb.c |
4497 | +++ b/drivers/video/fbdev/sm501fb.c |
4498 | @@ -1600,6 +1600,7 @@ static int sm501fb_start(struct sm501fb_info *info, |
4499 | info->fbmem = ioremap(res->start, resource_size(res)); |
4500 | if (info->fbmem == NULL) { |
4501 | dev_err(dev, "cannot remap framebuffer\n"); |
4502 | + ret = -ENXIO; |
4503 | goto err_mem_res; |
4504 | } |
4505 | |
4506 | diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
4507 | index 53326badfb61..2add8def83be 100644 |
4508 | --- a/drivers/video/fbdev/udlfb.c |
4509 | +++ b/drivers/video/fbdev/udlfb.c |
4510 | @@ -1487,15 +1487,25 @@ static struct device_attribute fb_device_attrs[] = { |
4511 | static int dlfb_select_std_channel(struct dlfb_data *dev) |
4512 | { |
4513 | int ret; |
4514 | - u8 set_def_chn[] = { 0x57, 0xCD, 0xDC, 0xA7, |
4515 | + void *buf; |
4516 | + static const u8 set_def_chn[] = { |
4517 | + 0x57, 0xCD, 0xDC, 0xA7, |
4518 | 0x1C, 0x88, 0x5E, 0x15, |
4519 | 0x60, 0xFE, 0xC6, 0x97, |
4520 | 0x16, 0x3D, 0x47, 0xF2 }; |
4521 | |
4522 | + buf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL); |
4523 | + |
4524 | + if (!buf) |
4525 | + return -ENOMEM; |
4526 | + |
4527 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
4528 | NR_USB_REQUEST_CHANNEL, |
4529 | (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, |
4530 | - set_def_chn, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT); |
4531 | + buf, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT); |
4532 | + |
4533 | + kfree(buf); |
4534 | + |
4535 | return ret; |
4536 | } |
4537 | |
4538 | diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
4539 | index 32930a073a12..977fe74e5abe 100644 |
4540 | --- a/drivers/watchdog/watchdog_dev.c |
4541 | +++ b/drivers/watchdog/watchdog_dev.c |
4542 | @@ -760,6 +760,7 @@ static int watchdog_open(struct inode *inode, struct file *file) |
4543 | { |
4544 | struct watchdog_core_data *wd_data; |
4545 | struct watchdog_device *wdd; |
4546 | + bool hw_running; |
4547 | int err; |
4548 | |
4549 | /* Get the corresponding watchdog device */ |
4550 | @@ -779,7 +780,8 @@ static int watchdog_open(struct inode *inode, struct file *file) |
4551 | * If the /dev/watchdog device is open, we don't want the module |
4552 | * to be unloaded. |
4553 | */ |
4554 | - if (!watchdog_hw_running(wdd) && !try_module_get(wdd->ops->owner)) { |
4555 | + hw_running = watchdog_hw_running(wdd); |
4556 | + if (!hw_running && !try_module_get(wdd->ops->owner)) { |
4557 | err = -EBUSY; |
4558 | goto out_clear; |
4559 | } |
4560 | @@ -790,7 +792,7 @@ static int watchdog_open(struct inode *inode, struct file *file) |
4561 | |
4562 | file->private_data = wd_data; |
4563 | |
4564 | - if (!watchdog_hw_running(wdd)) |
4565 | + if (!hw_running) |
4566 | kref_get(&wd_data->kref); |
4567 | |
4568 | /* dev/watchdog is a virtual (and thus non-seekable) filesystem */ |
4569 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
4570 | index 3286a6e47ff0..c95ff096cd24 100644 |
4571 | --- a/fs/btrfs/file.c |
4572 | +++ b/fs/btrfs/file.c |
4573 | @@ -2817,8 +2817,10 @@ static long btrfs_fallocate(struct file *file, int mode, |
4574 | } |
4575 | ret = btrfs_qgroup_reserve_data(inode, cur_offset, |
4576 | last_byte - cur_offset); |
4577 | - if (ret < 0) |
4578 | + if (ret < 0) { |
4579 | + free_extent_map(em); |
4580 | break; |
4581 | + } |
4582 | } else { |
4583 | /* |
4584 | * Do not need to reserve unwritten extent for this |
4585 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
4586 | index d196ce4be31c..ffd5831ca15c 100644 |
4587 | --- a/fs/btrfs/inode.c |
4588 | +++ b/fs/btrfs/inode.c |
4589 | @@ -567,8 +567,10 @@ static noinline void compress_file_range(struct inode *inode, |
4590 | PAGE_SET_WRITEBACK | |
4591 | page_error_op | |
4592 | PAGE_END_WRITEBACK); |
4593 | - btrfs_free_reserved_data_space_noquota(inode, start, |
4594 | - end - start + 1); |
4595 | + if (ret == 0) |
4596 | + btrfs_free_reserved_data_space_noquota(inode, |
4597 | + start, |
4598 | + end - start + 1); |
4599 | goto free_pages_out; |
4600 | } |
4601 | } |
4602 | diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c |
4603 | index 9a47b5598df7..d040afc966fe 100644 |
4604 | --- a/fs/btrfs/send.c |
4605 | +++ b/fs/btrfs/send.c |
4606 | @@ -5156,13 +5156,19 @@ static int is_extent_unchanged(struct send_ctx *sctx, |
4607 | while (key.offset < ekey->offset + left_len) { |
4608 | ei = btrfs_item_ptr(eb, slot, struct btrfs_file_extent_item); |
4609 | right_type = btrfs_file_extent_type(eb, ei); |
4610 | - if (right_type != BTRFS_FILE_EXTENT_REG) { |
4611 | + if (right_type != BTRFS_FILE_EXTENT_REG && |
4612 | + right_type != BTRFS_FILE_EXTENT_INLINE) { |
4613 | ret = 0; |
4614 | goto out; |
4615 | } |
4616 | |
4617 | right_disknr = btrfs_file_extent_disk_bytenr(eb, ei); |
4618 | - right_len = btrfs_file_extent_num_bytes(eb, ei); |
4619 | + if (right_type == BTRFS_FILE_EXTENT_INLINE) { |
4620 | + right_len = btrfs_file_extent_inline_len(eb, slot, ei); |
4621 | + right_len = PAGE_ALIGN(right_len); |
4622 | + } else { |
4623 | + right_len = btrfs_file_extent_num_bytes(eb, ei); |
4624 | + } |
4625 | right_offset = btrfs_file_extent_offset(eb, ei); |
4626 | right_gen = btrfs_file_extent_generation(eb, ei); |
4627 | |
4628 | @@ -5176,6 +5182,19 @@ static int is_extent_unchanged(struct send_ctx *sctx, |
4629 | goto out; |
4630 | } |
4631 | |
4632 | + /* |
4633 | + * We just wanted to see if when we have an inline extent, what |
4634 | + * follows it is a regular extent (wanted to check the above |
4635 | + * condition for inline extents too). This should normally not |
4636 | + * happen but it's possible for example when we have an inline |
4637 | + * compressed extent representing data with a size matching |
4638 | + * the page size (currently the same as sector size). |
4639 | + */ |
4640 | + if (right_type == BTRFS_FILE_EXTENT_INLINE) { |
4641 | + ret = 0; |
4642 | + goto out; |
4643 | + } |
4644 | + |
4645 | left_offset_fixed = left_offset; |
4646 | if (key.offset < ekey->offset) { |
4647 | /* Fix the right offset for 2a and 7. */ |
4648 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
4649 | index 5900508ca6ed..4730ba2cc049 100644 |
4650 | --- a/fs/btrfs/volumes.c |
4651 | +++ b/fs/btrfs/volumes.c |
4652 | @@ -3765,6 +3765,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl, |
4653 | struct btrfs_ioctl_balance_args *bargs) |
4654 | { |
4655 | struct btrfs_fs_info *fs_info = bctl->fs_info; |
4656 | + u64 meta_target, data_target; |
4657 | u64 allowed; |
4658 | int mixed = 0; |
4659 | int ret; |
4660 | @@ -3861,11 +3862,16 @@ int btrfs_balance(struct btrfs_balance_control *bctl, |
4661 | } |
4662 | } while (read_seqretry(&fs_info->profiles_lock, seq)); |
4663 | |
4664 | - if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) < |
4665 | - btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) { |
4666 | + /* if we're not converting, the target field is uninitialized */ |
4667 | + meta_target = (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
4668 | + bctl->meta.target : fs_info->avail_metadata_alloc_bits; |
4669 | + data_target = (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
4670 | + bctl->data.target : fs_info->avail_data_alloc_bits; |
4671 | + if (btrfs_get_num_tolerated_disk_barrier_failures(meta_target) < |
4672 | + btrfs_get_num_tolerated_disk_barrier_failures(data_target)) { |
4673 | btrfs_warn(fs_info, |
4674 | "metadata profile 0x%llx has lower redundancy than data profile 0x%llx", |
4675 | - bctl->meta.target, bctl->data.target); |
4676 | + meta_target, data_target); |
4677 | } |
4678 | |
4679 | if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { |
4680 | diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c |
4681 | index abae6dd2c6b9..cc88f4f0325e 100644 |
4682 | --- a/fs/cifs/netmisc.c |
4683 | +++ b/fs/cifs/netmisc.c |
4684 | @@ -980,10 +980,10 @@ struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) |
4685 | cifs_dbg(VFS, "illegal hours %d\n", st->Hours); |
4686 | days = sd->Day; |
4687 | month = sd->Month; |
4688 | - if ((days > 31) || (month > 12)) { |
4689 | + if (days < 1 || days > 31 || month < 1 || month > 12) { |
4690 | cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, days); |
4691 | - if (month > 12) |
4692 | - month = 12; |
4693 | + days = clamp(days, 1, 31); |
4694 | + month = clamp(month, 1, 12); |
4695 | } |
4696 | month -= 1; |
4697 | days += total_days_of_prev_months[month]; |
4698 | diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c |
4699 | index 538d9b55699a..c3db2a882aee 100644 |
4700 | --- a/fs/cifs/sess.c |
4701 | +++ b/fs/cifs/sess.c |
4702 | @@ -344,13 +344,12 @@ void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, |
4703 | /* BB is NTLMV2 session security format easier to use here? */ |
4704 | flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | |
4705 | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | |
4706 | - NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; |
4707 | - if (ses->server->sign) { |
4708 | + NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | |
4709 | + NTLMSSP_NEGOTIATE_SEAL; |
4710 | + if (ses->server->sign) |
4711 | flags |= NTLMSSP_NEGOTIATE_SIGN; |
4712 | - if (!ses->server->session_estab || |
4713 | - ses->ntlmssp->sesskey_per_smbsess) |
4714 | - flags |= NTLMSSP_NEGOTIATE_KEY_XCH; |
4715 | - } |
4716 | + if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) |
4717 | + flags |= NTLMSSP_NEGOTIATE_KEY_XCH; |
4718 | |
4719 | sec_blob->NegotiateFlags = cpu_to_le32(flags); |
4720 | |
4721 | @@ -407,13 +406,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer, |
4722 | flags = NTLMSSP_NEGOTIATE_56 | |
4723 | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO | |
4724 | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | |
4725 | - NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; |
4726 | - if (ses->server->sign) { |
4727 | + NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | |
4728 | + NTLMSSP_NEGOTIATE_SEAL; |
4729 | + if (ses->server->sign) |
4730 | flags |= NTLMSSP_NEGOTIATE_SIGN; |
4731 | - if (!ses->server->session_estab || |
4732 | - ses->ntlmssp->sesskey_per_smbsess) |
4733 | - flags |= NTLMSSP_NEGOTIATE_KEY_XCH; |
4734 | - } |
4735 | + if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) |
4736 | + flags |= NTLMSSP_NEGOTIATE_KEY_XCH; |
4737 | |
4738 | tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE); |
4739 | sec_blob->NegotiateFlags = cpu_to_le32(flags); |
4740 | diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
4741 | index 94c4c1901222..7c26286a525d 100644 |
4742 | --- a/fs/cifs/smb2pdu.c |
4743 | +++ b/fs/cifs/smb2pdu.c |
4744 | @@ -707,15 +707,13 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data) |
4745 | struct cifs_ses *ses = sess_data->ses; |
4746 | |
4747 | mutex_lock(&ses->server->srv_mutex); |
4748 | - if (ses->server->sign && ses->server->ops->generate_signingkey) { |
4749 | + if (ses->server->ops->generate_signingkey) { |
4750 | rc = ses->server->ops->generate_signingkey(ses); |
4751 | - kfree(ses->auth_key.response); |
4752 | - ses->auth_key.response = NULL; |
4753 | if (rc) { |
4754 | cifs_dbg(FYI, |
4755 | "SMB3 session key generation failed\n"); |
4756 | mutex_unlock(&ses->server->srv_mutex); |
4757 | - goto keygen_exit; |
4758 | + return rc; |
4759 | } |
4760 | } |
4761 | if (!ses->server->session_estab) { |
4762 | @@ -729,12 +727,6 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data) |
4763 | ses->status = CifsGood; |
4764 | ses->need_reconnect = false; |
4765 | spin_unlock(&GlobalMid_Lock); |
4766 | - |
4767 | -keygen_exit: |
4768 | - if (!ses->server->sign) { |
4769 | - kfree(ses->auth_key.response); |
4770 | - ses->auth_key.response = NULL; |
4771 | - } |
4772 | return rc; |
4773 | } |
4774 | |
4775 | @@ -1712,6 +1704,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, |
4776 | } else |
4777 | iov[0].iov_len = get_rfc1002_length(req) + 4; |
4778 | |
4779 | + /* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */ |
4780 | + if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) |
4781 | + req->hdr.Flags |= SMB2_FLAGS_SIGNED; |
4782 | |
4783 | rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0); |
4784 | rsp = (struct smb2_ioctl_rsp *)iov[0].iov_base; |
4785 | diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
4786 | index 7d4b557f1962..047c8ef620fe 100644 |
4787 | --- a/fs/jbd2/journal.c |
4788 | +++ b/fs/jbd2/journal.c |
4789 | @@ -691,8 +691,21 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) |
4790 | { |
4791 | int err = 0; |
4792 | |
4793 | - jbd2_might_wait_for_commit(journal); |
4794 | read_lock(&journal->j_state_lock); |
4795 | +#ifdef CONFIG_PROVE_LOCKING |
4796 | + /* |
4797 | + * Some callers make sure transaction is already committing and in that |
4798 | + * case we cannot block on open handles anymore. So don't warn in that |
4799 | + * case. |
4800 | + */ |
4801 | + if (tid_gt(tid, journal->j_commit_sequence) && |
4802 | + (!journal->j_committing_transaction || |
4803 | + journal->j_committing_transaction->t_tid != tid)) { |
4804 | + read_unlock(&journal->j_state_lock); |
4805 | + jbd2_might_wait_for_commit(journal); |
4806 | + read_lock(&journal->j_state_lock); |
4807 | + } |
4808 | +#endif |
4809 | #ifdef CONFIG_JBD2_DEBUG |
4810 | if (!tid_geq(journal->j_commit_request, tid)) { |
4811 | printk(KERN_ERR |
4812 | diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c |
4813 | index 3d17fc82b9fe..892c88542ebd 100644 |
4814 | --- a/fs/nfs/pagelist.c |
4815 | +++ b/fs/nfs/pagelist.c |
4816 | @@ -1262,8 +1262,10 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) |
4817 | mirror = &desc->pg_mirrors[midx]; |
4818 | if (!list_empty(&mirror->pg_list)) { |
4819 | prev = nfs_list_entry(mirror->pg_list.prev); |
4820 | - if (index != prev->wb_index + 1) |
4821 | - nfs_pageio_complete_mirror(desc, midx); |
4822 | + if (index != prev->wb_index + 1) { |
4823 | + nfs_pageio_complete(desc); |
4824 | + break; |
4825 | + } |
4826 | } |
4827 | } |
4828 | } |
4829 | diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
4830 | index b8e44746f761..0e008db16b16 100644 |
4831 | --- a/fs/nfs/pnfs.c |
4832 | +++ b/fs/nfs/pnfs.c |
4833 | @@ -1953,8 +1953,6 @@ void pnfs_error_mark_layout_for_return(struct inode *inode, |
4834 | |
4835 | spin_lock(&inode->i_lock); |
4836 | pnfs_set_plh_return_info(lo, range.iomode, 0); |
4837 | - /* Block LAYOUTGET */ |
4838 | - set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags); |
4839 | /* |
4840 | * mark all matching lsegs so that we are sure to have no live |
4841 | * segments at hand when sending layoutreturn. See pnfs_put_lseg() |
4842 | @@ -2308,10 +2306,20 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) |
4843 | enum pnfs_try_status trypnfs; |
4844 | |
4845 | trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg); |
4846 | - if (trypnfs == PNFS_TRY_AGAIN) |
4847 | - pnfs_read_resend_pnfs(hdr); |
4848 | - if (trypnfs == PNFS_NOT_ATTEMPTED || hdr->task.tk_status) |
4849 | + switch (trypnfs) { |
4850 | + case PNFS_NOT_ATTEMPTED: |
4851 | pnfs_read_through_mds(desc, hdr); |
4852 | + case PNFS_ATTEMPTED: |
4853 | + break; |
4854 | + case PNFS_TRY_AGAIN: |
4855 | + /* cleanup hdr and prepare to redo pnfs */ |
4856 | + if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { |
4857 | + struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); |
4858 | + list_splice_init(&hdr->pages, &mirror->pg_list); |
4859 | + mirror->pg_recoalesce = 1; |
4860 | + } |
4861 | + hdr->mds_ops->rpc_release(hdr); |
4862 | + } |
4863 | } |
4864 | |
4865 | static void pnfs_readhdr_free(struct nfs_pgio_header *hdr) |
4866 | diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
4867 | index 022d95886d66..eef0caf6e67d 100644 |
4868 | --- a/fs/nfsd/nfs4proc.c |
4869 | +++ b/fs/nfsd/nfs4proc.c |
4870 | @@ -1338,14 +1338,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp, |
4871 | const struct nfsd4_layout_ops *ops; |
4872 | struct nfs4_layout_stateid *ls; |
4873 | __be32 nfserr; |
4874 | - int accmode; |
4875 | + int accmode = NFSD_MAY_READ_IF_EXEC; |
4876 | |
4877 | switch (lgp->lg_seg.iomode) { |
4878 | case IOMODE_READ: |
4879 | - accmode = NFSD_MAY_READ; |
4880 | + accmode |= NFSD_MAY_READ; |
4881 | break; |
4882 | case IOMODE_RW: |
4883 | - accmode = NFSD_MAY_READ | NFSD_MAY_WRITE; |
4884 | + accmode |= NFSD_MAY_READ | NFSD_MAY_WRITE; |
4885 | break; |
4886 | default: |
4887 | dprintk("%s: invalid iomode %d\n", |
4888 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c |
4889 | index b829cc9a9b39..8f0b19a3ca81 100644 |
4890 | --- a/fs/nfsd/vfs.c |
4891 | +++ b/fs/nfsd/vfs.c |
4892 | @@ -94,6 +94,12 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, |
4893 | err = follow_down(&path); |
4894 | if (err < 0) |
4895 | goto out; |
4896 | + if (path.mnt == exp->ex_path.mnt && path.dentry == dentry && |
4897 | + nfsd_mountpoint(dentry, exp) == 2) { |
4898 | + /* This is only a mountpoint in some other namespace */ |
4899 | + path_put(&path); |
4900 | + goto out; |
4901 | + } |
4902 | |
4903 | exp2 = rqst_exp_get_by_name(rqstp, &path); |
4904 | if (IS_ERR(exp2)) { |
4905 | @@ -167,16 +173,26 @@ static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, st |
4906 | /* |
4907 | * For nfsd purposes, we treat V4ROOT exports as though there was an |
4908 | * export at *every* directory. |
4909 | + * We return: |
4910 | + * '1' if this dentry *must* be an export point, |
4911 | + * '2' if it might be, if there is really a mount here, and |
4912 | + * '0' if there is no chance of an export point here. |
4913 | */ |
4914 | int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) |
4915 | { |
4916 | - if (d_mountpoint(dentry)) |
4917 | + if (!d_inode(dentry)) |
4918 | + return 0; |
4919 | + if (exp->ex_flags & NFSEXP_V4ROOT) |
4920 | return 1; |
4921 | if (nfsd4_is_junction(dentry)) |
4922 | return 1; |
4923 | - if (!(exp->ex_flags & NFSEXP_V4ROOT)) |
4924 | - return 0; |
4925 | - return d_inode(dentry) != NULL; |
4926 | + if (d_mountpoint(dentry)) |
4927 | + /* |
4928 | + * Might only be a mountpoint in a different namespace, |
4929 | + * but we need to check. |
4930 | + */ |
4931 | + return 2; |
4932 | + return 0; |
4933 | } |
4934 | |
4935 | __be32 |
4936 | diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c |
4937 | index f61b00887481..cbca58ba008a 100644 |
4938 | --- a/fs/orangefs/waitqueue.c |
4939 | +++ b/fs/orangefs/waitqueue.c |
4940 | @@ -124,7 +124,14 @@ int service_operation(struct orangefs_kernel_op_s *op, |
4941 | gossip_debug(GOSSIP_WAIT_DEBUG, |
4942 | "%s:client core is NOT in service.\n", |
4943 | __func__); |
4944 | - timeout = op_timeout_secs * HZ; |
4945 | + /* |
4946 | + * Don't wait for the userspace component to return if |
4947 | + * the filesystem is being umounted anyway. |
4948 | + */ |
4949 | + if (op->upcall.type == ORANGEFS_VFS_OP_FS_UMOUNT) |
4950 | + timeout = 0; |
4951 | + else |
4952 | + timeout = op_timeout_secs * HZ; |
4953 | } |
4954 | spin_unlock(&orangefs_request_list_lock); |
4955 | |
4956 | diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h |
4957 | index c93dbadfc71d..db7d15b6a580 100644 |
4958 | --- a/include/acpi/actbl2.h |
4959 | +++ b/include/acpi/actbl2.h |
4960 | @@ -783,6 +783,15 @@ struct acpi_iort_smmu { |
4961 | #define ACPI_IORT_SMMU_DVM_SUPPORTED (1) |
4962 | #define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) |
4963 | |
4964 | +/* Global interrupt format */ |
4965 | + |
4966 | +struct acpi_iort_smmu_gsi { |
4967 | + u32 nsg_irpt; |
4968 | + u32 nsg_irpt_flags; |
4969 | + u32 nsg_cfg_irpt; |
4970 | + u32 nsg_cfg_irpt_flags; |
4971 | +}; |
4972 | + |
4973 | struct acpi_iort_smmu_v3 { |
4974 | u64 base_address; /* SMMUv3 base address */ |
4975 | u32 flags; |
4976 | diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h |
4977 | index 6a620e01b040..7751d72a6a40 100644 |
4978 | --- a/include/linux/mlx5/driver.h |
4979 | +++ b/include/linux/mlx5/driver.h |
4980 | @@ -380,8 +380,8 @@ struct mlx5_core_srq { |
4981 | struct mlx5_core_rsc_common common; /* must be first */ |
4982 | u32 srqn; |
4983 | int max; |
4984 | - int max_gs; |
4985 | - int max_avail_gather; |
4986 | + size_t max_gs; |
4987 | + size_t max_avail_gather; |
4988 | int wqe_shift; |
4989 | void (*event) (struct mlx5_core_srq *, enum mlx5_event); |
4990 | |
4991 | diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h |
4992 | index 34c4498b800f..83b22ae9ae12 100644 |
4993 | --- a/include/linux/posix-clock.h |
4994 | +++ b/include/linux/posix-clock.h |
4995 | @@ -59,23 +59,23 @@ struct posix_clock_operations { |
4996 | |
4997 | int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx); |
4998 | |
4999 | - int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts); |
5000 | + int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts); |
5001 | |
5002 | - int (*clock_getres) (struct posix_clock *pc, struct timespec *ts); |
5003 | + int (*clock_getres) (struct posix_clock *pc, struct timespec64 *ts); |
5004 | |
5005 | int (*clock_settime)(struct posix_clock *pc, |
5006 | - const struct timespec *ts); |
5007 | + const struct timespec64 *ts); |
5008 | |
5009 | int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit); |
5010 | |
5011 | int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit); |
5012 | |
5013 | void (*timer_gettime)(struct posix_clock *pc, |
5014 | - struct k_itimer *kit, struct itimerspec *tsp); |
5015 | + struct k_itimer *kit, struct itimerspec64 *tsp); |
5016 | |
5017 | int (*timer_settime)(struct posix_clock *pc, |
5018 | struct k_itimer *kit, int flags, |
5019 | - struct itimerspec *tsp, struct itimerspec *old); |
5020 | + struct itimerspec64 *tsp, struct itimerspec64 *old); |
5021 | /* |
5022 | * Optional character device methods: |
5023 | */ |
5024 | diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h |
5025 | index 70339d7958c0..0cd4c11479b1 100644 |
5026 | --- a/include/soc/fsl/qe/qe.h |
5027 | +++ b/include/soc/fsl/qe/qe.h |
5028 | @@ -243,6 +243,7 @@ static inline int qe_alive_during_sleep(void) |
5029 | #define qe_muram_free cpm_muram_free |
5030 | #define qe_muram_addr cpm_muram_addr |
5031 | #define qe_muram_offset cpm_muram_offset |
5032 | +#define qe_muram_dma cpm_muram_dma |
5033 | |
5034 | #define qe_setbits32(_addr, _v) iowrite32be(ioread32be(_addr) | (_v), (_addr)) |
5035 | #define qe_clrbits32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr)) |
5036 | diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
5037 | index ea41820ab12e..ed18aa4dceab 100644 |
5038 | --- a/kernel/irq/manage.c |
5039 | +++ b/kernel/irq/manage.c |
5040 | @@ -1210,8 +1210,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) |
5041 | * set the trigger type must match. Also all must |
5042 | * agree on ONESHOT. |
5043 | */ |
5044 | + unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data); |
5045 | + |
5046 | if (!((old->flags & new->flags) & IRQF_SHARED) || |
5047 | - ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) || |
5048 | + (oldtype != (new->flags & IRQF_TRIGGER_MASK)) || |
5049 | ((old->flags ^ new->flags) & IRQF_ONESHOT)) |
5050 | goto mismatch; |
5051 | |
5052 | diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c |
5053 | index 9cff0ab82b63..e24008c098c6 100644 |
5054 | --- a/kernel/time/posix-clock.c |
5055 | +++ b/kernel/time/posix-clock.c |
5056 | @@ -300,14 +300,17 @@ static int pc_clock_adjtime(clockid_t id, struct timex *tx) |
5057 | static int pc_clock_gettime(clockid_t id, struct timespec *ts) |
5058 | { |
5059 | struct posix_clock_desc cd; |
5060 | + struct timespec64 ts64; |
5061 | int err; |
5062 | |
5063 | err = get_clock_desc(id, &cd); |
5064 | if (err) |
5065 | return err; |
5066 | |
5067 | - if (cd.clk->ops.clock_gettime) |
5068 | - err = cd.clk->ops.clock_gettime(cd.clk, ts); |
5069 | + if (cd.clk->ops.clock_gettime) { |
5070 | + err = cd.clk->ops.clock_gettime(cd.clk, &ts64); |
5071 | + *ts = timespec64_to_timespec(ts64); |
5072 | + } |
5073 | else |
5074 | err = -EOPNOTSUPP; |
5075 | |
5076 | @@ -319,14 +322,17 @@ static int pc_clock_gettime(clockid_t id, struct timespec *ts) |
5077 | static int pc_clock_getres(clockid_t id, struct timespec *ts) |
5078 | { |
5079 | struct posix_clock_desc cd; |
5080 | + struct timespec64 ts64; |
5081 | int err; |
5082 | |
5083 | err = get_clock_desc(id, &cd); |
5084 | if (err) |
5085 | return err; |
5086 | |
5087 | - if (cd.clk->ops.clock_getres) |
5088 | - err = cd.clk->ops.clock_getres(cd.clk, ts); |
5089 | + if (cd.clk->ops.clock_getres) { |
5090 | + err = cd.clk->ops.clock_getres(cd.clk, &ts64); |
5091 | + *ts = timespec64_to_timespec(ts64); |
5092 | + } |
5093 | else |
5094 | err = -EOPNOTSUPP; |
5095 | |
5096 | @@ -337,6 +343,7 @@ static int pc_clock_getres(clockid_t id, struct timespec *ts) |
5097 | |
5098 | static int pc_clock_settime(clockid_t id, const struct timespec *ts) |
5099 | { |
5100 | + struct timespec64 ts64 = timespec_to_timespec64(*ts); |
5101 | struct posix_clock_desc cd; |
5102 | int err; |
5103 | |
5104 | @@ -350,7 +357,7 @@ static int pc_clock_settime(clockid_t id, const struct timespec *ts) |
5105 | } |
5106 | |
5107 | if (cd.clk->ops.clock_settime) |
5108 | - err = cd.clk->ops.clock_settime(cd.clk, ts); |
5109 | + err = cd.clk->ops.clock_settime(cd.clk, &ts64); |
5110 | else |
5111 | err = -EOPNOTSUPP; |
5112 | out: |
5113 | @@ -403,29 +410,36 @@ static void pc_timer_gettime(struct k_itimer *kit, struct itimerspec *ts) |
5114 | { |
5115 | clockid_t id = kit->it_clock; |
5116 | struct posix_clock_desc cd; |
5117 | + struct itimerspec64 ts64; |
5118 | |
5119 | if (get_clock_desc(id, &cd)) |
5120 | return; |
5121 | |
5122 | - if (cd.clk->ops.timer_gettime) |
5123 | - cd.clk->ops.timer_gettime(cd.clk, kit, ts); |
5124 | - |
5125 | + if (cd.clk->ops.timer_gettime) { |
5126 | + cd.clk->ops.timer_gettime(cd.clk, kit, &ts64); |
5127 | + *ts = itimerspec64_to_itimerspec(&ts64); |
5128 | + } |
5129 | put_clock_desc(&cd); |
5130 | } |
5131 | |
5132 | static int pc_timer_settime(struct k_itimer *kit, int flags, |
5133 | struct itimerspec *ts, struct itimerspec *old) |
5134 | { |
5135 | + struct itimerspec64 ts64 = itimerspec_to_itimerspec64(ts); |
5136 | clockid_t id = kit->it_clock; |
5137 | struct posix_clock_desc cd; |
5138 | + struct itimerspec64 old64; |
5139 | int err; |
5140 | |
5141 | err = get_clock_desc(id, &cd); |
5142 | if (err) |
5143 | return err; |
5144 | |
5145 | - if (cd.clk->ops.timer_settime) |
5146 | - err = cd.clk->ops.timer_settime(cd.clk, kit, flags, ts, old); |
5147 | + if (cd.clk->ops.timer_settime) { |
5148 | + err = cd.clk->ops.timer_settime(cd.clk, kit, flags, &ts64, &old64); |
5149 | + if (old) |
5150 | + *old = itimerspec64_to_itimerspec(&old64); |
5151 | + } |
5152 | else |
5153 | err = -EOPNOTSUPP; |
5154 | |
5155 | diff --git a/mm/memory-failure.c b/mm/memory-failure.c |
5156 | index 5aa71a82ca73..851efb004857 100644 |
5157 | --- a/mm/memory-failure.c |
5158 | +++ b/mm/memory-failure.c |
5159 | @@ -921,6 +921,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, |
5160 | int ret; |
5161 | int kill = 1, forcekill; |
5162 | struct page *hpage = *hpagep; |
5163 | + bool mlocked = PageMlocked(hpage); |
5164 | |
5165 | /* |
5166 | * Here we are interested only in user-mapped pages, so skip any |
5167 | @@ -984,6 +985,13 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, |
5168 | pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n", |
5169 | pfn, page_mapcount(hpage)); |
5170 | |
5171 | + /* |
5172 | + * try_to_unmap() might put mlocked page in lru cache, so call |
5173 | + * shake_page() again to ensure that it's flushed. |
5174 | + */ |
5175 | + if (mlocked) |
5176 | + shake_page(hpage, 0); |
5177 | + |
5178 | /* |
5179 | * Now that the dirty bit has been propagated to the |
5180 | * struct page and all unmaps done we can decide if |
5181 | diff --git a/mm/vmscan.c b/mm/vmscan.c |
5182 | index 4365de74bdb0..cdd5c3b5c357 100644 |
5183 | --- a/mm/vmscan.c |
5184 | +++ b/mm/vmscan.c |
5185 | @@ -2841,8 +2841,10 @@ static bool allow_direct_reclaim(pg_data_t *pgdat) |
5186 | |
5187 | for (i = 0; i <= ZONE_NORMAL; i++) { |
5188 | zone = &pgdat->node_zones[i]; |
5189 | - if (!managed_zone(zone) || |
5190 | - pgdat_reclaimable_pages(pgdat) == 0) |
5191 | + if (!managed_zone(zone)) |
5192 | + continue; |
5193 | + |
5194 | + if (!zone_reclaimable_pages(zone)) |
5195 | continue; |
5196 | |
5197 | pfmemalloc_reserve += min_wmark_pages(zone); |
5198 | diff --git a/mm/vmstat.c b/mm/vmstat.c |
5199 | index 3863b5d6d598..68b3193e4493 100644 |
5200 | --- a/mm/vmstat.c |
5201 | +++ b/mm/vmstat.c |
5202 | @@ -1387,18 +1387,24 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
5203 | zone->present_pages, |
5204 | zone->managed_pages); |
5205 | |
5206 | - for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) |
5207 | - seq_printf(m, "\n %-12s %lu", vmstat_text[i], |
5208 | - zone_page_state(zone, i)); |
5209 | - |
5210 | seq_printf(m, |
5211 | "\n protection: (%ld", |
5212 | zone->lowmem_reserve[0]); |
5213 | for (i = 1; i < ARRAY_SIZE(zone->lowmem_reserve); i++) |
5214 | seq_printf(m, ", %ld", zone->lowmem_reserve[i]); |
5215 | - seq_printf(m, |
5216 | - ")" |
5217 | - "\n pagesets"); |
5218 | + seq_putc(m, ')'); |
5219 | + |
5220 | + /* If unpopulated, no other information is useful */ |
5221 | + if (!populated_zone(zone)) { |
5222 | + seq_putc(m, '\n'); |
5223 | + return; |
5224 | + } |
5225 | + |
5226 | + for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) |
5227 | + seq_printf(m, "\n %-12s %lu", vmstat_text[i], |
5228 | + zone_page_state(zone, i)); |
5229 | + |
5230 | + seq_printf(m, "\n pagesets"); |
5231 | for_each_online_cpu(i) { |
5232 | struct per_cpu_pageset *pageset; |
5233 | |
5234 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
5235 | index 2f107e46355c..b5f264ae3bff 100644 |
5236 | --- a/net/ipv4/tcp_input.c |
5237 | +++ b/net/ipv4/tcp_input.c |
5238 | @@ -5606,10 +5606,6 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb) |
5239 | else |
5240 | tp->pred_flags = 0; |
5241 | |
5242 | - if (!sock_flag(sk, SOCK_DEAD)) { |
5243 | - sk->sk_state_change(sk); |
5244 | - sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT); |
5245 | - } |
5246 | } |
5247 | |
5248 | static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, |
5249 | @@ -5678,6 +5674,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, |
5250 | struct tcp_sock *tp = tcp_sk(sk); |
5251 | struct tcp_fastopen_cookie foc = { .len = -1 }; |
5252 | int saved_clamp = tp->rx_opt.mss_clamp; |
5253 | + bool fastopen_fail; |
5254 | |
5255 | tcp_parse_options(skb, &tp->rx_opt, 0, &foc); |
5256 | if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) |
5257 | @@ -5781,10 +5778,15 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, |
5258 | |
5259 | tcp_finish_connect(sk, skb); |
5260 | |
5261 | - if ((tp->syn_fastopen || tp->syn_data) && |
5262 | - tcp_rcv_fastopen_synack(sk, skb, &foc)) |
5263 | - return -1; |
5264 | + fastopen_fail = (tp->syn_fastopen || tp->syn_data) && |
5265 | + tcp_rcv_fastopen_synack(sk, skb, &foc); |
5266 | |
5267 | + if (!sock_flag(sk, SOCK_DEAD)) { |
5268 | + sk->sk_state_change(sk); |
5269 | + sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT); |
5270 | + } |
5271 | + if (fastopen_fail) |
5272 | + return -1; |
5273 | if (sk->sk_write_pending || |
5274 | icsk->icsk_accept_queue.rskq_defer_accept || |
5275 | icsk->icsk_ack.pingpong) { |
5276 | diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
5277 | index 912333586de6..345efeb887ef 100644 |
5278 | --- a/net/ipv6/ip6_vti.c |
5279 | +++ b/net/ipv6/ip6_vti.c |
5280 | @@ -625,6 +625,7 @@ static void vti6_link_config(struct ip6_tnl *t) |
5281 | { |
5282 | struct net_device *dev = t->dev; |
5283 | struct __ip6_tnl_parm *p = &t->parms; |
5284 | + struct net_device *tdev = NULL; |
5285 | |
5286 | memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); |
5287 | memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); |
5288 | @@ -637,6 +638,25 @@ static void vti6_link_config(struct ip6_tnl *t) |
5289 | dev->flags |= IFF_POINTOPOINT; |
5290 | else |
5291 | dev->flags &= ~IFF_POINTOPOINT; |
5292 | + |
5293 | + if (p->flags & IP6_TNL_F_CAP_XMIT) { |
5294 | + int strict = (ipv6_addr_type(&p->raddr) & |
5295 | + (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); |
5296 | + struct rt6_info *rt = rt6_lookup(t->net, |
5297 | + &p->raddr, &p->laddr, |
5298 | + p->link, strict); |
5299 | + |
5300 | + if (rt) |
5301 | + tdev = rt->dst.dev; |
5302 | + ip6_rt_put(rt); |
5303 | + } |
5304 | + |
5305 | + if (!tdev && p->link) |
5306 | + tdev = __dev_get_by_index(t->net, p->link); |
5307 | + |
5308 | + if (tdev) |
5309 | + dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, |
5310 | + IPV6_MIN_MTU); |
5311 | } |
5312 | |
5313 | /** |
5314 | diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c |
5315 | index d8e671457d10..41c22cb33424 100644 |
5316 | --- a/net/ipv6/ndisc.c |
5317 | +++ b/net/ipv6/ndisc.c |
5318 | @@ -1723,6 +1723,8 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, |
5319 | case NETDEV_CHANGEADDR: |
5320 | neigh_changeaddr(&nd_tbl, dev); |
5321 | fib6_run_gc(0, net, false); |
5322 | + /* fallthrough */ |
5323 | + case NETDEV_UP: |
5324 | idev = in6_dev_get(dev); |
5325 | if (!idev) |
5326 | break; |
5327 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
5328 | index dee60428c78c..efa2a2fcae72 100644 |
5329 | --- a/net/mac80211/cfg.c |
5330 | +++ b/net/mac80211/cfg.c |
5331 | @@ -620,10 +620,11 @@ void sta_set_rate_info_tx(struct sta_info *sta, |
5332 | int shift = ieee80211_vif_get_shift(&sta->sdata->vif); |
5333 | u16 brate; |
5334 | |
5335 | - sband = sta->local->hw.wiphy->bands[ |
5336 | - ieee80211_get_sdata_band(sta->sdata)]; |
5337 | - brate = sband->bitrates[rate->idx].bitrate; |
5338 | - rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); |
5339 | + sband = ieee80211_get_sband(sta->sdata); |
5340 | + if (sband) { |
5341 | + brate = sband->bitrates[rate->idx].bitrate; |
5342 | + rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); |
5343 | + } |
5344 | } |
5345 | if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) |
5346 | rinfo->bw = RATE_INFO_BW_40; |
5347 | @@ -1218,10 +1219,11 @@ static int sta_apply_parameters(struct ieee80211_local *local, |
5348 | int ret = 0; |
5349 | struct ieee80211_supported_band *sband; |
5350 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
5351 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5352 | u32 mask, set; |
5353 | |
5354 | - sband = local->hw.wiphy->bands[band]; |
5355 | + sband = ieee80211_get_sband(sdata); |
5356 | + if (!sband) |
5357 | + return -EINVAL; |
5358 | |
5359 | mask = params->sta_flags_mask; |
5360 | set = params->sta_flags_set; |
5361 | @@ -1354,7 +1356,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, |
5362 | ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, |
5363 | sband, params->supported_rates, |
5364 | params->supported_rates_len, |
5365 | - &sta->sta.supp_rates[band]); |
5366 | + &sta->sta.supp_rates[sband->band]); |
5367 | } |
5368 | |
5369 | if (params->ht_capa) |
5370 | @@ -1370,8 +1372,8 @@ static int sta_apply_parameters(struct ieee80211_local *local, |
5371 | /* returned value is only needed for rc update, but the |
5372 | * rc isn't initialized here yet, so ignore it |
5373 | */ |
5374 | - __ieee80211_vht_handle_opmode(sdata, sta, |
5375 | - params->opmode_notif, band); |
5376 | + __ieee80211_vht_handle_opmode(sdata, sta, params->opmode_notif, |
5377 | + sband->band); |
5378 | } |
5379 | |
5380 | if (params->support_p2p_ps >= 0) |
5381 | @@ -2017,13 +2019,15 @@ static int ieee80211_change_bss(struct wiphy *wiphy, |
5382 | struct bss_parameters *params) |
5383 | { |
5384 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
5385 | - enum nl80211_band band; |
5386 | + struct ieee80211_supported_band *sband; |
5387 | u32 changed = 0; |
5388 | |
5389 | if (!sdata_dereference(sdata->u.ap.beacon, sdata)) |
5390 | return -ENOENT; |
5391 | |
5392 | - band = ieee80211_get_sdata_band(sdata); |
5393 | + sband = ieee80211_get_sband(sdata); |
5394 | + if (!sband) |
5395 | + return -EINVAL; |
5396 | |
5397 | if (params->use_cts_prot >= 0) { |
5398 | sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; |
5399 | @@ -2036,7 +2040,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, |
5400 | } |
5401 | |
5402 | if (!sdata->vif.bss_conf.use_short_slot && |
5403 | - band == NL80211_BAND_5GHZ) { |
5404 | + sband->band == NL80211_BAND_5GHZ) { |
5405 | sdata->vif.bss_conf.use_short_slot = true; |
5406 | changed |= BSS_CHANGED_ERP_SLOT; |
5407 | } |
5408 | @@ -2049,7 +2053,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, |
5409 | |
5410 | if (params->basic_rates) { |
5411 | ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, |
5412 | - wiphy->bands[band], |
5413 | + wiphy->bands[sband->band], |
5414 | params->basic_rates, |
5415 | params->basic_rates_len, |
5416 | &sdata->vif.bss_conf.basic_rates); |
5417 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
5418 | index 62d13eabe17f..d31818e7d10c 100644 |
5419 | --- a/net/mac80211/ibss.c |
5420 | +++ b/net/mac80211/ibss.c |
5421 | @@ -994,7 +994,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, |
5422 | enum nl80211_band band = rx_status->band; |
5423 | enum nl80211_bss_scan_width scan_width; |
5424 | struct ieee80211_local *local = sdata->local; |
5425 | - struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
5426 | + struct ieee80211_supported_band *sband; |
5427 | bool rates_updated = false; |
5428 | u32 supp_rates = 0; |
5429 | |
5430 | @@ -1004,6 +1004,10 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, |
5431 | if (!ether_addr_equal(mgmt->bssid, sdata->u.ibss.bssid)) |
5432 | return; |
5433 | |
5434 | + sband = local->hw.wiphy->bands[band]; |
5435 | + if (WARN_ON(!sband)) |
5436 | + return; |
5437 | + |
5438 | rcu_read_lock(); |
5439 | sta = sta_info_get(sdata, mgmt->sa); |
5440 | |
5441 | diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
5442 | index 03dbc6bd8598..7fd544d970d9 100644 |
5443 | --- a/net/mac80211/ieee80211_i.h |
5444 | +++ b/net/mac80211/ieee80211_i.h |
5445 | @@ -991,21 +991,6 @@ sdata_assert_lock(struct ieee80211_sub_if_data *sdata) |
5446 | lockdep_assert_held(&sdata->wdev.mtx); |
5447 | } |
5448 | |
5449 | -static inline enum nl80211_band |
5450 | -ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata) |
5451 | -{ |
5452 | - enum nl80211_band band = NL80211_BAND_2GHZ; |
5453 | - struct ieee80211_chanctx_conf *chanctx_conf; |
5454 | - |
5455 | - rcu_read_lock(); |
5456 | - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
5457 | - if (!WARN_ON(!chanctx_conf)) |
5458 | - band = chanctx_conf->def.chan->band; |
5459 | - rcu_read_unlock(); |
5460 | - |
5461 | - return band; |
5462 | -} |
5463 | - |
5464 | static inline int |
5465 | ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) |
5466 | { |
5467 | @@ -1410,6 +1395,27 @@ IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) |
5468 | return container_of(wdev, struct ieee80211_sub_if_data, wdev); |
5469 | } |
5470 | |
5471 | +static inline struct ieee80211_supported_band * |
5472 | +ieee80211_get_sband(struct ieee80211_sub_if_data *sdata) |
5473 | +{ |
5474 | + struct ieee80211_local *local = sdata->local; |
5475 | + struct ieee80211_chanctx_conf *chanctx_conf; |
5476 | + enum nl80211_band band; |
5477 | + |
5478 | + rcu_read_lock(); |
5479 | + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
5480 | + |
5481 | + if (WARN_ON(!chanctx_conf)) { |
5482 | + rcu_read_unlock(); |
5483 | + return NULL; |
5484 | + } |
5485 | + |
5486 | + band = chanctx_conf->def.chan->band; |
5487 | + rcu_read_unlock(); |
5488 | + |
5489 | + return local->hw.wiphy->bands[band]; |
5490 | +} |
5491 | + |
5492 | /* this struct represents 802.11n's RA/TID combination */ |
5493 | struct ieee80211_ra_tid { |
5494 | u8 ra[ETH_ALEN]; |
5495 | diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c |
5496 | index b4b3fe078868..b2a27263d6ff 100644 |
5497 | --- a/net/mac80211/mesh.c |
5498 | +++ b/net/mac80211/mesh.c |
5499 | @@ -63,6 +63,7 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, |
5500 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
5501 | u32 basic_rates = 0; |
5502 | struct cfg80211_chan_def sta_chan_def; |
5503 | + struct ieee80211_supported_band *sband; |
5504 | |
5505 | /* |
5506 | * As support for each feature is added, check for matching |
5507 | @@ -83,7 +84,11 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, |
5508 | (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth))) |
5509 | return false; |
5510 | |
5511 | - ieee80211_sta_get_rates(sdata, ie, ieee80211_get_sdata_band(sdata), |
5512 | + sband = ieee80211_get_sband(sdata); |
5513 | + if (!sband) |
5514 | + return false; |
5515 | + |
5516 | + ieee80211_sta_get_rates(sdata, ie, sband->band, |
5517 | &basic_rates); |
5518 | |
5519 | if (sdata->vif.bss_conf.basic_rates != basic_rates) |
5520 | @@ -399,12 +404,13 @@ static int mesh_add_ds_params_ie(struct ieee80211_sub_if_data *sdata, |
5521 | int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata, |
5522 | struct sk_buff *skb) |
5523 | { |
5524 | - struct ieee80211_local *local = sdata->local; |
5525 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5526 | struct ieee80211_supported_band *sband; |
5527 | u8 *pos; |
5528 | |
5529 | - sband = local->hw.wiphy->bands[band]; |
5530 | + sband = ieee80211_get_sband(sdata); |
5531 | + if (!sband) |
5532 | + return -EINVAL; |
5533 | + |
5534 | if (!sband->ht_cap.ht_supported || |
5535 | sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || |
5536 | sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || |
5537 | @@ -462,12 +468,13 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata, |
5538 | int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata, |
5539 | struct sk_buff *skb) |
5540 | { |
5541 | - struct ieee80211_local *local = sdata->local; |
5542 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5543 | struct ieee80211_supported_band *sband; |
5544 | u8 *pos; |
5545 | |
5546 | - sband = local->hw.wiphy->bands[band]; |
5547 | + sband = ieee80211_get_sband(sdata); |
5548 | + if (!sband) |
5549 | + return -EINVAL; |
5550 | + |
5551 | if (!sband->vht_cap.vht_supported || |
5552 | sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT || |
5553 | sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 || |
5554 | @@ -916,12 +923,16 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, |
5555 | struct cfg80211_csa_settings params; |
5556 | struct ieee80211_csa_ie csa_ie; |
5557 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
5558 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5559 | + struct ieee80211_supported_band *sband; |
5560 | int err; |
5561 | u32 sta_flags; |
5562 | |
5563 | sdata_assert_lock(sdata); |
5564 | |
5565 | + sband = ieee80211_get_sband(sdata); |
5566 | + if (!sband) |
5567 | + return false; |
5568 | + |
5569 | sta_flags = IEEE80211_STA_DISABLE_VHT; |
5570 | switch (sdata->vif.bss_conf.chandef.width) { |
5571 | case NL80211_CHAN_WIDTH_20_NOHT: |
5572 | @@ -935,7 +946,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, |
5573 | |
5574 | memset(¶ms, 0, sizeof(params)); |
5575 | memset(&csa_ie, 0, sizeof(csa_ie)); |
5576 | - err = ieee80211_parse_ch_switch_ie(sdata, elems, band, |
5577 | + err = ieee80211_parse_ch_switch_ie(sdata, elems, sband->band, |
5578 | sta_flags, sdata->vif.addr, |
5579 | &csa_ie); |
5580 | if (err < 0) |
5581 | diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c |
5582 | index fcba70e57073..2d3c4695e75b 100644 |
5583 | --- a/net/mac80211/mesh_plink.c |
5584 | +++ b/net/mac80211/mesh_plink.c |
5585 | @@ -93,19 +93,23 @@ static inline void mesh_plink_fsm_restart(struct sta_info *sta) |
5586 | static u32 mesh_set_short_slot_time(struct ieee80211_sub_if_data *sdata) |
5587 | { |
5588 | struct ieee80211_local *local = sdata->local; |
5589 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5590 | - struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
5591 | + struct ieee80211_supported_band *sband; |
5592 | struct sta_info *sta; |
5593 | u32 erp_rates = 0, changed = 0; |
5594 | int i; |
5595 | bool short_slot = false; |
5596 | |
5597 | - if (band == NL80211_BAND_5GHZ) { |
5598 | + sband = ieee80211_get_sband(sdata); |
5599 | + if (!sband) |
5600 | + return changed; |
5601 | + |
5602 | + if (sband->band == NL80211_BAND_5GHZ) { |
5603 | /* (IEEE 802.11-2012 19.4.5) */ |
5604 | short_slot = true; |
5605 | goto out; |
5606 | - } else if (band != NL80211_BAND_2GHZ) |
5607 | + } else if (sband->band != NL80211_BAND_2GHZ) { |
5608 | goto out; |
5609 | + } |
5610 | |
5611 | for (i = 0; i < sband->n_bitrates; i++) |
5612 | if (sband->bitrates[i].flags & IEEE80211_RATE_ERP_G) |
5613 | @@ -121,7 +125,7 @@ static u32 mesh_set_short_slot_time(struct ieee80211_sub_if_data *sdata) |
5614 | continue; |
5615 | |
5616 | short_slot = false; |
5617 | - if (erp_rates & sta->sta.supp_rates[band]) |
5618 | + if (erp_rates & sta->sta.supp_rates[sband->band]) |
5619 | short_slot = true; |
5620 | else |
5621 | break; |
5622 | @@ -247,7 +251,15 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, |
5623 | mgmt->u.action.u.self_prot.action_code = action; |
5624 | |
5625 | if (action != WLAN_SP_MESH_PEERING_CLOSE) { |
5626 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5627 | + struct ieee80211_supported_band *sband; |
5628 | + enum nl80211_band band; |
5629 | + |
5630 | + sband = ieee80211_get_sband(sdata); |
5631 | + if (!sband) { |
5632 | + err = -EINVAL; |
5633 | + goto free; |
5634 | + } |
5635 | + band = sband->band; |
5636 | |
5637 | /* capability info */ |
5638 | pos = skb_put(skb, 2); |
5639 | @@ -393,13 +405,16 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, |
5640 | struct ieee802_11_elems *elems, bool insert) |
5641 | { |
5642 | struct ieee80211_local *local = sdata->local; |
5643 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5644 | struct ieee80211_supported_band *sband; |
5645 | u32 rates, basic_rates = 0, changed = 0; |
5646 | enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; |
5647 | |
5648 | - sband = local->hw.wiphy->bands[band]; |
5649 | - rates = ieee80211_sta_get_rates(sdata, elems, band, &basic_rates); |
5650 | + sband = ieee80211_get_sband(sdata); |
5651 | + if (!sband) |
5652 | + return; |
5653 | + |
5654 | + rates = ieee80211_sta_get_rates(sdata, elems, sband->band, |
5655 | + &basic_rates); |
5656 | |
5657 | spin_lock_bh(&sta->mesh->plink_lock); |
5658 | sta->rx_stats.last_rx = jiffies; |
5659 | @@ -410,9 +425,9 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, |
5660 | goto out; |
5661 | sta->mesh->processed_beacon = true; |
5662 | |
5663 | - if (sta->sta.supp_rates[band] != rates) |
5664 | + if (sta->sta.supp_rates[sband->band] != rates) |
5665 | changed |= IEEE80211_RC_SUPP_RATES_CHANGED; |
5666 | - sta->sta.supp_rates[band] = rates; |
5667 | + sta->sta.supp_rates[sband->band] = rates; |
5668 | |
5669 | if (ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
5670 | elems->ht_cap_elem, sta)) |
5671 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
5672 | index 1118c61f835d..fdab4f1390d2 100644 |
5673 | --- a/net/mac80211/mlme.c |
5674 | +++ b/net/mac80211/mlme.c |
5675 | @@ -1851,11 +1851,16 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, |
5676 | u16 capab, bool erp_valid, u8 erp) |
5677 | { |
5678 | struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; |
5679 | + struct ieee80211_supported_band *sband; |
5680 | u32 changed = 0; |
5681 | bool use_protection; |
5682 | bool use_short_preamble; |
5683 | bool use_short_slot; |
5684 | |
5685 | + sband = ieee80211_get_sband(sdata); |
5686 | + if (!sband) |
5687 | + return changed; |
5688 | + |
5689 | if (erp_valid) { |
5690 | use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0; |
5691 | use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0; |
5692 | @@ -1865,7 +1870,7 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, |
5693 | } |
5694 | |
5695 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); |
5696 | - if (ieee80211_get_sdata_band(sdata) == NL80211_BAND_5GHZ) |
5697 | + if (sband->band == NL80211_BAND_5GHZ) |
5698 | use_short_slot = true; |
5699 | |
5700 | if (use_protection != bss_conf->use_cts_prot) { |
5701 | @@ -2994,7 +2999,12 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, |
5702 | goto out; |
5703 | } |
5704 | |
5705 | - sband = local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)]; |
5706 | + sband = ieee80211_get_sband(sdata); |
5707 | + if (!sband) { |
5708 | + mutex_unlock(&sdata->local->sta_mtx); |
5709 | + ret = false; |
5710 | + goto out; |
5711 | + } |
5712 | |
5713 | /* Set up internal HT/VHT capabilities */ |
5714 | if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) |
5715 | diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c |
5716 | index 206698bc93f4..dbceb42c2a8e 100644 |
5717 | --- a/net/mac80211/rate.c |
5718 | +++ b/net/mac80211/rate.c |
5719 | @@ -875,7 +875,9 @@ int rate_control_set_rates(struct ieee80211_hw *hw, |
5720 | struct ieee80211_sta_rates *old; |
5721 | struct ieee80211_supported_band *sband; |
5722 | |
5723 | - sband = hw->wiphy->bands[ieee80211_get_sdata_band(sta->sdata)]; |
5724 | + sband = ieee80211_get_sband(sta->sdata); |
5725 | + if (!sband) |
5726 | + return -EINVAL; |
5727 | rate_control_apply_mask_ratetbl(sta, sband, rates); |
5728 | /* |
5729 | * mac80211 guarantees that this function will not be called |
5730 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
5731 | index 348700b424ea..1ecf3d07d1f5 100644 |
5732 | --- a/net/mac80211/sta_info.c |
5733 | +++ b/net/mac80211/sta_info.c |
5734 | @@ -395,10 +395,15 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, |
5735 | sta->sta.smps_mode = IEEE80211_SMPS_OFF; |
5736 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
5737 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { |
5738 | - struct ieee80211_supported_band *sband = |
5739 | - hw->wiphy->bands[ieee80211_get_sdata_band(sdata)]; |
5740 | - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> |
5741 | - IEEE80211_HT_CAP_SM_PS_SHIFT; |
5742 | + struct ieee80211_supported_band *sband; |
5743 | + u8 smps; |
5744 | + |
5745 | + sband = ieee80211_get_sband(sdata); |
5746 | + if (!sband) |
5747 | + goto free_txq; |
5748 | + |
5749 | + smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> |
5750 | + IEEE80211_HT_CAP_SM_PS_SHIFT; |
5751 | /* |
5752 | * Assume that hostapd advertises our caps in the beacon and |
5753 | * this is the known_smps_mode for a station that just assciated |
5754 | diff --git a/net/mac80211/status.c b/net/mac80211/status.c |
5755 | index ad37b4e58c2f..72fe9bc7a1f9 100644 |
5756 | --- a/net/mac80211/status.c |
5757 | +++ b/net/mac80211/status.c |
5758 | @@ -200,6 +200,7 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb) |
5759 | } |
5760 | |
5761 | if (ieee80211_is_action(mgmt->frame_control) && |
5762 | + !ieee80211_has_protected(mgmt->frame_control) && |
5763 | mgmt->u.action.category == WLAN_CATEGORY_HT && |
5764 | mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS && |
5765 | ieee80211_sdata_running(sdata)) { |
5766 | diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c |
5767 | index afca7d103684..f20dcf1b1830 100644 |
5768 | --- a/net/mac80211/tdls.c |
5769 | +++ b/net/mac80211/tdls.c |
5770 | @@ -47,8 +47,7 @@ static void ieee80211_tdls_add_ext_capab(struct ieee80211_sub_if_data *sdata, |
5771 | NL80211_FEATURE_TDLS_CHANNEL_SWITCH; |
5772 | bool wider_band = ieee80211_hw_check(&local->hw, TDLS_WIDER_BW) && |
5773 | !ifmgd->tdls_wider_bw_prohibited; |
5774 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5775 | - struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
5776 | + struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata); |
5777 | bool vht = sband && sband->vht_cap.vht_supported; |
5778 | u8 *pos = (void *)skb_put(skb, 10); |
5779 | |
5780 | @@ -180,11 +179,14 @@ static void ieee80211_tdls_add_bss_coex_ie(struct sk_buff *skb) |
5781 | static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata, |
5782 | u16 status_code) |
5783 | { |
5784 | + struct ieee80211_supported_band *sband; |
5785 | + |
5786 | /* The capability will be 0 when sending a failure code */ |
5787 | if (status_code != 0) |
5788 | return 0; |
5789 | |
5790 | - if (ieee80211_get_sdata_band(sdata) == NL80211_BAND_2GHZ) { |
5791 | + sband = ieee80211_get_sband(sdata); |
5792 | + if (sband && sband->band == NL80211_BAND_2GHZ) { |
5793 | return WLAN_CAPABILITY_SHORT_SLOT_TIME | |
5794 | WLAN_CAPABILITY_SHORT_PREAMBLE; |
5795 | } |
5796 | @@ -358,17 +360,20 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, |
5797 | u8 action_code, bool initiator, |
5798 | const u8 *extra_ies, size_t extra_ies_len) |
5799 | { |
5800 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5801 | - struct ieee80211_local *local = sdata->local; |
5802 | struct ieee80211_supported_band *sband; |
5803 | + struct ieee80211_local *local = sdata->local; |
5804 | struct ieee80211_sta_ht_cap ht_cap; |
5805 | struct ieee80211_sta_vht_cap vht_cap; |
5806 | struct sta_info *sta = NULL; |
5807 | size_t offset = 0, noffset; |
5808 | u8 *pos; |
5809 | |
5810 | - ieee80211_add_srates_ie(sdata, skb, false, band); |
5811 | - ieee80211_add_ext_srates_ie(sdata, skb, false, band); |
5812 | + sband = ieee80211_get_sband(sdata); |
5813 | + if (!sband) |
5814 | + return; |
5815 | + |
5816 | + ieee80211_add_srates_ie(sdata, skb, false, sband->band); |
5817 | + ieee80211_add_ext_srates_ie(sdata, skb, false, sband->band); |
5818 | ieee80211_tdls_add_supp_channels(sdata, skb); |
5819 | |
5820 | /* add any custom IEs that go before Extended Capabilities */ |
5821 | @@ -439,7 +444,6 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata, |
5822 | * the same on all bands. The specification limits the setup to a |
5823 | * single HT-cap, so use the current band for now. |
5824 | */ |
5825 | - sband = local->hw.wiphy->bands[band]; |
5826 | memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); |
5827 | |
5828 | if ((action_code == WLAN_TDLS_SETUP_REQUEST || |
5829 | @@ -545,9 +549,13 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, |
5830 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
5831 | size_t offset = 0, noffset; |
5832 | struct sta_info *sta, *ap_sta; |
5833 | - enum nl80211_band band = ieee80211_get_sdata_band(sdata); |
5834 | + struct ieee80211_supported_band *sband; |
5835 | u8 *pos; |
5836 | |
5837 | + sband = ieee80211_get_sband(sdata); |
5838 | + if (!sband) |
5839 | + return; |
5840 | + |
5841 | mutex_lock(&local->sta_mtx); |
5842 | |
5843 | sta = sta_info_get(sdata, peer); |
5844 | @@ -612,7 +620,8 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata, |
5845 | ieee80211_tdls_add_link_ie(sdata, skb, peer, initiator); |
5846 | |
5847 | /* only include VHT-operation if not on the 2.4GHz band */ |
5848 | - if (band != NL80211_BAND_2GHZ && sta->sta.vht_cap.vht_supported) { |
5849 | + if (sband->band != NL80211_BAND_2GHZ && |
5850 | + sta->sta.vht_cap.vht_supported) { |
5851 | /* |
5852 | * if both peers support WIDER_BW, we can expand the chandef to |
5853 | * a wider compatible one, up to 80MHz |
5854 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
5855 | index 1ffd1e145c13..84582998f65f 100644 |
5856 | --- a/net/mac80211/tx.c |
5857 | +++ b/net/mac80211/tx.c |
5858 | @@ -4182,7 +4182,10 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, |
5859 | return bcn; |
5860 | |
5861 | shift = ieee80211_vif_get_shift(vif); |
5862 | - sband = hw->wiphy->bands[ieee80211_get_sdata_band(vif_to_sdata(vif))]; |
5863 | + sband = ieee80211_get_sband(vif_to_sdata(vif)); |
5864 | + if (!sband) |
5865 | + return bcn; |
5866 | + |
5867 | ieee80211_tx_monitor(hw_to_local(hw), copy, sband, 1, shift, false); |
5868 | |
5869 | return bcn; |
5870 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
5871 | index 545c79a42a77..a2756096b94a 100644 |
5872 | --- a/net/mac80211/util.c |
5873 | +++ b/net/mac80211/util.c |
5874 | @@ -1590,14 +1590,14 @@ u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, |
5875 | size_t num_rates; |
5876 | u32 supp_rates, rate_flags; |
5877 | int i, j, shift; |
5878 | + |
5879 | sband = sdata->local->hw.wiphy->bands[band]; |
5880 | + if (WARN_ON(!sband)) |
5881 | + return 1; |
5882 | |
5883 | rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); |
5884 | shift = ieee80211_vif_get_shift(&sdata->vif); |
5885 | |
5886 | - if (WARN_ON(!sband)) |
5887 | - return 1; |
5888 | - |
5889 | num_rates = sband->n_bitrates; |
5890 | supp_rates = 0; |
5891 | for (i = 0; i < elems->supp_rates_len + |
5892 | diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
5893 | index 2155c2498aed..74d119512d96 100644 |
5894 | --- a/net/netfilter/ipvs/ip_vs_ctl.c |
5895 | +++ b/net/netfilter/ipvs/ip_vs_ctl.c |
5896 | @@ -3092,6 +3092,17 @@ static int ip_vs_genl_dump_services(struct sk_buff *skb, |
5897 | return skb->len; |
5898 | } |
5899 | |
5900 | +static bool ip_vs_is_af_valid(int af) |
5901 | +{ |
5902 | + if (af == AF_INET) |
5903 | + return true; |
5904 | +#ifdef CONFIG_IP_VS_IPV6 |
5905 | + if (af == AF_INET6 && ipv6_mod_enabled()) |
5906 | + return true; |
5907 | +#endif |
5908 | + return false; |
5909 | +} |
5910 | + |
5911 | static int ip_vs_genl_parse_service(struct netns_ipvs *ipvs, |
5912 | struct ip_vs_service_user_kern *usvc, |
5913 | struct nlattr *nla, int full_entry, |
5914 | @@ -3118,11 +3129,7 @@ static int ip_vs_genl_parse_service(struct netns_ipvs *ipvs, |
5915 | memset(usvc, 0, sizeof(*usvc)); |
5916 | |
5917 | usvc->af = nla_get_u16(nla_af); |
5918 | -#ifdef CONFIG_IP_VS_IPV6 |
5919 | - if (usvc->af != AF_INET && usvc->af != AF_INET6) |
5920 | -#else |
5921 | - if (usvc->af != AF_INET) |
5922 | -#endif |
5923 | + if (!ip_vs_is_af_valid(usvc->af)) |
5924 | return -EAFNOSUPPORT; |
5925 | |
5926 | if (nla_fwmark) { |
5927 | @@ -3624,6 +3631,11 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info) |
5928 | if (udest.af == 0) |
5929 | udest.af = svc->af; |
5930 | |
5931 | + if (!ip_vs_is_af_valid(udest.af)) { |
5932 | + ret = -EAFNOSUPPORT; |
5933 | + goto out; |
5934 | + } |
5935 | + |
5936 | if (udest.af != svc->af && cmd != IPVS_CMD_DEL_DEST) { |
5937 | /* The synchronization protocol is incompatible |
5938 | * with mixed family services |
5939 | diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c |
5940 | index 6dc44d9b4190..92e69af41656 100644 |
5941 | --- a/net/netfilter/nf_conntrack_helper.c |
5942 | +++ b/net/netfilter/nf_conntrack_helper.c |
5943 | @@ -379,17 +379,33 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me) |
5944 | struct nf_conntrack_tuple_mask mask = { .src.u.all = htons(0xFFFF) }; |
5945 | unsigned int h = helper_hash(&me->tuple); |
5946 | struct nf_conntrack_helper *cur; |
5947 | - int ret = 0; |
5948 | + int ret = 0, i; |
5949 | |
5950 | BUG_ON(me->expect_policy == NULL); |
5951 | BUG_ON(me->expect_class_max >= NF_CT_MAX_EXPECT_CLASSES); |
5952 | BUG_ON(strlen(me->name) > NF_CT_HELPER_NAME_LEN - 1); |
5953 | |
5954 | mutex_lock(&nf_ct_helper_mutex); |
5955 | - hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) { |
5956 | - if (nf_ct_tuple_src_mask_cmp(&cur->tuple, &me->tuple, &mask)) { |
5957 | - ret = -EEXIST; |
5958 | - goto out; |
5959 | + for (i = 0; i < nf_ct_helper_hsize; i++) { |
5960 | + hlist_for_each_entry(cur, &nf_ct_helper_hash[i], hnode) { |
5961 | + if (!strcmp(cur->name, me->name) && |
5962 | + (cur->tuple.src.l3num == NFPROTO_UNSPEC || |
5963 | + cur->tuple.src.l3num == me->tuple.src.l3num) && |
5964 | + cur->tuple.dst.protonum == me->tuple.dst.protonum) { |
5965 | + ret = -EEXIST; |
5966 | + goto out; |
5967 | + } |
5968 | + } |
5969 | + } |
5970 | + |
5971 | + /* avoid unpredictable behaviour for auto_assign_helper */ |
5972 | + if (!(me->flags & NF_CT_HELPER_F_USERSPACE)) { |
5973 | + hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) { |
5974 | + if (nf_ct_tuple_src_mask_cmp(&cur->tuple, &me->tuple, |
5975 | + &mask)) { |
5976 | + ret = -EEXIST; |
5977 | + goto out; |
5978 | + } |
5979 | } |
5980 | } |
5981 | hlist_add_head_rcu(&me->hnode, &nf_ct_helper_hash[h]); |
5982 | diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c |
5983 | index 31ca94793aa9..b9dd4e960426 100644 |
5984 | --- a/net/netfilter/nft_dynset.c |
5985 | +++ b/net/netfilter/nft_dynset.c |
5986 | @@ -82,8 +82,7 @@ static void nft_dynset_eval(const struct nft_expr *expr, |
5987 | nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION)) { |
5988 | timeout = priv->timeout ? : set->timeout; |
5989 | *nft_set_ext_expiration(ext) = jiffies + timeout; |
5990 | - } else if (sexpr == NULL) |
5991 | - goto out; |
5992 | + } |
5993 | |
5994 | if (sexpr != NULL) |
5995 | sexpr->ops->eval(sexpr, regs, pkt); |
5996 | @@ -92,7 +91,7 @@ static void nft_dynset_eval(const struct nft_expr *expr, |
5997 | regs->verdict.code = NFT_BREAK; |
5998 | return; |
5999 | } |
6000 | -out: |
6001 | + |
6002 | if (!priv->invert) |
6003 | regs->verdict.code = NFT_BREAK; |
6004 | } |
6005 | diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c |
6006 | index ac26b71d900e..7ad1a863587a 100644 |
6007 | --- a/net/netfilter/x_tables.c |
6008 | +++ b/net/netfilter/x_tables.c |
6009 | @@ -1006,8 +1006,10 @@ struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, |
6010 | list_for_each_entry(t, &init_net.xt.tables[af], list) { |
6011 | if (strcmp(t->name, name)) |
6012 | continue; |
6013 | - if (!try_module_get(t->me)) |
6014 | + if (!try_module_get(t->me)) { |
6015 | + mutex_unlock(&xt[af].mutex); |
6016 | return NULL; |
6017 | + } |
6018 | |
6019 | mutex_unlock(&xt[af].mutex); |
6020 | if (t->table_init(net) != 0) { |
6021 | diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c |
6022 | index 6669e68d589e..00ef8243d48d 100644 |
6023 | --- a/net/netfilter/xt_CT.c |
6024 | +++ b/net/netfilter/xt_CT.c |
6025 | @@ -168,8 +168,10 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, |
6026 | goto err_put_timeout; |
6027 | } |
6028 | timeout_ext = nf_ct_timeout_ext_add(ct, timeout, GFP_ATOMIC); |
6029 | - if (timeout_ext == NULL) |
6030 | + if (!timeout_ext) { |
6031 | ret = -ENOMEM; |
6032 | + goto err_put_timeout; |
6033 | + } |
6034 | |
6035 | rcu_read_unlock(); |
6036 | return ret; |
6037 | @@ -201,6 +203,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, |
6038 | struct xt_ct_target_info_v1 *info) |
6039 | { |
6040 | struct nf_conntrack_zone zone; |
6041 | + struct nf_conn_help *help; |
6042 | struct nf_conn *ct; |
6043 | int ret = -EOPNOTSUPP; |
6044 | |
6045 | @@ -249,7 +252,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, |
6046 | if (info->timeout[0]) { |
6047 | ret = xt_ct_set_timeout(ct, par, info->timeout); |
6048 | if (ret < 0) |
6049 | - goto err3; |
6050 | + goto err4; |
6051 | } |
6052 | __set_bit(IPS_CONFIRMED_BIT, &ct->status); |
6053 | nf_conntrack_get(&ct->ct_general); |
6054 | @@ -257,6 +260,10 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, |
6055 | info->ct = ct; |
6056 | return 0; |
6057 | |
6058 | +err4: |
6059 | + help = nfct_help(ct); |
6060 | + if (help) |
6061 | + module_put(help->helper->me); |
6062 | err3: |
6063 | nf_ct_tmpl_free(ct); |
6064 | err2: |
6065 | diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c |
6066 | index b28e45b691de..466393936db9 100644 |
6067 | --- a/net/openvswitch/conntrack.c |
6068 | +++ b/net/openvswitch/conntrack.c |
6069 | @@ -396,10 +396,38 @@ ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone, |
6070 | u16 proto, const struct sk_buff *skb) |
6071 | { |
6072 | struct nf_conntrack_tuple tuple; |
6073 | + struct nf_conntrack_expect *exp; |
6074 | |
6075 | if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, net, &tuple)) |
6076 | return NULL; |
6077 | - return __nf_ct_expect_find(net, zone, &tuple); |
6078 | + |
6079 | + exp = __nf_ct_expect_find(net, zone, &tuple); |
6080 | + if (exp) { |
6081 | + struct nf_conntrack_tuple_hash *h; |
6082 | + |
6083 | + /* Delete existing conntrack entry, if it clashes with the |
6084 | + * expectation. This can happen since conntrack ALGs do not |
6085 | + * check for clashes between (new) expectations and existing |
6086 | + * conntrack entries. nf_conntrack_in() will check the |
6087 | + * expectations only if a conntrack entry can not be found, |
6088 | + * which can lead to OVS finding the expectation (here) in the |
6089 | + * init direction, but which will not be removed by the |
6090 | + * nf_conntrack_in() call, if a matching conntrack entry is |
6091 | + * found instead. In this case all init direction packets |
6092 | + * would be reported as new related packets, while reply |
6093 | + * direction packets would be reported as un-related |
6094 | + * established packets. |
6095 | + */ |
6096 | + h = nf_conntrack_find_get(net, zone, &tuple); |
6097 | + if (h) { |
6098 | + struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); |
6099 | + |
6100 | + nf_ct_delete(ct, 0, 0); |
6101 | + nf_conntrack_put(&ct->ct_general); |
6102 | + } |
6103 | + } |
6104 | + |
6105 | + return exp; |
6106 | } |
6107 | |
6108 | /* This replicates logic from nf_conntrack_core.c that is not exported. */ |
6109 | diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c |
6110 | index 69502fa68a3c..1a2b1f61ed26 100644 |
6111 | --- a/net/sunrpc/xprtrdma/verbs.c |
6112 | +++ b/net/sunrpc/xprtrdma/verbs.c |
6113 | @@ -1054,6 +1054,7 @@ void |
6114 | rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) |
6115 | { |
6116 | cancel_delayed_work_sync(&buf->rb_recovery_worker); |
6117 | + cancel_delayed_work_sync(&buf->rb_refresh_worker); |
6118 | |
6119 | while (!list_empty(&buf->rb_recv_bufs)) { |
6120 | struct rpcrdma_rep *rep; |
6121 | diff --git a/net/tipc/node.c b/net/tipc/node.c |
6122 | index 5b3e1ea37b6d..db8fbc076e1a 100644 |
6123 | --- a/net/tipc/node.c |
6124 | +++ b/net/tipc/node.c |
6125 | @@ -2094,6 +2094,8 @@ int tipc_nl_node_get_monitor(struct sk_buff *skb, struct genl_info *info) |
6126 | int err; |
6127 | |
6128 | msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); |
6129 | + if (!msg.skb) |
6130 | + return -ENOMEM; |
6131 | msg.portid = info->snd_portid; |
6132 | msg.seq = info->snd_seq; |
6133 | |
6134 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
6135 | index cd427ea8861d..dae0021f39c3 100644 |
6136 | --- a/sound/pci/hda/patch_realtek.c |
6137 | +++ b/sound/pci/hda/patch_realtek.c |
6138 | @@ -6780,6 +6780,7 @@ enum { |
6139 | ALC668_FIXUP_DELL_DISABLE_AAMIX, |
6140 | ALC668_FIXUP_DELL_XPS13, |
6141 | ALC662_FIXUP_ASUS_Nx50, |
6142 | + ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE, |
6143 | ALC668_FIXUP_ASUS_Nx51, |
6144 | ALC891_FIXUP_HEADSET_MODE, |
6145 | ALC891_FIXUP_DELL_MIC_NO_PRESENCE, |
6146 | @@ -7031,14 +7032,21 @@ static const struct hda_fixup alc662_fixups[] = { |
6147 | .chained = true, |
6148 | .chain_id = ALC662_FIXUP_BASS_1A |
6149 | }, |
6150 | + [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = { |
6151 | + .type = HDA_FIXUP_FUNC, |
6152 | + .v.func = alc_fixup_headset_mode_alc668, |
6153 | + .chain_id = ALC662_FIXUP_BASS_CHMAP |
6154 | + }, |
6155 | [ALC668_FIXUP_ASUS_Nx51] = { |
6156 | .type = HDA_FIXUP_PINS, |
6157 | .v.pins = (const struct hda_pintbl[]) { |
6158 | - {0x1a, 0x90170151}, /* bass speaker */ |
6159 | + { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ |
6160 | + { 0x1a, 0x90170151 }, /* bass speaker */ |
6161 | + { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */ |
6162 | {} |
6163 | }, |
6164 | .chained = true, |
6165 | - .chain_id = ALC662_FIXUP_BASS_CHMAP, |
6166 | + .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE, |
6167 | }, |
6168 | [ALC891_FIXUP_HEADSET_MODE] = { |
6169 | .type = HDA_FIXUP_FUNC, |
6170 | diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c |
6171 | index 0bfa68862460..cd16b431d1bd 100644 |
6172 | --- a/sound/soc/intel/atom/sst/sst_acpi.c |
6173 | +++ b/sound/soc/intel/atom/sst/sst_acpi.c |
6174 | @@ -420,7 +420,21 @@ static const struct dmi_system_id byt_table[] = { |
6175 | .callback = byt_thinkpad10_quirk_cb, |
6176 | .matches = { |
6177 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
6178 | - DMI_MATCH(DMI_PRODUCT_NAME, "20C3001VHH"), |
6179 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"), |
6180 | + }, |
6181 | + }, |
6182 | + { |
6183 | + .callback = byt_thinkpad10_quirk_cb, |
6184 | + .matches = { |
6185 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
6186 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"), |
6187 | + }, |
6188 | + }, |
6189 | + { |
6190 | + .callback = byt_thinkpad10_quirk_cb, |
6191 | + .matches = { |
6192 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
6193 | + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"), |
6194 | }, |
6195 | }, |
6196 | { } |
6197 | diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c |
6198 | index 06fa5e85dd0e..3e526fbd267e 100644 |
6199 | --- a/sound/soc/intel/skylake/skl.c |
6200 | +++ b/sound/soc/intel/skylake/skl.c |
6201 | @@ -457,7 +457,7 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr) |
6202 | struct hdac_bus *bus = ebus_to_hbus(ebus); |
6203 | unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) | |
6204 | (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; |
6205 | - unsigned int res; |
6206 | + unsigned int res = -1; |
6207 | |
6208 | mutex_lock(&bus->cmd_mutex); |
6209 | snd_hdac_bus_send_cmd(bus, cmd); |
6210 | diff --git a/sound/soc/sh/rcar/cmd.c b/sound/soc/sh/rcar/cmd.c |
6211 | index 7d92a24b7cfa..98835e9d1d7d 100644 |
6212 | --- a/sound/soc/sh/rcar/cmd.c |
6213 | +++ b/sound/soc/sh/rcar/cmd.c |
6214 | @@ -82,6 +82,9 @@ static int rsnd_cmd_init(struct rsnd_mod *mod, |
6215 | [9] = 0x2, |
6216 | }; |
6217 | |
6218 | + if (unlikely(!src)) |
6219 | + return -EIO; |
6220 | + |
6221 | data = path[rsnd_mod_id(src)] | |
6222 | cmd_case[rsnd_mod_id(src)] << 16; |
6223 | } |
6224 | diff --git a/tools/perf/tests/kmod-path.c b/tools/perf/tests/kmod-path.c |
6225 | index 76f41f249944..6cd9e5107f77 100644 |
6226 | --- a/tools/perf/tests/kmod-path.c |
6227 | +++ b/tools/perf/tests/kmod-path.c |
6228 | @@ -61,6 +61,7 @@ int test__kmod_path__parse(int subtest __maybe_unused) |
6229 | M("/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_KERNEL, true); |
6230 | M("/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_USER, false); |
6231 | |
6232 | +#ifdef HAVE_ZLIB_SUPPORT |
6233 | /* path alloc_name alloc_ext kmod comp name ext */ |
6234 | T("/xxxx/xxxx/x.ko.gz", true , true , true, true, "[x]", "gz"); |
6235 | T("/xxxx/xxxx/x.ko.gz", false , true , true, true, NULL , "gz"); |
6236 | @@ -96,6 +97,7 @@ int test__kmod_path__parse(int subtest __maybe_unused) |
6237 | M("x.ko.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN, true); |
6238 | M("x.ko.gz", PERF_RECORD_MISC_KERNEL, true); |
6239 | M("x.ko.gz", PERF_RECORD_MISC_USER, false); |
6240 | +#endif |
6241 | |
6242 | /* path alloc_name alloc_ext kmod comp name ext */ |
6243 | T("[test_module]", true , true , true, false, "[test_module]", NULL); |
6244 | diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c |
6245 | index 71620fa95953..d025eafc09c2 100644 |
6246 | --- a/tools/testing/nvdimm/test/nfit.c |
6247 | +++ b/tools/testing/nvdimm/test/nfit.c |
6248 | @@ -1908,6 +1908,7 @@ static __init int nfit_test_init(void) |
6249 | put_device(&pdev->dev); |
6250 | goto err_register; |
6251 | } |
6252 | + get_device(&pdev->dev); |
6253 | |
6254 | rc = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
6255 | if (rc) |
6256 | @@ -1926,6 +1927,10 @@ static __init int nfit_test_init(void) |
6257 | if (instances[i]) |
6258 | platform_device_unregister(&instances[i]->pdev); |
6259 | nfit_test_teardown(); |
6260 | + for (i = 0; i < NUM_NFITS; i++) |
6261 | + if (instances[i]) |
6262 | + put_device(&instances[i]->pdev.dev); |
6263 | + |
6264 | return rc; |
6265 | } |
6266 | |
6267 | @@ -1933,10 +1938,13 @@ static __exit void nfit_test_exit(void) |
6268 | { |
6269 | int i; |
6270 | |
6271 | - platform_driver_unregister(&nfit_test_driver); |
6272 | for (i = 0; i < NUM_NFITS; i++) |
6273 | platform_device_unregister(&instances[i]->pdev); |
6274 | + platform_driver_unregister(&nfit_test_driver); |
6275 | nfit_test_teardown(); |
6276 | + |
6277 | + for (i = 0; i < NUM_NFITS; i++) |
6278 | + put_device(&instances[i]->pdev.dev); |
6279 | class_destroy(nfit_test_dimm); |
6280 | } |
6281 |