aboutsummaryrefslogtreecommitdiff
path: root/kernel/user.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-03-10 15:17:26 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-03-10 15:17:26 +0900
commite161183ba674f97fce748384f5bb037d07bdc5c9 (patch)
tree5b3bd4b995f6435ee977b71082244fa1a647f717 /kernel/user.c
parent2ef7f0dab6b3d171b6aff00a47077385ae3155b5 (diff)
parent99adcd9d67aaf04e28f5ae96df280f236bde4b66 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 477b6660f44..6a9b696128c 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -72,6 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
static void uid_hash_remove(struct user_struct *up)
{
hlist_del_init(&up->uidhash_node);
+ put_user_ns(up->user_ns);
}
static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
@@ -334,7 +335,6 @@ static void free_user(struct user_struct *up, unsigned long flags)
atomic_inc(&up->__count);
spin_unlock_irqrestore(&uidhash_lock, flags);
- put_user_ns(up->user_ns);
INIT_WORK(&up->work, remove_user_sysfs_dir);
schedule_work(&up->work);
}
@@ -357,12 +357,29 @@ static void free_user(struct user_struct *up, unsigned long flags)
sched_destroy_user(up);
key_put(up->uid_keyring);
key_put(up->session_keyring);
- put_user_ns(up->user_ns);
kmem_cache_free(uid_cachep, up);
}
#endif
+#if defined(CONFIG_RT_GROUP_SCHED) && defined(CONFIG_USER_SCHED)
+/*
+ * We need to check if a setuid can take place. This function should be called
+ * before successfully completing the setuid.
+ */
+int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
+{
+
+ return sched_rt_can_attach(up->tg, tsk);
+
+}
+#else
+int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
+{
+ return 1;
+}
+#endif
+
/*
* Locate the user_struct for the passed UID. If found, take a ref on it. The
* caller must undo that ref with free_uid().