Skip to content

Commit 06a0254

Browse files
nszeteismfrench
authored andcommitted
ksmbd: align aux_payload_buf to avoid OOB reads in cryptographic operations
The aux_payload_buf allocation in SMB2 read is performed without ensuring alignment, which could result in out-of-bounds (OOB) reads during cryptographic operations such as crypto_xor or ghash. This patch aligns the allocation of aux_payload_buf to prevent these issues. (Note that to add this patch to stable would require modifications due to recent patch "ksmbd: use __GFP_RETRY_MAYFAIL") Signed-off-by: Norbert Szetei <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 313dab0 commit 06a0254

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6680,7 +6680,7 @@ int smb2_read(struct ksmbd_work *work)
66806680
ksmbd_debug(SMB, "filename %pD, offset %lld, len %zu\n",
66816681
fp->filp, offset, length);
66826682

6683-
aux_payload_buf = kvzalloc(length, KSMBD_DEFAULT_GFP);
6683+
aux_payload_buf = kvzalloc(ALIGN(length, 8), KSMBD_DEFAULT_GFP);
66846684
if (!aux_payload_buf) {
66856685
err = -ENOMEM;
66866686
goto out;

0 commit comments

Comments
 (0)