lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250324210747.3dc899b9@pumpkin>
Date: Mon, 24 Mar 2025 21:07:47 +0000
From: David Laight <david.laight.linux@...il.com>
To: chenxiaosong@...nxiaosong.com
Cc: linkinjeon@...nel.org, sfrench@...ba.org, senozhatsky@...omium.org,
 tom@...pey.com, linux-cifs@...r.kernel.org, linux-kernel@...r.kernel.org,
 ChenXiaoSong <chenxiaosong@...inos.cn>, netdev@...r.kernel.org
Subject: Re: [PATCH] smb/server: use sock_create_kern() in create_socket()

On Mon, 24 Mar 2025 06:51:55 +0000
chenxiaosong@...nxiaosong.com wrote:

> From: ChenXiaoSong <chenxiaosong@...inos.cn>
> 
> The socket resides in kernel space, so use sock_create_kern()
> instead of sock_create().

As in the other patches you need to worry about whether the socket
holds a reference to the network namespace.

	David

> 
> Signed-off-by: ChenXiaoSong <chenxiaosong@...inos.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;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ