Commit 3edcc568 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-various-KCSAN-inspired-fixes'



Eric Dumazet says:

====================
net: various KCSAN inspired fixes

This is a series of minor fixes, mostly dealing with
lockless accesses to socket 'sk_ack_backlog', 'sk_max_ack_backlog'
ane neighbour 'confirmed' fields.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 71c780f1 099ecf59
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ static inline void __ipv4_confirm_neigh(struct net_device *dev, u32 key)
		unsigned long now = jiffies;

		/* avoid dirtying neighbour */
		if (n->confirmed != now)
			n->confirmed = now;
		if (READ_ONCE(n->confirmed) != now)
			WRITE_ONCE(n->confirmed, now);
	}
	rcu_read_unlock_bh();
}
+4 −4
Original line number Diff line number Diff line
@@ -414,8 +414,8 @@ static inline void __ipv6_confirm_neigh(struct net_device *dev,
		unsigned long now = jiffies;

		/* avoid dirtying neighbour */
		if (n->confirmed != now)
			n->confirmed = now;
		if (READ_ONCE(n->confirmed) != now)
			WRITE_ONCE(n->confirmed, now);
	}
	rcu_read_unlock_bh();
}
@@ -431,8 +431,8 @@ static inline void __ipv6_confirm_neigh_stub(struct net_device *dev,
		unsigned long now = jiffies;

		/* avoid dirtying neighbour */
		if (n->confirmed != now)
			n->confirmed = now;
		if (READ_ONCE(n->confirmed) != now)
			WRITE_ONCE(n->confirmed, now);
	}
	rcu_read_unlock_bh();
}
+9 −9
Original line number Diff line number Diff line
@@ -859,17 +859,17 @@ static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask)

static inline void sk_acceptq_removed(struct sock *sk)
{
	sk->sk_ack_backlog--;
	WRITE_ONCE(sk->sk_ack_backlog, sk->sk_ack_backlog - 1);
}

static inline void sk_acceptq_added(struct sock *sk)
{
	sk->sk_ack_backlog++;
	WRITE_ONCE(sk->sk_ack_backlog, sk->sk_ack_backlog + 1);
}

static inline bool sk_acceptq_is_full(const struct sock *sk)
{
	return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
	return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog);
}

/*
@@ -1939,8 +1939,8 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);

static inline void sk_dst_confirm(struct sock *sk)
{
	if (!sk->sk_dst_pending_confirm)
		sk->sk_dst_pending_confirm = 1;
	if (!READ_ONCE(sk->sk_dst_pending_confirm))
		WRITE_ONCE(sk->sk_dst_pending_confirm, 1);
}

static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
@@ -1950,10 +1950,10 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
		unsigned long now = jiffies;

		/* avoid dirtying neighbour */
		if (n->confirmed != now)
			n->confirmed = now;
		if (sk && sk->sk_dst_pending_confirm)
			sk->sk_dst_pending_confirm = 0;
		if (READ_ONCE(n->confirmed) != now)
			WRITE_ONCE(n->confirmed, now);
		if (sk && READ_ONCE(sk->sk_dst_pending_confirm))
			WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb)
			dev_kfree_skb(skb);
			goto as_indicate_complete;
		}
		sk->sk_ack_backlog++;
		sk_acceptq_added(sk);
		skb_queue_tail(&sk->sk_receive_queue, skb);
		pr_debug("waking sk_sleep(sk) 0x%p\n", sk_sleep(sk));
		sk->sk_state_change(sk);
+1 −1
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ static int svc_accept(struct socket *sock, struct socket *newsock, int flags,
				    msg->pvc.sap_addr.vpi,
				    msg->pvc.sap_addr.vci);
		dev_kfree_skb(skb);
		sk->sk_ack_backlog--;
		sk_acceptq_removed(sk);
		if (error) {
			sigd_enq2(NULL, as_reject, old_vcc, NULL, NULL,
				  &old_vcc->qos, error);
Loading