Author: eugen
Date: Mon Nov 26 11:17:12 2018
New Revision: 340951
URL: https://svnweb.freebsd.org/changeset/base/340951

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

Modified:
  stable/11/sys/net/if_stf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_stf.c
==============================================================================
--- stable/11/sys/net/if_stf.c  Mon Nov 26 11:15:59 2018        (r340950)
+++ stable/11/sys/net/if_stf.c  Mon Nov 26 11:17:12 2018        (r340951)
@@ -372,6 +372,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;
@@ -387,9 +388,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;
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to