[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d59f11971764db2a104c87937e1d3ab@AcuMS.aculab.com>
Date: Thu, 21 Jan 2021 17:44:55 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christoph Hellwig' <hch@....de>,
Christophe Leroy <christophe.leroy@...roup.eu>
CC: Petr Mladek <pmladek@...e.com>, Jiri Kosina <jikos@...nel.org>,
"Andrew Donnellan" <ajd@...ux.ibm.com>,
"linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
David Airlie <airlied@...ux.ie>,
"Masahiro Yamada" <masahiroy@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Maxime Ripard <mripard@...nel.org>,
"live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
Michal Marek <michal.lkml@...kovi.net>,
"Joe Lawrence" <joe.lawrence@...hat.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Jessica Yu <jeyu@...nel.org>,
Frederic Barrat <fbarrat@...ux.ibm.com>,
Daniel Vetter <daniel@...ll.ch>,
Miroslav Benes <mbenes@...e.cz>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: RE: [PATCH 02/13] module: add a module_loaded helper
>
> On Thu, Jan 21, 2021 at 11:00:20AM +0100, Christophe Leroy wrote:
> > > +bool module_loaded(const char *name);
> >
> > Maybe module_is_loaded() would be a better name.
>
> Fine with me.
It does look like both callers aren't 'unsafe'.
But it is a bit strange returning a stale value.
It did make be look a bit more deeply at try_module_get().
For THIS_MODULE (eg to get an extra reference for a kthread)
I doubt it can ever fail.
But the other cases require a 'module' structure be passed in.
ISTM that unloading the module could invalidate the pointer
that has just been read from some other structure.
I'm guessing that some other lock must always be held.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists