Skip to content

Commit 3066ff9

Browse files
bsberndMiklos Szeredi
authored andcommitted
fuse: Apply flags2 only when userspace set the FUSE_INIT_EXT
This is just a safety precaution to avoid checking flags on memory that was initialized on the user space side. libfuse zeroes struct fuse_init_out outarg, but this is not guranteed to be done in all implementations. Better is to act on flags and to only apply flags2 when FUSE_INIT_EXT is set. There is a risk with this change, though - it might break existing user space libraries, which are already using flags2 without setting FUSE_INIT_EXT. The corresponding libfuse patch is here libfuse/libfuse#662 Signed-off-by: Bernd Schubert <[email protected]> Fixes: 53db289 ("fuse: extend init flags") Cc: <[email protected]> # v5.17 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 1c3610d commit 3066ff9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/fuse/inode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,10 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
11341134
process_init_limits(fc, arg);
11351135

11361136
if (arg->minor >= 6) {
1137-
u64 flags = arg->flags | (u64) arg->flags2 << 32;
1137+
u64 flags = arg->flags;
1138+
1139+
if (flags & FUSE_INIT_EXT)
1140+
flags |= (u64) arg->flags2 << 32;
11381141

11391142
ra_pages = arg->max_readahead / PAGE_SIZE;
11401143
if (flags & FUSE_ASYNC_READ)

0 commit comments

Comments
 (0)