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:   Wed, 13 May 2020 06:46:09 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Shuah Khan <skhan@...uxfoundation.org>
Cc:     axboe@...nel.dk, zohar@...ux.vnet.ibm.com, mcgrof@...nel.org,
        keescook@...omium.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] fs: avoid fdput() after failed fdget() in
 ksys_sync_file_range()

On Tue, May 12, 2020 at 01:43:04PM -0600, Shuah Khan wrote:

> @@ -364,15 +364,15 @@ int sync_file_range(struct file *file, loff_t offset, loff_t nbytes,
>  int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
>  			 unsigned int flags)
>  {
> -	int ret;
> -	struct fd f;
> +	int ret = -EBADF;
> +	struct fd f = fdget(fd);
>  
> -	ret = -EBADF;
> -	f = fdget(fd);
> -	if (f.file)
> -		ret = sync_file_range(f.file, offset, nbytes, flags);
> +	if (!f.file)
> +		goto out;
>  
> +	ret = sync_file_range(f.file, offset, nbytes, flags);
>  	fdput(f);
> +out:
>  	return ret;

IDGI...  What's the point of that goto out, when it leads straight to return?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ