Skip to content

Commit 5157da2

Browse files
author
Miklos Szeredi
committed
fuse: always allow query of st_dev
Fuse mounts without "allow_other" are off-limits to all non-owners. Yet it makes sense to allow querying st_dev on the root, since this value is provided by the kernel, not the userspace filesystem. Allow statx(2) with a zero request mask to succeed on a fuse mounts for all users. Reported-by: Nikolaus Rath <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 614c026 commit 5157da2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fs/fuse/dir.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,18 @@ static int fuse_getattr(const struct path *path, struct kstat *stat,
16891689
struct inode *inode = d_inode(path->dentry);
16901690
struct fuse_conn *fc = get_fuse_conn(inode);
16911691

1692-
if (!fuse_allow_current_process(fc))
1692+
if (!fuse_allow_current_process(fc)) {
1693+
if (!request_mask) {
1694+
/*
1695+
* If user explicitly requested *nothing* then don't
1696+
* error out, but return st_dev only.
1697+
*/
1698+
stat->result_mask = 0;
1699+
stat->dev = inode->i_sb->s_dev;
1700+
return 0;
1701+
}
16931702
return -EACCES;
1703+
}
16941704

16951705
return fuse_update_get_attr(inode, NULL, stat, request_mask, flags);
16961706
}

0 commit comments

Comments
 (0)