1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-22 11:17:19 +00:00

Move inpcb lock higher to protect some nonbinding fields reading.

It fixes nothing at this time, but decided to be more correct.
This commit is contained in:
Alexander Motin 2008-07-28 19:32:18 +00:00
parent 2e38385526
commit 6c5bbf5ce1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180932
2 changed files with 6 additions and 3 deletions

View File

@ -1907,10 +1907,13 @@ icmp6_rip6_input(struct mbuf **mp, int off)
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
continue;
INP_RLOCK(in6p);
if (in6p->in6p_icmp6filt
&& ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
in6p->in6p_icmp6filt))
in6p->in6p_icmp6filt)) {
INP_RUNLOCK(in6p);
continue;
}
if (last) {
struct mbuf *n = NULL;
@ -1970,7 +1973,6 @@ icmp6_rip6_input(struct mbuf **mp, int off)
INP_RUNLOCK(last);
}
last = in6p;
INP_RLOCK(last);
}
INP_INFO_RUNLOCK(&ripcbinfo);
if (last) {

View File

@ -165,10 +165,12 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
continue;
INP_RLOCK(in6p);
if (in6p->in6p_cksum != -1) {
rip6stat.rip6s_isum++;
if (in6_cksum(m, proto, *offp,
m->m_pkthdr.len - *offp)) {
INP_RUNLOCK(in6p);
rip6stat.rip6s_badsum++;
continue;
}
@ -206,7 +208,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
INP_RUNLOCK(last);
}
last = in6p;
INP_RLOCK(last);
}
INP_INFO_RUNLOCK(&ripcbinfo);
#ifdef IPSEC