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

[Xen-changelog] [xen stable-4.7] arm/irq: Reorder check when the IRQ is already used by someone



commit c782e61edf16f4936aa2e8de79e14b11ef4cd690
Author:     Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>
AuthorDate: Fri Dec 2 18:38:16 2016 +0200
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Mar 17 12:06:39 2017 -0700

    arm/irq: Reorder check when the IRQ is already used by someone
    
    Call irq_get_domain for the IRQ we are interested in
    only after making sure that it is the guest IRQ to avoid
    ASSERT(test_bit(_IRQ_GUEST, &desc->status)) triggering.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
    Signed-off-by: Andrii Anisov <andrii_anisov@xxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/irq.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 2f8af72..8abae1e 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -466,26 +466,32 @@ int route_irq_to_guest(struct domain *d, unsigned int 
virq,
      */
     if ( desc->action != NULL )
     {
-        struct domain *ad = irq_get_domain(desc);
-
-        if ( test_bit(_IRQ_GUEST, &desc->status) && d == ad )
+        if ( test_bit(_IRQ_GUEST, &desc->status) )
         {
-            if ( irq_get_guest_info(desc)->virq != virq )
+            struct domain *ad = irq_get_domain(desc);
+
+            if ( d == ad )
+            {
+                if ( irq_get_guest_info(desc)->virq != virq )
+                {
+                    printk(XENLOG_G_ERR
+                           "d%u: IRQ %u is already assigned to vIRQ %u\n",
+                           d->domain_id, irq, irq_get_guest_info(desc)->virq);
+                    retval = -EBUSY;
+                }
+            }
+            else
             {
-                printk(XENLOG_G_ERR
-                       "d%u: IRQ %u is already assigned to vIRQ %u\n",
-                       d->domain_id, irq, irq_get_guest_info(desc)->virq);
+                printk(XENLOG_G_ERR "IRQ %u is already used by domain %u\n",
+                       irq, ad->domain_id);
                 retval = -EBUSY;
             }
-            goto out;
         }
-
-        if ( test_bit(_IRQ_GUEST, &desc->status) )
-            printk(XENLOG_G_ERR "IRQ %u is already used by domain %u\n",
-                   irq, ad->domain_id);
         else
+        {
             printk(XENLOG_G_ERR "IRQ %u is already used by Xen\n", irq);
-        retval = -EBUSY;
+            retval = -EBUSY;
+        }
         goto out;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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