[PATCH] smb3: do not call cifs functions in error path in rename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the server returned EBUSY during rename we could fall back to SMB1 in an
error path when using SMB2/SMB3.  Make sure we check the dialect before
calling CIFS_open there.

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a81a9df997c1..72b6e44a2162 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1743,6 +1743,10 @@ cifs_do_rename(const unsigned int xid, struct
dentry *from_dentry,
     if (to_dentry->d_parent != from_dentry->d_parent)
         goto do_rename_exit;

+    /* If not CIFS (vers=1.0) do not call CIFS/SMB1 functions below */
+    if (strcmp(server->vals->version_string, SMB1_VERSION_STRING) != 0)
+        goto do_rename_exit;
+
     oparms.tcon = tcon;
     oparms.cifs_sb = cifs_sb;
     /* open the file to be renamed -- we need DELETE perms */

-- 
Thanks,

Steve
From 007bb3005d40164d0067e618cf25f49de3c016a1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Sat, 3 Nov 2018 23:24:26 -0500
Subject: [PATCH] smb3: do not call cifs functions in error path in rename

If the server returned EBUSY during rename we could fall back to SMB1 in an
error path when using SMB2/SMB3.  Make sure we check the dialect before
calling CIFS_open there.

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a81a9df997c1..72b6e44a2162 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1743,6 +1743,10 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
 	if (to_dentry->d_parent != from_dentry->d_parent)
 		goto do_rename_exit;
 
+	/* If not CIFS (vers=1.0) do not call CIFS/SMB1 functions below */
+	if (strcmp(server->vals->version_string, SMB1_VERSION_STRING) != 0)
+		goto do_rename_exit;
+
 	oparms.tcon = tcon;
 	oparms.cifs_sb = cifs_sb;
 	/* open the file to be renamed -- we need DELETE perms */
-- 
2.17.1


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux