From a99e4e413e1ab9f3c567b5519f5557afd786dc62 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Sat, 1 Jul 2006 04:35:42 -0700 Subject: [PATCH] [PATCH] 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. Signed-off-by: Dinakar Guniguntala Signed-off-by: Vernon Mauery Acked-by: Paul E. McKenney Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/futex.c b/kernel/futex.c index 6c91f938005d..22aa3c16ca73 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1208,7 +1208,7 @@ static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, } 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 -- GitLab