fbdev: msm: Add check for ioctl calls

A check is added to ensure that only the supported
ioctl calls are allowed to proceed further and
all other ioctl calls are returned early.

Change-Id: I30f69bc9c60384d01f990bd1830ddc1d8aa9241e
Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
This commit is contained in:
Krishna Manikandan 2017-06-21 10:21:05 +05:30
parent 560a996da5
commit 151c1e441a

View file

@ -4921,6 +4921,15 @@ static int __ioctl_wait_idle(struct msm_fb_data_type *mfd, u32 cmd)
return ret;
}
static bool check_not_supported_ioctl(u32 cmd)
{
return((cmd == MSMFB_OVERLAY_SET) || (cmd == MSMFB_OVERLAY_UNSET) ||
(cmd == MSMFB_OVERLAY_GET) || (cmd == MSMFB_OVERLAY_PREPARE) ||
(cmd == MSMFB_DISPLAY_COMMIT) || (cmd == MSMFB_OVERLAY_PLAY) ||
(cmd == MSMFB_BUFFER_SYNC) || (cmd == MSMFB_OVERLAY_QUEUE) ||
(cmd == MSMFB_NOTIFY_UPDATE));
}
/*
* mdss_fb_do_ioctl() - MDSS Framebuffer ioctl function
* @info: pointer to framebuffer info
@ -4955,6 +4964,11 @@ int mdss_fb_do_ioctl(struct fb_info *info, unsigned int cmd,
if (!pdata || pdata->panel_info.dynamic_switch_pending)
return -EPERM;
if (check_not_supported_ioctl(cmd)) {
pr_err("Unsupported ioctl\n");
return -EINVAL;
}
atomic_inc(&mfd->ioctl_ref_cnt);
mdss_fb_power_setting_idle(mfd);