Patch "drm/sun4i: Fix crash during suspend after component bind failure" has been added to the 5.15-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/sun4i: Fix crash during suspend after component bind failure

to the 5.15-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-sun4i-fix-crash-during-suspend-after-component-b.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 43bf0e2fa72566c711db2bf048a119bd04b1be19
Author: Samuel Holland <samuel@xxxxxxxxxxxx>
Date:   Wed Jun 15 00:42:53 2022 -0500

    drm/sun4i: Fix crash during suspend after component bind failure
    
    [ Upstream commit 1342b5b23da9559a1578978eaff7f797d8a87d91 ]
    
    If the component driver fails to bind, or is unbound, the driver data
    for the top-level platform device points to a freed drm_device. If the
    system is then suspended, the driver passes this dangling pointer to
    drm_mode_config_helper_suspend(), which crashes.
    
    Fix this by only setting the driver data while the platform driver holds
    a reference to the drm_device.
    
    Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
    Signed-off-by: Samuel Holland <samuel@xxxxxxxxxxxx>
    Reviewed-by: Jernej Skrabec <jernej.skrabec@xxxxxxxxx>
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220615054254.16352-1-samuel@xxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 54dd562e294c..5b7061e2bca4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -72,7 +72,6 @@ static int sun4i_drv_bind(struct device *dev)
 		goto free_drm;
 	}
 
-	dev_set_drvdata(dev, drm);
 	drm->dev_private = drv;
 	INIT_LIST_HEAD(&drv->frontend_list);
 	INIT_LIST_HEAD(&drv->engine_list);
@@ -113,6 +112,8 @@ static int sun4i_drv_bind(struct device *dev)
 
 	drm_fbdev_generic_setup(drm, 32);
 
+	dev_set_drvdata(dev, drm);
+
 	return 0;
 
 finish_poll:
@@ -129,6 +130,7 @@ static void sun4i_drv_unbind(struct device *dev)
 {
 	struct drm_device *drm = dev_get_drvdata(dev);
 
+	dev_set_drvdata(dev, NULL);
 	drm_dev_unregister(drm);
 	drm_kms_helper_poll_fini(drm);
 	drm_atomic_helper_shutdown(drm);



[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