Skip to content

Commit 1336b57

Browse files
EricccTaiwanhtejun
authored andcommitted
sched_ext: Remove redundant css_put() in scx_cgroup_init()
The iterator css_for_each_descendant_pre() walks the cgroup hierarchy under cgroup_lock(). It does not increment the reference counts on yielded css structs. According to the cgroup documentation, css_put() should only be used to release a reference obtained via css_get() or css_tryget_online(). Since the iterator does not use either of these to acquire a reference, calling css_put() in the error path of scx_cgroup_init() causes a refcount underflow. Remove the unbalanced css_put() to prevent a potential Use-After-Free (UAF) vulnerability. Fixes: 8195136 ("sched_ext: Add cgroup support") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Reviewed-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 75ad518 commit 1336b57

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

kernel/sched/ext.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3589,7 +3589,6 @@ static int scx_cgroup_init(struct scx_sched *sch)
35893589
ret = SCX_CALL_OP_RET(sch, SCX_KF_UNLOCKED, cgroup_init, NULL,
35903590
css->cgroup, &args);
35913591
if (ret) {
3592-
css_put(css);
35933592
scx_error(sch, "ops.cgroup_init() failed (%d)", ret);
35943593
return ret;
35953594
}

0 commit comments

Comments
 (0)