Skip to content

Commit

Permalink
drm/vmwgfx: Fix invalid reads in fence signaled events
Browse files Browse the repository at this point in the history
commit a37ef76 upstream.

Correctly set the length of the drm_event to the size of the structure
that's actually used.

The length of the drm_event was set to the parent structure instead of
to the drm_vmw_event_fence which is supposed to be read. drm_read
uses the length parameter to copy the event to the user space thus
resuling in oob reads.

Signed-off-by: Zack Rusin <[email protected]>
Fixes: 8b7de6a ("vmwgfx: Rework fence event action")
Reported-by: [email protected] # ZDI-CAN-23566
Cc: David Airlie <[email protected]>
CC: Daniel Vetter <[email protected]>
Cc: Zack Rusin <[email protected]>
Cc: Broadcom internal kernel review list <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: <[email protected]> # v3.4+
Reviewed-by: Maaz Mombasawala <[email protected]>
Reviewed-by: Martin Krastev <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
zackr authored and gregkh committed May 17, 2024
1 parent 49e0911 commit 3cd6823
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ static int vmw_event_fence_action_create(struct drm_file *file_priv,
}

event->event.base.type = DRM_VMW_EVENT_FENCE_SIGNALED;
event->event.base.length = sizeof(*event);
event->event.base.length = sizeof(event->event);
event->event.user_data = user_data;

ret = drm_event_reserve_init(dev, file_priv, &event->base, &event->event.base);
Expand Down

0 comments on commit 3cd6823

Please sign in to comment.