]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - fs/io_uring.c
io_uring: don't derive close state from ->func
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 8 Jun 2020 18:08:17 +0000 (21:08 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 8 Jun 2020 19:47:37 +0000 (13:47 -0600)
commit3af73b286ccee493dc055fc58da02b2dc7a5304d
tree5876914efcdb3fbcc3fbdc6f642e9f39216b63b2
parenta8c73c1a614f6da6c0b04c393f87447e28cb6de4
io_uring: don't derive close state from ->func

Relying on having a specific work.func is dangerous, even if an opcode
handler set it itself. E.g. io_wq_assign_next() can modify it.

io_close() sets a custom work.func to indicate that
__close_fd_get_file() was already called. Fortunately, there is no bugs
with io_wq_assign_next() and close yet.

Still, do it safe and always be prepared to be called through
io_wq_submit_work(). Zero req->close.put_file in prep, and call
__close_fd_get_file() IFF it's NULL.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c