summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2021-11-24 12:07:39 -0500
committerMike Snitzer <snitzer@redhat.com>2021-11-24 12:07:39 -0500
commit1b8d2789dad0005fd5e7d35dab26a8e1203fb6da (patch)
tree6c49bc3e43d996b4a88f2e32201cd47465902ab5
parent136057256686de39cc3a07c2e39ef6bc43003ff6 (diff)
dm btree remove: fix use after free in rebalance_children()
Move dm_tm_unlock() after dm_tm_dec(). Cc: stable@vger.kernel.org Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/persistent-data/dm-btree-remove.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c
index 70532335c7c7..cb670f16e98e 100644
--- a/drivers/md/persistent-data/dm-btree-remove.c
+++ b/drivers/md/persistent-data/dm-btree-remove.c
@@ -423,9 +423,9 @@ static int rebalance_children(struct shadow_spine *s,
memcpy(n, dm_block_data(child),
dm_bm_block_size(dm_tm_get_bm(info->tm)));
- dm_tm_unlock(info->tm, child);
dm_tm_dec(info->tm, dm_block_location(child));
+ dm_tm_unlock(info->tm, child);
return 0;
}