intel-iommu: Unlink domain from iommu
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 4 Mar 2011 21:52:16 +0000 (14:52 -0700)
committerAndi Kleen <ak@linux.intel.com>
Thu, 28 Apr 2011 15:21:11 +0000 (08:21 -0700)
commit8e2f9d0be8626aca810c8cac38fce207ea81af4a
tree651b958c5e561cf130e77af9a10df60ede04ee56
parentbe57626a0d05b26e7e2db01ebe3fe0c0d3e8bc2e
intel-iommu: Unlink domain from iommu

commit a97590e56d0d58e1dd262353f7cbd84e81d8e600 upstream.

When we remove a device, we unlink the iommu from the domain, but
we never do the reverse unlinking of the domain from the iommu.
This means that we never clear iommu->domain_ids, eventually leading
to resource exhaustion if we repeatedly bind and unbind a device
to a driver.  Also free empty domains to avoid a resource leak.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Donald Dutile <ddutile@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/pci/intel-iommu.c