Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Lloyd Atkinson <latkinso@codeaurora.org>
To: dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, Lloyd Atkinson <latkinso@codeaurora.org>
Subject: [PATCH 1/3] drm/msm/dsi: check src_pll for null in dsi manager
Date: Fri, 12 Jan 2018 15:55:29 -0500	[thread overview]
Message-ID: <1515790531-157273-2-git-send-email-latkinso@codeaurora.org> (raw)
In-Reply-To: <1515790531-157273-1-git-send-email-latkinso@codeaurora.org>

Add checks for failure after retrieving the src_pll, since it
may fail. This prevents an invalid pointer dereference later in
msm_dsi_pll_get_clk_provider.

Signed-off-by: Lloyd Atkinson <latkinso@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 8552481..d276358 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -88,6 +88,8 @@ static int dsi_mgr_setup_components(int id)
 
 		msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE);
 		src_pll = msm_dsi_phy_get_pll(msm_dsi->phy);
+		if (!src_pll)
+			return -EINVAL;
 		ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll);
 	} else if (!other_dsi) {
 		ret = 0;
@@ -116,6 +118,8 @@ static int dsi_mgr_setup_components(int id)
 		msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
 					MSM_DSI_PHY_SLAVE);
 		src_pll = msm_dsi_phy_get_pll(clk_master_dsi->phy);
+		if (!src_pll)
+			return -EINVAL;
 		ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll);
 		if (ret)
 			return ret;
-- 
QUALCOMM Canada, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

  reply	other threads:[~2018-01-12 20:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 20:55 [PATCH 0/3] drm/msm/dsi: improve pointer validation checks Lloyd Atkinson
2018-01-12 20:55 ` Lloyd Atkinson [this message]
2018-01-15 14:40   ` [PATCH 1/3] drm/msm/dsi: check src_pll for null in dsi manager Rob Clark
2018-01-12 20:55 ` [PATCH 2/3] drm/msm/dsi: correct DSI id bounds check during registration Lloyd Atkinson
2018-01-15 14:44   ` Rob Clark
2018-01-12 20:55 ` [PATCH 3/3] drm/msm/dsi: check msm_dsi and dsi pointers before use Lloyd Atkinson
2018-01-15 14:48   ` Rob Clark
2018-01-15 15:01     ` Lloyd Atkinson
2018-01-15 15:25       ` Rob Clark
2018-01-16 21:26 ` [PATCH v2 0/3] drm/msm/dsi: improve pointer validation checks Lloyd Atkinson
2018-01-16 21:26 ` [PATCH v2 1/3] drm/msm/dsi: check for failure on retrieving pll in dsi manager Lloyd Atkinson
2018-01-16 21:26 ` [PATCH v2 2/3] drm/msm/dsi: correct DSI id bounds check during registration Lloyd Atkinson
2018-01-16 21:26 ` [PATCH v2 3/3] drm/msm/dsi: check msm_dsi and dsi pointers before use Lloyd Atkinson

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=1515790531-157273-2-git-send-email-latkinso@codeaurora.org \
    --to=latkinso@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.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