[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e086db3e422b401d9a4df896696f75b8@AcuMS.aculab.com>
Date: Fri, 9 Oct 2020 09:00:41 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Johannes Berg' <johannes@...solutions.net>,
Greg KH <gregkh@...uxfoundation.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nstange@...e.de" <nstange@...e.de>,
"ap420073@...il.com" <ap420073@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"rafael@...nel.org" <rafael@...nel.org>
Subject: RE: [CRAZY-RFF] debugfs: track open files and release on remove
From: Johannes Berg
> Sent: 09 October 2020 09:45
>
> On Fri, 2020-10-09 at 08:34 +0000, David Laight wrote:
> >
...
> > Does it ever make any sense to set .owner to anything other than
> > THIS_MODULE?
>
> No. But I believe THIS_MODULE is NULL for built-in code, so we can't
> just WARN_ON(!fops->owner).
...
> > I was also wondering if this affects normal opens?
> > They should hold a reference on the module to stop it being unloaded.
> > Does that rely on .owner being set?
>
> Yes.
Sound like the module load code should be verifying it then.
Looking at one of my modules (which does set .owner).
Perhaps cdev_init() could be a #define that picks up THIS_MODULE.
This could then be checked against the one in fops or saved
in the 'struct cdev'.
I presume debugfs (which I've not used) has some similar calls.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists