Skip to content

Commit 3677ca6

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: use sock_create_kern interface to create kernel socket
we should use sock_create_kern() if the socket resides in kernel space. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 5da92a2 commit 3677ca6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

fs/smb/server/transport_tcp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,13 @@ static int create_socket(struct interface *iface)
455455
struct socket *ksmbd_socket;
456456
bool ipv4 = false;
457457

458-
ret = sock_create(PF_INET6, SOCK_STREAM, IPPROTO_TCP, &ksmbd_socket);
458+
ret = sock_create_kern(current->nsproxy->net_ns, PF_INET6, SOCK_STREAM,
459+
IPPROTO_TCP, &ksmbd_socket);
459460
if (ret) {
460461
if (ret != -EAFNOSUPPORT)
461462
pr_err("Can't create socket for ipv6, fallback to ipv4: %d\n", ret);
462-
ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP,
463-
&ksmbd_socket);
463+
ret = sock_create_kern(current->nsproxy->net_ns, PF_INET,
464+
SOCK_STREAM, IPPROTO_TCP, &ksmbd_socket);
464465
if (ret) {
465466
pr_err("Can't create socket for ipv4: %d\n", ret);
466467
goto out_clear;

0 commit comments

Comments
 (0)