ksmbd: fix overflow in dacloffset bounds check
authorNorbert Szetei <norbert@doyensec.com>
Sat, 29 Mar 2025 06:58:15 +0000 (06:58 +0000)
committerSteve French <stfrench@microsoft.com>
Tue, 1 Apr 2025 05:04:21 +0000 (00:04 -0500)
commitbeff0bc9d69bc8e733f9bca28e2d3df5b3e10e42
treedec042705da83968d26b38cb0bf5c4dc0386eac1
parentfa4cdb8cbca7d6cb6aa13e4d8d83d1103f6345db
ksmbd: fix overflow in dacloffset bounds check

The dacloffset field was originally typed as int and used in an
unchecked addition, which could overflow and bypass the existing
bounds check in both smb_check_perm_dacl() and smb_inherit_dacl().

This could result in out-of-bounds memory access and a kernel crash
when dereferencing the DACL pointer.

This patch converts dacloffset to unsigned int and uses
check_add_overflow() to validate access to the DACL.

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>
fs/smb/server/smbacl.c