Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 2025 09:32:55 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 38c655093c6b - main - route: fix rtentry double free
Message-ID:  <202506050932.5559Wt51095365@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=38c655093c6b641a4ed4e844af95859f66844f25

commit 38c655093c6b641a4ed4e844af95859f66844f25
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-03 12:20:40 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-06-05 07:52:33 +0000

    route: fix rtentry double free
    
    add_route_flags() frees the rtentry on error when called with the RTM_F_CREATE
    flag. Don't free the rtentry a second time.
    
    Reviewed by:    ae
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D50665
---
 sys/net/route/route_ctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c
index 5a04e9dcf6e7..d629fd1625c3 100644
--- a/sys/net/route/route_ctl.c
+++ b/sys/net/route/route_ctl.c
@@ -673,12 +673,11 @@ rib_copy_route(struct rtentry *rt, const struct route_nhop_data *rnd_src,
 	if (error != 0) {
 		IF_DEBUG_LEVEL(LOG_DEBUG2) {
 			char buf[NHOP_PRINT_BUFSIZE];
-			rt_print_buf(rt_new, buf, sizeof(buf));
+			rt_print_buf(rt, buf, sizeof(buf));
 			FIB_RH_LOG(LOG_DEBUG, rh_dst,
 			    "Unable to add route %s: error %d", buf, error);
 		}
 		nhop_free(nh);
-		rt_free_immediate(rt_new);
 	}
 	return (error);
 }



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