]> git.baikalelectronics.ru Git - kernel.git/commit
x86, msr: fix NULL pointer deref due to msr_open on nonexistent CPUs
authorDarrick J. Wong <djwong@us.ibm.com>
Thu, 14 Aug 2008 22:43:33 +0000 (15:43 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 15 Aug 2008 11:38:30 +0000 (13:38 +0200)
commit312e9d8a1ca6eeec51f6eed0e2b902039c80b0c1
treec11b892999c65d8b1d805191f88b15bf4a058be2
parentc54833c494b8b7f322f1ef34bd7ef33b4bdf8c2b
x86, msr: fix NULL pointer deref due to msr_open on nonexistent CPUs

msr_open tests for someone trying to open a device for a nonexistent CPU.
However, the function always returns 0, not ret like it should, hence
userspace can BUG the kernel trivially.  This bug was introduced by the
cdev lock_kernel pushdown patch last May.

The BUG can be reproduced with these commands:

# mknod fubar c 202 8 <-- pick a number less than NR_CPUS that is not
                          the number of an online CPU
# cat fubar

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/msr.c