Skip to content

Commit a104a5e

Browse files
jthornbergregkh
authored andcommitted
dm space map common: fix division bug in sm_ll_find_free_block()
commit 5208692e80a1f3c8ce2063a22b675dd5589d1d80 upstream. This division bug meant the search for free metadata space could skip the final allocation bitmap's worth of entries. Fix affects DM thinp, cache and era targets. Cc: [email protected] Signed-off-by: Joe Thornber <[email protected]> Tested-by: Ming-Hung Tsai <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6b1d9e1 commit a104a5e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/persistent-data/dm-space-map-common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ int sm_ll_find_free_block(struct ll_disk *ll, dm_block_t begin,
337337
*/
338338
begin = do_div(index_begin, ll->entries_per_block);
339339
end = do_div(end, ll->entries_per_block);
340+
if (end == 0)
341+
end = ll->entries_per_block;
340342

341343
for (i = index_begin; i < index_end; i++, begin = 0) {
342344
struct dm_block *blk;

0 commit comments

Comments
 (0)