diff options
author | bryanv <bryanv@FreeBSD.org> | 2014-11-08 02:40:00 +0000 |
---|---|---|
committer | bryanv <bryanv@FreeBSD.org> | 2014-11-08 02:40:00 +0000 |
commit | 520007fcf463e48dc65f68dcb1679713c2e1df54 (patch) | |
tree | 21b047c473224b4e7262d4a4cca5a7d52ab7362d /sys/netinet | |
parent | 1a1a1d96c44591beb1cf138532b706a6c5b9f740 (diff) | |
download | FreeBSD-src-520007fcf463e48dc65f68dcb1679713c2e1df54.zip FreeBSD-src-520007fcf463e48dc65f68dcb1679713c2e1df54.tar.gz |
MFC r272797:
Check for mbuf copy failure when there are multiple multicast sockets
This partitular case is the only path where the mbuf could be NULL.
udp_append() checked for a NULL mbuf only after invoking the tunneling
callback. Our only in tree tunneling callback - SCTP - assumed a non
NULL mbuf, and it is a bit odd to make the callbacks responsible for
checking this condition.
This also reduces the differences between the IPv4 and IPv6 code.
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index f065f80..8c844e3 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -307,9 +307,6 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, return; } - if (n == NULL) - return; - off += sizeof(struct udphdr); #ifdef IPSEC @@ -568,8 +565,10 @@ udp_input(struct mbuf *m, int off) if (last != NULL) { struct mbuf *n; - n = m_copy(m, 0, M_COPYALL); - udp_append(last, ip, n, iphlen, &udp_in); + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + udp_append(last, ip, n, iphlen, + &udp_in); + } INP_RUNLOCK(last); } last = inp; |