Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2990
-gerrit
commit aeb285408b849f9542f84e94e92946c195749fed Author: Vladimir Serbinenko phcoder@gmail.com Date: Sat Mar 30 12:04:23 2013 +0100
Intel: Return on missing microcode file to fix null pointer dereference
Selecting `CPU_MICROCODE_IN_CBFS` in Kconfig but not having the microcode blob `cpu_microcode_blob.bin` in CBFS results in a null pointer dereference later on resulting in a crash.
for(c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
Fix this by returning if `microcode_updates` is `NULL`, that means no file is found.
This patch is successfully tested on the Lenovo X201.
Change-Id: I6e18fd37256910bf047061e4633a66cf29ad7b69 Signed-off-by: Vladimir Serbinenko phcoder@gmail.com Signed-off-by: Paul Menzel paulepanter@users.sourceforge.net --- src/cpu/intel/microcode/microcode.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index d908c25..82ab7a2 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -130,6 +130,9 @@ const void *intel_microcode_find(void) CBFS_TYPE_MICROCODE); #endif
+ /* No need for explicit error message since the user already gets + "file not found" from cbfs. + */ if (!microcode_updates) return microcode_updates;
@@ -202,6 +205,9 @@ void intel_update_microcode(const void *microcode_updates) const char *c; msr_t msr;
+ if (!microcode_updates) + return; + /* CPUID sets MSR 0x8B iff a microcode update has been loaded. */ msr.lo = 0; msr.hi = 0;