The patch titled x86_64: Calgary IOMMU: fix error path memleak in calgary_free_tar() has been added to the -mm tree. Its filename is calgary-iommu-fix-error-path-memleak-in.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: x86_64: Calgary IOMMU: fix error path memleak in calgary_free_tar() From: Muli Ben-Yehuda <muli@xxxxxxxxxx> We were freeing the iommu_table and leaking the bitmap pages. Also rename it to calgary_free_bus, which is more accurate. Signed-off-by: Muli Ben-Yehuda <muli@xxxxxxxxxx> Signed-off-by: Jon Mason <jdmason@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/x86_64/kernel/pci-calgary.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff -puN arch/x86_64/kernel/pci-calgary.c~calgary-iommu-fix-error-path-memleak-in arch/x86_64/kernel/pci-calgary.c --- a/arch/x86_64/kernel/pci-calgary.c~calgary-iommu-fix-error-path-memleak-in +++ a/arch/x86_64/kernel/pci-calgary.c @@ -658,11 +658,12 @@ static int __init calgary_setup_tar(stru return 0; } -static void __init calgary_free_tar(struct pci_dev *dev) +static void __init calgary_free_bus(struct pci_dev *dev) { u64 val64; struct iommu_table *tbl = dev->sysdata; void __iomem *target; + unsigned int bitmapsz; target = calgary_reg(tbl->bbar, tar_offset(dev->bus->number)); val64 = be64_to_cpu(readq(target)); @@ -670,8 +671,15 @@ static void __init calgary_free_tar(stru writeq(cpu_to_be64(val64), target); readq(target); /* flush */ + bitmapsz = tbl->it_size / BITS_PER_BYTE; + free_pages((unsigned long)tbl->it_map, get_order(bitmapsz)); + tbl->it_map = NULL; + kfree(tbl); dev->sysdata = NULL; + + /* Can't free bootmem allocated memory after system is up :-( */ + bus_info[dev->bus->number].tce_space = NULL; } static void calgary_watchdog(unsigned long data) @@ -853,7 +861,7 @@ error: if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) continue; calgary_disable_translation(dev); - calgary_free_tar(dev); + calgary_free_bus(dev); pci_dev_put(dev); } _ Patches currently in -mm which might be from muli@xxxxxxxxxx are calgary-iommu-rearrange-struct-iommu_table.patch calgary-iommu-consolidate-per-bus-data.patch calgary-iommu-break-out-of.patch calgary-iommu-fix-error-path-memleak-in.patch calgary-iommu-fix-reference-counting-of.patch calgary-iommu.patch calgary-iommu-save-a-bit-of-space-in-bus_info.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html