diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2006-04-13 16:27:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:09 -0400 |
commit | 57845bd104233cb75b9ab3624f7ea7662298bc27 (patch) | |
tree | 73ac01088881aa217b07c79a781b7c4412ea85e4 /drivers/usb/serial | |
parent | c10746dbb39d41e5fc27badfebe61448210c426d (diff) |
[PATCH] USB: console: fix oops
Prevent NULL dereference when used as a USB-serial console.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 986d7622273d..1122a0da41c1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1261,7 +1261,6 @@ static void ftdi_shutdown (struct usb_serial *serial) | |||
1261 | 1261 | ||
1262 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) | 1262 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) |
1263 | { /* ftdi_open */ | 1263 | { /* ftdi_open */ |
1264 | struct termios tmp_termios; | ||
1265 | struct usb_device *dev = port->serial->dev; | 1264 | struct usb_device *dev = port->serial->dev; |
1266 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1265 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1267 | unsigned long flags; | 1266 | unsigned long flags; |
@@ -1271,8 +1270,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1271 | 1270 | ||
1272 | dbg("%s", __FUNCTION__); | 1271 | dbg("%s", __FUNCTION__); |
1273 | 1272 | ||
1274 | 1273 | if (port->tty) | |
1275 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1274 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1276 | 1275 | ||
1277 | /* No error checking for this (will get errors later anyway) */ | 1276 | /* No error checking for this (will get errors later anyway) */ |
1278 | /* See ftdi_sio.h for description of what is reset */ | 1277 | /* See ftdi_sio.h for description of what is reset */ |
@@ -1286,7 +1285,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1286 | This is same behaviour as serial.c/rs_open() - Kuba */ | 1285 | This is same behaviour as serial.c/rs_open() - Kuba */ |
1287 | 1286 | ||
1288 | /* ftdi_set_termios will send usb control messages */ | 1287 | /* ftdi_set_termios will send usb control messages */ |
1289 | ftdi_set_termios(port, &tmp_termios); | 1288 | if (port->tty) |
1289 | ftdi_set_termios(port, NULL); | ||
1290 | 1290 | ||
1291 | /* FIXME: Flow control might be enabled, so it should be checked - | 1291 | /* FIXME: Flow control might be enabled, so it should be checked - |
1292 | we have no control of defaults! */ | 1292 | we have no control of defaults! */ |
@@ -1867,7 +1867,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1867 | err("%s urb failed to set baudrate", __FUNCTION__); | 1867 | err("%s urb failed to set baudrate", __FUNCTION__); |
1868 | } | 1868 | } |
1869 | /* Ensure RTS and DTR are raised when baudrate changed from 0 */ | 1869 | /* Ensure RTS and DTR are raised when baudrate changed from 0 */ |
1870 | if ((old_termios->c_cflag & CBAUD) == B0) { | 1870 | if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) { |
1871 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 1871 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1872 | } | 1872 | } |
1873 | } | 1873 | } |