Skip to content

Commit

Permalink
usb_serial: Fix oops when unexisting usb serial device is opened.
Browse files Browse the repository at this point in the history
This commit 335f851 has stopped
properly checking if there is any usb serial associated with the tty in
the close function. It happens the close function is called by releasing
the terminal right after opening the device fails.

As an example, open fails with a non-existing device, when probe has
never been called, because the device has never been plugged. This is
common in systems with static modules and no udev.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and Linus Torvalds committed Jun 25, 2009
1 parent 922b135 commit f4fa446
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
{
struct usb_serial_port *port = tty->driver_data;

if (!port)
return;

dbg("%s - port %d", __func__, port->number);


Expand Down

0 comments on commit f4fa446

Please sign in to comment.