]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nat: use atomic bit op to clear the _SRC_NAT_DONE_BIT
authorLiping Zhang <zlpnobody@gmail.com>
Sun, 21 May 2017 14:38:11 +0000 (22:38 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 23 May 2017 20:54:51 +0000 (22:54 +0200)
commit93ec0803152a7d6e76b5b7aada95e0769b7066b6
treeeb35feb6b0c04851d32095b9aa082c0f898c9210
parent56f18f1733f131dd157a71b4eb8b27a0513f0578
netfilter: nat: use atomic bit op to clear the _SRC_NAT_DONE_BIT

We need to clear the IPS_SRC_NAT_DONE_BIT to indicate that the ct has
been removed from nat_bysource table. But unfortunately, we use the
non-atomic bit operation: "ct->status &= ~IPS_NAT_DONE_MASK". So
there's a race condition that we may clear the _DYING_BIT set by
another CPU unexpectedly.

Since we don't care about the IPS_DST_NAT_DONE_BIT, so just using
clear_bit to clear the IPS_SRC_NAT_DONE_BIT is enough.

Also note, this is the last user which use the non-atomic bit operation
to update the confirmed ct->status.

Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_core.c