]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm vdo indexer: validate saved zone count
authorMatthew Sakai <msakai@redhat.com>
Wed, 11 Feb 2026 15:05:54 +0000 (10:05 -0500)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Mar 2026 15:37:43 +0000 (16:37 +0100)
Verify that the loaded zone count is in the valid range
before using it as a loop iterator.

Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-vdo/indexer/index-layout.c

index 61edf2b72427ddf2695584104407d551a60664b7..37144249f7ba6b860e2d2fa721c550aab533071e 100644 (file)
@@ -1445,6 +1445,9 @@ static int __must_check reconstruct_index_save(struct index_save_layout *isl,
        u64 last_block = next_block + isl->index_save.block_count;
 
        isl->zone_count = table->header.region_count - 3;
+       if (isl->zone_count > MAX_ZONES)
+               return vdo_log_error_strerror(UDS_CORRUPT_DATA,
+                                             "invalid zone count");
 
        last_region = &table->regions[table->header.region_count - 1];
        if (last_region->kind == RL_KIND_EMPTY) {