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]
Date:   Mon, 4 Dec 2023 11:37:20 -0800
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     liujing <liujing@...s.chinamobile.com>
Cc:     shuah@...nel.org, adobriyan@...il.com,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH] Fixed an open function not judging the return value and
 closed the open function

On Mon,  4 Dec 2023 03:05:54 -0500 liujing <liujing@...s.chinamobile.com> wrote:

> Signed-off-by: liujing <liujing@...s.chinamobile.com>
> ---
>  tools/testing/selftests/proc/proc-pid-vm.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c
> index cacbd2a4aec9..5fc9b46f236f 100644
> --- a/tools/testing/selftests/proc/proc-pid-vm.c
> +++ b/tools/testing/selftests/proc/proc-pid-vm.c
> @@ -205,7 +205,12 @@ static int make_exe(const uint8_t *payload, size_t len)
>  	/* Avoid ETXTBSY on exec. */
>  	snprintf(buf, sizeof(buf), "/proc/self/fd/%u", fd);
>  	fd1 = open(buf, O_RDONLY|O_CLOEXEC);
> +	if (fd == -1) {

fd1

> +		exit(1);
> +	}

unneeded braces

>  	close(fd);
> +	close(fd1);
>  
>  	return fd1;

Returning an fd which we just closed is clearly wrong.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ