[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5200B0FB.9040202@asianux.com>
Date: Tue, 06 Aug 2013 16:16:59 +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 2/2] kernel/sys.c: remove useless variable 'old_fsuid' for
setfsuid()
Remove useless variable 'old_fsuid' to make code clearer for readers.
Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
kernel/sys.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 558ccdb..e3983b2 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -728,11 +728,9 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)
{
const struct cred *old;
struct cred *new;
- uid_t old_fsuid;
kuid_t kuid;
old = current_cred();
- old_fsuid = from_kuid_munged(old->user_ns, old->fsuid);
kuid = make_kuid(old->user_ns, uid);
if (!uid_valid(kuid))
@@ -747,17 +745,17 @@ SYSCALL_DEFINE1(setfsuid, uid_t, uid)
nsown_capable(CAP_SETUID)) {
if (!uid_eq(kuid, old->fsuid)) {
new->fsuid = kuid;
- if (security_task_fix_setuid(new, old, LSM_SETID_FS) == 0)
- goto change_okay;
+ if (security_task_fix_setuid(new,
+ old, LSM_SETID_FS) == 0) {
+ commit_creds(new);
+ return from_kuid_munged(old->user_ns,
+ old->fsuid);
+ }
}
}
abort_creds(new);
return uid;
-
-change_okay:
- commit_creds(new);
- return old_fsuid;
}
/*
--
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