diff mbox series

[CIFS] do not reuse connection if share marked as isolated

Message ID CAH2r5mtN7BW6AoeNEAPM=+7YM2EUtxJJ9bt-ezsiFcDCYH+e4g@mail.gmail.com
State New
Headers show
Series [CIFS] do not reuse connection if share marked as isolated | expand

Commit Message

Steve French May 8, 2023, 5:36 a.m. UTC
"SHAREFLAG_ISOLATED_TRANSPORT" indicates that we should not reuse the socket
for this share (for future mounts).  Mark the socket as server->nosharesock if
share flags returned include SHAREFLAG_ISOLATED_TRANSPORT.

See MS-SMB2 MS-SMB2 2.2.10 and 3.2.5.5

See attached patch
diff mbox series

Patch

From 4365a391b1b5c0f2a065abafafe4abda9e96038a Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 7 May 2023 17:57:17 -0500
Subject: [PATCH] [SMB3.1.1] do not reuse connection if share marked as
 isolated

"SHAREFLAG_ISOLATED_TRANSPORT" indicates that we should not reuse the
socket for this share (for future mounts).  Mark the socket as
server->nosharesock if share flags returned include
SHAREFLAG_ISOLATED_TRANSPORT.

See MS-SMB2 MS-SMB2 2.2.10 and 3.2.5.5

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2pdu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e33ca0d33906..9ed61b6f9b21 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1947,6 +1947,9 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	init_copy_chunk_defaults(tcon);
 	if (server->ops->validate_negotiate)
 		rc = server->ops->validate_negotiate(xid, tcon);
+	if (rc == 0) /* See MS-SMB2 2.2.10 and 3.2.5.5 */
+		if (tcon->share_flags & SMB2_SHAREFLAG_ISOLATED_TRANSPORT)
+			server->nosharesock = true;
 tcon_exit:
 
 	free_rsp_buf(resp_buftype, rsp);
-- 
2.34.1