summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2025-04-30 11:05:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-18 08:24:46 +0200
commitb32411f0459d2e069d9ab7b989d11bf4bf72524b (patch)
tree0ab0e02c64dcdb68ac375ab792552a22a7cd729b /drivers/md
parentf08cdc6cc92e3d23a05745f0f12f8caa348a27b4 (diff)
downloadlinux-b32411f0459d2e069d9ab7b989d11bf4bf72524b.tar.gz
linux-b32411f0459d2e069d9ab7b989d11bf4bf72524b.tar.bz2
linux-b32411f0459d2e069d9ab7b989d11bf4bf72524b.zip
dm: add missing unlock on in dm_keyslot_evict()
commit 650266ac4c7230c89bcd1307acf5c9c92cfa85e2 upstream. We need to call dm_put_live_table() even if dm_get_live_table() returns NULL. Fixes: 9355a9eb21a5 ("dm: support key eviction from keyslot managers of underlying devices") Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 9cacc49f2cb0..3dc5bc3d29d6 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1183,7 +1183,7 @@ static int dm_keyslot_evict(struct blk_crypto_profile *profile,
t = dm_get_live_table(md, &srcu_idx);
if (!t)
- return 0;
+ goto put_live_table;
for (unsigned int i = 0; i < t->num_targets; i++) {
struct dm_target *ti = dm_table_get_target(t, i);
@@ -1194,6 +1194,7 @@ static int dm_keyslot_evict(struct blk_crypto_profile *profile,
(void *)key);
}
+put_live_table:
dm_put_live_table(md, srcu_idx);
return 0;
}