]> git.baikalelectronics.ru Git - kernel.git/commit
metag/usercopy: Fix src fixup in from user rapf loops
authorJames Hogan <james.hogan@imgtec.com>
Mon, 3 Apr 2017 16:41:40 +0000 (17:41 +0100)
committerJames Hogan <james.hogan@imgtec.com>
Wed, 5 Apr 2017 14:25:07 +0000 (15:25 +0100)
commitd95fe4824f8bd1faaca454b549f3db5ded2c2636
tree74acc23f831f04d128d28538cd0f7548a60785d4
parent3dc9fcc78a93a2344d98048ea2968122bb7e7559
metag/usercopy: Fix src fixup in from user rapf loops

The fixup code to rewind the source pointer in
__asm_copy_from_user_{32,64}bit_rapf_loop() always rewound the source by
a single unit (4 or 8 bytes), however this is insufficient if the fault
didn't occur on the first load in the loop, as the source pointer will
have been incremented but nothing will have been stored until all 4
register [pairs] are loaded.

Read the LSM_STEP field of TXSTATUS (which is already loaded into a
register), a bit like the copy_to_user versions, to determine how many
iterations of MGET[DL] have taken place, all of which need rewinding.

Fixes: 5ac8938ebf27 ("metag: Memory handling")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Cc: stable@vger.kernel.org
arch/metag/lib/usercopy.c