diff options
author | Daniel De Graaf <dgdegra@tycho.nsa.gov> | 2011-11-28 11:49:09 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-12-16 11:25:54 -0500 |
commit | c3b3f16d1bceb5ac5f21528f889810b4ac5a3596 (patch) | |
tree | 1447aa5bd9e3ff8e682dde597485cbfc857e054f /drivers/xen | |
parent | 9438ce9dbbf512fd717051284f568d5cb35e5cf1 (diff) |
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>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/events.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) | |||
1104 | struct irq_info *info; | 1104 | struct irq_info *info; |
1105 | int err = -ENOENT; | 1105 | int err = -ENOENT; |
1106 | 1106 | ||
1107 | if (evtchn >= NR_EVENT_CHANNELS) | ||
1108 | return -EINVAL; | ||
1109 | |||
1107 | mutex_lock(&irq_mapping_update_lock); | 1110 | mutex_lock(&irq_mapping_update_lock); |
1108 | 1111 | ||
1109 | irq = evtchn_to_irq[evtchn]; | 1112 | irq = evtchn_to_irq[evtchn]; |