1. 22 3月, 2017 6 次提交
  2. 18 3月, 2017 1 次提交
  3. 17 3月, 2017 4 次提交
    • G
      usb: hub: Fix crash after failure to read BOS descriptor · 7b2db29f
      Guenter Roeck 提交于
      If usb_get_bos_descriptor() returns an error, usb->bos will be NULL.
      Nevertheless, it is dereferenced unconditionally in
      hub_set_initial_usb2_lpm_policy() if usb2_hw_lpm_capable is set.
      This results in a crash.
      
      usb 5-1: unable to get BOS descriptor
      ...
      Unable to handle kernel NULL pointer dereference at virtual address 00000008
      pgd = ffffffc00165f000
      [00000008] *pgd=000000000174f003, *pud=000000000174f003,
      		*pmd=0000000001750003, *pte=00e8000001751713
      Internal error: Oops: 96000005 [#1] PREEMPT SMP
      Modules linked in: uinput uvcvideo videobuf2_vmalloc cmac [ ... ]
      CPU: 5 PID: 3353 Comm: kworker/5:3 Tainted: G    B 4.4.52 #480
      Hardware name: Google Kevin (DT)
      Workqueue: events driver_set_config_work
      task: ffffffc0c3690000 ti: ffffffc0ae9a8000 task.ti: ffffffc0ae9a8000
      PC is at hub_port_init+0xc3c/0xd10
      LR is at hub_port_init+0xc3c/0xd10
      ...
      Call trace:
      [<ffffffc0007fbbfc>] hub_port_init+0xc3c/0xd10
      [<ffffffc0007fbe2c>] usb_reset_and_verify_device+0x15c/0x82c
      [<ffffffc0007fc5e0>] usb_reset_device+0xe4/0x298
      [<ffffffbffc0e3fcc>] rtl8152_probe+0x84/0x9b0 [r8152]
      [<ffffffc00080ca8c>] usb_probe_interface+0x244/0x2f8
      [<ffffffc000774a24>] driver_probe_device+0x180/0x3b4
      [<ffffffc000774e48>] __device_attach_driver+0xb4/0xe0
      [<ffffffc000772168>] bus_for_each_drv+0xb4/0xe4
      [<ffffffc0007747ec>] __device_attach+0xd0/0x158
      [<ffffffc000775080>] device_initial_probe+0x24/0x30
      [<ffffffc0007739d4>] bus_probe_device+0x50/0xe4
      [<ffffffc000770bd0>] device_add+0x414/0x738
      [<ffffffc000809fe8>] usb_set_configuration+0x89c/0x914
      [<ffffffc00080a120>] driver_set_config_work+0xc0/0xf0
      [<ffffffc000249bb8>] process_one_work+0x390/0x6b8
      [<ffffffc00024abcc>] worker_thread+0x480/0x610
      [<ffffffc000251a80>] kthread+0x164/0x178
      [<ffffffc0002045d0>] ret_from_fork+0x10/0x40
      
      Since we don't know anything about LPM capabilities without BOS descriptor,
      don't attempt to enable LPM if it is not available.
      
      Fixes: 890dae88 ("xhci: Enable LPM support only for hardwired ...")
      Cc: stable <stable@vger.kernel.org>
      Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b2db29f
    • O
      ACM gadget: fix endianness in notifications · cdd7928d
      Oliver Neukum 提交于
      The gadget code exports the bitfield for serial status changes
      over the wire in its internal endianness. The fix is to convert
      to little endian before sending it over the wire.
      Signed-off-by: NOliver Neukum <oneukum@suse.com>
      Tested-by: N家瑋 <momo1208@gmail.com>
      CC: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cdd7928d
    • J
      USB: usbtmc: fix probe error path · 2e47c535
      Johan Hovold 提交于
      Make sure to initialise the return value to avoid having allocation
      failures going unnoticed when allocating interrupt-endpoint resources.
      
      This prevents use-after-free or worse when the device is later unbound.
      
      Fixes: dbf3e7f6 ("Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.")
      Cc: stable <stable@vger.kernel.org>     # 4.6
      Cc: Dave Penkler <dpenkler@gmail.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e47c535
    • J
      USB: usbtmc: add missing endpoint sanity check · 687e0687
      Johan Hovold 提交于
      USBTMC devices are required to have a bulk-in and a bulk-out endpoint,
      but the driver failed to verify this, something which could lead to the
      endpoint addresses being taken from uninitialised memory.
      
      Make sure to zero all private data as part of allocation, and add the
      missing endpoint sanity check.
      
      Note that this also addresses a more recently introduced issue, where
      the interrupt-in-presence flag would also be uninitialised whenever the
      optional interrupt-in endpoint is not present. This in turn could lead
      to an interrupt urb being allocated, initialised and submitted based on
      uninitialised values.
      
      Fixes: dbf3e7f6 ("Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.")
      Fixes: 5b775f67 ("USB: add USB test and measurement class driver")
      Cc: stable <stable@vger.kernel.org>     # 2.6.28
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      687e0687
  4. 14 3月, 2017 9 次提交
    • D
      USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems · 6e9f44ea
      Dan Williams 提交于
      Add Quectel UC15, UC20, EC21, and EC25.  The EC20 is handled by
      qcserial due to a USB VID/PID conflict with an existing Acer
      device.
      Signed-off-by: NDan Williams <dcbw@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      6e9f44ea
    • B
      usb: musb: fix possible spinlock deadlock · bc1e2154
      Bin Liu 提交于
      The DSPS glue calls del_timer_sync() in its musb_platform_disable()
      implementation, which requires the caller to not hold a lock. But
      musb_remove() calls musb_platform_disable() will musb->lock held. This
      could causes spinlock deadlock.
      
      So change musb_remove() to call musb_platform_disable() without holds
      musb->lock. This doesn't impact the musb_platform_disable implementation
      in other glue drivers.
      
      root@am335x-evm:~# modprobe -r musb-dsps
      [  126.134879] musb-hdrc musb-hdrc.1: remove, state 1
      [  126.140465] usb usb2: USB disconnect, device number 1
      [  126.146178] usb 2-1: USB disconnect, device number 2
      [  126.416985] musb-hdrc musb-hdrc.1: USB bus 2 deregistered
      [  126.423943]
      [  126.425525] ======================================================
      [  126.431997] [ INFO: possible circular locking dependency detected ]
      [  126.438564] 4.11.0-rc1-00003-g1557f13bca04-dirty #77 Not tainted
      [  126.444852] -------------------------------------------------------
      [  126.451414] modprobe/778 is trying to acquire lock:
      [  126.456523]  (((&glue->timer))){+.-...}, at: [<c01b8788>] del_timer_sync+0x0/0xd0
      [  126.464403]
      [  126.464403] but task is already holding lock:
      [  126.470511]  (&(&musb->lock)->rlock){-.-...}, at: [<bf30b7f8>] musb_remove+0x50/0x1
      30 [musb_hdrc]
      [  126.479965]
      [  126.479965] which lock already depends on the new lock.
      [  126.479965]
      [  126.488531]
      [  126.488531] the existing dependency chain (in reverse order) is:
      [  126.496368]
      [  126.496368] -> #1 (&(&musb->lock)->rlock){-.-...}:
      [  126.502968]        otg_timer+0x80/0xec [musb_dsps]
      [  126.507990]        call_timer_fn+0xb4/0x390
      [  126.512372]        expire_timers+0xf0/0x1fc
      [  126.516754]        run_timer_softirq+0x80/0x178
      [  126.521511]        __do_softirq+0xc4/0x554
      [  126.525802]        irq_exit+0xe8/0x158
      [  126.529735]        __handle_domain_irq+0x58/0xb8
      [  126.534583]        __irq_usr+0x54/0x80
      [  126.538507]
      [  126.538507] -> #0 (((&glue->timer))){+.-...}:
      [  126.544636]        del_timer_sync+0x40/0xd0
      [  126.549066]        musb_remove+0x6c/0x130 [musb_hdrc]
      [  126.554370]        platform_drv_remove+0x24/0x3c
      [  126.559206]        device_release_driver_internal+0x14c/0x1e0
      [  126.565225]        bus_remove_device+0xd8/0x108
      [  126.569970]        device_del+0x1e4/0x308
      [  126.574170]        platform_device_del+0x24/0x8c
      [  126.579006]        platform_device_unregister+0xc/0x20
      [  126.584394]        dsps_remove+0x14/0x30 [musb_dsps]
      [  126.589595]        platform_drv_remove+0x24/0x3c
      [  126.594432]        device_release_driver_internal+0x14c/0x1e0
      [  126.600450]        driver_detach+0x38/0x6c
      [  126.604740]        bus_remove_driver+0x4c/0xa0
      [  126.609407]        SyS_delete_module+0x11c/0x1e4
      [  126.614252]        __sys_trace_return+0x0/0x10
      
      Fixes: ea2f35c0 ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
      Cc: <stable@vger.kernel.org> #4.9+
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc1e2154
    • B
      usb: musb: dsps: fix iounmap in error and exit paths · 6b7ad496
      Bin Liu 提交于
      Cleanly iounmap the pointer in error and exit paths.
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b7ad496
    • B
      usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer · 0090114d
      Bin Liu 提交于
      The CPPI 4.1 driver polls register to workaround the premature TX
      interrupt issue, but it causes audio playback underrun when triggered in
      Isoch transfers.
      
      Isoch doesn't do back-to-back transfers, the TX should be done by the
      time the next transfer is scheduled. So skip this polling workaround for
      Isoch transfer.
      
      Fixes: a655f481 ("usb: musb: musb_cppi41: handle pre-mature TX complete interrupt")
      Cc: <stable@vger.kernel.org> #4.1+
      Reported-by: NAlexandre Bailon <abailon@baylibre.com>
      Acked-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: NAlexandre Bailon <abailon@baylibre.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0090114d
    • S
      usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk · 3243367b
      Samuel Thibault 提交于
      Some USB 2.0 devices erroneously report millisecond values in
      bInterval. The generic config code manages to catch most of them,
      but in some cases it's not completely enough.
      
      The case at stake here is a USB 2.0 braille device, which wants to
      announce 10ms and thus sets bInterval to 10, but with the USB 2.0
      computation that yields to 64ms.  It happens that one can type fast
      enough to reach this interval and get the device buffers overflown,
      leading to problematic latencies.  The generic config code does not
      catch this case because the 64ms is considered a sane enough value.
      
      This change thus adds a USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL quirk
      to mark devices which actually report milliseconds in bInterval,
      and marks Vario Ultra devices as needing it.
      Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3243367b
    • J
      USB: wusbcore: fix NULL-deref at probe · 03ace948
      Johan Hovold 提交于
      Make sure to check the number of endpoints to avoid dereferencing a
      NULL-pointer or accessing memory beyond the endpoint array should a
      malicious device lack the expected endpoints.
      
      This specifically fixes the NULL-pointer dereference when probing HWA HC
      devices.
      
      Fixes: df365423 ("wusb: add the Wire Adapter (WA) core")
      Cc: stable <stable@vger.kernel.org>     # 2.6.28
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Cc: David Vrabel <david.vrabel@csr.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03ace948
    • J
      USB: uss720: fix NULL-deref at probe · f259ca3e
      Johan Hovold 提交于
      Make sure to check the number of endpoints to avoid dereferencing a
      NULL-pointer or accessing memory beyond the endpoint array should a
      malicious device lack the expected endpoints.
      
      Note that the endpoint access that causes the NULL-deref is currently
      only used for debugging purposes during probe so the oops only happens
      when dynamic debugging is enabled. This means the driver could be
      rewritten to continue to accept device with only two endpoints, should
      such devices exist.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f259ca3e
    • J
      USB: lvtest: fix NULL-deref at probe · 1dc56c52
      Johan Hovold 提交于
      Make sure to check the number of endpoints to avoid dereferencing a
      NULL-pointer should the probed device lack endpoints.
      
      Note that this driver does not bind to any devices by default.
      
      Fixes: ce21bfe6 ("USB: Add LVS Test device driver")
      Cc: stable <stable@vger.kernel.org>     # 3.17
      Cc: Pratyush Anand <pratyush.anand@gmail.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1dc56c52
    • J
      USB: idmouse: fix NULL-deref at probe · b0addd3f
      Johan Hovold 提交于
      Make sure to check the number of endpoints to avoid dereferencing a
      NULL-pointer should a malicious device lack endpoints.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0addd3f
  5. 10 3月, 2017 5 次提交
  6. 09 3月, 2017 8 次提交
  7. 08 3月, 2017 6 次提交
  8. 06 3月, 2017 1 次提交
    • R
      usb: gadget: udc: net2280: Fix tmp reusage in net2280 driver · ef5e2fa9
      Raz Manor 提交于
      In the function scan_dma_completions() there is a reusage of tmp
      variable. That coused a wrong value being used in some case when
      reading a short packet terminated transaction from an endpoint,
      in 2 concecutive reads.
      
      This was my logic for the patch:
      
      The req->td->dmadesc equals to 0 iff:
      -- There was a transaction ending with a short packet, and
      -- The read() to read it was shorter than the transaction length, and
      -- The read() to complete it is longer than the residue.
      I believe this is true from the printouts of various cases,
      but I can't be positive it is correct.
      
      Entering this if, there should be no more data in the endpoint
      (a short packet terminated the transaction).
      If there is, the transaction wasn't really done and we should exit and
      wait for it to finish entirely. That is the inner if.
      That inner if should never happen, but it is there to be on the safe
      side. That is why it is marked with the comment /* paranoia */.
      The size of the data available in the endpoint is ep->dma->dmacount
      and it is read to tmp.
      This entire clause is based on my own educated guesses.
      
      If we passed that inner if without breaking in the original code,
      than tmp & DMA_BYTE_MASK_COUNT== 0.
      That means we will always pass dma bytes count of 0 to dma_done(),
      meaning all the requested bytes were read.
      
      dma_done() reports back to the upper layer that the request (read())
      was done and how many bytes were read.
      In the original code that would always be the request size,
      regardless of the actual size of the data.
      That did not make sense to me at all.
      
      However, the original value of tmp is req->td->dmacount,
      which is the dmacount value when the request's dma transaction was
      finished. And that is a much more reasonable value to report back to
      the caller.
      
      To recreate the problem:
      Read from a bulk out endpoint in a loop, 1024 * n bytes in each
      iteration.
      Connect the PLX to a host you can control.
      Send to that endpoint 1024 * n + x bytes,
      such that 0 < x < 1024 * n and (x % 1024) != 0
      You would expect the first read() to return 1024 * n
      and the second read() to return x.
      But you will get the first read to return 1024 * n
      and the second one to return 1024 * n.
      That is true for every positive integer n.
      
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Signed-off-by: NRaz Manor <Raz.Manor@valens.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      ef5e2fa9