• Pavel Begunkov's avatar
    io_uring: don't derive close state from ->func · 3af73b28
    Pavel Begunkov authored
    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: default avatarPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    3af73b28
io_uring.c 192 KB