Commit 5975bc20 authored by Linus Torvalds's avatar Linus Torvalds Committed by Greg Kroah-Hartman

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

commit 55815f70 upstream.

We already use them for openat() and friends, but fstat() also wants to
be able to use O_PATH file descriptors.  This should make it more
directly comparable to the O_SEARCH of Solaris.

Note that you could already do the same thing with "fstatat()" and an
empty path, but just doing "fstat()" directly is simpler and faster, so
there is no reason not to just allow it directly.

See also commit 332a2e12, which did the same thing for fchdir, for
the same reasons.
Reported-by: default avatarольга крыжановская <olga.kryzhanovska@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f2742791
...@@ -57,7 +57,7 @@ EXPORT_SYMBOL(vfs_getattr); ...@@ -57,7 +57,7 @@ EXPORT_SYMBOL(vfs_getattr);
int vfs_fstat(unsigned int fd, struct kstat *stat) int vfs_fstat(unsigned int fd, struct kstat *stat)
{ {
struct file *f = fget(fd); struct file *f = fget_raw(fd);
int error = -EBADF; int error = -EBADF;
if (f) { if (f) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment