summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-25 17:27:21 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-25 17:45:48 -0700
commitc6f31932d0a1d2b13952f506ebc92675e2d8df80 (patch)
treef08e31afb69ca52e8ba8a1cca316b12bd7bec365 /arch/x86/kernel
parentf73be6dedf4fa058ce80846dae604b08fa805ca1 (diff)
x86: msr: propagate errors from smp_call_function_single()
Propagate error (-ENXIO) from smp_call_function_single(). These errors can happen when a CPU is unplugged while the MSR driver is open. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/msr.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index e4393808688..9c34a1005db 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -79,8 +79,11 @@ static ssize_t msr_read(struct file *file, char __user *buf,
for (; count; count -= 8) {
err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]);
- if (err)
- return -EIO;
+ if (err) {
+ if (err == -EFAULT) /* Fix idiotic error code */
+ err = -EIO;
+ return err;
+ }
if (copy_to_user(tmp, &data, 8))
return -EFAULT;
tmp += 2;
@@ -105,8 +108,11 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
if (copy_from_user(&data, tmp, 8))
return -EFAULT;
err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]);
- if (err)
- return -EIO;
+ if (err) {
+ if (err == -EFAULT) /* Fix idiotic error code */
+ err = -EIO;
+ return err;
+ }
tmp += 2;
}