Skip to content

Commit

Permalink
x86: cpuid: propagate error from smp_call_function_single()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H. Peter Anvin committed Aug 26, 2008
1 parent c6f3193 commit 4b46ca7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/x86/kernel/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,17 @@ 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 */

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;
Expand Down

0 comments on commit 4b46ca7

Please sign in to comment.