Skip to content

Commit 18864e3

Browse files
committed
[FRR]: Fix crash on SRv6 locator deletion
Port upstream FRR pull request into SONiC: FRRouting/frr#20660 Signed-off-by: Carmine Scarpitta <[email protected]>
1 parent 512e4a5 commit 18864e3

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 3fd5c01f6e71de1ca05c1983f8762a7713ead7b2 Mon Sep 17 00:00:00 2001
2+
From: Carmine Scarpitta <[email protected]>
3+
Date: Mon, 2 Feb 2026 20:17:27 +0000
4+
Subject: [PATCH] staticd: Unset SID validity flag when locator is deleted
5+
6+
When a locator is removed, we iterate over the list of SIDs and
7+
uninstall them from the data plane. However, the validity flag of
8+
the SID remains set, and the locator pointer still points to the
9+
freed locator memory.
10+
11+
This causes issues in other parts of the code where we check the
12+
SID validity flag. Since the flag is still set, we assume the SID
13+
is valid and attempt to access the locator pointer, resulting in
14+
use-after-free crashes.
15+
16+
Fix this by:
17+
- Unsetting the STATIC_FLAG_SRV6_SID_VALID flag to mark the SID
18+
as invalid when its locator is deleted
19+
- Setting the locator pointer to NULL to indicate that the SID
20+
no longer has a locator associated with it
21+
22+
This ensures that when the locator is removed, associated SIDs are
23+
properly marked as invalid and cannot accidentally reference freed
24+
memory.
25+
26+
Signed-off-by: Carmine Scarpitta <[email protected]>
27+
---
28+
staticd/static_zebra.c | 3 +++
29+
1 file changed, 3 insertions(+)
30+
31+
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
32+
index b6757ed5b1b0..ceb60bfbc00b 100644
33+
--- a/staticd/static_zebra.c
34+
+++ b/staticd/static_zebra.c
35+
@@ -1259,6 +1259,9 @@ static int static_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS)
36+
static_zebra_srv6_sid_uninstall(sid);
37+
UNSET_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_SENT_TO_ZEBRA);
38+
}
39+
+
40+
+ sid->locator = NULL;
41+
+ UNSET_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_VALID);
42+
}
43+
44+
listnode_delete(srv6_locators, locator);

src/sonic-frr/patch/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@
6060
0098-SRv6-Add-support-for-multiple-SRv6-locators.patch
6161
0099-zebra-Fix-SRv6-explicit-SID-allocation-to-use-the-provided-locator.patch
6262
0100-bgpd-Allow-proper-shutdown-of-bgp-dynamic-peers.patch
63+
0101-staticd-Fix-SRv6-SID-use-after-free-on-locator-deletion.patch

0 commit comments

Comments
 (0)