diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-09-08 16:27:31 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-09-08 16:27:31 +0900 |
commit | e7a963ef20cabde53d0e609737764ddc65f4605a (patch) | |
tree | d2bf292f2dde9c6ee213d401abbbdc63fb3afa75 /fs/namei.c | |
parent | a2494b9b5fb702becaf8d8e3138f7a1a0d3c537e (diff) | |
parent | 3ff323f89075624b6891e7c428edb8e8a35be13c (diff) | |
download | kernel_samsung_aries-e7a963ef20cabde53d0e609737764ddc65f4605a.zip kernel_samsung_aries-e7a963ef20cabde53d0e609737764ddc65f4605a.tar.gz kernel_samsung_aries-e7a963ef20cabde53d0e609737764ddc65f4605a.tar.bz2 |
Merge branches 'sh/smp' and 'sh/stable-updates'
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -1542,28 +1542,31 @@ int may_open(struct path *path, int acc_mode, int flag) * An append-only file must be opened in append mode for writing. */ if (IS_APPEND(inode)) { + error = -EPERM; if ((flag & FMODE_WRITE) && !(flag & O_APPEND)) - return -EPERM; + goto err_out; if (flag & O_TRUNC) - return -EPERM; + goto err_out; } /* O_NOATIME can only be set by the owner or superuser */ if (flag & O_NOATIME) - if (!is_owner_or_cap(inode)) - return -EPERM; + if (!is_owner_or_cap(inode)) { + error = -EPERM; + goto err_out; + } /* * Ensure there are no outstanding leases on the file. */ error = break_lease(inode, flag); if (error) - return error; + goto err_out; if (flag & O_TRUNC) { error = get_write_access(inode); if (error) - return error; + goto err_out; /* * Refuse to truncate files with mandatory locks held on them. @@ -1581,12 +1584,17 @@ int may_open(struct path *path, int acc_mode, int flag) } put_write_access(inode); if (error) - return error; + goto err_out; } else if (flag & FMODE_WRITE) vfs_dq_init(inode); return 0; +err_out: + ima_counts_put(path, acc_mode ? + acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC) : + ACC_MODE(flag) & (MAY_READ | MAY_WRITE)); + return error; } /* |