Skip to content

bgpd: Fix memory leak for EVPN Type-4 and dangling pointer for bgp_debug_rdpfxpath2str() (backport #22210)#22447

Merged
riw777 merged 2 commits into
stable/10.5from
mergify/bp/stable/10.5/pr-22210
Jun 23, 2026
Merged

bgpd: Fix memory leak for EVPN Type-4 and dangling pointer for bgp_debug_rdpfxpath2str() (backport #22210)#22447
riw777 merged 2 commits into
stable/10.5from
mergify/bp/stable/10.5/pr-22210

Conversation

@mergify

@mergify mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown

This is an automatic backport of pull request #22210 done by [Mergify](https://mergify.com).

ton31337 added 2 commits June 22, 2026 14:47
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x50400007d818 at pc 0x55b8475e1bf8 bp 0x7ffe8b1f8c60 sp 0x7ffe8b1f8c50
READ of size 4 at 0x50400007d818 thread T0
    0 0x55b8475e1bf7 in bgp_debug_rdpfxpath2str bgpd/bgp_debug.c:2941
    1 0x55b84786dbb4 in bgp_update bgpd/bgp_route.c:6469
    2 0x55b84760ce07 in process_type5_route bgpd/bgp_evpn.c:5289
    3 0x55b847635fcc in bgp_nlri_parse_evpn bgpd/bgp_evpn.c:6501
    4 0x55b8477c2ac8 in bgp_nlri_parse bgpd/bgp_packet.c:322
    5 0x55b8477c9a89 in bgp_update_receive bgpd/bgp_packet.c:2506
    6 0x55b8477e2c34 in bgp_process_packet bgpd/bgp_packet.c:4132
    7 0x7f5fdd20306f in event_call lib/event.c:2740
    8 0x7f5fdd01ef39 in frr_run lib/libfrr.c:1258
    9 0x55b847578612 in main bgpd/bgp_main.c:549
    10 0x7f5fdb5bf1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb)
    11 0x7f5fdb5bf28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb)
    12 0x55b847572ae4 in _start (/usr/local/sbin/bgpd+0xa9eae4) (BuildId: 326510628b5cbd02b862e3f4d4e817224ecbeb04)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit cd8aaf7)
$ vtysh -c 'show bgp l2vpn evpn es'
ES Flags: B - bypass, L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI                            Flags RD                    #VNIs    VTEPs
03:aa:bb:cc:dd:ee:ff:00:00:01  L     172.54.0.10:2         0        10.99.0.1(E),10.99.0.2(E),10.99.0.3(E),10.99.0.4(E),10.99.0.5(E),10.99.0.6(E),10.99.0.7(E),10.99.0.8(E),10.99.0.9(E),10.99.0.10(E),10.99.0.11(E),10.99.0.12(E),10.99.0.13(E),10.99.0.14(E),10.99.0.15(E),10.99.0.16(E),10.99.0.17(E),10.99.0.18(E),10.99.0.19(E),10.99.0.20(E),10.99.0.21(E),10.99.0.22(E),10.99.0.23(E),10.99.0.24(E),10.99.0.25(E),10.99.0.26(E),10.99.0.27(E),10.99.0.28(E),10.99.0.29(E),10.99.0.30(E),10.99.0.31(E),10.99.0.32(E),10.99.0.33(E),10.99.0.34(E),10.99.0.35(E),10.99.0.36(E),10.99.0.37(E),10.99.0.38(E),...

$ vtysh -c 'show memory bgp' | grep 'ES VTEP'
BGP EVPN ES VTEP              :       50    112        5600       50      5600

$ vtysh -c 'show bgp l2vpn evpn route type es'
   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 65002:1
 *>  [4]:[03:aa:bb:cc:dd:ee:ff:00:00:01]:[32]:[10.99.0.1] RD 65002:1
                    10.99.0.50                             0 65002 i
...
Displayed 2 prefixes (2 paths) (of requested type)
```

After MP_UNREACH withdraw of the prefix, **49** vteps remain; only the
last-swapped NH `10.99.0.50` is deleted:

```
$ vtysh -c 'show memory bgp' | grep 'ES VTEP'
BGP EVPN ES VTEP              :       49    112        5488       50      5600
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 6b9fd94)
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Target branch is not in the allowed branches list.

@frrbot frrbot Bot added the bgp label Jun 22, 2026
@riw777 riw777 merged commit 6725a7d into stable/10.5 Jun 23, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants