[PATCH 4.17 186/324] RISC-V: Fix PTRACE_SETREGSET bug.

From: Greg Kroah-Hartman
Date: Thu Aug 23 2018 - 04:53:44 EST


4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jim Wilson <jimw@xxxxxxxxxx>

[ Upstream commit 1db9b80980d26fe95c942e0bb8bde2ca715029ad ]

In riscv_gpr_set, pass regs instead of &regs to user_regset_copyin to fix
gdb segfault.

Signed-off-by: Jim Wilson <jimw@xxxxxxxxxx>
Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
arch/riscv/kernel/ptrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -50,7 +50,7 @@ static int riscv_gpr_set(struct task_str
struct pt_regs *regs;

regs = task_pt_regs(target);
- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &regs, 0, -1);
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
return ret;
}