Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp247889lqr; Wed, 5 Jun 2024 05:09:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQFXDUbaUrBhmgcprn9N0JZUGzulX/r8ExjhTZuMlPXhOkIeiMGO5WzcztzhYF+irbcPCAoOgZgtqVL2ZGYO9o2mSUYfMzIN74R/e/wQ== X-Google-Smtp-Source: AGHT+IH1fimq4ZQs93Ba0h8gbWntMXmKLzMBIMKhN+degPkHZnh74moQe3+l9vq5zvE8opP7joO4 X-Received: by 2002:ac8:7f4d:0:b0:43a:b7da:ec97 with SMTP id d75a77b69052e-4402b6e19c6mr22263781cf.50.1717589361052; Wed, 05 Jun 2024 05:09:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717589361; cv=pass; d=google.com; s=arc-20160816; b=Rhe9eR1GGt0BGp1WARJlOWelVilTuZmzVN49W4yLK1eH+Ey2olND60zBT2KdqjiPsu sB9YB7mnK8kmrjuk9B7Z+ZYL7nN8JIxc3nP645JgdXicoVsb2+ypnkVgSDWL629SAjia XQjUV4SqvinT/6nEI1oCqSdU/mnJEpU7Zp79JhGQYnG44IL6U2NMB4yzJDnvufoIukaa vAC4zZ2V2pRvzCKkUZdFB/lg7iYUIWToEQ4Qf8pfzqbv73Y14tvUkTjUaLPk1D4oeC55 gOxUv7rVgYuQddvVCFqmuq1z6l3CAhkwfYTnIcoK+3c3+NzQP0Vfgc0hPJYHvX/5eDQb j1aA== 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=SgZB43w3admpJ9qcUG8Bjmwf7fUQTb9vWXvYwaIK2ozLV7e3EQm1vx4g4NdO3DT2eO zzxTr492Se8e/1oO9MQe+vYSOAaR+xlSYvcHO+vJLg22pg1lwEAO7JSanctWTYUZXF3z yS14vCBWbz5iEYH6ja+CbeGnLw59HzaJ/OVUMaiVqm8NrQKCtRzYEjiR4y2eoh1vH0O4 OEdfkClGTF4dRjU2lALves5Da2dNGu42PbcGPrVYT1+ZYdcx13aCMcLApNBosTqZloYm Y6j4lQhDAEL7lTQ/lU/BQDwK6nvOOFO53cgG8fSCIQUq2C4ocfIvu7UDofqsEY9tVCva O52g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DaNjv8WU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff25822c5si30202381cf.485.2024.06.05.05.09.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:09:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DaNjv8WU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202375-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9C2441C22C37 for ; Wed, 5 Jun 2024 12:09:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47A331AED4F; Wed, 5 Jun 2024 11:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DaNjv8WU" 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 679821AED35; Wed, 5 Jun 2024 11:53:13 +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=1717588393; cv=none; b=gfl4Wh4ztEBejIc9Bc67jbcMY27ZQJm/Nz5zhE0jle4uzALv3HjlLIoIsYh2CY+g7GolIYSxFZb8WMFMNQD8gdCuoHAST1WTC0jKOdrf3oiLqkuxKgqin2jMUr3cENliRX22b+GpxSxtj28HUPOngO04uIUWA8/aJs7MQYc3MeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588393; c=relaxed/simple; bh=kjeZ8UHJFxHkLku+pSLI36o1lVjKiKC7NzUYHLFjFwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nFXrwrrpjxqdi1TBT9vLFGj3mTPzOwis59jnaK+mcpHdmtpc4dGTwq7CtExIaAZHTCuPumSNwwAPYEUsh32U3iY6tsGEsje1EbDnpp6Ujboqbj96ptsRLy8KSVKhsptvFoSZNRAAsP/6qfpcL783PjbFhy2vLrS62ryW+O404KU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DaNjv8WU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA60BC32786; Wed, 5 Jun 2024 11:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588393; bh=kjeZ8UHJFxHkLku+pSLI36o1lVjKiKC7NzUYHLFjFwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaNjv8WUUoFpH8zQnv3qw29go/H00oUOUI5/ephyztejr9cjJ1s+e67d46aRAo+GT XbZXbYvUhD4O4k8lTCtpUeQ8YtGLMWVQIePOvT+aaGDwX4FjebXVU+27axc66L2/kv CisKPhFjsfb3v1glsCL9XLUG0s2nV+TBAHQ7dzZ0tSKSpQYMSAuNlSAqK264a99Zk8 D+MdqFezoFlcJ3mZ6wehegJ+mCQtvtMqTPZJlZ6VYnPZ4D2nf19s9xIocrAnhTxa4b iAwpq4odji81MM6At353QUnshC1RPt+hx2KUW9PeGhXF0dY80aZ5am0UDjW6TzLGQe P3g6bxrIw9cRw== 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.6 18/20] cpufreq: amd-pstate: fix memory leak on CPU EPP exit Date: Wed, 5 Jun 2024 07:52:01 -0400 Message-ID: <20240605115225.2963242-18-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115225.2963242-1-sashal@kernel.org> References: <20240605115225.2963242-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.6.32 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