mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-06 17:15:35 -05:00
io_uring: Fix race for sqes with userspace
io_ring_submit() finalises with 1. io_commit_sqring(), which releases sqes to the userspace 2. Then calls to io_queue_link_head(), accessing released head's sqe Reorder them. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
fb5ccc9878
commit
935d1e4590
@@ -2795,13 +2795,14 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
|
||||
submit++;
|
||||
io_submit_sqe(ctx, &s, statep, &link);
|
||||
}
|
||||
io_commit_sqring(ctx);
|
||||
|
||||
if (link)
|
||||
io_queue_link_head(ctx, link, &link->submit, shadow_req);
|
||||
if (statep)
|
||||
io_submit_state_end(statep);
|
||||
|
||||
io_commit_sqring(ctx);
|
||||
|
||||
return submit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user