[PATCH] USB Serial: clean tty fields on failed device open
If either the driver's open() method or try_module_get() fails, we need to set 'tty->driver_data' and 'port->tty' to NULL in serial_open(), otherwise we'll get an OOPS in usb_device_disconnect() when the device is disconnected. Signed-off-by: Frank Gevaerts <frank.gevaerts@fks.be> Acked-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4186c29ca1
commit
b059c81af7
@@ -237,6 +237,8 @@ bailout_module_put:
|
|||||||
module_put(serial->type->driver.owner);
|
module_put(serial->type->driver.owner);
|
||||||
bailout_mutex_unlock:
|
bailout_mutex_unlock:
|
||||||
port->open_count = 0;
|
port->open_count = 0;
|
||||||
|
tty->driver_data = NULL;
|
||||||
|
port->tty = NULL;
|
||||||
mutex_unlock(&port->mutex);
|
mutex_unlock(&port->mutex);
|
||||||
bailout_kref_put:
|
bailout_kref_put:
|
||||||
usb_serial_put(serial);
|
usb_serial_put(serial);
|
||||||
|
Reference in New Issue
Block a user