Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6878ea72 authored by Benjamin LaHaise's avatar Benjamin LaHaise
Browse files

aio: be defensive to ensure request batching is non-zero instead of BUG_ON()



In the event that an overflow/underflow occurs while calculating req_batch,
clamp the minimum at 1 request instead of doing a BUG_ON().

Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
parent db446a08
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -576,7 +576,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)

	atomic_set(&ctx->reqs_available, ctx->nr_events - 1);
	ctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4);
	BUG_ON(!ctx->req_batch);
	if (ctx->req_batch < 1)
		ctx->req_batch = 1;

	err = ioctx_add_table(ctx, mm);
	if (err)