summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mthread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mthread.c b/mthread.c
index 064cbdc..b54b714 100644
--- a/mthread.c
+++ b/mthread.c
@@ -187,6 +187,10 @@ out:
 	if (parent && parent != c) {
 		struct container *r;
 
+		// check we don't introduce a new loop
+		if (reachable(parent, c) || reachable(c, parent))
+			goto out2;
+
 		if (c->parent == parent) { // already correct
 			goto out2;
 		} else if (c->parent) {