Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 11:20:59 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329864 - head/sys/x86/x86
Message-ID:  <201802231120.w1NBKxCs068756@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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]);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802231120.w1NBKxCs068756>