Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfs: make O_PATH file descriptors usable for 'fchdir()'

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>
Cc: stable@kernel.org # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+3 -3
+3 -3
fs/open.c
··· 397 397 { 398 398 struct file *file; 399 399 struct inode *inode; 400 - int error; 400 + int error, fput_needed; 401 401 402 402 error = -EBADF; 403 - file = fget(fd); 403 + file = fget_raw_light(fd, &fput_needed); 404 404 if (!file) 405 405 goto out; 406 406 ··· 414 414 if (!error) 415 415 set_fs_pwd(current->fs, &file->f_path); 416 416 out_putf: 417 - fput(file); 417 + fput_light(file, fput_needed); 418 418 out: 419 419 return error; 420 420 }