AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Zilin Guan <zilin@seu.edu.cn>, alexander.deucher@amd.com
Cc: christian.koenig@amd.com, airlied@gmail.com, simona@ffwll.ch,
	mario.limonciello@amd.com, pratap.nirujogi@amd.com,
	alex.hung@amd.com, sakari.ailus@linux.intel.com,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] drm/amdgpu: Fix memory leak in amdgpu_acpi_enumerate_xcc()
Date: Thu, 29 Jan 2026 15:44:47 +0530	[thread overview]
Message-ID: <4bfe8f26-3ead-4d6f-a85b-da83ad45d57e@amd.com> (raw)
In-Reply-To: <20260129092532.921809-1-zilin@seu.edu.cn>



On 29-Jan-26 2:55 PM, Zilin Guan wrote:
> In amdgpu_acpi_enumerate_xcc(), if amdgpu_acpi_dev_init() returns -ENOMEM,
> the function returns directly without releasing the allocated xcc_info,
> resulting in a memory leak.
> 
> Fix this by ensuring that xcc_info is properly freed in the error paths.
> 
> Compile tested only. Issue found using a prototype static analysis tool
> and code review.
> 
> Fixes: 4d5275ab0b18 ("drm/amdgpu: Add parsing of acpi xcc objects")
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>

Thanks,
Lijo


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index d31460a9e958..7c9d8a6d0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -1135,8 +1135,10 @@ static int amdgpu_acpi_enumerate_xcc(void)
>   		if (!dev_info)
>   			ret = amdgpu_acpi_dev_init(&dev_info, xcc_info, sbdf);
>   
> -		if (ret == -ENOMEM)
> +		if (ret == -ENOMEM) {
> +			kfree(xcc_info);
>   			return ret;
> +		}
>   
>   		if (!dev_info) {
>   			kfree(xcc_info);


  reply	other threads:[~2026-01-29 10:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  9:25 [PATCH] drm/amdgpu: Fix memory leak in amdgpu_acpi_enumerate_xcc() Zilin Guan
2026-01-29 10:14 ` Lazar, Lijo [this message]
2026-02-02 14:51   ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bfe8f26-3ead-4d6f-a85b-da83ad45d57e@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=airlied@gmail.com \
    --cc=alex.hung@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=mario.limonciello@amd.com \
    --cc=pratap.nirujogi@amd.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=simona@ffwll.ch \
    --cc=zilin@seu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox