diff mbox series

[SMB3] smb3: do not attempt cifs operation in smb3 query info error path

Message ID CAH2r5mutYsFr4ukXQ6g1o80J2Atgubo2cDHe67v=2-TBTKC_6A@mail.gmail.com
State New
Headers show
Series [SMB3] smb3: do not attempt cifs operation in smb3 query info error path | expand

Commit Message

Steve French Oct. 19, 2018, 6:10 a.m. UTC
If backupuid mount option is sent, we can incorrectly retry
(on access denied on query info) with a cifs (FindFirst) operation
on an smb3 mount which causes the server to force the session close.

We set backup intent on open so no need for this fallback.

See kernel bugzilla 201435

Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
---
 fs/cifs/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

             if (srchinf == NULL) {

Comments

ronnie sahlberg Oct. 19, 2018, 6:50 a.m. UTC | #1
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
On Fri, Oct 19, 2018 at 4:10 PM Steve French <smfrench@gmail.com> wrote:
>
> If backupuid mount option is sent, we can incorrectly retry
> (on access denied on query info) with a cifs (FindFirst) operation
> on an smb3 mount which causes the server to force the session close.
>
> We set backup intent on open so no need for this fallback.
>
> See kernel bugzilla 201435
>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> CC: Stable <stable@vger.kernel.org>
> ---
>  fs/cifs/inode.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 0945d40030eb..7483c09317b9 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -781,7 +781,15 @@ cifs_get_inode_info(struct inode **inode, const
> char *full_path,
>      } else if (rc == -EREMOTE) {
>          cifs_create_dfs_fattr(&fattr, sb);
>          rc = 0;
> -    } else if (rc == -EACCES && backup_cred(cifs_sb)) {
> +    } else if ((rc == -EACCES) && backup_cred(cifs_sb) &&
> +           (strcmp(server->vals->version_string, SMB1_VERSION_STRING)
> +              == 0)) {
> +            /*
> +             * For SMB2 and later the backup intent flag is already
> +             * sent if needed on open and there is no path based
> +             * FindFirst operation to use to retry with
> +             */
> +
>              srchinf = kzalloc(sizeof(struct cifs_search_info),
>                          GFP_KERNEL);
>              if (srchinf == NULL) {
>
> --
> Thanks,
>
> Steve
diff mbox series

Patch

From 1fcb99e4c257f315de3c6805e6b75af4c044ddc8 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 19 Oct 2018 00:45:21 -0500
Subject: [PATCH] smb3: do not attempt cifs operation in smb3 query info error
 path

If backupuid mount option is sent, we can incorrectly retry
(on access denied on query info) with a cifs (FindFirst) operation
on an smb3 mount which causes the server to force the session close.

We set backup intent on open so no need for this fallback.

See kernel bugzilla 201435

Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
---
 fs/cifs/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0945d40030eb..7483c09317b9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -781,7 +781,15 @@  cifs_get_inode_info(struct inode **inode, const char *full_path,
 	} else if (rc == -EREMOTE) {
 		cifs_create_dfs_fattr(&fattr, sb);
 		rc = 0;
-	} else if (rc == -EACCES && backup_cred(cifs_sb)) {
+	} else if ((rc == -EACCES) && backup_cred(cifs_sb) &&
+		   (strcmp(server->vals->version_string, SMB1_VERSION_STRING)
+		      == 0)) {
+			/*
+			 * For SMB2 and later the backup intent flag is already
+			 * sent if needed on open and there is no path based
+			 * FindFirst operation to use to retry with
+			 */
+
 			srchinf = kzalloc(sizeof(struct cifs_search_info),
 						GFP_KERNEL);
 			if (srchinf == NULL) {
-- 
2.17.1