OSDN Git Service

iommu/arm-smmu: fix a DOMAIN_ATTR_DYNAMIC memory leak
authorJeremy Gebben <jgebben@codeaurora.org>
Mon, 24 Aug 2015 22:16:31 +0000 (16:16 -0600)
committerDavid Keitel <dkeitel@codeaurora.org>
Tue, 22 Mar 2016 18:14:04 +0000 (11:14 -0700)
commitfe676929a9601610dec537cc62dc84a66ca7f43f
tree0ea4caddbf7bc650edd9ad1498d6de96d465def8
parent599de5c63b6d9af25ee0af903d78836178adc6b0
iommu/arm-smmu: fix a DOMAIN_ATTR_DYNAMIC memory leak

The pagetable memory for a domain is freed by free_io_pgtable_ops(), which
is only called from arm_smmu_destroy_domain_context().  This function also
cleans up the hardware's context bank state and it is called during
iommu_device_detach().  Because dynamic domains don't have context bank
state, they don't call arm_smmu_destroy_domain_context() and thus their
pagetable memory was leaked.

Fix this by instead calling free_io_pgtable_ops() during
iommu_domain_destroy().  This ensures that the pagetable is freed for all
domains.

Change-Id: Id349fdc7df673cd4513468f23dcc95a9281d2657
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
drivers/iommu/arm-smmu.c