From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 75422374A03 for ; Tue, 9 Jun 2026 21:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781038975; cv=none; b=sZjwzD/KWCmjw4aqKVyPug/FaDThln7EOONzv8UJkvhTvTg7FE3eekfC5gbe1k5VP34nmbhdByhd0tNHRknENLahvmEvJzVeO9kFU+QKHdcz5H+JQ6THWF9KsdJq/mB1uQajCmnzIjTh6jfzH2brfJVZkM4n28S5YLwxQU14fHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781038975; c=relaxed/simple; bh=C8hY132qG+xjkRnVVTukTcbYF6pljAiJfoDuxTvymqU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u4tEoRuWEc9U/h2ZX9KxqLLYgQfeOtsCmK5DszfJk1ZFX4bj2ogKYaVmiscUiOBmhcfNryYUVQwFn8emYOCaBczorLv4mJ8fL4bf684QEHo9M1xS//pwl+hjWMU56wHkNW/SM4qI8JGIW9mBlLjE2GGTSg/SWArPPYRvTszmF0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V9xzLI6L; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="V9xzLI6L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781038974; x=1812574974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C8hY132qG+xjkRnVVTukTcbYF6pljAiJfoDuxTvymqU=; b=V9xzLI6Lrcdo3r5LPqaTat8+dgybf7uOksdC0EaJB+/3Auf7L+kJRqAf I0FRLJ1vKLwpAQkBZ1wJxw7TOERMu2til66jt7KkoE3PdPqjbReeMhNTs 9WJBYEwinrnGGAJyH35PuA64mOfekt+kzLNrH/KWLdjK8aLh6j44P2b3w +mvPsXCWOPxMhpwe1DxRU+jMCQ2rGKvIERFaZrKAa1SmIipydplFRBgx4 vWb3138chdDY8/WrhhLrEQHsxXTh5lW39M1WKQ6SdQQCIYrTKBSDscJhr w7epfKZS9Y9BYuoxUgCF6KhCZRClc1w+Cu0ps9a0Pyt+uGN/cGqKAvhan A==; X-CSE-ConnectionGUID: h4H3wbfpQ6mQdySDmIkfng== X-CSE-MsgGUID: IG/iUiL2Txy4WbvU40udOA== X-IronPort-AV: E=McAfee;i="6800,10657,11812"; a="81885016" X-IronPort-AV: E=Sophos;i="6.24,196,1774335600"; d="scan'208";a="81885016" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2026 14:02:53 -0700 X-CSE-ConnectionGUID: Nh3OGGcdRTWACpYQ7tKkIQ== X-CSE-MsgGUID: gd3spaAYQTa5FCtEWLIr4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,196,1774335600"; d="scan'208";a="251045678" Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2026 14:02:51 -0700 From: Reinette Chatre To: tony.luck@intel.com, james.morse@arm.com, Dave.Martin@arm.com, babu.moger@amd.com, bp@alien8.de, tglx@linutronix.de, dave.hansen@linux.intel.com Cc: x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fustini@kernel.org, fenghuay@nvidia.com, peternewman@google.com, yu.c.chen@intel.com, linux-kernel@vger.kernel.org, patches@lists.linux.dev, reinette.chatre@intel.com Subject: [PATCH v5 04/11] fs/resctrl: Free mon_data structures on rdt_get_tree() failure Date: Tue, 9 Jun 2026 14:02:30 -0700 Message-ID: <52880d6ee4d38599f69cbb42493e16f3903e7f52.1781029125.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Tony Luck If mkdir_mondata_all() or a subsequent call in rdt_get_tree() fails, the mon_data structures allocated by mon_get_kn_priv() are leaked. Add mon_put_kn_priv() to the out_mongrp error path to free the mon_data structures. Fixes: 2a6566038544 ("x86/resctrl: Expand the width of domid by replacing mon_data_bits") Reported-by: Reinette Chatre Closes: https://lore.kernel.org/lkml/5d38c1fb-8f91-472b-8897-24b2f50c772b@intel.com/ Signed-off-by: Tony Luck Signed-off-by: Reinette Chatre Reviewed-by: Chen Yu Reviewed-by: Ben Horgan --- Changes since V2: - Reword changelog. Changes since V3: - Add Chenyu's Reviewed-by tag that should have been added in V2. - Add Ben's Reviewed-by tag. - Add Closes: tag. --- fs/resctrl/rdtgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 2b624cf02147..31cfb54a5488 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3081,6 +3081,7 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_mondata); out_mongrp: if (resctrl_arch_mon_capable()) { + mon_put_kn_priv(); rdtgroup_unassign_cntrs(&rdtgroup_default); kernfs_remove(kn_mongrp); } -- 2.50.1