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:   Mon, 13 Nov 2023 12:42:16 -0800
From:   Wesley Cheng <quic_wcheng@...cinc.com>
To:     Kunwu Chan <chentao@...inos.cn>, <Thinh.Nguyen@...opsys.com>,
        <gregkh@...uxfoundation.org>
CC:     <kunwu.chan@...mail.com>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc3: Fix an issue that using pm_runtime_get_sync
 incorrectly

Hi,

On 11/13/2023 7:35 AM, Kunwu Chan wrote:
> pm_runtime_get_sync() also returns 1 on success.
> The documentation for pm_runtime_get_sync() suggests using
> pm_runtime_resume_and_get() instead.
> 
> Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
> Signed-off-by: Kunwu Chan <chentao@...inos.cn>
> ---
>   drivers/usb/dwc3/gadget.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 858fe4c299b7..0330de73cd9c 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2745,7 +2745,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
>   	 * successful resume, the DWC3 runtime PM resume routine will handle
>   	 * the run stop sequence, so avoid duplicate operations here.
>   	 */
> -	ret = pm_runtime_get_sync(dwc->dev);
> +	ret = pm_runtime_resume_and_get(dwc->dev);

If pm_runtime_get_sync() returns 1, that means that the runtime state is 
already in RPM_ACTIVE, so in that case, we should allow for the pullup 
routine to continue.

What is the end issue you're seeing with the current implementation?

>   	if (!ret || ret < 0) {
>   		pm_runtime_put(dwc->dev);

If you think using pm_runtime_resume_and_get() is still necessary, I 
think you'll need to figure out how to address the above put call as 
well.  pm_runtime_resume_and_get() already handles error cases and will 
call a put noidle.

Thanks
Wesley Cheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ