summaryrefslogtreecommitdiffstats
path: root/lib/linklist.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2014-12-12 21:35:28 +0100
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-26 17:24:51 +0200
commitde111d75a97e18bcbe048d070584ad06eff42f1d (patch)
tree308294006a5814ef742f19e47fbb8795bd1ac41d /lib/linklist.h
parentbgpd: set BGP_ATTR_MP_[UN]REACH_NLRI (fixes 1a211cb) (diff)
downloadfrr-de111d75a97e18bcbe048d070584ad06eff42f1d.tar.xz
frr-de111d75a97e18bcbe048d070584ad06eff42f1d.zip
lib: don't create circular lists (fixes 6d83113)
LISTNODE_DETACH doesn't clear out the node, and LISTNODE_ATTACH doesn't set ->next (since it assumes a fresh/zeroed listnode). As a result, the new listnode_move_to_tail() created a nice circular list, in turn crashing ospfd in ospf_write() later. Reported-by: Martin Winter <mwinter@netdef.org> Fixes: 6d83113 ("ospfd: Tweak previous iface RR write patch to avoid free/malloc & redundant log") Cc: Paul Jakma <paul@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> (cherry picked from commit 1c6db0d2da34044ddfb42665fda8a3387ecc451d)
Diffstat (limited to 'lib/linklist.h')
-rw-r--r--lib/linklist.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/linklist.h b/lib/linklist.h
index 24a9e2069..88f4a0391 100644
--- a/lib/linklist.h
+++ b/lib/linklist.h
@@ -112,6 +112,7 @@ extern void list_add_list (struct list *, struct list *);
#define LISTNODE_ATTACH(L,N) \
do { \
(N)->prev = (L)->tail; \
+ (N)->next = NULL; \
if ((L)->head == NULL) \
(L)->head = (N); \
else \