Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41966
b: refs/heads/master
c: e4fd77d
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and David S. Miller committed Dec 3, 2006
1 parent c48287b commit 8c1b348
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70fe9af47ee01a17fe7486f1739f6eac8a14868b
refs/heads/master: e4fd77deac764e17cb1eab8661bcf1413204d04d
38 changes: 19 additions & 19 deletions trunk/net/bridge/netfilter/ebtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ static int ebt_verify_pointers(struct ebt_replace *repl,
unsigned int offset = 0;
int i;

for (i = 0; i < NF_BR_NUMHOOKS; i++)
newinfo->hook_entry[i] = NULL;

newinfo->entries_size = repl->entries_size;
newinfo->nentries = repl->nentries;

while (offset < limit) {
size_t left = limit - offset;
struct ebt_entry *e = (void *)newinfo->entries + offset;
Expand Down Expand Up @@ -440,6 +446,15 @@ static int ebt_verify_pointers(struct ebt_replace *repl,
BUGPRINT("entries_size too small\n");
return -EINVAL;
}

/* check if all valid hooks have a chain */
for (i = 0; i < NF_BR_NUMHOOKS; i++) {
if (!newinfo->hook_entry[i] &&
(valid_hooks & (1 << i))) {
BUGPRINT("Valid hook without chain\n");
return -EINVAL;
}
}
return 0;
}

Expand Down Expand Up @@ -772,6 +787,10 @@ static int translate_table(struct ebt_replace *repl,
int ret;
struct ebt_cl_stack *cl_s = NULL; /* used in the checking for chain loops */

ret = ebt_verify_pointers(repl, newinfo);
if (ret != 0)
return ret;

i = 0;
while (i < NF_BR_NUMHOOKS && !(repl->valid_hooks & (1 << i)))
i++;
Expand All @@ -795,16 +814,6 @@ static int translate_table(struct ebt_replace *repl,
i = j;
}

for (i = 0; i < NF_BR_NUMHOOKS; i++)
newinfo->hook_entry[i] = NULL;

newinfo->entries_size = repl->entries_size;
newinfo->nentries = repl->nentries;

ret = ebt_verify_pointers(repl, newinfo);
if (ret != 0)
return ret;

/* do some early checkings and initialize some things */
i = 0; /* holds the expected nr. of entries for the chain */
j = 0; /* holds the up to now counted entries for the chain */
Expand All @@ -829,15 +838,6 @@ static int translate_table(struct ebt_replace *repl,
return -EINVAL;
}

/* check if all valid hooks have a chain */
for (i = 0; i < NF_BR_NUMHOOKS; i++) {
if (newinfo->hook_entry[i] == NULL &&
(repl->valid_hooks & (1 << i))) {
BUGPRINT("Valid hook without chain\n");
return -EINVAL;
}
}

/* get the location of the udc, put them in an array
while we're at it, allocate the chainstack */
if (udc_cnt) {
Expand Down

0 comments on commit 8c1b348

Please sign in to comment.