Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef1114d3 authored by Krishna Manikandan's avatar Krishna Manikandan
Browse files

msm: mdss: 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: default avatarKrishna Manikandan <mkrishn@codeaurora.org>
parent 58cbb103
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -4646,6 +4646,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
@@ -4680,6 +4689,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);