From nobody Mon Jun 8 15:36:51 2026 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 3D3C330C153 for ; Thu, 28 May 2026 09:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961083; cv=none; b=CSYR59EirCwLF2m7thvbvR+wIXbUX0VkwoNIIgHlKV8TRgGCsDoCvE3sQh0d8WCTzb3y6J2PalxuLUHlX+e77ImGo5ZBDzKeq8+rLnOidQVnMa6Tl4m9lnlz29FWLbGb1ojxe0XvPZwhSwpJdJTFw9zLyoNYflf6d+IETMLzmVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961083; c=relaxed/simple; bh=5fdPGmsaekgSXFdnDNIqxNfeLfEf8EE6+pf01BBiDdU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eFWiGHWd9WGt4hMbgWPMVFo2k9zFh/tnTp5l5z0qDYXzCSrj5Bu04UAjjdyJT87n6uZk98+skkxfJCv45b2j+jmmq8WhAwuK8EYYHaiYaIAkOxkmw3tJHevD/Q4+Z6zpdd84ko5ITZGBcxPqzrJ9bk+YwsBUkn0OIVsLhQUng4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Rua/h5+p; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Rua/h5+p" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779961077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=168BIu5dc0NAbe1hBH5woqQWWLGcJ7sVc64Of2NFMLA=; b=Rua/h5+pt/9jMZ7YFK9O/0Xvi+MqXZxpiRYslAQjiUFWz+UXNeuZGX6isMAwaSqSBENVuT YFlqRtxCB5wDvNNgTgrlbw9OkDilpT4VdeyLoVi3Ztu49Wt6Czwzw5gnwFRWt1QXVFM46R u/cY2vT0AWG9k2wZlRg+kCP8VpSSrPo= From: Guopeng Zhang To: Waiman Long , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= Cc: Chen Ridong , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Guopeng Zhang Subject: [PATCH] cgroup/cpuset: Free sched domains on rebuild guard failure Date: Thu, 28 May 2026 17:37:42 +0800 Message-ID: <20260528093742.1792456-1-guopeng.zhang@linux.dev> 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-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Guopeng Zhang generate_sched_domains() returns sched-domain masks and optional attributes that are normally handed to partition_sched_domains(), which takes ownership of them. rebuild_sched_domains_locked() has a WARN guard after generate_sched_domains() and before partition_sched_domains() to avoid passing offline CPUs into the scheduler domain rebuild path. If that guard fires, the function currently returns directly without freeing the generated doms and attr. Free the generated sched-domain masks and attributes before returning from the guard failure path. Signed-off-by: Guopeng Zhang Reviewed-by:=C2=A0 Waiman Long --- kernel/cgroup/cpuset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 51327333980a..c5fdebc205d8 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1004,8 +1004,11 @@ void rebuild_sched_domains_locked(void) * prevent the panic. */ for (i =3D 0; doms && i < ndoms; i++) { - if (WARN_ON_ONCE(!cpumask_subset(doms[i], cpu_active_mask))) + if (WARN_ON_ONCE(!cpumask_subset(doms[i], cpu_active_mask))) { + free_sched_domains(doms, ndoms); + kfree(attr); return; + } } =20 /* Have scheduler rebuild the domains */ --=20 2.43.0