From: Frank Gevaerts Date: Wed, 14 Jun 2006 13:52:05 +0000 (+0200) Subject: [PATCH] USB Serial: clean tty fields on failed device open X-Git-Tag: v2.6.18-rc1~858^2~26 X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=b059c81af7a1759a911cfc20ce8a4bf47c435830;p=~andy%2Flinux [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: Frank Gevaerts Acked-by: Luiz Fernando N. Capitulino Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index cbca3402d6c..92c213fa931 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -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);