git: ada1d9b8edbd - stable/14 - fib_dxr: do not leak memory if FIB constellation hits structural limit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 May 2024 17:34:54 UTC
The branch stable/14 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=ada1d9b8edbd52d2ce206bb99de35858b2f871cb commit ada1d9b8edbd52d2ce206bb99de35858b2f871cb Author: Marko Zec <zec@FreeBSD.org> AuthorDate: 2024-05-17 16:36:21 +0000 Commit: Marko Zec <zec@FreeBSD.org> CommitDate: 2024-05-22 17:34:26 +0000 fib_dxr: do not leak memory if FIB constellation hits structural limit DXR lookup table encoding has an inherent structural limit on the amount of binary search ranges it can accomodate. With the current IPv4 BGP views (circa 1 M prefixes) and default DXR encoding we are only at around 5% of that limit, so far, far away from hitting it. Just in case it ever gets hit, make sure we free the allocated structures, instead of leaking it. MFC after: 1 week (cherry picked from commit 19bd24caa4c8c76ddf138b3a1598a21c8c5c3291) --- sys/netinet/in_fib_dxr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 539d7fe6c96f..326710cc4c45 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -1320,8 +1320,10 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q, dxr_build(new_dxr); /* Structural limit exceeded, hard error */ - if (da->rtbl_top >= BASE_MAX) + if (da->rtbl_top >= BASE_MAX) { + dxr_destroy(new_dxr); return (FLM_ERROR); + } if (new_dxr->d == NULL) { dxr_destroy(new_dxr);