diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-27 15:08:13 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-28 18:10:03 -0400 |
commit | ad9d9e85072b668731f356be0a3750a3ba22a607 (patch) | |
tree | 4d3dbdeed7b1c48921ee55e839bba57973ea69fc | |
parent | 4b83a9049a983b20b1ec2757727c5e39f5847ad2 (diff) |
netfilter: nf_tables: disable preemption in nft_update_chain_stats()
This patch fixes the following splat.
[118709.054937] BUG: using smp_processor_id() in preemptible [00000000] code: test/1571
[118709.054970] caller is nft_update_chain_stats.isra.4+0x53/0x97 [nf_tables]
[118709.054980] CPU: 2 PID: 1571 Comm: test Not tainted 4.17.0-rc6+ #335
[...]
[118709.054992] Call Trace:
[118709.055011] dump_stack+0x5f/0x86
[118709.055026] check_preemption_disabled+0xd4/0xe4
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | net/netfilter/nf_tables_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index 942702a2776f..40e744572283 100644 --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c | |||
@@ -126,15 +126,15 @@ static noinline void nft_update_chain_stats(const struct nft_chain *chain, | |||
126 | if (!base_chain->stats) | 126 | if (!base_chain->stats) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | local_bh_disable(); | ||
129 | stats = this_cpu_ptr(rcu_dereference(base_chain->stats)); | 130 | stats = this_cpu_ptr(rcu_dereference(base_chain->stats)); |
130 | if (stats) { | 131 | if (stats) { |
131 | local_bh_disable(); | ||
132 | u64_stats_update_begin(&stats->syncp); | 132 | u64_stats_update_begin(&stats->syncp); |
133 | stats->pkts++; | 133 | stats->pkts++; |
134 | stats->bytes += pkt->skb->len; | 134 | stats->bytes += pkt->skb->len; |
135 | u64_stats_update_end(&stats->syncp); | 135 | u64_stats_update_end(&stats->syncp); |
136 | local_bh_enable(); | ||
137 | } | 136 | } |
137 | local_bh_enable(); | ||
138 | } | 138 | } |
139 | 139 | ||
140 | struct nft_jumpstack { | 140 | struct nft_jumpstack { |