提交 e680190d 编写于 作者: J Joel Fernandes (Google) 提交者: Xie XiuQi

pstore: Allocate compression during late_initcall()

mainline inclusion
from mainline-4.20
commit 416031653eb5
category: bugfix
bugzilla: 5899
CVE: NA

-------------------------------------------------

ramoops's call of pstore_register() was recently moved to run during
late_initcall() because the crypto backend may not have been ready during
postcore_initcall(). This meant early-boot crash dumps were not getting
caught by pstore any more.

Instead, lets allow calls to pstore_register() earlier, and once crypto
is ready we can initialize the compression.
Reported-by: NSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
Tested-by: NSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Fixes: cb3bee03 ("pstore: Use crypto compress API")
[kees: trivial rebase]
Signed-off-by: NKees Cook <keescook@chromium.org>
Tested-by: NGuenter Roeck <groeck@chromium.org>
Signed-off-by: NHou Tao <houtao1@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 68bc9e88
...@@ -786,13 +786,21 @@ static int __init pstore_init(void) ...@@ -786,13 +786,21 @@ static int __init pstore_init(void)
pstore_choose_compression(); pstore_choose_compression();
/*
* Check if any pstore backends registered earlier but did not
* initialize compression because crypto was not ready. If so,
* initialize compression now.
*/
if (psinfo && !tfm)
allocate_buf_for_compression();
ret = pstore_init_fs(); ret = pstore_init_fs();
if (ret) if (ret)
return ret; return ret;
return 0; return 0;
} }
module_init(pstore_init) late_initcall(pstore_init);
static void __exit pstore_exit(void) static void __exit pstore_exit(void)
{ {
......
...@@ -956,7 +956,7 @@ static int __init ramoops_init(void) ...@@ -956,7 +956,7 @@ static int __init ramoops_init(void)
return ret; return ret;
} }
late_initcall(ramoops_init); postcore_initcall(ramoops_init);
static void __exit ramoops_exit(void) static void __exit ramoops_exit(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册