dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed
@ 2015-09-27 16:11 Charles Keepax
  2015-09-30 11:26 ` Inki Dae
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Keepax @ 2015-09-27 16:11 UTC (permalink / raw)
  To: jingoohan1, inki.dae
  Cc: jy0922.shim, sw0312.kim, kyungmin.park, airlied, kgene,
	k.kozlowski, dri-devel, linux-arm-kernel, linux-samsung-soc

If binding failed calling exynos_dp_enable in exynos_dp_resume will
result in several NULL pointer dereferences. It is much better to
simply skip suspend/resume handling if bind has failed, do so by
checking if a drm_dev exists.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index d66ade0..48baf07 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1388,6 +1388,9 @@ static int exynos_dp_suspend(struct device *dev)
 {
 	struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
+	if (!dp->drm_dev)
+		return 0;
+
 	exynos_dp_disable(&dp->encoder);
 	return 0;
 }
@@ -1396,6 +1399,9 @@ static int exynos_dp_resume(struct device *dev)
 {
 	struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
+	if (!dp->drm_dev)
+		return 0;
+
 	exynos_dp_enable(&dp->encoder);
 	return 0;
 }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed
  2015-09-27 16:11 [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed Charles Keepax
@ 2015-09-30 11:26 ` Inki Dae
  2015-09-30 13:15   ` Charles Keepax
  0 siblings, 1 reply; 3+ messages in thread
From: Inki Dae @ 2015-09-30 11:26 UTC (permalink / raw)
  To: Charles Keepax, jingoohan1
  Cc: jy0922.shim, sw0312.kim, kyungmin.park, airlied, kgene,
	k.kozlowski, dri-devel, linux-arm-kernel, linux-samsung-soc

Hi,

On 2015년 09월 28일 01:11, Charles Keepax wrote:
> If binding failed calling exynos_dp_enable in exynos_dp_resume will
> result in several NULL pointer dereferences. It is much better to
> simply skip suspend/resume handling if bind has failed, do so by
> checking if a drm_dev exists.

Thanks for your patch. However, the pm interfaces of KMS drivers aren't
required because these are controlled by top of Exynos drm driver and
connector dpms. So I posted a patch that it removes pm interfaces of dp
driver.

Thanks,
Inki Dae

> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index d66ade0..48baf07 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1388,6 +1388,9 @@ static int exynos_dp_suspend(struct device *dev)
>  {
>  	struct exynos_dp_device *dp = dev_get_drvdata(dev);
>  
> +	if (!dp->drm_dev)
> +		return 0;
> +
>  	exynos_dp_disable(&dp->encoder);
>  	return 0;
>  }
> @@ -1396,6 +1399,9 @@ static int exynos_dp_resume(struct device *dev)
>  {
>  	struct exynos_dp_device *dp = dev_get_drvdata(dev);
>  
> +	if (!dp->drm_dev)
> +		return 0;
> +
>  	exynos_dp_enable(&dp->encoder);
>  	return 0;
>  }
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed
  2015-09-30 11:26 ` Inki Dae
@ 2015-09-30 13:15   ` Charles Keepax
  0 siblings, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2015-09-30 13:15 UTC (permalink / raw)
  To: Inki Dae
  Cc: jingoohan1, k.kozlowski, linux-samsung-soc, jy0922.shim, airlied,
	sw0312.kim, dri-devel, kyungmin.park, kgene, linux-arm-kernel

On Wed, Sep 30, 2015 at 08:26:37PM +0900, Inki Dae wrote:
> Hi,
> 
> On 2015년 09월 28일 01:11, Charles Keepax wrote:
> > If binding failed calling exynos_dp_enable in exynos_dp_resume will
> > result in several NULL pointer dereferences. It is much better to
> > simply skip suspend/resume handling if bind has failed, do so by
> > checking if a drm_dev exists.
> 
> Thanks for your patch. However, the pm interfaces of KMS drivers aren't
> required because these are controlled by top of Exynos drm driver and
> connector dpms. So I posted a patch that it removes pm interfaces of dp
> driver.

No problems at all, as long as my Arndale starts resuming without
a NULL pointer I am happy :-)

Had a quick test of your patch it appears to fix my issue as well
so totally fine with that.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-30 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-27 16:11 [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed Charles Keepax
2015-09-30 11:26 ` Inki Dae
2015-09-30 13:15   ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).