Re: [PATCH v5] fuse: clear ent->fuse_req in commit_fetch error path

From: Miklos Szeredi

Date: Mon Jun 15 2026 - 08:14:34 EST


On Mon, 15 Jun 2026 at 12:26, Bernd Schubert via B4 Relay
<devnull+bernd.bsbernd.com@xxxxxxxxxx> wrote:
>
> From: Zhenghang Xiao <kipreyyy@xxxxxxxxx>
>
> fuse_uring_commit_fetch() error path called fuse_request_end(req) without
> clearing ent->fuse_req when fuse_ring_ent_set_commit() fails. The
> still-pending fuse_uring_send_in_task() task-work later dereferences the
> dangling pointer through fuse_uring_prepare_send(), causing a
> use-after-free.
>
> End the request with fuse_uring_req_end(), which handles all conditions
> already.
>
> Annotation/edition by Bernd: The UAF should be fixed by other means already
> and actually has to be avoided that way.
> Just checking for ent->fuse_req == NULL in fuse_uring_send_in_task()
> would be prone to race conditions, because if malicious userspace
> would commit requests that have passed the NULL check, but are
> in doing args copy, it would still trigger a use-after-free.
> Setting ent->fuse_req = NULL in fuse_uring_commit_fetch() still
> makes sense, though.
>
> Reported-by: Shuvam Pandey <shuvampandey1@xxxxxxxxx>
> Reported-by: Berkant Koc <me@xxxxxxxxxx>
> Signed-off-by: Zhenghang Xiao <kipreyyy@xxxxxxxxx>
> Signed-off-by: Bernd Schubert <bernd@xxxxxxxxxxx>

Applied, thanks.

Miklos