commit:     110f6fab1225fb54ac384e8edad9ef57631d9b88
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 19:22:10 2016 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 19:22:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=110f6fab

Linux patch 3.14.78

 0000_README              |    4 +
 1077_linux-3.14.78.patch | 1315 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1319 insertions(+)

diff --git a/0000_README b/0000_README
index 47a374a..47a11c5 100644
--- a/0000_README
+++ b/0000_README
@@ -350,6 +350,10 @@ Patch:  1076_linux-3.14.77.patch
 From:   http://www.kernel.org
 Desc:   Linux 3.14.77
 
+Patch:  1077_linux-3.14.78.patch
+From:   http://www.kernel.org
+Desc:   Linux 3.14.78
+
 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/1077_linux-3.14.78.patch b/1077_linux-3.14.78.patch
new file mode 100644
index 0000000..d79970a
--- /dev/null
+++ b/1077_linux-3.14.78.patch
@@ -0,0 +1,1315 @@
+diff --git a/Makefile b/Makefile
+index fc4df99727c1..74346f0d89c1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 3
+ PATCHLEVEL = 14
+-SUBLEVEL = 77
++SUBLEVEL = 78
+ EXTRAVERSION =
+ NAME = Remembering Coco
+ 
+diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
+index 01d3aab64b79..cc0e347379b7 100644
+--- a/arch/arm64/include/asm/elf.h
++++ b/arch/arm64/include/asm/elf.h
+@@ -137,6 +137,7 @@ extern unsigned long randomize_et_dyn(unsigned long base);
+ 
+ #define SET_PERSONALITY(ex)           clear_thread_flag(TIF_32BIT);
+ 
++/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
+ #define ARCH_DLINFO                                                   \
+ do {                                                                  \
+       NEW_AUX_ENT(AT_SYSINFO_EHDR,                                    \
+diff --git a/arch/arm64/include/uapi/asm/auxvec.h 
b/arch/arm64/include/uapi/asm/auxvec.h
+index 22d6d8885854..4cf0c17787a8 100644
+--- a/arch/arm64/include/uapi/asm/auxvec.h
++++ b/arch/arm64/include/uapi/asm/auxvec.h
+@@ -19,4 +19,6 @@
+ /* vDSO location */
+ #define AT_SYSINFO_EHDR       33
+ 
++#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
++
+ #endif
+diff --git a/arch/parisc/include/uapi/asm/errno.h 
b/arch/parisc/include/uapi/asm/errno.h
+index c0ae62520d15..274d5bc6ecce 100644
+--- a/arch/parisc/include/uapi/asm/errno.h
++++ b/arch/parisc/include/uapi/asm/errno.h
+@@ -97,10 +97,10 @@
+ #define       ENOTCONN        235     /* Transport endpoint is not connected 
*/
+ #define       ESHUTDOWN       236     /* Cannot send after transport endpoint 
shutdown */
+ #define       ETOOMANYREFS    237     /* Too many references: cannot splice */
+-#define EREFUSED      ECONNREFUSED    /* for HP's NFS apparently */
+ #define       ETIMEDOUT       238     /* Connection timed out */
+ #define       ECONNREFUSED    239     /* Connection refused */
+-#define EREMOTERELEASE        240     /* Remote peer released connection */
++#define       EREFUSED        ECONNREFUSED    /* for HP's NFS apparently */
++#define       EREMOTERELEASE  240     /* Remote peer released connection */
+ #define       EHOSTDOWN       241     /* Host is down */
+ #define       EHOSTUNREACH    242     /* No route to host */
+ 
+diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
+index 04905bfc508b..5e4b0cc54e43 100644
+--- a/arch/x86/include/asm/tlbflush.h
++++ b/arch/x86/include/asm/tlbflush.h
+@@ -17,7 +17,14 @@
+ 
+ static inline void __native_flush_tlb(void)
+ {
++      /*
++       * If current->mm == NULL then we borrow a mm which may change during a
++       * task switch and therefore we must not be preempted while we write CR3
++       * back:
++       */
++      preempt_disable();
+       native_write_cr3(native_read_cr3());
++      preempt_enable();
+ }
+ 
+ static inline void __native_flush_tlb_global_irq_disabled(void)
+diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
+index 91a32cefb11f..684baf937c7c 100644
+--- a/drivers/acpi/sysfs.c
++++ b/drivers/acpi/sysfs.c
+@@ -494,23 +494,22 @@ static void acpi_global_event_handler(u32 event_type, 
acpi_handle device,
+ static int get_status(u32 index, acpi_event_status *status,
+                     acpi_handle *handle)
+ {
+-      int result = 0;
++      int result;
+ 
+       if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
+-              goto end;
++              return -EINVAL;
+ 
+       if (index < num_gpes) {
+               result = acpi_get_gpe_device(index, handle);
+               if (result) {
+                       ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
+                                       "Invalid GPE 0x%x", index));
+-                      goto end;
++                      return result;
+               }
+               result = acpi_get_gpe_status(*handle, index, status);
+       } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
+               result = acpi_get_event_status(index - num_gpes, status);
+ 
+-end:
+       return result;
+ }
+ 
+diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
+index 5533fe31c90d..433a7696bf0f 100644
+--- a/drivers/crypto/nx/nx.c
++++ b/drivers/crypto/nx/nx.c
+@@ -330,7 +330,7 @@ static void nx_of_update_msc(struct device   *dev,
+                    ((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) &&
+                    i < msc->triplets;
+                    i++) {
+-                      if (msc->fc > NX_MAX_FC || msc->mode > NX_MAX_MODE) {
++                      if (msc->fc >= NX_MAX_FC || msc->mode >= NX_MAX_MODE) {
+                               dev_err(dev, "unknown function code/mode "
+                                       "combo: %d/%d (ignored)\n", msc->fc,
+                                       msc->mode);
+diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
+index 19dc0bc9b136..9530c5703bb7 100644
+--- a/drivers/edac/edac_mc.c
++++ b/drivers/edac/edac_mc.c
+@@ -962,7 +962,7 @@ static void edac_inc_ue_error(struct mem_ctl_info *mci,
+       mci->ue_mc += count;
+ 
+       if (!enable_per_layer_report) {
+-              mci->ce_noinfo_count += count;
++              mci->ue_noinfo_count += count;
+               return;
+       }
+ 
+diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
+index 903f24d28ba0..7025562ede12 100644
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -50,6 +50,7 @@ config GPIO_DEVRES
+ config OF_GPIO
+       def_bool y
+       depends on OF
++      depends on HAS_IOMEM
+ 
+ config GPIO_ACPI
+       def_bool y
+diff --git a/drivers/input/keyboard/tegra-kbc.c 
b/drivers/input/keyboard/tegra-kbc.c
+index 9757a58bc897..5d39b966dd28 100644
+--- a/drivers/input/keyboard/tegra-kbc.c
++++ b/drivers/input/keyboard/tegra-kbc.c
+@@ -376,7 +376,7 @@ static int tegra_kbc_start(struct tegra_kbc *kbc)
+       /* Reset the KBC controller to clear all previous status.*/
+       reset_control_assert(kbc->rst);
+       udelay(100);
+-      reset_control_assert(kbc->rst);
++      reset_control_deassert(kbc->rst);
+       udelay(100);
+ 
+       tegra_kbc_config_pins(kbc);
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
+index eb796fff9e62..9a0cc5b5561a 100644
+--- a/drivers/input/serio/i8042.c
++++ b/drivers/input/serio/i8042.c
+@@ -1230,6 +1230,7 @@ static int __init i8042_create_kbd_port(void)
+       serio->start            = i8042_start;
+       serio->stop             = i8042_stop;
+       serio->close            = i8042_port_close;
++      serio->ps2_cmd_mutex    = &i8042_mutex;
+       serio->port_data        = port;
+       serio->dev.parent       = &i8042_platform_device->dev;
+       strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
+@@ -1257,6 +1258,7 @@ static int __init i8042_create_aux_port(int idx)
+       serio->write            = i8042_aux_write;
+       serio->start            = i8042_start;
+       serio->stop             = i8042_stop;
++      serio->ps2_cmd_mutex    = &i8042_mutex;
+       serio->port_data        = port;
+       serio->dev.parent       = &i8042_platform_device->dev;
+       if (idx < 0) {
+@@ -1321,21 +1323,6 @@ static void i8042_unregister_ports(void)
+       }
+ }
+ 
+-/*
+- * Checks whether port belongs to i8042 controller.
+- */
+-bool i8042_check_port_owner(const struct serio *port)
+-{
+-      int i;
+-
+-      for (i = 0; i < I8042_NUM_PORTS; i++)
+-              if (i8042_ports[i].serio == port)
+-                      return true;
+-
+-      return false;
+-}
+-EXPORT_SYMBOL(i8042_check_port_owner);
+-
+ static void i8042_free_irqs(void)
+ {
+       if (i8042_aux_irq_registered)
+diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
+index 75516996db20..ded0c6f65c9f 100644
+--- a/drivers/input/serio/libps2.c
++++ b/drivers/input/serio/libps2.c
+@@ -56,19 +56,17 @@ EXPORT_SYMBOL(ps2_sendbyte);
+ 
+ void ps2_begin_command(struct ps2dev *ps2dev)
+ {
+-      mutex_lock(&ps2dev->cmd_mutex);
++      struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
+ 
+-      if (i8042_check_port_owner(ps2dev->serio))
+-              i8042_lock_chip();
++      mutex_lock(m);
+ }
+ EXPORT_SYMBOL(ps2_begin_command);
+ 
+ void ps2_end_command(struct ps2dev *ps2dev)
+ {
+-      if (i8042_check_port_owner(ps2dev->serio))
+-              i8042_unlock_chip();
++      struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
+ 
+-      mutex_unlock(&ps2dev->cmd_mutex);
++      mutex_unlock(m);
+ }
+ EXPORT_SYMBOL(ps2_end_command);
+ 
+diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
+index a943c6c0f206..3f29cf979c09 100644
+--- a/drivers/pci/pci-sysfs.c
++++ b/drivers/pci/pci-sysfs.c
+@@ -1349,10 +1349,10 @@ int __must_check pci_create_sysfs_dev_files (struct 
pci_dev *pdev)
+       if (!sysfs_initialized)
+               return -EACCES;
+ 
+-      if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
+-              retval = sysfs_create_bin_file(&pdev->dev.kobj, 
&pci_config_attr);
+-      else
++      if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
+               retval = sysfs_create_bin_file(&pdev->dev.kobj, 
&pcie_config_attr);
++      else
++              retval = sysfs_create_bin_file(&pdev->dev.kobj, 
&pci_config_attr);
+       if (retval)
+               goto err;
+ 
+@@ -1409,10 +1409,10 @@ err_rom_file:
+ err_resource_files:
+       pci_remove_resource_files(pdev);
+ err_config_file:
+-      if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
+-              sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
+-      else
++      if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
+               sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr);
++      else
++              sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
+ err:
+       return retval;
+ }
+@@ -1446,10 +1446,10 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
+ 
+       pci_remove_capabilities_sysfs(pdev);
+ 
+-      if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
+-              sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
+-      else
++      if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
+               sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr);
++      else
++              sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
+ 
+       pci_remove_resource_files(pdev);
+ 
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
+index 09208ac59415..ca53d484513c 100644
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -288,6 +288,18 @@ static void quirk_citrine(struct pci_dev *dev)
+ }
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,   PCI_DEVICE_ID_IBM_CITRINE,      
quirk_citrine);
+ 
++/*
++ * This chip can cause bus lockups if config addresses above 0x600
++ * are read or written.
++ */
++static void quirk_nfp6000(struct pci_dev *dev)
++{
++      dev->cfg_size = 0x600;
++}
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME,     
PCI_DEVICE_ID_NETRONOME_NFP4000,        quirk_nfp6000);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME,     
PCI_DEVICE_ID_NETRONOME_NFP6000,        quirk_nfp6000);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME,     
PCI_DEVICE_ID_NETRONOME_NFP6000_VF,     quirk_nfp6000);
++
+ /*  On IBM Crocodile ipr SAS adapters, expand BAR to system page size */
+ static void quirk_extend_bar_to_page(struct pci_dev *dev)
+ {
+diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
+index 1eef0f586950..cf0214005fca 100644
+--- a/drivers/s390/block/dasd.c
++++ b/drivers/s390/block/dasd.c
+@@ -1613,9 +1613,18 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned 
long intparm,
+       unsigned long long now;
+       int expires;
+ 
++      cqr = (struct dasd_ccw_req *) intparm;
+       if (IS_ERR(irb)) {
+               switch (PTR_ERR(irb)) {
+               case -EIO:
++                      if (cqr && cqr->status == DASD_CQR_CLEAR_PENDING) {
++                              device = (struct dasd_device *) cqr->startdev;
++                              cqr->status = DASD_CQR_CLEARED;
++                              dasd_device_clear_timer(device);
++                              wake_up(&dasd_flush_wq);
++                              dasd_schedule_device_bh(device);
++                              return;
++                      }
+                       break;
+               case -ETIMEDOUT:
+                       DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s: "
+@@ -1631,7 +1640,6 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned 
long intparm,
+       }
+ 
+       now = get_tod_clock();
+-      cqr = (struct dasd_ccw_req *) intparm;
+       /* check for conditions that should be handled immediately */
+       if (!cqr ||
+           !(scsw_dstat(&irb->scsw) == (DEV_STAT_CHN_END | DEV_STAT_DEV_END) &&
+diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
+index fbcd48d0bfc3..16b2db3cd9f1 100644
+--- a/drivers/scsi/aacraid/commctrl.c
++++ b/drivers/scsi/aacraid/commctrl.c
+@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user 
*arg)
+       struct fib *fibptr;
+       struct hw_fib * hw_fib = (struct hw_fib *)0;
+       dma_addr_t hw_fib_pa = (dma_addr_t)0LL;
+-      unsigned size;
++      unsigned int size, osize;
+       int retval;
+ 
+       if (dev->in_reset) {
+@@ -87,7 +87,8 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user 
*arg)
+        *      will not overrun the buffer when we copy the memory. Return
+        *      an error if we would.
+        */
+-      size = le16_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr);
++      osize = size = le16_to_cpu(kfib->header.Size) +
++              sizeof(struct aac_fibhdr);
+       if (size < le16_to_cpu(kfib->header.SenderSize))
+               size = le16_to_cpu(kfib->header.SenderSize);
+       if (size > dev->max_fib_size) {
+@@ -118,6 +119,14 @@ static int ioctl_send_fib(struct aac_dev * dev, void 
__user *arg)
+               goto cleanup;
+       }
+ 
++      /* Sanity check the second copy */
++      if ((osize != le16_to_cpu(kfib->header.Size) +
++              sizeof(struct aac_fibhdr))
++              || (size < le16_to_cpu(kfib->header.SenderSize))) {
++              retval = -EINVAL;
++              goto cleanup;
++      }
++
+       if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) {
+               aac_adapter_interrupt(dev);
+               /*
+diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
+index 9f833f1504cc..5ff955524aaf 100644
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c
+@@ -3624,7 +3624,7 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
+       /* Find first memory bar */
+       bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
+       instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
+-      if (pci_request_selected_regions(instance->pdev, instance->bar,
++      if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
+                                        "megasas: LSI")) {
+               printk(KERN_DEBUG "megasas: IO memory region busy!\n");
+               return -EBUSY;
+@@ -3858,7 +3858,7 @@ fail_ready_state:
+       iounmap(instance->reg_set);
+ 
+       fail_ioremap:
+-      pci_release_selected_regions(instance->pdev, instance->bar);
++      pci_release_selected_regions(instance->pdev, 1<<instance->bar);
+ 
+       return -EINVAL;
+ }
+@@ -3879,7 +3879,7 @@ static void megasas_release_mfi(struct megasas_instance 
*instance)
+ 
+       iounmap(instance->reg_set);
+ 
+-      pci_release_selected_regions(instance->pdev, instance->bar);
++      pci_release_selected_regions(instance->pdev, 1<<instance->bar);
+ }
+ 
+ /**
+diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
+index a1f04e3b2a8f..665131a0b616 100644
+--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
+@@ -2175,7 +2175,7 @@ megasas_release_fusion(struct megasas_instance *instance)
+ 
+       iounmap(instance->reg_set);
+ 
+-      pci_release_selected_regions(instance->pdev, instance->bar);
++      pci_release_selected_regions(instance->pdev, 1<<instance->bar);
+ }
+ 
+ /**
+diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
+index ce153fcb8b2a..3c585b9de1b6 100644
+--- a/drivers/staging/comedi/drivers/daqboard2000.c
++++ b/drivers/staging/comedi/drivers/daqboard2000.c
+@@ -658,7 +658,7 @@ static const void *daqboard2000_find_boardinfo(struct 
comedi_device *dev,
+       const struct daq200_boardtype *board;
+       int i;
+ 
+-      if (pcidev->subsystem_device != PCI_VENDOR_ID_IOTECH)
++      if (pcidev->subsystem_vendor != PCI_VENDOR_ID_IOTECH)
+               return NULL;
+ 
+       for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
+index b6f5c7d3737b..18cb44d9cbd8 100644
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -1296,7 +1296,6 @@ made_compressed_probe:
+       spin_lock_init(&acm->write_lock);
+       spin_lock_init(&acm->read_lock);
+       mutex_init(&acm->mutex);
+-      acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
+       acm->is_int_ep = usb_endpoint_xfer_int(epread);
+       if (acm->is_int_ep)
+               acm->bInterval = epread->bInterval;
+@@ -1345,14 +1344,14 @@ made_compressed_probe:
+               urb->transfer_dma = rb->dma;
+               if (acm->is_int_ep) {
+                       usb_fill_int_urb(urb, acm->dev,
+-                                       acm->rx_endpoint,
++                                       usb_rcvintpipe(usb_dev, 
epread->bEndpointAddress),
+                                        rb->base,
+                                        acm->readsize,
+                                        acm_read_bulk_callback, rb,
+                                        acm->bInterval);
+               } else {
+                       usb_fill_bulk_urb(urb, acm->dev,
+-                                        acm->rx_endpoint,
++                                        usb_rcvbulkpipe(usb_dev, 
epread->bEndpointAddress),
+                                         rb->base,
+                                         acm->readsize,
+                                         acm_read_bulk_callback, rb);
+diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
+index 80826f843e04..82db3387ac6e 100644
+--- a/drivers/usb/class/cdc-acm.h
++++ b/drivers/usb/class/cdc-acm.h
+@@ -95,7 +95,6 @@ struct acm {
+       struct urb *read_urbs[ACM_NR];
+       struct acm_rb read_buffers[ACM_NR];
+       int rx_buflimit;
+-      int rx_endpoint;
+       spinlock_t read_lock;
+       int write_used;                                 /* number of non-empty 
write buffers */
+       int transmitting;
+diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
+index 12d14f91c4d3..0e9530997119 100644
+--- a/drivers/usb/core/config.c
++++ b/drivers/usb/core/config.c
+@@ -143,6 +143,31 @@ static void usb_parse_ss_endpoint_companion(struct device 
*ddev, int cfgno,
+       }
+ }
+ 
++static const unsigned short low_speed_maxpacket_maxes[4] = {
++      [USB_ENDPOINT_XFER_CONTROL] = 8,
++      [USB_ENDPOINT_XFER_ISOC] = 0,
++      [USB_ENDPOINT_XFER_BULK] = 0,
++      [USB_ENDPOINT_XFER_INT] = 8,
++};
++static const unsigned short full_speed_maxpacket_maxes[4] = {
++      [USB_ENDPOINT_XFER_CONTROL] = 64,
++      [USB_ENDPOINT_XFER_ISOC] = 1023,
++      [USB_ENDPOINT_XFER_BULK] = 64,
++      [USB_ENDPOINT_XFER_INT] = 64,
++};
++static const unsigned short high_speed_maxpacket_maxes[4] = {
++      [USB_ENDPOINT_XFER_CONTROL] = 64,
++      [USB_ENDPOINT_XFER_ISOC] = 1024,
++      [USB_ENDPOINT_XFER_BULK] = 512,
++      [USB_ENDPOINT_XFER_INT] = 1024,
++};
++static const unsigned short super_speed_maxpacket_maxes[4] = {
++      [USB_ENDPOINT_XFER_CONTROL] = 512,
++      [USB_ENDPOINT_XFER_ISOC] = 1024,
++      [USB_ENDPOINT_XFER_BULK] = 1024,
++      [USB_ENDPOINT_XFER_INT] = 1024,
++};
++
+ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
+     int asnum, struct usb_host_interface *ifp, int num_ep,
+     unsigned char *buffer, int size)
+@@ -151,6 +176,8 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
+       struct usb_endpoint_descriptor *d;
+       struct usb_host_endpoint *endpoint;
+       int n, i, j, retval;
++      unsigned int maxp;
++      const unsigned short *maxpacket_maxes;
+ 
+       d = (struct usb_endpoint_descriptor *) buffer;
+       buffer += d->bLength;
+@@ -192,6 +219,7 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
+       if (usb_endpoint_xfer_int(d)) {
+               i = 1;
+               switch (to_usb_device(ddev)->speed) {
++              case USB_SPEED_SUPER_PLUS:
+               case USB_SPEED_SUPER:
+               case USB_SPEED_HIGH:
+                       /* Many device manufacturers are using full-speed
+@@ -246,6 +274,42 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
+                       endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
+       }
+ 
++      /* Validate the wMaxPacketSize field */
++      maxp = usb_endpoint_maxp(&endpoint->desc);
++
++      /* Find the highest legal maxpacket size for this endpoint */
++      i = 0;          /* additional transactions per microframe */
++      switch (to_usb_device(ddev)->speed) {
++      case USB_SPEED_LOW:
++              maxpacket_maxes = low_speed_maxpacket_maxes;
++              break;
++      case USB_SPEED_FULL:
++              maxpacket_maxes = full_speed_maxpacket_maxes;
++              break;
++      case USB_SPEED_HIGH:
++              /* Bits 12..11 are allowed only for HS periodic endpoints */
++              if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) {
++                      i = maxp & (BIT(12) | BIT(11));
++                      maxp &= ~i;
++              }
++              /* fallthrough */
++      default:
++              maxpacket_maxes = high_speed_maxpacket_maxes;
++              break;
++      case USB_SPEED_SUPER:
++      case USB_SPEED_SUPER_PLUS:
++              maxpacket_maxes = super_speed_maxpacket_maxes;
++              break;
++      }
++      j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];
++
++      if (maxp > j) {
++              dev_warn(ddev, "config %d interface %d altsetting %d endpoint 
0x%X has invalid maxpacket %d, setting to %d\n",
++                  cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
++              maxp = j;
++              endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
++      }
++
+       /*
+        * Some buggy high speed devices have bulk endpoints using
+        * maxpacket sizes other than 512.  High speed HCDs may not
+@@ -253,9 +317,6 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
+        */
+       if (to_usb_device(ddev)->speed == USB_SPEED_HIGH
+                       && usb_endpoint_xfer_bulk(d)) {
+-              unsigned maxp;
+-
+-              maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
+               if (maxp != 512)
+                       dev_warn(ddev, "config %d interface %d altsetting %d "
+                               "bulk endpoint 0x%X has invalid maxpacket %d\n",
+@@ -264,7 +325,7 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
+       }
+ 
+       /* Parse a possible SuperSpeed endpoint companion descriptor */
+-      if (to_usb_device(ddev)->speed == USB_SPEED_SUPER)
++      if (to_usb_device(ddev)->speed >= USB_SPEED_SUPER)
+               usb_parse_ss_endpoint_companion(ddev, cfgno,
+                               inum, asnum, endpoint, buffer, size);
+ 
+diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
+index 2a3bbdf7eb94..332ed277a06c 100644
+--- a/drivers/usb/core/devices.c
++++ b/drivers/usb/core/devices.c
+@@ -221,7 +221,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
+               break;
+       case USB_ENDPOINT_XFER_INT:
+               type = "Int.";
+-              if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER)
++              if (speed == USB_SPEED_HIGH || speed >= USB_SPEED_SUPER)
+                       interval = 1 << (desc->bInterval - 1);
+               else
+                       interval = desc->bInterval;
+@@ -230,7 +230,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
+               return start;
+       }
+       interval *= (speed == USB_SPEED_HIGH ||
+-                   speed == USB_SPEED_SUPER) ? 125 : 1000;
++                   speed >= USB_SPEED_SUPER) ? 125 : 1000;
+       if (interval % 1000)
+               unit = 'u';
+       else {
+@@ -322,7 +322,7 @@ static char *usb_dump_config_descriptor(char *start, char 
*end,
+ 
+       if (start > end)
+               return start;
+-      if (speed == USB_SPEED_SUPER)
++      if (speed >= USB_SPEED_SUPER)
+               mul = 8;
+       else
+               mul = 2;
+@@ -534,6 +534,8 @@ static ssize_t usb_device_dump(char __user **buffer, 
size_t *nbytes,
+               speed = "480"; break;
+       case USB_SPEED_SUPER:
+               speed = "5000"; break;
++      case USB_SPEED_SUPER_PLUS:
++              speed = "10000"; break;
+       default:
+               speed = "??";
+       }
+@@ -553,7 +555,7 @@ static ssize_t usb_device_dump(char __user **buffer, 
size_t *nbytes,
+ 
+               /* super/high speed reserves 80%, full/low reserves 90% */
+               if (usbdev->speed == USB_SPEED_HIGH ||
+-                  usbdev->speed == USB_SPEED_SUPER)
++                  usbdev->speed >= USB_SPEED_SUPER)
+                       max = 800;
+               else
+                       max = FRAME_TIME_MAX_USECS_ALLOC;
+diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
+index ccdcc7063eee..a5ffceb50007 100644
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -207,7 +207,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
+        * The xHCI driver has its own irq management
+        * make sure irq setup is not touched for xhci in generic hcd code
+        */
+-      if ((driver->flags & HCD_MASK) != HCD_USB3) {
++      if ((driver->flags & HCD_MASK) < HCD_USB3) {
+               if (!dev->irq) {
+                       dev_err(&dev->dev,
+                       "Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
+index ee6c5562d296..2e6ec875b1b7 100644
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -1024,7 +1024,7 @@ static int register_root_hub(struct usb_hcd *hcd)
+                               dev_name(&usb_dev->dev), retval);
+               return (retval < 0) ? retval : -EMSGSIZE;
+       }
+-      if (usb_dev->speed == USB_SPEED_SUPER) {
++      if (usb_dev->speed >= USB_SPEED_SUPER) {
+               retval = usb_get_bos_descriptor(usb_dev);
+               if (retval < 0) {
+                       mutex_unlock(&usb_bus_list_lock);
+@@ -2055,7 +2055,7 @@ int usb_alloc_streams(struct usb_interface *interface,
+       hcd = bus_to_hcd(dev->bus);
+       if (!hcd->driver->alloc_streams || !hcd->driver->free_streams)
+               return -EINVAL;
+-      if (dev->speed != USB_SPEED_SUPER)
++      if (dev->speed < USB_SPEED_SUPER)
+               return -EINVAL;
+       if (dev->state < USB_STATE_CONFIGURED)
+               return -ENODEV;
+@@ -2093,7 +2093,7 @@ int usb_free_streams(struct usb_interface *interface,
+ 
+       dev = interface_to_usbdev(interface);
+       hcd = bus_to_hcd(dev->bus);
+-      if (dev->speed != USB_SPEED_SUPER)
++      if (dev->speed < USB_SPEED_SUPER)
+               return -EINVAL;
+ 
+       /* Streams only apply to bulk endpoints. */
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
+index f46ac929ef8a..a5f77367386d 100644
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -297,7 +297,7 @@ static void usb_set_lpm_parameters(struct usb_device *udev)
+       unsigned int hub_u1_del;
+       unsigned int hub_u2_del;
+ 
+-      if (!udev->lpm_capable || udev->speed != USB_SPEED_SUPER)
++      if (!udev->lpm_capable || udev->speed < USB_SPEED_SUPER)
+               return;
+ 
+       hub = usb_hub_to_struct_hub(udev->parent);
+@@ -2559,7 +2559,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
+  */
+ static bool use_new_scheme(struct usb_device *udev, int retry)
+ {
+-      if (udev->speed == USB_SPEED_SUPER)
++      if (udev->speed >= USB_SPEED_SUPER)
+               return false;
+ 
+       return USE_NEW_SCHEME(retry);
+@@ -3812,7 +3812,7 @@ int usb_disable_lpm(struct usb_device *udev)
+       struct usb_hcd *hcd;
+ 
+       if (!udev || !udev->parent ||
+-                      udev->speed != USB_SPEED_SUPER ||
++                      udev->speed < USB_SPEED_SUPER ||
+                       !udev->lpm_capable)
+               return 0;
+ 
+@@ -3868,7 +3868,7 @@ void usb_enable_lpm(struct usb_device *udev)
+       struct usb_hcd *hcd;
+ 
+       if (!udev || !udev->parent ||
+-                      udev->speed != USB_SPEED_SUPER ||
++                      udev->speed < USB_SPEED_SUPER ||
+                       !udev->lpm_capable)
+               return;
+ 
+@@ -4127,7 +4127,9 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+ 
+       retval = -ENODEV;
+ 
+-      if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) {
++      /* Don't allow speed changes at reset, except usb 3.0 to faster */
++      if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed &&
++          !(oldspeed == USB_SPEED_SUPER && udev->speed > oldspeed)) {
+               dev_dbg(&udev->dev, "device reset changed speed!\n");
+               goto fail;
+       }
+@@ -4139,6 +4141,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+        * reported as 0xff in the device descriptor). WUSB1.0[4.8.1].
+        */
+       switch (udev->speed) {
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+       case USB_SPEED_WIRELESS:        /* fixed at 512 */
+               udev->ep0.desc.wMaxPacketSize = cpu_to_le16(512);
+@@ -4165,7 +4168,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+       else
+               speed = usb_speed_string(udev->speed);
+ 
+-      if (udev->speed != USB_SPEED_SUPER)
++      if (udev->speed < USB_SPEED_SUPER)
+               dev_info(&udev->dev,
+                               "%s %s USB device number %d using %s\n",
+                               (udev->config) ? "reset" : "new", speed,
+@@ -4291,11 +4294,12 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+                                                       devnum, retval);
+                               goto fail;
+                       }
+-                      if (udev->speed == USB_SPEED_SUPER) {
++                      if (udev->speed >= USB_SPEED_SUPER) {
+                               devnum = udev->devnum;
+                               dev_info(&udev->dev,
+-                                              "%s SuperSpeed USB device 
number %d using %s\n",
++                                              "%s SuperSpeed%s USB device 
number %d using %s\n",
+                                               (udev->config) ? "reset" : 
"new",
++                                       (udev->speed == USB_SPEED_SUPER_PLUS) 
? "Plus" : "",
+                                               devnum, 
udev->bus->controller->driver->name);
+                       }
+ 
+@@ -4337,7 +4341,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+        * got from those devices show they aren't superspeed devices. Warm
+        * reset the port attached by the devices can fix them.
+        */
+-      if ((udev->speed == USB_SPEED_SUPER) &&
++      if ((udev->speed >= USB_SPEED_SUPER) &&
+                       (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) {
+               dev_err(&udev->dev, "got a wrong device descriptor, "
+                               "warm reset device\n");
+@@ -4348,7 +4352,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
+       }
+ 
+       if (udev->descriptor.bMaxPacketSize0 == 0xff ||
+-                      udev->speed == USB_SPEED_SUPER)
++                      udev->speed >= USB_SPEED_SUPER)
+               i = 512;
+       else
+               i = udev->descriptor.bMaxPacketSize0;
+@@ -4607,7 +4611,7 @@ static void hub_port_connect_change(struct usb_hub *hub, 
int port1,
+               udev->level = hdev->level + 1;
+               udev->wusb = hub_is_wusb(hub);
+ 
+-              /* Only USB 3.0 devices are connected to SuperSpeed hubs. */
++              /* Devices connected to SuperSpeed hubs are USB 3.0 or later */
+               if (hub_is_superspeed(hub->hdev))
+                       udev->speed = USB_SPEED_SUPER;
+               else
+diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
+index 9ff665f1322f..a47d904b3f87 100644
+--- a/drivers/usb/core/urb.c
++++ b/drivers/usb/core/urb.c
+@@ -402,7 +402,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
+               /* SuperSpeed isoc endpoints have up to 16 bursts of up to
+                * 3 packets each
+                */
+-              if (dev->speed == USB_SPEED_SUPER) {
++              if (dev->speed >= USB_SPEED_SUPER) {
+                       int     burst = 1 + ep->ss_ep_comp.bMaxBurst;
+                       int     mult = USB_SS_MULT(ep->ss_ep_comp.bmAttributes);
+                       max *= burst;
+@@ -499,6 +499,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
+               }
+               /* too big? */
+               switch (dev->speed) {
++              case USB_SPEED_SUPER_PLUS:
+               case USB_SPEED_SUPER:   /* units are 125us */
+                       /* Handle up to 2^(16-1) microframes */
+                       if (urb->interval > (1 << 15))
+diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
+index 0923add72b59..e9fad3d863a3 100644
+--- a/drivers/usb/core/usb.h
++++ b/drivers/usb/core/usb.h
+@@ -43,7 +43,7 @@ static inline unsigned usb_get_max_power(struct usb_device 
*udev,
+               struct usb_host_config *c)
+ {
+       /* SuperSpeed power is in 8 mA units; others are in 2 mA units */
+-      unsigned mul = (udev->speed == USB_SPEED_SUPER ? 8 : 2);
++      unsigned mul = (udev->speed >= USB_SPEED_SUPER ? 8 : 2);
+ 
+       return c->desc.bMaxPower * mul;
+ }
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
+index a57ad1f52f79..48fa53ba354b 100644
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -1799,14 +1799,6 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
+                       s_pkt = 1;
+       }
+ 
+-      /*
+-       * We assume here we will always receive the entire data block
+-       * which we should receive. Meaning, if we program RX to
+-       * receive 4K but we receive only 2K, we assume that's all we
+-       * should receive and we simply bounce the request back to the
+-       * gadget driver for further processing.
+-       */
+-      req->request.actual += req->request.length - count;
+       if (s_pkt)
+               return 1;
+       if ((event->status & DEPEVT_STATUS_LST) &&
+@@ -1826,6 +1818,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
+       struct dwc3_trb         *trb;
+       unsigned int            slot;
+       unsigned int            i;
++      int                     count = 0;
+       int                     ret;
+ 
+       do {
+@@ -1842,6 +1835,8 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
+                               slot++;
+                       slot %= DWC3_TRB_NUM;
+                       trb = &dep->trb_pool[slot];
++                      count += trb->size & DWC3_TRB_SIZE_MASK;
++
+ 
+                       ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
+                                       event, status);
+@@ -1849,6 +1844,14 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
+                               break;
+               }while (++i < req->request.num_mapped_sgs);
+ 
++              /*
++               * We assume here we will always receive the entire data block
++               * which we should receive. Meaning, if we program RX to
++               * receive 4K but we receive only 2K, we assume that's all we
++               * should receive and we simply bounce the request back to the
++               * gadget driver for further processing.
++               */
++              req->request.actual += req->request.length - count;
+               dwc3_gadget_giveback(dep, req, status);
+ 
+               if (ret)
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
+index 7f01f165e77b..69b28af70b7c 100644
+--- a/drivers/usb/host/xhci-hub.c
++++ b/drivers/usb/host/xhci-hub.c
+@@ -276,6 +276,9 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int 
slot_id, int suspend)
+ 
+       ret = 0;
+       virt_dev = xhci->devs[slot_id];
++      if (!virt_dev)
++              return -ENODEV;
++
+       cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO);
+       if (!cmd) {
+               xhci_dbg(xhci, "Couldn't allocate command structure.\n");
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
+index b39d217310fe..831e28989181 100644
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -974,7 +974,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd 
*xhci,
+       struct usb_device *top_dev;
+       struct usb_hcd *hcd;
+ 
+-      if (udev->speed == USB_SPEED_SUPER)
++      if (udev->speed >= USB_SPEED_SUPER)
+               hcd = xhci->shared_hcd;
+       else
+               hcd = xhci->main_hcd;
+@@ -1009,6 +1009,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd 
*xhci, struct usb_device *ud
+       /* 3) Only the control endpoint is valid - one endpoint context */
+       slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
+       switch (udev->speed) {
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+               slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_SS);
+               max_packets = MAX_PACKET(512);
+@@ -1196,6 +1197,7 @@ static unsigned int xhci_get_endpoint_interval(struct 
usb_device *udev,
+               }
+               /* Fall through - SS and HS isoc/int have same decoding */
+ 
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+               if (usb_endpoint_xfer_int(&ep->desc) ||
+                   usb_endpoint_xfer_isoc(&ep->desc)) {
+@@ -1236,7 +1238,7 @@ static unsigned int xhci_get_endpoint_interval(struct 
usb_device *udev,
+ static u32 xhci_get_endpoint_mult(struct usb_device *udev,
+               struct usb_host_endpoint *ep)
+ {
+-      if (udev->speed != USB_SPEED_SUPER ||
++      if (udev->speed < USB_SPEED_SUPER ||
+                       !usb_endpoint_xfer_isoc(&ep->desc))
+               return 0;
+       return ep->ss_ep_comp.bmAttributes;
+@@ -1288,7 +1290,7 @@ static u32 xhci_get_max_esit_payload(struct xhci_hcd 
*xhci,
+                       usb_endpoint_xfer_bulk(&ep->desc))
+               return 0;
+ 
+-      if (udev->speed == USB_SPEED_SUPER)
++      if (udev->speed >= USB_SPEED_SUPER)
+               return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
+ 
+       max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
+@@ -1359,6 +1361,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
+       max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
+       max_burst = 0;
+       switch (udev->speed) {
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+               /* dig out max burst from ep companion desc */
+               max_burst = ep->ss_ep_comp.bMaxBurst;
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
+index 3bfe81c6229a..4025a57ffb98 100644
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -3705,7 +3705,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd 
*xhci,
+ {
+       unsigned int max_burst;
+ 
+-      if (xhci->hci_version < 0x100 || udev->speed != USB_SPEED_SUPER)
++      if (xhci->hci_version < 0x100 || udev->speed < USB_SPEED_SUPER)
+               return 0;
+ 
+       max_burst = urb->ep->ss_ep_comp.bMaxBurst;
+@@ -3731,6 +3731,7 @@ static unsigned int 
xhci_get_last_burst_packet_count(struct xhci_hcd *xhci,
+               return 0;
+ 
+       switch (udev->speed) {
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+               /* bMaxBurst is zero based: 0 means 1 packet per burst */
+               max_burst = urb->ep->ss_ep_comp.bMaxBurst;
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
+index b63507bbf74b..648f8c4761ed 100644
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -2054,6 +2054,7 @@ static unsigned int xhci_get_block_size(struct 
usb_device *udev)
+       case USB_SPEED_HIGH:
+               return HS_BLOCK;
+       case USB_SPEED_SUPER:
++      case USB_SPEED_SUPER_PLUS:
+               return SS_BLOCK;
+       case USB_SPEED_UNKNOWN:
+       case USB_SPEED_WIRELESS:
+@@ -2179,7 +2180,7 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci,
+       unsigned int packets_remaining = 0;
+       unsigned int i;
+ 
+-      if (virt_dev->udev->speed == USB_SPEED_SUPER)
++      if (virt_dev->udev->speed >= USB_SPEED_SUPER)
+               return xhci_check_ss_bw(xhci, virt_dev);
+ 
+       if (virt_dev->udev->speed == USB_SPEED_HIGH) {
+@@ -2380,7 +2381,7 @@ void xhci_drop_ep_from_interval_table(struct xhci_hcd 
*xhci,
+       if (xhci_is_async_ep(ep_bw->type))
+               return;
+ 
+-      if (udev->speed == USB_SPEED_SUPER) {
++      if (udev->speed >= USB_SPEED_SUPER) {
+               if (xhci_is_sync_in_ep(ep_bw->type))
+                       xhci->devs[udev->slot_id]->bw_table->ss_bw_in -=
+                               xhci_get_ss_bw_consumed(ep_bw);
+@@ -2418,6 +2419,7 @@ void xhci_drop_ep_from_interval_table(struct xhci_hcd 
*xhci,
+               interval_bw->overhead[HS_OVERHEAD_TYPE] -= 1;
+               break;
+       case USB_SPEED_SUPER:
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_UNKNOWN:
+       case USB_SPEED_WIRELESS:
+               /* Should never happen because only LS/FS/HS endpoints will get
+@@ -2477,6 +2479,7 @@ static void xhci_add_ep_to_interval_table(struct 
xhci_hcd *xhci,
+               interval_bw->overhead[HS_OVERHEAD_TYPE] += 1;
+               break;
+       case USB_SPEED_SUPER:
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_UNKNOWN:
+       case USB_SPEED_WIRELESS:
+               /* Should never happen because only LS/FS/HS endpoints will get
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
+index fb3a832d86e3..6103727cd060 100644
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -661,6 +661,8 @@ static const struct usb_device_id id_table_combined[] = {
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) },
++      { USB_DEVICE(FTDI_VID, FTDI_PALMSENS_PID) },
++      { USB_DEVICE(FTDI_VID, FTDI_IVIUM_XSTAT_PID) },
+       { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
+       { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
+       { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
+@@ -1021,6 +1023,7 @@ static const struct usb_device_id id_table_combined[] = {
+       { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
+       { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
+       { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
++      { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
+       { }                                     /* Terminating entry */
+ };
+ 
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
+index 334bc600282d..48db84f25cc9 100644
+--- a/drivers/usb/serial/ftdi_sio_ids.h
++++ b/drivers/usb/serial/ftdi_sio_ids.h
+@@ -406,6 +406,12 @@
+ #define FTDI_4N_GALAXY_DE_3_PID       0xF3C2
+ 
+ /*
++ * Ivium Technologies product IDs
++ */
++#define FTDI_PALMSENS_PID     0xf440
++#define FTDI_IVIUM_XSTAT_PID  0xf441
++
++/*
+  * Linx Technologies product ids
+  */
+ #define LINX_SDMUSBQSS_PID    0xF448  /* Linx SDM-USB-QS-S */
+@@ -673,6 +679,12 @@
+ #define INTREPID_NEOVI_PID    0x0701
+ 
+ /*
++ * WICED USB UART
++ */
++#define WICED_VID             0x0A5C
++#define WICED_USB20706V2_PID  0x6422
++
++/*
+  * Definitions for ID TECH (www.idt-net.com) devices
+  */
+ #define IDTECH_VID            0x0ACD  /* ID TECH Vendor ID */
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
+index 4eb277225a77..56bc36439146 100644
+--- a/drivers/usb/serial/mos7720.c
++++ b/drivers/usb/serial/mos7720.c
+@@ -1239,7 +1239,7 @@ static int mos7720_write(struct tty_struct *tty, struct 
usb_serial_port *port,
+ 
+       if (urb->transfer_buffer == NULL) {
+               urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
+-                                             GFP_KERNEL);
++                                             GFP_ATOMIC);
+               if (!urb->transfer_buffer)
+                       goto exit;
+       }
+diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
+index e9d967ff521b..92f1a3bc22a8 100644
+--- a/drivers/usb/serial/mos7840.c
++++ b/drivers/usb/serial/mos7840.c
+@@ -1372,8 +1372,8 @@ static int mos7840_write(struct tty_struct *tty, struct 
usb_serial_port *port,
+       }
+ 
+       if (urb->transfer_buffer == NULL) {
+-              urb->transfer_buffer =
+-                  kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
++              urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
++                                             GFP_ATOMIC);
+               if (!urb->transfer_buffer)
+                       goto exit;
+       }
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
+index 006a2a721edf..2bc169692965 100644
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -275,6 +275,12 @@ static void option_instat_callback(struct urb *urb);
+ #define TELIT_PRODUCT_LE920                   0x1200
+ #define TELIT_PRODUCT_LE910                   0x1201
+ #define TELIT_PRODUCT_LE910_USBCFG4           0x1206
++#define TELIT_PRODUCT_LE920A4_1207            0x1207
++#define TELIT_PRODUCT_LE920A4_1208            0x1208
++#define TELIT_PRODUCT_LE920A4_1211            0x1211
++#define TELIT_PRODUCT_LE920A4_1212            0x1212
++#define TELIT_PRODUCT_LE920A4_1213            0x1213
++#define TELIT_PRODUCT_LE920A4_1214            0x1214
+ 
+ /* ZTE PRODUCTS */
+ #define ZTE_VENDOR_ID                         0x19d2
+@@ -636,6 +642,11 @@ static const struct option_blacklist_info 
telit_le920_blacklist = {
+       .reserved = BIT(1) | BIT(5),
+ };
+ 
++static const struct option_blacklist_info telit_le920a4_blacklist_1 = {
++      .sendsetup = BIT(0),
++      .reserved = BIT(1),
++};
++
+ static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
+       .sendsetup = BIT(2),
+       .reserved = BIT(0) | BIT(1) | BIT(3),
+@@ -1211,6 +1222,16 @@ static const struct usb_device_id option_ids[] = {
+               .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
+       { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
+               .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
++      { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) },
++      { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208),
++              .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
++      { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211),
++              .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
++      { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212),
++              .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
++      { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 
TELIT_PRODUCT_LE920A4_1213, 0xff) },
++      { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
++              .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
+       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 
0xff, 0xff) }, /* ZTE WCDMA products */
+       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 
0xff),
+               .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
+@@ -1839,6 +1860,7 @@ static const struct usb_device_id option_ids[] = {
+         .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+       { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* 
D-Link DWM-152/C1 */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* 
D-Link DWM-156/C1 */
++      { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* 
D-Link DWM-156/A3 */
+       { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* 
OLICARD300 - MT6225 */
+       { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
+       { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
+diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
+index 3d66e9c5a95d..a5308a97f65e 100644
+--- a/drivers/usb/serial/usb-serial.c
++++ b/drivers/usb/serial/usb-serial.c
+@@ -1426,7 +1426,7 @@ int usb_serial_register_drivers(struct usb_serial_driver 
*const serial_drivers[]
+ 
+       rc = usb_register(udriver);
+       if (rc)
+-              return rc;
++              goto failed_usb_register;
+ 
+       for (sd = serial_drivers; *sd; ++sd) {
+               (*sd)->usb_driver = udriver;
+@@ -1444,6 +1444,8 @@ int usb_serial_register_drivers(struct usb_serial_driver 
*const serial_drivers[]
+       while (sd-- > serial_drivers)
+               usb_serial_deregister(*sd);
+       usb_deregister(udriver);
++failed_usb_register:
++      kfree(udriver);
+       return rc;
+ }
+ EXPORT_SYMBOL_GPL(usb_serial_register_drivers);
+diff --git a/fs/seq_file.c b/fs/seq_file.c
+index 1d641bb108d2..d88584c61c1e 100644
+--- a/fs/seq_file.c
++++ b/fs/seq_file.c
+@@ -207,8 +207,10 @@ ssize_t seq_read(struct file *file, char __user *buf, 
size_t size, loff_t *ppos)
+               size -= n;
+               buf += n;
+               copied += n;
+-              if (!m->count)
++              if (!m->count) {
++                      m->from = 0;
+                       m->index++;
++              }
+               if (!size)
+                       goto Done;
+       }
+diff --git a/include/linux/i8042.h b/include/linux/i8042.h
+index 0f9bafa17a02..d98780ca9604 100644
+--- a/include/linux/i8042.h
++++ b/include/linux/i8042.h
+@@ -62,7 +62,6 @@ struct serio;
+ void i8042_lock_chip(void);
+ void i8042_unlock_chip(void);
+ int i8042_command(unsigned char *param, int command);
+-bool i8042_check_port_owner(const struct serio *);
+ int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
+                                       struct serio *serio));
+ int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
+@@ -83,11 +82,6 @@ static inline int i8042_command(unsigned char *param, int 
command)
+       return -ENODEV;
+ }
+ 
+-static inline bool i8042_check_port_owner(const struct serio *serio)
+-{
+-      return false;
+-}
+-
+ static inline int i8042_install_filter(bool (*filter)(unsigned char data, 
unsigned char str,
+                                       struct serio *serio))
+ {
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
+index 057c1d8c77e5..b3bf527d211b 100644
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -2473,6 +2473,13 @@
+ #define PCI_DEVICE_ID_KORENIX_JETCARDF2       0x1700
+ #define PCI_DEVICE_ID_KORENIX_JETCARDF3       0x17ff
+ 
++#define PCI_VENDOR_ID_NETRONOME               0x19ee
++#define PCI_DEVICE_ID_NETRONOME_NFP3200       0x3200
++#define PCI_DEVICE_ID_NETRONOME_NFP3240       0x3240
++#define PCI_DEVICE_ID_NETRONOME_NFP4000       0x4000
++#define PCI_DEVICE_ID_NETRONOME_NFP6000       0x6000
++#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF    0x6003
++
+ #define PCI_VENDOR_ID_QMI             0x1a32
+ 
+ #define PCI_VENDOR_ID_AZWAVE          0x1a3b
+diff --git a/include/linux/serio.h b/include/linux/serio.h
+index 9f779c7a2da4..27ae809edd70 100644
+--- a/include/linux/serio.h
++++ b/include/linux/serio.h
+@@ -29,7 +29,8 @@ struct serio {
+ 
+       struct serio_device_id id;
+ 
+-      spinlock_t lock;                /* protects critical sections from 
port's interrupt handler */
++      /* Protects critical sections from port's interrupt handler */
++      spinlock_t lock;
+ 
+       int (*write)(struct serio *, unsigned char);
+       int (*open)(struct serio *);
+@@ -38,16 +39,29 @@ struct serio {
+       void (*stop)(struct serio *);
+ 
+       struct serio *parent;
+-      struct list_head child_node;    /* Entry in parent->children list */
++      /* Entry in parent->children list */
++      struct list_head child_node;
+       struct list_head children;
+-      unsigned int depth;             /* level of nesting in serio hierarchy 
*/
++      /* Level of nesting in serio hierarchy */
++      unsigned int depth;
+ 
+-      struct serio_driver *drv;       /* accessed from interrupt, must be 
protected by serio->lock and serio->sem */
+-      struct mutex drv_mutex;         /* protects serio->drv so attributes 
can pin driver */
++      /*
++       * serio->drv is accessed from interrupt handlers; when modifying
++       * caller should acquire serio->drv_mutex and serio->lock.
++       */
++      struct serio_driver *drv;
++      /* Protects serio->drv so attributes can pin current driver */
++      struct mutex drv_mutex;
+ 
+       struct device dev;
+ 
+       struct list_head node;
++
++      /*
++       * For use by PS/2 layer when several ports share hardware and
++       * may get indigestion when exposed to concurrent access (i8042).
++       */
++      struct mutex *ps2_cmd_mutex;
+ };
+ #define to_serio_port(d)      container_of(d, struct serio, dev)
+ 
+diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
+index aa33fd1b2d4f..bff03877a2c8 100644
+--- a/include/uapi/linux/usb/ch9.h
++++ b/include/uapi/linux/usb/ch9.h
+@@ -913,6 +913,7 @@ enum usb_device_speed {
+       USB_SPEED_HIGH,                         /* usb 2.0 */
+       USB_SPEED_WIRELESS,                     /* wireless (usb 2.5) */
+       USB_SPEED_SUPER,                        /* usb 3.0 */
++      USB_SPEED_SUPER_PLUS,                   /* usb 3.1 */
+ };
+ 
+ 
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
+index 453e974287d1..ccaffd79dc6d 100644
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -1126,7 +1126,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct 
net_device *dev)
+ 
+       /* free all potentially still buffered bcast frames */
+       local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
+-      skb_queue_purge(&sdata->u.ap.ps.bc_buf);
++      ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
+ 
+       ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
+       mutex_lock(&local->mtx);
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index bc08a9ce3bd4..0f334c15ec9d 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -351,7 +351,7 @@ static void purge_old_ps_buffers(struct ieee80211_local 
*local)
+               skb = skb_dequeue(&ps->bc_buf);
+               if (skb) {
+                       purged++;
+-                      dev_kfree_skb(skb);
++                      ieee80211_free_txskb(&local->hw, skb);
+               }
+               total += skb_queue_len(&ps->bc_buf);
+       }
+@@ -434,7 +434,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data 
*tx)
+       if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) {
+               ps_dbg(tx->sdata,
+                      "BC TX buffer full - dropping the oldest frame\n");
+-              dev_kfree_skb(skb_dequeue(&ps->bc_buf));
++              ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
+       } else
+               tx->local->total_ps_buffered++;
+ 
+@@ -2910,7 +2910,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
+                       sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
+               if (!ieee80211_tx_prepare(sdata, &tx, skb))
+                       break;
+-              dev_kfree_skb_any(skb);
++              ieee80211_free_txskb(hw, skb);
+       }
+ 
+       info = IEEE80211_SKB_CB(skb);

Reply via email to