]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ksmbd: use check_add_overflow() to prevent u16 DACL size overflow
authorTristan Madani <tristan@talencesecurity.com>
Fri, 17 Apr 2026 19:54:57 +0000 (19:54 +0000)
committerSteve French <stfrench@microsoft.com>
Sat, 18 Apr 2026 17:19:59 +0000 (12:19 -0500)
commit299f962c0b02d048fb45d248b4da493d03f3175d
tree4ef209ef74f943ec85b441dee3feeb27b92393b4
parent1baff47b81f94f9231c91236aa511420d0e266b9
ksmbd: use check_add_overflow() to prevent u16 DACL size overflow

set_posix_acl_entries_dacl() and set_ntacl_dacl() accumulate ACE sizes
in u16 variables. When a file has many POSIX ACL entries, the
accumulated size can wrap past 65535, causing the pointer arithmetic
(char *)pndace + *size to land within already-written ACEs. Subsequent
writes then overwrite earlier entries, and pndacl->size gets a
truncated value.

Use check_add_overflow() at each accumulation point to detect the
wrap before it corrupts the buffer, consistent with existing
check_mul_overflow() usage elsewhere in smbacl.c.

Cc: stable@vger.kernel.org
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smbacl.c