Skip to contentSkip to conversation

ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall

PATCH In review Colin King 2 participants 3 messages Oct 24, 2016 Synopsys ARC architecture

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ARC: return -EFAULT on failed access_ok for arc_usr_cmpxchg syscall

From: Colin Ian King <[email protected]>

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 at canonical.com>
---
 arch/arc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/process.c +1 -1
index a746008..9ae3e1c 100644
@@ -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();
 
Signature · 1 line
2.9.3
#1 lore raw
Quoted 15 lines · Colin King

From: Colin Ian King <colin.king at 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 at canonical.com>
---
 arch/arc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/process.c +0 -0
index a746008..9ae3e1c 100644

arch/arc/kernel/process.c SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) · line 52

Quoted 7 lines
arch/arc/kernel/process.c +1 -1
@@ -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

#2 lore raw
Quoted 18 lines · Vineet Gupta
Quoted 17 lines · Colin King

From: Colin Ian King <colin.king at 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 at canonical.com>
---
 arch/arc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/process.c +0 -0
index a746008..9ae3e1c 100644
@@ -47,7 +47,7 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
 	int ret;
 
Quoted 8 lines

arch/arc/kernel/process.c SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) · line 52

Quoted 5 lines
arch/arc/kernel/process.c +1 -1
 	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

Quoted 5 lines

Thx,
-Vineet