Commit d4855e1f authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

tty: Reset hupped state on open

A common security idiom is to hangup the current tty (via vhangup())
after forking but before execing a root shell. This hangs up any
existing opens which other processes may have and ensures subsequent
opens have the necessary permissions to open the root shell tty/pty.

Reset the TTY_HUPPED state after the driver has successfully
returned the opened tty (perform the reset while the tty is locked
to avoid racing with concurrent hangups).
Reported-by: default avatarHeorhi Valakhanovich <valahanovich@tut.by>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Cc: stable <stable@vger.kernel.org> # 3.12
Tested-by: default avatarHeorhi Valakhanovich <valahanovich@tut.by>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3dcf344b
...@@ -2086,6 +2086,7 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -2086,6 +2086,7 @@ static int tty_open(struct inode *inode, struct file *filp)
filp->f_op = &tty_fops; filp->f_op = &tty_fops;
goto retry_open; goto retry_open;
} }
clear_bit(TTY_HUPPED, &tty->flags);
tty_unlock(tty); tty_unlock(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