Commit da298d3a authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: x_tables: fix xt_register_table error propagation

When xt_register_table fails the error is not properly propagated back.
Based on patch by Lepton Wu <ytht.net@gmail.com>.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bf7e8511
...@@ -1120,7 +1120,8 @@ int arpt_register_table(struct arpt_table *table, ...@@ -1120,7 +1120,8 @@ int arpt_register_table(struct arpt_table *table,
return ret; return ret;
} }
if (xt_register_table(table, &bootstrap, newinfo) != 0) { ret = xt_register_table(table, &bootstrap, newinfo);
if (ret != 0) {
xt_free_table_info(newinfo); xt_free_table_info(newinfo);
return ret; return ret;
} }
......
...@@ -2113,7 +2113,8 @@ int ipt_register_table(struct xt_table *table, const struct ipt_replace *repl) ...@@ -2113,7 +2113,8 @@ int ipt_register_table(struct xt_table *table, const struct ipt_replace *repl)
return ret; return ret;
} }
if (xt_register_table(table, &bootstrap, newinfo) != 0) { ret = xt_register_table(table, &bootstrap, newinfo);
if (ret != 0) {
xt_free_table_info(newinfo); xt_free_table_info(newinfo);
return ret; return ret;
} }
......
...@@ -1281,7 +1281,8 @@ int ip6t_register_table(struct xt_table *table, ...@@ -1281,7 +1281,8 @@ int ip6t_register_table(struct xt_table *table,
return ret; return ret;
} }
if (xt_register_table(table, &bootstrap, newinfo) != 0) { ret = xt_register_table(table, &bootstrap, newinfo);
if (ret != 0) {
xt_free_table_info(newinfo); xt_free_table_info(newinfo);
return ret; return ret;
} }
......
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