aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/lib/kdoc/kdoc_re.py
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2025-04-29 08:40:10 -1000
committerTejun Heo <tj@kernel.org>2025-04-29 08:40:10 -1000
commita77d10d032f511b027d80ef0640309a73e2561fa (patch)
tree4f7d9d85a67f59994263273d9434508242b8d286 /scripts/lib/kdoc/kdoc_re.py
parentsched_ext: Introduce scx_sched (diff)
downloadwireguard-linux-a77d10d032f511b027d80ef0640309a73e2561fa.tar.xz
wireguard-linux-a77d10d032f511b027d80ef0640309a73e2561fa.zip
sched_ext: Avoid NULL scx_root deref through SCX_HAS_OP()
SCX_HAS_OP() tests scx_root->has_op bitmap. The bitmap is currently in a statically allocated struct scx_sched and initialized while loading the BPF scheduler and cleared while unloading, and thus can be tested anytime. However, scx_root will be switched to dynamic allocation and thus won't always be deferenceable. Most usages of SCX_HAS_OP() are already protected by scx_enabled() either directly or indirectly (e.g. through a task which is on SCX). However, there are a couple places that could try to dereference NULL scx_root. Update them so that scx_root is guaranteed to be valid before SCX_HAS_OP() is called. - In handle_hotplug(), test whether scx_root is NULL before doing anything else. This is safe because scx_root updates will be protected by cpus_read_lock(). - In scx_tg_offline(), test scx_cgroup_enabled before invoking SCX_HAS_OP(), which should guarnatee that scx_root won't turn NULL. This is also in line with other cgroup operations. As the code path is synchronized against scx_cgroup_init/exit() through scx_cgroup_rwsem, this shouldn't cause any behavior differences. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Andrea Righi <arighi@nvidia.com> Acked-by: Changwoo Min <changwoo@igalia.com>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_re.py')
0 files changed, 0 insertions, 0 deletions