fib: fix use-after-free for interface adj removal
Type: fix
Change-Id: I82308e368d14d84f5970dad229bdcf2de7d1839d
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index cbd6691..7f053c8 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -823,12 +823,15 @@
};
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);
}