]>
Commit | Line | Data |
---|---|---|
4463d21a GKH |
1 | From 416031653eb55f844e3547fb8f8576399a800da0 Mon Sep 17 00:00:00 2001 |
2 | From: "Joel Fernandes (Google)" <joel@joelfernandes.org> | |
3 | Date: Wed, 17 Oct 2018 03:13:55 -0700 | |
4 | Subject: pstore: Allocate compression during late_initcall() | |
5 | ||
6 | From: Joel Fernandes (Google) <joel@joelfernandes.org> | |
7 | ||
8 | commit 416031653eb55f844e3547fb8f8576399a800da0 upstream. | |
9 | ||
10 | ramoops's call of pstore_register() was recently moved to run during | |
11 | late_initcall() because the crypto backend may not have been ready during | |
12 | postcore_initcall(). This meant early-boot crash dumps were not getting | |
13 | caught by pstore any more. | |
14 | ||
15 | Instead, lets allow calls to pstore_register() earlier, and once crypto | |
16 | is ready we can initialize the compression. | |
17 | ||
18 | Reported-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> | |
19 | Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> | |
20 | Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> | |
21 | Fixes: cb3bee0369bc ("pstore: Use crypto compress API") | |
22 | [kees: trivial rebase] | |
23 | Signed-off-by: Kees Cook <keescook@chromium.org> | |
24 | Tested-by: Guenter Roeck <groeck@chromium.org> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
26 | ||
27 | --- | |
28 | fs/pstore/platform.c | 10 +++++++++- | |
29 | fs/pstore/ram.c | 2 +- | |
30 | 2 files changed, 10 insertions(+), 2 deletions(-) | |
31 | ||
32 | --- a/fs/pstore/platform.c | |
33 | +++ b/fs/pstore/platform.c | |
34 | @@ -786,13 +786,21 @@ static int __init pstore_init(void) | |
35 | ||
36 | pstore_choose_compression(); | |
37 | ||
38 | + /* | |
39 | + * Check if any pstore backends registered earlier but did not | |
40 | + * initialize compression because crypto was not ready. If so, | |
41 | + * initialize compression now. | |
42 | + */ | |
43 | + if (psinfo && !tfm) | |
44 | + allocate_buf_for_compression(); | |
45 | + | |
46 | ret = pstore_init_fs(); | |
47 | if (ret) | |
48 | return ret; | |
49 | ||
50 | return 0; | |
51 | } | |
52 | -module_init(pstore_init) | |
53 | +late_initcall(pstore_init); | |
54 | ||
55 | static void __exit pstore_exit(void) | |
56 | { | |
57 | --- a/fs/pstore/ram.c | |
58 | +++ b/fs/pstore/ram.c | |
59 | @@ -956,7 +956,7 @@ static int __init ramoops_init(void) | |
60 | ||
61 | return ret; | |
62 | } | |
63 | -late_initcall(ramoops_init); | |
64 | +postcore_initcall(ramoops_init); | |
65 | ||
66 | static void __exit ramoops_exit(void) | |
67 | { |