Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i8k: Fix non-SMP operation

Commit f36fdb9f0266 (i8k: Force SMM to run on CPU 0) adds support
for multi-core CPUs to the driver. Unfortunately, that causes it
to fail loading if compiled without SMP support, at least on
32 bit kernels. Kernel log shows "i8k: unable to get SMM Dell
signature", and function i8k_smm is found to return -EINVAL.

Testing revealed that the culprit is the missing return value check
of set_cpus_allowed_ptr.

Fixes: f36fdb9f0266 (i8k: Force SMM to run on CPU 0)
Reported-by: Jim Bos <jim876@xs4all.nl>
Tested-by: Jim Bos <jim876@xs4all.nl>
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Andreas Mohr <andi@lisas.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Guenter Roeck and committed by
Greg Kroah-Hartman
6d827fbc 9bd2d0df

+3 -1
+3 -1
drivers/char/i8k.c
··· 138 138 if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) 139 139 return -ENOMEM; 140 140 cpumask_copy(old_mask, &current->cpus_allowed); 141 - set_cpus_allowed_ptr(current, cpumask_of(0)); 141 + rc = set_cpus_allowed_ptr(current, cpumask_of(0)); 142 + if (rc) 143 + goto out; 142 144 if (smp_processor_id() != 0) { 143 145 rc = -EBUSY; 144 146 goto out;