lkml.org 
[lkml]   [2008]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: debugfs_remove() vs. anything that is dynamic
From
Date

> 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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-04-04 17:43    [W:0.241 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site