On Wed, 15 Mar 2006, Paul Fulghum wrote:

> This is becoming clearer:
> 
> 1. usb device is disconnected (usb/core/hub.c:usb_disconnect)
> 2. usb_disconnect calls usb_disconnect recursively for child devices
> 3. usb_disconnect calls drivers/base/core.c:device_unregister() for dev
> 4. device_unregister() -> device_del() -> device_remove_file()
> 
> void device_remove_file(struct device * dev, struct device_attribute * attr)
> {
>       if (get_device(dev)) {
>               sysfs_remove_file(&dev->kobj, &attr->attr);
>               put_device(dev);
>       }
> }
> 
> The sysfs entry is deleted, which appears to release dev->kobj->dentry
> even though dev->kobj is still valid with references.
> 
> Later acm_tty_close() -> tty_unregister_device() and dev->kobj->dentry
> is touched while trying to release the tty class device symlinks.

Yes, that agrees with my assessment.

> Should driver core defer sysfs_remove_file until
> last dev->kobj reference is dropped?

No.  The files should be deleted.  James Bottomley refers to this as 
"removing from visibility".  There's no point leaving the symlink visible 
once it can no longer be used.

Instead, the code should be fixed so that the attempt to remove the 
already-deleted symlink by class_device_del() doesn't cause an oops.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to