summaryrefslogtreecommitdiff
path: root/net/ipv4/udp_bpf.c
diff options
context:
space:
mode:
authorCong Wang <cong.wang@bytedance.com>2021-04-06 20:21:11 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2021-04-12 17:34:27 +0200
commit51e0158a54321a48d260e95998393934bb0de52c (patch)
tree886e66f533cd8a55c78f23013ecf3325dafc9519 /net/ipv4/udp_bpf.c
parentcbaa683bb3923df4d3c12481bff6cb6d8fdbc060 (diff)
skmsg: Pass psock pointer to ->psock_update_sk_prot()
Using sk_psock() to retrieve psock pointer from sock requires RCU read lock, but we already get psock pointer before calling ->psock_update_sk_prot() in both cases, so we can just pass it without bothering sk_psock(). Fixes: 8a59f9d1e3d4 ("sock: Introduce sk->sk_prot->psock_update_sk_prot()") Reported-by: syzbot+320a3bc8d80f478c37e4@syzkaller.appspotmail.com Signed-off-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: syzbot+320a3bc8d80f478c37e4@syzkaller.appspotmail.com Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20210407032111.33398-1-xiyou.wangcong@gmail.com
Diffstat (limited to 'net/ipv4/udp_bpf.c')
-rw-r--r--net/ipv4/udp_bpf.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv4/udp_bpf.c b/net/ipv4/udp_bpf.c
index 4a7e38c5d842..954c4591a6fd 100644
--- a/net/ipv4/udp_bpf.c
+++ b/net/ipv4/udp_bpf.c
@@ -103,10 +103,9 @@ static int __init udp_bpf_v4_build_proto(void)
}
core_initcall(udp_bpf_v4_build_proto);
-int udp_bpf_update_proto(struct sock *sk, bool restore)
+int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
{
int family = sk->sk_family == AF_INET ? UDP_BPF_IPV4 : UDP_BPF_IPV6;
- struct sk_psock *psock = sk_psock(sk);
if (restore) {
sk->sk_write_space = psock->saved_write_space;