mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ksmbd: use sock_create_kern interface to create kernel socket
[ Upstream commit 3677ca67b9791481af16d86e47c3c7d1f2442f95 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e81e6d6d99
commit
a024cf4d9f
@@ -476,12 +476,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;
|
||||
|
||||
Reference in New Issue
Block a user