Patch "cifs: Fix xid leak in cifs_copy_file_range()" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    cifs: Fix xid leak in cifs_copy_file_range()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cifs-fix-xid-leak-in-cifs_copy_file_range.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 317a9f5090fe1046451ab5822c084c62140d4532
Author: Zhang Xiaoxu <zhangxiaoxu5@xxxxxxxxxx>
Date:   Mon Oct 17 22:45:22 2022 +0800

    cifs: Fix xid leak in cifs_copy_file_range()
    
    [ Upstream commit 9a97df404a402fe1174d2d1119f87ff2a0ca2fe9 ]
    
    If the file is used by swap, before return -EOPNOTSUPP, should
    free the xid, otherwise, the xid will be leaked.
    
    Fixes: 4e8aea30f775 ("smb3: enable swap on SMB3 mounts")
    Reviewed-by: Paulo Alcantara (SUSE) <pc@xxxxxx>
    Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@xxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 8ec55bbd705d..668dd6a86295 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1263,8 +1263,11 @@ static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
 	ssize_t rc;
 	struct cifsFileInfo *cfile = dst_file->private_data;
 
-	if (cfile->swapfile)
-		return -EOPNOTSUPP;
+	if (cfile->swapfile) {
+		rc = -EOPNOTSUPP;
+		free_xid(xid);
+		return rc;
+	}
 
 	rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff,
 					len, flags);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux