diff options
author | Pali Rohár <pali@kernel.org> | 2024-12-27 16:04:38 +0100 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2025-01-19 19:57:02 -0600 |
commit | e20a405fe4f240d94f1baaa0eaf816cbf16ffb60 (patch) | |
tree | 919e65c99c63aca3b81ad0edb521eb900ce05505 | |
parent | 4bda5f4de03883913e9d0a4ce9a495aa918051ac (diff) | |
download | linux-e20a405fe4f240d94f1baaa0eaf816cbf16ffb60.tar.gz linux-e20a405fe4f240d94f1baaa0eaf816cbf16ffb60.tar.bz2 linux-e20a405fe4f240d94f1baaa0eaf816cbf16ffb60.zip |
cifs: Do not attempt to call CIFSSMBRenameOpenFile() without CAP_INFOLEVEL_PASSTHRU
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>
-rw-r--r-- | fs/smb/client/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index f146e06c97eb..93e9188b2632 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -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, |