Re: [PATCH v2 1/2] fs: avoid fdput() after failed fdget() in ksys_sync_file_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux