1 |
From 98b8e4e5c17bf87c1b18ed929472051dab39878c Mon Sep 17 00:00:00 2001 |
2 |
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> |
3 |
Date: Wed, 3 Jan 2018 12:49:29 +0100 |
4 |
Subject: [PATCH] platform/x86: wmi: Call acpi_wmi_init() later |
5 |
|
6 |
Calling acpi_wmi_init() at the subsys_initcall() level causes ordering |
7 |
issues to appear on some systems and they are difficult to reproduce, |
8 |
because there is no guaranteed ordering between subsys_initcall() |
9 |
calls, so they may occur in different orders on different systems. |
10 |
|
11 |
In particular, commit 86d9f48534e8 (mm/slab: fix kmemcg cache |
12 |
creation delayed issue) exposed one of these issues where genl_init() |
13 |
and acpi_wmi_init() are both called at the same initcall level, but |
14 |
the former must run before the latter so as to avoid a NULL pointer |
15 |
dereference. |
16 |
|
17 |
For this reason, move the acpi_wmi_init() invocation to the |
18 |
initcall_sync level which should still be early enough for things |
19 |
to work correctly in the WMI land. |
20 |
|
21 |
Link: https://marc.info/?t=151274596700002&r=1&w=2 |
22 |
Reported-by: Jonathan McDowell <noodles@earth.li> |
23 |
Reported-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> |
24 |
Tested-by: Jonathan McDowell <noodles@earth.li> |
25 |
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
26 |
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> |
27 |
--- |
28 |
drivers/platform/x86/wmi.c | 2 +- |
29 |
1 file changed, 1 insertion(+), 1 deletion(-) |
30 |
|
31 |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c |
32 |
index 791449a2370f..daa68acbc900 100644 |
33 |
--- a/drivers/platform/x86/wmi.c |
34 |
+++ b/drivers/platform/x86/wmi.c |
35 |
@@ -1268,5 +1268,5 @@ static void __exit acpi_wmi_exit(void) |
36 |
bus_unregister(&wmi_bus_type); |
37 |
} |
38 |
|
39 |
-subsys_initcall(acpi_wmi_init); |
40 |
+subsys_initcall_sync(acpi_wmi_init); |
41 |
module_exit(acpi_wmi_exit); |