Skip to content

Commit 4f160d8

Browse files
icklegregkh
authored andcommitted
drm: Reorder set_property_atomic to avoid returning with an active ww_ctx
commit 227ad6d upstream. Delay the drm_modeset_acquire_init() until after we check for an allocation failure so that we can return immediately upon error without having to unwind. WARNING: lock held when returning to user space! 4.20.0+ #174 Not tainted ------------------------------------------------ syz-executor556/8153 is leaving the kernel with locks still held! 1 lock held by syz-executor556/8153: #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at: set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462 Reported-by: [email protected] Fixes: 144a799 ("drm: Handle properties in the core for atomic drivers") Signed-off-by: Chris Wilson <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Sean Paul <[email protected]> Cc: David Airlie <[email protected]> Cc: <[email protected]> # v4.14+ Reviewed-by: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a1dbb34 commit 4f160d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/drm_mode_object.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,13 @@ static int set_property_atomic(struct drm_mode_object *obj,
432432
struct drm_modeset_acquire_ctx ctx;
433433
int ret;
434434

435-
drm_modeset_acquire_init(&ctx, 0);
436-
437435
state = drm_atomic_state_alloc(dev);
438436
if (!state)
439437
return -ENOMEM;
438+
439+
drm_modeset_acquire_init(&ctx, 0);
440440
state->acquire_ctx = &ctx;
441+
441442
retry:
442443
if (prop == state->dev->mode_config.dpms_property) {
443444
if (obj->type != DRM_MODE_OBJECT_CONNECTOR) {

0 commit comments

Comments
 (0)