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] [day] [month] [year] [list]
Message-ID: <b2fe4035eb3b587657442490b1ce8410db63e5d2.camel@redhat.com>
Date: Tue, 09 Jul 2024 12:46:14 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Liu Jing <liujing@...s.chinamobile.com>, davem@...emloft.net, 
	edumazet@...gle.com, kuba@...nel.org, shuah@...nel.org
Cc: netdev@...r.kernel.org, linux-kselftest@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/net: missing close function in randomize
 function

On Fri, 2024-07-05 at 16:24 +0800, Liu Jing wrote:
> in randomize function, there is a open function, but there is no
> close function in the randomize, which is easy to cause memory leaks.

Please not that the file descriptor is not leaked, the kernel will
dispose it at process exit() time.

> 
> Signed-off-by: Liu Jing <liujing@...s.chinamobile.com>
> ---
>  tools/testing/selftests/net/tcp_mmap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
> index 4fcce5150850..ab305e262d0a 100644
> --- a/tools/testing/selftests/net/tcp_mmap.c
> +++ b/tools/testing/selftests/net/tcp_mmap.c
> @@ -438,6 +438,7 @@ static void randomize(void *target, size_t count)
>  		perror("read /dev/urandom");
>  		exit(1);
>  	}
> +	close(urandom);
>  }
>  
>  int main(int argc, char *argv[])

This is outside any loop, so the overall effect WRT the self-test
itself is not visible.

I think we are better off without this kind of changes, unless they are
part of a largish re-factor.

Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ