Skip to content

Commit

Permalink
netfilter: nat: remove rcu_read_lock in __nf_nat_decode_session.
Browse files Browse the repository at this point in the history
__nf_nat_decode_session is called from nf_nat_decode_session as decodefn.
before calling decodefn, it already set rcu_read_lock. so rcu_read_lock in
__nf_nat_decode_session can be removed.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Taehee Yoo authored and Pablo Neira Ayuso committed Apr 13, 2017
1 parent 4f13997 commit 5389023
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/netfilter/nf_nat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ static void __nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl)
if (ct == NULL)
return;

family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
rcu_read_lock();
family = nf_ct_l3num(ct);
l3proto = __nf_nat_l3proto_find(family);
if (l3proto == NULL)
goto out;
return;

dir = CTINFO2DIR(ctinfo);
if (dir == IP_CT_DIR_ORIGINAL)
Expand All @@ -84,8 +83,6 @@ static void __nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl)
statusbit = IPS_SRC_NAT;

l3proto->decode_session(skb, ct, dir, statusbit, fl);
out:
rcu_read_unlock();
}

int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int family)
Expand Down

0 comments on commit 5389023

Please sign in to comment.