Skip to content

Commit 8a70a26

Browse files
Sundance636alexdeucher
authored andcommitted
drm/amdkfd: Fix out-of-bounds write in kfd_event_page_set()
The kfd_event_page_set() function writes KFD_SIGNAL_EVENT_LIMIT * 8 bytes via memset without checking the buffer size parameter. This allows unprivileged userspace to trigger an out-of bounds kernel memory write by passing a small buffer, leading to potential privilege escalation. Signed-off-by: Sunday Clement <Sunday.Clement@amd.com> Reviewed-by: Alexander Deucher <Alexander.Deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 5642387 commit 8a70a26

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_events.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,12 @@ static int kfd_event_page_set(struct kfd_process *p, void *kernel_address,
331331
if (p->signal_page)
332332
return -EBUSY;
333333

334+
if (size < KFD_SIGNAL_EVENT_LIMIT * 8) {
335+
pr_err("Event page size %llu is too small, need at least %lu bytes\n",
336+
size, (unsigned long)(KFD_SIGNAL_EVENT_LIMIT * 8));
337+
return -EINVAL;
338+
}
339+
334340
page = kzalloc(sizeof(*page), GFP_KERNEL);
335341
if (!page)
336342
return -ENOMEM;

0 commit comments

Comments
 (0)