Skip to content

Commit

Permalink
io_uring: drop req submit reference always in async punt
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
axboe committed May 1, 2019
1 parent 52e04ef commit 817869d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,10 +1568,11 @@ static void io_sq_wq_submit_work(struct work_struct *work)
break;
cond_resched();
} while (1);

/* drop submission reference */
io_put_req(req);
}

/* drop submission reference */
io_put_req(req);

if (ret) {
io_cqring_add_event(ctx, sqe->user_data, ret, 0);
io_put_req(req);
Expand Down

0 comments on commit 817869d

Please sign in to comment.