Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328977
b: refs/heads/master
c: ee97cd8
h: refs/heads/master
i:
  328975: 9f77a8d
v: v3
  • Loading branch information
Al Viro committed Sep 27, 2012
1 parent 74775c0 commit f5e9c02
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8280d16172243702ed43432f826ca6130edb4086
refs/heads/master: ee97cd872d08b8623076f2a63ffb872d0884411a
47 changes: 15 additions & 32 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2126,8 +2126,6 @@ static inline void flush_unauthorized_files(const struct cred *cred,
spin_lock(&files->file_lock);
for (;;) {
unsigned long set, i;
int fd;

j++;
i = j * BITS_PER_LONG;
fdt = files_fdtable(files);
Expand All @@ -2138,38 +2136,23 @@ static inline void flush_unauthorized_files(const struct cred *cred,
continue;
spin_unlock(&files->file_lock);
for ( ; set ; i++, set >>= 1) {
if (set & 1) {
file = fget(i);
if (!file)
continue;
if (file_has_perm(cred,
file,
file_to_av(file))) {
sys_close(i);
fd = get_unused_fd();
if (fd != i) {
if (fd >= 0)
put_unused_fd(fd);
fput(file);
continue;
}
if (devnull) {
get_file(devnull);
} else {
devnull = dentry_open(
&selinux_null,
O_RDWR, cred);
if (IS_ERR(devnull)) {
devnull = NULL;
put_unused_fd(fd);
fput(file);
continue;
}
}
fd_install(fd, devnull);
if (!(set & 1))
continue;
file = fget(i);
if (!file)
continue;
if (file_has_perm(cred, file, file_to_av(file))) {
if (devnull) {
get_file(devnull);
} else {
devnull = dentry_open(&selinux_null,
O_RDWR, cred);
if (IS_ERR(devnull))
devnull = NULL;
}
fput(file);
replace_fd(i, devnull, 0);
}
fput(file);
}
spin_lock(&files->file_lock);

Expand Down

0 comments on commit f5e9c02

Please sign in to comment.