]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix put_kbuf without proper locking
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 25 Mar 2022 13:00:43 +0000 (13:00 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Mar 2022 13:43:53 +0000 (07:43 -0600)
commite14fc38cb13fafd1d76b0a023dad765d3c7bdc58
tree3844abb6d83a181ff588b15861ad7589a0da2702
parent71ee04221e3b3cce6db232ff6ea532aa79a6147b
io_uring: fix put_kbuf without proper locking

io_put_kbuf_comp() should only be called while holding
->completion_lock, however there is no such assumption in io_clean_op()
and thus it can corrupt ->io_buffer_comp. Take the lock there, and
workaround the only user of io_clean_op() calling it with locks. Not
the prettiest solution, but it's easier to refactor it for-next.

Fixes: 5edd5d0592c75 ("io_uring: speedup provided buffer handling")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/743e2130b73ec6d48c4c5dd15db896c433431e6d.1648212967.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c