diff mbox series

[SMB311,client] fix missing tcon check when mounting with linux extensions

Message ID CAH2r5muN630v9cDmMJ9hmavf2qdb0Gdpe80i6NAQnsB2C7eAgw@mail.gmail.com (mailing list archive)
State New
Headers show
Series [SMB311,client] fix missing tcon check when mounting with linux extensions | expand

Commit Message

Steve French April 6, 2025, 7:42 p.m. UTC
When mounting the same share twice, once with the "linux" mount parameter
(or equivalently "posix") and then once without (or e.g. with "nolinux"),
we were incorrectly reusing the same tree connection for both mounts.
This meant that the first mount of the share on the client, would
cause subsequent mounts of that same share on the same client to
ignore that mount parm ("linux" vs. "nolinux") and incorrectly reuse
the same tcon.

See attached
diff mbox series

Patch

From 015fe986c3e05f2d18e2b7d0c356306b98b69656 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 6 Apr 2025 14:09:19 -0500
Subject: [PATCH] smb311 client: fix missing tcon check when mounting with
 linux/posix extensions

When mounting the same share twice, once with the "linux" mount parameter
(or equivalently "posix") and then once without (or e.g. with "nolinux"),
we were incorrectly reusing the same tree connection for both mounts.
This meant that the first mount of the share on the client, would
cause subsequent mounts of that same share on the same client to
ignore that mount parm ("linux" vs. "nolinux") and incorrectly reuse
the same tcon.

Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/client/connect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index f298e86a3c1f..4c15ed0583b4 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2556,6 +2556,8 @@  static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
 		return 0;
 	if (tcon->nodelete != ctx->nodelete)
 		return 0;
+	if (tcon->posix_extensions != ctx->linux_ext)
+		return 0;
 	return 1;
 }
 
-- 
2.43.0