[PATCH 1/2] x86/microcode/intel: Save microcode patch unconditionally

From: Borislav Petkov
Date: Sat Apr 21 2018 - 04:20:08 EST


From: Borislav Petkov <bp@xxxxxxx>

save_mc_for_early() was a no-op on !CONFIG_HOTPLUG_CPU but the
generic_load_microcode() path saves the microcode patches it has found
into our cache of patches which is used for late loading too. Regardless
of whether we do CPU hotplug or not.

So make the saving unconditional so that late loading can find the
proper patch.

Reported-by: Vitezslav Samel <vitezslav@xxxxxxxx>
Tested-by: Vitezslav Samel <vitezslav@xxxxxxxx>
Tested-by: Ashok Raj <ashok.raj@xxxxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # if it has backported d8c3b52c00a05036e0a6b315b4b17921a7b67997
Link: http://lkml.kernel.org/r/20180418081140.GA2439@xxxxxxxxxxxxxx
---
arch/x86/kernel/cpu/microcode/intel.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 32b8e5724f96..1c2cfa0644aa 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -485,7 +485,6 @@ static void show_saved_mc(void)
*/
static void save_mc_for_early(u8 *mc, unsigned int size)
{
-#ifdef CONFIG_HOTPLUG_CPU
/* Synchronization during CPU hotplug. */
static DEFINE_MUTEX(x86_cpu_microcode_mutex);

@@ -495,7 +494,6 @@ static void save_mc_for_early(u8 *mc, unsigned int size)
show_saved_mc();

mutex_unlock(&x86_cpu_microcode_mutex);
-#endif
}

static bool load_builtin_intel_microcode(struct cpio_data *cp)
--
2.13.0