aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2013-01-22 16:09:50 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-28 00:15:27 -0500
commitcec771d646d6c9a6f123b50e132ab142342dcb97 (patch)
treed0591d47af01fb210a16635ff316e77161c5ec3a /net/decnet
parent78fb2de711ec28997bf38bcf3e48e108e907be77 (diff)
decnet: use correct RCU API to deref sk_dst_cache field
sock->sk_dst_cache is protected by RCU, therefore we should use __sk_dst_get() to deref it once we lock the sock. This fixes several sparse warnings. Cc: linux-decnet-user@lists.sourceforge.net Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet')
-rw-r--r--net/decnet/af_decnet.c6
-rw-r--r--net/decnet/dn_nsp_out.c2
-rw-r--r--net/decnet/dn_route.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 307c322d53bb..64d9843f9e04 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -909,6 +909,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
909 struct dn_scp *scp = DN_SK(sk); 909 struct dn_scp *scp = DN_SK(sk);
910 int err = -EISCONN; 910 int err = -EISCONN;
911 struct flowidn fld; 911 struct flowidn fld;
912 struct dst_entry *dst;
912 913
913 if (sock->state == SS_CONNECTED) 914 if (sock->state == SS_CONNECTED)
914 goto out; 915 goto out;
@@ -955,10 +956,11 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
955 fld.flowidn_proto = DNPROTO_NSP; 956 fld.flowidn_proto = DNPROTO_NSP;
956 if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0) 957 if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0)
957 goto out; 958 goto out;
958 sk->sk_route_caps = sk->sk_dst_cache->dev->features; 959 dst = __sk_dst_get(sk);
960 sk->sk_route_caps = dst->dev->features;
959 sock->state = SS_CONNECTING; 961 sock->state = SS_CONNECTING;
960 scp->state = DN_CI; 962 scp->state = DN_CI;
961 scp->segsize_loc = dst_metric_advmss(sk->sk_dst_cache); 963 scp->segsize_loc = dst_metric_advmss(dst);
962 964
963 dn_nsp_send_conninit(sk, NSP_CI); 965 dn_nsp_send_conninit(sk, NSP_CI);
964 err = -EINPROGRESS; 966 err = -EINPROGRESS;
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 8a96047c7c94..1aaa51ebbda6 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -598,7 +598,7 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
598 if (reason == 0) 598 if (reason == 0)
599 reason = le16_to_cpu(scp->discdata_out.opt_status); 599 reason = le16_to_cpu(scp->discdata_out.opt_status);
600 600
601 dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, 601 dn_nsp_do_disc(sk, msgflg, reason, gfp, __sk_dst_get(sk), ddl,
602 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); 602 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc);
603} 603}
604 604
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index b57419cc41a4..1550028fcd8e 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1282,7 +1282,7 @@ static int dn_route_output_key(struct dst_entry **pprt, struct flowidn *flp, int
1282 return err; 1282 return err;
1283} 1283}
1284 1284
1285int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *fl, struct sock *sk, int flags) 1285int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *fl, struct sock *sk, int flags)
1286{ 1286{
1287 int err; 1287 int err;
1288 1288