io_uring: add missing lock in io_get_file_fixed
authorBing-Jhong Billy Jheng <billy@starlabs.sg>
Thu, 2 Mar 2023 13:00:06 +0000 (21:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Mar 2023 10:45:54 +0000 (11:45 +0100)
commitcf7f9cd50013eb187867cd0c599aa184e6f59d54
treee4bf8dca02e35c3209240816bc430aa3696f5535
parent77358093331e9769855140bf94a3f00ecdcf4bb1
io_uring: add missing lock in io_get_file_fixed

io_get_file_fixed will access io_uring's context. Lock it if it is
invoked unlocked (eg via io-wq) to avoid a race condition with fixed
files getting unregistered.

No single upstream patch exists for this issue, it was fixed as part
of the file assignment changes that went into the 5.18 cycle.

Signed-off-by: Jheng, Bing-Jhong Billy <billy@starlabs.sg>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c