aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/tomoyo.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/tomoyo/tomoyo.c')
-rw-r--r--security/tomoyo/tomoyo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 95d3f9572237..2615c7d43960 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -93,6 +93,12 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm)
93 return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY); 93 return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY);
94} 94}
95 95
96static int tomoyo_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
97{
98 struct path path = { mnt, dentry };
99 return tomoyo_path_perm(TOMOYO_TYPE_GETATTR, &path);
100}
101
96static int tomoyo_path_truncate(struct path *path) 102static int tomoyo_path_truncate(struct path *path)
97{ 103{
98 return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path); 104 return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path);
@@ -176,9 +182,10 @@ static int tomoyo_path_rename(struct path *old_parent,
176static int tomoyo_file_fcntl(struct file *file, unsigned int cmd, 182static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
177 unsigned long arg) 183 unsigned long arg)
178{ 184{
179 if (cmd == F_SETFL && ((arg ^ file->f_flags) & O_APPEND)) 185 if (!(cmd == F_SETFL && ((arg ^ file->f_flags) & O_APPEND)))
180 return tomoyo_path_perm(TOMOYO_TYPE_REWRITE, &file->f_path); 186 return 0;
181 return 0; 187 return tomoyo_check_open_permission(tomoyo_domain(), &file->f_path,
188 O_WRONLY | (arg & O_APPEND));
182} 189}
183 190
184static int tomoyo_dentry_open(struct file *f, const struct cred *cred) 191static int tomoyo_dentry_open(struct file *f, const struct cred *cred)
@@ -258,6 +265,7 @@ static struct security_operations tomoyo_security_ops = {
258 .path_mknod = tomoyo_path_mknod, 265 .path_mknod = tomoyo_path_mknod,
259 .path_link = tomoyo_path_link, 266 .path_link = tomoyo_path_link,
260 .path_rename = tomoyo_path_rename, 267 .path_rename = tomoyo_path_rename,
268 .inode_getattr = tomoyo_inode_getattr,
261 .file_ioctl = tomoyo_file_ioctl, 269 .file_ioctl = tomoyo_file_ioctl,
262 .path_chmod = tomoyo_path_chmod, 270 .path_chmod = tomoyo_path_chmod,
263 .path_chown = tomoyo_path_chown, 271 .path_chown = tomoyo_path_chown,