Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jul 2024 15:54:46 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a948a61a822f - stable/13 - if_vxlan(4): Move the allocating of statistics counters below if_alloc()
Message-ID:  <202407161554.46GFskrM040872@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zlei:

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

commit a948a61a822f82a99ac58a412621e5546eac6be3
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-07-16 15:53:18 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-07-16 15:53:18 +0000

    if_vxlan(4): Move the allocating of statistics counters below if_alloc()
    
    The MFS of the fix [1] is done but the prerequisite [2] has not been
    MFCed to stable/13 branch yet. This results in another potential leak
    condition in stable/13 branch. Well `if_alloc(IFT_ETHER)` shall not
    fail, but just in case.
    
    This is a direct commit to stable/13.
    
    1. e729e750806d if_vxlan(4): Plug a memory leak
    2. 4787572d0580 ifnet: make if_alloc_domain() never fail
    
    Reviewed by:    kp
    Fixes:          12bd1341d2aa if_vxlan(4): Plug a memory leak
    Differential Revision:  https://reviews.freebsd.org/D45972
---
 sys/net/if_vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 2cc9f60cba87..3c074952864c 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -3216,13 +3216,13 @@ vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 			goto fail;
 	}
 
-	vxlan_stats_alloc(sc);
 	ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
 		error = ENOSPC;
 		goto fail;
 	}
 
+	vxlan_stats_alloc(sc);
 	sc->vxl_ifp = ifp;
 	rm_init(&sc->vxl_lock, "vxlanrm");
 	callout_init_rw(&sc->vxl_callout, &sc->vxl_lock, 0);



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