git: a948a61a822f - stable/13 - if_vxlan(4): Move the allocating of statistics counters below if_alloc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Jul 2024 15:54:46 UTC
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);