Commit 5428672d authored by Dong Chenchen's avatar Dong Chenchen Committed by Alex Deucher
Browse files

drm/amdgpu: Fix memory leak in amdgpu_cs_pass1



When p->gang_size equals 0, amdgpu_cs_pass1() will return directly
without freeing chunk_array, which will cause a memory leak issue,
this patch fixes it.

Fixes: 4624459c ("drm/amdgpu: add gang submit frontend v6")
Reviewed-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 094226ad
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -287,8 +287,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
		}
	}

	if (!p->gang_size)
		return -EINVAL;
	if (!p->gang_size) {
		ret = -EINVAL;
		goto free_partial_kdata;
	}

	for (i = 0; i < p->gang_size; ++i) {
		ret = amdgpu_job_alloc(p->adev, num_ibs[i], &p->jobs[i], vm);