diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/hooks.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 44e9cd470543..f5df8c70a9b5 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1695,9 +1695,10 @@ static inline void flush_unauthorized_files(struct files_struct * files) | |||
1695 | struct tty_struct *tty; | 1695 | struct tty_struct *tty; |
1696 | struct fdtable *fdt; | 1696 | struct fdtable *fdt; |
1697 | long j = -1; | 1697 | long j = -1; |
1698 | int drop_tty = 0; | ||
1698 | 1699 | ||
1699 | mutex_lock(&tty_mutex); | 1700 | mutex_lock(&tty_mutex); |
1700 | tty = current->signal->tty; | 1701 | tty = get_current_tty(); |
1701 | if (tty) { | 1702 | if (tty) { |
1702 | file_list_lock(); | 1703 | file_list_lock(); |
1703 | file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list); | 1704 | file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list); |
@@ -1710,12 +1711,14 @@ static inline void flush_unauthorized_files(struct files_struct * files) | |||
1710 | struct inode *inode = file->f_dentry->d_inode; | 1711 | struct inode *inode = file->f_dentry->d_inode; |
1711 | if (inode_has_perm(current, inode, | 1712 | if (inode_has_perm(current, inode, |
1712 | FILE__READ | FILE__WRITE, NULL)) { | 1713 | FILE__READ | FILE__WRITE, NULL)) { |
1713 | /* Reset controlling tty. */ | 1714 | drop_tty = 1; |
1714 | current->signal->tty = NULL; | ||
1715 | current->signal->tty_old_pgrp = 0; | ||
1716 | } | 1715 | } |
1717 | } | 1716 | } |
1718 | file_list_unlock(); | 1717 | file_list_unlock(); |
1718 | |||
1719 | /* Reset controlling tty. */ | ||
1720 | if (drop_tty) | ||
1721 | proc_set_tty(current, NULL); | ||
1719 | } | 1722 | } |
1720 | mutex_unlock(&tty_mutex); | 1723 | mutex_unlock(&tty_mutex); |
1721 | 1724 | ||