]> git.baikalelectronics.ru Git - kernel.git/commit
metag/usercopy: Zero rest of buffer from copy_from_user
authorJames Hogan <james.hogan@imgtec.com>
Fri, 31 Mar 2017 10:14:02 +0000 (11:14 +0100)
committerJames Hogan <james.hogan@imgtec.com>
Wed, 5 Apr 2017 14:25:02 +0000 (15:25 +0100)
commited67b6802fc24a433a14740f55a4611156bd21c7
treea28dd6bc34d9b593aa275e0a90beccf574f7fe6d
parent3eeabf1949fbe4f827154b83f46674bef2fd61b1
metag/usercopy: Zero rest of buffer from copy_from_user

Currently we try to zero the destination for a failed read from userland
in fixup code in the usercopy.c macros. The rest of the destination
buffer is then zeroed from __copy_user_zeroing(), which is used for both
copy_from_user() and __copy_from_user().

Unfortunately we fail to zero in the fixup code as D1Ar1 is set to 0
before the fixup code entry labels, and __copy_from_user() shouldn't even
be zeroing the rest of the buffer.

Move the zeroing out into copy_from_user() and rename
__copy_user_zeroing() to raw_copy_from_user() since it no longer does
any zeroing. This also conveniently matches the name needed for
RAW_COPY_USER support in a later patch.

Fixes: 5ac8938ebf27 ("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
arch/metag/include/asm/uaccess.h
arch/metag/lib/usercopy.c