Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp252532lqr; Wed, 5 Jun 2024 05:16:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqG9BG3yKDE66qLwSScJjOXRa34yw4hEyRhgWbDI4vhqsHSmAZ+2nx7yfuDX2FQ4Y0B2jLqfHV53pHhUw5of5rsftF01HthOPOjK3l7A== X-Google-Smtp-Source: AGHT+IFuX2krx2T6IzGPxyph4JBQ2MhbBEWxlTqv/9Y5ntUR4BbYqIBL8psi/MKXCmhh9COph8Ql X-Received: by 2002:a05:6a20:3d87:b0:1af:b0be:4661 with SMTP id adf61e73a8af0-1b2b6f95856mr3173964637.19.1717589797771; Wed, 05 Jun 2024 05:16:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717589797; cv=pass; d=google.com; s=arc-20160816; b=QWZ3Imv8neWQ2zyGdWij68UtQb+sV3JZLoQ8hX2kbid2L2OCXdBHgnmcsfTn1u3f/d 8ziGOBaObjx8T+ADMA1gdMz0Dz8BOF4zCQcCUO3WCPJdr9Q5yE7VTJ4dMUR5ga1grgU1 DfAGOEQUaEGn3Vtl8xpIoE/+gDbkBABF2gnhhRE0Xk0Oq/b+npoyMA9doqtaq/5WE6KW LF8IwYmdKZw2AyorFO74Vqvx2Vezxuj1K2mnim5LpL26dhsYpxacSBTg6CBg3NP2R8UB WQbum1GPPS1f56zr7MBwPMGJMuRwsE5xVhb7eJViujrNfAFuVSZTUAp/vOBWokLghf/a dx/A== 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=BzdW3hnp9Nr++vnrB5NT12PDPhnmrbJShCxyEhfv9y8=; fh=rzccf86xRhwWv8SIH6spfBi2IrLEFbujUIY28QwTats=; b=wDpt0XWUEmwKndu8g8haMcLdg2zwstePXZYqutNZLj7SfdklkxmZ12rbu3o3vFPFqN sZGdrKz8y7FxLGhk4CW7D4yb1xgQrFHEGjutH5SLxyrjlkErpzsWqwnDNYKxdJgqdVMW AcpIBk9qq0lL3qv4h2e+YWMJKJftsCvquOnCj0UP8dr9Qy830QdZ58nnSKrU0MrWOt8f WAaQngaifMs8pq23PTZsBTGk10jEwtRz85RQSFoiDrL0u943qy9wHCLw9G31tgPZFDqU 4xCWTUia/OVlkl/qG1KMCgGemh7xr6FtToWhmH5WtXUtyywI7GVJ/DOU0vmHUICzQTen JM6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mO8yHuZg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202352-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540fb254si9781834a12.164.2024.06.05.05.16.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mO8yHuZg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202352-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 18F64B24FE1 for ; Wed, 5 Jun 2024 12:03:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFD5D1A2FA5; Wed, 5 Jun 2024 11:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mO8yHuZg" 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 10A3019925C; Wed, 5 Jun 2024 11:51:57 +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=1717588317; cv=none; b=iiHan7fXLdOPPB95vBkk0dZEIrIKvdvKTYpVDZCyX7CjeD/ZwP40fxnUP9CtKAq0gu2/0S0qr696OAz4HLwzjC1hQBUxOh9/9tUghRKOtX6CrOXePRyeEmWowE2/qw4MvTQ6g3Ku6qB+0ntbRGDS03Cg7Uda/Mm4442yf8cQPzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588317; c=relaxed/simple; bh=kjeZ8UHJFxHkLku+pSLI36o1lVjKiKC7NzUYHLFjFwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LSmkVpxxEgRHoZydoxYZkxfKP8NSnHoB2aaJd1SyR8J8h9aqHEWdYfodNHnnsM8PdGErPOcyP/1dW9FndZFdTzfPcLKm7rqgFa5EBFBGIHJVskzPeM+TozWwJ4I6AndyVDHkid5iiYvnYIPP5q4gBZM8/V+DW3ZAoMkj3IP/9iI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mO8yHuZg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9FD8C4AF09; Wed, 5 Jun 2024 11:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588316; bh=kjeZ8UHJFxHkLku+pSLI36o1lVjKiKC7NzUYHLFjFwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mO8yHuZghR1kD0XUAUF5JTvTdOKhZg6EXWeL/idGvo8auQsDxsEJJtz8U+Jaoxgyk T2GusckToELEAp9TlTVQdkz5jTWclz8ARypFv5S4X0RsMiz9bTTFBfwpvQjavO+l7k BoDFf2JHdfOcgJcLaaK5tBgCC2vNbEx938TwvYWri5qSufnP3hejuVF6oAOsHMrZv1 CbUi7kuhJR3aOnrM2KOLdMout8CSbXqSGfsRHeHFfERDNhIPBPnCDzmRmd2oMbv72m qAO9EIO+y6uGx6+NiZpBU4b0zt6MqkPYj5tVhILqYM2v8mENquwQ8FXeSl0BrcMLj1 iUO7TSeVZ607g== 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.8 21/24] cpufreq: amd-pstate: fix memory leak on CPU EPP exit Date: Wed, 5 Jun 2024 07:50:31 -0400 Message-ID: <20240605115101.2962372-21-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115101.2962372-1-sashal@kernel.org> References: <20240605115101.2962372-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.8.12 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 07f3419954396..3efc2aef31ce4 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1216,6 +1216,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