[AMD Official Use Only - General]

Series is

Reviewed-by: Hawking Zhang <[email protected]>

Regards,
Hawking
From: Chai, Thomas <[email protected]>
Date: Wednesday, August 17, 2022 at 14:20
To: [email protected] <[email protected]>
Cc: Chai, Thomas <[email protected]>, Zhang, Hawking <[email protected]>, 
Zhou1, Tao <[email protected]>, Clements, John <[email protected]>, Li, 
Candice <[email protected]>, Chai, Thomas <[email protected]>
Subject: [PATCH V2 2/2] drm/amdgpu: fix hive reference leak when adding xgmi 
device
Only amdgpu_get_xgmi_hive but no amdgpu_put_xgmi_hive
which will leak the hive reference.

Signed-off-by: YiPeng Chai <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c84fdef0ac45..cf55b9354831 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2456,12 +2456,14 @@ static int amdgpu_device_ip_init(struct amdgpu_device 
*adev)
                         if (!hive->reset_domain ||
                             
!amdgpu_reset_get_reset_domain(hive->reset_domain)) {
                                 r = -ENOENT;
+                               amdgpu_put_xgmi_hive(hive);
                                 goto init_failed;
                         }

                         /* Drop the early temporary reset domain we created 
for device */
                         amdgpu_reset_put_reset_domain(adev->reset_domain);
                         adev->reset_domain = hive->reset_domain;
+                       amdgpu_put_xgmi_hive(hive);
                 }
         }

--
2.25.1

Reply via email to