Skip to content

Commit bf21e29

Browse files
nszeteiSteve French
authored andcommitted
ksmbd: validate zero num_subauth before sub_auth is accessed
Access psid->sub_auth[psid->num_subauth - 1] without checking if num_subauth is non-zero leads to an out-of-bounds read. This patch adds a validation step to ensure num_subauth != 0 before sub_auth is accessed. Cc: [email protected] Signed-off-by: Norbert Szetei <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent beff0bc commit bf21e29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/smb/server/smbacl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ static int sid_to_id(struct mnt_idmap *idmap,
270270
return -EIO;
271271
}
272272

273+
if (psid->num_subauth == 0) {
274+
pr_err("%s: zero subauthorities!\n", __func__);
275+
return -EIO;
276+
}
277+
273278
if (sidtype == SIDOWNER) {
274279
kuid_t uid;
275280
uid_t id;

0 commit comments

Comments
 (0)