1. 27 Oct, 2017 26 commits
    • John David Anglin's avatar
      parisc: Fix double-word compare and exchange in LWS code on 32-bit kernels · fcc65ab1
      John David Anglin authored
      commit 374b3bf8 upstream.
      
      As discussed on the debian-hppa list, double-wordcompare and exchange
      operations fail on 32-bit kernels.  Looking at the code, I realized that
      the ",ma" completer does the wrong thing in the  "ldw,ma  4(%r26), %r29"
      instruction.  This increments %r26 and causes the following store to
      write to the wrong location.
      
      Note by Helge Deller:
      The patch applies cleanly to stable kernel series if this upstream
      commit is merged in advance:
      f4125cfd ("parisc: Avoid trashing sr2 and sr3 in LWS code").
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Tested-by: default avatarChristoph Biedl <debian.axhn@manchmal.in-ulm.de>
      Fixes: 89206491 ("parisc: Implement new LWS CAS supporting 64 bit operations.")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcc65ab1
    • John David Anglin's avatar
      parisc: Avoid trashing sr2 and sr3 in LWS code · 558ca24d
      John David Anglin authored
      commit f4125cfd upstream.
      
      There is no need to trash sr2 and sr3 in the Light-weight syscall (LWS).  sr2
      already points to kernel space (it's zero in userspace, otherwise syscalls
      wouldn't work), and since the LWS code is executed in userspace, we can simply
      ignore to preload sr3.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      558ca24d
    • Eric Sesterhenn's avatar
      pkcs7: Prevent NULL pointer dereference, since sinfo is not always set. · 6f0dee7d
      Eric Sesterhenn authored
      commit 68a1fdbb upstream.
      
      The ASN.1 parser does not necessarily set the sinfo field,
      this patch prevents a NULL pointer dereference on broken
      input.
      
      Fixes: 99db4435 ("PKCS#7: Appropriately restrict authenticated attributes and content type")
      Signed-off-by: default avatarEric Sesterhenn <eric.sesterhenn@x41-dsec.de>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f0dee7d
    • David Howells's avatar
      KEYS: don't let add_key() update an uninstantiated key · 33dea302
      David Howells authored
      commit 60ff5b2f upstream.
      
      Currently, when passed a key that already exists, add_key() will call the
      key's ->update() method if such exists.  But this is heavily broken in the
      case where the key is uninstantiated because it doesn't call
      __key_instantiate_and_link().  Consequently, it doesn't do most of the
      things that are supposed to happen when the key is instantiated, such as
      setting the instantiation state, clearing KEY_FLAG_USER_CONSTRUCT and
      awakening tasks waiting on it, and incrementing key->user->nikeys.
      
      It also never takes key_construction_mutex, which means that
      ->instantiate() can run concurrently with ->update() on the same key.  In
      the case of the "user" and "logon" key types this causes a memory leak, at
      best.  Maybe even worse, the ->update() methods of the "encrypted" and
      "trusted" key types actually just dereference a NULL pointer when passed an
      uninstantiated key.
      
      Change key_create_or_update() to wait interruptibly for the key to finish
      construction before continuing.
      
      This patch only affects *uninstantiated* keys.  For now we still allow a
      negatively instantiated key to be updated (thereby positively
      instantiating it), although that's broken too (the next patch fixes it)
      and I'm not sure that anyone actually uses that functionality either.
      
      Here is a simple reproducer for the bug using the "encrypted" key type
      (requires CONFIG_ENCRYPTED_KEYS=y), though as noted above the bug
      pertained to more than just the "encrypted" key type:
      
          #include <stdlib.h>
          #include <unistd.h>
          #include <keyutils.h>
      
          int main(void)
          {
              int ringid = keyctl_join_session_keyring(NULL);
      
              if (fork()) {
                  for (;;) {
                      const char payload[] = "update user:foo 32";
      
                      usleep(rand() % 10000);
                      add_key("encrypted", "desc", payload, sizeof(payload), ringid);
                      keyctl_clear(ringid);
                  }
              } else {
                  for (;;)
                      request_key("encrypted", "desc", "callout_info", ringid);
              }
          }
      
      It causes:
      
          BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
          IP: encrypted_update+0xb0/0x170
          PGD 7a178067 P4D 7a178067 PUD 77269067 PMD 0
          PREEMPT SMP
          CPU: 0 PID: 340 Comm: reproduce Tainted: G      D         4.14.0-rc1-00025-g428490e3 #796
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
          task: ffff8a467a39a340 task.stack: ffffb15c40770000
          RIP: 0010:encrypted_update+0xb0/0x170
          RSP: 0018:ffffb15c40773de8 EFLAGS: 00010246
          RAX: 0000000000000000 RBX: ffff8a467a275b00 RCX: 0000000000000000
          RDX: 0000000000000005 RSI: ffff8a467a275b14 RDI: ffffffffb742f303
          RBP: ffffb15c40773e20 R08: 0000000000000000 R09: ffff8a467a275b17
          R10: 0000000000000020 R11: 0000000000000000 R12: 0000000000000000
          R13: 0000000000000000 R14: ffff8a4677057180 R15: ffff8a467a275b0f
          FS:  00007f5d7fb08700(0000) GS:ffff8a467f200000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 0000000000000018 CR3: 0000000077262005 CR4: 00000000001606f0
          Call Trace:
           key_create_or_update+0x2bc/0x460
           SyS_add_key+0x10c/0x1d0
           entry_SYSCALL_64_fastpath+0x1f/0xbe
          RIP: 0033:0x7f5d7f211259
          RSP: 002b:00007ffed03904c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
          RAX: ffffffffffffffda RBX: 000000003b2a7955 RCX: 00007f5d7f211259
          RDX: 00000000004009e4 RSI: 00000000004009ff RDI: 0000000000400a04
          RBP: 0000000068db8bad R08: 000000003b2a7955 R09: 0000000000000004
          R10: 000000000000001a R11: 0000000000000246 R12: 0000000000400868
          R13: 00007ffed03905d0 R14: 0000000000000000 R15: 0000000000000000
          Code: 77 28 e8 64 34 1f 00 45 31 c0 31 c9 48 8d 55 c8 48 89 df 48 8d 75 d0 e8 ff f9 ff ff 85 c0 41 89 c4 0f 88 84 00 00 00 4c 8b 7d c8 <49> 8b 75 18 4c 89 ff e8 24 f8 ff ff 85 c0 41 89 c4 78 6d 49 8b
          RIP: encrypted_update+0xb0/0x170 RSP: ffffb15c40773de8
          CR2: 0000000000000018
      Reported-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Eric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      33dea302
    • Eric Biggers's avatar
      lib/digsig: fix dereference of NULL user_key_payload · 503ef5c0
      Eric Biggers authored
      commit 192cabd6 upstream.
      
      digsig_verify() requests a user key, then accesses its payload.
      However, a revoked key has a NULL payload, and we failed to check for
      this.  request_key() *does* skip revoked keys, but there is still a
      window where the key can be revoked before we acquire its semaphore.
      
      Fix it by checking for a NULL payload, treating it like a key which was
      already revoked at the time it was requested.
      
      Fixes: 051dbb91 ("crypto: digital signature verification support")
      Reviewed-by: default avatarJames Morris <james.l.morris@oracle.com>
      Cc: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      503ef5c0
    • Eric Biggers's avatar
      KEYS: encrypted: fix dereference of NULL user_key_payload · 2b7e0226
      Eric Biggers authored
      commit 13923d08 upstream.
      
      A key of type "encrypted" references a "master key" which is used to
      encrypt and decrypt the encrypted key's payload.  However, when we
      accessed the master key's payload, we failed to handle the case where
      the master key has been revoked, which sets the payload pointer to NULL.
      Note that request_key() *does* skip revoked keys, but there is still a
      window where the key can be revoked before we acquire its semaphore.
      
      Fix it by checking for a NULL payload, treating it like a key which was
      already revoked at the time it was requested.
      
      This was an issue for master keys of type "user" only.  Master keys can
      also be of type "trusted", but those cannot be revoked.
      
      Fixes: 7e70cb49 ("keys: add new key-type encrypted")
      Reviewed-by: default avatarJames Morris <james.l.morris@oracle.com>
      Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: David Safford <safford@us.ibm.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      2b7e0226
    • Larry Finger's avatar
      rtlwifi: rtl8821ae: Fix connection lost problem · 51ba40fc
      Larry Finger authored
      commit b8b8b163 upstream.
      
      In commit 40b368af ("rtlwifi: Fix alignment issues"), the read
      of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
      this change results in reduced stability for the wireless connection.
      This regression was located using bisection.
      
      Fixes: 40b368af ("rtlwifi: Fix alignment issues")
      Reported-and-tested-by: default avatarJames Cameron <quozl@laptop.org>
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Ping-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51ba40fc
    • David Kozub's avatar
      clockevents/drivers/cs5535: Improve resilience to spurious interrupts · cffdaa65
      David Kozub authored
      commit eb39a7c0 upstream.
      
      The interrupt handler mfgpt_tick() is not robust versus spurious interrupts
      which happen before the clock event device is registered and fully
      initialized.
      
      The reason is that the safe guard against spurious interrupts solely checks
      for the clockevents shutdown state, but lacks a check for detached
      state. If the interrupt hits while the device is in detached state it
      passes the safe guard and dereferences the event handler call back which is
      NULL.
      
      Add the missing state check.
      
      Fixes: 8f9327cb ("clockevents/drivers/cs5535: Migrate to new 'set-state' interface")
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarDavid Kozub <zub@linux.fjfi.cvut.cz>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Link: https://lkml.kernel.org/r/20171020093103.3317F6004D@linux.fjfi.cvut.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cffdaa65
    • Jan Luebbe's avatar
      bus: mbus: fix window size calculation for 4GB windows · b178c94e
      Jan Luebbe authored
      commit 2bbbd963 upstream.
      
      At least the Armada XP SoC supports 4GB on a single DRAM window. Because
      the size register values contain the actual size - 1, the MSB is set in
      that case. For example, the SDRAM window's control register's value is
      0xffffffe1 for 4GB (bits 31 to 24 contain the size).
      
      The MBUS driver reads back each window's size from registers and
      calculates the actual size as (control_reg | ~DDR_SIZE_MASK) + 1, which
      overflows for 32 bit values, resulting in other miscalculations further
      on (a bad RAM window for the CESA crypto engine calculated by
      mvebu_mbus_setup_cpu_target_nooverlap() in my case).
      
      This patch changes the type in 'struct mbus_dram_window' from u32 to
      u64, which allows us to keep using the same register calculation code in
      most MBUS-using drivers (which calculate ->size - 1 again).
      
      Fixes: fddddb52 ("bus: introduce an Marvell EBU MBus driver")
      Signed-off-by: default avatarJan Luebbe <jlu@pengutronix.de>
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b178c94e
    • Arnd Bergmann's avatar
      brcmsmac: make some local variables 'static const' to reduce stack size · 260b6739
      Arnd Bergmann authored
      commit c503dd38 upstream.
      
      With KASAN and a couple of other patches applied, this driver is one
      of the few remaining ones that actually use more than 2048 bytes of
      kernel stack:
      
      broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy_gainctrl':
      broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
      broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy':
      broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
      
      Here, I'm reducing the stack size by marking as many local variables as
      'static const' as I can without changing the actual code.
      
      This is the first of three patches to improve the stack usage in this
      driver. It would be good to have this backported to stabl kernels
      to get all drivers in 'allmodconfig' below the 2048 byte limit so
      we can turn on the frame warning again globally, but I realize that
      the patch is larger than the normal limit for stable backports.
      
      The other two patches do not need to be backported.
      Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      260b6739
    • Pontus Andersson's avatar
      i2c: ismt: Separate I2C block read from SMBus block read · efdcbffb
      Pontus Andersson authored
      commit c6ebcedb upstream.
      
      Commit b6c159a9 ("i2c: ismt: Don't duplicate the receive length for
      block reads") broke I2C block reads. It aimed to fix normal SMBus block
      read, but changed the correct behavior of I2C block read in the process.
      
      According to Documentation/i2c/smbus-protocol, one vital difference
      between normal SMBus block read and I2C block read is that there is no
      byte count prefixed in the data sent on the wire:
      
       SMBus Block Read:  i2c_smbus_read_block_data()
       S Addr Wr [A] Comm [A]
                  S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
      
       I2C Block Read:  i2c_smbus_read_i2c_block_data()
       S Addr Wr [A] Comm [A]
                  S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
      
      Therefore the two transaction types need to be processed differently in
      the driver by copying of the dma_buffer as done previously for the
      I2C_SMBUS_I2C_BLOCK_DATA case.
      
      Fixes: b6c159a9 ("i2c: ismt: Don't duplicate the receive length for block reads")
      Signed-off-by: default avatarPontus Andersson <epontan@gmail.com>
      Tested-by: default avatarStephen Douthit <stephend@adiengineering.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      efdcbffb
    • Takashi Iwai's avatar
      ALSA: hda: Remove superfluous '-' added by printk conversion · 68c61077
      Takashi Iwai authored
      commit 6bf88a34 upstream.
      
      While converting the error messages to the standard macros in the
      commit 4e76a883 ("ALSA: hda - Replace with standard printk"), a
      superfluous '-' slipped in the code mistakenly.  Its influence is
      almost negligible, merely shows a dB value as negative integer instead
      of positive integer (or vice versa) in the rare error message.
      So let's kill this embarrassing byte to show more correct value.
      
      Fixes: 4e76a883 ("ALSA: hda - Replace with standard printk")
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68c61077
    • Ben Hutchings's avatar
      ALSA: seq: Enable 'use' locking in all configurations · f9e93712
      Ben Hutchings authored
      commit 8009d506 upstream.
      
      The 'use' locking macros are no-ops if neither SMP or SND_DEBUG is
      enabled.  This might once have been OK in non-preemptible
      configurations, but even in that case snd_seq_read() may sleep while
      relying on a 'use' lock.  So always use the proper implementations.
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9e93712
    • Ben Skeggs's avatar
      drm/nouveau/mmu: flush tlbs before deleting page tables · 4516069f
      Ben Skeggs authored
      commit 77913bbc upstream.
      
      Even though we've zeroed the PDE, the GPU may have cached the PD, so we
      need to flush when deleting them.
      
      Noticed while working on replacement MMU code, but a backport might be a
      good idea, so let's fix it in the current code too.
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4516069f
    • Ilia Mirkin's avatar
      drm/nouveau/bsp/g92: disable by default · 195674ad
      Ilia Mirkin authored
      commit 194d68dd upstream.
      
      G92's seem to require some additional bit of initialization before the
      BSP engine can work. It feels like clocks are not set up for the
      underlying VLD engine, which means that all commands submitted to the
      xtensa chip end up hanging. VP seems to work fine though.
      
      This still allows people to force-enable the bsp engine if they want to
      play around with it, but makes it harder for the card to hang by
      default.
      Signed-off-by: default avatarIlia Mirkin <imirkin@alum.mit.edu>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      195674ad
    • Stefan Mätje's avatar
      can: esd_usb2: Fix can_dlc value for received RTR, frames · 4d56587c
      Stefan Mätje authored
      commit 72d92e86 upstream.
      
      The dlc member of the struct rx_msg contains also the ESD_RTR flag to
      mark received RTR frames. Without the fix the can_dlc value for received
      RTR frames would always be set to 8 by get_can_dlc() instead of the
      received value.
      
      Fixes: 96d8e903 ("can: Add driver for esd CAN-USB/2 device")
      Signed-off-by: default avatarStefan Mätje <stefan.maetje@esd.eu>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d56587c
    • Jonathan Liu's avatar
      usb: musb: Check for host-mode using is_host_active() on reset interrupt · aa629364
      Jonathan Liu authored
      commit 445ef615 upstream.
      
      The sunxi musb has a bug where sometimes it will generate a babble
      error on device disconnect instead of a disconnect IRQ. When this
      happens the musb controller switches from host mode to device mode
      (it clears MUSB_DEVCTL_HM/MUSB_DEVCTL_SESSION and sets
      MUSB_DEVCTL_BDEVICE) and gets stuck in this state.
      
      The babble error is misdetected as a bus reset because MUSB_DEVCTL_HM
      was cleared.
      
      To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM)
      to detect babble error so that sunxi musb babble recovery can handle it
      by restoring the mode. This information is provided by the driver logic
      and does not rely on register contents.
      Signed-off-by: default avatarJonathan Liu <net147@gmail.com>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa629364
    • Jonathan Liu's avatar
      usb: musb: sunxi: Explicitly release USB PHY on exit · 583a4219
      Jonathan Liu authored
      commit 6ed05c68 upstream.
      
      This fixes a kernel oops when unloading the driver due to usb_put_phy
      being called after usb_phy_generic_unregister when the device is
      detached. Calling usb_phy_generic_unregister causes x->dev->driver to
      be NULL in usb_put_phy and results in a NULL pointer dereference.
      Signed-off-by: default avatarJonathan Liu <net147@gmail.com>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      583a4219
    • Wolfgang Grandegger's avatar
      can: gs_usb: fix busy loop if no more TX context is available · d68b07a1
      Wolfgang Grandegger authored
      commit 97819f94 upstream.
      
      If sending messages with no cable connected, it quickly happens that
      there is no more TX context available. Then "gs_can_start_xmit()"
      returns with "NETDEV_TX_BUSY" and the upper layer does retry
      immediately keeping the CPU busy. To fix that issue, I moved
      "atomic_dec(&dev->active_tx_urbs)" from "gs_usb_xmit_callback()" to
      the TX done handling in "gs_usb_receive_bulk_callback()". Renaming
      "active_tx_urbs" to "active_tx_contexts" and moving it into
      "gs_[alloc|free]_tx_context()" would also make sense.
      Signed-off-by: default avatarWolfgang Grandegger <wg@grandegger.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d68b07a1
    • Jussi Laako's avatar
      ALSA: usb-audio: Add native DSD support for Pro-Ject Pre Box S2 Digital · f7d8b2e1
      Jussi Laako authored
      commit 9bb201a5 upstream.
      
      Add native DSD support quirk for Pro-Ject Pre Box S2 Digital USB id
      2772:0230.
      Signed-off-by: default avatarJussi Laako <jussi@sonarnerd.net>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7d8b2e1
    • Mathias Nyman's avatar
      usb: hub: Allow reset retry for USB2 devices on connect bounce · 67e25805
      Mathias Nyman authored
      commit 1ac7db63 upstream.
      
      If the connect status change is set during reset signaling, but
      the status remains connected just retry port reset.
      
      This solves an issue with connecting a 90W HP Thunderbolt 3 dock
      with a Lenovo Carbon x1 (5th generation) which causes a 30min loop
      of a high speed device being re-discovererd before usb ports starts
      working.
      
      [...]
      [ 389.023845] usb 3-1: new high-speed USB device number 55 using xhci_hcd
      [ 389.491841] usb 3-1: new high-speed USB device number 56 using xhci_hcd
      [ 389.959928] usb 3-1: new high-speed USB device number 57 using xhci_hcd
      [...]
      
      This is caused by a high speed device that doesn't successfully go to the
      enabled state after the second port reset. Instead the connection bounces
      (connected, with connect status change), bailing out completely from
      enumeration just to restart from scratch.
      
      Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1716332Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67e25805
    • Felipe Balbi's avatar
      usb: quirks: add quirk for WORLDE MINI MIDI keyboard · d012ab21
      Felipe Balbi authored
      commit 2811501e upstream.
      
      This keyboard doesn't implement Get String descriptors properly even
      though string indexes are valid. What happens is that when requesting
      for the String descriptor, the device disconnects and
      reconnects. Without this quirk, this loop will continue forever.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarВладимир Мартьянов <vilgeforce@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d012ab21
    • Maksim Salau's avatar
      usb: cdc_acm: Add quirk for Elatec TWN3 · d729f29a
      Maksim Salau authored
      commit 765fb2f1 upstream.
      
      Elatec TWN3 has the union descriptor on data interface. This results in
      failure to bind the device to the driver with the following log:
        usb 1-1.2: new full speed USB device using streamplug-ehci and address 4
        usb 1-1.2: New USB device found, idVendor=09d8, idProduct=0320
        usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
        usb 1-1.2: Product: RFID Device (COM)
        usb 1-1.2: Manufacturer: OEM
        cdc_acm 1-1.2:1.0: Zero length descriptor references
        cdc_acm: probe of 1-1.2:1.0 failed with error -22
      
      Adding the NO_UNION_NORMAL quirk for the device fixes the issue.
      
      `lsusb -v` of the device:
      
      Bus 001 Device 003: ID 09d8:0320
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        32
        idVendor           0x09d8
        idProduct          0x0320
        bcdDevice            3.00
        iManufacturer           1 OEM
        iProduct                2 RFID Device (COM)
        iSerial                 0
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           67
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              250mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               2
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               0
            CDC Header:
              bcdCDC               1.10
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          1
            CDC ACM:
              bmCapabilities       0x06
                sends break
                line coding and serial state
            CDC Union:
              bMasterInterface        0
              bSlaveInterface         1
      Device Status:     0x0000
        (Bus Powered)
      Signed-off-by: default avatarMaksim Salau <msalau@iotecha.com>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d729f29a
    • Johan Hovold's avatar
      USB: serial: metro-usb: add MS7820 device id · 4512d650
      Johan Hovold authored
      commit 31dc3f81 upstream.
      
      Add device-id entry for (Honeywell) Metrologic MS7820 bar code scanner.
      
      The device has two interfaces (in this mode?); a vendor-specific
      interface with two interrupt endpoints and a second HID interface, which
      we do not bind to.
      Reported-by: default avatarLadislav Dobrovsky <ladislav.dobrovsky@gmail.com>
      Tested-by: default avatarLadislav Dobrovsky <ladislav.dobrovsky@gmail.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4512d650
    • Alan Stern's avatar
      USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor() · 9dff499d
      Alan Stern authored
      commit 1c0edc36 upstream.
      
      Andrey used the syzkaller fuzzer to find an out-of-bounds memory
      access in usb_get_bos_descriptor().  The code wasn't checking that the
      next usb_dev_cap_header structure could fit into the remaining buffer
      space.
      
      This patch fixes the error and also reduces the bNumDeviceCaps field
      in the header to match the actual number of capabilities found, in
      cases where there are fewer than expected.
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9dff499d
    • Hans de Goede's avatar
      USB: devio: Revert "USB: devio: Don't corrupt user memory" · abe43c97
      Hans de Goede authored
      commit 845d584f upstream.
      
      Taking the uurb->buffer_length userspace passes in as a maximum for the
      actual urbs transfer_buffer_length causes 2 serious issues:
      
      1) It breaks isochronous support for all userspace apps using libusb,
         as existing libusb versions pass in 0 for uurb->buffer_length,
         relying on the kernel using the lenghts of the usbdevfs_iso_packet_desc
         descriptors passed in added together as buffer length.
      
         This for example causes redirection of USB audio and Webcam's into
         virtual machines using qemu-kvm to no longer work. This is a userspace
         ABI break and as such must be reverted.
      
         Note that the original commit does not protect other users / the
         kernels memory, it only stops the userspace process making the call
         from shooting itself in the foot.
      
      2) It may cause the kernel to program host controllers to DMA over random
         memory. Just as the devio code used to only look at the iso_packet_desc
         lenghts, the host drivers do the same, relying on the submitter of the
         urbs to make sure the entire buffer is large enough and not checking
         transfer_buffer_length.
      
         But the "USB: devio: Don't corrupt user memory" commit now takes the
         userspace provided uurb->buffer_length for the buffer-size while copying
         over the user-provided iso_packet_desc lengths 1:1, allowing the user
         to specify a small buffer size while programming the host controller to
         dma a lot more data.
      
         (Atleast the ohci, uhci, xhci and fhci drivers do not check
          transfer_buffer_length for isoc transfers.)
      
      This reverts commit fa1ed74e ("USB: devio: Don't corrupt user memory")
      fixing both these issues.
      
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      abe43c97
  2. 21 Oct, 2017 14 commits