• Stefan Bühler's avatar
    io_uring: fix race condition reading SQE data · e2033e33
    Stefan Bühler authored
    When punting to workers the SQE gets copied after the initial try.
    There is a race condition between reading SQE data for the initial try
    and copying it for punting it to the workers.
    
    For example io_rw_done calls kiocb->ki_complete even if it was prepared
    for IORING_OP_FSYNC (and would be NULL).
    
    The easiest solution for now is to alway prepare again in the worker.
    
    req->file is safe to prepare though as long as it is checked before use.
    Signed-off-by: default avatarStefan Bühler <source@stbuehler.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    e2033e33
io_uring.c 76 KB