Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Oct 2014 05:17:48 +0000 (UTC)
From:      Bryan Venteicher <bryanv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272797 - head/sys/netinet
Message-ID:  <201410090517.s995HmSx048113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bryanv
Date: Thu Oct  9 05:17:47 2014
New Revision: 272797
URL: https://svnweb.freebsd.org/changeset/base/272797

Log:
  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.
  
  MFC after:	1 month

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Thu Oct  9 04:40:19 2014	(r272796)
+++ head/sys/netinet/udp_usrreq.c	Thu Oct  9 05:17:47 2014	(r272797)
@@ -316,9 +316,6 @@ udp_append(struct inpcb *inp, struct ip 
 		return;
 	}
 
-	if (n == NULL)
-		return;
-
 	off += sizeof(struct udphdr);
 
 #ifdef IPSEC
@@ -578,8 +575,10 @@ udp_input(struct mbuf **mp, int *offp, i
 			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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410090517.s995HmSx048113>