aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-02-23 11:20:59 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-02-23 11:20:59 +0000
commit33099716f37980d0cd9767540a5a1c699f7ab9e5 (patch)
tree344cb31d656c8e5dad5942c30be2d0ae90277c08 /sys/x86
parent3c41c1d4467c454281df72101259accd448fd65b (diff)
downloadsrc-33099716f37980d0cd9767540a5a1c699f7ab9e5.tar.gz
src-33099716f37980d0cd9767540a5a1c699f7ab9e5.zip
Do not return out of bound pointers from intr_lookup_source().
This hardens the code against driver and upper level bugs causing invalid indexes used, e.g. on msi release. Reported by: gallatin Reviewed by: gallatin, hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14470
Notes
Notes: svn path=/head/; revision=329864
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/intr_machdep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c
index c987bdf8b4be..1ae326e70821 100644
--- a/sys/x86/x86/intr_machdep.c
+++ b/sys/x86/x86/intr_machdep.c
@@ -178,6 +178,8 @@ struct intsrc *
intr_lookup_source(int vector)
{
+ if (vector < 0 || vector >= nitems(interrupt_sources))
+ return (NULL);
return (interrupt_sources[vector]);
}