Re: USB: serial: port lifetimes (was: Re: USB Ooops PL2303 when unplug while use (linux v3.7.3))

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

 



On Fri, Feb 22, 2013 at 01:21:24PM -0500, Peter Hurley wrote:
> On Fri, 2013-02-22 at 12:35 -0500, Alan Stern wrote:
> > On Fri, 22 Feb 2013, Johan Hovold wrote:
> ISTM the usb_serial_port private data should not be freed until
> port_release().
> 
> If usb traffic isn't halted until port_release() ...
> 
> static void port_release(struct device *dev)
> {
> 	struct usb_serial_port *port = to_usb_serial_port(dev);
> 	int i;
> 
> 	dev_dbg(dev, "%s\n", __func__);
> 
> 	/*
> 	 * Stop all the traffic before cancelling the work, so that
> 	 * nobody will restart it by calling usb_serial_port_softint.
> 	 */
> ====>	kill_traffic(port);
> 	cancel_work_sync(&port->work);
> 
> then what happens here if ->port_remove() has already been called?

I agree with Alan on this one. In fact, the call to kill_traffic in
port_release is wrong and I'm removing it as part of a disconnect clean
up series I'm preparing.

Exactly when the private port data is freed isn't the main issue here as
the subdrivers mustn't access the ports after the device has been
unregistered, and it's up to tty and usb-serial core to prevent any port
related calls after disconnect.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux