All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: linux-samsung-soc@vger.kernel.org, sw0312.kim@samsung.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	kyungmin.park@samsung.com, kgene@kernel.org
Subject: Re: [PATCH] drm/exynos: Check for NULL dereference of crtc
Date: Fri, 06 Mar 2015 22:13:42 +0900	[thread overview]
Message-ID: <54F9A806.6020605@samsung.com> (raw)
In-Reply-To: <1424193281-30401-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

On 2015년 02월 18일 02:14, Charles Keepax wrote:
> The commit "drm/exynos: remove exynos_plane_dpms" (d9ea6256) removed the
> use of the enabled flag, which means that the code may attempt to call
> win_enable on a NULL crtc. This results in the following oops on

Hmm... it's strange. plane->funcs->destroy() is called prior to
crtc->funcs->destroy() so it should be exynos_crtc is not NULL. However,
it seems there is any corner case we didn't catch up.

Applied.

Thanks,
Inki Dae

> Arndale:
> 
> [    1.673479] Unable to handle kernel NULL pointer dereference at virtual address 00000368
> [    1.681500] pgd = c0004000
> [    1.684154] [00000368] *pgd=00000000
> [    1.687713] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> [    1.693012] Modules linked in:
> [    1.696045] CPU: 1 PID: 1 Comm: swapper/0 Not tainted
> 3.19.0-07545-g57485fa #1907
> [    1.703524] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> (....)
> [    2.014803] [<c02f9cfc>] (exynos_plane_destroy) from [<c02e61b4>] (drm_mode_config_cleanup+0x168/0x20c)
> [    2.024178] [<c02e61b4>] (drm_mode_config_cleanup) from [<c02f66fc>] (exynos_drm_load+0xac/0x12c)
> 
> This patch adds in a check to ensure exynos_crtc is not NULL before it
> is dereferenced.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_plane.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index 2dfb847..78fc0a1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -176,7 +176,7 @@ static int exynos_disable_plane(struct drm_plane *plane)
>  	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
>  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
>  
> -	if (exynos_crtc->ops->win_disable)
> +	if (exynos_crtc && exynos_crtc->ops->win_disable)
>  		exynos_crtc->ops->win_disable(exynos_crtc,
>  					      exynos_plane->zpos);
>  
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Inki Dae <inki.dae@samsung.com>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com,
	kyungmin.park@samsung.com, airlied@linux.ie, kgene@kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/exynos: Check for NULL dereference of crtc
Date: Fri, 06 Mar 2015 22:13:42 +0900	[thread overview]
Message-ID: <54F9A806.6020605@samsung.com> (raw)
In-Reply-To: <1424193281-30401-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

On 2015년 02월 18일 02:14, Charles Keepax wrote:
> The commit "drm/exynos: remove exynos_plane_dpms" (d9ea6256) removed the
> use of the enabled flag, which means that the code may attempt to call
> win_enable on a NULL crtc. This results in the following oops on

Hmm... it's strange. plane->funcs->destroy() is called prior to
crtc->funcs->destroy() so it should be exynos_crtc is not NULL. However,
it seems there is any corner case we didn't catch up.

Applied.

Thanks,
Inki Dae

> Arndale:
> 
> [    1.673479] Unable to handle kernel NULL pointer dereference at virtual address 00000368
> [    1.681500] pgd = c0004000
> [    1.684154] [00000368] *pgd=00000000
> [    1.687713] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> [    1.693012] Modules linked in:
> [    1.696045] CPU: 1 PID: 1 Comm: swapper/0 Not tainted
> 3.19.0-07545-g57485fa #1907
> [    1.703524] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> (....)
> [    2.014803] [<c02f9cfc>] (exynos_plane_destroy) from [<c02e61b4>] (drm_mode_config_cleanup+0x168/0x20c)
> [    2.024178] [<c02e61b4>] (drm_mode_config_cleanup) from [<c02f66fc>] (exynos_drm_load+0xac/0x12c)
> 
> This patch adds in a check to ensure exynos_crtc is not NULL before it
> is dereferenced.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_plane.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index 2dfb847..78fc0a1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -176,7 +176,7 @@ static int exynos_disable_plane(struct drm_plane *plane)
>  	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
>  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
>  
> -	if (exynos_crtc->ops->win_disable)
> +	if (exynos_crtc && exynos_crtc->ops->win_disable)
>  		exynos_crtc->ops->win_disable(exynos_crtc,
>  					      exynos_plane->zpos);
>  
> 


  reply	other threads:[~2015-03-06 13:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 17:14 [PATCH] drm/exynos: Check for NULL dereference of crtc Charles Keepax
2015-03-06 13:13 ` Inki Dae [this message]
2015-03-06 13:13   ` Inki Dae
2015-03-06 14:04   ` Charles Keepax
2015-03-07 12:19     ` Inki Dae
2015-03-07 12:19       ` Inki Dae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F9A806.6020605@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.