Commit b3929b2c authored by Matthew Sakai's avatar Matthew Sakai Committed by Mikulas Patocka
Browse files

dm vdo slab-depot: validate old zone count on load



Verify the old zone count has a valid value before using
it to compute slab summary entry offsets.

Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
parent 9e809bb1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);