Author: bz
Date: Tue Jun  5 13:27:37 2012
New Revision: 236615
URL: http://svn.freebsd.org/changeset/base/236615

Log:
  Plug two interface address refcount leaks in early error return cases
  in the ioctl path.
  
  Reported by:  rpaulo
   Reviewed by: emax
  MFC after:    3 days

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c     Tue Jun  5 12:34:08 2012        (r236614)
+++ head/sys/netinet6/in6.c     Tue Jun  5 13:27:37 2012        (r236615)
@@ -1667,14 +1667,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l
                        hostid = IFA_IN6(ifa);
 
                        /* prefixlen must be <= 64. */
-                       if (64 < iflr->prefixlen)
+                       if (64 < iflr->prefixlen) {
+                               if (ifa != NULL)
+                                       ifa_free(ifa);
                                return EINVAL;
+                       }
                        prefixlen = iflr->prefixlen;
 
                        /* hostid part must be zero. */
                        sin6 = (struct sockaddr_in6 *)&iflr->addr;
                        if (sin6->sin6_addr.s6_addr32[2] != 0 ||
                            sin6->sin6_addr.s6_addr32[3] != 0) {
+                               if (ifa != NULL)
+                                       ifa_free(ifa);
                                return EINVAL;
                        }
                } else
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to