commit:     333e5cd50de2b89ba03019ae33808dfa4f3bcaf7
Author:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  6 13:23:40 2025 +0000
Commit:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
CommitDate: Sun Jul  6 13:23:40 2025 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=333e5cd5

Linux patch 5.4.259

Signed-off-by: Arisu Tachibana <alicef <AT> gentoo.org>

 0000_README              |    4 +
 1258_linux-5.4.259.patch | 3103 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 3107 insertions(+)

diff --git a/0000_README b/0000_README
index a6148b50..c3e3f23f 100644
--- a/0000_README
+++ b/0000_README
@@ -1075,6 +1075,10 @@ Patch:  1257_linux-5.4.258.patch
 From:   https://www.kernel.org
 Desc:   Linux 5.4.258
 
+Patch:  1258_linux-5.4.259.patch
+From:   https://www.kernel.org
+Desc:   Linux 5.4.259
+
 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/1258_linux-5.4.259.patch b/1258_linux-5.4.259.patch
new file mode 100644
index 00000000..02e9f174
--- /dev/null
+++ b/1258_linux-5.4.259.patch
@@ -0,0 +1,3103 @@
+diff --git a/Documentation/admin-guide/sysctl/net.rst 
b/Documentation/admin-guide/sysctl/net.rst
+index 95467351f5a7f..70bab788fca30 100644
+--- a/Documentation/admin-guide/sysctl/net.rst
++++ b/Documentation/admin-guide/sysctl/net.rst
+@@ -31,18 +31,18 @@ see only some of them, depending on your kernel's 
configuration.
+ 
+ Table : Subdirectories in /proc/sys/net
+ 
+- ========= =================== = ========== ==================
++ ========= =================== = ========== ===================
+  Directory Content               Directory  Content
+- ========= =================== = ========== ==================
+- 802       E802 protocol         mptcp     Multipath TCP
+- appletalk Appletalk protocol    netfilter Network Filter
++ ========= =================== = ========== ===================
++ 802       E802 protocol         mptcp      Multipath TCP
++ appletalk Appletalk protocol    netfilter  Network Filter
+  ax25      AX25                  netrom     NET/ROM
+- bridge    Bridging              rose      X.25 PLP layer
+- core      General parameter     tipc      TIPC
+- ethernet  Ethernet protocol     unix      Unix domain sockets
+- ipv4      IP version 4          x25       X.25 protocol
++ bridge    Bridging              rose       X.25 PLP layer
++ core      General parameter     tipc       TIPC
++ ethernet  Ethernet protocol     unix       Unix domain sockets
++ ipv4      IP version 4          x25        X.25 protocol
+  ipv6      IP version 6
+- ========= =================== = ========== ==================
++ ========= =================== = ========== ===================
+ 
+ 1. /proc/sys/net/core - Network core options
+ ============================================
+diff --git a/Makefile b/Makefile
+index 10e57b85abee8..b30442d90389e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 5
+ PATCHLEVEL = 4
+-SUBLEVEL = 258
++SUBLEVEL = 259
+ EXTRAVERSION =
+ NAME = Kleptomaniac Octopus
+ 
+diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts 
b/arch/arm/boot/dts/omap4-droid4-xt894.dts
+index f5dbc241aaf78..73425f692774c 100644
+--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts
++++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts
+@@ -678,6 +678,7 @@
+ &uart3 {
+       interrupts-extended = <&wakeupgen GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
+                              &omap4_pmx_core 0x17c>;
++      overrun-throttle-ms = <500>;
+ };
+ 
+ &uart4 {
+diff --git a/arch/powerpc/include/asm/nohash/32/pte-8xx.h 
b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
+index c9e4b2d90f65c..93ecf4e80ca70 100644
+--- a/arch/powerpc/include/asm/nohash/32/pte-8xx.h
++++ b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
+@@ -91,6 +91,13 @@ static inline pte_t pte_wrprotect(pte_t pte)
+ 
+ #define pte_wrprotect pte_wrprotect
+ 
++static inline int pte_read(pte_t pte)
++{
++      return (pte_val(pte) & _PAGE_RO) != _PAGE_NA;
++}
++
++#define pte_read pte_read
++
+ static inline int pte_write(pte_t pte)
+ {
+       return !(pte_val(pte) & _PAGE_RO);
+diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h 
b/arch/powerpc/include/asm/nohash/64/pgtable.h
+index 9a33b8bd842d9..c32cb88a15750 100644
+--- a/arch/powerpc/include/asm/nohash/64/pgtable.h
++++ b/arch/powerpc/include/asm/nohash/64/pgtable.h
+@@ -244,7 +244,7 @@ static inline int __ptep_test_and_clear_young(struct 
mm_struct *mm,
+ {
+       unsigned long old;
+ 
+-      if (pte_young(*ptep))
++      if (!pte_young(*ptep))
+               return 0;
+       old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
+       return (old & _PAGE_ACCESSED) != 0;
+diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
b/arch/powerpc/include/asm/nohash/pgtable.h
+index 3d2a78ab051a7..15dec9994c780 100644
+--- a/arch/powerpc/include/asm/nohash/pgtable.h
++++ b/arch/powerpc/include/asm/nohash/pgtable.h
+@@ -45,7 +45,9 @@ static inline int pte_write(pte_t pte)
+       return pte_val(pte) & _PAGE_RW;
+ }
+ #endif
++#ifndef pte_read
+ static inline int pte_read(pte_t pte)         { return 1; }
++#endif
+ static inline int pte_dirty(pte_t pte)                { return pte_val(pte) & 
_PAGE_DIRTY; }
+ static inline int pte_special(pte_t pte)      { return pte_val(pte) & 
_PAGE_SPECIAL; }
+ static inline int pte_none(pte_t pte)         { return (pte_val(pte) & 
~_PTE_NONE_MASK) == 0; }
+diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
+index 64b1399a73f04..b32da43f7a624 100644
+--- a/arch/s390/pci/pci_dma.c
++++ b/arch/s390/pci/pci_dma.c
+@@ -543,6 +543,17 @@ static void s390_dma_unmap_sg(struct device *dev, struct 
scatterlist *sg,
+               s->dma_length = 0;
+       }
+ }
++
++static unsigned long *bitmap_vzalloc(size_t bits, gfp_t flags)
++{
++      size_t n = BITS_TO_LONGS(bits);
++      size_t bytes;
++
++      if (unlikely(check_mul_overflow(n, sizeof(unsigned long), &bytes)))
++              return NULL;
++
++      return vzalloc(bytes);
++}
+       
+ int zpci_dma_init_device(struct zpci_dev *zdev)
+ {
+@@ -579,13 +590,13 @@ int zpci_dma_init_device(struct zpci_dev *zdev)
+                               zdev->end_dma - zdev->start_dma + 1);
+       zdev->end_dma = zdev->start_dma + zdev->iommu_size - 1;
+       zdev->iommu_pages = zdev->iommu_size >> PAGE_SHIFT;
+-      zdev->iommu_bitmap = vzalloc(zdev->iommu_pages / 8);
++      zdev->iommu_bitmap = bitmap_vzalloc(zdev->iommu_pages, GFP_KERNEL);
+       if (!zdev->iommu_bitmap) {
+               rc = -ENOMEM;
+               goto free_dma_table;
+       }
+       if (!s390_iommu_strict) {
+-              zdev->lazy_bitmap = vzalloc(zdev->iommu_pages / 8);
++              zdev->lazy_bitmap = bitmap_vzalloc(zdev->iommu_pages, 
GFP_KERNEL);
+               if (!zdev->lazy_bitmap) {
+                       rc = -ENOMEM;
+                       goto free_bitmap;
+diff --git a/arch/x86/include/asm/msr-index.h 
b/arch/x86/include/asm/msr-index.h
+index 7137256f2c31d..7167a162d7be5 100644
+--- a/arch/x86/include/asm/msr-index.h
++++ b/arch/x86/include/asm/msr-index.h
+@@ -502,6 +502,10 @@
+ 
+ #define MSR_AMD64_VIRT_SPEC_CTRL      0xc001011f
+ 
++/* Zen4 */
++#define MSR_ZEN4_BP_CFG                       0xc001102e
++#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
++
+ /* Fam 17h MSRs */
+ #define MSR_F17H_IRPERF                       0xc00000e9
+ 
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
+index fcffee447ba1f..eb3cd4ad45aed 100644
+--- a/arch/x86/kernel/cpu/amd.c
++++ b/arch/x86/kernel/cpu/amd.c
+@@ -75,6 +75,10 @@ static const int amd_zenbleed[] =
+                          AMD_MODEL_RANGE(0x17, 0x90, 0x0, 0x91, 0xf),
+                          AMD_MODEL_RANGE(0x17, 0xa0, 0x0, 0xaf, 0xf));
+ 
++static const int amd_erratum_1485[] =
++      AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf),
++                         AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf));
++
+ static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
+ {
+       int osvw_id = *erratum++;
+@@ -1117,6 +1121,10 @@ static void init_amd(struct cpuinfo_x86 *c)
+       check_null_seg_clears_base(c);
+ 
+       zenbleed_check(c);
++
++      if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
++           cpu_has_amd_erratum(c, amd_erratum_1485))
++              msr_set_bit(MSR_ZEN4_BP_CFG, 
MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
+ }
+ 
+ #ifdef CONFIG_X86_32
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
+index 23480d8e4ef17..319ed873a1111 100644
+--- a/arch/x86/kvm/lapic.c
++++ b/arch/x86/kvm/lapic.c
+@@ -2244,13 +2244,17 @@ int kvm_apic_local_deliver(struct kvm_lapic *apic, int 
lvt_type)
+ {
+       u32 reg = kvm_lapic_get_reg(apic, lvt_type);
+       int vector, mode, trig_mode;
++      int r;
+ 
+       if (kvm_apic_hw_enabled(apic) && !(reg & APIC_LVT_MASKED)) {
+               vector = reg & APIC_VECTOR_MASK;
+               mode = reg & APIC_MODE_MASK;
+               trig_mode = reg & APIC_LVT_LEVEL_TRIGGER;
+-              return __apic_accept_irq(apic, mode, vector, 1, trig_mode,
+-                                      NULL);
++
++              r = __apic_accept_irq(apic, mode, vector, 1, trig_mode, NULL);
++              if (r && lvt_type == APIC_LVTPC)
++                      kvm_lapic_set_reg(apic, APIC_LVTPC, reg | 
APIC_LVT_MASKED);
++              return r;
+       }
+       return 0;
+ }
+diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
+index e209081d644b5..6a9490ad78ceb 100644
+--- a/drivers/acpi/irq.c
++++ b/drivers/acpi/irq.c
+@@ -52,6 +52,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int 
trigger,
+                     int polarity)
+ {
+       struct irq_fwspec fwspec;
++      unsigned int irq;
+ 
+       if (WARN_ON(!acpi_gsi_domain_id)) {
+               pr_warn("GSI: No registered irqchip, giving up\n");
+@@ -63,7 +64,11 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int 
trigger,
+       fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
+       fwspec.param_count = 2;
+ 
+-      return irq_create_fwspec_mapping(&fwspec);
++      irq = irq_create_fwspec_mapping(&fwspec);
++      if (!irq)
++              return -EINVAL;
++
++      return irq;
+ }
+ EXPORT_SYMBOL_GPL(acpi_register_gsi);
+ 
+diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
+index 48ca9a844f06b..95d19740c207f 100644
+--- a/drivers/acpi/resource.c
++++ b/drivers/acpi/resource.c
+@@ -16,6 +16,7 @@
+ #include <linux/ioport.h>
+ #include <linux/slab.h>
+ #include <linux/irq.h>
++#include <linux/dmi.h>
+ 
+ #ifdef CONFIG_X86
+ #define valid_IRQ(i) (((i) != 0) && ((i) != 2))
+@@ -380,21 +381,117 @@ unsigned int acpi_dev_get_irq_type(int triggering, int 
polarity)
+ }
+ EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
+ 
+-static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
++static const struct dmi_system_id medion_laptop[] = {
++      {
++              .ident = "MEDION P15651",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
++                      DMI_MATCH(DMI_BOARD_NAME, "M15T"),
++              },
++      },
++      { }
++};
++
++static const struct dmi_system_id asus_laptop[] = {
++      {
++              .ident = "Asus Vivobook K3402ZA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"),
++              },
++      },
++      {
++              .ident = "Asus Vivobook K3502ZA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"),
++              },
++      },
++      {
++              .ident = "Asus Vivobook S5402ZA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"),
++              },
++      },
++      {
++              .ident = "Asus Vivobook S5602ZA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"),
++              },
++      },
++      {
++              .ident = "Asus ExpertBook B1402CBA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "B1402CBA"),
++              },
++      },
++      {
++              .ident = "Asus ExpertBook B1502CBA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "B1502CBA"),
++              },
++      },
++      {
++              .ident = "Asus ExpertBook B2402CBA",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "B2402CBA"),
++              },
++      },
++      {
++              .ident = "Asus ExpertBook B2502",
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"),
++              },
++      },
++      { }
++};
++
++struct irq_override_cmp {
++      const struct dmi_system_id *system;
++      unsigned char irq;
++      unsigned char triggering;
++      unsigned char polarity;
++      unsigned char shareable;
++};
++
++static const struct irq_override_cmp skip_override_table[] = {
++      { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
++      { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
++};
++
++static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
++                                u8 shareable)
+ {
+-      res->start = gsi;
+-      res->end = gsi;
+-      res->flags = IORESOURCE_IRQ | IORESOURCE_DISABLED | IORESOURCE_UNSET;
++      int i;
++
++      for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
++              const struct irq_override_cmp *entry = &skip_override_table[i];
++
++              if (dmi_check_system(entry->system) &&
++                  entry->irq == gsi &&
++                  entry->triggering == triggering &&
++                  entry->polarity == polarity &&
++                  entry->shareable == shareable)
++                      return false;
++      }
++
++      return true;
+ }
+ 
+ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
+                                    u8 triggering, u8 polarity, u8 shareable,
+-                                   bool legacy)
++                                   bool check_override)
+ {
+       int irq, p, t;
+ 
+       if (!valid_IRQ(gsi)) {
+-              acpi_dev_irqresource_disabled(res, gsi);
++              irqresource_disabled(res, gsi);
+               return;
+       }
+ 
+@@ -408,7 +505,9 @@ static void acpi_dev_get_irqresource(struct resource *res, 
u32 gsi,
+        * using extended IRQ descriptors we take the IRQ configuration
+        * from _CRS directly.
+        */
+-      if (legacy && !acpi_get_override_irq(gsi, &t, &p)) {
++      if (check_override &&
++          acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
++          !acpi_get_override_irq(gsi, &t, &p)) {
+               u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
+               u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
+ 
+@@ -426,7 +525,7 @@ static void acpi_dev_get_irqresource(struct resource *res, 
u32 gsi,
+               res->start = irq;
+               res->end = irq;
+       } else {
+-              acpi_dev_irqresource_disabled(res, gsi);
++              irqresource_disabled(res, gsi);
+       }
+ }
+ 
+@@ -463,7 +562,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource 
*ares, int index,
+                */
+               irq = &ares->data.irq;
+               if (index >= irq->interrupt_count) {
+-                      acpi_dev_irqresource_disabled(res, 0);
++                      irqresource_disabled(res, 0);
+                       return false;
+               }
+               acpi_dev_get_irqresource(res, irq->interrupts[index],
+@@ -473,7 +572,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource 
*ares, int index,
+       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+               ext_irq = &ares->data.extended_irq;
+               if (index >= ext_irq->interrupt_count) {
+-                      acpi_dev_irqresource_disabled(res, 0);
++                      irqresource_disabled(res, 0);
+                       return false;
+               }
+               if (is_gsi(ext_irq))
+@@ -481,7 +580,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource 
*ares, int index,
+                                        ext_irq->triggering, ext_irq->polarity,
+                                        ext_irq->shareable, false);
+               else
+-                      acpi_dev_irqresource_disabled(res, 0);
++                      irqresource_disabled(res, 0);
+               break;
+       default:
+               res->flags = 0;
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
+index 54b6ec44d3be4..fa3f08ca5f6ce 100644
+--- a/drivers/ata/libata-eh.c
++++ b/drivers/ata/libata-eh.c
+@@ -2422,7 +2422,7 @@ static void ata_eh_link_report(struct ata_link *link)
+       struct ata_eh_context *ehc = &link->eh_context;
+       struct ata_queued_cmd *qc;
+       const char *frozen, *desc;
+-      char tries_buf[6] = "";
++      char tries_buf[16] = "";
+       int tag, nr_failed = 0;
+ 
+       if (ehc->i.flags & ATA_EHI_QUIET)
+diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
+index a69e9797fba21..b5974cbbe78f6 100644
+--- a/drivers/base/regmap/regmap.c
++++ b/drivers/base/regmap/regmap.c
+@@ -1363,7 +1363,7 @@ static int dev_get_regmap_match(struct device *dev, void 
*res, void *data)
+ 
+       /* If the user didn't specify a name match any */
+       if (data)
+-              return !strcmp((*r)->name, data);
++              return (*r)->name && !strcmp((*r)->name, data);
+       else
+               return 1;
+ }
+diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
+index 65e41c1d760f0..6a0ddf266ad80 100644
+--- a/drivers/bluetooth/hci_vhci.c
++++ b/drivers/bluetooth/hci_vhci.c
+@@ -67,7 +67,10 @@ static int vhci_send_frame(struct hci_dev *hdev, struct 
sk_buff *skb)
+       struct vhci_data *data = hci_get_drvdata(hdev);
+ 
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
++
++      mutex_lock(&data->open_mutex);
+       skb_queue_tail(&data->readq, skb);
++      mutex_unlock(&data->open_mutex);
+ 
+       wake_up_interruptible(&data->read_wait);
+       return 0;
+diff --git a/drivers/dma/mediatek/mtk-uart-apdma.c 
b/drivers/dma/mediatek/mtk-uart-apdma.c
+index 7718d09e3d29f..5d1ba3ba3755a 100644
+--- a/drivers/dma/mediatek/mtk-uart-apdma.c
++++ b/drivers/dma/mediatek/mtk-uart-apdma.c
+@@ -450,9 +450,8 @@ static int mtk_uart_apdma_device_pause(struct dma_chan 
*chan)
+       mtk_uart_apdma_write(c, VFF_EN, VFF_EN_CLR_B);
+       mtk_uart_apdma_write(c, VFF_INT_EN, VFF_INT_EN_CLR_B);
+ 
+-      synchronize_irq(c->irq);
+-
+       spin_unlock_irqrestore(&c->vc.lock, flags);
++      synchronize_irq(c->irq);
+ 
+       return 0;
+ }
+diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
+index c902c24806404..ed5a999bb32f3 100644
+--- a/drivers/dma/stm32-mdma.c
++++ b/drivers/dma/stm32-mdma.c
+@@ -1207,6 +1207,10 @@ static int stm32_mdma_resume(struct dma_chan *c)
+       unsigned long flags;
+       u32 status, reg;
+ 
++      /* Transfer can be terminated */
++      if (!chan->desc || (stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & 
STM32_MDMA_CCR_EN))
++              return -EPERM;
++
+       hwdesc = chan->desc->node[chan->curr_hwdesc].hwdesc;
+ 
+       spin_lock_irqsave(&chan->vchan.lock, flags);
+diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
+index de14949a3fe5a..92c1f2baa4bff 100644
+--- a/drivers/gpio/gpio-timberdale.c
++++ b/drivers/gpio/gpio-timberdale.c
+@@ -43,9 +43,10 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, 
unsigned index,
+       unsigned offset, bool enabled)
+ {
+       struct timbgpio *tgpio = gpiochip_get_data(gpio);
++      unsigned long flags;
+       u32 reg;
+ 
+-      spin_lock(&tgpio->lock);
++      spin_lock_irqsave(&tgpio->lock, flags);
+       reg = ioread32(tgpio->membase + offset);
+ 
+       if (enabled)
+@@ -54,7 +55,7 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, 
unsigned index,
+               reg &= ~(1 << index);
+ 
+       iowrite32(reg, tgpio->membase + offset);
+-      spin_unlock(&tgpio->lock);
++      spin_unlock_irqrestore(&tgpio->lock, flags);
+ 
+       return 0;
+ }
+diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
+index 396a687e020f5..c2c38f13801f5 100644
+--- a/drivers/gpio/gpio-vf610.c
++++ b/drivers/gpio/gpio-vf610.c
+@@ -127,14 +127,14 @@ static int vf610_gpio_direction_output(struct gpio_chip 
*chip, unsigned gpio,
+       unsigned long mask = BIT(gpio);
+       u32 val;
+ 
++      vf610_gpio_set(chip, gpio, value);
++
+       if (port->sdata && port->sdata->have_paddr) {
+               val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
+               val |= mask;
+               vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
+       }
+ 
+-      vf610_gpio_set(chip, gpio, value);
+-
+       return pinctrl_gpio_direction_output(chip->base + gpio);
+ }
+ 
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c 
b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index 6106fa7c43028..43de9dfcba19a 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -44,6 +44,14 @@ static const struct drm_dmi_panel_orientation_data 
gpd_micropc = {
+       .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
+ };
+ 
++static const struct drm_dmi_panel_orientation_data gpd_onemix2s = {
++      .width = 1200,
++      .height = 1920,
++      .bios_dates = (const char * const []){ "05/21/2018", "10/26/2018",
++              "03/04/2019", NULL },
++      .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
++};
++
+ static const struct drm_dmi_panel_orientation_data gpd_pocket = {
+       .width = 1200,
+       .height = 1920,
+@@ -329,6 +337,14 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"),
+               },
+               .driver_data = (void *)&lcd800x1280_rightside_up,
++      }, {    /* One Mix 2S (generic strings, also match on bios date) */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
++                DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
++                DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
++                DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
++              },
++              .driver_data = (void *)&gpd_onemix2s,
+       },
+       {}
+ };
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+index fe7817e4c0d1c..4400f578685a6 100644
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+@@ -98,7 +98,7 @@ static int etnaviv_gem_prime_mmap_obj(struct 
etnaviv_gem_object *etnaviv_obj,
+       ret = dma_buf_mmap(etnaviv_obj->base.dma_buf, vma, 0);
+       if (!ret) {
+               /* Drop the reference acquired by drm_gem_mmap_obj(). */
+-              drm_gem_object_put(&etnaviv_obj->base);
++              drm_gem_object_put_unlocked(&etnaviv_obj->base);
+       }
+ 
+       return ret;
+diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
+index c59764f156f94..419cad31830ea 100644
+--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
+@@ -1051,9 +1051,21 @@ static void dsi_wait4video_done(struct msm_dsi_host 
*msm_host)
+ 
+ static void dsi_wait4video_eng_busy(struct msm_dsi_host *msm_host)
+ {
++      u32 data;
++
+       if (!(msm_host->mode_flags & MIPI_DSI_MODE_VIDEO))
+               return;
+ 
++      data = dsi_read(msm_host, REG_DSI_STATUS0);
++
++      /* if video mode engine is not busy, its because
++       * either timing engine was not turned on or the
++       * DSI controller has finished transmitting the video
++       * data already, so no need to wait in those cases
++       */
++      if (!(data & DSI_STATUS0_VIDEO_MODE_ENGINE_BUSY))
++              return;
++
+       if (msm_host->power_on && msm_host->enabled) {
+               dsi_wait4video_done(msm_host);
+               /* delay 4 ms to skip BLLP */
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+index e3d20048075bf..8db3b3ddbb644 100644
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+@@ -1623,7 +1623,7 @@ static int vmw_cmd_tex_state(struct vmw_private 
*dev_priv,
+ {
+       VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdSetTextureState);
+       SVGA3dTextureState *last_state = (SVGA3dTextureState *)
+-        ((unsigned long) header + header->size + sizeof(header));
++        ((unsigned long) header + header->size + sizeof(*header));
+       SVGA3dTextureState *cur_state = (SVGA3dTextureState *)
+               ((unsigned long) header + sizeof(*cmd));
+       struct vmw_resource *ctx;
+diff --git a/drivers/hid/hid-holtek-kbd.c b/drivers/hid/hid-holtek-kbd.c
+index 403506b9697e7..b346d68a06f5a 100644
+--- a/drivers/hid/hid-holtek-kbd.c
++++ b/drivers/hid/hid-holtek-kbd.c
+@@ -130,6 +130,10 @@ static int holtek_kbd_input_event(struct input_dev *dev, 
unsigned int type,
+               return -ENODEV;
+ 
+       boot_hid = usb_get_intfdata(boot_interface);
++      if (list_empty(&boot_hid->inputs)) {
++              hid_err(hid, "no inputs found\n");
++              return -ENODEV;
++      }
+       boot_hid_input = list_first_entry(&boot_hid->inputs,
+               struct hid_input, list);
+ 
+diff --git a/drivers/hid/hid-logitech-hidpp.c 
b/drivers/hid/hid-logitech-hidpp.c
+index b8558292801ec..477b082aa6a85 100644
+--- a/drivers/hid/hid-logitech-hidpp.c
++++ b/drivers/hid/hid-logitech-hidpp.c
+@@ -3723,7 +3723,8 @@ static int hidpp_probe(struct hid_device *hdev, const 
struct hid_device_id *id)
+                       goto hid_hw_init_fail;
+       }
+ 
+-      hidpp_connect_event(hidpp);
++      schedule_work(&hidpp->work);
++      flush_work(&hidpp->work);
+ 
+       /* Reset the HID node state */
+       hid_device_io_stop(hdev);
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
+index 0893b31e6f102..590b25460456b 100644
+--- a/drivers/hid/hid-multitouch.c
++++ b/drivers/hid/hid-multitouch.c
+@@ -2081,6 +2081,10 @@ static const struct hid_device_id mt_devices[] = {
+                       USB_DEVICE_ID_MTP_STM)},
+ 
+       /* Synaptics devices */
++      { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
++              HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
++                      USB_VENDOR_ID_SYNAPTICS, 0xcd7e) },
++
+       { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
+               HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+                       USB_VENDOR_ID_SYNAPTICS, 0xce08) },
+diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
+index 774507b54b57b..c90cec8d9656d 100644
+--- a/drivers/i2c/i2c-mux.c
++++ b/drivers/i2c/i2c-mux.c
+@@ -340,7 +340,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
+               priv->adap.lock_ops = &i2c_parent_lock_ops;
+ 
+       /* Sanity check on class */
+-      if (i2c_mux_parent_classes(parent) & class)
++      if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
+               dev_err(&parent->dev,
+                       "Segment %d behind mux can't share classes with 
ancestors\n",
+                       chan_id);
+diff --git a/drivers/iio/pressure/bmp280-core.c 
b/drivers/iio/pressure/bmp280-core.c
+index 0a95afaa48fe6..6d1e7c1deea0a 100644
+--- a/drivers/iio/pressure/bmp280-core.c
++++ b/drivers/iio/pressure/bmp280-core.c
+@@ -1113,7 +1113,7 @@ int bmp280_common_probe(struct device *dev,
+        * however as it happens, the BMP085 shares the chip ID of BMP180
+        * so we look for an IRQ if we have that.
+        */
+-      if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
++      if (irq > 0 && (chip_id  == BMP180_CHIP_ID)) {
+               ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
+               if (ret)
+                       goto out_disable_vdda;
+diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
+index d3d16258f1d18..2b2203eea3e90 100644
+--- a/drivers/iio/pressure/dps310.c
++++ b/drivers/iio/pressure/dps310.c
+@@ -57,8 +57,8 @@
+ #define  DPS310_RESET_MAGIC   0x09
+ #define DPS310_COEF_BASE      0x10
+ 
+-/* Make sure sleep time is <= 20ms for usleep_range */
+-#define DPS310_POLL_SLEEP_US(t)               min(20000, (t) / 8)
++/* Make sure sleep time is <= 30ms for usleep_range */
++#define DPS310_POLL_SLEEP_US(t)               min(30000, (t) / 8)
+ /* Silently handle error in rate value here */
+ #define DPS310_POLL_TIMEOUT_US(rc)    ((rc) <= 0 ? 1000000 : 1000000 / (rc))
+ 
+@@ -402,8 +402,8 @@ static int dps310_reset_wait(struct dps310_data *data)
+       if (rc)
+               return rc;
+ 
+-      /* Wait for device chip access: 2.5ms in specification */
+-      usleep_range(2500, 12000);
++      /* Wait for device chip access: 15ms in specification */
++      usleep_range(15000, 55000);
+       return 0;
+ }
+ 
+diff --git a/drivers/iio/pressure/ms5611_core.c 
b/drivers/iio/pressure/ms5611_core.c
+index 511ebdeafbe4d..6943d118752ec 100644
+--- a/drivers/iio/pressure/ms5611_core.c
++++ b/drivers/iio/pressure/ms5611_core.c
+@@ -76,7 +76,7 @@ static bool ms5611_prom_is_valid(u16 *prom, size_t len)
+ 
+       crc = (crc >> 12) & 0x000F;
+ 
+-      return crc_orig != 0x0000 && crc == crc_orig;
++      return crc == crc_orig;
+ }
+ 
+ static int ms5611_read_prom(struct iio_dev *indio_dev)
+diff --git a/drivers/infiniband/hw/cxgb4/cm.c 
b/drivers/infiniband/hw/cxgb4/cm.c
+index e163c09547ebd..c7214c49f202f 100644
+--- a/drivers/infiniband/hw/cxgb4/cm.c
++++ b/drivers/infiniband/hw/cxgb4/cm.c
+@@ -1965,6 +1965,9 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, 
unsigned int atid)
+       int win;
+ 
+       skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
++      if (!skb)
++              return -ENOMEM;
++
+       req = __skb_put_zero(skb, sizeof(*req));
+       req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
+       req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
+diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
+index b99318fb58dc6..762c502391464 100644
+--- a/drivers/input/joystick/xpad.c
++++ b/drivers/input/joystick/xpad.c
+@@ -252,6 +252,7 @@ static const struct xpad_device {
+       { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 },
+       { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 },
+       { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 },
++      { 0x11ff, 0x0511, "PXN V900", 0, XTYPE_XBOX360 },
+       { 0x1209, 0x2882, "Ardwiino Controller", 0, XTYPE_XBOX360 },
+       { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, 
XTYPE_XBOX360 },
+       { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
+@@ -446,6 +447,7 @@ static const struct usb_device_id xpad_table[] = {
+       XPAD_XBOXONE_VENDOR(0x0f0d),            /* Hori Controllers */
+       XPAD_XBOX360_VENDOR(0x1038),            /* SteelSeries Controllers */
+       XPAD_XBOX360_VENDOR(0x11c9),            /* Nacon GC100XF */
++      XPAD_XBOX360_VENDOR(0x11ff),            /* PXN V900 */
+       XPAD_XBOX360_VENDOR(0x1209),            /* Ardwiino Controllers */
+       XPAD_XBOX360_VENDOR(0x12ab),            /* X-Box 360 dance pads */
+       XPAD_XBOX360_VENDOR(0x1430),            /* RedOctane X-Box 360 
controllers */
+diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
+index c4e0e1886061f..6b1b95d58e6b5 100644
+--- a/drivers/input/misc/powermate.c
++++ b/drivers/input/misc/powermate.c
+@@ -425,6 +425,7 @@ static void powermate_disconnect(struct usb_interface 
*intf)
+               pm->requires_update = 0;
+               usb_kill_urb(pm->irq);
+               input_unregister_device(pm->input);
++              usb_kill_urb(pm->config);
+               usb_free_urb(pm->irq);
+               usb_free_urb(pm->config);
+               powermate_free_buffers(interface_to_usbdev(intf), pm);
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
+index 53debe75ae6bc..9ff89bfda7a24 100644
+--- a/drivers/input/mouse/elantech.c
++++ b/drivers/input/mouse/elantech.c
+@@ -2114,6 +2114,7 @@ static int elantech_setup_ps2(struct psmouse *psmouse,
+       psmouse->protocol_handler = elantech_process_byte;
+       psmouse->disconnect = elantech_disconnect;
+       psmouse->reconnect = elantech_reconnect;
++      psmouse->fast_reconnect = NULL;
+       psmouse->pktsize = info->hw_version > 1 ? 6 : 4;
+ 
+       return 0;
+diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
+index 4b81b2d0fe067..f2383c91113c3 100644
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -1617,6 +1617,7 @@ static int synaptics_init_ps2(struct psmouse *psmouse,
+       psmouse->set_rate = synaptics_set_rate;
+       psmouse->disconnect = synaptics_disconnect;
+       psmouse->reconnect = synaptics_reconnect;
++      psmouse->fast_reconnect = NULL;
+       psmouse->cleanup = synaptics_reset;
+       /* Synaptics can usually stay in sync without extra help */
+       psmouse->resync_time = 0;
+diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
+index 2df3ab3b76e4e..174461371b766 100644
+--- a/drivers/mcb/mcb-core.c
++++ b/drivers/mcb/mcb-core.c
+@@ -389,17 +389,13 @@ EXPORT_SYMBOL_GPL(mcb_free_dev);
+ 
+ static int __mcb_bus_add_devices(struct device *dev, void *data)
+ {
+-      struct mcb_device *mdev = to_mcb_device(dev);
+       int retval;
+ 
+-      if (mdev->is_added)
+-              return 0;
+-
+       retval = device_attach(dev);
+-      if (retval < 0)
++      if (retval < 0) {
+               dev_err(dev, "Error adding device (%d)\n", retval);
+-
+-      mdev->is_added = true;
++              return retval;
++      }
+ 
+       return 0;
+ }
+diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c
+index cfe5c95ce0cef..c111025f23c5d 100644
+--- a/drivers/mcb/mcb-parse.c
++++ b/drivers/mcb/mcb-parse.c
+@@ -99,8 +99,6 @@ static int chameleon_parse_gdd(struct mcb_bus *bus,
+       mdev->mem.end = mdev->mem.start + size - 1;
+       mdev->mem.flags = IORESOURCE_MEM;
+ 
+-      mdev->is_added = false;
+-
+       ret = mcb_device_register(bus, mdev);
+       if (ret < 0)
+               goto err;
+diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
+index ed939bb2f7006..6609acf279231 100644
+--- a/drivers/mmc/core/mmc.c
++++ b/drivers/mmc/core/mmc.c
+@@ -95,7 +95,7 @@ static int mmc_decode_cid(struct mmc_card *card)
+       case 3: /* MMC v3.1 - v3.3 */
+       case 4: /* MMC v4 */
+               card->cid.manfid        = UNSTUFF_BITS(resp, 120, 8);
+-              card->cid.oemid         = UNSTUFF_BITS(resp, 104, 16);
++              card->cid.oemid         = UNSTUFF_BITS(resp, 104, 8);
+               card->cid.prod_name[0]  = UNSTUFF_BITS(resp, 96, 8);
+               card->cid.prod_name[1]  = UNSTUFF_BITS(resp, 88, 8);
+               card->cid.prod_name[2]  = UNSTUFF_BITS(resp, 80, 8);
+diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
+index 9e0791332ef38..e614fd82a32a4 100644
+--- a/drivers/mmc/core/sdio.c
++++ b/drivers/mmc/core/sdio.c
+@@ -1014,8 +1014,14 @@ static int mmc_sdio_resume(struct mmc_host *host)
+               }
+               err = mmc_sdio_reinit_card(host);
+       } else if (mmc_card_wake_sdio_irq(host)) {
+-              /* We may have switched to 1-bit mode during suspend */
++              /*
++               * We may have switched to 1-bit mode during suspend,
++               * need to hold retuning, because tuning only supprt
++               * 4-bit mode or 8 bit mode.
++               */
++              mmc_retune_hold_now(host);
+               err = sdio_enable_4bit_bus(host->card);
++              mmc_retune_release(host);
+       }
+ 
+       if (err)
+diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
+index 21b556afc3050..e4f72b2df8039 100644
+--- a/drivers/mtd/maps/physmap-core.c
++++ b/drivers/mtd/maps/physmap-core.c
+@@ -533,6 +533,17 @@ static int physmap_flash_probe(struct platform_device 
*dev)
+               if (info->probe_type) {
+                       info->mtds[i] = do_map_probe(info->probe_type,
+                                                    &info->maps[i]);
++
++                      /* Fall back to mapping region as ROM */
++                      if (!info->mtds[i] && IS_ENABLED(CONFIG_MTD_ROM) &&
++                          strcmp(info->probe_type, "map_rom")) {
++                              dev_warn(&dev->dev,
++                                       "map_probe() failed for type %s\n",
++                                       info->probe_type);
++
++                              info->mtds[i] = do_map_probe("map_rom",
++                                                           &info->maps[i]);
++                      }
+               } else {
+                       int j;
+ 
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c 
b/drivers/mtd/nand/raw/qcom_nandc.c
+index 5af3bef6c2303..db5cfcadb2bdf 100644
+--- a/drivers/mtd/nand/raw/qcom_nandc.c
++++ b/drivers/mtd/nand/raw/qcom_nandc.c
+@@ -2972,7 +2972,7 @@ err_nandc_alloc:
+ err_aon_clk:
+       clk_disable_unprepare(nandc->core_clk);
+ err_core_clk:
+-      dma_unmap_resource(dev, res->start, resource_size(res),
++      dma_unmap_resource(dev, nandc->base_dma, resource_size(res),
+                          DMA_BIDIRECTIONAL, 0);
+       return ret;
+ }
+diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
+index 7d7b1f7fcf71d..c232ecd761aef 100644
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -12,7 +12,7 @@
+ 
+ #define SPINAND_MFR_MICRON            0x2c
+ 
+-#define MICRON_STATUS_ECC_MASK                GENMASK(7, 4)
++#define MICRON_STATUS_ECC_MASK                GENMASK(6, 4)
+ #define MICRON_STATUS_ECC_NO_BITFLIPS (0 << 4)
+ #define MICRON_STATUS_ECC_1TO3_BITFLIPS       (1 << 4)
+ #define MICRON_STATUS_ECC_4TO6_BITFLIPS       (3 << 4)
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c 
b/drivers/net/ethernet/intel/i40e/i40e_common.c
+index 6475f78e85f6c..a3709c4fc65d0 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
+@@ -1341,7 +1341,7 @@ void i40e_clear_hw(struct i40e_hw *hw)
+                    I40E_PFLAN_QALLOC_FIRSTQ_SHIFT;
+       j = (val & I40E_PFLAN_QALLOC_LASTQ_MASK) >>
+           I40E_PFLAN_QALLOC_LASTQ_SHIFT;
+-      if (val & I40E_PFLAN_QALLOC_VALID_MASK)
++      if (val & I40E_PFLAN_QALLOC_VALID_MASK && j >= base_queue)
+               num_queues = (j - base_queue) + 1;
+       else
+               num_queues = 0;
+@@ -1351,7 +1351,7 @@ void i40e_clear_hw(struct i40e_hw *hw)
+           I40E_PF_VT_PFALLOC_FIRSTVF_SHIFT;
+       j = (val & I40E_PF_VT_PFALLOC_LASTVF_MASK) >>
+           I40E_PF_VT_PFALLOC_LASTVF_SHIFT;
+-      if (val & I40E_PF_VT_PFALLOC_VALID_MASK)
++      if (val & I40E_PF_VT_PFALLOC_VALID_MASK && j >= i)
+               num_vfs = (j - i) + 1;
+       else
+               num_vfs = 0;
+diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c 
b/drivers/net/ethernet/intel/ice/ice_lib.c
+index cc755382df256..50034ff26477e 100644
+--- a/drivers/net/ethernet/intel/ice/ice_lib.c
++++ b/drivers/net/ethernet/intel/ice/ice_lib.c
+@@ -1015,8 +1015,7 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx 
*ctxt, struct ice_vsi *vsi)
+ 
+       ctxt->info.q_opt_rss = ((lut_type << ICE_AQ_VSI_Q_OPT_RSS_LUT_S) &
+                               ICE_AQ_VSI_Q_OPT_RSS_LUT_M) |
+-                              ((hash_type << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) &
+-                               ICE_AQ_VSI_Q_OPT_RSS_HASH_M);
++                              (hash_type & ICE_AQ_VSI_Q_OPT_RSS_HASH_M);
+ }
+ 
+ /**
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+index 0e73e3b1af19a..a3b1295415665 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+@@ -28,6 +28,9 @@ static inline void ixgbe_alloc_vf_macvlans(struct 
ixgbe_adapter *adapter,
+       struct vf_macvlans *mv_list;
+       int num_vf_macvlans, i;
+ 
++      /* Initialize list of VF macvlans */
++      INIT_LIST_HEAD(&adapter->vf_mvs.l);
++
+       num_vf_macvlans = hw->mac.num_rar_entries -
+                         (IXGBE_MAX_PF_MACVLANS + 1 + num_vfs);
+       if (!num_vf_macvlans)
+@@ -36,8 +39,6 @@ static inline void ixgbe_alloc_vf_macvlans(struct 
ixgbe_adapter *adapter,
+       mv_list = kcalloc(num_vf_macvlans, sizeof(struct vf_macvlans),
+                         GFP_KERNEL);
+       if (mv_list) {
+-              /* Initialize list of VF macvlans */
+-              INIT_LIST_HEAD(&adapter->vf_mvs.l);
+               for (i = 0; i < num_vf_macvlans; i++) {
+                       mv_list[i].vf = -1;
+                       mv_list[i].free = true;
+diff --git a/drivers/net/ethernet/marvell/sky2.h 
b/drivers/net/ethernet/marvell/sky2.h
+index b02b6523083ce..99451585a45f2 100644
+--- a/drivers/net/ethernet/marvell/sky2.h
++++ b/drivers/net/ethernet/marvell/sky2.h
+@@ -2201,7 +2201,7 @@ struct rx_ring_info {
+       struct sk_buff  *skb;
+       dma_addr_t      data_addr;
+       DEFINE_DMA_UNMAP_LEN(data_size);
+-      dma_addr_t      frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
++      dma_addr_t      frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1];
+ };
+ 
+ enum flow_control {
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
+index 05517c7feaa56..a20ba23f0ed7a 100644
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
+@@ -294,8 +294,8 @@ const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = {
+       .fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
+ };
+ 
+-static bool mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
+-                                           bool learning_en)
++static int mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
++                                          bool learning_en)
+ {
+       char tnpc_pl[MLXSW_REG_TNPC_LEN];
+ 
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c 
b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+index c449ecc0add23..1f77bbb35ea93 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+@@ -113,7 +113,10 @@ static void qed_ll2b_complete_tx_packet(void *cxt,
+ static int qed_ll2_alloc_buffer(struct qed_dev *cdev,
+                               u8 **data, dma_addr_t *phys_addr)
+ {
+-      *data = kmalloc(cdev->ll2->rx_size, GFP_ATOMIC);
++      size_t size = cdev->ll2->rx_size + NET_SKB_PAD +
++                    SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
++
++      *data = kmalloc(size, GFP_ATOMIC);
+       if (!(*data)) {
+               DP_INFO(cdev, "Failed to allocate LL2 buffer data\n");
+               return -ENOMEM;
+@@ -2449,7 +2452,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct 
qed_ll2_params *params)
+       INIT_LIST_HEAD(&cdev->ll2->list);
+       spin_lock_init(&cdev->ll2->lock);
+ 
+-      cdev->ll2->rx_size = NET_SKB_PAD + ETH_HLEN +
++      cdev->ll2->rx_size = PRM_DMA_PAD_BYTES_NUM + ETH_HLEN +
+                            L1_CACHE_BYTES + params->mtu;
+ 
+       /* Allocate memory for LL2.
+diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
+index 231a1295c4700..367da05ddb1e7 100644
+--- a/drivers/net/ethernet/renesas/ravb_main.c
++++ b/drivers/net/ethernet/renesas/ravb_main.c
+@@ -1703,6 +1703,8 @@ static int ravb_close(struct net_device *ndev)
+                       of_phy_deregister_fixed_link(np);
+       }
+ 
++      cancel_work_sync(&priv->work);
++
+       if (priv->chip_id != RCAR_GEN2) {
+               free_irq(priv->tx_irqs[RAVB_NC], ndev);
+               free_irq(priv->rx_irqs[RAVB_NC], ndev);
+@@ -2212,14 +2214,14 @@ static int ravb_remove(struct platform_device *pdev)
+       if (priv->chip_id != RCAR_GEN2)
+               ravb_ptp_stop(ndev);
+ 
+-      dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
+-                        priv->desc_bat_dma);
+       /* Set reset mode */
+       ravb_write(ndev, CCC_OPC_RESET, CCC);
+       unregister_netdev(ndev);
+       netif_napi_del(&priv->napi[RAVB_NC]);
+       netif_napi_del(&priv->napi[RAVB_BE]);
+       ravb_mdio_release(priv);
++      dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
++                        priv->desc_bat_dma);
+       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
+       free_netdev(ndev);
+diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
+index fb57e561d3e61..fdbdc22fe4e5c 100644
+--- a/drivers/net/ieee802154/ca8210.c
++++ b/drivers/net/ieee802154/ca8210.c
+@@ -2782,7 +2782,6 @@ static int ca8210_register_ext_clock(struct spi_device 
*spi)
+       struct device_node *np = spi->dev.of_node;
+       struct ca8210_priv *priv = spi_get_drvdata(spi);
+       struct ca8210_platform_data *pdata = spi->dev.platform_data;
+-      int ret = 0;
+ 
+       if (!np)
+               return -EFAULT;
+@@ -2799,18 +2798,8 @@ static int ca8210_register_ext_clock(struct spi_device 
*spi)
+               dev_crit(&spi->dev, "Failed to register external clk\n");
+               return PTR_ERR(priv->clk);
+       }
+-      ret = of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
+-      if (ret) {
+-              clk_unregister(priv->clk);
+-              dev_crit(
+-                      &spi->dev,
+-                      "Failed to register external clock as clock provider\n"
+-              );
+-      } else {
+-              dev_info(&spi->dev, "External clock set as clock provider\n");
+-      }
+ 
+-      return ret;
++      return of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
+ }
+ 
+ /**
+@@ -2822,8 +2811,8 @@ static void ca8210_unregister_ext_clock(struct 
spi_device *spi)
+ {
+       struct ca8210_priv *priv = spi_get_drvdata(spi);
+ 
+-      if (!priv->clk)
+-              return
++      if (IS_ERR_OR_NULL(priv->clk))
++              return;
+ 
+       of_clk_del_provider(spi->dev.of_node);
+       clk_unregister(priv->clk);
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c
+index 51cc8768d910c..c595262c109ac 100644
+--- a/drivers/net/tun.c
++++ b/drivers/net/tun.c
+@@ -3134,10 +3134,11 @@ static long __tun_chr_ioctl(struct file *file, 
unsigned int cmd,
+       struct net *net = sock_net(&tfile->sk);
+       struct tun_struct *tun;
+       void __user* argp = (void __user*)arg;
+-      unsigned int ifindex, carrier;
++      unsigned int carrier;
+       struct ifreq ifr;
+       kuid_t owner;
+       kgid_t group;
++      int ifindex;
+       int sndbuf;
+       int vnet_hdr_sz;
+       int le;
+@@ -3194,7 +3195,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned 
int cmd,
+               ret = -EFAULT;
+               if (copy_from_user(&ifindex, argp, sizeof(ifindex)))
+                       goto unlock;
+-
++              ret = -EINVAL;
++              if (ifindex < 0)
++                      goto unlock;
+               ret = 0;
+               tfile->ifindex = ifindex;
+               goto unlock;
+diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
+index 915ac75b55fc7..5aad26600b03e 100644
+--- a/drivers/net/usb/dm9601.c
++++ b/drivers/net/usb/dm9601.c
+@@ -221,13 +221,18 @@ static int dm9601_mdio_read(struct net_device *netdev, 
int phy_id, int loc)
+       struct usbnet *dev = netdev_priv(netdev);
+ 
+       __le16 res;
++      int err;
+ 
+       if (phy_id) {
+               netdev_dbg(dev->net, "Only internal phy supported\n");
+               return 0;
+       }
+ 
+-      dm_read_shared_word(dev, 1, loc, &res);
++      err = dm_read_shared_word(dev, 1, loc, &res);
++      if (err < 0) {
++              netdev_err(dev->net, "MDIO read error: %d\n", err);
++              return err;
++      }
+ 
+       netdev_dbg(dev->net,
+                  "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, 
returns=0x%04x\n",
+diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
+index 9a770f7fa5b02..7c579b038be75 100644
+--- a/drivers/net/usb/smsc95xx.c
++++ b/drivers/net/usb/smsc95xx.c
+@@ -1040,7 +1040,7 @@ static int smsc95xx_reset(struct usbnet *dev)
+ 
+       if (timeout >= 100) {
+               netdev_warn(dev->net, "timeout waiting for completion of Lite 
Reset\n");
+-              return ret;
++              return -ETIMEDOUT;
+       }
+ 
+       ret = smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_);
+diff --git a/drivers/net/xen-netback/interface.c 
b/drivers/net/xen-netback/interface.c
+index 6432f6e7fd548..91b35093f2aa6 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -41,7 +41,6 @@
+ #include <asm/xen/hypercall.h>
+ #include <xen/balloon.h>
+ 
+-#define XENVIF_QUEUE_LENGTH 32
+ #define XENVIF_NAPI_WEIGHT  64
+ 
+ /* Number of bytes allowed on the internal guest Rx queue. */
+@@ -526,8 +525,6 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t 
domid,
+       dev->features = dev->hw_features | NETIF_F_RXCSUM;
+       dev->ethtool_ops = &xenvif_ethtool_ops;
+ 
+-      dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
+-
+       dev->min_mtu = ETH_MIN_MTU;
+       dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
+ 
+diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c 
b/drivers/phy/motorola/phy-mapphone-mdm6600.c
+index 39d13f7e4cf33..a79d6cf202209 100644
+--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
+@@ -122,16 +122,10 @@ static int phy_mdm6600_power_on(struct phy *x)
+ {
+       struct phy_mdm6600 *ddata = phy_get_drvdata(x);
+       struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
+-      int error;
+ 
+       if (!ddata->enabled)
+               return -ENODEV;
+ 
+-      error = pinctrl_pm_select_default_state(ddata->dev);
+-      if (error)
+-              dev_warn(ddata->dev, "%s: error with default_state: %i\n",
+-                       __func__, error);
+-
+       gpiod_set_value_cansleep(enable_gpio, 1);
+ 
+       /* Allow aggressive PM for USB, it's only needed for n_gsm port */
+@@ -160,11 +154,6 @@ static int phy_mdm6600_power_off(struct phy *x)
+ 
+       gpiod_set_value_cansleep(enable_gpio, 0);
+ 
+-      error = pinctrl_pm_select_sleep_state(ddata->dev);
+-      if (error)
+-              dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
+-                       __func__, error);
+-
+       return 0;
+ }
+ 
+@@ -455,6 +444,7 @@ static void phy_mdm6600_device_power_off(struct 
phy_mdm6600 *ddata)
+ {
+       struct gpio_desc *reset_gpio =
+               ddata->ctrl_gpios[PHY_MDM6600_RESET];
++      int error;
+ 
+       ddata->enabled = false;
+       phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_BP_SHUTDOWN_REQ);
+@@ -470,6 +460,17 @@ static void phy_mdm6600_device_power_off(struct 
phy_mdm6600 *ddata)
+       } else {
+               dev_err(ddata->dev, "Timed out powering down\n");
+       }
++
++      /*
++       * Keep reset gpio high with padconf internal pull-up resistor to
++       * prevent modem from waking up during deeper SoC idle states. The
++       * gpio bank lines can have glitches if not in the always-on wkup
++       * domain.
++       */
++      error = pinctrl_pm_select_sleep_state(ddata->dev);
++      if (error)
++              dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
++                       __func__, error);
+ }
+ 
+ static void phy_mdm6600_deferred_power_on(struct work_struct *work)
+@@ -570,12 +571,6 @@ static int phy_mdm6600_probe(struct platform_device *pdev)
+       ddata->dev = &pdev->dev;
+       platform_set_drvdata(pdev, ddata);
+ 
+-      /* Active state selected in phy_mdm6600_power_on() */
+-      error = pinctrl_pm_select_sleep_state(ddata->dev);
+-      if (error)
+-              dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
+-                       __func__, error);
+-
+       error = phy_mdm6600_init_lines(ddata);
+       if (error)
+               return error;
+@@ -626,10 +621,12 @@ idle:
+       pm_runtime_put_autosuspend(ddata->dev);
+ 
+ cleanup:
+-      if (error < 0)
++      if (error < 0) {
+               phy_mdm6600_device_power_off(ddata);
+-      pm_runtime_disable(ddata->dev);
+-      pm_runtime_dont_use_autosuspend(ddata->dev);
++              pm_runtime_disable(ddata->dev);
++              pm_runtime_dont_use_autosuspend(ddata->dev);
++      }
++
+       return error;
+ }
+ 
+@@ -638,6 +635,7 @@ static int phy_mdm6600_remove(struct platform_device *pdev)
+       struct phy_mdm6600 *ddata = platform_get_drvdata(pdev);
+       struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET];
+ 
++      pm_runtime_get_noresume(ddata->dev);
+       pm_runtime_dont_use_autosuspend(ddata->dev);
+       pm_runtime_put_sync(ddata->dev);
+       pm_runtime_disable(ddata->dev);
+diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c
+index ad205fdad3722..286e9b119ee5b 100644
+--- a/drivers/pwm/pwm-hibvt.c
++++ b/drivers/pwm/pwm-hibvt.c
+@@ -146,6 +146,7 @@ static void hibvt_pwm_get_state(struct pwm_chip *chip, 
struct pwm_device *pwm,
+ 
+       value = readl(base + PWM_CTRL_ADDR(pwm->hwpwm));
+       state->enabled = (PWM_ENABLE_MASK & value);
++      state->polarity = (PWM_POLARITY_MASK & value) ? PWM_POLARITY_INVERSED : 
PWM_POLARITY_NORMAL;
+ }
+ 
+ static int hibvt_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
+index fe4b666edd037..87d0cd6f49ca9 100644
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -5351,15 +5351,11 @@ wash:
+       mutex_lock(&regulator_list_mutex);
+       regulator_ena_gpio_free(rdev);
+       mutex_unlock(&regulator_list_mutex);
+-      put_device(&rdev->dev);
+-      rdev = NULL;
+ clean:
+       if (dangling_of_gpiod)
+               gpiod_put(config->ena_gpiod);
+-      if (rdev && rdev->dev.of_node)
+-              of_node_put(rdev->dev.of_node);
+-      kfree(rdev);
+       kfree(config);
++      put_device(&rdev->dev);
+ rinse:
+       if (dangling_cfg_gpiod)
+               gpiod_put(cfg->ena_gpiod);
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
+index f787e9771b1f4..9a1954e9f6f15 100644
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -148,6 +148,10 @@ int usb_device_supports_lpm(struct usb_device *udev)
+       if (udev->quirks & USB_QUIRK_NO_LPM)
+               return 0;
+ 
++      /* Skip if the device BOS descriptor couldn't be read */
++      if (!udev->bos)
++              return 0;
++
+       /* USB 2.1 (and greater) devices indicate LPM support through
+        * their USB 2.0 Extended Capabilities BOS descriptor.
+        */
+@@ -324,6 +328,10 @@ static void usb_set_lpm_parameters(struct usb_device 
*udev)
+       if (!udev->lpm_capable || udev->speed < USB_SPEED_SUPER)
+               return;
+ 
++      /* Skip if the device BOS descriptor couldn't be read */
++      if (!udev->bos)
++              return;
++
+       hub = usb_hub_to_struct_hub(udev->parent);
+       /* It doesn't take time to transition the roothub into U0, since it
+        * doesn't have an upstream link.
+@@ -2678,7 +2686,8 @@ out_authorized:
+ }
+ 
+ /*
+- * Return 1 if port speed is SuperSpeedPlus, 0 otherwise
++ * Return 1 if port speed is SuperSpeedPlus, 0 otherwise or if the
++ * capability couldn't be checked.
+  * check it from the link protocol field of the current speed ID attribute.
+  * current speed ID is got from ext port status request. Sublink speed 
attribute
+  * table is returned with the hub BOS SSP device capability descriptor
+@@ -2688,8 +2697,12 @@ static int port_speed_is_ssp(struct usb_device *hdev, 
int speed_id)
+       int ssa_count;
+       u32 ss_attr;
+       int i;
+-      struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap;
++      struct usb_ssp_cap_descriptor *ssp_cap;
+ 
++      if (!hdev->bos)
++              return 0;
++
++      ssp_cap = hdev->bos->ssp_cap;
+       if (!ssp_cap)
+               return 0;
+ 
+@@ -4091,8 +4104,15 @@ static void usb_enable_link_state(struct usb_hcd *hcd, 
struct usb_device *udev,
+               enum usb3_link_state state)
+ {
+       int timeout, ret;
+-      __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat;
+-      __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat;
++      __u8 u1_mel;
++      __le16 u2_mel;
++
++      /* Skip if the device BOS descriptor couldn't be read */
++      if (!udev->bos)
++              return;
++
++      u1_mel = udev->bos->ss_cap->bU1devExitLat;
++      u2_mel = udev->bos->ss_cap->bU2DevExitLat;
+ 
+       /* If the device says it doesn't have *any* exit latency to come out of
+        * U1 or U2, it's probably lying.  Assume it doesn't implement that link
+diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
+index a8f23f8bc6efd..1c455800f7d3d 100644
+--- a/drivers/usb/core/hub.h
++++ b/drivers/usb/core/hub.h
+@@ -141,7 +141,7 @@ static inline int hub_is_superspeedplus(struct usb_device 
*hdev)
+ {
+       return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS &&
+               le16_to_cpu(hdev->descriptor.bcdUSB) >= 0x0310 &&
+-              hdev->bos->ssp_cap);
++              hdev->bos && hdev->bos->ssp_cap);
+ }
+ 
+ static inline unsigned hub_power_on_good_delay(struct usb_hub *hub)
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
+index 22c1a68e1cc8a..49404e860d45c 100644
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -250,9 +250,46 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
+        * XHCI driver will reset the host block. If dwc3 was configured for
+        * host-only mode or current role is host, then we can return early.
+        */
+-      if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == 
DWC3_GCTL_PRTCAP_HOST)
++      if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
+               return 0;
+ 
++      /*
++       * If the dr_mode is host and the dwc->current_dr_role is not the
++       * corresponding DWC3_GCTL_PRTCAP_HOST, then the dwc3_core_init_mode
++       * isn't executed yet. Ensure the phy is ready before the controller
++       * updates the GCTL.PRTCAPDIR or other settings by soft-resetting
++       * the phy.
++       *
++       * Note: GUSB3PIPECTL[n] and GUSB2PHYCFG[n] are port settings where n
++       * is port index. If this is a multiport host, then we need to reset
++       * all active ports.
++       */
++      if (dwc->dr_mode == USB_DR_MODE_HOST) {
++              u32 usb3_port;
++              u32 usb2_port;
++
++              usb3_port = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
++              usb3_port |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
++              dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
++
++              usb2_port = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
++              usb2_port |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
++              dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
++
++              /* Small delay for phy reset assertion */
++              usleep_range(1000, 2000);
++
++              usb3_port &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
++              dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
++
++              usb2_port &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
++              dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
++
++              /* Wait for clock synchronization */
++              msleep(50);
++              return 0;
++      }
++
+       reg = dwc3_readl(dwc->regs, DWC3_DCTL);
+       reg |= DWC3_DCTL_CSFTRST;
+       dwc3_writel(dwc->regs, DWC3_DCTL, reg);
+diff --git a/drivers/usb/gadget/function/f_ncm.c 
b/drivers/usb/gadget/function/f_ncm.c
+index 5558ea5ac77af..8d23a870b7b7f 100644
+--- a/drivers/usb/gadget/function/f_ncm.c
++++ b/drivers/usb/gadget/function/f_ncm.c
+@@ -1180,7 +1180,8 @@ static int ncm_unwrap_ntb(struct gether *port,
+                         struct sk_buff_head *list)
+ {
+       struct f_ncm    *ncm = func_to_ncm(&port->func);
+-      __le16          *tmp = (void *) skb->data;
++      unsigned char   *ntb_ptr = skb->data;
++      __le16          *tmp;
+       unsigned        index, index2;
+       int             ndp_index;
+       unsigned        dg_len, dg_len2;
+@@ -1193,6 +1194,10 @@ static int ncm_unwrap_ntb(struct gether *port,
+       const struct ndp_parser_opts *opts = ncm->parser_opts;
+       unsigned        crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
+       int             dgram_counter;
++      int             to_process = skb->len;
++
++parse_ntb:
++      tmp = (__le16 *)ntb_ptr;
+ 
+       /* dwSignature */
+       if (get_unaligned_le32(tmp) != opts->nth_sign) {
+@@ -1239,7 +1244,7 @@ static int ncm_unwrap_ntb(struct gether *port,
+                * walk through NDP
+                * dwSignature
+                */
+-              tmp = (void *)(skb->data + ndp_index);
++              tmp = (__le16 *)(ntb_ptr + ndp_index);
+               if (get_unaligned_le32(tmp) != ncm->ndp_sign) {
+                       INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
+                       goto err;
+@@ -1296,11 +1301,11 @@ static int ncm_unwrap_ntb(struct gether *port,
+                       if (ncm->is_crc) {
+                               uint32_t crc, crc2;
+ 
+-                              crc = get_unaligned_le32(skb->data +
++                              crc = get_unaligned_le32(ntb_ptr +
+                                                        index + dg_len -
+                                                        crc_len);
+                               crc2 = ~crc32_le(~0,
+-                                               skb->data + index,
++                                               ntb_ptr + index,
+                                                dg_len - crc_len);
+                               if (crc != crc2) {
+                                       INFO(port->func.config->cdev,
+@@ -1327,7 +1332,7 @@ static int ncm_unwrap_ntb(struct gether *port,
+                                                        dg_len - crc_len);
+                       if (skb2 == NULL)
+                               goto err;
+-                      skb_put_data(skb2, skb->data + index,
++                      skb_put_data(skb2, ntb_ptr + index,
+                                    dg_len - crc_len);
+ 
+                       skb_queue_tail(list, skb2);
+@@ -1340,10 +1345,17 @@ static int ncm_unwrap_ntb(struct gether *port,
+               } while (ndp_len > 2 * (opts->dgram_item_len * 2));
+       } while (ndp_index);
+ 
+-      dev_consume_skb_any(skb);
+-
+       VDBG(port->func.config->cdev,
+            "Parsed NTB with %d frames\n", dgram_counter);
++
++      to_process -= block_len;
++      if (to_process != 0) {
++              ntb_ptr = (unsigned char *)(ntb_ptr + block_len);
++              goto parse_ntb;
++      }
++
++      dev_consume_skb_any(skb);
++
+       return 0;
+ err:
+       skb_queue_purge(list);
+diff --git a/drivers/usb/gadget/udc/udc-xilinx.c 
b/drivers/usb/gadget/udc/udc-xilinx.c
+index de22dd5436538..1db7b61af591b 100644
+--- a/drivers/usb/gadget/udc/udc-xilinx.c
++++ b/drivers/usb/gadget/udc/udc-xilinx.c
+@@ -496,11 +496,13 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct 
xusb_req *req,
+               /* Get the Buffer address and copy the transmit data.*/
+               eprambase = (u32 __force *)(udc->addr + ep->rambase);
+               if (ep->is_in) {
+-                      memcpy(eprambase, bufferptr, bytestosend);
++                      memcpy_toio((void __iomem *)eprambase, bufferptr,
++                                  bytestosend);
+                       udc->write_fn(udc->addr, ep->offset +
+                                     XUSB_EP_BUF0COUNT_OFFSET, bufferlen);
+               } else {
+-                      memcpy(bufferptr, eprambase, bytestosend);
++                      memcpy_toio((void __iomem *)bufferptr, eprambase,
++                                  bytestosend);
+               }
+               /*
+                * Enable the buffer for transmission.
+@@ -514,11 +516,13 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct 
xusb_req *req,
+               eprambase = (u32 __force *)(udc->addr + ep->rambase +
+                            ep->ep_usb.maxpacket);
+               if (ep->is_in) {
+-                      memcpy(eprambase, bufferptr, bytestosend);
++                      memcpy_toio((void __iomem *)eprambase, bufferptr,
++                                  bytestosend);
+                       udc->write_fn(udc->addr, ep->offset +
+                                     XUSB_EP_BUF1COUNT_OFFSET, bufferlen);
+               } else {
+-                      memcpy(bufferptr, eprambase, bytestosend);
++                      memcpy_toio((void __iomem *)bufferptr, eprambase,
++                                  bytestosend);
+               }
+               /*
+                * Enable the buffer for transmission.
+@@ -1020,7 +1024,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, struct 
xusb_req *req)
+                          udc->addr);
+               length = req->usb_req.actual = min_t(u32, length,
+                                                    EP0_MAX_PACKET);
+-              memcpy(corebuf, req->usb_req.buf, length);
++              memcpy_toio((void __iomem *)corebuf, req->usb_req.buf, length);
+               udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length);
+               udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1);
+       } else {
+@@ -1746,7 +1750,7 @@ static void xudc_handle_setup(struct xusb_udc *udc)
+ 
+       /* Load up the chapter 9 command buffer.*/
+       ep0rambase = (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET);
+-      memcpy(&setup, ep0rambase, 8);
++      memcpy_toio((void __iomem *)&setup, ep0rambase, 8);
+ 
+       udc->setup = setup;
+       udc->setup.wValue = cpu_to_le16(setup.wValue);
+@@ -1833,7 +1837,7 @@ static void xudc_ep0_out(struct xusb_udc *udc)
+                            (ep0->rambase << 2));
+               buffer = req->usb_req.buf + req->usb_req.actual;
+               req->usb_req.actual = req->usb_req.actual + bytes_to_rx;
+-              memcpy(buffer, ep0rambase, bytes_to_rx);
++              memcpy_toio((void __iomem *)buffer, ep0rambase, bytes_to_rx);
+ 
+               if (req->usb_req.length == req->usb_req.actual) {
+                       /* Data transfer completed get ready for Status stage */
+@@ -1909,7 +1913,7 @@ static void xudc_ep0_in(struct xusb_udc *udc)
+                                    (ep0->rambase << 2));
+                       buffer = req->usb_req.buf + req->usb_req.actual;
+                       req->usb_req.actual = req->usb_req.actual + length;
+-                      memcpy(ep0rambase, buffer, length);
++                      memcpy_toio((void __iomem *)ep0rambase, buffer, length);
+               }
+               udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count);
+               udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1);
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
+index e6faabe65bd5d..35372f3e3b572 100644
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -714,7 +714,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
+ static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci,
+               struct xhci_ring *ring, struct xhci_td *td)
+ {
+-      struct device *dev = xhci_to_hcd(xhci)->self.controller;
++      struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
+       struct xhci_segment *seg = td->bounce_seg;
+       struct urb *urb = td->urb;
+       size_t len;
+@@ -3283,7 +3283,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int 
transferred,
+ static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
+                        u32 *trb_buff_len, struct xhci_segment *seg)
+ {
+-      struct device *dev = xhci_to_hcd(xhci)->self.controller;
++      struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
+       unsigned int unalign;
+       unsigned int max_pkt;
+       u32 new_buff_len;
+diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
+index 0c6204add6161..1efd5ce48f893 100644
+--- a/drivers/usb/musb/musb_debugfs.c
++++ b/drivers/usb/musb/musb_debugfs.c
+@@ -39,7 +39,7 @@ static const struct musb_register_map musb_regmap[] = {
+       { "IntrUsbE",   MUSB_INTRUSBE,  8 },
+       { "DevCtl",     MUSB_DEVCTL,    8 },
+       { "VControl",   0x68,           32 },
+-      { "HWVers",     0x69,           16 },
++      { "HWVers",     MUSB_HWVERS,    16 },
+       { "LinkInfo",   MUSB_LINKINFO,  8 },
+       { "VPLen",      MUSB_VPLEN,     8 },
+       { "HS_EOF1",    MUSB_HS_EOF1,   8 },
+diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
+index fa9922c0c9104..eb88d52e6d94f 100644
+--- a/drivers/usb/musb/musb_host.c
++++ b/drivers/usb/musb/musb_host.c
+@@ -339,10 +339,16 @@ static void musb_advance_schedule(struct musb *musb, 
struct urb *urb,
+       musb_giveback(musb, urb, status);
+       qh->is_ready = ready;
+ 
++      /*
++       * musb->lock had been unlocked in musb_giveback, so qh may
++       * be freed, need to get it again
++       */
++      qh = musb_ep_get_qh(hw_ep, is_in);
++
+       /* reclaim resources (and bandwidth) ASAP; deschedule it, and
+        * invalidate qh as soon as list_empty(&hep->urb_list)
+        */
+-      if (list_empty(&qh->hep->urb_list)) {
++      if (qh && list_empty(&qh->hep->urb_list)) {
+               struct list_head        *head;
+               struct dma_controller   *dma = musb->dma_controller;
+ 
+@@ -2424,6 +2430,7 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct 
urb *urb, int status)
+                * and its URB list has emptied, recycle this qh.
+                */
+               if (ready && list_empty(&qh->hep->urb_list)) {
++                      musb_ep_set_qh(qh->hw_ep, is_in, NULL);
+                       qh->hep->hcpriv = NULL;
+                       list_del(&qh->ring);
+                       kfree(qh);
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
+index dfe820af88385..24d79ea95155e 100644
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -203,6 +203,9 @@ static void option_instat_callback(struct urb *urb);
+ #define DELL_PRODUCT_5829E_ESIM                       0x81e4
+ #define DELL_PRODUCT_5829E                    0x81e6
+ 
++#define DELL_PRODUCT_FM101R                   0x8213
++#define DELL_PRODUCT_FM101R_ESIM              0x8215
++
+ #define KYOCERA_VENDOR_ID                     0x0c88
+ #define KYOCERA_PRODUCT_KPC650                        0x17da
+ #define KYOCERA_PRODUCT_KPC680                        0x180a
+@@ -1108,6 +1111,8 @@ static const struct usb_device_id option_ids[] = {
+         .driver_info = RSVD(0) | RSVD(6) },
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM),
+         .driver_info = RSVD(0) | RSVD(6) },
++      { USB_DEVICE_INTERFACE_CLASS(DELL_VENDOR_ID, DELL_PRODUCT_FM101R, 0xff) 
},
++      { USB_DEVICE_INTERFACE_CLASS(DELL_VENDOR_ID, DELL_PRODUCT_FM101R_ESIM, 
0xff) },
+       { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },   /* 
ADU-E100, ADU-310 */
+       { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
+       { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
+@@ -1290,6 +1295,7 @@ static const struct usb_device_id option_ids[] = {
+        .driver_info = NCTRL(0) | RSVD(3) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1033, 0xff),    /* 
Telit LE910C1-EUX (ECM) */
+        .driver_info = NCTRL(0) },
++      { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1035, 0xff) }, /* Telit 
LE910C4-WWX (ECM) */
+       { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0),
+         .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) },
+       { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1),
+@@ -2262,6 +2268,7 @@ static const struct usb_device_id option_ids[] = {
+       { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) },                   
/* GosunCn GM500 ECM/NCM */
+       { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 
0xff, 0x30) },
+       { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, 
SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) },
++      { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, 
SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) },
+       { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, 
SIERRA_PRODUCT_EM9191, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 
0xff, 0, 0) },
+       { } /* Terminating entry */
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
+index a9191a0d2f4c9..f47316edcf423 100644
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -1681,12 +1681,12 @@ static int run_delayed_tree_ref(struct 
btrfs_trans_handle *trans,
+               parent = ref->parent;
+       ref_root = ref->root;
+ 
+-      if (node->ref_mod != 1) {
++      if (unlikely(node->ref_mod != 1)) {
+               btrfs_err(trans->fs_info,
+-      "btree block(%llu) has %d references rather than 1: action %d ref_root 
%llu parent %llu",
++      "btree block %llu has %d references rather than 1: action %d ref_root 
%llu parent %llu",
+                         node->bytenr, node->ref_mod, node->action, ref_root,
+                         parent);
+-              return -EIO;
++              return -EUCLEAN;
+       }
+       if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) {
+               BUG_ON(!extent_op || !extent_op->update_flags);
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
+index 1197dfdfebbf6..775245b148bb3 100644
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -4143,7 +4143,7 @@ static void get_block_group_info(struct list_head 
*groups_list,
+ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
+                                  void __user *arg)
+ {
+-      struct btrfs_ioctl_space_args space_args;
++      struct btrfs_ioctl_space_args space_args = { 0 };
+       struct btrfs_ioctl_space_info space;
+       struct btrfs_ioctl_space_info *dest;
+       struct btrfs_ioctl_space_info *dest_orig;
+@@ -5515,7 +5515,7 @@ static int _btrfs_ioctl_send(struct file *file, void 
__user *argp, bool compat)
+ 
+       if (compat) {
+ #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
+-              struct btrfs_ioctl_send_args_32 args32;
++              struct btrfs_ioctl_send_args_32 args32 = { 0 };
+ 
+               ret = copy_from_user(&args32, argp, sizeof(args32));
+               if (ret)
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
+index 926b1d34e55cc..f75333d7b78a5 100644
+--- a/fs/btrfs/tree-log.c
++++ b/fs/btrfs/tree-log.c
+@@ -4283,7 +4283,7 @@ static int btrfs_log_prealloc_extents(struct 
btrfs_trans_handle *trans,
+       struct extent_buffer *leaf;
+       int slot;
+       int ins_nr = 0;
+-      int start_slot;
++      int start_slot = 0;
+       int ret;
+ 
+       if (!(inode->flags & BTRFS_INODE_PREALLOC))
+diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
+index af85a72376040..a08ddd4e26d95 100644
+--- a/fs/ceph/inode.c
++++ b/fs/ceph/inode.c
+@@ -619,9 +619,7 @@ int ceph_fill_file_size(struct inode *inode, int issued,
+                       ci->i_truncate_seq = truncate_seq;
+ 
+                       /* the MDS should have revoked these caps */
+-                      WARN_ON_ONCE(issued & (CEPH_CAP_FILE_EXCL |
+-                                             CEPH_CAP_FILE_RD |
+-                                             CEPH_CAP_FILE_WR |
++                      WARN_ON_ONCE(issued & (CEPH_CAP_FILE_RD |
+                                              CEPH_CAP_FILE_LAZYIO));
+                       /*
+                        * If we hold relevant caps, or in the case where we're
+diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
+index 1bfd1660a66c0..9e5223108362d 100644
+--- a/fs/overlayfs/copy_up.c
++++ b/fs/overlayfs/copy_up.c
+@@ -192,7 +192,7 @@ static int ovl_set_timestamps(struct dentry *upperdentry, 
struct kstat *stat)
+ {
+       struct iattr attr = {
+               .ia_valid =
+-                   ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET,
++                   ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET 
| ATTR_CTIME,
+               .ia_atime = stat->atime,
+               .ia_mtime = stat->mtime,
+       };
+diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
+index 89990f9b31d50..3e56fe3196639 100644
+--- a/fs/quota/dquot.c
++++ b/fs/quota/dquot.c
+@@ -231,19 +231,18 @@ static void put_quota_format(struct quota_format_type 
*fmt)
+  * All dquots are placed to the end of inuse_list when first created, and this
+  * list is used for invalidate operation, which must look at every dquot.
+  *
+- * When the last reference of a dquot will be dropped, the dquot will be
+- * added to releasing_dquots. We'd then queue work item which would call
++ * When the last reference of a dquot is dropped, the dquot is added to
++ * releasing_dquots. We'll then queue work item which will call
+  * synchronize_srcu() and after that perform the final cleanup of all the
+- * dquots on the list. Both releasing_dquots and free_dquots use the
+- * dq_free list_head in the dquot struct. When a dquot is removed from
+- * releasing_dquots, a reference count is always subtracted, and if
+- * dq_count == 0 at that point, the dquot will be added to the free_dquots.
++ * dquots on the list. Each cleaned up dquot is moved to free_dquots list.
++ * Both releasing_dquots and free_dquots use the dq_free list_head in the 
dquot
++ * struct.
+  *
+- * Unused dquots (dq_count == 0) are added to the free_dquots list when freed,
+- * and this list is searched whenever we need an available dquot.  Dquots are
+- * removed from the list as soon as they are used again, and
+- * dqstats.free_dquots gives the number of dquots on the list. When
+- * dquot is invalidated it's completely released from memory.
++ * Unused and cleaned up dquots are in the free_dquots list and this list is
++ * searched whenever we need an available dquot. Dquots are removed from the
++ * list as soon as they are used again and dqstats.free_dquots gives the 
number
++ * of dquots on the list. When dquot is invalidated it's completely released
++ * from memory.
+  *
+  * Dirty dquots are added to the dqi_dirty_list of quota_info when mark
+  * dirtied, and this list is searched when writing dirty dquots back to
+@@ -321,6 +320,7 @@ static inline void put_dquot_last(struct dquot *dquot)
+ static inline void put_releasing_dquots(struct dquot *dquot)
+ {
+       list_add_tail(&dquot->dq_free, &releasing_dquots);
++      set_bit(DQ_RELEASING_B, &dquot->dq_flags);
+ }
+ 
+ static inline void remove_free_dquot(struct dquot *dquot)
+@@ -328,8 +328,10 @@ static inline void remove_free_dquot(struct dquot *dquot)
+       if (list_empty(&dquot->dq_free))
+               return;
+       list_del_init(&dquot->dq_free);
+-      if (!atomic_read(&dquot->dq_count))
++      if (!test_bit(DQ_RELEASING_B, &dquot->dq_flags))
+               dqstats_dec(DQST_FREE_DQUOTS);
++      else
++              clear_bit(DQ_RELEASING_B, &dquot->dq_flags);
+ }
+ 
+ static inline void put_inuse(struct dquot *dquot)
+@@ -572,12 +574,6 @@ restart:
+                       continue;
+               /* Wait for dquot users */
+               if (atomic_read(&dquot->dq_count)) {
+-                      /* dquot in releasing_dquots, flush and retry */
+-                      if (!list_empty(&dquot->dq_free)) {
+-                              spin_unlock(&dq_list_lock);
+-                              goto restart;
+-                      }
+-
+                       atomic_inc(&dquot->dq_count);
+                       spin_unlock(&dq_list_lock);
+                       /*
+@@ -596,6 +592,15 @@ restart:
+                        * restart. */
+                       goto restart;
+               }
++              /*
++               * The last user already dropped its reference but dquot didn't
++               * get fully cleaned up yet. Restart the scan which flushes the
++               * work cleaning up released dquots.
++               */
++              if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) {
++                      spin_unlock(&dq_list_lock);
++                      goto restart;
++              }
+               /*
+                * Quota now has no users and it has been written on last
+                * dqput()
+@@ -687,6 +692,13 @@ int dquot_writeback_dquots(struct super_block *sb, int 
type)
+                                                dq_dirty);
+ 
+                       WARN_ON(!dquot_active(dquot));
++                      /* If the dquot is releasing we should not touch it */
++                      if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) {
++                              spin_unlock(&dq_list_lock);
++                              flush_delayed_work(&quota_release_work);
++                              spin_lock(&dq_list_lock);
++                              continue;
++                      }
+ 
+                       /* Now we have active dquot from which someone is
+                        * holding reference so we can safely just increase
+@@ -800,18 +812,18 @@ static void quota_release_workfn(struct work_struct 
*work)
+       /* Exchange the list head to avoid livelock. */
+       list_replace_init(&releasing_dquots, &rls_head);
+       spin_unlock(&dq_list_lock);
++      synchronize_srcu(&dquot_srcu);
+ 
+ restart:
+-      synchronize_srcu(&dquot_srcu);
+       spin_lock(&dq_list_lock);
+       while (!list_empty(&rls_head)) {
+               dquot = list_first_entry(&rls_head, struct dquot, dq_free);
+-              /* Dquot got used again? */
+-              if (atomic_read(&dquot->dq_count) > 1) {
+-                      remove_free_dquot(dquot);
+-                      atomic_dec(&dquot->dq_count);
+-                      continue;
+-              }
++              WARN_ON_ONCE(atomic_read(&dquot->dq_count));
++              /*
++               * Note that DQ_RELEASING_B protects us from racing with
++               * invalidate_dquots() calls so we are safe to work with the
++               * dquot even after we drop dq_list_lock.
++               */
+               if (dquot_dirty(dquot)) {
+                       spin_unlock(&dq_list_lock);
+                       /* Commit dquot before releasing */
+@@ -825,7 +837,6 @@ restart:
+               }
+               /* Dquot is inactive and clean, now move it to free list */
+               remove_free_dquot(dquot);
+-              atomic_dec(&dquot->dq_count);
+               put_dquot_last(dquot);
+       }
+       spin_unlock(&dq_list_lock);
+@@ -866,6 +877,7 @@ void dqput(struct dquot *dquot)
+       BUG_ON(!list_empty(&dquot->dq_free));
+ #endif
+       put_releasing_dquots(dquot);
++      atomic_dec(&dquot->dq_count);
+       spin_unlock(&dq_list_lock);
+       queue_delayed_work(system_unbound_wq, &quota_release_work, 1);
+ }
+@@ -954,7 +966,7 @@ we_slept:
+               dqstats_inc(DQST_LOOKUPS);
+       }
+       /* Wait for dq_lock - after this we know that either dquot_release() is
+-       * already finished or it will be canceled due to dq_count > 1 test */
++       * already finished or it will be canceled due to dq_count > 0 test */
+       wait_on_dquot(dquot);
+       /* Read the dquot / allocate space in quota file */
+       if (!dquot_active(dquot)) {
+diff --git a/include/linux/ioport.h b/include/linux/ioport.h
+index fdc201d614607..d94db8d6df52a 100644
+--- a/include/linux/ioport.h
++++ b/include/linux/ioport.h
+@@ -300,6 +300,13 @@ struct resource *devm_request_free_mem_region(struct 
device *dev,
+ struct resource *request_free_mem_region(struct resource *base,
+               unsigned long size, const char *name);
+ 
++static inline void irqresource_disabled(struct resource *res, u32 irq)
++{
++      res->start = irq;
++      res->end = irq;
++      res->flags = IORESOURCE_IRQ | IORESOURCE_DISABLED | IORESOURCE_UNSET;
++}
++
+ #ifdef CONFIG_IO_STRICT_DEVMEM
+ void revoke_devmem(struct resource *res);
+ #else
+diff --git a/include/linux/mcb.h b/include/linux/mcb.h
+index 71dd10a3d9288..01fd26170e6bf 100644
+--- a/include/linux/mcb.h
++++ b/include/linux/mcb.h
+@@ -63,7 +63,6 @@ static inline struct mcb_bus *to_mcb_bus(struct device *dev)
+ struct mcb_device {
+       struct device dev;
+       struct mcb_bus *bus;
+-      bool is_added;
+       struct mcb_driver *driver;
+       u16 id;
+       int inst;
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
+index bf623f0e04d64..a3ade51bd9e25 100644
+--- a/include/linux/netdevice.h
++++ b/include/linux/netdevice.h
+@@ -3763,7 +3763,7 @@ static __always_inline int ____dev_forward_skb(struct 
net_device *dev,
+               return NET_RX_DROP;
+       }
+ 
+-      skb_scrub_packet(skb, true);
++      skb_scrub_packet(skb, !net_eq(dev_net(dev), dev_net(skb->dev)));
+       skb->priority = 0;
+       return 0;
+ }
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
+index c99e2f851d312..4c7409e23318b 100644
+--- a/include/linux/perf_event.h
++++ b/include/linux/perf_event.h
+@@ -607,6 +607,7 @@ struct perf_event {
+       /* The cumulative AND of all event_caps for events in this group. */
+       int                             group_caps;
+ 
++      unsigned int                    group_generation;
+       struct perf_event               *group_leader;
+       struct pmu                      *pmu;
+       void                            *pmu_private;
+diff --git a/include/linux/quota.h b/include/linux/quota.h
+index 27aab84fcbaac..b93cb93d19565 100644
+--- a/include/linux/quota.h
++++ b/include/linux/quota.h
+@@ -285,7 +285,9 @@ static inline void dqstats_dec(unsigned int type)
+ #define DQ_FAKE_B     3       /* no limits only usage */
+ #define DQ_READ_B     4       /* dquot was read into memory */
+ #define DQ_ACTIVE_B   5       /* dquot is active (dquot_release not called) */
+-#define DQ_LASTSET_B  6       /* Following 6 bits (see QIF_) are reserved\
++#define DQ_RELEASING_B        6       /* dquot is in releasing_dquots list 
waiting
++                               * to be cleaned up */
++#define DQ_LASTSET_B  7       /* Following 6 bits (see QIF_) are reserved\
+                                * for the mask of entries set via SETQUOTA\
+                                * quotactl. They are set under dq_data_lock\
+                                * and the quota format handling dquot can\
+diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
+index ec10897f7f60c..844b5836d11d6 100644
+--- a/include/linux/quotaops.h
++++ b/include/linux/quotaops.h
+@@ -59,7 +59,7 @@ static inline bool dquot_is_busy(struct dquot *dquot)
+ {
+       if (test_bit(DQ_MOD_B, &dquot->dq_flags))
+               return true;
+-      if (atomic_read(&dquot->dq_count) > 1)
++      if (atomic_read(&dquot->dq_count) > 0)
+               return true;
+       return false;
+ }
+diff --git a/include/net/bluetooth/hci_core.h 
b/include/net/bluetooth/hci_core.h
+index ecad25900ad78..b54f17677ac0c 100644
+--- a/include/net/bluetooth/hci_core.h
++++ b/include/net/bluetooth/hci_core.h
+@@ -219,7 +219,7 @@ struct hci_dev {
+       struct list_head list;
+       struct mutex    lock;
+ 
+-      char            name[8];
++      const char      *name;
+       unsigned long   flags;
+       __u16           id;
+       __u8            bus;
+diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h
+index 240786b04a464..e22c289503b5b 100644
+--- a/include/net/bluetooth/hci_mon.h
++++ b/include/net/bluetooth/hci_mon.h
+@@ -54,7 +54,7 @@ struct hci_mon_new_index {
+       __u8            type;
+       __u8            bus;
+       bdaddr_t        bdaddr;
+-      char            name[8];
++      char            name[8] __nonstring;
+ } __packed;
+ #define HCI_MON_NEW_INDEX_SIZE 16
+ 
+diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
+index b59d73d529ba7..0e1cef938ba44 100644
+--- a/include/net/netns/xfrm.h
++++ b/include/net/netns/xfrm.h
+@@ -49,6 +49,7 @@ struct netns_xfrm {
+       struct list_head        policy_all;
+       struct hlist_head       *policy_byidx;
+       unsigned int            policy_idx_hmask;
++      unsigned int            idx_generator;
+       struct hlist_head       policy_inexact[XFRM_POLICY_MAX];
+       struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
+       unsigned int            policy_count[XFRM_POLICY_MAX * 2];
+diff --git a/include/net/tcp.h b/include/net/tcp.h
+index 2a17c0b423946..4fcae463ba194 100644
+--- a/include/net/tcp.h
++++ b/include/net/tcp.h
+@@ -138,6 +138,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
+ #define TCP_RTO_MAX   ((unsigned)(120*HZ))
+ #define TCP_RTO_MIN   ((unsigned)(HZ/5))
+ #define TCP_TIMEOUT_MIN       (2U) /* Min timeout for TCP timers in jiffies */
++
++#define TCP_TIMEOUT_MIN_US (2*USEC_PER_MSEC) /* Min TCP timeout in microsecs 
*/
++
+ #define TCP_TIMEOUT_INIT ((unsigned)(1*HZ))   /* RFC6298 2.1 initial RTO 
value        */
+ #define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ))       /* RFC 1122 initial RTO 
value, now
+                                                * used as a fallback RTO for 
the
+diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
+index 62bb17516713f..5ade62ac49b47 100644
+--- a/include/trace/events/neigh.h
++++ b/include/trace/events/neigh.h
+@@ -39,7 +39,6 @@ TRACE_EVENT(neigh_create,
+       ),
+ 
+       TP_fast_assign(
+-              struct in6_addr *pin6;
+               __be32 *p32;
+ 
+               __entry->family = tbl->family;
+@@ -47,7 +46,6 @@ TRACE_EVENT(neigh_create,
+               __entry->entries = atomic_read(&tbl->gc_entries);
+               __entry->created = n != NULL;
+               __entry->gc_exempt = exempt_from_gc;
+-              pin6 = (struct in6_addr *)__entry->primary_key6;
+               p32 = (__be32 *)__entry->primary_key4;
+ 
+               if (tbl->family == AF_INET)
+@@ -57,6 +55,8 @@ TRACE_EVENT(neigh_create,
+ 
+ #if IS_ENABLED(CONFIG_IPV6)
+               if (tbl->family == AF_INET6) {
++                      struct in6_addr *pin6;
++
+                       pin6 = (struct in6_addr *)__entry->primary_key6;
+                       *pin6 = *(struct in6_addr *)pkey;
+               }
+diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
+index 759a931f278b8..6fcabeacb7d87 100644
+--- a/kernel/cgroup/cgroup-v1.c
++++ b/kernel/cgroup/cgroup-v1.c
+@@ -367,10 +367,9 @@ static int pidlist_array_load(struct cgroup *cgrp, enum 
cgroup_filetype type,
+       }
+       css_task_iter_end(&it);
+       length = n;
+-      /* now sort & (if procs) strip out duplicates */
++      /* now sort & strip out duplicates (tgids or recycled thread PIDs) */
+       sort(array, length, sizeof(pid_t), cmppid, NULL);
+-      if (type == CGROUP_FILE_PROCS)
+-              length = pidlist_uniq(array, length);
++      length = pidlist_uniq(array, length);
+ 
+       l = cgroup_pidlist_find_create(cgrp, type);
+       if (!l) {
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index 875b3c27eab02..884cb4aaf342e 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -1849,6 +1849,7 @@ static void perf_group_attach(struct perf_event *event)
+ 
+       list_add_tail(&event->sibling_list, &group_leader->sibling_list);
+       group_leader->nr_siblings++;
++      group_leader->group_generation++;
+ 
+       perf_event__header_size(group_leader);
+ 
+@@ -2004,6 +2005,7 @@ static void perf_group_detach(struct perf_event *event)
+       if (event->group_leader != event) {
+               list_del_init(&event->sibling_list);
+               event->group_leader->nr_siblings--;
++              event->group_leader->group_generation++;
+               goto out;
+       }
+ 
+@@ -4854,7 +4856,7 @@ static int __perf_read_group_add(struct perf_event 
*leader,
+                                       u64 read_format, u64 *values)
+ {
+       struct perf_event_context *ctx = leader->ctx;
+-      struct perf_event *sub;
++      struct perf_event *sub, *parent;
+       unsigned long flags;
+       int n = 1; /* skip @nr */
+       int ret;
+@@ -4864,6 +4866,33 @@ static int __perf_read_group_add(struct perf_event 
*leader,
+               return ret;
+ 
+       raw_spin_lock_irqsave(&ctx->lock, flags);
++      /*
++       * Verify the grouping between the parent and child (inherited)
++       * events is still in tact.
++       *
++       * Specifically:
++       *  - leader->ctx->lock pins leader->sibling_list
++       *  - parent->child_mutex pins parent->child_list
++       *  - parent->ctx->mutex pins parent->sibling_list
++       *
++       * Because parent->ctx != leader->ctx (and child_list nests inside
++       * ctx->mutex), group destruction is not atomic between children, also
++       * see perf_event_release_kernel(). Additionally, parent can grow the
++       * group.
++       *
++       * Therefore it is possible to have parent and child groups in a
++       * different configuration and summing over such a beast makes no sense
++       * what so ever.
++       *
++       * Reject this.
++       */
++      parent = leader->parent;
++      if (parent &&
++          (parent->group_generation != leader->group_generation ||
++           parent->nr_siblings != leader->nr_siblings)) {
++              ret = -ECHILD;
++              goto unlock;
++      }
+ 
+       /*
+        * Since we co-schedule groups, {enabled,running} times of siblings
+@@ -4893,8 +4922,9 @@ static int __perf_read_group_add(struct perf_event 
*leader,
+                       values[n++] = primary_event_id(sub);
+       }
+ 
++unlock:
+       raw_spin_unlock_irqrestore(&ctx->lock, flags);
+-      return 0;
++      return ret;
+ }
+ 
+ static int perf_read_group(struct perf_event *event,
+@@ -4913,10 +4943,6 @@ static int perf_read_group(struct perf_event *event,
+ 
+       values[0] = 1 + leader->nr_siblings;
+ 
+-      /*
+-       * By locking the child_mutex of the leader we effectively
+-       * lock the child list of all siblings.. XXX explain how.
+-       */
+       mutex_lock(&leader->child_mutex);
+ 
+       ret = __perf_read_group_add(leader, read_format, values);
+@@ -11989,6 +12015,7 @@ static int inherit_group(struct perf_event 
*parent_event,
+                   !perf_get_aux_event(child_ctr, leader))
+                       return -EINVAL;
+       }
++      leader->group_generation = parent_event->group_generation;
+       return 0;
+ }
+ 
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
+index 51adf0817ef3a..4f42dd0880796 100644
+--- a/kernel/trace/trace_events.c
++++ b/kernel/trace/trace_events.c
+@@ -2236,6 +2236,7 @@ void trace_event_eval_update(struct trace_eval_map 
**map, int len)
+                               update_event_printk(call, map[i]);
+                       }
+               }
++              cond_resched();
+       }
+       up_write(&trace_event_sem);
+ }
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c
+index 856188b0681af..a2c4de2a11327 100644
+--- a/kernel/workqueue.c
++++ b/kernel/workqueue.c
+@@ -5273,9 +5273,13 @@ static int workqueue_apply_unbound_cpumask(void)
+       list_for_each_entry(wq, &workqueues, list) {
+               if (!(wq->flags & WQ_UNBOUND))
+                       continue;
++
+               /* creating multiple pwqs breaks ordering guarantee */
+-              if (wq->flags & __WQ_ORDERED)
+-                      continue;
++              if (!list_empty(&wq->pwqs)) {
++                      if (wq->flags & __WQ_ORDERED_EXPLICIT)
++                              continue;
++                      wq->flags &= ~__WQ_ORDERED;
++              }
+ 
+               ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs);
+               if (!ctx) {
+diff --git a/lib/test_meminit.c b/lib/test_meminit.c
+index 2c6c96b40e3d3..470f8260d4e09 100644
+--- a/lib/test_meminit.c
++++ b/lib/test_meminit.c
+@@ -86,7 +86,7 @@ static int __init test_pages(int *total_failures)
+       int failures = 0, num_tests = 0;
+       int i;
+ 
+-      for (i = 0; i <= MAX_ORDER; i++)
++      for (i = 0; i < MAX_ORDER; i++)
+               num_tests += do_alloc_pages_order(i, &failures);
+ 
+       REPORT_FAILURES_IN_FN();
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
+index ee57fa20bac3e..afdc0afa8ee7d 100644
+--- a/net/bluetooth/hci_conn.c
++++ b/net/bluetooth/hci_conn.c
+@@ -1207,6 +1207,15 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, 
bdaddr_t *dst,
+               return ERR_PTR(-EOPNOTSUPP);
+       }
+ 
++      /* Reject outgoing connection to device with same BD ADDR against
++       * CVE-2020-26555
++       */
++      if (!bacmp(&hdev->bdaddr, dst)) {
++              bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n",
++                         dst);
++              return ERR_PTR(-ECONNREFUSED);
++      }
++
+       acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
+       if (!acl) {
+               acl = hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER);
+@@ -1382,34 +1391,41 @@ int hci_conn_security(struct hci_conn *conn, __u8 
sec_level, __u8 auth_type,
+       if (!test_bit(HCI_CONN_AUTH, &conn->flags))
+               goto auth;
+ 
+-      /* An authenticated FIPS approved combination key has sufficient
+-       * security for security level 4. */
+-      if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256 &&
+-          sec_level == BT_SECURITY_FIPS)
+-              goto encrypt;
+-
+-      /* An authenticated combination key has sufficient security for
+-         security level 3. */
+-      if ((conn->key_type == HCI_LK_AUTH_COMBINATION_P192 ||
+-           conn->key_type == HCI_LK_AUTH_COMBINATION_P256) &&
+-          sec_level == BT_SECURITY_HIGH)
+-              goto encrypt;
+-
+-      /* An unauthenticated combination key has sufficient security for
+-         security level 1 and 2. */
+-      if ((conn->key_type == HCI_LK_UNAUTH_COMBINATION_P192 ||
+-           conn->key_type == HCI_LK_UNAUTH_COMBINATION_P256) &&
+-          (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW))
+-              goto encrypt;
+-
+-      /* A combination key has always sufficient security for the security
+-         levels 1 or 2. High security level requires the combination key
+-         is generated using maximum PIN code length (16).
+-         For pre 2.1 units. */
+-      if (conn->key_type == HCI_LK_COMBINATION &&
+-          (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW ||
+-           conn->pin_length == 16))
+-              goto encrypt;
++      switch (conn->key_type) {
++      case HCI_LK_AUTH_COMBINATION_P256:
++              /* An authenticated FIPS approved combination key has
++               * sufficient security for security level 4 or lower.
++               */
++              if (sec_level <= BT_SECURITY_FIPS)
++                      goto encrypt;
++              break;
++      case HCI_LK_AUTH_COMBINATION_P192:
++              /* An authenticated combination key has sufficient security for
++               * security level 3 or lower.
++               */
++              if (sec_level <= BT_SECURITY_HIGH)
++                      goto encrypt;
++              break;
++      case HCI_LK_UNAUTH_COMBINATION_P192:
++      case HCI_LK_UNAUTH_COMBINATION_P256:
++              /* An unauthenticated combination key has sufficient security
++               * for security level 2 or lower.
++               */
++              if (sec_level <= BT_SECURITY_MEDIUM)
++                      goto encrypt;
++              break;
++      case HCI_LK_COMBINATION:
++              /* A combination key has always sufficient security for the
++               * security levels 2 or lower. High security level requires the
++               * combination key is generated using maximum PIN code length
++               * (16). For pre 2.1 units.
++               */
++              if (sec_level <= BT_SECURITY_MEDIUM || conn->pin_length == 16)
++                      goto encrypt;
++              break;
++      default:
++              break;
++      }
+ 
+ auth:
+       if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index 21469934fc3c0..54c55c30db17b 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -3317,7 +3317,11 @@ int hci_register_dev(struct hci_dev *hdev)
+       if (id < 0)
+               return id;
+ 
+-      snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
++      error = dev_set_name(&hdev->dev, "hci%u", id);
++      if (error)
++              return error;
++
++      hdev->name = dev_name(&hdev->dev);
+       hdev->id = id;
+ 
+       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
+@@ -3339,8 +3343,6 @@ int hci_register_dev(struct hci_dev *hdev)
+       if (!IS_ERR_OR_NULL(bt_debugfs))
+               hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
+ 
+-      dev_set_name(&hdev->dev, "%s", hdev->name);
+-
+       error = device_add(&hdev->dev);
+       if (error < 0)
+               goto err_wqueue;
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
+index 84b430986b1de..f182a7d3e44cf 100644
+--- a/net/bluetooth/hci_event.c
++++ b/net/bluetooth/hci_event.c
+@@ -25,6 +25,8 @@
+ /* Bluetooth HCI event handling. */
+ 
+ #include <asm/unaligned.h>
++#include <linux/crypto.h>
++#include <crypto/algapi.h>
+ 
+ #include <net/bluetooth/bluetooth.h>
+ #include <net/bluetooth/hci_core.h>
+@@ -2594,6 +2596,16 @@ static void hci_conn_request_evt(struct hci_dev *hdev, 
struct sk_buff *skb)
+       BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr,
+              ev->link_type);
+ 
++      /* Reject incoming connection from device with same BD ADDR against
++       * CVE-2020-26555
++       */
++      if (hdev && !bacmp(&hdev->bdaddr, &ev->bdaddr)) {
++              bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n",
++                         &ev->bdaddr);
++              hci_reject_conn(hdev, &ev->bdaddr);
++              return;
++      }
++
+       mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type,
+                                     &flags);
+ 
+@@ -3935,6 +3947,15 @@ static void hci_link_key_notify_evt(struct hci_dev 
*hdev, struct sk_buff *skb)
+       if (!conn)
+               goto unlock;
+ 
++      /* Ignore NULL link key against CVE-2020-26555 */
++      if (!crypto_memneq(ev->link_key, ZERO_KEY, HCI_LINK_KEY_SIZE)) {
++              bt_dev_dbg(hdev, "Ignore NULL link key (ZERO KEY) for %pMR",
++                         &ev->bdaddr);
++              hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE);
++              hci_conn_drop(conn);
++              goto unlock;
++      }
++
+       hci_conn_hold(conn);
+       conn->disc_timeout = HCI_DISCONN_TIMEOUT;
+       hci_conn_drop(conn);
+@@ -4426,8 +4447,8 @@ static u8 bredr_oob_data_present(struct hci_conn *conn)
+                * available, then do not declare that OOB data is
+                * present.
+                */
+-              if (!memcmp(data->rand256, ZERO_KEY, 16) ||
+-                  !memcmp(data->hash256, ZERO_KEY, 16))
++              if (!crypto_memneq(data->rand256, ZERO_KEY, 16) ||
++                  !crypto_memneq(data->hash256, ZERO_KEY, 16))
+                       return 0x00;
+ 
+               return 0x02;
+@@ -4437,8 +4458,8 @@ static u8 bredr_oob_data_present(struct hci_conn *conn)
+        * not supported by the hardware, then check that if
+        * P-192 data values are present.
+        */
+-      if (!memcmp(data->rand192, ZERO_KEY, 16) ||
+-          !memcmp(data->hash192, ZERO_KEY, 16))
++      if (!crypto_memneq(data->rand192, ZERO_KEY, 16) ||
++          !crypto_memneq(data->hash192, ZERO_KEY, 16))
+               return 0x00;
+ 
+       return 0x01;
+@@ -4454,7 +4475,7 @@ static void hci_io_capa_request_evt(struct hci_dev 
*hdev, struct sk_buff *skb)
+       hci_dev_lock(hdev);
+ 
+       conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
+-      if (!conn)
++      if (!conn || !hci_conn_ssp_enabled(conn))
+               goto unlock;
+ 
+       hci_conn_hold(conn);
+@@ -4689,7 +4710,7 @@ static void hci_simple_pair_complete_evt(struct hci_dev 
*hdev,
+       hci_dev_lock(hdev);
+ 
+       conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
+-      if (!conn)
++      if (!conn || !hci_conn_ssp_enabled(conn))
+               goto unlock;
+ 
+       /* Reset the authentication requirement to unknown */
+diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
+index 45f6ce1f380e0..1d08f7b78fa04 100644
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -430,7 +430,8 @@ static struct sk_buff *create_monitor_event(struct hci_dev 
*hdev, int event)
+               ni->type = hdev->dev_type;
+               ni->bus = hdev->bus;
+               bacpy(&ni->bdaddr, &hdev->bdaddr);
+-              memcpy(ni->name, hdev->name, 8);
++              memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name,
++                             strnlen(hdev->name, sizeof(ni->name)), '\0');
+ 
+               opcode = cpu_to_le16(HCI_MON_NEW_INDEX);
+               break;
+diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
+index 49726c378aab3..db6320076e237 100644
+--- a/net/ceph/messenger.c
++++ b/net/ceph/messenger.c
+@@ -477,8 +477,8 @@ static int ceph_tcp_connect(struct ceph_connection *con)
+       dout("connect %s\n", ceph_pr_addr(&con->peer_addr));
+ 
+       con_sock_state_connecting(con);
+-      ret = sock->ops->connect(sock, (struct sockaddr *)&ss, sizeof(ss),
+-                               O_NONBLOCK);
++      ret = kernel_connect(sock, (struct sockaddr *)&ss, sizeof(ss),
++                           O_NONBLOCK);
+       if (ret == -EINPROGRESS) {
+               dout("connect %s EINPROGRESS sk_state = %u\n",
+                    ceph_pr_addr(&con->peer_addr),
+diff --git a/net/core/pktgen.c b/net/core/pktgen.c
+index 1d20dd70879bb..5e9bd9d80b393 100644
+--- a/net/core/pktgen.c
++++ b/net/core/pktgen.c
+@@ -645,19 +645,19 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
+       seq_puts(seq, "     Flags: ");
+ 
+       for (i = 0; i < NR_PKT_FLAGS; i++) {
+-              if (i == F_FLOW_SEQ)
++              if (i == FLOW_SEQ_SHIFT)
+                       if (!pkt_dev->cflows)
+                               continue;
+ 
+-              if (pkt_dev->flags & (1 << i))
++              if (pkt_dev->flags & (1 << i)) {
+                       seq_printf(seq, "%s  ", pkt_flag_names[i]);
+-              else if (i == F_FLOW_SEQ)
+-                      seq_puts(seq, "FLOW_RND  ");
+-
+ #ifdef CONFIG_XFRM
+-              if (i == F_IPSEC && pkt_dev->spi)
+-                      seq_printf(seq, "spi:%u", pkt_dev->spi);
++                      if (i == IPSEC_SHIFT && pkt_dev->spi)
++                              seq_printf(seq, "spi:%u  ", pkt_dev->spi);
+ #endif
++              } else if (i == FLOW_SEQ_SHIFT) {
++                      seq_puts(seq, "FLOW_RND  ");
++              }
+       }
+ 
+       seq_puts(seq, "\n");
+diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
+index f555dd4bac653..9a8f0e36bbf91 100644
+--- a/net/ipv4/esp4.c
++++ b/net/ipv4/esp4.c
+@@ -567,7 +567,9 @@ static inline int esp_remove_trailer(struct sk_buff *skb)
+               skb->csum = csum_block_sub(skb->csum, csumdiff,
+                                          skb->len - trimlen);
+       }
+-      pskb_trim(skb, skb->len - trimlen);
++      ret = pskb_trim(skb, skb->len - trimlen);
++      if (unlikely(ret))
++              return ret;
+ 
+       ret = nexthdr[1];
+ 
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
+index 51cfb650060ba..2890dbe08d17a 100644
+--- a/net/ipv4/fib_semantics.c
++++ b/net/ipv4/fib_semantics.c
+@@ -1333,15 +1333,18 @@ __be32 fib_info_update_nhc_saddr(struct net *net, 
struct fib_nh_common *nhc,
+                                unsigned char scope)
+ {
+       struct fib_nh *nh;
++      __be32 saddr;
+ 
+       if (nhc->nhc_family != AF_INET)
+               return inet_select_addr(nhc->nhc_dev, 0, scope);
+ 
+       nh = container_of(nhc, struct fib_nh, nh_common);
+-      nh->nh_saddr = inet_select_addr(nh->fib_nh_dev, nh->fib_nh_gw4, scope);
+-      nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid);
++      saddr = inet_select_addr(nh->fib_nh_dev, nh->fib_nh_gw4, scope);
+ 
+-      return nh->nh_saddr;
++      WRITE_ONCE(nh->nh_saddr, saddr);
++      WRITE_ONCE(nh->nh_saddr_genid, atomic_read(&net->ipv4.dev_addr_genid));
++
++      return saddr;
+ }
+ 
+ __be32 fib_result_prefsrc(struct net *net, struct fib_result *res)
+@@ -1355,8 +1358,9 @@ __be32 fib_result_prefsrc(struct net *net, struct 
fib_result *res)
+               struct fib_nh *nh;
+ 
+               nh = container_of(nhc, struct fib_nh, nh_common);
+-              if (nh->nh_saddr_genid == 
atomic_read(&net->ipv4.dev_addr_genid))
+-                      return nh->nh_saddr;
++              if (READ_ONCE(nh->nh_saddr_genid) ==
++                  atomic_read(&net->ipv4.dev_addr_genid))
++                      return READ_ONCE(nh->nh_saddr);
+       }
+ 
+       return fib_info_update_nhc_saddr(net, nhc, res->fi->fib_scope);
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
+index 4c90a61148da4..16e0249b11f6c 100644
+--- a/net/ipv4/tcp_output.c
++++ b/net/ipv4/tcp_output.c
+@@ -2259,6 +2259,18 @@ static bool tcp_pacing_check(struct sock *sk)
+       return true;
+ }
+ 
++static bool tcp_rtx_queue_empty_or_single_skb(const struct sock *sk)
++{
++      const struct rb_node *node = sk->tcp_rtx_queue.rb_node;
++
++      /* No skb in the rtx queue. */
++      if (!node)
++              return true;
++
++      /* Only one skb in rtx queue. */
++      return !node->rb_left && !node->rb_right;
++}
++
+ /* TCP Small Queues :
+  * Control number of packets in qdisc/devices to two packets / or ~1 ms.
+  * (These limits are doubled for retransmits)
+@@ -2296,12 +2308,12 @@ static bool tcp_small_queue_check(struct sock *sk, 
const struct sk_buff *skb,
+               limit += extra_bytes;
+       }
+       if (refcount_read(&sk->sk_wmem_alloc) > limit) {
+-              /* Always send skb if rtx queue is empty.
++              /* Always send skb if rtx queue is empty or has one skb.
+                * No need to wait for TX completion to call us back,
+                * after softirq/tasklet schedule.
+                * This helps when TX completions are delayed too much.
+                */
+-              if (tcp_rtx_queue_empty(sk))
++              if (tcp_rtx_queue_empty_or_single_skb(sk))
+                       return false;
+ 
+               set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags);
+@@ -2504,7 +2516,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool 
advancing_rto)
+ {
+       struct inet_connection_sock *icsk = inet_csk(sk);
+       struct tcp_sock *tp = tcp_sk(sk);
+-      u32 timeout, rto_delta_us;
++      u32 timeout, timeout_us, rto_delta_us;
+       int early_retrans;
+ 
+       /* Don't do any loss probe on a Fast Open connection before 3WHS
+@@ -2528,11 +2540,12 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool 
advancing_rto)
+        * sample is available then probe after TCP_TIMEOUT_INIT.
+        */
+       if (tp->srtt_us) {
+-              timeout = usecs_to_jiffies(tp->srtt_us >> 2);
++              timeout_us = tp->srtt_us >> 2;
+               if (tp->packets_out == 1)
+-                      timeout += TCP_RTO_MIN;
++                      timeout_us += tcp_rto_min_us(sk);
+               else
+-                      timeout += TCP_TIMEOUT_MIN;
++                      timeout_us += TCP_TIMEOUT_MIN_US;
++              timeout = usecs_to_jiffies(timeout_us);
+       } else {
+               timeout = TCP_TIMEOUT_INIT;
+       }
+diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
+index 22ec8dcc1428a..db3469c95c49d 100644
+--- a/net/ipv4/tcp_recovery.c
++++ b/net/ipv4/tcp_recovery.c
+@@ -123,7 +123,7 @@ bool tcp_rack_mark_lost(struct sock *sk)
+       tp->rack.advanced = 0;
+       tcp_rack_detect_loss(sk, &timeout);
+       if (timeout) {
+-              timeout = usecs_to_jiffies(timeout) + TCP_TIMEOUT_MIN;
++              timeout = usecs_to_jiffies(timeout + TCP_TIMEOUT_MIN_US);
+               inet_csk_reset_xmit_timer(sk, ICSK_TIME_REO_TIMEOUT,
+                                         timeout, inet_csk(sk)->icsk_rto);
+       }
+diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
+index b64791d3b0f81..a1cdb43e72167 100644
+--- a/net/ipv6/esp6.c
++++ b/net/ipv6/esp6.c
+@@ -506,7 +506,9 @@ static inline int esp_remove_trailer(struct sk_buff *skb)
+               skb->csum = csum_block_sub(skb->csum, csumdiff,
+                                          skb->len - trimlen);
+       }
+-      pskb_trim(skb, skb->len - trimlen);
++      ret = pskb_trim(skb, skb->len - trimlen);
++      if (unlikely(ret))
++              return ret;
+ 
+       ret = nexthdr[1];
+ 
+diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
+index 247296e3294bd..4c3aa97f23faa 100644
+--- a/net/ipv6/xfrm6_policy.c
++++ b/net/ipv6/xfrm6_policy.c
+@@ -120,11 +120,11 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
+ {
+       struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
+ 
+-      if (likely(xdst->u.rt6.rt6i_idev))
+-              in6_dev_put(xdst->u.rt6.rt6i_idev);
+       dst_destroy_metrics_generic(dst);
+       if (xdst->u.rt6.rt6i_uncached_list)
+               rt6_uncached_list_del(&xdst->u.rt6);
++      if (likely(xdst->u.rt6.rt6i_idev))
++              in6_dev_put(xdst->u.rt6.rt6i_idev);
+       xfrm_dst_destroy(xdst);
+ }
+ 
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index d82d22b6a2a94..8bd01dfa75cb1 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -651,7 +651,8 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
+               }
+ 
+               if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED &&
+-                           !ieee80211_is_deauth(hdr->frame_control)))
++                           !ieee80211_is_deauth(hdr->frame_control)) &&
++                           tx->skb->protocol != 
tx->sdata->control_port_protocol)
+                       return TX_DROP;
+ 
+               if (!skip_hw && tx->key &&
+diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
+index b0054bdf92a2a..fb1dc205e3b57 100644
+--- a/net/netfilter/ipvs/ip_vs_sync.c
++++ b/net/netfilter/ipvs/ip_vs_sync.c
+@@ -1444,7 +1444,7 @@ static int bind_mcastif_addr(struct socket *sock, struct 
net_device *dev)
+       sin.sin_addr.s_addr  = addr;
+       sin.sin_port         = 0;
+ 
+-      return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
++      return kernel_bind(sock, (struct sockaddr *)&sin, sizeof(sin));
+ }
+ 
+ static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
+@@ -1551,7 +1551,7 @@ static int make_receive_sock(struct netns_ipvs *ipvs, 
int id,
+ 
+       get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id);
+       sock->sk->sk_bound_dev_if = dev->ifindex;
+-      result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen);
++      result = kernel_bind(sock, (struct sockaddr *)&mcast_addr, salen);
+       if (result < 0) {
+               pr_err("Error binding to the multicast addr\n");
+               goto error;
+diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
+index 54298fcd82f0e..a4f9a150812a3 100644
+--- a/net/netfilter/nft_payload.c
++++ b/net/netfilter/nft_payload.c
+@@ -84,7 +84,7 @@ void nft_payload_eval(const struct nft_expr *expr,
+ 
+       switch (priv->base) {
+       case NFT_PAYLOAD_LL_HEADER:
+-              if (!skb_mac_header_was_set(skb))
++              if (!skb_mac_header_was_set(skb) || skb_mac_header_len(skb) == 
0)
+                       goto err;
+ 
+               if (skb_vlan_tag_present(skb)) {
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
+index 093eea02f9d28..2c58e9ae0b0e4 100644
+--- a/net/netfilter/nft_set_rbtree.c
++++ b/net/netfilter/nft_set_rbtree.c
+@@ -338,6 +338,8 @@ static void *nft_rbtree_deactivate(const struct net *net,
+                                  nft_rbtree_interval_end(this)) {
+                               parent = parent->rb_right;
+                               continue;
++                      } else if (nft_set_elem_expired(&rbe->ext)) {
++                              break;
+                       } else if (!nft_set_elem_active(&rbe->ext, genmask)) {
+                               parent = parent->rb_left;
+                               continue;
+diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
+index b1107570eaee8..92f70686bee0a 100644
+--- a/net/nfc/llcp_core.c
++++ b/net/nfc/llcp_core.c
+@@ -205,17 +205,13 @@ static struct nfc_llcp_sock *nfc_llcp_sock_get(struct 
nfc_llcp_local *local,
+ 
+               if (tmp_sock->ssap == ssap && tmp_sock->dsap == dsap) {
+                       llcp_sock = tmp_sock;
++                      sock_hold(&llcp_sock->sk);
+                       break;
+               }
+       }
+ 
+       read_unlock(&local->sockets.lock);
+ 
+-      if (llcp_sock == NULL)
+-              return NULL;
+-
+-      sock_hold(&llcp_sock->sk);
+-
+       return llcp_sock;
+ }
+ 
+@@ -348,7 +344,8 @@ static int nfc_llcp_wks_sap(const char *service_name, 
size_t service_name_len)
+ 
+ static
+ struct nfc_llcp_sock *nfc_llcp_sock_from_sn(struct nfc_llcp_local *local,
+-                                          const u8 *sn, size_t sn_len)
++                                          const u8 *sn, size_t sn_len,
++                                          bool needref)
+ {
+       struct sock *sk;
+       struct nfc_llcp_sock *llcp_sock, *tmp_sock;
+@@ -384,6 +381,8 @@ struct nfc_llcp_sock *nfc_llcp_sock_from_sn(struct 
nfc_llcp_local *local,
+ 
+               if (memcmp(sn, tmp_sock->service_name, sn_len) == 0) {
+                       llcp_sock = tmp_sock;
++                      if (needref)
++                              sock_hold(&llcp_sock->sk);
+                       break;
+               }
+       }
+@@ -425,7 +424,8 @@ u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
+                * to this service name.
+                */
+               if (nfc_llcp_sock_from_sn(local, sock->service_name,
+-                                        sock->service_name_len) != NULL) {
++                                        sock->service_name_len,
++                                        false) != NULL) {
+                       mutex_unlock(&local->sdp_lock);
+ 
+                       return LLCP_SAP_MAX;
+@@ -833,16 +833,7 @@ out:
+ static struct nfc_llcp_sock *nfc_llcp_sock_get_sn(struct nfc_llcp_local 
*local,
+                                                 const u8 *sn, size_t sn_len)
+ {
+-      struct nfc_llcp_sock *llcp_sock;
+-
+-      llcp_sock = nfc_llcp_sock_from_sn(local, sn, sn_len);
+-
+-      if (llcp_sock == NULL)
+-              return NULL;
+-
+-      sock_hold(&llcp_sock->sk);
+-
+-      return llcp_sock;
++      return nfc_llcp_sock_from_sn(local, sn, sn_len, true);
+ }
+ 
+ static const u8 *nfc_llcp_connect_sn(const struct sk_buff *skb, size_t 
*sn_len)
+@@ -1307,7 +1298,8 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local 
*local,
+                       }
+ 
+                       llcp_sock = nfc_llcp_sock_from_sn(local, service_name,
+-                                                        service_name_len);
++                                                        service_name_len,
++                                                        true);
+                       if (!llcp_sock) {
+                               sap = 0;
+                               goto add_snl;
+@@ -1327,6 +1319,7 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local 
*local,
+ 
+                               if (sap == LLCP_SAP_MAX) {
+                                       sap = 0;
++                                      nfc_llcp_sock_put(llcp_sock);
+                                       goto add_snl;
+                               }
+ 
+@@ -1344,6 +1337,7 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local 
*local,
+ 
+                       pr_debug("%p %d\n", llcp_sock, sap);
+ 
++                      nfc_llcp_sock_put(llcp_sock);
+ add_snl:
+                       sdp = nfc_llcp_build_sdres_tlv(tid, sap);
+                       if (sdp == NULL)
+diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
+index 57849baf9294d..54b9efb5ae821 100644
+--- a/net/nfc/nci/core.c
++++ b/net/nfc/nci/core.c
+@@ -894,6 +894,11 @@ static int nci_activate_target(struct nfc_dev *nfc_dev,
+               return -EINVAL;
+       }
+ 
++      if (protocol >= NFC_PROTO_MAX) {
++              pr_err("the requested nfc protocol is invalid\n");
++              return -EINVAL;
++      }
++
+       if (!(nci_target->supported_protocols & (1 << protocol))) {
+               pr_err("target does not support the requested protocol 0x%x\n",
+                      protocol);
+diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c
+index 9dd8a10969166..96f071792a045 100644
+--- a/net/nfc/nci/spi.c
++++ b/net/nfc/nci/spi.c
+@@ -150,6 +150,8 @@ static int send_acknowledge(struct nci_spi *nspi, u8 
acknowledge)
+       int ret;
+ 
+       skb = nci_skb_alloc(nspi->ndev, 0, GFP_KERNEL);
++      if (!skb)
++              return -ENOMEM;
+ 
+       /* add the NCI SPI header to the start of the buffer */
+       hdr = skb_push(skb, NCI_SPI_HDR_LEN);
+diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c
+index 23d6d26127088..63efe60fda1fe 100644
+--- a/net/rds/tcp_connect.c
++++ b/net/rds/tcp_connect.c
+@@ -141,7 +141,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
+               addrlen = sizeof(sin);
+       }
+ 
+-      ret = sock->ops->bind(sock, addr, addrlen);
++      ret = kernel_bind(sock, addr, addrlen);
+       if (ret) {
+               rdsdebug("bind failed with %d at address %pI6c\n",
+                        ret, &conn->c_laddr);
+diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
+index 26a3e18e460d9..dfeceed3b5336 100644
+--- a/net/rds/tcp_listen.c
++++ b/net/rds/tcp_listen.c
+@@ -332,7 +332,7 @@ struct socket *rds_tcp_listen_init(struct net *net, bool 
isv6)
+               addr_len = sizeof(*sin);
+       }
+ 
+-      ret = sock->ops->bind(sock, (struct sockaddr *)&ss, addr_len);
++      ret = kernel_bind(sock, (struct sockaddr *)&ss, addr_len);
+       if (ret < 0) {
+               rdsdebug("could not bind %s listener socket: %d\n",
+                        isv6 ? "IPv6" : "IPv4", ret);
+diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
+index f5afc9bcdee65..2cc95c8dc4c7b 100644
+--- a/net/rfkill/rfkill-gpio.c
++++ b/net/rfkill/rfkill-gpio.c
+@@ -98,13 +98,13 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
+ 
+       rfkill->clk = devm_clk_get(&pdev->dev, NULL);
+ 
+-      gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
++      gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_ASIS);
+       if (IS_ERR(gpio))
+               return PTR_ERR(gpio);
+ 
+       rfkill->reset_gpio = gpio;
+ 
+-      gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW);
++      gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_ASIS);
+       if (IS_ERR(gpio))
+               return PTR_ERR(gpio);
+ 
+diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
+index 2af4adb7e84e4..9ebae0d07a9c6 100644
+--- a/net/sched/sch_hfsc.c
++++ b/net/sched/sch_hfsc.c
+@@ -903,6 +903,14 @@ hfsc_change_usc(struct hfsc_class *cl, struct 
tc_service_curve *usc,
+       cl->cl_flags |= HFSC_USC;
+ }
+ 
++static void
++hfsc_upgrade_rt(struct hfsc_class *cl)
++{
++      cl->cl_fsc = cl->cl_rsc;
++      rtsc_init(&cl->cl_virtual, &cl->cl_fsc, cl->cl_vt, cl->cl_total);
++      cl->cl_flags |= HFSC_FSC;
++}
++
+ static const struct nla_policy hfsc_policy[TCA_HFSC_MAX + 1] = {
+       [TCA_HFSC_RSC]  = { .len = sizeof(struct tc_service_curve) },
+       [TCA_HFSC_FSC]  = { .len = sizeof(struct tc_service_curve) },
+@@ -1012,10 +1020,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 
parentid,
+               if (parent == NULL)
+                       return -ENOENT;
+       }
+-      if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) {
+-              NL_SET_ERR_MSG(extack, "Invalid parent - parent class must have 
FSC");
+-              return -EINVAL;
+-      }
+ 
+       if (classid == 0 || TC_H_MAJ(classid ^ sch->handle) != 0)
+               return -EINVAL;
+@@ -1068,6 +1072,12 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 
parentid,
+       cl->cf_tree = RB_ROOT;
+ 
+       sch_tree_lock(sch);
++      /* Check if the inner class is a misconfigured 'rt' */
++      if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) {
++              NL_SET_ERR_MSG(extack,
++                             "Forced curve change on parent 'rt' to 'sc'");
++              hfsc_upgrade_rt(parent);
++      }
+       qdisc_class_hash_insert(&q->clhash, &cl->cl_common);
+       list_add_tail(&cl->siblings, &parent->children);
+       if (parent->level == 0)
+diff --git a/net/socket.c b/net/socket.c
+index c12e01c4a3535..38c26e20511d7 100644
+--- a/net/socket.c
++++ b/net/socket.c
+@@ -3584,7 +3584,11 @@ static long compat_sock_ioctl(struct file *file, 
unsigned int cmd,
+ 
+ int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
+ {
+-      return sock->ops->bind(sock, addr, addrlen);
++      struct sockaddr_storage address;
++
++      memcpy(&address, addr, addrlen);
++
++      return sock->ops->bind(sock, (struct sockaddr *)&address, addrlen);
+ }
+ EXPORT_SYMBOL(kernel_bind);
+ 
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index 8459f5b6002e1..0926a30bc7391 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -6914,7 +6914,7 @@ static int nl80211_update_mesh_config(struct sk_buff 
*skb,
+       struct cfg80211_registered_device *rdev = info->user_ptr[0];
+       struct net_device *dev = info->user_ptr[1];
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+-      struct mesh_config cfg;
++      struct mesh_config cfg = {};
+       u32 mask;
+       int err;
+ 
+diff --git a/net/xfrm/xfrm_interface_core.c b/net/xfrm/xfrm_interface_core.c
+index 3dc63810c5f5a..82c0c05750745 100644
+--- a/net/xfrm/xfrm_interface_core.c
++++ b/net/xfrm/xfrm_interface_core.c
+@@ -219,8 +219,8 @@ static int xfrmi_rcv_cb(struct sk_buff *skb, int err)
+       skb->dev = dev;
+ 
+       if (err) {
+-              dev->stats.rx_errors++;
+-              dev->stats.rx_dropped++;
++              DEV_STATS_INC(dev, rx_errors);
++              DEV_STATS_INC(dev, rx_dropped);
+ 
+               return 0;
+       }
+@@ -260,7 +260,6 @@ static int
+ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
+ {
+       struct xfrm_if *xi = netdev_priv(dev);
+-      struct net_device_stats *stats = &xi->dev->stats;
+       struct dst_entry *dst = skb_dst(skb);
+       unsigned int length = skb->len;
+       struct net_device *tdev;
+@@ -286,7 +285,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, 
struct flowi *fl)
+       tdev = dst->dev;
+ 
+       if (tdev == dev) {
+-              stats->collisions++;
++              DEV_STATS_INC(dev, collisions);
+               net_warn_ratelimited("%s: Local routing loop detected!\n",
+                                    dev->name);
+               goto tx_err_dst_release;
+@@ -329,13 +328,13 @@ xmit:
+               tstats->tx_packets++;
+               u64_stats_update_end(&tstats->syncp);
+       } else {
+-              stats->tx_errors++;
+-              stats->tx_aborted_errors++;
++              DEV_STATS_INC(dev, tx_errors);
++              DEV_STATS_INC(dev, tx_aborted_errors);
+       }
+ 
+       return 0;
+ tx_err_link_failure:
+-      stats->tx_carrier_errors++;
++      DEV_STATS_INC(dev, tx_carrier_errors);
+       dst_link_failure(skb);
+ tx_err_dst_release:
+       dst_release(dst);
+@@ -345,7 +344,6 @@ tx_err_dst_release:
+ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+       struct xfrm_if *xi = netdev_priv(dev);
+-      struct net_device_stats *stats = &xi->dev->stats;
+       struct dst_entry *dst = skb_dst(skb);
+       struct flowi fl;
+       int ret;
+@@ -362,7 +360,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct 
net_device *dev)
+                       dst = ip6_route_output(dev_net(dev), NULL, &fl.u.ip6);
+                       if (dst->error) {
+                               dst_release(dst);
+-                              stats->tx_carrier_errors++;
++                              DEV_STATS_INC(dev, tx_carrier_errors);
+                               goto tx_err;
+                       }
+                       skb_dst_set(skb, dst);
+@@ -378,7 +376,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct 
net_device *dev)
+                       fl.u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
+                       rt = __ip_route_output_key(dev_net(dev), &fl.u.ip4);
+                       if (IS_ERR(rt)) {
+-                              stats->tx_carrier_errors++;
++                              DEV_STATS_INC(dev, tx_carrier_errors);
+                               goto tx_err;
+                       }
+                       skb_dst_set(skb, &rt->dst);
+@@ -397,8 +395,8 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct 
net_device *dev)
+       return NETDEV_TX_OK;
+ 
+ tx_err:
+-      stats->tx_errors++;
+-      stats->tx_dropped++;
++      DEV_STATS_INC(dev, tx_errors);
++      DEV_STATS_INC(dev, tx_dropped);
+       kfree_skb(skb);
+       return NETDEV_TX_OK;
+ }
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
+index 9d4b405659058..9484f27e905ae 100644
+--- a/net/xfrm/xfrm_policy.c
++++ b/net/xfrm/xfrm_policy.c
+@@ -1369,8 +1369,6 @@ EXPORT_SYMBOL(xfrm_policy_hash_rebuild);
+  * of an absolute inpredictability of ordering of rules. This will not pass. 
*/
+ static u32 xfrm_gen_index(struct net *net, int dir, u32 index)
+ {
+-      static u32 idx_generator;
+-
+       for (;;) {
+               struct hlist_head *list;
+               struct xfrm_policy *p;
+@@ -1378,8 +1376,8 @@ static u32 xfrm_gen_index(struct net *net, int dir, u32 
index)
+               int found;
+ 
+               if (!index) {
+-                      idx = (idx_generator | dir);
+-                      idx_generator += 8;
++                      idx = (net->xfrm.idx_generator | dir);
++                      net->xfrm.idx_generator += 8;
+               } else {
+                       idx = index;
+                       index = 0;
+diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
+index 5fdd1a24c232d..ff3db623c476d 100644
+--- a/sound/soc/pxa/pxa-ssp.c
++++ b/sound/soc/pxa/pxa-ssp.c
+@@ -797,7 +797,7 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
+               if (IS_ERR(priv->extclk)) {
+                       ret = PTR_ERR(priv->extclk);
+                       if (ret == -EPROBE_DEFER)
+-                              return ret;
++                              goto err_priv;
+ 
+                       priv->extclk = NULL;
+               }

Reply via email to