[Differential] D12457: Complete INADDR_HASH lock protection

Phabricator phabric-noreply at FreeBSD.org
Sat Oct 27 04:45:44 UTC 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rS339806: Prevent stf(4) from panicing due to unprotected access to INADDR_HASH. (authored by eugen, committed by ).

CHANGED PRIOR TO COMMIT
  https://reviews.freebsd.org/D12457?vs=33312&id=49678#toc

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D12457?vs=33312&id=49678

CHANGES SINCE LAST ACTION
  https://reviews.freebsd.org/D12457/new/

REVISION DETAIL
  https://reviews.freebsd.org/D12457

AFFECTED FILES
  head/sys/net/if_stf.c

CHANGE DETAILS

diff --git a/head/sys/net/if_stf.c b/head/sys/net/if_stf.c
--- a/head/sys/net/if_stf.c
+++ b/head/sys/net/if_stf.c
@@ -367,6 +367,7 @@
 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 @@
 			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;
 



EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: eugen_grosbein.net, ae, avg, mav, rwatson
Cc: bz, imp, freebsd-net-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12457.49678.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20181027/8ccb88b4/attachment.bin>


More information about the freebsd-net mailing list