From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
airlied@gmail.com, simona@ffwll.ch
Cc: navid.emamdoost@gmail.com, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/amdgpu: Fix potential stale ACP domain on initialization failure
Date: Wed, 2 Dec 2026 19:28:01 +0800 [thread overview]
Message-ID: <20261202-85cdeb22ca-drm-amdgpu@mail.sdu.edu.cn> (raw)
The ACP initialization error paths free acp_genpd without removing its
generic power domain. The global domain list can then reference freed
storage.
Remove the initialized domain before freeing it, and handle domain
initialization failure without attempting to remove an unregistered
domain.
This issue was found by our static analysis tool under development.
Fixes: 57be09c6e874 ("drm/amdgpu: fix multiple memory leaks in acp_hw_init")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index f7dc385e6582..da3e249f40c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -254,7 +254,9 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
adev->acp.acp_genpd->gpd.power_on = acp_poweron;
adev->acp.acp_genpd->adev = adev;
- pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false);
+ r = pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false);
+ if (r)
+ goto free_genpd;
dmi_check_system(acp_quirk_table);
switch (acp_machine_id) {
case ST_JADEITE:
@@ -498,6 +500,8 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
kfree(adev->acp.i2s_pdata);
kfree(adev->acp.acp_res);
kfree(adev->acp.acp_cell);
+ pm_genpd_remove(&adev->acp.acp_genpd->gpd);
+free_genpd:
kfree(adev->acp.acp_genpd);
return r;
}
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
reply other threads:[~2026-12-02 11:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261202-85cdeb22ca-drm-amdgpu@mail.sdu.edu.cn \
--to=liguangshuo@mail.sdu.edu.cn \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=navid.emamdoost@gmail.com \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.