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

ipv6: use RCU in inet6_csk_xmit()

Use RCU to avoid changing dst_entry refcount in fast path.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cfdf7647
...@@ -211,6 +211,7 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused) ...@@ -211,6 +211,7 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused)
struct flowi6 fl6; struct flowi6 fl6;
struct dst_entry *dst; struct dst_entry *dst;
struct in6_addr *final_p, final; struct in6_addr *final_p, final;
int res;
memset(&fl6, 0, sizeof(fl6)); memset(&fl6, 0, sizeof(fl6));
fl6.flowi6_proto = sk->sk_protocol; fl6.flowi6_proto = sk->sk_protocol;
...@@ -241,12 +242,14 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused) ...@@ -241,12 +242,14 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused)
__inet6_csk_dst_store(sk, dst, NULL, NULL); __inet6_csk_dst_store(sk, dst, NULL, NULL);
} }
skb_dst_set(skb, dst_clone(dst)); rcu_read_lock();
skb_dst_set_noref(skb, dst);
/* Restore final destination back after routing done */ /* Restore final destination back after routing done */
ipv6_addr_copy(&fl6.daddr, &np->daddr); ipv6_addr_copy(&fl6.daddr, &np->daddr);
return ip6_xmit(sk, skb, &fl6, np->opt); res = ip6_xmit(sk, skb, &fl6, np->opt);
rcu_read_unlock();
return res;
} }
EXPORT_SYMBOL_GPL(inet6_csk_xmit); EXPORT_SYMBOL_GPL(inet6_csk_xmit);
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