mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Greg KH <greg@kroah.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: debugfs_remove() vs. anything that is dynamic
Date: Fri, 04 Apr 2008 17:41:24 +0200	[thread overview]
Message-ID: <1207323684.19189.54.camel@johannes.berg> (raw)
In-Reply-To: <20080404153402.GB16923@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]


> If you worry about this type of interaction, use debugfs_create_file,
> which takes a fileops, and set your module owner in there so that the
> reference count will not allow your module from being removed.
>
> Also remember, you have to be root to unload modules, so if you are
> doing that, and you have debugfs files open, you should know better :)

That really was just an example, we have per-wireless-device debugfs
code users can easily trigger a debugfs_remove() by unplugging a usb
netdevice for example. Also, that means that anything that is dynamic
would have the lifetime rules imposed by debugfs which is rather
awkward.

The current code for simple_attr_open copies the in i_private pointer:

attr->data = inode->i_private;

if, instead, it would keep a reference to that, like

attr->dataptr = &inode->i_private;

we could NULL out that pointer on debugfs_remove() and have
simple_attr_read() just return -ENOENT.


However, if nobody else is concerned about this, I'll just remove all
the wireless debugfs code instead, I just don't want to allow crashing
it that way.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2008-04-04 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 23:56 Johannes Berg
2008-04-04 15:34 ` Greg KH
2008-04-04 15:41   ` Johannes Berg [this message]
2008-04-04 20:20     ` Greg KH
2008-04-04 20:57       ` Johannes Berg
2008-04-04 21:20         ` 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=1207323684.19189.54.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.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®