Skip to contentSkip to conversation

Patch "drm/vc4: Allocate the right amount of space for boot-time CRTC state." has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Apr 3, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/vc4: Allocate the right amount of space for boot-time CRTC state.

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-vc4-allocate-the-right-amount-of-space-for-boot-time-crtc-state.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6d6e500391875cc372336c88e9a8af377be19c36 Mon Sep 17 00:00:00 2001

From: Eric Anholt <[email protected]>
Date: Tue, 28 Mar 2017 13:13:43 -0700
Subject: drm/vc4: Allocate the right amount of space for boot-time CRTC state.

From: Eric Anholt <[email protected]>

commit 6d6e500391875cc372336c88e9a8af377be19c36 upstream.

Without this, the first modeset would dereference past the allocation when trying to free the mm node.

Fixes d8dbf44f13b9 ("drm/vc4: Make the CRTCs cooperate on allocating display lists.")
---
 drivers/gpu/drm/vc4/vc4_crtc.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_crtc.c +12 -1
@@ -842,6 +842,17 @@ static void vc4_crtc_destroy_state(struc
 	drm_atomic_helper_crtc_destroy_state(crtc, state);
 }
 
+static void
+vc4_crtc_reset(struct drm_crtc *crtc)
+{
+	if (crtc->state)
+		__drm_atomic_helper_crtc_destroy_state(crtc->state);
+
+	crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
+	if (crtc->state)
+		crtc->state->crtc = crtc;
+}
+
 static const struct drm_crtc_funcs vc4_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.destroy = vc4_crtc_destroy,
@@ -849,7 +860,7 @@ static const struct drm_crtc_funcs vc4_c
 	.set_property = NULL,
 	.cursor_set = NULL, /* handled by drm_mode_cursor_universal */
 	.cursor_move = NULL, /* handled by drm_mode_cursor_universal */
-	.reset = drm_atomic_helper_crtc_reset,
+	.reset = vc4_crtc_reset,
 	.atomic_duplicate_state = vc4_crtc_duplicate_state,
 	.atomic_destroy_state = vc4_crtc_destroy_state,
 	.gamma_set = vc4_crtc_gamma_set,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/drm-vc4-allocate-the-right-amount-of-space-for-boot-time-crtc-state.patch