2020-07-25 03:06:03

by Li Heng

[permalink] [raw]
Subject: [PATCH] svc: add missed destroy_workqueue when gb_svc_create fails

destroy_workqueue() should be called to destroy svc->wq
when gb_svc_create() init resources fails.

Fixes: 8465def499c7 ("staging: greybus: move the greybus core to drivers/greybus")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Li Heng <[email protected]>
---
drivers/greybus/svc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c
index ce7740e..38f858f 100644
--- a/drivers/greybus/svc.c
+++ b/drivers/greybus/svc.c
@@ -1340,6 +1340,7 @@ struct gb_svc *gb_svc_create(struct gb_host_device *hd)

err_put_device:
put_device(&svc->dev);
+ destroy_workqueue(svc->wq);
return NULL;
}

--
2.7.4


2020-07-25 07:31:25

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH] svc: add missed destroy_workqueue when gb_svc_create fails

On Sat, Jul 25, 2020 at 11:06:37AM +0800, Li Heng wrote:
> destroy_workqueue() should be called to destroy svc->wq
> when gb_svc_create() init resources fails.
>
> Fixes: 8465def499c7 ("staging: greybus: move the greybus core to drivers/greybus")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Li Heng <[email protected]>
> ---
> drivers/greybus/svc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c
> index ce7740e..38f858f 100644
> --- a/drivers/greybus/svc.c
> +++ b/drivers/greybus/svc.c
> @@ -1340,6 +1340,7 @@ struct gb_svc *gb_svc_create(struct gb_host_device *hd)
>
> err_put_device:
> put_device(&svc->dev);
> + destroy_workqueue(svc->wq);

Your bot is broken; the workqueue is released in gb_svc_release().

And please fix your internal review process so that you catch things
like this before posting.

> return NULL;
> }

Johan