Date: Mon, 26 Nov 2018 12:41:50 +0000 (UTC) From: Eugene Grosbein <eugen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340960 - stable/11/sys/netinet Message-ID: <201811261241.wAQCfoZD067540@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eugen Date: Mon Nov 26 12:41:49 2018 New Revision: 340960 URL: https://svnweb.freebsd.org/changeset/base/340960 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/11/sys/netinet/ip_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/ip_input.c ============================================================================== --- stable/11/sys/netinet/ip_input.c Mon Nov 26 12:39:57 2018 (r340959) +++ stable/11/sys/netinet/ip_input.c Mon Nov 26 12:41:49 2018 (r340960) @@ -446,6 +446,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; @@ -679,7 +680,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 @@ -691,11 +692,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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811261241.wAQCfoZD067540>