aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 868d0cb9d473..17ea76bf2fbe 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -282,8 +282,7 @@ int inode_permission(struct inode *inode, int mask)
282 if (retval) 282 if (retval)
283 return retval; 283 return retval;
284 284
285 return security_inode_permission(inode, 285 return security_inode_permission(inode, mask);
286 mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND));
287} 286}
288 287
289/** 288/**
@@ -484,13 +483,8 @@ ok:
484 483
485static __always_inline void set_root(struct nameidata *nd) 484static __always_inline void set_root(struct nameidata *nd)
486{ 485{
487 if (!nd->root.mnt) { 486 if (!nd->root.mnt)
488 struct fs_struct *fs = current->fs; 487 get_fs_root(current->fs, &nd->root);
489 read_lock(&fs->lock);
490 nd->root = fs->root;
491 path_get(&nd->root);
492 read_unlock(&fs->lock);
493 }
494} 488}
495 489
496static int link_path_walk(const char *, struct nameidata *); 490static int link_path_walk(const char *, struct nameidata *);
@@ -1016,11 +1010,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
1016 nd->path = nd->root; 1010 nd->path = nd->root;
1017 path_get(&nd->root); 1011 path_get(&nd->root);
1018 } else if (dfd == AT_FDCWD) { 1012 } else if (dfd == AT_FDCWD) {
1019 struct fs_struct *fs = current->fs; 1013 get_fs_pwd(current->fs, &nd->path);
1020 read_lock(&fs->lock);
1021 nd->path = fs->pwd;
1022 path_get(&fs->pwd);
1023 read_unlock(&fs->lock);
1024 } else { 1014 } else {
1025 struct dentry *dentry; 1015 struct dentry *dentry;
1026 1016
@@ -1484,8 +1474,7 @@ static int handle_truncate(struct path *path)
1484 */ 1474 */
1485 error = locks_verify_locked(inode); 1475 error = locks_verify_locked(inode);
1486 if (!error) 1476 if (!error)
1487 error = security_path_truncate(path, 0, 1477 error = security_path_truncate(path);
1488 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN);
1489 if (!error) { 1478 if (!error) {
1490 error = do_truncate(path->dentry, 0, 1479 error = do_truncate(path->dentry, 0,
1491 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, 1480 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
@@ -2635,7 +2624,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2635{ 2624{
2636 int error; 2625 int error;
2637 int is_dir = S_ISDIR(old_dentry->d_inode->i_mode); 2626 int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
2638 const char *old_name; 2627 const unsigned char *old_name;
2639 2628
2640 if (old_dentry->d_inode == new_dentry->d_inode) 2629 if (old_dentry->d_inode == new_dentry->d_inode)
2641 return 0; 2630 return 0;