linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ckeepax@opensource.wolfsonmicro.com (Charles Keepax)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed
Date: Sun, 27 Sep 2015 17:11:46 +0100	[thread overview]
Message-ID: <1443370306-15429-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)

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

             reply	other threads:[~2015-09-27 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-27 16:11 Charles Keepax [this message]
2015-09-30 11:26 ` [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed Inki Dae
2015-09-30 13:15   ` Charles Keepax

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=1443370306-15429-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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).