From: Dinh Nguyen <dinh.ngu...@intel.com> commit bcb864df35d751a77abcfa116ae9d801f47a6e5b from https://github.com/altera-opensource/linux-socfpga.git
This reverts commit 31f58fc8d843cfc1d458fa01f4c24c4ea37834e5. Due to a mistake in resolving a merge conflict, this patch needs to get reverted. Signed-off-by: Dinh Nguyen <dinh.ngu...@intel.com> Signed-off-by: Wenlin Kang <wenlin.k...@windriver.com> --- kernel/cgroup/cgroup-v1.c | 7 +++---- kernel/cgroup/cgroup.c | 8 -------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 433b9e840b38..4296e0e581cc 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -507,11 +507,10 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, goto out_unlock; /* - * Even if we're attaching all tasks in the thread group, we only need - * to check permissions on one of them. Check permissions using the - * credentials from file open to protect against inherited fd attacks. + * Even if we're attaching all tasks in the thread group, we only + * need to check permissions on one of them. */ - cred = of->file->f_cred; + cred = current_cred(); tcred = get_task_cred(task); if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && !uid_eq(cred->euid, tcred->uid) && diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 684c16849eff..7173e8b5f5a1 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4856,16 +4856,9 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root); spin_unlock_irq(&css_set_lock); - /* - * Process and thread migrations follow same delegation rule. Check - * permissions using the credentials from file open to protect against - * inherited fd attacks. - */ - saved_cred = override_creds(of->file->f_cred); ret = cgroup_attach_permissions(src_cgrp, dst_cgrp, of->file->f_path.dentry->d_sb, true, ctx->ns); - revert_creds(saved_cred); if (ret) goto out_finish; @@ -4890,7 +4883,6 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, struct cgroup_file_ctx *ctx = of->priv; struct cgroup *src_cgrp, *dst_cgrp; struct task_struct *task; - const struct cred *saved_cred; ssize_t ret; bool locked; -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12583): https://lists.yoctoproject.org/g/linux-yocto/message/12583 Mute This Topic: https://lists.yoctoproject.org/mt/98921504/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-