From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, Liping Zhang <zlpnobody@163.com>,
Netfilter Developer Mailing List
<netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nf] netfilter: ctnetlink: fix incorrect nf_ct_put during hash resize
Date: Tue, 23 May 2017 23:34:27 +0200 [thread overview]
Message-ID: <20170523213427.GA9071@salvia> (raw)
In-Reply-To: <CAML_gOdnZkbCp8JnVpd8bbeTQuhK7hMtQio4iuLQe137HxE_+g@mail.gmail.com>
On Sun, May 21, 2017 at 08:59:45AM +0800, Liping Zhang wrote:
> Hi Florian,
>
> 2017-05-21 8:00 GMT+08:00 Florian Westphal <fw@strlen.de>:
> [...]
> > Yes, you're right, seems this was added in
> > 93bb0ceb75be2fdfa9fc0dd1fb522d9ada515d9c (it adds the 'goto out').
>
> I added some trace logs, and when the hash size reduced, for example,
> from 60000 to 500, then the issue would happen.
>
> Actually, hitting 'goto out' is not easy, so the issue exists for a very long
> time. Maybe commit 89f2e21883b5("[NETFILTER]: ctnetlink: change
> table dumping not to require an unique ID") is to blame for it.
>
> > Your patch looks correct.
> >
> > However, why do we bump refcnt of 'last' in the first place?
> >
> > Its only the continuation marker, i.e. its expected to reside
> > in the hash slot at cb->args[0], but after rehash this might not
> > be true either.
> >
> > I think we should simplify this, just take the verbatim address,
> > and clear it right at start of ctnetlink_dump_table, i.e.
> >
> > unsigned long last = cb->args[1];
> > cb->args[1] = 0;
> >
> > for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
> > ...
> > hlist_nulls_for_each_entry ... {
> > ...
> > if (last) {
> > if (last != (unsigned long)ct))
> > cont;
> > last = 0;
> > }
> > ...
> > dump();
> > }
> > last = 0; /* reset it, as it wasn't in args[0] slot */
> > }
> >
> > Do you see any problem with that?
>
> I think this will be better, this will make code more clean.
> Also we can clean up the ctnetlink_exp_ct_dump_table too.
@Florian, no objection then if I place this into nf.git?
I will append the Fixes: tag:
Fixes: 89f2e21883b5 ("[NETFILTER]: ctnetlink: change table dumping not to require an unique ID")
next prev parent reply other threads:[~2017-05-23 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-20 23:22 [PATCH nf] netfilter: ctnetlink: fix incorrect nf_ct_put during hash resize Liping Zhang
2017-05-21 0:00 ` Florian Westphal
2017-05-21 0:59 ` Liping Zhang
2017-05-23 21:34 ` Pablo Neira Ayuso [this message]
2017-05-23 22:28 ` Florian Westphal
2017-05-24 0:52 ` Liping Zhang
2017-05-24 6:22 ` Florian Westphal
2017-05-24 10:24 ` 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=20170523213427.GA9071@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.