From: Jan Beulich Date: Thu, 12 Oct 2017 12:35:14 +0000 (+0200) Subject: x86: don't allow MSI pIRQ mapping on unowned device X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3308374b1be7d43e23bd2e9eaf23ec06d7959882;p=people%2Fiwj%2Fxen.git x86: don't allow MSI pIRQ mapping on unowned device MSI setup should be permitted only for existing devices owned by the respective guest (the operation may still be carried out by the domain controlling that guest). This is part of XSA-237. Reported-by: HW42 Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 77ca181985..382b1f3ed2 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1972,7 +1972,10 @@ int map_domain_pirq( if ( !cpu_has_apic ) goto done; - pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn); + pdev = pci_get_pdev_by_domain(d, msi->seg, msi->bus, msi->devfn); + if ( !pdev ) + goto done; + ret = pci_enable_msi(msi, &msi_desc); if ( ret ) {