ARM: 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 7 Sep 2012 17:22:28 +0000 (18:22 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:35 +0000 (04:33 +0000)
commitb5c70f452589114e6a551803bf312eed1b57f964
tree1e57c8fa12e52f8dd9c51a3957a274e3fa82a7a3
parent960c9d696b30cfed659cd56d4c7f1bfac7d9c424
ARM: 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS

commit 8404663f81d212918ff85f493649a7991209fa04 upstream.

The {get,put}_user macros don't perform range checking on the provided
__user address when !CPU_HAS_DOMAINS.

This patch reworks the out-of-line assembly accessors to check the user
address against a specified limit, returning -EFAULT if is is out of
range.

[will: changed get_user register allocation to match put_user]
[rmk: fixed building on older ARM architectures]

Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[bwh: Backported to 3.2: TUSER() was called T()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm/include/asm/assembler.h
arch/arm/include/asm/uaccess.h
arch/arm/lib/getuser.S
arch/arm/lib/putuser.S