Re: Flaw in the driver-model implementation of attributes

viro@parcelfarce.linux.theplanet.co.uk
Mon, 16 Jun 2003 19:15:38 +0100


On Mon, Jun 16, 2003 at 08:00:33PM +0200, Martin Diehl wrote:
> with old procfs one would like to set the owner field of the
> corresponding struct proc_dir_entry and/or file_operations at this point.
>
> > - userspace opens new file (this does not increment the device drivers
> > use count.)
>
> given owner=THIS_MODULE was set, this would bump the module's use count

... and for objects that have lifetime different from that of any module
this approach fucks up with procfs just as badly as with sysctl or sysfs.

Folks, _forget_ modules. ->owner is OK for many things, but for stuff
like procfs it's not enough. It only protects code. procfs and sysfs
entries are _data_. And in cases when it is OK the data is protected
by separate refcounts.

Folks, please, stop assuming that rmmod is the root of all evil and/or
place to deal with said evil. Objects can be and are destroyed regardless
of rmmod.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/