aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2017-03-07 19:07:21 +0800
committerKevin Wolf <kwolf@redhat.com>2017-03-07 14:53:29 +0100
commit50bfbe93b2ca0ab795f3de305bec5ab1df620be4 (patch)
treecfde0e80bf2c9dbfc2af1a1016e81225ce8cb5ca /block
parentd282f34e82bf8f243dd1f7103963fec1d4129672 (diff)
block: Don't use error_abort in blk_new_open
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>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index daa7908d01..5742c09c2c 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -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;
}