Skip to content

Commit 2408d17

Browse files
isilenceaxboe
authored andcommitted
io_uring/query: prevent infinite loops
If the query chain forms a cycle, the interface will loop indefinitely. Make sure it handles fatal signals, so the user can kill the process and hence break out of the infinite loop. Fixes: c265ae7 ("io_uring: introduce io_uring querying") Reported-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 31bf77d commit 2408d17

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

io_uring/query.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ int io_query(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args)
8888
if (ret)
8989
return ret;
9090
uhdr = u64_to_user_ptr(next_hdr);
91+
92+
if (fatal_signal_pending(current))
93+
return -EINTR;
94+
cond_resched();
9195
}
9296
return 0;
9397
}

0 commit comments

Comments
 (0)