svn commit: r326860 - head/sys/net

Ryan Stone rstone at FreeBSD.org
Thu Dec 14 20:48:51 UTC 2017


Author: rstone
Date: Thu Dec 14 20:48:50 2017
New Revision: 326860
URL: https://svnweb.freebsd.org/changeset/base/326860

Log:
  Plug an ifaddr leak when changing a route's src
  
  If a route is modified in a way that changes the route's source
  address (i.e. the address used to access the gateway), then a
  reference on the ifaddr representing the old source address will
  be leaked if the address type does not have an ifa_rtrequest
  method defined.  Plug the leak by releasing the reference in
  all cases.
  
  Differential Revision:	https://reviews.freebsd.org/D13417
  Reviewed by:	ae
  MFC after:	3 weeks
  Sponsored by:	Dell

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Thu Dec 14 20:01:04 2017	(r326859)
+++ head/sys/net/route.c	Thu Dec 14 20:48:50 2017	(r326860)
@@ -1781,8 +1781,9 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_
 
 	/* Check if outgoing interface has changed */
 	if (info->rti_ifa != NULL && info->rti_ifa != rt->rt_ifa &&
-	    rt->rt_ifa != NULL && rt->rt_ifa->ifa_rtrequest != NULL) {
-		rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
+	    rt->rt_ifa != NULL) {
+		if (rt->rt_ifa->ifa_rtrequest != NULL)
+			rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
 		ifa_free(rt->rt_ifa);
 	}
 	/* Update gateway address */


More information about the svn-src-head mailing list