diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-01-17 15:42:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-02 13:11:27 -0500 |
commit | 1d1d14da12e79a6c05fbe1a975401f0f56c93316 (patch) | |
tree | 6cbf288a73b5251633590e31da9b175be7311559 /include/linux/tty.h | |
parent | 3abf87cd3e70009ed70a7f28c2914888a7e27332 (diff) |
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>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r-- | include/linux/tty.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 849659908f23..55964b9490dd 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -25,6 +25,9 @@ | |||
25 | * | 25 | * |
26 | * legacy_mutex - Nested tty locks are necessary for releasing pty pairs. | 26 | * legacy_mutex - Nested tty locks are necessary for releasing pty pairs. |
27 | * The stable lock order is master pty first, then slave pty. | 27 | * The stable lock order is master pty first, then slave pty. |
28 | * tty_buffer lock - slave ptys can claim nested buffer lock when handling | ||
29 | * signal chars. The stable lock order is slave pty, then | ||
30 | * master. | ||
28 | */ | 31 | */ |
29 | 32 | ||
30 | enum { | 33 | enum { |
@@ -460,6 +463,7 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty); | |||
460 | extern void tty_buffer_free_all(struct tty_port *port); | 463 | extern void tty_buffer_free_all(struct tty_port *port); |
461 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); | 464 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); |
462 | extern void tty_buffer_init(struct tty_port *port); | 465 | extern void tty_buffer_init(struct tty_port *port); |
466 | extern void tty_buffer_set_lock_subclass(struct tty_port *port); | ||
463 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 467 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
464 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 468 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
465 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, | 469 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |