sched_ext: Remove redundant css_put()
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
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | sched/ext: Remove redundant css_put()kernel/ | +0 | 2 replies |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Andrea Righi |
|---|---|
| 1/1 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
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