[patch] pi-futex: fix mm_struct memory leak



From: Vernon Mauery <vernux@xxxxxxxxxx>
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.

Signed-off-by: Dinakar Guniguntala <dino@xxxxxxxxxx>
Signed-off-by: Vernon Mauery <vernux@xxxxxxxxxx>
Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
kernel/futex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/kernel/futex.c
===================================================================
--- linux.orig/kernel/futex.c
+++ 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • [GIT PULL] KVM fixes for 2.6.25-rc6
    ... The patches fix a memory leak, ... on the host, a locking issue, and a host crash when host userspace changes ... KVM: MMU: Fix memory leak on guest demand faults ...
    (Linux-Kernel)
  • Re: Loosing Microsoft Equations
    ... The memory leak will slow down a bit if you disable Show Project Gallery at ... which hopefully will fix it. ... After a significant editing session (with auto-backup ... McGhie Information Engineering Pty Ltd ...
    (microsoft.public.mac.office)
  • Re: Virtual memory problem? - PF usage grows, not freed when apps
    ... Apparently it is a memory leak bug which currently has no fix, ... but the fix has been broken by subsequent Windows XP updates. ... > That's the page file monitor porgram I asked baout earlier. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: [PATCH 1/2] slub: fix leakage
    ... Fix memory leak by not reusing cpu_slab ... Fix the memory leak that may occur when we attempt to reuse a cpu_slab ... This only occurs if we find that the concurrently allocated slab fits ... our allocation needs. ...
    (Linux-Kernel)