From nobody Tue Apr 7 09:16:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 22B0536492A for ; Fri, 13 Mar 2026 19:34:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773430477; cv=none; b=PUuSCZSM1t1riKR7snWQ3FppHOZtZ7ZjQt6KQj1s/TT1akehlLAeehdL1NfO2m7ZIv14N9PRlcBqwlxx5VdRIxs6F8x9h9U4xcc7+yveuAvSfDV11fXbCLO4MO9vSUoSo7+HCUsuP5CkMYtfIsAnqj1gW/QTaMFRoxSQr7s+JnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773430477; c=relaxed/simple; bh=1avPnl1R5Bj9uM9OzyMrUT3GHKajtV6y4uoRFtzXu3M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UTlrbQ+ZyQSr2Vc9PpgdL3kTiW/8L451U+N8YotoPCNtR+SezOOXaRH+vWL/zUa0uzQYeYsAkVH12/qPdTamlu3R2DaEkWy1VGCjei+V0qTGIfUOnX7UOqcMIiaL5d3TJ8xqwMIk9lnB6kMybVAFmJUSlgHLXFEbfoDwpRyXN44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F1EBC19421; Fri, 13 Mar 2026 19:34:36 +0000 (UTC) From: Joseph Salisbury To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , linux-kernel@vger.kernel.org Subject: [PATCH] sched/topology: fail overlapping group build when no sched_group is created Date: Fri, 13 Mar 2026 15:34:35 -0400 Message-ID: <20260313193435.1016354-1-joseph.salisbury@oracle.com> X-Mailer: git-send-email 2.47.3 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 Content-Type: text/plain; charset="utf-8" build_overlap_sched_groups() can complete without creating any sched_group and still return success. This can happen on overlapping NUMA topologies with unequal domain depth. In that case build_sched_domains() may stop building some sibling domain levels early once their span already matches the target cpu_map. Later, when build_overlap_sched_groups() walks the span, every candidate sibling can fail the: cpumask_test_cpu(i, sched_domain_span(sibling)) check, so no group is created and first remains NULL. That leaves sd->groups unset (NULL). Later topology setup still assumes sd->groups is valid and can dereference it from=20 init_sched_groups_capacity(), sd_degenerate(), and cpu_attach_domain(). Catch the empty-group case in build_overlap_sched_groups() itself and fail the sched-domain build through the existing error path instead of constructing an invalid sched_domain. Fixes: f2cb13609d53 ("sched/topology: Split out scheduler topology code fro= m core.c into topology.c") Cc: stable@vger.kernel.org Assisted-by: Codex:GPT-5 Signed-off-by: Joseph Salisbury --- kernel/sched/topology.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1108,6 +1108,10 @@ build_overlap_sched_groups(struct sched_domain *sd, = int cpu) last =3D sg; last->next =3D first; } + + if (WARN_ON_ONCE(!first)) + return -EINVAL; + sd->groups =3D first; =20 return 0; --=20 2.47.3