On Tue, May 11, 2004 at 01:43:19PM -0700, Pete Zaitcev wrote:
> Hi, Greg,
> 
> One guy recently reminded me that the way 2.4 clears tty->driver_data
> is wrong. I went to check 2.6.6, which does it correctly in between
> ->release and ->disconnect (hurray!) but then it completely ignores that
> the port was marked disconnected (by resetting intfdata) and goes
> on to accept all writes and other functions. All the old checks for
> !serial remain in the code, even though now they are not possible
> to trip. It looks terribly unsafe to me. Is 2.6.6 simply incomplete?

I don't think it's incomplete, here's what happens:
        - on USB probe we grab a reference to the serial port kref
        - on USB disconnect we drop the reference
        - on tty open we grab a reference to the serial port kref
        - on tty close we mark the tty as NULL and drop the reference

So on the last reference drop the structure will properly go away.

If a user yanks out the device (giving us a USB disconnect) yet still
has a port open, the device will not go away, but any future writes will
fail (due to the driver failing on a call to usb_submit_urb() for the
device that is disconnected.)

Do you see a place this is unsafe?

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to