summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2018-05-09 07:16:04 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-05-11 14:02:05 +0200
commit528cd74fd326517b2c9d941c9e9803c6c8d17515 (patch)
treeca35bf426330a46c68b570e7762fc83ac5e44be6 /bgpd/bgp_route.c
parentMerge pull request #2195 from qlyoung/docuser (diff)
downloadfrr-528cd74fd326517b2c9d941c9e9803c6c8d17515.tar.xz
frr-528cd74fd326517b2c9d941c9e9803c6c8d17515.zip
bgpd: Update parent entry's refcount for imported routes
Imported routes in a VRF routing table have a reference to their parent route entry which resides in the EVPN or IPVPN routing table. Ensure that this reference uses appropriate locking so that the parent entry doesn't get freed prematurely. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 13cb6b22ba9d558b1b4a1e8752f63f13242462a7) Conflicts: bgpd/bgp_mplsvpn.c Ticket: CM-20471 Testing Done: a) Ran vrf_route_leak tests without fix and hit crash, ran twice with fix and did not see the crash. b) Ran evpn-smoke and ensured there were no new failures.
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index cfaa04a8c..424fc4bc0 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -225,6 +225,11 @@ struct bgp_info *bgp_info_lock(struct bgp_info *binfo)
struct bgp_info *bgp_info_unlock(struct bgp_info *binfo)
{
+ /* unlink reference to parent, if any. */
+ if (binfo->extra && binfo->extra->parent) {
+ bgp_info_unlock((struct bgp_info *)binfo->extra->parent);
+ binfo->extra->parent = NULL;
+ }
assert(binfo && binfo->lock > 0);
binfo->lock--;