diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-07-19 19:59:38 +0200 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2012-08-03 20:45:56 +0200 |
commit | b5975917a3e5f93b5d1c95561aab0aa44327baea (patch) | |
tree | aa2e9ffd6ba21164f2d891224552bed72ae4655a /arch/x86 | |
parent | x86: mce: Disable preemption when calling raise_local() (diff) | |
download | linux-b5975917a3e5f93b5d1c95561aab0aa44327baea.tar.xz linux-b5975917a3e5f93b5d1c95561aab0aa44327baea.zip |
x86: mce: Serialize mce injection
raise_mce() fiddles with global state, but lacks any kind of
serialization.
Add a mutex around the raise_mce() call, so concurrent writers do not
stomp on each other toes.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce-inject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c index 753746f6dbd8..ddc72f839332 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-inject.c +++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c @@ -78,6 +78,7 @@ static void raise_exception(struct mce *m, struct pt_regs *pregs) } static cpumask_var_t mce_inject_cpumask; +static DEFINE_MUTEX(mce_inject_mutex); static int mce_raise_notify(unsigned int cmd, struct pt_regs *regs) { @@ -229,7 +230,10 @@ static ssize_t mce_write(struct file *filp, const char __user *ubuf, * so do it a jiffie or two later everywhere. */ schedule_timeout(2); + + mutex_lock(&mce_inject_mutex); raise_mce(&m); + mutex_unlock(&mce_inject_mutex); return usize; } |