Skip to contentSkip to conversation

pi-futex: fix mm_struct memory leak

PATCH New Ingo Molnar 1 participant 1 message Jun 30, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pi-futex: fix mm_struct memory leak

From: Vernon Mauery <[email protected]>
Subject: pi-futex: fix mm_struct memory leak

lock_queue was getting called essentially twice in a row and was continually incrementing the mm_count ref count, thus causing a memory leak.

Dinakar Guniguntala provided a proper fix for the problem that simply grabs the spinlock for the hash bucket queue rather than calling lock_queue.

The second time we do a queue_lock in futex_lock_pi, we really only need to take the hash bucket lock.

---
 kernel/futex.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
Index: linux/kernel/futex.c
===================================================================
@@ -1208,7 +1208,7 @@ static int do_futex_lock_pi(u32 __user *
 	}
 
 	down_read(&curr->mm->mmap_sem);
-	hb = queue_lock(&q, -1, NULL);
+	spin_lock(q.lock_ptr);
 
 	/*
 	 * Got the lock. We might not be the anticipated owner if we