* [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register()
@ 2013-09-23 9:56 Wei Yongjun
2013-09-23 15:47 ` Kees Cook
2013-09-24 23:46 ` Andrew Morton
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2013-09-23 9:56 UTC (permalink / raw)
To: akpm, keescook; +Cc: yongjun_wei, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Add the missing destroy_workqueue() before return from
i2o_driver_register() in the error handling case.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/message/i2o/driver.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 813eaa3..c3d8462 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -105,7 +105,8 @@ int i2o_driver_register(struct i2o_driver *drv)
osm_err("too many drivers registered, increase "
"max_drivers\n");
spin_unlock_irqrestore(&i2o_drivers_lock, flags);
- return -EFAULT;
+ rc = -EFAULT;
+ goto out;
}
drv->context = i;
@@ -124,11 +125,14 @@ int i2o_driver_register(struct i2o_driver *drv)
}
rc = driver_register(&drv->driver);
- if (rc) {
- if (drv->event) {
- destroy_workqueue(drv->event_queue);
- drv->event_queue = NULL;
- }
+ if (rc)
+ goto out;
+
+ return 0;
+out:
+ if (drv->event_queue) {
+ destroy_workqueue(drv->event_queue);
+ drv->event_queue = NULL;
}
return rc;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register()
2013-09-23 9:56 [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register() Wei Yongjun
@ 2013-09-23 15:47 ` Kees Cook
2013-09-24 23:46 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2013-09-23 15:47 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Andrew Morton, yongjun_wei, LKML
On Mon, Sep 23, 2013 at 2:56 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add the missing destroy_workqueue() before return from
> i2o_driver_register() in the error handling case.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Good catch!
Acked-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register()
2013-09-23 9:56 [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register() Wei Yongjun
2013-09-23 15:47 ` Kees Cook
@ 2013-09-24 23:46 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2013-09-24 23:46 UTC (permalink / raw)
To: Wei Yongjun; +Cc: keescook, yongjun_wei, linux-kernel
On Mon, 23 Sep 2013 17:56:56 +0800 Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add the missing destroy_workqueue() before return from
> i2o_driver_register() in the error handling case.
yup.
> --- a/drivers/message/i2o/driver.c
> +++ b/drivers/message/i2o/driver.c
> @@ -105,7 +105,8 @@ int i2o_driver_register(struct i2o_driver *drv)
> osm_err("too many drivers registered, increase "
> "max_drivers\n");
> spin_unlock_irqrestore(&i2o_drivers_lock, flags);
> - return -EFAULT;
> + rc = -EFAULT;
Why on earth does this function return -EFAULT (twice)? Imagine the poor
user's confusion if that code gets propagated back to his application
or shell.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-24 23:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-23 9:56 [PATCH] i2o: add missing destroy_workqueue() on error in i2o_driver_register() Wei Yongjun
2013-09-23 15:47 ` Kees Cook
2013-09-24 23:46 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.