Skip to contentSkip to conversation

FAILED: patch "[PATCH] sched_ext: Fix exit_task leak on fork failure during enable" failed to apply to 6.18-stable tree

PATCH New [email protected] 2 participants 2 messages Sep 3 – Sep 9

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 03506edca637a8465dba9f635c50e9884fbcaf4e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090320-scrooge-flashing-ac37@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 03506edca637a8465dba9f635c50e9884fbcaf4e Mon Sep 17 00:00:00 2001
From: fangqiurong <[email protected]>
Date: Fri, 14 Aug 2026 11:26:23 +0800
Subject: [PATCH] sched_ext: Fix exit_task leak on fork failure during enable

scx_fork() initializes tasks when scx_init_task_enabled is set, but scx_cancel_fork() only exits them when scx_enabled() is true. A fork that fails in the enable window (between releasing scx_fork_rwsem and setting __scx_enabled) runs ops.init_task() but never ops.exit_task().

Gate scx_cancel_fork() on scx_init_task_enabled.

Fixes 4269c603cc26 ("sched_ext: Enable scx_ops_init_task() separately")
Cc [email protected] # v6.12+
kernel/sched/ext/ext.c +1 -1
index 61b156d7fc4b..2adf2bde0cb1 100644
@@ -4163,7 +4163,7 @@ void scx_post_fork(struct task_struct *p)
 
 void scx_cancel_fork(struct task_struct *p)
 {
-	if (scx_enabled()) {
+	if (scx_init_task_enabled) {
 		struct rq *rq;
 		struct rq_flags rf;
 
maintainer
#1 lore raw

PATCH 1/1 sched_ext: Fix exit_task leak on fork failure during enable

From: fangqiurong <[email protected]>

[ Upstream commit 03506edca637a8465dba9f635c50e9884fbcaf4e ]

scx_fork() initializes tasks when scx_init_task_enabled is set, but scx_cancel_fork() only exits them when scx_enabled() is true. A fork that fails in the enable window (between releasing scx_fork_rwsem and setting __scx_enabled) runs ops.init_task() but never ops.exit_task().

Gate scx_cancel_fork() on scx_init_task_enabled.

Fixes 4269c603cc26 ("sched_ext: Enable scx_ops_init_task() separately")
Cc [email protected] # v6.12+
[ Adjusted the target file path from kernel/sched/ext/ext.c to kernel/sched/ext.c. ]
---
 kernel/sched/ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/ext.c +1 -1
index b5f95b379ea6c..a8a507988e419 100644
@@ -3007,7 +3007,7 @@ void scx_post_fork(struct task_struct *p)
 
 void scx_cancel_fork(struct task_struct *p)
 {
-	if (scx_enabled()) {
+	if (scx_init_task_enabled) {
 		struct rq *rq;
 		struct rq_flags rf;
 
Signature · 1 line
2.53.0