xfrm: remove extranous rcu_read_lock
The handlers for xfrm_tunnel are always invoked with rcu read lock already. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
0c5794a66c
Коммит
b0558ef24a
|
@ -304,7 +304,6 @@ static int vti_err(struct sk_buff *skb, u32 info)
|
||||||
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
t = vti_tunnel_lookup(dev_net(skb->dev), iph->daddr, iph->saddr);
|
t = vti_tunnel_lookup(dev_net(skb->dev), iph->daddr, iph->saddr);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -326,7 +325,6 @@ static int vti_err(struct sk_buff *skb, u32 info)
|
||||||
t->err_count = 1;
|
t->err_count = 1;
|
||||||
t->err_time = jiffies;
|
t->err_time = jiffies;
|
||||||
out:
|
out:
|
||||||
rcu_read_unlock();
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +334,6 @@ static int vti_rcv(struct sk_buff *skb)
|
||||||
struct ip_tunnel *tunnel;
|
struct ip_tunnel *tunnel;
|
||||||
const struct iphdr *iph = ip_hdr(skb);
|
const struct iphdr *iph = ip_hdr(skb);
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
tunnel = vti_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr);
|
tunnel = vti_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr);
|
||||||
if (tunnel != NULL) {
|
if (tunnel != NULL) {
|
||||||
struct pcpu_tstats *tstats;
|
struct pcpu_tstats *tstats;
|
||||||
|
@ -348,10 +345,8 @@ static int vti_rcv(struct sk_buff *skb)
|
||||||
u64_stats_update_end(&tstats->syncp);
|
u64_stats_update_end(&tstats->syncp);
|
||||||
|
|
||||||
skb->dev = tunnel->dev;
|
skb->dev = tunnel->dev;
|
||||||
rcu_read_unlock();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,8 +365,6 @@ static int ipip_err(struct sk_buff *skb, u32 info)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
t = ipip_tunnel_lookup(dev_net(skb->dev), iph->daddr, iph->saddr);
|
t = ipip_tunnel_lookup(dev_net(skb->dev), iph->daddr, iph->saddr);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -398,7 +396,7 @@ static int ipip_err(struct sk_buff *skb, u32 info)
|
||||||
t->err_count = 1;
|
t->err_count = 1;
|
||||||
t->err_time = jiffies;
|
t->err_time = jiffies;
|
||||||
out:
|
out:
|
||||||
rcu_read_unlock();
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,13 +414,11 @@ static int ipip_rcv(struct sk_buff *skb)
|
||||||
struct ip_tunnel *tunnel;
|
struct ip_tunnel *tunnel;
|
||||||
const struct iphdr *iph = ip_hdr(skb);
|
const struct iphdr *iph = ip_hdr(skb);
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
tunnel = ipip_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr);
|
tunnel = ipip_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr);
|
||||||
if (tunnel != NULL) {
|
if (tunnel != NULL) {
|
||||||
struct pcpu_tstats *tstats;
|
struct pcpu_tstats *tstats;
|
||||||
|
|
||||||
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
|
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
|
||||||
rcu_read_unlock();
|
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -445,11 +441,8 @@ static int ipip_rcv(struct sk_buff *skb)
|
||||||
ipip_ecn_decapsulate(iph, skb);
|
ipip_ecn_decapsulate(iph, skb);
|
||||||
|
|
||||||
netif_rx(skb);
|
netif_rx(skb);
|
||||||
|
|
||||||
rcu_read_unlock();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,7 +545,6 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
|
||||||
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
t = ipip6_tunnel_lookup(dev_net(skb->dev),
|
t = ipip6_tunnel_lookup(dev_net(skb->dev),
|
||||||
skb->dev,
|
skb->dev,
|
||||||
iph->daddr,
|
iph->daddr,
|
||||||
|
@ -579,7 +578,6 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
|
||||||
t->err_count = 1;
|
t->err_count = 1;
|
||||||
t->err_time = jiffies;
|
t->err_time = jiffies;
|
||||||
out:
|
out:
|
||||||
rcu_read_unlock();
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +597,6 @@ static int ipip6_rcv(struct sk_buff *skb)
|
||||||
|
|
||||||
iph = ip_hdr(skb);
|
iph = ip_hdr(skb);
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
|
tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
|
||||||
iph->saddr, iph->daddr);
|
iph->saddr, iph->daddr);
|
||||||
if (tunnel != NULL) {
|
if (tunnel != NULL) {
|
||||||
|
@ -615,7 +612,6 @@ static int ipip6_rcv(struct sk_buff *skb)
|
||||||
if ((tunnel->dev->priv_flags & IFF_ISATAP) &&
|
if ((tunnel->dev->priv_flags & IFF_ISATAP) &&
|
||||||
!isatap_chksrc(skb, iph, tunnel)) {
|
!isatap_chksrc(skb, iph, tunnel)) {
|
||||||
tunnel->dev->stats.rx_errors++;
|
tunnel->dev->stats.rx_errors++;
|
||||||
rcu_read_unlock();
|
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -630,12 +626,10 @@ static int ipip6_rcv(struct sk_buff *skb)
|
||||||
|
|
||||||
netif_rx(skb);
|
netif_rx(skb);
|
||||||
|
|
||||||
rcu_read_unlock();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no tunnel matched, let upstream know, ipsec may handle it */
|
/* no tunnel matched, let upstream know, ipsec may handle it */
|
||||||
rcu_read_unlock();
|
|
||||||
return 1;
|
return 1;
|
||||||
out:
|
out:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче