[PATCH V2 2/2] drm/amdgpu: fix hive reference leak when adding xgmi device

Zhang, Hawking Hawking.Zhang at amd.com
Wed Aug 17 14:18:04 UTC 2022


[AMD Official Use Only - General]

Series is

Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>

Regards,
Hawking
From: Chai, Thomas <YiPeng.Chai at amd.com>
Date: Wednesday, August 17, 2022 at 14:20
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Chai, Thomas <YiPeng.Chai at amd.com>, Zhang, Hawking <Hawking.Zhang at amd.com>, Zhou1, Tao <Tao.Zhou1 at amd.com>, Clements, John <John.Clements at amd.com>, Li, Candice <Candice.Li at amd.com>, Chai, Thomas <YiPeng.Chai at amd.com>
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 <YiPeng.Chai at amd.com>
---
 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220817/32ca33de/attachment.htm>


More information about the amd-gfx mailing list