projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
85bca3c
)
dm space map common: add bounds check to sm_ll_lookup_bitmap()
author
Joe Thornber
<ejt@redhat.com>
Fri, 10 Dec 2021 13:49:53 +0000
(13:49 +0000)
committer
Mike Snitzer
<snitzer@redhat.com>
Tue, 4 Jan 2022 18:58:19 +0000
(13:58 -0500)
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>
drivers/md/persistent-data/dm-space-map-common.c
patch
|
blob
|
history
diff --git
a/drivers/md/persistent-data/dm-space-map-common.c
b/drivers/md/persistent-data/dm-space-map-common.c
index
4a6a2a9
..
bfbfa75
100644
(file)
--- a/
drivers/md/persistent-data/dm-space-map-common.c
+++ b/
drivers/md/persistent-data/dm-space-map-common.c
@@
-283,6
+283,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)