Herbert Xu
2006-Aug-30 11:18 UTC
[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@gondor.apana.org.au> Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> 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@lists.xensource.com http://lists.xensource.com/xen-devel