From: Rakesh Garimella Date: Mon, 11 Mar 2013 12:38:31 +0000 (+0000) Subject: bgpd: prevent double address delete on shutdown X-Git-Tag: frr-2.0-rc1~1658 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9e47abd862f71847a85f330435c7b3a9b1f76099;p=matthieu%2Ffrr.git bgpd: prevent double address delete on shutdown bgp_interface_down() and bgp_exit() both proceed to delete the address from bgpd's interface representation, so the second call gets a NULL result from the hash lookup and subsequently crashes. Signed-off-by: Rakesh Garimella [reformatted] Signed-off-by: David Lamparter --- diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index d469236651..4076fe4198 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -604,6 +604,10 @@ bgp_address_del (struct prefix *p) tmp.addr = p->u.prefix4; addr = hash_lookup (bgp_address_hash, &tmp); + /* may have been deleted earlier by bgp_interface_down() */ + if (addr == NULL) + return; + addr->refcnt--; if (addr->refcnt == 0)