Commit 8a402bbe authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski
Browse files

net: dst: annotate data-races around dst->obsolete



(dst_entry)->obsolete is read locklessly, add corresponding
annotations.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250630121934.3399505-2-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8077b9a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *,
							   u32));
static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
{
	if (dst->obsolete)
	if (READ_ONCE(dst->obsolete))
		dst = INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check,
					 ipv4_dst_check, dst, cookie);
	return dst;
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ void dst_dev_put(struct dst_entry *dst)
{
	struct net_device *dev = dst->dev;

	dst->obsolete = DST_OBSOLETE_DEAD;
	WRITE_ONCE(dst->obsolete, DST_OBSOLETE_DEAD);
	if (dst->ops->ifdown)
		dst->ops->ifdown(dst, dev);
	dst->input = dst_discard;
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache,

	if (unlikely(!time_after(idst->refresh_ts,
				 READ_ONCE(dst_cache->reset_ts)) ||
		     (dst->obsolete && !dst->ops->check(dst, idst->cookie)))) {
		     (READ_ONCE(dst->obsolete) && !dst->ops->check(dst, idst->cookie)))) {
		dst_cache_per_cpu_dst_set(idst, NULL, 0);
		dst_release(dst);
		goto fail;
+2 −1
Original line number Diff line number Diff line
@@ -1428,7 +1428,8 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,
			 * we can reinject the packet there.
			 */
			n2 = NULL;
			if (dst && dst->obsolete != DST_OBSOLETE_DEAD) {
			if (dst &&
			    READ_ONCE(dst->obsolete) != DST_OBSOLETE_DEAD) {
				n2 = dst_neigh_lookup_skb(dst, skb);
				if (n2)
					n1 = n2;
+2 −2
Original line number Diff line number Diff line
@@ -602,7 +602,7 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
{
	struct dst_entry *dst = __sk_dst_get(sk);

	if (dst && dst->obsolete &&
	if (dst && READ_ONCE(dst->obsolete) &&
	    INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check, ipv4_dst_check,
			       dst, cookie) == NULL) {
		sk_tx_queue_clear(sk);
@@ -620,7 +620,7 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie)
{
	struct dst_entry *dst = sk_dst_get(sk);

	if (dst && dst->obsolete &&
	if (dst && READ_ONCE(dst->obsolete) &&
	    INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check, ipv4_dst_check,
			       dst, cookie) == NULL) {
		sk_dst_reset(sk);
Loading