From d64970cb765ec0d18b47596ee690a032bf77c95d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 24 Dec 2009 06:58:56 -0500 Subject: [PATCH] --- yaml --- r: 179403 b: refs/heads/master c: 6d125529c6cbfe570ce3bf9a0728548f087499da h: refs/heads/master i: 179401: d361a0a517f1c707b7b6ad489b6372f893fe8f34 179399: 2aa6c1aac676dd670ee1c4e8a30c28eea1ff977d v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 2 +- trunk/include/linux/fs.h | 2 +- trunk/security/tomoyo/tomoyo.c | 7 +------ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 759abb4146be..21ec620d4a88 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4ecf09fd3a7c8858198875171b684c73338fad83 +refs/heads/master: 6d125529c6cbfe570ce3bf9a0728548f087499da diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 1b26b1620664..d930f1856ed2 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1620,7 +1620,7 @@ struct file *do_filp_open(int dfd, const char *pathname, open_flag |= O_DSYNC; if (!acc_mode) - acc_mode = MAY_OPEN | ACC_MODE(flag); + acc_mode = MAY_OPEN | ACC_MODE(open_flag); /* O_TRUNC implies we need access checks for write permissions */ if (flag & O_TRUNC) diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 9147ca88f253..b1bcb275b596 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -2463,7 +2463,7 @@ int proc_nr_files(struct ctl_table *table, int write, int __init get_filesystem_list(char *buf); -#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) +#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) #endif /* __KERNEL__ */ diff --git a/trunk/security/tomoyo/tomoyo.c b/trunk/security/tomoyo/tomoyo.c index 8a00ade85166..2aceebf5f354 100644 --- a/trunk/security/tomoyo/tomoyo.c +++ b/trunk/security/tomoyo/tomoyo.c @@ -80,9 +80,8 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm) return tomoyo_find_next_domain(bprm); /* * Read permission is checked against interpreters using next domain. - * '1' is the result of open_to_namei_flags(O_RDONLY). */ - return tomoyo_check_open_permission(domain, &bprm->file->f_path, 1); + return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY); } static int tomoyo_path_truncate(struct path *path, loff_t length, @@ -184,10 +183,6 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd, static int tomoyo_dentry_open(struct file *f, const struct cred *cred) { int flags = f->f_flags; - - if ((flags + 1) & O_ACCMODE) - flags++; - flags |= f->f_flags & (O_APPEND | O_TRUNC); /* Don't check read permission here if called from do_execve(). */ if (current->in_execve) return 0;