Skip to content

Commit d3a9b8a

Browse files
ummakynesgregkh
authored andcommitted
netfilter: nf_tables: disable preemption in nft_update_chain_stats()
commit ad9d9e8 upstream. 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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 491b1a8 commit d3a9b8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/nf_tables_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ static noinline void nft_update_chain_stats(const struct nft_chain *chain,
126126
if (!base_chain->stats)
127127
return;
128128

129+
local_bh_disable();
129130
stats = this_cpu_ptr(rcu_dereference(base_chain->stats));
130131
if (stats) {
131-
local_bh_disable();
132132
u64_stats_update_begin(&stats->syncp);
133133
stats->pkts++;
134134
stats->bytes += pkt->skb->len;
135135
u64_stats_update_end(&stats->syncp);
136-
local_bh_enable();
137136
}
137+
local_bh_enable();
138138
}
139139

140140
struct nft_jumpstack {

0 commit comments

Comments
 (0)