Blame linux-kernel-patches/13-09e182d17e8891dd73baba961a0f5a82e9274c97.patch

Packit 863535
From 09e182d17e8891dd73baba961a0f5a82e9274c97 Mon Sep 17 00:00:00 2001
Packit 863535
From: Borislav Petkov <bp@suse.de>
Packit 863535
Date: Sat, 21 Apr 2018 10:19:30 +0200
Packit 863535
Subject: x86/microcode: Do not exit early from __reload_late()
Packit 863535

Packit 863535
Vitezslav reported a case where the
Packit 863535

Packit 863535
  "Timeout during microcode update!"
Packit 863535

Packit 863535
panic would hit. After a deeper look, it turned out that his .config had
Packit 863535
CONFIG_HOTPLUG_CPU disabled which practically made save_mc_for_early() a
Packit 863535
no-op.
Packit 863535

Packit 863535
When that happened, the discovered microcode patch wasn't saved into the
Packit 863535
cache and the late loading path wouldn't find any.
Packit 863535

Packit 863535
This, then, lead to early exit from __reload_late() and thus CPUs waiting
Packit 863535
until the timeout is reached, leading to the panic.
Packit 863535

Packit 863535
In hindsight, that function should have been written so it does not return
Packit 863535
before the post-synchronization. Oh well, I know better now...
Packit 863535

Packit 863535
Fixes: bb8c13d61a62 ("x86/microcode: Fix CPU synchronization routine")
Packit 863535
Reported-by: Vitezslav Samel <vitezslav@samel.cz>
Packit 863535
Signed-off-by: Borislav Petkov <bp@suse.de>
Packit 863535
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Packit 863535
Tested-by: Vitezslav Samel <vitezslav@samel.cz>
Packit 863535
Tested-by: Ashok Raj <ashok.raj@intel.com>
Packit 863535
Cc: stable@vger.kernel.org
Packit 863535
Link: http://lkml.kernel.org/r/20180418081140.GA2439@pc11.op.pod.cz
Packit 863535
Link: https://lkml.kernel.org/r/20180421081930.15741-2-bp@alien8.de
Packit 863535
---
Packit 863535
 arch/x86/kernel/cpu/microcode/core.c | 6 ++----
Packit 863535
 1 file changed, 2 insertions(+), 4 deletions(-)
Packit 863535

Packit 863535
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
Packit 863535
index 10c4fc2..77e2013 100644
Packit 863535
--- a/arch/x86/kernel/cpu/microcode/core.c
Packit 863535
+++ b/arch/x86/kernel/cpu/microcode/core.c
Packit 863535
@@ -564,14 +564,12 @@ static int __reload_late(void *info)
Packit 863535
 	apply_microcode_local(&err;;
Packit 863535
 	spin_unlock(&update_lock);
Packit 863535
 
Packit 863535
+	/* siblings return UCODE_OK because their engine got updated already */
Packit 863535
 	if (err > UCODE_NFOUND) {
Packit 863535
 		pr_warn("Error reloading microcode on CPU %d\n", cpu);
Packit 863535
-		return -1;
Packit 863535
-	/* siblings return UCODE_OK because their engine got updated already */
Packit 863535
+		ret = -1;
Packit 863535
 	} else if (err == UCODE_UPDATED || err == UCODE_OK) {
Packit 863535
 		ret = 1;
Packit 863535
-	} else {
Packit 863535
-		return ret;
Packit 863535
 	}
Packit 863535
 
Packit 863535
 	/*
Packit 863535
-- 
Packit 863535
cgit v1.1
Packit 863535