aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-05-29 18:07:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:32 -0400
commit17a801f4bfeb8d55df1b05fa7adb16ada504e765 (patch)
tree7aa3a8683c48ff5d5c5fd987f0edbc34171ddb7e /lib
parent401dea7f7ade662b77c33ce2498fb5b4f97cb29c (diff)
list_debug: WARN for adding something already in the list
We were bitten by this at one point and added an additional sanity test for DEBUG_LIST. You can't validly add a list_head to a list where either prev or next is the same as the thing you're adding. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/list_debug.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 3810b481f940..23a5e031cd8b 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -31,6 +31,9 @@ void __list_add(struct list_head *new,
31 "list_add corruption. prev->next should be " 31 "list_add corruption. prev->next should be "
32 "next (%p), but was %p. (prev=%p).\n", 32 "next (%p), but was %p. (prev=%p).\n",
33 next, prev->next, prev); 33 next, prev->next, prev);
34 WARN(new == prev || new == next,
35 "list_add double add: new=%p, prev=%p, next=%p.\n",
36 new, prev, next);
34 next->prev = new; 37 next->prev = new;
35 new->next = next; 38 new->next = next;
36 new->prev = prev; 39 new->prev = prev;