From b9a78e5991e18eb4c5f93d2d58e19f1708528dae Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 2 Jun 2002 03:21:53 -0700 Subject: [PATCH] list_head debugging A common and very subtle bug is to use list_heads which aren't on any lists. It causes kernel memory corruption which is observed long after the offending code has executed. The patch nulls out the dangling pointers so we get a nice oops at the site of the buggy code. --- include/linux/list.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/list.h b/include/linux/list.h index 99da4ab62ec2..6331739453a0 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -94,6 +94,8 @@ static __inline__ void __list_del(struct list_head * prev, static __inline__ void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); + entry->next = NULL; + entry->prev = NULL; } /** -- cgit v1.2.3