aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-08-07 12:46:18 -0400
committerJohn Lo <loj@cisco.com>2018-08-07 18:05:23 +0000
commit28374cada08df61180044e24cb758fa570e73c9d (patch)
tree0050b76a5c9e59029c9b91becc18b88b6db6f908 /src/vnet/l2
parente25c9bf62e374bebcb89399470b7817c7f446b1b (diff)
Fix dangling reference in l2fib_scan(...)
Deleting a bihash kvp frees the bucket's backing storage when the bucket reference count reaches zero. l2fib_scan MUST check for that condition, and stop scanning the bucket if it occurs. One of the L2 FIB extended "make test" vectors caused this issue 100% of the time. Change-Id: I250bcc4c1518e16042120fbc4032227a759a602e Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/l2')
-rw-r--r--src/vnet/l2/l2_fib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index 959cf4dea17..d891ced1080 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -1103,9 +1103,17 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
kv.key = key.raw;
BV (clib_bihash_add_del) (&fm->mac_table, &kv, 0);
learn_count--;
+ /*
+ * Note: we may have just freed the bucket's backing
+ * storage, so check right here...
+ */
+ if (b->offset == 0)
+ goto doublebreak;
}
v++;
}
+ doublebreak:
+ ;
}
/* keep learn count consistent */