drm/amdgpu: Fix NULL ptr deref in amdgpu_device_cache_switch_state()
Subsystems (2)
PATCH 1/1 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)
--- 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
@@ -7148,7 +7148,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 */
base-commit: 035edba1e204b302ae74269d4f09e355153a79ac
Signature · 1 line
2.47.2
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks,
Candice
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of John Olender
Sent: Friday, September 5, 2025 6:11 PM
To: Wang, Yang(Kevin) <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Sun, Ce(Overlord) <[email protected]>; John Olender <[email protected]>
Subject: [PATCH] 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)
--- 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
@@ -7148,7 +7148,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 */
base-commit: 035edba1e204b302ae74269d4f09e355153a79ac --
2.47.2
[AMD Official Use Only - AMD Internal Distribution Only]
Best Regards,
Kevin
-----Original Message-----
From: John Olender <[email protected]>
Sent: Friday, September 5, 2025 6:11 PM
To: Wang, Yang(Kevin) <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Sun, Ce(Overlord) <[email protected]>; John Olender <[email protected]>
Subject: [PATCH] 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)
--- 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
@@ -7148,7 +7148,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 */
base-commit: 035edba1e204b302ae74269d4f09e355153a79ac --
2.47.2
Alex Deucher
AppliedApplied. Thanks!
Quoted 53 lines · Yang(Kevin)
[AMD Official Use Only - AMD Internal Distribution Only]
Reviewed-by Yang Wang <[email protected]>Best Regards,
Kevin-----Original Message-----
From: John Olender <[email protected]>
Sent: Friday, September 5, 2025 6:11 PM
To: Wang, Yang(Kevin) <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Sun, Ce(Overlord) <[email protected]>; John Olender <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix NULL ptr deref inamdgpu_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 e5e203e0cd53 ("drm/amdgpu: Save and restore switch state")Signed-off-by John Olender <[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
-1@@ -7148,7 +7148,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 */ base-commit:
035edba1e204b302ae74269d4f09e355153a79ac--
2.47.2