summaryrefslogtreecommitdiff
path: root/bgpd/bgp_label.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2025-02-10 12:02:00 -0500
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-02-13 17:45:18 +0000
commit00e7b27af084719e1356c5a11cafe723a8d5492c (patch)
treec7b94523c1346d7f7fdec941cbbd9438fd189d74 /bgpd/bgp_label.c
parent3b97f50e31614a14a7c446e420f269b878f5fdf9 (diff)
bgpd: Fix crash in bgp_labelpool
The bgp labelpool code is grabbing the vpn policy data structure. This vpn_policy has a pointer to the bgp data structure. If a item placed on the bgp label pool workqueue happens to sit there for the microsecond or so and the operator issues a `no router bgp...` command that corresponds to the vpn_policy bgp pointer, when the workqueue is run it will crash because the bgp pointer is now freed and something else owns it. Modify the labelpool code to store the vrf id associated with the request on the workqueue. When you wake up if the vrf id still has a bgp pointer allow the request to continue, else drop it. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit 14eac319e8ae9314f5270f871106a70c4986c60c)
Diffstat (limited to 'bgpd/bgp_label.c')
-rw-r--r--bgpd/bgp_label.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 5db3621738..8ed9584b0a 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -387,6 +387,8 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
*/
if (!have_label_to_reg) {
SET_FLAG(dest->flags, BGP_NODE_LABEL_REQUESTED);
+ struct bgp_table *table;
+
if (BGP_DEBUG(labelpool, LABELPOOL))
zlog_debug(
"%s: Requesting label from LP for %pFX",
@@ -396,7 +398,9 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
* the pool. This means we'll never register
* FECs withoutvalid labels.
*/
- bgp_lp_get(LP_TYPE_BGP_LU, dest,
+ table = bgp_dest_table(dest);
+
+ bgp_lp_get(LP_TYPE_BGP_LU, dest, table->bgp->vrf_id,
bgp_reg_for_label_callback);
return;
}