]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - security/selinux/hooks.c
tty: fix fu_list abuse
[net-next-2.6.git] / security / selinux / hooks.c
index bd7da0f0ccf3f58a72784c1ed0e2042eb8cd1b38..4796ddd4e721ae454a02563d713aa235870ece02 100644 (file)
@@ -2172,6 +2172,7 @@ static inline void flush_unauthorized_files(const struct cred *cred,
        if (tty) {
                spin_lock(&tty_files_lock);
                if (!list_empty(&tty->tty_files)) {
+                       struct tty_file_private *file_priv;
                        struct inode *inode;
 
                        /* Revalidate access to controlling tty.
@@ -2179,7 +2180,9 @@ static inline void flush_unauthorized_files(const struct cred *cred,
                           than using file_has_perm, as this particular open
                           file may belong to another process and we are only
                           interested in the inode-based check here. */
-                       file = list_first_entry(&tty->tty_files, struct file, f_u.fu_list);
+                       file_priv = list_first_entry(&tty->tty_files,
+                                               struct tty_file_private, list);
+                       file = file_priv->file;
                        inode = file->f_path.dentry->d_inode;
                        if (inode_has_perm(cred, inode,
                                           FILE__READ | FILE__WRITE, NULL)) {