Skip to content

Commit

Permalink
[PATCH] USB Serial: clean tty fields on failed device open
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Frank Gevaerts authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 4186c29 commit b059c81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b059c81

Please sign in to comment.