* [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed
@ 2020-02-04 13:07 qiwuchen55
2020-02-04 13:07 ` [PATCH 2/2] pstore/ram: remove unnecessary ramoops_unregister_dummy() qiwuchen55
0 siblings, 1 reply; 2+ messages in thread
From: qiwuchen55 @ 2020-02-04 13:07 UTC (permalink / raw)
To: keescook, anton, ccross, tony.luck; +Cc: linux-kernel, chenqiwu
From: chenqiwu <chenqiwu@xiaomi.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@xiaomi.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] pstore/ram: remove unnecessary ramoops_unregister_dummy()
2020-02-04 13:07 [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed qiwuchen55
@ 2020-02-04 13:07 ` qiwuchen55
0 siblings, 0 replies; 2+ messages in thread
From: qiwuchen55 @ 2020-02-04 13:07 UTC (permalink / raw)
To: keescook, anton, ccross, tony.luck; +Cc: linux-kernel, chenqiwu
From: chenqiwu <chenqiwu@xiaomi.com>
Remove unnecessary ramoops_unregister_dummy() if ramoops
platform device register failed.
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
fs/pstore/ram.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 013486b..7956221 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -963,7 +963,6 @@ static void __init ramoops_register_dummy(void)
pr_info("could not create platform device: %ld\n",
PTR_ERR(dummy));
dummy = NULL;
- ramoops_unregister_dummy();
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-04 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 13:07 [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed qiwuchen55
2020-02-04 13:07 ` [PATCH 2/2] pstore/ram: remove unnecessary ramoops_unregister_dummy() qiwuchen55
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).