summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchenqiwu <chenqiwu@xiaomi.com>2020-02-07 10:46:39 +0100
committerKees Cook <keescook@chromium.org>2020-02-25 20:13:18 +0100
commit8a57d6d4ddfa41c49014e20493152c41a38fcbf8 (patch)
treeb8d5621a193cba199800996085be4ba096370dd9
parentLinux 5.6-rc2 (diff)
downloadlinux-8a57d6d4ddfa41c49014e20493152c41a38fcbf8.tar.xz
linux-8a57d6d4ddfa41c49014e20493152c41a38fcbf8.zip
pstore/platform: fix potential mem leak if pstore_init_fs failed
There is a potential mem leak when pstore_init_fs failed, since the pstore compression maybe unlikey to initialized successfully. We must clean up the allocation once this unlikey issue happens. Signed-off-by: chenqiwu <chenqiwu@xiaomi.com> Link: https://lore.kernel.org/r/1581068800-13817-1-git-send-email-qiwuchen55@gmail.com Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--fs/pstore/platform.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index d896457e7c11..408277ee3cdb 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -823,9 +823,9 @@ static int __init pstore_init(void)
ret = pstore_init_fs();
if (ret)
- return ret;
+ free_buf_for_compression();
- return 0;
+ return ret;
}
late_initcall(pstore_init);