summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2008-11-22 01:12:22 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2008-11-22 01:12:22 +0100
commitfbde6c39084637c2f3f4d31261a44dbf367958d1 (patch)
treeff396e1bef302d669314f5d43bbf1fc19bc3f17a
parent35f983f88912eadb1e0b25d800693256cbee33ce (diff)
downloadbird-fbde6c39084637c2f3f4d31261a44dbf367958d1.tar
bird-fbde6c39084637c2f3f4d31261a44dbf367958d1.zip
Fixes race condition leading to memory corruption and crash.
When protocol started, feeding was scheduled. If protocol got down before feeding was executed, then function responsible for connecting protocol to kernel routing tables was called after the function responsible for disconnecting, then resource pool of protocol was freed, but freed linked list structures remains in the list.
-rw-r--r--nest/proto.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/nest/proto.c b/nest/proto.c
index fb24e57..6c89f7e 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -521,9 +521,10 @@ proto_feed_more(void *P)
{
struct proto *p = P;
- DBG("Feeding protocol %s continued\n", p->name);
if (p->core_state != FS_FEEDING)
return;
+
+ DBG("Feeding protocol %s continued\n", p->name);
if (rt_feed_baby(p))
{
p->core_state = FS_HAPPY;
@@ -542,6 +543,9 @@ proto_feed(void *P)
{
struct proto *p = P;
+ if (p->core_state != FS_FEEDING)
+ return;
+
DBG("Feeding protocol %s\n", p->name);
proto_add_announce_hook(p, p->table);
if_feed_baby(p);