aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Fernandes (Google) <joel@joelfernandes.org>2018-10-17 06:13:55 -0400
committerKees Cook <keescook@chromium.org>2018-10-22 10:11:58 -0400
commit416031653eb55f844e3547fb8f8576399a800da0 (patch)
tree34316a8c8acabd4ece304c2374ef87084aa41d81
parentcb095afd44768bf495894b9ad063bd078e4bb201 (diff)
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: cb3bee0369bc ("pstore: Use crypto compress API") [kees: trivial rebase] Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: Guenter Roeck <groeck@chromium.org>
-rw-r--r--fs/pstore/platform.c10
-rw-r--r--fs/pstore/ram.c2
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index d61e26812af6..578f178a695f 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -786,13 +786,21 @@ static int __init pstore_init(void)
786 786
787 pstore_choose_compression(); 787 pstore_choose_compression();
788 788
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
789 ret = pstore_init_fs(); 797 ret = pstore_init_fs();
790 if (ret) 798 if (ret)
791 return ret; 799 return ret;
792 800
793 return 0; 801 return 0;
794} 802}
795module_init(pstore_init) 803late_initcall(pstore_init);
796 804
797static void __exit pstore_exit(void) 805static void __exit pstore_exit(void)
798{ 806{
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index bbd1e357c23d..98e48d1a9776 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -940,7 +940,7 @@ static int __init ramoops_init(void)
940 ramoops_register_dummy(); 940 ramoops_register_dummy();
941 return platform_driver_register(&ramoops_driver); 941 return platform_driver_register(&ramoops_driver);
942} 942}
943late_initcall(ramoops_init); 943postcore_initcall(ramoops_init);
944 944
945static void __exit ramoops_exit(void) 945static void __exit ramoops_exit(void)
946{ 946{