[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_NrcF+Swf0T+upaM64=WYfxExEHyBEGKTDAB8P4Khyw1Q@mail.gmail.com>
Date: Wed, 3 Jan 2024 09:30:04 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: Zhipeng Lu <alexious@....edu.cn>
Cc: dri-devel@...ts.freedesktop.org, Ran Sun <sunran001@...suo.com>,
Thomas Zimmermann <tzimmermann@...e.de>, Deepak R Varma <drv@...lo.com>, Rex Zhu <Rex.Zhu@....com>,
Ruan Jinjie <ruanjinjie@...wei.com>, "Pan, Xinhui" <Xinhui.Pan@....com>, linux-kernel@...r.kernel.org,
amd-gfx@...ts.freedesktop.org, Mario Limonciello <mario.limonciello@....com>,
Daniel Vetter <daniel@...ll.ch>, Alex Deucher <alexander.deucher@....com>,
Ken Wang <Qingqing.Wang@....com>, Evan Quan <evan.quan@....com>,
David Airlie <airlied@...il.com>, Christian König <christian.koenig@....com>
Subject: Re: [PATCH] drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init
Applied. Thanks!
On Mon, Dec 25, 2023 at 5:18 AM Zhipeng Lu <alexious@....edu.cn> wrote:
>
> 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 <alexious@....edu.cn>
> ---
> 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.34.1
>
Powered by blists - more mailing lists