From: Daniel De Graaf Date: Mon, 28 Nov 2011 16:49:09 +0000 (-0500) Subject: xen/events: prevent calling evtchn_get on invalid channels X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c3b3f16d1bceb5ac5f21528f889810b4ac5a3596;p=linux-beck.git xen/events: prevent calling evtchn_get on invalid channels 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 Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/xen/events.c b/drivers/xen/events.c index a3bcd6175f4a..e5e5812a1014 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -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];