]> www.infradead.org Git - users/jedix/linux-maple.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>
Thu, 2 Feb 2012 19:07:16 +0000 (14:07 -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 b2d71266f6ed0ff8b589320688a8d67a26153917..f3ea75e53e089127f518256d341910d956e2b440 100644 (file)
@@ -1081,6 +1081,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];