]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/amd_nb: Fix boot crash on non-AMD systems
authorBorislav Petkov <bp@suse.de>
Thu, 16 Jun 2016 17:13:49 +0000 (19:13 +0200)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:22:04 +0000 (17:22 -0500)
commit3f50ffcbf8bce5d3c52aeeea3efcf63c22db68bc
tree2a5f25e8f4057efe0c99b02ae8a993413139d0f8
parent560ecdda5858ce3ecad9f56bf967b394a5672ef1
x86/amd_nb: Fix boot crash on non-AMD systems

Orabug: 25308095

[ Upstream commit 1ead852dd88779eda12cb09cc894a03d9abfe1ec ]

Fix boot crash that triggers if this driver is built into a kernel and
run on non-AMD systems.

AMD northbridges users call amd_cache_northbridges() and it returns
a negative value to signal that we weren't able to cache/detect any
northbridges on the system.

At least, it should do so as all its callers expect it to do so. But it
does return a negative value only when kmalloc() fails.

Fix it to return -ENODEV if there are no NBs cached as otherwise, amd_nb
users like amd64_edac, for example, which relies on it to know whether
it should load or not, gets loaded on systems like Intel Xeons where it
shouldn't.

Reported-and-tested-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1466097230-5333-2-git-send-email-bp@alien8.de
Link: https://lkml.kernel.org/r/5761BEB0.9000807@cybernetics.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
(cherry picked from commit 784110017ee4dc5e9bbbe29a712993803afdb3fd)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
arch/x86/kernel/amd_nb.c