drm/amd/amdgpu: fix potential memleak
Subsystems (2)
PATCH 1/1 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.
Signed-off-by Bernard Zhao <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -0
@@ -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;
Signature · 1 line
2.33.1
Am 2021-11-14 um 9:58 p.m. schrieb Bernard Zhao:
Quoted 4 lines
In function
amdgpu_get_xgmi_hive, whenkobject_init_and_addfailed There is a potential memleak if not callkobject_put.Signed-off-by Bernard Zhao <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1
-0@@ -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;
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 26 lines · Felix Kuehling
Am 2021-11-14 um 9:58 p.m. schrieb Bernard Zhao:
Quoted 4 lines
In function
amdgpu_get_xgmi_hive, whenkobject_init_and_addfailed There is a potential memleak if not callkobject_put.Signed-off-by Bernard Zhao <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1
-0@@ -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;