In kfd_criu_restore_event, there was no handling for
the event priv data having an invalid event type. The priv
data here is untrusted and can be invalid.

In that case, fail with EINVAL.

Signed-off-by: David Francis <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index f5fd78f0df7d..9e0f57cfa3bf 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -452,6 +452,9 @@ int kfd_criu_restore_event(struct file *devkfd,
 
                ret = create_other_event(p, ev, &ev_priv->event_id);
                break;
+       default:
+               ret = -EINVAL;
+               break;
        }
        mutex_unlock(&p->event_mutex);
 
-- 
2.34.1

Reply via email to