drm/amdkfd: Check bounds on CRIU restore event id
Subsystems (3)
PATCH v3 1/1 drm/amdkfd: Check bounds on CRIU restore event id
The valid amdkfd event ids go from 0 to KFD_SIGNAL_EVENT_LIMIT - 1.
During CRIU restore, ensure that the provided event ids are in that range.
v2: No need for lower bound check since idr_alloc rejects negative inputs
v3: Also change error message to reflect new error condition
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +4 -1
@@ -107,6 +107,9 @@ static int allocate_event_notification_slot(struct kfd_process *p, }if (restore_id) { +if (*restore_id >=KFD_SIGNAL_EVENT_LIMIT ) +return -EINVAL ; + id =idr_alloc (&p->event_idr, ev, *restore_id, *restore_id +1 ,GFP_KERNEL ); }else {
@@ -204,7 +207,7 @@ static int create_signal_event(struct file *devkfd, struct kfd_process *p, ret =allocate_event_notification_slot (p, ev, restore_id);if (ret) { -pr_warn ("Signal event wasn't created because out of kernel memory\n" ); +pr_warn ("Failed to create signal event notification slot\n" );return ret; }
Signature · 1 line
2.34.1
AMD General
Quoted 51 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of David Francis
Sent: Wednesday, June 24, 2026 9:48 AM
To: [email protected]
Cc: Russell, Kent <[email protected]>; Francis, David <[email protected]>
Subject: [PATCH v3] drm/amdkfd: Check bounds on CRIU restore event idThe valid amdkfd event ids go from 0 to
KFD_SIGNAL_EVENT_LIMIT- 1.During CRIU restore, ensure that the provided event ids are in that range.
v2: No need for lower bound check since
idr_allocrejects negative inputsv3: Also change error message to reflect new error condition
Signed-off-by David Francis <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_events.c +3
-0@@ -107,6 +107,9 @@ static int allocate_event_notification_slot(struct kfd_process *p, }if (restore_id) { +if (*restore_id >=KFD_SIGNAL_EVENT_LIMIT ) +return -EINVAL ; + id =idr_alloc (&p->event_idr, ev, *restore_id, *restore_id +1 ,GFP_KERNEL );} else {drivers/gpu/drm/amd/amdkfd/kfd_events.c +1
-1@@ -204,7 +207,7 @@ static int create_signal_event(struct file *devkfd, structkfd_process *p, ret =allocate_event_notification_slot (p, ev, restore_id);if (ret) { -pr_warn ("Signal event wasn't created because out of kernel memory\n"); + pr_warn("Failed to create signal event notification slot\n" );return ret;}--
2.34.1