elf core dump: fix get_user use
commit54fe30373788fa3e968ade0481e08a6f13067b73
authorRoland McGrath <roland@redhat.com>
Sat, 7 Feb 2009 01:34:07 +0000 (6 17:34 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 12 Feb 2009 17:50:36 +0000 (12 09:50 -0800)
tree404bd426693b84cd4146a85e2157ac00cdc098e9
parent7bf97ba5bb635e84e2092d4de4092dcf76ad82a0
elf core dump: fix get_user use

commit 92dc07b1f988e8c237a38e23be660b9b8533e6fd upstream.

The elf_core_dump() code does its work with set_fs(KERNEL_DS) in force,
so vma_dump_size() needs to switch back with set_fs(USER_DS) to safely
use get_user() for a normal user-space address.

Checking for VM_READ optimizes out the case where get_user() would fail
anyway.  The vm_file check here was already superfluous given the control
flow earlier in the function, so that is a cleanup/optimization unrelated
to other changes but an obvious and trivial one.

Reported-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/binfmt_elf.c