[NETFILTER]: x_tables: move table->lock initialization
authorDmitry Mishin <dim@openvz.org>
Tue, 25 Apr 2006 00:18:25 +0000 (17:18 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 25 Apr 2006 00:27:33 +0000 (17:27 -0700)
xt_table->lock should be initialized before xt_replace_table() call, which
uses it. This patch removes strict requirement that table should define
lock before registering.

Signed-off-by: Dmitry Mishin <dim@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/x_tables.c

index 00cf0a4f4d92ab3a54ca6b503a83d7312efd74cb..17abf60f957003f3e9f3df5904f6255c8995e93b 100644 (file)
@@ -529,6 +529,7 @@ int xt_register_table(struct xt_table *table,
 
        /* Simplifies replace_table code. */
        table->private = bootstrap;
+       rwlock_init(&table->lock);
        if (!xt_replace_table(table, 0, newinfo, &ret))
                goto unlock;
 
@@ -538,7 +539,6 @@ int xt_register_table(struct xt_table *table,
        /* save number of initial entries */
        private->initial_entries = private->number;
 
-       rwlock_init(&table->lock);
        list_prepend(&xt[table->af].tables, table);
 
        ret = 0;