[Bionic][PATCH 08/18] powerpc/powernv/ioda2: Remove redundant free of TCE pages

Jose Ricardo Ziviani joserz at linux.ibm.com
Wed Oct 31 15:09:21 UTC 2018

From: Alexey Kardashevskiy <aik at ozlabs.ru>

BugLink: https://bugs.launchpad.net/qemu-kvm/+bug/1800649

When IODA2 creates a PE, it creates an IOMMU table with it_ops::free
set to pnv_ioda2_table_free() which calls pnv_pci_ioda2_table_free_pages().

Since iommu_tce_table_put() calls it_ops::free when the last reference
to the table is released, explicit call to pnv_pci_ioda2_table_free_pages()
is not needed so let's remove it.

This should fix double free in the case of PCI hotuplug as
pnv_pci_ioda2_table_free_pages() does not reset neither
iommu_table::it_base nor ::it_size.

This was not exposed by SRIOV as it uses different code path via

IODA1 does not inialize it_ops::free so it does not have this issue.

Fixes: c5f7700bbd2e ("powerpc/powernv: Dynamically release PE")
Cc: stable at vger.kernel.org # v4.8+
Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
(cherry picked from commit 98fd72fe82527fd26618062b60cfd329451f2329)
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.ibm.com>
 arch/powerpc/platforms/powernv/pci-ioda.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 1b36dc9b6c82..f0cdb4667f44 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3663,7 +3663,6 @@ static void pnv_pci_ioda2_release_pe_dma(struct pnv_ioda_pe *pe)
-	pnv_pci_ioda2_table_free_pages(tbl);

More information about the kernel-team mailing list