[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/6] block/qcow2: zero data_file child after free
From: |
Max Reitz |
Subject: |
[PULL 4/6] block/qcow2: zero data_file child after free |
Date: |
Tue, 24 Mar 2020 13:20:42 +0100 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index e08917ed84..d1da3d91db 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.25.1
- [PULL 0/6] Block patches for 5.0-rc0, Max Reitz, 2020/03/24
- [PULL 1/6] block: Avoid memleak on qcow2 image info failure, Max Reitz, 2020/03/24
- [PULL 2/6] block: Assert BlockDriver::format_name is not NULL, Max Reitz, 2020/03/24
- [PULL 3/6] block: bdrv_set_backing_bs: fix use-after-free, Max Reitz, 2020/03/24
- [PULL 4/6] block/qcow2: zero data_file child after free,
Max Reitz <=
- [PULL 5/6] iotests: Fix cleanup path in some tests, Max Reitz, 2020/03/24
- [PULL 6/6] iotests/026: Move v3-exclusive test to new file, Max Reitz, 2020/03/24
- Re: [PULL 0/6] Block patches for 5.0-rc0, Peter Maydell, 2020/03/24