From: Pavel Begunkov Date: Sun, 6 Dec 2020 22:22:45 +0000 (+0000) Subject: io_uring: fix io_cqring_events()'s noflush X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~491^2~210 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=821d12a15cc264f3597c93dc5d44d6e9bbf9f3a3;p=linux.git io_uring: fix io_cqring_events()'s noflush commit 59850d226e4907a6f37c1d2fe5ba97546a8691a4 upstream. Checking !list_empty(&ctx->cq_overflow_list) around noflush in io_cqring_events() is racy, because if it fails but a request overflowed just after that, io_cqring_overflow_flush() still will be called. Remove the second check, it shouldn't be a problem for performance, because there is cq_check_overflow bit check just above. Cc: # 5.5+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/io_uring.c b/fs/io_uring.c index e9219841923c..443b021c80be 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2242,7 +2242,7 @@ static unsigned io_cqring_events(struct io_ring_ctx *ctx, bool noflush) * we wake up the task, and the next invocation will flush the * entries. We cannot safely to it from here. */ - if (noflush && !list_empty(&ctx->cq_overflow_list)) + if (noflush) return -1U; io_cqring_overflow_flush(ctx, false, NULL, NULL);