aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-01-30 06:00:19 -0800
committerDamjan Marion <dmarion@me.com>2019-01-30 19:47:36 +0000
commit13b2ba2ad5527c8185dce368993a3877e7daf7a2 (patch)
tree44e47257a4b6561d5b9a56880e68b8da91754b50 /src
parent910d3694e8b22c9d14e5f2913d14ae149e184620 (diff)
MPLS tunnel; fix crash when deleting non-existant path
in the case the tunnel is the only user of the shared path list then removing its dependency removes the path list. hence lock the list Change-Id: I18318441698ceac16715b1826266a7d19dcd76e1 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/abf/abf_policy.c2
-rw-r--r--src/vnet/mpls/mpls_tunnel.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/abf/abf_policy.c b/src/plugins/abf/abf_policy.c
index 1fde97f4c50..c411f3bae62 100644
--- a/src/plugins/abf/abf_policy.c
+++ b/src/plugins/abf/abf_policy.c
@@ -198,6 +198,7 @@ abf_policy_delete (u32 policy_id, const fib_route_path_t * rpaths)
ap = abf_policy_get (api);
old_pl = ap->ap_pl;
+ fib_path_list_lock (old_pl);
ap->ap_pl =
fib_path_list_copy_and_path_remove (ap->ap_pl,
(FIB_PATH_LIST_FLAG_SHARED |
@@ -227,6 +228,7 @@ abf_policy_delete (u32 policy_id, const fib_route_path_t * rpaths)
fib_walk_sync (abf_policy_fib_node_type, api, &ctx);
}
+ fib_path_list_unlock (old_pl);
}
return (0);
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index b9e8519e5f4..ad61ac2b25d 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -724,6 +724,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
old_pl_index = mt->mt_path_list;
+ fib_path_list_lock(old_pl_index);
mt->mt_path_list =
fib_path_list_copy_and_path_remove(old_pl_index,
FIB_PATH_LIST_FLAG_SHARED,
@@ -735,6 +736,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
if (FIB_NODE_INDEX_INVALID == mt->mt_path_list)
{
/* no paths left */
+ fib_path_list_unlock(old_pl_index);
return (0);
}
else
@@ -758,6 +760,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
mt->mt_path_list);
mpls_tunnel_restack(mt);
+ fib_path_list_unlock(old_pl_index);
}
return (fib_path_list_get_n_paths(mt->mt_path_list));