netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 5/8] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len
Date: Sat,  5 Apr 2014 18:03:47 +0200	[thread overview]
Message-ID: <1396713830-4009-6-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1396713830-4009-1-git-send-email-pablo@netfilter.org>

From: Andrey Vagin <avagin@openvz.org>

"len" contains sizeof(nf_ct_ext) and size of extensions. In a worst
case it can contain all extensions. Bellow you can find sizes for all
types of extensions. Their sum is definitely bigger than 256.

nf_ct_ext_types[0]->len = 24
nf_ct_ext_types[1]->len = 32
nf_ct_ext_types[2]->len = 24
nf_ct_ext_types[3]->len = 32
nf_ct_ext_types[4]->len = 152
nf_ct_ext_types[5]->len = 2
nf_ct_ext_types[6]->len = 16
nf_ct_ext_types[7]->len = 8

I have seen "len" up to 280 and my host has crashes w/o this patch.

The right way to fix this problem is reducing the size of the ecache
extension (4) and Florian is going to do this, but these changes will
be quite large to be appropriate for a stable tree.

Fixes: 5b423f6a40a0 (netfilter: nf_conntrack: fix racy timer handling with reliable)
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/net/netfilter/nf_conntrack_extend.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 956b175..55d1504 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
 /* Extensions: optional stuff which isn't permanently in struct. */
 struct nf_ct_ext {
 	struct rcu_head rcu;
-	u8 offset[NF_CT_EXT_NUM];
-	u8 len;
+	u16 offset[NF_CT_EXT_NUM];
+	u16 len;
 	char data[0];
 };
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-04-05 16:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-05 16:03 [PATCH 0/8] netfilter fixes for net Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 1/8] netfilter: connlimit: fix UP build Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 2/8] netfilter: connlimit: move lock array out of struct connlimit_data Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 3/8] netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 4/8] netfilter: Add {ipt,ip6t}_osf aliases for xt_osf Pablo Neira Ayuso
2014-04-05 16:03 ` Pablo Neira Ayuso [this message]
2014-04-05 16:03 ` [PATCH 6/8] netfilter: nf_tables: set names cannot be larger than 15 bytes Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 7/8] netfilter: nf_tables: fix wrong format in request_module() Pablo Neira Ayuso
2014-04-05 16:03 ` [PATCH 8/8] netfilter: Can't fail and free after table replacement 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=1396713830-4009-6-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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).