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]
Date:   Fri, 24 Mar 2023 05:28:06 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     aloktiagi <aloktiagi@...il.com>
Cc:     viro@...iv.linux.org.uk, brauner@...nel.org,
        David.Laight@...lab.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, keescook@...omium.org,
        hch@...radead.org, Tycho Andersen <tycho@...ho.pizza>
Subject: Re: [RFC v3 2/3] file: allow callers to free the old file descriptor
 after dup2

On Fri, Mar 24, 2023 at 05:15:25AM +0000, aloktiagi wrote:
> @@ -1119,8 +1119,12 @@ __releases(&files->file_lock)
>  		__clear_close_on_exec(fd, fdt);
>  	spin_unlock(&files->file_lock);
>  
> -	if (tofree)
> -		filp_close(tofree, files);
> +	if (fdfile) {
> +		*fdfile = tofree;
> +	} else {
> +		if (tofree)
> +			filp_close(tofree, files);
> +	}

Why not:

	if (fdfile)
		 *fdfile = tofree;
	else if (tofree)
		filp_close(tofree, files);

Shorter and makes the parallel structure more obvious.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ