提交 91536b7a 编写于 作者: D Dmitry Mishin 提交者: David S. Miller

[NETFILTER]: x_tables: move table->lock initialization

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: NDmitry Mishin <dim@openvz.org>
Signed-off-by: NKirill Korotaev <dev@openvz.org>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e4a79ef8
...@@ -529,6 +529,7 @@ int xt_register_table(struct xt_table *table, ...@@ -529,6 +529,7 @@ int xt_register_table(struct xt_table *table,
/* Simplifies replace_table code. */ /* Simplifies replace_table code. */
table->private = bootstrap; table->private = bootstrap;
rwlock_init(&table->lock);
if (!xt_replace_table(table, 0, newinfo, &ret)) if (!xt_replace_table(table, 0, newinfo, &ret))
goto unlock; goto unlock;
...@@ -538,7 +539,6 @@ int xt_register_table(struct xt_table *table, ...@@ -538,7 +539,6 @@ int xt_register_table(struct xt_table *table,
/* save number of initial entries */ /* save number of initial entries */
private->initial_entries = private->number; private->initial_entries = private->number;
rwlock_init(&table->lock);
list_prepend(&xt[table->af].tables, table); list_prepend(&xt[table->af].tables, table);
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册