]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: Don't use error_abort in blk_new_open
authorFam Zheng <famz@redhat.com>
Tue, 7 Mar 2017 11:07:21 +0000 (19:07 +0800)
committerKevin Wolf <kwolf@redhat.com>
Tue, 7 Mar 2017 13:53:29 +0000 (14:53 +0100)
We have an errp and bdrv_root_attach_child can fail permission check,
error_abort is not the best choice here.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c

index daa7908d0151b158d3fe8d0f81cf7b20e599b9b8..5742c09c2cd3d56afca16272f23493abfb6d9305 100644 (file)
@@ -213,7 +213,12 @@ BlockBackend *blk_new_open(const char *filename, const char *reference,
     }
 
     blk->root = bdrv_root_attach_child(bs, "root", &child_root,
-                                       perm, BLK_PERM_ALL, blk, &error_abort);
+                                       perm, BLK_PERM_ALL, blk, errp);
+    if (!blk->root) {
+        bdrv_unref(bs);
+        blk_unref(blk);
+        return NULL;
+    }
 
     return blk;
 }