Skip to content
/ linux Public

Commit 4857c37

Browse files
Sundance636Sasha Levin
authored andcommitted
drm/amdkfd: Fix out-of-bounds write in kfd_event_page_set()
[ Upstream commit 8a70a26 ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7a4fd19 commit 4857c37

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

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

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

0 commit comments

Comments
 (0)