mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
dm space map common: add bounds check to sm_ll_lookup_bitmap()
[ Upstream commit cba23ac158
]
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>
This commit is contained in:
parent
74b16f895b
commit
cda3458337
1 changed files with 5 additions and 0 deletions
|
@ -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 disk_index_entry ie_disk;
|
||||||
struct dm_block *blk;
|
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);
|
b = do_div(index, ll->entries_per_block);
|
||||||
r = ll->load_ie(ll, index, &ie_disk);
|
r = ll->load_ie(ll, index, &ie_disk);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
Loading…
Reference in a new issue