lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 24 Aug 2021 11:17:59 +0300
From:   Felipe Balbi <balbi@...nel.org>
To:     Wesley Cheng <wcheng@...eaurora.org>
Cc:     gregkh@...uxfoundation.org, Thinh.Nguyen@...opsys.com,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        jackp@...eaurora.org
Subject: Re: [PATCH v4] usb: dwc3: gadget: Stop EP0 transfers during pullup
 disable


Wesley Cheng <wcheng@...eaurora.org> writes:

> During a USB cable disconnect, or soft disconnect scenario, a pending
> SETUP transaction may not be completed, leading to the following
> error:
>
>     dwc3 a600000.dwc3: timed out waiting for SETUP phase
>
> If this occurs, then the entire pullup disable routine is skipped and
> proper cleanup and halting of the controller does not complete.
>
> Instead of returning an error (which is ignored from the UDC
> perspective), allow the pullup disable routine to continue, which
> will also handle disabling of EP0/1.  This will end any active
> transfers as well.  Ensure to clear any delayed_status also, as the
> timeout could happen within the STATUS stage.
>
> Signed-off-by: Wesley Cheng <wcheng@...eaurora.org>
> ---
> Changes in v4:
>  - Fixed formatting and typos in commit text
>  - Removed braces due to the removal of the return statement
>
> Changes in v3:
>  - Added suggestion by Thinh to change dev_err to dev_warn
>
> Changes in v2:
>  - Removed calls to dwc3_ep0_end_control_data() and just allow the ep disables
>    on EP0 handle the proper ending of transfers.
>  - Ensure that delayed_status is cleared, as ran into enumeration issues if the
>    SETUP transaction fails on a STATUS stage.  Saw delayed_status == TRUE on the
>    next connect, which blocked further SETUP transactions to be handled.
>
>  drivers/usb/dwc3/gadget.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 5d084542718d..63f6d9f2a692 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2428,10 +2428,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
>  
>  		ret = wait_for_completion_timeout(&dwc->ep0_in_setup,
>  				msecs_to_jiffies(DWC3_PULL_UP_TIMEOUT));
> -		if (ret == 0) {
> -			dev_err(dwc->dev, "timed out waiting for SETUP phase\n");
> -			return -ETIMEDOUT;
> -		}
> +		if (ret == 0)
> +			dev_warn(dwc->dev, "timed out waiting for SETUP phase\n");

looks like a bug fix. Do we need to Cc stable?

-- 
balbi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ