From c53476111d5ede61d24b3fa181fa2d19d3a3e6bc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 23 Sep 2021 09:15:16 -0600 Subject: [PATCH] t/io_uring: ensure batch counts are smaller or equal to depth If you use a batch submit or complete count that's larger than the depth, then t/io_uring will stall. Make sure to sanitize the counts so that any batch values is always <= total depth. Signed-off-by: Jens Axboe --- t/io_uring.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/io_uring.c b/t/io_uring.c index 1adb8789..af1b8fa8 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -617,6 +617,11 @@ int main(int argc, char *argv[]) } } + if (batch_complete > depth) + batch_complete = depth; + if (batch_submit > depth) + batch_submit = depth; + submitter = calloc(nthreads, sizeof(*submitter) + depth * sizeof(struct iovec)); for (j = 0; j < nthreads; j++) { -- 2.25.1