blkverify: Fix BDS leak in .bdrv_open error path
cover blkverify: Fix BDS leak in .bdrv_open error path
Kevin Wolf (2):
block: Allow bdrv_unref_child(bs, NULL)
blkverify: Fix BDS leak in .bdrv_open error path
block.c | 7 ++++++- block/blkverify.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 block: Allow bdrv_unref_child(bs, NULL)
bdrv_unref() can be called with a NULL argument and doesn't do anything then. Make bdrv_unref_child() consistent with it.
Signed-off-by Kevin Wolf <[email protected]>
--- block.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
block.c +6 -1
@@ -1104,12 +1104,17 @@ static void bdrv_detach_child(BdrvChild *child)void bdrv_unref_child (BlockDriverState *parent,BdrvChild *child) { -BlockDriverState *child_bs = child->bs; +BlockDriverState *child_bs; + +if (child ==NULL ) { +return ; + }if (child->bs->inherits_from == parent) { child->bs->inherits_from =NULL ; } + child_bs = child->bs;bdrv_detach_child (child);bdrv_unref (child_bs); }
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL)
Quoted 34 lines · Kevin Wolf
bdrv_unref()can be called with a NULL argument and doesn't do anything then. Makebdrv_unref_child()consistent with it.Signed-off-by Kevin Wolf <[email protected]>--- block.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)block.c +6
-1@@ -1104,12 +1104,17 @@ static void bdrv_detach_child(BdrvChild *child)void bdrv_unref_child (BlockDriverState *parent,BdrvChild *child) { -BlockDriverState *child_bs = child->bs; +BlockDriverState *child_bs; + +if (child ==NULL ) { +return ; + }if (child->bs->inherits_from == parent) { child->bs->inherits_from =NULL ; } + child_bs = child->bs;bdrv_detach_child (child);bdrv_unref (child_bs); }Signature · 1 line
1.8.3.1
Reviewed-by Jeff Cody <[email protected]>
PATCH 2/2 blkverify: Fix BDS leak in .bdrv_open error path
In reply to Kevin WolfSigned-off-by Kevin Wolf <[email protected]>
--- block/blkverify.c | 3 +++ 1 file changed, 3 insertions(+)
block/blkverify.c +3 -0
@@ -143,6 +143,9 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, ret =0 ; fail: +if (ret <0 ) { +bdrv_unref_child (bs, bs->file); + }qemu_opts_del (opts);return ret; }
Signature · 1 line
1.8.3.1
Quoted 22 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/blkverify.c | 3 +++ 1 file changed, 3 insertions(+)block/blkverify.c +3
-0@@ -143,6 +143,9 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, ret =0 ; fail: +if (ret <0 ) { +bdrv_unref_child (bs, bs->file); + }qemu_opts_del (opts);return ret; }Signature · 1 line
1.8.3.1
Reviewed-by Jeff Cody <[email protected]>
Quoted 4 lines · Kevin Wolf
Kevin Wolf (2):
block: Allowbdrv_unref_child(bs, NULL)
blkverify: Fix BDS leak in .bdrv_open error path
Quoted 8 lines
block.c | 7 ++++++- block/blkverify.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-)Signature · 1 line
1.8.3.1
Reviewed-by Stefan Hajnoczi <[email protected]>