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>

+4 -1
+4 -1
arch/x86/kernel/cpuid.c
··· 89 struct cpuid_regs cmd; 90 int cpu = iminor(file->f_path.dentry->d_inode); 91 u64 pos = *ppos; 92 93 if (count % 16) 94 return -EINVAL; /* Invalid chunk size */ ··· 97 for (; count; count -= 16) { 98 cmd.eax = pos; 99 cmd.ecx = pos >> 32; 100 - smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); 101 if (copy_to_user(tmp, &cmd, 16)) 102 return -EFAULT; 103 tmp += 16;
··· 89 struct cpuid_regs cmd; 90 int cpu = iminor(file->f_path.dentry->d_inode); 91 u64 pos = *ppos; 92 + int err; 93 94 if (count % 16) 95 return -EINVAL; /* Invalid chunk size */ ··· 96 for (; count; count -= 16) { 97 cmd.eax = pos; 98 cmd.ecx = pos >> 32; 99 + err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); 100 + if (err) 101 + return err; 102 if (copy_to_user(tmp, &cmd, 16)) 103 return -EFAULT; 104 tmp += 16;