linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests
@ 2025-11-25 18:13 Joanne Koong
  2025-11-25 18:23 ` Joanne Koong
  2025-11-26 11:41 ` Miklos Szeredi
  0 siblings, 2 replies; 4+ messages in thread
From: Joanne Koong @ 2025-11-25 18:13 UTC (permalink / raw)
  To: miklos; +Cc: bernd, linux-fsdevel

When a request is terminated before it has been committed, the request
is not removed from the queue's list. This leaves a dangling list entry
that leads to list corruption and use-after-free issues.

Remove the request from the queue's list for terminated non-committed
requests.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support")
---
 fs/fuse/dev_uring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 0066c9c0a5d5..7760fe4e1f9e 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -86,6 +86,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req,
 	lockdep_assert_not_held(&queue->lock);
 	spin_lock(&queue->lock);
 	ent->fuse_req = NULL;
+	list_del_init(&req->list);
 	if (test_bit(FR_BACKGROUND, &req->flags)) {
 		queue->active_background--;
 		spin_lock(&fc->bg_lock);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests
  2025-11-25 18:13 [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests Joanne Koong
@ 2025-11-25 18:23 ` Joanne Koong
  2025-11-25 20:24   ` Bernd Schubert
  2025-11-26 11:41 ` Miklos Szeredi
  1 sibling, 1 reply; 4+ messages in thread
From: Joanne Koong @ 2025-11-25 18:23 UTC (permalink / raw)
  To: miklos; +Cc: bernd, linux-fsdevel, stable

On Tue, Nov 25, 2025 at 10:15 AM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> When a request is terminated before it has been committed, the request
> is not removed from the queue's list. This leaves a dangling list entry
> that leads to list corruption and use-after-free issues.
>
> Remove the request from the queue's list for terminated non-committed
> requests.
>
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support")

Sorry, forgot to add the stable tag. There should be this line:

Cc: stable@vger.kernel.org

> ---
>  fs/fuse/dev_uring.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index 0066c9c0a5d5..7760fe4e1f9e 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -86,6 +86,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req,
>         lockdep_assert_not_held(&queue->lock);
>         spin_lock(&queue->lock);
>         ent->fuse_req = NULL;
> +       list_del_init(&req->list);
>         if (test_bit(FR_BACKGROUND, &req->flags)) {
>                 queue->active_background--;
>                 spin_lock(&fc->bg_lock);
> --
> 2.47.3
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests
  2025-11-25 18:23 ` Joanne Koong
@ 2025-11-25 20:24   ` Bernd Schubert
  0 siblings, 0 replies; 4+ messages in thread
From: Bernd Schubert @ 2025-11-25 20:24 UTC (permalink / raw)
  To: Joanne Koong, miklos; +Cc: linux-fsdevel, stable



On 11/25/25 19:23, Joanne Koong wrote:
> On Tue, Nov 25, 2025 at 10:15 AM Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>> When a request is terminated before it has been committed, the request
>> is not removed from the queue's list. This leaves a dangling list entry
>> that leads to list corruption and use-after-free issues.
>>
>> Remove the request from the queue's list for terminated non-committed
>> requests.
>>
>> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
>> Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support")
> 
> Sorry, forgot to add the stable tag. There should be this line:
> 
> Cc: stable@vger.kernel.org
> 
>> ---
>>  fs/fuse/dev_uring.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
>> index 0066c9c0a5d5..7760fe4e1f9e 100644
>> --- a/fs/fuse/dev_uring.c
>> +++ b/fs/fuse/dev_uring.c
>> @@ -86,6 +86,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req,
>>         lockdep_assert_not_held(&queue->lock);
>>         spin_lock(&queue->lock);
>>         ent->fuse_req = NULL;
>> +       list_del_init(&req->list);
>>         if (test_bit(FR_BACKGROUND, &req->flags)) {
>>                 queue->active_background--;
>>                 spin_lock(&fc->bg_lock);
>> --
>> 2.47.3
>>


Thank you, clearly missing in the fuse_uring_prepare_send() ->
fuse_uring_req_end() error code path.

Reviewed-by: Bernd Schubert <bschubert@ddn.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests
  2025-11-25 18:13 [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests Joanne Koong
  2025-11-25 18:23 ` Joanne Koong
@ 2025-11-26 11:41 ` Miklos Szeredi
  1 sibling, 0 replies; 4+ messages in thread
From: Miklos Szeredi @ 2025-11-26 11:41 UTC (permalink / raw)
  To: Joanne Koong; +Cc: bernd, linux-fsdevel

On Tue, 25 Nov 2025 at 19:15, Joanne Koong <joannelkoong@gmail.com> wrote:
>
> When a request is terminated before it has been committed, the request
> is not removed from the queue's list. This leaves a dangling list entry
> that leads to list corruption and use-after-free issues.
>
> Remove the request from the queue's list for terminated non-committed
> requests.
>
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support")

Applied, thanks.

Miklos

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-26 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 18:13 [PATCH] fuse: fix io-uring list corruption for terminated non-committed requests Joanne Koong
2025-11-25 18:23 ` Joanne Koong
2025-11-25 20:24   ` Bernd Schubert
2025-11-26 11:41 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).