Re: [PATCH] fuse: reject a duplicate fd= mount option
From: Miklos Szeredi
Date: Tue Aug 18 2026 - 05:07:55 EST
On Tue, 11 Aug 2026 at 06:54, Baokun Li <libaokun@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxx>
Applied, thanks.
Miklos