1. 20 2月, 2018 2 次提交
  2. 16 2月, 2018 17 次提交
    • G
      Merge tag 'fixes-for-v4.16-rc2' of... · fc19b1d0
      Greg Kroah-Hartman 提交于
      Merge tag 'fixes-for-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
      
      Felipe writes:
      
      usb: fixes for v4.16-rc2
      
      First set of fixes for current -rc cycle. Most of the changes are on
      dwc3 this time around (59%) with some function changes (25%).
      
      Out of the those, the most important fixes are:
      
      - EP0 TRB counter fix on dwc3
      - dwc3-omap stopped missing events during suspend/resume
      - maxpacket size fix for ep0 in dwc3
      - Descriptor processing fix for functionfs
      
      Apart from these, your usual set of important-but-not-so-critical
      fixes all over the place.
      fc19b1d0
    • D
      usb: cdc_acm: prevent race at write to acm while system resumes · b86b8eb6
      Dominik Bozek 提交于
      ACM driver may accept data to transmit while system is not fully
      resumed. In this case ACM driver buffers data and prepare URBs
      on usb anchor list.
      There is a little chance that two tasks put a char and initiate
      acm_tty_flush_chars(). In such a case, driver will put one URB
      twice on usb anchor list.
      This patch also reset length of data before resue of a buffer.
      This not only prevent sending rubbish, but also lower risc of race.
      
      Without this patch we hit following kernel panic in one of our
      stabilty/stress tests.
      
      [   46.884442] *list_add double add*: new=ffff9b2ab7289330, prev=ffff9b2ab7289330, next=ffff9b2ab81e28e0.
      [   46.884476] Modules linked in: hci_uart btbcm bluetooth rfkill_gpio igb_avb(O) cfg80211 snd_soc_sst_bxt_tdf8532 snd_soc_skl snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp snd_soc_sst_acpi snd_soc_sst_match snd_hda_ext_core snd_hda_core trusty_timer trusty_wall trusty_log trusty_virtio trusty_ipc trusty_mem trusty_irq trusty virtio_ring virtio intel_ipu4_mmu_bxtB0 lib2600_mod_bxtB0 intel_ipu4_isys_mod_bxtB0 lib2600psys_mod_bxtB0 intel_ipu4_psys_mod_bxtB0 intel_ipu4_mod_bxtB0 intel_ipu4_wrapper_bxtB0 intel_ipu4_acpi videobuf2_dma_contig as3638 dw9714 lm3643 crlmodule smiapp smiapp_pll
      [   46.884480] CPU: 1 PID: 33 Comm: kworker/u8:1 Tainted: G     U  W  O    4.9.56-quilt-2e5dc0ac-g618ed69ced6e-dirty #4
      [   46.884489] Workqueue: events_unbound flush_to_ldisc
      [   46.884494]  ffffb98ac012bb08 ffffffffad3e82e5 ffffb98ac012bb58 0000000000000000
      [   46.884497]  ffffb98ac012bb48 ffffffffad0a23d1 00000024ad6374dd ffff9b2ab7289330
      [   46.884500]  ffff9b2ab81e28e0 ffff9b2ab7289330 0000000000000002 0000000000000000
      [   46.884501] Call Trace:
      [   46.884507]  [<ffffffffad3e82e5>] dump_stack+0x67/0x92
      [   46.884511]  [<ffffffffad0a23d1>] __warn+0xd1/0xf0
      [   46.884513]  [<ffffffffad0a244f>] warn_slowpath_fmt+0x5f/0x80
      [   46.884516]  [<ffffffffad407443>] __list_add+0xb3/0xc0
      [   46.884521]  [<ffffffffad71133c>] *usb_anchor_urb*+0x4c/0xa0
      [   46.884524]  [<ffffffffad782c6f>] *acm_tty_flush_chars*+0x8f/0xb0
      [   46.884527]  [<ffffffffad782cd1>] *acm_tty_put_char*+0x41/0x100
      [   46.884530]  [<ffffffffad4ced34>] tty_put_char+0x24/0x40
      [   46.884533]  [<ffffffffad4d3bf5>] do_output_char+0xa5/0x200
      [   46.884535]  [<ffffffffad4d3e98>] __process_echoes+0x148/0x290
      [   46.884538]  [<ffffffffad4d654c>] n_tty_receive_buf_common+0x57c/0xb00
      [   46.884541]  [<ffffffffad4d6ae4>] n_tty_receive_buf2+0x14/0x20
      [   46.884543]  [<ffffffffad4d9662>] tty_ldisc_receive_buf+0x22/0x50
      [   46.884545]  [<ffffffffad4d9c05>] flush_to_ldisc+0xc5/0xe0
      [   46.884549]  [<ffffffffad0bcfe8>] process_one_work+0x148/0x440
      [   46.884551]  [<ffffffffad0bdc19>] worker_thread+0x69/0x4a0
      [   46.884554]  [<ffffffffad0bdbb0>] ? max_active_store+0x80/0x80
      [   46.884556]  [<ffffffffad0c2e10>] kthread+0x110/0x130
      [   46.884559]  [<ffffffffad0c2d00>] ? kthread_park+0x60/0x60
      [   46.884563]  [<ffffffffadad9917>] ret_from_fork+0x27/0x40
      [   46.884566] ---[ end trace 3bd599058b8a9eb3 ]---
      Signed-off-by: NDominik Bozek <dominikx.bozek@intel.com>
      Signed-off-by: NKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b86b8eb6
    • J
      Add delay-init quirk for Corsair K70 RGB keyboards · 7a1646d9
      Jack Stocker 提交于
      Following on from this patch: https://lkml.org/lkml/2017/11/3/516,
      Corsair K70 RGB keyboards also require the DELAY_INIT quirk to
      start correctly at boot.
      
      Device ids found here:
      usb 3-3: New USB device found, idVendor=1b1c, idProduct=1b13
      usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      usb 3-3: Product: Corsair K70 RGB Gaming Keyboard
      Signed-off-by: NJack Stocker <jackstocker.93@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7a1646d9
    • A
      usb: ohci: Proper handling of ed_rm_list to handle race condition between... · 46408ea5
      AMAN DEEP 提交于
      usb: ohci: Proper handling of ed_rm_list to handle race condition between usb_kill_urb() and finish_unlinks()
      
      There is a race condition between finish_unlinks->finish_urb() function
      and usb_kill_urb() in ohci controller case. The finish_urb calls
      spin_unlock(&ohci->lock) before usb_hcd_giveback_urb() function call,
      then if during this time, usb_kill_urb is called for another endpoint,
      then new ed will be added to ed_rm_list at beginning for unlink, and
      ed_rm_list will point to newly added.
      
      When finish_urb() is completed in finish_unlinks() and ed->td_list
      becomes empty as in below code (in finish_unlinks() function):
      
              if (list_empty(&ed->td_list)) {
                      *last = ed->ed_next;
                      ed->ed_next = NULL;
              } else if (ohci->rh_state == OHCI_RH_RUNNING) {
                      *last = ed->ed_next;
                      ed->ed_next = NULL;
                      ed_schedule(ohci, ed);
              }
      
      The *last = ed->ed_next will make ed_rm_list to point to ed->ed_next
      and previously added ed by usb_kill_urb will be left unreferenced by
      ed_rm_list. This causes usb_kill_urb() hang forever waiting for
      finish_unlink to remove added ed from ed_rm_list.
      
      The main reason for hang in this race condtion is addition and removal
      of ed from ed_rm_list in the beginning during usb_kill_urb and later
      last* is modified in finish_unlinks().
      
      As suggested by Alan Stern, the solution for proper handling of
      ohci->ed_rm_list is to remove ed from the ed_rm_list before finishing
      any URBs. Then at the end, we can add ed back to the list if necessary.
      
      This properly handle the updated ohci->ed_rm_list in usb_kill_urb().
      
      Fixes: 977dcfdc ("USB: OHCI: don't lose track of EDs when a controller dies")
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NAman Deep <aman.deep@samsung.com>
      Signed-off-by: NJeffy Chen <jeffy.chen@rock-chips.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46408ea5
    • P
      usb: host: ehci: always enable interrupt for qtd completion at test mode · 91b11935
      Peter Chen 提交于
      At former code, the SETUP stage does not enable interrupt
      for qtd completion, it relies on IAA watchdog to complete
      interrupt, then the transcation would be considered timeout
      if the flag need_io_watchdog is cleared by platform code.
      
      In this commit, we always add enable interrupt for qtd completion,
      then the qtd completion can be notified by hardware interrupt.
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91b11935
    • K
      usb: ldusb: add PIDs for new CASSY devices supported by this driver · 52ad2bd8
      Karsten Koop 提交于
      This patch adds support for new CASSY devices to the ldusb driver. The
      PIDs are also added to the ignore list in hid-quirks.
      Signed-off-by: NKarsten Koop <kkoop@ld-didactic.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52ad2bd8
    • Y
      usb: renesas_usbhs: missed the "running" flag in usb_dmac with rx path · d6efa938
      Yoshihiro Shimoda 提交于
      This fixes an issue that a gadget driver (usb_f_fs) is possible to
      stop rx transactions after the usb-dmac is used because the following
      functions missed to set/check the "running" flag.
       - usbhsf_dma_prepare_pop_with_usb_dmac()
       - usbhsf_dma_pop_done_with_usb_dmac()
      
      So, if next transaction uses pio, the usbhsf_prepare_pop() can not
      start the transaction because the "running" flag is 0.
      
      Fixes: 8355b2b3 ("usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle")
      Cc: <stable@vger.kernel.org> # v3.19+
      Signed-off-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6efa938
    • P
      usb: host: ehci: use correct device pointer for dma ops · 02a10f06
      Peter Chen 提交于
      commit a8c06e40 ("usb: separate out sysdev pointer from usb_bus")
      converted to use hcd->self.sysdev for DMA operations instead of
      hcd->self.controller, but forgot to do it for hcd test mode. Replace
      the correct one in this commit.
      
      Fixes: a8c06e40 ("usb: separate out sysdev pointer from usb_bus")
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02a10f06
    • S
      usbip: keep usbip_device sockfd state in sync with tcp_socket · 009f41ae
      Shuah Khan 提交于
      Keep usbip_device sockfd state in sync with tcp_socket. When tcp_socket
      is reset to null, reset sockfd to -1 to keep it in sync.
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      009f41ae
    • S
      ohci-hcd: Fix race condition caused by ohci_urb_enqueue() and io_watchdog_func() · b2685bda
      Shigeru Yoshida 提交于
      Running io_watchdog_func() while ohci_urb_enqueue() is running can
      cause a race condition where ohci->prev_frame_no is corrupted and the
      watchdog can mis-detect following error:
      
        ohci-platform 664a0800.usb: frame counter not updating; disabled
        ohci-platform 664a0800.usb: HC died; cleaning up
      
      Specifically, following scenario causes a race condition:
      
        1. ohci_urb_enqueue() calls spin_lock_irqsave(&ohci->lock, flags)
           and enters the critical section
        2. ohci_urb_enqueue() calls timer_pending(&ohci->io_watchdog) and it
           returns false
        3. ohci_urb_enqueue() sets ohci->prev_frame_no to a frame number
           read by ohci_frame_no(ohci)
        4. ohci_urb_enqueue() schedules io_watchdog_func() with mod_timer()
        5. ohci_urb_enqueue() calls spin_unlock_irqrestore(&ohci->lock,
           flags) and exits the critical section
        6. Later, ohci_urb_enqueue() is called
        7. ohci_urb_enqueue() calls spin_lock_irqsave(&ohci->lock, flags)
           and enters the critical section
        8. The timer scheduled on step 4 expires and io_watchdog_func() runs
        9. io_watchdog_func() calls spin_lock_irqsave(&ohci->lock, flags)
           and waits on it because ohci_urb_enqueue() is already in the
           critical section on step 7
       10. ohci_urb_enqueue() calls timer_pending(&ohci->io_watchdog) and it
           returns false
       11. ohci_urb_enqueue() sets ohci->prev_frame_no to new frame number
           read by ohci_frame_no(ohci) because the frame number proceeded
           between step 3 and 6
       12. ohci_urb_enqueue() schedules io_watchdog_func() with mod_timer()
       13. ohci_urb_enqueue() calls spin_unlock_irqrestore(&ohci->lock,
           flags) and exits the critical section, then wake up
           io_watchdog_func() which is waiting on step 9
       14. io_watchdog_func() enters the critical section
       15. io_watchdog_func() calls ohci_frame_no(ohci) and set frame_no
           variable to the frame number
       16. io_watchdog_func() compares frame_no and ohci->prev_frame_no
      
      On step 16, because this calling of io_watchdog_func() is scheduled on
      step 4, the frame number set in ohci->prev_frame_no is expected to the
      number set on step 3.  However, ohci->prev_frame_no is overwritten on
      step 11.  Because step 16 is executed soon after step 11, the frame
      number might not proceed, so ohci->prev_frame_no must equals to
      frame_no.
      
      To address above scenario, this patch introduces a special sentinel
      value IO_WATCHDOG_OFF and set this value to ohci->prev_frame_no when
      the watchdog is not pending or running.  When ohci_urb_enqueue()
      schedules the watchdog (step 4 and 12 above), it compares
      ohci->prev_frame_no to IO_WATCHDOG_OFF so that ohci->prev_frame_no is
      not overwritten while io_watchdog_func() is running.
      Signed-off-by: NShigeru Yoshida <Shigeru.Yoshida@windriver.com>
      Signed-off-by: NHaiqing Bai <Haiqing.Bai@windriver.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2685bda
    • K
      USB: serial: option: Add support for Quectel EP06 · 71a0483d
      Kristian Evensen 提交于
      The Quectel EP06 is a Cat. 6 LTE modem, and the interface mapping is as
      follows:
      
      0: Diag
      1: NMEA
      2: AT
      3: Modem
      
      Interface 4 is QMI and interface 5 is ADB, so they are blacklisted.
      
      This patch should also be considered for -stable. The QMI-patch for this
      modem is already in the -stable-queue.
      
      v1->v2:
      * Updated commit prefix (thanks Johan Hovold)
      * Updated commit message slightly.
      Signed-off-by: NKristian Evensen <kristian.evensen@gmail.com>
      Acked-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71a0483d
    • Z
      xhci: fix xhci debugfs errors in xhci_stop · 11cd764d
      Zhengjun Xing 提交于
      In function xhci_stop, xhci_debugfs_exit called before xhci_mem_cleanup.
      xhci_debugfs_exit removed the xhci debugfs root nodes, xhci_mem_cleanup
      called function xhci_free_virt_devices_depth_first which in turn called
      function xhci_debugfs_remove_slot.
      Function xhci_debugfs_remove_slot removed the nodes for devices, the nodes
      folders are sub folder of xhci debugfs.
      
      It is unreasonable to remove xhci debugfs root folder before
      xhci debugfs sub folder. Function xhci_mem_cleanup should be called
      before function xhci_debugfs_exit.
      
      Fixes: 02b6fdc2 ("usb: xhci: Add debugfs interface for xHCI driver")
      Cc: <stable@vger.kernel.org> # v4.15
      Signed-off-by: NZhengjun Xing <zhengjun.xing@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11cd764d
    • Z
      xhci: xhci debugfs device nodes weren't removed after device plugged out · 8c5a93eb
      Zhengjun Xing 提交于
      There is a bug after plugged out USB device, the device and its ep00
      nodes are still kept, we need to remove the nodes in xhci_free_dev when
      USB device is plugged out.
      
      Fixes: 052f71e2 ("xhci: Fix xhci debugfs NULL pointer dereference in resume from hibernate")
      Cc: <stable@vger.kernel.org> # v4.15
      Signed-off-by: NZhengjun Xing <zhengjun.xing@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c5a93eb
    • Z
      xhci: Fix xhci debugfs devices node disappearance after hibernation · d9167671
      Zhengjun Xing 提交于
      During system resume from hibernation, xhci host is reset, all the
      nodes in devices folder are removed in xhci_mem_cleanup function.
      Later nodes in /sys/kernel/debug/usb/xhci/* are created again in
      function xhci_run, but the nodes already exist, so the nodes still
      keep the old ones, finally device nodes in xhci debugfs folder
      /sys/kernel/debug/usb/xhci/*/devices/* are disappeared.
      
      This fix removed xhci debugfs nodes before the nodes are re-created,
      so all the nodes in xhci debugfs can be re-created successfully.
      
      Fixes: 02b6fdc2 ("usb: xhci: Add debugfs interface for xHCI driver")
      Cc: <stable@vger.kernel.org> # v4.15
      Signed-off-by: NZhengjun Xing <zhengjun.xing@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9167671
    • Z
      xhci: Fix NULL pointer in xhci debugfs · fa2dfd0e
      Zhengjun Xing 提交于
      Commit dde63405 ("xhci: Fix use-after-free in xhci debugfs") causes a
      null pointer dereference while fixing xhci-debugfs usage of ring pointers
      that were freed during hibernate.
      
      The fix passed addresses to ring pointers instead, but forgot to do this
      change for the xhci_ring_trb_show function.
      
      The address of the ring pointer passed to xhci-debugfs was of a temporary
      ring pointer "new_ring" instead of the actual ring "ring" pointer. The
      temporary new_ring pointer will be set to NULL later causing the NULL
      pointer dereference.
      
      This issue was seen when reading xhci related files in debugfs:
      
      cat /sys/kernel/debug/usb/xhci/*/devices/*/ep*/trbs
      
      [  184.604861] BUG: unable to handle kernel NULL pointer dereference at (null)
      [  184.613776] IP: xhci_ring_trb_show+0x3a/0x890
      [  184.618733] PGD 264193067 P4D 264193067 PUD 263238067 PMD 0
      [  184.625184] Oops: 0000 [#1] SMP
      [  184.726410] RIP: 0010:xhci_ring_trb_show+0x3a/0x890
      [  184.731944] RSP: 0018:ffffba8243c0fd90 EFLAGS: 00010246
      [  184.737880] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000000295d6
      [  184.746020] RDX: 00000000000295d5 RSI: 0000000000000001 RDI: ffff971a6418d400
      [  184.754121] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      [  184.762222] R10: ffff971a64c98a80 R11: ffff971a62a00e40 R12: ffff971a62a85500
      [  184.770325] R13: 0000000000020000 R14: ffff971a6418d400 R15: ffff971a6418d400
      [  184.778448] FS:  00007fe725a79700(0000) GS:ffff971a6ec00000(0000) knlGS:0000000000000000
      [  184.787644] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  184.794168] CR2: 0000000000000000 CR3: 000000025f365005 CR4: 00000000003606f0
      [  184.802318] Call Trace:
      [  184.805094]  ? seq_read+0x281/0x3b0
      [  184.809068]  seq_read+0xeb/0x3b0
      [  184.812735]  full_proxy_read+0x4d/0x70
      [  184.817007]  __vfs_read+0x23/0x120
      [  184.820870]  vfs_read+0x91/0x130
      [  184.824538]  SyS_read+0x42/0x90
      [  184.828106]  entry_SYSCALL_64_fastpath+0x1a/0x7d
      
      Fixes: dde63405 ("xhci: Fix use-after-free in xhci debugfs")
      Cc: <stable@vger.kernel.org> # v4.15
      Signed-off-by: NZhengjun Xing <zhengjun.xing@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa2dfd0e
    • M
      xhci: Don't print a warning when setting link state for disabled ports · 1208d8a8
      Mathias Nyman 提交于
      When disabling a USB3 port the hub driver will set the port link state to
      U3 to prevent "ejected" or "safely removed" devices that are still
      physically connected from immediately re-enumerating.
      
      If the device was really unplugged, then error messages were printed
      as the hub tries to set the U3 link state for a port that is no longer
      enabled.
      
      xhci-hcd ee000000.usb: Cannot set link state.
      usb usb8-port1: cannot disable (err = -32)
      
      Don't print error message in xhci-hub if hub tries to set port link state
      for a disabled port. Return -ENODEV instead which also silences hub driver.
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Tested-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1208d8a8
    • J
      xhci: workaround for AMD Promontory disabled ports wakeup · bde0716d
      Joe Lee 提交于
      For AMD Promontory xHCI host, although you can disable USB ports in
      BIOS settings, those ports will be enabled anyway after you remove a
      device on that port and re-plug it in again. It's a known limitation of
      the chip. As a workaround we can clear the PORT_WAKE_BITS.
      
      [commit and code comment rephrasing -Mathias]
      Signed-off-by: NJoe Lee <asmt.swfae@gmail.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bde0716d
  3. 15 2月, 2018 2 次提交
  4. 12 2月, 2018 19 次提交