提交 b87c6e86 编写于 作者: E Elina Pasheva 提交者: Greg Kroah-Hartman

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/511157Signed-off-by: NElina Pasheva <epasheva@sierrawireless.com>
Cc: stable <stable@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 7650cd96
...@@ -594,14 +594,17 @@ static void sierra_indat_callback(struct urb *urb) ...@@ -594,14 +594,17 @@ static void sierra_indat_callback(struct urb *urb)
} else { } else {
if (urb->actual_length) { if (urb->actual_length) {
tty = tty_port_tty_get(&port->port); tty = tty_port_tty_get(&port->port);
if (tty) {
tty_buffer_request_room(tty, urb->actual_length); tty_buffer_request_room(tty,
tty_insert_flip_string(tty, data, urb->actual_length); urb->actual_length);
tty_flip_buffer_push(tty); tty_insert_flip_string(tty, data,
urb->actual_length);
tty_kref_put(tty); tty_flip_buffer_push(tty);
usb_serial_debug_data(debug, &port->dev, __func__,
urb->actual_length, data); tty_kref_put(tty);
usb_serial_debug_data(debug, &port->dev,
__func__, urb->actual_length, data);
}
} else { } else {
dev_dbg(&port->dev, "%s: empty read urb" dev_dbg(&port->dev, "%s: empty read urb"
" received\n", __func__); " received\n", __func__);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册