x86/microcode: Fix the ancient deprecated microcode loading method
authorBorislav Petkov <bp@suse.de>
Thu, 4 Apr 2019 20:14:07 +0000 (22:14 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 10 Apr 2019 20:41:24 +0000 (22:41 +0200)
Commit

  2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present")

added the new define UCODE_NEW to denote that an update should happen
only when newer microcode (than installed on the system) has been found.

But it missed adjusting that for the old /dev/cpu/microcode loading
interface. Fix it.

Fixes: 2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present")
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jann Horn <jannh@google.com>
Link: https://lkml.kernel.org/r/20190405133010.24249-3-bp@alien8.de
arch/x86/kernel/cpu/microcode/core.c

index 5260185cbf7ba1a77ecc30bdd61a99a2338b159b..8a4a7823451acf2d9d9668f0ddf2a29af3a444f9 100644 (file)
@@ -418,8 +418,9 @@ static int do_microcode_update(const void __user *buf, size_t size)
                if (ustate == UCODE_ERROR) {
                        error = -1;
                        break;
-               } else if (ustate == UCODE_OK)
+               } else if (ustate == UCODE_NEW) {
                        apply_microcode_on_target(cpu);
+               }
        }
 
        return error;