Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+5 -3
+5 -3
security/selinux/hooks.c
··· 2126 2126 tty = get_current_tty(); 2127 2127 if (tty) { 2128 2128 file_list_lock(); 2129 - file = list_entry(tty->tty_files.next, typeof(*file), f_u.fu_list); 2130 - if (file) { 2129 + if (!list_empty(&tty->tty_files)) { 2130 + struct inode *inode; 2131 + 2131 2132 /* Revalidate access to controlling tty. 2132 2133 Use inode_has_perm on the tty inode directly rather 2133 2134 than using file_has_perm, as this particular open 2134 2135 file may belong to another process and we are only 2135 2136 interested in the inode-based check here. */ 2136 - struct inode *inode = file->f_path.dentry->d_inode; 2137 + file = list_first_entry(&tty->tty_files, struct file, f_u.fu_list); 2138 + inode = file->f_path.dentry->d_inode; 2137 2139 if (inode_has_perm(current, inode, 2138 2140 FILE__READ | FILE__WRITE, NULL)) { 2139 2141 drop_tty = 1;