netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@163.com>
Cc: netfilter-devel@vger.kernel.org,
	Liping Zhang <zlpnobody@gmail.com>,
	Davide Caratti <dcaratti@redhat.com>
Subject: Re: [PATCH nf] netfilter: nf_ct_dccp/sctp: fix memory leak after netns cleanup
Date: Tue, 27 Jun 2017 17:57:57 +0200	[thread overview]
Message-ID: <20170627155757.GA4859@salvia> (raw)
In-Reply-To: <1496575054-17168-1-git-send-email-zlpnobody@163.com>

On Sun, Jun 04, 2017 at 07:17:34PM +0800, Liping Zhang wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
> 
> After running the following commands for a while, kmemleak reported that
> "1879 new suspected memory leaks" happened:
>   # while : ; do
>   ip netns add test
>   ip netns delete test
>   done
> 
>   unreferenced object 0xffff88006342fa38 (size 1024):
>   comm "ip", pid 15477, jiffies 4295982857 (age 957.836s)
>   hex dump (first 32 bytes):
>     b8 b0 4d a0 ff ff ff ff c0 34 c3 59 00 88 ff ff  ..M......4.Y....
>     04 00 00 00 a4 01 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<ffffffff8190510a>] kmemleak_alloc+0x4a/0xa0
>     [<ffffffff81284130>] __kmalloc_track_caller+0x150/0x300
>     [<ffffffff812302d0>] kmemdup+0x20/0x50
>     [<ffffffffa04d598a>] dccp_init_net+0x8a/0x160 [nf_conntrack]
>     [<ffffffffa04cf9f5>] nf_ct_l4proto_pernet_register_one+0x25/0x90
>   ...
>   unreferenced object 0xffff88006342da58 (size 1024):
>   comm "ip", pid 15477, jiffies 4295982857 (age 957.836s)
>   hex dump (first 32 bytes):
>     10 b3 4d a0 ff ff ff ff 04 35 c3 59 00 88 ff ff  ..M......5.Y....
>     04 00 00 00 a4 01 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<ffffffff8190510a>] kmemleak_alloc+0x4a/0xa0
>     [<ffffffff81284130>] __kmalloc_track_caller+0x150/0x300
>     [<ffffffff812302d0>] kmemdup+0x20/0x50
>     [<ffffffffa04d6a9d>] sctp_init_net+0x5d/0x130 [nf_conntrack]
>     [<ffffffffa04cf9f5>] nf_ct_l4proto_pernet_register_one+0x25/0x90
>   ...
> 
> This is because we forgot to implement the get_net_proto for sctp and
> dccp, so we won't invoke the nf_ct_unregister_sysctl to free the
> ctl_table when do netns cleanup. Also note, we will fail to register
> the sysctl for dccp/sctp either due to the lack of get_net_proto.

Applied to nf, thanks.

  parent reply	other threads:[~2017-06-27 15:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-04 11:17 [PATCH nf] netfilter: nf_ct_dccp/sctp: fix memory leak after netns cleanup Liping Zhang
2017-06-05  8:09 ` Davide Caratti
2017-06-19 15:52 ` Florian Westphal
2017-06-27 15:57 ` Pablo Neira Ayuso [this message]
2017-06-28 18:24 ` [nf] " Andrei Vagin
2017-06-28 23:36   ` Pablo Neira Ayuso

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=20170627155757.GA4859@salvia \
    --to=pablo@netfilter.org \
    --cc=dcaratti@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zlpnobody@163.com \
    --cc=zlpnobody@gmail.com \
    /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).