diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-06-10 00:55:16 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-06-10 00:55:16 -0700 |
| commit | b29a28a041aba98c707abf1f2f400fad0b558332 (patch) | |
| tree | bb24070eaeb1e5cde2401a0d5219a45188672536 /include/linux | |
| parent | ae6a0c465d560a2c5e1fa16dd3d2ed769119cf2c (diff) | |
Re-introduce debugging code in list handling, poisoning stale
list pointers to give us a nice oops if somebody is doing something
bad.
Also introduce hlist_del_rcu_init() - same as hlist_del_init().
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/list.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index abf35a4e5b37..d6305f84bfe6 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -8,6 +8,14 @@ #include <asm/system.h> /* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* * Simple doubly linked list implementation. * * Some of the internal functions ("__xxx") are useful when @@ -137,7 +145,10 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) static inline void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; } + /** * list_del_rcu - deletes entry from list without re-initialization * @entry: the element to delete from the list. @@ -148,6 +159,8 @@ static inline void list_del(struct list_head *entry) static inline void list_del_rcu(struct list_head *entry) { __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; } /** @@ -399,8 +412,9 @@ static __inline__ void __hlist_del(struct hlist_node *n) static __inline__ void hlist_del(struct hlist_node *n) { - if (n->pprev) - __hlist_del(n); + __hlist_del(n); + n->next = LIST_POISON1; + n->pprev = LIST_POISON2; } #define hlist_del_rcu hlist_del /* list_del_rcu is identical too? */ @@ -413,6 +427,8 @@ static __inline__ void hlist_del_init(struct hlist_node *n) } } +#define hlist_del_rcu_init hlist_del_init + static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h) { struct hlist_node *first = h->first; |
