Commit 1bc2326c authored by Al Viro's avatar Al Viro Committed by David S. Miller

[EBTABLES]: Move calls of ebt_verify_pointers() upstream.

... and pass just repl->name to translate_table()
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7da79d9
...@@ -774,17 +774,12 @@ static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s ...@@ -774,17 +774,12 @@ static int check_chainloops(struct ebt_entries *chain, struct ebt_cl_stack *cl_s
} }
/* do the parsing of the table/chains/entries/matches/watchers/targets, heh */ /* do the parsing of the table/chains/entries/matches/watchers/targets, heh */
static int translate_table(struct ebt_replace *repl, static int translate_table(char *name, struct ebt_table_info *newinfo)
struct ebt_table_info *newinfo)
{ {
unsigned int i, j, k, udc_cnt; unsigned int i, j, k, udc_cnt;
int ret; int ret;
struct ebt_cl_stack *cl_s = NULL; /* used in the checking for chain loops */ 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; i = 0;
while (i < NF_BR_NUMHOOKS && !newinfo->hook_entry[i]) while (i < NF_BR_NUMHOOKS && !newinfo->hook_entry[i])
i++; i++;
...@@ -889,7 +884,7 @@ static int translate_table(struct ebt_replace *repl, ...@@ -889,7 +884,7 @@ static int translate_table(struct ebt_replace *repl,
/* used to know what we need to clean up if something goes wrong */ /* used to know what we need to clean up if something goes wrong */
i = 0; i = 0;
ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
ebt_check_entry, newinfo, repl->name, &i, cl_s, udc_cnt); ebt_check_entry, newinfo, name, &i, cl_s, udc_cnt);
if (ret != 0) { if (ret != 0) {
EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
ebt_cleanup_entry, &i); ebt_cleanup_entry, &i);
...@@ -986,7 +981,11 @@ static int do_replace(void __user *user, unsigned int len) ...@@ -986,7 +981,11 @@ static int do_replace(void __user *user, unsigned int len)
/* this can get initialized by translate_table() */ /* this can get initialized by translate_table() */
newinfo->chainstack = NULL; newinfo->chainstack = NULL;
ret = translate_table(&tmp, newinfo); ret = ebt_verify_pointers(&tmp, newinfo);
if (ret != 0)
goto free_counterstmp;
ret = translate_table(tmp.name, newinfo);
if (ret != 0) if (ret != 0)
goto free_counterstmp; goto free_counterstmp;
...@@ -1185,7 +1184,10 @@ int ebt_register_table(struct ebt_table *table) ...@@ -1185,7 +1184,10 @@ int ebt_register_table(struct ebt_table *table)
/* fill in newinfo and parse the entries */ /* fill in newinfo and parse the entries */
newinfo->chainstack = NULL; newinfo->chainstack = NULL;
ret = translate_table(table->table, newinfo); ret = ebt_verify_pointers(table->table, newinfo);
if (ret != 0)
goto free_chainstack;
ret = translate_table(table->table->name, newinfo);
if (ret != 0) { if (ret != 0) {
BUGPRINT("Translate_table failed\n"); BUGPRINT("Translate_table failed\n");
goto free_chainstack; goto free_chainstack;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment