netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Parkin <tparkin@katalix.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: kmemleak complaints in ip6mr.c
Date: Wed, 30 Jan 2013 09:49:28 +0000	[thread overview]
Message-ID: <20130130094928.GA2519@raven> (raw)
In-Reply-To: <20130129.135906.1332264867631483230.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

On Tue, Jan 29, 2013 at 01:59:06PM -0500, David Miller wrote:
> From: Tom Parkin <tparkin@katalix.com>
> Date: Tue, 29 Jan 2013 18:51:27 +0000
> 
> > I've discovered what may be a memory leak in ip6mr when using network
> > namespaces.  Here's the kmemleak backtrace:
> > 
> > 
> > unreferenced object 0xf0d4a180 (size 96):
> >   comm "ip", pid 6735, jiffies 4294949643 (age 73.268s)
> >   hex dump (first 32 bytes):
> >     68 a1 d4 f0 00 02 20 00 01 00 00 00 00 00 00 00  h..... .........
> >     00 00 00 00 00 00 00 00 00 00 00 00 ff 7f 00 00  ................
> >   backtrace:
> >     [<c159b50c>] kmemleak_alloc+0x2c/0x60
> >     [<c1139c23>] __kmalloc+0x1c3/0x240
> >     [<c14e2627>] fib_default_rule_add+0x27/0x70
> >     [<c157f8df>] ip6mr_net_init+0x6f/0x140
> >     [<c14c4129>] ops_init+0x39/0x110
> >     [<c14c425f>] setup_net+0x5f/0xf0
> >     [<c14c46e4>] copy_net_ns+0x74/0xf0
> >     [<c105fc81>] create_new_namespaces+0xd1/0x160
> >     [<c105fedf>] unshare_nsproxy_namespaces+0x5f/0xa0
> >     [<c1038a94>] sys_unshare+0x114/0x280
> >     [<c15b7ecd>] sysenter_do_call+0x12/0x28
> >     [<ffffffff>] 0xffffffff
> 
> How is this memory unreferenced?  fib_rule_default_add() adds
> the allocated object to the ops->rules_list as it's very last
> action.

I think it should be freed by ip6mr_rules_exit() when the namespace is
destroyed.  That function calls fib_rules_unregister() on the stashed
ops pointer in net->ipv6.mr6_rules_ops.
-- 
Tom Parkin
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

      parent reply	other threads:[~2013-01-30  9:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 18:51 kmemleak complaints in ip6mr.c Tom Parkin
2013-01-29 18:59 ` David Miller
2013-01-30  8:22   ` Cong Wang
2013-01-30  9:49   ` Tom Parkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130130094928.GA2519@raven \
    --to=tparkin@katalix.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).