Patch "drm: Move drm_mode_setcrtc() local re-init to failure path" has been added to the 4.19-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: Move drm_mode_setcrtc() local re-init to failure path

to the 4.19-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-move-drm_mode_setcrtc-local-re-init-to-failure-p.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 8a34f21e7c580c8530fddd263dbd11870f467ea5
Author: Sean Paul <seanpaul@xxxxxxxxxxxx>
Date:   Thu Nov 29 10:04:15 2018 -0500

    drm: Move drm_mode_setcrtc() local re-init to failure path
    
    [ Upstream commit c232e9f41b136c141df9938024e521191a7b910d ]
    
    Instead of always re-initializing the variables we need to clean up on
    out, move the re-initialization into the branch that goes back to retry
    label.
    
    This is a lateral move right now, but will allow us to pull out the
    modeset locking into common code. I kept this change separate to make
    things easier to review.
    
    Changes in v2:
    - None
    
    Reviewed-by: Daniel Vetter <daniel@xxxxxxxx>
    Signed-off-by: Sean Paul <seanpaul@xxxxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-2-sean@xxxxxxxxxx
    Stable-dep-of: b6802b61a9d0 ("drm/crtc: fix uninitialized variable use even harder")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 22eba10af165d..82ad38ee3fea7 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -567,9 +567,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	struct drm_mode_crtc *crtc_req = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_connector **connector_set, *connector;
-	struct drm_framebuffer *fb;
-	struct drm_display_mode *mode;
+	struct drm_connector **connector_set = NULL, *connector;
+	struct drm_framebuffer *fb = NULL;
+	struct drm_display_mode *mode = NULL;
 	struct drm_mode_set set;
 	uint32_t __user *set_connectors_ptr;
 	struct drm_modeset_acquire_ctx ctx;
@@ -601,10 +601,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	mutex_lock(&crtc->dev->mode_config.mutex);
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
-	connector_set = NULL;
-	fb = NULL;
-	mode = NULL;
-
 	ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
 	if (ret)
 		goto out;
@@ -767,6 +763,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	kfree(connector_set);
 	drm_mode_destroy(dev, mode);
+
+	/* In case we need to retry... */
+	connector_set = NULL;
+	fb = NULL;
+	mode = NULL;
+
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
 		if (!ret)




[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