ARM: 8657/1: uaccess: consistently check object sizes
authorKees Cook <keescook@chromium.org>
Thu, 16 Feb 2017 00:43:58 +0000 (01:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:28:16 +0000 (09:28 +0100)
commit5d4d0a95437efc94c3b10a2ea04a81e5e3863dfb
tree57748f823775b6a1430b1fe5072f95b20223c00c
parent7c4615c853fa7969755f7b0e8bcfaaa2ec264243
ARM: 8657/1: uaccess: consistently check object sizes

[ Upstream commit 32b143637e8180f5d5cea54320c769210dea4f19 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/uaccess.h