]> Git Repo - qemu.git/commitdiff
block: Fix anonymous BBs in blk_root_inactivate()
authorKevin Wolf <[email protected]>
Mon, 22 May 2017 15:03:39 +0000 (17:03 +0200)
committerKevin Wolf <[email protected]>
Fri, 9 Jun 2017 09:45:03 +0000 (11:45 +0200)
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 <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
block/block-backend.c

index f3a60081a7658bd60adc76a5b2b53ec06953876e..7d7f3697d1aed6ce9d03f9f6cbaf9f2392bda6d0 100644 (file)
@@ -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;
     }
 
This page took 0.023267 seconds and 4 git commands to generate.