[PATCH] drm/exynos: dpi: Fix NULL pointer dereference with legacy bindings

Jingoo Han jg1.han at samsung.com
Tue Jun 17 18:07:48 PDT 2014


On Wednesday, June 11, 2014 5:58 AM, Tomasz Figa wrote:
> 
> If there is no panel node in DT and instead display timings are provided
> directly in FIMD node, there is no panel object created and ctx->panel
> becomes NULL. However during Exynos DRM initialization
> drm_helper_hpd_irq_event() is called, which in turns calls
> exynos_dpi_detect(), which dereferences ctx->panel without a check,
> causing a NULL pointer derefrence.
> 
> This patch fixes the issue by adding necessary NULL pointer check.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa at gmail.com>

(+cc Inki Dae)

Reviewed-by: Jingoo Han <jg1.han at samsung.com>

Best regards,
Jingoo Han

> ---
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> index f1b8587..f44bd90 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> @@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force)
>  {
>  	struct exynos_dpi *ctx = connector_to_dpi(connector);
> 
> -	if (!ctx->panel->connector)
> +	if (ctx->panel && !ctx->panel->connector)
>  		drm_panel_attach(ctx->panel, &ctx->connector);
> 
>  	return connector_status_connected;
> --



More information about the dri-devel mailing list