1. 19 10月, 2017 2 次提交
  2. 17 10月, 2017 2 次提交
    • F
      usb: quirks: add quirk for WORLDE MINI MIDI keyboard · 2811501e
      Felipe Balbi 提交于
      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: NВладимир Мартьянов <vilgeforce@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2811501e
    • H
      USB: devio: Revert "USB: devio: Don't corrupt user memory" · 845d584f
      Hans de Goede 提交于
      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>
      Cc: stable@vger.kernel.org
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      845d584f
  3. 25 9月, 2017 2 次提交
  4. 21 9月, 2017 1 次提交
  5. 19 9月, 2017 1 次提交
  6. 18 9月, 2017 1 次提交
    • D
      usb: Increase quirk delay for USB devices · b2a542bb
      Dmitry Fleytman 提交于
      Commit e0429362
      ("usb: Add device quirk for Logitech HD Pro Webcams C920 and C930e")
      introduced quirk to workaround an issue with some Logitech webcams.
      
      The workaround is introducing delay for some USB operations.
      
      According to our testing, delay introduced by original commit
      is not long enough and in rare cases we still see issues described
      by the aforementioned commit.
      
      This patch increases delays introduced by original commit.
      Having this patch applied we do not see those problems anymore.
      Signed-off-by: NDmitry Fleytman <dmitry@daynix.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2a542bb
  7. 29 8月, 2017 1 次提交
    • C
      usb: core: usbport: fix "BUG: key not in .data" when lockdep is enabled · aa759365
      Christian Lamparter 提交于
      This patch fixes a splat that happens if CONFIG_DEBUG_LOCK_ALLOC
      is enabled and the ledtrig_usbport is loaded. (on a device that
      has some usb ports).
      
      [   60.695479] BUG: key c53f8420 not in .data!
      [   60.695521] ------------[ cut here ]------------
      [   60.698542] WARNING: CPU: 1 PID: 854 at kernel/locking/lockdep.c:3134 __kernfs_create_file+0x5c/0xc0
      [   60.703355] DEBUG_LOCKS_WARN_ON(1)
      [   60.712534] Modules linked in:
      [   60.944078] CPU: 1 PID: 854 Comm: S96led Not tainted 4.9.44 #0
      [   60.944329] Hardware name: Generic DT based system
      [   60.950106] [<c021585c>] (unwind_backtrace) from [<c0212150>] (show_stack+0x10/0x14)
      [   60.954878] [<c0212150>] (show_stack) from [<c03a2bc4>] (dump_stack+0x7c/0x9c)
      [   60.962772] [<c03a2bc4>] (dump_stack) from [<c021db34>] (__warn+0xbc/0xec)
      [   60.969799] [<c021db34>] (__warn) from [<c021db98>] (warn_slowpath_fmt+0x34/0x44)
      [   60.976656] [<c021db98>] (warn_slowpath_fmt)
      [   60.984210] [<c0320688>] (__kernfs_create_file)
      [   60.992712] [<c0320ef0>] (sysfs_add_file_mode_ns)
      [   61.002090] [<c0321044>] (sysfs_add_file) from
      [   61.010619] [<c0321094>] (sysfs_add_file_to_group)
      [   61.019263] [<bf24a47c>] (usbport_trig_add_usb_dev_ports [ledtrig_usbport])
      [   61.031002] [<c0430414>] (bus_for_each_dev)
      [   61.042106] [<c0497dc4>] (usb_for_each_dev)
      [   61.050375] [<bf24a2ac>] (usbport_trig_activate [ledtrig_usbport])
      [   61.060685] [<c04e1708>] (led_trigger_set) from [<c04e1834>]
      [...]
      Signed-off-by: NChristian Lamparter <chunkeey@googlemail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa759365
  8. 28 8月, 2017 4 次提交
    • D
      usb: Add device quirk for Logitech HD Pro Webcam C920-C · a1279ef7
      Dmitry Fleytman 提交于
      Commit e0429362
      ("usb: Add device quirk for Logitech HD Pro Webcams C920 and C930e")
      introduced quirk to workaround an issue with some Logitech webcams.
      
      Apparently model C920-C has the same issue so applying
      the same quirk as well.
      
      See aforementioned commit message for detailed explanation of the problem.
      Signed-off-by: NDmitry Fleytman <dmitry@daynix.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1279ef7
    • K
      usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard · de3af5bf
      Kai-Heng Feng 提交于
      Corsair Strafe RGB keyboard has trouble to initialize:
      
      [ 1.679455] usb 3-6: new full-speed USB device number 4 using xhci_hcd
      [ 6.871136] usb 3-6: unable to read config index 0 descriptor/all
      [ 6.871138] usb 3-6: can't read configurations, error -110
      [ 6.991019] usb 3-6: new full-speed USB device number 5 using xhci_hcd
      [ 12.246642] usb 3-6: unable to read config index 0 descriptor/all
      [ 12.246644] usb 3-6: can't read configurations, error -110
      [ 12.366555] usb 3-6: new full-speed USB device number 6 using xhci_hcd
      [ 17.622145] usb 3-6: unable to read config index 0 descriptor/all
      [ 17.622147] usb 3-6: can't read configurations, error -110
      [ 17.742093] usb 3-6: new full-speed USB device number 7 using xhci_hcd
      [ 22.997715] usb 3-6: unable to read config index 0 descriptor/all
      [ 22.997716] usb 3-6: can't read configurations, error -110
      
      Although it may work after several times unpluging/pluging:
      
      [ 68.195240] usb 3-6: new full-speed USB device number 11 using xhci_hcd
      [ 68.337459] usb 3-6: New USB device found, idVendor=1b1c, idProduct=1b20
      [ 68.337463] usb 3-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      [ 68.337466] usb 3-6: Product: Corsair STRAFE RGB Gaming Keyboard
      [ 68.337468] usb 3-6: Manufacturer: Corsair
      [ 68.337470] usb 3-6: SerialNumber: 0F013021AEB8046755A93ED3F5001941
      
      Tried three quirks: USB_QUIRK_DELAY_INIT, USB_QUIRK_NO_LPM and
      USB_QUIRK_DEVICE_QUALIFIER, user confirmed that USB_QUIRK_DELAY_INIT alone
      can workaround this issue. Hence add the quirk for Corsair Strafe RGB.
      
      BugLink: https://bugs.launchpad.net/bugs/1678477Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      de3af5bf
    • A
      USB: core: constify vm_operations_struct · b64d47ae
      Arvind Yadav 提交于
      vm_operations_struct are not supposed to change at runtime.
      All functions working with const vm_operations_struct.
      So mark the non-const structs as const.
      Signed-off-by: NArvind Yadav <arvind.yadav.cs@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b64d47ae
    • D
      USB: core: Avoid race of async_completed() w/ usbdev_release() · ed62ca2f
      Douglas Anderson 提交于
      While running reboot tests w/ a specific set of USB devices (and
      slub_debug enabled), I found that once every few hours my device would
      be crashed with a stack that looked like this:
      
      [   14.012445] BUG: spinlock bad magic on CPU#0, modprobe/2091
      [   14.012460]  lock: 0xffffffc0cb055978, .magic: ffffffc0, .owner: cryption contexts: %lu/%lu
      [   14.012460] /1025536097, .owner_cpu: 0
      [   14.012466] CPU: 0 PID: 2091 Comm: modprobe Not tainted 4.4.79 #352
      [   14.012468] Hardware name: Google Kevin (DT)
      [   14.012471] Call trace:
      [   14.012483] [<....>] dump_backtrace+0x0/0x160
      [   14.012487] [<....>] show_stack+0x20/0x28
      [   14.012494] [<....>] dump_stack+0xb4/0xf0
      [   14.012500] [<....>] spin_dump+0x8c/0x98
      [   14.012504] [<....>] spin_bug+0x30/0x3c
      [   14.012508] [<....>] do_raw_spin_lock+0x40/0x164
      [   14.012515] [<....>] _raw_spin_lock_irqsave+0x64/0x74
      [   14.012521] [<....>] __wake_up+0x2c/0x60
      [   14.012528] [<....>] async_completed+0x2d0/0x300
      [   14.012534] [<....>] __usb_hcd_giveback_urb+0xc4/0x138
      [   14.012538] [<....>] usb_hcd_giveback_urb+0x54/0xf0
      [   14.012544] [<....>] xhci_irq+0x1314/0x1348
      [   14.012548] [<....>] usb_hcd_irq+0x40/0x50
      [   14.012553] [<....>] handle_irq_event_percpu+0x1b4/0x3f0
      [   14.012556] [<....>] handle_irq_event+0x4c/0x7c
      [   14.012561] [<....>] handle_fasteoi_irq+0x158/0x1c8
      [   14.012564] [<....>] generic_handle_irq+0x30/0x44
      [   14.012568] [<....>] __handle_domain_irq+0x90/0xbc
      [   14.012572] [<....>] gic_handle_irq+0xcc/0x18c
      
      Investigation using kgdb() found that the wait queue that was passed
      into wake_up() had been freed (it was filled with slub_debug poison).
      
      I analyzed and instrumented the code and reproduced.  My current
      belief is that this is happening:
      
      1. async_completed() is called (from IRQ).  Moves "as" onto the
         completed list.
      2. On another CPU, proc_reapurbnonblock_compat() calls
         async_getcompleted().  Blocks on spinlock.
      3. async_completed() releases the lock; keeps running; gets blocked
         midway through wake_up().
      4. proc_reapurbnonblock_compat() => async_getcompleted() gets the
         lock; removes "as" from completed list and frees it.
      5. usbdev_release() is called.  Frees "ps".
      6. async_completed() finally continues running wake_up().  ...but
         wake_up() has a pointer to the freed "ps".
      
      The instrumentation that led me to believe this was based on adding
      some trace_printk() calls in a select few functions and then using
      kdb's "ftdump" at crash time.  The trace follows (NOTE: in the trace
      below I cheated a little bit and added a udelay(1000) in
      async_completed() after releasing the spinlock because I wanted it to
      trigger quicker):
      
      <...>-2104   0d.h2 13759034us!: async_completed at start: as=ffffffc0cc638200
      mtpd-2055    3.... 13759356us : async_getcompleted before spin_lock_irqsave
      mtpd-2055    3d..1 13759362us : async_getcompleted after list_del_init: as=ffffffc0cc638200
      mtpd-2055    3.... 13759371us+: proc_reapurbnonblock_compat: free_async(ffffffc0cc638200)
      mtpd-2055    3.... 13759422us+: async_getcompleted before spin_lock_irqsave
      mtpd-2055    3.... 13759479us : usbdev_release at start: ps=ffffffc0cc042080
      mtpd-2055    3.... 13759487us : async_getcompleted before spin_lock_irqsave
      mtpd-2055    3.... 13759497us!: usbdev_release after kfree(ps): ps=ffffffc0cc042080
      <...>-2104   0d.h2 13760294us : async_completed before wake_up(): as=ffffffc0cc638200
      
      To fix this problem we can just move the wake_up() under the ps->lock.
      There should be no issues there that I'm aware of.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed62ca2f
  9. 17 8月, 2017 1 次提交
    • M
      usb: Increase root hub reset signaling time to prevent retry · 74072bae
      Mathias Nyman 提交于
      Save 80ms device enumeration time by increasing root hub port reset time
      
      The 50ms reset signaling time is not enough for most root hub ports.
      Increasing the reset time to 60ms allows host controllers to finish port
      reset and removes a retry causing an extra 50ms delay.
      
      The USB 2 specification requires "at least 50ms" for driving root
      port reset. The current msleep is exactly 50ms which may not be
      enough if there are any delays between writing the reset bit to host
      controller portsc register and phy actually driving reset.
      
      On Haswell, Skylake and Kabylake xHC port reset took in average 52-59ms
      
      The 80ms improvement comes from (40ms * 2 port resets) save at enumeration
      for each device connected to a root hub port.
      
      more details about root port reset in USB2 section 7.1.7.5:.
      "Software must ensure that resets issued to the root ports drive reset
      long enough to overwhelm any concurrent resume attempts by downstream
      devices. It is required that resets from root ports have a duration of
      at least 50 ms (TDRSTR).
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74072bae
  10. 11 8月, 2017 4 次提交
  11. 30 7月, 2017 2 次提交
  12. 22 7月, 2017 2 次提交
  13. 30 6月, 2017 1 次提交
  14. 29 6月, 2017 2 次提交
  15. 27 6月, 2017 1 次提交
  16. 16 6月, 2017 1 次提交
    • M
      usb: Avoid unnecessary LPM enabling and disabling during suspend and resume · d590c231
      Mathias Nyman 提交于
      The original motivation for disabling/enabling Link PM at device
      suspend/resume was to force link state to go via U0 before suspend sets
      the link state to U3. Going directly from U2 to U3 is not allowed.
      
      Disabling LPM will forced the link state to U0, but will send a lot of
      Set port feature requests for evert suspend and resume.
      
      This is not needed as Hub hardware will take care of going via U0
      when a U2 -> U3 transition is requested [1]
      
      [1] USB 3.1 specification section 10.16.2.10 Set Port Feature:
      
      "If the value is 3, then host software wants to selectively suspend the
      device connected to this port. The hub shall transition the link to U3
      from any of the other U states using allowed link state transitions.
      If the port is not already in the U0 state, then it shall transition the
      port to the U0 state and then initiate the transition to U3.
      While this state is active, the hub does not propagate downstream-directed
      traffic to this port, but the hub will respond to resume signaling from the
      port"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d590c231
  17. 15 6月, 2017 1 次提交
    • R
      USB / PCI / PM: Allow the PCI core to do the resume cleanup · d438aa22
      Rafael J. Wysocki 提交于
      hcd_pci_resume_noirq() used as a universal _resume_noirq handler for
      PCI USB controllers calls pci_back_from_sleep() which is unnecessary
      and may become problematic.
      
      It is unnecessary, because the PCI bus type carries out post-suspend
      cleanup of all PCI devices during resume and that covers all things
      done by the pci_back_from_sleep().  There is no reason why USB cannot
      follow all of the other PCI devices in that respect.
      
      It will become problematic after subsequent changes that make it
      possible to go back to sleep again after executing dpm_resume_noirq()
      if no valid system wakeup events have been detected at that point.
      Namely, calling pci_back_from_sleep() at the _resume_noirq stage
      will cause the wakeup status of the devices in question to be cleared
      and if any of them has triggered system wakeup, that event may be
      missed then.
      
      For the above reasons, drop the pci_back_from_sleep() invocation
      from hcd_pci_resume_noirq().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d438aa22
  18. 13 6月, 2017 4 次提交
  19. 03 6月, 2017 1 次提交
    • M
      usb: optimize acpi companion search for usb port devices · ed18c5fa
      Mathias Nyman 提交于
      This optimization significantly reduces xhci driver load time.
      
      In ACPI tables the acpi companion port devices are children of
      the hub device. The port devices are identified by their port number
      returned by the ACPI _ADR method.
      _ADR 0 is reserved for the root hub device.
      
      The current implementation to find a acpi companion port device
      loops through all acpi port devices under that parent hub, evaluating
      their _ADR method each time a new port device is added.
      
      for a xHC controller with 25 ports under its roothub it
      will end up invoking ACPI bytecode 625 times before all ports
      are ready, making it really slow.
      
      The _ADR values are already read and cached earler. So instead of
      running the bytecode again we can check the cached _ADR value first,
      and then fall back to the old way.
      
      As one of the more significant changes, the xhci load time on
      Intel kabylake reduced by 70%, (28ms) from
      initcall xhci_pci_init+0x0/0x49 returned 0 after 39537 usecs
      to
      initcall xhci_pci_init+0x0/0x49 returned 0 after 11270 usecs
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed18c5fa
  20. 17 5月, 2017 6 次提交