[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510102014.640012135@linuxfoundation.org>
Date: Mon, 10 May 2021 12:21:31 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Joe Thornber <ejt@...hat.com>,
Ming-Hung Tsai <mtsai@...hat.com>,
Mike Snitzer <snitzer@...hat.com>
Subject: [PATCH 5.10 294/299] dm space map common: fix division bug in sm_ll_find_free_block()
From: Joe Thornber <ejt@...hat.com>
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: stable@...r.kernel.org
Signed-off-by: Joe Thornber <ejt@...hat.com>
Tested-by: Ming-Hung Tsai <mtsai@...hat.com>
Signed-off-by: Mike Snitzer <snitzer@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/md/persistent-data/dm-space-map-common.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -339,6 +339,8 @@ int sm_ll_find_free_block(struct ll_disk
*/
begin = do_div(index_begin, ll->entries_per_block);
end = do_div(end, ll->entries_per_block);
+ if (end == 0)
+ end = ll->entries_per_block;
for (i = index_begin; i < index_end; i++, begin = 0) {
struct dm_block *blk;
Powered by blists - more mailing lists