From owner-svn-src-all@freebsd.org Thu Dec 14 20:48:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB917E8EFF6; Thu, 14 Dec 2017 20:48:51 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 785D478FD2; Thu, 14 Dec 2017 20:48:51 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBEKmogw076612; Thu, 14 Dec 2017 20:48:50 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBEKmor6076611; Thu, 14 Dec 2017 20:48:50 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201712142048.vBEKmor6076611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 14 Dec 2017 20:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326860 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 326860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 20:48:51 -0000 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 */