Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -237,6 +237,8 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
	module_put(serial->type->driver.owner);
bailout_mutex_unlock:
	port->open_count = 0;
	tty->driver_data = NULL;
	port->tty = NULL;
	mutex_unlock(&port->mutex);
bailout_kref_put:
	usb_serial_put(serial);