linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work
@ 2020-06-14  3:15 Aditya Pakki
  2020-06-14  8:50 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2020-06-14  3:15 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, wu000273, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
	linux-kernel

dwc3_pci_resume_work() calls pm_runtime_get_sync() that increments
the reference counter. In case of failure, decrement the reference
count and return the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/usb/dwc3/dwc3-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index b67372737dc9..96c05b121fac 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -206,8 +206,10 @@ static void dwc3_pci_resume_work(struct work_struct *work)
 	int ret;
 
 	ret = pm_runtime_get_sync(&dwc3->dev);
-	if (ret)
+	if (ret) {
+		pm_runtime_put_sync_autosuspend(&dwc3->dev);
 		return;
+	}
 
 	pm_runtime_mark_last_busy(&dwc3->dev);
 	pm_runtime_put_sync_autosuspend(&dwc3->dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work
  2020-06-14  3:15 [PATCH] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work Aditya Pakki
@ 2020-06-14  8:50 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2020-06-14  8:50 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, wu000273, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
	linux-kernel

Hello!

On 14.06.2020 6:15, Aditya Pakki wrote:

> dwc3_pci_resume_work() calls pm_runtime_get_sync() that increments
> the reference counter. In case of failure, decrement the reference
> count and return the error.

    In this case you still return nothing.

> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>   drivers/usb/dwc3/dwc3-pci.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
> index b67372737dc9..96c05b121fac 100644
> --- a/drivers/usb/dwc3/dwc3-pci.c
> +++ b/drivers/usb/dwc3/dwc3-pci.c
> @@ -206,8 +206,10 @@ static void dwc3_pci_resume_work(struct work_struct *work)
>   	int ret;
>   
>   	ret = pm_runtime_get_sync(&dwc3->dev);
> -	if (ret)
> +	if (ret) {
> +		pm_runtime_put_sync_autosuspend(&dwc3->dev);
>   		return;
> +	}
>   
>   	pm_runtime_mark_last_busy(&dwc3->dev);
>   	pm_runtime_put_sync_autosuspend(&dwc3->dev);

MBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-14  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14  3:15 [PATCH] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work Aditya Pakki
2020-06-14  8:50 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).