summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-06-04 13:16:03 +0200
committerPaolo Abeni <pabeni@redhat.com>2024-06-06 11:52:52 +0200
commitb4cb4a1391dcdc640c4ade003aaf0ee19cc8d509 (patch)
tree0e1edc28739cb61536a84d2806dc61b25ef07b77 /include/net
parentMerge branch 'improve-gbeth-performance-on-renesas-rz-g2l-and-related-socs' (diff)
downloadlinux-b4cb4a1391dcdc640c4ade003aaf0ee19cc8d509.tar.xz
linux-b4cb4a1391dcdc640c4ade003aaf0ee19cc8d509.zip
net: use unrcu_pointer() helper
Toke mentioned unrcu_pointer() existence, allowing to remove some of the ugly casts we have when using xchg() for rcu protected pointers. Also make inet_rcv_compat const. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Toke Høiland-Jørgensen <toke@redhat.com> Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/r/20240604111603.45871-1-edumazet@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sock.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 953c8dc4e259..b30ea0c342a6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2095,7 +2095,7 @@ sk_dst_set(struct sock *sk, struct dst_entry *dst)
sk_tx_queue_clear(sk);
WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
- old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
+ old_dst = unrcu_pointer(xchg(&sk->sk_dst_cache, RCU_INITIALIZER(dst)));
dst_release(old_dst);
}