Patch "drm/vc4: crtc: Rework a bit the CRTC state code" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    drm/vc4: crtc: Rework a bit the CRTC state code

to the 5.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-crtc-rework-a-bit-the-crtc-state-code.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d1075d109352e8b31a3f0ebbdd33bafa91f9c8a9
Author: Maxime Ripard <maxime@xxxxxxxxxx>
Date:   Wed Sep 23 10:40:31 2020 +0200

    drm/vc4: crtc: Rework a bit the CRTC state code
    
    [ Upstream commit 427c4a0680a28f87bb9c7bbfeac26b39ef8682ad ]
    
    The current CRTC state reset hook in vc4 allocates a vc4_crtc_state
    structure as a drm_crtc_state, and relies on the fact that vc4_crtc_state
    embeds drm_crtc_state as its first member, and therefore can be safely
    cast.
    
    However, this is pretty fragile especially since there's no check for this
    in place, and we're going to need to access vc4_crtc_state member at reset
    so this looks like a good occasion to make it more robust.
    
    Fixes: 6d6e50039187 ("drm/vc4: Allocate the right amount of space for boot-time CRTC state.")
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Tested-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
    Reviewed-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200923084032.218619-1-maxime@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 6d8fa6118fc1a..eaad187c41f07 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -723,11 +723,18 @@ void vc4_crtc_destroy_state(struct drm_crtc *crtc,
 
 void vc4_crtc_reset(struct drm_crtc *crtc)
 {
+	struct vc4_crtc_state *vc4_crtc_state;
+
 	if (crtc->state)
 		vc4_crtc_destroy_state(crtc, crtc->state);
-	crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
-	if (crtc->state)
-		__drm_atomic_helper_crtc_reset(crtc, crtc->state);
+
+	vc4_crtc_state = kzalloc(sizeof(*vc4_crtc_state), GFP_KERNEL);
+	if (!vc4_crtc_state) {
+		crtc->state = NULL;
+		return;
+	}
+
+	__drm_atomic_helper_crtc_reset(crtc, &vc4_crtc_state->base);
 }
 
 static const struct drm_crtc_funcs vc4_crtc_funcs = {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux