]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Jul 2018 12:35:51 +0000 (14:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Jul 2018 12:35:51 +0000 (14:35 +0200)
added patches:
ahci-disable-lpm-on-lenovo-50-series-laptops-with-a-too-old-bios.patch
ata-fix-zbc_out-all-bit-handling.patch
ata-fix-zbc_out-command-block-check.patch
ibmasm-don-t-write-out-of-bounds-in-read-handler.patch
mips-call-dump_stack-from-show_regs.patch
mips-fix-ioremap-ram-check.patch
mips-use-async-ipis-for-arch_trigger_cpumask_backtrace.patch
mmc-dw_mmc-fix-card-threshold-control-configuration.patch
nvme-validate-admin-queue-before-unquiesce.patch
usb-quirks-add-delay-quirks-for-corsair-strafe.patch
usb-serial-ch341-fix-type-promotion-bug-in-ch341_control_in.patch
usb-serial-cp210x-add-another-usb-id-for-qivicon-zigbee-stick.patch
usb-serial-keyspan_pda-fix-modem-status-error-handling.patch
usb-serial-mos7840-fix-status-register-error-handling.patch
usb-yurex-fix-out-of-bounds-uaccess-in-read-handler.patch
vmw_balloon-fix-inflation-with-batching.patch
xhci-xhci-mem-off-by-one-in-xhci_stream_id_to_ring.patch

18 files changed:
queue-4.9/ahci-disable-lpm-on-lenovo-50-series-laptops-with-a-too-old-bios.patch [new file with mode: 0644]
queue-4.9/ata-fix-zbc_out-all-bit-handling.patch [new file with mode: 0644]
queue-4.9/ata-fix-zbc_out-command-block-check.patch [new file with mode: 0644]
queue-4.9/ibmasm-don-t-write-out-of-bounds-in-read-handler.patch [new file with mode: 0644]
queue-4.9/mips-call-dump_stack-from-show_regs.patch [new file with mode: 0644]
queue-4.9/mips-fix-ioremap-ram-check.patch [new file with mode: 0644]
queue-4.9/mips-use-async-ipis-for-arch_trigger_cpumask_backtrace.patch [new file with mode: 0644]
queue-4.9/mmc-dw_mmc-fix-card-threshold-control-configuration.patch [new file with mode: 0644]
queue-4.9/nvme-validate-admin-queue-before-unquiesce.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/usb-quirks-add-delay-quirks-for-corsair-strafe.patch [new file with mode: 0644]
queue-4.9/usb-serial-ch341-fix-type-promotion-bug-in-ch341_control_in.patch [new file with mode: 0644]
queue-4.9/usb-serial-cp210x-add-another-usb-id-for-qivicon-zigbee-stick.patch [new file with mode: 0644]
queue-4.9/usb-serial-keyspan_pda-fix-modem-status-error-handling.patch [new file with mode: 0644]
queue-4.9/usb-serial-mos7840-fix-status-register-error-handling.patch [new file with mode: 0644]
queue-4.9/usb-yurex-fix-out-of-bounds-uaccess-in-read-handler.patch [new file with mode: 0644]
queue-4.9/vmw_balloon-fix-inflation-with-batching.patch [new file with mode: 0644]
queue-4.9/xhci-xhci-mem-off-by-one-in-xhci_stream_id_to_ring.patch [new file with mode: 0644]

diff --git a/queue-4.9/ahci-disable-lpm-on-lenovo-50-series-laptops-with-a-too-old-bios.patch b/queue-4.9/ahci-disable-lpm-on-lenovo-50-series-laptops-with-a-too-old-bios.patch
new file mode 100644 (file)
index 0000000..12961e2
--- /dev/null
@@ -0,0 +1,149 @@
+From 240630e61870e62e39a97225048f9945848fa5f5 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Sun, 1 Jul 2018 12:15:46 +0200
+Subject: ahci: Disable LPM on Lenovo 50 series laptops with a too old BIOS
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 240630e61870e62e39a97225048f9945848fa5f5 upstream.
+
+There have been several reports of LPM related hard freezes about once
+a day on multiple Lenovo 50 series models. Strange enough these reports
+where not disk model specific as LPM issues usually are and some users
+with the exact same disk + laptop where seeing them while other users
+where not seeing these issues.
+
+It turns out that enabling LPM triggers a firmware bug somewhere, which
+has been fixed in later BIOS versions.
+
+This commit adds a new ahci_broken_lpm() function and a new ATA_FLAG_NO_LPM
+for dealing with this.
+
+The ahci_broken_lpm() function contains DMI match info for the 4 models
+which are known to be affected by this and the DMI BIOS date field for
+known good BIOS versions. If the BIOS date is older then the one in the
+table LPM will be disabled and a warning will be printed.
+
+Note the BIOS dates are for known good versions, some older versions may
+work too, but we don't know for sure, the table is using dates from BIOS
+versions for which users have confirmed that upgrading to that version
+makes the problem go away.
+
+Unfortunately I've been unable to get hold of the reporter who reported
+that BIOS version 2.35 fixed the problems on the W541 for him. I've been
+able to verify the DMI_SYS_VENDOR and DMI_PRODUCT_VERSION from an older
+dmidecode, but I don't know the exact BIOS date as reported in the DMI.
+Lenovo keeps a changelog with dates in their release notes, but the
+dates there are the release dates not the build dates which are in DMI.
+So I've chosen to set the date to which we compare to one day past the
+release date of the 2.34 BIOS. I plan to fix this with a follow up
+commit once I've the necessary info.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci.c        |   59 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/ata/libata-core.c |    3 ++
+ include/linux/libata.h    |    1 
+ 3 files changed, 63 insertions(+)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -1260,6 +1260,59 @@ static bool ahci_broken_suspend(struct p
+       return strcmp(buf, dmi->driver_data) < 0;
+ }
++static bool ahci_broken_lpm(struct pci_dev *pdev)
++{
++      static const struct dmi_system_id sysids[] = {
++              /* Various Lenovo 50 series have LPM issues with older BIOSen */
++              {
++                      .matches = {
++                              DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                              DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X250"),
++                      },
++                      .driver_data = "20180406", /* 1.31 */
++              },
++              {
++                      .matches = {
++                              DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                              DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L450"),
++                      },
++                      .driver_data = "20180420", /* 1.28 */
++              },
++              {
++                      .matches = {
++                              DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                              DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T450s"),
++                      },
++                      .driver_data = "20180315", /* 1.33 */
++              },
++              {
++                      .matches = {
++                              DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                              DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"),
++                      },
++                      /*
++                       * Note date based on release notes, 2.35 has been
++                       * reported to be good, but I've been unable to get
++                       * a hold of the reporter to get the DMI BIOS date.
++                       * TODO: fix this.
++                       */
++                      .driver_data = "20180310", /* 2.35 */
++              },
++              { }     /* terminate list */
++      };
++      const struct dmi_system_id *dmi = dmi_first_match(sysids);
++      int year, month, date;
++      char buf[9];
++
++      if (!dmi)
++              return false;
++
++      dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
++      snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
++
++      return strcmp(buf, dmi->driver_data) < 0;
++}
++
+ static bool ahci_broken_online(struct pci_dev *pdev)
+ {
+ #define ENCODE_BUSDEVFN(bus, slot, func)                      \
+@@ -1626,6 +1679,12 @@ static int ahci_init_one(struct pci_dev
+                       "quirky BIOS, skipping spindown on poweroff\n");
+       }
++      if (ahci_broken_lpm(pdev)) {
++              pi.flags |= ATA_FLAG_NO_LPM;
++              dev_warn(&pdev->dev,
++                       "BIOS update required for Link Power Management support\n");
++      }
++
+       if (ahci_broken_suspend(pdev)) {
+               hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
+               dev_warn(&pdev->dev,
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -2385,6 +2385,9 @@ int ata_dev_configure(struct ata_device
+           (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2)
+               dev->horkage |= ATA_HORKAGE_NOLPM;
++      if (ap->flags & ATA_FLAG_NO_LPM)
++              dev->horkage |= ATA_HORKAGE_NOLPM;
++
+       if (dev->horkage & ATA_HORKAGE_NOLPM) {
+               ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
+               dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -208,6 +208,7 @@ enum {
+       ATA_FLAG_SLAVE_POSS     = (1 << 0), /* host supports slave dev */
+                                           /* (doesn't imply presence) */
+       ATA_FLAG_SATA           = (1 << 1),
++      ATA_FLAG_NO_LPM         = (1 << 2), /* host not happy with LPM */
+       ATA_FLAG_NO_LOG_PAGE    = (1 << 5), /* do not issue log page read */
+       ATA_FLAG_NO_ATAPI       = (1 << 6), /* No ATAPI support */
+       ATA_FLAG_PIO_DMA        = (1 << 7), /* PIO cmds via DMA */
diff --git a/queue-4.9/ata-fix-zbc_out-all-bit-handling.patch b/queue-4.9/ata-fix-zbc_out-all-bit-handling.patch
new file mode 100644 (file)
index 0000000..8bf5375
--- /dev/null
@@ -0,0 +1,49 @@
+From 6edf1d4cb0acde3a0a5dac849f33031bd7abb7b1 Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Tue, 26 Jun 2018 20:56:55 +0900
+Subject: ata: Fix ZBC_OUT all bit handling
+
+From: Damien Le Moal <damien.lemoal@wdc.com>
+
+commit 6edf1d4cb0acde3a0a5dac849f33031bd7abb7b1 upstream.
+
+If the ALL bit is set in the ZBC_OUT command, the command zone ID field
+(block) should be ignored.
+
+Reported-by: David Butterfield <david.butterfield@wdc.com>
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-scsi.c |   11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -3772,7 +3772,14 @@ static unsigned int ata_scsi_zbc_out_xla
+                */
+               goto invalid_param_len;
+       }
+-      if (block >= dev->n_sectors) {
++
++      all = cdb[14] & 0x1;
++      if (all) {
++              /*
++               * Ignore the block address (zone ID) as defined by ZBC.
++               */
++              block = 0;
++      } else if (block >= dev->n_sectors) {
+               /*
+                * Block must be a valid zone ID (a zone start LBA).
+                */
+@@ -3780,8 +3787,6 @@ static unsigned int ata_scsi_zbc_out_xla
+               goto invalid_fld;
+       }
+-      all = cdb[14] & 0x1;
+-
+       if (ata_ncq_enabled(qc->dev) &&
+           ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
+               tf->protocol = ATA_PROT_NCQ_NODATA;
diff --git a/queue-4.9/ata-fix-zbc_out-command-block-check.patch b/queue-4.9/ata-fix-zbc_out-command-block-check.patch
new file mode 100644 (file)
index 0000000..6932bf3
--- /dev/null
@@ -0,0 +1,56 @@
+From b320a0a9f23c98f21631eb27bcbbca91c79b1c6e Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Tue, 26 Jun 2018 20:56:54 +0900
+Subject: ata: Fix ZBC_OUT command block check
+
+From: Damien Le Moal <damien.lemoal@wdc.com>
+
+commit b320a0a9f23c98f21631eb27bcbbca91c79b1c6e upstream.
+
+The block (LBA) specified must not exceed the last addressable LBA,
+which is dev->nr_sectors - 1. So fix the correct check is
+"if (block >= dev->n_sectors)" and not "if (block > dev->n_sectords)".
+
+Additionally, the asc/ascq to return for an LBA that is not a zone start
+LBA should be ILLEGAL REQUEST, regardless if the bad LBA is out of
+range.
+
+Reported-by: David Butterfield <david.butterfield@wdc.com>
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/libata-scsi.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -3772,8 +3772,13 @@ static unsigned int ata_scsi_zbc_out_xla
+                */
+               goto invalid_param_len;
+       }
+-      if (block > dev->n_sectors)
+-              goto out_of_range;
++      if (block >= dev->n_sectors) {
++              /*
++               * Block must be a valid zone ID (a zone start LBA).
++               */
++              fp = 2;
++              goto invalid_fld;
++      }
+       all = cdb[14] & 0x1;
+@@ -3804,10 +3809,6 @@ static unsigned int ata_scsi_zbc_out_xla
+  invalid_fld:
+       ata_scsi_set_invalid_field(qc->dev, scmd, fp, 0xff);
+       return 1;
+- out_of_range:
+-      /* "Logical Block Address out of range" */
+-      ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x21, 0x00);
+-      return 1;
+ invalid_param_len:
+       /* "Parameter list length error" */
+       ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x1a, 0x0);
diff --git a/queue-4.9/ibmasm-don-t-write-out-of-bounds-in-read-handler.patch b/queue-4.9/ibmasm-don-t-write-out-of-bounds-in-read-handler.patch
new file mode 100644 (file)
index 0000000..2614298
--- /dev/null
@@ -0,0 +1,63 @@
+From a0341fc1981a950c1e902ab901e98f60e0e243f3 Mon Sep 17 00:00:00 2001
+From: Jann Horn <jannh@google.com>
+Date: Sat, 7 Jul 2018 04:16:33 +0200
+Subject: ibmasm: don't write out of bounds in read handler
+
+From: Jann Horn <jannh@google.com>
+
+commit a0341fc1981a950c1e902ab901e98f60e0e243f3 upstream.
+
+This read handler had a lot of custom logic and wrote outside the bounds of
+the provided buffer. This could lead to kernel and userspace memory
+corruption. Just use simple_read_from_buffer() with a stack buffer.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jann Horn <jannh@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/ibmasm/ibmasmfs.c |   27 +++------------------------
+ 1 file changed, 3 insertions(+), 24 deletions(-)
+
+--- a/drivers/misc/ibmasm/ibmasmfs.c
++++ b/drivers/misc/ibmasm/ibmasmfs.c
+@@ -507,35 +507,14 @@ static int remote_settings_file_close(st
+ static ssize_t remote_settings_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
+ {
+       void __iomem *address = (void __iomem *)file->private_data;
+-      unsigned char *page;
+-      int retval;
+       int len = 0;
+       unsigned int value;
+-
+-      if (*offset < 0)
+-              return -EINVAL;
+-      if (count == 0 || count > 1024)
+-              return 0;
+-      if (*offset != 0)
+-              return 0;
+-
+-      page = (unsigned char *)__get_free_page(GFP_KERNEL);
+-      if (!page)
+-              return -ENOMEM;
++      char lbuf[20];
+       value = readl(address);
+-      len = sprintf(page, "%d\n", value);
+-
+-      if (copy_to_user(buf, page, len)) {
+-              retval = -EFAULT;
+-              goto exit;
+-      }
+-      *offset += len;
+-      retval = len;
++      len = snprintf(lbuf, sizeof(lbuf), "%d\n", value);
+-exit:
+-      free_page((unsigned long)page);
+-      return retval;
++      return simple_read_from_buffer(buf, count, offset, lbuf, len);
+ }
+ static ssize_t remote_settings_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset)
diff --git a/queue-4.9/mips-call-dump_stack-from-show_regs.patch b/queue-4.9/mips-call-dump_stack-from-show_regs.patch
new file mode 100644 (file)
index 0000000..cd36599
--- /dev/null
@@ -0,0 +1,71 @@
+From 5a267832c2ec47b2dad0fdb291a96bb5b8869315 Mon Sep 17 00:00:00 2001
+From: Paul Burton <paul.burton@mips.com>
+Date: Fri, 22 Jun 2018 10:55:45 -0700
+Subject: MIPS: Call dump_stack() from show_regs()
+
+From: Paul Burton <paul.burton@mips.com>
+
+commit 5a267832c2ec47b2dad0fdb291a96bb5b8869315 upstream.
+
+The generic nmi_cpu_backtrace() function calls show_regs() when a struct
+pt_regs is available, and dump_stack() otherwise. If we were to make use
+of the generic nmi_cpu_backtrace() with MIPS' current implementation of
+show_regs() this would mean that we see only register data with no
+accompanying stack information, in contrast with our current
+implementation which calls dump_stack() regardless of whether register
+state is available.
+
+In preparation for making use of the generic nmi_cpu_backtrace() to
+implement arch_trigger_cpumask_backtrace(), have our implementation of
+show_regs() call dump_stack() and drop the explicit dump_stack() call in
+arch_dump_stack() which is invoked by arch_trigger_cpumask_backtrace().
+
+This will allow the output we produce to remain the same after a later
+patch switches to using nmi_cpu_backtrace(). It may mean that we produce
+extra stack output in other uses of show_regs(), but this:
+
+  1) Seems harmless.
+  2) Is good for consistency between arch_trigger_cpumask_backtrace()
+     and other users of show_regs().
+  3) Matches the behaviour of the ARM & PowerPC architectures.
+
+Marked for stable back to v4.9 as a prerequisite of the following patch
+"MIPS: Call dump_stack() from show_regs()".
+
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Patchwork: https://patchwork.linux-mips.org/patch/19596/
+Cc: James Hogan <jhogan@kernel.org>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: Huacai Chen <chenhc@lemote.com>
+Cc: linux-mips@linux-mips.org
+Cc: stable@vger.kernel.org # v4.9+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/kernel/process.c |    4 ++--
+ arch/mips/kernel/traps.c   |    1 +
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/kernel/process.c
++++ b/arch/mips/kernel/process.c
+@@ -641,8 +641,8 @@ static void arch_dump_stack(void *info)
+       if (regs)
+               show_regs(regs);
+-
+-      dump_stack();
++      else
++              dump_stack();
+ }
+ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
+--- a/arch/mips/kernel/traps.c
++++ b/arch/mips/kernel/traps.c
+@@ -351,6 +351,7 @@ static void __show_regs(const struct pt_
+ void show_regs(struct pt_regs *regs)
+ {
+       __show_regs((struct pt_regs *)regs);
++      dump_stack();
+ }
+ void show_registers(struct pt_regs *regs)
diff --git a/queue-4.9/mips-fix-ioremap-ram-check.patch b/queue-4.9/mips-fix-ioremap-ram-check.patch
new file mode 100644 (file)
index 0000000..1a388ac
--- /dev/null
@@ -0,0 +1,125 @@
+From 523402fa9101090c91d2033b7ebdfdcf65880488 Mon Sep 17 00:00:00 2001
+From: Paul Burton <paul.burton@mips.com>
+Date: Thu, 5 Jul 2018 14:37:52 -0700
+Subject: MIPS: Fix ioremap() RAM check
+
+From: Paul Burton <paul.burton@mips.com>
+
+commit 523402fa9101090c91d2033b7ebdfdcf65880488 upstream.
+
+We currently attempt to check whether a physical address range provided
+to __ioremap() may be in use by the page allocator by examining the
+value of PageReserved for each page in the region - lowmem pages not
+marked reserved are presumed to be in use by the page allocator, and
+requests to ioremap them fail.
+
+The way we check this has been broken since commit 92923ca3aace ("mm:
+meminit: only set page reserved in the memblock region"), because
+memblock will typically not have any knowledge of non-RAM pages and
+therefore those pages will not have the PageReserved flag set. Thus when
+we attempt to ioremap a region outside of RAM we incorrectly fail
+believing that the region is RAM that may be in use.
+
+In most cases ioremap() on MIPS will take a fast-path to use the
+unmapped kseg1 or xkphys virtual address spaces and never hit this path,
+so the only way to hit it is for a MIPS32 system to attempt to ioremap()
+an address range in lowmem with flags other than _CACHE_UNCACHED.
+Perhaps the most straightforward way to do this is using
+ioremap_uncached_accelerated(), which is how the problem was discovered.
+
+Fix this by making use of walk_system_ram_range() to test the address
+range provided to __ioremap() against only RAM pages, rather than all
+lowmem pages. This means that if we have a lowmem I/O region, which is
+very common for MIPS systems, we're free to ioremap() address ranges
+within it. A nice bonus is that the test is no longer limited to lowmem.
+
+The approach here matches the way x86 performed the same test after
+commit c81c8a1eeede ("x86, ioremap: Speed up check for RAM pages") until
+x86 moved towards a slightly more complicated check using walk_mem_res()
+for unrelated reasons with commit 0e4c12b45aa8 ("x86/mm, resource: Use
+PAGE_KERNEL protection for ioremap of memory pages").
+
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Reported-by: Serge Semin <fancer.lancer@gmail.com>
+Tested-by: Serge Semin <fancer.lancer@gmail.com>
+Fixes: 92923ca3aace ("mm: meminit: only set page reserved in the memblock region")
+Cc: James Hogan <jhogan@kernel.org>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: linux-mips@linux-mips.org
+Cc: stable@vger.kernel.org # v4.2+
+Patchwork: https://patchwork.linux-mips.org/patch/19786/
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/mm/ioremap.c |   37 +++++++++++++++++++++++++------------
+ 1 file changed, 25 insertions(+), 12 deletions(-)
+
+--- a/arch/mips/mm/ioremap.c
++++ b/arch/mips/mm/ioremap.c
+@@ -9,6 +9,7 @@
+ #include <linux/export.h>
+ #include <asm/addrspace.h>
+ #include <asm/byteorder.h>
++#include <linux/ioport.h>
+ #include <linux/sched.h>
+ #include <linux/slab.h>
+ #include <linux/vmalloc.h>
+@@ -97,6 +98,20 @@ static int remap_area_pages(unsigned lon
+       return error;
+ }
++static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
++                             void *arg)
++{
++      unsigned long i;
++
++      for (i = 0; i < nr_pages; i++) {
++              if (pfn_valid(start_pfn + i) &&
++                  !PageReserved(pfn_to_page(start_pfn + i)))
++                      return 1;
++      }
++
++      return 0;
++}
++
+ /*
+  * Generic mapping function (not visible outside):
+  */
+@@ -115,8 +130,8 @@ static int remap_area_pages(unsigned lon
+ void __iomem * __ioremap(phys_addr_t phys_addr, phys_addr_t size, unsigned long flags)
+ {
++      unsigned long offset, pfn, last_pfn;
+       struct vm_struct * area;
+-      unsigned long offset;
+       phys_addr_t last_addr;
+       void * addr;
+@@ -136,18 +151,16 @@ void __iomem * __ioremap(phys_addr_t phy
+               return (void __iomem *) CKSEG1ADDR(phys_addr);
+       /*
+-       * Don't allow anybody to remap normal RAM that we're using..
++       * Don't allow anybody to remap RAM that may be allocated by the page
++       * allocator, since that could lead to races & data clobbering.
+        */
+-      if (phys_addr < virt_to_phys(high_memory)) {
+-              char *t_addr, *t_end;
+-              struct page *page;
+-
+-              t_addr = __va(phys_addr);
+-              t_end = t_addr + (size - 1);
+-
+-              for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
+-                      if(!PageReserved(page))
+-                              return NULL;
++      pfn = PFN_DOWN(phys_addr);
++      last_pfn = PFN_DOWN(last_addr);
++      if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
++                                __ioremap_check_ram) == 1) {
++              WARN_ONCE(1, "ioremap on RAM at %pa - %pa\n",
++                        &phys_addr, &last_addr);
++              return NULL;
+       }
+       /*
diff --git a/queue-4.9/mips-use-async-ipis-for-arch_trigger_cpumask_backtrace.patch b/queue-4.9/mips-use-async-ipis-for-arch_trigger_cpumask_backtrace.patch
new file mode 100644 (file)
index 0000000..a3974de
--- /dev/null
@@ -0,0 +1,180 @@
+From b63e132b6433a41cf311e8bc382d33fd2b73b505 Mon Sep 17 00:00:00 2001
+From: Paul Burton <paul.burton@mips.com>
+Date: Fri, 22 Jun 2018 10:55:46 -0700
+Subject: MIPS: Use async IPIs for arch_trigger_cpumask_backtrace()
+
+From: Paul Burton <paul.burton@mips.com>
+
+commit b63e132b6433a41cf311e8bc382d33fd2b73b505 upstream.
+
+The current MIPS implementation of arch_trigger_cpumask_backtrace() is
+broken because it attempts to use synchronous IPIs despite the fact that
+it may be run with interrupts disabled.
+
+This means that when arch_trigger_cpumask_backtrace() is invoked, for
+example by the RCU CPU stall watchdog, we may:
+
+  - Deadlock due to use of synchronous IPIs with interrupts disabled,
+    causing the CPU that's attempting to generate the backtrace output
+    to hang itself.
+
+  - Not succeed in generating the desired output from remote CPUs.
+
+  - Produce warnings about this from smp_call_function_many(), for
+    example:
+
+    [42760.526910] INFO: rcu_sched detected stalls on CPUs/tasks:
+    [42760.535755]  0-...!: (1 GPs behind) idle=ade/140000000000000/0 softirq=526944/526945 fqs=0
+    [42760.547874]  1-...!: (0 ticks this GP) idle=e4a/140000000000000/0 softirq=547885/547885 fqs=0
+    [42760.559869]  (detected by 2, t=2162 jiffies, g=266689, c=266688, q=33)
+    [42760.568927] ------------[ cut here ]------------
+    [42760.576146] WARNING: CPU: 2 PID: 1216 at kernel/smp.c:416 smp_call_function_many+0x88/0x20c
+    [42760.587839] Modules linked in:
+    [42760.593152] CPU: 2 PID: 1216 Comm: sh Not tainted 4.15.4-00373-gee058bb4d0c2 #2
+    [42760.603767] Stack : 8e09bd20 8e09bd20 8e09bd20 fffffff0 00000007 00000006 00000000 8e09bca8
+    [42760.616937]         95b2b379 95b2b379 807a0080 00000007 81944518 0000018a 00000032 00000000
+    [42760.630095]         00000000 00000030 80000000 00000000 806eca74 00000009 8017e2b8 000001a0
+    [42760.643169]         00000000 00000002 00000000 8e09baa4 00000008 808b8008 86d69080 8e09bca0
+    [42760.656282]         8e09ad50 805e20aa 00000000 00000000 00000000 8017e2b8 00000009 801070ca
+    [42760.669424]         ...
+    [42760.673919] Call Trace:
+    [42760.678672] [<27fde568>] show_stack+0x70/0xf0
+    [42760.685417] [<84751641>] dump_stack+0xaa/0xd0
+    [42760.692188] [<699d671c>] __warn+0x80/0x92
+    [42760.698549] [<68915d41>] warn_slowpath_null+0x28/0x36
+    [42760.705912] [<f7c76c1c>] smp_call_function_many+0x88/0x20c
+    [42760.713696] [<6bbdfc2a>] arch_trigger_cpumask_backtrace+0x30/0x4a
+    [42760.722216] [<f845bd33>] rcu_dump_cpu_stacks+0x6a/0x98
+    [42760.729580] [<796e7629>] rcu_check_callbacks+0x672/0x6ac
+    [42760.737476] [<059b3b43>] update_process_times+0x18/0x34
+    [42760.744981] [<6eb94941>] tick_sched_handle.isra.5+0x26/0x38
+    [42760.752793] [<478d3d70>] tick_sched_timer+0x1c/0x50
+    [42760.759882] [<e56ea39f>] __hrtimer_run_queues+0xc6/0x226
+    [42760.767418] [<e88bbcae>] hrtimer_interrupt+0x88/0x19a
+    [42760.775031] [<6765a19e>] gic_compare_interrupt+0x2e/0x3a
+    [42760.782761] [<0558bf5f>] handle_percpu_devid_irq+0x78/0x168
+    [42760.790795] [<90c11ba2>] generic_handle_irq+0x1e/0x2c
+    [42760.798117] [<1b6d462c>] gic_handle_local_int+0x38/0x86
+    [42760.805545] [<b2ada1c7>] gic_irq_dispatch+0xa/0x14
+    [42760.812534] [<90c11ba2>] generic_handle_irq+0x1e/0x2c
+    [42760.820086] [<c7521934>] do_IRQ+0x16/0x20
+    [42760.826274] [<9aef3ce6>] plat_irq_dispatch+0x62/0x94
+    [42760.833458] [<6a94b53c>] except_vec_vi_end+0x70/0x78
+    [42760.840655] [<22284043>] smp_call_function_many+0x1ba/0x20c
+    [42760.848501] [<54022b58>] smp_call_function+0x1e/0x2c
+    [42760.855693] [<ab9fc705>] flush_tlb_mm+0x2a/0x98
+    [42760.862730] [<0844cdd0>] tlb_flush_mmu+0x1c/0x44
+    [42760.869628] [<cb259b74>] arch_tlb_finish_mmu+0x26/0x3e
+    [42760.877021] [<1aeaaf74>] tlb_finish_mmu+0x18/0x66
+    [42760.883907] [<b3fce717>] exit_mmap+0x76/0xea
+    [42760.890428] [<c4c8a2f6>] mmput+0x80/0x11a
+    [42760.896632] [<a41a08f4>] do_exit+0x1f4/0x80c
+    [42760.903158] [<ee01cef6>] do_group_exit+0x20/0x7e
+    [42760.909990] [<13fa8d54>] __wake_up_parent+0x0/0x1e
+    [42760.917045] [<46cf89d0>] smp_call_function_many+0x1a2/0x20c
+    [42760.924893] [<8c21a93b>] syscall_common+0x14/0x1c
+    [42760.931765] ---[ end trace 02aa09da9dc52a60 ]---
+    [42760.938342] ------------[ cut here ]------------
+    [42760.945311] WARNING: CPU: 2 PID: 1216 at kernel/smp.c:291 smp_call_function_single+0xee/0xf8
+    ...
+
+This patch switches MIPS' arch_trigger_cpumask_backtrace() to use async
+IPIs & smp_call_function_single_async() in order to resolve this
+problem. We ensure use of the pre-allocated call_single_data_t
+structures is serialized by maintaining a cpumask indicating that
+they're busy, and refusing to attempt to send an IPI when a CPU's bit is
+set in this mask. This should only happen if a CPU hasn't responded to a
+previous backtrace IPI - ie. if it's hung - and we print a warning to
+the console in this case.
+
+I've marked this for stable branches as far back as v4.9, to which it
+applies cleanly. Strictly speaking the faulty MIPS implementation can be
+traced further back to commit 856839b76836 ("MIPS: Add
+arch_trigger_all_cpu_backtrace() function") in v3.19, but kernel
+versions v3.19 through v4.8 will require further work to backport due to
+the rework performed in commit 9a01c3ed5cdb ("nmi_backtrace: add more
+trigger_*_cpu_backtrace() methods").
+
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Patchwork: https://patchwork.linux-mips.org/patch/19597/
+Cc: James Hogan <jhogan@kernel.org>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: Huacai Chen <chenhc@lemote.com>
+Cc: linux-mips@linux-mips.org
+Cc: stable@vger.kernel.org # v4.9+
+Fixes: 856839b76836 ("MIPS: Add arch_trigger_all_cpu_backtrace() function")
+Fixes: 9a01c3ed5cdb ("nmi_backtrace: add more trigger_*_cpu_backtrace() methods")
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/kernel/process.c |   45 ++++++++++++++++++++++++++++++---------------
+ 1 file changed, 30 insertions(+), 15 deletions(-)
+
+--- a/arch/mips/kernel/process.c
++++ b/arch/mips/kernel/process.c
+@@ -26,6 +26,7 @@
+ #include <linux/kallsyms.h>
+ #include <linux/random.h>
+ #include <linux/prctl.h>
++#include <linux/nmi.h>
+ #include <asm/asm.h>
+ #include <asm/bootinfo.h>
+@@ -633,28 +634,42 @@ unsigned long arch_align_stack(unsigned
+       return sp & ALMASK;
+ }
+-static void arch_dump_stack(void *info)
+-{
+-      struct pt_regs *regs;
++static DEFINE_PER_CPU(call_single_data_t, backtrace_csd);
++static struct cpumask backtrace_csd_busy;
+-      regs = get_irq_regs();
+-
+-      if (regs)
+-              show_regs(regs);
+-      else
+-              dump_stack();
++static void handle_backtrace(void *info)
++{
++      nmi_cpu_backtrace(get_irq_regs());
++      cpumask_clear_cpu(smp_processor_id(), &backtrace_csd_busy);
+ }
+-void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
++static void raise_backtrace(cpumask_t *mask)
+ {
+-      long this_cpu = get_cpu();
++      call_single_data_t *csd;
++      int cpu;
+-      if (cpumask_test_cpu(this_cpu, mask) && !exclude_self)
+-              dump_stack();
++      for_each_cpu(cpu, mask) {
++              /*
++               * If we previously sent an IPI to the target CPU & it hasn't
++               * cleared its bit in the busy cpumask then it didn't handle
++               * our previous IPI & it's not safe for us to reuse the
++               * call_single_data_t.
++               */
++              if (cpumask_test_and_set_cpu(cpu, &backtrace_csd_busy)) {
++                      pr_warn("Unable to send backtrace IPI to CPU%u - perhaps it hung?\n",
++                              cpu);
++                      continue;
++              }
+-      smp_call_function_many(mask, arch_dump_stack, NULL, 1);
++              csd = &per_cpu(backtrace_csd, cpu);
++              csd->func = handle_backtrace;
++              smp_call_function_single_async(cpu, csd);
++      }
++}
+-      put_cpu();
++void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
++{
++      nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace);
+ }
+ int mips_get_process_fp_mode(struct task_struct *task)
diff --git a/queue-4.9/mmc-dw_mmc-fix-card-threshold-control-configuration.patch b/queue-4.9/mmc-dw_mmc-fix-card-threshold-control-configuration.patch
new file mode 100644 (file)
index 0000000..2fb929a
--- /dev/null
@@ -0,0 +1,49 @@
+From 7a6b9f4d601dfce8cb68f0dcfd834270280e31e6 Mon Sep 17 00:00:00 2001
+From: x00270170 <xiaqing17@hisilicon.com>
+Date: Tue, 3 Jul 2018 15:06:27 +0800
+Subject: mmc: dw_mmc: fix card threshold control configuration
+
+From: x00270170 <xiaqing17@hisilicon.com>
+
+commit 7a6b9f4d601dfce8cb68f0dcfd834270280e31e6 upstream.
+
+Card write threshold control is supposed to be set since controller
+version 2.80a for data write in HS400 mode and data read in
+HS200/HS400/SDR104 mode. However the current code returns without
+configuring it in the case of data writing in HS400 mode.
+Meanwhile the patch fixes that the current code goes to
+'disable' when doing data reading in HS400 mode.
+
+Fixes: 7e4bf1bc9543 ("mmc: dw_mmc: add the card write threshold for HS400 mode")
+Signed-off-by: Qing Xia <xiaqing17@hisilicon.com>
+Cc: stable@vger.kernel.org # v4.8+
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/host/dw_mmc.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/mmc/host/dw_mmc.c
++++ b/drivers/mmc/host/dw_mmc.c
+@@ -981,8 +981,8 @@ static void dw_mci_ctrl_thld(struct dw_m
+        * It's used when HS400 mode is enabled.
+        */
+       if (data->flags & MMC_DATA_WRITE &&
+-              !(host->timing != MMC_TIMING_MMC_HS400))
+-              return;
++              host->timing != MMC_TIMING_MMC_HS400)
++              goto disable;
+       if (data->flags & MMC_DATA_WRITE)
+               enable = SDMMC_CARD_WR_THR_EN;
+@@ -990,7 +990,8 @@ static void dw_mci_ctrl_thld(struct dw_m
+               enable = SDMMC_CARD_RD_THR_EN;
+       if (host->timing != MMC_TIMING_MMC_HS200 &&
+-          host->timing != MMC_TIMING_UHS_SDR104)
++          host->timing != MMC_TIMING_UHS_SDR104 &&
++          host->timing != MMC_TIMING_MMC_HS400)
+               goto disable;
+       blksz_depth = blksz / (1 << host->data_shift);
diff --git a/queue-4.9/nvme-validate-admin-queue-before-unquiesce.patch b/queue-4.9/nvme-validate-admin-queue-before-unquiesce.patch
new file mode 100644 (file)
index 0000000..f74c2be
--- /dev/null
@@ -0,0 +1,78 @@
+From 7dd1ab163c17e11473a65b11f7e748db30618ebb Mon Sep 17 00:00:00 2001
+From: Scott Bauer <scott.bauer@intel.com>
+Date: Tue, 25 Jul 2017 10:27:06 -0600
+Subject: nvme: validate admin queue before unquiesce
+
+From: Scott Bauer <scott.bauer@intel.com>
+
+commit 7dd1ab163c17e11473a65b11f7e748db30618ebb upstream.
+
+With a misbehaving controller it's possible we'll never
+enter the live state and create an admin queue. When we
+fail out of reset work it's possible we failed out early
+enough without setting up the admin queue. We tear down
+queues after a failed reset, but needed to do some more
+sanitization.
+
+Fixes 443bd90f2cca: "nvme: host: unquiesce queue in nvme_kill_queues()"
+
+[  189.650995] nvme nvme1: pci function 0000:0b:00.0
+[  317.680055] nvme nvme0: Device not ready; aborting reset
+[  317.680183] nvme nvme0: Removing after probe failure status: -19
+[  317.681258] kasan: GPF could be caused by NULL-ptr deref or user memory access
+[  317.681397] general protection fault: 0000 [#1] SMP KASAN
+[  317.682984] CPU: 3 PID: 477 Comm: kworker/3:2 Not tainted 4.13.0-rc1+ #5
+[  317.683112] Hardware name: Gigabyte Technology Co., Ltd. Z170X-UD5/Z170X-UD5-CF, BIOS F5 03/07/2016
+[  317.683284] Workqueue: events nvme_remove_dead_ctrl_work [nvme]
+[  317.683398] task: ffff8803b0990000 task.stack: ffff8803c2ef0000
+[  317.683516] RIP: 0010:blk_mq_unquiesce_queue+0x2b/0xa0
+[  317.683614] RSP: 0018:ffff8803c2ef7d40 EFLAGS: 00010282
+[  317.683716] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 1ffff1006fbdcde3
+[  317.683847] RDX: 0000000000000038 RSI: 1ffff1006f5a9245 RDI: 0000000000000000
+[  317.683978] RBP: ffff8803c2ef7d58 R08: 1ffff1007bcdc974 R09: 0000000000000000
+[  317.684108] R10: 1ffff1007bcdc975 R11: 0000000000000000 R12: 00000000000001c0
+[  317.684239] R13: ffff88037ad49228 R14: ffff88037ad492d0 R15: ffff88037ad492e0
+[  317.684371] FS:  0000000000000000(0000) GS:ffff8803de6c0000(0000) knlGS:0000000000000000
+[  317.684519] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[  317.684627] CR2: 0000002d1860c000 CR3: 000000045b40d000 CR4: 00000000003406e0
+[  317.684758] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[  317.684888] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[  317.685018] Call Trace:
+[  317.685084]  nvme_kill_queues+0x4d/0x170 [nvme_core]
+[  317.685185]  nvme_remove_dead_ctrl_work+0x3a/0x90 [nvme]
+[  317.685289]  process_one_work+0x771/0x1170
+[  317.685372]  worker_thread+0xde/0x11e0
+[  317.685452]  ? pci_mmcfg_check_reserved+0x110/0x110
+[  317.685550]  kthread+0x2d3/0x3d0
+[  317.685617]  ? process_one_work+0x1170/0x1170
+[  317.685704]  ? kthread_create_on_node+0xc0/0xc0
+[  317.685785]  ret_from_fork+0x25/0x30
+[  317.685798] Code: 0f 1f 44 00 00 55 48 b8 00 00 00 00 00 fc ff df 48 89 e5 41 54 4c 8d a7 c0 01 00 00 53 48 89 fb 4c 89 e2 48 c1 ea 03 48 83 ec 08 <80> 3c 02 00 75 50 48 8b bb c0 01 00 00 e8 33 8a f9 00 0f ba b3
+[  317.685872] RIP: blk_mq_unquiesce_queue+0x2b/0xa0 RSP: ffff8803c2ef7d40
+[  317.685908] ---[ end trace a3f8704150b1e8b4 ]---
+
+Signed-off-by: Scott Bauer <scott.bauer@intel.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+[ adapted for 4.9: added check around blk_mq_start_hw_queues() call
+  instead of upstream blk_mq_unquiesce_queue() ]
+Fixes: 4aae4388165a2611fa42 ("nvme: fix hang in remove path")
+Signed-off-by: Simon Veith <sveith@amazon.de>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Amit Shah <aams@amazon.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/nvme/host/core.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -2042,7 +2042,8 @@ void nvme_kill_queues(struct nvme_ctrl *
+       mutex_lock(&ctrl->namespaces_mutex);
+       /* Forcibly start all queues to avoid having stuck requests */
+-      blk_mq_start_hw_queues(ctrl->admin_q);
++      if (ctrl->admin_q)
++              blk_mq_start_hw_queues(ctrl->admin_q);
+       list_for_each_entry(ns, &ctrl->namespaces, list) {
+               /*
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6447c44e374b14543a02e3a5c2fc89ab4c2165cd 100644 (file)
@@ -0,0 +1,17 @@
+nvme-validate-admin-queue-before-unquiesce.patch
+mips-call-dump_stack-from-show_regs.patch
+mips-use-async-ipis-for-arch_trigger_cpumask_backtrace.patch
+mips-fix-ioremap-ram-check.patch
+mmc-dw_mmc-fix-card-threshold-control-configuration.patch
+ibmasm-don-t-write-out-of-bounds-in-read-handler.patch
+ata-fix-zbc_out-command-block-check.patch
+ata-fix-zbc_out-all-bit-handling.patch
+vmw_balloon-fix-inflation-with-batching.patch
+ahci-disable-lpm-on-lenovo-50-series-laptops-with-a-too-old-bios.patch
+usb-serial-ch341-fix-type-promotion-bug-in-ch341_control_in.patch
+usb-serial-cp210x-add-another-usb-id-for-qivicon-zigbee-stick.patch
+usb-serial-keyspan_pda-fix-modem-status-error-handling.patch
+usb-yurex-fix-out-of-bounds-uaccess-in-read-handler.patch
+usb-serial-mos7840-fix-status-register-error-handling.patch
+usb-quirks-add-delay-quirks-for-corsair-strafe.patch
+xhci-xhci-mem-off-by-one-in-xhci_stream_id_to_ring.patch
diff --git a/queue-4.9/usb-quirks-add-delay-quirks-for-corsair-strafe.patch b/queue-4.9/usb-quirks-add-delay-quirks-for-corsair-strafe.patch
new file mode 100644 (file)
index 0000000..3aec5e6
--- /dev/null
@@ -0,0 +1,38 @@
+From bba57eddadda936c94b5dccf73787cb9e159d0a5 Mon Sep 17 00:00:00 2001
+From: Nico Sneck <snecknico@gmail.com>
+Date: Mon, 2 Jul 2018 19:26:07 +0300
+Subject: usb: quirks: add delay quirks for Corsair Strafe
+
+From: Nico Sneck <snecknico@gmail.com>
+
+commit bba57eddadda936c94b5dccf73787cb9e159d0a5 upstream.
+
+Corsair Strafe appears to suffer from the same issues
+as the Corsair Strafe RGB.
+Apply the same quirks (control message delay and init delay)
+that the RGB version has to 1b1c:1b15.
+
+With these quirks in place the keyboard works correctly upon
+booting the system, and no longer requires reattaching the device.
+
+Signed-off-by: Nico Sneck <snecknico@gmail.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/quirks.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -231,6 +231,10 @@ static const struct usb_device_id usb_qu
+       /* Corsair K70 RGB */
+       { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
++      /* Corsair Strafe */
++      { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
++        USB_QUIRK_DELAY_CTRL_MSG },
++
+       /* Corsair Strafe RGB */
+       { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
+         USB_QUIRK_DELAY_CTRL_MSG },
diff --git a/queue-4.9/usb-serial-ch341-fix-type-promotion-bug-in-ch341_control_in.patch b/queue-4.9/usb-serial-ch341-fix-type-promotion-bug-in-ch341_control_in.patch
new file mode 100644 (file)
index 0000000..d42aace
--- /dev/null
@@ -0,0 +1,35 @@
+From e33eab9ded328ccc14308afa51b5be7cbe78d30b Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Wed, 4 Jul 2018 12:29:38 +0300
+Subject: USB: serial: ch341: fix type promotion bug in ch341_control_in()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit e33eab9ded328ccc14308afa51b5be7cbe78d30b upstream.
+
+The "r" variable is an int and "bufsize" is an unsigned int so the
+comparison is type promoted to unsigned.  If usb_control_msg() returns a
+negative that is treated as a high positive value and the error handling
+doesn't work.
+
+Fixes: 2d5a9c72d0c4 ("USB: serial: ch341: fix control-message error handling")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ch341.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/ch341.c
++++ b/drivers/usb/serial/ch341.c
+@@ -118,7 +118,7 @@ static int ch341_control_in(struct usb_d
+       r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
+                           USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+                           value, index, buf, bufsize, DEFAULT_TIMEOUT);
+-      if (r < bufsize) {
++      if (r < (int)bufsize) {
+               if (r >= 0) {
+                       dev_err(&dev->dev,
+                               "short control message received (%d < %u)\n",
diff --git a/queue-4.9/usb-serial-cp210x-add-another-usb-id-for-qivicon-zigbee-stick.patch b/queue-4.9/usb-serial-cp210x-add-another-usb-id-for-qivicon-zigbee-stick.patch
new file mode 100644 (file)
index 0000000..37bdd3e
--- /dev/null
@@ -0,0 +1,31 @@
+From 367b160fe4717c14a2a978b6f9ffb75a7762d3ed Mon Sep 17 00:00:00 2001
+From: Olli Salonen <olli.salonen@iki.fi>
+Date: Wed, 4 Jul 2018 14:07:42 +0300
+Subject: USB: serial: cp210x: add another USB ID for Qivicon ZigBee stick
+
+From: Olli Salonen <olli.salonen@iki.fi>
+
+commit 367b160fe4717c14a2a978b6f9ffb75a7762d3ed upstream.
+
+There are two versions of the Qivicon Zigbee stick in circulation. This
+adds the second USB ID to the cp210x driver.
+
+Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/cp210x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -146,6 +146,7 @@ static const struct usb_device_id id_tab
+       { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
+       { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
+       { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
++      { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
+       { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
+       { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
+       { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
diff --git a/queue-4.9/usb-serial-keyspan_pda-fix-modem-status-error-handling.patch b/queue-4.9/usb-serial-keyspan_pda-fix-modem-status-error-handling.patch
new file mode 100644 (file)
index 0000000..7799066
--- /dev/null
@@ -0,0 +1,35 @@
+From 01b3cdfca263a17554f7b249d20a247b2a751521 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Wed, 4 Jul 2018 17:02:16 +0200
+Subject: USB: serial: keyspan_pda: fix modem-status error handling
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 01b3cdfca263a17554f7b249d20a247b2a751521 upstream.
+
+Fix broken modem-status error handling which could lead to bits of slab
+data leaking to user space.
+
+Fixes: 3b36a8fd6777 ("usb: fix uninitialized variable warning in keyspan_pda")
+Cc: stable <stable@vger.kernel.org>     # 2.6.27
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/keyspan_pda.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/keyspan_pda.c
++++ b/drivers/usb/serial/keyspan_pda.c
+@@ -373,8 +373,10 @@ static int keyspan_pda_get_modem_info(st
+                            3, /* get pins */
+                            USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
+                            0, 0, data, 1, 2000);
+-      if (rc >= 0)
++      if (rc == 1)
+               *value = *data;
++      else if (rc >= 0)
++              rc = -EIO;
+       kfree(data);
+       return rc;
diff --git a/queue-4.9/usb-serial-mos7840-fix-status-register-error-handling.patch b/queue-4.9/usb-serial-mos7840-fix-status-register-error-handling.patch
new file mode 100644 (file)
index 0000000..dc25db6
--- /dev/null
@@ -0,0 +1,34 @@
+From 794744abfffef8b1f3c0c8a4896177d6d13d653d Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Wed, 4 Jul 2018 17:02:17 +0200
+Subject: USB: serial: mos7840: fix status-register error handling
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 794744abfffef8b1f3c0c8a4896177d6d13d653d upstream.
+
+Add missing transfer-length sanity check to the status-register
+completion handler to avoid leaking bits of uninitialised slab data to
+user space.
+
+Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")
+Cc: stable <stable@vger.kernel.org>     # 2.6.19
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/mos7840.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/serial/mos7840.c
++++ b/drivers/usb/serial/mos7840.c
+@@ -482,6 +482,9 @@ static void mos7840_control_callback(str
+       }
+       dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
++      if (urb->actual_length < 1)
++              goto out;
++
+       dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__,
+               mos7840_port->MsrLsr, mos7840_port->port_num);
+       data = urb->transfer_buffer;
diff --git a/queue-4.9/usb-yurex-fix-out-of-bounds-uaccess-in-read-handler.patch b/queue-4.9/usb-yurex-fix-out-of-bounds-uaccess-in-read-handler.patch
new file mode 100644 (file)
index 0000000..fe6d94c
--- /dev/null
@@ -0,0 +1,69 @@
+From f1e255d60ae66a9f672ff9a207ee6cd8e33d2679 Mon Sep 17 00:00:00 2001
+From: Jann Horn <jannh@google.com>
+Date: Fri, 6 Jul 2018 17:12:56 +0200
+Subject: USB: yurex: fix out-of-bounds uaccess in read handler
+
+From: Jann Horn <jannh@google.com>
+
+commit f1e255d60ae66a9f672ff9a207ee6cd8e33d2679 upstream.
+
+In general, accessing userspace memory beyond the length of the supplied
+buffer in VFS read/write handlers can lead to both kernel memory corruption
+(via kernel_read()/kernel_write(), which can e.g. be triggered via
+sys_splice()) and privilege escalation inside userspace.
+
+Fix it by using simple_read_from_buffer() instead of custom logic.
+
+Fixes: 6bc235a2e24a ("USB: add driver for Meywa-Denki & Kayac YUREX")
+Signed-off-by: Jann Horn <jannh@google.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/misc/yurex.c |   23 ++++++-----------------
+ 1 file changed, 6 insertions(+), 17 deletions(-)
+
+--- a/drivers/usb/misc/yurex.c
++++ b/drivers/usb/misc/yurex.c
+@@ -406,8 +406,7 @@ static ssize_t yurex_read(struct file *f
+                         loff_t *ppos)
+ {
+       struct usb_yurex *dev;
+-      int retval = 0;
+-      int bytes_read = 0;
++      int len = 0;
+       char in_buffer[20];
+       unsigned long flags;
+@@ -415,26 +414,16 @@ static ssize_t yurex_read(struct file *f
+       mutex_lock(&dev->io_mutex);
+       if (!dev->interface) {          /* already disconnected */
+-              retval = -ENODEV;
+-              goto exit;
++              mutex_unlock(&dev->io_mutex);
++              return -ENODEV;
+       }
+       spin_lock_irqsave(&dev->lock, flags);
+-      bytes_read = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
++      len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
+       spin_unlock_irqrestore(&dev->lock, flags);
+-
+-      if (*ppos < bytes_read) {
+-              if (copy_to_user(buffer, in_buffer + *ppos, bytes_read - *ppos))
+-                      retval = -EFAULT;
+-              else {
+-                      retval = bytes_read - *ppos;
+-                      *ppos += bytes_read;
+-              }
+-      }
+-
+-exit:
+       mutex_unlock(&dev->io_mutex);
+-      return retval;
++
++      return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
+ }
+ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
diff --git a/queue-4.9/vmw_balloon-fix-inflation-with-batching.patch b/queue-4.9/vmw_balloon-fix-inflation-with-batching.patch
new file mode 100644 (file)
index 0000000..57f2ea7
--- /dev/null
@@ -0,0 +1,44 @@
+From 90d72ce079791399ac255c75728f3c9e747b093d Mon Sep 17 00:00:00 2001
+From: Nadav Amit <namit@vmware.com>
+Date: Mon, 2 Jul 2018 19:27:13 -0700
+Subject: vmw_balloon: fix inflation with batching
+
+From: Nadav Amit <namit@vmware.com>
+
+commit 90d72ce079791399ac255c75728f3c9e747b093d upstream.
+
+Embarrassingly, the recent fix introduced worse problem than it solved,
+causing the balloon not to inflate. The VM informed the hypervisor that
+the pages for lock/unlock are sitting in the wrong address, as it used
+the page that is used the uninitialized page variable.
+
+Fixes: b23220fe054e9 ("vmw_balloon: fixing double free when batching mode is off")
+Cc: stable@vger.kernel.org
+Reviewed-by: Xavier Deguillard <xdeguillard@vmware.com>
+Signed-off-by: Nadav Amit <namit@vmware.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/vmw_balloon.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/misc/vmw_balloon.c
++++ b/drivers/misc/vmw_balloon.c
+@@ -467,7 +467,7 @@ static int vmballoon_send_batched_lock(s
+               unsigned int num_pages, bool is_2m_pages, unsigned int *target)
+ {
+       unsigned long status;
+-      unsigned long pfn = page_to_pfn(b->page);
++      unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
+       STATS_INC(b->stats.lock[is_2m_pages]);
+@@ -515,7 +515,7 @@ static bool vmballoon_send_batched_unloc
+               unsigned int num_pages, bool is_2m_pages, unsigned int *target)
+ {
+       unsigned long status;
+-      unsigned long pfn = page_to_pfn(b->page);
++      unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
+       STATS_INC(b->stats.unlock[is_2m_pages]);
diff --git a/queue-4.9/xhci-xhci-mem-off-by-one-in-xhci_stream_id_to_ring.patch b/queue-4.9/xhci-xhci-mem-off-by-one-in-xhci_stream_id_to_ring.patch
new file mode 100644 (file)
index 0000000..e7152bf
--- /dev/null
@@ -0,0 +1,32 @@
+From 313db3d6488bb03b61b99de9dbca061f1fd838e1 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Wed, 4 Jul 2018 12:48:53 +0300
+Subject: xhci: xhci-mem: off by one in xhci_stream_id_to_ring()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit 313db3d6488bb03b61b99de9dbca061f1fd838e1 upstream.
+
+The > should be >= here so that we don't read one element beyond the end
+of the ep->stream_info->stream_rings[] array.
+
+Fixes: e9df17eb1408 ("USB: xhci: Correct assumptions about number of rings per endpoint.")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -650,7 +650,7 @@ struct xhci_ring *xhci_stream_id_to_ring
+       if (!ep->stream_info)
+               return NULL;
+-      if (stream_id > ep->stream_info->num_streams)
++      if (stream_id >= ep->stream_info->num_streams)
+               return NULL;
+       return ep->stream_info->stream_rings[stream_id];
+ }