@@ -43,6 +43,7 @@
#define BME_RESERVED_FLAGS 0xfffffffc
#define BME_FLAG_IN_USE 1
#define BME_FLAG_AUTO (1U << 1)
+#define BME_FLAG_EXTRA_DATA_COMPATIBLE (1U << 1)
/* bits [1, 8] U [56, 63] are reserved */
#define BME_TABLE_ENTRY_RESERVED_MASK 0xff000000000001fe
@@ -331,6 +332,13 @@ static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs, QCow2Bitmap *bm,
return NULL;
}
+ if (!(bmh->flags & BME_FLAG_EXTRA_DATA_COMPATIBLE) &&
+ bmh->extra_data_size != 0) {
+ error_setg(errp, "Uncompatible extra data found for bitmap '%s'",
+ bm->name);
+ return NULL;
+ }
+
bitmap_table = g_try_malloc(bmh->bitmap_table_size * sizeof(uint64_t));
if (bitmap_table == NULL) {
error_setg_errno(errp, -ENOMEM,
If this flag is unset and exta data present the bitmap should be read-only. For now just return error for this case. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- block/qcow2-dirty-bitmap.c | 8 ++++++++ 1 file changed, 8 insertions(+)