Skip to content

Commit

Permalink
dm: add missing unlock on in dm_keyslot_evict()
Browse files Browse the repository at this point in the history
We need to call dm_put_live_table() even if dm_get_live_table() returns
NULL.

Fixes: 9355a9e ("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>
  • Loading branch information
Dan Carpenter authored and Mikulas Patocka committed Apr 30, 2025
1 parent 5a2a6c4 commit 650266a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,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);
Expand All @@ -1184,6 +1184,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;
}
Expand Down

0 comments on commit 650266a

Please sign in to comment.