summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBernard Zhao <bernard@vivo.com>2021-11-15 03:58:50 +0100
committerAlex Deucher <alexander.deucher@amd.com>2021-11-18 05:04:57 +0100
commit27dfaedc0d321b4ea4e10c53e4679d6911ab17aa (patch)
treeac73aee74c0a269fde3459726cf8b6febefc0489 /drivers
parentdrm/amd/amdkfd: Fix kernel panic when reset failed and been triggered again (diff)
downloadlinux-27dfaedc0d321b4ea4e10c53e4679d6911ab17aa.tar.xz
linux-27dfaedc0d321b4ea4e10c53e4679d6911ab17aa.zip
drm/amd/amdgpu: fix potential memleak
In function amdgpu_get_xgmi_hive, when kobject_init_and_add failed There is a potential memleak if not call kobject_put. Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Bernard Zhao <bernard@vivo.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 0fad2bf854ae..567df2db23ac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -386,6 +386,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
"%s", "xgmi_hive_info");
if (ret) {
dev_err(adev->dev, "XGMI: failed initializing kobject for xgmi hive\n");
+ kobject_put(&hive->kobj);
kfree(hive);
hive = NULL;
goto pro_end;