[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] AMD IOMMU: don't free page table prematurely
commit 6b4d71d028f445cba7426a144751fddc8bfdd67b Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed May 28 09:50:33 2014 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed May 28 09:50:33 2014 +0200 AMD IOMMU: don't free page table prematurely iommu_merge_pages() still wants to look at the next level page table, the TLB flush necessary before freeing too happens in that function, and if it fails no free should happen at all. Hence the freeing must be done after that function returned successfully, not before it's being called. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Tested-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> --- xen/drivers/passthrough/amd/iommu_map.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index ceb1c28..a8c60ec 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -691,8 +691,6 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn, if ( !iommu_update_pde_count(d, pt_mfn[merge_level], gfn, mfn, merge_level) ) break; - /* Deallocate lower level page table */ - free_amd_iommu_pgtable(mfn_to_page(pt_mfn[merge_level - 1])); if ( iommu_merge_pages(d, pt_mfn[merge_level], gfn, flags, merge_level) ) @@ -703,6 +701,9 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn, domain_crash(d); return -EFAULT; } + + /* Deallocate lower level page table */ + free_amd_iommu_pgtable(mfn_to_page(pt_mfn[merge_level - 1])); } out: -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |