1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Prevent ip_input() 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
This commit is contained in:
Eugene Grosbein 2018-10-27 04:59:35 +00:00
parent 4f1e3122ac
commit 1a5995cc88
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339808

View File

@ -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 @@ ip_input(struct mbuf *m)
/*
* 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 @@ ip_input(struct mbuf *m)
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.