Skip to content

Commit 98bc07d

Browse files
Vladimir Sementsov-OgievskiyXanClic
authored andcommitted
qcow2-refcount: check_refcounts_l1(): check reserved bits
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Eric Blake <[email protected]> Tested-by: Kirill Tkhai <[email protected]> Reviewed-by: Hanna Reitz <[email protected]> Message-Id: <[email protected]> Signed-off-by: Hanna Reitz <[email protected]>
1 parent cd6efd6 commit 98bc07d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

block/qcow2-refcount.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,12 @@ static int check_refcounts_l1(BlockDriverState *bs,
19021902
continue;
19031903
}
19041904

1905+
if (l1_table[i] & L1E_RESERVED_MASK) {
1906+
fprintf(stderr, "ERROR found L1 entry with reserved bits set: "
1907+
"%" PRIx64 "\n", l1_table[i]);
1908+
res->corruptions++;
1909+
}
1910+
19051911
l2_offset = l1_table[i] & L1E_OFFSET_MASK;
19061912

19071913
/* Mark L2 table as used */

block/qcow2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ typedef enum QCow2MetadataOverlap {
586586
(QCOW2_OL_CACHED | QCOW2_OL_INACTIVE_L2)
587587

588588
#define L1E_OFFSET_MASK 0x00fffffffffffe00ULL
589+
#define L1E_RESERVED_MASK 0x7f000000000001ffULL
589590
#define L2E_OFFSET_MASK 0x00fffffffffffe00ULL
590591
#define L2E_STD_RESERVED_MASK 0x3f000000000001feULL
591592

0 commit comments

Comments
 (0)