1. 05 Aug, 2021 3 commits
    • Wesley Cheng's avatar
      usb: dwc3: gadget: Use list_replace_init() before traversing lists · d25d8506
      Wesley Cheng authored
      The list_for_each_entry_safe() macro saves the current item (n) and
      the item after (n+1), so that n can be safely removed without
      corrupting the list.  However, when traversing the list and removing
      items using gadget giveback, the DWC3 lock is briefly released,
      allowing other routines to execute.  There is a situation where, while
      items are being removed from the cancelled_list using
      dwc3_gadget_ep_cleanup_cancelled_requests(), the pullup disable
      routine is running in parallel (due to UDC unbind).  As the cleanup
      routine removes n, and the pullup disable removes n+1, once the
      cleanup retakes the DWC3 lock, it references a request who was already
      removed/handled.  With list debug enabled, this leads to a panic.
      Ensure all instances of the macro are replaced where gadget giveback
      is used.
      
      Example call stack:
      
      Thread#1:
      __dwc3_gadget_ep_set_halt() - CLEAR HALT
        -> dwc3_gadget_ep_cleanup_cancelled_requests()
          ->list_for_each_entry_safe()
          ->dwc3_gadget_giveback(n)
            ->dwc3_gadget_del_and_unmap_request()- n deleted[cancelled_list]
            ->spin_unlock
            ->Thread#2 executes
            ...
          ->dwc3_gadget_giveback(n+1)
            ->Already removed!
      
      Thread#2:
      dwc3_gadget_pullup()
        ->waiting for dwc3 spin_lock
        ...
        ->Thread#1 released lock
        ->dwc3_stop_active_transfers()
          ->dwc3_remove_requests()
            ->fetches n+1 item from cancelled_list (n removed by Thread#1)
            ->dwc3_gadget_giveback()
              ->dwc3_gadget_del_and_unmap_request()- n+1
      deleted[cancelled_list]
              ->spin_unlock
      
      Fix this condition by utilizing list_replace_init(), and traversing
      through a local copy of the current elements in the endpoint lists.
      This will also set the parent list as empty, so if another thread is
      also looping through the list, it will be empty on the next iteration.
      
      Fixes: d4f1afe5 ("usb: dwc3: gadget: move requests to cancelled_list")
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/1627543994-20327-1-git-send-email-wcheng@codeaurora.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d25d8506
    • Greg Kroah-Hartman's avatar
      Merge tag 'usb-serial-5.14-rc5' of... · b47b0b6d
      Greg Kroah-Hartman authored
      Merge tag 'usb-serial-5.14-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
      
      Johan writes:
      
      USB-serial fixes for 5.14-rc5
      
      Here are two type-detection regression fixes for pl2303 and a patch to
      increase the receive buffer size for for ch341 to avoid lost characters
      at high line speeds.
      
      Included are also some new device ids.
      
      All but the last three commits have been in linux-next and with no
      reported issues.
      
      * tag 'usb-serial-5.14-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial:
        USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2
        USB: serial: pl2303: fix GT type detection
        USB: serial: option: add Telit FD980 composition 0x1056
        USB: serial: pl2303: fix HX type detection
        USB: serial: ch341: fix character loss at high transfer rates
      b47b0b6d
    • David Bauer's avatar
      USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2 · 8da0e55c
      David Bauer authored
      The Auto-M3 OP-COM v2 is a OBD diagnostic device using a FTD232 for the
      USB connection.
      Signed-off-by: default avatarDavid Bauer <mail@david-bauer.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      8da0e55c
  2. 04 Aug, 2021 2 commits
  3. 30 Jul, 2021 1 commit
  4. 29 Jul, 2021 6 commits
  5. 28 Jul, 2021 1 commit
  6. 27 Jul, 2021 8 commits
  7. 25 Jul, 2021 9 commits
  8. 24 Jul, 2021 10 commits