Commit 9a97df40 authored by Zhang Xiaoxu's avatar Zhang Xiaoxu Committed by Steve French
Browse files

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: 4e8aea30 ("smb3: enable swap on SMB3 mounts")
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent fee0fb1f
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -1302,8 +1302,11 @@ static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
	ssize_t rc;
	ssize_t rc;
	struct cifsFileInfo *cfile = dst_file->private_data;
	struct cifsFileInfo *cfile = dst_file->private_data;


	if (cfile->swapfile)
	if (cfile->swapfile) {
		return -EOPNOTSUPP;
		rc = -EOPNOTSUPP;
		free_xid(xid);
		return rc;
	}


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