Commit b059c81a authored by Frank Gevaerts's avatar Frank Gevaerts Committed by Greg Kroah-Hartman

[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: default avatarFrank Gevaerts <frank.gevaerts@fks.be>
Acked-by: default avatarLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4186c29c
...@@ -237,6 +237,8 @@ static int serial_open (struct tty_struct *tty, struct file * filp) ...@@ -237,6 +237,8 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment