All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ronnie Sahlberg <lsahlber@redhat.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Cc: Steve French <smfrench@gmail.com>
Subject: [PATCH 2/4] cifs: check for smb1 in open_cached_dir()
Date: Tue, 10 May 2022 09:42:05 +1000	[thread overview]
Message-ID: <20220509234207.2469586-3-lsahlber@redhat.com> (raw)
In-Reply-To: <20220509234207.2469586-1-lsahlber@redhat.com>

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>
---
 fs/cifs/smb2ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index d6aaeff4a30a..2c93ee27d54d 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -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)
-- 
2.30.2


  parent reply	other threads:[~2022-05-09 23:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 23:42 Cifs: cache entries for the cached directory Ronnie Sahlberg
2022-05-09 23:42 ` [PATCH 1/4] cifs: move definition of cifs_fattr earlier in cifsglob.h Ronnie Sahlberg
2022-05-09 23:42 ` Ronnie Sahlberg [this message]
2022-05-09 23:42 ` [PATCH 3/4] cifs: set the CREATE_NOT_FILE when opening the directory in use_cached_dir() Ronnie Sahlberg
2022-05-21 17:26   ` Steve French
2022-05-09 23:42 ` [PATCH 4/4] cifs: cache the dirents for entries in a cached directory Ronnie Sahlberg
2022-05-10 22:57   ` Enzo Matsumiya
2022-05-11  0:41     ` Leif Sahlberg
2022-05-24 19:38       ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220509234207.2469586-3-lsahlber@redhat.com \
    --to=lsahlber@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.