lkml.org 
[lkml]   [2013]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] kernel/sys.c: return the current uid when error occurs
According to the API definition, when error occurs, need return current
fsuid instead of the previous one.

The related informations ("man setfsuid"):

RETURN VALUE
On success, the previous value of fsuid is returned. On error, the current value of fsuid is returned.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
kernel/sys.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 771129b..558ccdb 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -736,11 +736,11 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)

kuid = make_kuid(old->user_ns, uid);
if (!uid_valid(kuid))
- return old_fsuid;
+ return uid;

new = prepare_creds();
if (!new)
- return old_fsuid;
+ return uid;

if (uid_eq(kuid, old->uid) || uid_eq(kuid, old->euid) ||
uid_eq(kuid, old->suid) || uid_eq(kuid, old->fsuid) ||
@@ -753,7 +753,7 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)
}

abort_creds(new);
- return old_fsuid;
+ return uid;

change_okay:
commit_creds(new);
--
1.7.7.6

\
 
 \ /
  Last update: 2013-08-06 10:21    [W:0.137 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site