netdev
[Top] [All Lists]

Re: Memory leak in 2.6.11-rc1?

To: Russell King <rmk+lkml@xxxxxxxxxxxxxxxx>
Subject: Re: Memory leak in 2.6.11-rc1?
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Thu, 27 Jan 2005 16:34:44 -0800
Cc: Robert.Olsson@xxxxxxxxxxx, akpm@xxxxxxxx, torvalds@xxxxxxxx, alexn@xxxxxxxxx, kas@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050128001701.D22695@xxxxxxxxxxxxxxxxxxxxxx>
References: <20050123095608.GD16648@xxxxxxx> <20050123023248.263daca9.akpm@xxxxxxxx> <20050123200315.A25351@xxxxxxxxxxxxxxxxxxxxxx> <20050124114853.A16971@xxxxxxxxxxxxxxxxxxxxxx> <20050125193207.B30094@xxxxxxxxxxxxxxxxxxxxxx> <20050127082809.A20510@xxxxxxxxxxxxxxxxxxxxxx> <20050127004732.5d8e3f62.akpm@xxxxxxxx> <16888.58622.376497.380197@xxxxxxxxxxxx> <20050127164918.C3036@xxxxxxxxxxxxxxxxxxxxxx> <20050127123326.2eafab35.davem@xxxxxxxxxxxxx> <20050128001701.D22695@xxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Fri, 28 Jan 2005 00:17:01 +0000
Russell King <rmk+lkml@xxxxxxxxxxxxxxxx> wrote:

> Yes.  Someone suggested this evening that there may have been a recent
> change to do with some IPv6 refcounting which may have caused this
> problem.  Is that something you can confirm?

Yep, it would be this change below.  Try backing it out and see
if that makes your leak go away.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/14 20:41:55-08:00 herbert@xxxxxxxxxxxxxxxxxxx 
#   [IPV6]: Fix locking in ip6_dst_lookup().
#   
#   The caller does not necessarily have the socket locked
#   (udpv6sendmsg() is one such case) so we have to use
#   sk_dst_check() instead of __sk_dst_check().
#   
#   Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
#   Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
# 
# net/ipv6/ip6_output.c
#   2005/01/14 20:41:34-08:00 herbert@xxxxxxxxxxxxxxxxxxx +3 -3
#   [IPV6]: Fix locking in ip6_dst_lookup().
#   
#   The caller does not necessarily have the socket locked
#   (udpv6sendmsg() is one such case) so we have to use
#   sk_dst_check() instead of __sk_dst_check().
#   
#   Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
#   Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
# 
diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
--- a/net/ipv6/ip6_output.c     2005-01-27 16:07:21 -08:00
+++ b/net/ipv6/ip6_output.c     2005-01-27 16:07:21 -08:00
@@ -745,7 +745,7 @@
        if (sk) {
                struct ipv6_pinfo *np = inet6_sk(sk);
        
-               *dst = __sk_dst_check(sk, np->dst_cookie);
+               *dst = sk_dst_check(sk, np->dst_cookie);
                if (*dst) {
                        struct rt6_info *rt = (struct rt6_info*)*dst;
        
@@ -772,9 +772,9 @@
                             && (np->daddr_cache == NULL ||
                                 !ipv6_addr_equal(&fl->fl6_dst, 
np->daddr_cache)))
                            || (fl->oif && fl->oif != (*dst)->dev->ifindex)) {
+                               dst_release(*dst);
                                *dst = NULL;
-                       } else
-                               dst_hold(*dst);
+                       }
                }
        }
 

<Prev in Thread] Current Thread [Next in Thread>