From: Florian Westphal <fw@strlen.de>
To: Liping Zhang <zlpnobody@163.com>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
Liping Zhang <liping.zhang@spreadtrum.com>
Subject: Re: [PATCH nf] netfilter: nft_ct: fix unpaired nf_connlabels_get/put call
Date: Sat, 16 Jul 2016 11:18:01 +0200 [thread overview]
Message-ID: <20160716091801.GB6123@breakpoint.cc> (raw)
In-Reply-To: <1468650441-17407-1-git-send-email-zlpnobody@163.com>
Liping Zhang <zlpnobody@163.com> wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
>
> We only get nf_connlabels if the user add ct label set expr successfully,
> but we will also put nf_connlabels if the user delete ct lable get expr.
> This is mismathced, and will cause ct label expr cannot work properly.
>
> Also, if we init something fail, we should put nf_connlabels back.
> Otherwise, we may waste to alloc the memory that will never be used.
Acked-by: Florian Westphal <fw@strlen.de>
Unrelated to your patch:
I think its time to change conntrack labels to a pure 128 bit field:
#define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE)
struct nf_conn_labels {
unsigned long bits[NF_CT_LABELS_MAX_SIZE];
};
static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
{
#ifdef CONFIG_NF_CONNTRACK_LABELS
struct nf_conn_labels *cl_ext;
struct net *net = nf_ct_net(ct);
if (net->ct.labels_used == 0)
return NULL;
cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
sizeof(struct nf_conn_labels), GFP_ATOMIC);
if (cl_ext != NULL)
cl_ext->words = words;
return cl_ext;
#else
return NULL;
#endif
}
Most arches are 64bit so once one label is active we already allocate 16 bytes
due to the padding hole in nf_conn_labels struct.
OVS always asks for 128bit so in that case we'd only allocate 16 instead of the
current 24 byte.
next prev parent reply other threads:[~2016-07-16 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-16 6:27 [PATCH nf] netfilter: nft_ct: fix unpaired nf_connlabels_get/put call Liping Zhang
2016-07-16 9:18 ` Florian Westphal [this message]
2016-07-18 19:52 ` 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=20160716091801.GB6123@breakpoint.cc \
--to=fw@strlen.de \
--cc=liping.zhang@spreadtrum.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zlpnobody@163.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).