From mboxrd@z Thu Jan 1 00:00:00 1970 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 B8EB36BB56; Tue, 23 Jan 2024 02:03:18 +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=1705975398; cv=none; b=LugVWrPl7YwPS4E9FWeNFz32h0N9t9T/6Nspg8Vu9DHx/RbAfg3rE0m2MZaEkUmkJiKgMxSPViafkfZ5oVoLGe1iHGIW6Rffa4RH76tCAJRI/Lb1rLBaNVR+yTxifJi0HIUhcJfVcG8jBAkV83yCFD4CRoaZQDCoRy5PiGAFKd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705975398; c=relaxed/simple; bh=fnQUxwwWySV1v7fjR5tFNfMpKyjFr44qvAW5kvezLNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=evVhndACF3SVV9vwmTvScMCkcZ5RWNnyPEMAS70+axXfQ80QNgB5Gvj0cBnRldnrZXd55/PJ9hXymI2+pi3kjztL+3nu3QtOoX1fsJHXw4AbanME9R9/5l56u1zFQJUlivUsh0a0DXESLxbQ37VEt7xoLmgF52y04sgJWYAAdIM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dbdF+RcO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dbdF+RcO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72D4BC433C7; Tue, 23 Jan 2024 02:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705975398; bh=fnQUxwwWySV1v7fjR5tFNfMpKyjFr44qvAW5kvezLNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dbdF+RcOBn1oJ3IOEN81dDwzJs2MD+06nQQ9pOKKs3N19tioCfYri630JRqOfBA/C tgF+rKkmGtJ+RnGX6s8VSgjECSvpzqt9G0DL6GxLn+H0fnj8GeUCi4kai80POP84t3 Y3obosLCIg8HeS81jSOnw8mxo9qv2ZCOV/4h8/7Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhipeng Lu , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 332/583] drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init Date: Mon, 22 Jan 2024 15:56:23 -0800 Message-ID: <20240122235822.204749867@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235812.238724226@linuxfoundation.org> References: <20240122235812.238724226@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhipeng Lu [ Upstream commit 2f3be3ca779b11c332441b10e00443a2510f4d7b ] The hwmgr->backend, (i.e. data) allocated by kzalloc is not freed in the error-handling paths of smu7_get_evv_voltages and smu7_update_edc_leakage_table. However, it did be freed in the error-handling of phm_initializa_dynamic_state_adjustment_rule_settings, by smu7_hwmgr_backend_fini. So the lack of free in smu7_get_evv_voltages and smu7_update_edc_leakage_table is considered a memleak in this patch. Fixes: 599a7e9fe1b6 ("drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.") Fixes: 8f0804c6b7d0 ("drm/amd/pm: add edc leakage controller setting") Signed-off-by: Zhipeng Lu Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c index 11372fcc59c8..b1a8799e2dee 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c @@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) result = smu7_get_evv_voltages(hwmgr); if (result) { pr_info("Get EVV Voltage Failed. Abort Driver loading!\n"); + kfree(hwmgr->backend); + hwmgr->backend = NULL; return -EINVAL; } } else { @@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) } result = smu7_update_edc_leakage_table(hwmgr); - if (result) + if (result) { + smu7_hwmgr_backend_fini(hwmgr); return result; + } return 0; } -- 2.43.0