From: Joanne Koong <joannelkoong@gmail.com>
To: David Carlier <devnexen@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fuse: add missing NULL check for fget() in fuse_parse_param()
Date: Wed, 18 Mar 2026 14:31:18 -0700 [thread overview]
Message-ID: <CAJnrk1ZBV6p6gg2Fu2_6O=FBXYzDgRcYTP+_8i205MrMhC8FKg@mail.gmail.com> (raw)
In-Reply-To: <20260318182701.21697-1-devnexen@gmail.com>
On Wed, Mar 18, 2026 at 11:53 AM David Carlier <devnexen@gmail.com> wrote:
>
> In the OPT_FD case of fuse_parse_param(), when using the old mount API,
> fget() is called on the user-supplied file descriptor but its return
> value is not checked for NULL before being passed to fuse_opt_fd().
> fuse_opt_fd() unconditionally dereferences file->f_op, causing a kernel
> NULL pointer dereference.
>
> This is user-triggerable via: mount -t fuse -o fd=99999 dummy /mnt
> where fd 99999 is not open.
>
> The new mount API path (FSCONFIG_SET_FD) is not affected because
> fsopen.c validates the fd with fget_raw() + NULL check before setting
> param->file.
>
> Add a NULL check after fget() and return an error via invalfc() when
> the fd is invalid.
>
> Fixes: 3f2496deff35 ("fuse: don't require /dev/fuse fd to be kept open during mount")
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> fs/fuse/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index af8ad96829fd..39b635651165 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -862,6 +862,8 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)
> return fuse_opt_fd(fsc, param->file);
> } else {
> struct file *file __free(fput) = fget(result.uint_32);
> + if (!file)
> + return invalfc(fsc, "Invalid fuse fd");
> return fuse_opt_fd(fsc, file);
> }
>
Hi David,
I think this is already going to be fixed up in the fuse tree by
Miklos when he applies the next version of his cleanup series, as per
the conversation in [1].
Thanks,
Joanne
[1] https://lore.kernel.org/linux-fsdevel/20260316165320.3245526-5-mszeredi@redhat.com/t/#u
> --
> 2.53.0
>
>
prev parent reply other threads:[~2026-03-18 21:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 18:27 [PATCH] fuse: add missing NULL check for fget() in fuse_parse_param() David Carlier
2026-03-18 21:31 ` Joanne Koong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJnrk1ZBV6p6gg2Fu2_6O=FBXYzDgRcYTP+_8i205MrMhC8FKg@mail.gmail.com' \
--to=joannelkoong@gmail.com \
--cc=devnexen@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox