Skip to content

Commit 97f3087

Browse files
joannekoongMiklos Szeredi
authored andcommitted
fuse: check aborted connection before adding requests to pending list for resending
There is a race condition where inflight requests will not be aborted if they are in the middle of being re-sent when the connection is aborted. If fuse_resend has already moved all the requests in the fpq->processing lists to its private queue ("to_queue") and then the connection starts and finishes aborting, these requests will be added to the pending queue and remain on it indefinitely. Fixes: 760eac7 ("fuse: Introduce a new notification type for resend pending requests") Signed-off-by: Joanne Koong <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Reviewed-by: Jingbo Xu <[email protected]> Cc: <[email protected]> # v6.9 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent b189152 commit 97f3087

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/fuse/dev.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ MODULE_ALIAS("devname:fuse");
3131

3232
static struct kmem_cache *fuse_req_cachep;
3333

34+
static void end_requests(struct list_head *head);
35+
3436
static struct fuse_dev *fuse_get_dev(struct file *file)
3537
{
3638
/*
@@ -1820,6 +1822,13 @@ static void fuse_resend(struct fuse_conn *fc)
18201822
}
18211823

18221824
spin_lock(&fiq->lock);
1825+
if (!fiq->connected) {
1826+
spin_unlock(&fiq->lock);
1827+
list_for_each_entry(req, &to_queue, list)
1828+
clear_bit(FR_PENDING, &req->flags);
1829+
end_requests(&to_queue);
1830+
return;
1831+
}
18231832
/* iq and pq requests are both oldest to newest */
18241833
list_splice(&to_queue, &fiq->pending);
18251834
fiq->ops->wake_pending_and_unlock(fiq);

0 commit comments

Comments
 (0)