Commit:     218ad12f42e0b6207105cde8fd13017d1ed449e4
Parent:     8053fc3de720e1027d690f892ff7d7c1737fdd9d
Author:     Pavel Emelyanov <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 20:23:31 2007 +0800
Committer:  Herbert Xu <[EMAIL PROTECTED]>
CommitDate: Mon Nov 26 20:23:31 2007 +0800

    [IPV4]: Fix memory leak in inet_hashtables.h when NUMA is on
    The inet_ehash_locks_alloc() looks like this:
    #ifdef CONFIG_NUMA
        if (size > PAGE_SIZE)
                x = vmalloc(...);
                x = kmalloc(...);
    Unlike it, the inet_ehash_locks_alloc() looks like this:
    #ifdef CONFIG_NUMA
        if (size > PAGE_SIZE)
    The error is obvious - if the NUMA is on and the size
    is less than the PAGE_SIZE we leak the pointer (kfree is
    inside the #else branch).
    Compiler doesn't warn us because after the kfree(x) there's
    a "x = NULL" assignment, so here's another (minor?) bug: we
    don't set x to NULL under certain circumstances.
    Boring explanation, I know... Patch explains it better.
    Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
 include/net/inet_hashtables.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 469216d..37f6cb1 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -186,9 +186,8 @@ static inline void inet_ehash_locks_free(struct 
inet_hashinfo *hashinfo)
                if (size > PAGE_SIZE)
-               kfree(hashinfo->ehash_locks);
+               kfree(hashinfo->ehash_locks);
                hashinfo->ehash_locks = NULL;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to