]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix NULL reg-buffer
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 26 Apr 2021 14:17:38 +0000 (15:17 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Apr 2021 15:03:57 +0000 (09:03 -0600)
commit2da0af13b676357591d8da9948f838b9f887c772
treeaecf19946187f5912d04a7156f16017b1b96f891
parentb20408ca1037079326fdae5edd8f327df693bb5f
io_uring: fix NULL reg-buffer

io_import_fixed() doesn't expect a registered buffer slot to be NULL and
would fail stumbling on it. We don't allow it, but if during
__io_sqe_buffers_update() rsrc removal succeeds but following register
fails, we'll get such a situation.

Do it atomically and don't remove buffers until we sure that a new one
can be set.

Fixes: 28c2b7b3c696b ("io_uring: add full-fledged dynamic buffers support")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/830020f9c387acddd51962a3123b5566571b8c6d.1619446608.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c