From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
ldv-project@linuxtesting.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, HPDD-discuss@ml01.01.org
Subject: Re: [PATCH] staging: lustre: do not ignore try_module_get() fail in obd_class_open()
Date: Sat, 17 Jan 2015 15:48:30 -0800 [thread overview]
Message-ID: <20150117234830.GA26997@kroah.com> (raw)
In-Reply-To: <1419636413-17452-1-git-send-email-khoroshilov@ispras.ru>
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
prev parent reply other threads:[~2015-01-17 23:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150117234830.GA26997@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=HPDD-discuss@ml01.01.org \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox