drm/amdgpu: Check if NBIO funcs are NULL in amdgpu_device_baco_exit
Subsystems (2)
PATCH 1/1 drm/amdgpu: Check if NBIO funcs are NULL in amdgpu_device_baco_exit
The special case for VM passthrough doesn't check adev->nbio.funcs before dereferencing it. If GPUs that don't have an NBIO block are passed through, this leads to a NULL pointer dereference on startup.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -6165,7 +6165,7 @@ int amdgpu_device_baco_exit(struct drm_device *dev) adev->nbio.funcs->enable_doorbell_interrupt) adev->nbio.funcs->enable_doorbell_interrupt(adev, true); -if (amdgpu_passthrough (adev) && +if (amdgpu_passthrough (adev) && adev->nbio.funcs && adev->nbio.funcs->clear_doorbell_interrupt) adev->nbio.funcs->clear_doorbell_interrupt (adev);
--
2.45.0
Am 14.05.24 um 09:06 schrieb Friedrich Vock:
Quoted 5 lines
The special case for VM passthrough doesn't check
adev->nbio.funcsbefore dereferencing it. If GPUs that don't have an NBIO block are passed through, this leads to a NULL pointer dereference on startup.Signed-off-by Friedrich Vock <[email protected]>
Quoted 24 lines
Fixes 1bece222eab ("drm/amdgpu: Clear doorbell interrupt status for Sienna Cichlid")Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-2@@ -6165,7 +6165,7 @@ int amdgpu_device_baco_exit(struct drm_device *dev) adev->nbio.funcs->enable_doorbell_interrupt) adev->nbio.funcs->enable_doorbell_interrupt(adev, true); -if (amdgpu_passthrough (adev) && +if (amdgpu_passthrough (adev) && adev->nbio.funcs && adev->nbio.funcs->clear_doorbell_interrupt) adev->nbio.funcs->clear_doorbell_interrupt (adev); --2.45.0
Alex Deucher
AppliedApplied. Thanks!
Quoted 35 lines · Christian König
Am 14.05.24 um 09:06 schrieb Friedrich Vock:
Quoted 5 lines
The special case for VM passthrough doesn't check
adev->nbio.funcsbefore dereferencing it. If GPUs that don't have an NBIO block are passed through, this leads to a NULL pointer dereference on startup.Signed-off-by Friedrich Vock <[email protected]>Acked-by Christian König <[email protected]>Quoted 24 lines
Fixes 1bece222eab ("drm/amdgpu: Clear doorbell interrupt status for Sienna Cichlid")Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-2@@ -6165,7 +6165,7 @@ int amdgpu_device_baco_exit(struct drm_device *dev) adev->nbio.funcs->enable_doorbell_interrupt) adev->nbio.funcs->enable_doorbell_interrupt (adev, true); -if (amdgpu_passthrough (adev) && +if (amdgpu_passthrough (adev) && adev->nbio.funcs && adev->nbio.funcs->clear_doorbell_interrupt) adev->nbio.funcs->clear_doorbell_interrupt (adev); --2.45.0