Skip to contentSkip to conversation

drm/amdkfd: Fix NULL pointer dereference

PATCH In review Felix Kuehling 3 participants 3 messages Apr 6, 2022 – Apr 7, 2022

Subsystems (3)
lore
Share & tools
lore

Felix Kuehling

author maintainer
#0 lore raw

PATCH 1/1 drm/amdkfd: Fix NULL pointer dereference

Check that adev->gfx.ras is valid before using it.

Fixes f385fc0d19ce ("drm/amdgpu: add UTCL2 RAS poison query for Aldebaran (v2)")
CC Tao Zhou <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1 -1
index c18c4be1e4ac..64c6664b34e8 100644
@@ -727,7 +727,7 @@ void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bo
 
 bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev)
 {
-	if (adev->gfx.ras->query_utcl2_poison_status)
+	if (adev->gfx.ras && adev->gfx.ras->query_utcl2_poison_status)
 		return adev->gfx.ras->query_utcl2_poison_status(adev);
 	else
 		return false;
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Quoted 38 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Felix Kuehling
Sent: Wednesday, April 6, 2022 5:06 PM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 1/1] drm/amdkfd: Fix NULL pointer dereference

[CAUTION: External Email]

Check that adev->gfx.ras is valid before using it.

Fixes f385fc0d19ce ("drm/amdgpu: add UTCL2 RAS poison query for

Aldebaran (v2)")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -0
index c18c4be1e4ac..64c6664b34e8 100644
@@ -727,7 +727,7 @@ void

amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bo

bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct
amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1 -2
-       if (adev->gfx.ras->query_utcl2_poison_status)
+       if (adev->gfx.ras && adev->gfx.ras->query_utcl2_poison_status)
                return adev->gfx.ras->query_utcl2_poison_status(adev);
        else
                return false;
--

2.32.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Felix Kuehling

[AMD Official Use Only]

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Felix Kuehling
Sent: Thursday, April 7, 2022 05:06
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 1/1] drm/amdkfd: Fix NULL pointer dereference

Check that adev->gfx.ras is valid before using it.

Fixes f385fc0d19ce ("drm/amdgpu: add UTCL2 RAS poison query for Aldebaran (v2)")
CC Tao Zhou <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1 -2
index c18c4be1e4ac..64c6664b34e8 100644
@@ -727,7 +727,7 @@ void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bo
 
 bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev)  {
-       if (adev->gfx.ras->query_utcl2_poison_status)
+       if (adev->gfx.ras && adev->gfx.ras->query_utcl2_poison_status)
                return adev->gfx.ras->query_utcl2_poison_status(adev);
        else
                return false;
--

2.32.0