mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall
@ 2016-10-24 10:47 Colin King
  2016-10-24 15:56 ` Vineet Gupta
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2016-10-24 10:47 UTC (permalink / raw)
  To: Vineet Gupta, Jiri Slaby, Andrew Morton, linux-snps-arc; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

arc_usr_cmpxchg currently returns an uninitialized value in ret
on a failed access_ok call. Instead, return -EFAULT.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 arch/arc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index a746008..9ae3e1c 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -47,7 +47,7 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
 	int ret;
 
 	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
-		return ret;
+		return -EFAULT;
 
 	preempt_disable();
 
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall
  2016-10-24 10:47 [PATCH] ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall Colin King
@ 2016-10-24 15:56 ` Vineet Gupta
  2016-10-24 15:58   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Vineet Gupta @ 2016-10-24 15:56 UTC (permalink / raw)
  To: Colin King, Jiri Slaby, Andrew Morton, linux-snps-arc; +Cc: linux-kernel

On 10/24/2016 03:47 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> arc_usr_cmpxchg currently returns an uninitialized value in ret
> on a failed access_ok call. Instead, return -EFAULT.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  arch/arc/kernel/process.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
> index a746008..9ae3e1c 100644
> --- a/arch/arc/kernel/process.c
> +++ b/arch/arc/kernel/process.c
> @@ -47,7 +47,7 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
>  	int ret;
>  
>  	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
> -		return ret;
> +		return -EFAULT;
>  
>  	preempt_disable();

Thx for spotting this. Since this is new code, not yet merged, do you mind if I
squash it with orig patch. I can add a Reviewed-by a SOB as you prefer.

Thx,
-Vineet

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall
  2016-10-24 15:56 ` Vineet Gupta
@ 2016-10-24 15:58   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2016-10-24 15:58 UTC (permalink / raw)
  To: Vineet Gupta, Jiri Slaby, Andrew Morton, linux-snps-arc; +Cc: linux-kernel

On 24/10/16 16:56, Vineet Gupta wrote:
> On 10/24/2016 03:47 AM, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> arc_usr_cmpxchg currently returns an uninitialized value in ret
>> on a failed access_ok call. Instead, return -EFAULT.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  arch/arc/kernel/process.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
>> index a746008..9ae3e1c 100644
>> --- a/arch/arc/kernel/process.c
>> +++ b/arch/arc/kernel/process.c
>> @@ -47,7 +47,7 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
>>  	int ret;
>>  
>>  	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
>> -		return ret;
>> +		return -EFAULT;
>>  
>>  	preempt_disable();
> 
> Thx for spotting this. Since this is new code, not yet merged, do you mind if I
> squash it with orig patch. I can add a Reviewed-by a SOB as you prefer.

Sure, squash it int and add me as a Reviewed-by.

Colin
> 
> Thx,
> -Vineet
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-24 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 10:47 [PATCH] ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall Colin King
2016-10-24 15:56 ` Vineet Gupta
2016-10-24 15:58   ` Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®