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

Log:
  Prevent ip_input() from panicing due to unprotected access
  to INADDR_HASH. This is direct commit to stable/10 instead of MFC r339808
  due to significant differences in code base.
  
  PR:                   220078
  Differential Revision:        https://reviews.freebsd.org/D12457
  Tested-by:            Cassiano Peixoto and others

Modified:
  stable/10/sys/netinet/ip_input.c

Modified: stable/10/sys/netinet/ip_input.c
==============================================================================
--- stable/10/sys/netinet/ip_input.c    Mon Nov 26 12:41:49 2018        
(r340960)
+++ stable/10/sys/netinet/ip_input.c    Mon Nov 26 12:47:12 2018        
(r340961)
@@ -564,7 +564,7 @@ passin:
        /*
         * Check for exact addresses in the hash bucket.
         */
-       /* IN_IFADDR_RLOCK(); */
+       IN_IFADDR_RLOCK();
        LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) {
                /*
                 * If the address matches, verify that the packet
@@ -574,11 +574,11 @@ passin:
                if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr && 
                    (!checkif || ia->ia_ifp == ifp)) {
                        ifa_ref(&ia->ia_ifa);
-                       /* IN_IFADDR_RUNLOCK(); */
+                       IN_IFADDR_RUNLOCK();
                        goto ours;
                }
        }
-       /* IN_IFADDR_RUNLOCK(); */
+       IN_IFADDR_RUNLOCK();
 
        /*
         * Check for broadcast addresses.
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to