Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed5f6f8d authored by Borislav Petkov's avatar Borislav Petkov Committed by Greg Kroah-Hartman
Browse files

x86/mce-inject: Reset injection struct after injection



[ 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: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20180905081954.10391-1-bp@alien8.de


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1190bbd4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -108,6 +108,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. */
@@ -576,6 +579,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;
}