[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86/irq: skip unmap_domain_pirq XSM during destruction



commit 2e6f95a942d1927a53f077c301db0b799c54c05a
Author:     Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Fri Apr 8 14:51:52 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Apr 8 14:51:52 2022 +0200

    x86/irq: skip unmap_domain_pirq XSM during destruction
    
    xsm_unmap_domain_irq was seen denying unmap_domain_pirq when called from
    complete_domain_destroy as an RCU callback.  The source context was an
    unexpected, random domain.  Since this is a xen-internal operation,
    going through the XSM hook is inapproriate.
    
    Check d->is_dying and skip the XSM hook when set since this is a cleanup
    operation for a domain being destroyed.
    
    Suggested-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/irq.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 285ac399fb..de30ee7779 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2340,8 +2340,14 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         nr = msi_desc->msi.nvec;
     }
 
-    ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
-                               msi_desc ? msi_desc->dev : NULL);
+    /*
+     * When called by complete_domain_destroy via RCU, current is a random
+     * domain.  Skip the XSM check since this is a Xen-initiated action.
+     */
+    if ( !d->is_dying )
+        ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
+                                   msi_desc ? msi_desc->dev : NULL);
+
     if ( ret )
         goto done;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.