]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cifs: check for smb1 in open_cached_dir()
authorRonnie Sahlberg <lsahlber@redhat.com>
Mon, 9 May 2022 23:42:05 +0000 (09:42 +1000)
committerSteve French <stfrench@microsoft.com>
Sat, 21 May 2022 17:23:08 +0000 (12:23 -0500)
Check protocol version in open_cached_dir() and return not supported
for SMB1.  This allows us to call open_cached_dir() from code that
is common to both smb1 and smb2/3 in future patches without having to
do this check in the call-site.
At the same time, add a check if tcon is valid or not for the same reason.

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index d6aaeff4a30a530864211b79fbda744b87d6b720..2c93ee27d54d51ae4684f5bd9c2c9b51aada8573 100644 (file)
@@ -776,7 +776,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
        struct cifs_fid *pfid;
        struct dentry *dentry;
 
-       if (tcon->nohandlecache)
+       if (tcon == NULL || tcon->nohandlecache ||
+           is_smb1_server(tcon->ses->server))
                return -ENOTSUPP;
 
        if (cifs_sb->root == NULL)