From 701c12a6b9e9db84c89b9f9926a2efd35eba8e1d Mon Sep 17 00:00:00 2001 From: Fancy Fang <chen.fang@nxp.com> Date: Wed, 3 Apr 2019 15:57:34 +0800 Subject: [PATCH] MLK-21317 drm/imx: core: fix dangling pointer use of 'drm_device' When any fail happens during master's '>bind()' function, the drm_device' pointer data which is set to the device driver data will be put and freed. But if later, system suspend is called, the freed 'drm_device' pointer will be used again. Signed-off-by: Fancy Fang <chen.fang@nxp.com> --- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 9d6f8bf707932..11382d330e7a4 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -247,8 +247,6 @@ static int imx_drm_bind(struct device *dev) if (ret) goto err_kms; - dev_set_drvdata(dev, drm); - /* Now try and bind all our sub-components */ ret = component_bind_all(dev, drm); if (ret) @@ -282,6 +280,8 @@ static int imx_drm_bind(struct device *dev) if (ret) goto err_fbhelper; + dev_set_drvdata(dev, drm); + return 0; err_fbhelper: -- GitLab