On Mon, 13 Mar 2006, Paul Fulghum wrote:

> This patch correct the flaw identified by Pete Zaitcev.
> 
> Plus I now fully understand the sysfs oops.
> It is not a problem with sysfs, so GregKH rightly ignored me.
> 
> A pointer to control_interface->dev is saved in the tty class device
> object created by tty_register_device(). This reference is used to
> create/destroy sysfs symlinks between the tty class device object and the
> control_interface->dev. On disconnect control_interface->dev is released.
> tty_unregister_device() is called later when the last tty file desc
> is closed. tty_unregister_device() then passes the stale pointer
> to sysfs_remove_link() causing the oops if the slab debug is turned on.
> 
> So the below patch seems the cleanest way of fixing this.

Wouldn't it be better to do get_device() on control_interface->dev just
before calling tty_register_device(), so that the data structure isn't
released too soon?  (And of course, call put_device() after the tty
device is unregistered.)  That way all the sysfs links remain intact, as
intended.

In fact, shouldn't the tty subsystem do this automatically on behalf of 
all callers?

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