]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix not locked access to fixed buf table
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 9 Jun 2022 07:34:35 +0000 (08:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Jul 2022 14:41:18 +0000 (16:41 +0200)
commite7f4e0bd2a0ff499fd147d6e29f42794c100ab80
treef91bb3ca9ceaae0efa7ce2ec0c25f8466aa6605c
parentc29567d053a9052e2f158f6d31f5f8ae7271600a
io_uring: fix not locked access to fixed buf table

commit e9b4ed5c52df71f2dd523b4c07e20c560352a740 upstream.

We can look inside the fixed buffer table only while holding
->uring_lock, however in some cases we don't do the right async prep for
IORING_OP_{WRITE,READ}_FIXED ending up with NULL req->imu forcing making
an io-wq worker to try to resolve the fixed buffer without proper
locking.

Move req->imu setup into early req init paths, i.e. io_prep_rw(), which
is called unconditionally for rw requests and under uring_lock.

Fixes: 28c2b7b3c696b ("io_uring: add full-fledged dynamic buffers support")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c