Commit 922b1356 authored by Thadeu Lima de Souza Cascardo's avatar Thadeu Lima de Souza Cascardo Committed by Linus Torvalds

acm: Fix oops when closing ACM tty device right after open has failed.

This commit 10077d4a 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: default avatarThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 42dd2aa6
...@@ -677,7 +677,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) ...@@ -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 /* Perform the closing process and see if we need to do the hardware
shutdown */ shutdown */
if (tty_port_close_start(&acm->port, tty, filp) == 0) if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0)
return; return;
acm_port_down(acm, 0); acm_port_down(acm, 0);
tty_port_close_end(&acm->port, tty); tty_port_close_end(&acm->port, tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment