aboutsummaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-05-22 17:03:39 +0200
committerKevin Wolf <kwolf@redhat.com>2017-06-09 11:45:03 +0200
commit93c26503e01808bfb8cea3c25eae5be63147380e (patch)
treedb81e67a1eef8fb9dab31577dd83d62815e60c7a /block/block-backend.c
parent64175afc695c0672876fbbfc31b299c86d562cb4 (diff)
block: Fix anonymous BBs in blk_root_inactivate()
blk->name isn't an array, but a pointer that can be NULL. Checking for an anonymous BB must involve a NULL check first, otherwise we get crashes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index f3a60081a7..7d7f3697d1 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -168,7 +168,7 @@ static int blk_root_inactivate(BdrvChild *child)
* this point because the VM is stopped) and unattached monitor-owned
* BlockBackends. If there is still any other user like a block job, then
* we simply can't inactivate the image. */
- if (!blk->dev && !blk->name[0]) {
+ if (!blk->dev && !blk_name(blk)[0]) {
return -EPERM;
}