[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.14] VT-d: don't leak domid mapping on error path
commit fb9177385357bd0856692a6aa9c1513468281ae1 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Jan 7 08:51:27 2022 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Jan 7 08:51:27 2022 +0100 VT-d: don't leak domid mapping on error path While domain_context_mapping() invokes domain_context_unmap() in a sub- case of handling DEV_TYPE_PCI when encountering an error, thus avoiding a leak, individual calls to domain_context_mapping_one() aren't similarly covered. Such a leak might persist until domain destruction. Leverage that these cases can be recognized by pdev being non-NULL. Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment") Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> master commit: e6252a51faf42c892eb5fc71f8a2617580832196 master date: 2021-11-24 11:07:11 +0100 --- xen/drivers/passthrough/vtd/iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 59809bba7f..ce3e511ef7 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1518,7 +1518,12 @@ int domain_context_mapping_one( rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC); if ( rc ) - domain_context_unmap_one(domain, iommu, bus, devfn); + { + ret = domain_context_unmap_one(domain, iommu, bus, devfn); + + if ( !ret && pdev && pdev->devfn == devfn ) + check_cleanup_domid_map(domain, pdev, iommu); + } return rc; } -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.14
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |