summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-integrity.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-04-04 19:34:28 +0200
committerMike Snitzer <snitzer@kernel.org>2023-04-04 19:39:25 +0200
commit6b79a428c02769f2a11f8ae76bf866226d134887 (patch)
tree096b5ed62b1d7e4ebe07fcbf36b4feb05f3b62d8 /drivers/md/dm-integrity.c
parentdm clone: call kmem_cache_destroy() in dm_clone_init() error path (diff)
downloadlinux-6b79a428c02769f2a11f8ae76bf866226d134887.tar.xz
linux-6b79a428c02769f2a11f8ae76bf866226d134887.zip
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)