From: Manfred Spraul A list_del debugging check. Has been in -mm for over three years. davej thinks it'd be useful for mainline. Cc: Dave Jones Signed-off-by: Andrew Morton --- include/linux/list.h | 4 ++++ 1 file changed, 4 insertions(+) diff -puN include/linux/list.h~list_del-debug include/linux/list.h --- a/include/linux/list.h~list_del-debug +++ a/include/linux/list.h @@ -6,7 +6,9 @@ #include #include #include +#include #include +#include /* * Simple doubly linked list implementation. @@ -167,6 +169,8 @@ static inline void __list_del(struct lis #ifndef CONFIG_DEBUG_LIST static inline void list_del(struct list_head *entry) { + BUG_ON(entry->prev->next != entry); + BUG_ON(entry->next->prev != entry); __list_del(entry->prev, entry->next); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; _