diff mbox series

usb: musb: fix reference count leak in musb_irq_work

Message ID 20200614032704.129010-1-pakki001@umn.edu (mailing list archive)
State New, archived
Headers show
Series usb: musb: fix reference count leak in musb_irq_work | expand

Commit Message

Aditya Pakki June 14, 2020, 3:27 a.m. UTC
musb_irq_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/musb/musb_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sergei Shtylyov June 14, 2020, 8:51 a.m. UTC | #1
On 14.06.2020 6:27, Aditya Pakki wrote:

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

    Again, *void* function, so no error returned.

> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>   drivers/usb/musb/musb_core.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 384a8039a7fd..fd36a026bef0 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -2070,6 +2070,7 @@ static void musb_irq_work(struct work_struct *data)
>   	error = pm_runtime_get_sync(musb->controller);
>   	if (error < 0) {
>   		dev_err(musb->controller, "Could not enable: %i\n", error);
> +		pm_runtime_put_autosuspend(musb->controller);
>   
>   		return;
>   	}

MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 384a8039a7fd..fd36a026bef0 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2070,6 +2070,7 @@  static void musb_irq_work(struct work_struct *data)
 	error = pm_runtime_get_sync(musb->controller);
 	if (error < 0) {
 		dev_err(musb->controller, "Could not enable: %i\n", error);
+		pm_runtime_put_autosuspend(musb->controller);
 
 		return;
 	}