All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] Patch "dm space map common: add bounds check to sm_ll_lookup_bitmap()" has been added to the 4.4-stable tree
@ 2022-01-23 16:49 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2022-01-23 16:49 UTC (permalink / raw)
  To: stable-commits, ejt; +Cc: dm-devel, Mike Snitzer, Alasdair Kergon

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 4.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-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.



commit 163211e460901c820ba9c4a78c1b38457b6e92c6
Author: Joe Thornber <ejt@redhat.com>
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().
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c
index ca09ad2a639c4..6fa4a68e78b0d 100644
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -279,6 +279,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
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-23 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 16:49 [dm-devel] Patch "dm space map common: add bounds check to sm_ll_lookup_bitmap()" has been added to the 4.4-stable tree Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.