Skip to content

Commit

Permalink
x86/microcode/intel: Check if microcode was found before applying
Browse files Browse the repository at this point in the history
We should check the return value of the routines fishing out the proper
microcode and not try to apply if we haven't found a suitable blob.

Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Borislav Petkov committed Mar 2, 2015
1 parent d496a00 commit 776d3cd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions arch/x86/kernel/cpu/microcode/intel_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,10 @@ _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,

ret = load_microcode(mc_saved_data, mc_saved_in_initrd,
initrd_start_early, uci);
if (ret != UCODE_OK)
return;

if (ret == UCODE_OK)
apply_microcode_early(uci, true);
apply_microcode_early(uci, true);
}

void __init
Expand Down Expand Up @@ -769,6 +770,7 @@ void load_ucode_intel_ap(void)
struct ucode_cpu_info uci;
unsigned long *mc_saved_in_initrd_p;
unsigned long initrd_start_addr;
enum ucode_state ret;
#ifdef CONFIG_X86_32
unsigned long *initrd_start_p;

Expand All @@ -791,8 +793,12 @@ void load_ucode_intel_ap(void)
return;

collect_cpu_info_early(&uci);
load_microcode(mc_saved_data_p, mc_saved_in_initrd_p,
initrd_start_addr, &uci);
ret = load_microcode(mc_saved_data_p, mc_saved_in_initrd_p,
initrd_start_addr, &uci);

if (ret != UCODE_OK)
return;

apply_microcode_early(&uci, true);
}

Expand Down

0 comments on commit 776d3cd

Please sign in to comment.