From owner-svn-src-stable@freebsd.org Mon Nov 26 12:39:58 2018 Return-Path: Delivered-To: svn-src-stable@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 21A5B1104983; Mon, 26 Nov 2018 12:39:58 +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 BCCDD712B8; Mon, 26 Nov 2018 12:39:57 +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 9EC6B4032; Mon, 26 Nov 2018 12:39:57 +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 wAQCdvnb062639; Mon, 26 Nov 2018 12:39:57 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAQCdvoE062638; Mon, 26 Nov 2018 12:39:57 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201811261239.wAQCdvoE062638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 26 Nov 2018 12:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340959 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 340959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCCDD712B8 X-Spamd-Result: default: False [1.22 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.04)[0.044,0]; NEURAL_SPAM_MEDIUM(0.56)[0.562,0]; NEURAL_SPAM_LONG(0.61)[0.611,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2018 12:39:58 -0000 Author: eugen Date: Mon Nov 26 12:39:57 2018 New Revision: 340959 URL: https://svnweb.freebsd.org/changeset/base/340959 Log: MFC r339808: Prevent ip_input() 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/12/sys/netinet/ip_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/ip_input.c ============================================================================== --- stable/12/sys/netinet/ip_input.c Mon Nov 26 12:19:30 2018 (r340958) +++ stable/12/sys/netinet/ip_input.c Mon Nov 26 12:39:57 2018 (r340959) @@ -448,6 +448,7 @@ ip_direct_input(struct mbuf *m) void ip_input(struct mbuf *m) { + struct rm_priotracker in_ifa_tracker; struct ip *ip = NULL; struct in_ifaddr *ia = NULL; struct ifaddr *ifa; @@ -681,7 +682,7 @@ passin: /* * Check for exact addresses in the hash bucket. */ - /* IN_IFADDR_RLOCK(); */ + IN_IFADDR_RLOCK(&in_ifa_tracker); LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { /* * If the address matches, verify that the packet @@ -693,11 +694,11 @@ passin: counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); counter_u64_add(ia->ia_ifa.ifa_ibytes, m->m_pkthdr.len); - /* IN_IFADDR_RUNLOCK(); */ + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto ours; } } - /* IN_IFADDR_RUNLOCK(); */ + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * Check for broadcast addresses.