提交 124dffea 编写于 作者: L Liping Zhang 提交者: Pablo Neira Ayuso

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: NFlorian Westphal <fw@strlen.de>
Signed-off-by: NLiping Zhang <zlpnobody@gmail.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 d2df92e9
...@@ -566,7 +566,7 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data) ...@@ -566,7 +566,7 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
* Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
* will delete entry from already-freed table. * will delete entry from already-freed table.
*/ */
ct->status &= ~IPS_NAT_DONE_MASK; clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource, rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
nf_nat_bysource_params); nf_nat_bysource_params);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册