Skip to content

Commit 4160316

Browse files
joelagnelkees
authored andcommitted
pstore: Allocate compression during late_initcall()
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: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> Fixes: cb3bee0 ("pstore: Use crypto compress API") [kees: trivial rebase] Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: Guenter Roeck <groeck@chromium.org>
1 parent cb095af commit 4160316

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

fs/pstore/platform.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,21 @@ static int __init pstore_init(void)
786786

787787
pstore_choose_compression();
788788

789+
/*
790+
* Check if any pstore backends registered earlier but did not
791+
* initialize compression because crypto was not ready. If so,
792+
* initialize compression now.
793+
*/
794+
if (psinfo && !tfm)
795+
allocate_buf_for_compression();
796+
789797
ret = pstore_init_fs();
790798
if (ret)
791799
return ret;
792800

793801
return 0;
794802
}
795-
module_init(pstore_init)
803+
late_initcall(pstore_init);
796804

797805
static void __exit pstore_exit(void)
798806
{

fs/pstore/ram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ static int __init ramoops_init(void)
940940
ramoops_register_dummy();
941941
return platform_driver_register(&ramoops_driver);
942942
}
943-
late_initcall(ramoops_init);
943+
postcore_initcall(ramoops_init);
944944

945945
static void __exit ramoops_exit(void)
946946
{

0 commit comments

Comments
 (0)