]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.45/pstore-allocate-compression-during-late_initcall.patch
Linux 4.19.45
[thirdparty/kernel/stable-queue.git] / releases / 4.19.45 / pstore-allocate-compression-during-late_initcall.patch
CommitLineData
4463d21a
GKH
1From 416031653eb55f844e3547fb8f8576399a800da0 Mon Sep 17 00:00:00 2001
2From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
3Date: Wed, 17 Oct 2018 03:13:55 -0700
4Subject: pstore: Allocate compression during late_initcall()
5
6From: Joel Fernandes (Google) <joel@joelfernandes.org>
7
8commit 416031653eb55f844e3547fb8f8576399a800da0 upstream.
9
10ramoops's call of pstore_register() was recently moved to run during
11late_initcall() because the crypto backend may not have been ready during
12postcore_initcall(). This meant early-boot crash dumps were not getting
13caught by pstore any more.
14
15Instead, lets allow calls to pstore_register() earlier, and once crypto
16is ready we can initialize the compression.
17
18Reported-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
19Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
20Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
21Fixes: cb3bee0369bc ("pstore: Use crypto compress API")
22[kees: trivial rebase]
23Signed-off-by: Kees Cook <keescook@chromium.org>
24Tested-by: Guenter Roeck <groeck@chromium.org>
25Signed-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 {