Skip to content

Commit 27122c0

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix unprotected iopoll overflow
[ 71.490669] WARNING: CPU: 3 PID: 17070 at io_uring/io_uring.c:769 io_cqring_event_overflow+0x47b/0x6b0 [ 71.498381] Call Trace: [ 71.498590] <TASK> [ 71.501858] io_req_cqe_overflow+0x105/0x1e0 [ 71.502194] __io_submit_flush_completions+0x9f9/0x1090 [ 71.503537] io_submit_sqes+0xebd/0x1f00 [ 71.503879] __do_sys_io_uring_enter+0x8c5/0x2380 [ 71.507360] do_syscall_64+0x39/0x80 We decoupled CQ locking from ->task_complete but haven't fixed up places forcing locking for CQ overflows. Fixes: ec26c22 ("io_uring: merge iopoll and normal completion paths") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 45500dc commit 27122c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io_uring/io_uring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ static void __io_flush_post_cqes(struct io_ring_ctx *ctx)
908908
struct io_uring_cqe *cqe = &ctx->completion_cqes[i];
909909

910910
if (!io_fill_cqe_aux(ctx, cqe->user_data, cqe->res, cqe->flags)) {
911-
if (ctx->task_complete) {
911+
if (ctx->lockless_cq) {
912912
spin_lock(&ctx->completion_lock);
913913
io_cqring_event_overflow(ctx, cqe->user_data,
914914
cqe->res, cqe->flags, 0, 0);
@@ -1566,7 +1566,7 @@ void __io_submit_flush_completions(struct io_ring_ctx *ctx)
15661566

15671567
if (!(req->flags & REQ_F_CQE_SKIP) &&
15681568
unlikely(!io_fill_cqe_req(ctx, req))) {
1569-
if (ctx->task_complete) {
1569+
if (ctx->lockless_cq) {
15701570
spin_lock(&ctx->completion_lock);
15711571
io_req_cqe_overflow(req);
15721572
spin_unlock(&ctx->completion_lock);

0 commit comments

Comments
 (0)