mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] x86/microcode: Handle negative microcode revisions
@ 2018-10-20 14:41 Andi Kleen
  2018-10-20 17:41 ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2018-10-20 14:41 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Andi Kleen, stable

From: Andi Kleen <ak@linux.intel.com>

The Intel microcode revision space is unsigned. Inside Intel there are special
microcodes that have the highest bit set, and they are considered to have
a higher revision than any microcodes that don't have this bit set.

The function comparing the microcode revision in the Linux driver compares
u32 with int, which ends up being signed extended to long on 64bit
systems. This results in these highest bit set microcode revision not loading
because their revision appears negative and smaller than the
existing microcode.

Change the comparison to unsigned. With that the loading works
as expected.

Cc: stable@vger.kernel.org # Any supported stable
Signed-off-by: Andi Kleen <ak@linux.intel.com>
--
v2: White space changes.
---
 arch/x86/kernel/cpu/microcode/intel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 16936a24795c..e54d402500d3 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -93,7 +93,8 @@ static int find_matching_signature(void *mc, unsigned int csig, int cpf)
 /*
  * Returns 1 if update has been found, 0 otherwise.
  */
-static int has_newer_microcode(void *mc, unsigned int csig, int cpf, int new_rev)
+static int has_newer_microcode(void *mc, unsigned int csig, int cpf,
+			       unsigned new_rev)
 {
 	struct microcode_header_intel *mc_hdr = mc;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-25 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-20 14:41 [PATCH v2] x86/microcode: Handle negative microcode revisions Andi Kleen
2018-10-20 17:41 ` Borislav Petkov
2018-10-25 23:51   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome