Skip to content

Commit 817869d

Browse files
committed
io_uring: drop req submit reference always in async punt
If we don't end up actually calling submit in io_sq_wq_submit_work(), we still need to drop the submit reference to the request. If we don't, then we can leak the request. This can happen if we race with ring shutdown while flushing the workqueue for requests that require use of the mm_struct. Fixes: e65ef56 ("io_uring: use regular request ref counts") Signed-off-by: Jens Axboe <[email protected]>
1 parent 52e04ef commit 817869d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/io_uring.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,10 +1568,11 @@ static void io_sq_wq_submit_work(struct work_struct *work)
15681568
break;
15691569
cond_resched();
15701570
} while (1);
1571-
1572-
/* drop submission reference */
1573-
io_put_req(req);
15741571
}
1572+
1573+
/* drop submission reference */
1574+
io_put_req(req);
1575+
15751576
if (ret) {
15761577
io_cqring_add_event(ctx, sqe->user_data, ret, 0);
15771578
io_put_req(req);

0 commit comments

Comments
 (0)