Skip to contentSkip to conversation

block: fix bdrv_root_attach_child forget to unref child_bs

PATCH Applied Vladimir Sementsov-Ogievskiy 2 participants 2 messages Mar 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: fix bdrv_root_attach_child forget to unref child_bs

bdrv_root_attach_child promises to drop child_bs reference on failure. It does it on first handled failure path, but not on the second. Fix that.

---
 block.c | 1 +
 1 file changed, 1 insertion(+)
block.c +1 -0
index a2542c977b..6713db773d 100644
@@ -2612,6 +2612,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
             error_propagate(errp, local_err);
             g_free(child);
             bdrv_abort_perm_update(child_bs);
+            bdrv_unref(child_bs);
             return NULL;
         }
     }
Signature · 1 line
2.21.0
Applied
#1 lore raw

Am 24.03.2020 um 16:59 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 5 lines

bdrv_root_attach_child promises to drop child_bs reference on failure. It does it on first handled failure path, but not on the second. Fix that.

Thanks, applied to the block branch.

Kevin