]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: Do not attempt to call CIFSSMBRenameOpenFile() without CAP_INFOLEVEL_PASSTHRU
authorPali Rohár <pali@kernel.org>
Fri, 27 Dec 2024 15:04:38 +0000 (16:04 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 20 Jan 2025 01:57:02 +0000 (19:57 -0600)
CIFSSMBRenameOpenFile() uses SMB_SET_FILE_RENAME_INFORMATION (0x3f2) level
which is SMB PASSTHROUGH level (>= 0x03e8). SMB PASSTHROUGH levels are
supported only when server announce CAP_INFOLEVEL_PASSTHRU.

All usage of CIFSSMBRenameOpenFile() execept the one is already guarded by
checks which prevents calling it against servers without support for
CAP_INFOLEVEL_PASSTHRU.

The remaning usage without guard is in cifs_do_rename() function, so add
missing guard here.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/inode.c

index f146e06c97eb694c18646590fd695c9f9cc6b244..93e9188b2632fdea3da95ef6d4507970c17451af 100644 (file)
@@ -2392,6 +2392,13 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
        if (to_dentry->d_parent != from_dentry->d_parent)
                goto do_rename_exit;
 
+       /*
+        * CIFSSMBRenameOpenFile() uses SMB_SET_FILE_RENAME_INFORMATION
+        * which is SMB PASSTHROUGH level.
+        */
+       if (!(tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU))
+               goto do_rename_exit;
+
        oparms = (struct cifs_open_parms) {
                .tcon = tcon,
                .cifs_sb = cifs_sb,