[PATCH RFC v4 5/9] powerpc/powernv/ioda: Fix using uninitialized IOMMU group

Sergey Miroshnichenko s.miroshnichenko at yadro.com
Sat Mar 2 03:04:36 AEDT 2019


Otherwise there will be a NULL pointer dereferencing in iommu_add_device()
later during activating a newly created VF.

Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko at yadro.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3b8b21a70196..0631e8196dad 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1593,6 +1593,9 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)
 
 		pnv_pci_ioda2_setup_dma_pe(phb, pe);
 #ifdef CONFIG_IOMMU_API
+		iommu_register_group(&pe->table_group,
+				     pe->phb->hose->global_number,
+				     pe->pe_number);
 		pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL);
 #endif
 	}
-- 
2.20.1



More information about the Linuxppc-dev mailing list