Re: device_remove_file and disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Greg KH wrote:
On Wed, Jun 29, 2005 at 06:59:00PM +0200, matthieu castet wrote:

Hi,

I have a question about sysfs interface.

If you open a sysfs file created by a module, then remove it (rmmoding the module that create this sysfs file), then try to read the opened file, you often get strange result (segdefault or oppps).


What file did you do this for?  The module count should be incremented
if you do this, to prevent the module from being unloaded.

Ok, but if we unplug a device, then disconnect will be called even if we opened a sysfs file.

Couldn't be a race between the moment we read our private data and check it is valid and the moment we use it :

Process A (read/write sysfs file) 		Process B (disconnect)
recover our private data from struct device
check it is valid
						free our private data
do operation on private data


If it is the first case, I fear that lot's of modules are broken.


Remember, only root can unload modules, so it really isn't _that_ big of
a deal (I can do a lot more damage as root than just oopsing the
kernel...)

Yes I know, but fewer possible opps won't hurt ;)

thanks

Matthieu
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux