aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2022-09-23 07:19:38 -1000
committerTejun Heo <tj@kernel.org>2022-09-23 07:19:38 -1000
commit026e14a276c67c8433ecb10e557f0ba23d2b6636 (patch)
tree8f57de61bfe542eebbf26f38f237e57f4850cec1 /kernel/cgroup
parentc478bd88362418bd2a1c230215fde184f5642e44 (diff)
parentdf02452f3df069a59bc9e69c84435bf115cb6e37 (diff)
downloadlinux-026e14a276c67c8433ecb10e557f0ba23d2b6636.tar.gz
Merge branch 'for-6.0-fixes' into for-6.1
for-6.0 has the following fix for cgroup_get_from_id(). 836ac87d ("cgroup: fix cgroup_get_from_id") which conflicts with the following two commits in for-6.1. 4534dee9 ("cgroup: cgroup: Honor caller's cgroup NS when resolving cgroup id") fa7e439c ("cgroup: Homogenize cgroup_get_from_id() return value") While the resolution is straightforward, the code ends up pretty ugly afterwards. Let's pull for-6.0-fixes into for-6.1 so that the code can be fixed up there. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup')
-rw-r--r--kernel/cgroup/cgroup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index e24015877d3c5..0d93cd17548c2 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -6072,6 +6072,9 @@ struct cgroup *cgroup_get_from_id(u64 id)
if (!kn)
goto out;
+ if (kernfs_type(kn) != KERNFS_DIR)
+ goto put;
+
rcu_read_lock();
cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
@@ -6079,6 +6082,7 @@ struct cgroup *cgroup_get_from_id(u64 id)
cgrp = NULL;
rcu_read_unlock();
+put:
kernfs_put(kn);
if (!cgrp)