Author: kib
Date: Fri Feb 23 11:20:59 2018
New Revision: 329864
URL: https://svnweb.freebsd.org/changeset/base/329864

Log:
  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

Modified:
  head/sys/x86/x86/intr_machdep.c

Modified: head/sys/x86/x86/intr_machdep.c
==============================================================================
--- head/sys/x86/x86/intr_machdep.c     Fri Feb 23 11:17:16 2018        
(r329863)
+++ head/sys/x86/x86/intr_machdep.c     Fri Feb 23 11:20:59 2018        
(r329864)
@@ -178,6 +178,8 @@ struct intsrc *
 intr_lookup_source(int vector)
 {
 
+       if (vector < 0 || vector >= nitems(interrupt_sources))
+               return (NULL);
        return (interrupt_sources[vector]);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to