summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-25 17:28:20 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-25 17:45:48 -0700
commit4b46ca701bdcdc19fcf32823f9fcabf8236e4e78 (patch)
treeb32c91552aa74f55381d591bc3a6787164899ac7
parentc6f31932d0a1d2b13952f506ebc92675e2d8df80 (diff)
downloadop-kernel-dev-4b46ca701bdcdc19fcf32823f9fcabf8236e4e78.zip
op-kernel-dev-4b46ca701bdcdc19fcf32823f9fcabf8236e4e78.tar.gz
x86: cpuid: propagate error from smp_call_function_single()
Propagate error (-ENXIO) from smp_call_function_single() in the CPUID driver. This can happen when a CPU is unplugged while the CPUID driver is open. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--arch/x86/kernel/cpuid.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 14b11b3..23e8316 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -89,6 +89,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
struct cpuid_regs cmd;
int cpu = iminor(file->f_path.dentry->d_inode);
u64 pos = *ppos;
+ int err;
if (count % 16)
return -EINVAL; /* Invalid chunk size */
@@ -96,7 +97,9 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
for (; count; count -= 16) {
cmd.eax = pos;
cmd.ecx = pos >> 32;
- smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1);
+ err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1);
+ if (err)
+ return err;
if (copy_to_user(tmp, &cmd, 16))
return -EFAULT;
tmp += 16;
OpenPOWER on IntegriCloud