From de111d75a97e18bcbe048d070584ad06eff42f1d Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 12 Dec 2014 21:35:28 +0100 Subject: [PATCH] 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) --- lib/linklist.h | 1 + 1 file changed, 1 insertion(+) 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 \ -- 2.39.5