Messages in this thread | | | Date | Wed, 13 May 2020 06:46:09 +0100 | From | Al Viro <> | 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?
| |