From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9AB60259CBD; Thu, 28 May 2026 20:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000533; cv=none; b=XhVqMy607ArgcTFIoOwdpBWuyBPu0jYEKUpILmZa5qh0KbYMWIl9669oAbbh/lg+DEmqt3nadyO9tK9Y1vbNhwaAvsZhFUvNJV9UoaL534DGGDriAFWzXO9z5KWGmTGBVvDWHZ40zuXD+DN7frYQBUosYCWdFUkFRgbyx39Qi+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000533; c=relaxed/simple; bh=22+6odYQ78JLDDZMyWUAhdqcC2dycLW5SQaKiEKtlbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IztyYQ5be+ohIOgLqYONs43w1w5D8mJrTUzoRKHKbiwCyYKZ8PMWnL5goOyDWyaGefoLaF2ZCMYxkztcdKSzEoGpitOhy+VsAAYY7tNQ86QKHMd4bMtu7+fxPq8CUeLWbgHbMb18BpXiR7z38INvGDqSHocSnL4WxU3MYtx3Wnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B+43LKEw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="B+43LKEw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B39C91F000E9; Thu, 28 May 2026 20:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000532; bh=4aOKF7AfmUfq/JdCDf0bDhvdcCjtPc8PZavr9f8dn90=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B+43LKEwVuk4+ZtgsZHFA/k0w65OUNvxcZCGX46D2QxmcCaqLYguc2OdiSSjFZNVH cBp6/dNSunLOtOJNikMqwN2FQmSU2twuYhQecI63UiOQ7rjmhp8gDcBDHstlqwe3Km r98KsxFF030QmPZxSRrRR20xu/UU9SVze+sgqKOc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Samuele Mariotti , Paolo Valente , Andrea Righi , Tejun Heo , Sasha Levin Subject: [PATCH 6.12 077/272] sched_ext: Fix missing warning in scx_set_task_state() default case Date: Thu, 28 May 2026 21:47:31 +0200 Message-ID: <20260528194631.531703867@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194629.379955525@linuxfoundation.org> References: <20260528194629.379955525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Samuele Mariotti [ Upstream commit b905ee77d5f557a83a485b4146210f54f13365fc ] In scx_set_task_state(), the default case was setting the warn flag, but then returning immediately. This is problematic because the only purpose of the warn flag is to trigger WARN_ONCE, but the early return prevented it from ever firing, leaving invalid task states undetected and untraced. To fix this, a WARN_ONCE call is now added directly in the default case. The fix addresses two aspects: - Guarantees the invalid task states are properly logged and traced. - Provides a distinct warning message ("sched_ext: Invalid task state") specifically for states outside the defined scx_task_state enum values, making it easier to distinguish from other transition warnings. This ensures proper detection and reporting of invalid states. Signed-off-by: Samuele Mariotti Signed-off-by: Paolo Valente Reviewed-by: Andrea Righi Signed-off-by: Tejun Heo Stable-dep-of: 9a415cc53711 ("sched_ext: Avoid UAF in scx_root_enable_workfn() init failure path") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/sched/ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -3637,7 +3637,8 @@ static void scx_set_task_state(struct ta warn = prev_state != SCX_TASK_READY; break; default: - warn = true; + WARN_ONCE(1, "sched_ext: Invalid task state %d -> %d for %s[%d]", + prev_state, state, p->comm, p->pid); return; }