Skip to content

Commit 9c21ea5

Browse files
committed
x86/microcode/intel: Set new revision only after a successful update
This was meant to be done only when early microcode got updated successfully. Move it into the if-branch. Also, make sure the current revision is read unconditionally and only once. Fixes: 080990a ("x86/microcode: Rework early revisions reporting") Reported-by: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Ashok Raj <ashok.raj@intel.com> Link: https://lore.kernel.org/r/ZWjVt5dNRjbcvlzR@a4bf019067fa.jf.intel.com
1 parent 1f693ef commit 9c21ea5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • arch/x86/kernel/cpu/microcode

arch/x86/kernel/cpu/microcode/intel.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,14 @@ static __init struct microcode_intel *get_microcode_blob(struct ucode_cpu_info *
370370
{
371371
struct cpio_data cp;
372372

373+
intel_collect_cpu_info(&uci->cpu_sig);
374+
373375
if (!load_builtin_intel_microcode(&cp))
374376
cp = find_microcode_in_initrd(ucode_path);
375377

376378
if (!(cp.data && cp.size))
377379
return NULL;
378380

379-
intel_collect_cpu_info(&uci->cpu_sig);
380-
381381
return scan_microcode(cp.data, cp.size, uci, save);
382382
}
383383

@@ -410,13 +410,13 @@ void __init load_ucode_intel_bsp(struct early_load_data *ed)
410410
{
411411
struct ucode_cpu_info uci;
412412

413-
ed->old_rev = intel_get_microcode_revision();
414-
415413
uci.mc = get_microcode_blob(&uci, false);
416-
if (uci.mc && apply_microcode_early(&uci) == UCODE_UPDATED)
417-
ucode_patch_va = UCODE_BSP_LOADED;
414+
ed->old_rev = uci.cpu_sig.rev;
418415

419-
ed->new_rev = uci.cpu_sig.rev;
416+
if (uci.mc && apply_microcode_early(&uci) == UCODE_UPDATED) {
417+
ucode_patch_va = UCODE_BSP_LOADED;
418+
ed->new_rev = uci.cpu_sig.rev;
419+
}
420420
}
421421

422422
void load_ucode_intel_ap(void)

0 commit comments

Comments
 (0)