Enter the image header into the metadata list to protect it against
accidental modifications.

Signed-off-by: Max Reitz <mre...@redhat.com>
Reviewed-by: Eric Blake <ebl...@redhat.com>
---
 block/qcow2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index b15a612..fc53b34 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -766,6 +766,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, 
int flags,
         }
     }
 
+    qcow2_metadata_list_enter(bs, 0, 1, QCOW2_OL_MAIN_HEADER);
+
     s->refcount_table_offset = header.refcount_table_offset;
     s->refcount_table_size =
         header.refcount_table_clusters << (s->cluster_bits - 3);
-- 
2.3.7


Reply via email to