summaryrefslogtreecommitdiff
path: root/drivers/md/dm-integrity.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-04-04 20:34:28 +0300
committerMike Snitzer <snitzer@kernel.org>2023-04-04 20:39:25 +0300
commit6b79a428c02769f2a11f8ae76bf866226d134887 (patch)
tree096b5ed62b1d7e4ebe07fcbf36b4feb05f3b62d8 /drivers/md/dm-integrity.c
parent6827af4a9a9f5bb664c42abf7c11af4978d72201 (diff)
downloadlinux-6b79a428c02769f2a11f8ae76bf866226d134887.tar.xz
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>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r--drivers/md/dm-integrity.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index b0d5057fbdd9..54830b07b829 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -4703,11 +4703,13 @@ static int __init dm_integrity_init(void)
}
r = dm_register_target(&integrity_target);
-
- if (r < 0)
+ if (r < 0) {
DMERR("register failed %d", r);
+ kmem_cache_destroy(journal_io_cache);
+ return r;
+ }
- return r;
+ return 0;
}
static void __exit dm_integrity_exit(void)