Skip to content

Commit

Permalink
ndr: fix translation in ndr_encode_posix_acl()
Browse files Browse the repository at this point in the history
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 <stfrench@microsoft.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Cc: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Christian Brauner authored and Steve French committed Sep 4, 2021
1 parent 55cd04d commit 9467a0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ksmbd/ndr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9467a0c

Please sign in to comment.