1. 17 3月, 2017 1 次提交
  2. 02 3月, 2017 2 次提交
  3. 28 2月, 2017 1 次提交
  4. 25 1月, 2017 1 次提交
    • L
      USB: Add quirk for WORLDE easykey.25 MIDI keyboard · d9b2997e
      Lukáš Lalinský 提交于
      Add a quirk for WORLDE easykey.25 MIDI keyboard (idVendor=0218,
      idProduct=0401). The device reports that it has config string
      descriptor at index 3, but when the system selects the configuration
      and tries to get the description, it returns a -EPROTO error,
      the communication restarts and this keeps repeating over and over again.
      Not requesting the string descriptor makes the device work correctly.
      
      Relevant info from Wireshark:
      
      [...]
      
      CONFIGURATION DESCRIPTOR
          bLength: 9
          bDescriptorType: 0x02 (CONFIGURATION)
          wTotalLength: 101
          bNumInterfaces: 2
          bConfigurationValue: 1
          iConfiguration: 3
          Configuration bmAttributes: 0xc0  SELF-POWERED  NO REMOTE-WAKEUP
              1... .... = Must be 1: Must be 1 for USB 1.1 and higher
              .1.. .... = Self-Powered: This device is SELF-POWERED
              ..0. .... = Remote Wakeup: This device does NOT support remote wakeup
          bMaxPower: 50  (100mA)
      
      [...]
      
           45 0.369104       host                  2.38.0                USB      64     GET DESCRIPTOR Request STRING
      
      [...]
      
      URB setup
          bmRequestType: 0x80
              1... .... = Direction: Device-to-host
              .00. .... = Type: Standard (0x00)
              ...0 0000 = Recipient: Device (0x00)
          bRequest: GET DESCRIPTOR (6)
          Descriptor Index: 0x03
          bDescriptorType: 0x03
          Language Id: English (United States) (0x0409)
          wLength: 255
      
           46 0.369255       2.38.0                host                  USB      64     GET DESCRIPTOR Response STRING[Malformed Packet]
      
      [...]
      
      Frame 46: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface 0
      USB URB
          [Source: 2.38.0]
          [Destination: host]
          URB id: 0xffff88021f62d480
          URB type: URB_COMPLETE ('C')
          URB transfer type: URB_CONTROL (0x02)
          Endpoint: 0x80, Direction: IN
          Device: 38
          URB bus id: 2
          Device setup request: not relevant ('-')
          Data: present (0)
          URB sec: 1484896277
          URB usec: 455031
          URB status: Protocol error (-EPROTO) (-71)
          URB length [bytes]: 0
          Data length [bytes]: 0
          [Request in: 45]
          [Time from request: 0.000151000 seconds]
          Unused Setup Header
          Interval: 0
          Start frame: 0
          Copy of Transfer Flags: 0x00000200
          Number of ISO descriptors: 0
      [Malformed Packet: USB]
          [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
              [Malformed Packet (Exception occurred)]
              [Severity level: Error]
              [Group: Malformed]
      Signed-off-by: NLukáš Lalinský <lukas@oxygene.sk>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9b2997e
  5. 19 1月, 2017 2 次提交
    • W
      usb: hcd: initialize hcd->flags to 0 when rm hcd · 76b8db0d
      William wu 提交于
      On some platforms(e.g. rk3399 board), we can call hcd_add/remove
      consecutively without calling usb_put_hcd/usb_create_hcd in between,
      so hcd->flags can be stale.
      
      If the HC dies due to whatever reason then without this patch we get
      the below error on next hcd_add.
      
      [173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
      [173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
      [173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
      [173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
      [173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
      [173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
      [173.297222] usb usb6: Product: xHCI Host Controller
      [173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
      [173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
      [173.298680] hub 6-0:1.0: USB hub found
      [173.298749] hub 6-0:1.0: 1 port detected
      [173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
      [173.395418] hub 5-0:1.0: activate --> -19
      [173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
      [173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
      [173.603513] Hardware name: Google Kevin (DT)
      [173.603531] Call trace:
      [173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
      [173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
      [173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
      [173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
      [173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
      [173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
      [173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
      [173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
      [173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
      [173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
      [173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
      ...
      [173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
      [173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
      [173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
      [173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
      [173.604607] [<0000000000b16000>] 0xb16000
      [173.604622] handlers:
      [173.604648] [<ffffffc000642084>] usb_hcd_irq
      [173.604673] Disabling IRQ #228
      Signed-off-by: NWilliam wu <wulf@rock-chips.com>
      Acked-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76b8db0d
    • J
      usb: core: update comments for send message functions · 123b7b30
      Jaejoong Kim 提交于
      The commonly use of bottom halves are tasklet and workqueue. The big
      difference between tasklet and workqueue is that the tasklet runs in
      an interrupt context and the workqueue runs in a process context,
      which means it can sleep if need be.
      
      The comment for usb_control/interrupt/bulk_msg() functions note that do
      not use this function within an interrupt context, like a 'bottom half'
      handler. With this comment, it makes confuse about usage of these
      functions.
      
      To more clarify, remove 'bottom half' comment.
      Signed-off-by: NJaejoong Kim <climbbb.kim@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      123b7b30
  6. 11 1月, 2017 1 次提交
  7. 06 1月, 2017 2 次提交
    • A
      USB: fix problems with duplicate endpoint addresses · 0a8fd134
      Alan Stern 提交于
      When checking a new device's descriptors, the USB core does not check
      for duplicate endpoint addresses.  This can cause a problem when the
      sysfs files for those endpoints are created; trying to create multiple
      files with the same name will provoke a WARNING:
      
      WARNING: CPU: 2 PID: 865 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x8a/0xa0
      sysfs: cannot create duplicate filename
      '/devices/platform/dummy_hcd.0/usb2/2-1/2-1:64.0/ep_05'
      Kernel panic - not syncing: panic_on_warn set ...
      
      CPU: 2 PID: 865 Comm: kworker/2:1 Not tainted 4.9.0-rc7+ #34
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
      Workqueue: usb_hub_wq hub_event
       ffff88006bee64c8 ffffffff81f96b8a ffffffff00000001 1ffff1000d7dcc2c
       ffffed000d7dcc24 0000000000000001 0000000041b58ab3 ffffffff8598b510
       ffffffff81f968f8 ffffffff850fee20 ffffffff85cff020 dffffc0000000000
      Call Trace:
       [<     inline     >] __dump_stack lib/dump_stack.c:15
       [<ffffffff81f96b8a>] dump_stack+0x292/0x398 lib/dump_stack.c:51
       [<ffffffff8168c88e>] panic+0x1cb/0x3a9 kernel/panic.c:179
       [<ffffffff812b80b4>] __warn+0x1c4/0x1e0 kernel/panic.c:542
       [<ffffffff812b8195>] warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:565
       [<ffffffff819e70ca>] sysfs_warn_dup+0x8a/0xa0 fs/sysfs/dir.c:30
       [<ffffffff819e7308>] sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:59
       [<     inline     >] create_dir lib/kobject.c:71
       [<ffffffff81fa1b07>] kobject_add_internal+0x227/0xa60 lib/kobject.c:229
       [<     inline     >] kobject_add_varg lib/kobject.c:366
       [<ffffffff81fa2479>] kobject_add+0x139/0x220 lib/kobject.c:411
       [<ffffffff82737a63>] device_add+0x353/0x1660 drivers/base/core.c:1088
       [<ffffffff82738d8d>] device_register+0x1d/0x20 drivers/base/core.c:1206
       [<ffffffff82cb77d3>] usb_create_ep_devs+0x163/0x260 drivers/usb/core/endpoint.c:195
       [<ffffffff82c9f27b>] create_intf_ep_devs+0x13b/0x200 drivers/usb/core/message.c:1030
       [<ffffffff82ca39d3>] usb_set_configuration+0x1083/0x18d0 drivers/usb/core/message.c:1937
       [<ffffffff82cc9e2e>] generic_probe+0x6e/0xe0 drivers/usb/core/generic.c:172
       [<ffffffff82caa7fa>] usb_probe_device+0xaa/0xe0 drivers/usb/core/driver.c:263
      
      This patch prevents the problem by checking for duplicate endpoint
      addresses during enumeration and skipping any duplicates.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NAndrey Konovalov <andreyknvl@google.com>
      Tested-by: NAndrey Konovalov <andreyknvl@google.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a8fd134
    • G
      usb: hub: Move hub_port_disable() to fix warning if PM is disabled · 3bc02bce
      Geert Uytterhoeven 提交于
      If CONFIG_PM=n:
      
          drivers/usb/core/hub.c:107: warning: ‘hub_usb3_port_prepare_disable’ declared inline after being called
          drivers/usb/core/hub.c:107: warning: previous declaration of ‘hub_usb3_port_prepare_disable’ was here
      
      To fix this, move hub_port_disable() after
      hub_usb3_port_prepare_disable(), and adjust forward declarations.
      
      Fixes: 37be6676 ("usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bc02bce
  8. 25 12月, 2016 1 次提交
  9. 06 12月, 2016 1 次提交
    • R
      usb: core: usbport: Use proper LED API to fix potential crash · 89778ba3
      Rafał Miłecki 提交于
      Calling brightness_set manually isn't safe as some LED drivers don't
      implement this callback. The best idea is to just use a proper helper
      which will fallback to the brightness_set_blocking callback if needed.
      
      This fixes:
      [ 1461.761528] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      (...)
      [ 1462.117049] Backtrace:
      [ 1462.119521] [<bf228164>] (usbport_trig_port_store [ledtrig_usbport]) from [<c023f758>] (dev_attr_store+0x20/0x2c)
      [ 1462.129826]  r7:dcabc7c0 r6:dee0ff80 r5:00000002 r4:bf228164
      [ 1462.135511] [<c023f738>] (dev_attr_store) from [<c0169310>] (sysfs_kf_write+0x48/0x4c)
      [ 1462.143459]  r5:00000002 r4:c023f738
      [ 1462.147049] [<c01692c8>] (sysfs_kf_write) from [<c0168ab8>] (kernfs_fop_write+0xf8/0x1f8)
      [ 1462.155258]  r5:00000002 r4:df4a1000
      [ 1462.158850] [<c01689c0>] (kernfs_fop_write) from [<c0100c78>] (__vfs_write+0x34/0x120)
      [ 1462.166800]  r10:00000000 r9:dee0e000 r8:c000fc24 r7:00000002 r6:dee0ff80 r5:c01689c0
      [ 1462.174660]  r4:df727a80
      [ 1462.177204] [<c0100c44>] (__vfs_write) from [<c0101ae4>] (vfs_write+0xac/0x170)
      [ 1462.184543]  r9:dee0e000 r8:c000fc24 r7:dee0ff80 r6:b6f092d0 r5:df727a80 r4:00000002
      [ 1462.192319] [<c0101a38>] (vfs_write) from [<c01028dc>] (SyS_write+0x4c/0xa8)
      [ 1462.199396]  r9:dee0e000 r8:c000fc24 r7:00000002 r6:b6f092d0 r5:df727a80 r4:df727a80
      [ 1462.207174] [<c0102890>] (SyS_write) from [<c000fa60>] (ret_fast_syscall+0x0/0x3c)
      [ 1462.214774]  r7:00000004 r6:ffffffff r5:00000000 r4:00000000
      [ 1462.220456] Code: bad PC value
      [ 1462.223560] ---[ end trace 676638a3a12c7a56 ]---
      Reported-by: NRalph Sennhauser <ralph.sennhauser@gmail.com>
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Fixes: 0f247626 ("usb: core: Introduce a USB port LED trigger")
      Cc: stable@vger.kernel.org # 4.9+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89778ba3
  10. 05 12月, 2016 1 次提交
    • G
      usb: hub: Wait for connection to be reestablished after port reset · 22547c4c
      Guenter Roeck 提交于
      On a system with a defective USB device connected to an USB hub,
      an endless sequence of port connect events was observed. The sequence
      of events as observed is as follows:
      
      - Port reports connected event (port status=USB_PORT_STAT_CONNECTION).
      - Event handler debounces port and resets it by calling hub_port_reset().
      - hub_port_reset() calls hub_port_wait_reset() to wait for the reset
        to complete.
      - The reset completes, but USB_PORT_STAT_CONNECTION is not immediately
        set in the port status register.
      - hub_port_wait_reset() returns -ENOTCONN.
      - Port initialization sequence is aborted.
      - A few milliseconds later, the port again reports a connected event,
        and the sequence repeats.
      
      This continues either forever or, randomly, stops if the connection
      is already re-established when the port status is read. It results in
      a high rate of udev events. This in turn destabilizes userspace since
      the above sequence holds the device mutex pretty much continuously
      and prevents userspace from actually reading the device status.
      
      To prevent the problem from happening, let's wait for the connection
      to be re-established after a port reset. If the device was actually
      disconnected, the code will still return an error, but it will do so
      only after the long reset timeout.
      
      Cc: Douglas Anderson <dianders@chromium.org>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22547c4c
  11. 18 11月, 2016 1 次提交
  12. 17 11月, 2016 1 次提交
  13. 03 11月, 2016 3 次提交
  14. 30 10月, 2016 1 次提交
  15. 27 10月, 2016 1 次提交
  16. 28 9月, 2016 1 次提交
  17. 27 9月, 2016 3 次提交
    • Y
      usb: hub: change CLEAR_FEATURE to SET_FEATURE · 4e248000
      Yonglong Wu 提交于
      In USB20 specification, describes in chapter 9.4.5: The Remote Wakeup
      field can be modified by the SetFeature() and ClearFeature() requests
      using the DEVICE_REMOTE_WAKEUP feature selector.
      
      In USB30 specification, also describes in chapter 9.4.5: The Function
      Remote Wakeup field can be modified by the SetFeature() requests
      using the FUNCTION_SUSPEND feature selector. In chapter 9.4.9 Set
      Feature reference, it describes Function Remote Wake Enabled/Disabled
      at suspend options by SET_FEATURE.
      
      In USB30 specification only mentioned SetFeature(), so we need use
      SET_FEATURE replace CLEAR_FEATURE to disable USB30 function remote
      wakeup in suspend options.
      Signed-off-by: NYonglong Wu <yonglong.wu@mediatek.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e248000
    • R
      usb: core: Introduce a USB port LED trigger · 0f247626
      Rafał Miłecki 提交于
      This commit adds a new trigger responsible for turning on LED when USB
      device gets connected to the selected USB port. This can can useful for
      various home routers that have USB port(s) and a proper LED telling user
      a device is connected.
      
      The trigger gets its documentation file but basically it just requires
      enabling it and selecting USB ports (e.g. echo 1 > ports/usb1-1).
      
      There was a long discussion on design of this driver. Its current state
      is a result of picking them most adjustable solution as others couldn't
      handle all cases.
      
      1) It wasn't possible for the driver to register separated trigger for
         each USB port. Some physical USB ports are handled by more than one
         controller and so by more than one USB port. E.g. USB 2.0 physical
         port may be handled by OHCI's port and EHCI's port.
         It's also not possible to assign more than 1 trigger to a single LED
         and implementing such feature would be tricky due to syncing triggers
         and sysfs conflicts with old triggers.
      
      2) Another idea was to register trigger per USB hub. This wouldn't allow
         handling devices with multiple USB LEDs and controllers (hubs)
         controlling more than 1 physical port. It's common for hubs to have
         few ports and each may have its own LED.
      
      This final trigger is highly flexible. It allows selecting any USB ports
      for any LED. It was also modified (comparing to the initial version) to
      allow choosing ports rather than having user /guess/ proper names. It
      was successfully tested on SmartRG SR400ac which has 3 USB LEDs,
      2 physical ports and 3 controllers.
      
      It was noted USB subsystem already has usb-gadget and usb-host triggers
      but they are pretty trivial ones. They indicate activity only and can't
      have ports specified.
      
      In future it may be good idea to consider adding activity support to
      usbport as well. This should allow switching to this more generic driver
      and maybe marking old ones as obsolete.
      This can be implemented with another sysfs file for setting mode. The
      default mode wouldn't change so there won't be ABI breakage and so such
      feature can be safely implemented later.
      
      There was also an idea of supporting other devices (PCI, SDIO, etc.) but
      as this driver already contains some USB specific code (and will get
      more) these should be probably separated drivers (triggers).
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f247626
    • B
      usb: core: hcd: add missing header dependencies · 35be784c
      Baoyou Xie 提交于
      We get 1 warning when building kernel with W=1:
      drivers/usb/core/hcd.c:2390:5: warning: no previous prototype for 'usb_bus_start_enum' [-Wmissing-prototypes]
      
      In fact, these functions are declared in linux/usb/otg.h, so this patch
      adds the missing header dependencies.
      Signed-off-by: NBaoyou Xie <baoyou.xie@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35be784c
  18. 16 9月, 2016 1 次提交
    • A
      USB: change bInterval default to 10 ms · 08c5cd37
      Alan Stern 提交于
      Some full-speed mceusb infrared transceivers contain invalid endpoint
      descriptors for their interrupt endpoints, with bInterval set to 0.
      In the past they have worked out okay with the mceusb driver, because
      the driver sets the bInterval field in the descriptor to 1,
      overwriting whatever value may have been there before.  However, this
      approach was never sanctioned by the USB core, and in fact it does not
      work with xHCI controllers, because they use the bInterval value that
      was present when the configuration was installed.
      
      Currently usbcore uses 32 ms as the default interval if the value in
      the endpoint descriptor is invalid.  It turns out that these IR
      transceivers don't work properly unless the interval is set to 10 ms
      or below.  To work around this mceusb problem, this patch changes the
      endpoint-descriptor parsing routine, making the default interval value
      be 10 ms rather than 32 ms.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NWade Berrier <wberrier@gmail.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08c5cd37
  19. 13 9月, 2016 1 次提交
    • R
      usb: core: setup dma_pfn_offset for USB devices and, interfaces · b44bbc46
      Roger Quadros 提交于
      If dma_pfn_offset is not inherited correctly from the host controller,
      it might result in sub-optimal configuration as bounce
      buffer limit might be set to less than optimal level.
      
      Consider the mass storage device case.
      USB storage driver creates a scsi host for the mass storage interface in
      drivers/usb/storage/usb.c
      The scsi host parent device is nothing but the the USB interface device.
      Now, __scsi_init_queue() calls scsi_calculate_bounce_limit() to find out
      and set the block layer bounce limit.
      scsi_calculate_bounce_limit() uses dma_max_pfn(host_dev) to get the
      bounce_limit. host_dev is nothing but the device representing the
      mass storage interface.
      If that device doesn't have the right dma_pfn_offset, then dma_max_pfn()
      is messed up and the bounce buffer limit is wrong.
      
      e.g. On Keystone 2 systems, dma_max_pfn() is 0x87FFFF and dma_mask_pfn
      is 0xFFFFF. Consider a mass storage use case: Without this patch,
      usb scsi host device (usb-storage) will get a dma_pfn_offset of 0 resulting
      in a dma_max_pfn() of 0xFFFFF within the scsi layer
      (scsi_calculate_bounce_limit()).
      This will result in bounce buffers being unnecessarily used.
      
      Hint: On 32-bit ARM platforms dma_max_pfn() = dma_mask_pfn + dma_pfn_offset
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b44bbc46
  20. 09 9月, 2016 1 次提交
  21. 02 9月, 2016 1 次提交
  22. 31 8月, 2016 4 次提交
  23. 24 8月, 2016 1 次提交
    • A
      USB: avoid left shift by -1 · 53e5f36f
      Alan Stern 提交于
      UBSAN complains about a left shift by -1 in proc_do_submiturb().  This
      can occur when an URB is submitted for a bulk or control endpoint on
      a high-speed device, since the code doesn't bother to check the
      endpoint type; normally only interrupt or isochronous endpoints have
      a nonzero bInterval value.
      
      Aside from the fact that the operation is illegal, it shouldn't matter
      because the result isn't used.  Still, in theory it could cause a
      hardware exception or other problem, so we should work around it.
      This patch avoids doing the left shift unless the shift amount is >= 0.
      
      The same piece of code has another problem.  When checking the device
      speed (the exponential encoding for interrupt endpoints is used only
      by high-speed or faster devices), we need to look for speed >=
      USB_SPEED_SUPER as well as speed == USB_SPEED HIGH.  The patch adds
      this check.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NVittorio Zecca <zeccav@gmail.com>
      Tested-by: NVittorio Zecca <zeccav@gmail.com>
      Suggested-by: NBjørn Mork <bjorn@mork.no>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53e5f36f
  24. 23 8月, 2016 1 次提交
  25. 09 8月, 2016 6 次提交
    • P
      usb: core: of.c: fix defined but not declare warning · 0573f2c5
      Peter Chen 提交于
      The helper usb_of_get_child_node is defined at of.c, but missing its
      declare as a global function. Fix it by adding related header file
      as well as compile it on conditional of CONFIG_OF.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: linux-usb@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Ben Dooks <ben.dooks@codethink.co.uk>
      Cc: linux-kernel@lists.codethink.co.uk
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Reported-by: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0573f2c5
    • M
      usb: remove redundant dependency on USB_SUPPORT · a26a1422
      Masahiro Yamada 提交于
      The whole Kconfig entries of the USB subsystem are surrounded with
      "if USB_SUPPORT" ... "endif", so CONFIG_USB_SUPPORT=y is surely met
      when these two Kconfig options are visible.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a26a1422
    • A
      USB: remove race condition in usbfs/libusb when using reap-after-disconnect · 5cce4382
      Alan Stern 提交于
      Hans de Goede has reported a difficulty in the Linux port of libusb.
      When a device is removed, the poll() system call in usbfs starts
      returning POLLERR as soon as udev->state is set to
      USB_STATE_NOTATTACHED, but the outstanding URBs are not available for
      reaping until some time later (after usbdev_remove() has been called).
      This is awkward for libusb or other usbfs clients, although not an
      insuperable problem.
      
      At any rate, it's easy to change usbfs so that it returns POLLHUP as
      soon as the state becomes USB_STATE_NOTATTACHED but it doesn't return
      POLLERR until after the outstanding URBs have completed.  That's what
      this patch does; it uses the fact that ps->list is always on the
      dev->filelist list until usbdev_remove() takes it off, which happens
      after all the outstanding URBs have been cancelled.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5cce4382
    • J
      usb: devio, do not warn when allocation fails · 70f7ca9a
      Jiri Slaby 提交于
      usbdev_mmap allocates a buffer. The size of the buffer is determined
      by a user. So with this code (no need to be root):
      
      	int fd = open("/dev/bus/usb/001/001", O_RDONLY);
      	mmap(NULL, 0x800000, PROT_READ, MAP_SHARED, fd, 0);
      
      we can see a warning:
      
      WARNING: CPU: 0 PID: 21771 at ../mm/page_alloc.c:3563 __alloc_pages_slowpath+0x1036/0x16e0()
      ...
      Call Trace:
       [<ffffffff8117a3ae>] ? warn_slowpath_null+0x2e/0x40
       [<ffffffff815178b6>] ? __alloc_pages_slowpath+0x1036/0x16e0
       [<ffffffff81516880>] ? warn_alloc_failed+0x250/0x250
       [<ffffffff8151226b>] ? get_page_from_freelist+0x75b/0x28b0
       [<ffffffff815184e3>] ? __alloc_pages_nodemask+0x583/0x6b0
       [<ffffffff81517f60>] ? __alloc_pages_slowpath+0x16e0/0x16e0
       [<ffffffff810565d4>] ? dma_generic_alloc_coherent+0x104/0x220
       [<ffffffffa0269e56>] ? hcd_buffer_alloc+0x1d6/0x3e0 [usbcore]
       [<ffffffffa0269c80>] ? hcd_buffer_destroy+0xa0/0xa0 [usbcore]
       [<ffffffffa0228f05>] ? usb_alloc_coherent+0x65/0x90 [usbcore]
       [<ffffffffa0275c05>] ? usbdev_mmap+0x1a5/0x770 [usbcore]
      ...
      
      Allocations like this one should be marked as __GFP_NOWARN. So do so.
      
      The size could be also clipped by something like:
      	if (size >= (1 << (MAX_ORDER + PAGE_SHIFT - 1)))
      		return -ENOMEM;
      But I think the overall limit of 16M (by usbfs_increase_memory_usage)
      is enough, so that we only silence the warning here.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Markus Rechberger <mrechberger@gmail.com>
      Fixes: f7d34b44 (USB: Add support for usbfs zerocopy.)
      Cc: 4.6+ <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70f7ca9a
    • A
      USB: validate wMaxPacketValue entries in endpoint descriptors · aed9d65a
      Alan Stern 提交于
      Erroneous or malicious endpoint descriptors may have non-zero bits in
      reserved positions, or out-of-bounds values.  This patch helps prevent
      these from causing problems by bounds-checking the wMaxPacketValue
      entries in endpoint descriptors and capping the values at the maximum
      allowed.
      
      This issue was first discovered and tests were conducted by Jake Lamberson
      <jake.lamberson1@gmail.com>, an intern working for Rosie Hall.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: Nroswest <roswest@cisco.com>
      Tested-by: Nroswest <roswest@cisco.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aed9d65a
    • A
      USB: hub: change the locking in hub_activate · 07d316a2
      Alan Stern 提交于
      The locking in hub_activate() is not adequate to provide full mutual
      exclusion with hub_quiesce().  The subroutine locks the hub's
      usb_interface, but the callers of hub_quiesce() (such as
      hub_pre_reset() and hub_event()) hold the lock to the hub's
      usb_device.
      
      This patch changes hub_activate() to make it acquire the same lock as
      those other routines.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org> #4.4+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      07d316a2