Skip to content

Commit

Permalink
acm: Fix oops when closing ACM tty device right after open has failed.
Browse files Browse the repository at this point in the history
This commit 10077d4 has stopped
checking if there was a valid acm device associated to the tty, which is
not true right after open fails and tty subsystem tries to close the
device.

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 42dd2aa commit 922b135
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)

/* Perform the closing process and see if we need to do the hardware
shutdown */
if (tty_port_close_start(&acm->port, tty, filp) == 0)
if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0)
return;
acm_port_down(acm, 0);
tty_port_close_end(&acm->port, tty);
Expand Down

0 comments on commit 922b135

Please sign in to comment.