summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/udp6_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-12 03:23:56 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-12 03:23:56 +0000
commit8a39e7b800c3e1302530f1b61be756b3d627077a (patch)
treef544e9fc97e8edc4971a49085fee7365e8784959 /sys/netinet6/udp6_usrreq.c
parentc67babbd23513f7218ba33aa3f6cd6af5cef187a (diff)
downloadFreeBSD-src-8a39e7b800c3e1302530f1b61be756b3d627077a.zip
FreeBSD-src-8a39e7b800c3e1302530f1b61be756b3d627077a.tar.gz
Add udbinfo locking in udp6_input() to protect lookups of the inpcb
lists during UDPv6 receipt. MFC after: 3 months
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
-rw-r--r--sys/netinet6/udp6_usrreq.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index d551e17..61c8ea1 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -167,13 +167,14 @@ udp6_input(mp, offp, proto)
*/
if (uh->uh_sum == 0) {
udpstat.udps_nosum++;
- goto bad;
+ goto bad_unlocked;
}
if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) {
udpstat.udps_badsum++;
- goto bad;
+ goto bad_unlocked;
}
+ INP_INFO_RLOCK(&udbinfo);
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
struct inpcb *last;
@@ -321,6 +322,7 @@ udp6_input(mp, offp, proto)
goto bad;
}
sorwakeup(last->in6p_socket);
+ INP_INFO_RUNLOCK(&udbinfo);
return IPPROTO_DONE;
}
/*
@@ -345,6 +347,7 @@ udp6_input(mp, offp, proto)
udpstat.udps_noportmcast++;
goto bad;
}
+ INP_INFO_RUNLOCK(&udbinfo);
icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
return IPPROTO_DONE;
}
@@ -376,8 +379,11 @@ udp6_input(mp, offp, proto)
goto bad;
}
sorwakeup(in6p->in6p_socket);
+ INP_INFO_RUNLOCK(&udbinfo);
return IPPROTO_DONE;
bad:
+ INP_INFO_RUNLOCK(&udbinfo);
+bad_unlocked:
if (m)
m_freem(m);
if (opts)
OpenPOWER on IntegriCloud