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

[Xen-devel] [PATCH] physdev: Check for negative irqs in alloc_irq_vector



Hi Keir:

[PATCH] physdev: Check for negative irqs in alloc_irq_vector

Since we're checking the validity of the supplied irq element in
PHYSDEVOP_alloc_irq_vector, we might as well check it completely
as a negtive irq is just as lethal as one above NR_IRQS.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff -r 8273f730371b xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Tue Aug 29 12:23:11 2006 +0100
+++ b/xen/arch/x86/physdev.c    Wed Aug 30 21:15:19 2006 +1000
@@ -96,9 +96,10 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         if ( !IS_PRIV(current->domain) )
             break;
 
+       irq = irq_op.irq;
         ret = -EINVAL;
-        if ( (irq = irq_op.irq) >= NR_IRQS )
-            break;
+       if ( (irq < 0) || (irq >= NR_IRQS) )
+           break;
         
         irq_op.vector = assign_irq_vector(irq);
         ret = copy_to_guest(arg, &irq_op, 1) ? -EFAULT : 0;

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


 


Rackspace

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