]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86: don't allow MSI pIRQ mapping on unowned device
authorJan Beulich <jbeulich@suse.com>
Thu, 12 Oct 2017 12:35:14 +0000 (14:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 12 Oct 2017 12:35:14 +0000 (14:35 +0200)
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 <hw42@ipsumj.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/irq.c

index 77ca1819853ac12eae4dc85cd7ccca6de3ee51f5..382b1f3ed273618dee8a6dbea9d902d51611d324 100644 (file)
@@ -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 )
         {