Mesa (7.9): util: make calling remove_from_list multiple times in a row safe

Marek Olšák mareko at kemper.freedesktop.org
Sat Sep 25 00:14:15 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 09085ada5df210b92648a2a9f73bcefc62281648
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09085ada5df210b92648a2a9f73bcefc62281648

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Sep 23 20:39:27 2010 +0200

util: make calling remove_from_list multiple times in a row safe

This commit fixes an infinite loop in foreach_s if remove_from_list is used
more than once on the same item with other list operations in between.

NOTE: This is a candidate for the 7.9 branch because the commit
"r300g: fixup long-lived BO maps being incorrectly unmapped when flushing"
depends on it.
(cherry picked from commit 68afbe89c72d085dcbbf2b264f0201ab73fe339e)

---

 src/gallium/auxiliary/util/u_simple_list.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_simple_list.h b/src/gallium/auxiliary/util/u_simple_list.h
index f5f43b0..fe59771 100644
--- a/src/gallium/auxiliary/util/u_simple_list.h
+++ b/src/gallium/auxiliary/util/u_simple_list.h
@@ -46,6 +46,8 @@
 do {						\
    (elem)->next->prev = (elem)->prev;		\
    (elem)->prev->next = (elem)->next;		\
+   (elem)->next = elem;                         \
+   (elem)->prev = elem;                         \
 } while (0)
 
 /**




More information about the mesa-commit mailing list