Patch "tty: Fix tty_send_xchar() lock order inversion" has been added to the 4.2-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
tty: Fix tty_send_xchar() lock order inversion
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tty-fix-tty_send_xchar-lock-order-inversion.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
ee0c1a65cf95230d5eb3d9de94fd2ead9a428c67Mon Sep 17 00:00:00 2001
From: Peter Hurley <[email protected]>
Date: Wed, 11 Nov 2015 08:03:54 -0500
Subject: tty: Fix tty_send_xchar() lock order inversion
From: Peter Hurley <[email protected]>
commit ee0c1a65cf95230d5eb3d9de94fd2ead9a428c67 upstream.
The correct lock order is atomic_write_lock => termios_rwsem, as established by tty_write() => n_tty_write().
--- drivers/tty/tty_io.c | 4 ++++ drivers/tty/tty_ioctl.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/tty/tty_io.c +4 -0
@@ -1279,18 +1279,22 @@ int tty_send_xchar(struct tty_struct *ttint was_stopped = tty->stopped;if (tty->ops->send_xchar) { +down_read (&tty->termios_rwsem); tty->ops->send_xchar (tty, ch); +up_read (&tty->termios_rwsem);return 0 ; }if (tty_write_lock (tty,0 ) <0 )return -ERESTARTSYS ; +down_read (&tty->termios_rwsem);if (was_stopped)start_tty (tty); tty->ops->write (tty, &ch,1 );if (was_stopped)stop_tty (tty); +up_read (&tty->termios_rwsem);tty_write_unlock (tty);return 0 ; }
drivers/tty/tty_ioctl.c +0 -4
@@ -1142,16 +1142,12 @@ int n_tty_ioctl_helper(struct tty_structspin_unlock_irq (&tty->flow_lock);break ;case TCIOFF : -down_read (&tty->termios_rwsem);if (STOP_CHAR (tty) != __DISABLED_CHAR) retval =tty_send_xchar (tty,STOP_CHAR (tty)); -up_read (&tty->termios_rwsem);break ;case TCION : -down_read (&tty->termios_rwsem);if (START_CHAR (tty) != __DISABLED_CHAR) retval =tty_send_xchar (tty,START_CHAR (tty)); -up_read (&tty->termios_rwsem);break ;default :return -EINVAL ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.2/tty-fix-tty_send_xchar-lock-order-inversion.patch queue-4.2/tty-audit-fix-audit-source.patch