1
0
Fork 0

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 <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
hifive-unleashed-5.1
Daniel De Graaf 2011-11-28 11:49:09 -05:00 committed by Konrad Rzeszutek Wilk
parent 9438ce9dbb
commit c3b3f16d1b
1 changed files with 3 additions and 0 deletions

View 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];