aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-06-08 16:25:14 +0200
committerDave Wallace <dwallacelf@gmail.com>2021-06-09 15:14:48 +0000
commit655c37760724c26c1de15602bf8e4087854af042 (patch)
treedca9dfd32bf63ba55b808b39ad3c1086e106da9f
parent6ac910e0d62f984aca0caca7b07c794beae6e4ba (diff)
fib: make sure adj is valid during walk
The adj can be deleted during fib_walk_sync(), make sure it can happen only after clearing the SYNC_WALK_ACTIVE flag. Type: fix Change-Id: I68be00e9602e2783d9dced71c51547c38b7e8a00 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 9f10edbb46dc1937ed99469a581723cb1ac1ff45)
-rw-r--r--src/vnet/adj/adj_nbr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 811d0b8faa2..3344d6e47cc 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -750,12 +750,15 @@ adj_nbr_interface_state_change_one (adj_index_t ai,
};
ip_adjacency_t *adj;
+ adj_lock (ai);
+
adj = adj_get(ai);
adj->ia_flags |= ADJ_FLAG_SYNC_WALK_ACTIVE;
fib_walk_sync(FIB_NODE_TYPE_ADJ, ai, &bw_ctx);
adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE;
+ adj_unlock (ai);
return (ADJ_WALK_RC_CONTINUE);
}