Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2017 20:48:50 +0000 (UTC)
From:      Ryan Stone <rstone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326860 - head/sys/net
Message-ID:  <201712142048.vBEKmor6076611@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



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