[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bed81c02-97e0-9905-0dd3-6064a54691ff@synopsys.com>
Date: Tue, 2 Mar 2021 11:01:11 -0800
From: Vineet Gupta <vgupta@...opsys.com>
To: Wang Qing <wangqing@...o.com>, Jens Axboe <axboe@...nel.dk>,
Thomas Gleixner <tglx@...utronix.de>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-snps-arc@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arc: kernel: Return -EFAULT if copy_to_user() fails
On 3/1/21 4:05 AM, Wang Qing wrote:
> 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@...o.com>
Acked-by: Vineet Gupta <vgupta@...opsys.com>
Do you want me to pick this up via ARC tree ?
Thx,
-Vineet
> ---
> arch/arc/kernel/signal.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
> index a78d8f7..fdbe06c
> --- 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;
>
Powered by blists - more mailing lists