Author: bryanv
Date: Sat Nov  8 02:40:00 2014
New Revision: 274264
URL: https://svnweb.freebsd.org/changeset/base/274264

Log:
  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.

Modified:
  stable/10/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/udp_usrreq.c  Sat Nov  8 00:55:06 2014        
(r274263)
+++ stable/10/sys/netinet/udp_usrreq.c  Sat Nov  8 02:40:00 2014        
(r274264)
@@ -307,9 +307,6 @@ udp_append(struct inpcb *inp, struct ip 
                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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to