* [PATCH] iommu/amd: Fix NULL pointer dereference for GPUs without upstream bridge
[not found] <6a3cf464-6c1b-460a-9ee5-5468ded48e0a@amd.com>
@ 2026-11-03 15:16 ` Jean-Christophe Guillain
2026-11-05 3:36 ` Vasant Hegde
0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe Guillain @ 2026-11-03 15:16 UTC (permalink / raw)
To: vasant.hegde, joro
Cc: suravee.suthikulpanit, will, robin.murphy, iommu, linux-kernel,
Jean-Christophe Guillain
pci_upstream_bridge() can return NULL for devices without an upstream
bridge. The AMD GPU identity mapping quirk dereferences the returned
pointer unconditionally, causing a kernel panic during boot.
Check the pointer before accessing the bridge vendor ID.
This fixes a boot regression on a Lenovo system with an AMD PRO
A10-9700E APU. The system now boots with AMD IOMMU enabled.
Fixes: bf5bdfd1f8d4 ("iommu/amd: Force identity mode for selected GPUs only")
Signed-off-by: Jean-Christophe Guillain <jean-christophe@guillain.net>
---
drivers/iommu/amd/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 960e1dc05ec6..75e98e2e9d83 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3372,6 +3372,7 @@ static bool amd_iommu_is_attach_deferred(struct device *dev)
static bool quirks_force_identity_mapping(struct pci_dev *pdev)
{
+ struct pci_dev *bridge;
int class = pdev->class >> 8;
/* AMD GPU vendor ID */
@@ -3383,7 +3384,8 @@ static bool quirks_force_identity_mapping(struct pci_dev *pdev)
class != PCI_CLASS_DISPLAY_OTHER)
return false;
- if (pci_upstream_bridge(pdev)->vendor == PCI_VENDOR_ID_ATI)
+ bridge = pci_upstream_bridge(pdev);
+ if (bridge && bridge->vendor == PCI_VENDOR_ID_ATI)
return false;
/* It is the GPU in an APU, force identity domain */
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/amd: Fix NULL pointer dereference for GPUs without upstream bridge
2026-11-03 15:16 ` [PATCH] iommu/amd: Fix NULL pointer dereference for GPUs without upstream bridge Jean-Christophe Guillain
@ 2026-11-05 3:36 ` Vasant Hegde
0 siblings, 0 replies; 2+ messages in thread
From: Vasant Hegde @ 2026-11-05 3:36 UTC (permalink / raw)
To: Jean-Christophe Guillain, joro
Cc: suravee.suthikulpanit, will, robin.murphy, iommu, linux-kernel
On 11/3/2026 8:46 PM, Jean-Christophe Guillain wrote:
> [You don't often get email from jean-christophe@guillain.net. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> pci_upstream_bridge() can return NULL for devices without an upstream
> bridge. The AMD GPU identity mapping quirk dereferences the returned
> pointer unconditionally, causing a kernel panic during boot.
>
> Check the pointer before accessing the bridge vendor ID.
>
> This fixes a boot regression on a Lenovo system with an AMD PRO
> A10-9700E APU. The system now boots with AMD IOMMU enabled.
>
> Fixes: bf5bdfd1f8d4 ("iommu/amd: Force identity mode for selected GPUs only")
>
> Signed-off-by: Jean-Christophe Guillain <jean-christophe@guillain.net>
Thanks Jean! Queued for rc.
-Vasant
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <6a3cf464-6c1b-460a-9ee5-5468ded48e0a@amd.com>
2026-11-03 15:16 ` [PATCH] iommu/amd: Fix NULL pointer dereference for GPUs without upstream bridge Jean-Christophe Guillain
2026-11-05 3:36 ` Vasant Hegde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®