diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-08-25 20:28:20 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-08-25 20:45:48 -0400 |
commit | 4b46ca701bdcdc19fcf32823f9fcabf8236e4e78 (patch) | |
tree | b32c91552aa74f55381d591bc3a6787164899ac7 /arch | |
parent | c6f31932d0a1d2b13952f506ebc92675e2d8df80 (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpuid.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 14b11b3be31c..23e8316c8357 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, | |||
89 | struct cpuid_regs cmd; | 89 | struct cpuid_regs cmd; |
90 | int cpu = iminor(file->f_path.dentry->d_inode); | 90 | int cpu = iminor(file->f_path.dentry->d_inode); |
91 | u64 pos = *ppos; | 91 | u64 pos = *ppos; |
92 | int err; | ||
92 | 93 | ||
93 | if (count % 16) | 94 | if (count % 16) |
94 | return -EINVAL; /* Invalid chunk size */ | 95 | return -EINVAL; /* Invalid chunk size */ |
@@ -96,7 +97,9 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
96 | for (; count; count -= 16) { | 97 | for (; count; count -= 16) { |
97 | cmd.eax = pos; | 98 | cmd.eax = pos; |
98 | cmd.ecx = pos >> 32; | 99 | cmd.ecx = pos >> 32; |
99 | smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); | 100 | err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); |
101 | if (err) | ||
102 | return err; | ||
100 | if (copy_to_user(tmp, &cmd, 16)) | 103 | if (copy_to_user(tmp, &cmd, 16)) |
101 | return -EFAULT; | 104 | return -EFAULT; |
102 | tmp += 16; | 105 | tmp += 16; |