* [PATCH] staging: lustre: do not ignore try_module_get() fail in obd_class_open()
@ 2014-12-26 23:26 Alexey Khoroshilov
2015-01-17 23:48 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2014-12-26 23:26 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger
Cc: Alexey Khoroshilov, Greg Kroah-Hartman, HPDD-discuss, devel,
linux-kernel, ldv-project
obd_class_open() ignores error code of try_module_get(),
while it can lead to race with module unload.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 66ceab20c743..bb4bc72ddac7 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -168,8 +168,7 @@ EXPORT_SYMBOL(obd_ioctl_popdata);
/* opening /dev/obd */
static int obd_class_open(struct inode *inode, struct file *file)
{
- try_module_get(THIS_MODULE);
- return 0;
+ return try_module_get(THIS_MODULE);
}
/* closing /dev/obd */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: lustre: do not ignore try_module_get() fail in obd_class_open()
2014-12-26 23:26 [PATCH] staging: lustre: do not ignore try_module_get() fail in obd_class_open() Alexey Khoroshilov
@ 2015-01-17 23:48 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2015-01-17 23:48 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Oleg Drokin, Andreas Dilger, ldv-project, devel, linux-kernel,
HPDD-discuss
On Sat, Dec 27, 2014 at 02:26:53AM +0300, Alexey Khoroshilov wrote:
> obd_class_open() ignores error code of try_module_get(),
> while it can lead to race with module unload.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
> drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> index 66ceab20c743..bb4bc72ddac7 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> @@ -168,8 +168,7 @@ EXPORT_SYMBOL(obd_ioctl_popdata);
> /* opening /dev/obd */
> static int obd_class_open(struct inode *inode, struct file *file)
> {
> - try_module_get(THIS_MODULE);
> - return 0;
> + return try_module_get(THIS_MODULE);
> }
This code is totally wrong and racy and should just be fixed up
properly. No module can lock it's own code, we know better than this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-17 23:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 23:26 [PATCH] staging: lustre: do not ignore try_module_get() fail in obd_class_open() Alexey Khoroshilov
2015-01-17 23:48 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox