From owner-svn-src-head@freebsd.org Wed Jan 20 11:25:31 2016 Return-Path: Delivered-To: svn-src-head@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 7C06AA88B97; Wed, 20 Jan 2016 11:25:31 +0000 (UTC) (envelope-from melifaro@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 4EF931CF2; Wed, 20 Jan 2016 11:25:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0KBPUMf018065; Wed, 20 Jan 2016 11:25:30 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0KBPUKO018064; Wed, 20 Jan 2016 11:25:30 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201601201125.u0KBPUKO018064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 20 Jan 2016 11:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294411 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2016 11:25:31 -0000 Author: melifaro Date: Wed Jan 20 11:25:30 2016 New Revision: 294411 URL: https://svnweb.freebsd.org/changeset/base/294411 Log: Fix rte refcount leak in ip6_forward(). Reviewed by: ae MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netinet6/ip6_forward.c Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Wed Jan 20 11:15:54 2016 (r294410) +++ head/sys/netinet6/ip6_forward.c Wed Jan 20 11:25:30 2016 (r294411) @@ -341,6 +341,7 @@ again: dst->sin6_addr = ip6->ip6_dst; again2: rin6.ro_rt = in6_rtalloc1((struct sockaddr *)dst, 0, 0, M_GETFIB(m)); + rt = rin6.ro_rt; if (rin6.ro_rt != NULL) RT_UNLOCK(rin6.ro_rt); else { @@ -352,7 +353,6 @@ again2: } goto bad; } - rt = rin6.ro_rt; /* * Source scope check: if a packet can't be delivered to its @@ -505,8 +505,10 @@ again2: /* If destination is now ourself drop to ip6_input(). */ if (in6_localip(&ip6->ip6_dst)) m->m_flags |= M_FASTFWD_OURS; - else + else { + RTFREE(rt); goto again; /* Redo the routing table lookup. */ + } } /* See if local, if yes, send it to netisr. */ @@ -533,6 +535,7 @@ again2: m->m_flags |= M_SKIP_FIREWALL; m->m_flags &= ~M_IP6_NEXTHOP; m_tag_delete(m, fwd_tag); + RTFREE(rt); goto again2; }