• K
    mirror: Fail gracefully for source == target · 86fae10c
    Kevin Wolf 提交于
    blockdev-mirror with the same node for source and target segfaults
    today: A node is in its own backing chain, so mirror_start_job() decides
    that this is an active commit. When adding the intermediate nodes with
    block_job_add_bdrv(), it starts the iteration through the subchain with
    the backing file of source, though, so it never reaches target and
    instead runs into NULL at the base.
    
    While we could fix that by starting with source itself, there is no
    point in allowing mirroring a node into itself and I wouldn't be
    surprised if this caused more problems later.
    
    So just check for this scenario and error out.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    86fae10c
mirror.c 56.2 KB