Skip to content

Commit

Permalink
drm/amdgpu: fix possible UAF in amdgpu_cs_pass1()
Browse files Browse the repository at this point in the history
commit 90e0656 upstream.

Since the gang_size check is outside of chunk parsing
loop, we need to reset i before we free the chunk data.

Suggested by Ye Zhang (@VAR10CK) of Baidu Security.

Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
alexdeucher authored and gregkh committed Aug 16, 2023
1 parent 2322dd8 commit 9a2393a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Expand Up @@ -287,7 +287,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,

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

for (i = 0; i < p->gang_size; ++i) {
Expand Down

0 comments on commit 9a2393a

Please sign in to comment.