cgroup by writing its PID to the "cgroup.procs" file, the following
 conditions must be met.
 
-- The writer's euid must match either uid or suid of the target process.
-
 - The writer must have write access to the "cgroup.procs" file.
 
 - The writer must have write access to the "cgroup.procs" file of the
   common ancestor of the source and destination cgroups.
 
-The above three constraints ensure that while a delegatee may migrate
+The above two constraints ensure that while a delegatee may migrate
 processes around freely in the delegated sub-hierarchy it can't pull
 in from or push out to outside the sub-hierarchy.
 
 
 Let's also say U0 wants to write the PID of a process which is
 currently in C10 into "C00/cgroup.procs".  U0 has write access to the
-file and uid match on the process; however, the common ancestor of the
-source cgroup C10 and the destination cgroup C00 is above the points
-of delegation and U0 would not have write access to its "cgroup.procs"
-files and thus the write will be denied with -EACCES.
+file; however, the common ancestor of the source cgroup C10 and the
+destination cgroup C00 is above the points of delegation and U0 would
+not have write access to its "cgroup.procs" files and thus the write
+will be denied with -EACCES.
 
 
 2-6. Guidelines
 
                                         struct cgroup *dst_cgrp,
                                         struct kernfs_open_file *of)
 {
-       const struct cred *cred = current_cred();
-       const struct cred *tcred = get_task_cred(task);
        int ret = 0;
 
-       /*
-        * even if we're attaching all tasks in the thread group, we only
-        * need to check permissions on one of them.
-        */
-       if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) &&
-           !uid_eq(cred->euid, tcred->uid) &&
-           !uid_eq(cred->euid, tcred->suid))
-               ret = -EACCES;
-
-       if (!ret && cgroup_on_dfl(dst_cgrp)) {
+       if (cgroup_on_dfl(dst_cgrp)) {
                struct super_block *sb = of->file->f_path.dentry->d_sb;
                struct cgroup *cgrp;
                struct inode *inode;
                        ret = inode_permission(inode, MAY_WRITE);
                        iput(inode);
                }
+       } else {
+               const struct cred *cred = current_cred();
+               const struct cred *tcred = get_task_cred(task);
+
+               /*
+                * even if we're attaching all tasks in the thread group,
+                * we only need to check permissions on one of them.
+                */
+               if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) &&
+                   !uid_eq(cred->euid, tcred->uid) &&
+                   !uid_eq(cred->euid, tcred->suid))
+                       ret = -EACCES;
+               put_cred(tcred);
        }
 
-       put_cred(tcred);
        return ret;
 }