[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5200AD67.1030109@asianux.com>
Date: Tue, 06 Aug 2013 16:01:43 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Kees Cook <keescook@...omium.org>,
Al Viro <viro@...iv.linux.org.uk>,
Oleg Nesterov <oleg@...hat.com>, holt@....com
CC: Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] kernel/sys.c: return the current gid when error occurs
According to the API definition, when error occurs, need return current
fsgid instead of the previous one.
The related informations ("man setfsgid"):
RETURN VALUE
On success, the previous value of fsgid is returned. On error, the current value of fsgid is returned.
Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
kernel/sys.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 771129b..9356dc8 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -775,11 +775,11 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
kgid = make_kgid(old->user_ns, gid);
if (!gid_valid(kgid))
- return old_fsgid;
+ return gid;
new = prepare_creds();
if (!new)
- return old_fsgid;
+ return gid;
if (gid_eq(kgid, old->gid) || gid_eq(kgid, old->egid) ||
gid_eq(kgid, old->sgid) || gid_eq(kgid, old->fsgid) ||
@@ -791,7 +791,7 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
}
abort_creds(new);
- return old_fsgid;
+ return gid;
change_okay:
commit_creds(new);
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists