]> xenbits.xensource.com Git - xen.git/commit
VT-d: don't leak domid mapping on error path
authorJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:07:11 +0000 (11:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:07:11 +0000 (11:07 +0100)
commite6252a51faf42c892eb5fc71f8a2617580832196
tree769372f4d8ab8700a7eb292c89dffa30669a129f
parent9fdc10abe9457e4c9879a266f82372cb08e88ffb
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@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/vtd/iommu.c