]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86/mce-inject: Reset injection struct after injection
authorBorislav Petkov <bp@suse.de>
Tue, 4 Sep 2018 09:22:12 +0000 (11:22 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:45 +0000 (13:16 +0100)
BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit 7401a633c34adc7aefd3edfec60074cb0475a3e8 ]

Clear the MCE struct which is used for collecting the injection details
after injection.

Also, populate it with more details from the machine.

Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20180905081954.10391-1-bp@alien8.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/x86/kernel/cpu/mcheck/mce-inject.c

index 6c2b53f74a2a07022d5a106a00d29dae6d0fee26..e57b59762f9f5f7b33126cea9de96c4dfd8eaf02 100644 (file)
@@ -106,6 +106,9 @@ static void setup_inj_struct(struct mce *m)
        memset(m, 0, sizeof(struct mce));
 
        m->cpuvendor = boot_cpu_data.x86_vendor;
+       m->time      = ktime_get_real_seconds();
+       m->cpuid     = cpuid_eax(1);
+       m->microcode = boot_cpu_data.microcode;
 }
 
 /* Update fake mce registers on current CPU. */
@@ -580,6 +583,9 @@ static int inj_bank_set(void *data, u64 val)
        m->bank = val;
        do_inject();
 
+       /* Reset injection struct */
+       setup_inj_struct(&i_mce);
+
        return 0;
 }