diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-12 10:40:11 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-12 10:40:11 -0800 |
| commit | 49008f0cc1ef0b86ccfa0d1d99e67741d46bd35b (patch) | |
| tree | cdd2a2502f4980e9db586b38647329f9daee37c4 /drivers/md/persistent-data/dm-space-map-common.c | |
| parent | c9193f48e94deaeff0c9abbc67b9584e8ddc42ed (diff) | |
| parent | eaac0b590a47c717ef36cbfd1c528cd154c965a1 (diff) | |
Merge tag 'for-5.17/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper updates from Mike Snitzer:
- Fixes and improvements to dm btree and dm space map code in
persistent-data library used by thinp and cache.
- Update DM integrity to use struct_group() to zero struct
journal_sector.
- Update DM sysfs to use default_groups in kobj_type.
* tag 'for-5.17/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm sysfs: use default_groups in kobj_type
dm integrity: Use struct_group() to zero struct journal_sector
dm space map common: add bounds check to sm_ll_lookup_bitmap()
dm btree: add a defensive bounds check to insert_at()
dm btree remove: change a bunch of BUG_ON() calls to proper errors
dm btree spine: eliminate duplicate le32_to_cpu() in node_check()
dm btree spine: remove extra node_check function declaration
Diffstat (limited to 'drivers/md/persistent-data/dm-space-map-common.c')
| -rw-r--r-- | drivers/md/persistent-data/dm-space-map-common.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c index 4a6a2a9b4eb4..bfbfa750e016 100644 --- 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) |
