Skip to content

Commit 6b79a42

Browse files
author
Mike Snitzer
committed
dm integrity: call kmem_cache_destroy() in dm_integrity_init() error path
Otherwise the journal_io_cache will leak if dm_register_target() fails. Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@kernel.org>
1 parent 6827af4 commit 6b79a42

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/md/dm-integrity.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4703,11 +4703,13 @@ static int __init dm_integrity_init(void)
47034703
}
47044704

47054705
r = dm_register_target(&integrity_target);
4706-
4707-
if (r < 0)
4706+
if (r < 0) {
47084707
DMERR("register failed %d", r);
4708+
kmem_cache_destroy(journal_io_cache);
4709+
return r;
4710+
}
47094711

4710-
return r;
4712+
return 0;
47114713
}
47124714

47134715
static void __exit dm_integrity_exit(void)

0 commit comments

Comments
 (0)