Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3015202pxb; Mon, 18 Oct 2021 06:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE/Q511iEpvLyczUZfgh1BvmkYfb6McktkmC0Z6uEVaeSP/sOybeF9zJtgkX0g8v/XWR/D X-Received: by 2002:a63:18b:: with SMTP id 133mr1019079pgb.156.1634564328746; Mon, 18 Oct 2021 06:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564328; cv=none; d=google.com; s=arc-20160816; b=GQm0eh736UNwWvK4rlOYoDZnWCn+ulOic0QRPatCH883rbZ6SpmmrJUFhOKn6cmAw9 aP32ToTJgBTB96oqnsUydDoT4H3mnenz+ZBfj3wFef/NoS9609PfqP0W2PCQU4L2NPwP u0LIC1dfsWDCWnVz68/yim3ig91t9/q+77VTh/e6MDK/4QUadMxNN1Yg7lntkzA/wfWT eut/eS4Rk3iHVWSIrxwE/YlYxgriX+vKpvwee+TOs8X02N7cshNTdbe9lYCC+OyRQw8M PU8Ec54NzNYLKijFDS/XJBD2aFcfoo9RxMLsPRbEQJO8VrAvfyEk7xRKeQedEE66aJ97 SCnw== 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=ea45hMMJId7XEKFzQQuZaCkKAw2e1KB6+7cBYdgbfRY=; b=MxzgVAjs5M333Iau9ms8tJxCWTMSqtDgJkkQpe1sV/R7vDf2TqgE64h1/XrGQwyIP5 m5jNC/Qs131dDI1w8qMuUWaFvkSNviU1CwrG/i3+obWmQoUO23ssGNTFjmAdlDFCH149 55UZbOznv3vgchMt5y1pYajdMSJXMuIeJL9+H4oxZCpM4fyqGOotHclykxQDp3NiSp7P MLcfE8+0Fy1IyLGCfEraV5O8/SkZslqgJRKaKaE93+xWaXcIrK4v+XYg5/D3PIif4FKP /I1Hc5UlufulYlobVZbQTCnWrn7hFcrua54iI63GElBNQFZi00jwCLgyPJL8yQitMY0R nOGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lQh1zyiI; 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 d18si9176469plr.345.2021.10.18.06.38.35; Mon, 18 Oct 2021 06:38:48 -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=lQh1zyiI; 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 S233075AbhJRNjZ (ORCPT + 99 others); Mon, 18 Oct 2021 09:39:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:56336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbhJRNg4 (ORCPT ); Mon, 18 Oct 2021 09:36:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BC2F6136A; Mon, 18 Oct 2021 13:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563879; bh=OM20+lB+gffL8rLecoYgxGmfeLWLanpiKC2P8wWeRe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQh1zyiIqklc7eI7r5MIU4e6ZTfMWImql/qSsnq9BrITQS5RAdjUKqWhPwNm9JYkq xIKy5I3cQpfouyHpH0VY+o6qKuWL7dCaqAP91hOazK44FTppcAIkwnfWYYcu554oUH 7wuRTwcYmMCCWXVf+X/43EyNG/IexwpEPHF7uNvU= 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.4 17/69] x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails Date: Mon, 18 Oct 2021 15:24:15 +0200 Message-Id: <20211018132330.040445279@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@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 @@ -588,6 +588,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; }