Check io_uring_wait_cqe() result, it's not safe to poke into cqe on error. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- test/sq-poll-share.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/sq-poll-share.c b/test/sq-poll-share.c index 0f25389..02b008e 100644 --- a/test/sq-poll-share.c +++ b/test/sq-poll-share.c @@ -60,7 +60,14 @@ static int wait_io(struct io_uring *ring, int nr_ios) struct io_uring_cqe *cqe; while (nr_ios) { - io_uring_wait_cqe(ring, &cqe); + int ret = io_uring_wait_cqe(ring, &cqe); + + if (ret == -EAGAIN) { + continue; + } else if (ret) { + fprintf(stderr, "io_uring_wait_cqe failed %i\n", ret); + return 1; + } if (cqe->res != BS) { fprintf(stderr, "Unexpected ret %d\n", cqe->res); return 1; -- 2.24.0