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

tty: Document check_tty_count() requires tty_lock held

Holding the tty_lock() is necessary to prevent concurrent changes
to the tty count that may cause it to differ from the open file
list count. The tty_lock() is already held at all call sites.

NB: Note that the check for the pty master tty count is safe because
the slave's tty_lock() is held while decrementing the pty master
tty count.
Reviewed-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d5e370a4
...@@ -275,6 +275,7 @@ int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, ...@@ -275,6 +275,7 @@ int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
return 0; return 0;
} }
/* Caller must hold tty_lock */
static int check_tty_count(struct tty_struct *tty, const char *routine) static int check_tty_count(struct tty_struct *tty, const char *routine)
{ {
#ifdef CHECK_TTY_COUNT #ifdef CHECK_TTY_COUNT
......
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