diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-17 04:27:58 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-17 04:27:58 +0100 |
commit | d05f06e60df4f56a70fb8a3e46335b40687169e9 (patch) | |
tree | c1eec6749fed86a21b08606e1e4acefe4b033253 /security/selinux/hooks.c | |
parent | Merge branch 'arch-s390' into no-rebases (diff) | |
parent | frv: fix the broken preempt (diff) | |
download | linux-d05f06e60df4f56a70fb8a3e46335b40687169e9.tar.xz linux-d05f06e60df4f56a70fb8a3e46335b40687169e9.zip |
Merge branch 'arch-frv' into no-rebases
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 24ab4148547c..61a53367d029 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2132,18 +2132,14 @@ static inline void flush_unauthorized_files(const struct cred *cred, return; devnull = dentry_open(&selinux_null, O_RDWR, cred); - if (!IS_ERR(devnull)) { - /* replace all the matching ones with this */ - do { - replace_fd(n - 1, get_file(devnull), 0); - } while ((n = iterate_fd(files, n, match_file, cred)) != 0); + if (IS_ERR(devnull)) + devnull = NULL; + /* replace all the matching ones with this */ + do { + replace_fd(n - 1, devnull, 0); + } while ((n = iterate_fd(files, n, match_file, cred)) != 0); + if (devnull) fput(devnull); - } else { - /* just close all the matching ones */ - do { - replace_fd(n - 1, NULL, 0); - } while ((n = iterate_fd(files, n, match_file, cred)) != 0); - } } /* |