Skip to content

Commit

Permalink
arc: kernel: Return -EFAULT if copy_to_user() fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wang Qing authored and vineetgarc committed Mar 22, 2021
1 parent fac2452 commit 46e1521
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 46e1521

Please sign in to comment.