From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 3/7] netfilter: CONFIG_COMPAT: allow delta to exceed 32767
Date: Fri, 5 Feb 2010 02:43:11 +0100 [thread overview]
Message-ID: <1265334195-28120-4-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1265334195-28120-1-git-send-email-fw@strlen.de>
with 32 bit userland and 64 bit kernels, it is unlikely but possible
that insertion of new rules fails even tough there are only about 2000
iptables rules.
This happens because the compat delta is using a short int.
Easily reproducible via "iptables -m limit" ; after about 2050
rules inserting new ones fails with -ELOOP.
Note that compat_delta included 2 bytes of padding on x86_64, so
structure size remains the same.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/linux/netfilter/x_tables.h | 2 +-
net/netfilter/x_tables.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 365fabe..2e342ad 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -583,7 +583,7 @@ extern void xt_compat_unlock(u_int8_t af);
extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
extern void xt_compat_flush_offsets(u_int8_t af);
-extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
+extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
extern int xt_compat_match_offset(const struct xt_match *match);
extern int xt_compat_match_from_user(struct xt_entry_match *m,
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index f01955c..783ca37 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -37,7 +37,7 @@ MODULE_DESCRIPTION("{ip,ip6,arp,eb}_tables backend module");
struct compat_delta {
struct compat_delta *next;
unsigned int offset;
- short delta;
+ int delta;
};
struct xt_af {
@@ -435,10 +435,10 @@ void xt_compat_flush_offsets(u_int8_t af)
}
EXPORT_SYMBOL_GPL(xt_compat_flush_offsets);
-short xt_compat_calc_jump(u_int8_t af, unsigned int offset)
+int xt_compat_calc_jump(u_int8_t af, unsigned int offset)
{
struct compat_delta *tmp;
- short delta;
+ int delta;
for (tmp = xt[af].compat_offsets, delta = 0; tmp; tmp = tmp->next)
if (tmp->offset < offset)
--
1.6.4.4
next prev parent reply other threads:[~2010-02-05 1:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-05 1:43 [PATCH 0/7] netfilter: ebtables: CONFIG_COMPAT support Florian Westphal
2010-02-05 1:43 ` [PATCH 1/7] netfilter: ebtables: abort if next_offset is too small Florian Westphal
2010-02-05 1:43 ` [PATCH 2/7] netfilter: ebtables: avoid explicit XT_ALIGN() in match/targets Florian Westphal
2010-02-05 1:43 ` Florian Westphal [this message]
2010-02-05 1:43 ` [PATCH 4/7] netfilter: ebtables: split do_replace into two functions Florian Westphal
2010-02-05 1:43 ` [PATCH 5/7] netfilter: ebtables: add CONFIG_COMPAT support Florian Westphal
2010-02-05 13:52 ` Florian Westphal
2010-02-07 22:43 ` Florian Westphal
2010-02-05 1:43 ` [PATCH 6/7] netfilter: ebt_limit: " Florian Westphal
2010-02-05 1:43 ` [PATCH 7/7] netfilter: ebtables: mark: " Florian Westphal
2010-02-05 7:15 ` [PATCH 0/7] netfilter: ebtables: " Jan Engelhardt
2010-02-05 14:00 ` Florian Westphal
2010-02-05 17:15 ` Bart De Schuymer
2010-02-05 18:02 ` David Miller
2010-02-06 13:08 ` Bart De Schuymer
2010-02-06 13:50 ` Jan Engelhardt
2010-02-07 22:38 ` Florian Westphal
2010-02-07 23:19 ` Bart De Schuymer
2010-02-07 23:28 ` Florian Westphal
2010-02-05 19:53 ` Florian Westphal
2010-02-05 20:07 ` Jan Engelhardt
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=1265334195-28120-4-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--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).