diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2006-09-26 02:32:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:53 -0400 |
commit | b20c8122a3204496fca8b5343c93b60fe11dad04 (patch) | |
tree | f807fb699dcec3f40a8de1a5c64f3653cf68bb6a /security/selinux | |
parent | bc7e982b84aceef0a040c88ff659eb5c83818f72 (diff) |
[PATCH] selinux: fix tty locking
Take tty_mutex when accessing ->signal->tty in selinux code. Noted by Alan
Cox. Longer term, we are looking at refactoring the code to provide better
encapsulation of the tty layer, but this is a simple fix that addresses the
immediate bug.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Alan Cox <alan@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/hooks.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 55cec4d6f117..e4d81a42fca4 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1689,10 +1689,12 @@ static inline void flush_unauthorized_files(struct files_struct * files) | |||
1689 | { | 1689 | { |
1690 | struct avc_audit_data ad; | 1690 | struct avc_audit_data ad; |
1691 | struct file *file, *devnull = NULL; | 1691 | struct file *file, *devnull = NULL; |
1692 | struct tty_struct *tty = current->signal->tty; | 1692 | struct tty_struct *tty; |
1693 | struct fdtable *fdt; | 1693 | struct fdtable *fdt; |
1694 | long j = -1; | 1694 | long j = -1; |
1695 | 1695 | ||
1696 | mutex_lock(&tty_mutex); | ||
1697 | tty = current->signal->tty; | ||
1696 | if (tty) { | 1698 | if (tty) { |
1697 | file_list_lock(); | 1699 | file_list_lock(); |
1698 | file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list); | 1700 | file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list); |
@@ -1712,6 +1714,7 @@ static inline void flush_unauthorized_files(struct files_struct * files) | |||
1712 | } | 1714 | } |
1713 | file_list_unlock(); | 1715 | file_list_unlock(); |
1714 | } | 1716 | } |
1717 | mutex_unlock(&tty_mutex); | ||
1715 | 1718 | ||
1716 | /* Revalidate access to inherited open files. */ | 1719 | /* Revalidate access to inherited open files. */ |
1717 | 1720 | ||