]> git.ipfire.org Git - thirdparty/linux.git/commit
io_uring: fix CQ overflow condition
authorJens Axboe <axboe@kernel.dk>
Wed, 17 Apr 2019 14:57:48 +0000 (08:57 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 17 Apr 2019 17:41:49 +0000 (11:41 -0600)
commit74f464e97044da33b25aaed00213914b0edf1f2e
tree47875b487bcdb6a18648c270b6b6b4f251ca5ce0
parentb19062a567266ee1f10f6709325f766bbcc07d1c
io_uring: fix CQ overflow condition

This is a leftover from when the rings initially were not free flowing,
and hence a test for tail + 1 == head would indicate full. Since we now
let them wrap instead of mask them with the size, we need to check if
they drift more than the ring size from each other.

This fixes a case where we'd overwrite CQ ring entries, if the user
failed to reap completions. Both cases would ultimately result in lost
completions as the application violated the depth it asked for. The only
difference is that before this fix we'd return invalid entries for the
overflowed completions, instead of properly flagging it in the
cq_ring->overflow variable.

Reported-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c