metag/usercopy: Add early abort to copy_to_user
authorJames Hogan <james.hogan@imgtec.com>
Fri, 31 Mar 2017 12:35:01 +0000 (13:35 +0100)
committerSasha Levin <alexander.levin@verizon.com>
Wed, 17 May 2017 19:08:21 +0000 (15:08 -0400)
commitf58b27f0ce36a00a70be28bf734271a43c9a3ceb
treebfb762694fb14add1bed84fb34ba8b1c78da1fcb
parentfde1ed807fc632dbc029171648ddf7e906a62d7b
metag/usercopy: Add early abort to copy_to_user

[ Upstream commit fb8ea062a8f2e85256e13f55696c5c5f0dfdcc8b ]

When copying to userland on Meta, if any faults are encountered
immediately abort the copy instead of continuing on and repeatedly
faulting, and worse potentially copying further bytes successfully to
subsequent valid pages.

Fixes: 373cd784d0fc ("metag: Memory handling")
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
arch/metag/lib/usercopy.c