Skip to content

Commit 9a97df4

Browse files
z00467499smfrench
authored andcommitted
cifs: Fix xid leak in cifs_copy_file_range()
If the file is used by swap, before return -EOPNOTSUPP, should free the xid, otherwise, the xid will be leaked. Fixes: 4e8aea3 ("smb3: enable swap on SMB3 mounts") Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Zhang Xiaoxu <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent fee0fb1 commit 9a97df4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/cifs/cifsfs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,8 +1302,11 @@ static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
13021302
ssize_t rc;
13031303
struct cifsFileInfo *cfile = dst_file->private_data;
13041304

1305-
if (cfile->swapfile)
1306-
return -EOPNOTSUPP;
1305+
if (cfile->swapfile) {
1306+
rc = -EOPNOTSUPP;
1307+
free_xid(xid);
1308+
return rc;
1309+
}
13071310

13081311
rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff,
13091312
len, flags);

0 commit comments

Comments
 (0)