Skip to content

Commit 9bd8127

Browse files
author
Al Viro
committed
convert cifs_ioctl_copychunk()
fdput() moved past mnt_drop_file_write(); harmless, if somewhat cringeworthy. Reordering could be avoided either by adding an explicit scope or by making mnt_drop_file_write() called via __cleanup. Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 44b11a5 commit 9bd8127

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/smb/client/ioctl.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file,
7272
unsigned long srcfd)
7373
{
7474
int rc;
75-
struct fd src_file;
7675
struct inode *src_inode;
7776

7877
cifs_dbg(FYI, "ioctl copychunk range\n");
@@ -89,29 +88,27 @@ static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file,
8988
return rc;
9089
}
9190

92-
src_file = fdget(srcfd);
93-
if (!fd_file(src_file)) {
91+
CLASS(fd, src_file)(srcfd);
92+
if (fd_empty(src_file)) {
9493
rc = -EBADF;
9594
goto out_drop_write;
9695
}
9796

9897
if (fd_file(src_file)->f_op->unlocked_ioctl != cifs_ioctl) {
9998
rc = -EBADF;
10099
cifs_dbg(VFS, "src file seems to be from a different filesystem type\n");
101-
goto out_fput;
100+
goto out_drop_write;
102101
}
103102

104103
src_inode = file_inode(fd_file(src_file));
105104
rc = -EINVAL;
106105
if (S_ISDIR(src_inode->i_mode))
107-
goto out_fput;
106+
goto out_drop_write;
108107

109108
rc = cifs_file_copychunk_range(xid, fd_file(src_file), 0, dst_file, 0,
110109
src_inode->i_size, 0);
111110
if (rc > 0)
112111
rc = 0;
113-
out_fput:
114-
fdput(src_file);
115112
out_drop_write:
116113
mnt_drop_write_file(dst_file);
117114
return rc;

0 commit comments

Comments
 (0)