Skip to content

Commit ee41e5b

Browse files
GoodLuck612alexdeucher
authored andcommitted
drm/amdgpu: Fix memory leak in amdgpu_ras_init()
When amdgpu_nbio_ras_sw_init() fails in amdgpu_ras_init(), the function returns directly without freeing the allocated con structure, leading to a memory leak. Fix this by jumping to the release_con label to properly clean up the allocated memory before returning the error code. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: fdc94d3 ("drm/amdgpu: Rework pcie_bif ras sw_init") Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0c44d61 commit ee41e5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4352,7 +4352,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
43524352
* to handle fatal error */
43534353
r = amdgpu_nbio_ras_sw_init(adev);
43544354
if (r)
4355-
return r;
4355+
goto release_con;
43564356

43574357
if (adev->nbio.ras &&
43584358
adev->nbio.ras->init_ras_controller_interrupt) {

0 commit comments

Comments
 (0)