]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xen/events: prevent calling evtchn_get on invalid channels
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Mon, 28 Nov 2011 16:49:09 +0000 (11:49 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 16 Dec 2011 16:25:54 +0000 (11:25 -0500)
The event channel number provided to evtchn_get can be provided by
userspace, so needs to be checked against the maximum number of event
channels prior to using it to index into evtchn_to_irq.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/events.c

index a3bcd6175f4a6e288cd6ccd40bebbe7719b55862..e5e5812a1014cbf2c306ec802391980a7926754c 100644 (file)
@@ -1104,6 +1104,9 @@ int evtchn_get(unsigned int evtchn)
        struct irq_info *info;
        int err = -ENOENT;
 
+       if (evtchn >= NR_EVENT_CHANNELS)
+               return -EINVAL;
+
        mutex_lock(&irq_mapping_update_lock);
 
        irq = evtchn_to_irq[evtchn];