Re: [PATCH bpf] bpf, sockmap: take the socket lock in udp_bpf_recvmsg()
From: Cong Wang
Date: Thu Jun 11 2026 - 17:20:19 EST
On Wed, Jun 10, 2026 at 05:59:17PM +0000, Sechang Lim wrote:
> diff --git a/net/ipv4/udp_bpf.c b/net/ipv4/udp_bpf.c
> index 9f33b07b1481..8dd73e9ee1ea 100644
> --- a/net/ipv4/udp_bpf.c
> +++ b/net/ipv4/udp_bpf.c
> @@ -80,7 +80,9 @@ static int udp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
> }
>
> msg_bytes_ready:
> + lock_sock(sk);
> copied = sk_msg_recvmsg(sk, psock, msg, len, flags);
> + release_sock(sk);
> if (!copied) {
> long timeo;
> int data;
It seems Kuniyuki's fix covers more than yours:
https://lore.kernel.org/bpf/20260221233234.3814768-4-kuniyu@xxxxxxxxxx/
Regards,
Cong