mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-10 08:41:03 -04:00
raw: annotate disconnect-side IPv4 match writers
raw_v4_match() reads inet_daddr, inet_rcv_saddr and sk_bound_dev_if locklessly under RCU. Bind and connect writers are annotated, but __udp_disconnect() still clears the same fields using plain stores. Commit18f116931f("raw: annotate lockless match fields in raw_v4_match()") added the lockless readers and annotated the raw bind and datagram connect writers. Its v4 revision intentionally left the shared disconnect-side IPv4 writers for follow-up cleanup. Complete that follow-up by using WRITE_ONCE() for the disconnect-side stores, including the inet_rcv_saddr reset in inet_reset_saddr(), to pair with the lockless raw socket matcher. Fixes:0daf07e527("raw: convert raw sockets to RCU") Link: https://lore.kernel.org/netdev/20260716142958.3064224-1-runyu.xiao@seu.edu.cn/ Suggested-by: Runyu Xiao <runyu.xiao@seu.edu.cn> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260828012918.1461-1-xuanqiang.luo@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
2cb0b0b1ed
commit
ac08d183da
@@ -704,7 +704,8 @@ static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,
|
||||
|
||||
static __inline__ void inet_reset_saddr(struct sock *sk)
|
||||
{
|
||||
inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
|
||||
inet_sk(sk)->inet_saddr = 0;
|
||||
WRITE_ONCE(inet_sk(sk)->inet_rcv_saddr, 0);
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (sk->sk_family == PF_INET6) {
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
|
||||
@@ -2166,10 +2166,10 @@ int __udp_disconnect(struct sock *sk, int flags)
|
||||
*/
|
||||
|
||||
sk->sk_state = TCP_CLOSE;
|
||||
inet->inet_daddr = 0;
|
||||
WRITE_ONCE(inet->inet_daddr, 0);
|
||||
inet->inet_dport = 0;
|
||||
sock_rps_reset_rxhash(sk);
|
||||
sk->sk_bound_dev_if = 0;
|
||||
WRITE_ONCE(sk->sk_bound_dev_if, 0);
|
||||
if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) {
|
||||
inet_reset_saddr(sk);
|
||||
if (sk->sk_prot->rehash &&
|
||||
|
||||
Reference in New Issue
Block a user