Skip to content

sched_ext: Remove redundant css_put()

Cheng-Yang Chou lkml sched-ext 1 version Applied

Status from this message: Applied to sched_ext/for-7.0-fixes with the following updates:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/1sched/ext: Remove redundant css_put()kernel/sched/ext.c+0 -12 replies

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchAndrea Righi
1/1R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/1] sched_ext: Remove redundant css_put()

I noticed a redundant css_put() call in the error path of scx_cgroup_init() within ext.c.

According to the cgroup documentation, css_put() should only be used to release a reference obtained via css_get() or css_tryget_online().

The current iteration uses css_for_each_descendant_pre(), which walks the cgroup hierarchy under cgroup_lock(). This iterator does not implicitly acquire a reference on the yielded css structures.

Since there is no preceding css_get() or css_tryget_online() within the loop, calling css_put() when ops.cgroup_init() fails appears to cause a refcount underflow. This could potentially lead to a Use-After-Free (UAF) vulnerability.

I have tested this patch by building the kernel with make -j and CONFIG_EXT_GROUP_SCHED enabled. However, I do not have specific data or a reproducer to test if this error path triggers in a live environment.

Could anyone clarify if this css_put() is indeed an unbalanced refcount drop, or did I miss a reference acquisition somewhere? I have attached a patch that removes the unbalanced call.

Thanks,
Cheng-Yang

---

Cheng-Yang Chou (1):
sched/ext: Remove redundant css_put()

 kernel/sched/ext.c | 1 -
 1 file changed, 1 deletion(-)
Signature · 1 line
2.48.1