diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/inode.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 2 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 4 | ||||
-rw-r--r-- | fs/utimes.c | 2 | ||||
-rw-r--r-- | fs/xattr.c | 2 |
6 files changed, 15 insertions, 19 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index f25caf2b0887..89209f00f9c7 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -830,7 +830,7 @@ out: | |||
830 | static int | 830 | static int |
831 | ecryptfs_permission(struct inode *inode, int mask) | 831 | ecryptfs_permission(struct inode *inode, int mask) |
832 | { | 832 | { |
833 | return permission(ecryptfs_inode_to_lower(inode), mask, NULL); | 833 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); |
834 | } | 834 | } |
835 | 835 | ||
836 | /** | 836 | /** |
diff --git a/fs/namei.c b/fs/namei.c index 396cb3e5c364..5029b93ebbd5 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -227,13 +227,9 @@ int generic_permission(struct inode *inode, int mask, | |||
227 | return -EACCES; | 227 | return -EACCES; |
228 | } | 228 | } |
229 | 229 | ||
230 | int permission(struct inode *inode, int mask, struct nameidata *nd) | 230 | int inode_permission(struct inode *inode, int mask) |
231 | { | 231 | { |
232 | int retval; | 232 | int retval; |
233 | struct vfsmount *mnt = NULL; | ||
234 | |||
235 | if (nd) | ||
236 | mnt = nd->path.mnt; | ||
237 | 233 | ||
238 | if (mask & MAY_WRITE) { | 234 | if (mask & MAY_WRITE) { |
239 | umode_t mode = inode->i_mode; | 235 | umode_t mode = inode->i_mode; |
@@ -293,7 +289,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd) | |||
293 | */ | 289 | */ |
294 | int vfs_permission(struct nameidata *nd, int mask) | 290 | int vfs_permission(struct nameidata *nd, int mask) |
295 | { | 291 | { |
296 | return permission(nd->path.dentry->d_inode, mask, nd); | 292 | return inode_permission(nd->path.dentry->d_inode, mask); |
297 | } | 293 | } |
298 | 294 | ||
299 | /** | 295 | /** |
@@ -310,7 +306,7 @@ int vfs_permission(struct nameidata *nd, int mask) | |||
310 | */ | 306 | */ |
311 | int file_permission(struct file *file, int mask) | 307 | int file_permission(struct file *file, int mask) |
312 | { | 308 | { |
313 | return permission(file->f_path.dentry->d_inode, mask, NULL); | 309 | return inode_permission(file->f_path.dentry->d_inode, mask); |
314 | } | 310 | } |
315 | 311 | ||
316 | /* | 312 | /* |
@@ -1262,7 +1258,7 @@ static struct dentry *lookup_hash(struct nameidata *nd) | |||
1262 | { | 1258 | { |
1263 | int err; | 1259 | int err; |
1264 | 1260 | ||
1265 | err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd); | 1261 | err = inode_permission(nd->path.dentry->d_inode, MAY_EXEC); |
1266 | if (err) | 1262 | if (err) |
1267 | return ERR_PTR(err); | 1263 | return ERR_PTR(err); |
1268 | return __lookup_hash(&nd->last, nd->path.dentry, nd); | 1264 | return __lookup_hash(&nd->last, nd->path.dentry, nd); |
@@ -1310,7 +1306,7 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
1310 | if (err) | 1306 | if (err) |
1311 | return ERR_PTR(err); | 1307 | return ERR_PTR(err); |
1312 | 1308 | ||
1313 | err = permission(base->d_inode, MAY_EXEC, NULL); | 1309 | err = inode_permission(base->d_inode, MAY_EXEC); |
1314 | if (err) | 1310 | if (err) |
1315 | return ERR_PTR(err); | 1311 | return ERR_PTR(err); |
1316 | return __lookup_hash(&this, base, NULL); | 1312 | return __lookup_hash(&this, base, NULL); |
@@ -1400,7 +1396,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) | |||
1400 | BUG_ON(victim->d_parent->d_inode != dir); | 1396 | BUG_ON(victim->d_parent->d_inode != dir); |
1401 | audit_inode_child(victim->d_name.name, victim, dir); | 1397 | audit_inode_child(victim->d_name.name, victim, dir); |
1402 | 1398 | ||
1403 | error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); | 1399 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); |
1404 | if (error) | 1400 | if (error) |
1405 | return error; | 1401 | return error; |
1406 | if (IS_APPEND(dir)) | 1402 | if (IS_APPEND(dir)) |
@@ -1437,7 +1433,7 @@ static inline int may_create(struct inode *dir, struct dentry *child, | |||
1437 | return -EEXIST; | 1433 | return -EEXIST; |
1438 | if (IS_DEADDIR(dir)) | 1434 | if (IS_DEADDIR(dir)) |
1439 | return -ENOENT; | 1435 | return -ENOENT; |
1440 | return permission(dir,MAY_WRITE | MAY_EXEC, nd); | 1436 | return inode_permission(dir, MAY_WRITE | MAY_EXEC); |
1441 | } | 1437 | } |
1442 | 1438 | ||
1443 | /* | 1439 | /* |
@@ -2543,7 +2539,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, | |||
2543 | * we'll need to flip '..'. | 2539 | * we'll need to flip '..'. |
2544 | */ | 2540 | */ |
2545 | if (new_dir != old_dir) { | 2541 | if (new_dir != old_dir) { |
2546 | error = permission(old_dentry->d_inode, MAY_WRITE, NULL); | 2542 | error = inode_permission(old_dentry->d_inode, MAY_WRITE); |
2547 | if (error) | 2543 | if (error) |
2548 | return error; | 2544 | return error; |
2549 | } | 2545 | } |
@@ -2897,7 +2893,7 @@ EXPORT_SYMBOL(page_symlink); | |||
2897 | EXPORT_SYMBOL(page_symlink_inode_operations); | 2893 | EXPORT_SYMBOL(page_symlink_inode_operations); |
2898 | EXPORT_SYMBOL(path_lookup); | 2894 | EXPORT_SYMBOL(path_lookup); |
2899 | EXPORT_SYMBOL(vfs_path_lookup); | 2895 | EXPORT_SYMBOL(vfs_path_lookup); |
2900 | EXPORT_SYMBOL(permission); | 2896 | EXPORT_SYMBOL(inode_permission); |
2901 | EXPORT_SYMBOL(vfs_permission); | 2897 | EXPORT_SYMBOL(vfs_permission); |
2902 | EXPORT_SYMBOL(file_permission); | 2898 | EXPORT_SYMBOL(file_permission); |
2903 | EXPORT_SYMBOL(unlock_rename); | 2899 | EXPORT_SYMBOL(unlock_rename); |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index f45451eb1e38..ea37c96f0445 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -51,7 +51,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry) | |||
51 | /* make sure parents give x permission to user */ | 51 | /* make sure parents give x permission to user */ |
52 | int err; | 52 | int err; |
53 | parent = dget_parent(tdentry); | 53 | parent = dget_parent(tdentry); |
54 | err = permission(parent->d_inode, MAY_EXEC, NULL); | 54 | err = inode_permission(parent->d_inode, MAY_EXEC); |
55 | if (err < 0) { | 55 | if (err < 0) { |
56 | dput(parent); | 56 | dput(parent); |
57 | break; | 57 | break; |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index ad1ad59e3742..18060bed5267 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1953,12 +1953,12 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
1953 | return 0; | 1953 | return 0; |
1954 | 1954 | ||
1955 | /* This assumes NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */ | 1955 | /* This assumes NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */ |
1956 | err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), NULL); | 1956 | err = inode_permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC)); |
1957 | 1957 | ||
1958 | /* Allow read access to binaries even when mode 111 */ | 1958 | /* Allow read access to binaries even when mode 111 */ |
1959 | if (err == -EACCES && S_ISREG(inode->i_mode) && | 1959 | if (err == -EACCES && S_ISREG(inode->i_mode) && |
1960 | acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE)) | 1960 | acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE)) |
1961 | err = permission(inode, MAY_EXEC, NULL); | 1961 | err = inode_permission(inode, MAY_EXEC); |
1962 | 1962 | ||
1963 | return err? nfserrno(err) : 0; | 1963 | return err? nfserrno(err) : 0; |
1964 | } | 1964 | } |
diff --git a/fs/utimes.c b/fs/utimes.c index dad679d3a158..dc28b7826259 100644 --- a/fs/utimes.c +++ b/fs/utimes.c | |||
@@ -96,7 +96,7 @@ static int utimes_common(struct path *path, struct timespec *times) | |||
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 (!is_owner_or_cap(inode)) { |
99 | error = permission(inode, MAY_WRITE, NULL); | 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; |
102 | } | 102 | } |
diff --git a/fs/xattr.c b/fs/xattr.c index 4706a8b1f495..b96222e05ba0 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -63,7 +63,7 @@ xattr_permission(struct inode *inode, const char *name, int mask) | |||
63 | return -EPERM; | 63 | return -EPERM; |
64 | } | 64 | } |
65 | 65 | ||
66 | return permission(inode, mask, NULL); | 66 | return inode_permission(inode, mask); |
67 | } | 67 | } |
68 | 68 | ||
69 | int | 69 | int |