Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Oct 2018 04:45:28 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339806 - head/sys/net
Message-ID:  <201810270445.w9R4jSfU035457@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Sat Oct 27 04:45:28 2018
New Revision: 339806
URL: https://svnweb.freebsd.org/changeset/base/339806

Log:
  Prevent stf(4) from panicing due to unprotected access to INADDR_HASH.
  
  PR:			220078
  MFC after:		1 month
  Differential Revision:	https://reviews.freebsd.org/D12457
  Tested-by:		Cassiano Peixoto and others

Modified:
  head/sys/net/if_stf.c

Modified: head/sys/net/if_stf.c
==============================================================================
--- head/sys/net/if_stf.c	Sat Oct 27 04:10:42 2018	(r339805)
+++ head/sys/net/if_stf.c	Sat Oct 27 04:45:28 2018	(r339806)
@@ -367,6 +367,7 @@ stf_encapcheck(const struct mbuf *m, int off, int prot
 static int
 stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask)
 {
+	struct rm_priotracker in_ifa_tracker;
 	struct ifaddr *ia;
 	struct in_ifaddr *ia4;
 	struct in6_ifaddr *ia6;
@@ -382,9 +383,11 @@ stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *add
 			continue;
 
 		bcopy(GET_V4(&sin6->sin6_addr), &in, sizeof(in));
+		IN_IFADDR_RLOCK(&in_ifa_tracker);
 		LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash)
 			if (ia4->ia_addr.sin_addr.s_addr == in.s_addr)
 				break;
+		IN_IFADDR_RUNLOCK(&in_ifa_tracker);
 		if (ia4 == NULL)
 			continue;
 



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