Thread (15 messages) 15 messages, 3 authors, 2d ago

[RFC PATCH 08/41] smb: client: use __kuid_val() for the unix SIDs of the caller

flat view
WARM2d

From: Jan Koester <hidden>
Date: 2026-10-18 18:01:59
Also in: keyrings, linux-arch, linux-cifs, linux-ext4, linux-fsdevel, linux-nfs, linux-security-module, lkml, netdev
Subsystem: common internet file system client (cifs and smb3), filesystems (vfs and infrastructure), the rest · Maintainers: Paulo Alcantara, Namjae Jeon, Alexander Viro, Christian Brauner, Linus Torvalds

The S-1-5-88-1-<uid> and S-1-5-88-2-<gid> SIDs sent with a create
request take the raw kernel ids from kuid_t.val, which is gone now that
the ids can be UUIDs and GUIDs. Use __kuid_val()/__kgid_val(), the same
value for classic ids and -1 for the others, which have no unix SID.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jan Koester <redacted>
---
 fs/smb/client/cifsacl.c | 2 +-
 fs/smb/client/smb2pdu.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
index c5e47a835f..78ed25b1f7 100644
--- a/fs/smb/client/cifsacl.c
+++ b/fs/smb/client/cifsacl.c
@@ -1086,7 +1086,7 @@ unsigned int setup_special_user_owner_ACE(struct smb_ace *pntace)
 
 	pntace->sid.sub_auth[0] = sid_unix_NFS_users.sub_auth[0];
 	pntace->sid.sub_auth[1] = sid_unix_NFS_users.sub_auth[1];
-	pntace->sid.sub_auth[2] = cpu_to_le32(current_fsgid().val);
+	pntace->sid.sub_auth[2] = cpu_to_le32(__kgid_val(current_fsgid()));
 
 	/* size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth*4) */
 	pntace->size = cpu_to_le16(ace_size);
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index cfe3c4b4ab..941ca8a3d6 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2731,7 +2731,7 @@ static void setup_owner_group_sids(char *buf)
 	sids->owner.Authority[5] = 5;
 	sids->owner.SubAuthorities[0] = cpu_to_le32(88);
 	sids->owner.SubAuthorities[1] = cpu_to_le32(1);
-	sids->owner.SubAuthorities[2] = cpu_to_le32(current_fsuid().val);
+	sids->owner.SubAuthorities[2] = cpu_to_le32(__kuid_val(current_fsuid()));
 
 	/* Populate the group ownership fields S-1-5-88-2 */
 	sids->group.Revision = 1;
@@ -2739,9 +2739,10 @@ static void setup_owner_group_sids(char *buf)
 	sids->group.Authority[5] = 5;
 	sids->group.SubAuthorities[0] = cpu_to_le32(88);
 	sids->group.SubAuthorities[1] = cpu_to_le32(2);
-	sids->group.SubAuthorities[2] = cpu_to_le32(current_fsgid().val);
+	sids->group.SubAuthorities[2] = cpu_to_le32(__kgid_val(current_fsgid()));
 
-	cifs_dbg(FYI, "owner S-1-5-88-1-%d, group S-1-5-88-2-%d\n", current_fsuid().val, current_fsgid().val);
+	cifs_dbg(FYI, "owner S-1-5-88-1-%d, group S-1-5-88-2-%d\n",
+		 __kuid_val(current_fsuid()), __kgid_val(current_fsgid()));
 }
 
 /* See MS-SMB2 2.2.13.2.2 and MS-DTYP 2.4.6 */
-- 
2.56.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help