WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] fix irq_vector[] update of c/s 19419

To: "Gang Wei" <gang.wei@xxxxxxxxx>,<xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix irq_vector[] update of c/s 19419
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 01 Apr 2009 10:33:40 +0100
Cc:
Delivery-date: Wed, 01 Apr 2009 02:42:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The updating of irq_vector[] looks very suspicious - the array is IRQ-
indexed, hence you potentially overwrite an already existing entry, or
risk your entry to be overwritten later.

Also, what is the reason for overwriting the vector_irq[] initialization
assign_irq_vector() already did?

Likewise you should be calling free_irq_vector() in the error path rather
than doing any of the updates yourself.

Finally, assign_irq_vector() does not return zero on failure, but a negative
error code.

If there is nothing I'm overlooking, here's a patch - untested, as I don't
have the needed hardware.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2009-03-27.orig/xen/arch/x86/hpet.c 2009-03-24 09:04:02.000000000 +0100
+++ 2009-03-27/xen/arch/x86/hpet.c      2009-04-01 11:28:25.000000000 +0200
@@ -346,17 +346,14 @@ static int hpet_assign_irq(struct hpet_e
     unsigned int vector;
 
     vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
-    if ( !vector )
-        return -EINVAL;
+    if ( (int)vector < 0 )
+        return vector;
 
-    irq_vector[vector] = vector;
-    vector_irq[vector] = vector;
     vector_channel[vector] = ch - &hpet_events[0];
 
     if ( hpet_setup_msi_irq(vector) )
     {
-        irq_vector[vector] = 0;
-        vector_irq[vector] = FREE_TO_ASSIGN_IRQ;
+        free_irq_vector(vector);
         vector_channel[vector] = -1;
         return -EINVAL;
     }






_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>