Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb/server: use sock_create_kern() in create_socket()
@ 2025-03-24  6:51 chenxiaosong
  2025-03-24 21:07 ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: chenxiaosong @ 2025-03-24  6:51 UTC (permalink / raw)
  To: linkinjeon, sfrench, senozhatsky, tom
  Cc: linux-cifs, linux-kernel, ChenXiaoSong

From: ChenXiaoSong <chenxiaosong@kylinos.cn>

The socket resides in kernel space, so use sock_create_kern()
instead of sock_create().

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/server/transport_tcp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/smb/server/transport_tcp.c b/fs/smb/server/transport_tcp.c
index 7f38a3c3f5bd..e5f46a91c3fc 100644
--- a/fs/smb/server/transport_tcp.c
+++ b/fs/smb/server/transport_tcp.c
@@ -429,12 +429,13 @@ static int create_socket(struct interface *iface)
 	struct socket *ksmbd_socket;
 	bool ipv4 = false;
 
-	ret = sock_create(PF_INET6, SOCK_STREAM, IPPROTO_TCP, &ksmbd_socket);
+	ret = sock_create_kern(current->nsproxy->net_ns, PF_INET6, SOCK_STREAM,
+			       IPPROTO_TCP, &ksmbd_socket);
 	if (ret) {
 		if (ret != -EAFNOSUPPORT)
 			pr_err("Can't create socket for ipv6, fallback to ipv4: %d\n", ret);
-		ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP,
-				  &ksmbd_socket);
+		ret = sock_create_kern(current->nsproxy->net_ns, PF_INET,
+				       SOCK_STREAM, IPPROTO_TCP, &ksmbd_socket);
 		if (ret) {
 			pr_err("Can't create socket for ipv4: %d\n", ret);
 			goto out_clear;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-24 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24  6:51 [PATCH] smb/server: use sock_create_kern() in create_socket() chenxiaosong
2025-03-24 21:07 ` David Laight
2025-03-24 22:11   ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox