From owner-svn-src-head@freebsd.org Sat Oct 27 04:45:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56AD010D848C; Sat, 27 Oct 2018 04:45:29 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C21C7CDB2; Sat, 27 Oct 2018 04:45:29 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE6CD39A4; Sat, 27 Oct 2018 04:45:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9R4jSgc035458; Sat, 27 Oct 2018 04:45:28 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9R4jSfU035457; Sat, 27 Oct 2018 04:45:28 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201810270445.w9R4jSfU035457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 27 Oct 2018 04:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339806 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 339806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Oct 2018 04:45:29 -0000 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;