]> git.karo-electronics.de Git - karo-tx-linux.git/commit
powerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe
authorAnton Blanchard <anton@samba.org>
Wed, 10 Aug 2011 20:44:24 +0000 (20:44 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:44:40 +0000 (09:44 -0800)
commit7bd46f22875431f4ec2a21cefd1aecf80193b6d7
tree1a4717a08e1c5942a5bba8b3450c2eec8fa4367b
parent9d99c1d2bd6aedb02a70d2cb9f1edb0b416a443e
powerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe

commit a11940978bd598e65996b4f807cf4904793f7025 upstream.

If we echo an address the hypervisor doesn't like to
/sys/devices/system/memory/probe we oops the box:

# echo 0x10000000000 > /sys/devices/system/memory/probe

kernel BUG at arch/powerpc/mm/hash_utils_64.c:541!

The backtrace is:

create_section_mapping
arch_add_memory
add_memory
memory_probe_store
sysdev_class_store
sysfs_write_file
vfs_write
SyS_write

In create_section_mapping we BUG if htab_bolt_mapping returned
an error. A better approach is to return an error which will
propagate back to userspace.

Rerunning the test with this patch applied:

# echo 0x10000000000 > /sys/devices/system/memory/probe
-bash: echo: write error: Invalid argument

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/powerpc/include/asm/sparsemem.h
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/mem.c