Re: [PATCH net-next v2] net: annotate data races around sk->sk_prot

From: Eric Dumazet

Date: Wed Mar 04 2026 - 02:04:09 EST


On Wed, Mar 4, 2026 at 7:43 AM Jiayuan Chen <jiayuan.chen@xxxxxxxxx> wrote:
>
> inet_sendmsg() and inet_recvmsg() access sk->sk_prot without
> lock_sock() or any other synchronization.
>
> sock_replace_proto() (used by sockmap), TLS and MPTCP can change
> sk->sk_prot under us, so these functions need READ_ONCE() to avoid
> load tearing.
>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
> ---

Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>

nits: (no need to resend)

1) You could have avoided the temporary variable
return INDIRECT_CALL_2(READ_ONCE(sk->sk_prot)->recvmsg, tcp_recvmsg, ...);

2) This could target net tree, with a Fixes: tag, but I am guessing
stable teams will automatically pick
this patch based on the changelog content.

Thanks.