[Crash-utility] [PATCH] Report error for NULL list_head pointers

Rabin Vincent rabin.vincent at axis.com
Thu Mar 30 18:34:10 UTC 2017


From: Rabin Vincent <rabinv at axis.com>

If we hit a NULL next pointer on a struct list_head list it means the
list is corrupted.
---
 tools.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools.c b/tools.c
index 8190d7e..577820d 100644
--- a/tools.c
+++ b/tools.c
@@ -3808,6 +3808,12 @@ do_list(struct list_data *ld)
 		}
 
 		if (next == 0) {
+			if (ld->flags & LIST_HEAD_FORMAT) {
+				error(INFO, "\ninvalid list entry: 0\n");
+				if (close_hq_on_return)
+					hq_close();
+				return -1;
+			}
 			if (CRASHDEBUG(1))
 				console("do_list end: next:%lx\n", next);
 			break;
-- 
2.7.0




More information about the Crash-utility mailing list