]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/amdgpu: fix potential memleak
authorBernard Zhao <bernard@vivo.com>
Mon, 15 Nov 2021 02:58:50 +0000 (18:58 -0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 18 Nov 2021 04:04:57 +0000 (23:04 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c

index 0fad2bf854ae9dc10096c5f8b931d8b7ba792939..567df2db23ac783aa851011194298b55429a6bed 100644 (file)
@@ -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;