From nobody Sat Jul 25 04:15:57 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78E142641CA for ; Sat, 18 Jul 2026 20:18:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784405893; cv=none; b=J9FZ4UbAv+8ji7zyRXeDyvdoqdI8A2iXRalUZGF07YyS0Cm1S56PEFsaq46zDo1yKeY/y7h6eGD463p77PXXqVXo3eRhqWM7VYuNYdqTtfdCE1VyYLN05osXU4IFEtYtiY2E5fZJmceC9pk16c7gmOak9DIHEes1w0ci5Wth0Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784405893; c=relaxed/simple; bh=mdNDbL1ZbLOovWxIYYR0FsEcIXjDNHEoX5kVwP7YXEY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hW8S4GmwU/DcXriwidonV83TBw2y5M7+VrQOcnkxjO0zKatv9VmXaR2Guea6ItoNL+lKt6yt4DUGBs9/Ifm9kcryYz0odMALTd/Hz+ToK41sZvlp5qRS9AN1JxPIQoAUO8THwUfI40yKuhwGaAtHDPdc7OlIBkTUmUov88Tjv/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=IwfRwgJH; arc=none smtp.client-ip=117.135.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="IwfRwgJH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=aN ZcrnwJUb8dIAlVfZD4IoXdCGWNUcT8sVztnOa7EZU=; b=IwfRwgJHwoBap6/5Xf 1E2hCaLkAFqiGGJGXq90HtjVwMmusFs6imCVytkT6QUMEUOQVKXPM0JzkVuPrjiN kZBHiLKKVo6vbb8AUR2rN/Wt21lgBQjddNfEO0rUchPoagEs/Roiq+xowzwT8fLT St9bzZ+uNLu37J8QF+CpYQpbY= Received: from cuijian-virtual-machine.localdomain (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgC3BSJK31tqq7K4Hw--.50927S2; Sun, 19 Jul 2026 04:17:15 +0800 (CST) From: Cui Jian To: Tejun Heo Cc: David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org, Cui Jian Subject: [PATCH] sched_ext: Fix stale errno in scx_sub_enable_workfn() Date: Sun, 19 Jul 2026 04:17:13 +0800 Message-Id: <20260718201713.17890-1-cjian720@163.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgC3BSJK31tqq7K4Hw--.50927S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZrWUAry3Zr4xJFW3KFy8Xwb_yoW8Cw13pa yay3srt3ykWFW8uFWjyFZ7u3WYgws7tr17XryDCw1Iyw1Sgr1FqF95JF12gFW2krn5C3W3 ZFWjvr9rG34qk37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0p_PETdUUUUU= X-CM-SenderInfo: pfmlt0qxsqqiywtou0bp/xtbC3At7CGpb30sdNwAA3r Content-Type: text/plain; charset="utf-8" scx_sub_enable_workfn() drops the return value of validate_ops(). When validate_ops() fails, the function jumps to err_disable with ret still holding 0 from the previous call, so the fallback error added by commit db4e9defd2e8 ("sched_ext: Record an error on errno-only sub-enable failure") reports "scx_sub_enable() failed (0)". This is currently harmless because validate_ops() records its own scx_error() first and the first error wins, but it leaves the fallback broken for this path. Save the return value into ret, like scx_root_enable_workfn() already does. The nesting depth check and the cgroup online check also reach err_disable without setting ret. Set -EINVAL and -ENODEV there so the fallback always reports a real errno. Signed-off-by: Cui Jian --- kernel/sched/ext/ext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index e3fa7b2fac9d..e623d6375f66 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -7559,6 +7559,7 @@ static void scx_sub_enable_workfn(struct kthread_work= *work) if (sch->level >=3D SCX_SUB_MAX_DEPTH) { scx_error(sch, "max nesting depth %d violated", SCX_SUB_MAX_DEPTH); + ret =3D -EINVAL; goto err_disable; } =20 @@ -7580,7 +7581,8 @@ static void scx_sub_enable_workfn(struct kthread_work= *work) if (ret) goto err_disable; =20 - if (validate_ops(sch, ops)) + ret =3D validate_ops(sch, ops); + if (ret) goto err_disable; =20 struct scx_sub_attach_args sub_attach_args =3D { @@ -7613,6 +7615,7 @@ static void scx_sub_enable_workfn(struct kthread_work= *work) set_cgroup_sched(sch_cgroup(sch), sch); if (!(cgrp->self.flags & CSS_ONLINE)) { scx_error(sch, "cgroup is not online"); + ret =3D -ENODEV; goto err_unlock_and_disable; } =20 base-commit: 1229e2e57a5c2980ccd457b9b53ea0eed5a22ab3 --=20 2.34.1