summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Ebbert <76306.1226@compuserve.com>2007-01-04 02:59:56 -0500
committerChris Wright <chrisw@sous-sol.org>2007-01-10 11:05:22 -0800
commitff6173b1de40f8b0341c18a8e12414a59bcf7f52 (patch)
tree950587c15826781ece13ac869d365be7786d5a37
parentc68cacc6bc902217988302f966a47fe184f3eaa1 (diff)
[PATCH] ebtables: don't compute gap before checking struct type
We cannot compute the gap until we know we have a 'struct ebt_entry' and not 'struct ebt_entries'. Failure to check can cause crash. Tested-by: Santiago Garcia Mantinan <manty@manty.net> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r--net/bridge/netfilter/ebtables.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 136ed7d4bd73..473ca3ac6c86 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -575,7 +575,7 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo,
struct ebt_entry_target *t;
struct ebt_target *target;
unsigned int i, j, hook = 0, hookmask = 0;
- size_t gap = e->next_offset - e->target_offset;
+ size_t gap;
int ret;
/* don't mess with the struct ebt_entries */
@@ -625,6 +625,7 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo,
if (ret != 0)
goto cleanup_watchers;
t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
+ gap = e->next_offset - e->target_offset;
target = find_target_lock(t->u.name, &ret, &ebt_mutex);
if (!target)
goto cleanup_watchers;