Commit 421ee18d authored by Inki Dae's avatar Inki Dae

drm/exynos: fix null pointer dereference issue

This patch fixes null pointer dereference issue incurred
when ipp driver is enabled and Exynos drm driver is closed.

Non kms driver should register its own sub driver to setup necessary
resources, which is done by load(). So null pointer dereference
occurs when ipp driver is enabled and Exynos drm driver is closed
because ipp core device is registered after component_master_add_with_match
call.

This patch makes exynos_drm_device_subdrv_probe() to be called after all non
kms drivers are registered.
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent e9fbdcb4
...@@ -108,11 +108,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -108,11 +108,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
if (ret) if (ret)
goto err_unbind_all; goto err_unbind_all;
/* Probe non kms sub drivers and virtual display driver. */
ret = exynos_drm_device_subdrv_probe(dev);
if (ret)
goto err_cleanup_vblank;
/* /*
* enable drm irq mode. * enable drm irq mode.
* - with irq_enabled = true, we can use the vblank feature. * - with irq_enabled = true, we can use the vblank feature.
...@@ -138,8 +133,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -138,8 +133,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
return 0; return 0;
err_cleanup_vblank:
drm_vblank_cleanup(dev);
err_unbind_all: err_unbind_all:
component_unbind_all(dev->dev, dev); component_unbind_all(dev->dev, dev);
err_mode_config_cleanup: err_mode_config_cleanup:
...@@ -153,8 +146,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -153,8 +146,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
static int exynos_drm_unload(struct drm_device *dev) static int exynos_drm_unload(struct drm_device *dev)
{ {
exynos_drm_device_subdrv_remove(dev);
exynos_drm_fbdev_fini(dev); exynos_drm_fbdev_fini(dev);
drm_kms_helper_poll_fini(dev); drm_kms_helper_poll_fini(dev);
...@@ -636,9 +627,16 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) ...@@ -636,9 +627,16 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
goto err_unregister_ipp_drv; goto err_unregister_ipp_drv;
#endif #endif
/* Probe non kms sub drivers and virtual display driver. */
ret = exynos_drm_device_subdrv_probe(platform_get_drvdata(pdev));
if (ret)
goto err_unregister_resources;
return ret; return ret;
err_unregister_resources:
#ifdef CONFIG_DRM_EXYNOS_IPP #ifdef CONFIG_DRM_EXYNOS_IPP
exynos_platform_device_ipp_unregister();
err_unregister_ipp_drv: err_unregister_ipp_drv:
platform_driver_unregister(&ipp_driver); platform_driver_unregister(&ipp_driver);
err_unregister_gsc_drv: err_unregister_gsc_drv:
...@@ -691,6 +689,8 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) ...@@ -691,6 +689,8 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
static int exynos_drm_platform_remove(struct platform_device *pdev) static int exynos_drm_platform_remove(struct platform_device *pdev)
{ {
exynos_drm_device_subdrv_remove(platform_get_drvdata(pdev));
#ifdef CONFIG_DRM_EXYNOS_IPP #ifdef CONFIG_DRM_EXYNOS_IPP
exynos_platform_device_ipp_unregister(); exynos_platform_device_ipp_unregister();
platform_driver_unregister(&ipp_driver); platform_driver_unregister(&ipp_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment