mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
drm/amdgpu: fix resource leak on ACP reset timeout
commit020da7c5aaupstream. When ACP soft reset poll times out, original code returns early without cleanup, leaking MFD child devices, genpd links and all ACP heap allocations. Replace direct early return with goto out to force run all cleanup logic regardless of reset success, preserve timeout error code for caller. Signed-off-by: Ce Sun <cesun102@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit98073e4328) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ffb33d466a
commit
68eab5a64d
@@ -505,6 +505,7 @@ static int acp_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
u32 val = 0;
|
||||
u32 count = 0;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
int ret = 0;
|
||||
|
||||
/* return early if no ACP */
|
||||
if (!adev->acp.acp_genpd) {
|
||||
@@ -526,7 +527,8 @@ static int acp_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
break;
|
||||
if (--count == 0) {
|
||||
dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
|
||||
return -ETIMEDOUT;
|
||||
ret = -ETIMEDOUT;
|
||||
goto out;
|
||||
}
|
||||
udelay(100);
|
||||
}
|
||||
@@ -543,11 +545,12 @@ static int acp_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
break;
|
||||
if (--count == 0) {
|
||||
dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
|
||||
return -ETIMEDOUT;
|
||||
ret = -ETIMEDOUT;
|
||||
goto out;
|
||||
}
|
||||
udelay(100);
|
||||
}
|
||||
|
||||
out:
|
||||
device_for_each_child(adev->acp.parent, NULL,
|
||||
acp_genpd_remove_device);
|
||||
|
||||
@@ -556,7 +559,7 @@ static int acp_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
kfree(adev->acp.acp_genpd);
|
||||
kfree(adev->acp.acp_cell);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int acp_suspend(struct amdgpu_ip_block *ip_block)
|
||||
|
||||
Reference in New Issue
Block a user