]> xenbits.xensource.com Git - xen.git/commit
IOMMU/PCI: don't let domain cleanup continue when device de-assignment failed
authorJan Beulich <jbeulich@suse.com>
Fri, 25 Jun 2021 12:06:55 +0000 (14:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 25 Jun 2021 12:06:55 +0000 (14:06 +0200)
commitf591755823a7e94fc6b4b8ddce71f0421a94fa09
tree0ea952f443a530d0b090013229b567c62b184c1b
parent01a2d001dea2219c9702afbe2d6fd1b0af539203
IOMMU/PCI: don't let domain cleanup continue when device de-assignment failed

Failure here could in principle mean the device may still be issuing DMA
requests, which would continue to be translated by the page tables the
device entry currently points at. With this we cannot allow the
subsequent cleanup step of freeing the page tables to occur, to prevent
use-after-free issues. We would need to accept, for the time being, that
in such a case the remaining domain resources will all be leaked, and
the domain will continue to exist as a zombie.

However, with flushes no longer timing out (and with proper timeout
detection for device I/O TLB flushing yet to be implemented), there's no
way anymore for failures to occur, except due to bugs elsewhere. Hence
the change here is merely a "just in case" one.

In order to continue the loop in spite of an error, we can't use
pci_get_pdev_by_domain() anymore. I have no idea why it was used here in
the first place, instead of the cheaper list iteration.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/drivers/passthrough/pci.c