Skip to contentSkip to conversation

drm/amdgpu: fix possible UAF in amdgpu_cs_pass1()

PATCH In review Alex Deucher 3 participants 3 messages Jul 28, 2023 – Aug 3, 2023

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: fix possible UAF in amdgpu_cs_pass1()

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index 040f4cb6ab2d0..fb78a8f475879 100644
@@ -295,7 +295,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) {
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw

[Public]

Quoted 8 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, July 28, 2023 11:23 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: fix possible UAF in amdgpu_cs_pass1()

Quoted 4 lines

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

Regards,
Guchun

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index 040f4cb6ab2d0..fb78a8f475879 100644
@@ -295,7 +295,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) {

--
2.41.0

#2 lore raw

Am 31.07.23 um 03:41 schrieb Chen, Guchun:

Quoted 10 lines

[Public]

Quoted 8 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, July 28, 2023 11:23 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: fix possible UAF in amdgpu_cs_pass1()

Quoted 5 lines
Quoted 4 lines

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

Might have already been landed, but the patch is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.

Quoted 25 lines

Regards,
Guchun

Quoted 21 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index 040f4cb6ab2d0..fb78a8f475879 100644
@@ -295,7 +295,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) {

--
2.41.0