]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/sys.c
CRED: Use RCU to access another task's creds and to release a task's own creds
[linux-2.6-omap-h63xx.git] / kernel / sys.c
index c4d6b59553e9766da2f0bf16e088316ac7dc544a..ccc9eb736d35273f96422b07577fd43f5172c714 100644 (file)
@@ -112,14 +112,17 @@ EXPORT_SYMBOL(cad_pid);
 
 void (*pm_power_off_prepare)(void);
 
+/*
+ * set the priority of a task
+ * - the caller must hold the RCU read lock
+ */
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
-       uid_t euid = current_euid();
+       const struct cred *cred = current_cred(), *pcred = __task_cred(p);
        int no_nice;
 
-       if (p->cred->uid  != euid &&
-           p->cred->euid != euid &&
-           !capable(CAP_SYS_NICE)) {
+       if (pcred->uid  != cred->euid &&
+           pcred->euid != cred->euid && !capable(CAP_SYS_NICE)) {
                error = -EPERM;
                goto out;
        }