summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-04-02 01:45:28 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-02 01:45:27 -0700
commitd83747f35cc5dafb1ab3c5287e961d59d24a014a (patch)
treeead2e026e3e9db7845a7170208bb74b6583e6ea8 /drivers/gpu
parentdd13676f456a84096bae16ccd6524471ae4e7e3e (diff)
parentf42176b6937f22fac87d55de64b415a5d6f13ce1 (diff)
Merge "drm: msm: fix potential NULL pointer dereference"
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c4
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c6
-rw-r--r--drivers/gpu/drm/msm/sde/sde_kms.c7
3 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index 422a9a78f3b2..65e085fd2b6a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015, 2018 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -242,7 +242,7 @@ static void blend_setup(struct drm_crtc *crtc)
/* The reset for blending */
for (i = STAGE0; i <= STAGE_MAX; i++) {
- if (!pstates[i])
+ if (!pstates[i] || !pstates[i]->base.fb)
continue;
format = to_mdp_format(
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 873ab11d34d2..01b6425c6e19 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (C) 2014-2015, 2018 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -218,8 +218,10 @@ mdp5_plane_duplicate_state(struct drm_plane *plane)
mdp5_state = kmemdup(to_mdp5_plane_state(plane->state),
sizeof(*mdp5_state), GFP_KERNEL);
+ if (!mdp5_state)
+ return NULL;
- if (mdp5_state && mdp5_state->base.fb)
+ if (mdp5_state->base.fb)
drm_framebuffer_reference(mdp5_state->base.fb);
mdp5_state->mode_changed = false;
diff --git a/drivers/gpu/drm/msm/sde/sde_kms.c b/drivers/gpu/drm/msm/sde/sde_kms.c
index 59bc1a4465fe..a94de553c855 100644
--- a/drivers/gpu/drm/msm/sde/sde_kms.c
+++ b/drivers/gpu/drm/msm/sde/sde_kms.c
@@ -389,13 +389,12 @@ static void sde_kms_wait_for_commit_done(struct msm_kms *kms,
struct drm_device *dev;
int ret;
- if (!kms || !crtc || !crtc->state) {
- SDE_ERROR("invalid params\n");
+ dev = crtc->dev;
+ if (!dev) {
+ SDE_ERROR("invalid dev\n");
return;
}
- dev = crtc->dev;
-
if (!crtc->state->enable) {
SDE_DEBUG("[crtc:%d] not enable\n", crtc->base.id);
return;