VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Linus Torvalds <torvalds@linux-foundation.org> 2017-05-12 11:39:59 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2017-05-12 11:39:59 -0700 commit: 050453295f808dd683b9a88f58a1b29540097394 parent: e0c4a5fc750e22c6f8d5c1ab7cc18592b88852ab
Commit Summary:
Merge branch 'work.sane_pwd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Diffstat:
1 file changed, 3 insertions, 6 deletions
diff --git a/fs/open.c b/fs/open.c
index 6d2d2b33ac54..cd0c5be8d012 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -460,20 +460,17 @@ out:
 SYSCALL_DEFINE1(fchdir, unsigned int, fd)
 {
 	struct fd f = fdget_raw(fd);
-	struct inode *inode;
-	int error = -EBADF;
+	int error;
 
 	error = -EBADF;
 	if (!f.file)
 		goto out;
 
-	inode = file_inode(f.file);
-
 	error = -ENOTDIR;
-	if (!S_ISDIR(inode->i_mode))
+	if (!d_can_lookup(f.file->f_path.dentry))
 		goto out_putf;
 
-	error = inode_permission(inode, MAY_EXEC | MAY_CHDIR);
+	error = inode_permission(file_inode(f.file), MAY_EXEC | MAY_CHDIR);
 	if (!error)
 		set_fs_pwd(current->fs, &f.file->f_path);
 out_putf: