diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2017-09-28 15:03:00 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-10-06 16:30:47 +0200 |
commit | 18775ff32697ab6e1fd47989673bf1de54d0d942 (patch) | |
tree | 0f8418d3f464695c0934400ad783334325d133b8 /block/mirror.c | |
parent | d67a6b09b4ac27a4fac07544ded79b40d2717a0d (diff) |
block/mirror: check backing in bdrv_mirror_top_refresh_filename
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>
Diffstat (limited to 'block/mirror.c')
-rw-r--r-- | block/mirror.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c index 459b80f8f3..3b6f0c5772 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -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); |