From: Johannes Berg <johannes@sipsolutions.net>
To: David Laight <David.Laight@ACULAB.COM>,
Greg KH <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"nstange@suse.de" <nstange@suse.de>,
"ap420073@gmail.com" <ap420073@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"rafael@kernel.org" <rafael@kernel.org>
Subject: Re: [CRAZY-RFF] debugfs: track open files and release on remove
Date: Fri, 09 Oct 2020 10:44:35 +0200 [thread overview]
Message-ID: <e3a807b1d5f728c178f43b453f3b495bf53abfce.camel@sipsolutions.net> (raw)
In-Reply-To: <03c42bb5f57a4c3d9c782a023add28cd@AcuMS.aculab.com>
On Fri, 2020-10-09 at 08:34 +0000, David Laight wrote:
>
> > I think adding the .owner everywhere would be good, and perhaps we can
> > somehow put a check somewhere like
> >
> > WARN_ON(is_module_address((unsigned long)fops) && !fops->owner);
> >
> > to prevent the issue in the future?
>
> 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).
> If not the code that saves the 'struct file_operations' address
> ought to be able to save the associated module.
No, it's const.
> 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.
> For debugfs surely it is possible to determine and save THIS_MODULE
> when he nodes are registers and do a try_module_get() in the open?
I don't really see where to save it?
johannes
next prev parent reply other threads:[~2020-10-09 8:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87v9fkgf4i.fsf@suse.de>
2020-10-09 7:53 ` Johannes Berg
2020-10-09 8:03 ` Greg KH
2020-10-09 8:06 ` Johannes Berg
2020-10-09 8:16 ` Greg KH
2020-10-09 8:19 ` Johannes Berg
2020-10-09 8:34 ` David Laight
2020-10-09 8:44 ` Johannes Berg [this message]
2020-10-09 9:00 ` David Laight
2020-10-09 8:47 ` Greg KH
2020-10-09 8:48 ` Johannes Berg
2020-10-10 9:38 ` Greg KH
2020-10-10 10:47 ` Johannes Berg
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=e3a807b1d5f728c178f43b453f3b495bf53abfce.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=David.Laight@ACULAB.COM \
--cc=ap420073@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nstange@suse.de \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®