]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block/mirror: check backing in bdrv_mirror_top_refresh_filename
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Thu, 28 Sep 2017 12:03:00 +0000 (15:03 +0300)
committerMax Reitz <mreitz@redhat.com>
Fri, 6 Oct 2017 14:30:47 +0000 (16:30 +0200)
Backing may be zero after failed bdrv_attach_child in
bdrv_set_backing_hd, which leads to SIGSEGV.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20170928120300.58164-1-vsementsov@virtuozzo.com
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/mirror.c

index 459b80f8f32e922073a1fcae32c238df7e7cd264..3b6f0c577221bb05205561d94ec5512b805de776 100644 (file)
@@ -1058,6 +1058,11 @@ static int coroutine_fn bdrv_mirror_top_pdiscard(BlockDriverState *bs,
 
 static void bdrv_mirror_top_refresh_filename(BlockDriverState *bs, QDict *opts)
 {
+    if (bs->backing == NULL) {
+        /* we can be here after failed bdrv_attach_child in
+         * bdrv_set_backing_hd */
+        return;
+    }
     bdrv_refresh_filename(bs->backing->bs);
     pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
             bs->backing->bs->filename);