From 9947944ca24a7c222842df61dedb5307461e60ed Mon Sep 17 00:00:00 2001 From: Ksawlii Date: Sun, 24 Nov 2024 00:23:50 +0100 Subject: [PATCH] Revert "cgroup/cpuset: Prevent UAF in proc_cpuset_show()" This reverts commit 106a2662b1d13f63e08b4662174ddee298d71c35. --- kernel/cgroup/cpuset.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 648fc13a7..11afc255c 100755 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -22,7 +22,6 @@ * distribution for more details. */ -#include "cgroup-internal.h" #include #include #include @@ -3780,14 +3779,10 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, if (!buf) goto out; - rcu_read_lock(); - spin_lock_irq(&css_set_lock); - css = task_css(tsk, cpuset_cgrp_id); - retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, - current->nsproxy->cgroup_ns); - spin_unlock_irq(&css_set_lock); - rcu_read_unlock(); - + css = task_get_css(tsk, cpuset_cgrp_id); + retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX, + current->nsproxy->cgroup_ns); + css_put(css); if (retval >= PATH_MAX) retval = -ENAMETOOLONG; if (retval < 0)