From owner-svn-src-all@FreeBSD.ORG Thu Jan 16 12:35:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12A3F81A; Thu, 16 Jan 2014 12:35:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F326913C8; Thu, 16 Jan 2014 12:35:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GCZI9E088225; Thu, 16 Jan 2014 12:35:18 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCZIL8088224; Thu, 16 Jan 2014 12:35:18 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401161235.s0GCZIL8088224@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 16 Jan 2014 12:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260707 - head/sys/netinet X-SVN-Group: head 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.17 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, 16 Jan 2014 12:35:19 -0000 Author: melifaro Date: Thu Jan 16 12:35:18 2014 New Revision: 260707 URL: http://svnweb.freebsd.org/changeset/base/260707 Log: Fix refcount leak on netinet ifa. Reviewed by: glebius MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jan 16 12:31:27 2014 (r260706) +++ head/sys/netinet/in.c Thu Jan 16 12:35:18 2014 (r260707) @@ -408,7 +408,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat if (ifp->if_flags & IFF_LOOPBACK) ia->ia_dstaddr = ia->ia_addr; - ifa_ref(ifa); /* if_addrhead */ + /* if_addrhead is already referenced by ifa_alloc() */ IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); @@ -495,13 +495,13 @@ fail1: IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); - ifa_free(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ return (error); } @@ -565,7 +565,6 @@ in_difaddr_ioctl(caddr_t data, struct if TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ /* * in_scrubprefix() kills the interface route. @@ -601,6 +600,7 @@ in_difaddr_ioctl(caddr_t data, struct if } EVENTHANDLER_INVOKE(ifaddr_event, ifp); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ return (0); }