Skip to content

Commit 9467a0c

Browse files
Christian Braunersmfrench
authored andcommitted
ndr: fix translation in ndr_encode_posix_acl()
The sid_to_id() helper encodes raw ownership information suitable for s*id handling. This is conceptually equivalent to reporting ownership information via stat to userspace. In this case the consumer is ksmbd instead of a regular user. So when encoding raw ownership information suitable for s*id handling later we need to map the id up according to the user namespace of ksmbd itself taking any idmapped mounts into account. Cc: Steve French <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Namjae Jeon <[email protected]> Cc: Hyunchul Lee <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: [email protected] Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 55cd04d commit 9467a0c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ksmbd/ndr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ int ndr_encode_posix_acl(struct ndr *n,
259259
ndr_write_int32(n, 0);
260260
}
261261

262-
ndr_write_int64(n, from_kuid(user_ns, inode->i_uid));
263-
ndr_write_int64(n, from_kgid(user_ns, inode->i_gid));
262+
ndr_write_int64(n, from_kuid(&init_user_ns, i_uid_into_mnt(user_ns, inode)));
263+
ndr_write_int64(n, from_kgid(&init_user_ns, i_gid_into_mnt(user_ns, inode)));
264264
ndr_write_int32(n, inode->i_mode);
265265

266266
if (acl) {

0 commit comments

Comments
 (0)