aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/open.c b/fs/open.c
index ca8ac4bbd3bd..54198538b67e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -490,7 +490,7 @@ asmlinkage long sys_chdir(const char __user * filename)
490 if (error) 490 if (error)
491 goto dput_and_out; 491 goto dput_and_out;
492 492
493 set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry); 493 set_fs_pwd(current->fs, &nd.path);
494 494
495dput_and_out: 495dput_and_out:
496 path_put(&nd.path); 496 path_put(&nd.path);
@@ -501,9 +501,7 @@ out:
501asmlinkage long sys_fchdir(unsigned int fd) 501asmlinkage long sys_fchdir(unsigned int fd)
502{ 502{
503 struct file *file; 503 struct file *file;
504 struct dentry *dentry;
505 struct inode *inode; 504 struct inode *inode;
506 struct vfsmount *mnt;
507 int error; 505 int error;
508 506
509 error = -EBADF; 507 error = -EBADF;
@@ -511,9 +509,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
511 if (!file) 509 if (!file)
512 goto out; 510 goto out;
513 511
514 dentry = file->f_path.dentry; 512 inode = file->f_path.dentry->d_inode;
515 mnt = file->f_path.mnt;
516 inode = dentry->d_inode;
517 513
518 error = -ENOTDIR; 514 error = -ENOTDIR;
519 if (!S_ISDIR(inode->i_mode)) 515 if (!S_ISDIR(inode->i_mode))
@@ -521,7 +517,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
521 517
522 error = file_permission(file, MAY_EXEC); 518 error = file_permission(file, MAY_EXEC);
523 if (!error) 519 if (!error)
524 set_fs_pwd(current->fs, mnt, dentry); 520 set_fs_pwd(current->fs, &file->f_path);
525out_putf: 521out_putf:
526 fput(file); 522 fput(file);
527out: 523out:
@@ -545,7 +541,7 @@ asmlinkage long sys_chroot(const char __user * filename)
545 if (!capable(CAP_SYS_CHROOT)) 541 if (!capable(CAP_SYS_CHROOT))
546 goto dput_and_out; 542 goto dput_and_out;
547 543
548 set_fs_root(current->fs, nd.path.mnt, nd.path.dentry); 544 set_fs_root(current->fs, &nd.path);
549 set_fs_altroot(); 545 set_fs_altroot();
550 error = 0; 546 error = 0;
551dput_and_out: 547dput_and_out: