aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-07 13:17:00 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-07-23 05:50:25 -0400
commit2992f3335a1015b83f4167a6490745bf3d45d447 (patch)
tree4999511040893dd1ee754aeed993527cd940417a /fs
parentc49547993cdd394a31a28310f090b3f8ac1f4550 (diff)
vfs: make O_PATH file descriptors usable for 'fchdir()'
BugLink: http://bugs.launchpad.net/bugs/1025406 commit 332a2e1244bd08b9e3ecd378028513396a004a24 upstream. We already use them for openat() and friends, but fchdir() also wants to be able to use O_PATH file descriptors. This should make it comparable to the O_SEARCH of Solaris. In particular, O_PATH allows you to access (not-quite-open) a directory you don't have read persmission to, only execute permission. Noticed during development of multithread support for ksh93. Reported-by: ольга крыжановская <olga.kryzhanovska@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index a540e7bb3a3..e3638449b86 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -400,10 +400,10 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
400{ 400{
401 struct file *file; 401 struct file *file;
402 struct inode *inode; 402 struct inode *inode;
403 int error; 403 int error, fput_needed;
404 404
405 error = -EBADF; 405 error = -EBADF;
406 file = fget(fd); 406 file = fget_raw_light(fd, &fput_needed);
407 if (!file) 407 if (!file)
408 goto out; 408 goto out;
409 409
@@ -417,7 +417,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
417 if (!error) 417 if (!error)
418 set_fs_pwd(current->fs, &file->f_path); 418 set_fs_pwd(current->fs, &file->f_path);
419out_putf: 419out_putf:
420 fput(file); 420 fput_light(file, fput_needed);
421out: 421out:
422 return error; 422 return error;
423} 423}