]> git.ipfire.org Git - thirdparty/linux.git/commit
iommu/amd: Fix clone_alias() to use the original device's devid
authorVasant Hegde <vasant.hegde@amd.com>
Wed, 1 Apr 2026 08:00:17 +0000 (08:00 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Thu, 2 Apr 2026 07:31:24 +0000 (09:31 +0200)
commitfaad224fe0f0857a04ff2eb3c90f0de57f47d0f3
tree2d32563f881240b8b33eaa496c7ad70fe7523ed6
parent0e59645683b7b6fa20eceb21a6f420e4f7412943
iommu/amd: Fix clone_alias() to use the original device's devid

Currently clone_alias() assumes first argument (pdev) is always the
original device pointer. This function is called by
pci_for_each_dma_alias() which based on topology decides to send
original or alias device details in first argument.

This meant that the source devid used to look up and copy the DTE
may be incorrect, leading to wrong or stale DTE entries being
propagated to alias device.

Fix this by passing the original pdev as the opaque data argument to
both the direct clone_alias() call and pci_for_each_dma_alias(). Inside
clone_alias(), retrieve the original device from data and compute devid
from it.

Fixes: 3332364e4ebc ("iommu/amd: Support multiple PCI DMA aliases in device table")
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd/iommu.c