From: Fam Zheng <f...@redhat.com> 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 <f...@redhat.com> Signed-off-by: Kevin Wolf <kw...@redhat.com> --- block/block-backend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/block-backend.c b/block/block-backend.c index daa7908..5742c09 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; } -- 1.8.3.1