Re: device_remove_file and disconnect
From: Greg KH
Date: Sun Jul 24 2005 - 23:26:48 EST
On Thu, Jun 30, 2005 at 10:31:44PM +0200, matthieu castet wrote:
> >Then they should be fixed. Any specific examples?
> I am a little lasy to list all, but some drivers in driver/usb should
> have this problem : the first driver I look : ./misc/phidgetkit.c do
> . So sysfs read don't check if to_usb_interface or usb_get_intfdata
> return NULL pointer...
> And it is a bit your fault, as many developper should have read your
> great tutorial  ;)
You are correct, I'll go fix those drivers, thanks for pointing it out.
Others pointed out the same thing this week at OLS :)
> >>Also I always see driver free their privatre data in device disconnect,
> >>so if read/write from sysfs aren't serialized with device disconnect
> >>there are still a possible race like I show in my example.
> >Yes, you are correct. Again, any specific drivers you see with this
> I believe near all drivers that use sysfs via device_create_file, as I
> never see them use mutex in read/write in order to check there aren't in
> the same time in their disconnect that could free there private data
> when they do operation on it...
> Couldn't be possible the make device_remove_file blocking until all the
> open file are closed ?
Hm, do we even know that those files are opened then? I'll poke around
in sysfs and see if we could do that.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/