[PATCH][CIFS] mount with "unix" mount option for SMB1 incorrectly handled

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

 



When Andrew Bartlett mentioned problems using the SMB1 Unix Extensions to Samba
I noticed a couple of client bugs.  This fixes the second problem I noticed.

Although by default we negotiate CIFS Unix Extensions for SMB1 mounts
to Samba (and they work if the user does not specify "unix" or "posix"
or "linux" on mount), and we do properly handle when a user turns them
off with "nounix" mount parm, ... but with the  changes to the mount
API we broke cases where the user explicitly specified the "unix"
option (or equivalently "linux" or "posix") on mount with vers=1.0 to
Samba or other servers which support the CIFS Unix Extensions.

   "mount error(95): Operation not supported"

and logged:

   "CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required
for POSIX extensions"

even though CIFS Unix Extensions are supported for vers=1.0  This
patch fixes the case where the user specifies both "unix" (or
equivalently "posix" or "linux") and "vers=1.0" on mount to a server
which supports the CIFS Unix Extensions.

See attached

-- 
Thanks,

Steve
From 6be36ee0acceef03ab61985786ca238a132721e6 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Tue, 23 Jul 2024 00:44:48 -0500
Subject: [PATCH] cifs: mount with "unix" mount option for SMB1 incorrectly
 handled

Although by default we negotiate CIFS Unix Extensions for SMB1 mounts to
Samba (and they work if the user does not specify "unix" or "posix" or
"linux" on mount), and we do properly handle when a user turns them off
with "nounix" mount parm.  But with the changes to the mount API we
broke cases where the user explicitly specifies the "unix" option (or
equivalently "linux" or "posix") on mount with vers=1.0 to Samba or other
servers which support the CIFS Unix Extensions.

 "mount error(95): Operation not supported"

and logged:

 "CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required for POSIX extensions"

even though CIFS Unix Extensions are supported for vers=1.0  This patch fixes
the case where the user specifies both "unix" (or equivalently "posix" or
"linux") and "vers=1.0" on mount to a server which supports the
CIFS Unix Extensions.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/smb/client/connect.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index b66d8b03a389..c3d8d7b7b46a 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2614,6 +2614,13 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 			cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 extensions\n");
 			rc = -EOPNOTSUPP;
 			goto out_fail;
+		} else if (ses->server->vals->protocol_id == SMB10_PROT_ID)
+			if (cap_unix(ses))
+				cifs_dbg(FYI, "Unix Extensions requested on SMB1 mount\n");
+			else {
+				cifs_dbg(VFS, "SMB1 Unix Extensions not supported by server\n");
+				rc = -EOPNOTSUPP;
+				goto out_fail;
 		} else {
 			cifs_dbg(VFS,
 				"Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n");
-- 
2.43.0


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

  Powered by Linux