From: Andrew Morton Date: Sun, 2 Jun 2002 10:21:53 +0000 (-0700) Subject: [PATCH] list_head debugging X-Git-Tag: v2.5.20~2^2~18 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=b9a78e5991e18eb4c5f93d2d58e19f1708528dae;p=history.git [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. --- 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; } /**