]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/microcode: microcode_write() should not reference boot_cpu_data
authorAnkur Arora <ankur.a.arora@oracle.com>
Wed, 25 Apr 2018 21:55:02 +0000 (17:55 -0400)
committerBrian Maly <brian.maly@oracle.com>
Tue, 8 May 2018 19:58:57 +0000 (15:58 -0400)
microcode_write() internally calls the AMD or Intel microcode
update logic, both of which update the cpu_data(cpu)->microcode
value. For probing speculation features however, we call
init_scattered_cpuid_features() with boot_cpu_data which is stale
and might have an old value of microcode version.

Fix this by using cpu_data() instead.

Orabug: 27878230

Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry-picked from commit ea35f733dca011782ef2a3647e7f3ac284dbed2e)

Conflict:
  arch/x86/kernel/cpu/microcode/core.c

[Backport: modify arch/x86/kernel/microcode_core.c instead.]

Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/microcode/core.c

index e953faddb47f52bd08da95fecb444487b05b0ffb..0bdc1bbbf2c321639cddae0cf9851dd8aa40ce50 100644 (file)
@@ -234,7 +234,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
                perf_check_microcode();
 
        /* check spec_ctrl capabilities */
-       init_scattered_cpuid_features(&boot_cpu_data, GET_CPU_CAP_FULL);
+       init_scattered_cpuid_features(&cpu_data(0), GET_CPU_CAP_FULL);
 
        mutex_unlock(&microcode_mutex);
        put_online_cpus();