From owner-dev-commits-src-all@freebsd.org Sun Feb 14 10:18:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 335B6529F2B; Sun, 14 Feb 2021 10:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ddjqb0x76z4r4l; Sun, 14 Feb 2021 10:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E753635; Sun, 14 Feb 2021 10:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11EAIIci072294; Sun, 14 Feb 2021 10:18:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11EAIIDR072293; Sun, 14 Feb 2021 10:18:18 GMT (envelope-from git) Date: Sun, 14 Feb 2021 10:18:18 GMT Message-Id: <202102141018.11EAIIDR072293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 11304949deb3 - stable/13 - Fix ifa refcount leak during route addition. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11304949deb36d2f9abbcda87d398496e892dcec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2021 10:18:19 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=11304949deb36d2f9abbcda87d398496e892dcec commit 11304949deb36d2f9abbcda87d398496e892dcec Author: Alexander V. Chernikov AuthorDate: 2021-02-12 20:56:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-14 10:16:51 +0000 Fix ifa refcount leak during route addition. Reported by: rstone Reviewed by: rstone (cherry picked from commit a375ec52a7b423133f66878ecf002efc3b6e9fca) --- sys/net/route/route_ctl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 6b0869196d12..9aedfb9d5855 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -594,14 +594,12 @@ create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info, } error = nhop_create_from_info(rnh, info, &nh); - if (error != 0) { - ifa_free(info->rti_ifa); + ifa_free(info->rti_ifa); + if (error != 0) return (error); - } rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) { - ifa_free(info->rti_ifa); nhop_free(nh); return (ENOBUFS); }