diff options
| author | John Olender <john.olender@gmail.com> | 2025-09-05 13:11:28 +0300 | 
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2025-09-09 23:14:23 +0300 | 
| commit | 4e89d629dc72965ea05a9b5231862ffd9c9dab55 (patch) | |
| tree | 9e3a9b0aed4186f6ab029734082b7e52548259db /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
| parent | a525fa37aac36c4591cc8b07ae8957862415fbd5 (diff) | |
| download | linux-4e89d629dc72965ea05a9b5231862ffd9c9dab55.tar.xz | |
drm/amdgpu: Fix NULL ptr deref in amdgpu_device_cache_switch_state()
Kaveri has no upstream bridge, therefore parent is NULL.
$ lspci -PP
...
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Kaveri [Radeon R7 Graphics] (rev d4)
For comparison, Raphael:
$ lspci -PP
...
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raphael/Granite Ridge Internal GPP Bridge to Bus [C:A]
...
00:08.1/0e:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Raphael (rev c5)
Fixes: 1dd2fa0e00f1 ("drm/amdgpu: Save and restore switch state")
Link: https://lore.kernel.org/amd-gfx/38fe6513-f8a9-4669-8e86-89c54c465611@gmail.com/
Reviewed-by: Candice Li <candice.li@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: John Olender <john.olender@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index bdfb80377e6a..b20383021b50 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -7161,7 +7161,7 @@ static void amdgpu_device_cache_switch_state(struct amdgpu_device *adev)  	struct pci_dev *parent = pci_upstream_bridge(adev->pdev);  	int r; -	if (parent->vendor != PCI_VENDOR_ID_ATI) +	if (!parent || parent->vendor != PCI_VENDOR_ID_ATI)  		return;  	/* If already saved, return */ | 
