Skip to content

Commit

Permalink
netfilter: {ip,ip6,arp}_tables: avoid lockdep false positive
Browse files Browse the repository at this point in the history
After commit 24b36f0 (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: Linus Torvalds <torvalds@linux-foundation.org>
Diagnosed-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Aug 17, 2010
1 parent 5ca6f7c commit 001389b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,15 @@ static void get_counters(const struct xt_table_info *t,
if (cpu == curcpu)
continue;
i = 0;
local_bh_disable();
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
iter->counters.pcnt);
++i;
}
xt_info_wrunlock(cpu);
local_bh_enable();
}
put_cpu();
}
Expand Down
2 changes: 2 additions & 0 deletions net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,15 @@ get_counters(const struct xt_table_info *t,
if (cpu == curcpu)
continue;
i = 0;
local_bh_disable();
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
iter->counters.pcnt);
++i; /* macro does multi eval of i */
}
xt_info_wrunlock(cpu);
local_bh_enable();
}
put_cpu();
}
Expand Down
2 changes: 2 additions & 0 deletions net/ipv6/netfilter/ip6_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,15 @@ get_counters(const struct xt_table_info *t,
if (cpu == curcpu)
continue;
i = 0;
local_bh_disable();
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
iter->counters.pcnt);
++i;
}
xt_info_wrunlock(cpu);
local_bh_enable();
}
put_cpu();
}
Expand Down

0 comments on commit 001389b

Please sign in to comment.