mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
drm/amdkfd: Check bounds in allocate_event_notification_slot
The valid event ids go from 0 to KFD_SIGNAL_EVENT_LIMIT allocate_event_notification_slot has an option to specify an event id to allocate at, used by CRIU. We weren't checking the bounds on that value. Check them. v2: Lower bounds check is unecessary because of idr_alloc already rejecting negative numbers. Upper bounds check should be KFD_SIGNAL_EVENT_LIMIT since the signal mode mappings might not yet exist Signed-off-by: David Francis <David.Francis@amd.com> Reviewed-by: David Yat Sin <david.yatsin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
8799ba6fb6
commit
6853f1f6cb
|
|
@ -61,6 +61,9 @@ static int allocate_event_notification_slot(struct kfd_process *p,
|
|||
return -ENOMEM;
|
||||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user