1. 22 11月, 2022 2 次提交
  2. 08 11月, 2022 1 次提交
  3. 27 10月, 2022 2 次提交
  4. 22 10月, 2022 1 次提交
  5. 22 9月, 2022 2 次提交
  6. 07 9月, 2022 5 次提交
  7. 31 8月, 2022 4 次提交
  8. 19 8月, 2022 2 次提交
  9. 08 7月, 2022 2 次提交
  10. 30 6月, 2022 2 次提交
  11. 10 6月, 2022 1 次提交
    • W
      usb: dwc3: gadget: Fix IN endpoint max packet size allocation · 9c1e9169
      Wesley Cheng 提交于
      The current logic to assign the max packet limit for IN endpoints attempts
      to take the default HW value and apply the optimal endpoint settings based
      on it.  However, if the default value reports a TxFIFO size large enough
      for only one max packet, it will divide the value and assign a smaller ep
      max packet limit.
      
      For example, if the default TxFIFO size fits 1024B, current logic will
      assign 1024/3 = 341B to ep max packet size.  If function drivers attempt to
      request for an endpoint with a wMaxPacketSize of 1024B (SS BULK max packet
      size) then it will fail, as the gadget is unable to find an endpoint which
      can fit the requested size.
      
      Functionally, if the TxFIFO has enough space to fit one max packet, it will
      be sufficient, at least when initializing the endpoints.
      
      Fixes: d94ea531 ("usb: dwc3: gadget: Properly set maxpacket limit")
      Cc: stable <stable@kernel.org>
      Signed-off-by: NWesley Cheng <quic_wcheng@quicinc.com>
      Link: https://lore.kernel.org/r/20220523213948.22142-1-quic_wcheng@quicinc.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c1e9169
  12. 20 5月, 2022 2 次提交
  13. 06 5月, 2022 6 次提交
  14. 26 4月, 2022 1 次提交
  15. 23 4月, 2022 2 次提交
    • W
      usb: dwc3: gadget: Replace list_for_each_entry_safe() if using giveback · bf594d1d
      Wesley Cheng 提交于
      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
      
      Fixes: d4f1afe5 ("usb: dwc3: gadget: move requests to cancelled_list")
      Signed-off-by: NWesley Cheng <quic_wcheng@quicinc.com>
      Link: https://lore.kernel.org/r/20220414183521.23451-1-quic_wcheng@quicinc.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf594d1d
    • W
      usb: dwc3: EP clear halt leading to clearing of delayed_status · 2840d6df
      Wesley Cheng 提交于
      The usb_ep_clear_halt() API can be called from the function driver, and
      translates to dwc3_gadget_ep_set_halt().  This routine is shared with when
      the host issues a clear feature ENDPOINT_HALT, and is differentiated by the
      protocol argument.  If the following sequence occurs, there can be a
      situation where the delayed_status flag is improperly cleared for the wrong
      SETUP transaction:
      
      1. Vendor specific control transfer returns USB_GADGET_DELAYED_STATUS.
      2. DWC3 gadget sets dwc->delayed_status to '1'.
      3. Another function driver issues a usb_ep_clear_halt() call.
      4. DWC3 gadget issues dwc3_stop_active_transfer() and sets
         DWC3_EP_PENDING_CLEAR_STALL.
      5. EP command complete interrupt triggers for the end transfer, and
         dwc3_ep0_send_delayed_status() is allowed to run, as delayed_status
         is '1' due to step#1.
      6. STATUS phase is sent, and delayed_status is cleared.
      7. Vendor specific control transfer is finished being handled, and issues
         usb_composite_setup_continue().  This results in queuing of a data
         phase.
      
      Cache the protocol flag so that DWC3 gadget is aware of when the clear halt
      is due to a SETUP request from the host versus when it is sourced from a
      function driver.  This allows for the EP command complete interrupt to know
      if it needs to issue a delayed status phase.
      Signed-off-by: NWesley Cheng <quic_wcheng@quicinc.com>
      Link: https://lore.kernel.org/r/20220414073902.21960-1-quic_wcheng@quicinc.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2840d6df
  16. 22 4月, 2022 2 次提交
  17. 18 3月, 2022 1 次提交
  18. 16 3月, 2022 2 次提交