Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: SELinux: properly handle empty tty_files list
This commit is contained in:
commit
0a6d2fac61
1 changed files with 5 additions and 3 deletions
|
@ -2126,14 +2126,16 @@ static inline void flush_unauthorized_files(struct files_struct *files)
|
||||||
tty = get_current_tty();
|
tty = get_current_tty();
|
||||||
if (tty) {
|
if (tty) {
|
||||||
file_list_lock();
|
file_list_lock();
|
||||||
file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list);
|
if (!list_empty(&tty->tty_files)) {
|
||||||
if (file) {
|
struct inode *inode;
|
||||||
|
|
||||||
/* Revalidate access to controlling tty.
|
/* Revalidate access to controlling tty.
|
||||||
Use inode_has_perm on the tty inode directly rather
|
Use inode_has_perm on the tty inode directly rather
|
||||||
than using file_has_perm, as this particular open
|
than using file_has_perm, as this particular open
|
||||||
file may belong to another process and we are only
|
file may belong to another process and we are only
|
||||||
interested in the inode-based check here. */
|
interested in the inode-based check here. */
|
||||||
struct inode *inode = file->f_path.dentry->d_inode;
|
file = list_first_entry(&tty->tty_files, struct file, f_u.fu_list);
|
||||||
|
inode = file->f_path.dentry->d_inode;
|
||||||
if (inode_has_perm(current, inode,
|
if (inode_has_perm(current, inode,
|
||||||
FILE__READ | FILE__WRITE, NULL)) {
|
FILE__READ | FILE__WRITE, NULL)) {
|
||||||
drop_tty = 1;
|
drop_tty = 1;
|
||||||
|
|
Loading…
Reference in a new issue