]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: extable: fix err reg writing in dedicated uaccess handler
authorJisheng Zhang <jszhang@kernel.org>
Sun, 23 Jan 2022 09:04:17 +0000 (17:04 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 9 Feb 2022 01:02:47 +0000 (17:02 -0800)
commitea8e9b29c7e87f966ca512ba9a3d0704c76c465f
tree5e0075974304fc0021484ba9a8971cf564178ede
parent469119f8c8e93f2080f45b2d4e2acc9e512a6349
riscv: extable: fix err reg writing in dedicated uaccess handler

Mayuresh reported commit 8a2fea88ca0c ("riscv: extable: add a dedicated
uaccess handler") breaks the writev02 test case in LTP. This is due to
the err reg isn't correctly set with the errno(-EFAULT in writev02
case). First of all, the err and zero regs are reg numbers rather than
reg offsets in struct pt_regs; Secondly, regs_set_gpr() should write
the regs when offset isn't zero(zero means epc)

Fix it by correcting regs_set_gpr() logic and passing the correct reg
offset to it.

Reported-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Fixes: 8a2fea88ca0c ("riscv: extable: add a dedicated uaccess handler")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/mm/extable.c