On Fri, Nov 12, 2021 at 10:48:43AM +0100, Jan Beulich wrote: > 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.
Would it help to place the domid cleanup in domain_context_unmap_one, as that would then cover calls from domain_context_unmap and the failure path in domain_context_mapping_one. Thanks, Roger.