From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Baokun Li <libaokun@linux.alibaba.com>, fuse-devel@lists.linux.dev
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fuse: reject a duplicate fd= mount option
Date: Tue, 11 Aug 2026 13:39:51 +0800 [thread overview]
Message-ID: <2eddc058-c808-4c30-8a9c-bc29b443d7bb@linux.alibaba.com> (raw)
In-Reply-To: <20260811045350.164272-1-libaokun@linux.alibaba.com>
On 8/11/26 12:53 PM, Baokun Li wrote:
> fuse_opt_fd() stored the fuse device in ctx->fud and bumped its refcount
> unconditionally:
>
> ctx->fud = fuse_dev_grab(file);
>
> If fd= is given twice (two fsconfig FSCONFIG_SET_FD calls), the second
> call overwrites ctx->fud and grabs the new device, while the reference
> taken on the first device is never released - a permanent refcount leak
> that pins the first fuse_dev until reboot.
>
> Reject a second fd= outright. ctx is zeroed on allocation, so a non-NULL
> ctx->fud reliably means the option was already processed.
>
> Fixes: d42eb23b2ef9 ("fuse: don't require /dev/fuse fd to be kept open during mount")
> Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>
LGTM.
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
> ---
> fs/fuse/inode.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 455c7feba057..2372e6ed333f 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -791,6 +791,9 @@ static int fuse_opt_fd(struct fs_context *fsc, struct file *file)
> {
> struct fuse_fs_context *ctx = fsc->fs_private;
>
> + if (ctx->fud)
> + return invalfc(fsc, "Multiple fd specified");
> +
> if (file->f_op != &fuse_dev_operations)
> return invalfc(fsc, "fd is not a fuse device");
> /*
--
Thanks,
Jingbo
prev parent reply other threads:[~2026-08-11 5:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 4:53 [PATCH] fuse: reject a duplicate fd= mount option Baokun Li
2026-08-11 5:39 ` Jingbo Xu [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=2eddc058-c808-4c30-8a9c-bc29b443d7bb@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=fuse-devel@lists.linux.dev \
--cc=libaokun@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.