commit:     3af0f636399a165ea0a180550c66d5a5515a9c60
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 29 12:04:29 2019 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Tue Oct 29 12:04:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3af0f636

Linux patch 4.19.81

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README              |    4 +
 1080_linux-4.19.81.patch | 2700 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 2704 insertions(+)

diff --git a/0000_README b/0000_README
index 4a75724..3811a86 100644
--- a/0000_README
+++ b/0000_README
@@ -359,6 +359,10 @@ Patch:  1079_linux-4.19.80.patch
 From:   https://www.kernel.org
 Desc:   Linux 4.19.80
 
+Patch:  1080_linux-4.19.81.patch
+From:   https://www.kernel.org
+Desc:   Linux 4.19.81
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1080_linux-4.19.81.patch b/1080_linux-4.19.81.patch
new file mode 100644
index 0000000..55ea23d
--- /dev/null
+++ b/1080_linux-4.19.81.patch
@@ -0,0 +1,2700 @@
+diff --git a/Makefile b/Makefile
+index ced4a9fd9754..3c146e8d93dc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 4
+ PATCHLEVEL = 19
+-SUBLEVEL = 80
++SUBLEVEL = 81
+ EXTRAVERSION =
+ NAME = "People's Front"
+ 
+diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
+index d4b7c59eec68..cf1e4f747242 100644
+--- a/arch/arm/boot/dts/am4372.dtsi
++++ b/arch/arm/boot/dts/am4372.dtsi
+@@ -1142,6 +1142,8 @@
+                               ti,hwmods = "dss_dispc";
+                               clocks = <&disp_clk>;
+                               clock-names = "fck";
++
++                              max-memory-bandwidth = <230000000>;
+                       };
+ 
+                       rfbi: rfbi@4832a800 {
+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
+index 9ded7bf972e7..3b8fe014a3e9 100644
+--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
++++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+@@ -946,7 +946,8 @@ static struct omap_hwmod_class_sysconfig am33xx_timer_sysc 
= {
+       .rev_offs       = 0x0000,
+       .sysc_offs      = 0x0010,
+       .syss_offs      = 0x0014,
+-      .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
++      .sysc_flags     = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
++                        SYSC_HAS_RESET_STATUS,
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+                         SIDLE_SMART_WKUP),
+       .sysc_fields    = &omap_hwmod_sysc_type2,
+diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
+index ca03af8fe43f..ddf96adf65ab 100644
+--- a/arch/arm/mach-omap2/pm.c
++++ b/arch/arm/mach-omap2/pm.c
+@@ -77,83 +77,6 @@ int omap_pm_clkdms_setup(struct clockdomain *clkdm, void 
*unused)
+       return 0;
+ }
+ 
+-/*
+- * This API is to be called during init to set the various voltage
+- * domains to the voltage as per the opp table. Typically we boot up
+- * at the nominal voltage. So this function finds out the rate of
+- * the clock associated with the voltage domain, finds out the correct
+- * opp entry and sets the voltage domain to the voltage specified
+- * in the opp entry
+- */
+-static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
+-                                       const char *oh_name)
+-{
+-      struct voltagedomain *voltdm;
+-      struct clk *clk;
+-      struct dev_pm_opp *opp;
+-      unsigned long freq, bootup_volt;
+-      struct device *dev;
+-
+-      if (!vdd_name || !clk_name || !oh_name) {
+-              pr_err("%s: invalid parameters\n", __func__);
+-              goto exit;
+-      }
+-
+-      if (!strncmp(oh_name, "mpu", 3))
+-              /* 
+-               * All current OMAPs share voltage rail and clock
+-               * source, so CPU0 is used to represent the MPU-SS.
+-               */
+-              dev = get_cpu_device(0);
+-      else
+-              dev = omap_device_get_by_hwmod_name(oh_name);
+-
+-      if (IS_ERR(dev)) {
+-              pr_err("%s: Unable to get dev pointer for hwmod %s\n",
+-                      __func__, oh_name);
+-              goto exit;
+-      }
+-
+-      voltdm = voltdm_lookup(vdd_name);
+-      if (!voltdm) {
+-              pr_err("%s: unable to get vdd pointer for vdd_%s\n",
+-                      __func__, vdd_name);
+-              goto exit;
+-      }
+-
+-      clk =  clk_get(NULL, clk_name);
+-      if (IS_ERR(clk)) {
+-              pr_err("%s: unable to get clk %s\n", __func__, clk_name);
+-              goto exit;
+-      }
+-
+-      freq = clk_get_rate(clk);
+-      clk_put(clk);
+-
+-      opp = dev_pm_opp_find_freq_ceil(dev, &freq);
+-      if (IS_ERR(opp)) {
+-              pr_err("%s: unable to find boot up OPP for vdd_%s\n",
+-                      __func__, vdd_name);
+-              goto exit;
+-      }
+-
+-      bootup_volt = dev_pm_opp_get_voltage(opp);
+-      dev_pm_opp_put(opp);
+-
+-      if (!bootup_volt) {
+-              pr_err("%s: unable to find voltage corresponding to the bootup 
OPP for vdd_%s\n",
+-                     __func__, vdd_name);
+-              goto exit;
+-      }
+-
+-      voltdm_scale(voltdm, bootup_volt);
+-      return 0;
+-
+-exit:
+-      pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name);
+-      return -EINVAL;
+-}
+-
+ #ifdef CONFIG_SUSPEND
+ static int omap_pm_enter(suspend_state_t suspend_state)
+ {
+@@ -211,25 +134,6 @@ void omap_common_suspend_init(void *pm_suspend)
+ }
+ #endif /* CONFIG_SUSPEND */
+ 
+-static void __init omap3_init_voltages(void)
+-{
+-      if (!soc_is_omap34xx())
+-              return;
+-
+-      omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
+-      omap2_set_init_voltage("core", "l3_ick", "l3_main");
+-}
+-
+-static void __init omap4_init_voltages(void)
+-{
+-      if (!soc_is_omap44xx())
+-              return;
+-
+-      omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
+-      omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
+-      omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
+-}
+-
+ int __maybe_unused omap_pm_nop_init(void)
+ {
+       return 0;
+@@ -249,10 +153,6 @@ int __init omap2_common_pm_late_init(void)
+       omap4_twl_init();
+       omap_voltage_late_init();
+ 
+-      /* Initialize the voltages */
+-      omap3_init_voltages();
+-      omap4_init_voltages();
+-
+       /* Smartreflex device init */
+       omap_devinit_smartreflex();
+ 
+diff --git a/arch/arm/xen/efi.c b/arch/arm/xen/efi.c
+index b4d78959cadf..bc9a37b3cecd 100644
+--- a/arch/arm/xen/efi.c
++++ b/arch/arm/xen/efi.c
+@@ -31,7 +31,9 @@ void __init xen_efi_runtime_setup(void)
+       efi.get_variable             = xen_efi_get_variable;
+       efi.get_next_variable        = xen_efi_get_next_variable;
+       efi.set_variable             = xen_efi_set_variable;
++      efi.set_variable_nonblocking = xen_efi_set_variable;
+       efi.query_variable_info      = xen_efi_query_variable_info;
++      efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
+       efi.update_capsule           = xen_efi_update_capsule;
+       efi.query_capsule_caps       = xen_efi_query_capsule_caps;
+       efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
+index 9ccf16939d13..71888808ded7 100644
+--- a/arch/arm64/kernel/cpu_errata.c
++++ b/arch/arm64/kernel/cpu_errata.c
+@@ -23,6 +23,7 @@
+ #include <asm/cpu.h>
+ #include <asm/cputype.h>
+ #include <asm/cpufeature.h>
++#include <asm/smp_plat.h>
+ 
+ static bool __maybe_unused
+ is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
+@@ -618,6 +619,30 @@ check_branch_predictor(const struct 
arm64_cpu_capabilities *entry, int scope)
+       return (need_wa > 0);
+ }
+ 
++static const __maybe_unused struct midr_range tx2_family_cpus[] = {
++      MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
++      MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
++      {},
++};
++
++static bool __maybe_unused
++needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry,
++                       int scope)
++{
++      int i;
++
++      if (!is_affected_midr_range_list(entry, scope) ||
++          !is_hyp_mode_available())
++              return false;
++
++      for_each_possible_cpu(i) {
++              if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0)
++                      return true;
++      }
++
++      return false;
++}
++
+ #ifdef CONFIG_HARDEN_EL2_VECTORS
+ 
+ static const struct midr_range arm64_harden_el2_vectors[] = {
+@@ -801,6 +826,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
+               .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
+               .matches = has_cortex_a76_erratum_1463225,
+       },
++#endif
++#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
++      {
++              .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg 
trapping)",
++              .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM,
++              ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
++              .matches = needs_tx2_tvm_workaround,
++      },
+ #endif
+       {
+       }
+diff --git a/arch/mips/boot/dts/qca/ar9331.dtsi 
b/arch/mips/boot/dts/qca/ar9331.dtsi
+index 2bae201aa365..1c7bf11f8450 100644
+--- a/arch/mips/boot/dts/qca/ar9331.dtsi
++++ b/arch/mips/boot/dts/qca/ar9331.dtsi
+@@ -99,7 +99,7 @@
+ 
+                       miscintc: interrupt-controller@18060010 {
+                               compatible = "qca,ar7240-misc-intc";
+-                              reg = <0x18060010 0x4>;
++                              reg = <0x18060010 0x8>;
+ 
+                               interrupt-parent = <&cpuintc>;
+                               interrupts = <6>;
+diff --git a/arch/mips/loongson64/common/serial.c 
b/arch/mips/loongson64/common/serial.c
+index ffefc1cb2612..98c3a7feb10f 100644
+--- a/arch/mips/loongson64/common/serial.c
++++ b/arch/mips/loongson64/common/serial.c
+@@ -110,7 +110,7 @@ static int __init serial_init(void)
+ }
+ module_init(serial_init);
+ 
+-static void __init serial_exit(void)
++static void __exit serial_exit(void)
+ {
+       platform_device_unregister(&uart8250_device);
+ }
+diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
+index 355f8eadb1cd..3944c49eee0c 100644
+--- a/arch/mips/mm/tlbex.c
++++ b/arch/mips/mm/tlbex.c
+@@ -654,6 +654,13 @@ static void build_restore_pagemask(u32 **p, struct 
uasm_reloc **r,
+                                  int restore_scratch)
+ {
+       if (restore_scratch) {
++              /*
++               * Ensure the MFC0 below observes the value written to the
++               * KScratch register by the prior MTC0.
++               */
++              if (scratch_reg >= 0)
++                      uasm_i_ehb(p);
++
+               /* Reset default page size */
+               if (PM_DEFAULT_MASK >> 16) {
+                       uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16);
+@@ -668,12 +675,10 @@ static void build_restore_pagemask(u32 **p, struct 
uasm_reloc **r,
+                       uasm_i_mtc0(p, 0, C0_PAGEMASK);
+                       uasm_il_b(p, r, lid);
+               }
+-              if (scratch_reg >= 0) {
+-                      uasm_i_ehb(p);
++              if (scratch_reg >= 0)
+                       UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
+-              } else {
++              else
+                       UASM_i_LW(p, 1, scratchpad_offset(0), 0);
+-              }
+       } else {
+               /* Reset default page size */
+               if (PM_DEFAULT_MASK >> 16) {
+@@ -922,6 +927,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, 
struct uasm_reloc **r,
+       }
+       if (mode != not_refill && check_for_high_segbits) {
+               uasm_l_large_segbits_fault(l, *p);
++
++              if (mode == refill_scratch && scratch_reg >= 0)
++                      uasm_i_ehb(p);
++
+               /*
+                * We get here if we are an xsseg address, or if we are
+                * an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary.
+@@ -938,12 +947,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, 
struct uasm_reloc **r,
+               uasm_i_jr(p, ptr);
+ 
+               if (mode == refill_scratch) {
+-                      if (scratch_reg >= 0) {
+-                              uasm_i_ehb(p);
++                      if (scratch_reg >= 0)
+                               UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
+-                      } else {
++                      else
+                               UASM_i_LW(p, 1, scratchpad_offset(0), 0);
+-                      }
+               } else {
+                       uasm_i_nop(p);
+               }
+diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
+index 92a9b5f12f98..f29f682352f0 100644
+--- a/arch/parisc/mm/ioremap.c
++++ b/arch/parisc/mm/ioremap.c
+@@ -3,7 +3,7 @@
+  * arch/parisc/mm/ioremap.c
+  *
+  * (C) Copyright 1995 1996 Linus Torvalds
+- * (C) Copyright 2001-2006 Helge Deller <[email protected]>
++ * (C) Copyright 2001-2019 Helge Deller <[email protected]>
+  * (C) Copyright 2005 Kyle McMartin <[email protected]>
+  */
+ 
+@@ -84,7 +84,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned 
long size, unsigned l
+       addr = (void __iomem *) area->addr;
+       if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
+                              phys_addr, pgprot)) {
+-              vfree(addr);
++              vunmap(addr);
+               return NULL;
+       }
+ 
+@@ -92,9 +92,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned 
long size, unsigned l
+ }
+ EXPORT_SYMBOL(__ioremap);
+ 
+-void iounmap(const volatile void __iomem *addr)
++void iounmap(const volatile void __iomem *io_addr)
+ {
+-      if (addr > high_memory)
+-              return vfree((void *) (PAGE_MASK & (unsigned long __force) 
addr));
++      unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
++
++      if (is_vmalloc_addr((void *)addr))
++              vunmap((void *)addr);
+ }
+ EXPORT_SYMBOL(iounmap);
+diff --git a/arch/x86/kernel/apic/x2apic_cluster.c 
b/arch/x86/kernel/apic/x2apic_cluster.c
+index 7685444a106b..145517934171 100644
+--- a/arch/x86/kernel/apic/x2apic_cluster.c
++++ b/arch/x86/kernel/apic/x2apic_cluster.c
+@@ -158,7 +158,8 @@ static int x2apic_dead_cpu(unsigned int dead_cpu)
+ {
+       struct cluster_mask *cmsk = per_cpu(cluster_masks, dead_cpu);
+ 
+-      cpumask_clear_cpu(dead_cpu, &cmsk->mask);
++      if (cmsk)
++              cpumask_clear_cpu(dead_cpu, &cmsk->mask);
+       free_cpumask_var(per_cpu(ipi_mask, dead_cpu));
+       return 0;
+ }
+diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
+index 250cfa85b633..88dc38b4a147 100644
+--- a/arch/x86/kernel/head64.c
++++ b/arch/x86/kernel/head64.c
+@@ -222,13 +222,31 @@ unsigned long __head __startup_64(unsigned long physaddr,
+        * we might write invalid pmds, when the kernel is relocated
+        * cleanup_highmap() fixes this up along with the mappings
+        * beyond _end.
++       *
++       * Only the region occupied by the kernel image has so far
++       * been checked against the table of usable memory regions
++       * provided by the firmware, so invalidate pages outside that
++       * region. A page table entry that maps to a reserved area of
++       * memory would allow processor speculation into that area,
++       * and on some hardware (particularly the UV platform) even
++       * speculative access to some reserved areas is caught as an
++       * error, causing the BIOS to halt the system.
+        */
+ 
+       pmd = fixup_pointer(level2_kernel_pgt, physaddr);
+-      for (i = 0; i < PTRS_PER_PMD; i++) {
++
++      /* invalidate pages before the kernel image */
++      for (i = 0; i < pmd_index((unsigned long)_text); i++)
++              pmd[i] &= ~_PAGE_PRESENT;
++
++      /* fixup pages that are part of the kernel image */
++      for (; i <= pmd_index((unsigned long)_end); i++)
+               if (pmd[i] & _PAGE_PRESENT)
+                       pmd[i] += load_delta;
+-      }
++
++      /* invalidate pages after the kernel image */
++      for (; i < PTRS_PER_PMD; i++)
++              pmd[i] &= ~_PAGE_PRESENT;
+ 
+       /*
+        * Fixup phys_base - remove the memory encryption mask to obtain
+diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
+index 1804b27f9632..66bcdeeee639 100644
+--- a/arch/x86/xen/efi.c
++++ b/arch/x86/xen/efi.c
+@@ -77,7 +77,9 @@ static efi_system_table_t __init *xen_efi_probe(void)
+       efi.get_variable             = xen_efi_get_variable;
+       efi.get_next_variable        = xen_efi_get_next_variable;
+       efi.set_variable             = xen_efi_set_variable;
++      efi.set_variable_nonblocking = xen_efi_set_variable;
+       efi.query_variable_info      = xen_efi_query_variable_info;
++      efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
+       efi.update_capsule           = xen_efi_update_capsule;
+       efi.query_capsule_caps       = xen_efi_query_capsule_caps;
+       efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
+diff --git a/arch/xtensa/kernel/xtensa_ksyms.c 
b/arch/xtensa/kernel/xtensa_ksyms.c
+index 04f19de46700..4092555828b1 100644
+--- a/arch/xtensa/kernel/xtensa_ksyms.c
++++ b/arch/xtensa/kernel/xtensa_ksyms.c
+@@ -119,13 +119,6 @@ EXPORT_SYMBOL(__invalidate_icache_range);
+ // FIXME EXPORT_SYMBOL(screen_info);
+ #endif
+ 
+-EXPORT_SYMBOL(outsb);
+-EXPORT_SYMBOL(outsw);
+-EXPORT_SYMBOL(outsl);
+-EXPORT_SYMBOL(insb);
+-EXPORT_SYMBOL(insw);
+-EXPORT_SYMBOL(insl);
+-
+ extern long common_exception_return;
+ EXPORT_SYMBOL(common_exception_return);
+ 
+diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h
+index 60fac2d066cf..98caba3e962e 100644
+--- a/block/blk-rq-qos.h
++++ b/block/blk-rq-qos.h
+@@ -80,16 +80,13 @@ static inline void rq_qos_add(struct request_queue *q, 
struct rq_qos *rqos)
+ 
+ static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
+ {
+-      struct rq_qos *cur, *prev = NULL;
+-      for (cur = q->rq_qos; cur; cur = cur->next) {
+-              if (cur == rqos) {
+-                      if (prev)
+-                              prev->next = rqos->next;
+-                      else
+-                              q->rq_qos = cur;
++      struct rq_qos **cur;
++
++      for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
++              if (*cur == rqos) {
++                      *cur = rqos->next;
+                       break;
+               }
+-              prev = cur;
+       }
+ }
+ 
+diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
+index a1aa59849b96..41228e545e82 100644
+--- a/drivers/acpi/cppc_acpi.c
++++ b/drivers/acpi/cppc_acpi.c
+@@ -909,8 +909,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
+                       pcc_data[pcc_ss_id]->refcount--;
+                       if (!pcc_data[pcc_ss_id]->refcount) {
+                               
pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel);
+-                              pcc_data[pcc_ss_id]->pcc_channel_acquired = 0;
+                               kfree(pcc_data[pcc_ss_id]);
++                              pcc_data[pcc_ss_id] = NULL;
+                       }
+               }
+       }
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
+index 5d110b1362e7..fa1c5a442957 100644
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -1633,7 +1633,9 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, 
struct ahci_host_priv *hp
+        */
+       if (!id || id->vendor != PCI_VENDOR_ID_INTEL)
+               return;
+-      if (((enum board_ids) id->driver_data) < board_ahci_pcs7)
++
++      /* Skip applying the quirk on Denverton and beyond */
++      if (((enum board_ids) id->driver_data) >= board_ahci_pcs7)
+               return;
+ 
+       /*
+diff --git a/drivers/base/core.c b/drivers/base/core.c
+index fcda6313e7de..985ccced33a2 100644
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -8,6 +8,7 @@
+  * Copyright (c) 2006 Novell, Inc.
+  */
+ 
++#include <linux/cpufreq.h>
+ #include <linux/device.h>
+ #include <linux/err.h>
+ #include <linux/fwnode.h>
+@@ -2943,6 +2944,8 @@ void device_shutdown(void)
+       wait_for_device_probe();
+       device_block_probing();
+ 
++      cpufreq_suspend();
++
+       spin_lock(&devices_kset->list_lock);
+       /*
+        * Walk the devices list backward, shutting down each in turn.
+diff --git a/drivers/base/memory.c b/drivers/base/memory.c
+index 817320c7c4c1..85ee64d0a44e 100644
+--- a/drivers/base/memory.c
++++ b/drivers/base/memory.c
+@@ -554,6 +554,9 @@ store_soft_offline_page(struct device *dev,
+       pfn >>= PAGE_SHIFT;
+       if (!pfn_valid(pfn))
+               return -ENXIO;
++      /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */
++      if (!pfn_to_online_page(pfn))
++              return -EIO;
+       ret = soft_offline_page(pfn_to_page(pfn), 0);
+       return ret == 0 ? count : ret;
+ }
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
+index d3213594d1a7..ace5ec65e36f 100644
+--- a/drivers/cpufreq/cpufreq.c
++++ b/drivers/cpufreq/cpufreq.c
+@@ -2578,14 +2578,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver 
*driver)
+ }
+ EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
+ 
+-/*
+- * Stop cpufreq at shutdown to make sure it isn't holding any locks
+- * or mutexes when secondary CPUs are halted.
+- */
+-static struct syscore_ops cpufreq_syscore_ops = {
+-      .shutdown = cpufreq_suspend,
+-};
+-
+ struct kobject *cpufreq_global_kobject;
+ EXPORT_SYMBOL(cpufreq_global_kobject);
+ 
+@@ -2597,8 +2589,6 @@ static int __init cpufreq_core_init(void)
+       cpufreq_global_kobject = kobject_create_and_add("cpufreq", 
&cpu_subsys.dev_root->kobj);
+       BUG_ON(!cpufreq_global_kobject);
+ 
+-      register_syscore_ops(&cpufreq_syscore_ops);
+-
+       return 0;
+ }
+ module_param(off, int, 0444);
+diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
+index 473aeec4b1da..574bce603337 100644
+--- a/drivers/edac/ghes_edac.c
++++ b/drivers/edac/ghes_edac.c
+@@ -532,7 +532,11 @@ void ghes_edac_unregister(struct ghes *ghes)
+       if (!ghes_pvt)
+               return;
+ 
++      if (atomic_dec_return(&ghes_init))
++              return;
++
+       mci = ghes_pvt->mci;
++      ghes_pvt = NULL;
+       edac_mc_del_mc(mci->pdev);
+       edac_mc_free(mci);
+ }
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+index b40e9c76af0c..5e29f14f4b30 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+@@ -841,6 +841,41 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
+       if (ret == -EPROBE_DEFER)
+               return ret;
+ 
++#ifdef CONFIG_DRM_AMDGPU_SI
++      if (!amdgpu_si_support) {
++              switch (flags & AMD_ASIC_MASK) {
++              case CHIP_TAHITI:
++              case CHIP_PITCAIRN:
++              case CHIP_VERDE:
++              case CHIP_OLAND:
++              case CHIP_HAINAN:
++                      dev_info(&pdev->dev,
++                               "SI support provided by radeon.\n");
++                      dev_info(&pdev->dev,
++                               "Use radeon.si_support=0 amdgpu.si_support=1 
to override.\n"
++                              );
++                      return -ENODEV;
++              }
++      }
++#endif
++#ifdef CONFIG_DRM_AMDGPU_CIK
++      if (!amdgpu_cik_support) {
++              switch (flags & AMD_ASIC_MASK) {
++              case CHIP_KAVERI:
++              case CHIP_BONAIRE:
++              case CHIP_HAWAII:
++              case CHIP_KABINI:
++              case CHIP_MULLINS:
++                      dev_info(&pdev->dev,
++                               "CIK support provided by radeon.\n");
++                      dev_info(&pdev->dev,
++                               "Use radeon.cik_support=0 amdgpu.cik_support=1 
to override.\n"
++                              );
++                      return -ENODEV;
++              }
++      }
++#endif
++
+       /* Get rid of things like offb */
+       ret = amdgpu_kick_out_firmware_fb(pdev);
+       if (ret)
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+index fc93b103f777..ba10577569f8 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+@@ -87,41 +87,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned 
long flags)
+       struct amdgpu_device *adev;
+       int r, acpi_status;
+ 
+-#ifdef CONFIG_DRM_AMDGPU_SI
+-      if (!amdgpu_si_support) {
+-              switch (flags & AMD_ASIC_MASK) {
+-              case CHIP_TAHITI:
+-              case CHIP_PITCAIRN:
+-              case CHIP_VERDE:
+-              case CHIP_OLAND:
+-              case CHIP_HAINAN:
+-                      dev_info(dev->dev,
+-                               "SI support provided by radeon.\n");
+-                      dev_info(dev->dev,
+-                               "Use radeon.si_support=0 amdgpu.si_support=1 
to override.\n"
+-                              );
+-                      return -ENODEV;
+-              }
+-      }
+-#endif
+-#ifdef CONFIG_DRM_AMDGPU_CIK
+-      if (!amdgpu_cik_support) {
+-              switch (flags & AMD_ASIC_MASK) {
+-              case CHIP_KAVERI:
+-              case CHIP_BONAIRE:
+-              case CHIP_HAWAII:
+-              case CHIP_KABINI:
+-              case CHIP_MULLINS:
+-                      dev_info(dev->dev,
+-                               "CIK support provided by radeon.\n");
+-                      dev_info(dev->dev,
+-                               "Use radeon.cik_support=0 amdgpu.cik_support=1 
to override.\n"
+-                              );
+-                      return -ENODEV;
+-              }
+-      }
+-#endif
+-
+       adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
+       if (adev == NULL) {
+               return -ENOMEM;
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
+index e5e7e65934da..f5926bf5dabd 100644
+--- a/drivers/gpu/drm/drm_edid.c
++++ b/drivers/gpu/drm/drm_edid.c
+@@ -166,6 +166,9 @@ static const struct edid_quirk {
+       /* Medion MD 30217 PG */
+       { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 },
+ 
++      /* Lenovo G50 */
++      { "SDC", 18514, EDID_QUIRK_FORCE_6BPC },
++
+       /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
+       { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
+ 
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
+index d83310751a8e..c26f09b47ecb 100644
+--- a/drivers/gpu/drm/radeon/radeon_drv.c
++++ b/drivers/gpu/drm/radeon/radeon_drv.c
+@@ -395,19 +395,11 @@ radeon_pci_remove(struct pci_dev *pdev)
+ static void
+ radeon_pci_shutdown(struct pci_dev *pdev)
+ {
+-      struct drm_device *ddev = pci_get_drvdata(pdev);
+-
+       /* if we are running in a VM, make sure the device
+        * torn down properly on reboot/shutdown
+        */
+       if (radeon_device_is_virtual())
+               radeon_pci_remove(pdev);
+-
+-      /* Some adapters need to be suspended before a
+-      * shutdown occurs in order to prevent an error
+-      * during kexec.
+-      */
+-      radeon_suspend_kms(ddev, true, true, false);
+ }
+ 
+ static int radeon_pmops_suspend(struct device *dev)
+diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+index 6fe91c1b692d..185655f22f89 100644
+--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
++++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+@@ -273,15 +273,13 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
+               else
+                       ret = vmf_insert_pfn(&cvma, address, pfn);
+ 
+-              /*
+-               * Somebody beat us to this PTE or prefaulting to
+-               * an already populated PTE, or prefaulting error.
+-               */
+-
+-              if (unlikely((ret == VM_FAULT_NOPAGE && i > 0)))
+-                      break;
+-              else if (unlikely(ret & VM_FAULT_ERROR))
+-                      goto out_io_unlock;
++              /* Never error on prefaulted PTEs */
++              if (unlikely((ret & VM_FAULT_ERROR))) {
++                      if (i == 0)
++                              goto out_io_unlock;
++                      else
++                              break;
++              }
+ 
+               address += PAGE_SIZE;
+               if (unlikely(++page_offset >= page_last))
+diff --git a/drivers/infiniband/hw/cxgb4/mem.c 
b/drivers/infiniband/hw/cxgb4/mem.c
+index 7b76e6f81aeb..f2fb7318abc1 100644
+--- a/drivers/infiniband/hw/cxgb4/mem.c
++++ b/drivers/infiniband/hw/cxgb4/mem.c
+@@ -274,13 +274,17 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 
reset_tpt_entry,
+                          struct sk_buff *skb, struct c4iw_wr_wait *wr_waitp)
+ {
+       int err;
+-      struct fw_ri_tpte tpt;
++      struct fw_ri_tpte *tpt;
+       u32 stag_idx;
+       static atomic_t key;
+ 
+       if (c4iw_fatal_error(rdev))
+               return -EIO;
+ 
++      tpt = kmalloc(sizeof(*tpt), GFP_KERNEL);
++      if (!tpt)
++              return -ENOMEM;
++
+       stag_state = stag_state > 0;
+       stag_idx = (*stag) >> 8;
+ 
+@@ -290,6 +294,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 
reset_tpt_entry,
+                       mutex_lock(&rdev->stats.lock);
+                       rdev->stats.stag.fail++;
+                       mutex_unlock(&rdev->stats.lock);
++                      kfree(tpt);
+                       return -ENOMEM;
+               }
+               mutex_lock(&rdev->stats.lock);
+@@ -304,28 +309,28 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 
reset_tpt_entry,
+ 
+       /* write TPT entry */
+       if (reset_tpt_entry)
+-              memset(&tpt, 0, sizeof(tpt));
++              memset(tpt, 0, sizeof(*tpt));
+       else {
+-              tpt.valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F |
++              tpt->valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F |
+                       FW_RI_TPTE_STAGKEY_V((*stag & FW_RI_TPTE_STAGKEY_M)) |
+                       FW_RI_TPTE_STAGSTATE_V(stag_state) |
+                       FW_RI_TPTE_STAGTYPE_V(type) | FW_RI_TPTE_PDID_V(pdid));
+-              tpt.locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) |
++              tpt->locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) |
+                       (bind_enabled ? FW_RI_TPTE_MWBINDEN_F : 0) |
+                       FW_RI_TPTE_ADDRTYPE_V((zbva ? FW_RI_ZERO_BASED_TO :
+                                                     FW_RI_VA_BASED_TO))|
+                       FW_RI_TPTE_PS_V(page_size));
+-              tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32(
++              tpt->nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32(
+                       FW_RI_TPTE_PBLADDR_V(PBL_OFF(rdev, pbl_addr)>>3));
+-              tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL));
+-              tpt.va_hi = cpu_to_be32((u32)(to >> 32));
+-              tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL));
+-              tpt.dca_mwbcnt_pstag = cpu_to_be32(0);
+-              tpt.len_hi = cpu_to_be32((u32)(len >> 32));
++              tpt->len_lo = cpu_to_be32((u32)(len & 0xffffffffUL));
++              tpt->va_hi = cpu_to_be32((u32)(to >> 32));
++              tpt->va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL));
++              tpt->dca_mwbcnt_pstag = cpu_to_be32(0);
++              tpt->len_hi = cpu_to_be32((u32)(len >> 32));
+       }
+       err = write_adapter_mem(rdev, stag_idx +
+                               (rdev->lldi.vr->stag.start >> 5),
+-                              sizeof(tpt), &tpt, skb, wr_waitp);
++                              sizeof(*tpt), tpt, skb, wr_waitp);
+ 
+       if (reset_tpt_entry) {
+               c4iw_put_resource(&rdev->resource.tpt_table, stag_idx);
+@@ -333,6 +338,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 
reset_tpt_entry,
+               rdev->stats.stag.cur -= 32;
+               mutex_unlock(&rdev->stats.lock);
+       }
++      kfree(tpt);
+       return err;
+ }
+ 
+diff --git a/drivers/input/misc/da9063_onkey.c 
b/drivers/input/misc/da9063_onkey.c
+index 3e9c353d82ef..a01b25facf46 100644
+--- a/drivers/input/misc/da9063_onkey.c
++++ b/drivers/input/misc/da9063_onkey.c
+@@ -248,10 +248,7 @@ static int da9063_onkey_probe(struct platform_device 
*pdev)
+       onkey->input->phys = onkey->phys;
+       onkey->input->dev.parent = &pdev->dev;
+ 
+-      if (onkey->key_power)
+-              input_set_capability(onkey->input, EV_KEY, KEY_POWER);
+-
+-      input_set_capability(onkey->input, EV_KEY, KEY_SLEEP);
++      input_set_capability(onkey->input, EV_KEY, KEY_POWER);
+ 
+       INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
+ 
+diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
+index 7fb358f96195..162526a0d463 100644
+--- a/drivers/input/rmi4/rmi_driver.c
++++ b/drivers/input/rmi4/rmi_driver.c
+@@ -149,7 +149,7 @@ static int rmi_process_interrupt_requests(struct 
rmi_device *rmi_dev)
+       }
+ 
+       mutex_lock(&data->irq_mutex);
+-      bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask,
++      bitmap_and(data->irq_status, data->irq_status, data->fn_irq_bits,
+              data->irq_count);
+       /*
+        * At this point, irq_status has all bits that are set in the
+@@ -388,6 +388,8 @@ static int rmi_driver_set_irq_bits(struct rmi_device 
*rmi_dev,
+       bitmap_copy(data->current_irq_mask, data->new_irq_mask,
+                   data->num_of_irq_regs);
+ 
++      bitmap_or(data->fn_irq_bits, data->fn_irq_bits, mask, data->irq_count);
++
+ error_unlock:
+       mutex_unlock(&data->irq_mutex);
+       return error;
+@@ -401,6 +403,8 @@ static int rmi_driver_clear_irq_bits(struct rmi_device 
*rmi_dev,
+       struct device *dev = &rmi_dev->dev;
+ 
+       mutex_lock(&data->irq_mutex);
++      bitmap_andnot(data->fn_irq_bits,
++                    data->fn_irq_bits, mask, data->irq_count);
+       bitmap_andnot(data->new_irq_mask,
+                 data->current_irq_mask, mask, data->irq_count);
+ 
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
+index b29a8327eed1..84ff70027c25 100644
+--- a/drivers/md/dm-cache-target.c
++++ b/drivers/md/dm-cache-target.c
+@@ -541,7 +541,7 @@ static void wake_migration_worker(struct cache *cache)
+ 
+ static struct dm_bio_prison_cell_v2 *alloc_prison_cell(struct cache *cache)
+ {
+-      return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOWAIT);
++      return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOIO);
+ }
+ 
+ static void free_prison_cell(struct cache *cache, struct 
dm_bio_prison_cell_v2 *cell)
+@@ -553,9 +553,7 @@ static struct dm_cache_migration *alloc_migration(struct 
cache *cache)
+ {
+       struct dm_cache_migration *mg;
+ 
+-      mg = mempool_alloc(&cache->migration_pool, GFP_NOWAIT);
+-      if (!mg)
+-              return NULL;
++      mg = mempool_alloc(&cache->migration_pool, GFP_NOIO);
+ 
+       memset(mg, 0, sizeof(*mg));
+ 
+@@ -663,10 +661,6 @@ static bool bio_detain_shared(struct cache *cache, 
dm_oblock_t oblock, struct bi
+       struct dm_bio_prison_cell_v2 *cell_prealloc, *cell;
+ 
+       cell_prealloc = alloc_prison_cell(cache); /* FIXME: allow wait if 
calling from worker */
+-      if (!cell_prealloc) {
+-              defer_bio(cache, bio);
+-              return false;
+-      }
+ 
+       build_key(oblock, end, &key);
+       r = dm_cell_get_v2(cache->prison, &key, lock_level(bio), bio, 
cell_prealloc, &cell);
+@@ -1492,11 +1486,6 @@ static int mg_lock_writes(struct dm_cache_migration *mg)
+       struct dm_bio_prison_cell_v2 *prealloc;
+ 
+       prealloc = alloc_prison_cell(cache);
+-      if (!prealloc) {
+-              DMERR_LIMIT("%s: alloc_prison_cell failed", 
cache_device_name(cache));
+-              mg_complete(mg, false);
+-              return -ENOMEM;
+-      }
+ 
+       /*
+        * Prevent writes to the block, but allow reads to continue.
+@@ -1534,11 +1523,6 @@ static int mg_start(struct cache *cache, struct 
policy_work *op, struct bio *bio
+       }
+ 
+       mg = alloc_migration(cache);
+-      if (!mg) {
+-              policy_complete_background_work(cache->policy, op, false);
+-              background_work_end(cache);
+-              return -ENOMEM;
+-      }
+ 
+       mg->op = op;
+       mg->overwrite_bio = bio;
+@@ -1627,10 +1611,6 @@ static int invalidate_lock(struct dm_cache_migration 
*mg)
+       struct dm_bio_prison_cell_v2 *prealloc;
+ 
+       prealloc = alloc_prison_cell(cache);
+-      if (!prealloc) {
+-              invalidate_complete(mg, false);
+-              return -ENOMEM;
+-      }
+ 
+       build_key(mg->invalidate_oblock, oblock_succ(mg->invalidate_oblock), 
&key);
+       r = dm_cell_lock_v2(cache->prison, &key,
+@@ -1668,10 +1648,6 @@ static int invalidate_start(struct cache *cache, 
dm_cblock_t cblock,
+               return -EPERM;
+ 
+       mg = alloc_migration(cache);
+-      if (!mg) {
+-              background_work_end(cache);
+-              return -ENOMEM;
+-      }
+ 
+       mg->overwrite_bio = bio;
+       mg->invalidate_cblock = cblock;
+diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
+index 43fa7dbf844b..3cafbfd655f5 100644
+--- a/drivers/md/raid0.c
++++ b/drivers/md/raid0.c
+@@ -158,7 +158,7 @@ static int create_strip_zones(struct mddev *mddev, struct 
r0conf **private_conf)
+       } else {
+               pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with 
default_layout setting\n",
+                      mdname(mddev));
+-              pr_err("md/raid0: please set raid.default_layout to 1 or 2\n");
++              pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
+               err = -ENOTSUPP;
+               goto abort;
+       }
+diff --git a/drivers/memstick/host/jmb38x_ms.c 
b/drivers/memstick/host/jmb38x_ms.c
+index bcdca9fbef51..29f5021d21ea 100644
+--- a/drivers/memstick/host/jmb38x_ms.c
++++ b/drivers/memstick/host/jmb38x_ms.c
+@@ -949,7 +949,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev,
+       if (!cnt) {
+               rc = -ENODEV;
+               pci_dev_busy = 1;
+-              goto err_out;
++              goto err_out_int;
+       }
+ 
+       jm = kzalloc(sizeof(struct jmb38x_ms)
+diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
+index a8af682a9182..28f5aaca505a 100644
+--- a/drivers/mmc/host/cqhci.c
++++ b/drivers/mmc/host/cqhci.c
+@@ -617,7 +617,8 @@ static int cqhci_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
+       cq_host->slot[tag].flags = 0;
+ 
+       cq_host->qcnt += 1;
+-
++      /* Make sure descriptors are ready before ringing the doorbell */
++      wmb();
+       cqhci_writel(cq_host, 1 << tag, CQHCI_TDBR);
+       if (!(cqhci_readl(cq_host, CQHCI_TDBR) & (1 << tag)))
+               pr_debug("%s: cqhci: doorbell not set for tag %d\n",
+diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
+index bdd8f2df6630..33232cc9fb04 100644
+--- a/drivers/net/dsa/qca8k.c
++++ b/drivers/net/dsa/qca8k.c
+@@ -543,7 +543,7 @@ qca8k_setup(struct dsa_switch *ds)
+                   BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
+ 
+       /* Setup connection between CPU port & user ports */
+-      for (i = 0; i < DSA_MAX_PORTS; i++) {
++      for (i = 0; i < QCA8K_NUM_PORTS; i++) {
+               /* CPU port gets connected to all user ports of the switch */
+               if (dsa_is_cpu_port(ds, i)) {
+                       qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
+@@ -897,7 +897,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
+       if (id != QCA8K_ID_QCA8337)
+               return -ENODEV;
+ 
+-      priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
++      priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
+       if (!priv->ds)
+               return -ENOMEM;
+ 
+diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
+index a4d5049df692..f4b14b6acd22 100644
+--- a/drivers/net/dsa/rtl8366rb.c
++++ b/drivers/net/dsa/rtl8366rb.c
+@@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi 
*smi)
+       irq = of_irq_get(intc, 0);
+       if (irq <= 0) {
+               dev_err(smi->dev, "failed to get parent IRQ\n");
+-              return irq ? irq : -EINVAL;
++              ret = irq ? irq : -EINVAL;
++              goto out_put_node;
+       }
+ 
+       /* This clears the IRQ status register */
+@@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi 
*smi)
+                         &val);
+       if (ret) {
+               dev_err(smi->dev, "can't read interrupt status\n");
+-              return ret;
++              goto out_put_node;
+       }
+ 
+       /* Fetch IRQ edge information from the descriptor */
+@@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi 
*smi)
+                                val);
+       if (ret) {
+               dev_err(smi->dev, "could not configure IRQ polarity\n");
+-              return ret;
++              goto out_put_node;
+       }
+ 
+       ret = devm_request_threaded_irq(smi->dev, irq, NULL,
+@@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi 
*smi)
+                                       "RTL8366RB", smi);
+       if (ret) {
+               dev_err(smi->dev, "unable to request irq: %d\n", ret);
+-              return ret;
++              goto out_put_node;
+       }
+       smi->irqdomain = irq_domain_add_linear(intc,
+                                              RTL8366RB_NUM_INTERRUPT,
+@@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct 
realtek_smi *smi)
+                                              smi);
+       if (!smi->irqdomain) {
+               dev_err(smi->dev, "failed to create IRQ domain\n");
+-              return -EINVAL;
++              ret = -EINVAL;
++              goto out_put_node;
+       }
+       for (i = 0; i < smi->num_ports; i++)
+               irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq);
+ 
+-      return 0;
++out_put_node:
++      of_node_put(intc);
++      return ret;
+ }
+ 
+ static int rtl8366rb_set_addr(struct realtek_smi *smi)
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h 
b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+index 14b49612aa86..4dabf37319c8 100644
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+@@ -369,6 +369,7 @@ struct bcmgenet_mib_counters {
+ #define  EXT_PWR_DOWN_PHY_EN          (1 << 20)
+ 
+ #define EXT_RGMII_OOB_CTRL            0x0C
++#define  RGMII_MODE_EN_V123           (1 << 0)
+ #define  RGMII_LINK                   (1 << 4)
+ #define  OOB_DISABLE                  (1 << 5)
+ #define  RGMII_MODE_EN                        (1 << 6)
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c 
b/drivers/net/ethernet/broadcom/genet/bcmmii.c
+index de0e24d912fe..0d527fa5de61 100644
+--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
++++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
+@@ -261,7 +261,11 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
+        */
+       if (priv->ext_phy) {
+               reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
+-              reg |= RGMII_MODE_EN | id_mode_dis;
++              reg |= id_mode_dis;
++              if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
++                      reg |= RGMII_MODE_EN_V123;
++              else
++                      reg |= RGMII_MODE_EN;
+               bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
+       }
+ 
+@@ -276,11 +280,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
+       struct bcmgenet_priv *priv = netdev_priv(dev);
+       struct device_node *dn = priv->pdev->dev.of_node;
+       struct phy_device *phydev;
+-      u32 phy_flags;
++      u32 phy_flags = 0;
+       int ret;
+ 
+       /* Communicate the integrated PHY revision */
+-      phy_flags = priv->gphy_rev;
++      if (priv->internal_phy)
++              phy_flags = priv->gphy_rev;
+ 
+       /* Initialize link state variables that bcmgenet_mii_setup() uses */
+       priv->old_link = -1;
+diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c 
b/drivers/net/ethernet/hisilicon/hns_mdio.c
+index baf5cc251f32..9a3bc0994a1d 100644
+--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
++++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
+@@ -156,11 +156,15 @@ static int mdio_sc_cfg_reg_write(struct hns_mdio_device 
*mdio_dev,
+ {
+       u32 time_cnt;
+       u32 reg_value;
++      int ret;
+ 
+       regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val);
+ 
+       for (time_cnt = MDIO_TIMEOUT; time_cnt; time_cnt--) {
+-              regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
++              ret = regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
++              if (ret)
++                      return ret;
++
+               reg_value &= st_msk;
+               if ((!!check_st) == (!!reg_value))
+                       break;
+diff --git a/drivers/net/ethernet/i825xx/lasi_82596.c 
b/drivers/net/ethernet/i825xx/lasi_82596.c
+index b69c622ba8b2..6f0e4019adef 100644
+--- a/drivers/net/ethernet/i825xx/lasi_82596.c
++++ b/drivers/net/ethernet/i825xx/lasi_82596.c
+@@ -96,6 +96,8 @@
+ 
+ #define OPT_SWAP_PORT 0x0001  /* Need to wordswp on the MPU port */
+ 
++#define LIB82596_DMA_ATTR     DMA_ATTR_NON_CONSISTENT
++
+ #define DMA_WBACK(ndev, addr, len) \
+       do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, 
DMA_TO_DEVICE); } while (0)
+ 
+@@ -199,7 +201,7 @@ static int __exit lan_remove_chip(struct parisc_device 
*pdev)
+ 
+       unregister_netdev (dev);
+       dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
+-                     lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
++                     lp->dma_addr, LIB82596_DMA_ATTR);
+       free_netdev (dev);
+       return 0;
+ }
+diff --git a/drivers/net/ethernet/i825xx/lib82596.c 
b/drivers/net/ethernet/i825xx/lib82596.c
+index 2f7ae118217f..d0e8193ca470 100644
+--- a/drivers/net/ethernet/i825xx/lib82596.c
++++ b/drivers/net/ethernet/i825xx/lib82596.c
+@@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev)
+ 
+       dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
+                             &lp->dma_addr, GFP_KERNEL,
+-                            DMA_ATTR_NON_CONSISTENT);
++                            LIB82596_DMA_ATTR);
+       if (!dma) {
+               printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
+               return -ENOMEM;
+@@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev)
+       i = register_netdev(dev);
+       if (i) {
+               dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
+-                             dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
++                             dma, lp->dma_addr, LIB82596_DMA_ATTR);
+               return i;
+       }
+ 
+diff --git a/drivers/net/ethernet/i825xx/sni_82596.c 
b/drivers/net/ethernet/i825xx/sni_82596.c
+index b2c04a789744..43c1fd18670b 100644
+--- a/drivers/net/ethernet/i825xx/sni_82596.c
++++ b/drivers/net/ethernet/i825xx/sni_82596.c
+@@ -23,6 +23,8 @@
+ 
+ static const char sni_82596_string[] = "snirm_82596";
+ 
++#define LIB82596_DMA_ATTR     0
++
+ #define DMA_WBACK(priv, addr, len)     do { } while (0)
+ #define DMA_INV(priv, addr, len)       do { } while (0)
+ #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
+@@ -151,7 +153,7 @@ static int sni_82596_driver_remove(struct platform_device 
*pdev)
+ 
+       unregister_netdev(dev);
+       dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
+-                     lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
++                     lp->dma_addr, LIB82596_DMA_ATTR);
+       iounmap(lp->ca);
+       iounmap(lp->mpu_port);
+       free_netdev (dev);
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
+index aa067a7a72d4..8fa14736449b 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -2731,12 +2731,10 @@ static int enable_scrq_irq(struct ibmvnic_adapter 
*adapter,
+ 
+       if (adapter->resetting &&
+           adapter->reset_reason == VNIC_RESET_MOBILITY) {
+-              u64 val = (0xff000000) | scrq->hw_irq;
++              struct irq_desc *desc = irq_to_desc(scrq->irq);
++              struct irq_chip *chip = irq_desc_get_chip(desc);
+ 
+-              rc = plpar_hcall_norets(H_EOI, val);
+-              if (rc)
+-                      dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n",
+-                              val, rc);
++              chip->irq_eoi(&desc->irq_data);
+       }
+ 
+       rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+index 0101ebaecf02..014fe93ed2d8 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+@@ -4522,8 +4522,10 @@ int stmmac_suspend(struct device *dev)
+               stmmac_mac_set(priv, priv->ioaddr, false);
+               pinctrl_pm_select_sleep_state(priv->device);
+               /* Disable clock in case of PWM is off */
+-              clk_disable(priv->plat->pclk);
+-              clk_disable(priv->plat->stmmac_clk);
++              if (priv->plat->clk_ptp_ref)
++                      clk_disable_unprepare(priv->plat->clk_ptp_ref);
++              clk_disable_unprepare(priv->plat->pclk);
++              clk_disable_unprepare(priv->plat->stmmac_clk);
+       }
+       mutex_unlock(&priv->lock);
+ 
+@@ -4588,8 +4590,10 @@ int stmmac_resume(struct device *dev)
+       } else {
+               pinctrl_pm_select_default_state(priv->device);
+               /* enable the clk previously disabled */
+-              clk_enable(priv->plat->stmmac_clk);
+-              clk_enable(priv->plat->pclk);
++              clk_prepare_enable(priv->plat->stmmac_clk);
++              clk_prepare_enable(priv->plat->pclk);
++              if (priv->plat->clk_ptp_ref)
++                      clk_prepare_enable(priv->plat->clk_ptp_ref);
+               /* reset the phy so that it's ready */
+               if (priv->mii)
+                       stmmac_mdio_reset(priv->mii);
+diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
+index b2ff903a9cb6..38a41651e451 100644
+--- a/drivers/net/ieee802154/ca8210.c
++++ b/drivers/net/ieee802154/ca8210.c
+@@ -3151,12 +3151,12 @@ static int ca8210_probe(struct spi_device *spi_device)
+               goto error;
+       }
+ 
++      priv->spi->dev.platform_data = pdata;
+       ret = ca8210_get_platform_data(priv->spi, pdata);
+       if (ret) {
+               dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
+               goto error;
+       }
+-      priv->spi->dev.platform_data = pdata;
+ 
+       ret = ca8210_dev_com_init(priv);
+       if (ret) {
+diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
+index a065a6184f7e..a291e5f2daef 100644
+--- a/drivers/net/usb/r8152.c
++++ b/drivers/net/usb/r8152.c
+@@ -4474,10 +4474,9 @@ static int rtl8152_reset_resume(struct usb_interface 
*intf)
+       struct r8152 *tp = usb_get_intfdata(intf);
+ 
+       clear_bit(SELECTIVE_SUSPEND, &tp->flags);
+-      mutex_lock(&tp->control);
+       tp->rtl_ops.init(tp);
+       queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
+-      mutex_unlock(&tp->control);
++      set_ethernet_addr(tp);
+       return rtl8152_resume(intf);
+ }
+ 
+diff --git a/drivers/net/xen-netback/interface.c 
b/drivers/net/xen-netback/interface.c
+index 82add0ac4a5f..27b6b141cb71 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -718,7 +718,6 @@ err_unmap:
+       xenvif_unmap_frontend_data_rings(queue);
+       netif_napi_del(&queue->napi);
+ err:
+-      module_put(THIS_MODULE);
+       return err;
+ }
+ 
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index ae0b01059fc6..5d0f99bcc987 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -111,10 +111,13 @@ static void nvme_set_queue_dying(struct nvme_ns *ns)
+        */
+       if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags))
+               return;
+-      revalidate_disk(ns->disk);
+       blk_set_queue_dying(ns->queue);
+       /* Forcibly unquiesce queues to avoid blocking dispatch */
+       blk_mq_unquiesce_queue(ns->queue);
++      /*
++       * Revalidate after unblocking dispatchers that may be holding bd_butex
++       */
++      revalidate_disk(ns->disk);
+ }
+ 
+ static void nvme_queue_scan(struct nvme_ctrl *ctrl)
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
+index 6384930a6749..2baf1f82f893 100644
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -925,19 +925,6 @@ void pci_update_current_state(struct pci_dev *dev, 
pci_power_t state)
+       }
+ }
+ 
+-/**
+- * pci_power_up - Put the given device into D0 forcibly
+- * @dev: PCI device to power up
+- */
+-void pci_power_up(struct pci_dev *dev)
+-{
+-      if (platform_pci_power_manageable(dev))
+-              platform_pci_set_power_state(dev, PCI_D0);
+-
+-      pci_raw_set_power_state(dev, PCI_D0);
+-      pci_update_current_state(dev, PCI_D0);
+-}
+-
+ /**
+  * pci_platform_power_transition - Use platform to change device power state
+  * @dev: PCI device to handle.
+@@ -1116,6 +1103,17 @@ int pci_set_power_state(struct pci_dev *dev, 
pci_power_t state)
+ }
+ EXPORT_SYMBOL(pci_set_power_state);
+ 
++/**
++ * pci_power_up - Put the given device into D0 forcibly
++ * @dev: PCI device to power up
++ */
++void pci_power_up(struct pci_dev *dev)
++{
++      __pci_start_power_transition(dev, PCI_D0);
++      pci_raw_set_power_state(dev, PCI_D0);
++      pci_update_current_state(dev, PCI_D0);
++}
++
+ /**
+  * pci_choose_state - Choose the power state of a PCI device
+  * @dev: PCI device to be suspended
+diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c 
b/drivers/pinctrl/intel/pinctrl-cherryview.c
+index b7e272d6ae81..227646eb817c 100644
+--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
++++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
+@@ -1524,7 +1524,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+                       DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
+               },
+       },
+       {
+@@ -1532,7 +1531,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
+               },
+       },
+       {
+@@ -1540,7 +1538,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
+               },
+       },
+       {
+@@ -1548,7 +1545,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = {
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Celes"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
+               },
+       },
+       {}
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c 
b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+index aa48b3f23c7f..3aac640596ad 100644
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+@@ -183,10 +183,10 @@ static struct armada_37xx_pin_group 
armada_37xx_nb_groups[] = {
+       PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19),
+                     BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19),
+                     18, 2, "gpio", "uart"),
+-      PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"),
+-      PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"),
+-      PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"),
+-      PIN_GRP_GPIO("led3_od", 14, 1, BIT(23), "led"),
++      PIN_GRP_GPIO_2("led0_od", 11, 1, BIT(20), BIT(20), 0, "led"),
++      PIN_GRP_GPIO_2("led1_od", 12, 1, BIT(21), BIT(21), 0, "led"),
++      PIN_GRP_GPIO_2("led2_od", 13, 1, BIT(22), BIT(22), 0, "led"),
++      PIN_GRP_GPIO_2("led3_od", 14, 1, BIT(23), BIT(23), 0, "led"),
+ 
+ };
+ 
+@@ -218,11 +218,11 @@ static const struct armada_37xx_pin_data 
armada_37xx_pin_sb = {
+ };
+ 
+ static inline void armada_37xx_update_reg(unsigned int *reg,
+-                                        unsigned int offset)
++                                        unsigned int *offset)
+ {
+       /* We never have more than 2 registers */
+-      if (offset >= GPIO_PER_REG) {
+-              offset -= GPIO_PER_REG;
++      if (*offset >= GPIO_PER_REG) {
++              *offset -= GPIO_PER_REG;
+               *reg += sizeof(u32);
+       }
+ }
+@@ -373,7 +373,7 @@ static inline void armada_37xx_irq_update_reg(unsigned int 
*reg,
+ {
+       int offset = irqd_to_hwirq(d);
+ 
+-      armada_37xx_update_reg(reg, offset);
++      armada_37xx_update_reg(reg, &offset);
+ }
+ 
+ static int armada_37xx_gpio_direction_input(struct gpio_chip *chip,
+@@ -383,7 +383,7 @@ static int armada_37xx_gpio_direction_input(struct 
gpio_chip *chip,
+       unsigned int reg = OUTPUT_EN;
+       unsigned int mask;
+ 
+-      armada_37xx_update_reg(&reg, offset);
++      armada_37xx_update_reg(&reg, &offset);
+       mask = BIT(offset);
+ 
+       return regmap_update_bits(info->regmap, reg, mask, 0);
+@@ -396,7 +396,7 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip 
*chip,
+       unsigned int reg = OUTPUT_EN;
+       unsigned int val, mask;
+ 
+-      armada_37xx_update_reg(&reg, offset);
++      armada_37xx_update_reg(&reg, &offset);
+       mask = BIT(offset);
+       regmap_read(info->regmap, reg, &val);
+ 
+@@ -410,7 +410,7 @@ static int armada_37xx_gpio_direction_output(struct 
gpio_chip *chip,
+       unsigned int reg = OUTPUT_EN;
+       unsigned int mask, val, ret;
+ 
+-      armada_37xx_update_reg(&reg, offset);
++      armada_37xx_update_reg(&reg, &offset);
+       mask = BIT(offset);
+ 
+       ret = regmap_update_bits(info->regmap, reg, mask, mask);
+@@ -431,7 +431,7 @@ static int armada_37xx_gpio_get(struct gpio_chip *chip, 
unsigned int offset)
+       unsigned int reg = INPUT_VAL;
+       unsigned int val, mask;
+ 
+-      armada_37xx_update_reg(&reg, offset);
++      armada_37xx_update_reg(&reg, &offset);
+       mask = BIT(offset);
+ 
+       regmap_read(info->regmap, reg, &val);
+@@ -446,7 +446,7 @@ static void armada_37xx_gpio_set(struct gpio_chip *chip, 
unsigned int offset,
+       unsigned int reg = OUTPUT_VAL;
+       unsigned int mask, val;
+ 
+-      armada_37xx_update_reg(&reg, offset);
++      armada_37xx_update_reg(&reg, &offset);
+       mask = BIT(offset);
+       val = value ? mask : 0;
+ 
+diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
+index aff073a5b52b..df888506e363 100644
+--- a/drivers/s390/scsi/zfcp_fsf.c
++++ b/drivers/s390/scsi/zfcp_fsf.c
+@@ -21,6 +21,11 @@
+ 
+ struct kmem_cache *zfcp_fsf_qtcb_cache;
+ 
++static bool ber_stop = true;
++module_param(ber_stop, bool, 0600);
++MODULE_PARM_DESC(ber_stop,
++               "Shuts down FCP devices for FCP channels that report a 
bit-error count in excess of its threshold (default on)");
++
+ static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
+ {
+       struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
+@@ -230,10 +235,15 @@ static void zfcp_fsf_status_read_handler(struct 
zfcp_fsf_req *req)
+       case FSF_STATUS_READ_SENSE_DATA_AVAIL:
+               break;
+       case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
+-              dev_warn(&adapter->ccw_device->dev,
+-                       "The error threshold for checksum statistics "
+-                       "has been exceeded\n");
+               zfcp_dbf_hba_bit_err("fssrh_3", req);
++              if (ber_stop) {
++                      dev_warn(&adapter->ccw_device->dev,
++                               "All paths over this FCP device are disused 
because of excessive bit errors\n");
++                      zfcp_erp_adapter_shutdown(adapter, 0, "fssrh_b");
++              } else {
++                      dev_warn(&adapter->ccw_device->dev,
++                               "The error threshold for checksum statistics 
has been exceeded\n");
++              }
+               break;
+       case FSF_STATUS_READ_LINK_DOWN:
+               zfcp_fsf_status_read_link_down(req);
+diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
+index 1c5051b1c125..9e287927b7f9 100644
+--- a/drivers/scsi/ch.c
++++ b/drivers/scsi/ch.c
+@@ -578,7 +578,6 @@ ch_release(struct inode *inode, struct file *file)
+       scsi_changer *ch = file->private_data;
+ 
+       scsi_device_put(ch->device);
+-      ch->device = NULL;
+       file->private_data = NULL;
+       kref_put(&ch->ref, ch_destroy);
+       return 0;
+diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
+index 8c7154143a4e..a84878fbf45d 100644
+--- a/drivers/scsi/megaraid.c
++++ b/drivers/scsi/megaraid.c
+@@ -4189,11 +4189,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
+                */
+               if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
+                   pdev->subsystem_device == 0xC000)
+-                      return -ENODEV;
++                      goto out_disable_device;
+               /* Now check the magic signature byte */
+               pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
+               if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
+-                      return -ENODEV;
++                      goto out_disable_device;
+               /* Ok it is probably a megaraid */
+       }
+ 
+diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
+index 7a1cc0b25e59..d6dc320f81a7 100644
+--- a/drivers/scsi/qla2xxx/qla_target.c
++++ b/drivers/scsi/qla2xxx/qla_target.c
+@@ -1023,6 +1023,7 @@ void qlt_free_session_done(struct work_struct *work)
+ 
+       if (logout_started) {
+               bool traced = false;
++              u16 cnt = 0;
+ 
+               while (!READ_ONCE(sess->logout_completed)) {
+                       if (!traced) {
+@@ -1032,6 +1033,9 @@ void qlt_free_session_done(struct work_struct *work)
+                               traced = true;
+                       }
+                       msleep(100);
++                      cnt++;
++                      if (cnt > 200)
++                              break;
+               }
+ 
+               ql_dbg(ql_dbg_disc, vha, 0xf087,
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index b7a8fdfeb2f4..e731af504f07 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -970,6 +970,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct 
scsi_eh_save *ses,
+       ses->sdb = scmd->sdb;
+       ses->next_rq = scmd->request->next_rq;
+       ses->result = scmd->result;
++      ses->resid_len = scmd->req.resid_len;
+       ses->underflow = scmd->underflow;
+       ses->prot_op = scmd->prot_op;
+       ses->eh_eflags = scmd->eh_eflags;
+@@ -981,6 +982,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct 
scsi_eh_save *ses,
+       memset(&scmd->sdb, 0, sizeof(scmd->sdb));
+       scmd->request->next_rq = NULL;
+       scmd->result = 0;
++      scmd->req.resid_len = 0;
+ 
+       if (sense_bytes) {
+               scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
+@@ -1034,6 +1036,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct 
scsi_eh_save *ses)
+       scmd->sdb = ses->sdb;
+       scmd->request->next_rq = ses->next_rq;
+       scmd->result = ses->result;
++      scmd->req.resid_len = ses->resid_len;
+       scmd->underflow = ses->underflow;
+       scmd->prot_op = ses->prot_op;
+       scmd->eh_eflags = ses->eh_eflags;
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index 3aee9464a7bf..186f779fa60c 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -723,6 +723,14 @@ sdev_store_delete(struct device *dev, struct 
device_attribute *attr,
+                 const char *buf, size_t count)
+ {
+       struct kernfs_node *kn;
++      struct scsi_device *sdev = to_scsi_device(dev);
++
++      /*
++       * We need to try to get module, avoiding the module been removed
++       * during delete.
++       */
++      if (scsi_device_get(sdev))
++              return -ENODEV;
+ 
+       kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
+       WARN_ON_ONCE(!kn);
+@@ -737,9 +745,10 @@ sdev_store_delete(struct device *dev, struct 
device_attribute *attr,
+        * state into SDEV_DEL.
+        */
+       device_remove_file(dev, attr);
+-      scsi_remove_device(to_scsi_device(dev));
++      scsi_remove_device(sdev);
+       if (kn)
+               sysfs_unbreak_active_protection(kn);
++      scsi_device_put(sdev);
+       return count;
+ };
+ static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 77cb45ef55fc..f8a09e6678d4 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -1646,7 +1646,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct 
scsi_sense_hdr *sshdr)
+               /* we need to evaluate the error return  */
+               if (scsi_sense_valid(sshdr) &&
+                       (sshdr->asc == 0x3a ||  /* medium not present */
+-                       sshdr->asc == 0x20))   /* invalid command */
++                       sshdr->asc == 0x20 ||  /* invalid command */
++                       (sshdr->asc == 0x74 && sshdr->ascq == 0x71)))  /* 
drive is password locked */
+                               /* this is no error here */
+                               return 0;
+ 
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
+index b8b59cfeacd1..4aaba3e03055 100644
+--- a/drivers/scsi/ufs/ufshcd.c
++++ b/drivers/scsi/ufs/ufshcd.c
+@@ -7874,6 +7874,9 @@ int ufshcd_shutdown(struct ufs_hba *hba)
+ {
+       int ret = 0;
+ 
++      if (!hba->is_powered)
++              goto out;
++
+       if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
+               goto out;
+ 
+diff --git a/drivers/staging/wlan-ng/cfg80211.c 
b/drivers/staging/wlan-ng/cfg80211.c
+index d4cf09b11e33..095df245ced5 100644
+--- a/drivers/staging/wlan-ng/cfg80211.c
++++ b/drivers/staging/wlan-ng/cfg80211.c
+@@ -476,10 +476,8 @@ static int prism2_connect(struct wiphy *wiphy, struct 
net_device *dev,
+       /* Set the encryption - we only support wep */
+       if (is_wep) {
+               if (sme->key) {
+-                      if (sme->key_idx >= NUM_WEPKEYS) {
+-                              err = -EINVAL;
+-                              goto exit;
+-                      }
++                      if (sme->key_idx >= NUM_WEPKEYS)
++                              return -EINVAL;
+ 
+                       result = prism2_domibset_uint32(wlandev,
+                               
DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
+diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
+index 502e9bf1746f..4a80103675d5 100644
+--- a/drivers/usb/class/usblp.c
++++ b/drivers/usb/class/usblp.c
+@@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp *usblp)
+       kfree(usblp->readbuf);
+       kfree(usblp->device_id_string);
+       kfree(usblp->statusbuf);
++      usb_put_intf(usblp->intf);
+       kfree(usblp);
+ }
+ 
+@@ -1107,7 +1108,7 @@ static int usblp_probe(struct usb_interface *intf,
+       init_waitqueue_head(&usblp->wwait);
+       init_usb_anchor(&usblp->urbs);
+       usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
+-      usblp->intf = intf;
++      usblp->intf = usb_get_intf(intf);
+ 
+       /* Malloc device ID string buffer to the largest expected length,
+        * since we can re-query it on an ioctl and a dynamic string
+@@ -1196,6 +1197,7 @@ abort:
+       kfree(usblp->readbuf);
+       kfree(usblp->statusbuf);
+       kfree(usblp->device_id_string);
++      usb_put_intf(usblp->intf);
+       kfree(usblp);
+ abort_ret:
+       return retval;
+diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c 
b/drivers/usb/gadget/udc/lpc32xx_udc.c
+index eafc2a00c96a..21921db068f6 100644
+--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
++++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
+@@ -1165,11 +1165,11 @@ static void udc_pop_fifo(struct lpc32xx_udc *udc, u8 
*data, u32 bytes)
+                       tmp = readl(USBD_RXDATA(udc->udp_baseaddr));
+ 
+                       bl = bytes - n;
+-                      if (bl > 3)
+-                              bl = 3;
++                      if (bl > 4)
++                              bl = 4;
+ 
+                       for (i = 0; i < bl; i++)
+-                              data[n + i] = (u8) ((tmp >> (n * 8)) & 0xFF);
++                              data[n + i] = (u8) ((tmp >> (i * 8)) & 0xFF);
+               }
+               break;
+ 
+diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
+index b9cbcf35d4e1..6b3a6fd7d271 100644
+--- a/drivers/usb/misc/ldusb.c
++++ b/drivers/usb/misc/ldusb.c
+@@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct 
file *file)
+               goto exit;
+       }
+ 
+-      if (mutex_lock_interruptible(&dev->mutex)) {
+-              retval = -ERESTARTSYS;
+-              goto exit;
+-      }
++      mutex_lock(&dev->mutex);
+ 
+       if (dev->open_count != 1) {
+               retval = -ENODEV;
+@@ -467,7 +464,7 @@ static ssize_t ld_usb_read(struct file *file, char __user 
*buffer, size_t count,
+ 
+       /* wait for data */
+       spin_lock_irq(&dev->rbsl);
+-      if (dev->ring_head == dev->ring_tail) {
++      while (dev->ring_head == dev->ring_tail) {
+               dev->interrupt_in_done = 0;
+               spin_unlock_irq(&dev->rbsl);
+               if (file->f_flags & O_NONBLOCK) {
+@@ -477,12 +474,17 @@ static ssize_t ld_usb_read(struct file *file, char 
__user *buffer, size_t count,
+               retval = wait_event_interruptible(dev->read_wait, 
dev->interrupt_in_done);
+               if (retval < 0)
+                       goto unlock_exit;
+-      } else {
+-              spin_unlock_irq(&dev->rbsl);
++
++              spin_lock_irq(&dev->rbsl);
+       }
++      spin_unlock_irq(&dev->rbsl);
+ 
+       /* actual_buffer contains actual_length + interrupt_in_buffer */
+       actual_buffer = (size_t *)(dev->ring_buffer + dev->ring_tail * 
(sizeof(size_t)+dev->interrupt_in_endpoint_size));
++      if (*actual_buffer > dev->interrupt_in_endpoint_size) {
++              retval = -EIO;
++              goto unlock_exit;
++      }
+       bytes_to_read = min(count, *actual_buffer);
+       if (bytes_to_read < *actual_buffer)
+               dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes 
dropped\n",
+@@ -693,10 +695,9 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
+               dev_warn(&intf->dev, "Interrupt out endpoint not found (using 
control endpoint instead)\n");
+ 
+       dev->interrupt_in_endpoint_size = 
usb_endpoint_maxp(dev->interrupt_in_endpoint);
+-      dev->ring_buffer =
+-              kmalloc_array(ring_buffer_size,
+-                            sizeof(size_t) + dev->interrupt_in_endpoint_size,
+-                            GFP_KERNEL);
++      dev->ring_buffer = kcalloc(ring_buffer_size,
++                      sizeof(size_t) + dev->interrupt_in_endpoint_size,
++                      GFP_KERNEL);
+       if (!dev->ring_buffer)
+               goto error;
+       dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, 
GFP_KERNEL);
+diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
+index 9d4c52a7ebe0..62dab2441ec4 100644
+--- a/drivers/usb/misc/legousbtower.c
++++ b/drivers/usb/misc/legousbtower.c
+@@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct 
file *file)
+               goto exit;
+       }
+ 
+-      if (mutex_lock_interruptible(&dev->lock)) {
+-              retval = -ERESTARTSYS;
+-              goto exit;
+-      }
++      mutex_lock(&dev->lock);
+ 
+       if (dev->open_count != 1) {
+               dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n",
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
+index e3c5832337e0..c9201e0a8241 100644
+--- a/drivers/usb/serial/ti_usb_3410_5052.c
++++ b/drivers/usb/serial/ti_usb_3410_5052.c
+@@ -776,7 +776,6 @@ static void ti_close(struct usb_serial_port *port)
+       struct ti_port *tport;
+       int port_number;
+       int status;
+-      int do_unlock;
+       unsigned long flags;
+ 
+       tdev = usb_get_serial_data(port->serial);
+@@ -800,16 +799,13 @@ static void ti_close(struct usb_serial_port *port)
+                       "%s - cannot send close port command, %d\n"
+                                                       , __func__, status);
+ 
+-      /* if mutex_lock is interrupted, continue anyway */
+-      do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock);
++      mutex_lock(&tdev->td_open_close_lock);
+       --tport->tp_tdev->td_open_port_count;
+-      if (tport->tp_tdev->td_open_port_count <= 0) {
++      if (tport->tp_tdev->td_open_port_count == 0) {
+               /* last port is closed, shut down interrupt urb */
+               usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
+-              tport->tp_tdev->td_open_port_count = 0;
+       }
+-      if (do_unlock)
+-              mutex_unlock(&tdev->td_open_close_lock);
++      mutex_unlock(&tdev->td_open_close_lock);
+ }
+ 
+ 
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
+index e49e29288049..72c745682996 100644
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -10000,6 +10000,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
+                       btrfs_err(info,
+ "bg %llu is a mixed block group but filesystem hasn't enabled mixed block 
groups",
+                                 cache->key.objectid);
++                      btrfs_put_block_group(cache);
+                       ret = -EINVAL;
+                       goto error;
+               }
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
+index c84186563c31..4870440d6424 100644
+--- a/fs/btrfs/file.c
++++ b/fs/btrfs/file.c
+@@ -2056,25 +2056,7 @@ int btrfs_sync_file(struct file *file, loff_t start, 
loff_t end, int datasync)
+       struct btrfs_trans_handle *trans;
+       struct btrfs_log_ctx ctx;
+       int ret = 0, err;
+-      u64 len;
+ 
+-      /*
+-       * If the inode needs a full sync, make sure we use a full range to
+-       * avoid log tree corruption, due to hole detection racing with ordered
+-       * extent completion for adjacent ranges, and assertion failures during
+-       * hole detection.
+-       */
+-      if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
+-                   &BTRFS_I(inode)->runtime_flags)) {
+-              start = 0;
+-              end = LLONG_MAX;
+-      }
+-
+-      /*
+-       * The range length can be represented by u64, we have to do the 
typecasts
+-       * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
+-       */
+-      len = (u64)end - (u64)start + 1;
+       trace_btrfs_sync_file(file, datasync);
+ 
+       btrfs_init_log_ctx(&ctx, inode);
+@@ -2100,6 +2082,19 @@ int btrfs_sync_file(struct file *file, loff_t start, 
loff_t end, int datasync)
+ 
+       atomic_inc(&root->log_batch);
+ 
++      /*
++       * If the inode needs a full sync, make sure we use a full range to
++       * avoid log tree corruption, due to hole detection racing with ordered
++       * extent completion for adjacent ranges, and assertion failures during
++       * hole detection. Do this while holding the inode lock, to avoid races
++       * with other tasks.
++       */
++      if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
++                   &BTRFS_I(inode)->runtime_flags)) {
++              start = 0;
++              end = LLONG_MAX;
++      }
++
+       /*
+        * Before we acquired the inode's lock, someone may have dirtied more
+        * pages in the target range. We need to make sure that writeback for
+@@ -2127,8 +2122,11 @@ int btrfs_sync_file(struct file *file, loff_t start, 
loff_t end, int datasync)
+       /*
+        * We have to do this here to avoid the priority inversion of waiting on
+        * IO of a lower priority task while holding a transaciton open.
++       *
++       * Also, the range length can be represented by u64, we have to do the
++       * typecasts to avoid signed overflow if it's [0, LLONG_MAX].
+        */
+-      ret = btrfs_wait_ordered_range(inode, start, len);
++      ret = btrfs_wait_ordered_range(inode, start, (u64)end - (u64)start + 1);
+       if (ret) {
+               up_write(&BTRFS_I(inode)->dio_sem);
+               inode_unlock(inode);
+diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
+index 5d57ed629345..bccd9dede2af 100644
+--- a/fs/btrfs/relocation.c
++++ b/fs/btrfs/relocation.c
+@@ -3187,6 +3187,8 @@ static int relocate_file_extent_cluster(struct inode 
*inode,
+                       if (!page) {
+                               btrfs_delalloc_release_metadata(BTRFS_I(inode),
+                                                       PAGE_SIZE, true);
++                              btrfs_delalloc_release_extents(BTRFS_I(inode),
++                                                      PAGE_SIZE, true);
+                               ret = -ENOMEM;
+                               goto out;
+                       }
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c
+index 617f86beb08b..b4e33ef2ff31 100644
+--- a/fs/cifs/file.c
++++ b/fs/cifs/file.c
+@@ -403,10 +403,11 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, 
bool wait_oplock_handler)
+       bool oplock_break_cancelled;
+ 
+       spin_lock(&tcon->open_file_lock);
+-
++      spin_lock(&cifsi->open_file_lock);
+       spin_lock(&cifs_file->file_info_lock);
+       if (--cifs_file->count > 0) {
+               spin_unlock(&cifs_file->file_info_lock);
++              spin_unlock(&cifsi->open_file_lock);
+               spin_unlock(&tcon->open_file_lock);
+               return;
+       }
+@@ -419,9 +420,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, 
bool wait_oplock_handler)
+       cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open);
+ 
+       /* remove it from the lists */
+-      spin_lock(&cifsi->open_file_lock);
+       list_del(&cifs_file->flist);
+-      spin_unlock(&cifsi->open_file_lock);
+       list_del(&cifs_file->tlist);
+ 
+       if (list_empty(&cifsi->openFileList)) {
+@@ -437,6 +436,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, 
bool wait_oplock_handler)
+               cifs_set_oplock_level(cifsi, 0);
+       }
+ 
++      spin_unlock(&cifsi->open_file_lock);
+       spin_unlock(&tcon->open_file_lock);
+ 
+       oplock_break_cancelled = wait_oplock_handler ?
+diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
+index 47db8eb6cbcf..c7f0c8566442 100644
+--- a/fs/cifs/smb1ops.c
++++ b/fs/cifs/smb1ops.c
+@@ -183,6 +183,9 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
+       /* we do not want to loop forever */
+       last_mid = cur_mid;
+       cur_mid++;
++      /* avoid 0xFFFF MID */
++      if (cur_mid == 0xffff)
++              cur_mid++;
+ 
+       /*
+        * This nested loop looks more expensive than it is.
+diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
+index bd3475694e83..c492cbb2410f 100644
+--- a/fs/ocfs2/journal.c
++++ b/fs/ocfs2/journal.c
+@@ -231,7 +231,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
+       /* At this point, we know that no more recovery threads can be
+        * launched, so wait for any recovery completion work to
+        * complete. */
+-      flush_workqueue(osb->ocfs2_wq);
++      if (osb->ocfs2_wq)
++              flush_workqueue(osb->ocfs2_wq);
+ 
+       /*
+        * Now that recovery is shut down, and the osb is about to be
+diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
+index 30208233f65b..a46aff7135d3 100644
+--- a/fs/ocfs2/localalloc.c
++++ b/fs/ocfs2/localalloc.c
+@@ -391,7 +391,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
+       struct ocfs2_dinode *alloc = NULL;
+ 
+       cancel_delayed_work(&osb->la_enable_wq);
+-      flush_workqueue(osb->ocfs2_wq);
++      if (osb->ocfs2_wq)
++              flush_workqueue(osb->ocfs2_wq);
+ 
+       if (osb->local_alloc_state == OCFS2_LA_UNUSED)
+               goto out;
+diff --git a/fs/proc/page.c b/fs/proc/page.c
+index 792c78a49174..64293df0faa3 100644
+--- a/fs/proc/page.c
++++ b/fs/proc/page.c
+@@ -42,10 +42,12 @@ static ssize_t kpagecount_read(struct file *file, char 
__user *buf,
+               return -EINVAL;
+ 
+       while (count > 0) {
+-              if (pfn_valid(pfn))
+-                      ppage = pfn_to_page(pfn);
+-              else
+-                      ppage = NULL;
++              /*
++               * TODO: ZONE_DEVICE support requires to identify
++               * memmaps that were actually initialized.
++               */
++              ppage = pfn_to_online_page(pfn);
++
+               if (!ppage || PageSlab(ppage))
+                       pcount = 0;
+               else
+@@ -216,10 +218,11 @@ static ssize_t kpageflags_read(struct file *file, char 
__user *buf,
+               return -EINVAL;
+ 
+       while (count > 0) {
+-              if (pfn_valid(pfn))
+-                      ppage = pfn_to_page(pfn);
+-              else
+-                      ppage = NULL;
++              /*
++               * TODO: ZONE_DEVICE support requires to identify
++               * memmaps that were actually initialized.
++               */
++              ppage = pfn_to_online_page(pfn);
+ 
+               if (put_user(stable_page_flags(ppage), out)) {
+                       ret = -EFAULT;
+@@ -261,10 +264,11 @@ static ssize_t kpagecgroup_read(struct file *file, char 
__user *buf,
+               return -EINVAL;
+ 
+       while (count > 0) {
+-              if (pfn_valid(pfn))
+-                      ppage = pfn_to_page(pfn);
+-              else
+-                      ppage = NULL;
++              /*
++               * TODO: ZONE_DEVICE support requires to identify
++               * memmaps that were actually initialized.
++               */
++              ppage = pfn_to_online_page(pfn);
+ 
+               if (ppage)
+                       ino = page_cgroup_ino(ppage);
+diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
+index 2b7e227960e1..91f403341dd7 100644
+--- a/include/scsi/scsi_eh.h
++++ b/include/scsi/scsi_eh.h
+@@ -32,6 +32,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user 
*);
+ struct scsi_eh_save {
+       /* saved state */
+       int result;
++      unsigned int resid_len;
+       int eh_eflags;
+       enum dma_data_direction data_direction;
+       unsigned underflow;
+diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
+index b401c4e36394..eb3f668b8bce 100644
+--- a/include/trace/events/btrfs.h
++++ b/include/trace/events/btrfs.h
+@@ -1655,6 +1655,7 @@ TRACE_EVENT(qgroup_update_reserve,
+               __entry->qgid           = qgroup->qgroupid;
+               __entry->cur_reserved   = qgroup->rsv.values[type];
+               __entry->diff           = diff;
++              __entry->type           = type;
+       ),
+ 
+       TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
+@@ -1677,6 +1678,7 @@ TRACE_EVENT(qgroup_meta_reserve,
+       TP_fast_assign_btrfs(root->fs_info,
+               __entry->refroot        = root->objectid;
+               __entry->diff           = diff;
++              __entry->type           = type;
+       ),
+ 
+       TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
+@@ -1693,7 +1695,6 @@ TRACE_EVENT(qgroup_meta_convert,
+       TP_STRUCT__entry_btrfs(
+               __field(        u64,    refroot                 )
+               __field(        s64,    diff                    )
+-              __field(        int,    type                    )
+       ),
+ 
+       TP_fast_assign_btrfs(root->fs_info,
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index 7ca44b8523c8..625ba462e5bb 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -6813,7 +6813,7 @@ static void __perf_event_output_stop(struct perf_event 
*event, void *data)
+ static int __perf_pmu_output_stop(void *info)
+ {
+       struct perf_event *event = info;
+-      struct pmu *pmu = event->pmu;
++      struct pmu *pmu = event->ctx->pmu;
+       struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
+       struct remote_output ro = {
+               .rb     = event->rb,
+diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
+index e6945b55c688..f5b3bf0e69f6 100644
+--- a/kernel/trace/trace_event_perf.c
++++ b/kernel/trace/trace_event_perf.c
+@@ -272,9 +272,11 @@ int perf_kprobe_init(struct perf_event *p_event, bool 
is_retprobe)
+               goto out;
+       }
+ 
++      mutex_lock(&event_mutex);
+       ret = perf_trace_event_init(tp_event, p_event);
+       if (ret)
+               destroy_local_trace_kprobe(tp_event);
++      mutex_unlock(&event_mutex);
+ out:
+       kfree(func);
+       return ret;
+@@ -282,8 +284,10 @@ out:
+ 
+ void perf_kprobe_destroy(struct perf_event *p_event)
+ {
++      mutex_lock(&event_mutex);
+       perf_trace_event_close(p_event);
+       perf_trace_event_unreg(p_event);
++      mutex_unlock(&event_mutex);
+ 
+       destroy_local_trace_kprobe(p_event->tp_event);
+ }
+diff --git a/lib/textsearch.c b/lib/textsearch.c
+index 5939549c0e7b..9135c29add62 100644
+--- a/lib/textsearch.c
++++ b/lib/textsearch.c
+@@ -93,9 +93,9 @@
+  *       goto errout;
+  *   }
+  *
+- *   pos = textsearch_find_continuous(conf, \&state, example, 
strlen(example));
++ *   pos = textsearch_find_continuous(conf, &state, example, strlen(example));
+  *   if (pos != UINT_MAX)
+- *       panic("Oh my god, dancing chickens at \%d\n", pos);
++ *       panic("Oh my god, dancing chickens at %d\n", pos);
+  *
+  *   textsearch_destroy(conf);
+  */
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index 57053affaad2..6f4ce9547658 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -1073,11 +1073,10 @@ static bool pfn_range_valid_gigantic(struct zone *z,
+       struct page *page;
+ 
+       for (i = start_pfn; i < end_pfn; i++) {
+-              if (!pfn_valid(i))
++              page = pfn_to_online_page(i);
++              if (!page)
+                       return false;
+ 
+-              page = pfn_to_page(i);
+-
+               if (page_zone(page) != z)
+                       return false;
+ 
+diff --git a/mm/memfd.c b/mm/memfd.c
+index 2bb5e257080e..5859705dafe1 100644
+--- a/mm/memfd.c
++++ b/mm/memfd.c
+@@ -34,11 +34,12 @@ static void memfd_tag_pins(struct address_space *mapping)
+       void __rcu **slot;
+       pgoff_t start;
+       struct page *page;
++      unsigned int tagged = 0;
+ 
+       lru_add_drain();
+       start = 0;
+-      rcu_read_lock();
+ 
++      xa_lock_irq(&mapping->i_pages);
+       radix_tree_for_each_slot(slot, &mapping->i_pages, &iter, start) {
+               page = radix_tree_deref_slot(slot);
+               if (!page || radix_tree_exception(page)) {
+@@ -47,18 +48,19 @@ static void memfd_tag_pins(struct address_space *mapping)
+                               continue;
+                       }
+               } else if (page_count(page) - page_mapcount(page) > 1) {
+-                      xa_lock_irq(&mapping->i_pages);
+                       radix_tree_tag_set(&mapping->i_pages, iter.index,
+                                          MEMFD_TAG_PINNED);
+-                      xa_unlock_irq(&mapping->i_pages);
+               }
+ 
+-              if (need_resched()) {
+-                      slot = radix_tree_iter_resume(slot, &iter);
+-                      cond_resched_rcu();
+-              }
++              if (++tagged % 1024)
++                      continue;
++
++              slot = radix_tree_iter_resume(slot, &iter);
++              xa_unlock_irq(&mapping->i_pages);
++              cond_resched();
++              xa_lock_irq(&mapping->i_pages);
+       }
+-      rcu_read_unlock();
++      xa_unlock_irq(&mapping->i_pages);
+ }
+ 
+ /*
+diff --git a/mm/memory-failure.c b/mm/memory-failure.c
+index 2994ceb2e7b0..148fdd929a19 100644
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -202,7 +202,6 @@ struct to_kill {
+       struct task_struct *tsk;
+       unsigned long addr;
+       short size_shift;
+-      char addr_valid;
+ };
+ 
+ /*
+@@ -327,22 +326,27 @@ static void add_to_kill(struct task_struct *tsk, struct 
page *p,
+               }
+       }
+       tk->addr = page_address_in_vma(p, vma);
+-      tk->addr_valid = 1;
+       if (is_zone_device_page(p))
+               tk->size_shift = dev_pagemap_mapping_shift(p, vma);
+       else
+               tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT;
+ 
+       /*
+-       * In theory we don't have to kill when the page was
+-       * munmaped. But it could be also a mremap. Since that's
+-       * likely very rare kill anyways just out of paranoia, but use
+-       * a SIGKILL because the error is not contained anymore.
++       * Send SIGKILL if "tk->addr == -EFAULT". Also, as
++       * "tk->size_shift" is always non-zero for !is_zone_device_page(),
++       * so "tk->size_shift == 0" effectively checks no mapping on
++       * ZONE_DEVICE. Indeed, when a devdax page is mmapped N times
++       * to a process' address space, it's possible not all N VMAs
++       * contain mappings for the page, but at least one VMA does.
++       * Only deliver SIGBUS with payload derived from the VMA that
++       * has a mapping for the page.
+        */
+-      if (tk->addr == -EFAULT || tk->size_shift == 0) {
++      if (tk->addr == -EFAULT) {
+               pr_info("Memory failure: Unable to find user space address %lx 
in %s\n",
+                       page_to_pfn(p), tsk->comm);
+-              tk->addr_valid = 0;
++      } else if (tk->size_shift == 0) {
++              kfree(tk);
++              return;
+       }
+       get_task_struct(tsk);
+       tk->tsk = tsk;
+@@ -369,7 +373,7 @@ static void kill_procs(struct list_head *to_kill, int 
forcekill, bool fail,
+                        * make sure the process doesn't catch the
+                        * signal and then access the memory. Just kill it.
+                        */
+-                      if (fail || tk->addr_valid == 0) {
++                      if (fail || tk->addr == -EFAULT) {
+                               pr_err("Memory failure: %#lx: forcibly killing 
%s:%d because of failure to unmap corrupted page\n",
+                                      pfn, tk->tsk->comm, tk->tsk->pid);
+                               do_send_sig_info(SIGKILL, SEND_SIG_PRIV,
+@@ -1258,17 +1262,19 @@ int memory_failure(unsigned long pfn, int flags)
+       if (!sysctl_memory_failure_recovery)
+               panic("Memory failure on page %lx", pfn);
+ 
+-      if (!pfn_valid(pfn)) {
++      p = pfn_to_online_page(pfn);
++      if (!p) {
++              if (pfn_valid(pfn)) {
++                      pgmap = get_dev_pagemap(pfn, NULL);
++                      if (pgmap)
++                              return memory_failure_dev_pagemap(pfn, flags,
++                                                                pgmap);
++              }
+               pr_err("Memory failure: %#lx: memory outside kernel control\n",
+                       pfn);
+               return -ENXIO;
+       }
+ 
+-      pgmap = get_dev_pagemap(pfn, NULL);
+-      if (pgmap)
+-              return memory_failure_dev_pagemap(pfn, flags, pgmap);
+-
+-      p = pfn_to_page(pfn);
+       if (PageHuge(p))
+               return memory_failure_hugetlb(pfn, flags);
+       if (TestSetPageHWPoison(p)) {
+diff --git a/mm/page_owner.c b/mm/page_owner.c
+index d80adfe702d3..63b1053f5b41 100644
+--- a/mm/page_owner.c
++++ b/mm/page_owner.c
+@@ -273,7 +273,8 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m,
+        * not matter as the mixed block count will still be correct
+        */
+       for (; pfn < end_pfn; ) {
+-              if (!pfn_valid(pfn)) {
++              page = pfn_to_online_page(pfn);
++              if (!page) {
+                       pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
+                       continue;
+               }
+@@ -281,13 +282,13 @@ void pagetypeinfo_showmixedcount_print(struct seq_file 
*m,
+               block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
+               block_end_pfn = min(block_end_pfn, end_pfn);
+ 
+-              page = pfn_to_page(pfn);
+               pageblock_mt = get_pageblock_migratetype(page);
+ 
+               for (; pfn < block_end_pfn; pfn++) {
+                       if (!pfn_valid_within(pfn))
+                               continue;
+ 
++                      /* The pageblock is online, no need to recheck. */
+                       page = pfn_to_page(pfn);
+ 
+                       if (page_zone(page) != zone)
+diff --git a/mm/slub.c b/mm/slub.c
+index 09c0e24a06d8..9c3937c5ce38 100644
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -4797,7 +4797,17 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
+               }
+       }
+ 
+-      get_online_mems();
++      /*
++       * It is impossible to take "mem_hotplug_lock" here with "kernfs_mutex"
++       * already held which will conflict with an existing lock order:
++       *
++       * mem_hotplug_lock->slab_mutex->kernfs_mutex
++       *
++       * We don't really need mem_hotplug_lock (to hold off
++       * slab_mem_going_offline_callback) here because slab's memory hot
++       * unplug code doesn't destroy the kmem_cache->node[] data.
++       */
++
+ #ifdef CONFIG_SLUB_DEBUG
+       if (flags & SO_ALL) {
+               struct kmem_cache_node *n;
+@@ -4838,7 +4848,6 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
+                       x += sprintf(buf + x, " N%d=%lu",
+                                       node, nodes[node]);
+ #endif
+-      put_online_mems();
+       kfree(nodes);
+       return x + sprintf(buf + x, "\n");
+ }
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c
+index 7065d68086ab..69127f6039b2 100644
+--- a/net/ipv4/route.c
++++ b/net/ipv4/route.c
+@@ -1476,7 +1476,7 @@ static bool rt_cache_route(struct fib_nh *nh, struct 
rtable *rt)
+       prev = cmpxchg(p, orig, rt);
+       if (prev == orig) {
+               if (orig) {
+-                      dst_dev_put(&orig->dst);
++                      rt_add_uncached_list(orig);
+                       dst_release(&orig->dst);
+               }
+       } else {
+@@ -2381,14 +2381,17 @@ struct rtable *ip_route_output_key_hash_rcu(struct net 
*net, struct flowi4 *fl4,
+       int orig_oif = fl4->flowi4_oif;
+       unsigned int flags = 0;
+       struct rtable *rth;
+-      int err = -ENETUNREACH;
++      int err;
+ 
+       if (fl4->saddr) {
+-              rth = ERR_PTR(-EINVAL);
+               if (ipv4_is_multicast(fl4->saddr) ||
+                   ipv4_is_lbcast(fl4->saddr) ||
+-                  ipv4_is_zeronet(fl4->saddr))
++                  ipv4_is_zeronet(fl4->saddr)) {
++                      rth = ERR_PTR(-EINVAL);
+                       goto out;
++              }
++
++              rth = ERR_PTR(-ENETUNREACH);
+ 
+               /* I removed check for oif == dev_out->oif here.
+                  It was wrong for two reasons:
+diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
+index 2b6d43022383..acf0749ee5bb 100644
+--- a/net/ipv6/ip6_input.c
++++ b/net/ipv6/ip6_input.c
+@@ -80,8 +80,10 @@ static void ip6_sublist_rcv_finish(struct list_head *head)
+ {
+       struct sk_buff *skb, *next;
+ 
+-      list_for_each_entry_safe(skb, next, head, list)
++      list_for_each_entry_safe(skb, next, head, list) {
++              skb_list_del_init(skb);
+               dst_input(skb);
++      }
+ }
+ 
+ static void ip6_list_rcv_finish(struct net *net, struct sock *sk,
+diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
+index d37d4acafebf..316250ae9071 100644
+--- a/net/mac80211/debugfs_netdev.c
++++ b/net/mac80211/debugfs_netdev.c
+@@ -490,9 +490,14 @@ static ssize_t ieee80211_if_fmt_aqm(
+       const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
+ {
+       struct ieee80211_local *local = sdata->local;
+-      struct txq_info *txqi = to_txq_info(sdata->vif.txq);
++      struct txq_info *txqi;
+       int len;
+ 
++      if (!sdata->vif.txq)
++              return 0;
++
++      txqi = to_txq_info(sdata->vif.txq);
++
+       spin_lock_bh(&local->fq.lock);
+       rcu_read_lock();
+ 
+@@ -659,7 +664,9 @@ static void add_common_files(struct ieee80211_sub_if_data 
*sdata)
+       DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
+       DEBUGFS_ADD(hw_queues);
+ 
+-      if (sdata->local->ops->wake_tx_queue)
++      if (sdata->local->ops->wake_tx_queue &&
++          sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
++          sdata->vif.type != NL80211_IFTYPE_NAN)
+               DEBUGFS_ADD(aqm);
+ }
+ 
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
+index b5c06242a92e..5c9dcafbc342 100644
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
+@@ -2554,7 +2554,8 @@ struct sk_buff *ieee80211_ap_probereq_get(struct 
ieee80211_hw *hw,
+ 
+       rcu_read_lock();
+       ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID);
+-      if (WARN_ON_ONCE(ssid == NULL))
++      if (WARN_ONCE(!ssid || ssid[1] > IEEE80211_MAX_SSID_LEN,
++                    "invalid SSID element (len=%d)", ssid ? ssid[1] : -1))
+               ssid_len = 0;
+       else
+               ssid_len = ssid[1];
+@@ -5039,7 +5040,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data 
*sdata,
+ 
+       rcu_read_lock();
+       ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
+-      if (!ssidie) {
++      if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) {
+               rcu_read_unlock();
+               kfree(assoc_data);
+               return -EINVAL;
+diff --git a/net/netfilter/nft_connlimit.c b/net/netfilter/nft_connlimit.c
+index af1497ab9464..69d6173f91e2 100644
+--- a/net/netfilter/nft_connlimit.c
++++ b/net/netfilter/nft_connlimit.c
+@@ -218,8 +218,13 @@ static void nft_connlimit_destroy_clone(const struct 
nft_ctx *ctx,
+ static bool nft_connlimit_gc(struct net *net, const struct nft_expr *expr)
+ {
+       struct nft_connlimit *priv = nft_expr_priv(expr);
++      bool ret;
+ 
+-      return nf_conncount_gc_list(net, &priv->list);
++      local_bh_disable();
++      ret = nf_conncount_gc_list(net, &priv->list);
++      local_bh_enable();
++
++      return ret;
+ }
+ 
+ static struct nft_expr_type nft_connlimit_type;
+diff --git a/net/sched/act_api.c b/net/sched/act_api.c
+index 7c4a4b874248..f2c4bfc79663 100644
+--- a/net/sched/act_api.c
++++ b/net/sched/act_api.c
+@@ -1307,11 +1307,16 @@ static int tcf_action_add(struct net *net, struct 
nlattr *nla,
+                         struct netlink_ext_ack *extack)
+ {
+       size_t attr_size = 0;
+-      int ret = 0;
++      int loop, ret;
+       struct tc_action *actions[TCA_ACT_MAX_PRIO] = {};
+ 
+-      ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, actions,
+-                            &attr_size, true, extack);
++      for (loop = 0; loop < 10; loop++) {
++              ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0,
++                                    actions, &attr_size, true, extack);
++              if (ret != -EAGAIN)
++                      break;
++      }
++
+       if (ret < 0)
+               return ret;
+       ret = tcf_add_notify(net, n, actions, portid, attr_size, extack);
+@@ -1361,11 +1366,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct 
nlmsghdr *n,
+                */
+               if (n->nlmsg_flags & NLM_F_REPLACE)
+                       ovr = 1;
+-replay:
+               ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr,
+                                    extack);
+-              if (ret == -EAGAIN)
+-                      goto replay;
+               break;
+       case RTM_DELACTION:
+               ret = tca_action_gd(net, tca[TCA_ACT_TAB], n,
+diff --git a/net/sctp/socket.c b/net/sctp/socket.c
+index 9f5b4e547b63..227b050cfe45 100644
+--- a/net/sctp/socket.c
++++ b/net/sctp/socket.c
+@@ -8957,7 +8957,7 @@ struct proto sctp_prot = {
+       .backlog_rcv =  sctp_backlog_rcv,
+       .hash        =  sctp_hash,
+       .unhash      =  sctp_unhash,
+-      .get_port    =  sctp_get_port,
++      .no_autobind =  true,
+       .obj_size    =  sizeof(struct sctp_sock),
+       .useroffset  =  offsetof(struct sctp_sock, subscribe),
+       .usersize    =  offsetof(struct sctp_sock, initmsg) -
+@@ -8999,7 +8999,7 @@ struct proto sctpv6_prot = {
+       .backlog_rcv    = sctp_backlog_rcv,
+       .hash           = sctp_hash,
+       .unhash         = sctp_unhash,
+-      .get_port       = sctp_get_port,
++      .no_autobind    = true,
+       .obj_size       = sizeof(struct sctp6_sock),
+       .useroffset     = offsetof(struct sctp6_sock, sctp.subscribe),
+       .usersize       = offsetof(struct sctp6_sock, sctp.initmsg) -
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index 334e3181f1c5..a28d6456e93e 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -5843,6 +5843,9 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct 
genl_info *info)
+       if (!rdev->ops->del_mpath)
+               return -EOPNOTSUPP;
+ 
++      if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
++              return -EOPNOTSUPP;
++
+       return rdev_del_mpath(rdev, dev, dst);
+ }
+ 
+diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
+index c67d7a82ab13..73fd0eae08ca 100644
+--- a/net/wireless/wext-sme.c
++++ b/net/wireless/wext-sme.c
+@@ -202,6 +202,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
+                              struct iw_point *data, char *ssid)
+ {
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
++      int ret = 0;
+ 
+       /* call only for station! */
+       if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+@@ -219,7 +220,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
+               if (ie) {
+                       data->flags = 1;
+                       data->length = ie[1];
+-                      memcpy(ssid, ie + 2, data->length);
++                      if (data->length > IW_ESSID_MAX_SIZE)
++                              ret = -EINVAL;
++                      else
++                              memcpy(ssid, ie + 2, data->length);
+               }
+               rcu_read_unlock();
+       } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) {
+@@ -229,7 +233,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
+       }
+       wdev_unlock(wdev);
+ 
+-      return 0;
++      return ret;
+ }
+ 
+ int cfg80211_mgd_wext_siwap(struct net_device *dev,
+diff --git a/scripts/namespace.pl b/scripts/namespace.pl
+index 6135574a6f39..1da7bca201a4 100755
+--- a/scripts/namespace.pl
++++ b/scripts/namespace.pl
+@@ -65,13 +65,14 @@
+ use warnings;
+ use strict;
+ use File::Find;
++use File::Spec;
+ 
+ my $nm = ($ENV{'NM'} || "nm") . " -p";
+ my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
+-my $srctree = "";
+-my $objtree = "";
+-$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
+-$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));
++my $srctree = File::Spec->curdir();
++my $objtree = File::Spec->curdir();
++$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'}));
++$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'}));
+ 
+ if ($#ARGV != -1) {
+       print STDERR "usage: $0 takes no parameters\n";
+@@ -231,9 +232,9 @@ sub do_nm
+       }
+       ($source = $basename) =~ s/\.o$//;
+       if (-e "$source.c" || -e "$source.S") {
+-              $source = "$objtree$File::Find::dir/$source";
++              $source = File::Spec->catfile($objtree, $File::Find::dir, 
$source)
+       } else {
+-              $source = "$srctree$File::Find::dir/$source";
++              $source = File::Spec->catfile($srctree, $File::Find::dir, 
$source)
+       }
+       if (! -e "$source.c" && ! -e "$source.S") {
+               # No obvious source, exclude the object if it is conglomerate
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 107ec7f3e221..c827a2a89cc3 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -3264,6 +3264,8 @@ static int patch_nvhdmi(struct hda_codec *codec)
+               nvhdmi_chmap_cea_alloc_validate_get_type;
+       spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
+ 
++      codec->link_down_at_suspend = 1;
++
+       return 0;
+ }
+ 
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index e1b08d6f2a51..dd46354270d0 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -405,6 +405,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
+       case 0x10ec0700:
+       case 0x10ec0701:
+       case 0x10ec0703:
++      case 0x10ec0711:
+               alc_update_coef_idx(codec, 0x10, 1<<15, 0);
+               break;
+       case 0x10ec0662:
+@@ -5676,6 +5677,7 @@ enum {
+       ALC225_FIXUP_WYSE_AUTO_MUTE,
+       ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
+       ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
++      ALC256_FIXUP_ASUS_HEADSET_MIC,
+       ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
+       ALC299_FIXUP_PREDATOR_SPK,
+       ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
+@@ -6692,6 +6694,15 @@ static const struct hda_fixup alc269_fixups[] = {
+               .chained = true,
+               .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
+       },
++      [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
++              .type = HDA_FIXUP_PINS,
++              .v.pins = (const struct hda_pintbl[]) {
++                      { 0x19, 0x03a11020 }, /* headset mic with jack detect */
++                      { }
++              },
++              .chained = true,
++              .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
++      },
+       [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+@@ -6888,6 +6899,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", 
ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
+       SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+       SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", 
ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC),
++      SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", 
ALC256_FIXUP_ASUS_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
+       SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
+       SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
+@@ -7752,6 +7764,7 @@ static int patch_alc269(struct hda_codec *codec)
+       case 0x10ec0700:
+       case 0x10ec0701:
+       case 0x10ec0703:
++      case 0x10ec0711:
+               spec->codec_variant = ALC269_TYPE_ALC700;
+               spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback 
mixer path */
+               alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack 
auto trigger control */
+@@ -8883,6 +8896,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = 
{
+       HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
+       HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
+       HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
++      HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
+       HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
+       HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
+       HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index d23c2bbff0cf..15a31820df16 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -674,6 +674,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, 
unsigned int fmt)
+       }
+ 
+       /* set format */
++      rdai->bit_clk_inv = 0;
+       switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+       case SND_SOC_DAIFMT_I2S:
+               rdai->sys_delay = 0;
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
+index 13ea63c959d3..1828225ba882 100644
+--- a/sound/usb/pcm.c
++++ b/sound/usb/pcm.c
+@@ -355,6 +355,9 @@ static int set_sync_ep_implicit_fb_quirk(struct 
snd_usb_substream *subs,
+               ep = 0x81;
+               ifnum = 1;
+               goto add_sync_ep_from_ifnum;
++      case USB_ID(0x0582, 0x01d8): /* BOSS Katana */
++              /* BOSS Katana amplifiers do not need quirks */
++              return 0;
+       }
+ 
+       if (attr == USB_ENDPOINT_SYNC_ASYNC &&

Reply via email to