mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
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 <[email protected]> Cc: Andi Kleen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
401dea7f7a
commit
17a801f4bf
1 file changed
+3
@@ -31,6 +31,9 @@ void __list_add(struct list_head *new,
|
||||
"list_add corruption. prev->next should be "
|
||||
"next (%p), but was %p. (prev=%p).\n",
|
||||
next, prev->next, prev);
|
||||
WARN(new == prev || new == next,
|
||||
"list_add double add: new=%p, prev=%p, next=%p.\n",
|
||||
new, prev, next);
|
||||
next->prev = new;
|
||||
new->next = next;
|
||||
new->prev = prev;
|
||||
|
||||
Reference in new issue
Block a user