Commit d96524e4 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPV6]: Fix locking in ip6_dst_lookup().

The caller does not necessarily have the socket locked
(udpv6sendmsg() is one such case) so we have to use
sk_dst_check() instead of __sk_dst_check().
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d70ff6fd
...@@ -745,7 +745,7 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) ...@@ -745,7 +745,7 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
if (sk) { if (sk) {
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
*dst = __sk_dst_check(sk, np->dst_cookie); *dst = sk_dst_check(sk, np->dst_cookie);
if (*dst) { if (*dst) {
struct rt6_info *rt = (struct rt6_info*)*dst; struct rt6_info *rt = (struct rt6_info*)*dst;
...@@ -772,9 +772,9 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) ...@@ -772,9 +772,9 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
&& (np->daddr_cache == NULL || && (np->daddr_cache == NULL ||
!ipv6_addr_equal(&fl->fl6_dst, np->daddr_cache))) !ipv6_addr_equal(&fl->fl6_dst, np->daddr_cache)))
|| (fl->oif && fl->oif != (*dst)->dev->ifindex)) { || (fl->oif && fl->oif != (*dst)->dev->ifindex)) {
dst_release(*dst);
*dst = NULL; *dst = NULL;
} else }
dst_hold(*dst);
} }
} }
......
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