All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/7] smb: client: fix uid/gid override in getattr with posix extensions
@ 2026-09-06 20:05 Paulo Alcantara
  2026-09-06 20:05 ` [PATCH v4 2/7] smb: client: honor forceuid/forcegid when mapping SIDs to uid/gid Paulo Alcantara
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Paulo Alcantara @ 2026-09-06 20:05 UTC (permalink / raw)
  To: linux-cifs
  Cc: Arthur Lesuisse, Namjae Jeon, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM, stable

When mounting with 'multiuser,posix' options, cifs_getattr() overrides
the server-provided uid/gid with the current process's fsuid/fsgid.
This is because the condition only checks for unix extensions
(tcon->unix_ext) but not posix extensions (tcon->posix_extensions).

With SMB3 POSIX extensions, the server provides real uid/gid values
just like with unix extensions, so they should be preserved rather
than replaced with the caller's credentials.

Add a tcon->posix_extensions check to the condition so that uid/gid
from the server are properly reported in stat results.

Reported-by: Arthur Lesuisse <arthur.lesuisse@ulb.be>
Closes: https://lore.kernel.org/r/DB9P190MB2012266F6B8DECBE5D26A1798DB52@DB9P190MB2012.EURP190.PROD.OUTLOOK.COM
Suggested-by: Arthur Lesuisse <arthur.lesuisse@ulb.be>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Shyam Prasad N <sprasad@microsoft.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Bharath SM <bharathsm@microsoft.com>
Cc: stable@vger.kernel.org
---
 fs/smb/client/inode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 12ed8db10e00..49f9993ad567 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -2992,14 +2992,14 @@ int cifs_getattr(struct mnt_idmap *idmap, const struct path *path,
 		stat->attributes |= STATX_ATTR_ENCRYPTED;
 
 	/*
-	 * If on a multiuser mount without unix extensions or cifsacl being
-	 * enabled, and the admin hasn't overridden them, set the ownership
-	 * to the fsuid/fsgid of the current process.
+	 * If on a multiuser mount without unix extensions, posix extensions
+	 * or cifsacl being enabled, and the admin hasn't overridden them,
+	 * set the ownership to the fsuid/fsgid of the current process.
 	 */
 	sbflags = cifs_sb_flags(cifs_sb);
 	if ((sbflags & CIFS_MOUNT_MULTIUSER) &&
 	    !(sbflags & CIFS_MOUNT_CIFS_ACL) &&
-	    !tcon->unix_ext) {
+	    !tcon->unix_ext && !tcon->posix_extensions) {
 		if (!(sbflags & CIFS_MOUNT_OVERR_UID))
 			stat->uid = current_fsuid();
 		if (!(sbflags & CIFS_MOUNT_OVERR_GID))
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-09-07 23:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 20:05 [PATCH v4 1/7] smb: client: fix uid/gid override in getattr with posix extensions Paulo Alcantara
2026-09-06 20:05 ` [PATCH v4 2/7] smb: client: honor forceuid/forcegid when mapping SIDs to uid/gid Paulo Alcantara
2026-09-07 22:59   ` Namjae Jeon
2026-09-06 20:05 ` [PATCH v4 3/7] smb: client: fix WSL reparse point uid/gid override Paulo Alcantara
2026-09-07 22:59   ` Namjae Jeon
2026-09-06 20:05 ` [PATCH v4 4/7] smb: client: avoid using uninitialized SIDs in cifs_posix_to_fattr() Paulo Alcantara
2026-09-07 23:00   ` Namjae Jeon
2026-09-06 20:05 ` [PATCH v4 5/7] smb: client: fix file type corruption in wsl_to_fattr() Paulo Alcantara
2026-09-07 23:00   ` Namjae Jeon
2026-09-06 20:05 ` [PATCH v4 6/7] smb: client: fix file type corruption in posix_reparse_to_fattr() Paulo Alcantara
2026-09-07 23:00   ` Namjae Jeon
2026-09-06 20:05 ` [PATCH v4 7/7] smb: client: fix file type corruption in cifs_reparse_point_to_fattr() Paulo Alcantara
2026-09-07 23:01   ` Namjae Jeon
2026-09-07 22:58 ` [PATCH v4 1/7] smb: client: fix uid/gid override in getattr with posix extensions Namjae Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.