From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [PATCH 2/2] block/qcow2: zero data_file child after free
Date: Mon, 16 Mar 2020 09:06:31 +0300 [thread overview]
Message-ID: <20200316060631.30052-3-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20200316060631.30052-1-vsementsov@virtuozzo.com>
data_file being NULL doesn't seem to be a correct state, but it's
better than dead pointer and simpler to debug.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/qcow2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index d44b45633d..6cdefe059f 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1758,6 +1758,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
g_free(s->image_data_file);
if (has_data_file(bs)) {
bdrv_unref_child(bs, s->data_file);
+ s->data_file = NULL;
}
g_free(s->unknown_header_fields);
cleanup_unknown_header_ext(bs);
@@ -2621,6 +2622,7 @@ static void qcow2_close(BlockDriverState *bs)
if (has_data_file(bs)) {
bdrv_unref_child(bs, s->data_file);
+ s->data_file = NULL;
}
qcow2_refcount_close(bs);
--
2.21.0
next prev parent reply other threads:[~2020-03-16 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 6:06 [PATCH 0/2] zero pointer after bdrv_unref_child Vladimir Sementsov-Ogievskiy
2020-03-16 6:06 ` [PATCH 1/2] block: bdrv_set_backing_bs: fix use-after-free Vladimir Sementsov-Ogievskiy
2020-03-16 8:47 ` Philippe Mathieu-Daudé
2020-03-16 17:37 ` John Snow
2020-03-16 6:06 ` Vladimir Sementsov-Ogievskiy [this message]
2020-03-16 17:48 ` [PATCH 2/2] block/qcow2: zero data_file child after free John Snow
2020-03-23 14:11 ` [PATCH 0/2] zero pointer after bdrv_unref_child Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200316060631.30052-3-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).