Magellan Linux

Contents of /trunk/kernel-alx/patches-4.9/0294-4.9.195-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3569 - (show annotations) (download)
Thu Aug 13 10:21:13 2020 UTC (3 years, 8 months ago) by niro
File size: 134409 byte(s)
linux-195
1 diff --git a/Makefile b/Makefile
2 index 6e3c81c3bf40..bee0218e3fb5 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 194
9 +SUBLEVEL = 195
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
14 index ec4a00f1ce01..8b754ae8c8f7 100644
15 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
16 +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
17 @@ -427,6 +427,7 @@
18 regulator-name = "vdd_ldo10";
19 regulator-min-microvolt = <1800000>;
20 regulator-max-microvolt = <1800000>;
21 + regulator-always-on;
22 regulator-state-mem {
23 regulator-off-in-suspend;
24 };
25 diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
26 index 01f466816fea..1f90df2d7ecd 100644
27 --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
28 +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
29 @@ -427,6 +427,7 @@
30 regulator-name = "vdd_ldo10";
31 regulator-min-microvolt = <1800000>;
32 regulator-max-microvolt = <1800000>;
33 + regulator-always-on;
34 regulator-state-mem {
35 regulator-off-in-suspend;
36 };
37 diff --git a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
38 index 205130600853..72d1b8209f5e 100644
39 --- a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
40 +++ b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
41 @@ -43,7 +43,7 @@
42 <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
43 assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
44 assigned-clock-rates = <0>, <100000000>;
45 - phy-mode = "rgmii";
46 + phy-mode = "rgmii-id";
47 phy-handle = <&ethphy0>;
48 fsl,magic-packet;
49 status = "okay";
50 @@ -69,7 +69,7 @@
51 <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
52 assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
53 assigned-clock-rates = <0>, <100000000>;
54 - phy-mode = "rgmii";
55 + phy-mode = "rgmii-id";
56 phy-handle = <&ethphy1>;
57 fsl,magic-packet;
58 status = "okay";
59 diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
60 index 7cd9865bdeb7..94929eb707f0 100644
61 --- a/arch/arm/mach-zynq/platsmp.c
62 +++ b/arch/arm/mach-zynq/platsmp.c
63 @@ -65,7 +65,7 @@ int zynq_cpun_start(u32 address, int cpu)
64 * 0x4: Jump by mov instruction
65 * 0x8: Jumping address
66 */
67 - memcpy((__force void *)zero, &zynq_secondary_trampoline,
68 + memcpy_toio(zero, &zynq_secondary_trampoline,
69 trampoline_size);
70 writel(address, zero + trampoline_size);
71
72 diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
73 index 3ceec224d3d2..3b95e3126eeb 100644
74 --- a/arch/arm64/mm/proc.S
75 +++ b/arch/arm64/mm/proc.S
76 @@ -263,6 +263,15 @@ skip_pgd:
77 msr sctlr_el1, x18
78 isb
79
80 + /*
81 + * Invalidate the local I-cache so that any instructions fetched
82 + * speculatively from the PoC are discarded, since they may have
83 + * been dynamically patched at the PoU.
84 + */
85 + ic iallu
86 + dsb nsh
87 + isb
88 +
89 /* Set the flag to zero to indicate that we're all done */
90 str wzr, [flag_ptr]
91 ret
92 diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
93 index d1d945c6bd05..9fe114620b9d 100644
94 --- a/arch/ia64/kernel/module.c
95 +++ b/arch/ia64/kernel/module.c
96 @@ -912,8 +912,12 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *mo
97 void
98 module_arch_cleanup (struct module *mod)
99 {
100 - if (mod->arch.init_unw_table)
101 + if (mod->arch.init_unw_table) {
102 unw_remove_unwind_table(mod->arch.init_unw_table);
103 - if (mod->arch.core_unw_table)
104 + mod->arch.init_unw_table = NULL;
105 + }
106 + if (mod->arch.core_unw_table) {
107 unw_remove_unwind_table(mod->arch.core_unw_table);
108 + mod->arch.core_unw_table = NULL;
109 + }
110 }
111 diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
112 index 591cbdf615af..1a906dd7ca7d 100644
113 --- a/arch/s390/crypto/aes_s390.c
114 +++ b/arch/s390/crypto/aes_s390.c
115 @@ -572,6 +572,9 @@ static int xts_aes_encrypt(struct blkcipher_desc *desc,
116 struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
117 struct blkcipher_walk walk;
118
119 + if (!nbytes)
120 + return -EINVAL;
121 +
122 if (unlikely(!xts_ctx->fc))
123 return xts_fallback_encrypt(desc, dst, src, nbytes);
124
125 @@ -586,6 +589,9 @@ static int xts_aes_decrypt(struct blkcipher_desc *desc,
126 struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
127 struct blkcipher_walk walk;
128
129 + if (!nbytes)
130 + return -EINVAL;
131 +
132 if (unlikely(!xts_ctx->fc))
133 return xts_fallback_decrypt(desc, dst, src, nbytes);
134
135 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
136 index 928ffdc21873..232350519062 100644
137 --- a/arch/x86/kernel/apic/apic.c
138 +++ b/arch/x86/kernel/apic/apic.c
139 @@ -1303,6 +1303,14 @@ void setup_local_APIC(void)
140 return;
141 }
142
143 + /*
144 + * If this comes from kexec/kcrash the APIC might be enabled in
145 + * SPIV. Soft disable it before doing further initialization.
146 + */
147 + value = apic_read(APIC_SPIV);
148 + value &= ~APIC_SPIV_APIC_ENABLED;
149 + apic_write(APIC_SPIV, value);
150 +
151 #ifdef CONFIG_X86_32
152 /* Pound the ESR really hard over the head with a big hammer - mbligh */
153 if (lapic_is_integrated() && apic->disable_esr) {
154 diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
155 index 2863ad306692..33ba47c44816 100644
156 --- a/arch/x86/kernel/smp.c
157 +++ b/arch/x86/kernel/smp.c
158 @@ -181,6 +181,12 @@ asmlinkage __visible void smp_reboot_interrupt(void)
159 irq_exit();
160 }
161
162 +static int register_stop_handler(void)
163 +{
164 + return register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
165 + NMI_FLAG_FIRST, "smp_stop");
166 +}
167 +
168 static void native_stop_other_cpus(int wait)
169 {
170 unsigned long flags;
171 @@ -214,39 +220,41 @@ static void native_stop_other_cpus(int wait)
172 apic->send_IPI_allbutself(REBOOT_VECTOR);
173
174 /*
175 - * Don't wait longer than a second if the caller
176 - * didn't ask us to wait.
177 + * Don't wait longer than a second for IPI completion. The
178 + * wait request is not checked here because that would
179 + * prevent an NMI shutdown attempt in case that not all
180 + * CPUs reach shutdown state.
181 */
182 timeout = USEC_PER_SEC;
183 - while (num_online_cpus() > 1 && (wait || timeout--))
184 + while (num_online_cpus() > 1 && timeout--)
185 udelay(1);
186 }
187 -
188 - /* if the REBOOT_VECTOR didn't work, try with the NMI */
189 - if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi)) {
190 - if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
191 - NMI_FLAG_FIRST, "smp_stop"))
192 - /* Note: we ignore failures here */
193 - /* Hope the REBOOT_IRQ is good enough */
194 - goto finish;
195 -
196 - /* sync above data before sending IRQ */
197 - wmb();
198
199 - pr_emerg("Shutting down cpus with NMI\n");
200 + /* if the REBOOT_VECTOR didn't work, try with the NMI */
201 + if (num_online_cpus() > 1) {
202 + /*
203 + * If NMI IPI is enabled, try to register the stop handler
204 + * and send the IPI. In any case try to wait for the other
205 + * CPUs to stop.
206 + */
207 + if (!smp_no_nmi_ipi && !register_stop_handler()) {
208 + /* Sync above data before sending IRQ */
209 + wmb();
210
211 - apic->send_IPI_allbutself(NMI_VECTOR);
212 + pr_emerg("Shutting down cpus with NMI\n");
213
214 + apic->send_IPI_allbutself(NMI_VECTOR);
215 + }
216 /*
217 - * Don't wait longer than a 10 ms if the caller
218 - * didn't ask us to wait.
219 + * Don't wait longer than 10 ms if the caller didn't
220 + * reqeust it. If wait is true, the machine hangs here if
221 + * one or more CPUs do not reach shutdown state.
222 */
223 timeout = USEC_PER_MSEC * 10;
224 while (num_online_cpus() > 1 && (wait || timeout--))
225 udelay(1);
226 }
227
228 -finish:
229 local_irq_save(flags);
230 disable_local_APIC();
231 mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
232 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
233 index b636a1e849fd..660c35f854f8 100644
234 --- a/arch/x86/kvm/emulate.c
235 +++ b/arch/x86/kvm/emulate.c
236 @@ -5257,6 +5257,8 @@ done_prefixes:
237 ctxt->memopp->addr.mem.ea + ctxt->_eip);
238
239 done:
240 + if (rc == X86EMUL_PROPAGATE_FAULT)
241 + ctxt->have_exception = true;
242 return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;
243 }
244
245 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
246 index aabfc141d2f1..0b6517f5821b 100644
247 --- a/arch/x86/kvm/x86.c
248 +++ b/arch/x86/kvm/x86.c
249 @@ -535,8 +535,14 @@ static int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
250 data, offset, len, access);
251 }
252
253 +static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
254 +{
255 + return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
256 + rsvd_bits(1, 2);
257 +}
258 +
259 /*
260 - * Load the pae pdptrs. Return true is they are all valid.
261 + * Load the pae pdptrs. Return 1 if they are all valid, 0 otherwise.
262 */
263 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
264 {
265 @@ -555,8 +561,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
266 }
267 for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
268 if ((pdpte[i] & PT_PRESENT_MASK) &&
269 - (pdpte[i] &
270 - vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
271 + (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
272 ret = 0;
273 goto out;
274 }
275 @@ -5764,8 +5769,16 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
276 if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
277 emulation_type))
278 return EMULATE_DONE;
279 - if (ctxt->have_exception && inject_emulated_exception(vcpu))
280 + if (ctxt->have_exception) {
281 + /*
282 + * #UD should result in just EMULATION_FAILED, and trap-like
283 + * exception should not be encountered during decode.
284 + */
285 + WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR ||
286 + exception_type(ctxt->exception.vector) == EXCPT_TRAP);
287 + inject_emulated_exception(vcpu);
288 return EMULATE_DONE;
289 + }
290 if (emulation_type & EMULTYPE_SKIP)
291 return EMULATE_FAIL;
292 return handle_emulation_failure(vcpu);
293 diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
294 index e0ea8f56d2bf..9ec4618df533 100644
295 --- a/drivers/acpi/cppc_acpi.c
296 +++ b/drivers/acpi/cppc_acpi.c
297 @@ -360,8 +360,10 @@ static int acpi_get_psd(struct cpc_desc *cpc_ptr, acpi_handle handle)
298 union acpi_object *psd = NULL;
299 struct acpi_psd_package *pdomain;
300
301 - status = acpi_evaluate_object_typed(handle, "_PSD", NULL, &buffer,
302 - ACPI_TYPE_PACKAGE);
303 + status = acpi_evaluate_object_typed(handle, "_PSD", NULL,
304 + &buffer, ACPI_TYPE_PACKAGE);
305 + if (status == AE_NOT_FOUND) /* _PSD is optional */
306 + return 0;
307 if (ACPI_FAILURE(status))
308 return -ENODEV;
309
310 diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
311 index c68e72414a67..435bd0ffc8c0 100644
312 --- a/drivers/acpi/custom_method.c
313 +++ b/drivers/acpi/custom_method.c
314 @@ -48,8 +48,10 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
315 if ((*ppos > max_size) ||
316 (*ppos + count > max_size) ||
317 (*ppos + count < count) ||
318 - (count > uncopied_bytes))
319 + (count > uncopied_bytes)) {
320 + kfree(buf);
321 return -EINVAL;
322 + }
323
324 if (copy_from_user(buf + (*ppos), user_buf, count)) {
325 kfree(buf);
326 @@ -69,6 +71,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
327 add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
328 }
329
330 + kfree(buf);
331 return count;
332 }
333
334 diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
335 index c576a6fe4ebb..94ded9513c73 100644
336 --- a/drivers/acpi/pci_irq.c
337 +++ b/drivers/acpi/pci_irq.c
338 @@ -462,8 +462,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
339 * No IRQ known to the ACPI subsystem - maybe the BIOS /
340 * driver reported one, then use it. Exit in any case.
341 */
342 - if (!acpi_pci_irq_valid(dev, pin))
343 + if (!acpi_pci_irq_valid(dev, pin)) {
344 + kfree(entry);
345 return 0;
346 + }
347
348 if (acpi_isa_register_gsi(dev))
349 dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
350 diff --git a/drivers/base/soc.c b/drivers/base/soc.c
351 index b63f23e6ad61..ddb32c890fa6 100644
352 --- a/drivers/base/soc.c
353 +++ b/drivers/base/soc.c
354 @@ -145,6 +145,7 @@ out2:
355 out1:
356 return ERR_PTR(ret);
357 }
358 +EXPORT_SYMBOL_GPL(soc_device_register);
359
360 /* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
361 void soc_device_unregister(struct soc_device *soc_dev)
362 @@ -153,6 +154,7 @@ void soc_device_unregister(struct soc_device *soc_dev)
363
364 device_unregister(&soc_dev->dev);
365 }
366 +EXPORT_SYMBOL_GPL(soc_device_unregister);
367
368 static int __init soc_bus_register(void)
369 {
370 diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
371 index 8dce1a890078..1d1c0d7aec88 100644
372 --- a/drivers/bluetooth/btusb.c
373 +++ b/drivers/bluetooth/btusb.c
374 @@ -362,6 +362,9 @@ static const struct usb_device_id blacklist_table[] = {
375 /* Additional Realtek 8822BE Bluetooth devices */
376 { USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
377
378 + /* Additional Realtek 8822CE Bluetooth devices */
379 + { USB_DEVICE(0x04ca, 0x4005), .driver_info = BTUSB_REALTEK },
380 +
381 /* Silicon Wave based devices */
382 { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
383
384 diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
385 index d2d2c89de5b4..5e79b4bfe27a 100644
386 --- a/drivers/char/hw_random/core.c
387 +++ b/drivers/char/hw_random/core.c
388 @@ -88,7 +88,7 @@ static void add_early_randomness(struct hwrng *rng)
389 size_t size = min_t(size_t, 16, rng_buffer_size());
390
391 mutex_lock(&reading_mutex);
392 - bytes_read = rng_get_data(rng, rng_buffer, size, 1);
393 + bytes_read = rng_get_data(rng, rng_buffer, size, 0);
394 mutex_unlock(&reading_mutex);
395 if (bytes_read > 0)
396 add_device_randomness(rng_buffer, bytes_read);
397 diff --git a/drivers/char/mem.c b/drivers/char/mem.c
398 index 593a8818aca9..e87a40c198fa 100644
399 --- a/drivers/char/mem.c
400 +++ b/drivers/char/mem.c
401 @@ -96,6 +96,13 @@ void __weak unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
402 }
403 #endif
404
405 +static inline bool should_stop_iteration(void)
406 +{
407 + if (need_resched())
408 + cond_resched();
409 + return fatal_signal_pending(current);
410 +}
411 +
412 /*
413 * This funcion reads the *physical* memory. The f_pos points directly to the
414 * memory location.
415 @@ -162,6 +169,8 @@ static ssize_t read_mem(struct file *file, char __user *buf,
416 p += sz;
417 count -= sz;
418 read += sz;
419 + if (should_stop_iteration())
420 + break;
421 }
422
423 *ppos += read;
424 @@ -233,6 +242,8 @@ static ssize_t write_mem(struct file *file, const char __user *buf,
425 p += sz;
426 count -= sz;
427 written += sz;
428 + if (should_stop_iteration())
429 + break;
430 }
431
432 *ppos += written;
433 @@ -446,6 +457,10 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
434 read += sz;
435 low_count -= sz;
436 count -= sz;
437 + if (should_stop_iteration()) {
438 + count = 0;
439 + break;
440 + }
441 }
442 }
443
444 @@ -470,6 +485,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
445 buf += sz;
446 read += sz;
447 p += sz;
448 + if (should_stop_iteration())
449 + break;
450 }
451 free_page((unsigned long)kbuf);
452 }
453 @@ -522,6 +539,8 @@ static ssize_t do_write_kmem(unsigned long p, const char __user *buf,
454 p += sz;
455 count -= sz;
456 written += sz;
457 + if (should_stop_iteration())
458 + break;
459 }
460
461 *ppos += written;
462 @@ -573,6 +592,8 @@ static ssize_t write_kmem(struct file *file, const char __user *buf,
463 buf += sz;
464 virtr += sz;
465 p += sz;
466 + if (should_stop_iteration())
467 + break;
468 }
469 free_page((unsigned long)kbuf);
470 }
471 diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
472 index 30f8bbe757b7..8b383d3d21c2 100644
473 --- a/drivers/crypto/talitos.c
474 +++ b/drivers/crypto/talitos.c
475 @@ -3043,6 +3043,7 @@ static int talitos_remove(struct platform_device *ofdev)
476 break;
477 case CRYPTO_ALG_TYPE_AEAD:
478 crypto_unregister_aead(&t_alg->algt.alg.aead);
479 + break;
480 case CRYPTO_ALG_TYPE_AHASH:
481 crypto_unregister_ahash(&t_alg->algt.alg.hash);
482 break;
483 diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
484 index 1b21bb60e797..2c8f41fbe94f 100644
485 --- a/drivers/devfreq/exynos-bus.c
486 +++ b/drivers/devfreq/exynos-bus.c
487 @@ -198,11 +198,10 @@ static void exynos_bus_exit(struct device *dev)
488 if (ret < 0)
489 dev_warn(dev, "failed to disable the devfreq-event devices\n");
490
491 - if (bus->regulator)
492 - regulator_disable(bus->regulator);
493 -
494 dev_pm_opp_of_remove_table(dev);
495 clk_disable_unprepare(bus->clk);
496 + if (bus->regulator)
497 + regulator_disable(bus->regulator);
498 }
499
500 /*
501 @@ -391,6 +390,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
502 struct exynos_bus *bus;
503 int ret, max_state;
504 unsigned long min_freq, max_freq;
505 + bool passive = false;
506
507 if (!np) {
508 dev_err(dev, "failed to find devicetree node\n");
509 @@ -404,27 +404,27 @@ static int exynos_bus_probe(struct platform_device *pdev)
510 bus->dev = &pdev->dev;
511 platform_set_drvdata(pdev, bus);
512
513 - /* Parse the device-tree to get the resource information */
514 - ret = exynos_bus_parse_of(np, bus);
515 - if (ret < 0)
516 - return ret;
517 -
518 profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL);
519 - if (!profile) {
520 - ret = -ENOMEM;
521 - goto err;
522 - }
523 + if (!profile)
524 + return -ENOMEM;
525
526 node = of_parse_phandle(dev->of_node, "devfreq", 0);
527 if (node) {
528 of_node_put(node);
529 - goto passive;
530 + passive = true;
531 } else {
532 ret = exynos_bus_parent_parse_of(np, bus);
533 + if (ret < 0)
534 + return ret;
535 }
536
537 + /* Parse the device-tree to get the resource information */
538 + ret = exynos_bus_parse_of(np, bus);
539 if (ret < 0)
540 - goto err;
541 + goto err_reg;
542 +
543 + if (passive)
544 + goto passive;
545
546 /* Initialize the struct profile and governor data for parent device */
547 profile->polling_ms = 50;
548 @@ -514,6 +514,9 @@ out:
549 err:
550 dev_pm_opp_of_remove_table(dev);
551 clk_disable_unprepare(bus->clk);
552 +err_reg:
553 + if (!passive)
554 + regulator_disable(bus->regulator);
555
556 return ret;
557 }
558 diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
559 index 5be96b2249e7..62c262fc2178 100644
560 --- a/drivers/devfreq/governor_passive.c
561 +++ b/drivers/devfreq/governor_passive.c
562 @@ -152,7 +152,6 @@ static int devfreq_passive_notifier_call(struct notifier_block *nb,
563 static int devfreq_passive_event_handler(struct devfreq *devfreq,
564 unsigned int event, void *data)
565 {
566 - struct device *dev = devfreq->dev.parent;
567 struct devfreq_passive_data *p_data
568 = (struct devfreq_passive_data *)devfreq->data;
569 struct devfreq *parent = (struct devfreq *)p_data->parent;
570 @@ -168,12 +167,12 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
571 p_data->this = devfreq;
572
573 nb->notifier_call = devfreq_passive_notifier_call;
574 - ret = devm_devfreq_register_notifier(dev, parent, nb,
575 + ret = devfreq_register_notifier(parent, nb,
576 DEVFREQ_TRANSITION_NOTIFIER);
577 break;
578 case DEVFREQ_GOV_STOP:
579 - devm_devfreq_unregister_notifier(dev, parent, nb,
580 - DEVFREQ_TRANSITION_NOTIFIER);
581 + WARN_ON(devfreq_unregister_notifier(parent, nb,
582 + DEVFREQ_TRANSITION_NOTIFIER));
583 break;
584 default:
585 break;
586 diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
587 index 6ba53bbd0e16..b984d00bc055 100644
588 --- a/drivers/dma/bcm2835-dma.c
589 +++ b/drivers/dma/bcm2835-dma.c
590 @@ -891,8 +891,10 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
591 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
592
593 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
594 - if (rc)
595 + if (rc) {
596 + dev_err(&pdev->dev, "Unable to set DMA mask\n");
597 return rc;
598 + }
599
600 od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL);
601 if (!od)
602 diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
603 index 57962bff7532..72f31e837b1d 100644
604 --- a/drivers/dma/edma.c
605 +++ b/drivers/dma/edma.c
606 @@ -2268,9 +2268,6 @@ static int edma_probe(struct platform_device *pdev)
607
608 ecc->default_queue = info->default_queue;
609
610 - for (i = 0; i < ecc->num_slots; i++)
611 - edma_write_slot(ecc, i, &dummy_paramset);
612 -
613 if (info->rsv) {
614 /* Set the reserved slots in inuse list */
615 rsv_slots = info->rsv->rsv_slots;
616 @@ -2283,6 +2280,12 @@ static int edma_probe(struct platform_device *pdev)
617 }
618 }
619
620 + for (i = 0; i < ecc->num_slots; i++) {
621 + /* Reset only unused - not reserved - paRAM slots */
622 + if (!test_bit(i, ecc->slot_inuse))
623 + edma_write_slot(ecc, i, &dummy_paramset);
624 + }
625 +
626 /* Clear the xbar mapped channels in unused list */
627 xbar_chans = info->xbar_chans;
628 if (xbar_chans) {
629 diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
630 index a410657f7bcd..012584cf3c17 100644
631 --- a/drivers/dma/iop-adma.c
632 +++ b/drivers/dma/iop-adma.c
633 @@ -125,9 +125,9 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan)
634 list_for_each_entry_safe(iter, _iter, &iop_chan->chain,
635 chain_node) {
636 pr_debug("\tcookie: %d slot: %d busy: %d "
637 - "this_desc: %#x next_desc: %#x ack: %d\n",
638 + "this_desc: %#x next_desc: %#llx ack: %d\n",
639 iter->async_tx.cookie, iter->idx, busy,
640 - iter->async_tx.phys, iop_desc_get_next_desc(iter),
641 + iter->async_tx.phys, (u64)iop_desc_get_next_desc(iter),
642 async_tx_test_ack(&iter->async_tx));
643 prefetch(_iter);
644 prefetch(&_iter->async_tx);
645 @@ -315,9 +315,9 @@ retry:
646 int i;
647 dev_dbg(iop_chan->device->common.dev,
648 "allocated slot: %d "
649 - "(desc %p phys: %#x) slots_per_op %d\n",
650 + "(desc %p phys: %#llx) slots_per_op %d\n",
651 iter->idx, iter->hw_desc,
652 - iter->async_tx.phys, slots_per_op);
653 + (u64)iter->async_tx.phys, slots_per_op);
654
655 /* pre-ack all but the last descriptor */
656 if (num_slots != slots_per_op)
657 @@ -525,7 +525,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest,
658 return NULL;
659 BUG_ON(len > IOP_ADMA_MAX_BYTE_COUNT);
660
661 - dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
662 + dev_dbg(iop_chan->device->common.dev, "%s len: %zu\n",
663 __func__, len);
664
665 spin_lock_bh(&iop_chan->lock);
666 @@ -558,7 +558,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest,
667 BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
668
669 dev_dbg(iop_chan->device->common.dev,
670 - "%s src_cnt: %d len: %u flags: %lx\n",
671 + "%s src_cnt: %d len: %zu flags: %lx\n",
672 __func__, src_cnt, len, flags);
673
674 spin_lock_bh(&iop_chan->lock);
675 @@ -591,7 +591,7 @@ iop_adma_prep_dma_xor_val(struct dma_chan *chan, dma_addr_t *dma_src,
676 if (unlikely(!len))
677 return NULL;
678
679 - dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
680 + dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
681 __func__, src_cnt, len);
682
683 spin_lock_bh(&iop_chan->lock);
684 @@ -629,7 +629,7 @@ iop_adma_prep_dma_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
685 BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
686
687 dev_dbg(iop_chan->device->common.dev,
688 - "%s src_cnt: %d len: %u flags: %lx\n",
689 + "%s src_cnt: %d len: %zu flags: %lx\n",
690 __func__, src_cnt, len, flags);
691
692 if (dmaf_p_disabled_continue(flags))
693 @@ -692,7 +692,7 @@ iop_adma_prep_dma_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
694 return NULL;
695 BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
696
697 - dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
698 + dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
699 __func__, src_cnt, len);
700
701 spin_lock_bh(&iop_chan->lock);
702 diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
703 index b0bd0f64d8f2..6037efa94c9b 100644
704 --- a/drivers/edac/altera_edac.c
705 +++ b/drivers/edac/altera_edac.c
706 @@ -1651,6 +1651,7 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
707 struct altr_arria10_edac *edac = irq_desc_get_handler_data(desc);
708 struct irq_chip *chip = irq_desc_get_chip(desc);
709 int irq = irq_desc_get_irq(desc);
710 + unsigned long bits;
711
712 dberr = (irq == edac->db_irq) ? 1 : 0;
713 sm_offset = dberr ? A10_SYSMGR_ECC_INTSTAT_DERR_OFST :
714 @@ -1660,7 +1661,8 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
715
716 regmap_read(edac->ecc_mgr_map, sm_offset, &irq_status);
717
718 - for_each_set_bit(bit, (unsigned long *)&irq_status, 32) {
719 + bits = irq_status;
720 + for_each_set_bit(bit, &bits, 32) {
721 irq = irq_linear_revmap(edac->domain, dberr * 32 + bit);
722 if (irq)
723 generic_handle_irq(irq);
724 diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
725 index d42537425438..f40f7df4b734 100644
726 --- a/drivers/firmware/efi/cper.c
727 +++ b/drivers/firmware/efi/cper.c
728 @@ -384,6 +384,21 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
729 printk(
730 "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n",
731 pfx, pcie->bridge.secondary_status, pcie->bridge.control);
732 +
733 + /* Fatal errors call __ghes_panic() before AER handler prints this */
734 + if ((pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) &&
735 + (gdata->error_severity & CPER_SEV_FATAL)) {
736 + struct aer_capability_regs *aer;
737 +
738 + aer = (struct aer_capability_regs *)pcie->aer_info;
739 + printk("%saer_uncor_status: 0x%08x, aer_uncor_mask: 0x%08x\n",
740 + pfx, aer->uncor_status, aer->uncor_mask);
741 + printk("%saer_uncor_severity: 0x%08x\n",
742 + pfx, aer->uncor_severity);
743 + printk("%sTLP Header: %08x %08x %08x %08x\n", pfx,
744 + aer->header_log.dw0, aer->header_log.dw1,
745 + aer->header_log.dw2, aer->header_log.dw3);
746 + }
747 }
748
749 static void cper_estatus_print_section(
750 diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
751 index 3907439417e7..c0db3b57dfe5 100644
752 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
753 +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
754 @@ -3739,6 +3739,11 @@ int smu7_program_display_gap(struct pp_hwmgr *hwmgr)
755
756 data->frame_time_x2 = frame_time_in_us * 2 / 100;
757
758 + if (data->frame_time_x2 < 280) {
759 + pr_debug("%s: enforce minimal VBITimeout: %d -> 280\n", __func__, data->frame_time_x2);
760 + data->frame_time_x2 = 280;
761 + }
762 +
763 display_gap2 = pre_vbi_time_in_us * (ref_clock / 100);
764
765 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2);
766 diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
767 index d7822bef1986..b33d39d9dd14 100644
768 --- a/drivers/gpu/drm/drm_probe_helper.c
769 +++ b/drivers/gpu/drm/drm_probe_helper.c
770 @@ -387,6 +387,9 @@ static void output_poll_execute(struct work_struct *work)
771 enum drm_connector_status old_status;
772 bool repoll = false, changed;
773
774 + if (!dev->mode_config.poll_enabled)
775 + return;
776 +
777 /* Pick up any changes detected by the probe functions. */
778 changed = dev->mode_config.delayed_event;
779 dev->mode_config.delayed_event = false;
780 @@ -550,7 +553,11 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init);
781 */
782 void drm_kms_helper_poll_fini(struct drm_device *dev)
783 {
784 - drm_kms_helper_poll_disable(dev);
785 + if (!dev->mode_config.poll_enabled)
786 + return;
787 +
788 + dev->mode_config.poll_enabled = false;
789 + cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
790 }
791 EXPORT_SYMBOL(drm_kms_helper_poll_fini);
792
793 diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
794 index 52026dc94d5c..7e55d3f755dd 100644
795 --- a/drivers/hid/hid-lg.c
796 +++ b/drivers/hid/hid-lg.c
797 @@ -761,7 +761,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
798
799 if (!buf) {
800 ret = -ENOMEM;
801 - goto err_free;
802 + goto err_stop;
803 }
804
805 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
806 @@ -793,9 +793,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
807 ret = lg4ff_init(hdev);
808
809 if (ret)
810 - goto err_free;
811 + goto err_stop;
812
813 return 0;
814 +
815 +err_stop:
816 + hid_hw_stop(hdev);
817 err_free:
818 kfree(drv_data);
819 return ret;
820 @@ -806,8 +809,7 @@ static void lg_remove(struct hid_device *hdev)
821 struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
822 if (drv_data->quirks & LG_FF4)
823 lg4ff_deinit(hdev);
824 - else
825 - hid_hw_stop(hdev);
826 + hid_hw_stop(hdev);
827 kfree(drv_data);
828 }
829
830 diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
831 index 1fc12e357035..127f1335a1da 100644
832 --- a/drivers/hid/hid-lg4ff.c
833 +++ b/drivers/hid/hid-lg4ff.c
834 @@ -1485,7 +1485,6 @@ int lg4ff_deinit(struct hid_device *hid)
835 }
836 }
837 #endif
838 - hid_hw_stop(hid);
839 drv_data->device_props = NULL;
840
841 kfree(entry);
842 diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
843 index f095bf8a3aa9..762f33817dd0 100644
844 --- a/drivers/hid/hid-prodikeys.c
845 +++ b/drivers/hid/hid-prodikeys.c
846 @@ -556,10 +556,14 @@ static void pcmidi_setup_extra_keys(
847
848 static int pcmidi_set_operational(struct pcmidi_snd *pm)
849 {
850 + int rc;
851 +
852 if (pm->ifnum != 1)
853 return 0; /* only set up ONCE for interace 1 */
854
855 - pcmidi_get_output_report(pm);
856 + rc = pcmidi_get_output_report(pm);
857 + if (rc < 0)
858 + return rc;
859 pcmidi_submit_output_report(pm, 0xc1);
860 return 0;
861 }
862 @@ -688,7 +692,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
863 spin_lock_init(&pm->rawmidi_in_lock);
864
865 init_sustain_timers(pm);
866 - pcmidi_set_operational(pm);
867 + err = pcmidi_set_operational(pm);
868 + if (err < 0) {
869 + pk_error("failed to find output report\n");
870 + goto fail_register;
871 + }
872
873 /* register it */
874 err = snd_card_register(card);
875 diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
876 index 216f0338a1f7..750c16897130 100644
877 --- a/drivers/hid/hidraw.c
878 +++ b/drivers/hid/hidraw.c
879 @@ -378,7 +378,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
880
881 mutex_lock(&minors_lock);
882 dev = hidraw_table[minor];
883 - if (!dev) {
884 + if (!dev || !dev->exist) {
885 ret = -ENODEV;
886 goto out;
887 }
888 diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
889 index 579bdf93be43..e27f7e12c05b 100644
890 --- a/drivers/hwmon/acpi_power_meter.c
891 +++ b/drivers/hwmon/acpi_power_meter.c
892 @@ -693,8 +693,8 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
893
894 if (resource->caps.flags & POWER_METER_CAN_CAP) {
895 if (!can_cap_in_hardware()) {
896 - dev_err(&resource->acpi_dev->dev,
897 - "Ignoring unsafe software power cap!\n");
898 + dev_warn(&resource->acpi_dev->dev,
899 + "Ignoring unsafe software power cap!\n");
900 goto skip_unsafe_cap;
901 }
902
903 diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
904 index c811af4c8d81..e420b41a34ba 100644
905 --- a/drivers/i2c/busses/i2c-riic.c
906 +++ b/drivers/i2c/busses/i2c-riic.c
907 @@ -212,6 +212,7 @@ static irqreturn_t riic_tend_isr(int irq, void *data)
908 if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) {
909 /* We got a NACKIE */
910 readb(riic->base + RIIC_ICDRR); /* dummy read */
911 + riic_clear_set_bit(riic, ICSR2_NACKF, 0, RIIC_ICSR2);
912 riic->err = -ENXIO;
913 } else if (riic->bytes_left) {
914 return IRQ_NONE;
915 diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c
916 index ff12b8d176ce..c4e7aa91498b 100644
917 --- a/drivers/infiniband/core/cq.c
918 +++ b/drivers/infiniband/core/cq.c
919 @@ -102,12 +102,12 @@ static void ib_cq_poll_work(struct work_struct *work)
920 completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE);
921 if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
922 ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
923 - queue_work(ib_comp_wq, &cq->work);
924 + queue_work(cq->comp_wq, &cq->work);
925 }
926
927 static void ib_cq_completion_workqueue(struct ib_cq *cq, void *private)
928 {
929 - queue_work(ib_comp_wq, &cq->work);
930 + queue_work(cq->comp_wq, &cq->work);
931 }
932
933 /**
934 @@ -159,9 +159,12 @@ struct ib_cq *ib_alloc_cq(struct ib_device *dev, void *private,
935 ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
936 break;
937 case IB_POLL_WORKQUEUE:
938 + case IB_POLL_UNBOUND_WORKQUEUE:
939 cq->comp_handler = ib_cq_completion_workqueue;
940 INIT_WORK(&cq->work, ib_cq_poll_work);
941 ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
942 + cq->comp_wq = (cq->poll_ctx == IB_POLL_WORKQUEUE) ?
943 + ib_comp_wq : ib_comp_unbound_wq;
944 break;
945 default:
946 ret = -EINVAL;
947 @@ -196,6 +199,7 @@ void ib_free_cq(struct ib_cq *cq)
948 irq_poll_disable(&cq->iop);
949 break;
950 case IB_POLL_WORKQUEUE:
951 + case IB_POLL_UNBOUND_WORKQUEUE:
952 cancel_work_sync(&cq->work);
953 break;
954 default:
955 diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
956 index 15f4bdf89fe1..4b947d5cafe2 100644
957 --- a/drivers/infiniband/core/device.c
958 +++ b/drivers/infiniband/core/device.c
959 @@ -59,6 +59,7 @@ struct ib_client_data {
960 };
961
962 struct workqueue_struct *ib_comp_wq;
963 +struct workqueue_struct *ib_comp_unbound_wq;
964 struct workqueue_struct *ib_wq;
965 EXPORT_SYMBOL_GPL(ib_wq);
966
967 @@ -1005,10 +1006,19 @@ static int __init ib_core_init(void)
968 goto err;
969 }
970
971 + ib_comp_unbound_wq =
972 + alloc_workqueue("ib-comp-unb-wq",
973 + WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM |
974 + WQ_SYSFS, WQ_UNBOUND_MAX_ACTIVE);
975 + if (!ib_comp_unbound_wq) {
976 + ret = -ENOMEM;
977 + goto err_comp;
978 + }
979 +
980 ret = class_register(&ib_class);
981 if (ret) {
982 pr_warn("Couldn't create InfiniBand device class\n");
983 - goto err_comp;
984 + goto err_comp_unbound;
985 }
986
987 ret = ibnl_init();
988 @@ -1055,6 +1065,8 @@ err_ibnl:
989 ibnl_cleanup();
990 err_sysfs:
991 class_unregister(&ib_class);
992 +err_comp_unbound:
993 + destroy_workqueue(ib_comp_unbound_wq);
994 err_comp:
995 destroy_workqueue(ib_comp_wq);
996 err:
997 @@ -1071,6 +1083,7 @@ static void __exit ib_core_cleanup(void)
998 addr_cleanup();
999 ibnl_cleanup();
1000 class_unregister(&ib_class);
1001 + destroy_workqueue(ib_comp_unbound_wq);
1002 destroy_workqueue(ib_comp_wq);
1003 /* Make sure that any pending umem accounting work is done. */
1004 destroy_workqueue(ib_wq);
1005 diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
1006 index 25a28e706072..a1f059a9c751 100644
1007 --- a/drivers/infiniband/core/mad.c
1008 +++ b/drivers/infiniband/core/mad.c
1009 @@ -3163,7 +3163,7 @@ static int ib_mad_port_open(struct ib_device *device,
1010 }
1011
1012 port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0,
1013 - IB_POLL_WORKQUEUE);
1014 + IB_POLL_UNBOUND_WORKQUEUE);
1015 if (IS_ERR(port_priv->cq)) {
1016 dev_err(&device->dev, "Couldn't create ib_mad CQ\n");
1017 ret = PTR_ERR(port_priv->cq);
1018 diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c
1019 index 9487c9bb8920..908d4dd01562 100644
1020 --- a/drivers/infiniband/hw/hfi1/mad.c
1021 +++ b/drivers/infiniband/hw/hfi1/mad.c
1022 @@ -2016,7 +2016,7 @@ struct opa_port_status_req {
1023 __be32 vl_select_mask;
1024 };
1025
1026 -#define VL_MASK_ALL 0x000080ff
1027 +#define VL_MASK_ALL 0x00000000000080ffUL
1028
1029 struct opa_port_status_rsp {
1030 __u8 port_num;
1031 @@ -2315,15 +2315,14 @@ static int pma_get_opa_classportinfo(struct opa_pma_mad *pmp,
1032 }
1033
1034 static void a0_portstatus(struct hfi1_pportdata *ppd,
1035 - struct opa_port_status_rsp *rsp, u32 vl_select_mask)
1036 + struct opa_port_status_rsp *rsp)
1037 {
1038 if (!is_bx(ppd->dd)) {
1039 unsigned long vl;
1040 u64 sum_vl_xmit_wait = 0;
1041 - u32 vl_all_mask = VL_MASK_ALL;
1042 + unsigned long vl_all_mask = VL_MASK_ALL;
1043
1044 - for_each_set_bit(vl, (unsigned long *)&(vl_all_mask),
1045 - 8 * sizeof(vl_all_mask)) {
1046 + for_each_set_bit(vl, &vl_all_mask, BITS_PER_LONG) {
1047 u64 tmp = sum_vl_xmit_wait +
1048 read_port_cntr(ppd, C_TX_WAIT_VL,
1049 idx_from_vl(vl));
1050 @@ -2347,12 +2346,12 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
1051 (struct opa_port_status_req *)pmp->data;
1052 struct hfi1_devdata *dd = dd_from_ibdev(ibdev);
1053 struct opa_port_status_rsp *rsp;
1054 - u32 vl_select_mask = be32_to_cpu(req->vl_select_mask);
1055 + unsigned long vl_select_mask = be32_to_cpu(req->vl_select_mask);
1056 unsigned long vl;
1057 size_t response_data_size;
1058 u32 nports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
1059 u8 port_num = req->port_num;
1060 - u8 num_vls = hweight32(vl_select_mask);
1061 + u8 num_vls = hweight64(vl_select_mask);
1062 struct _vls_pctrs *vlinfo;
1063 struct hfi1_ibport *ibp = to_iport(ibdev, port);
1064 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
1065 @@ -2386,7 +2385,7 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
1066
1067 hfi1_read_link_quality(dd, &rsp->link_quality_indicator);
1068
1069 - rsp->vl_select_mask = cpu_to_be32(vl_select_mask);
1070 + rsp->vl_select_mask = cpu_to_be32((u32)vl_select_mask);
1071 rsp->port_xmit_data = cpu_to_be64(read_dev_cntr(dd, C_DC_XMIT_FLITS,
1072 CNTR_INVALID_VL));
1073 rsp->port_rcv_data = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FLITS,
1074 @@ -2449,8 +2448,7 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
1075 * So in the for_each_set_bit() loop below, we don't need
1076 * any additional checks for vl.
1077 */
1078 - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
1079 - 8 * sizeof(vl_select_mask)) {
1080 + for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
1081 memset(vlinfo, 0, sizeof(*vlinfo));
1082
1083 tmp = read_dev_cntr(dd, C_DC_RX_FLIT_VL, idx_from_vl(vl));
1084 @@ -2487,7 +2485,7 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
1085 vfi++;
1086 }
1087
1088 - a0_portstatus(ppd, rsp, vl_select_mask);
1089 + a0_portstatus(ppd, rsp);
1090
1091 if (resp_len)
1092 *resp_len += response_data_size;
1093 @@ -2534,16 +2532,14 @@ static u64 get_error_counter_summary(struct ib_device *ibdev, u8 port,
1094 return error_counter_summary;
1095 }
1096
1097 -static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp,
1098 - u32 vl_select_mask)
1099 +static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp)
1100 {
1101 if (!is_bx(ppd->dd)) {
1102 unsigned long vl;
1103 u64 sum_vl_xmit_wait = 0;
1104 - u32 vl_all_mask = VL_MASK_ALL;
1105 + unsigned long vl_all_mask = VL_MASK_ALL;
1106
1107 - for_each_set_bit(vl, (unsigned long *)&(vl_all_mask),
1108 - 8 * sizeof(vl_all_mask)) {
1109 + for_each_set_bit(vl, &vl_all_mask, BITS_PER_LONG) {
1110 u64 tmp = sum_vl_xmit_wait +
1111 read_port_cntr(ppd, C_TX_WAIT_VL,
1112 idx_from_vl(vl));
1113 @@ -2599,7 +2595,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,
1114 u64 port_mask;
1115 u8 port_num;
1116 unsigned long vl;
1117 - u32 vl_select_mask;
1118 + unsigned long vl_select_mask;
1119 int vfi;
1120
1121 num_ports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
1122 @@ -2668,8 +2664,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,
1123 * So in the for_each_set_bit() loop below, we don't need
1124 * any additional checks for vl.
1125 */
1126 - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
1127 - 8 * sizeof(req->vl_select_mask)) {
1128 + for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
1129 memset(vlinfo, 0, sizeof(*vlinfo));
1130
1131 rsp->vls[vfi].port_vl_xmit_data =
1132 @@ -2712,7 +2707,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,
1133 vfi++;
1134 }
1135
1136 - a0_datacounters(ppd, rsp, vl_select_mask);
1137 + a0_datacounters(ppd, rsp);
1138
1139 if (resp_len)
1140 *resp_len += response_data_size;
1141 @@ -2807,7 +2802,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp,
1142 struct _vls_ectrs *vlinfo;
1143 unsigned long vl;
1144 u64 port_mask, tmp;
1145 - u32 vl_select_mask;
1146 + unsigned long vl_select_mask;
1147 int vfi;
1148
1149 req = (struct opa_port_error_counters64_msg *)pmp->data;
1150 @@ -2866,8 +2861,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp,
1151 vlinfo = &rsp->vls[0];
1152 vfi = 0;
1153 vl_select_mask = be32_to_cpu(req->vl_select_mask);
1154 - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
1155 - 8 * sizeof(req->vl_select_mask)) {
1156 + for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
1157 memset(vlinfo, 0, sizeof(*vlinfo));
1158 rsp->vls[vfi].port_vl_xmit_discards =
1159 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD_VL,
1160 @@ -3077,7 +3071,7 @@ static int pma_set_opa_portstatus(struct opa_pma_mad *pmp,
1161 u32 nports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
1162 u64 portn = be64_to_cpu(req->port_select_mask[3]);
1163 u32 counter_select = be32_to_cpu(req->counter_select_mask);
1164 - u32 vl_select_mask = VL_MASK_ALL; /* clear all per-vl cnts */
1165 + unsigned long vl_select_mask = VL_MASK_ALL; /* clear all per-vl cnts */
1166 unsigned long vl;
1167
1168 if ((nports != 1) || (portn != 1 << port)) {
1169 @@ -3169,8 +3163,7 @@ static int pma_set_opa_portstatus(struct opa_pma_mad *pmp,
1170 if (counter_select & CS_UNCORRECTABLE_ERRORS)
1171 write_dev_cntr(dd, C_DC_UNC_ERR, CNTR_INVALID_VL, 0);
1172
1173 - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
1174 - 8 * sizeof(vl_select_mask)) {
1175 + for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
1176 if (counter_select & CS_PORT_XMIT_DATA)
1177 write_port_cntr(ppd, C_TX_FLIT_VL, idx_from_vl(vl), 0);
1178
1179 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
1180 index dd7880de7e4e..e81acb2b6ee7 100644
1181 --- a/drivers/iommu/amd_iommu.c
1182 +++ b/drivers/iommu/amd_iommu.c
1183 @@ -2595,7 +2595,9 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
1184
1185 bus_addr = address + s->dma_address + (j << PAGE_SHIFT);
1186 phys_addr = (sg_phys(s) & PAGE_MASK) + (j << PAGE_SHIFT);
1187 - ret = iommu_map_page(domain, bus_addr, phys_addr, PAGE_SIZE, prot, GFP_ATOMIC);
1188 + ret = iommu_map_page(domain, bus_addr, phys_addr,
1189 + PAGE_SIZE, prot,
1190 + GFP_ATOMIC | __GFP_NOWARN);
1191 if (ret)
1192 goto out_unmap;
1193
1194 diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
1195 index 83ca754250fb..0c0cd2768d6e 100644
1196 --- a/drivers/irqchip/irq-gic-v3-its.c
1197 +++ b/drivers/irqchip/irq-gic-v3-its.c
1198 @@ -1519,14 +1519,13 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq,
1199 struct its_device *its_dev = irq_data_get_irq_chip_data(d);
1200 int i;
1201
1202 + bitmap_release_region(its_dev->event_map.lpi_map,
1203 + its_get_event_id(irq_domain_get_irq_data(domain, virq)),
1204 + get_count_order(nr_irqs));
1205 +
1206 for (i = 0; i < nr_irqs; i++) {
1207 struct irq_data *data = irq_domain_get_irq_data(domain,
1208 virq + i);
1209 - u32 event = its_get_event_id(data);
1210 -
1211 - /* Mark interrupt index as unused */
1212 - clear_bit(event, its_dev->event_map.lpi_map);
1213 -
1214 /* Nuke the entry in the domain */
1215 irq_domain_reset_irq_data(data);
1216 }
1217 diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
1218 index d7c986fb0b3b..d204e530fcaa 100644
1219 --- a/drivers/isdn/mISDN/socket.c
1220 +++ b/drivers/isdn/mISDN/socket.c
1221 @@ -766,6 +766,8 @@ base_sock_create(struct net *net, struct socket *sock, int protocol, int kern)
1222
1223 if (sock->type != SOCK_RAW)
1224 return -ESOCKTNOSUPPORT;
1225 + if (!capable(CAP_NET_RAW))
1226 + return -EPERM;
1227
1228 sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
1229 if (!sk)
1230 diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c
1231 index b75333803a63..9f5e4d04efad 100644
1232 --- a/drivers/leds/leds-lp5562.c
1233 +++ b/drivers/leds/leds-lp5562.c
1234 @@ -263,7 +263,11 @@ static void lp5562_firmware_loaded(struct lp55xx_chip *chip)
1235 {
1236 const struct firmware *fw = chip->fw;
1237
1238 - if (fw->size > LP5562_PROGRAM_LENGTH) {
1239 + /*
1240 + * the firmware is encoded in ascii hex character, with 2 chars
1241 + * per byte
1242 + */
1243 + if (fw->size > (LP5562_PROGRAM_LENGTH * 2)) {
1244 dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
1245 fw->size);
1246 return;
1247 diff --git a/drivers/md/md.c b/drivers/md/md.c
1248 index 765a16dab2e5..da8708b65356 100644
1249 --- a/drivers/md/md.c
1250 +++ b/drivers/md/md.c
1251 @@ -1662,8 +1662,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
1252 if (!(le32_to_cpu(sb->feature_map) &
1253 MD_FEATURE_RECOVERY_BITMAP))
1254 rdev->saved_raid_disk = -1;
1255 - } else
1256 - set_bit(In_sync, &rdev->flags);
1257 + } else {
1258 + /*
1259 + * If the array is FROZEN, then the device can't
1260 + * be in_sync with rest of array.
1261 + */
1262 + if (!test_bit(MD_RECOVERY_FROZEN,
1263 + &mddev->recovery))
1264 + set_bit(In_sync, &rdev->flags);
1265 + }
1266 rdev->raid_disk = role;
1267 break;
1268 }
1269 @@ -8573,7 +8580,8 @@ void md_reap_sync_thread(struct mddev *mddev)
1270 /* resync has finished, collect result */
1271 md_unregister_thread(&mddev->sync_thread);
1272 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
1273 - !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
1274 + !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
1275 + mddev->degraded != mddev->raid_disks) {
1276 /* success...*/
1277 /* activate any spares */
1278 if (mddev->pers->spare_active(mddev)) {
1279 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
1280 index 53048bf0b2b8..9892c41de441 100644
1281 --- a/drivers/md/raid1.c
1282 +++ b/drivers/md/raid1.c
1283 @@ -2960,6 +2960,13 @@ static int raid1_run(struct mddev *mddev)
1284 !test_bit(In_sync, &conf->mirrors[i].rdev->flags) ||
1285 test_bit(Faulty, &conf->mirrors[i].rdev->flags))
1286 mddev->degraded++;
1287 + /*
1288 + * RAID1 needs at least one disk in active
1289 + */
1290 + if (conf->raid_disks - mddev->degraded < 1) {
1291 + ret = -EINVAL;
1292 + goto abort;
1293 + }
1294
1295 if (conf->raid_disks - mddev->degraded == 1)
1296 mddev->recovery_cp = MaxSector;
1297 @@ -2994,8 +3001,12 @@ static int raid1_run(struct mddev *mddev)
1298 ret = md_integrity_register(mddev);
1299 if (ret) {
1300 md_unregister_thread(&mddev->thread);
1301 - raid1_free(mddev, conf);
1302 + goto abort;
1303 }
1304 + return 0;
1305 +
1306 +abort:
1307 + raid1_free(mddev, conf);
1308 return ret;
1309 }
1310
1311 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1312 index 401e7c0e8802..1143860f0028 100644
1313 --- a/drivers/md/raid5.c
1314 +++ b/drivers/md/raid5.c
1315 @@ -2416,7 +2416,9 @@ static void raid5_end_read_request(struct bio * bi)
1316 && !test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
1317 retry = 1;
1318 if (retry)
1319 - if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
1320 + if (sh->qd_idx >= 0 && sh->pd_idx == i)
1321 + set_bit(R5_ReadError, &sh->dev[i].flags);
1322 + else if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
1323 set_bit(R5_ReadError, &sh->dev[i].flags);
1324 clear_bit(R5_ReadNoMerge, &sh->dev[i].flags);
1325 } else
1326 diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
1327 index 75a3f4b57fd4..a1cc1c1e5318 100644
1328 --- a/drivers/media/dvb-core/dvbdev.c
1329 +++ b/drivers/media/dvb-core/dvbdev.c
1330 @@ -314,8 +314,10 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
1331 if (npads) {
1332 dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads),
1333 GFP_KERNEL);
1334 - if (!dvbdev->pads)
1335 + if (!dvbdev->pads) {
1336 + kfree(dvbdev->entity);
1337 return -ENOMEM;
1338 + }
1339 }
1340
1341 switch (type) {
1342 diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
1343 index 502c72238a4a..db962e2108ad 100644
1344 --- a/drivers/media/i2c/ov9650.c
1345 +++ b/drivers/media/i2c/ov9650.c
1346 @@ -708,6 +708,11 @@ static int ov965x_set_gain(struct ov965x *ov965x, int auto_gain)
1347 for (m = 6; m >= 0; m--)
1348 if (gain >= (1 << m) * 16)
1349 break;
1350 +
1351 + /* Sanity check: don't adjust the gain with a negative value */
1352 + if (m < 0)
1353 + return -EINVAL;
1354 +
1355 rgain = (gain - ((1 << m) * 16)) / (1 << m);
1356 rgain |= (((1 << m) - 1) << 4);
1357
1358 diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
1359 index e83f8111a5fb..b27362ae4a5e 100644
1360 --- a/drivers/media/i2c/tvp5150.c
1361 +++ b/drivers/media/i2c/tvp5150.c
1362 @@ -824,7 +824,7 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
1363 return 0;
1364 case V4L2_CID_HUE:
1365 tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
1366 - break;
1367 + return 0;
1368 case V4L2_CID_TEST_PATTERN:
1369 decoder->enable = ctrl->val ? false : true;
1370 tvp5150_selmux(sd);
1371 diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c b/drivers/media/pci/saa7134/saa7134-i2c.c
1372 index dca0592c5f47..6f93568f5620 100644
1373 --- a/drivers/media/pci/saa7134/saa7134-i2c.c
1374 +++ b/drivers/media/pci/saa7134/saa7134-i2c.c
1375 @@ -355,7 +355,11 @@ static struct i2c_client saa7134_client_template = {
1376
1377 /* ----------------------------------------------------------- */
1378
1379 -/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
1380 +/*
1381 + * On Medion 7134 reading the SAA7134 chip config EEPROM needs DVB-T
1382 + * demod i2c gate closed due to an address clash between this EEPROM
1383 + * and the demod one.
1384 + */
1385 static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
1386 {
1387 u8 subaddr = 0x7, dmdregval;
1388 @@ -372,14 +376,14 @@ static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
1389
1390 ret = i2c_transfer(&dev->i2c_adap, i2cgatemsg_r, 2);
1391 if ((ret == 2) && (dmdregval & 0x2)) {
1392 - pr_debug("%s: DVB-T demod i2c gate was left closed\n",
1393 + pr_debug("%s: DVB-T demod i2c gate was left open\n",
1394 dev->name);
1395
1396 data[0] = subaddr;
1397 data[1] = (dmdregval & ~0x2);
1398 if (i2c_transfer(&dev->i2c_adap, i2cgatemsg_w, 1) != 1)
1399 - pr_err("%s: EEPROM i2c gate open failure\n",
1400 - dev->name);
1401 + pr_err("%s: EEPROM i2c gate close failure\n",
1402 + dev->name);
1403 }
1404 }
1405
1406 diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
1407 index f5fc8bcbd14b..be85a2c4318e 100644
1408 --- a/drivers/media/pci/saa7146/hexium_gemini.c
1409 +++ b/drivers/media/pci/saa7146/hexium_gemini.c
1410 @@ -304,6 +304,9 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
1411 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
1412 if (ret < 0) {
1413 pr_err("cannot register capture v4l2 device. skipping.\n");
1414 + saa7146_vv_release(dev);
1415 + i2c_del_adapter(&hexium->i2c_adapter);
1416 + kfree(hexium);
1417 return ret;
1418 }
1419
1420 diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
1421 index 7f92144a1de3..f9456f26ff4f 100644
1422 --- a/drivers/media/platform/exynos4-is/fimc-is.c
1423 +++ b/drivers/media/platform/exynos4-is/fimc-is.c
1424 @@ -819,6 +819,7 @@ static int fimc_is_probe(struct platform_device *pdev)
1425 return -ENODEV;
1426
1427 is->pmu_regs = of_iomap(node, 0);
1428 + of_node_put(node);
1429 if (!is->pmu_regs)
1430 return -ENOMEM;
1431
1432 diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
1433 index 1a1154a9dfa4..ef6ccb5b8952 100644
1434 --- a/drivers/media/platform/exynos4-is/media-dev.c
1435 +++ b/drivers/media/platform/exynos4-is/media-dev.c
1436 @@ -494,6 +494,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
1437 continue;
1438
1439 ret = fimc_md_parse_port_node(fmd, port, index);
1440 + of_node_put(port);
1441 if (ret < 0) {
1442 of_node_put(node);
1443 goto rpm_put;
1444 @@ -527,6 +528,7 @@ static int __of_get_csis_id(struct device_node *np)
1445 if (!np)
1446 return -EINVAL;
1447 of_property_read_u32(np, "reg", &reg);
1448 + of_node_put(np);
1449 return reg - FIMC_INPUT_MIPI_CSI2_0;
1450 }
1451
1452 diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
1453 index a21b12c5c085..ce651d3ca1b8 100644
1454 --- a/drivers/media/platform/omap3isp/isp.c
1455 +++ b/drivers/media/platform/omap3isp/isp.c
1456 @@ -726,6 +726,10 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
1457 s_stream, mode);
1458 pipe->do_propagation = true;
1459 }
1460 +
1461 + /* Stop at the first external sub-device. */
1462 + if (subdev->dev != isp->dev)
1463 + break;
1464 }
1465
1466 return 0;
1467 @@ -840,6 +844,10 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
1468 &subdev->entity);
1469 failure = -ETIMEDOUT;
1470 }
1471 +
1472 + /* Stop at the first external sub-device. */
1473 + if (subdev->dev != isp->dev)
1474 + break;
1475 }
1476
1477 return failure;
1478 diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
1479 index 882310eb45cc..fe16fbd95221 100644
1480 --- a/drivers/media/platform/omap3isp/ispccdc.c
1481 +++ b/drivers/media/platform/omap3isp/ispccdc.c
1482 @@ -2608,6 +2608,7 @@ int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
1483 int ret;
1484
1485 /* Register the subdev and video node. */
1486 + ccdc->subdev.dev = vdev->mdev->dev;
1487 ret = v4l2_device_register_subdev(vdev, &ccdc->subdev);
1488 if (ret < 0)
1489 goto error;
1490 diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
1491 index ca095238510d..b64e218eaea6 100644
1492 --- a/drivers/media/platform/omap3isp/ispccp2.c
1493 +++ b/drivers/media/platform/omap3isp/ispccp2.c
1494 @@ -1030,6 +1030,7 @@ int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
1495 int ret;
1496
1497 /* Register the subdev and video nodes. */
1498 + ccp2->subdev.dev = vdev->mdev->dev;
1499 ret = v4l2_device_register_subdev(vdev, &ccp2->subdev);
1500 if (ret < 0)
1501 goto error;
1502 diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
1503 index f75a1be29d84..27a2913363b6 100644
1504 --- a/drivers/media/platform/omap3isp/ispcsi2.c
1505 +++ b/drivers/media/platform/omap3isp/ispcsi2.c
1506 @@ -1206,6 +1206,7 @@ int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
1507 int ret;
1508
1509 /* Register the subdev and video nodes. */
1510 + csi2->subdev.dev = vdev->mdev->dev;
1511 ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
1512 if (ret < 0)
1513 goto error;
1514 diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
1515 index ac30a0f83780..e981eb2330f1 100644
1516 --- a/drivers/media/platform/omap3isp/isppreview.c
1517 +++ b/drivers/media/platform/omap3isp/isppreview.c
1518 @@ -2228,6 +2228,7 @@ int omap3isp_preview_register_entities(struct isp_prev_device *prev,
1519 int ret;
1520
1521 /* Register the subdev and video nodes. */
1522 + prev->subdev.dev = vdev->mdev->dev;
1523 ret = v4l2_device_register_subdev(vdev, &prev->subdev);
1524 if (ret < 0)
1525 goto error;
1526 diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
1527 index 0b6a87508584..2035e3c6a9de 100644
1528 --- a/drivers/media/platform/omap3isp/ispresizer.c
1529 +++ b/drivers/media/platform/omap3isp/ispresizer.c
1530 @@ -1684,6 +1684,7 @@ int omap3isp_resizer_register_entities(struct isp_res_device *res,
1531 int ret;
1532
1533 /* Register the subdev and video nodes. */
1534 + res->subdev.dev = vdev->mdev->dev;
1535 ret = v4l2_device_register_subdev(vdev, &res->subdev);
1536 if (ret < 0)
1537 goto error;
1538 diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
1539 index 1b9217d3b1b6..4a4ae637655b 100644
1540 --- a/drivers/media/platform/omap3isp/ispstat.c
1541 +++ b/drivers/media/platform/omap3isp/ispstat.c
1542 @@ -1010,6 +1010,8 @@ void omap3isp_stat_unregister_entities(struct ispstat *stat)
1543 int omap3isp_stat_register_entities(struct ispstat *stat,
1544 struct v4l2_device *vdev)
1545 {
1546 + stat->subdev.dev = vdev->mdev->dev;
1547 +
1548 return v4l2_device_register_subdev(vdev, &stat->subdev);
1549 }
1550
1551 diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
1552 index 4b132c29f290..1d045a8c29e2 100644
1553 --- a/drivers/media/radio/si470x/radio-si470x-usb.c
1554 +++ b/drivers/media/radio/si470x/radio-si470x-usb.c
1555 @@ -742,7 +742,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
1556 /* start radio */
1557 retval = si470x_start_usb(radio);
1558 if (retval < 0)
1559 - goto err_all;
1560 + goto err_buf;
1561
1562 /* set initial frequency */
1563 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
1564 @@ -757,6 +757,8 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
1565
1566 return 0;
1567 err_all:
1568 + usb_kill_urb(radio->int_in_urb);
1569 +err_buf:
1570 kfree(radio->buffer);
1571 err_ctrl:
1572 v4l2_ctrl_handler_free(&radio->hdl);
1573 @@ -830,6 +832,7 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
1574 mutex_lock(&radio->lock);
1575 v4l2_device_disconnect(&radio->v4l2_dev);
1576 video_unregister_device(&radio->videodev);
1577 + usb_kill_urb(radio->int_in_urb);
1578 usb_set_intfdata(intf, NULL);
1579 mutex_unlock(&radio->lock);
1580 v4l2_device_put(&radio->v4l2_dev);
1581 diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
1582 index 5f634545ddd8..25470395c43f 100644
1583 --- a/drivers/media/rc/iguanair.c
1584 +++ b/drivers/media/rc/iguanair.c
1585 @@ -430,6 +430,10 @@ static int iguanair_probe(struct usb_interface *intf,
1586 int ret, pipein, pipeout;
1587 struct usb_host_interface *idesc;
1588
1589 + idesc = intf->altsetting;
1590 + if (idesc->desc.bNumEndpoints < 2)
1591 + return -ENODEV;
1592 +
1593 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
1594 rc = rc_allocate_device();
1595 if (!ir || !rc) {
1596 @@ -444,18 +448,13 @@ static int iguanair_probe(struct usb_interface *intf,
1597 ir->urb_in = usb_alloc_urb(0, GFP_KERNEL);
1598 ir->urb_out = usb_alloc_urb(0, GFP_KERNEL);
1599
1600 - if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out) {
1601 + if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out ||
1602 + !usb_endpoint_is_int_in(&idesc->endpoint[0].desc) ||
1603 + !usb_endpoint_is_int_out(&idesc->endpoint[1].desc)) {
1604 ret = -ENOMEM;
1605 goto out;
1606 }
1607
1608 - idesc = intf->altsetting;
1609 -
1610 - if (idesc->desc.bNumEndpoints < 2) {
1611 - ret = -ENODEV;
1612 - goto out;
1613 - }
1614 -
1615 ir->rc = rc;
1616 ir->dev = &intf->dev;
1617 ir->udev = udev;
1618 diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
1619 index 21e5454d260a..30e27844e0e9 100644
1620 --- a/drivers/media/usb/cpia2/cpia2_usb.c
1621 +++ b/drivers/media/usb/cpia2/cpia2_usb.c
1622 @@ -690,6 +690,10 @@ static int submit_urbs(struct camera_data *cam)
1623 if (!urb) {
1624 for (j = 0; j < i; j++)
1625 usb_free_urb(cam->sbuf[j].urb);
1626 + for (j = 0; j < NUM_SBUF; j++) {
1627 + kfree(cam->sbuf[j].data);
1628 + cam->sbuf[j].data = NULL;
1629 + }
1630 return -ENOMEM;
1631 }
1632
1633 diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
1634 index 2868766893c8..c7c8fea0f1fa 100644
1635 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c
1636 +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
1637 @@ -2438,9 +2438,13 @@ static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
1638 8, 0x0486,
1639 };
1640
1641 + if (!IS_ENABLED(CONFIG_DVB_DIB9000))
1642 + return -ENODEV;
1643 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
1644 return -ENODEV;
1645 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1646 + if (!i2c)
1647 + return -ENODEV;
1648 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
1649 return -ENODEV;
1650 dib0700_set_i2c_speed(adap->dev, 1500);
1651 @@ -2516,10 +2520,14 @@ static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
1652 0, 0x00ef,
1653 8, 0x0406,
1654 };
1655 + if (!IS_ENABLED(CONFIG_DVB_DIB9000))
1656 + return -ENODEV;
1657 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
1658 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
1659 return -ENODEV;
1660 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1661 + if (!i2c)
1662 + return -ENODEV;
1663 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
1664 return -ENODEV;
1665
1666 diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
1667 index 78542fff403f..5a37d32e8fd0 100644
1668 --- a/drivers/media/usb/gspca/konica.c
1669 +++ b/drivers/media/usb/gspca/konica.c
1670 @@ -127,6 +127,11 @@ static void reg_r(struct gspca_dev *gspca_dev, u16 value, u16 index)
1671 if (ret < 0) {
1672 pr_err("reg_r err %d\n", ret);
1673 gspca_dev->usb_err = ret;
1674 + /*
1675 + * Make sure the buffer is zeroed to avoid uninitialized
1676 + * values.
1677 + */
1678 + memset(gspca_dev->usb_buf, 0, 2);
1679 }
1680 }
1681
1682 diff --git a/drivers/media/usb/gspca/nw80x.c b/drivers/media/usb/gspca/nw80x.c
1683 index 599f755e75b8..7ebeee98dc1b 100644
1684 --- a/drivers/media/usb/gspca/nw80x.c
1685 +++ b/drivers/media/usb/gspca/nw80x.c
1686 @@ -1584,6 +1584,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1687 if (ret < 0) {
1688 pr_err("reg_r err %d\n", ret);
1689 gspca_dev->usb_err = ret;
1690 + /*
1691 + * Make sure the buffer is zeroed to avoid uninitialized
1692 + * values.
1693 + */
1694 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1695 return;
1696 }
1697 if (len == 1)
1698 diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c
1699 index 965372a5ff2f..7ac38905080a 100644
1700 --- a/drivers/media/usb/gspca/ov519.c
1701 +++ b/drivers/media/usb/gspca/ov519.c
1702 @@ -2087,6 +2087,11 @@ static int reg_r(struct sd *sd, u16 index)
1703 } else {
1704 PERR("reg_r %02x failed %d\n", index, ret);
1705 sd->gspca_dev.usb_err = ret;
1706 + /*
1707 + * Make sure the result is zeroed to avoid uninitialized
1708 + * values.
1709 + */
1710 + gspca_dev->usb_buf[0] = 0;
1711 }
1712
1713 return ret;
1714 @@ -2115,6 +2120,11 @@ static int reg_r8(struct sd *sd,
1715 } else {
1716 PERR("reg_r8 %02x failed %d\n", index, ret);
1717 sd->gspca_dev.usb_err = ret;
1718 + /*
1719 + * Make sure the buffer is zeroed to avoid uninitialized
1720 + * values.
1721 + */
1722 + memset(gspca_dev->usb_buf, 0, 8);
1723 }
1724
1725 return ret;
1726 diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c
1727 index 9266a5c9abc5..ba289b453077 100644
1728 --- a/drivers/media/usb/gspca/ov534.c
1729 +++ b/drivers/media/usb/gspca/ov534.c
1730 @@ -645,6 +645,11 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
1731 if (ret < 0) {
1732 pr_err("read failed %d\n", ret);
1733 gspca_dev->usb_err = ret;
1734 + /*
1735 + * Make sure the result is zeroed to avoid uninitialized
1736 + * values.
1737 + */
1738 + gspca_dev->usb_buf[0] = 0;
1739 }
1740 return gspca_dev->usb_buf[0];
1741 }
1742 diff --git a/drivers/media/usb/gspca/ov534_9.c b/drivers/media/usb/gspca/ov534_9.c
1743 index 47085cf2d723..f2dca0606935 100644
1744 --- a/drivers/media/usb/gspca/ov534_9.c
1745 +++ b/drivers/media/usb/gspca/ov534_9.c
1746 @@ -1157,6 +1157,7 @@ static u8 reg_r(struct gspca_dev *gspca_dev, u16 reg)
1747 if (ret < 0) {
1748 pr_err("reg_r err %d\n", ret);
1749 gspca_dev->usb_err = ret;
1750 + return 0;
1751 }
1752 return gspca_dev->usb_buf[0];
1753 }
1754 diff --git a/drivers/media/usb/gspca/se401.c b/drivers/media/usb/gspca/se401.c
1755 index 5102cea50471..6adbb0eca71f 100644
1756 --- a/drivers/media/usb/gspca/se401.c
1757 +++ b/drivers/media/usb/gspca/se401.c
1758 @@ -115,6 +115,11 @@ static void se401_read_req(struct gspca_dev *gspca_dev, u16 req, int silent)
1759 pr_err("read req failed req %#04x error %d\n",
1760 req, err);
1761 gspca_dev->usb_err = err;
1762 + /*
1763 + * Make sure the buffer is zeroed to avoid uninitialized
1764 + * values.
1765 + */
1766 + memset(gspca_dev->usb_buf, 0, READ_REQ_SIZE);
1767 }
1768 }
1769
1770 diff --git a/drivers/media/usb/gspca/sn9c20x.c b/drivers/media/usb/gspca/sn9c20x.c
1771 index 10269dad9d20..11c794aea045 100644
1772 --- a/drivers/media/usb/gspca/sn9c20x.c
1773 +++ b/drivers/media/usb/gspca/sn9c20x.c
1774 @@ -137,6 +137,13 @@ static const struct dmi_system_id flip_dmi_table[] = {
1775 DMI_MATCH(DMI_PRODUCT_VERSION, "0341")
1776 }
1777 },
1778 + {
1779 + .ident = "MSI MS-1039",
1780 + .matches = {
1781 + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD."),
1782 + DMI_MATCH(DMI_PRODUCT_NAME, "MS-1039"),
1783 + }
1784 + },
1785 {
1786 .ident = "MSI MS-1632",
1787 .matches = {
1788 @@ -923,6 +930,11 @@ static void reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length)
1789 if (unlikely(result < 0 || result != length)) {
1790 pr_err("Read register %02x failed %d\n", reg, result);
1791 gspca_dev->usb_err = result;
1792 + /*
1793 + * Make sure the buffer is zeroed to avoid uninitialized
1794 + * values.
1795 + */
1796 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1797 }
1798 }
1799
1800 diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
1801 index 6696b2ec34e9..83e98b85ab6a 100644
1802 --- a/drivers/media/usb/gspca/sonixb.c
1803 +++ b/drivers/media/usb/gspca/sonixb.c
1804 @@ -466,6 +466,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1805 dev_err(gspca_dev->v4l2_dev.dev,
1806 "Error reading register %02x: %d\n", value, res);
1807 gspca_dev->usb_err = res;
1808 + /*
1809 + * Make sure the result is zeroed to avoid uninitialized
1810 + * values.
1811 + */
1812 + gspca_dev->usb_buf[0] = 0;
1813 }
1814 }
1815
1816 diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c
1817 index d49d76ec1421..9ec63f75b8ea 100644
1818 --- a/drivers/media/usb/gspca/sonixj.c
1819 +++ b/drivers/media/usb/gspca/sonixj.c
1820 @@ -1174,6 +1174,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1821 if (ret < 0) {
1822 pr_err("reg_r err %d\n", ret);
1823 gspca_dev->usb_err = ret;
1824 + /*
1825 + * Make sure the buffer is zeroed to avoid uninitialized
1826 + * values.
1827 + */
1828 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1829 }
1830 }
1831
1832 diff --git a/drivers/media/usb/gspca/spca1528.c b/drivers/media/usb/gspca/spca1528.c
1833 index f38fd8949609..ee93bd443df5 100644
1834 --- a/drivers/media/usb/gspca/spca1528.c
1835 +++ b/drivers/media/usb/gspca/spca1528.c
1836 @@ -84,6 +84,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1837 if (ret < 0) {
1838 pr_err("reg_r err %d\n", ret);
1839 gspca_dev->usb_err = ret;
1840 + /*
1841 + * Make sure the buffer is zeroed to avoid uninitialized
1842 + * values.
1843 + */
1844 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1845 }
1846 }
1847
1848 diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
1849 index e274cf19a3ea..b236e9dcd468 100644
1850 --- a/drivers/media/usb/gspca/sq930x.c
1851 +++ b/drivers/media/usb/gspca/sq930x.c
1852 @@ -438,6 +438,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1853 if (ret < 0) {
1854 pr_err("reg_r %04x failed %d\n", value, ret);
1855 gspca_dev->usb_err = ret;
1856 + /*
1857 + * Make sure the buffer is zeroed to avoid uninitialized
1858 + * values.
1859 + */
1860 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1861 }
1862 }
1863
1864 diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c
1865 index 46c9f2229a18..cc3e1478c5a0 100644
1866 --- a/drivers/media/usb/gspca/sunplus.c
1867 +++ b/drivers/media/usb/gspca/sunplus.c
1868 @@ -268,6 +268,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
1869 if (ret < 0) {
1870 pr_err("reg_r err %d\n", ret);
1871 gspca_dev->usb_err = ret;
1872 + /*
1873 + * Make sure the buffer is zeroed to avoid uninitialized
1874 + * values.
1875 + */
1876 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1877 }
1878 }
1879
1880 diff --git a/drivers/media/usb/gspca/vc032x.c b/drivers/media/usb/gspca/vc032x.c
1881 index b4efb2fb36fa..5032b9d7d9bb 100644
1882 --- a/drivers/media/usb/gspca/vc032x.c
1883 +++ b/drivers/media/usb/gspca/vc032x.c
1884 @@ -2919,6 +2919,11 @@ static void reg_r_i(struct gspca_dev *gspca_dev,
1885 if (ret < 0) {
1886 pr_err("reg_r err %d\n", ret);
1887 gspca_dev->usb_err = ret;
1888 + /*
1889 + * Make sure the buffer is zeroed to avoid uninitialized
1890 + * values.
1891 + */
1892 + memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
1893 }
1894 }
1895 static void reg_r(struct gspca_dev *gspca_dev,
1896 diff --git a/drivers/media/usb/gspca/w996Xcf.c b/drivers/media/usb/gspca/w996Xcf.c
1897 index 896f1b2b9179..948aaae4d47e 100644
1898 --- a/drivers/media/usb/gspca/w996Xcf.c
1899 +++ b/drivers/media/usb/gspca/w996Xcf.c
1900 @@ -147,6 +147,11 @@ static int w9968cf_read_sb(struct sd *sd)
1901 } else {
1902 pr_err("Read SB reg [01] failed\n");
1903 sd->gspca_dev.usb_err = ret;
1904 + /*
1905 + * Make sure the buffer is zeroed to avoid uninitialized
1906 + * values.
1907 + */
1908 + memset(sd->gspca_dev.usb_buf, 0, 2);
1909 }
1910
1911 udelay(W9968CF_I2C_BUS_DELAY);
1912 diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
1913 index a20b60ac66ca..99171b912a2d 100644
1914 --- a/drivers/media/usb/hdpvr/hdpvr-core.c
1915 +++ b/drivers/media/usb/hdpvr/hdpvr-core.c
1916 @@ -143,6 +143,7 @@ static int device_authorization(struct hdpvr_device *dev)
1917
1918 dev->fw_ver = dev->usbc_buf[1];
1919
1920 + dev->usbc_buf[46] = '\0';
1921 v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n",
1922 dev->fw_ver, &dev->usbc_buf[2]);
1923
1924 @@ -278,6 +279,7 @@ static int hdpvr_probe(struct usb_interface *interface,
1925 #endif
1926 size_t buffer_size;
1927 int i;
1928 + int dev_num;
1929 int retval = -ENOMEM;
1930
1931 /* allocate memory for our device state and initialize it */
1932 @@ -382,8 +384,17 @@ static int hdpvr_probe(struct usb_interface *interface,
1933 }
1934 #endif
1935
1936 + dev_num = atomic_inc_return(&dev_nr);
1937 + if (dev_num >= HDPVR_MAX) {
1938 + v4l2_err(&dev->v4l2_dev,
1939 + "max device number reached, device register failed\n");
1940 + atomic_dec(&dev_nr);
1941 + retval = -ENODEV;
1942 + goto reg_fail;
1943 + }
1944 +
1945 retval = hdpvr_register_videodev(dev, &interface->dev,
1946 - video_nr[atomic_inc_return(&dev_nr)]);
1947 + video_nr[dev_num]);
1948 if (retval < 0) {
1949 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
1950 goto reg_fail;
1951 diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
1952 index 4e7671a3a1e4..d7397c0d7f86 100644
1953 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
1954 +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
1955 @@ -278,7 +278,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
1956
1957 dprintk("%s\n", __func__);
1958
1959 - b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
1960 + b = kzalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
1961 if (!b)
1962 return -ENOMEM;
1963
1964 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1965 index df306caba296..0347742a495a 100644
1966 --- a/drivers/mmc/host/sdhci.c
1967 +++ b/drivers/mmc/host/sdhci.c
1968 @@ -1557,7 +1557,9 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
1969 ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
1970 else if (timing == MMC_TIMING_UHS_SDR12)
1971 ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
1972 - else if (timing == MMC_TIMING_UHS_SDR25)
1973 + else if (timing == MMC_TIMING_SD_HS ||
1974 + timing == MMC_TIMING_MMC_HS ||
1975 + timing == MMC_TIMING_UHS_SDR25)
1976 ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
1977 else if (timing == MMC_TIMING_UHS_SDR50)
1978 ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
1979 diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
1980 index de35a2a362f9..8725e406a9eb 100644
1981 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
1982 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
1983 @@ -1624,29 +1624,35 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
1984 continue;
1985 }
1986
1987 - if (time_after(jiffies, timeo) && !chip_ready(map, adr)){
1988 + /*
1989 + * We check "time_after" and "!chip_good" before checking
1990 + * "chip_good" to avoid the failure due to scheduling.
1991 + */
1992 + if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) {
1993 xip_enable(map, chip, adr);
1994 printk(KERN_WARNING "MTD %s(): software timeout\n", __func__);
1995 xip_disable(map, chip, adr);
1996 + ret = -EIO;
1997 break;
1998 }
1999
2000 - if (chip_ready(map, adr))
2001 + if (chip_good(map, adr, datum))
2002 break;
2003
2004 /* Latency issues. Drop the lock, wait a while and retry */
2005 UDELAY(map, chip, adr, 1);
2006 }
2007 +
2008 /* Did we succeed? */
2009 - if (!chip_good(map, adr, datum)) {
2010 + if (ret) {
2011 /* reset on all failures. */
2012 map_write( map, CMD(0xF0), chip->start );
2013 /* FIXME - should have reset delay before continuing */
2014
2015 - if (++retry_cnt <= MAX_RETRIES)
2016 + if (++retry_cnt <= MAX_RETRIES) {
2017 + ret = 0;
2018 goto retry;
2019 -
2020 - ret = -EIO;
2021 + }
2022 }
2023 xip_enable(map, chip, adr);
2024 op_done:
2025 diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
2026 index 6ea963e3b89a..85ffd0561827 100644
2027 --- a/drivers/net/arcnet/arcnet.c
2028 +++ b/drivers/net/arcnet/arcnet.c
2029 @@ -1009,31 +1009,34 @@ EXPORT_SYMBOL(arcnet_interrupt);
2030 static void arcnet_rx(struct net_device *dev, int bufnum)
2031 {
2032 struct arcnet_local *lp = netdev_priv(dev);
2033 - struct archdr pkt;
2034 + union {
2035 + struct archdr pkt;
2036 + char buf[512];
2037 + } rxdata;
2038 struct arc_rfc1201 *soft;
2039 int length, ofs;
2040
2041 - soft = &pkt.soft.rfc1201;
2042 + soft = &rxdata.pkt.soft.rfc1201;
2043
2044 - lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE);
2045 - if (pkt.hard.offset[0]) {
2046 - ofs = pkt.hard.offset[0];
2047 + lp->hw.copy_from_card(dev, bufnum, 0, &rxdata.pkt, ARC_HDR_SIZE);
2048 + if (rxdata.pkt.hard.offset[0]) {
2049 + ofs = rxdata.pkt.hard.offset[0];
2050 length = 256 - ofs;
2051 } else {
2052 - ofs = pkt.hard.offset[1];
2053 + ofs = rxdata.pkt.hard.offset[1];
2054 length = 512 - ofs;
2055 }
2056
2057 /* get the full header, if possible */
2058 - if (sizeof(pkt.soft) <= length) {
2059 - lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(pkt.soft));
2060 + if (sizeof(rxdata.pkt.soft) <= length) {
2061 + lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(rxdata.pkt.soft));
2062 } else {
2063 - memset(&pkt.soft, 0, sizeof(pkt.soft));
2064 + memset(&rxdata.pkt.soft, 0, sizeof(rxdata.pkt.soft));
2065 lp->hw.copy_from_card(dev, bufnum, ofs, soft, length);
2066 }
2067
2068 arc_printk(D_DURING, dev, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n",
2069 - bufnum, pkt.hard.source, pkt.hard.dest, length);
2070 + bufnum, rxdata.pkt.hard.source, rxdata.pkt.hard.dest, length);
2071
2072 dev->stats.rx_packets++;
2073 dev->stats.rx_bytes += length + ARC_HDR_SIZE;
2074 @@ -1042,13 +1045,13 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
2075 if (arc_proto_map[soft->proto]->is_ip) {
2076 if (BUGLVL(D_PROTO)) {
2077 struct ArcProto
2078 - *oldp = arc_proto_map[lp->default_proto[pkt.hard.source]],
2079 + *oldp = arc_proto_map[lp->default_proto[rxdata.pkt.hard.source]],
2080 *newp = arc_proto_map[soft->proto];
2081
2082 if (oldp != newp) {
2083 arc_printk(D_PROTO, dev,
2084 "got protocol %02Xh; encap for host %02Xh is now '%c' (was '%c')\n",
2085 - soft->proto, pkt.hard.source,
2086 + soft->proto, rxdata.pkt.hard.source,
2087 newp->suffix, oldp->suffix);
2088 }
2089 }
2090 @@ -1057,10 +1060,10 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
2091 lp->default_proto[0] = soft->proto;
2092
2093 /* in striking contrast, the following isn't a hack. */
2094 - lp->default_proto[pkt.hard.source] = soft->proto;
2095 + lp->default_proto[rxdata.pkt.hard.source] = soft->proto;
2096 }
2097 /* call the protocol-specific receiver. */
2098 - arc_proto_map[soft->proto]->rx(dev, bufnum, &pkt, length);
2099 + arc_proto_map[soft->proto]->rx(dev, bufnum, &rxdata.pkt, length);
2100 }
2101
2102 static void null_rx(struct net_device *dev, int bufnum,
2103 diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
2104 index dc7d671b903c..625008e8cb0d 100644
2105 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
2106 +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
2107 @@ -1447,6 +1447,16 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
2108 else
2109 phy_reg |= 0xFA;
2110 e1e_wphy_locked(hw, I217_PLL_CLOCK_GATE_REG, phy_reg);
2111 +
2112 + if (speed == SPEED_1000) {
2113 + hw->phy.ops.read_reg_locked(hw, HV_PM_CTRL,
2114 + &phy_reg);
2115 +
2116 + phy_reg |= HV_PM_CTRL_K1_CLK_REQ;
2117 +
2118 + hw->phy.ops.write_reg_locked(hw, HV_PM_CTRL,
2119 + phy_reg);
2120 + }
2121 }
2122 hw->phy.ops.release(hw);
2123
2124 diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
2125 index 67163ca898ba..6374c8fc76a8 100644
2126 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
2127 +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
2128 @@ -227,7 +227,7 @@
2129
2130 /* PHY Power Management Control */
2131 #define HV_PM_CTRL PHY_REG(770, 17)
2132 -#define HV_PM_CTRL_PLL_STOP_IN_K1_GIGA 0x100
2133 +#define HV_PM_CTRL_K1_CLK_REQ 0x200
2134 #define HV_PM_CTRL_K1_ENABLE 0x4000
2135
2136 #define I217_PLL_CLOCK_GATE_REG PHY_REG(772, 28)
2137 diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
2138 index c9f4b5412844..b97a070074b7 100644
2139 --- a/drivers/net/ethernet/marvell/skge.c
2140 +++ b/drivers/net/ethernet/marvell/skge.c
2141 @@ -3114,7 +3114,7 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
2142 skb_put(skb, len);
2143
2144 if (dev->features & NETIF_F_RXCSUM) {
2145 - skb->csum = csum;
2146 + skb->csum = le16_to_cpu(csum);
2147 skb->ip_summed = CHECKSUM_COMPLETE;
2148 }
2149
2150 diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
2151 index 8e13ec84c538..9fcaf1910633 100644
2152 --- a/drivers/net/ethernet/nxp/lpc_eth.c
2153 +++ b/drivers/net/ethernet/nxp/lpc_eth.c
2154 @@ -1374,13 +1374,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
2155 pldat->dma_buff_base_p = dma_handle;
2156
2157 netdev_dbg(ndev, "IO address space :%pR\n", res);
2158 - netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
2159 + netdev_dbg(ndev, "IO address size :%zd\n",
2160 + (size_t)resource_size(res));
2161 netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
2162 pldat->net_base);
2163 netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
2164 - netdev_dbg(ndev, "DMA buffer size :%d\n", pldat->dma_buff_size);
2165 - netdev_dbg(ndev, "DMA buffer P address :0x%08x\n",
2166 - pldat->dma_buff_base_p);
2167 + netdev_dbg(ndev, "DMA buffer size :%zd\n", pldat->dma_buff_size);
2168 + netdev_dbg(ndev, "DMA buffer P address :%pad\n",
2169 + &pldat->dma_buff_base_p);
2170 netdev_dbg(ndev, "DMA buffer V address :0x%p\n",
2171 pldat->dma_buff_base_v);
2172
2173 @@ -1427,8 +1428,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
2174 if (ret)
2175 goto err_out_unregister_netdev;
2176
2177 - netdev_info(ndev, "LPC mac at 0x%08x irq %d\n",
2178 - res->start, ndev->irq);
2179 + netdev_info(ndev, "LPC mac at 0x%08lx irq %d\n",
2180 + (unsigned long)res->start, ndev->irq);
2181
2182 phydev = ndev->phydev;
2183
2184 diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
2185 index d91f020a8491..da10104be16c 100644
2186 --- a/drivers/net/macsec.c
2187 +++ b/drivers/net/macsec.c
2188 @@ -1240,6 +1240,7 @@ deliver:
2189 macsec_rxsa_put(rx_sa);
2190 macsec_rxsc_put(rx_sc);
2191
2192 + skb_orphan(skb);
2193 ret = gro_cells_receive(&macsec->gro_cells, skb);
2194 if (ret == NET_RX_SUCCESS)
2195 count_rx(dev, skb->len);
2196 diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c
2197 index 2a1b490bc587..718cd3c59e92 100644
2198 --- a/drivers/net/phy/national.c
2199 +++ b/drivers/net/phy/national.c
2200 @@ -110,14 +110,17 @@ static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)
2201
2202 static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
2203 {
2204 + u16 lb_dis = BIT(1);
2205 +
2206 if (disable)
2207 - ns_exp_write(phydev, 0x1c0, ns_exp_read(phydev, 0x1c0) | 1);
2208 + ns_exp_write(phydev, 0x1c0,
2209 + ns_exp_read(phydev, 0x1c0) | lb_dis);
2210 else
2211 ns_exp_write(phydev, 0x1c0,
2212 - ns_exp_read(phydev, 0x1c0) & 0xfffe);
2213 + ns_exp_read(phydev, 0x1c0) & ~lb_dis);
2214
2215 pr_debug("10BASE-T HDX loopback %s\n",
2216 - (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on");
2217 + (ns_exp_read(phydev, 0x1c0) & lb_dis) ? "off" : "on");
2218 }
2219
2220 static int ns_config_init(struct phy_device *phydev)
2221 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
2222 index 1e4969d90f1a..801bab5968d0 100644
2223 --- a/drivers/net/ppp/ppp_generic.c
2224 +++ b/drivers/net/ppp/ppp_generic.c
2225 @@ -1432,6 +1432,8 @@ static void __ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb)
2226 netif_wake_queue(ppp->dev);
2227 else
2228 netif_stop_queue(ppp->dev);
2229 + } else {
2230 + kfree_skb(skb);
2231 }
2232 ppp_xmit_unlock(ppp);
2233 }
2234 diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
2235 index 7b158674ceed..43e28d2b0de7 100644
2236 --- a/drivers/net/usb/cdc_ncm.c
2237 +++ b/drivers/net/usb/cdc_ncm.c
2238 @@ -679,8 +679,12 @@ cdc_ncm_find_endpoints(struct usbnet *dev, struct usb_interface *intf)
2239 u8 ep;
2240
2241 for (ep = 0; ep < intf->cur_altsetting->desc.bNumEndpoints; ep++) {
2242 -
2243 e = intf->cur_altsetting->endpoint + ep;
2244 +
2245 + /* ignore endpoints which cannot transfer data */
2246 + if (!usb_endpoint_maxp(&e->desc))
2247 + continue;
2248 +
2249 switch (e->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
2250 case USB_ENDPOINT_XFER_INT:
2251 if (usb_endpoint_dir_in(&e->desc)) {
2252 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
2253 index a5acbcb3c044..0b5fd1499ac0 100644
2254 --- a/drivers/net/usb/usbnet.c
2255 +++ b/drivers/net/usb/usbnet.c
2256 @@ -114,6 +114,11 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
2257 int intr = 0;
2258
2259 e = alt->endpoint + ep;
2260 +
2261 + /* ignore endpoints which cannot transfer data */
2262 + if (!usb_endpoint_maxp(&e->desc))
2263 + continue;
2264 +
2265 switch (e->desc.bmAttributes) {
2266 case USB_ENDPOINT_XFER_INT:
2267 if (!usb_endpoint_dir_in(&e->desc))
2268 @@ -349,6 +354,8 @@ void usbnet_update_max_qlen(struct usbnet *dev)
2269 {
2270 enum usb_device_speed speed = dev->udev->speed;
2271
2272 + if (!dev->rx_urb_size || !dev->hard_mtu)
2273 + goto insanity;
2274 switch (speed) {
2275 case USB_SPEED_HIGH:
2276 dev->rx_qlen = MAX_QUEUE_MEMORY / dev->rx_urb_size;
2277 @@ -365,6 +372,7 @@ void usbnet_update_max_qlen(struct usbnet *dev)
2278 dev->tx_qlen = 5 * MAX_QUEUE_MEMORY / dev->hard_mtu;
2279 break;
2280 default:
2281 +insanity:
2282 dev->rx_qlen = dev->tx_qlen = 4;
2283 }
2284 }
2285 diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
2286 index a605d569f663..9d147b11ee51 100644
2287 --- a/drivers/net/wireless/marvell/libertas/if_usb.c
2288 +++ b/drivers/net/wireless/marvell/libertas/if_usb.c
2289 @@ -49,7 +49,8 @@ static const struct lbs_fw_table fw_table[] = {
2290 { MODEL_8388, "libertas/usb8388_v5.bin", NULL },
2291 { MODEL_8388, "libertas/usb8388.bin", NULL },
2292 { MODEL_8388, "usb8388.bin", NULL },
2293 - { MODEL_8682, "libertas/usb8682.bin", NULL }
2294 + { MODEL_8682, "libertas/usb8682.bin", NULL },
2295 + { 0, NULL, NULL }
2296 };
2297
2298 static struct usb_device_id if_usb_table[] = {
2299 diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
2300 index cdb7752dcbb7..446f61ba018d 100644
2301 --- a/drivers/nvme/target/admin-cmd.c
2302 +++ b/drivers/nvme/target/admin-cmd.c
2303 @@ -47,9 +47,11 @@ static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
2304 }
2305
2306 host_reads = part_stat_read(ns->bdev->bd_part, ios[READ]);
2307 - data_units_read = part_stat_read(ns->bdev->bd_part, sectors[READ]);
2308 + data_units_read = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
2309 + sectors[READ]), 1000);
2310 host_writes = part_stat_read(ns->bdev->bd_part, ios[WRITE]);
2311 - data_units_written = part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
2312 + data_units_written = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
2313 + sectors[WRITE]), 1000);
2314
2315 put_unaligned_le64(host_reads, &slog->host_reads[0]);
2316 put_unaligned_le64(data_units_read, &slog->data_units_read[0]);
2317 @@ -75,11 +77,11 @@ static u16 nvmet_get_smart_log_all(struct nvmet_req *req,
2318 rcu_read_lock();
2319 list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link) {
2320 host_reads += part_stat_read(ns->bdev->bd_part, ios[READ]);
2321 - data_units_read +=
2322 - part_stat_read(ns->bdev->bd_part, sectors[READ]);
2323 + data_units_read += DIV_ROUND_UP(
2324 + part_stat_read(ns->bdev->bd_part, sectors[READ]), 1000);
2325 host_writes += part_stat_read(ns->bdev->bd_part, ios[WRITE]);
2326 - data_units_written +=
2327 - part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
2328 + data_units_written += DIV_ROUND_UP(
2329 + part_stat_read(ns->bdev->bd_part, sectors[WRITE]), 1000);
2330
2331 }
2332 rcu_read_unlock();
2333 diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
2334 index ed92c1254cff..d842ae5310f7 100644
2335 --- a/drivers/parisc/dino.c
2336 +++ b/drivers/parisc/dino.c
2337 @@ -160,6 +160,15 @@ struct dino_device
2338 (struct dino_device *)__pdata; })
2339
2340
2341 +/* Check if PCI device is behind a Card-mode Dino. */
2342 +static int pci_dev_is_behind_card_dino(struct pci_dev *dev)
2343 +{
2344 + struct dino_device *dino_dev;
2345 +
2346 + dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge));
2347 + return is_card_dino(&dino_dev->hba.dev->id);
2348 +}
2349 +
2350 /*
2351 * Dino Configuration Space Accessor Functions
2352 */
2353 @@ -442,6 +451,21 @@ static void quirk_cirrus_cardbus(struct pci_dev *dev)
2354 }
2355 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6832, quirk_cirrus_cardbus );
2356
2357 +#ifdef CONFIG_TULIP
2358 +static void pci_fixup_tulip(struct pci_dev *dev)
2359 +{
2360 + if (!pci_dev_is_behind_card_dino(dev))
2361 + return;
2362 + if (!(pci_resource_flags(dev, 1) & IORESOURCE_MEM))
2363 + return;
2364 + pr_warn("%s: HP HSC-PCI Cards with card-mode Dino not yet supported.\n",
2365 + pci_name(dev));
2366 + /* Disable this card by zeroing the PCI resources */
2367 + memset(&dev->resource[0], 0, sizeof(dev->resource[0]));
2368 + memset(&dev->resource[1], 0, sizeof(dev->resource[1]));
2369 +}
2370 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_DEC, PCI_ANY_ID, pci_fixup_tulip);
2371 +#endif /* CONFIG_TULIP */
2372
2373 static void __init
2374 dino_bios_init(void)
2375 diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
2376 index c0fc98e03c91..85cb5b9c1b6f 100644
2377 --- a/drivers/power/supply/power_supply_sysfs.c
2378 +++ b/drivers/power/supply/power_supply_sysfs.c
2379 @@ -84,7 +84,8 @@ static ssize_t power_supply_show_property(struct device *dev,
2380 dev_dbg(dev, "driver has no data for `%s' property\n",
2381 attr->attr.name);
2382 else if (ret != -ENODEV && ret != -EAGAIN)
2383 - dev_err(dev, "driver failed to report `%s' property: %zd\n",
2384 + dev_err_ratelimited(dev,
2385 + "driver failed to report `%s' property: %zd\n",
2386 attr->attr.name, ret);
2387 return ret;
2388 }
2389 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
2390 index 18d57c0efe9f..47e6c8acd5e2 100644
2391 --- a/drivers/regulator/core.c
2392 +++ b/drivers/regulator/core.c
2393 @@ -4452,7 +4452,7 @@ static int __init regulator_init(void)
2394 /* init early to allow our consumers to complete system booting */
2395 core_initcall(regulator_init);
2396
2397 -static int __init regulator_late_cleanup(struct device *dev, void *data)
2398 +static int regulator_late_cleanup(struct device *dev, void *data)
2399 {
2400 struct regulator_dev *rdev = dev_to_rdev(dev);
2401 const struct regulator_ops *ops = rdev->desc->ops;
2402 @@ -4501,17 +4501,8 @@ unlock:
2403 return 0;
2404 }
2405
2406 -static int __init regulator_init_complete(void)
2407 +static void regulator_init_complete_work_function(struct work_struct *work)
2408 {
2409 - /*
2410 - * Since DT doesn't provide an idiomatic mechanism for
2411 - * enabling full constraints and since it's much more natural
2412 - * with DT to provide them just assume that a DT enabled
2413 - * system has full constraints.
2414 - */
2415 - if (of_have_populated_dt())
2416 - has_full_constraints = true;
2417 -
2418 /*
2419 * Regulators may had failed to resolve their input supplies
2420 * when were registered, either because the input supply was
2421 @@ -4529,6 +4520,35 @@ static int __init regulator_init_complete(void)
2422 */
2423 class_for_each_device(&regulator_class, NULL, NULL,
2424 regulator_late_cleanup);
2425 +}
2426 +
2427 +static DECLARE_DELAYED_WORK(regulator_init_complete_work,
2428 + regulator_init_complete_work_function);
2429 +
2430 +static int __init regulator_init_complete(void)
2431 +{
2432 + /*
2433 + * Since DT doesn't provide an idiomatic mechanism for
2434 + * enabling full constraints and since it's much more natural
2435 + * with DT to provide them just assume that a DT enabled
2436 + * system has full constraints.
2437 + */
2438 + if (of_have_populated_dt())
2439 + has_full_constraints = true;
2440 +
2441 + /*
2442 + * We punt completion for an arbitrary amount of time since
2443 + * systems like distros will load many drivers from userspace
2444 + * so consumers might not always be ready yet, this is
2445 + * particularly an issue with laptops where this might bounce
2446 + * the display off then on. Ideally we'd get a notification
2447 + * from userspace when this happens but we don't so just wait
2448 + * a bit and hope we waited long enough. It'd be better if
2449 + * we'd only do this on systems that need it, and a kernel
2450 + * command line option might be useful.
2451 + */
2452 + schedule_delayed_work(&regulator_init_complete_work,
2453 + msecs_to_jiffies(30000));
2454
2455 return 0;
2456 }
2457 diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c
2458 index f53e63301a20..e71117d7217b 100644
2459 --- a/drivers/regulator/lm363x-regulator.c
2460 +++ b/drivers/regulator/lm363x-regulator.c
2461 @@ -33,7 +33,7 @@
2462
2463 /* LM3632 */
2464 #define LM3632_BOOST_VSEL_MAX 0x26
2465 -#define LM3632_LDO_VSEL_MAX 0x29
2466 +#define LM3632_LDO_VSEL_MAX 0x28
2467 #define LM3632_VBOOST_MIN 4500000
2468 #define LM3632_VLDO_MIN 4000000
2469
2470 diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
2471 index c94d3390cbfc..3df434eb1474 100644
2472 --- a/fs/btrfs/ctree.c
2473 +++ b/fs/btrfs/ctree.c
2474 @@ -1406,6 +1406,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
2475 struct tree_mod_elem *tm;
2476 struct extent_buffer *eb = NULL;
2477 struct extent_buffer *eb_root;
2478 + u64 eb_root_owner = 0;
2479 struct extent_buffer *old;
2480 struct tree_mod_root *old_root = NULL;
2481 u64 old_generation = 0;
2482 @@ -1439,6 +1440,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
2483 free_extent_buffer(old);
2484 }
2485 } else if (old_root) {
2486 + eb_root_owner = btrfs_header_owner(eb_root);
2487 btrfs_tree_read_unlock(eb_root);
2488 free_extent_buffer(eb_root);
2489 eb = alloc_dummy_extent_buffer(root->fs_info, logical,
2490 @@ -1457,7 +1459,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
2491 if (old_root) {
2492 btrfs_set_header_bytenr(eb, eb->start);
2493 btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
2494 - btrfs_set_header_owner(eb, btrfs_header_owner(eb_root));
2495 + btrfs_set_header_owner(eb, eb_root_owner);
2496 btrfs_set_header_level(eb, old_root->level);
2497 btrfs_set_header_generation(eb, old_generation);
2498 }
2499 @@ -5465,6 +5467,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
2500 advance_left = advance_right = 0;
2501
2502 while (1) {
2503 + cond_resched();
2504 if (advance_left && !left_end_reached) {
2505 ret = tree_advance(left_root, left_path, &left_level,
2506 left_root_level,
2507 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
2508 index 7938c48c72ff..f3a251234474 100644
2509 --- a/fs/btrfs/extent-tree.c
2510 +++ b/fs/btrfs/extent-tree.c
2511 @@ -7571,6 +7571,14 @@ search:
2512 */
2513 if ((flags & extra) && !(block_group->flags & extra))
2514 goto loop;
2515 +
2516 + /*
2517 + * This block group has different flags than we want.
2518 + * It's possible that we have MIXED_GROUP flag but no
2519 + * block group is mixed. Just skip such block group.
2520 + */
2521 + btrfs_release_block_group(block_group, delalloc);
2522 + continue;
2523 }
2524
2525 have_block_group:
2526 diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
2527 index f25233093d68..0355e6d9e21c 100644
2528 --- a/fs/btrfs/qgroup.c
2529 +++ b/fs/btrfs/qgroup.c
2530 @@ -759,10 +759,10 @@ out:
2531 return ret;
2532 }
2533
2534 -static int update_qgroup_status_item(struct btrfs_trans_handle *trans,
2535 - struct btrfs_fs_info *fs_info,
2536 - struct btrfs_root *root)
2537 +static int update_qgroup_status_item(struct btrfs_trans_handle *trans)
2538 {
2539 + struct btrfs_fs_info *fs_info = trans->fs_info;
2540 + struct btrfs_root *quota_root = fs_info->quota_root;
2541 struct btrfs_path *path;
2542 struct btrfs_key key;
2543 struct extent_buffer *l;
2544 @@ -778,7 +778,7 @@ static int update_qgroup_status_item(struct btrfs_trans_handle *trans,
2545 if (!path)
2546 return -ENOMEM;
2547
2548 - ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
2549 + ret = btrfs_search_slot(trans, quota_root, &key, path, 0, 1);
2550 if (ret > 0)
2551 ret = -ENOENT;
2552
2553 @@ -1863,7 +1863,7 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans,
2554 fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON;
2555 spin_unlock(&fs_info->qgroup_lock);
2556
2557 - ret = update_qgroup_status_item(trans, fs_info, quota_root);
2558 + ret = update_qgroup_status_item(trans);
2559 if (ret)
2560 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
2561
2562 @@ -2380,9 +2380,6 @@ out:
2563 btrfs_free_path(path);
2564
2565 mutex_lock(&fs_info->qgroup_rescan_lock);
2566 - if (!btrfs_fs_closing(fs_info))
2567 - fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
2568 -
2569 if (err > 0 &&
2570 fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT) {
2571 fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
2572 @@ -2398,16 +2395,30 @@ out:
2573 trans = btrfs_start_transaction(fs_info->quota_root, 1);
2574 if (IS_ERR(trans)) {
2575 err = PTR_ERR(trans);
2576 + trans = NULL;
2577 btrfs_err(fs_info,
2578 "fail to start transaction for status update: %d\n",
2579 err);
2580 - goto done;
2581 }
2582 - ret = update_qgroup_status_item(trans, fs_info, fs_info->quota_root);
2583 - if (ret < 0) {
2584 - err = ret;
2585 - btrfs_err(fs_info, "fail to update qgroup status: %d", err);
2586 +
2587 + mutex_lock(&fs_info->qgroup_rescan_lock);
2588 + if (!btrfs_fs_closing(fs_info))
2589 + fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
2590 + if (trans) {
2591 + ret = update_qgroup_status_item(trans);
2592 + if (ret < 0) {
2593 + err = ret;
2594 + btrfs_err(fs_info, "fail to update qgroup status: %d",
2595 + err);
2596 + }
2597 }
2598 + fs_info->qgroup_rescan_running = false;
2599 + complete_all(&fs_info->qgroup_rescan_completion);
2600 + mutex_unlock(&fs_info->qgroup_rescan_lock);
2601 +
2602 + if (!trans)
2603 + return;
2604 +
2605 btrfs_end_transaction(trans, fs_info->quota_root);
2606
2607 if (btrfs_fs_closing(fs_info)) {
2608 @@ -2418,12 +2429,6 @@ out:
2609 } else {
2610 btrfs_err(fs_info, "qgroup scan failed with %d", err);
2611 }
2612 -
2613 -done:
2614 - mutex_lock(&fs_info->qgroup_rescan_lock);
2615 - fs_info->qgroup_rescan_running = false;
2616 - mutex_unlock(&fs_info->qgroup_rescan_lock);
2617 - complete_all(&fs_info->qgroup_rescan_completion);
2618 }
2619
2620 /*
2621 diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
2622 index f7ad2a3677be..67d9b7a277a3 100644
2623 --- a/fs/cifs/smb2ops.c
2624 +++ b/fs/cifs/smb2ops.c
2625 @@ -1419,6 +1419,11 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
2626 if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
2627 return;
2628
2629 + /* Check if the server granted an oplock rather than a lease */
2630 + if (oplock & SMB2_OPLOCK_LEVEL_EXCLUSIVE)
2631 + return smb2_set_oplock_level(cinode, oplock, epoch,
2632 + purge_cache);
2633 +
2634 if (oplock & SMB2_LEASE_READ_CACHING_HE) {
2635 new_oplock |= CIFS_CACHE_READ_FLG;
2636 strcat(message, "R");
2637 diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
2638 index 20af5187ba63..6634ad3567e0 100644
2639 --- a/fs/cifs/xattr.c
2640 +++ b/fs/cifs/xattr.c
2641 @@ -31,7 +31,7 @@
2642 #include "cifs_fs_sb.h"
2643 #include "cifs_unicode.h"
2644
2645 -#define MAX_EA_VALUE_SIZE 65535
2646 +#define MAX_EA_VALUE_SIZE CIFSMaxBufSize
2647 #define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
2648 #define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */
2649 #define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */
2650 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
2651 index b2ba9955fa11..71c68bd302c5 100644
2652 --- a/fs/ext4/extents.c
2653 +++ b/fs/ext4/extents.c
2654 @@ -3755,8 +3755,8 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle,
2655 * illegal.
2656 */
2657 if (ee_block != map->m_lblk || ee_len > map->m_len) {
2658 -#ifdef EXT4_DEBUG
2659 - ext4_warning("Inode (%ld) finished: extent logical block %llu,"
2660 +#ifdef CONFIG_EXT4_DEBUG
2661 + ext4_warning(inode->i_sb, "Inode (%ld) finished: extent logical block %llu,"
2662 " len %u; IO logical block %llu, len %u",
2663 inode->i_ino, (unsigned long long)ee_block, ee_len,
2664 (unsigned long long)map->m_lblk, map->m_len);
2665 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2666 index b8046182efb0..a73056e06bde 100644
2667 --- a/fs/ext4/inode.c
2668 +++ b/fs/ext4/inode.c
2669 @@ -3957,6 +3957,15 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
2670
2671 trace_ext4_punch_hole(inode, offset, length, 0);
2672
2673 + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
2674 + if (ext4_has_inline_data(inode)) {
2675 + down_write(&EXT4_I(inode)->i_mmap_sem);
2676 + ret = ext4_convert_inline_data(inode);
2677 + up_write(&EXT4_I(inode)->i_mmap_sem);
2678 + if (ret)
2679 + return ret;
2680 + }
2681 +
2682 /*
2683 * Write out all dirty pages to avoid race conditions
2684 * Then release them.
2685 diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
2686 index c983f7d28f03..1d5a35213810 100644
2687 --- a/fs/f2fs/segment.c
2688 +++ b/fs/f2fs/segment.c
2689 @@ -1709,11 +1709,6 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
2690 seg_i = CURSEG_I(sbi, i);
2691 segno = le32_to_cpu(ckpt->cur_data_segno[i]);
2692 blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]);
2693 - if (blk_off > ENTRIES_IN_SUM) {
2694 - f2fs_bug_on(sbi, 1);
2695 - f2fs_put_page(page, 1);
2696 - return -EFAULT;
2697 - }
2698 seg_i->next_segno = segno;
2699 reset_curseg(sbi, i, 0);
2700 seg_i->alloc_type = ckpt->alloc_type[i];
2701 @@ -2495,6 +2490,41 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi)
2702 return init_victim_secmap(sbi);
2703 }
2704
2705 +static int sanity_check_curseg(struct f2fs_sb_info *sbi)
2706 +{
2707 + int i;
2708 +
2709 + /*
2710 + * In LFS/SSR curseg, .next_blkoff should point to an unused blkaddr;
2711 + * In LFS curseg, all blkaddr after .next_blkoff should be unused.
2712 + */
2713 + for (i = 0; i < NO_CHECK_TYPE; i++) {
2714 + struct curseg_info *curseg = CURSEG_I(sbi, i);
2715 + struct seg_entry *se = get_seg_entry(sbi, curseg->segno);
2716 + unsigned int blkofs = curseg->next_blkoff;
2717 +
2718 + if (f2fs_test_bit(blkofs, se->cur_valid_map))
2719 + goto out;
2720 +
2721 + if (curseg->alloc_type == SSR)
2722 + continue;
2723 +
2724 + for (blkofs += 1; blkofs < sbi->blocks_per_seg; blkofs++) {
2725 + if (!f2fs_test_bit(blkofs, se->cur_valid_map))
2726 + continue;
2727 +out:
2728 + f2fs_msg(sbi->sb, KERN_ERR,
2729 + "Current segment's next free block offset is "
2730 + "inconsistent with bitmap, logtype:%u, "
2731 + "segno:%u, type:%u, next_blkoff:%u, blkofs:%u",
2732 + i, curseg->segno, curseg->alloc_type,
2733 + curseg->next_blkoff, blkofs);
2734 + return -EINVAL;
2735 + }
2736 + }
2737 + return 0;
2738 +}
2739 +
2740 /*
2741 * Update min, max modified time for cost-benefit GC algorithm
2742 */
2743 @@ -2588,6 +2618,10 @@ int build_segment_manager(struct f2fs_sb_info *sbi)
2744 if (err)
2745 return err;
2746
2747 + err = sanity_check_curseg(sbi);
2748 + if (err)
2749 + return err;
2750 +
2751 init_min_max_mtime(sbi);
2752 return 0;
2753 }
2754 diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
2755 index 4ebe69572475..9eff18c1f3e4 100644
2756 --- a/fs/f2fs/super.c
2757 +++ b/fs/f2fs/super.c
2758 @@ -1557,11 +1557,11 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi)
2759 }
2760 }
2761 for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) {
2762 - for (j = i; j < NR_CURSEG_DATA_TYPE; j++) {
2763 + for (j = 0; j < NR_CURSEG_DATA_TYPE; j++) {
2764 if (le32_to_cpu(ckpt->cur_node_segno[i]) ==
2765 le32_to_cpu(ckpt->cur_data_segno[j])) {
2766 f2fs_msg(sbi->sb, KERN_ERR,
2767 - "Data segment (%u) and Data segment (%u)"
2768 + "Node segment (%u) and Data segment (%u)"
2769 " has the same segno: %u", i, j,
2770 le32_to_cpu(ckpt->cur_node_segno[i]));
2771 return 1;
2772 diff --git a/fs/fuse/file.c b/fs/fuse/file.c
2773 index 72be347a0469..1b0e7b1039c1 100644
2774 --- a/fs/fuse/file.c
2775 +++ b/fs/fuse/file.c
2776 @@ -1694,6 +1694,7 @@ static int fuse_writepage(struct page *page, struct writeback_control *wbc)
2777 WARN_ON(wbc->sync_mode == WB_SYNC_ALL);
2778
2779 redirty_page_for_writepage(wbc, page);
2780 + unlock_page(page);
2781 return 0;
2782 }
2783
2784 diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
2785 index 16f6db88c8e5..804b3469669f 100644
2786 --- a/fs/overlayfs/inode.c
2787 +++ b/fs/overlayfs/inode.c
2788 @@ -234,7 +234,8 @@ static bool ovl_can_list(const char *s)
2789 return true;
2790
2791 /* Never list trusted.overlay, list other trusted for superuser only */
2792 - return !ovl_is_private_xattr(s) && capable(CAP_SYS_ADMIN);
2793 + return !ovl_is_private_xattr(s) &&
2794 + ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
2795 }
2796
2797 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
2798 diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
2799 index 8ad65d43b65d..d34085bf4a40 100644
2800 --- a/fs/xfs/libxfs/xfs_bmap.c
2801 +++ b/fs/xfs/libxfs/xfs_bmap.c
2802 @@ -4212,15 +4212,28 @@ xfs_bmapi_read(
2803 XFS_STATS_INC(mp, xs_blk_mapr);
2804
2805 ifp = XFS_IFORK_PTR(ip, whichfork);
2806 + if (!ifp) {
2807 + /* No CoW fork? Return a hole. */
2808 + if (whichfork == XFS_COW_FORK) {
2809 + mval->br_startoff = bno;
2810 + mval->br_startblock = HOLESTARTBLOCK;
2811 + mval->br_blockcount = len;
2812 + mval->br_state = XFS_EXT_NORM;
2813 + *nmap = 1;
2814 + return 0;
2815 + }
2816
2817 - /* No CoW fork? Return a hole. */
2818 - if (whichfork == XFS_COW_FORK && !ifp) {
2819 - mval->br_startoff = bno;
2820 - mval->br_startblock = HOLESTARTBLOCK;
2821 - mval->br_blockcount = len;
2822 - mval->br_state = XFS_EXT_NORM;
2823 - *nmap = 1;
2824 - return 0;
2825 + /*
2826 + * A missing attr ifork implies that the inode says we're in
2827 + * extents or btree format but failed to pass the inode fork
2828 + * verifier while trying to load it. Treat that as a file
2829 + * corruption too.
2830 + */
2831 +#ifdef DEBUG
2832 + xfs_alert(mp, "%s: inode %llu missing fork %d",
2833 + __func__, ip->i_ino, whichfork);
2834 +#endif /* DEBUG */
2835 + return -EFSCORRUPTED;
2836 }
2837
2838 if (!(ifp->if_flags & XFS_IFEXTENTS)) {
2839 diff --git a/include/linux/bug.h b/include/linux/bug.h
2840 index 292d6a10b0c2..0faae96302bd 100644
2841 --- a/include/linux/bug.h
2842 +++ b/include/linux/bug.h
2843 @@ -114,6 +114,11 @@ int is_valid_bugaddr(unsigned long addr);
2844
2845 #else /* !CONFIG_GENERIC_BUG */
2846
2847 +static inline void *find_bug(unsigned long bugaddr)
2848 +{
2849 + return NULL;
2850 +}
2851 +
2852 static inline enum bug_trap_type report_bug(unsigned long bug_addr,
2853 struct pt_regs *regs)
2854 {
2855 diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
2856 index f00fa86ac966..87733344768c 100644
2857 --- a/include/linux/quotaops.h
2858 +++ b/include/linux/quotaops.h
2859 @@ -21,7 +21,7 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
2860 /* i_mutex must being held */
2861 static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
2862 {
2863 - return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
2864 + return (ia->ia_valid & ATTR_SIZE) ||
2865 (ia->ia_valid & ATTR_UID && !uid_eq(ia->ia_uid, inode->i_uid)) ||
2866 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
2867 }
2868 diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
2869 index a42535f252b5..0638b8aeba34 100644
2870 --- a/include/rdma/ib_verbs.h
2871 +++ b/include/rdma/ib_verbs.h
2872 @@ -63,6 +63,7 @@
2873
2874 extern struct workqueue_struct *ib_wq;
2875 extern struct workqueue_struct *ib_comp_wq;
2876 +extern struct workqueue_struct *ib_comp_unbound_wq;
2877
2878 union ib_gid {
2879 u8 raw[16];
2880 @@ -1415,9 +1416,10 @@ struct ib_ah {
2881 typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
2882
2883 enum ib_poll_context {
2884 - IB_POLL_DIRECT, /* caller context, no hw completions */
2885 - IB_POLL_SOFTIRQ, /* poll from softirq context */
2886 - IB_POLL_WORKQUEUE, /* poll from workqueue */
2887 + IB_POLL_DIRECT, /* caller context, no hw completions */
2888 + IB_POLL_SOFTIRQ, /* poll from softirq context */
2889 + IB_POLL_WORKQUEUE, /* poll from workqueue */
2890 + IB_POLL_UNBOUND_WORKQUEUE, /* poll from unbound workqueue */
2891 };
2892
2893 struct ib_cq {
2894 @@ -1434,6 +1436,7 @@ struct ib_cq {
2895 struct irq_poll iop;
2896 struct work_struct work;
2897 };
2898 + struct workqueue_struct *comp_wq;
2899 };
2900
2901 struct ib_srq {
2902 diff --git a/kernel/kprobes.c b/kernel/kprobes.c
2903 index e2845dd53b30..11863e2b01c2 100644
2904 --- a/kernel/kprobes.c
2905 +++ b/kernel/kprobes.c
2906 @@ -1454,7 +1454,8 @@ static int check_kprobe_address_safe(struct kprobe *p,
2907 /* Ensure it is not in reserved area nor out of text */
2908 if (!kernel_text_address((unsigned long) p->addr) ||
2909 within_kprobe_blacklist((unsigned long) p->addr) ||
2910 - jump_label_text_reserved(p->addr, p->addr)) {
2911 + jump_label_text_reserved(p->addr, p->addr) ||
2912 + find_bug((unsigned long)p->addr)) {
2913 ret = -EINVAL;
2914 goto out;
2915 }
2916 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
2917 index 4b27aaffdf35..d7f425698a4a 100644
2918 --- a/kernel/locking/lockdep.c
2919 +++ b/kernel/locking/lockdep.c
2920 @@ -3446,6 +3446,9 @@ __lock_set_class(struct lockdep_map *lock, const char *name,
2921 unsigned int depth;
2922 int i;
2923
2924 + if (unlikely(!debug_locks))
2925 + return 0;
2926 +
2927 depth = curr->lockdep_depth;
2928 /*
2929 * This function is about (re)setting the class of a held lock,
2930 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
2931 index 27adaaab96ba..6607d77afe55 100644
2932 --- a/kernel/printk/printk.c
2933 +++ b/kernel/printk/printk.c
2934 @@ -356,7 +356,6 @@ DECLARE_WAIT_QUEUE_HEAD(log_wait);
2935 /* the next printk record to read by syslog(READ) or /proc/kmsg */
2936 static u64 syslog_seq;
2937 static u32 syslog_idx;
2938 -static enum log_flags syslog_prev;
2939 static size_t syslog_partial;
2940
2941 /* index and sequence number of the first record stored in the buffer */
2942 @@ -370,7 +369,6 @@ static u32 log_next_idx;
2943 /* the next printk record to write to the console */
2944 static u64 console_seq;
2945 static u32 console_idx;
2946 -static enum log_flags console_prev;
2947
2948 /* the next printk record to read after the last 'clear' command */
2949 static u64 clear_seq;
2950 @@ -639,27 +637,15 @@ static void append_char(char **pp, char *e, char c)
2951 }
2952
2953 static ssize_t msg_print_ext_header(char *buf, size_t size,
2954 - struct printk_log *msg, u64 seq,
2955 - enum log_flags prev_flags)
2956 + struct printk_log *msg, u64 seq)
2957 {
2958 u64 ts_usec = msg->ts_nsec;
2959 - char cont = '-';
2960
2961 do_div(ts_usec, 1000);
2962
2963 - /*
2964 - * If we couldn't merge continuation line fragments during the print,
2965 - * export the stored flags to allow an optional external merge of the
2966 - * records. Merging the records isn't always neccessarily correct, like
2967 - * when we hit a race during printing. In most cases though, it produces
2968 - * better readable output. 'c' in the record flags mark the first
2969 - * fragment of a line, '+' the following.
2970 - */
2971 - if (msg->flags & LOG_CONT)
2972 - cont = (prev_flags & LOG_CONT) ? '+' : 'c';
2973 -
2974 return scnprintf(buf, size, "%u,%llu,%llu,%c;",
2975 - (msg->facility << 3) | msg->level, seq, ts_usec, cont);
2976 + (msg->facility << 3) | msg->level, seq, ts_usec,
2977 + msg->flags & LOG_CONT ? 'c' : '-');
2978 }
2979
2980 static ssize_t msg_print_ext_body(char *buf, size_t size,
2981 @@ -714,7 +700,6 @@ static ssize_t msg_print_ext_body(char *buf, size_t size,
2982 struct devkmsg_user {
2983 u64 seq;
2984 u32 idx;
2985 - enum log_flags prev;
2986 struct ratelimit_state rs;
2987 struct mutex lock;
2988 char buf[CONSOLE_EXT_LOG_MAX];
2989 @@ -824,12 +809,11 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
2990
2991 msg = log_from_idx(user->idx);
2992 len = msg_print_ext_header(user->buf, sizeof(user->buf),
2993 - msg, user->seq, user->prev);
2994 + msg, user->seq);
2995 len += msg_print_ext_body(user->buf + len, sizeof(user->buf) - len,
2996 log_dict(msg), msg->dict_len,
2997 log_text(msg), msg->text_len);
2998
2999 - user->prev = msg->flags;
3000 user->idx = log_next(user->idx);
3001 user->seq++;
3002 raw_spin_unlock_irq(&logbuf_lock);
3003 @@ -1215,26 +1199,12 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf)
3004 return len;
3005 }
3006
3007 -static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
3008 - bool syslog, char *buf, size_t size)
3009 +static size_t msg_print_text(const struct printk_log *msg, bool syslog, char *buf, size_t size)
3010 {
3011 const char *text = log_text(msg);
3012 size_t text_size = msg->text_len;
3013 - bool prefix = true;
3014 - bool newline = true;
3015 size_t len = 0;
3016
3017 - if ((prev & LOG_CONT) && !(msg->flags & LOG_PREFIX))
3018 - prefix = false;
3019 -
3020 - if (msg->flags & LOG_CONT) {
3021 - if ((prev & LOG_CONT) && !(prev & LOG_NEWLINE))
3022 - prefix = false;
3023 -
3024 - if (!(msg->flags & LOG_NEWLINE))
3025 - newline = false;
3026 - }
3027 -
3028 do {
3029 const char *next = memchr(text, '\n', text_size);
3030 size_t text_len;
3031 @@ -1252,22 +1222,17 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
3032 text_len + 1 >= size - len)
3033 break;
3034
3035 - if (prefix)
3036 - len += print_prefix(msg, syslog, buf + len);
3037 + len += print_prefix(msg, syslog, buf + len);
3038 memcpy(buf + len, text, text_len);
3039 len += text_len;
3040 - if (next || newline)
3041 - buf[len++] = '\n';
3042 + buf[len++] = '\n';
3043 } else {
3044 /* SYSLOG_ACTION_* buffer size only calculation */
3045 - if (prefix)
3046 - len += print_prefix(msg, syslog, NULL);
3047 + len += print_prefix(msg, syslog, NULL);
3048 len += text_len;
3049 - if (next || newline)
3050 - len++;
3051 + len++;
3052 }
3053
3054 - prefix = true;
3055 text = next;
3056 } while (text);
3057
3058 @@ -1293,7 +1258,6 @@ static int syslog_print(char __user *buf, int size)
3059 /* messages are gone, move to first one */
3060 syslog_seq = log_first_seq;
3061 syslog_idx = log_first_idx;
3062 - syslog_prev = 0;
3063 syslog_partial = 0;
3064 }
3065 if (syslog_seq == log_next_seq) {
3066 @@ -1303,13 +1267,11 @@ static int syslog_print(char __user *buf, int size)
3067
3068 skip = syslog_partial;
3069 msg = log_from_idx(syslog_idx);
3070 - n = msg_print_text(msg, syslog_prev, true, text,
3071 - LOG_LINE_MAX + PREFIX_MAX);
3072 + n = msg_print_text(msg, true, text, LOG_LINE_MAX + PREFIX_MAX);
3073 if (n - syslog_partial <= size) {
3074 /* message fits into buffer, move forward */
3075 syslog_idx = log_next(syslog_idx);
3076 syslog_seq++;
3077 - syslog_prev = msg->flags;
3078 n -= syslog_partial;
3079 syslog_partial = 0;
3080 } else if (!len){
3081 @@ -1352,7 +1314,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3082 u64 next_seq;
3083 u64 seq;
3084 u32 idx;
3085 - enum log_flags prev;
3086
3087 /*
3088 * Find first record that fits, including all following records,
3089 @@ -1360,12 +1321,10 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3090 */
3091 seq = clear_seq;
3092 idx = clear_idx;
3093 - prev = 0;
3094 while (seq < log_next_seq) {
3095 struct printk_log *msg = log_from_idx(idx);
3096
3097 - len += msg_print_text(msg, prev, true, NULL, 0);
3098 - prev = msg->flags;
3099 + len += msg_print_text(msg, true, NULL, 0);
3100 idx = log_next(idx);
3101 seq++;
3102 }
3103 @@ -1373,12 +1332,10 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3104 /* move first record forward until length fits into the buffer */
3105 seq = clear_seq;
3106 idx = clear_idx;
3107 - prev = 0;
3108 while (len > size && seq < log_next_seq) {
3109 struct printk_log *msg = log_from_idx(idx);
3110
3111 - len -= msg_print_text(msg, prev, true, NULL, 0);
3112 - prev = msg->flags;
3113 + len -= msg_print_text(msg, true, NULL, 0);
3114 idx = log_next(idx);
3115 seq++;
3116 }
3117 @@ -1391,7 +1348,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3118 struct printk_log *msg = log_from_idx(idx);
3119 int textlen;
3120
3121 - textlen = msg_print_text(msg, prev, true, text,
3122 + textlen = msg_print_text(msg, true, text,
3123 LOG_LINE_MAX + PREFIX_MAX);
3124 if (textlen < 0) {
3125 len = textlen;
3126 @@ -1399,7 +1356,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3127 }
3128 idx = log_next(idx);
3129 seq++;
3130 - prev = msg->flags;
3131
3132 raw_spin_unlock_irq(&logbuf_lock);
3133 if (copy_to_user(buf + len, text, textlen))
3134 @@ -1412,7 +1368,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
3135 /* messages are gone, move to next one */
3136 seq = log_first_seq;
3137 idx = log_first_idx;
3138 - prev = 0;
3139 }
3140 }
3141 }
3142 @@ -1513,7 +1468,6 @@ int do_syslog(int type, char __user *buf, int len, int source)
3143 /* messages are gone, move to first one */
3144 syslog_seq = log_first_seq;
3145 syslog_idx = log_first_idx;
3146 - syslog_prev = 0;
3147 syslog_partial = 0;
3148 }
3149 if (source == SYSLOG_FROM_PROC) {
3150 @@ -1526,16 +1480,14 @@ int do_syslog(int type, char __user *buf, int len, int source)
3151 } else {
3152 u64 seq = syslog_seq;
3153 u32 idx = syslog_idx;
3154 - enum log_flags prev = syslog_prev;
3155
3156 error = 0;
3157 while (seq < log_next_seq) {
3158 struct printk_log *msg = log_from_idx(idx);
3159
3160 - error += msg_print_text(msg, prev, true, NULL, 0);
3161 + error += msg_print_text(msg, true, NULL, 0);
3162 idx = log_next(idx);
3163 seq++;
3164 - prev = msg->flags;
3165 }
3166 error -= syslog_partial;
3167 }
3168 @@ -1717,7 +1669,7 @@ static size_t cont_print_text(char *text, size_t size)
3169 size_t textlen = 0;
3170 size_t len;
3171
3172 - if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) {
3173 + if (cont.cons == 0) {
3174 textlen += print_time(cont.ts_nsec, text);
3175 size -= textlen;
3176 }
3177 @@ -1985,11 +1937,9 @@ static u64 syslog_seq;
3178 static u32 syslog_idx;
3179 static u64 console_seq;
3180 static u32 console_idx;
3181 -static enum log_flags syslog_prev;
3182 static u64 log_first_seq;
3183 static u32 log_first_idx;
3184 static u64 log_next_seq;
3185 -static enum log_flags console_prev;
3186 static struct cont {
3187 size_t len;
3188 size_t cons;
3189 @@ -2001,15 +1951,15 @@ static char *log_dict(const struct printk_log *msg) { return NULL; }
3190 static struct printk_log *log_from_idx(u32 idx) { return NULL; }
3191 static u32 log_next(u32 idx) { return 0; }
3192 static ssize_t msg_print_ext_header(char *buf, size_t size,
3193 - struct printk_log *msg, u64 seq,
3194 - enum log_flags prev_flags) { return 0; }
3195 + struct printk_log *msg,
3196 + u64 seq) { return 0; }
3197 static ssize_t msg_print_ext_body(char *buf, size_t size,
3198 char *dict, size_t dict_len,
3199 char *text, size_t text_len) { return 0; }
3200 static void call_console_drivers(int level,
3201 const char *ext_text, size_t ext_len,
3202 const char *text, size_t len) {}
3203 -static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
3204 +static size_t msg_print_text(const struct printk_log *msg,
3205 bool syslog, char *buf, size_t size) { return 0; }
3206 static size_t cont_print_text(char *text, size_t size) { return 0; }
3207 static bool suppress_message_printing(int level) { return false; }
3208 @@ -2397,7 +2347,6 @@ again:
3209 /* messages are gone, move to first one */
3210 console_seq = log_first_seq;
3211 console_idx = log_first_idx;
3212 - console_prev = 0;
3213 } else {
3214 len = 0;
3215 }
3216 @@ -2422,16 +2371,14 @@ skip:
3217 * will properly dump everything later.
3218 */
3219 msg->flags &= ~LOG_NOCONS;
3220 - console_prev = msg->flags;
3221 goto skip;
3222 }
3223
3224 - len += msg_print_text(msg, console_prev, false,
3225 - text + len, sizeof(text) - len);
3226 + len += msg_print_text(msg, false, text + len, sizeof(text) - len);
3227 if (nr_ext_console_drivers) {
3228 ext_len = msg_print_ext_header(ext_text,
3229 sizeof(ext_text),
3230 - msg, console_seq, console_prev);
3231 + msg, console_seq);
3232 ext_len += msg_print_ext_body(ext_text + ext_len,
3233 sizeof(ext_text) - ext_len,
3234 log_dict(msg), msg->dict_len,
3235 @@ -2439,7 +2386,6 @@ skip:
3236 }
3237 console_idx = log_next(console_idx);
3238 console_seq++;
3239 - console_prev = msg->flags;
3240 raw_spin_unlock(&logbuf_lock);
3241
3242 stop_critical_timings(); /* don't trace print latency */
3243 @@ -2734,7 +2680,6 @@ void register_console(struct console *newcon)
3244 raw_spin_lock_irqsave(&logbuf_lock, flags);
3245 console_seq = syslog_seq;
3246 console_idx = syslog_idx;
3247 - console_prev = syslog_prev;
3248 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
3249 /*
3250 * We're about to replay the log buffer. Only do this to the
3251 @@ -3084,7 +3029,7 @@ bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog,
3252 goto out;
3253
3254 msg = log_from_idx(dumper->cur_idx);
3255 - l = msg_print_text(msg, 0, syslog, line, size);
3256 + l = msg_print_text(msg, syslog, line, size);
3257
3258 dumper->cur_idx = log_next(dumper->cur_idx);
3259 dumper->cur_seq++;
3260 @@ -3153,7 +3098,6 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
3261 u32 idx;
3262 u64 next_seq;
3263 u32 next_idx;
3264 - enum log_flags prev;
3265 size_t l = 0;
3266 bool ret = false;
3267
3268 @@ -3176,27 +3120,23 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
3269 /* calculate length of entire buffer */
3270 seq = dumper->cur_seq;
3271 idx = dumper->cur_idx;
3272 - prev = 0;
3273 while (seq < dumper->next_seq) {
3274 struct printk_log *msg = log_from_idx(idx);
3275
3276 - l += msg_print_text(msg, prev, true, NULL, 0);
3277 + l += msg_print_text(msg, true, NULL, 0);
3278 idx = log_next(idx);
3279 seq++;
3280 - prev = msg->flags;
3281 }
3282
3283 /* move first record forward until length fits into the buffer */
3284 seq = dumper->cur_seq;
3285 idx = dumper->cur_idx;
3286 - prev = 0;
3287 - while (l > size && seq < dumper->next_seq) {
3288 + while (l >= size && seq < dumper->next_seq) {
3289 struct printk_log *msg = log_from_idx(idx);
3290
3291 - l -= msg_print_text(msg, prev, true, NULL, 0);
3292 + l -= msg_print_text(msg, true, NULL, 0);
3293 idx = log_next(idx);
3294 seq++;
3295 - prev = msg->flags;
3296 }
3297
3298 /* last message in next interation */
3299 @@ -3207,10 +3147,9 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
3300 while (seq < dumper->next_seq) {
3301 struct printk_log *msg = log_from_idx(idx);
3302
3303 - l += msg_print_text(msg, prev, syslog, buf + l, size - l);
3304 + l += msg_print_text(msg, syslog, buf + l, size - l);
3305 idx = log_next(idx);
3306 seq++;
3307 - prev = msg->flags;
3308 }
3309
3310 dumper->next_seq = next_seq;
3311 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3312 index 3861dd6da91e..63be0bcfa286 100644
3313 --- a/kernel/sched/core.c
3314 +++ b/kernel/sched/core.c
3315 @@ -8474,10 +8474,6 @@ static int cpu_cgroup_can_attach(struct cgroup_taskset *tset)
3316 #ifdef CONFIG_RT_GROUP_SCHED
3317 if (!sched_rt_can_attach(css_tg(css), task))
3318 return -EINVAL;
3319 -#else
3320 - /* We don't support RT-tasks being in separate groups */
3321 - if (task->sched_class != &fair_sched_class)
3322 - return -EINVAL;
3323 #endif
3324 /*
3325 * Serialize against wake_up_new_task() such that if its
3326 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
3327 index b314feaf91f4..d8afae1bd5c5 100644
3328 --- a/kernel/sched/fair.c
3329 +++ b/kernel/sched/fair.c
3330 @@ -7929,9 +7929,10 @@ more_balance:
3331 out_balanced:
3332 /*
3333 * We reach balance although we may have faced some affinity
3334 - * constraints. Clear the imbalance flag if it was set.
3335 + * constraints. Clear the imbalance flag only if other tasks got
3336 + * a chance to move and fix the imbalance.
3337 */
3338 - if (sd_parent) {
3339 + if (sd_parent && !(env.flags & LBF_ALL_PINNED)) {
3340 int *group_imbalance = &sd_parent->groups->sgc->imbalance;
3341
3342 if (*group_imbalance)
3343 diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
3344 index a0ee81f49a87..a519d3cab1a2 100644
3345 --- a/kernel/time/alarmtimer.c
3346 +++ b/kernel/time/alarmtimer.c
3347 @@ -544,7 +544,7 @@ static int alarm_timer_create(struct k_itimer *new_timer)
3348 enum alarmtimer_type type;
3349
3350 if (!alarmtimer_get_rtcdev())
3351 - return -ENOTSUPP;
3352 + return -EOPNOTSUPP;
3353
3354 if (!capable(CAP_WAKE_ALARM))
3355 return -EPERM;
3356 @@ -772,7 +772,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
3357 struct restart_block *restart;
3358
3359 if (!alarmtimer_get_rtcdev())
3360 - return -ENOTSUPP;
3361 + return -EOPNOTSUPP;
3362
3363 if (flags & ~TIMER_ABSTIME)
3364 return -EINVAL;
3365 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3366 index cbcbba028c2d..9ca63af4f37a 100644
3367 --- a/mm/memcontrol.c
3368 +++ b/mm/memcontrol.c
3369 @@ -2325,6 +2325,16 @@ int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,
3370
3371 if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
3372 !page_counter_try_charge(&memcg->kmem, nr_pages, &counter)) {
3373 +
3374 + /*
3375 + * Enforce __GFP_NOFAIL allocation because callers are not
3376 + * prepared to see failures and likely do not have any failure
3377 + * handling code.
3378 + */
3379 + if (gfp & __GFP_NOFAIL) {
3380 + page_counter_charge(&memcg->kmem, nr_pages);
3381 + return 0;
3382 + }
3383 cancel_charge(memcg, nr_pages);
3384 return -ENOMEM;
3385 }
3386 diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
3387 index e206d98b3b82..d74092cc639a 100644
3388 --- a/net/appletalk/ddp.c
3389 +++ b/net/appletalk/ddp.c
3390 @@ -1029,6 +1029,11 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
3391 */
3392 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
3393 goto out;
3394 +
3395 + rc = -EPERM;
3396 + if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
3397 + goto out;
3398 +
3399 rc = -ENOMEM;
3400 sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern);
3401 if (!sk)
3402 diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
3403 index 2772f6a13fcb..de55a3f001dc 100644
3404 --- a/net/ax25/af_ax25.c
3405 +++ b/net/ax25/af_ax25.c
3406 @@ -859,6 +859,8 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
3407 break;
3408
3409 case SOCK_RAW:
3410 + if (!capable(CAP_NET_RAW))
3411 + return -EPERM;
3412 break;
3413 default:
3414 return -ESOCKTNOSUPPORT;
3415 diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
3416 index 163a239bda91..6f78489fdb13 100644
3417 --- a/net/bluetooth/hci_event.c
3418 +++ b/net/bluetooth/hci_event.c
3419 @@ -5089,11 +5089,6 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,
3420 return send_conn_param_neg_reply(hdev, handle,
3421 HCI_ERROR_UNKNOWN_CONN_ID);
3422
3423 - if (min < hcon->le_conn_min_interval ||
3424 - max > hcon->le_conn_max_interval)
3425 - return send_conn_param_neg_reply(hdev, handle,
3426 - HCI_ERROR_INVALID_LL_PARAMS);
3427 -
3428 if (hci_check_conn_params(min, max, latency, timeout))
3429 return send_conn_param_neg_reply(hdev, handle,
3430 HCI_ERROR_INVALID_LL_PARAMS);
3431 diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
3432 index 4912e80dacef..48d23abfe799 100644
3433 --- a/net/bluetooth/l2cap_core.c
3434 +++ b/net/bluetooth/l2cap_core.c
3435 @@ -5277,14 +5277,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
3436
3437 memset(&rsp, 0, sizeof(rsp));
3438
3439 - if (min < hcon->le_conn_min_interval ||
3440 - max > hcon->le_conn_max_interval) {
3441 - BT_DBG("requested connection interval exceeds current bounds.");
3442 - err = -EINVAL;
3443 - } else {
3444 - err = hci_check_conn_params(min, max, latency, to_multiplier);
3445 - }
3446 -
3447 + err = hci_check_conn_params(min, max, latency, to_multiplier);
3448 if (err)
3449 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
3450 else
3451 diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
3452 index bf5d26d83af0..f66e4afb978a 100644
3453 --- a/net/ieee802154/socket.c
3454 +++ b/net/ieee802154/socket.c
3455 @@ -1003,6 +1003,9 @@ static int ieee802154_create(struct net *net, struct socket *sock,
3456
3457 switch (sock->type) {
3458 case SOCK_RAW:
3459 + rc = -EPERM;
3460 + if (!capable(CAP_NET_RAW))
3461 + goto out;
3462 proto = &ieee802154_raw_prot;
3463 ops = &ieee802154_raw_ops;
3464 break;
3465 diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
3466 index 6708de10a3e5..0b0de3030e0d 100644
3467 --- a/net/mac80211/ieee80211_i.h
3468 +++ b/net/mac80211/ieee80211_i.h
3469 @@ -2123,6 +2123,9 @@ void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
3470 const u8 *addr);
3471 void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
3472 void ieee80211_tdls_chsw_work(struct work_struct *wk);
3473 +void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
3474 + const u8 *peer, u16 reason);
3475 +const char *ieee80211_get_reason_code_string(u16 reason_code);
3476
3477 extern const struct ethtool_ops ieee80211_ethtool_ops;
3478
3479 diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
3480 index f462f026fc6a..c75594a12c38 100644
3481 --- a/net/mac80211/mlme.c
3482 +++ b/net/mac80211/mlme.c
3483 @@ -2755,7 +2755,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
3484 #define case_WLAN(type) \
3485 case WLAN_REASON_##type: return #type
3486
3487 -static const char *ieee80211_get_reason_code_string(u16 reason_code)
3488 +const char *ieee80211_get_reason_code_string(u16 reason_code)
3489 {
3490 switch (reason_code) {
3491 case_WLAN(UNSPECIFIED);
3492 @@ -2820,6 +2820,11 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
3493 if (len < 24 + 2)
3494 return;
3495
3496 + if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) {
3497 + ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code);
3498 + return;
3499 + }
3500 +
3501 if (ifmgd->associated &&
3502 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) {
3503 const u8 *bssid = ifmgd->associated->bssid;
3504 @@ -2869,8 +2874,14 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
3505
3506 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
3507
3508 - sdata_info(sdata, "disassociated from %pM (Reason: %u)\n",
3509 - mgmt->sa, reason_code);
3510 + if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) {
3511 + ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code);
3512 + return;
3513 + }
3514 +
3515 + sdata_info(sdata, "disassociated from %pM (Reason: %u=%s)\n",
3516 + mgmt->sa, reason_code,
3517 + ieee80211_get_reason_code_string(reason_code));
3518
3519 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
3520
3521 diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
3522 index c64ae68ae4f8..863f92c08701 100644
3523 --- a/net/mac80211/tdls.c
3524 +++ b/net/mac80211/tdls.c
3525 @@ -2001,3 +2001,26 @@ void ieee80211_tdls_chsw_work(struct work_struct *wk)
3526 }
3527 rtnl_unlock();
3528 }
3529 +
3530 +void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
3531 + const u8 *peer, u16 reason)
3532 +{
3533 + struct ieee80211_sta *sta;
3534 +
3535 + rcu_read_lock();
3536 + sta = ieee80211_find_sta(&sdata->vif, peer);
3537 + if (!sta || !sta->tdls) {
3538 + rcu_read_unlock();
3539 + return;
3540 + }
3541 + rcu_read_unlock();
3542 +
3543 + tdls_dbg(sdata, "disconnected from TDLS peer %pM (Reason: %u=%s)\n",
3544 + peer, reason,
3545 + ieee80211_get_reason_code_string(reason));
3546 +
3547 + ieee80211_tdls_oper_request(&sdata->vif, peer,
3548 + NL80211_TDLS_TEARDOWN,
3549 + WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE,
3550 + GFP_ATOMIC);
3551 +}
3552 diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
3553 index e31dea17473d..22d5a80a8f34 100644
3554 --- a/net/nfc/llcp_sock.c
3555 +++ b/net/nfc/llcp_sock.c
3556 @@ -1011,10 +1011,13 @@ static int llcp_sock_create(struct net *net, struct socket *sock,
3557 sock->type != SOCK_RAW)
3558 return -ESOCKTNOSUPPORT;
3559
3560 - if (sock->type == SOCK_RAW)
3561 + if (sock->type == SOCK_RAW) {
3562 + if (!capable(CAP_NET_RAW))
3563 + return -EPERM;
3564 sock->ops = &llcp_rawsock_ops;
3565 - else
3566 + } else {
3567 sock->ops = &llcp_sock_ops;
3568 + }
3569
3570 sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern);
3571 if (sk == NULL)
3572 diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
3573 index 453f806afe6e..0ddcc63a0247 100644
3574 --- a/net/openvswitch/datapath.c
3575 +++ b/net/openvswitch/datapath.c
3576 @@ -2218,7 +2218,7 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
3577 [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
3578 [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
3579 [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
3580 - [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 },
3581 + [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_UNSPEC },
3582 [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
3583 };
3584
3585 diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
3586 index 7b670a9a375e..ee930b3011cc 100644
3587 --- a/net/qrtr/qrtr.c
3588 +++ b/net/qrtr/qrtr.c
3589 @@ -126,6 +126,7 @@ static void __qrtr_node_release(struct kref *kref)
3590 list_del(&node->item);
3591 mutex_unlock(&qrtr_node_lock);
3592
3593 + cancel_work_sync(&node->work);
3594 skb_queue_purge(&node->rx_queue);
3595 kfree(node);
3596 }
3597 diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
3598 index e9812e21dbc9..12e3ae09c4ba 100644
3599 --- a/net/sched/sch_netem.c
3600 +++ b/net/sched/sch_netem.c
3601 @@ -711,7 +711,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
3602 int i;
3603 size_t s;
3604
3605 - if (n > NETEM_DIST_MAX)
3606 + if (!n || n > NETEM_DIST_MAX)
3607 return -EINVAL;
3608
3609 s = sizeof(struct disttable) + n * sizeof(s16);
3610 diff --git a/net/wireless/util.c b/net/wireless/util.c
3611 index 3b9a81998014..c93f333c675b 100644
3612 --- a/net/wireless/util.c
3613 +++ b/net/wireless/util.c
3614 @@ -1051,6 +1051,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
3615 }
3616
3617 cfg80211_process_rdev_events(rdev);
3618 + cfg80211_mlme_purge_registrations(dev->ieee80211_ptr);
3619 }
3620
3621 err = rdev_change_virtual_intf(rdev, dev, ntype, flags, params);
3622 diff --git a/sound/firewire/tascam/tascam-pcm.c b/sound/firewire/tascam/tascam-pcm.c
3623 index 79db1b651f5c..984749ee8145 100644
3624 --- a/sound/firewire/tascam/tascam-pcm.c
3625 +++ b/sound/firewire/tascam/tascam-pcm.c
3626 @@ -81,6 +81,9 @@ static int pcm_open(struct snd_pcm_substream *substream)
3627 goto err_locked;
3628
3629 err = snd_tscm_stream_get_clock(tscm, &clock);
3630 + if (err < 0)
3631 + goto err_locked;
3632 +
3633 if (clock != SND_TSCM_CLOCK_INTERNAL ||
3634 amdtp_stream_pcm_running(&tscm->rx_stream) ||
3635 amdtp_stream_pcm_running(&tscm->tx_stream)) {
3636 diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c
3637 index f1657a4e0621..a1308f12a65b 100644
3638 --- a/sound/firewire/tascam/tascam-stream.c
3639 +++ b/sound/firewire/tascam/tascam-stream.c
3640 @@ -9,20 +9,37 @@
3641 #include <linux/delay.h>
3642 #include "tascam.h"
3643
3644 +#define CLOCK_STATUS_MASK 0xffff0000
3645 +#define CLOCK_CONFIG_MASK 0x0000ffff
3646 +
3647 #define CALLBACK_TIMEOUT 500
3648
3649 static int get_clock(struct snd_tscm *tscm, u32 *data)
3650 {
3651 + int trial = 0;
3652 __be32 reg;
3653 int err;
3654
3655 - err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
3656 - TSCM_ADDR_BASE + TSCM_OFFSET_CLOCK_STATUS,
3657 - &reg, sizeof(reg), 0);
3658 - if (err >= 0)
3659 + while (trial++ < 5) {
3660 + err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
3661 + TSCM_ADDR_BASE + TSCM_OFFSET_CLOCK_STATUS,
3662 + &reg, sizeof(reg), 0);
3663 + if (err < 0)
3664 + return err;
3665 +
3666 *data = be32_to_cpu(reg);
3667 + if (*data & CLOCK_STATUS_MASK)
3668 + break;
3669
3670 - return err;
3671 + // In intermediate state after changing clock status.
3672 + msleep(50);
3673 + }
3674 +
3675 + // Still in the intermediate state.
3676 + if (trial >= 5)
3677 + return -EAGAIN;
3678 +
3679 + return 0;
3680 }
3681
3682 static int set_clock(struct snd_tscm *tscm, unsigned int rate,
3683 @@ -35,7 +52,7 @@ static int set_clock(struct snd_tscm *tscm, unsigned int rate,
3684 err = get_clock(tscm, &data);
3685 if (err < 0)
3686 return err;
3687 - data &= 0x0000ffff;
3688 + data &= CLOCK_CONFIG_MASK;
3689
3690 if (rate > 0) {
3691 data &= 0x000000ff;
3692 @@ -80,17 +97,14 @@ static int set_clock(struct snd_tscm *tscm, unsigned int rate,
3693
3694 int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate)
3695 {
3696 - u32 data = 0x0;
3697 - unsigned int trials = 0;
3698 + u32 data;
3699 int err;
3700
3701 - while (data == 0x0 || trials++ < 5) {
3702 - err = get_clock(tscm, &data);
3703 - if (err < 0)
3704 - return err;
3705 + err = get_clock(tscm, &data);
3706 + if (err < 0)
3707 + return err;
3708
3709 - data = (data & 0xff000000) >> 24;
3710 - }
3711 + data = (data & 0xff000000) >> 24;
3712
3713 /* Check base rate. */
3714 if ((data & 0x0f) == 0x01)
3715 diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
3716 index 00c6af2ae1c2..433f3280f709 100644
3717 --- a/sound/hda/hdac_controller.c
3718 +++ b/sound/hda/hdac_controller.c
3719 @@ -441,6 +441,8 @@ static void azx_int_disable(struct hdac_bus *bus)
3720 list_for_each_entry(azx_dev, &bus->stream_list, list)
3721 snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_INT_MASK, 0);
3722
3723 + synchronize_irq(bus->irq);
3724 +
3725 /* disable SIE for all streams */
3726 snd_hdac_chip_writeb(bus, INTCTL, 0);
3727
3728 diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
3729 index bf377dc192aa..d33e02c31712 100644
3730 --- a/sound/i2c/other/ak4xxx-adda.c
3731 +++ b/sound/i2c/other/ak4xxx-adda.c
3732 @@ -789,11 +789,12 @@ static int build_adc_controls(struct snd_akm4xxx *ak)
3733 return err;
3734
3735 memset(&knew, 0, sizeof(knew));
3736 - knew.name = ak->adc_info[mixer_ch].selector_name;
3737 - if (!knew.name) {
3738 + if (!ak->adc_info ||
3739 + !ak->adc_info[mixer_ch].selector_name) {
3740 knew.name = "Capture Channel";
3741 knew.index = mixer_ch + ak->idx_offset * 2;
3742 - }
3743 + } else
3744 + knew.name = ak->adc_info[mixer_ch].selector_name;
3745
3746 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
3747 knew.info = ak4xxx_capture_source_info;
3748 diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
3749 index 85dbe2420248..c5e82329348b 100644
3750 --- a/sound/pci/hda/hda_controller.c
3751 +++ b/sound/pci/hda/hda_controller.c
3752 @@ -866,10 +866,13 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
3753 */
3754 if (hbus->allow_bus_reset && !hbus->response_reset && !hbus->in_reset) {
3755 hbus->response_reset = 1;
3756 + dev_err(chip->card->dev,
3757 + "No response from codec, resetting bus: last cmd=0x%08x\n",
3758 + bus->last_cmd[addr]);
3759 return -EAGAIN; /* give a chance to retry */
3760 }
3761
3762 - dev_err(chip->card->dev,
3763 + dev_WARN(chip->card->dev,
3764 "azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n",
3765 bus->last_cmd[addr]);
3766 chip->single_cmd = 1;
3767 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3768 index f2f1d9fd848c..3d4ea5fd75bf 100644
3769 --- a/sound/pci/hda/hda_intel.c
3770 +++ b/sound/pci/hda/hda_intel.c
3771 @@ -1239,9 +1239,9 @@ static int azx_free(struct azx *chip)
3772 }
3773
3774 if (bus->chip_init) {
3775 + azx_stop_chip(chip);
3776 azx_clear_irq_pending(chip);
3777 azx_stop_all_streams(chip);
3778 - azx_stop_chip(chip);
3779 }
3780
3781 if (bus->irq >= 0)
3782 diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
3783 index e0fb8c6d1bc2..7d65c6df9aa8 100644
3784 --- a/sound/pci/hda/patch_analog.c
3785 +++ b/sound/pci/hda/patch_analog.c
3786 @@ -370,6 +370,7 @@ static const struct hda_fixup ad1986a_fixups[] = {
3787
3788 static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
3789 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
3790 + SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
3791 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
3792 SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
3793 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
3794 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3795 index 31322aeebcff..d45c85dcf9d9 100644
3796 --- a/sound/pci/hda/patch_realtek.c
3797 +++ b/sound/pci/hda/patch_realtek.c
3798 @@ -969,6 +969,9 @@ static const struct snd_pci_quirk beep_white_list[] = {
3799 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
3800 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
3801 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
3802 + /* blacklist -- no beep available */
3803 + SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
3804 + SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
3805 {}
3806 };
3807
3808 diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
3809 index 3dba5550a665..d81ac4e499aa 100644
3810 --- a/sound/soc/codecs/sgtl5000.c
3811 +++ b/sound/soc/codecs/sgtl5000.c
3812 @@ -987,12 +987,17 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
3813 SGTL5000_INT_OSC_EN);
3814 /* Enable VDDC charge pump */
3815 ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP;
3816 - } else if (vddio >= 3100 && vdda >= 3100) {
3817 + } else {
3818 ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP;
3819 - /* VDDC use VDDIO rail */
3820 - lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
3821 - lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
3822 - SGTL5000_VDDC_MAN_ASSN_SHIFT;
3823 + /*
3824 + * if vddio == vdda the source of charge pump should be
3825 + * assigned manually to VDDIO
3826 + */
3827 + if (vddio == vdda) {
3828 + lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
3829 + lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
3830 + SGTL5000_VDDC_MAN_ASSN_SHIFT;
3831 + }
3832 }
3833
3834 snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, lreg_ctrl);
3835 diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
3836 index 1c03490e1182..7cd2a5aed15a 100644
3837 --- a/sound/soc/fsl/fsl_ssi.c
3838 +++ b/sound/soc/fsl/fsl_ssi.c
3839 @@ -1431,6 +1431,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
3840 struct fsl_ssi_private *ssi_private;
3841 int ret = 0;
3842 struct device_node *np = pdev->dev.of_node;
3843 + struct device_node *root;
3844 const struct of_device_id *of_id;
3845 const char *p, *sprop;
3846 const uint32_t *iprop;
3847 @@ -1620,7 +1621,9 @@ static int fsl_ssi_probe(struct platform_device *pdev)
3848 * device tree. We also pass the address of the CPU DAI driver
3849 * structure.
3850 */
3851 - sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);
3852 + root = of_find_node_by_path("/");
3853 + sprop = of_get_property(root, "compatible", NULL);
3854 + of_node_put(root);
3855 /* Sometimes the compatible name has a "fsl," prefix, so we strip it. */
3856 p = strrchr(sprop, ',');
3857 if (p)
3858 diff --git a/sound/soc/intel/common/sst-ipc.c b/sound/soc/intel/common/sst-ipc.c
3859 index 6c672ac79cce..9d24cb719f69 100644
3860 --- a/sound/soc/intel/common/sst-ipc.c
3861 +++ b/sound/soc/intel/common/sst-ipc.c
3862 @@ -211,6 +211,8 @@ struct ipc_message *sst_ipc_reply_find_msg(struct sst_generic_ipc *ipc,
3863
3864 if (ipc->ops.reply_msg_match != NULL)
3865 header = ipc->ops.reply_msg_match(header, &mask);
3866 + else
3867 + mask = (u64)-1;
3868
3869 if (list_empty(&ipc->rx_list)) {
3870 dev_err(ipc->dev, "error: rx list empty but received 0x%llx\n",
3871 diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
3872 index dcf03691ebc8..d8cf37a0f696 100644
3873 --- a/sound/soc/intel/skylake/skl-nhlt.c
3874 +++ b/sound/soc/intel/skylake/skl-nhlt.c
3875 @@ -211,7 +211,7 @@ int skl_nhlt_update_topology_bin(struct skl *skl)
3876 struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
3877 struct device *dev = bus->dev;
3878
3879 - dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n",
3880 + dev_dbg(dev, "oem_id %.6s, oem_table_id %.8s oem_revision %d\n",
3881 nhlt->header.oem_id, nhlt->header.oem_table_id,
3882 nhlt->header.oem_revision);
3883
3884 diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
3885 index 6cef3977507a..67d22b4baeb0 100644
3886 --- a/sound/soc/soc-generic-dmaengine-pcm.c
3887 +++ b/sound/soc/soc-generic-dmaengine-pcm.c
3888 @@ -312,6 +312,12 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
3889
3890 if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
3891 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
3892 +
3893 + if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
3894 + strncpy(rtd->pcm->streams[i].pcm->name,
3895 + rtd->pcm->streams[i].pcm->id,
3896 + sizeof(rtd->pcm->streams[i].pcm->name));
3897 + }
3898 }
3899
3900 return 0;
3901 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3902 index 497bad9f2789..9bc995f9b4e1 100644
3903 --- a/sound/usb/pcm.c
3904 +++ b/sound/usb/pcm.c
3905 @@ -470,6 +470,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
3906 }
3907 ep = get_endpoint(alts, 1)->bEndpointAddress;
3908 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
3909 + get_endpoint(alts, 0)->bSynchAddress != 0 &&
3910 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
3911 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
3912 dev_err(&dev->dev,
3913 diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
3914 index 7851df1490e0..cc3315da6dc3 100644
3915 --- a/tools/lib/traceevent/Makefile
3916 +++ b/tools/lib/traceevent/Makefile
3917 @@ -54,15 +54,15 @@ set_plugin_dir := 1
3918
3919 # Set plugin_dir to preffered global plugin location
3920 # If we install under $HOME directory we go under
3921 -# $(HOME)/.traceevent/plugins
3922 +# $(HOME)/.local/lib/traceevent/plugins
3923 #
3924 # We dont set PLUGIN_DIR in case we install under $HOME
3925 # directory, because by default the code looks under:
3926 -# $(HOME)/.traceevent/plugins by default.
3927 +# $(HOME)/.local/lib/traceevent/plugins by default.
3928 #
3929 ifeq ($(plugin_dir),)
3930 ifeq ($(prefix),$(HOME))
3931 -override plugin_dir = $(HOME)/.traceevent/plugins
3932 +override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
3933 set_plugin_dir := 0
3934 else
3935 override plugin_dir = $(libdir)/traceevent/plugins
3936 diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c
3937 index a16756ae3526..5fe7889606a2 100644
3938 --- a/tools/lib/traceevent/event-plugin.c
3939 +++ b/tools/lib/traceevent/event-plugin.c
3940 @@ -30,7 +30,7 @@
3941 #include "event-parse.h"
3942 #include "event-utils.h"
3943
3944 -#define LOCAL_PLUGIN_DIR ".traceevent/plugins"
3945 +#define LOCAL_PLUGIN_DIR ".local/lib/traceevent/plugins/"
3946
3947 static struct registered_plugin_options {
3948 struct registered_plugin_options *next;
3949 diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
3950 index 884d4f1ed0c1..84756140a8a8 100644
3951 --- a/tools/objtool/Makefile
3952 +++ b/tools/objtool/Makefile
3953 @@ -32,7 +32,7 @@ INCLUDES := -I$(srctree)/tools/include \
3954 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
3955 -I$(srctree)/tools/objtool/arch/$(ARCH)/include
3956 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
3957 -CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
3958 +CFLAGS := -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
3959 LDFLAGS += -lelf $(LIBSUBCMD)
3960
3961 # Allow old libelf to be used: