Commit 2b7547578b9fdf811072cfc0c3594eb370e7d219
Committed by
Martin Schwidefsky
1 parent
50bb1f761e
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
s390/lgr: Add init check to lgr_info_log()
If lgr has not been initialized, the lgr_info_log() function currently crashes because 'lgr_page' is not allocated. To fix this 'lgr_page' is allocated statically now. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Showing 1 changed file with 5 additions and 10 deletions Side-by-side Diff
arch/s390/kernel/lgr.c
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | /* |
46 | 46 | * LGR globals |
47 | 47 | */ |
48 | -static void *lgr_page; | |
48 | +static char lgr_page[PAGE_SIZE] __aligned(PAGE_SIZE); | |
49 | 49 | static struct lgr_info lgr_info_last; |
50 | 50 | static struct lgr_info lgr_info_cur; |
51 | 51 | static struct debug_info *lgr_dbf; |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | */ |
75 | 75 | static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) |
76 | 76 | { |
77 | - struct sysinfo_1_1_1 *si = lgr_page; | |
77 | + struct sysinfo_1_1_1 *si = (void *) lgr_page; | |
78 | 78 | |
79 | 79 | if (stsi(si, 1, 1, 1) == -ENOSYS) |
80 | 80 | return; |
... | ... | @@ -91,7 +91,7 @@ |
91 | 91 | */ |
92 | 92 | static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) |
93 | 93 | { |
94 | - struct sysinfo_2_2_2 *si = lgr_page; | |
94 | + struct sysinfo_2_2_2 *si = (void *) lgr_page; | |
95 | 95 | |
96 | 96 | if (stsi(si, 2, 2, 2) == -ENOSYS) |
97 | 97 | return; |
... | ... | @@ -105,7 +105,7 @@ |
105 | 105 | */ |
106 | 106 | static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) |
107 | 107 | { |
108 | - struct sysinfo_3_2_2 *si = lgr_page; | |
108 | + struct sysinfo_3_2_2 *si = (void *) lgr_page; | |
109 | 109 | int i; |
110 | 110 | |
111 | 111 | if (stsi(si, 3, 2, 2) == -ENOSYS) |
112 | 112 | |
113 | 113 | |
... | ... | @@ -183,14 +183,9 @@ |
183 | 183 | */ |
184 | 184 | static int __init lgr_init(void) |
185 | 185 | { |
186 | - lgr_page = (void *) __get_free_pages(GFP_KERNEL, 0); | |
187 | - if (!lgr_page) | |
188 | - return -ENOMEM; | |
189 | 186 | lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info)); |
190 | - if (!lgr_dbf) { | |
191 | - free_page((unsigned long) lgr_page); | |
187 | + if (!lgr_dbf) | |
192 | 188 | return -ENOMEM; |
193 | - } | |
194 | 189 | debug_register_view(lgr_dbf, &debug_hex_ascii_view); |
195 | 190 | lgr_info_get(&lgr_info_last); |
196 | 191 | debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); |