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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Jun 2023 22:23:56 +0000
From:   Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To:     Jisheng Zhang <jszhang@...nel.org>
CC:     Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc3: don't reset device side if dwc3 was configured
 as host-only

On Wed, Jun 28, 2023, Jisheng Zhang wrote:
> Commit c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs on
> system_suspend in host mode") replaces check for HOST only dr_mode with
> current_dr_role. But during booting, the current_dr_role isn't
> initialized, thus the device side reset is always issued even if dwc3
> was configured as host-only. What's more, on some platforms with host
> only dwc3, aways issuing device side reset by accessing device register
> block can cause kernel panic.
> 

Ah... good catch!

This should be backported to stable.

So perhaps you or Greg can add Cc: stable@...r.kernel.org

> Fixes: c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs on system_suspend in host mode")
> Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
> ---
>  drivers/usb/dwc3/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 7b2ce013cc5b..16d7a1d1cbfa 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -277,9 +277,9 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
>  	/*
>  	 * We're resetting only the device side because, if we're in host mode,
>  	 * XHCI driver will reset the host block. If dwc3 was configured for
> -	 * host-only mode, then we can return early.
> +	 * host-only mode or current role is host, then we can return early.
>  	 */
> -	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
> +	if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
>  		return 0;
>  
>  	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
> -- 
> 2.40.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ