tty: Make tty_files_lock per-tty
Access to tty->tty_files list is always per-tty, never for all ttys simultaneously. Replace global tty_files_lock spinlock with per-tty ->files_lock. Initialize when the ->tty_files list is inited, in alloc_tty_struct(). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
527ffc11e1
commit
4a51096937
@@ -2415,7 +2415,7 @@ static inline void flush_unauthorized_files(const struct cred *cred,
|
||||
|
||||
tty = get_current_tty();
|
||||
if (tty) {
|
||||
spin_lock(&tty_files_lock);
|
||||
spin_lock(&tty->files_lock);
|
||||
if (!list_empty(&tty->tty_files)) {
|
||||
struct tty_file_private *file_priv;
|
||||
|
||||
@@ -2430,7 +2430,7 @@ static inline void flush_unauthorized_files(const struct cred *cred,
|
||||
if (file_path_has_perm(cred, file, FILE__READ | FILE__WRITE))
|
||||
drop_tty = 1;
|
||||
}
|
||||
spin_unlock(&tty_files_lock);
|
||||
spin_unlock(&tty->files_lock);
|
||||
tty_kref_put(tty);
|
||||
}
|
||||
/* Reset controlling tty. */
|
||||
|
||||
Reference in New Issue
Block a user