Skip to content

Commit 27dfaed

Browse files
Bernard Zhaoalexdeucher
authored andcommitted
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>
1 parent 2cf49e0 commit 27dfaed

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
386386
"%s", "xgmi_hive_info");
387387
if (ret) {
388388
dev_err(adev->dev, "XGMI: failed initializing kobject for xgmi hive\n");
389+
kobject_put(&hive->kobj);
389390
kfree(hive);
390391
hive = NULL;
391392
goto pro_end;

0 commit comments

Comments
 (0)