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]
Message-ID: <20230411012207.mn4cpxbo5lq73r4n@synopsys.com>
Date:   Tue, 11 Apr 2023 01:22:11 +0000
From:   Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To:     Johan Hovold <johan+linaro@...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>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Roger Quadros <rogerq@...com>
Subject: Re: [PATCH 01/11] USB: dwc3: fix runtime pm imbalance on probe errors

On Tue, Apr 04, 2023, Johan Hovold wrote:
> Make sure not to suspend the device when probe fails to avoid disabling
> clocks and phys multiple times.
> 
> Fixes: 328082376aea ("usb: dwc3: fix runtime PM in error path")
> Cc: stable@...r.kernel.org      # 4.8
> Cc: Roger Quadros <rogerq@...com>
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
> ---
>  drivers/usb/dwc3/core.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 476b63618511..5058bd8d56ca 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1883,13 +1883,11 @@ static int dwc3_probe(struct platform_device *pdev)
>  	spin_lock_init(&dwc->lock);
>  	mutex_init(&dwc->mutex);
>  
> +	pm_runtime_get_noresume(dev);
>  	pm_runtime_set_active(dev);
>  	pm_runtime_use_autosuspend(dev);
>  	pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY);
>  	pm_runtime_enable(dev);
> -	ret = pm_runtime_get_sync(dev);
> -	if (ret < 0)
> -		goto err1;
>  
>  	pm_runtime_forbid(dev);
>  
> @@ -1954,12 +1952,10 @@ static int dwc3_probe(struct platform_device *pdev)
>  	dwc3_free_event_buffers(dwc);
>  
>  err2:
> -	pm_runtime_allow(&pdev->dev);
> -
> -err1:
> -	pm_runtime_put_sync(&pdev->dev);
> -	pm_runtime_disable(&pdev->dev);
> -
> +	pm_runtime_allow(dev);
> +	pm_runtime_disable(dev);
> +	pm_runtime_set_suspended(dev);
> +	pm_runtime_put_noidle(dev);
>  disable_clks:
>  	dwc3_clk_disable(dwc);
>  assert_reset:
> -- 
> 2.39.2
> 

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

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ