]> 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)
committerPavel Begunkov <asml.silence@gmail.com>
Mon, 13 Jun 2022 08:53:41 +0000 (09:53 +0100)
commit11b687169cf05f23256ef57e3cfa5a1d7b291f4c
treeb9ea721f301a58633b99cef2fd5da753e89729c1
parent14c3e1b7ef26fcfd502a33f3e2a4c8e23fd241f1
io_uring: fix not locked access to fixed buf table

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: 776912e4af75b ("io_uring: add full-fledged dynamic buffers support")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
fs/io_uring.c