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 23E7A471250; Tue, 21 Jul 2026 18:41:25 +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=1784659286; cv=none; b=F1lrOaEQz1uceotxXuwPsNfbwCdUJ2cLHjDa1feWrr60zUpXyl1sT/7vrA390T1p3sMgvmNbWIZluI+RaKyxKQm8Xrhs3Z2UzI4Hw90jpzOoOV7ghCtsMGFubT/7YY2ef7I9xQ4vN6BCGoYMB7+ajP1DxS4eaRRSfWM8ePLjzvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659286; c=relaxed/simple; bh=4FL1tZD6025xg3MyP6iRWRBX/bLcR102UcLRRhPnXVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uxvfGR5Vl5ikSDMlnljwkllJDOz0J19lvBxXXRfeN7YGfkhOJQiGLkSx7Wno/IS/dL69fXJTKo1yT0lXp/h4fI8wWkLI8ZnEZQJ1Ekm6qIW443vbLOuRdp6MPzX8V4Dr9vvblOvbJWcg+LhY5CIjLiMI1avWN+FFRmJavNzT9O0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZGWbY3zK; 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="ZGWbY3zK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B3E1F000E9; Tue, 21 Jul 2026 18:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784659285; bh=kYlcxDpkBxFdfnBynyqYq5AtlXOk/LO2vTJVsJIor4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZGWbY3zK1tlKOxsiJlHZfMP++6JsJPn9UODasM9w6gsKKmDbJnolazKdEvReX47PU FQ8BtVQxM76chi4eq7UO2TkrlRCMrr4IPBPnc/P8UbBkmcchqQUa7SKhiibDnF8CBx +YtNtdrwrj6EeRz75hQwgu+Ezn1XNo9p8mWD3r74= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Reinette Chatre , "Borislav Petkov (AMD)" , stable@kernel.org Subject: [PATCH 6.18 1463/1611] fs/resctrl: Fix double-add of pseudo-locked regions RMID to free list Date: Tue, 21 Jul 2026 17:26:19 +0200 Message-ID: <20260721152548.353702139@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Reinette Chatre commit b9f089723aee892efc77c349ae47a6b452b293c4 upstream. A pseudo-locked group's RMID is freed when it is created. On unmount rmdir_all_sub() unconditionally frees all RMID of all groups, resulting in a double-free of the pseudo-locked group's RMID. The consequence of this is that the original free results in the pseudo-locked group's RMID being added to the rmid_free_lru linked list and the second free then attempts to add the same RMID entry to the rmid_free_lru again. Do not double-free a pseudo-locked group's RMID. Fixes: e0bdfe8e36f3 ("x86/intel_rdt: Support creation/removal of pseudo-locked region") Signed-off-by: Reinette Chatre Signed-off-by: Borislav Petkov (AMD) Cc: Link: https://patch.msgid.link/551432dd7e624a862b8e58314c38aaba0afff3e9.1783377598.git.reinette.chatre@intel.com Signed-off-by: Greg Kroah-Hartman --- fs/resctrl/rdtgroup.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2986,10 +2986,6 @@ static void rmdir_all_sub(void) if (rdtgrp == &rdtgroup_default) continue; - if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || - rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) - rdtgroup_pseudo_lock_remove(rdtgrp); - /* * Give any CPUs back to the default group. We cannot copy * cpu_online_mask because a CPU might have executed the @@ -3000,7 +2996,13 @@ static void rmdir_all_sub(void) rdtgroup_unassign_cntrs(rdtgrp); - free_rmid(rdtgrp->closid, rdtgrp->mon.rmid); + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || + rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { + rdtgroup_pseudo_lock_remove(rdtgrp); + } else { + /* Pseudo-locked group's RMID is freed during setup. */ + free_rmid(rdtgrp->closid, rdtgrp->mon.rmid); + } kernfs_remove(rdtgrp->kn); list_del(&rdtgrp->rdtgroup_list);