提交 b059c81a 编写于 作者: F Frank Gevaerts 提交者: 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: NFrank Gevaerts <frank.gevaerts@fks.be>
Acked-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 4186c29c
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册