Skip to contentSkip to conversation

Patch "dm space map common: add bounds check to sm_ll_lookup_bitmap()" has been added to the 5.4-stable tree

dm-devel Sasha Levin 1 participant 1 message Jan 23, 2022 Device mapper

lore
Share & tools
lore

Sasha Levin

author Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dm space map common: add bounds check to sm_ll_lookup_bitmap()

to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dm-space-map-common-add-bounds-check-to-sm_ll_lookup.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

commit fa3b4db21e9ed73b98ffb1ccdbb4f58671bb1044

Author: Joe Thornber <[email protected]>
Date:   Fri Dec 10 13:49:53 2021 +0000

dm space map common: add bounds check to sm_ll_lookup_bitmap()

[ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ]

Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap().

drivers/md/persistent-data/dm-space-map-common.c +5 -0
index a213bf11738fb..85853ab629717 100644
@@ -281,6 +281,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result)
 	struct disk_index_entry ie_disk;
 	struct dm_block *blk;
 
+	if (b >= ll->nr_blocks) {
+		DMERR_LIMIT("metadata block out of bounds");
+		return -EINVAL;
+	}
+
 	b = do_div(index, ll->entries_per_block);
 	r = ll->load_ie(ll, index, &ie_disk);
 	if (r < 0)

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel