diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2009-10-29 16:45:52 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-10 07:46:09 +0300 |
commit | 506f90eeae682dc96c11c7aefac0262b3a560b49 (patch) | |
tree | f151440e5c91bfdf9957941bd94dc8d7b42e0356 | |
parent | de2a47cf2b3f59ef9664b277f4021b91af13598e (diff) | |
download | linux-506f90eeae682dc96c11c7aefac0262b3a560b49.tar.xz |
x86, amd-ucode: Check UCODE_MAGIC before loading the container file
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
LKML-Reference: <20091029134552.GC30802@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 366baa179913..f4c538b681ca 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -317,6 +317,12 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device) return UCODE_NFOUND; } + if (*(u32 *)firmware->data != UCODE_MAGIC) { + printk(KERN_ERR "microcode: invalid UCODE_MAGIC (0x%08x)\n", + *(u32 *)firmware->data); + return UCODE_ERROR; + } + ret = generic_load_microcode(cpu, firmware->data, firmware->size); release_firmware(firmware); |