]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/ioprio.c
CRED: Wrap current->cred and a few other accessors
[mirror_ubuntu-zesty-kernel.git] / fs / ioprio.c
index c4a1c3c65aac35ba999a4739fb3ed6549b5e1b75..5112554fd210a100a4a58ef1aa4e3aea61ed6629 100644 (file)
@@ -32,8 +32,8 @@ static int set_task_ioprio(struct task_struct *task, int ioprio)
        int err;
        struct io_context *ioc;
 
-       if (task->uid != current->euid &&
-           task->uid != current->uid && !capable(CAP_SYS_NICE))
+       if (task->cred->uid != current_euid() &&
+           task->cred->uid != current_uid() && !capable(CAP_SYS_NICE))
                return -EPERM;
 
        err = security_task_setioprio(task, ioprio);
@@ -115,15 +115,15 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
                                pgrp = task_pgrp(current);
                        else
                                pgrp = find_vpid(who);
-                       do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
+                       do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
                                ret = set_task_ioprio(p, ioprio);
                                if (ret)
                                        break;
-                       } while_each_pid_task(pgrp, PIDTYPE_PGID, p);
+                       } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
                        break;
                case IOPRIO_WHO_USER:
                        if (!who)
-                               user = current->user;
+                               user = current_user();
                        else
                                user = find_user(who);
 
@@ -131,7 +131,7 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
                                break;
 
                        do_each_thread(g, p) {
-                               if (p->uid != who)
+                               if (p->cred->uid != who)
                                        continue;
                                ret = set_task_ioprio(p, ioprio);
                                if (ret)
@@ -204,7 +204,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
                                pgrp = task_pgrp(current);
                        else
                                pgrp = find_vpid(who);
-                       do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
+                       do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
                                tmpio = get_task_ioprio(p);
                                if (tmpio < 0)
                                        continue;
@@ -212,11 +212,11 @@ asmlinkage long sys_ioprio_get(int which, int who)
                                        ret = tmpio;
                                else
                                        ret = ioprio_best(ret, tmpio);
-                       } while_each_pid_task(pgrp, PIDTYPE_PGID, p);
+                       } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
                        break;
                case IOPRIO_WHO_USER:
                        if (!who)
-                               user = current->user;
+                               user = current_user();
                        else
                                user = find_user(who);
 
@@ -224,7 +224,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
                                break;
 
                        do_each_thread(g, p) {
-                               if (p->uid != user->uid)
+                               if (p->cred->uid != user->uid)
                                        continue;
                                tmpio = get_task_ioprio(p);
                                if (tmpio < 0)