Skip to content

Commit 10e6fe5

Browse files
paliSteve French
authored andcommitted
cifs: Do not attempt to call CIFSGetSrvInodeNumber() without CAP_INFOLEVEL_PASSTHRU
CIFSGetSrvInodeNumber() uses SMB_QUERY_FILE_INTERNAL_INFO (0x3ee) level which is SMB PASSTHROUGH level (>= 0x03e8). SMB PASSTHROUGH levels are supported only when server announce CAP_INFOLEVEL_PASSTHRU. So add guard in cifs_query_file_info() function which is the only user of CIFSGetSrvInodeNumber() function and returns -EOPNOTSUPP when server does not announce CAP_INFOLEVEL_PASSTHRU. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent e20a405 commit 10e6fe5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/smb/client/smb1ops.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,13 @@ static int cifs_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
614614
* There may be higher info levels that work but are there Windows
615615
* server or network appliances for which IndexNumber field is not
616616
* guaranteed unique?
617+
*
618+
* CIFSGetSrvInodeNumber() uses SMB_QUERY_FILE_INTERNAL_INFO
619+
* which is SMB PASSTHROUGH level therefore check for capability.
620+
* Note that this function can be called with tcon == NULL.
617621
*/
622+
if (tcon && !(tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU))
623+
return -EOPNOTSUPP;
618624
return CIFSGetSrvInodeNumber(xid, tcon, full_path, uniqueid,
619625
cifs_sb->local_nls,
620626
cifs_remap(cifs_sb));

0 commit comments

Comments
 (0)