Re: [syzbot] [bpf?] [net?] WARNING in sock_map_close (2)

From: Hillf Danton
Date: Sat Aug 24 2024 - 19:35:20 EST


On Thu, 22 Aug 2024 06:19:27 -0700
> syzbot found the following issue on:
>
> HEAD commit: d785ed945de6 net: wwan: t7xx: PCIe reset rescan
> git tree: net-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12378c33980000

#syz test net-next d785ed945de6

--- x/net/core/sock_map.c
+++ y/net/core/sock_map.c
@@ -196,7 +196,7 @@ static void sock_map_unref(struct sock *

static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)
{
- if (!sk->sk_prot->psock_update_sk_prot)
+ if (!sk->sk_prot->psock_update_sk_prot || psock->saved_close == sock_map_close)
return -EINVAL;
psock->psock_update_sk_prot = sk->sk_prot->psock_update_sk_prot;
return sk->sk_prot->psock_update_sk_prot(sk, psock, false);
--