CVE-2025-21897

Source
https://cve.org/CVERecord?id=CVE-2025-21897
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-21897.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-21897
Downstream
Published
2025-04-01T15:26:49.705Z
Modified
2026-03-11T05:34:00.699221Z
Summary
sched_ext: Fix pick_task_scx() picking non-queued tasks when it's called without balance()
Details

In the Linux kernel, the following vulnerability has been resolved:

schedext: Fix picktask_scx() picking non-queued tasks when it's called without balance()

a6250aa251ea ("schedext: Handle cases where picktaskscx() is called without preceding balancescx()") added a workaround to handle the cases where picktaskscx() is called without prececing balancescx() which is due to a fair class bug where picktaksfair() may return NULL after a true return from balancefair().

The workaround detects when picktaskscx() is called without preceding balancescx() and emulates SCXRQBALKEEP and triggers kicking to avoid stalling. Unfortunately, the workaround code was testing whether @prev was on SCX to decide whether to keep the task running. This is incorrect as the task may be on SCX but no longer runnable.

This could lead to a non-runnable task to be returned from picktaskscx() which cause interesting confusions and failures. e.g. A common failure mode is the task ending up with (!onrq && oncpu) state which can cause potential wakers to busy loop, which can easily lead to deadlocks.

Fix it by testing whether @prev has SCXTASKQUEUED set. This makes @prevonscx only used in one place. Open code the usage and improve the comment while at it.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21897.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a6250aa251eacaf3ebfcfe152a96a727fd483ecd
Fixed
5324c459f90d16b0c43a78b494c598915d782b7a
Fixed
de60a31cb0bcacfaf9487546eac5e70e0a9c66d7
Fixed
8fef0a3b17bb258130a4fcbcb5addf94b25e9ec5

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-21897.json"