diff options
author | Bernard Zhao <bernard@vivo.com> | 2021-11-14 18:58:50 -0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-11-22 14:45:03 -0500 |
commit | 7b833d680481f463276aedf500696ea25698deaa (patch) | |
tree | bbe0a595e2ac4eb57fa8d0e34507f3f1d2d2dd46 /drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | |
parent | 8b11e14bd5793cd0e5cb65055fe51588a779f05b (diff) | |
download | linux-7b833d680481f463276aedf500696ea25698deaa.tar.gz linux-7b833d680481f463276aedf500696ea25698deaa.tar.bz2 linux-7b833d680481f463276aedf500696ea25698deaa.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/gpu/drm/amd/amdgpu/amdgpu_xgmi.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 |
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; |