Skip to content
  • Borislav Petkov's avatar
    x86/microcode: Fix loading precedence · 6c545647
    Borislav Petkov authored
    
    
    So it can happen that even with builtin microcode,
    CONFIG_BLK_DEV_INITRD=y gets forgotten enabled.
    
    Or, even with that disabled, an initrd image gets supplied by the boot
    loader, by omission or is simply forgotten there. And since we do look
    at boot_params.hdr.ramdisk_* to know whether we have received an initrd,
    we might get puzzled.
    
    So let's just make the loader look for builtin microcode first and if
    found, ignore the ramdisk image.
    
    If no builtin found, it falls back to scanning the supplied initrd, of
    course.
    
    For that, we move all the initrd scanning in a separate
    __scan_microcode_initrd() function and fall back to it only if
    load_builtin_intel_microcode() has failed.
    
    Reported-and-tested-by: default avatarGabriel Craciunescu <nix.or.die@gmail.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1465225850-7352-2-git-send-email-bp@alien8.de
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6c545647