]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm vdo slab-depot: validate old zone count on load
authorMatthew Sakai <msakai@redhat.com>
Wed, 11 Feb 2026 15:05:55 +0000 (10:05 -0500)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Mar 2026 15:37:59 +0000 (16:37 +0100)
Verify the old zone count has a valid value before using
it to compute slab summary entry offsets.

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

index 034ecaa51f481761f86ff483ba49428ad829bc02..ad00afc2c168d897992a49e21a335733b35ecee6 100644 (file)
@@ -4262,6 +4262,10 @@ int vdo_decode_slab_depot(struct slab_depot_state_2_0 state, struct vdo *vdo,
        }
        slab_size_shift = ilog2(slab_size);
 
+       if (state.zone_count > MAX_VDO_PHYSICAL_ZONES)
+               return vdo_log_error_strerror(UDS_CORRUPT_DATA,
+                                             "invalid zone count");
+
        result = vdo_allocate_extended(struct slab_depot,
                                       vdo->thread_config.physical_zone_count,
                                       struct block_allocator, __func__, &depot);