summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@yandex-team.ru>2021-10-27 00:07:01 +0500
committerNeale Ranns <neale@graphiant.com>2022-03-22 09:02:30 +0000
commit15732f5d05f46498457b98ae3e187870210e69c4 (patch)
treea55d25f39fe3171b991fe03a84c41201d611b033 /src/vnet
parentb9ff03c805ead01101f214638873fcdcb3124a02 (diff)
fib: refetech the adj after the walk in case the pool realloc'd
Follow e3aeb38fa82b77ae84643f5140d9674056b6b5ca Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I743911cacc026af5da392d26eaf47ab83ea1de99
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/adj/adj_nbr.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index d289bb6a2a8..b3a027b7af4 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -532,7 +532,7 @@ adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
fib_walk_sync(FIB_NODE_TYPE_ADJ, walk_ai, &bw_ctx);
/*
- * fib_walk_sync may allocate a new adjacency and potentially cuase a
+ * fib_walk_sync may allocate a new adjacency and potentially cause a
* realloc for adj_pool. When that happens, adj pointer is no longer
* valid here. We refresh the adj pointer accordingly.
*/
@@ -793,9 +793,15 @@ adj_nbr_interface_state_change_one (adj_index_t ai,
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);
+
+ /*
+ * fib_walk_sync may allocate a new adjacency and potentially cause a
+ * realloc for adj_pool. When that happens, adj pointer is no longer
+ * valid here. We refresh the adj pointer accordingly.
+ */
+ adj = adj_get(ai);
adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE;
adj_unlock (ai);
@@ -903,9 +909,15 @@ adj_nbr_interface_delete_one (adj_index_t ai,
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);
+
+ /*
+ * fib_walk_sync may allocate a new adjacency and potentially cause a
+ * realloc for adj_pool. When that happens, adj pointer is no longer
+ * valid here. We refresh the adj pointer accordingly.
+ */
+ adj = adj_get(ai);
adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE;
adj_unlock(ai);