io_uring: fix racy IOPOLL flush overflow
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 6 Dec 2020 22:22:44 +0000 (22:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:54:02 +0000 (11:54 +0100)
commitc0fd45a9a97e0e46b9a590c957204434315a66c0
treedec6f5705d835fe84c21f9b8a10e239d791ac42d
parentb931ea024e4531c02607978a04c55b7f7f6f5c7d
io_uring: fix racy IOPOLL flush overflow

[ Upstream commit 634578f800652035debba3098d8ab0d21af7c7a5 ]

It's not safe to call io_cqring_overflow_flush() for IOPOLL mode without
hodling uring_lock, because it does synchronisation differently. Make
sure we have it.

As for io_ring_exit_work(), we don't even need it there because
io_ring_ctx_wait_and_kill() already set force flag making all overflowed
requests to be dropped.

Cc: <stable@vger.kernel.org> # 5.5+
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c