Commit 10bbf165 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: implement lockless SO_PRIORITY



This is a followup of 8bf43be7 ("net: annotate data-races
around sk->sk_priority").

sk->sk_priority can be read and written without holding the socket lock.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarWenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06bc3668
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,

	skb->dev = dev;

	skb->priority = sk->sk_priority;
	skb->priority = READ_ONCE(sk->sk_priority);
	skb->protocol = cpu_to_be16(ETH_P_PPP_SES);

	ph = skb_put(skb, total_len + sizeof(struct pppoe_hdr));
+1 −1
Original line number Diff line number Diff line
@@ -541,7 +541,7 @@ static inline struct sk_buff *bt_skb_sendmsg(struct sock *sk,
		return ERR_PTR(-EFAULT);
	}

	skb->priority = sk->sk_priority;
	skb->priority = READ_ONCE(sk->sk_priority);

	return skb;
}
+1 −1
Original line number Diff line number Diff line
@@ -664,7 +664,7 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb,

sendit:
	if (skb->sk)
		skb->priority = skb->sk->sk_priority;
		skb->priority = READ_ONCE(skb->sk->sk_priority);
	if (dev_queue_xmit(skb))
		goto drop;
sent:
+1 −1
Original line number Diff line number Diff line
@@ -939,7 +939,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
	sock_init_data(NULL, sk);

	sk->sk_type     = osk->sk_type;
	sk->sk_priority = osk->sk_priority;
	sk->sk_priority = READ_ONCE(osk->sk_priority);
	sk->sk_protocol = osk->sk_protocol;
	sk->sk_rcvbuf   = osk->sk_rcvbuf;
	sk->sk_sndbuf   = osk->sk_sndbuf;
+1 −1
Original line number Diff line number Diff line
@@ -1615,7 +1615,7 @@ static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
		return ERR_PTR(-ENOTCONN);
	}

	skb->priority = sk->sk_priority;
	skb->priority = READ_ONCE(sk->sk_priority);

	bt_cb(skb)->l2cap.chan = chan;

Loading