[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1580821634-15246-1-git-send-email-qiwuchen55@gmail.com>
Date: Tue, 4 Feb 2020 21:07:13 +0800
From: qiwuchen55@...il.com
To: keescook@...omium.org, anton@...msg.org, ccross@...roid.com,
tony.luck@...el.com
Cc: linux-kernel@...r.kernel.org, chenqiwu <chenqiwu@...omi.com>
Subject: [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed
From: chenqiwu <chenqiwu@...omi.com>
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@...omi.com>
---
fs/pstore/platform.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index d896457..114dbdf15 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -822,10 +822,10 @@ static int __init pstore_init(void)
allocate_buf_for_compression();
ret = pstore_init_fs();
- if (ret)
- return ret;
+ if (ret < 0)
+ free_buf_for_compression();
- return 0;
+ return ret;
}
late_initcall(pstore_init);
--
1.9.1
Powered by blists - more mailing lists