[PATCH] USB Serial: clean tty fields on failed device open
authorFrank Gevaerts <frank.gevaerts@fks.be>
Wed, 14 Jun 2006 13:52:05 +0000 (15:52 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Jun 2006 22:04:17 +0000 (15:04 -0700)
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>
drivers/usb/serial/usb-serial.c

index cbca3402d6cd2cac1f323f693b7594a1a9706da1..92c213fa93173bc24dbbaddd6a5faba733ca51f6 100644 (file)
@@ -237,6 +237,8 @@ bailout_module_put:
        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);