diff mbox

[v4,04/17] qcow2/overlaps: Protect image header

Message ID 1430766953-6913-5-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz May 4, 2015, 7:15 p.m. UTC
Enter the image header into the metadata list to protect it against
accidental modifications.

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

Patch

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);