From: Christian Brauner Date: Mon, 23 Aug 2021 15:13:54 +0000 (+0200) Subject: ndr: fix translation in ndr_encode_posix_acl() X-Git-Tag: accepted/tizen/unified/20230118.172025~6404^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9467a0ce486c87a8f06ad492afa8b95686bff61f;p=platform%2Fkernel%2Flinux-rpi.git 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 Cc: Christoph Hellwig Cc: Namjae Jeon Cc: Hyunchul Lee Cc: Sergey Senozhatsky Cc: linux-cifs@vger.kernel.org Signed-off-by: Christian Brauner Signed-off-by: Namjae Jeon Signed-off-by: Steve French --- diff --git a/fs/ksmbd/ndr.c b/fs/ksmbd/ndr.c index 2243a2c..e6a574f 100644 --- a/fs/ksmbd/ndr.c +++ b/fs/ksmbd/ndr.c @@ -259,8 +259,8 @@ int ndr_encode_posix_acl(struct ndr *n, ndr_write_int32(n, 0); } - ndr_write_int64(n, from_kuid(user_ns, inode->i_uid)); - ndr_write_int64(n, from_kgid(user_ns, inode->i_gid)); + ndr_write_int64(n, from_kuid(&init_user_ns, i_uid_into_mnt(user_ns, inode))); + ndr_write_int64(n, from_kgid(&init_user_ns, i_gid_into_mnt(user_ns, inode))); ndr_write_int32(n, inode->i_mode); if (acl) {