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 4F55A478E55; Tue, 16 Jun 2026 17:55:45 +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=1781632546; cv=none; b=fujKS1/VUJbcefZaw3JBbmdVfKTTmNcIE723ND/zR52KHLu+GkSppPdrgONnxW7l1x3xMlkAleCGnnCeOfNKWzzA2ebAsoL9O0zMRVfmoELBNxu7c7yxV25UXfJm1Q9QItFpOfeRxd6AsctCYwSdblTSLFbLhFUdeIXKWfXXHc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781632546; c=relaxed/simple; bh=hlHa1+CE2Fn0Vd3FSWmni9/19d2EoS5PS/0VeAfAlwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LdkK7rcy8ZpuRlJe5Mmo0kG/4ZeKHfQqKS9eg9E8rTcaAz/RjnwV80hQjd0093jWkJfP0qTL3cSfrOfhGvNRfwkANJ/JEqI6wSOpNYKgACEcz7XpPpVlQeglv7zIPLpngV/MGHXj8I8B73rocG1GKDsLfm5A2QifBwiPFeEaCoo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hquEjS+Z; 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="hquEjS+Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24DA41F00A3A; Tue, 16 Jun 2026 17:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781632545; bh=tk28eEXyGKSmXtrqWRKZI7zDql6cKVdc0KGwihM9Z5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hquEjS+Zi57y3KifcUBmjUXugSr7WALgeAcJfOOLCkSuSJjz0vgmuTpcucFemo6wC 3B1aDYHVPhqJly00UBVmT+FMeYQXOxnE6XnqgFO/3t0UyCg0mTUNr7GvaHBRVL2qSZ SQK+kSpuQx990/Ay55DYEmsCqGzLL86P0Xj3c2To= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guopeng Zhang , Tejun Heo , Chen Ridong , Waiman Long , Sasha Levin Subject: [PATCH 6.1 431/522] cgroup/cpuset: Reset DL migration state on can_attach() failure Date: Tue, 16 Jun 2026 20:29:38 +0530 Message-ID: <20260616145146.132165243@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guopeng Zhang [ Upstream commit 4a39eda5fdd867fc39f3c039714dd432cee00268 ] cpuset_can_attach() accumulates temporary SCHED_DEADLINE migration state in the destination cpuset while walking the taskset. If a later task_can_attach() or security_task_setscheduler() check fails, cgroup_migrate_execute() treats cpuset as the failing subsystem and does not call cpuset_cancel_attach() for it. The partially accumulated state is then left behind and can be consumed by a later attach, corrupting cpuset DL task accounting and pending DL bandwidth accounting. Reset the pending DL migration state from the common error exit when ret is non-zero. Successful can_attach() keeps the state for cpuset_attach() or cpuset_cancel_attach(). Fixes: 2ef269ef1ac0 ("cgroup/cpuset: Free DL BW in case can_attach() fails") Cc: stable@vger.kernel.org # v6.10+ Signed-off-by: Guopeng Zhang Signed-off-by: Tejun Heo Reviewed-by: Chen Ridong Reviewed-by: Waiman Long [ omitted upstream context line `cs->dl_bw_cpu = cpu;` ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/cgroup/cpuset.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2579,16 +2579,13 @@ static int cpuset_can_attach(struct cgro int cpu = cpumask_any_and(cpu_active_mask, cs->effective_cpus); if (unlikely(cpu >= nr_cpu_ids)) { - reset_migrate_dl_data(cs); ret = -EINVAL; goto out_unlock; } ret = dl_bw_alloc(cpu, cs->sum_migrate_dl_bw); - if (ret) { - reset_migrate_dl_data(cs); + if (ret) goto out_unlock; - } } out_success: @@ -3401,7 +3398,10 @@ static int cpuset_can_fork(struct task_s * changes which zero cpus/mems_allowed. */ cs->attach_in_progress++; + out_unlock: + if (ret) + reset_migrate_dl_data(cs); mutex_unlock(&cpuset_mutex); return ret; }