Skip to content

Commit 9ddf6d3

Browse files
Ivan AbramovMikulas Patocka
authored andcommitted
dm vdo: return error on corrupted metadata in start_restoring_volume functions
The return values of VDO_ASSERT calls that validate metadata are not acted upon. Return UDS_CORRUPT_DATA in case of an error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: a4eb7e2 ("dm vdo: implement the volume index") Signed-off-by: Ivan Abramov <[email protected]> Reviewed-by: Matthew Sakai <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent e828a18 commit 9ddf6d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/dm-vdo/indexer/volume-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ static int start_restoring_volume_sub_index(struct volume_sub_index *sub_index,
836836
"%zu bytes decoded of %zu expected", offset,
837837
sizeof(buffer));
838838
if (result != VDO_SUCCESS)
839-
result = UDS_CORRUPT_DATA;
839+
return UDS_CORRUPT_DATA;
840840

841841
if (memcmp(header.magic, MAGIC_START_5, MAGIC_SIZE) != 0) {
842842
return vdo_log_warning_strerror(UDS_CORRUPT_DATA,
@@ -928,7 +928,7 @@ static int start_restoring_volume_index(struct volume_index *volume_index,
928928
"%zu bytes decoded of %zu expected", offset,
929929
sizeof(buffer));
930930
if (result != VDO_SUCCESS)
931-
result = UDS_CORRUPT_DATA;
931+
return UDS_CORRUPT_DATA;
932932

933933
if (memcmp(header.magic, MAGIC_START_6, MAGIC_SIZE) != 0)
934934
return vdo_log_warning_strerror(UDS_CORRUPT_DATA,

0 commit comments

Comments
 (0)