File 59df6224-x86-FLASK-fix-unmap-domain-IRQ-XSM-hook.patch of Package xen.7317

# Commit 6f17f5c43a3bd28d27ed8133b2bf513e2eab7d59
# Date 2017-10-12 14:37:56 +0200
# Author Jan Beulich <jbeulich@suse.com>
# Committer Jan Beulich <jbeulich@suse.com>
x86/FLASK: fix unmap-domain-IRQ XSM hook

The caller and the FLASK implementation of xsm_unmap_domain_irq()
disagreed about what the "data" argument points to in the MSI case:
Change both sides to pass/take a PCI device.

This is part of XSA-237.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2138,7 +2138,8 @@ int unmap_domain_pirq(struct domain *d,
         nr = msi_desc->msi.nvec;
     }
 
-    ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq, msi_desc);
+    ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
+                               msi_desc ? msi_desc->dev : NULL);
     if ( ret )
         goto done;
 
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -873,11 +873,12 @@ static int flask_unmap_domain_irq (struc
 {
     u32 sid;
     int rc = -EPERM;
-    struct msi_info *msi = data;
+    const struct pci_dev *pdev = data;
     struct avc_audit_data ad;
 
-    if ( irq >= nr_static_irqs && msi ) {
-        u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+    if ( irq >= nr_static_irqs && pdev ) {
+        u32 machine_bdf = (pdev->seg << 16) | (pdev->bus << 8) | pdev->devfn;
+
         AVC_AUDIT_DATA_INIT(&ad, DEV);
         ad.device = machine_bdf;
         rc = security_device_sid(machine_bdf, &sid);
openSUSE Build Service is sponsored by