Re: [syzbot] [net?] [s390?] general protection fault in smc_diag_dump_proto

From: Jeongjun Park
Date: Wed Sep 18 2024 - 12:04:18 EST


#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
net/smc/smc_inet.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/smc/smc_inet.c b/net/smc/smc_inet.c
index a5b2041600f9..e101c8eee187 100644
--- a/net/smc/smc_inet.c
+++ b/net/smc/smc_inet.c
@@ -111,11 +111,17 @@ static struct inet_protosw smc_inet6_protosw = {
static int smc_inet_init_sock(struct sock *sk)
{
struct net *net = sock_net(sk);
+ int rc;

/* init common smc sock */
smc_sk_init(net, sk, IPPROTO_SMC);
/* create clcsock */
- return smc_create_clcsk(net, sk, sk->sk_family);
+ rc = smc_create_clcsk(net, sk, sk->sk_family);
+
+ if (rc)
+ sk_common_release(sk);
+
+ return rc;
}

int __init smc_inet_init(void)
--