Skip to content

Commit

Permalink
x86, amd-ucode: Check UCODE_MAGIC before loading the container file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Borislav Petkov authored and Ingo Molnar committed Nov 10, 2009
1 parent de2a47c commit 506f90e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 506f90e

Please sign in to comment.