summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev
diff options
context:
space:
mode:
authorJayant Shekhar <jshekhar@codeaurora.org>2015-06-08 13:42:53 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:47:20 -0700
commit885d494e6d473779feddd3a3f35c16852bb567cf (patch)
tree8dd9aeaaafb7be540112465f1c606cfe7ee3a7fb /drivers/video/fbdev
parent3b7c593e88e7df25f93ffe65225bf4b9ae03ce22 (diff)
msm: mdss: Fix potential NULL pointer dereference
If ctl reset is called from rotator, ctl's mfd is NULL. This might cause NULL pointer dereference leading to kernel panic. Fix this by adding required check. Conflicts: drivers/video/msm/mdss/mdss_mdp_ctl.c Change-Id: Icbd3e2e3ffc7cc0521222185d30ae0ca6adad5c4 Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_ctl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_ctl.c b/drivers/video/fbdev/msm/mdss_mdp_ctl.c
index 2525925f27bc..ecf59e4f81a0 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_ctl.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_ctl.c
@@ -3448,8 +3448,14 @@ int mdss_mdp_ctl_reset(struct mdss_mdp_ctl *ctl, bool is_recovery)
{
u32 status = 1;
int cnt = 20;
- struct mdss_mdp_mixer *mixer = ctl->mixer_left;
+ struct mdss_mdp_mixer *mixer;
+
+ if (!ctl) {
+ pr_err("ctl not initialized\n");
+ return -EINVAL;
+ }
+ mixer = ctl->mixer_left;
mdss_mdp_ctl_write(ctl, MDSS_MDP_REG_CTL_SW_RESET, 1);
/*
@@ -3467,7 +3473,8 @@ int mdss_mdp_ctl_reset(struct mdss_mdp_ctl *ctl, bool is_recovery)
if (mixer) {
mdss_mdp_pipe_reset(mixer, is_recovery);
- if (ctl->mfd->split_mode == MDP_DUAL_LM_SINGLE_DISPLAY)
+ if (ctl->mfd &&
+ (ctl->mfd->split_mode == MDP_DUAL_LM_SINGLE_DISPLAY))
mdss_mdp_pipe_reset(ctl->mixer_right, is_recovery);
}