ARM: 8657/1: uaccess: consistently check object sizes
authorKees Cook <keescook@chromium.org>
Thu, 16 Feb 2017 00:43:58 +0000 (01:43 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 16 Feb 2017 15:58:31 +0000 (15:58 +0000)
commit32b143637e8180f5d5cea54320c769210dea4f19
tree636eec0a91ac1dfffdd9208539633cc8ccb0417a
parent228dbbfb5d77f8e047b2a1d78da14b7158433027
ARM: 8657/1: uaccess: consistently check object sizes

In commit 76624175dcae ("arm64: uaccess: consistently check object sizes"),
the object size checks are moved outside the access_ok() so that bad
destinations are detected before hitting the "memset(dest, 0, size)" in the
copy_from_user() failure path.

This makes the same change for arm, with attention given to possibly
extracting the uaccess routines into a common header file for all
architectures in the future.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/include/asm/uaccess.h