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

net: annotate lockless accesses to sk->sk_err_soft

This field can be read/written without lock synchronization.

tcp and dccp have been handled in different patches.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a25f0cb
...@@ -601,7 +601,7 @@ static void lowcomms_error_report(struct sock *sk) ...@@ -601,7 +601,7 @@ static void lowcomms_error_report(struct sock *sk)
"sk_err=%d/%d\n", dlm_our_nodeid(), "sk_err=%d/%d\n", dlm_our_nodeid(),
con->nodeid, &inet->inet_daddr, con->nodeid, &inet->inet_daddr,
ntohs(inet->inet_dport), sk->sk_err, ntohs(inet->inet_dport), sk->sk_err,
sk->sk_err_soft); READ_ONCE(sk->sk_err_soft));
break; break;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
case AF_INET6: case AF_INET6:
...@@ -610,14 +610,15 @@ static void lowcomms_error_report(struct sock *sk) ...@@ -610,14 +610,15 @@ static void lowcomms_error_report(struct sock *sk)
"dport %d, sk_err=%d/%d\n", dlm_our_nodeid(), "dport %d, sk_err=%d/%d\n", dlm_our_nodeid(),
con->nodeid, &sk->sk_v6_daddr, con->nodeid, &sk->sk_v6_daddr,
ntohs(inet->inet_dport), sk->sk_err, ntohs(inet->inet_dport), sk->sk_err,
sk->sk_err_soft); READ_ONCE(sk->sk_err_soft));
break; break;
#endif #endif
default: default:
printk_ratelimited(KERN_ERR "dlm: node %d: socket error " printk_ratelimited(KERN_ERR "dlm: node %d: socket error "
"invalid socket family %d set, " "invalid socket family %d set, "
"sk_err=%d/%d\n", dlm_our_nodeid(), "sk_err=%d/%d\n", dlm_our_nodeid(),
sk->sk_family, sk->sk_err, sk->sk_err_soft); sk->sk_family, sk->sk_err,
READ_ONCE(sk->sk_err_soft));
break; break;
} }
......
...@@ -125,7 +125,7 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -125,7 +125,7 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb)
break; break;
case as_addparty: case as_addparty:
case as_dropparty: case as_dropparty:
sk->sk_err_soft = -msg->reply; WRITE_ONCE(sk->sk_err_soft, -msg->reply);
/* < 0 failure, otherwise ep_ref */ /* < 0 failure, otherwise ep_ref */
clear_bit(ATM_VF_WAITING, &vcc->flags); clear_bit(ATM_VF_WAITING, &vcc->flags);
break; break;
......
...@@ -1322,7 +1322,7 @@ int inet_sk_rebuild_header(struct sock *sk) ...@@ -1322,7 +1322,7 @@ int inet_sk_rebuild_header(struct sock *sk)
sk->sk_state != TCP_SYN_SENT || sk->sk_state != TCP_SYN_SENT ||
(sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) ||
(err = inet_sk_reselect_saddr(sk)) != 0) (err = inet_sk_reselect_saddr(sk)) != 0)
sk->sk_err_soft = -err; WRITE_ONCE(sk->sk_err_soft, -err);
} }
return err; return err;
......
...@@ -845,7 +845,7 @@ int inet6_sk_rebuild_header(struct sock *sk) ...@@ -845,7 +845,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
if (IS_ERR(dst)) { if (IS_ERR(dst)) {
sk->sk_route_caps = 0; sk->sk_route_caps = 0;
sk->sk_err_soft = -PTR_ERR(dst); WRITE_ONCE(sk->sk_err_soft, -PTR_ERR(dst));
return PTR_ERR(dst); return PTR_ERR(dst);
} }
......
...@@ -120,7 +120,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused ...@@ -120,7 +120,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused
dst = inet6_csk_route_socket(sk, &fl6); dst = inet6_csk_route_socket(sk, &fl6);
if (IS_ERR(dst)) { if (IS_ERR(dst)) {
sk->sk_err_soft = -PTR_ERR(dst); WRITE_ONCE(sk->sk_err_soft, -PTR_ERR(dst));
sk->sk_route_caps = 0; sk->sk_route_caps = 0;
kfree_skb(skb); kfree_skb(skb);
return PTR_ERR(dst); return PTR_ERR(dst);
......
...@@ -585,7 +585,7 @@ static void sctp_v4_err_handle(struct sctp_transport *t, struct sk_buff *skb, ...@@ -585,7 +585,7 @@ static void sctp_v4_err_handle(struct sctp_transport *t, struct sk_buff *skb,
sk->sk_err = err; sk->sk_err = err;
sk_error_report(sk); sk_error_report(sk);
} else { /* Only an error on timeout */ } else { /* Only an error on timeout */
sk->sk_err_soft = err; WRITE_ONCE(sk->sk_err_soft, err);
} }
} }
......
...@@ -155,7 +155,7 @@ static void sctp_v6_err_handle(struct sctp_transport *t, struct sk_buff *skb, ...@@ -155,7 +155,7 @@ static void sctp_v6_err_handle(struct sctp_transport *t, struct sk_buff *skb,
sk->sk_err = err; sk->sk_err = err;
sk_error_report(sk); sk_error_report(sk);
} else { } else {
sk->sk_err_soft = err; WRITE_ONCE(sk->sk_err_soft, err);
} }
} }
......
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