]>
Commit | Line | Data |
---|---|---|
1dc68eea GKH |
1 | From 47512cfd0d7a8bd6ab71d01cd89fca19eb2093eb Mon Sep 17 00:00:00 2001 |
2 | From: Thomas Gleixner <tglx@linutronix.de> | |
3 | Date: Wed, 15 Feb 2017 11:11:50 +0100 | |
4 | Subject: x86/platform/goldfish: Prevent unconditional loading | |
5 | ||
6 | From: Thomas Gleixner <tglx@linutronix.de> | |
7 | ||
8 | commit 47512cfd0d7a8bd6ab71d01cd89fca19eb2093eb upstream. | |
9 | ||
10 | The goldfish platform code registers the platform device unconditionally | |
11 | which causes havoc in several ways if the goldfish_pdev_bus driver is | |
12 | enabled: | |
13 | ||
14 | - Access to the hardcoded physical memory region, which is either not | |
15 | available or contains stuff which is completely unrelated. | |
16 | ||
17 | - Prevents that the interrupt of the serial port can be requested | |
18 | ||
19 | - In case of a spurious interrupt it goes into a infinite loop in the | |
20 | interrupt handler of the pdev_bus driver (which needs to be fixed | |
21 | seperately). | |
22 | ||
23 | Add a 'goldfish' command line option to make the registration opt-in when | |
24 | the platform is compiled in. | |
25 | ||
26 | I'm seriously grumpy about this engineering trainwreck, which has seven | |
27 | SOBs from Intel developers for 50 lines of code. And none of them figured | |
28 | out that this is broken. Impressive fail! | |
29 | ||
30 | Fixes: ddd70cf93d78 ("goldfish: platform device for x86") | |
31 | Reported-by: Gabriel C <nix.or.die@gmail.com> | |
32 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
33 | Acked-by: Linus Torvalds <torvalds@linux-foundation.org> | |
34 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
35 | ||
36 | --- | |
37 | Documentation/kernel-parameters.txt | 4 ++++ | |
38 | arch/x86/platform/goldfish/goldfish.c | 14 +++++++++++++- | |
39 | 2 files changed, 17 insertions(+), 1 deletion(-) | |
40 | ||
41 | --- a/Documentation/kernel-parameters.txt | |
42 | +++ b/Documentation/kernel-parameters.txt | |
43 | @@ -1391,6 +1391,10 @@ bytes respectively. Such letter suffixes | |
44 | When zero, profiling data is discarded and associated | |
45 | debugfs files are removed at module unload time. | |
46 | ||
47 | + goldfish [X86] Enable the goldfish android emulator platform. | |
48 | + Don't use this when you are not running on the | |
49 | + android emulator | |
50 | + | |
51 | gpt [EFI] Forces disk with valid GPT signature but | |
52 | invalid Protective MBR to be treated as GPT. If the | |
53 | primary GPT is corrupted, it enables the backup/alternate | |
54 | --- a/arch/x86/platform/goldfish/goldfish.c | |
55 | +++ b/arch/x86/platform/goldfish/goldfish.c | |
56 | @@ -42,10 +42,22 @@ static struct resource goldfish_pdev_bus | |
57 | } | |
58 | }; | |
59 | ||
60 | +static bool goldfish_enable __initdata; | |
61 | + | |
62 | +static int __init goldfish_setup(char *str) | |
63 | +{ | |
64 | + goldfish_enable = true; | |
65 | + return 0; | |
66 | +} | |
67 | +__setup("goldfish", goldfish_setup); | |
68 | + | |
69 | static int __init goldfish_init(void) | |
70 | { | |
71 | + if (!goldfish_enable) | |
72 | + return -ENODEV; | |
73 | + | |
74 | platform_device_register_simple("goldfish_pdev_bus", -1, | |
75 | - goldfish_pdev_bus_resources, 2); | |
76 | + goldfish_pdev_bus_resources, 2); | |
77 | return 0; | |
78 | } | |
79 | device_initcall(goldfish_init); |