projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9d9d69
)
x86/mce/AMD: Make the init code more robust
author
Thomas Gleixner
<
[email protected]
>
Mon, 26 Dec 2016 21:58:20 +0000
(22:58 +0100)
committer
Linus Torvalds
<
[email protected]
>
Tue, 27 Dec 2016 01:30:24 +0000
(17:30 -0800)
If mce_device_init() fails then the mce device pointer is NULL and the
AMD mce code happily dereferences it.
Add a sanity check.
Reported-by: Markus Trippelsdorf <
[email protected]
>
Reported-by: Boris Ostrovsky <
[email protected]
>
Signed-off-by: Thomas Gleixner <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
arch/x86/kernel/cpu/mcheck/mce_amd.c
patch
|
blob
|
history
diff --git
a/arch/x86/kernel/cpu/mcheck/mce_amd.c
b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index ffacfdcacb85eafd145228d0e0d3e4765b2177ea..a5fd137417a27278f49f3cf0b60803997176a665 100644
(file)
--- a/
arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/
arch/x86/kernel/cpu/mcheck/mce_amd.c
@@
-1182,6
+1182,9
@@
static int threshold_create_bank(unsigned int cpu, unsigned int bank)
const char *name = get_name(bank, NULL);
int err = 0;
+ if (!dev)
+ return -ENODEV;
+
if (is_shared_bank(bank)) {
nb = node_to_amd_nb(amd_get_nb_id(cpu));