[PATCH] 2.6.16.19 Fix the bug of "return 0 instead of the error code in ipt_register_table"

From: lepton
Date: Thu Jun 01 2006 - 06:24:20 EST


Hi,

There is a bug in ipt_register_table() in
net/ipv4/netfilter/ip_tables.c:

ipt_register_table() will return 0 instead of
the error code when xt_register_table() fails

Signed-off-by: Lepton Wu <ytht.net@xxxxxxxxx>

diff -prU 10 linux-2.6.16.19.oirg/net/ipv4/netfilter/ip_tables.c linux-2.6.16.19/net/ipv4/netfilter/ip_tables.c
--- linux-2.6.16.19.oirg/net/ipv4/netfilter/ip_tables.c 2006-05-31 08:31:44.000000000 +0800
+++ linux-2.6.16.19/net/ipv4/netfilter/ip_tables.c 2006-06-01 18:11:25.000000000 +0800
@@ -1235,21 +1235,22 @@ int ipt_register_table(struct xt_table *
ret = translate_table(table->name, table->valid_hooks,
newinfo, loc_cpu_entry, repl->size,
repl->num_entries,
repl->hook_entry,
repl->underflow);
if (ret != 0) {
xt_free_table_info(newinfo);
return ret;
}

- if (xt_register_table(table, &bootstrap, newinfo) != 0) {
+ ret = xt_register_table(table, &bootstrap, newinfo);
+ if (ret) {
xt_free_table_info(newinfo);
return ret;
}

return 0;
}

void ipt_unregister_table(struct ipt_table *table)
{
struct xt_table_info *private;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/