Magellan Linux

Contents of /trunk/kernel-alx/patches-4.19/0180-4.19.81-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3477 - (show annotations) (download)
Tue Oct 29 10:31:35 2019 UTC (4 years, 6 months ago) by niro
File size: 90054 byte(s)
-linux-4.19.81
1 diff --git a/Makefile b/Makefile
2 index ced4a9fd9754..3c146e8d93dc 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 4
8 PATCHLEVEL = 19
9 -SUBLEVEL = 80
10 +SUBLEVEL = 81
11 EXTRAVERSION =
12 NAME = "People's Front"
13
14 diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
15 index d4b7c59eec68..cf1e4f747242 100644
16 --- a/arch/arm/boot/dts/am4372.dtsi
17 +++ b/arch/arm/boot/dts/am4372.dtsi
18 @@ -1142,6 +1142,8 @@
19 ti,hwmods = "dss_dispc";
20 clocks = <&disp_clk>;
21 clock-names = "fck";
22 +
23 + max-memory-bandwidth = <230000000>;
24 };
25
26 rfbi: rfbi@4832a800 {
27 diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
28 index 9ded7bf972e7..3b8fe014a3e9 100644
29 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
30 +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
31 @@ -946,7 +946,8 @@ static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = {
32 .rev_offs = 0x0000,
33 .sysc_offs = 0x0010,
34 .syss_offs = 0x0014,
35 - .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
36 + .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
37 + SYSC_HAS_RESET_STATUS,
38 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
39 SIDLE_SMART_WKUP),
40 .sysc_fields = &omap_hwmod_sysc_type2,
41 diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
42 index ca03af8fe43f..ddf96adf65ab 100644
43 --- a/arch/arm/mach-omap2/pm.c
44 +++ b/arch/arm/mach-omap2/pm.c
45 @@ -77,83 +77,6 @@ int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused)
46 return 0;
47 }
48
49 -/*
50 - * This API is to be called during init to set the various voltage
51 - * domains to the voltage as per the opp table. Typically we boot up
52 - * at the nominal voltage. So this function finds out the rate of
53 - * the clock associated with the voltage domain, finds out the correct
54 - * opp entry and sets the voltage domain to the voltage specified
55 - * in the opp entry
56 - */
57 -static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
58 - const char *oh_name)
59 -{
60 - struct voltagedomain *voltdm;
61 - struct clk *clk;
62 - struct dev_pm_opp *opp;
63 - unsigned long freq, bootup_volt;
64 - struct device *dev;
65 -
66 - if (!vdd_name || !clk_name || !oh_name) {
67 - pr_err("%s: invalid parameters\n", __func__);
68 - goto exit;
69 - }
70 -
71 - if (!strncmp(oh_name, "mpu", 3))
72 - /*
73 - * All current OMAPs share voltage rail and clock
74 - * source, so CPU0 is used to represent the MPU-SS.
75 - */
76 - dev = get_cpu_device(0);
77 - else
78 - dev = omap_device_get_by_hwmod_name(oh_name);
79 -
80 - if (IS_ERR(dev)) {
81 - pr_err("%s: Unable to get dev pointer for hwmod %s\n",
82 - __func__, oh_name);
83 - goto exit;
84 - }
85 -
86 - voltdm = voltdm_lookup(vdd_name);
87 - if (!voltdm) {
88 - pr_err("%s: unable to get vdd pointer for vdd_%s\n",
89 - __func__, vdd_name);
90 - goto exit;
91 - }
92 -
93 - clk = clk_get(NULL, clk_name);
94 - if (IS_ERR(clk)) {
95 - pr_err("%s: unable to get clk %s\n", __func__, clk_name);
96 - goto exit;
97 - }
98 -
99 - freq = clk_get_rate(clk);
100 - clk_put(clk);
101 -
102 - opp = dev_pm_opp_find_freq_ceil(dev, &freq);
103 - if (IS_ERR(opp)) {
104 - pr_err("%s: unable to find boot up OPP for vdd_%s\n",
105 - __func__, vdd_name);
106 - goto exit;
107 - }
108 -
109 - bootup_volt = dev_pm_opp_get_voltage(opp);
110 - dev_pm_opp_put(opp);
111 -
112 - if (!bootup_volt) {
113 - pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
114 - __func__, vdd_name);
115 - goto exit;
116 - }
117 -
118 - voltdm_scale(voltdm, bootup_volt);
119 - return 0;
120 -
121 -exit:
122 - pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name);
123 - return -EINVAL;
124 -}
125 -
126 #ifdef CONFIG_SUSPEND
127 static int omap_pm_enter(suspend_state_t suspend_state)
128 {
129 @@ -211,25 +134,6 @@ void omap_common_suspend_init(void *pm_suspend)
130 }
131 #endif /* CONFIG_SUSPEND */
132
133 -static void __init omap3_init_voltages(void)
134 -{
135 - if (!soc_is_omap34xx())
136 - return;
137 -
138 - omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
139 - omap2_set_init_voltage("core", "l3_ick", "l3_main");
140 -}
141 -
142 -static void __init omap4_init_voltages(void)
143 -{
144 - if (!soc_is_omap44xx())
145 - return;
146 -
147 - omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
148 - omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
149 - omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
150 -}
151 -
152 int __maybe_unused omap_pm_nop_init(void)
153 {
154 return 0;
155 @@ -249,10 +153,6 @@ int __init omap2_common_pm_late_init(void)
156 omap4_twl_init();
157 omap_voltage_late_init();
158
159 - /* Initialize the voltages */
160 - omap3_init_voltages();
161 - omap4_init_voltages();
162 -
163 /* Smartreflex device init */
164 omap_devinit_smartreflex();
165
166 diff --git a/arch/arm/xen/efi.c b/arch/arm/xen/efi.c
167 index b4d78959cadf..bc9a37b3cecd 100644
168 --- a/arch/arm/xen/efi.c
169 +++ b/arch/arm/xen/efi.c
170 @@ -31,7 +31,9 @@ void __init xen_efi_runtime_setup(void)
171 efi.get_variable = xen_efi_get_variable;
172 efi.get_next_variable = xen_efi_get_next_variable;
173 efi.set_variable = xen_efi_set_variable;
174 + efi.set_variable_nonblocking = xen_efi_set_variable;
175 efi.query_variable_info = xen_efi_query_variable_info;
176 + efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
177 efi.update_capsule = xen_efi_update_capsule;
178 efi.query_capsule_caps = xen_efi_query_capsule_caps;
179 efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
180 diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
181 index 9ccf16939d13..71888808ded7 100644
182 --- a/arch/arm64/kernel/cpu_errata.c
183 +++ b/arch/arm64/kernel/cpu_errata.c
184 @@ -23,6 +23,7 @@
185 #include <asm/cpu.h>
186 #include <asm/cputype.h>
187 #include <asm/cpufeature.h>
188 +#include <asm/smp_plat.h>
189
190 static bool __maybe_unused
191 is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
192 @@ -618,6 +619,30 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope)
193 return (need_wa > 0);
194 }
195
196 +static const __maybe_unused struct midr_range tx2_family_cpus[] = {
197 + MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
198 + MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
199 + {},
200 +};
201 +
202 +static bool __maybe_unused
203 +needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry,
204 + int scope)
205 +{
206 + int i;
207 +
208 + if (!is_affected_midr_range_list(entry, scope) ||
209 + !is_hyp_mode_available())
210 + return false;
211 +
212 + for_each_possible_cpu(i) {
213 + if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0)
214 + return true;
215 + }
216 +
217 + return false;
218 +}
219 +
220 #ifdef CONFIG_HARDEN_EL2_VECTORS
221
222 static const struct midr_range arm64_harden_el2_vectors[] = {
223 @@ -801,6 +826,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
224 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
225 .matches = has_cortex_a76_erratum_1463225,
226 },
227 +#endif
228 +#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
229 + {
230 + .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)",
231 + .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM,
232 + ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
233 + .matches = needs_tx2_tvm_workaround,
234 + },
235 #endif
236 {
237 }
238 diff --git a/arch/mips/boot/dts/qca/ar9331.dtsi b/arch/mips/boot/dts/qca/ar9331.dtsi
239 index 2bae201aa365..1c7bf11f8450 100644
240 --- a/arch/mips/boot/dts/qca/ar9331.dtsi
241 +++ b/arch/mips/boot/dts/qca/ar9331.dtsi
242 @@ -99,7 +99,7 @@
243
244 miscintc: interrupt-controller@18060010 {
245 compatible = "qca,ar7240-misc-intc";
246 - reg = <0x18060010 0x4>;
247 + reg = <0x18060010 0x8>;
248
249 interrupt-parent = <&cpuintc>;
250 interrupts = <6>;
251 diff --git a/arch/mips/loongson64/common/serial.c b/arch/mips/loongson64/common/serial.c
252 index ffefc1cb2612..98c3a7feb10f 100644
253 --- a/arch/mips/loongson64/common/serial.c
254 +++ b/arch/mips/loongson64/common/serial.c
255 @@ -110,7 +110,7 @@ static int __init serial_init(void)
256 }
257 module_init(serial_init);
258
259 -static void __init serial_exit(void)
260 +static void __exit serial_exit(void)
261 {
262 platform_device_unregister(&uart8250_device);
263 }
264 diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
265 index 355f8eadb1cd..3944c49eee0c 100644
266 --- a/arch/mips/mm/tlbex.c
267 +++ b/arch/mips/mm/tlbex.c
268 @@ -654,6 +654,13 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r,
269 int restore_scratch)
270 {
271 if (restore_scratch) {
272 + /*
273 + * Ensure the MFC0 below observes the value written to the
274 + * KScratch register by the prior MTC0.
275 + */
276 + if (scratch_reg >= 0)
277 + uasm_i_ehb(p);
278 +
279 /* Reset default page size */
280 if (PM_DEFAULT_MASK >> 16) {
281 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16);
282 @@ -668,12 +675,10 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r,
283 uasm_i_mtc0(p, 0, C0_PAGEMASK);
284 uasm_il_b(p, r, lid);
285 }
286 - if (scratch_reg >= 0) {
287 - uasm_i_ehb(p);
288 + if (scratch_reg >= 0)
289 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
290 - } else {
291 + else
292 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
293 - }
294 } else {
295 /* Reset default page size */
296 if (PM_DEFAULT_MASK >> 16) {
297 @@ -922,6 +927,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
298 }
299 if (mode != not_refill && check_for_high_segbits) {
300 uasm_l_large_segbits_fault(l, *p);
301 +
302 + if (mode == refill_scratch && scratch_reg >= 0)
303 + uasm_i_ehb(p);
304 +
305 /*
306 * We get here if we are an xsseg address, or if we are
307 * an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary.
308 @@ -938,12 +947,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
309 uasm_i_jr(p, ptr);
310
311 if (mode == refill_scratch) {
312 - if (scratch_reg >= 0) {
313 - uasm_i_ehb(p);
314 + if (scratch_reg >= 0)
315 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
316 - } else {
317 + else
318 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
319 - }
320 } else {
321 uasm_i_nop(p);
322 }
323 diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
324 index 92a9b5f12f98..f29f682352f0 100644
325 --- a/arch/parisc/mm/ioremap.c
326 +++ b/arch/parisc/mm/ioremap.c
327 @@ -3,7 +3,7 @@
328 * arch/parisc/mm/ioremap.c
329 *
330 * (C) Copyright 1995 1996 Linus Torvalds
331 - * (C) Copyright 2001-2006 Helge Deller <deller@gmx.de>
332 + * (C) Copyright 2001-2019 Helge Deller <deller@gmx.de>
333 * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
334 */
335
336 @@ -84,7 +84,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
337 addr = (void __iomem *) area->addr;
338 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
339 phys_addr, pgprot)) {
340 - vfree(addr);
341 + vunmap(addr);
342 return NULL;
343 }
344
345 @@ -92,9 +92,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
346 }
347 EXPORT_SYMBOL(__ioremap);
348
349 -void iounmap(const volatile void __iomem *addr)
350 +void iounmap(const volatile void __iomem *io_addr)
351 {
352 - if (addr > high_memory)
353 - return vfree((void *) (PAGE_MASK & (unsigned long __force) addr));
354 + unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
355 +
356 + if (is_vmalloc_addr((void *)addr))
357 + vunmap((void *)addr);
358 }
359 EXPORT_SYMBOL(iounmap);
360 diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
361 index 7685444a106b..145517934171 100644
362 --- a/arch/x86/kernel/apic/x2apic_cluster.c
363 +++ b/arch/x86/kernel/apic/x2apic_cluster.c
364 @@ -158,7 +158,8 @@ static int x2apic_dead_cpu(unsigned int dead_cpu)
365 {
366 struct cluster_mask *cmsk = per_cpu(cluster_masks, dead_cpu);
367
368 - cpumask_clear_cpu(dead_cpu, &cmsk->mask);
369 + if (cmsk)
370 + cpumask_clear_cpu(dead_cpu, &cmsk->mask);
371 free_cpumask_var(per_cpu(ipi_mask, dead_cpu));
372 return 0;
373 }
374 diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
375 index 250cfa85b633..88dc38b4a147 100644
376 --- a/arch/x86/kernel/head64.c
377 +++ b/arch/x86/kernel/head64.c
378 @@ -222,13 +222,31 @@ unsigned long __head __startup_64(unsigned long physaddr,
379 * we might write invalid pmds, when the kernel is relocated
380 * cleanup_highmap() fixes this up along with the mappings
381 * beyond _end.
382 + *
383 + * Only the region occupied by the kernel image has so far
384 + * been checked against the table of usable memory regions
385 + * provided by the firmware, so invalidate pages outside that
386 + * region. A page table entry that maps to a reserved area of
387 + * memory would allow processor speculation into that area,
388 + * and on some hardware (particularly the UV platform) even
389 + * speculative access to some reserved areas is caught as an
390 + * error, causing the BIOS to halt the system.
391 */
392
393 pmd = fixup_pointer(level2_kernel_pgt, physaddr);
394 - for (i = 0; i < PTRS_PER_PMD; i++) {
395 +
396 + /* invalidate pages before the kernel image */
397 + for (i = 0; i < pmd_index((unsigned long)_text); i++)
398 + pmd[i] &= ~_PAGE_PRESENT;
399 +
400 + /* fixup pages that are part of the kernel image */
401 + for (; i <= pmd_index((unsigned long)_end); i++)
402 if (pmd[i] & _PAGE_PRESENT)
403 pmd[i] += load_delta;
404 - }
405 +
406 + /* invalidate pages after the kernel image */
407 + for (; i < PTRS_PER_PMD; i++)
408 + pmd[i] &= ~_PAGE_PRESENT;
409
410 /*
411 * Fixup phys_base - remove the memory encryption mask to obtain
412 diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
413 index 1804b27f9632..66bcdeeee639 100644
414 --- a/arch/x86/xen/efi.c
415 +++ b/arch/x86/xen/efi.c
416 @@ -77,7 +77,9 @@ static efi_system_table_t __init *xen_efi_probe(void)
417 efi.get_variable = xen_efi_get_variable;
418 efi.get_next_variable = xen_efi_get_next_variable;
419 efi.set_variable = xen_efi_set_variable;
420 + efi.set_variable_nonblocking = xen_efi_set_variable;
421 efi.query_variable_info = xen_efi_query_variable_info;
422 + efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
423 efi.update_capsule = xen_efi_update_capsule;
424 efi.query_capsule_caps = xen_efi_query_capsule_caps;
425 efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
426 diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
427 index 04f19de46700..4092555828b1 100644
428 --- a/arch/xtensa/kernel/xtensa_ksyms.c
429 +++ b/arch/xtensa/kernel/xtensa_ksyms.c
430 @@ -119,13 +119,6 @@ EXPORT_SYMBOL(__invalidate_icache_range);
431 // FIXME EXPORT_SYMBOL(screen_info);
432 #endif
433
434 -EXPORT_SYMBOL(outsb);
435 -EXPORT_SYMBOL(outsw);
436 -EXPORT_SYMBOL(outsl);
437 -EXPORT_SYMBOL(insb);
438 -EXPORT_SYMBOL(insw);
439 -EXPORT_SYMBOL(insl);
440 -
441 extern long common_exception_return;
442 EXPORT_SYMBOL(common_exception_return);
443
444 diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h
445 index 60fac2d066cf..98caba3e962e 100644
446 --- a/block/blk-rq-qos.h
447 +++ b/block/blk-rq-qos.h
448 @@ -80,16 +80,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos)
449
450 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
451 {
452 - struct rq_qos *cur, *prev = NULL;
453 - for (cur = q->rq_qos; cur; cur = cur->next) {
454 - if (cur == rqos) {
455 - if (prev)
456 - prev->next = rqos->next;
457 - else
458 - q->rq_qos = cur;
459 + struct rq_qos **cur;
460 +
461 + for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
462 + if (*cur == rqos) {
463 + *cur = rqos->next;
464 break;
465 }
466 - prev = cur;
467 }
468 }
469
470 diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
471 index a1aa59849b96..41228e545e82 100644
472 --- a/drivers/acpi/cppc_acpi.c
473 +++ b/drivers/acpi/cppc_acpi.c
474 @@ -909,8 +909,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
475 pcc_data[pcc_ss_id]->refcount--;
476 if (!pcc_data[pcc_ss_id]->refcount) {
477 pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel);
478 - pcc_data[pcc_ss_id]->pcc_channel_acquired = 0;
479 kfree(pcc_data[pcc_ss_id]);
480 + pcc_data[pcc_ss_id] = NULL;
481 }
482 }
483 }
484 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
485 index 5d110b1362e7..fa1c5a442957 100644
486 --- a/drivers/ata/ahci.c
487 +++ b/drivers/ata/ahci.c
488 @@ -1633,7 +1633,9 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp
489 */
490 if (!id || id->vendor != PCI_VENDOR_ID_INTEL)
491 return;
492 - if (((enum board_ids) id->driver_data) < board_ahci_pcs7)
493 +
494 + /* Skip applying the quirk on Denverton and beyond */
495 + if (((enum board_ids) id->driver_data) >= board_ahci_pcs7)
496 return;
497
498 /*
499 diff --git a/drivers/base/core.c b/drivers/base/core.c
500 index fcda6313e7de..985ccced33a2 100644
501 --- a/drivers/base/core.c
502 +++ b/drivers/base/core.c
503 @@ -8,6 +8,7 @@
504 * Copyright (c) 2006 Novell, Inc.
505 */
506
507 +#include <linux/cpufreq.h>
508 #include <linux/device.h>
509 #include <linux/err.h>
510 #include <linux/fwnode.h>
511 @@ -2943,6 +2944,8 @@ void device_shutdown(void)
512 wait_for_device_probe();
513 device_block_probing();
514
515 + cpufreq_suspend();
516 +
517 spin_lock(&devices_kset->list_lock);
518 /*
519 * Walk the devices list backward, shutting down each in turn.
520 diff --git a/drivers/base/memory.c b/drivers/base/memory.c
521 index 817320c7c4c1..85ee64d0a44e 100644
522 --- a/drivers/base/memory.c
523 +++ b/drivers/base/memory.c
524 @@ -554,6 +554,9 @@ store_soft_offline_page(struct device *dev,
525 pfn >>= PAGE_SHIFT;
526 if (!pfn_valid(pfn))
527 return -ENXIO;
528 + /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */
529 + if (!pfn_to_online_page(pfn))
530 + return -EIO;
531 ret = soft_offline_page(pfn_to_page(pfn), 0);
532 return ret == 0 ? count : ret;
533 }
534 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
535 index d3213594d1a7..ace5ec65e36f 100644
536 --- a/drivers/cpufreq/cpufreq.c
537 +++ b/drivers/cpufreq/cpufreq.c
538 @@ -2578,14 +2578,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
539 }
540 EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
541
542 -/*
543 - * Stop cpufreq at shutdown to make sure it isn't holding any locks
544 - * or mutexes when secondary CPUs are halted.
545 - */
546 -static struct syscore_ops cpufreq_syscore_ops = {
547 - .shutdown = cpufreq_suspend,
548 -};
549 -
550 struct kobject *cpufreq_global_kobject;
551 EXPORT_SYMBOL(cpufreq_global_kobject);
552
553 @@ -2597,8 +2589,6 @@ static int __init cpufreq_core_init(void)
554 cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
555 BUG_ON(!cpufreq_global_kobject);
556
557 - register_syscore_ops(&cpufreq_syscore_ops);
558 -
559 return 0;
560 }
561 module_param(off, int, 0444);
562 diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
563 index 473aeec4b1da..574bce603337 100644
564 --- a/drivers/edac/ghes_edac.c
565 +++ b/drivers/edac/ghes_edac.c
566 @@ -532,7 +532,11 @@ void ghes_edac_unregister(struct ghes *ghes)
567 if (!ghes_pvt)
568 return;
569
570 + if (atomic_dec_return(&ghes_init))
571 + return;
572 +
573 mci = ghes_pvt->mci;
574 + ghes_pvt = NULL;
575 edac_mc_del_mc(mci->pdev);
576 edac_mc_free(mci);
577 }
578 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
579 index b40e9c76af0c..5e29f14f4b30 100644
580 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
581 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
582 @@ -841,6 +841,41 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
583 if (ret == -EPROBE_DEFER)
584 return ret;
585
586 +#ifdef CONFIG_DRM_AMDGPU_SI
587 + if (!amdgpu_si_support) {
588 + switch (flags & AMD_ASIC_MASK) {
589 + case CHIP_TAHITI:
590 + case CHIP_PITCAIRN:
591 + case CHIP_VERDE:
592 + case CHIP_OLAND:
593 + case CHIP_HAINAN:
594 + dev_info(&pdev->dev,
595 + "SI support provided by radeon.\n");
596 + dev_info(&pdev->dev,
597 + "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
598 + );
599 + return -ENODEV;
600 + }
601 + }
602 +#endif
603 +#ifdef CONFIG_DRM_AMDGPU_CIK
604 + if (!amdgpu_cik_support) {
605 + switch (flags & AMD_ASIC_MASK) {
606 + case CHIP_KAVERI:
607 + case CHIP_BONAIRE:
608 + case CHIP_HAWAII:
609 + case CHIP_KABINI:
610 + case CHIP_MULLINS:
611 + dev_info(&pdev->dev,
612 + "CIK support provided by radeon.\n");
613 + dev_info(&pdev->dev,
614 + "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
615 + );
616 + return -ENODEV;
617 + }
618 + }
619 +#endif
620 +
621 /* Get rid of things like offb */
622 ret = amdgpu_kick_out_firmware_fb(pdev);
623 if (ret)
624 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
625 index fc93b103f777..ba10577569f8 100644
626 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
627 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
628 @@ -87,41 +87,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
629 struct amdgpu_device *adev;
630 int r, acpi_status;
631
632 -#ifdef CONFIG_DRM_AMDGPU_SI
633 - if (!amdgpu_si_support) {
634 - switch (flags & AMD_ASIC_MASK) {
635 - case CHIP_TAHITI:
636 - case CHIP_PITCAIRN:
637 - case CHIP_VERDE:
638 - case CHIP_OLAND:
639 - case CHIP_HAINAN:
640 - dev_info(dev->dev,
641 - "SI support provided by radeon.\n");
642 - dev_info(dev->dev,
643 - "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
644 - );
645 - return -ENODEV;
646 - }
647 - }
648 -#endif
649 -#ifdef CONFIG_DRM_AMDGPU_CIK
650 - if (!amdgpu_cik_support) {
651 - switch (flags & AMD_ASIC_MASK) {
652 - case CHIP_KAVERI:
653 - case CHIP_BONAIRE:
654 - case CHIP_HAWAII:
655 - case CHIP_KABINI:
656 - case CHIP_MULLINS:
657 - dev_info(dev->dev,
658 - "CIK support provided by radeon.\n");
659 - dev_info(dev->dev,
660 - "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
661 - );
662 - return -ENODEV;
663 - }
664 - }
665 -#endif
666 -
667 adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
668 if (adev == NULL) {
669 return -ENOMEM;
670 diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
671 index e5e7e65934da..f5926bf5dabd 100644
672 --- a/drivers/gpu/drm/drm_edid.c
673 +++ b/drivers/gpu/drm/drm_edid.c
674 @@ -166,6 +166,9 @@ static const struct edid_quirk {
675 /* Medion MD 30217 PG */
676 { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 },
677
678 + /* Lenovo G50 */
679 + { "SDC", 18514, EDID_QUIRK_FORCE_6BPC },
680 +
681 /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
682 { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
683
684 diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
685 index d83310751a8e..c26f09b47ecb 100644
686 --- a/drivers/gpu/drm/radeon/radeon_drv.c
687 +++ b/drivers/gpu/drm/radeon/radeon_drv.c
688 @@ -395,19 +395,11 @@ radeon_pci_remove(struct pci_dev *pdev)
689 static void
690 radeon_pci_shutdown(struct pci_dev *pdev)
691 {
692 - struct drm_device *ddev = pci_get_drvdata(pdev);
693 -
694 /* if we are running in a VM, make sure the device
695 * torn down properly on reboot/shutdown
696 */
697 if (radeon_device_is_virtual())
698 radeon_pci_remove(pdev);
699 -
700 - /* Some adapters need to be suspended before a
701 - * shutdown occurs in order to prevent an error
702 - * during kexec.
703 - */
704 - radeon_suspend_kms(ddev, true, true, false);
705 }
706
707 static int radeon_pmops_suspend(struct device *dev)
708 diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
709 index 6fe91c1b692d..185655f22f89 100644
710 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
711 +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
712 @@ -273,15 +273,13 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
713 else
714 ret = vmf_insert_pfn(&cvma, address, pfn);
715
716 - /*
717 - * Somebody beat us to this PTE or prefaulting to
718 - * an already populated PTE, or prefaulting error.
719 - */
720 -
721 - if (unlikely((ret == VM_FAULT_NOPAGE && i > 0)))
722 - break;
723 - else if (unlikely(ret & VM_FAULT_ERROR))
724 - goto out_io_unlock;
725 + /* Never error on prefaulted PTEs */
726 + if (unlikely((ret & VM_FAULT_ERROR))) {
727 + if (i == 0)
728 + goto out_io_unlock;
729 + else
730 + break;
731 + }
732
733 address += PAGE_SIZE;
734 if (unlikely(++page_offset >= page_last))
735 diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
736 index 7b76e6f81aeb..f2fb7318abc1 100644
737 --- a/drivers/infiniband/hw/cxgb4/mem.c
738 +++ b/drivers/infiniband/hw/cxgb4/mem.c
739 @@ -274,13 +274,17 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
740 struct sk_buff *skb, struct c4iw_wr_wait *wr_waitp)
741 {
742 int err;
743 - struct fw_ri_tpte tpt;
744 + struct fw_ri_tpte *tpt;
745 u32 stag_idx;
746 static atomic_t key;
747
748 if (c4iw_fatal_error(rdev))
749 return -EIO;
750
751 + tpt = kmalloc(sizeof(*tpt), GFP_KERNEL);
752 + if (!tpt)
753 + return -ENOMEM;
754 +
755 stag_state = stag_state > 0;
756 stag_idx = (*stag) >> 8;
757
758 @@ -290,6 +294,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
759 mutex_lock(&rdev->stats.lock);
760 rdev->stats.stag.fail++;
761 mutex_unlock(&rdev->stats.lock);
762 + kfree(tpt);
763 return -ENOMEM;
764 }
765 mutex_lock(&rdev->stats.lock);
766 @@ -304,28 +309,28 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
767
768 /* write TPT entry */
769 if (reset_tpt_entry)
770 - memset(&tpt, 0, sizeof(tpt));
771 + memset(tpt, 0, sizeof(*tpt));
772 else {
773 - tpt.valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F |
774 + tpt->valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F |
775 FW_RI_TPTE_STAGKEY_V((*stag & FW_RI_TPTE_STAGKEY_M)) |
776 FW_RI_TPTE_STAGSTATE_V(stag_state) |
777 FW_RI_TPTE_STAGTYPE_V(type) | FW_RI_TPTE_PDID_V(pdid));
778 - tpt.locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) |
779 + tpt->locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) |
780 (bind_enabled ? FW_RI_TPTE_MWBINDEN_F : 0) |
781 FW_RI_TPTE_ADDRTYPE_V((zbva ? FW_RI_ZERO_BASED_TO :
782 FW_RI_VA_BASED_TO))|
783 FW_RI_TPTE_PS_V(page_size));
784 - tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32(
785 + tpt->nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32(
786 FW_RI_TPTE_PBLADDR_V(PBL_OFF(rdev, pbl_addr)>>3));
787 - tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL));
788 - tpt.va_hi = cpu_to_be32((u32)(to >> 32));
789 - tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL));
790 - tpt.dca_mwbcnt_pstag = cpu_to_be32(0);
791 - tpt.len_hi = cpu_to_be32((u32)(len >> 32));
792 + tpt->len_lo = cpu_to_be32((u32)(len & 0xffffffffUL));
793 + tpt->va_hi = cpu_to_be32((u32)(to >> 32));
794 + tpt->va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL));
795 + tpt->dca_mwbcnt_pstag = cpu_to_be32(0);
796 + tpt->len_hi = cpu_to_be32((u32)(len >> 32));
797 }
798 err = write_adapter_mem(rdev, stag_idx +
799 (rdev->lldi.vr->stag.start >> 5),
800 - sizeof(tpt), &tpt, skb, wr_waitp);
801 + sizeof(*tpt), tpt, skb, wr_waitp);
802
803 if (reset_tpt_entry) {
804 c4iw_put_resource(&rdev->resource.tpt_table, stag_idx);
805 @@ -333,6 +338,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
806 rdev->stats.stag.cur -= 32;
807 mutex_unlock(&rdev->stats.lock);
808 }
809 + kfree(tpt);
810 return err;
811 }
812
813 diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
814 index 3e9c353d82ef..a01b25facf46 100644
815 --- a/drivers/input/misc/da9063_onkey.c
816 +++ b/drivers/input/misc/da9063_onkey.c
817 @@ -248,10 +248,7 @@ static int da9063_onkey_probe(struct platform_device *pdev)
818 onkey->input->phys = onkey->phys;
819 onkey->input->dev.parent = &pdev->dev;
820
821 - if (onkey->key_power)
822 - input_set_capability(onkey->input, EV_KEY, KEY_POWER);
823 -
824 - input_set_capability(onkey->input, EV_KEY, KEY_SLEEP);
825 + input_set_capability(onkey->input, EV_KEY, KEY_POWER);
826
827 INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
828
829 diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
830 index 7fb358f96195..162526a0d463 100644
831 --- a/drivers/input/rmi4/rmi_driver.c
832 +++ b/drivers/input/rmi4/rmi_driver.c
833 @@ -149,7 +149,7 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
834 }
835
836 mutex_lock(&data->irq_mutex);
837 - bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask,
838 + bitmap_and(data->irq_status, data->irq_status, data->fn_irq_bits,
839 data->irq_count);
840 /*
841 * At this point, irq_status has all bits that are set in the
842 @@ -388,6 +388,8 @@ static int rmi_driver_set_irq_bits(struct rmi_device *rmi_dev,
843 bitmap_copy(data->current_irq_mask, data->new_irq_mask,
844 data->num_of_irq_regs);
845
846 + bitmap_or(data->fn_irq_bits, data->fn_irq_bits, mask, data->irq_count);
847 +
848 error_unlock:
849 mutex_unlock(&data->irq_mutex);
850 return error;
851 @@ -401,6 +403,8 @@ static int rmi_driver_clear_irq_bits(struct rmi_device *rmi_dev,
852 struct device *dev = &rmi_dev->dev;
853
854 mutex_lock(&data->irq_mutex);
855 + bitmap_andnot(data->fn_irq_bits,
856 + data->fn_irq_bits, mask, data->irq_count);
857 bitmap_andnot(data->new_irq_mask,
858 data->current_irq_mask, mask, data->irq_count);
859
860 diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
861 index b29a8327eed1..84ff70027c25 100644
862 --- a/drivers/md/dm-cache-target.c
863 +++ b/drivers/md/dm-cache-target.c
864 @@ -541,7 +541,7 @@ static void wake_migration_worker(struct cache *cache)
865
866 static struct dm_bio_prison_cell_v2 *alloc_prison_cell(struct cache *cache)
867 {
868 - return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOWAIT);
869 + return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOIO);
870 }
871
872 static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell_v2 *cell)
873 @@ -553,9 +553,7 @@ static struct dm_cache_migration *alloc_migration(struct cache *cache)
874 {
875 struct dm_cache_migration *mg;
876
877 - mg = mempool_alloc(&cache->migration_pool, GFP_NOWAIT);
878 - if (!mg)
879 - return NULL;
880 + mg = mempool_alloc(&cache->migration_pool, GFP_NOIO);
881
882 memset(mg, 0, sizeof(*mg));
883
884 @@ -663,10 +661,6 @@ static bool bio_detain_shared(struct cache *cache, dm_oblock_t oblock, struct bi
885 struct dm_bio_prison_cell_v2 *cell_prealloc, *cell;
886
887 cell_prealloc = alloc_prison_cell(cache); /* FIXME: allow wait if calling from worker */
888 - if (!cell_prealloc) {
889 - defer_bio(cache, bio);
890 - return false;
891 - }
892
893 build_key(oblock, end, &key);
894 r = dm_cell_get_v2(cache->prison, &key, lock_level(bio), bio, cell_prealloc, &cell);
895 @@ -1492,11 +1486,6 @@ static int mg_lock_writes(struct dm_cache_migration *mg)
896 struct dm_bio_prison_cell_v2 *prealloc;
897
898 prealloc = alloc_prison_cell(cache);
899 - if (!prealloc) {
900 - DMERR_LIMIT("%s: alloc_prison_cell failed", cache_device_name(cache));
901 - mg_complete(mg, false);
902 - return -ENOMEM;
903 - }
904
905 /*
906 * Prevent writes to the block, but allow reads to continue.
907 @@ -1534,11 +1523,6 @@ static int mg_start(struct cache *cache, struct policy_work *op, struct bio *bio
908 }
909
910 mg = alloc_migration(cache);
911 - if (!mg) {
912 - policy_complete_background_work(cache->policy, op, false);
913 - background_work_end(cache);
914 - return -ENOMEM;
915 - }
916
917 mg->op = op;
918 mg->overwrite_bio = bio;
919 @@ -1627,10 +1611,6 @@ static int invalidate_lock(struct dm_cache_migration *mg)
920 struct dm_bio_prison_cell_v2 *prealloc;
921
922 prealloc = alloc_prison_cell(cache);
923 - if (!prealloc) {
924 - invalidate_complete(mg, false);
925 - return -ENOMEM;
926 - }
927
928 build_key(mg->invalidate_oblock, oblock_succ(mg->invalidate_oblock), &key);
929 r = dm_cell_lock_v2(cache->prison, &key,
930 @@ -1668,10 +1648,6 @@ static int invalidate_start(struct cache *cache, dm_cblock_t cblock,
931 return -EPERM;
932
933 mg = alloc_migration(cache);
934 - if (!mg) {
935 - background_work_end(cache);
936 - return -ENOMEM;
937 - }
938
939 mg->overwrite_bio = bio;
940 mg->invalidate_cblock = cblock;
941 diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
942 index 43fa7dbf844b..3cafbfd655f5 100644
943 --- a/drivers/md/raid0.c
944 +++ b/drivers/md/raid0.c
945 @@ -158,7 +158,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
946 } else {
947 pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
948 mdname(mddev));
949 - pr_err("md/raid0: please set raid.default_layout to 1 or 2\n");
950 + pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
951 err = -ENOTSUPP;
952 goto abort;
953 }
954 diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
955 index bcdca9fbef51..29f5021d21ea 100644
956 --- a/drivers/memstick/host/jmb38x_ms.c
957 +++ b/drivers/memstick/host/jmb38x_ms.c
958 @@ -949,7 +949,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev,
959 if (!cnt) {
960 rc = -ENODEV;
961 pci_dev_busy = 1;
962 - goto err_out;
963 + goto err_out_int;
964 }
965
966 jm = kzalloc(sizeof(struct jmb38x_ms)
967 diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
968 index a8af682a9182..28f5aaca505a 100644
969 --- a/drivers/mmc/host/cqhci.c
970 +++ b/drivers/mmc/host/cqhci.c
971 @@ -617,7 +617,8 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
972 cq_host->slot[tag].flags = 0;
973
974 cq_host->qcnt += 1;
975 -
976 + /* Make sure descriptors are ready before ringing the doorbell */
977 + wmb();
978 cqhci_writel(cq_host, 1 << tag, CQHCI_TDBR);
979 if (!(cqhci_readl(cq_host, CQHCI_TDBR) & (1 << tag)))
980 pr_debug("%s: cqhci: doorbell not set for tag %d\n",
981 diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
982 index bdd8f2df6630..33232cc9fb04 100644
983 --- a/drivers/net/dsa/qca8k.c
984 +++ b/drivers/net/dsa/qca8k.c
985 @@ -543,7 +543,7 @@ qca8k_setup(struct dsa_switch *ds)
986 BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
987
988 /* Setup connection between CPU port & user ports */
989 - for (i = 0; i < DSA_MAX_PORTS; i++) {
990 + for (i = 0; i < QCA8K_NUM_PORTS; i++) {
991 /* CPU port gets connected to all user ports of the switch */
992 if (dsa_is_cpu_port(ds, i)) {
993 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
994 @@ -897,7 +897,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
995 if (id != QCA8K_ID_QCA8337)
996 return -ENODEV;
997
998 - priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
999 + priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
1000 if (!priv->ds)
1001 return -ENOMEM;
1002
1003 diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
1004 index a4d5049df692..f4b14b6acd22 100644
1005 --- a/drivers/net/dsa/rtl8366rb.c
1006 +++ b/drivers/net/dsa/rtl8366rb.c
1007 @@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
1008 irq = of_irq_get(intc, 0);
1009 if (irq <= 0) {
1010 dev_err(smi->dev, "failed to get parent IRQ\n");
1011 - return irq ? irq : -EINVAL;
1012 + ret = irq ? irq : -EINVAL;
1013 + goto out_put_node;
1014 }
1015
1016 /* This clears the IRQ status register */
1017 @@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
1018 &val);
1019 if (ret) {
1020 dev_err(smi->dev, "can't read interrupt status\n");
1021 - return ret;
1022 + goto out_put_node;
1023 }
1024
1025 /* Fetch IRQ edge information from the descriptor */
1026 @@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
1027 val);
1028 if (ret) {
1029 dev_err(smi->dev, "could not configure IRQ polarity\n");
1030 - return ret;
1031 + goto out_put_node;
1032 }
1033
1034 ret = devm_request_threaded_irq(smi->dev, irq, NULL,
1035 @@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
1036 "RTL8366RB", smi);
1037 if (ret) {
1038 dev_err(smi->dev, "unable to request irq: %d\n", ret);
1039 - return ret;
1040 + goto out_put_node;
1041 }
1042 smi->irqdomain = irq_domain_add_linear(intc,
1043 RTL8366RB_NUM_INTERRUPT,
1044 @@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
1045 smi);
1046 if (!smi->irqdomain) {
1047 dev_err(smi->dev, "failed to create IRQ domain\n");
1048 - return -EINVAL;
1049 + ret = -EINVAL;
1050 + goto out_put_node;
1051 }
1052 for (i = 0; i < smi->num_ports; i++)
1053 irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq);
1054
1055 - return 0;
1056 +out_put_node:
1057 + of_node_put(intc);
1058 + return ret;
1059 }
1060
1061 static int rtl8366rb_set_addr(struct realtek_smi *smi)
1062 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1063 index 14b49612aa86..4dabf37319c8 100644
1064 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1065 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1066 @@ -369,6 +369,7 @@ struct bcmgenet_mib_counters {
1067 #define EXT_PWR_DOWN_PHY_EN (1 << 20)
1068
1069 #define EXT_RGMII_OOB_CTRL 0x0C
1070 +#define RGMII_MODE_EN_V123 (1 << 0)
1071 #define RGMII_LINK (1 << 4)
1072 #define OOB_DISABLE (1 << 5)
1073 #define RGMII_MODE_EN (1 << 6)
1074 diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1075 index de0e24d912fe..0d527fa5de61 100644
1076 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
1077 +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1078 @@ -261,7 +261,11 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
1079 */
1080 if (priv->ext_phy) {
1081 reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
1082 - reg |= RGMII_MODE_EN | id_mode_dis;
1083 + reg |= id_mode_dis;
1084 + if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
1085 + reg |= RGMII_MODE_EN_V123;
1086 + else
1087 + reg |= RGMII_MODE_EN;
1088 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
1089 }
1090
1091 @@ -276,11 +280,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
1092 struct bcmgenet_priv *priv = netdev_priv(dev);
1093 struct device_node *dn = priv->pdev->dev.of_node;
1094 struct phy_device *phydev;
1095 - u32 phy_flags;
1096 + u32 phy_flags = 0;
1097 int ret;
1098
1099 /* Communicate the integrated PHY revision */
1100 - phy_flags = priv->gphy_rev;
1101 + if (priv->internal_phy)
1102 + phy_flags = priv->gphy_rev;
1103
1104 /* Initialize link state variables that bcmgenet_mii_setup() uses */
1105 priv->old_link = -1;
1106 diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
1107 index baf5cc251f32..9a3bc0994a1d 100644
1108 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c
1109 +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
1110 @@ -156,11 +156,15 @@ static int mdio_sc_cfg_reg_write(struct hns_mdio_device *mdio_dev,
1111 {
1112 u32 time_cnt;
1113 u32 reg_value;
1114 + int ret;
1115
1116 regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val);
1117
1118 for (time_cnt = MDIO_TIMEOUT; time_cnt; time_cnt--) {
1119 - regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
1120 + ret = regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
1121 + if (ret)
1122 + return ret;
1123 +
1124 reg_value &= st_msk;
1125 if ((!!check_st) == (!!reg_value))
1126 break;
1127 diff --git a/drivers/net/ethernet/i825xx/lasi_82596.c b/drivers/net/ethernet/i825xx/lasi_82596.c
1128 index b69c622ba8b2..6f0e4019adef 100644
1129 --- a/drivers/net/ethernet/i825xx/lasi_82596.c
1130 +++ b/drivers/net/ethernet/i825xx/lasi_82596.c
1131 @@ -96,6 +96,8 @@
1132
1133 #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */
1134
1135 +#define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT
1136 +
1137 #define DMA_WBACK(ndev, addr, len) \
1138 do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
1139
1140 @@ -199,7 +201,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev)
1141
1142 unregister_netdev (dev);
1143 dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
1144 - lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
1145 + lp->dma_addr, LIB82596_DMA_ATTR);
1146 free_netdev (dev);
1147 return 0;
1148 }
1149 diff --git a/drivers/net/ethernet/i825xx/lib82596.c b/drivers/net/ethernet/i825xx/lib82596.c
1150 index 2f7ae118217f..d0e8193ca470 100644
1151 --- a/drivers/net/ethernet/i825xx/lib82596.c
1152 +++ b/drivers/net/ethernet/i825xx/lib82596.c
1153 @@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev)
1154
1155 dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
1156 &lp->dma_addr, GFP_KERNEL,
1157 - DMA_ATTR_NON_CONSISTENT);
1158 + LIB82596_DMA_ATTR);
1159 if (!dma) {
1160 printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
1161 return -ENOMEM;
1162 @@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev)
1163 i = register_netdev(dev);
1164 if (i) {
1165 dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
1166 - dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
1167 + dma, lp->dma_addr, LIB82596_DMA_ATTR);
1168 return i;
1169 }
1170
1171 diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c
1172 index b2c04a789744..43c1fd18670b 100644
1173 --- a/drivers/net/ethernet/i825xx/sni_82596.c
1174 +++ b/drivers/net/ethernet/i825xx/sni_82596.c
1175 @@ -23,6 +23,8 @@
1176
1177 static const char sni_82596_string[] = "snirm_82596";
1178
1179 +#define LIB82596_DMA_ATTR 0
1180 +
1181 #define DMA_WBACK(priv, addr, len) do { } while (0)
1182 #define DMA_INV(priv, addr, len) do { } while (0)
1183 #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
1184 @@ -151,7 +153,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev)
1185
1186 unregister_netdev(dev);
1187 dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
1188 - lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
1189 + lp->dma_addr, LIB82596_DMA_ATTR);
1190 iounmap(lp->ca);
1191 iounmap(lp->mpu_port);
1192 free_netdev (dev);
1193 diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1194 index aa067a7a72d4..8fa14736449b 100644
1195 --- a/drivers/net/ethernet/ibm/ibmvnic.c
1196 +++ b/drivers/net/ethernet/ibm/ibmvnic.c
1197 @@ -2731,12 +2731,10 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,
1198
1199 if (adapter->resetting &&
1200 adapter->reset_reason == VNIC_RESET_MOBILITY) {
1201 - u64 val = (0xff000000) | scrq->hw_irq;
1202 + struct irq_desc *desc = irq_to_desc(scrq->irq);
1203 + struct irq_chip *chip = irq_desc_get_chip(desc);
1204
1205 - rc = plpar_hcall_norets(H_EOI, val);
1206 - if (rc)
1207 - dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n",
1208 - val, rc);
1209 + chip->irq_eoi(&desc->irq_data);
1210 }
1211
1212 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
1213 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1214 index 0101ebaecf02..014fe93ed2d8 100644
1215 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1216 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1217 @@ -4522,8 +4522,10 @@ int stmmac_suspend(struct device *dev)
1218 stmmac_mac_set(priv, priv->ioaddr, false);
1219 pinctrl_pm_select_sleep_state(priv->device);
1220 /* Disable clock in case of PWM is off */
1221 - clk_disable(priv->plat->pclk);
1222 - clk_disable(priv->plat->stmmac_clk);
1223 + if (priv->plat->clk_ptp_ref)
1224 + clk_disable_unprepare(priv->plat->clk_ptp_ref);
1225 + clk_disable_unprepare(priv->plat->pclk);
1226 + clk_disable_unprepare(priv->plat->stmmac_clk);
1227 }
1228 mutex_unlock(&priv->lock);
1229
1230 @@ -4588,8 +4590,10 @@ int stmmac_resume(struct device *dev)
1231 } else {
1232 pinctrl_pm_select_default_state(priv->device);
1233 /* enable the clk previously disabled */
1234 - clk_enable(priv->plat->stmmac_clk);
1235 - clk_enable(priv->plat->pclk);
1236 + clk_prepare_enable(priv->plat->stmmac_clk);
1237 + clk_prepare_enable(priv->plat->pclk);
1238 + if (priv->plat->clk_ptp_ref)
1239 + clk_prepare_enable(priv->plat->clk_ptp_ref);
1240 /* reset the phy so that it's ready */
1241 if (priv->mii)
1242 stmmac_mdio_reset(priv->mii);
1243 diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
1244 index b2ff903a9cb6..38a41651e451 100644
1245 --- a/drivers/net/ieee802154/ca8210.c
1246 +++ b/drivers/net/ieee802154/ca8210.c
1247 @@ -3151,12 +3151,12 @@ static int ca8210_probe(struct spi_device *spi_device)
1248 goto error;
1249 }
1250
1251 + priv->spi->dev.platform_data = pdata;
1252 ret = ca8210_get_platform_data(priv->spi, pdata);
1253 if (ret) {
1254 dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
1255 goto error;
1256 }
1257 - priv->spi->dev.platform_data = pdata;
1258
1259 ret = ca8210_dev_com_init(priv);
1260 if (ret) {
1261 diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1262 index a065a6184f7e..a291e5f2daef 100644
1263 --- a/drivers/net/usb/r8152.c
1264 +++ b/drivers/net/usb/r8152.c
1265 @@ -4474,10 +4474,9 @@ static int rtl8152_reset_resume(struct usb_interface *intf)
1266 struct r8152 *tp = usb_get_intfdata(intf);
1267
1268 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
1269 - mutex_lock(&tp->control);
1270 tp->rtl_ops.init(tp);
1271 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
1272 - mutex_unlock(&tp->control);
1273 + set_ethernet_addr(tp);
1274 return rtl8152_resume(intf);
1275 }
1276
1277 diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
1278 index 82add0ac4a5f..27b6b141cb71 100644
1279 --- a/drivers/net/xen-netback/interface.c
1280 +++ b/drivers/net/xen-netback/interface.c
1281 @@ -718,7 +718,6 @@ err_unmap:
1282 xenvif_unmap_frontend_data_rings(queue);
1283 netif_napi_del(&queue->napi);
1284 err:
1285 - module_put(THIS_MODULE);
1286 return err;
1287 }
1288
1289 diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
1290 index ae0b01059fc6..5d0f99bcc987 100644
1291 --- a/drivers/nvme/host/core.c
1292 +++ b/drivers/nvme/host/core.c
1293 @@ -111,10 +111,13 @@ static void nvme_set_queue_dying(struct nvme_ns *ns)
1294 */
1295 if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags))
1296 return;
1297 - revalidate_disk(ns->disk);
1298 blk_set_queue_dying(ns->queue);
1299 /* Forcibly unquiesce queues to avoid blocking dispatch */
1300 blk_mq_unquiesce_queue(ns->queue);
1301 + /*
1302 + * Revalidate after unblocking dispatchers that may be holding bd_butex
1303 + */
1304 + revalidate_disk(ns->disk);
1305 }
1306
1307 static void nvme_queue_scan(struct nvme_ctrl *ctrl)
1308 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1309 index 6384930a6749..2baf1f82f893 100644
1310 --- a/drivers/pci/pci.c
1311 +++ b/drivers/pci/pci.c
1312 @@ -925,19 +925,6 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
1313 }
1314 }
1315
1316 -/**
1317 - * pci_power_up - Put the given device into D0 forcibly
1318 - * @dev: PCI device to power up
1319 - */
1320 -void pci_power_up(struct pci_dev *dev)
1321 -{
1322 - if (platform_pci_power_manageable(dev))
1323 - platform_pci_set_power_state(dev, PCI_D0);
1324 -
1325 - pci_raw_set_power_state(dev, PCI_D0);
1326 - pci_update_current_state(dev, PCI_D0);
1327 -}
1328 -
1329 /**
1330 * pci_platform_power_transition - Use platform to change device power state
1331 * @dev: PCI device to handle.
1332 @@ -1116,6 +1103,17 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1333 }
1334 EXPORT_SYMBOL(pci_set_power_state);
1335
1336 +/**
1337 + * pci_power_up - Put the given device into D0 forcibly
1338 + * @dev: PCI device to power up
1339 + */
1340 +void pci_power_up(struct pci_dev *dev)
1341 +{
1342 + __pci_start_power_transition(dev, PCI_D0);
1343 + pci_raw_set_power_state(dev, PCI_D0);
1344 + pci_update_current_state(dev, PCI_D0);
1345 +}
1346 +
1347 /**
1348 * pci_choose_state - Choose the power state of a PCI device
1349 * @dev: PCI device to be suspended
1350 diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
1351 index b7e272d6ae81..227646eb817c 100644
1352 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c
1353 +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
1354 @@ -1524,7 +1524,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
1355 .matches = {
1356 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
1357 DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"),
1358 - DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
1359 },
1360 },
1361 {
1362 @@ -1532,7 +1531,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
1363 .matches = {
1364 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
1365 DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
1366 - DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
1367 },
1368 },
1369 {
1370 @@ -1540,7 +1538,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
1371 .matches = {
1372 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
1373 DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"),
1374 - DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
1375 },
1376 },
1377 {
1378 @@ -1548,7 +1545,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
1379 .matches = {
1380 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
1381 DMI_MATCH(DMI_PRODUCT_NAME, "Celes"),
1382 - DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
1383 },
1384 },
1385 {}
1386 diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
1387 index aa48b3f23c7f..3aac640596ad 100644
1388 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
1389 +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
1390 @@ -183,10 +183,10 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = {
1391 PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19),
1392 BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19),
1393 18, 2, "gpio", "uart"),
1394 - PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"),
1395 - PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"),
1396 - PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"),
1397 - PIN_GRP_GPIO("led3_od", 14, 1, BIT(23), "led"),
1398 + PIN_GRP_GPIO_2("led0_od", 11, 1, BIT(20), BIT(20), 0, "led"),
1399 + PIN_GRP_GPIO_2("led1_od", 12, 1, BIT(21), BIT(21), 0, "led"),
1400 + PIN_GRP_GPIO_2("led2_od", 13, 1, BIT(22), BIT(22), 0, "led"),
1401 + PIN_GRP_GPIO_2("led3_od", 14, 1, BIT(23), BIT(23), 0, "led"),
1402
1403 };
1404
1405 @@ -218,11 +218,11 @@ static const struct armada_37xx_pin_data armada_37xx_pin_sb = {
1406 };
1407
1408 static inline void armada_37xx_update_reg(unsigned int *reg,
1409 - unsigned int offset)
1410 + unsigned int *offset)
1411 {
1412 /* We never have more than 2 registers */
1413 - if (offset >= GPIO_PER_REG) {
1414 - offset -= GPIO_PER_REG;
1415 + if (*offset >= GPIO_PER_REG) {
1416 + *offset -= GPIO_PER_REG;
1417 *reg += sizeof(u32);
1418 }
1419 }
1420 @@ -373,7 +373,7 @@ static inline void armada_37xx_irq_update_reg(unsigned int *reg,
1421 {
1422 int offset = irqd_to_hwirq(d);
1423
1424 - armada_37xx_update_reg(reg, offset);
1425 + armada_37xx_update_reg(reg, &offset);
1426 }
1427
1428 static int armada_37xx_gpio_direction_input(struct gpio_chip *chip,
1429 @@ -383,7 +383,7 @@ static int armada_37xx_gpio_direction_input(struct gpio_chip *chip,
1430 unsigned int reg = OUTPUT_EN;
1431 unsigned int mask;
1432
1433 - armada_37xx_update_reg(&reg, offset);
1434 + armada_37xx_update_reg(&reg, &offset);
1435 mask = BIT(offset);
1436
1437 return regmap_update_bits(info->regmap, reg, mask, 0);
1438 @@ -396,7 +396,7 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip,
1439 unsigned int reg = OUTPUT_EN;
1440 unsigned int val, mask;
1441
1442 - armada_37xx_update_reg(&reg, offset);
1443 + armada_37xx_update_reg(&reg, &offset);
1444 mask = BIT(offset);
1445 regmap_read(info->regmap, reg, &val);
1446
1447 @@ -410,7 +410,7 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip,
1448 unsigned int reg = OUTPUT_EN;
1449 unsigned int mask, val, ret;
1450
1451 - armada_37xx_update_reg(&reg, offset);
1452 + armada_37xx_update_reg(&reg, &offset);
1453 mask = BIT(offset);
1454
1455 ret = regmap_update_bits(info->regmap, reg, mask, mask);
1456 @@ -431,7 +431,7 @@ static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
1457 unsigned int reg = INPUT_VAL;
1458 unsigned int val, mask;
1459
1460 - armada_37xx_update_reg(&reg, offset);
1461 + armada_37xx_update_reg(&reg, &offset);
1462 mask = BIT(offset);
1463
1464 regmap_read(info->regmap, reg, &val);
1465 @@ -446,7 +446,7 @@ static void armada_37xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
1466 unsigned int reg = OUTPUT_VAL;
1467 unsigned int mask, val;
1468
1469 - armada_37xx_update_reg(&reg, offset);
1470 + armada_37xx_update_reg(&reg, &offset);
1471 mask = BIT(offset);
1472 val = value ? mask : 0;
1473
1474 diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
1475 index aff073a5b52b..df888506e363 100644
1476 --- a/drivers/s390/scsi/zfcp_fsf.c
1477 +++ b/drivers/s390/scsi/zfcp_fsf.c
1478 @@ -21,6 +21,11 @@
1479
1480 struct kmem_cache *zfcp_fsf_qtcb_cache;
1481
1482 +static bool ber_stop = true;
1483 +module_param(ber_stop, bool, 0600);
1484 +MODULE_PARM_DESC(ber_stop,
1485 + "Shuts down FCP devices for FCP channels that report a bit-error count in excess of its threshold (default on)");
1486 +
1487 static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
1488 {
1489 struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
1490 @@ -230,10 +235,15 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
1491 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
1492 break;
1493 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
1494 - dev_warn(&adapter->ccw_device->dev,
1495 - "The error threshold for checksum statistics "
1496 - "has been exceeded\n");
1497 zfcp_dbf_hba_bit_err("fssrh_3", req);
1498 + if (ber_stop) {
1499 + dev_warn(&adapter->ccw_device->dev,
1500 + "All paths over this FCP device are disused because of excessive bit errors\n");
1501 + zfcp_erp_adapter_shutdown(adapter, 0, "fssrh_b");
1502 + } else {
1503 + dev_warn(&adapter->ccw_device->dev,
1504 + "The error threshold for checksum statistics has been exceeded\n");
1505 + }
1506 break;
1507 case FSF_STATUS_READ_LINK_DOWN:
1508 zfcp_fsf_status_read_link_down(req);
1509 diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
1510 index 1c5051b1c125..9e287927b7f9 100644
1511 --- a/drivers/scsi/ch.c
1512 +++ b/drivers/scsi/ch.c
1513 @@ -578,7 +578,6 @@ ch_release(struct inode *inode, struct file *file)
1514 scsi_changer *ch = file->private_data;
1515
1516 scsi_device_put(ch->device);
1517 - ch->device = NULL;
1518 file->private_data = NULL;
1519 kref_put(&ch->ref, ch_destroy);
1520 return 0;
1521 diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
1522 index 8c7154143a4e..a84878fbf45d 100644
1523 --- a/drivers/scsi/megaraid.c
1524 +++ b/drivers/scsi/megaraid.c
1525 @@ -4189,11 +4189,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1526 */
1527 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
1528 pdev->subsystem_device == 0xC000)
1529 - return -ENODEV;
1530 + goto out_disable_device;
1531 /* Now check the magic signature byte */
1532 pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
1533 if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
1534 - return -ENODEV;
1535 + goto out_disable_device;
1536 /* Ok it is probably a megaraid */
1537 }
1538
1539 diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
1540 index 7a1cc0b25e59..d6dc320f81a7 100644
1541 --- a/drivers/scsi/qla2xxx/qla_target.c
1542 +++ b/drivers/scsi/qla2xxx/qla_target.c
1543 @@ -1023,6 +1023,7 @@ void qlt_free_session_done(struct work_struct *work)
1544
1545 if (logout_started) {
1546 bool traced = false;
1547 + u16 cnt = 0;
1548
1549 while (!READ_ONCE(sess->logout_completed)) {
1550 if (!traced) {
1551 @@ -1032,6 +1033,9 @@ void qlt_free_session_done(struct work_struct *work)
1552 traced = true;
1553 }
1554 msleep(100);
1555 + cnt++;
1556 + if (cnt > 200)
1557 + break;
1558 }
1559
1560 ql_dbg(ql_dbg_disc, vha, 0xf087,
1561 diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
1562 index b7a8fdfeb2f4..e731af504f07 100644
1563 --- a/drivers/scsi/scsi_error.c
1564 +++ b/drivers/scsi/scsi_error.c
1565 @@ -970,6 +970,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
1566 ses->sdb = scmd->sdb;
1567 ses->next_rq = scmd->request->next_rq;
1568 ses->result = scmd->result;
1569 + ses->resid_len = scmd->req.resid_len;
1570 ses->underflow = scmd->underflow;
1571 ses->prot_op = scmd->prot_op;
1572 ses->eh_eflags = scmd->eh_eflags;
1573 @@ -981,6 +982,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
1574 memset(&scmd->sdb, 0, sizeof(scmd->sdb));
1575 scmd->request->next_rq = NULL;
1576 scmd->result = 0;
1577 + scmd->req.resid_len = 0;
1578
1579 if (sense_bytes) {
1580 scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
1581 @@ -1034,6 +1036,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses)
1582 scmd->sdb = ses->sdb;
1583 scmd->request->next_rq = ses->next_rq;
1584 scmd->result = ses->result;
1585 + scmd->req.resid_len = ses->resid_len;
1586 scmd->underflow = ses->underflow;
1587 scmd->prot_op = ses->prot_op;
1588 scmd->eh_eflags = ses->eh_eflags;
1589 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
1590 index 3aee9464a7bf..186f779fa60c 100644
1591 --- a/drivers/scsi/scsi_sysfs.c
1592 +++ b/drivers/scsi/scsi_sysfs.c
1593 @@ -723,6 +723,14 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr,
1594 const char *buf, size_t count)
1595 {
1596 struct kernfs_node *kn;
1597 + struct scsi_device *sdev = to_scsi_device(dev);
1598 +
1599 + /*
1600 + * We need to try to get module, avoiding the module been removed
1601 + * during delete.
1602 + */
1603 + if (scsi_device_get(sdev))
1604 + return -ENODEV;
1605
1606 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
1607 WARN_ON_ONCE(!kn);
1608 @@ -737,9 +745,10 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr,
1609 * state into SDEV_DEL.
1610 */
1611 device_remove_file(dev, attr);
1612 - scsi_remove_device(to_scsi_device(dev));
1613 + scsi_remove_device(sdev);
1614 if (kn)
1615 sysfs_unbreak_active_protection(kn);
1616 + scsi_device_put(sdev);
1617 return count;
1618 };
1619 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
1620 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
1621 index 77cb45ef55fc..f8a09e6678d4 100644
1622 --- a/drivers/scsi/sd.c
1623 +++ b/drivers/scsi/sd.c
1624 @@ -1646,7 +1646,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
1625 /* we need to evaluate the error return */
1626 if (scsi_sense_valid(sshdr) &&
1627 (sshdr->asc == 0x3a || /* medium not present */
1628 - sshdr->asc == 0x20)) /* invalid command */
1629 + sshdr->asc == 0x20 || /* invalid command */
1630 + (sshdr->asc == 0x74 && sshdr->ascq == 0x71))) /* drive is password locked */
1631 /* this is no error here */
1632 return 0;
1633
1634 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
1635 index b8b59cfeacd1..4aaba3e03055 100644
1636 --- a/drivers/scsi/ufs/ufshcd.c
1637 +++ b/drivers/scsi/ufs/ufshcd.c
1638 @@ -7874,6 +7874,9 @@ int ufshcd_shutdown(struct ufs_hba *hba)
1639 {
1640 int ret = 0;
1641
1642 + if (!hba->is_powered)
1643 + goto out;
1644 +
1645 if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
1646 goto out;
1647
1648 diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
1649 index d4cf09b11e33..095df245ced5 100644
1650 --- a/drivers/staging/wlan-ng/cfg80211.c
1651 +++ b/drivers/staging/wlan-ng/cfg80211.c
1652 @@ -476,10 +476,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
1653 /* Set the encryption - we only support wep */
1654 if (is_wep) {
1655 if (sme->key) {
1656 - if (sme->key_idx >= NUM_WEPKEYS) {
1657 - err = -EINVAL;
1658 - goto exit;
1659 - }
1660 + if (sme->key_idx >= NUM_WEPKEYS)
1661 + return -EINVAL;
1662
1663 result = prism2_domibset_uint32(wlandev,
1664 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
1665 diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
1666 index 502e9bf1746f..4a80103675d5 100644
1667 --- a/drivers/usb/class/usblp.c
1668 +++ b/drivers/usb/class/usblp.c
1669 @@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp *usblp)
1670 kfree(usblp->readbuf);
1671 kfree(usblp->device_id_string);
1672 kfree(usblp->statusbuf);
1673 + usb_put_intf(usblp->intf);
1674 kfree(usblp);
1675 }
1676
1677 @@ -1107,7 +1108,7 @@ static int usblp_probe(struct usb_interface *intf,
1678 init_waitqueue_head(&usblp->wwait);
1679 init_usb_anchor(&usblp->urbs);
1680 usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
1681 - usblp->intf = intf;
1682 + usblp->intf = usb_get_intf(intf);
1683
1684 /* Malloc device ID string buffer to the largest expected length,
1685 * since we can re-query it on an ioctl and a dynamic string
1686 @@ -1196,6 +1197,7 @@ abort:
1687 kfree(usblp->readbuf);
1688 kfree(usblp->statusbuf);
1689 kfree(usblp->device_id_string);
1690 + usb_put_intf(usblp->intf);
1691 kfree(usblp);
1692 abort_ret:
1693 return retval;
1694 diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
1695 index eafc2a00c96a..21921db068f6 100644
1696 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c
1697 +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
1698 @@ -1165,11 +1165,11 @@ static void udc_pop_fifo(struct lpc32xx_udc *udc, u8 *data, u32 bytes)
1699 tmp = readl(USBD_RXDATA(udc->udp_baseaddr));
1700
1701 bl = bytes - n;
1702 - if (bl > 3)
1703 - bl = 3;
1704 + if (bl > 4)
1705 + bl = 4;
1706
1707 for (i = 0; i < bl; i++)
1708 - data[n + i] = (u8) ((tmp >> (n * 8)) & 0xFF);
1709 + data[n + i] = (u8) ((tmp >> (i * 8)) & 0xFF);
1710 }
1711 break;
1712
1713 diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
1714 index b9cbcf35d4e1..6b3a6fd7d271 100644
1715 --- a/drivers/usb/misc/ldusb.c
1716 +++ b/drivers/usb/misc/ldusb.c
1717 @@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct file *file)
1718 goto exit;
1719 }
1720
1721 - if (mutex_lock_interruptible(&dev->mutex)) {
1722 - retval = -ERESTARTSYS;
1723 - goto exit;
1724 - }
1725 + mutex_lock(&dev->mutex);
1726
1727 if (dev->open_count != 1) {
1728 retval = -ENODEV;
1729 @@ -467,7 +464,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
1730
1731 /* wait for data */
1732 spin_lock_irq(&dev->rbsl);
1733 - if (dev->ring_head == dev->ring_tail) {
1734 + while (dev->ring_head == dev->ring_tail) {
1735 dev->interrupt_in_done = 0;
1736 spin_unlock_irq(&dev->rbsl);
1737 if (file->f_flags & O_NONBLOCK) {
1738 @@ -477,12 +474,17 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count,
1739 retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done);
1740 if (retval < 0)
1741 goto unlock_exit;
1742 - } else {
1743 - spin_unlock_irq(&dev->rbsl);
1744 +
1745 + spin_lock_irq(&dev->rbsl);
1746 }
1747 + spin_unlock_irq(&dev->rbsl);
1748
1749 /* actual_buffer contains actual_length + interrupt_in_buffer */
1750 actual_buffer = (size_t *)(dev->ring_buffer + dev->ring_tail * (sizeof(size_t)+dev->interrupt_in_endpoint_size));
1751 + if (*actual_buffer > dev->interrupt_in_endpoint_size) {
1752 + retval = -EIO;
1753 + goto unlock_exit;
1754 + }
1755 bytes_to_read = min(count, *actual_buffer);
1756 if (bytes_to_read < *actual_buffer)
1757 dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n",
1758 @@ -693,10 +695,9 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
1759 dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n");
1760
1761 dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
1762 - dev->ring_buffer =
1763 - kmalloc_array(ring_buffer_size,
1764 - sizeof(size_t) + dev->interrupt_in_endpoint_size,
1765 - GFP_KERNEL);
1766 + dev->ring_buffer = kcalloc(ring_buffer_size,
1767 + sizeof(size_t) + dev->interrupt_in_endpoint_size,
1768 + GFP_KERNEL);
1769 if (!dev->ring_buffer)
1770 goto error;
1771 dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
1772 diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
1773 index 9d4c52a7ebe0..62dab2441ec4 100644
1774 --- a/drivers/usb/misc/legousbtower.c
1775 +++ b/drivers/usb/misc/legousbtower.c
1776 @@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct file *file)
1777 goto exit;
1778 }
1779
1780 - if (mutex_lock_interruptible(&dev->lock)) {
1781 - retval = -ERESTARTSYS;
1782 - goto exit;
1783 - }
1784 + mutex_lock(&dev->lock);
1785
1786 if (dev->open_count != 1) {
1787 dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n",
1788 diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
1789 index e3c5832337e0..c9201e0a8241 100644
1790 --- a/drivers/usb/serial/ti_usb_3410_5052.c
1791 +++ b/drivers/usb/serial/ti_usb_3410_5052.c
1792 @@ -776,7 +776,6 @@ static void ti_close(struct usb_serial_port *port)
1793 struct ti_port *tport;
1794 int port_number;
1795 int status;
1796 - int do_unlock;
1797 unsigned long flags;
1798
1799 tdev = usb_get_serial_data(port->serial);
1800 @@ -800,16 +799,13 @@ static void ti_close(struct usb_serial_port *port)
1801 "%s - cannot send close port command, %d\n"
1802 , __func__, status);
1803
1804 - /* if mutex_lock is interrupted, continue anyway */
1805 - do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock);
1806 + mutex_lock(&tdev->td_open_close_lock);
1807 --tport->tp_tdev->td_open_port_count;
1808 - if (tport->tp_tdev->td_open_port_count <= 0) {
1809 + if (tport->tp_tdev->td_open_port_count == 0) {
1810 /* last port is closed, shut down interrupt urb */
1811 usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
1812 - tport->tp_tdev->td_open_port_count = 0;
1813 }
1814 - if (do_unlock)
1815 - mutex_unlock(&tdev->td_open_close_lock);
1816 + mutex_unlock(&tdev->td_open_close_lock);
1817 }
1818
1819
1820 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1821 index e49e29288049..72c745682996 100644
1822 --- a/fs/btrfs/extent-tree.c
1823 +++ b/fs/btrfs/extent-tree.c
1824 @@ -10000,6 +10000,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
1825 btrfs_err(info,
1826 "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups",
1827 cache->key.objectid);
1828 + btrfs_put_block_group(cache);
1829 ret = -EINVAL;
1830 goto error;
1831 }
1832 diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
1833 index c84186563c31..4870440d6424 100644
1834 --- a/fs/btrfs/file.c
1835 +++ b/fs/btrfs/file.c
1836 @@ -2056,25 +2056,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1837 struct btrfs_trans_handle *trans;
1838 struct btrfs_log_ctx ctx;
1839 int ret = 0, err;
1840 - u64 len;
1841
1842 - /*
1843 - * If the inode needs a full sync, make sure we use a full range to
1844 - * avoid log tree corruption, due to hole detection racing with ordered
1845 - * extent completion for adjacent ranges, and assertion failures during
1846 - * hole detection.
1847 - */
1848 - if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
1849 - &BTRFS_I(inode)->runtime_flags)) {
1850 - start = 0;
1851 - end = LLONG_MAX;
1852 - }
1853 -
1854 - /*
1855 - * The range length can be represented by u64, we have to do the typecasts
1856 - * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
1857 - */
1858 - len = (u64)end - (u64)start + 1;
1859 trace_btrfs_sync_file(file, datasync);
1860
1861 btrfs_init_log_ctx(&ctx, inode);
1862 @@ -2100,6 +2082,19 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1863
1864 atomic_inc(&root->log_batch);
1865
1866 + /*
1867 + * If the inode needs a full sync, make sure we use a full range to
1868 + * avoid log tree corruption, due to hole detection racing with ordered
1869 + * extent completion for adjacent ranges, and assertion failures during
1870 + * hole detection. Do this while holding the inode lock, to avoid races
1871 + * with other tasks.
1872 + */
1873 + if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
1874 + &BTRFS_I(inode)->runtime_flags)) {
1875 + start = 0;
1876 + end = LLONG_MAX;
1877 + }
1878 +
1879 /*
1880 * Before we acquired the inode's lock, someone may have dirtied more
1881 * pages in the target range. We need to make sure that writeback for
1882 @@ -2127,8 +2122,11 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1883 /*
1884 * We have to do this here to avoid the priority inversion of waiting on
1885 * IO of a lower priority task while holding a transaciton open.
1886 + *
1887 + * Also, the range length can be represented by u64, we have to do the
1888 + * typecasts to avoid signed overflow if it's [0, LLONG_MAX].
1889 */
1890 - ret = btrfs_wait_ordered_range(inode, start, len);
1891 + ret = btrfs_wait_ordered_range(inode, start, (u64)end - (u64)start + 1);
1892 if (ret) {
1893 up_write(&BTRFS_I(inode)->dio_sem);
1894 inode_unlock(inode);
1895 diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
1896 index 5d57ed629345..bccd9dede2af 100644
1897 --- a/fs/btrfs/relocation.c
1898 +++ b/fs/btrfs/relocation.c
1899 @@ -3187,6 +3187,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
1900 if (!page) {
1901 btrfs_delalloc_release_metadata(BTRFS_I(inode),
1902 PAGE_SIZE, true);
1903 + btrfs_delalloc_release_extents(BTRFS_I(inode),
1904 + PAGE_SIZE, true);
1905 ret = -ENOMEM;
1906 goto out;
1907 }
1908 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1909 index 617f86beb08b..b4e33ef2ff31 100644
1910 --- a/fs/cifs/file.c
1911 +++ b/fs/cifs/file.c
1912 @@ -403,10 +403,11 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)
1913 bool oplock_break_cancelled;
1914
1915 spin_lock(&tcon->open_file_lock);
1916 -
1917 + spin_lock(&cifsi->open_file_lock);
1918 spin_lock(&cifs_file->file_info_lock);
1919 if (--cifs_file->count > 0) {
1920 spin_unlock(&cifs_file->file_info_lock);
1921 + spin_unlock(&cifsi->open_file_lock);
1922 spin_unlock(&tcon->open_file_lock);
1923 return;
1924 }
1925 @@ -419,9 +420,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)
1926 cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open);
1927
1928 /* remove it from the lists */
1929 - spin_lock(&cifsi->open_file_lock);
1930 list_del(&cifs_file->flist);
1931 - spin_unlock(&cifsi->open_file_lock);
1932 list_del(&cifs_file->tlist);
1933
1934 if (list_empty(&cifsi->openFileList)) {
1935 @@ -437,6 +436,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)
1936 cifs_set_oplock_level(cifsi, 0);
1937 }
1938
1939 + spin_unlock(&cifsi->open_file_lock);
1940 spin_unlock(&tcon->open_file_lock);
1941
1942 oplock_break_cancelled = wait_oplock_handler ?
1943 diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
1944 index 47db8eb6cbcf..c7f0c8566442 100644
1945 --- a/fs/cifs/smb1ops.c
1946 +++ b/fs/cifs/smb1ops.c
1947 @@ -183,6 +183,9 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
1948 /* we do not want to loop forever */
1949 last_mid = cur_mid;
1950 cur_mid++;
1951 + /* avoid 0xFFFF MID */
1952 + if (cur_mid == 0xffff)
1953 + cur_mid++;
1954
1955 /*
1956 * This nested loop looks more expensive than it is.
1957 diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
1958 index bd3475694e83..c492cbb2410f 100644
1959 --- a/fs/ocfs2/journal.c
1960 +++ b/fs/ocfs2/journal.c
1961 @@ -231,7 +231,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
1962 /* At this point, we know that no more recovery threads can be
1963 * launched, so wait for any recovery completion work to
1964 * complete. */
1965 - flush_workqueue(osb->ocfs2_wq);
1966 + if (osb->ocfs2_wq)
1967 + flush_workqueue(osb->ocfs2_wq);
1968
1969 /*
1970 * Now that recovery is shut down, and the osb is about to be
1971 diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
1972 index 30208233f65b..a46aff7135d3 100644
1973 --- a/fs/ocfs2/localalloc.c
1974 +++ b/fs/ocfs2/localalloc.c
1975 @@ -391,7 +391,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
1976 struct ocfs2_dinode *alloc = NULL;
1977
1978 cancel_delayed_work(&osb->la_enable_wq);
1979 - flush_workqueue(osb->ocfs2_wq);
1980 + if (osb->ocfs2_wq)
1981 + flush_workqueue(osb->ocfs2_wq);
1982
1983 if (osb->local_alloc_state == OCFS2_LA_UNUSED)
1984 goto out;
1985 diff --git a/fs/proc/page.c b/fs/proc/page.c
1986 index 792c78a49174..64293df0faa3 100644
1987 --- a/fs/proc/page.c
1988 +++ b/fs/proc/page.c
1989 @@ -42,10 +42,12 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
1990 return -EINVAL;
1991
1992 while (count > 0) {
1993 - if (pfn_valid(pfn))
1994 - ppage = pfn_to_page(pfn);
1995 - else
1996 - ppage = NULL;
1997 + /*
1998 + * TODO: ZONE_DEVICE support requires to identify
1999 + * memmaps that were actually initialized.
2000 + */
2001 + ppage = pfn_to_online_page(pfn);
2002 +
2003 if (!ppage || PageSlab(ppage))
2004 pcount = 0;
2005 else
2006 @@ -216,10 +218,11 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
2007 return -EINVAL;
2008
2009 while (count > 0) {
2010 - if (pfn_valid(pfn))
2011 - ppage = pfn_to_page(pfn);
2012 - else
2013 - ppage = NULL;
2014 + /*
2015 + * TODO: ZONE_DEVICE support requires to identify
2016 + * memmaps that were actually initialized.
2017 + */
2018 + ppage = pfn_to_online_page(pfn);
2019
2020 if (put_user(stable_page_flags(ppage), out)) {
2021 ret = -EFAULT;
2022 @@ -261,10 +264,11 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf,
2023 return -EINVAL;
2024
2025 while (count > 0) {
2026 - if (pfn_valid(pfn))
2027 - ppage = pfn_to_page(pfn);
2028 - else
2029 - ppage = NULL;
2030 + /*
2031 + * TODO: ZONE_DEVICE support requires to identify
2032 + * memmaps that were actually initialized.
2033 + */
2034 + ppage = pfn_to_online_page(pfn);
2035
2036 if (ppage)
2037 ino = page_cgroup_ino(ppage);
2038 diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
2039 index 2b7e227960e1..91f403341dd7 100644
2040 --- a/include/scsi/scsi_eh.h
2041 +++ b/include/scsi/scsi_eh.h
2042 @@ -32,6 +32,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
2043 struct scsi_eh_save {
2044 /* saved state */
2045 int result;
2046 + unsigned int resid_len;
2047 int eh_eflags;
2048 enum dma_data_direction data_direction;
2049 unsigned underflow;
2050 diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
2051 index b401c4e36394..eb3f668b8bce 100644
2052 --- a/include/trace/events/btrfs.h
2053 +++ b/include/trace/events/btrfs.h
2054 @@ -1655,6 +1655,7 @@ TRACE_EVENT(qgroup_update_reserve,
2055 __entry->qgid = qgroup->qgroupid;
2056 __entry->cur_reserved = qgroup->rsv.values[type];
2057 __entry->diff = diff;
2058 + __entry->type = type;
2059 ),
2060
2061 TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
2062 @@ -1677,6 +1678,7 @@ TRACE_EVENT(qgroup_meta_reserve,
2063 TP_fast_assign_btrfs(root->fs_info,
2064 __entry->refroot = root->objectid;
2065 __entry->diff = diff;
2066 + __entry->type = type;
2067 ),
2068
2069 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
2070 @@ -1693,7 +1695,6 @@ TRACE_EVENT(qgroup_meta_convert,
2071 TP_STRUCT__entry_btrfs(
2072 __field( u64, refroot )
2073 __field( s64, diff )
2074 - __field( int, type )
2075 ),
2076
2077 TP_fast_assign_btrfs(root->fs_info,
2078 diff --git a/kernel/events/core.c b/kernel/events/core.c
2079 index 7ca44b8523c8..625ba462e5bb 100644
2080 --- a/kernel/events/core.c
2081 +++ b/kernel/events/core.c
2082 @@ -6813,7 +6813,7 @@ static void __perf_event_output_stop(struct perf_event *event, void *data)
2083 static int __perf_pmu_output_stop(void *info)
2084 {
2085 struct perf_event *event = info;
2086 - struct pmu *pmu = event->pmu;
2087 + struct pmu *pmu = event->ctx->pmu;
2088 struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
2089 struct remote_output ro = {
2090 .rb = event->rb,
2091 diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
2092 index e6945b55c688..f5b3bf0e69f6 100644
2093 --- a/kernel/trace/trace_event_perf.c
2094 +++ b/kernel/trace/trace_event_perf.c
2095 @@ -272,9 +272,11 @@ int perf_kprobe_init(struct perf_event *p_event, bool is_retprobe)
2096 goto out;
2097 }
2098
2099 + mutex_lock(&event_mutex);
2100 ret = perf_trace_event_init(tp_event, p_event);
2101 if (ret)
2102 destroy_local_trace_kprobe(tp_event);
2103 + mutex_unlock(&event_mutex);
2104 out:
2105 kfree(func);
2106 return ret;
2107 @@ -282,8 +284,10 @@ out:
2108
2109 void perf_kprobe_destroy(struct perf_event *p_event)
2110 {
2111 + mutex_lock(&event_mutex);
2112 perf_trace_event_close(p_event);
2113 perf_trace_event_unreg(p_event);
2114 + mutex_unlock(&event_mutex);
2115
2116 destroy_local_trace_kprobe(p_event->tp_event);
2117 }
2118 diff --git a/lib/textsearch.c b/lib/textsearch.c
2119 index 5939549c0e7b..9135c29add62 100644
2120 --- a/lib/textsearch.c
2121 +++ b/lib/textsearch.c
2122 @@ -93,9 +93,9 @@
2123 * goto errout;
2124 * }
2125 *
2126 - * pos = textsearch_find_continuous(conf, \&state, example, strlen(example));
2127 + * pos = textsearch_find_continuous(conf, &state, example, strlen(example));
2128 * if (pos != UINT_MAX)
2129 - * panic("Oh my god, dancing chickens at \%d\n", pos);
2130 + * panic("Oh my god, dancing chickens at %d\n", pos);
2131 *
2132 * textsearch_destroy(conf);
2133 */
2134 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2135 index 57053affaad2..6f4ce9547658 100644
2136 --- a/mm/hugetlb.c
2137 +++ b/mm/hugetlb.c
2138 @@ -1073,11 +1073,10 @@ static bool pfn_range_valid_gigantic(struct zone *z,
2139 struct page *page;
2140
2141 for (i = start_pfn; i < end_pfn; i++) {
2142 - if (!pfn_valid(i))
2143 + page = pfn_to_online_page(i);
2144 + if (!page)
2145 return false;
2146
2147 - page = pfn_to_page(i);
2148 -
2149 if (page_zone(page) != z)
2150 return false;
2151
2152 diff --git a/mm/memfd.c b/mm/memfd.c
2153 index 2bb5e257080e..5859705dafe1 100644
2154 --- a/mm/memfd.c
2155 +++ b/mm/memfd.c
2156 @@ -34,11 +34,12 @@ static void memfd_tag_pins(struct address_space *mapping)
2157 void __rcu **slot;
2158 pgoff_t start;
2159 struct page *page;
2160 + unsigned int tagged = 0;
2161
2162 lru_add_drain();
2163 start = 0;
2164 - rcu_read_lock();
2165
2166 + xa_lock_irq(&mapping->i_pages);
2167 radix_tree_for_each_slot(slot, &mapping->i_pages, &iter, start) {
2168 page = radix_tree_deref_slot(slot);
2169 if (!page || radix_tree_exception(page)) {
2170 @@ -47,18 +48,19 @@ static void memfd_tag_pins(struct address_space *mapping)
2171 continue;
2172 }
2173 } else if (page_count(page) - page_mapcount(page) > 1) {
2174 - xa_lock_irq(&mapping->i_pages);
2175 radix_tree_tag_set(&mapping->i_pages, iter.index,
2176 MEMFD_TAG_PINNED);
2177 - xa_unlock_irq(&mapping->i_pages);
2178 }
2179
2180 - if (need_resched()) {
2181 - slot = radix_tree_iter_resume(slot, &iter);
2182 - cond_resched_rcu();
2183 - }
2184 + if (++tagged % 1024)
2185 + continue;
2186 +
2187 + slot = radix_tree_iter_resume(slot, &iter);
2188 + xa_unlock_irq(&mapping->i_pages);
2189 + cond_resched();
2190 + xa_lock_irq(&mapping->i_pages);
2191 }
2192 - rcu_read_unlock();
2193 + xa_unlock_irq(&mapping->i_pages);
2194 }
2195
2196 /*
2197 diff --git a/mm/memory-failure.c b/mm/memory-failure.c
2198 index 2994ceb2e7b0..148fdd929a19 100644
2199 --- a/mm/memory-failure.c
2200 +++ b/mm/memory-failure.c
2201 @@ -202,7 +202,6 @@ struct to_kill {
2202 struct task_struct *tsk;
2203 unsigned long addr;
2204 short size_shift;
2205 - char addr_valid;
2206 };
2207
2208 /*
2209 @@ -327,22 +326,27 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
2210 }
2211 }
2212 tk->addr = page_address_in_vma(p, vma);
2213 - tk->addr_valid = 1;
2214 if (is_zone_device_page(p))
2215 tk->size_shift = dev_pagemap_mapping_shift(p, vma);
2216 else
2217 tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT;
2218
2219 /*
2220 - * In theory we don't have to kill when the page was
2221 - * munmaped. But it could be also a mremap. Since that's
2222 - * likely very rare kill anyways just out of paranoia, but use
2223 - * a SIGKILL because the error is not contained anymore.
2224 + * Send SIGKILL if "tk->addr == -EFAULT". Also, as
2225 + * "tk->size_shift" is always non-zero for !is_zone_device_page(),
2226 + * so "tk->size_shift == 0" effectively checks no mapping on
2227 + * ZONE_DEVICE. Indeed, when a devdax page is mmapped N times
2228 + * to a process' address space, it's possible not all N VMAs
2229 + * contain mappings for the page, but at least one VMA does.
2230 + * Only deliver SIGBUS with payload derived from the VMA that
2231 + * has a mapping for the page.
2232 */
2233 - if (tk->addr == -EFAULT || tk->size_shift == 0) {
2234 + if (tk->addr == -EFAULT) {
2235 pr_info("Memory failure: Unable to find user space address %lx in %s\n",
2236 page_to_pfn(p), tsk->comm);
2237 - tk->addr_valid = 0;
2238 + } else if (tk->size_shift == 0) {
2239 + kfree(tk);
2240 + return;
2241 }
2242 get_task_struct(tsk);
2243 tk->tsk = tsk;
2244 @@ -369,7 +373,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, bool fail,
2245 * make sure the process doesn't catch the
2246 * signal and then access the memory. Just kill it.
2247 */
2248 - if (fail || tk->addr_valid == 0) {
2249 + if (fail || tk->addr == -EFAULT) {
2250 pr_err("Memory failure: %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n",
2251 pfn, tk->tsk->comm, tk->tsk->pid);
2252 do_send_sig_info(SIGKILL, SEND_SIG_PRIV,
2253 @@ -1258,17 +1262,19 @@ int memory_failure(unsigned long pfn, int flags)
2254 if (!sysctl_memory_failure_recovery)
2255 panic("Memory failure on page %lx", pfn);
2256
2257 - if (!pfn_valid(pfn)) {
2258 + p = pfn_to_online_page(pfn);
2259 + if (!p) {
2260 + if (pfn_valid(pfn)) {
2261 + pgmap = get_dev_pagemap(pfn, NULL);
2262 + if (pgmap)
2263 + return memory_failure_dev_pagemap(pfn, flags,
2264 + pgmap);
2265 + }
2266 pr_err("Memory failure: %#lx: memory outside kernel control\n",
2267 pfn);
2268 return -ENXIO;
2269 }
2270
2271 - pgmap = get_dev_pagemap(pfn, NULL);
2272 - if (pgmap)
2273 - return memory_failure_dev_pagemap(pfn, flags, pgmap);
2274 -
2275 - p = pfn_to_page(pfn);
2276 if (PageHuge(p))
2277 return memory_failure_hugetlb(pfn, flags);
2278 if (TestSetPageHWPoison(p)) {
2279 diff --git a/mm/page_owner.c b/mm/page_owner.c
2280 index d80adfe702d3..63b1053f5b41 100644
2281 --- a/mm/page_owner.c
2282 +++ b/mm/page_owner.c
2283 @@ -273,7 +273,8 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m,
2284 * not matter as the mixed block count will still be correct
2285 */
2286 for (; pfn < end_pfn; ) {
2287 - if (!pfn_valid(pfn)) {
2288 + page = pfn_to_online_page(pfn);
2289 + if (!page) {
2290 pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
2291 continue;
2292 }
2293 @@ -281,13 +282,13 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m,
2294 block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
2295 block_end_pfn = min(block_end_pfn, end_pfn);
2296
2297 - page = pfn_to_page(pfn);
2298 pageblock_mt = get_pageblock_migratetype(page);
2299
2300 for (; pfn < block_end_pfn; pfn++) {
2301 if (!pfn_valid_within(pfn))
2302 continue;
2303
2304 + /* The pageblock is online, no need to recheck. */
2305 page = pfn_to_page(pfn);
2306
2307 if (page_zone(page) != zone)
2308 diff --git a/mm/slub.c b/mm/slub.c
2309 index 09c0e24a06d8..9c3937c5ce38 100644
2310 --- a/mm/slub.c
2311 +++ b/mm/slub.c
2312 @@ -4797,7 +4797,17 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
2313 }
2314 }
2315
2316 - get_online_mems();
2317 + /*
2318 + * It is impossible to take "mem_hotplug_lock" here with "kernfs_mutex"
2319 + * already held which will conflict with an existing lock order:
2320 + *
2321 + * mem_hotplug_lock->slab_mutex->kernfs_mutex
2322 + *
2323 + * We don't really need mem_hotplug_lock (to hold off
2324 + * slab_mem_going_offline_callback) here because slab's memory hot
2325 + * unplug code doesn't destroy the kmem_cache->node[] data.
2326 + */
2327 +
2328 #ifdef CONFIG_SLUB_DEBUG
2329 if (flags & SO_ALL) {
2330 struct kmem_cache_node *n;
2331 @@ -4838,7 +4848,6 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
2332 x += sprintf(buf + x, " N%d=%lu",
2333 node, nodes[node]);
2334 #endif
2335 - put_online_mems();
2336 kfree(nodes);
2337 return x + sprintf(buf + x, "\n");
2338 }
2339 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2340 index 7065d68086ab..69127f6039b2 100644
2341 --- a/net/ipv4/route.c
2342 +++ b/net/ipv4/route.c
2343 @@ -1476,7 +1476,7 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
2344 prev = cmpxchg(p, orig, rt);
2345 if (prev == orig) {
2346 if (orig) {
2347 - dst_dev_put(&orig->dst);
2348 + rt_add_uncached_list(orig);
2349 dst_release(&orig->dst);
2350 }
2351 } else {
2352 @@ -2381,14 +2381,17 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
2353 int orig_oif = fl4->flowi4_oif;
2354 unsigned int flags = 0;
2355 struct rtable *rth;
2356 - int err = -ENETUNREACH;
2357 + int err;
2358
2359 if (fl4->saddr) {
2360 - rth = ERR_PTR(-EINVAL);
2361 if (ipv4_is_multicast(fl4->saddr) ||
2362 ipv4_is_lbcast(fl4->saddr) ||
2363 - ipv4_is_zeronet(fl4->saddr))
2364 + ipv4_is_zeronet(fl4->saddr)) {
2365 + rth = ERR_PTR(-EINVAL);
2366 goto out;
2367 + }
2368 +
2369 + rth = ERR_PTR(-ENETUNREACH);
2370
2371 /* I removed check for oif == dev_out->oif here.
2372 It was wrong for two reasons:
2373 diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
2374 index 2b6d43022383..acf0749ee5bb 100644
2375 --- a/net/ipv6/ip6_input.c
2376 +++ b/net/ipv6/ip6_input.c
2377 @@ -80,8 +80,10 @@ static void ip6_sublist_rcv_finish(struct list_head *head)
2378 {
2379 struct sk_buff *skb, *next;
2380
2381 - list_for_each_entry_safe(skb, next, head, list)
2382 + list_for_each_entry_safe(skb, next, head, list) {
2383 + skb_list_del_init(skb);
2384 dst_input(skb);
2385 + }
2386 }
2387
2388 static void ip6_list_rcv_finish(struct net *net, struct sock *sk,
2389 diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
2390 index d37d4acafebf..316250ae9071 100644
2391 --- a/net/mac80211/debugfs_netdev.c
2392 +++ b/net/mac80211/debugfs_netdev.c
2393 @@ -490,9 +490,14 @@ static ssize_t ieee80211_if_fmt_aqm(
2394 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
2395 {
2396 struct ieee80211_local *local = sdata->local;
2397 - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
2398 + struct txq_info *txqi;
2399 int len;
2400
2401 + if (!sdata->vif.txq)
2402 + return 0;
2403 +
2404 + txqi = to_txq_info(sdata->vif.txq);
2405 +
2406 spin_lock_bh(&local->fq.lock);
2407 rcu_read_lock();
2408
2409 @@ -659,7 +664,9 @@ static void add_common_files(struct ieee80211_sub_if_data *sdata)
2410 DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
2411 DEBUGFS_ADD(hw_queues);
2412
2413 - if (sdata->local->ops->wake_tx_queue)
2414 + if (sdata->local->ops->wake_tx_queue &&
2415 + sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
2416 + sdata->vif.type != NL80211_IFTYPE_NAN)
2417 DEBUGFS_ADD(aqm);
2418 }
2419
2420 diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
2421 index b5c06242a92e..5c9dcafbc342 100644
2422 --- a/net/mac80211/mlme.c
2423 +++ b/net/mac80211/mlme.c
2424 @@ -2554,7 +2554,8 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
2425
2426 rcu_read_lock();
2427 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID);
2428 - if (WARN_ON_ONCE(ssid == NULL))
2429 + if (WARN_ONCE(!ssid || ssid[1] > IEEE80211_MAX_SSID_LEN,
2430 + "invalid SSID element (len=%d)", ssid ? ssid[1] : -1))
2431 ssid_len = 0;
2432 else
2433 ssid_len = ssid[1];
2434 @@ -5039,7 +5040,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
2435
2436 rcu_read_lock();
2437 ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
2438 - if (!ssidie) {
2439 + if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) {
2440 rcu_read_unlock();
2441 kfree(assoc_data);
2442 return -EINVAL;
2443 diff --git a/net/netfilter/nft_connlimit.c b/net/netfilter/nft_connlimit.c
2444 index af1497ab9464..69d6173f91e2 100644
2445 --- a/net/netfilter/nft_connlimit.c
2446 +++ b/net/netfilter/nft_connlimit.c
2447 @@ -218,8 +218,13 @@ static void nft_connlimit_destroy_clone(const struct nft_ctx *ctx,
2448 static bool nft_connlimit_gc(struct net *net, const struct nft_expr *expr)
2449 {
2450 struct nft_connlimit *priv = nft_expr_priv(expr);
2451 + bool ret;
2452
2453 - return nf_conncount_gc_list(net, &priv->list);
2454 + local_bh_disable();
2455 + ret = nf_conncount_gc_list(net, &priv->list);
2456 + local_bh_enable();
2457 +
2458 + return ret;
2459 }
2460
2461 static struct nft_expr_type nft_connlimit_type;
2462 diff --git a/net/sched/act_api.c b/net/sched/act_api.c
2463 index 7c4a4b874248..f2c4bfc79663 100644
2464 --- a/net/sched/act_api.c
2465 +++ b/net/sched/act_api.c
2466 @@ -1307,11 +1307,16 @@ static int tcf_action_add(struct net *net, struct nlattr *nla,
2467 struct netlink_ext_ack *extack)
2468 {
2469 size_t attr_size = 0;
2470 - int ret = 0;
2471 + int loop, ret;
2472 struct tc_action *actions[TCA_ACT_MAX_PRIO] = {};
2473
2474 - ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, actions,
2475 - &attr_size, true, extack);
2476 + for (loop = 0; loop < 10; loop++) {
2477 + ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0,
2478 + actions, &attr_size, true, extack);
2479 + if (ret != -EAGAIN)
2480 + break;
2481 + }
2482 +
2483 if (ret < 0)
2484 return ret;
2485 ret = tcf_add_notify(net, n, actions, portid, attr_size, extack);
2486 @@ -1361,11 +1366,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n,
2487 */
2488 if (n->nlmsg_flags & NLM_F_REPLACE)
2489 ovr = 1;
2490 -replay:
2491 ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr,
2492 extack);
2493 - if (ret == -EAGAIN)
2494 - goto replay;
2495 break;
2496 case RTM_DELACTION:
2497 ret = tca_action_gd(net, tca[TCA_ACT_TAB], n,
2498 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2499 index 9f5b4e547b63..227b050cfe45 100644
2500 --- a/net/sctp/socket.c
2501 +++ b/net/sctp/socket.c
2502 @@ -8957,7 +8957,7 @@ struct proto sctp_prot = {
2503 .backlog_rcv = sctp_backlog_rcv,
2504 .hash = sctp_hash,
2505 .unhash = sctp_unhash,
2506 - .get_port = sctp_get_port,
2507 + .no_autobind = true,
2508 .obj_size = sizeof(struct sctp_sock),
2509 .useroffset = offsetof(struct sctp_sock, subscribe),
2510 .usersize = offsetof(struct sctp_sock, initmsg) -
2511 @@ -8999,7 +8999,7 @@ struct proto sctpv6_prot = {
2512 .backlog_rcv = sctp_backlog_rcv,
2513 .hash = sctp_hash,
2514 .unhash = sctp_unhash,
2515 - .get_port = sctp_get_port,
2516 + .no_autobind = true,
2517 .obj_size = sizeof(struct sctp6_sock),
2518 .useroffset = offsetof(struct sctp6_sock, sctp.subscribe),
2519 .usersize = offsetof(struct sctp6_sock, sctp.initmsg) -
2520 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2521 index 334e3181f1c5..a28d6456e93e 100644
2522 --- a/net/wireless/nl80211.c
2523 +++ b/net/wireless/nl80211.c
2524 @@ -5843,6 +5843,9 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
2525 if (!rdev->ops->del_mpath)
2526 return -EOPNOTSUPP;
2527
2528 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
2529 + return -EOPNOTSUPP;
2530 +
2531 return rdev_del_mpath(rdev, dev, dst);
2532 }
2533
2534 diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
2535 index c67d7a82ab13..73fd0eae08ca 100644
2536 --- a/net/wireless/wext-sme.c
2537 +++ b/net/wireless/wext-sme.c
2538 @@ -202,6 +202,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
2539 struct iw_point *data, char *ssid)
2540 {
2541 struct wireless_dev *wdev = dev->ieee80211_ptr;
2542 + int ret = 0;
2543
2544 /* call only for station! */
2545 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
2546 @@ -219,7 +220,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
2547 if (ie) {
2548 data->flags = 1;
2549 data->length = ie[1];
2550 - memcpy(ssid, ie + 2, data->length);
2551 + if (data->length > IW_ESSID_MAX_SIZE)
2552 + ret = -EINVAL;
2553 + else
2554 + memcpy(ssid, ie + 2, data->length);
2555 }
2556 rcu_read_unlock();
2557 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) {
2558 @@ -229,7 +233,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
2559 }
2560 wdev_unlock(wdev);
2561
2562 - return 0;
2563 + return ret;
2564 }
2565
2566 int cfg80211_mgd_wext_siwap(struct net_device *dev,
2567 diff --git a/scripts/namespace.pl b/scripts/namespace.pl
2568 index 6135574a6f39..1da7bca201a4 100755
2569 --- a/scripts/namespace.pl
2570 +++ b/scripts/namespace.pl
2571 @@ -65,13 +65,14 @@
2572 use warnings;
2573 use strict;
2574 use File::Find;
2575 +use File::Spec;
2576
2577 my $nm = ($ENV{'NM'} || "nm") . " -p";
2578 my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
2579 -my $srctree = "";
2580 -my $objtree = "";
2581 -$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
2582 -$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));
2583 +my $srctree = File::Spec->curdir();
2584 +my $objtree = File::Spec->curdir();
2585 +$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'}));
2586 +$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'}));
2587
2588 if ($#ARGV != -1) {
2589 print STDERR "usage: $0 takes no parameters\n";
2590 @@ -231,9 +232,9 @@ sub do_nm
2591 }
2592 ($source = $basename) =~ s/\.o$//;
2593 if (-e "$source.c" || -e "$source.S") {
2594 - $source = "$objtree$File::Find::dir/$source";
2595 + $source = File::Spec->catfile($objtree, $File::Find::dir, $source)
2596 } else {
2597 - $source = "$srctree$File::Find::dir/$source";
2598 + $source = File::Spec->catfile($srctree, $File::Find::dir, $source)
2599 }
2600 if (! -e "$source.c" && ! -e "$source.S") {
2601 # No obvious source, exclude the object if it is conglomerate
2602 diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
2603 index 107ec7f3e221..c827a2a89cc3 100644
2604 --- a/sound/pci/hda/patch_hdmi.c
2605 +++ b/sound/pci/hda/patch_hdmi.c
2606 @@ -3264,6 +3264,8 @@ static int patch_nvhdmi(struct hda_codec *codec)
2607 nvhdmi_chmap_cea_alloc_validate_get_type;
2608 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
2609
2610 + codec->link_down_at_suspend = 1;
2611 +
2612 return 0;
2613 }
2614
2615 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2616 index e1b08d6f2a51..dd46354270d0 100644
2617 --- a/sound/pci/hda/patch_realtek.c
2618 +++ b/sound/pci/hda/patch_realtek.c
2619 @@ -405,6 +405,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
2620 case 0x10ec0700:
2621 case 0x10ec0701:
2622 case 0x10ec0703:
2623 + case 0x10ec0711:
2624 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
2625 break;
2626 case 0x10ec0662:
2627 @@ -5676,6 +5677,7 @@ enum {
2628 ALC225_FIXUP_WYSE_AUTO_MUTE,
2629 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
2630 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
2631 + ALC256_FIXUP_ASUS_HEADSET_MIC,
2632 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
2633 ALC299_FIXUP_PREDATOR_SPK,
2634 ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
2635 @@ -6692,6 +6694,15 @@ static const struct hda_fixup alc269_fixups[] = {
2636 .chained = true,
2637 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
2638 },
2639 + [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
2640 + .type = HDA_FIXUP_PINS,
2641 + .v.pins = (const struct hda_pintbl[]) {
2642 + { 0x19, 0x03a11020 }, /* headset mic with jack detect */
2643 + { }
2644 + },
2645 + .chained = true,
2646 + .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
2647 + },
2648 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
2649 .type = HDA_FIXUP_PINS,
2650 .v.pins = (const struct hda_pintbl[]) {
2651 @@ -6888,6 +6899,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2652 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
2653 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
2654 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC),
2655 + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
2656 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
2657 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
2658 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
2659 @@ -7752,6 +7764,7 @@ static int patch_alc269(struct hda_codec *codec)
2660 case 0x10ec0700:
2661 case 0x10ec0701:
2662 case 0x10ec0703:
2663 + case 0x10ec0711:
2664 spec->codec_variant = ALC269_TYPE_ALC700;
2665 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2666 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
2667 @@ -8883,6 +8896,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
2668 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
2669 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
2670 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
2671 + HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
2672 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
2673 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
2674 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
2675 diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
2676 index d23c2bbff0cf..15a31820df16 100644
2677 --- a/sound/soc/sh/rcar/core.c
2678 +++ b/sound/soc/sh/rcar/core.c
2679 @@ -674,6 +674,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
2680 }
2681
2682 /* set format */
2683 + rdai->bit_clk_inv = 0;
2684 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
2685 case SND_SOC_DAIFMT_I2S:
2686 rdai->sys_delay = 0;
2687 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
2688 index 13ea63c959d3..1828225ba882 100644
2689 --- a/sound/usb/pcm.c
2690 +++ b/sound/usb/pcm.c
2691 @@ -355,6 +355,9 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
2692 ep = 0x81;
2693 ifnum = 1;
2694 goto add_sync_ep_from_ifnum;
2695 + case USB_ID(0x0582, 0x01d8): /* BOSS Katana */
2696 + /* BOSS Katana amplifiers do not need quirks */
2697 + return 0;
2698 }
2699
2700 if (attr == USB_ENDPOINT_SYNC_ASYNC &&