* [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path
@ 2015-10-13 12:17 Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kevin Wolf @ 2015-10-13 12:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, jcody, qemu-devel
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(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL)
2015-10-13 12:17 [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
@ 2015-10-13 12:17 ` Kevin Wolf
2015-10-13 12:22 ` Jeff Cody
2015-10-13 12:17 ` [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-26 11:26 ` [Qemu-devel] [Qemu-block] [PATCH 0/2] " Stefan Hajnoczi
2 siblings, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2015-10-13 12:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, jcody, qemu-devel
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 <kwolf@redhat.com>
---
block.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index f38146e..6490040 100644
--- a/block.c
+++ b/block.c
@@ -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);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path
2015-10-13 12:17 [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
@ 2015-10-13 12:17 ` Kevin Wolf
2015-10-13 12:35 ` Jeff Cody
2015-10-26 11:26 ` [Qemu-devel] [Qemu-block] [PATCH 0/2] " Stefan Hajnoczi
2 siblings, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2015-10-13 12:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, jcody, qemu-devel
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/blkverify.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/blkverify.c b/block/blkverify.c
index f8655ad..c5f8e8d 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -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;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL)
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
@ 2015-10-13 12:22 ` Jeff Cody
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Cody @ 2015-10-13 12:22 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, qemu-block
On Tue, Oct 13, 2015 at 02:17:39PM +0200, Kevin Wolf wrote:
> 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 <kwolf@redhat.com>
> ---
> block.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/block.c b/block.c
> index f38146e..6490040 100644
> --- a/block.c
> +++ b/block.c
> @@ -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);
> }
> --
> 1.8.3.1
>
Reviewed-by: Jeff Cody <jcody@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path
2015-10-13 12:17 ` [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
@ 2015-10-13 12:35 ` Jeff Cody
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Cody @ 2015-10-13 12:35 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, qemu-block
On Tue, Oct 13, 2015 at 02:17:40PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/blkverify.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/block/blkverify.c b/block/blkverify.c
> index f8655ad..c5f8e8d 100644
> --- a/block/blkverify.c
> +++ b/block/blkverify.c
> @@ -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;
> }
> --
> 1.8.3.1
>
Reviewed-by: Jeff Cody <jcody@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path
2015-10-13 12:17 [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
@ 2015-10-26 11:26 ` Stefan Hajnoczi
2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-10-26 11:26 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, qemu-block
On Tue, Oct 13, 2015 at 02:17:38PM +0200, Kevin Wolf wrote:
> 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(-)
>
> --
> 1.8.3.1
>
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-26 11:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 12:17 [Qemu-devel] [PATCH 0/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:17 ` [Qemu-devel] [PATCH 1/2] block: Allow bdrv_unref_child(bs, NULL) Kevin Wolf
2015-10-13 12:22 ` Jeff Cody
2015-10-13 12:17 ` [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path Kevin Wolf
2015-10-13 12:35 ` Jeff Cody
2015-10-26 11:26 ` [Qemu-devel] [Qemu-block] [PATCH 0/2] " Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).