diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-24 19:28:35 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-24 19:40:08 +0200 |
commit | b09bceec68e9963b0bffc70c04f06d307d474adb (patch) | |
tree | 527b0b39f4a08fe548913df56f265964ac13897a /lib/routemap.c | |
parent | Merge remote-tracking branch 'origin/cmaster' into cmaster-next (diff) | |
download | frr-b09bceec68e9963b0bffc70c04f06d307d474adb.tar.xz frr-b09bceec68e9963b0bffc70c04f06d307d474adb.zip |
lib: Fix race condition in shutdown of routemap
When shutting down a daemon that uses an update
timer to handle route map processing, there
exists a race condition where if you change
a route map and then immediately shutdown
quagga before the update timer for the routemap
runs, you will be placed in a infinite loop.
This condition happens because this commit introduces
route map memory free'ing but never tests to see
if the to_be_processed flag has happened or not
before deleting:
commit 289d25016b79ed7908a29af7ba35e18f1ec6ed0a
Author: Lou Berger <lberger@labn.net>
Date: Wed Apr 10 12:30:04 2013 -0700
bgpd, lib: memory cleanups for valgrind, plus debug changes
Modify route_map_finish to explicitly turn off the to_be_processed
field. As that we know we are going away if route_map_finish is
called.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'lib/routemap.c')
-rw-r--r-- | lib/routemap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/routemap.c b/lib/routemap.c index eec36d371..7b0749953 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1838,7 +1838,11 @@ route_map_finish (void) /* cleanup route_map */ while (route_map_master.head) - route_map_delete (route_map_master.head); + { + struct route_map *map = route_map_master.head; + map->to_be_processed = 0; + route_map_delete (map); + } for (i = 1; i < ROUTE_MAP_DEP_MAX; i++) hash_free(route_map_dep_hash[i]); |