aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorElina Pasheva <epasheva@sierrawireless.com>2010-02-15 17:50:14 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:55:03 -0500
commitb87c6e86dac1bb5222279cc8ff7e09529e1c4ed9 (patch)
tree01c52edb21677004ad1a64c20f1f3f965ee13b27 /drivers/usb
parent7650cd9678df29b01d1e46a9d2ce7e5d8c72b3ce (diff)
USB: serial: sierra driver indat_callback fix
A crash has been reported with sierra driver on disconnect with Ubuntu/Lucid distribution based on kernel-2.6.32. The cause of the crash was determined as "NULL tty pointer was being referenced" and the NULL pointer was passed by sierra_indat_callback(). This patch modifies sierra_indat_callback() function to check for NULL tty structure pointer. This modification prevents a crash from happening when the device is disconnected. This patch fixes the bug reported in Launchpad: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/511157 Signed-off-by: Elina Pasheva <epasheva@sierrawireless.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/sierra.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 6aeea40081c2..fcec46603558 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -594,14 +594,17 @@ static void sierra_indat_callback(struct urb *urb)
594 } else { 594 } else {
595 if (urb->actual_length) { 595 if (urb->actual_length) {
596 tty = tty_port_tty_get(&port->port); 596 tty = tty_port_tty_get(&port->port);
597 597 if (tty) {
598 tty_buffer_request_room(tty, urb->actual_length); 598 tty_buffer_request_room(tty,
599 tty_insert_flip_string(tty, data, urb->actual_length); 599 urb->actual_length);
600 tty_flip_buffer_push(tty); 600 tty_insert_flip_string(tty, data,
601 601 urb->actual_length);
602 tty_kref_put(tty); 602 tty_flip_buffer_push(tty);
603 usb_serial_debug_data(debug, &port->dev, __func__, 603
604 urb->actual_length, data); 604 tty_kref_put(tty);
605 usb_serial_debug_data(debug, &port->dev,
606 __func__, urb->actual_length, data);
607 }
605 } else { 608 } else {
606 dev_dbg(&port->dev, "%s: empty read urb" 609 dev_dbg(&port->dev, "%s: empty read urb"
607 " received\n", __func__); 610 " received\n", __func__);