]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ksmbd: validate SID namespace before mapping IDs
authorNamjae Jeon <linkinjeon@kernel.org>
Wed, 1 Jul 2026 13:58:35 +0000 (22:58 +0900)
committerSteve French <stfrench@microsoft.com>
Mon, 6 Jul 2026 12:55:41 +0000 (07:55 -0500)
commitfbe0bb2b75eb3c61e8464486506253d1b471240b
treeac81a88b7e7266bc9d6067d18af05a0daaf3b761
parent8cdeaa50eae8dad34885515f62559ee83e7e8dda
ksmbd: validate SID namespace before mapping IDs

sid_to_id() currently treats the last subauthority of any owner or group
SID as a Unix uid or gid. For example, this maps Everyone (S-1-1-0) to
uid 0 and BUILTIN\Users (S-1-5-32-545) to gid 545.

When an SMB2 CREATE security descriptor contains those SIDs, ksmbd
attempts to change the newly created file to the bogus Unix ownership.
notify_change() then returns -EPERM, which makes smb2.create.aclfile fail
with NT_STATUS_SHARING_VIOLATION.

Validate the SID prefix before extracting its RID. Only server-domain
owner SIDs and S-1-22-2 Unix group SIDs have local ID representations.
Treat other valid Windows SIDs as unmapped so their original values can
still be preserved in the NT ACL xattr.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smbacl.c