summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Qing <wangqing@vivo.com>2021-03-01 20:05:48 +0800
committerVineet Gupta <vgupta@synopsys.com>2021-03-22 10:05:43 -0700
commit46e152186cd89d940b26726fff11eb3f4935b45a (patch)
treeb8deeb0964152baa2379a015507ae4209b3b71df
parentfac245216b68cdfccf3e2a8d20d6710b750bf20f (diff)
downloadlinux-stable-46e152186cd89d940b26726fff11eb3f4935b45a.tar.gz
linux-stable-46e152186cd89d940b26726fff11eb3f4935b45a.tar.bz2
linux-stable-46e152186cd89d940b26726fff11eb3f4935b45a.zip
arc: kernel: Return -EFAULT if copy_to_user() fails
The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing <wangqing@vivo.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/signal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index a78d8f745a67..fdbe06c98895 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
sizeof(sf->uc.uc_mcontext.regs.scratch));
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
- return err;
+ return err ? -EFAULT : 0;
}
static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
@@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
&(sf->uc.uc_mcontext.regs.scratch),
sizeof(sf->uc.uc_mcontext.regs.scratch));
if (err)
- return err;
+ return -EFAULT;
set_current_blocked(&set);
regs->bta = uregs.scratch.bta;