diff --git a/fs/aio.c b/fs/aio.c index 6a9c7e489adf..955947ef3e02 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1063,6 +1063,9 @@ static long aio_read_events_ring(struct kioctx *ctx, if (head == tail) goto out; + head %= ctx->nr_events; + tail %= ctx->nr_events; + while (ret < nr) { long avail; struct io_event *ev;