]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/tty/tty_buffer.c
pty: Fix buffer flush deadlock
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 17 Jan 2015 20:42:05 +0000 (15:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Feb 2015 18:11:27 +0000 (10:11 -0800)
commit1d1d14da12e79a6c05fbe1a975401f0f56c93316
tree6cbf288a73b5251633590e31da9b175be7311559
parent3abf87cd3e70009ed70a7f28c2914888a7e27332
pty: Fix buffer flush deadlock

The pty driver does not clear its write buffer when commanded.
This is to avoid an apparent deadlock between parallel flushes from
both pty ends; specifically when handling either BRK or INTR input.
However, parallel flushes from this source is not possible since
the pty master can never be set to BRKINT or ISIG. Parallel flushes
from other sources are possible but these do not threaten deadlocks.

Annotate the tty buffer mutex for lockdep to represent the nested
tty_buffer locking which occurs when the pty slave is processing input
(its buffer mutex held) and receives INTR or BRK and acquires the
linked tty buffer mutex via tty_buffer_flush().

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c
drivers/tty/tty_buffer.c
include/linux/tty.h