Skip to content

Commit

Permalink
pstore: Allocate compression during late_initcall()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Joel Fernandes (Google) <[email protected]>
Tested-by: Sai Prakash Ranjan <[email protected]>
Fixes: cb3bee0 ("pstore: Use crypto compress API")
[kees: trivial rebase]
Signed-off-by: Kees Cook <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
  • Loading branch information
joelagnel authored and kees committed Oct 22, 2018
1 parent cb095af commit 4160316
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,13 +786,21 @@ static int __init pstore_init(void)

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();
if (ret)
return ret;

return 0;
}
module_init(pstore_init)
late_initcall(pstore_init);

static void __exit pstore_exit(void)
{
Expand Down
2 changes: 1 addition & 1 deletion fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ static int __init ramoops_init(void)
ramoops_register_dummy();
return platform_driver_register(&ramoops_driver);
}
late_initcall(ramoops_init);
postcore_initcall(ramoops_init);

static void __exit ramoops_exit(void)
{
Expand Down

0 comments on commit 4160316

Please sign in to comment.