From: David Lamparter Date: Fri, 12 Dec 2014 20:35:28 +0000 (+0100) Subject: lib: don't create circular lists (fixes 6d83113) X-Git-Tag: frr-2.0-rc1~774 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=de111d75a97e18bcbe048d070584ad06eff42f1d;p=matthieu%2Ffrr.git 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 Fixes: 6d83113 ("ospfd: Tweak previous iface RR write patch to avoid free/malloc & redundant log") Cc: Paul Jakma Signed-off-by: David Lamparter Acked-by: Greg Troxel Acked-by: Dinesh Dutt Acked-by: Vincent JARDIN (cherry picked from commit 1c6db0d2da34044ddfb42665fda8a3387ecc451d) --- diff --git a/lib/linklist.h b/lib/linklist.h index 24a9e20698..88f4a03912 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 \