Skip to content

Commit 543e866

Browse files
peilin-yealexdeucher
authored andcommitted
drm/amdgpu: Prevent kernel-infoleak in amdgpu_info_ioctl()
Compiler leaves a 4-byte hole near the end of `dev_info`, causing amdgpu_info_ioctl() to copy uninitialized kernel stack memory to userspace when `size` is greater than 356. In 2015 we tried to fix this issue by doing `= {};` on `dev_info`, which unfortunately does not initialize that 4-byte hole. Fix it by using memset() instead. Cc: [email protected] Fixes: c193fa9 ("drm/amdgpu: information leak in amdgpu_info_ioctl()") Fixes: d38ceaf ("drm/amdgpu: add core driver (v4)") Suggested-by: Dan Carpenter <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Peilin Ye <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a4a2739 commit 543e866

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
692692
return n ? -EFAULT : 0;
693693
}
694694
case AMDGPU_INFO_DEV_INFO: {
695-
struct drm_amdgpu_info_device dev_info = {};
695+
struct drm_amdgpu_info_device dev_info;
696696
uint64_t vm_size;
697697

698+
memset(&dev_info, 0, sizeof(dev_info));
698699
dev_info.device_id = dev->pdev->device;
699700
dev_info.chip_rev = adev->rev_id;
700701
dev_info.external_rev = adev->external_rev_id;

0 commit comments

Comments
 (0)