diff mbox series

list_debug: check prev/next for NULL when checking list_head for validity

Message ID 20180110030757.16774-1-lsahlber@redhat.com
State New
Headers show
Series list_debug: check prev/next for NULL when checking list_head for validity | expand

Commit Message

Ronnie Sahlberg Jan. 10, 2018, 3:07 a.m. UTC
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 lib/list_debug.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/list_debug.c b/lib/list_debug.c
index a34db8d27667..e33947f06d84 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -42,7 +42,13 @@  bool __list_del_entry_valid(struct list_head *entry)
 	prev = entry->prev;
 	next = entry->next;
 
-	if (CHECK_DATA_CORRUPTION(next == LIST_POISON1,
+	if (CHECK_DATA_CORRUPTION(next == NULL,
+			"list_del corruption, %p->next is NULL\n",
+			entry) ||
+	    CHECK_DATA_CORRUPTION(prev == NULL,
+			"list_del corruption, %p->prev is NULL\n",
+			entry) ||
+	    CHECK_DATA_CORRUPTION(next == LIST_POISON1,
 			"list_del corruption, %p->next is LIST_POISON1 (%p)\n",
 			entry, LIST_POISON1) ||
 	    CHECK_DATA_CORRUPTION(prev == LIST_POISON2,