Skip to content

Commit f0bb29d

Browse files
Christian Braunersmfrench
authored andcommitted
ksmbd: fix subauth 0 handling in sid_to_id()
It's not obvious why subauth 0 would be excluded from translation. This would lead to wrong results whenever a non-identity idmapping is used. 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 0e844ef commit f0bb29d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ksmbd/smbacl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static int sid_to_id(struct user_namespace *user_ns,
274274
uid_t id;
275275

276276
id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
277-
if (id > 0) {
277+
if (id >= 0) {
278278
uid = make_kuid(user_ns, id);
279279
if (uid_valid(uid) && kuid_has_mapping(user_ns, uid)) {
280280
fattr->cf_uid = uid;
@@ -286,7 +286,7 @@ static int sid_to_id(struct user_namespace *user_ns,
286286
gid_t id;
287287

288288
id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
289-
if (id > 0) {
289+
if (id >= 0) {
290290
gid = make_kgid(user_ns, id);
291291
if (gid_valid(gid) && kgid_has_mapping(user_ns, gid)) {
292292
fattr->cf_gid = gid;

0 commit comments

Comments
 (0)