[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206075504.24153-4-kuniyu@amazon.com>
Date: Fri, 6 Dec 2024 16:54:52 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>
CC: Kuniyuki Iwashima <kuniyu@...zon.com>, Kuniyuki Iwashima
<kuni1840@...il.com>, <netdev@...r.kernel.org>
Subject: [PATCH v1 net-next 03/15] smc: Pass kern to smc_sock_alloc().
Since commit d7cd421da9da ("net/smc: Introduce TCP ULP support"),
smc_ulp_init() calls __smc_create() with kern=1.
However, __smc_create() does not pass it to smc_sock_alloc(),
which finally calls sk_alloc() with kern=0.
Let's pass kern down to smc_sock_alloc() and sk_alloc().
Note that we change kern from 1 to 0 in smc_ulp_init() not to
introduce any functional change.
Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
---
net/smc/af_smc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 9e6c69d18581..a9679c37202d 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -387,13 +387,13 @@ void smc_sk_init(struct net *net, struct sock *sk, int protocol)
}
static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
- int protocol)
+ int protocol, int kern)
{
struct proto *prot;
struct sock *sk;
prot = (protocol == SMCPROTO_SMC6) ? &smc_proto6 : &smc_proto;
- sk = sk_alloc(net, PF_SMC, GFP_KERNEL, prot, 0);
+ sk = sk_alloc(net, PF_SMC, GFP_KERNEL, prot, kern);
if (!sk)
return NULL;
@@ -1712,7 +1712,7 @@ static int smc_clcsock_accept(struct smc_sock *lsmc, struct smc_sock **new_smc)
int rc = -EINVAL;
release_sock(lsk);
- new_sk = smc_sock_alloc(sock_net(lsk), NULL, lsk->sk_protocol);
+ new_sk = smc_sock_alloc(sock_net(lsk), NULL, lsk->sk_protocol, 0);
if (!new_sk) {
rc = -ENOMEM;
lsk->sk_err = ENOMEM;
@@ -3346,7 +3346,7 @@ static int __smc_create(struct net *net, struct socket *sock, int protocol,
rc = -ENOBUFS;
sock->ops = &smc_sock_ops;
sock->state = SS_UNCONNECTED;
- sk = smc_sock_alloc(net, sock, protocol);
+ sk = smc_sock_alloc(net, sock, protocol, kern);
if (!sk)
goto out;
@@ -3405,7 +3405,7 @@ static int smc_ulp_init(struct sock *sk)
smcsock->type = SOCK_STREAM;
__module_get(THIS_MODULE); /* tried in __tcp_ulp_find_autoload */
- ret = __smc_create(net, smcsock, protocol, 1, tcp);
+ ret = __smc_create(net, smcsock, protocol, 0, tcp);
if (ret) {
sock_release(smcsock); /* module_put() which ops won't be NULL */
return ret;
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists