• Jens Axboe's avatar
    io_uring: fix potential deadlock in io_poll_wake() · 7c9e7f0f
    Jens Axboe authored
    We attempt to run the poll completion inline, but we're using trylock to
    do so. This avoids a deadlock since we're grabbing the locks in reverse
    order at this point, we already hold the poll wq lock and we're trying
    to grab the completion lock, while the normal rules are the reverse of
    that order.
    
    IO completion for a timeout link will need to grab the completion lock,
    but that's not safe from this context. Put the completion under the
    completion_lock in io_poll_wake(), and mark the request as entering
    the completion with the completion_lock already held.
    
    Fixes: 2665abfd ("io_uring: add support for linked SQE timeouts")
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    7c9e7f0f
io_uring.c 114 KB