tty: Document check_tty_count() requires tty_lock held
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 5 Nov 2014 17:12:55 +0000 (12:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 02:41:22 +0000 (18:41 -0800)
commitdeb287e7401bbbf7803731805acbda1d983d1999
treea190857e293df1c08a6627b8c9a42f5e5f6ddbcc
parentd5e370a4eeb701201bd441b4ec089091dd6f2ce0
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: Alan Cox <alan@linux.intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c