io_uring: fix racy overflow count reporting
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 30 Jul 2020 15:43:47 +0000 (18:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:42 +0000 (08:23 +0200)
commite79ec069c60e192d7bc30680b0052ec8c01ccb22
treeda4273df3f21bb04a53a4b617507b1ffa1d7c491
parent743d10b7dcc675f915d5825e12bca5dedf2f44ee
io_uring: fix racy overflow count reporting

[ Upstream commit b2bd1cf99f3e7c8fbf12ea07af2c6998e1209e25 ]

All ->cq_overflow modifications should be under completion_lock,
otherwise it can report a wrong number to the userspace. Fix it in
io_uring_cancel_files().

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