aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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-15 12:06:28 -0400
commit3c0611ea174f2dd680856120272f0c8babf1aa6b (patch)
treefe9d87c1239145c0e600acfa8f4396da16a3d9a2 /drivers
parent401c1e931d0f19af9eb25a310e1aeb187d03526d (diff)
USB: serial: sierra driver indat_callback fix
commit b87c6e86dac1bb5222279cc8ff7e09529e1c4ed9 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-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 3eb6143bb646..0cfd62127424 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -604,14 +604,17 @@ static void sierra_indat_callback(struct urb *urb)
604 } else { 604 } else {
605 if (urb->actual_length) { 605 if (urb->actual_length) {
606 tty = tty_port_tty_get(&port->port); 606 tty = tty_port_tty_get(&port->port);
607 607 if (tty) {
608 tty_buffer_request_room(tty, urb->actual_length); 608 tty_buffer_request_room(tty,
609 tty_insert_flip_string(tty, data, urb->actual_length); 609 urb->actual_length);
610 tty_flip_buffer_push(tty); 610 tty_insert_flip_string(tty, data,
611 611 urb->actual_length);
612 tty_kref_put(tty); 612 tty_flip_buffer_push(tty);
613 usb_serial_debug_data(debug, &port->dev, __func__, 613
614 urb->actual_length, data); 614 tty_kref_put(tty);
615 usb_serial_debug_data(debug, &port->dev,
616 __func__, urb->actual_length, data);
617 }
615 } else { 618 } else {
616 dev_dbg(&port->dev, "%s: empty read urb" 619 dev_dbg(&port->dev, "%s: empty read urb"
617 " received\n", __func__); 620 " received\n", __func__);