[PATCH] Make sure that ->prev and ->next are non-NULL before we call __list_del() and dereference them.

Ronnie Sahlberg ronniesahlberg
Mon Jul 7 04:53:13 CEST 2008


Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
 usr/list.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/usr/list.h b/usr/list.h
index 4d76057..12e6b06 100644
--- a/usr/list.h
+++ b/usr/list.h
@@ -82,6 +82,9 @@ static inline void __list_del(struct list_head *
prev, struct list_head * next)

 static inline void list_del(struct list_head *entry)
 {
+	if ((entry->prev == NULL) && (entry->next == NULL))
+		return;
+
 	__list_del(entry->prev, entry->next);
 	entry->next = entry->prev = NULL;
 }
-- 
1.5.4.3



More information about the stgt mailing list