diff options
author | Serge E. Hallyn <serge@hallyn.com> | 2011-03-23 19:43:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:47:13 -0400 |
commit | 2e1496707560ecf98e9b0604622c0990f94861d3 (patch) | |
tree | d1473b70fad31a903fedc87221680678a6c6c5f6 /fs | |
parent | e795b71799ff0b27365020c9ddaa25d0d83f99c8 (diff) |
userns: rename is_owner_or_cap to inode_owner_or_capable
And give it a kernel-doc comment.
[akpm@linux-foundation.org: btrfs changed in linux-next]
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>
Acked-by: David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/acl.c | 2 | ||||
-rw-r--r-- | fs/attr.c | 4 | ||||
-rw-r--r-- | fs/btrfs/acl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 4 | ||||
-rw-r--r-- | fs/ext2/acl.c | 2 | ||||
-rw-r--r-- | fs/ext2/ioctl.c | 6 | ||||
-rw-r--r-- | fs/ext3/acl.c | 2 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 6 | ||||
-rw-r--r-- | fs/ext4/acl.c | 2 | ||||
-rw-r--r-- | fs/ext4/ioctl.c | 8 | ||||
-rw-r--r-- | fs/fcntl.c | 2 | ||||
-rw-r--r-- | fs/generic_acl.c | 2 | ||||
-rw-r--r-- | fs/gfs2/file.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/ioctl.c | 2 | ||||
-rw-r--r-- | fs/inode.c | 13 | ||||
-rw-r--r-- | fs/jffs2/acl.c | 2 | ||||
-rw-r--r-- | fs/jfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 2 | ||||
-rw-r--r-- | fs/logfs/file.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/ioctl.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/acl.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/ioctl.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 2 | ||||
-rw-r--r-- | fs/ubifs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/utimes.c | 2 | ||||
-rw-r--r-- | fs/xattr.c | 2 |
28 files changed, 45 insertions, 42 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 33aa116732c8..535ab6eccb1a 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -323,7 +323,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, | |||
323 | 323 | ||
324 | if (S_ISLNK(inode->i_mode)) | 324 | if (S_ISLNK(inode->i_mode)) |
325 | return -EOPNOTSUPP; | 325 | return -EOPNOTSUPP; |
326 | if (!is_owner_or_cap(inode)) | 326 | if (!inode_owner_or_capable(inode)) |
327 | return -EPERM; | 327 | return -EPERM; |
328 | if (value) { | 328 | if (value) { |
329 | /* update the cached acl value */ | 329 | /* update the cached acl value */ |
@@ -59,7 +59,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr) | |||
59 | 59 | ||
60 | /* Make sure a caller can chmod. */ | 60 | /* Make sure a caller can chmod. */ |
61 | if (ia_valid & ATTR_MODE) { | 61 | if (ia_valid & ATTR_MODE) { |
62 | if (!is_owner_or_cap(inode)) | 62 | if (!inode_owner_or_capable(inode)) |
63 | return -EPERM; | 63 | return -EPERM; |
64 | /* Also check the setgid bit! */ | 64 | /* Also check the setgid bit! */ |
65 | if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid : | 65 | if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid : |
@@ -69,7 +69,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr) | |||
69 | 69 | ||
70 | /* Check for setting the inode time. */ | 70 | /* Check for setting the inode time. */ |
71 | if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)) { | 71 | if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)) { |
72 | if (!is_owner_or_cap(inode)) | 72 | if (!inode_owner_or_capable(inode)) |
73 | return -EPERM; | 73 | return -EPERM; |
74 | } | 74 | } |
75 | 75 | ||
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 9c949348510b..de34bfad9ec3 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -170,7 +170,7 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
170 | int ret; | 170 | int ret; |
171 | struct posix_acl *acl = NULL; | 171 | struct posix_acl *acl = NULL; |
172 | 172 | ||
173 | if (!is_owner_or_cap(dentry->d_inode)) | 173 | if (!inode_owner_or_capable(dentry->d_inode)) |
174 | return -EPERM; | 174 | return -EPERM; |
175 | 175 | ||
176 | if (!IS_POSIXACL(dentry->d_inode)) | 176 | if (!IS_POSIXACL(dentry->d_inode)) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 5fdb2abc4fa7..d1bace3df9b6 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -158,7 +158,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
158 | FS_SYNC_FL | FS_DIRSYNC_FL)) | 158 | FS_SYNC_FL | FS_DIRSYNC_FL)) |
159 | return -EOPNOTSUPP; | 159 | return -EOPNOTSUPP; |
160 | 160 | ||
161 | if (!is_owner_or_cap(inode)) | 161 | if (!inode_owner_or_capable(inode)) |
162 | return -EACCES; | 162 | return -EACCES; |
163 | 163 | ||
164 | mutex_lock(&inode->i_mutex); | 164 | mutex_lock(&inode->i_mutex); |
@@ -1077,7 +1077,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) | 1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) |
1078 | return -EOPNOTSUPP; | 1078 | return -EOPNOTSUPP; |
1079 | 1079 | ||
1080 | if (!is_owner_or_cap(inode)) | 1080 | if (!inode_owner_or_capable(inode)) |
1081 | return -EACCES; | 1081 | return -EACCES; |
1082 | 1082 | ||
1083 | down_write(&root->fs_info->subvol_sem); | 1083 | down_write(&root->fs_info->subvol_sem); |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index 7b4180554a62..abea5a17c764 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
@@ -406,7 +406,7 @@ ext2_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, | |||
406 | return -EINVAL; | 406 | return -EINVAL; |
407 | if (!test_opt(dentry->d_sb, POSIX_ACL)) | 407 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
408 | return -EOPNOTSUPP; | 408 | return -EOPNOTSUPP; |
409 | if (!is_owner_or_cap(dentry->d_inode)) | 409 | if (!inode_owner_or_capable(dentry->d_inode)) |
410 | return -EPERM; | 410 | return -EPERM; |
411 | 411 | ||
412 | if (value) { | 412 | if (value) { |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index e7431309bdca..f81e250ac5c4 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -39,7 +39,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
39 | if (ret) | 39 | if (ret) |
40 | return ret; | 40 | return ret; |
41 | 41 | ||
42 | if (!is_owner_or_cap(inode)) { | 42 | if (!inode_owner_or_capable(inode)) { |
43 | ret = -EACCES; | 43 | ret = -EACCES; |
44 | goto setflags_out; | 44 | goto setflags_out; |
45 | } | 45 | } |
@@ -89,7 +89,7 @@ setflags_out: | |||
89 | case EXT2_IOC_GETVERSION: | 89 | case EXT2_IOC_GETVERSION: |
90 | return put_user(inode->i_generation, (int __user *) arg); | 90 | return put_user(inode->i_generation, (int __user *) arg); |
91 | case EXT2_IOC_SETVERSION: | 91 | case EXT2_IOC_SETVERSION: |
92 | if (!is_owner_or_cap(inode)) | 92 | if (!inode_owner_or_capable(inode)) |
93 | return -EPERM; | 93 | return -EPERM; |
94 | ret = mnt_want_write(filp->f_path.mnt); | 94 | ret = mnt_want_write(filp->f_path.mnt); |
95 | if (ret) | 95 | if (ret) |
@@ -115,7 +115,7 @@ setflags_out: | |||
115 | if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode)) | 115 | if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode)) |
116 | return -ENOTTY; | 116 | return -ENOTTY; |
117 | 117 | ||
118 | if (!is_owner_or_cap(inode)) | 118 | if (!inode_owner_or_capable(inode)) |
119 | return -EACCES; | 119 | return -EACCES; |
120 | 120 | ||
121 | if (get_user(rsv_window_size, (int __user *)arg)) | 121 | if (get_user(rsv_window_size, (int __user *)arg)) |
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index e4fa49e6c539..9d021c0d472a 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -435,7 +435,7 @@ ext3_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, | |||
435 | return -EINVAL; | 435 | return -EINVAL; |
436 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 436 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
437 | return -EOPNOTSUPP; | 437 | return -EOPNOTSUPP; |
438 | if (!is_owner_or_cap(inode)) | 438 | if (!inode_owner_or_capable(inode)) |
439 | return -EPERM; | 439 | return -EPERM; |
440 | 440 | ||
441 | if (value) { | 441 | if (value) { |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index fc080dd561f7..f4090bd2f345 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -38,7 +38,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
38 | unsigned int oldflags; | 38 | unsigned int oldflags; |
39 | unsigned int jflag; | 39 | unsigned int jflag; |
40 | 40 | ||
41 | if (!is_owner_or_cap(inode)) | 41 | if (!inode_owner_or_capable(inode)) |
42 | return -EACCES; | 42 | return -EACCES; |
43 | 43 | ||
44 | if (get_user(flags, (int __user *) arg)) | 44 | if (get_user(flags, (int __user *) arg)) |
@@ -123,7 +123,7 @@ flags_out: | |||
123 | __u32 generation; | 123 | __u32 generation; |
124 | int err; | 124 | int err; |
125 | 125 | ||
126 | if (!is_owner_or_cap(inode)) | 126 | if (!inode_owner_or_capable(inode)) |
127 | return -EPERM; | 127 | return -EPERM; |
128 | 128 | ||
129 | err = mnt_want_write(filp->f_path.mnt); | 129 | err = mnt_want_write(filp->f_path.mnt); |
@@ -192,7 +192,7 @@ setversion_out: | |||
192 | if (err) | 192 | if (err) |
193 | return err; | 193 | return err; |
194 | 194 | ||
195 | if (!is_owner_or_cap(inode)) { | 195 | if (!inode_owner_or_capable(inode)) { |
196 | err = -EACCES; | 196 | err = -EACCES; |
197 | goto setrsvsz_out; | 197 | goto setrsvsz_out; |
198 | } | 198 | } |
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c index e0270d1f8d82..21eacd7b7d79 100644 --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c | |||
@@ -433,7 +433,7 @@ ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, | |||
433 | return -EINVAL; | 433 | return -EINVAL; |
434 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 434 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
435 | return -EOPNOTSUPP; | 435 | return -EOPNOTSUPP; |
436 | if (!is_owner_or_cap(inode)) | 436 | if (!inode_owner_or_capable(inode)) |
437 | return -EPERM; | 437 | return -EPERM; |
438 | 438 | ||
439 | if (value) { | 439 | if (value) { |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index eb3bc2fe647e..a84faa110bcd 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -38,7 +38,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
38 | unsigned int oldflags; | 38 | unsigned int oldflags; |
39 | unsigned int jflag; | 39 | unsigned int jflag; |
40 | 40 | ||
41 | if (!is_owner_or_cap(inode)) | 41 | if (!inode_owner_or_capable(inode)) |
42 | return -EACCES; | 42 | return -EACCES; |
43 | 43 | ||
44 | if (get_user(flags, (int __user *) arg)) | 44 | if (get_user(flags, (int __user *) arg)) |
@@ -146,7 +146,7 @@ flags_out: | |||
146 | __u32 generation; | 146 | __u32 generation; |
147 | int err; | 147 | int err; |
148 | 148 | ||
149 | if (!is_owner_or_cap(inode)) | 149 | if (!inode_owner_or_capable(inode)) |
150 | return -EPERM; | 150 | return -EPERM; |
151 | 151 | ||
152 | err = mnt_want_write(filp->f_path.mnt); | 152 | err = mnt_want_write(filp->f_path.mnt); |
@@ -298,7 +298,7 @@ mext_out: | |||
298 | case EXT4_IOC_MIGRATE: | 298 | case EXT4_IOC_MIGRATE: |
299 | { | 299 | { |
300 | int err; | 300 | int err; |
301 | if (!is_owner_or_cap(inode)) | 301 | if (!inode_owner_or_capable(inode)) |
302 | return -EACCES; | 302 | return -EACCES; |
303 | 303 | ||
304 | err = mnt_want_write(filp->f_path.mnt); | 304 | err = mnt_want_write(filp->f_path.mnt); |
@@ -320,7 +320,7 @@ mext_out: | |||
320 | case EXT4_IOC_ALLOC_DA_BLKS: | 320 | case EXT4_IOC_ALLOC_DA_BLKS: |
321 | { | 321 | { |
322 | int err; | 322 | int err; |
323 | if (!is_owner_or_cap(inode)) | 323 | if (!inode_owner_or_capable(inode)) |
324 | return -EACCES; | 324 | return -EACCES; |
325 | 325 | ||
326 | err = mnt_want_write(filp->f_path.mnt); | 326 | err = mnt_want_write(filp->f_path.mnt); |
diff --git a/fs/fcntl.c b/fs/fcntl.c index 6c82e5bac039..22764c7c8382 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -159,7 +159,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
159 | 159 | ||
160 | /* O_NOATIME can only be set by the owner or superuser */ | 160 | /* O_NOATIME can only be set by the owner or superuser */ |
161 | if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) | 161 | if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
162 | if (!is_owner_or_cap(inode)) | 162 | if (!inode_owner_or_capable(inode)) |
163 | return -EPERM; | 163 | return -EPERM; |
164 | 164 | ||
165 | /* required for strict SunOS emulation */ | 165 | /* required for strict SunOS emulation */ |
diff --git a/fs/generic_acl.c b/fs/generic_acl.c index 06c48a891832..8f26d1a58912 100644 --- a/fs/generic_acl.c +++ b/fs/generic_acl.c | |||
@@ -74,7 +74,7 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value, | |||
74 | return -EINVAL; | 74 | return -EINVAL; |
75 | if (S_ISLNK(inode->i_mode)) | 75 | if (S_ISLNK(inode->i_mode)) |
76 | return -EOPNOTSUPP; | 76 | return -EOPNOTSUPP; |
77 | if (!is_owner_or_cap(inode)) | 77 | if (!inode_owner_or_capable(inode)) |
78 | return -EPERM; | 78 | return -EPERM; |
79 | if (value) { | 79 | if (value) { |
80 | acl = posix_acl_from_xattr(value, size); | 80 | acl = posix_acl_from_xattr(value, size); |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 4074b952b059..b2682e073eee 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -221,7 +221,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | |||
221 | goto out_drop_write; | 221 | goto out_drop_write; |
222 | 222 | ||
223 | error = -EACCES; | 223 | error = -EACCES; |
224 | if (!is_owner_or_cap(inode)) | 224 | if (!inode_owner_or_capable(inode)) |
225 | goto out; | 225 | goto out; |
226 | 226 | ||
227 | error = 0; | 227 | error = 0; |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index 508ce662ce12..fbaa6690c8e0 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
@@ -47,7 +47,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
47 | if (err) | 47 | if (err) |
48 | goto out; | 48 | goto out; |
49 | 49 | ||
50 | if (!is_owner_or_cap(inode)) { | 50 | if (!inode_owner_or_capable(inode)) { |
51 | err = -EACCES; | 51 | err = -EACCES; |
52 | goto out_drop_write; | 52 | goto out_drop_write; |
53 | } | 53 | } |
diff --git a/fs/inode.c b/fs/inode.c index a21d5a938a17..0b3da4a77704 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1735,11 +1735,14 @@ void inode_init_owner(struct inode *inode, const struct inode *dir, | |||
1735 | } | 1735 | } |
1736 | EXPORT_SYMBOL(inode_init_owner); | 1736 | EXPORT_SYMBOL(inode_init_owner); |
1737 | 1737 | ||
1738 | /* | 1738 | /** |
1739 | * return true if current either has CAP_FOWNER to the | 1739 | * inode_owner_or_capable - check current task permissions to inode |
1740 | * file, or owns the file. | 1740 | * @inode: inode being checked |
1741 | * | ||
1742 | * Return true if current either has CAP_FOWNER to the inode, or | ||
1743 | * owns the file. | ||
1741 | */ | 1744 | */ |
1742 | bool is_owner_or_cap(const struct inode *inode) | 1745 | bool inode_owner_or_capable(const struct inode *inode) |
1743 | { | 1746 | { |
1744 | struct user_namespace *ns = inode_userns(inode); | 1747 | struct user_namespace *ns = inode_userns(inode); |
1745 | 1748 | ||
@@ -1749,4 +1752,4 @@ bool is_owner_or_cap(const struct inode *inode) | |||
1749 | return true; | 1752 | return true; |
1750 | return false; | 1753 | return false; |
1751 | } | 1754 | } |
1752 | EXPORT_SYMBOL(is_owner_or_cap); | 1755 | EXPORT_SYMBOL(inode_owner_or_capable); |
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 95b79672150a..828a0e1ea438 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -402,7 +402,7 @@ static int jffs2_acl_setxattr(struct dentry *dentry, const char *name, | |||
402 | 402 | ||
403 | if (name[0] != '\0') | 403 | if (name[0] != '\0') |
404 | return -EINVAL; | 404 | return -EINVAL; |
405 | if (!is_owner_or_cap(dentry->d_inode)) | 405 | if (!inode_owner_or_capable(dentry->d_inode)) |
406 | return -EPERM; | 406 | return -EPERM; |
407 | 407 | ||
408 | if (value) { | 408 | if (value) { |
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index afe222bf300f..6f98a1866776 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -72,7 +72,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
72 | if (err) | 72 | if (err) |
73 | return err; | 73 | return err; |
74 | 74 | ||
75 | if (!is_owner_or_cap(inode)) { | 75 | if (!inode_owner_or_capable(inode)) { |
76 | err = -EACCES; | 76 | err = -EACCES; |
77 | goto setflags_out; | 77 | goto setflags_out; |
78 | } | 78 | } |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 3fa4c32272df..24838f1eeee5 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -678,7 +678,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | |||
678 | struct posix_acl *acl; | 678 | struct posix_acl *acl; |
679 | int rc; | 679 | int rc; |
680 | 680 | ||
681 | if (!is_owner_or_cap(inode)) | 681 | if (!inode_owner_or_capable(inode)) |
682 | return -EPERM; | 682 | return -EPERM; |
683 | 683 | ||
684 | /* | 684 | /* |
diff --git a/fs/logfs/file.c b/fs/logfs/file.c index e86376b87af1..c2ad7028def4 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c | |||
@@ -196,7 +196,7 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
196 | if (IS_RDONLY(inode)) | 196 | if (IS_RDONLY(inode)) |
197 | return -EROFS; | 197 | return -EROFS; |
198 | 198 | ||
199 | if (!is_owner_or_cap(inode)) | 199 | if (!inode_owner_or_capable(inode)) |
200 | return -EACCES; | 200 | return -EACCES; |
201 | 201 | ||
202 | err = get_user(flags, (int __user *)arg); | 202 | err = get_user(flags, (int __user *)arg); |
diff --git a/fs/namei.c b/fs/namei.c index dbb45a652ae3..fc858b1124c2 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2036,7 +2036,7 @@ static int may_open(struct path *path, int acc_mode, int flag) | |||
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | /* O_NOATIME can only be set by the owner or superuser */ | 2038 | /* O_NOATIME can only be set by the owner or superuser */ |
2039 | if (flag & O_NOATIME && !is_owner_or_cap(inode)) | 2039 | if (flag & O_NOATIME && !inode_owner_or_capable(inode)) |
2040 | return -EPERM; | 2040 | return -EPERM; |
2041 | 2041 | ||
2042 | /* | 2042 | /* |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 95c04c2f2b3e..f2469ba6246b 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -113,7 +113,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp, | |||
113 | unsigned int flags, oldflags; | 113 | unsigned int flags, oldflags; |
114 | int ret; | 114 | int ret; |
115 | 115 | ||
116 | if (!is_owner_or_cap(inode)) | 116 | if (!inode_owner_or_capable(inode)) |
117 | return -EACCES; | 117 | return -EACCES; |
118 | 118 | ||
119 | if (get_user(flags, (int __user *)argp)) | 119 | if (get_user(flags, (int __user *)argp)) |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index 704f6b1742f3..90f2729b7a5b 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -497,7 +497,7 @@ static int ocfs2_xattr_set_acl(struct dentry *dentry, const char *name, | |||
497 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 497 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
498 | return -EOPNOTSUPP; | 498 | return -EOPNOTSUPP; |
499 | 499 | ||
500 | if (!is_owner_or_cap(inode)) | 500 | if (!inode_owner_or_capable(inode)) |
501 | return -EPERM; | 501 | return -EPERM; |
502 | 502 | ||
503 | if (value) { | 503 | if (value) { |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 7a4868196152..09de77ce002a 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -82,7 +82,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | status = -EACCES; | 84 | status = -EACCES; |
85 | if (!is_owner_or_cap(inode)) | 85 | if (!inode_owner_or_capable(inode)) |
86 | goto bail_unlock; | 86 | goto bail_unlock; |
87 | 87 | ||
88 | if (!S_ISDIR(inode->i_mode)) | 88 | if (!S_ISDIR(inode->i_mode)) |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 79265fdc317a..4e153051bc75 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -59,7 +59,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
59 | if (err) | 59 | if (err) |
60 | break; | 60 | break; |
61 | 61 | ||
62 | if (!is_owner_or_cap(inode)) { | 62 | if (!inode_owner_or_capable(inode)) { |
63 | err = -EPERM; | 63 | err = -EPERM; |
64 | goto setflags_out; | 64 | goto setflags_out; |
65 | } | 65 | } |
@@ -103,7 +103,7 @@ setflags_out: | |||
103 | err = put_user(inode->i_generation, (int __user *)arg); | 103 | err = put_user(inode->i_generation, (int __user *)arg); |
104 | break; | 104 | break; |
105 | case REISERFS_IOC_SETVERSION: | 105 | case REISERFS_IOC_SETVERSION: |
106 | if (!is_owner_or_cap(inode)) { | 106 | if (!inode_owner_or_capable(inode)) { |
107 | err = -EPERM; | 107 | err = -EPERM; |
108 | break; | 108 | break; |
109 | } | 109 | } |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 90d2fcb67a31..3dc38f1206fc 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -26,7 +26,7 @@ posix_acl_set(struct dentry *dentry, const char *name, const void *value, | |||
26 | size_t jcreate_blocks; | 26 | size_t jcreate_blocks; |
27 | if (!reiserfs_posixacl(inode->i_sb)) | 27 | if (!reiserfs_posixacl(inode->i_sb)) |
28 | return -EOPNOTSUPP; | 28 | return -EOPNOTSUPP; |
29 | if (!is_owner_or_cap(inode)) | 29 | if (!inode_owner_or_capable(inode)) |
30 | return -EPERM; | 30 | return -EPERM; |
31 | 31 | ||
32 | if (value) { | 32 | if (value) { |
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 8aacd64957a2..548acf494afd 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c | |||
@@ -160,7 +160,7 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
160 | if (IS_RDONLY(inode)) | 160 | if (IS_RDONLY(inode)) |
161 | return -EROFS; | 161 | return -EROFS; |
162 | 162 | ||
163 | if (!is_owner_or_cap(inode)) | 163 | if (!inode_owner_or_capable(inode)) |
164 | return -EACCES; | 164 | return -EACCES; |
165 | 165 | ||
166 | if (get_user(flags, (int __user *) arg)) | 166 | if (get_user(flags, (int __user *) arg)) |
diff --git a/fs/utimes.c b/fs/utimes.c index 179b58690657..ba653f3dc1bc 100644 --- a/fs/utimes.c +++ b/fs/utimes.c | |||
@@ -95,7 +95,7 @@ static int utimes_common(struct path *path, struct timespec *times) | |||
95 | if (IS_IMMUTABLE(inode)) | 95 | if (IS_IMMUTABLE(inode)) |
96 | goto mnt_drop_write_and_out; | 96 | goto mnt_drop_write_and_out; |
97 | 97 | ||
98 | if (!is_owner_or_cap(inode)) { | 98 | if (!inode_owner_or_capable(inode)) { |
99 | error = inode_permission(inode, MAY_WRITE); | 99 | error = inode_permission(inode, MAY_WRITE); |
100 | if (error) | 100 | if (error) |
101 | goto mnt_drop_write_and_out; | 101 | goto mnt_drop_write_and_out; |
diff --git a/fs/xattr.c b/fs/xattr.c index 01bb8135e14a..a19acdb81cd1 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -59,7 +59,7 @@ xattr_permission(struct inode *inode, const char *name, int mask) | |||
59 | if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) | 59 | if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) |
60 | return -EPERM; | 60 | return -EPERM; |
61 | if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) && | 61 | if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) && |
62 | (mask & MAY_WRITE) && !is_owner_or_cap(inode)) | 62 | (mask & MAY_WRITE) && !inode_owner_or_capable(inode)) |
63 | return -EPERM; | 63 | return -EPERM; |
64 | } | 64 | } |
65 | 65 | ||