diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 22 |
1 files changed, 9 insertions, 13 deletions
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); |