Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp240858lqr; Wed, 5 Jun 2024 04:59:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVk3wqIsKbX/MxWdUehz8ikTM0ewroOPCa1/Rm365Hn2NdmLv29sg5BuqCRK+8DY9D/GcbxVXFL7BQwwTz6Il27fZbm9wsjlBMQxu/uQw== X-Google-Smtp-Source: AGHT+IHL/HH5c37lW37mFpk/97YWYCzLlqFb9fCIeV5aEV2akEt99rFJvR/GPf0NwGJo/YQYZ8TW X-Received: by 2002:a17:90a:46c8:b0:2c2:4e3e:23c7 with SMTP id 98e67ed59e1d1-2c27db63b03mr2123370a91.40.1717588783695; Wed, 05 Jun 2024 04:59:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717588783; cv=pass; d=google.com; s=arc-20160816; b=j1NGiDWmtmt11v1spFhVKY5lbXBez9j2FLk3cDEqz8+wjDMGKkcxvOy1fWWov68C9H sbjBGr7zbR45kv0D8EN90ADRNAqYUIy6R8iRV3awzUxGKHK4iR85Rl9prVgUKnK4nkJ4 zoO4g2N9rrCWnXD0PHN1sby9t0CTdHHxaJIGDqHd4dSAIZuwyxS2nL36Mple4Pw4EDL6 iTNsbA5GJjo9rqFUqeVdljCZjNwepkDRzHGZ9ifrWpGoM0s9VqyynprqgIj2aH7UbXxp 5jbPGYD4vII0I/leW84khnm1KzPGXunE1d3jjllwXIS8nZrDaqN52HIMMLzxVIZxGFdV Bkfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zvCP80TuG+5VSyazJBDuZER0lSdfn5WSSwUMHLSjMKk=; fh=rzccf86xRhwWv8SIH6spfBi2IrLEFbujUIY28QwTats=; b=YxS6JO2ZBQFnAPA/2hXpLhbRTXvK/0OKsYn7duCyqhz7jHl1BnjYx9SobrByJV8oVX m4VwySlHdIXj1k2Vmeb3GU1EpJPAMIpnnzo8kSbtAa116K/vuSyezvZqcy74UpRS3nff u2Z9JODzQT4JOUE+rOA0m+93UqNDPLAE4sg3tL23TvxMAW3TFhzIsEAWDn8uLQLD8bZx oe1NjBipkE6hEZgPfsBN2Nw/Tkx5n7O9keweqPuyP5So3wYZsHITyttm6tTcJ29ROlKZ 1vanqzd1knwdt8D79ExkJBZ0ZlWVbRTx42Q91SGUu22TaA3p+Vc5x9cJ0u44OwCFxlC7 U97g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k6Wehzt3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806aed1csi430447a91.163.2024.06.05.04.59.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k6Wehzt3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E01628A25A for ; Wed, 5 Jun 2024 11:56:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7E2A194A4A; Wed, 5 Jun 2024 11:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k6Wehzt3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DAB2519ADA6; Wed, 5 Jun 2024 11:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588228; cv=none; b=ERAeFgWdunHaiwreZaVKTv0TvV5t2I0yQ29ZaQItKPSa18a5Qy6PStgNiRJEzETFJ8ih/pBuRlK+RECzm/SUW4quqVApO9QGjoJE7oDwblhLVHTftGnL4YaGuRjV1DIvM2fcTx+cpAuLgdAWM0REz1KeW9AbINLzO61L8JpU6w0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588228; c=relaxed/simple; bh=NcXz8TapCZDDTdXu2QlDm8BCujGH0K94hgrdOa/LTzk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dx3TlYbFg41u2jjS3iuVwQNsWQx+hcbn5CUSAK+T5c5l90t3d8+RomA1GnzLQaX+IFvB9UKjctzRY+oUF4UP9W+1ja9HhyHX6BrSIMNaBqyXb6k9IRrSSajQKSy600oqAuyUos5QlAtdhiONZ6elSDIWbqm+F8LINEec+teFZc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k6Wehzt3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CC0C32786; Wed, 5 Jun 2024 11:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588227; bh=NcXz8TapCZDDTdXu2QlDm8BCujGH0K94hgrdOa/LTzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6Wehzt3cEtTkT9I6cH2XkMW1VthKW8eiZN0P0j8eRT/wzT9K65IbLTFMk/POCza0 KlFg6nstaK3C/akQi0K7DHBfaWI/XIEym2tbjwAOVVvbr03xJzc6mY8UoFefsxd6LY L/Re5KHD7zFmA01nMabAcb4ek5vezAXO8hTdhWlKLQisC+JBIxnLVhPrGmNcbu0krs rfHezQgRxXKPJ3CBeQ0twkrmnI9iO0XZULfUB/Wcky1HrnZNP69mxz66Haaiwqy5wV W+FCNjkUL3XNNzcHqQ8FEYV7UTIBrR86xEzZjxy+/LKGNOqUTS1BXal1m1b0c386Pa ZkN5rSY3Ye+Tw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peng Ma , Mario Limonciello , Perry Yuan , "Rafael J . Wysocki" , Sasha Levin , ray.huang@amd.com, gautham.shenoy@amd.com, rafael@kernel.org, linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 6.9 25/28] cpufreq: amd-pstate: fix memory leak on CPU EPP exit Date: Wed, 5 Jun 2024 07:48:54 -0400 Message-ID: <20240605114927.2961639-25-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605114927.2961639-1-sashal@kernel.org> References: <20240605114927.2961639-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.9.3 Content-Transfer-Encoding: 8bit From: Peng Ma [ Upstream commit cea04f3d9aeebda9d9c063c0dfa71e739c322c81 ] The cpudata memory from kzalloc() in amd_pstate_epp_cpu_init() is not freed in the analogous exit function, so fix that. Signed-off-by: Peng Ma Acked-by: Mario Limonciello Reviewed-by: Perry Yuan [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/amd-pstate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 2015c9fcc3c91..097268e7b0aa8 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1378,6 +1378,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) { + struct amd_cpudata *cpudata = policy->driver_data; + + if (cpudata) { + kfree(cpudata); + policy->driver_data = NULL; + } + pr_debug("CPU %d exiting\n", policy->cpu); return 0; } -- 2.43.0