io_uring/msg_ring: fix missing lock on overflow for IOPOLL
authorJens Axboe <axboe@kernel.dk>
Wed, 23 Aug 2023 00:00:02 +0000 (18:00 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:11:05 +0000 (16:11 +0200)
commit22a406b3629a10979916ea7cace47858410117b5
tree8661360eab9c57019db79e59025f6d44c49922cc
parent816c7cecf6a0cf04b5b543690e38a1b15bdf8e88
io_uring/msg_ring: fix missing lock on overflow for IOPOLL

Commit e12d7a46f65ae4b7d58a5e0c1cbfa825cf8d830d upstream.

If the target ring is configured with IOPOLL, then we always need to hold
the target ring uring_lock before posting CQEs. We could just grab it
unconditionally, but since we don't expect many target rings to be of this
type, make grabbing the uring_lock conditional on the ring type.

Link: https://lore.kernel.org/io-uring/Y8krlYa52%2F0YGqkg@ip-172-31-85-199.ec2.internal/
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/msg_ring.c