diff options
author | Patrick McHardy <kaber@trash.net> | 2013-07-28 22:54:09 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-31 19:54:24 +0200 |
commit | 0658cdc8f3babb4a441f5a803a0b644fafcbf9ef (patch) | |
tree | 0f1b27ef787814b8f9124c72ecd658876de1580e /net/netfilter/nf_nat_helper.c | |
parent | 02982c27ba1e1bd9f9d4747214e19ca83aa88d0e (diff) | |
download | op-kernel-dev-0658cdc8f3babb4a441f5a803a0b644fafcbf9ef.zip op-kernel-dev-0658cdc8f3babb4a441f5a803a0b644fafcbf9ef.tar.gz |
netfilter: nf_nat: fix locking in nf_nat_seq_adjust()
nf_nat_seq_adjust() needs to grab nf_nat_seqofs_lock to protect against
concurrent changes to the sequence adjustment data.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_nat_helper.c')
-rw-r--r-- | net/netfilter/nf_nat_helper.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/netfilter/nf_nat_helper.c b/net/netfilter/nf_nat_helper.c index 85e20a9..a7262ed 100644 --- a/net/netfilter/nf_nat_helper.c +++ b/net/netfilter/nf_nat_helper.c @@ -373,6 +373,7 @@ nf_nat_seq_adjust(struct sk_buff *skb, s16 seqoff, ackoff; struct nf_conn_nat *nat = nfct_nat(ct); struct nf_nat_seq *this_way, *other_way; + int res; dir = CTINFO2DIR(ctinfo); @@ -383,6 +384,7 @@ nf_nat_seq_adjust(struct sk_buff *skb, return 0; tcph = (void *)skb->data + protoff; + spin_lock_bh(&nf_nat_seqofs_lock); if (after(ntohl(tcph->seq), this_way->correction_pos)) seqoff = this_way->offset_after; else @@ -407,7 +409,10 @@ nf_nat_seq_adjust(struct sk_buff *skb, tcph->seq = newseq; tcph->ack_seq = newack; - return nf_nat_sack_adjust(skb, protoff, tcph, ct, ctinfo); + res = nf_nat_sack_adjust(skb, protoff, tcph, ct, ctinfo); + spin_unlock_bh(&nf_nat_seqofs_lock); + + return res; } /* Setup NAT on this expected conntrack so it follows master. */ |