Re: [ 035/218] vfs: make O_PATH file descriptors usable for fstat()

From: Ben Hutchings
Date: Fri Sep 28 2012 - 19:27:52 EST


On Fri, 2012-09-28 at 13:14 -0700, Greg Kroah-Hartman wrote:
> 3.4-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> 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.kryzhanovska@xxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

The upstream version exchanges fget_light() for fget_raw_light(). Since
3.2 (and likewise 3.4) have fget() here, I cherry-picked e994def 'VFS:
make vfs_fstat() use f[get|put]_light()' before this. Was that a
bad/good/neutral idea?

Ben.

> ---
> fs/stat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -57,7 +57,7 @@ EXPORT_SYMBOL(vfs_getattr);
>
> int vfs_fstat(unsigned int fd, struct kstat *stat)
> {
> - struct file *f = fget(fd);
> + struct file *f = fget_raw(fd);
> int error = -EBADF;
>
> if (f) {

--
Ben Hutchings
Usenet is essentially a HUGE group of people passing notes in class.
- Rachel Kadel, `A Quick Guide to Newsgroup Etiquette'

Attachment: signature.asc
Description: This is a digitally signed message part