[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/14] block: Fix Transaction leak in bdrv_root_attach_child()
From: |
Kevin Wolf |
Subject: |
[PULL 02/14] block: Fix Transaction leak in bdrv_root_attach_child() |
Date: |
Fri, 14 May 2021 18:31:12 +0200 |
The error path needs to call tran_finalize(), too.
Fixes: CID 1452773
Fixes: 548a74c0dbc858edd1a7ee3045b5f2fe710bd8b1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210503110555.24001-2-kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 9ad725d205..c411e8a5c6 100644
--- a/block.c
+++ b/block.c
@@ -2917,13 +2917,14 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState
*child_bs,
child_role, perm, shared_perm, opaque,
&child, tran, errp);
if (ret < 0) {
- bdrv_unref(child_bs);
- return NULL;
+ assert(child == NULL);
+ goto out;
}
ret = bdrv_refresh_perms(child_bs, errp);
- tran_finalize(tran, ret);
+out:
+ tran_finalize(tran, ret);
bdrv_unref(child_bs);
return child;
}
--
2.30.2
- [PULL 00/14] Block layer patches, Kevin Wolf, 2021/05/14
- [PULL 01/14] qcow2: set bdi->is_dirty, Kevin Wolf, 2021/05/14
- [PULL 03/14] block: Fix Transaction leak in bdrv_reopen_multiple(), Kevin Wolf, 2021/05/14
- [PULL 07/14] tests/qtest: add multi-queue test case to vhost-user-blk-test, Kevin Wolf, 2021/05/14
- [PULL 02/14] block: Fix Transaction leak in bdrv_root_attach_child(),
Kevin Wolf <=
- [PULL 04/14] qapi: spelling fix (addtional), Kevin Wolf, 2021/05/14
- [PULL 05/14] block/export: improve vu_blk_sect_range_ok(), Kevin Wolf, 2021/05/14
- [PULL 10/14] vhost-user-blk: Don't reconnect during initialisation, Kevin Wolf, 2021/05/14
- [PULL 06/14] test: new qTest case to test the vhost-user-blk-server, Kevin Wolf, 2021/05/14
- [PULL 13/14] virtio: Fail if iommu_platform is requested, but unsupported, Kevin Wolf, 2021/05/14
- [PULL 11/14] vhost-user-blk: Improve error reporting in realize, Kevin Wolf, 2021/05/14
- [PULL 14/14] vhost-user-blk: Check that num-queues is supported by backend, Kevin Wolf, 2021/05/14
- [PULL 08/14] vhost-user-blk-test: test discard/write zeroes invalid inputs, Kevin Wolf, 2021/05/14
- [PULL 09/14] vhost-user-blk: Make sure to set Error on realize failure, Kevin Wolf, 2021/05/14