Commit cca32e4b authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: TCP early demux cleanup

early_demux() handlers should be called in RCU context, and as we
use skb_dst_set_noref(skb, dst), caller must not exit from RCU context
before dst use (skb_dst(skb)) or release (skb_drop(dst))

Therefore, rcu_read_lock()/rcu_read_unlock() pairs around
->early_demux() are confusing and not needed :

Protocol handlers are already in an RCU read lock section.
(__netif_receive_skb() does the rcu_read_lock() )
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8bbb1813
...@@ -325,14 +325,12 @@ static int ip_rcv_finish(struct sk_buff *skb) ...@@ -325,14 +325,12 @@ static int ip_rcv_finish(struct sk_buff *skb)
const struct net_protocol *ipprot; const struct net_protocol *ipprot;
int protocol = iph->protocol; int protocol = iph->protocol;
rcu_read_lock();
ipprot = rcu_dereference(inet_protos[protocol]); ipprot = rcu_dereference(inet_protos[protocol]);
if (ipprot && ipprot->early_demux) { if (ipprot && ipprot->early_demux) {
ipprot->early_demux(skb); ipprot->early_demux(skb);
/* must reload iph, skb->head might have changed */ /* must reload iph, skb->head might have changed */
iph = ip_hdr(skb); iph = ip_hdr(skb);
} }
rcu_read_unlock();
} }
/* /*
......
...@@ -52,11 +52,9 @@ int ip6_rcv_finish(struct sk_buff *skb) ...@@ -52,11 +52,9 @@ int ip6_rcv_finish(struct sk_buff *skb)
if (sysctl_ip_early_demux && !skb_dst(skb)) { if (sysctl_ip_early_demux && !skb_dst(skb)) {
const struct inet6_protocol *ipprot; const struct inet6_protocol *ipprot;
rcu_read_lock();
ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]); ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);
if (ipprot && ipprot->early_demux) if (ipprot && ipprot->early_demux)
ipprot->early_demux(skb); ipprot->early_demux(skb);
rcu_read_unlock();
} }
if (!skb_dst(skb)) if (!skb_dst(skb))
ip6_route_input(skb); ip6_route_input(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment