diff options
author | Norbert Szetei <norbert@doyensec.com> | 2025-03-29 16:06:01 +0000 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2025-04-01 00:04:21 -0500 |
commit | bf21e29d78cd2c2371023953d9c82dfef82ebb36 (patch) | |
tree | 297eacb0736cb0149f90507f42abe5a5a2a6240d /fs | |
parent | beff0bc9d69bc8e733f9bca28e2d3df5b3e10e42 (diff) |
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: stable@vger.kernel.org
Signed-off-by: Norbert Szetei <norbert@doyensec.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/server/smbacl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c index 2693ea2d67aa..5aa7a66334d9 100644 --- a/fs/smb/server/smbacl.c +++ b/fs/smb/server/smbacl.c @@ -270,6 +270,11 @@ static int sid_to_id(struct mnt_idmap *idmap, return -EIO; } + if (psid->num_subauth == 0) { + pr_err("%s: zero subauthorities!\n", __func__); + return -EIO; + } + if (sidtype == SIDOWNER) { kuid_t uid; uid_t id; |