[cmaster-next] [PATCH] bgpd: Fix route node unlock when clearing adj-out

Donald Sharp sharpd at cumulusnetworks.com
Fri Dec 2 08:22:21 EST 2016


From: vivek <vivek at cumulusnetworks.com>

When clearing the adj-out for a subgroup (e.g., upon peer going down),
ensure that the adj-out is removed before unlocking the route node that
it points to, otherwise, there is a possibility that the route node may
be prematurely freed.

Signed-off-by: Vivek Venkatraman <vivek at cumulusnetworks.com>

Ticket: CM-13690
Reviewed By: None
Testing Done: bgp-smoke, resilient-hash tests

(cherry picked from commit c3d7d35f3b7152c9e50e52c3cfd60b0dc52df703)
---
 bgpd/bgp_updgrp_adv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index c485e61..a95a11b 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -573,8 +573,8 @@ subgroup_clear_table (struct update_subgroup *subgrp)
 
   SUBGRP_FOREACH_ADJ_SAFE (subgrp, aout, taout)
   {
-    bgp_unlock_node (aout->rn);
     bgp_adj_out_remove_subgroup (aout->rn, aout, subgrp);
+    bgp_unlock_node (aout->rn);
   }
 }
 
-- 
2.5.5





More information about the dev mailing list