diff options
| author | Eric Dumazet <[email protected]> | 2025-06-20 13:30:00 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-06-24 00:04:03 +0000 |
| commit | e84a4927a404f369c842c19de93b216627fcc690 (patch) | |
| tree | 901784e2f1bbcbcfbc36eff81b0d685abd7140e6 /net/ipv4/ping.c | |
| parent | caif: reduce stack size, again (diff) | |
| download | kernel-e84a4927a404f369c842c19de93b216627fcc690.tar.gz kernel-e84a4927a404f369c842c19de93b216627fcc690.zip | |
net: annotate races around sk->sk_uid
sk->sk_uid can be read while another thread changes its
value in sockfs_setattr().
Add sk_uid(const struct sock *sk) helper to factorize the needed
READ_ONCE() annotations, and add corresponding WRITE_ONCE()
where needed.
Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Lorenzo Colitti <[email protected]>
Reviewed-by: Maciej Żenczykowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/ipv4/ping.c')
| -rw-r--r-- | net/ipv4/ping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index c14baa6589c7..4eacaf00e2e9 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -781,7 +781,7 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, ipc.tos & INET_DSCP_MASK, scope, sk->sk_protocol, inet_sk_flowi_flags(sk), faddr, - saddr, 0, 0, sk->sk_uid); + saddr, 0, 0, sk_uid(sk)); fl4.fl4_icmp_type = user_icmph.type; fl4.fl4_icmp_code = user_icmph.code; |
