summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2022-04-15 13:53:56 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-27 08:50:25 +0200
commit549f5093e9d6d19d21dc4d5a763b7ec294a8af90 (patch)
treee0b69e497241c75b6d1ce654a670fa262291a1ae /fs/fuse
parentaf6d1fc5b8a68c790e3da09ff5dfb61eff63cca0 (diff)
downloadlinux-stable-549f5093e9d6d19d21dc4d5a763b7ec294a8af90.tar.gz
linux-stable-549f5093e9d6d19d21dc4d5a763b7ec294a8af90.tar.bz2
linux-stable-549f5093e9d6d19d21dc4d5a763b7ec294a8af90.zip
fuse: Apply flags2 only when userspace set the FUSE_INIT_EXT
commit 3066ff93476c35679cb07a97cce37d9bb07632ff upstream. 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 https://github.com/libfuse/libfuse/pull/662 Signed-off-by: Bernd Schubert <bschubert@ddn.com> Fixes: 53db28933e95 ("fuse: extend init flags") Cc: <stable@vger.kernel.org> # v5.17 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 6b3beda16c1b..bc3c3e76c646 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1127,7 +1127,10 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
process_init_limits(fc, arg);
if (arg->minor >= 6) {
- u64 flags = arg->flags | (u64) arg->flags2 << 32;
+ u64 flags = arg->flags;
+
+ if (flags & FUSE_INIT_EXT)
+ flags |= (u64) arg->flags2 << 32;
ra_pages = arg->max_readahead / PAGE_SIZE;
if (flags & FUSE_ASYNC_READ)