From: Florian Westphal <fw@strlen.de>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: "Maciej Żenczykowski" <maze@google.com>,
"David S . Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, "Cong Wang" <xiyou.wangcong@gmail.com>,
"Eric Dumazet" <edumazet@google.com>,
"Pablo Neira Ayuso" <pablo@netfilter.org>
Subject: Re: [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in
Date: Tue, 8 Oct 2019 08:01:09 +0200 [thread overview]
Message-ID: <20191008060109.GA25052@breakpoint.cc> (raw)
In-Reply-To: <20191008053507.252202-1-zenczykowski@gmail.com>
Maciej Żenczykowski <zenczykowski@gmail.com> wrote:
> From: Maciej Żenczykowski <maze@google.com>
>
> Cc: Cong Wang <xiyou.wangcong@gmail.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
> net/netfilter/nf_conntrack_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 0c63120b2db2..35459d04a050 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1679,7 +1679,8 @@ nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state)
> if ((tmpl && !nf_ct_is_template(tmpl)) ||
> ctinfo == IP_CT_UNTRACKED) {
> NF_CT_STAT_INC_ATOMIC(state->net, ignore);
> - return NF_ACCEPT;
> + ret = NF_ACCEPT;
This looks wrong.
> + goto out;
This puts tmpl, causing underflow of skb->nfct.
When we enter nf_conntrack_in and this branch, then 'tmpl'
is already assigned to skb->nfct, it will be put when skb
is free'd.
nf_ct_get() doesn't increment the refcnt.
tmpl only needs to be put in case of ...
> }
> skb->_nfct = 0;
...this.
next prev parent reply other threads:[~2019-10-08 6:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 5:35 [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in Maciej Żenczykowski
2019-10-08 5:35 ` [PATCH 2/2] netfilter: revert "conntrack: silent a memory leak warning" Maciej Żenczykowski
2019-10-08 5:38 ` Maciej Żenczykowski
2019-10-08 5:58 ` Cong Wang
2019-10-08 6:04 ` Florian Westphal
2019-10-08 6:45 ` Maciej Żenczykowski
2019-10-08 7:10 ` Maciej Żenczykowski
2019-10-10 18:36 ` Cong Wang
2019-10-17 18:30 ` Maciej Żenczykowski
2019-10-08 6:01 ` Florian Westphal [this message]
2019-10-08 6:05 ` [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in Cong Wang
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=20191008060109.GA25052@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=xiyou.wangcong@gmail.com \
--cc=zenczykowski@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).