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
This commit is contained in:
Konstantin Belousov 2018-02-23 11:20:59 +00:00
parent 3c41c1d446
commit 33099716f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329864

View File

@ -178,6 +178,8 @@ struct intsrc *
intr_lookup_source(int vector)
{
if (vector < 0 || vector >= nitems(interrupt_sources))
return (NULL);
return (interrupt_sources[vector]);
}