FYI, Linus just fixed another bug with O_PATH, related to fstat().

Olga

---------- Forwarded message ----------
From: Ben Hutchings <b...@decadent.org.uk>
Date: Mon, Sep 17, 2012 at 2:38 AM
Subject: [ 135/135] vfs: make O_PATH file descriptors usable for fstat()
To: linux-ker...@vger.kernel.org, sta...@vger.kernel.org
Cc: torva...@linux-foundation.org, a...@linux-foundation.org,
a...@lxorguk.ukuu.org.uk, ÐŸÐ»Ñ Ð³Ð° ÐºÑ Ñ Ð¶Ð°ÐœÐŸÐ²Ñ ÐºÐ°Ñ
<olga.kryzhanov...@gmail.com>, Al Viro <v...@zeniv.linux.org.uk>


3.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <torva...@linux-foundation.org>

commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2 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 332a2e1244bd, which did the same thing for fchdir, for
the same reasons.

Reported-by: ольга крыжановская <olga.kryzhanov...@gmail.com>
Cc: Al Viro <v...@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Ben Hutchings <b...@decadent.org.uk>
---
 fs/stat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/stat.c b/fs/stat.c
index b6ff118..4078022 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(vfs_getattr);
 int vfs_fstat(unsigned int fd, struct kstat *stat)
 {
        int fput_needed;
-       struct file *f = fget_light(fd, &fput_needed);
+       struct file *f = fget_raw_light(fd, &fput_needed);
        int error = -EBADF;

        if (f) {




-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanov...@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to