From: Jorge Boncompte [DTI2] Date: Fri, 13 Apr 2012 11:46:09 +0000 (+0200) Subject: bgpd: Fix crash when disabling dampening (BZ#687) X-Git-Tag: frr-2.0-rc1~1858 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fa4094ac49b4cc23589f5c5b7e608c4b4ee6ca04;p=matthieu%2Ffrr.git bgpd: Fix crash when disabling dampening (BZ#687) Vladimir Podobaev reported that the following commands crashed the daemon. router bgp 123 bgp dampening no bgp dampening 1 2 3 4 no bgp dampening The problem was that bgp_damp_info_clean() tried to dereference the already freed reuse_list array in the second call to "no bgp dampening". Fixed by checking in bgp_damp_disable() that the dampening it's enabled before doing the cleanup. Signed-off-by: Jorge Boncompte [DTI2] --- diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index a513883354..2820f17c79 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -498,6 +498,10 @@ bgp_damp_info_clean (void) int bgp_damp_disable (struct bgp *bgp, afi_t afi, safi_t safi) { + /* If it wasn't enabled, there's nothing to do. */ + if (! CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) + return 0; + /* Cancel reuse thread. */ if (damp->t_reuse ) thread_cancel (damp->t_reuse);