Please apply.

I have reproduced the SEGV that was reported when I/O has failed/been aborted.
This pathc prevents the SEGV from occuring in this situation.

It does however not address the root cause why tgtd tries to clear a
list that is already (and it should know is already?) empty.

ronnie sahlberg


>From 9fce02d67ea0369a4c070e3559c0c812a728a914 Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[EMAIL PROTECTED]>
Date: Mon, 7 Jul 2008 11:06:11 +1000
Subject: [PATCH] Make sure the ->next/prev pointers in the list head
are non-NULL
 before we dereference them.

Signed-off-by: Ronnie Sahlberg <[EMAIL PROTECTED]>
---
 usr/list.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/usr/list.h b/usr/list.h
index 4d76057..39222ab 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
_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to