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 E136B2E92BA; Thu, 28 May 2026 20:35:37 +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=1780000538; cv=none; b=qUHdYfKxxsyvmcsdHWSLplmVm7xyzfb4vgDIZH/aFFPmLkNxgqW86kHZNpNRhpgJEHna1AEXT03otz7KFcgE9oL7kWzc53ABG/0U4P6LTbf/S18rqZkBN1GIh9CLnPzEvhvptWhzp9Dilh0/8jgeRkpB4LSLdrqUksOWKCNQ1CY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000538; c=relaxed/simple; bh=iL00tCKP9Pnbi9lMgkZ3oNNOU6KiHqgfZivT8MPf3mE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gC3qm6Cc+rmgK9zoU1MZsa8m0PlaCY1dVIAkWnNiBP9ATx3jiHyvNkbLCr1busgHGH7YIluIyMvznkQyI86VXQdTA9wYVPEnCXXCZJ1rxjl4k2EePPA9uWFel2ZjQoRt4IoFyKdhkqnoGPMdmVaY6T2xJMv4fKuPvr5aHgFuxOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Q33i/Ey9; 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="Q33i/Ey9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BA2E1F000E9; Thu, 28 May 2026 20:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000537; bh=19qqbegkgKcjYimwAdMcQnXvzl4jbP/M1QF3DGvw7AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q33i/Ey95PV1peH5JyUhn3eNznr/lObGbpEVDuxuX7c0PE1lhuojZ9A9MKVXhDc/1 Wi0tKDyMHbm+r4k9fB+RfIdx0TDUQotvsjim4Z07Vtc/a49+7dF/qu8MDQuwzZ2n6l h8dl+etkICnTWlbJh3akl7UJDvAH2W6auPhDzRe8= 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.12 079/272] cgroup/cpuset: Reset DL migration state on can_attach() failure Date: Thu, 28 May 2026 21:47:33 +0200 Message-ID: <20260528194631.587657841@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: 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 @@ -2996,16 +2996,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: @@ -3014,7 +3011,10 @@ out_success: * 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; }