diff mbox series

[SRU,Cosmic,Bionic,1/1] tty: do not set TTY_IO_ERROR flag if console port

Message ID 1544597743-7510-2-git-send-email-woodrow.shen@canonical.com
State New
Headers show
Series [SRU,Cosmic,Bionic,1/1] tty: do not set TTY_IO_ERROR flag if console port | expand

Commit Message

Woodrow Shen Dec. 12, 2018, 6:55 a.m. UTC
From: Chanho Park <parkch98@gmail.com>

Since Commit 761ed4a94582 ('tty: serial_core: convert uart_close to use
tty_port_close') and Commit 4dda864d7307 ('tty: serial_core: Fix serial
console crash on port shutdown), a serial port which is used as
console can be stuck when logging out if there is a remained process.
After logged out, agetty will try to grab the serial port but it will
be failed because the previous process did not release the port
correctly. To fix this, TTY_IO_ERROR bit should not be enabled of
tty_port_close if the port is console port.

Reproduce step:
- Run background processes from serial console
$ while true; do sleep 10; done &

- Log out
$ logout
-> Stuck

- Read journal log by journalctl | tail
Jan 28 16:07:01 ubuntu systemd[1]: Stopped Serial Getty on ttyAMA0.
Jan 28 16:07:01 ubuntu systemd[1]: Started Serial Getty on ttyAMA0.
Jan 28 16:07:02 ubuntu agetty[1643]: /dev/ttyAMA0: not a tty

Fixes: 761ed4a94582 ("tty: serial_core: convert uart_close to use tty_port_close")
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Rob Herring <robh@kernel.org>
Cc: Jiri Slaby <jslaby@suse.com>
Signed-off-by: Chanho Park <parkch98@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/tty_port.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Po-Hsu Lin Dec. 12, 2018, 9:04 a.m. UTC | #1
Hi Woodrow,

your patch is missing your sign-off, and the "cherry-pick from commit " message here.

Thanks
Sam
Woodrow Shen Dec. 12, 2018, 2:15 p.m. UTC | #2
Hi Po-Hsu,

Thanks your feedback for correction, and I've sent the patch again.

Woodrow

On Wed, Dec 12, 2018 at 5:04 PM Po-Hsu Lin <po-hsu.lin@canonical.com> wrote:

> Hi Woodrow,
>
> your patch is missing your sign-off, and the "cherry-pick from commit "
> message here.
>
> Thanks
> Sam
>
>
diff mbox series

Patch

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 25d7368..c699d41 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -640,7 +640,8 @@  void tty_port_close(struct tty_port *port, struct tty_struct *tty,
 	if (tty_port_close_start(port, tty, filp) == 0)
 		return;
 	tty_port_shutdown(port, tty);
-	set_bit(TTY_IO_ERROR, &tty->flags);
+	if (!port->console)
+		set_bit(TTY_IO_ERROR, &tty->flags);
 	tty_port_close_end(port, tty);
 	tty_port_tty_set(port, NULL);
 }