Skip to content
  • Kevin Wolf's avatar
    e2626874
    block: Fix use after free in blockdev_mark_auto_del() · e2626874
    Kevin Wolf authored
    
    
    job_cancel_locked() drops the job list lock temporarily and it may call
    aio_poll(). We must assume that the list has changed after this call.
    Also, with unlucky timing, it can end up freeing the job during
    job_completed_txn_abort_locked(), making the job pointer invalid, too.
    
    For both reasons, we can't just continue at block_job_next_locked(job).
    Instead, start at the head of the list again after job_cancel_locked()
    and skip those jobs that we already cancelled (or that are completing
    anyway).
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20230503140142.474404-1-kwolf@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    e2626874
    block: Fix use after free in blockdev_mark_auto_del()
    Kevin Wolf authored
    
    
    job_cancel_locked() drops the job list lock temporarily and it may call
    aio_poll(). We must assume that the list has changed after this call.
    Also, with unlucky timing, it can end up freeing the job during
    job_completed_txn_abort_locked(), making the job pointer invalid, too.
    
    For both reasons, we can't just continue at block_job_next_locked(job).
    Instead, start at the head of the list again after job_cancel_locked()
    and skip those jobs that we already cancelled (or that are completing
    anyway).
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20230503140142.474404-1-kwolf@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading