Skip to content

Commit a9f0779

Browse files
hdthkyogabbay
authored andcommitted
accel/habanalabs: fix information leak in sec_attest_info()
This function may copy the pad0 field of struct hl_info_sec_attest to user mode which has not been initialized, resulting in leakage of kernel heap data to user mode. To prevent this, use kzalloc() to allocate and zero out the buffer, which can also eliminate other uninitialized holes, if any. Fixes: 0c88760 ("habanalabs/gaudi2: add secured attestation info uapi") Signed-off-by: Xingyuan Mo <hdthky0@gmail.com> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
1 parent bc5f15a commit a9f0779

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/accel/habanalabs/common/habanalabs_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ static int sec_attest_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
688688
if (!sec_attest_info)
689689
return -ENOMEM;
690690

691-
info = kmalloc(sizeof(*info), GFP_KERNEL);
691+
info = kzalloc(sizeof(*info), GFP_KERNEL);
692692
if (!info) {
693693
rc = -ENOMEM;
694694
goto free_sec_attest_info;

0 commit comments

Comments
 (0)