Skip to content

Commit cccd033

Browse files
committed
Merge tag 'for-6.15/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mikulas Patocka: - fix reading past the end of allocated memory - fix missing dm_put_live_table() in dm_keyslot_evict() * tag 'for-6.15/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: fix copying after src array boundaries dm: add missing unlock on in dm_keyslot_evict()
2 parents 01f9550 + f1aff4b commit cccd033

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/md/dm-table.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,9 @@ static char **realloc_argv(unsigned int *size, char **old_argv)
524524
}
525525
argv = kmalloc_array(new_size, sizeof(*argv), gfp);
526526
if (argv) {
527-
*size = new_size;
528527
if (old_argv)
529528
memcpy(argv, old_argv, *size * sizeof(*argv));
529+
*size = new_size;
530530
}
531531

532532
kfree(old_argv);
@@ -1173,7 +1173,7 @@ static int dm_keyslot_evict(struct blk_crypto_profile *profile,
11731173

11741174
t = dm_get_live_table(md, &srcu_idx);
11751175
if (!t)
1176-
return 0;
1176+
goto put_live_table;
11771177

11781178
for (unsigned int i = 0; i < t->num_targets; i++) {
11791179
struct dm_target *ti = dm_table_get_target(t, i);
@@ -1184,6 +1184,7 @@ static int dm_keyslot_evict(struct blk_crypto_profile *profile,
11841184
(void *)key);
11851185
}
11861186

1187+
put_live_table:
11871188
dm_put_live_table(md, srcu_idx);
11881189
return 0;
11891190
}

0 commit comments

Comments
 (0)