Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3029051pxb; Mon, 18 Oct 2021 06:56:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJFGyk7BhtC8malkKuKUpL7j6SaRi+FAtzFP/xSLR/4FGQhD5S6x0yUkkQCOVlK/hTL3st X-Received: by 2002:a17:903:2451:b0:13f:297b:829e with SMTP id l17-20020a170903245100b0013f297b829emr27492198pls.45.1634565364691; Mon, 18 Oct 2021 06:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565364; cv=none; d=google.com; s=arc-20160816; b=Yc5eshgXYLyNctNGjnpuSI2fQfE14GRfZGb9USpAGG5HnGDzVm4qKx2m+fCrL3qHKX yfSNBDbLHoytBx91JehSUzIr2+zzbWwtywLIlqwghw9AYCLZPpv8osgF1pwuEuVmV4iO BecZ34nxfRrCTDNBJzHLCPTPsVvS80Iszq3OR6WH1SelRQOSc01ggwDTYmxmLxoGeTKI iYTRU5R1jaV38mROQS+5/2iYKcXEhq5PYxzhYcsd9aBf0OF8aVgtFM9iy8M+eXpEaYOm 0gYTl15oPaxeQ5YfvGD7plus/3msqrKQXWqAmsOMeZWfVhO2uU+usociLmDb6UAevSO5 2qQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3hfHCc9LlKWEm96DZ3DfT5+W2l7Z4a0DssaKcF/B5f0=; b=SgB0gJrFf4mftSYqu3LNYFnvcxvzrbxsNKcjz2SahhxrI6XvmkuWDEmUnylIBqzKCX okO8q94qwBK7sVBsXtuK5/yRsAkZ5I2JiVA5HEEkK/S0K9uYI/KtuD7R/e3TdBmy3QWy GtUX0cm2IjBN+6Y26GccrfXmvqJwnMlpWivNKXqZjiii2DwHgzjOmH/5wamqUB8hB6Zg kZWegIysIUcSI77/MTWUkNOoXjP9/tQQr0GPzlt5icrmGadexrZuw1pizNfU6pi6+c1Y /SQLAeoaVwz/RKPA9m9ZlTyEkI1fZAOEG13pXcnfNeq8vyEUQUv6hCOIyR+eU6+/llt0 lg7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S1Ql0Hjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 68si17937094pfe.367.2021.10.18.06.55.51; Mon, 18 Oct 2021 06:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S1Ql0Hjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbhJRN5C (ORCPT + 99 others); Mon, 18 Oct 2021 09:57:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234191AbhJRNzA (ORCPT ); Mon, 18 Oct 2021 09:55:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0C10619FA; Mon, 18 Oct 2021 13:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564389; bh=Zl0baRCnKsAHiJrz1tKd7AQ0J4hd5iCqHZMVx0C6zQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S1Ql0HjkHAKSkDmC2v5M8nodPqOYAVsOm4fEf7U+FqBsDlrzHRvBg3li84gDIFPUC aaCGAa7Tq4+JW0BpculG3NQmJjt8LrLdMZMVT2jEp4XIJoEyAHklT+VF1UV3fS5vjO aNeZV20DjJ2TkqYNQ7sUPm8EF0nGMGChFskhInIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Borislav Petkov , Reinette Chatre Subject: [PATCH 5.14 037/151] x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails Date: Mon, 18 Oct 2021 15:23:36 +0200 Message-Id: <20211018132341.898620240@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Morse commit 64e87d4bd3201bf8a4685083ee4daf5c0d001452 upstream. domain_add_cpu() is called whenever a CPU is brought online. The earlier call to domain_setup_ctrlval() allocates the control value arrays. If domain_setup_mon_state() fails, the control value arrays are not freed. Add the missing kfree() calls. Fixes: 1bd2a63b4f0de ("x86/intel_rdt/mba_sc: Add initialization support") Fixes: edf6fa1c4a951 ("x86/intel_rdt/cqm: Add RMID (Resource monitoring ID) management") Signed-off-by: James Morse Signed-off-by: Borislav Petkov Acked-by: Reinette Chatre Cc: Link: https://lkml.kernel.org/r/20210917165958.28313-1-james.morse@arm.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -590,6 +590,8 @@ static void domain_add_cpu(int cpu, stru } if (r->mon_capable && domain_setup_mon_state(r, d)) { + kfree(d->ctrl_val); + kfree(d->mbps_val); kfree(d); return; }