提交 001389b9 编写于 作者: E Eric Dumazet 提交者: David S. Miller

netfilter: {ip,ip6,arp}_tables: avoid lockdep false positive

After commit 24b36f01 (netfilter: {ip,ip6,arp}_tables: dont block
bottom half more than necessary), lockdep can raise a warning
because we attempt to lock a spinlock with BH enabled, while
the same lock is usually locked by another cpu in a softirq context.

Disable again BH to avoid these lockdep warnings.
Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
Diagnosed-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5ca6f7c8
...@@ -735,6 +735,7 @@ static void get_counters(const struct xt_table_info *t, ...@@ -735,6 +735,7 @@ static void get_counters(const struct xt_table_info *t,
if (cpu == curcpu) if (cpu == curcpu)
continue; continue;
i = 0; i = 0;
local_bh_disable();
xt_info_wrlock(cpu); xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) { xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt, ADD_COUNTER(counters[i], iter->counters.bcnt,
...@@ -742,6 +743,7 @@ static void get_counters(const struct xt_table_info *t, ...@@ -742,6 +743,7 @@ static void get_counters(const struct xt_table_info *t,
++i; ++i;
} }
xt_info_wrunlock(cpu); xt_info_wrunlock(cpu);
local_bh_enable();
} }
put_cpu(); put_cpu();
} }
......
...@@ -909,6 +909,7 @@ get_counters(const struct xt_table_info *t, ...@@ -909,6 +909,7 @@ get_counters(const struct xt_table_info *t,
if (cpu == curcpu) if (cpu == curcpu)
continue; continue;
i = 0; i = 0;
local_bh_disable();
xt_info_wrlock(cpu); xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) { xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt, ADD_COUNTER(counters[i], iter->counters.bcnt,
...@@ -916,6 +917,7 @@ get_counters(const struct xt_table_info *t, ...@@ -916,6 +917,7 @@ get_counters(const struct xt_table_info *t,
++i; /* macro does multi eval of i */ ++i; /* macro does multi eval of i */
} }
xt_info_wrunlock(cpu); xt_info_wrunlock(cpu);
local_bh_enable();
} }
put_cpu(); put_cpu();
} }
......
...@@ -922,6 +922,7 @@ get_counters(const struct xt_table_info *t, ...@@ -922,6 +922,7 @@ get_counters(const struct xt_table_info *t,
if (cpu == curcpu) if (cpu == curcpu)
continue; continue;
i = 0; i = 0;
local_bh_disable();
xt_info_wrlock(cpu); xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) { xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt, ADD_COUNTER(counters[i], iter->counters.bcnt,
...@@ -929,6 +930,7 @@ get_counters(const struct xt_table_info *t, ...@@ -929,6 +930,7 @@ get_counters(const struct xt_table_info *t,
++i; ++i;
} }
xt_info_wrunlock(cpu); xt_info_wrunlock(cpu);
local_bh_enable();
} }
put_cpu(); put_cpu();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册