Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm: Reorder set_property_atomic to avoid returning with an" failed to apply to 5.0-stable tree

PATCH [email protected] 1 participant 1 message Mar 18, 2019

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.0-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 227ad6d957898a88b1746e30234ece64d305f066 Mon Sep 17 00:00:00 2001
From: Chris Wilson <[email protected]>
Date: Sun, 30 Dec 2018 12:28:42 +0000
Subject: [PATCH] drm: Reorder set_property_atomic to avoid returning with an
active ww_ctx

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 144a7999d633 ("drm: Handle properties in the core for atomic drivers")
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+
drivers/gpu/drm/drm_mode_object.c +3 -2
index bb1dd46496cd..a9005c1c2384 100644
@@ -459,12 +459,13 @@ static int set_property_atomic(struct drm_mode_object *obj,
 	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
-	drm_modeset_acquire_init(&ctx, 0);
-
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
 		return -ENOMEM;
+
+	drm_modeset_acquire_init(&ctx, 0);
 	state->acquire_ctx = &ctx;
+
 retry:
 	if (prop == state->dev->mode_config.dpms_property) {
 		if (obj->type != DRM_MODE_OBJECT_CONNECTOR) {