msm: camera: ispif: Validate VFE num input during reset

Userspace supplies the actual number of used VFEs in session to ISPIF.
Validate the userspace input value and if found to be invalid, return
error.

BUG=27600832

Change-Id: I91944434e9a83d34af765c40bf8ad297a09ce2f5
This commit is contained in:
Suman Mukherjee 2016-04-13 16:36:00 -07:00 committed by Yuan Lin
parent 72d3908cc1
commit cbd741f1c3

View file

@ -920,6 +920,13 @@ static irqreturn_t msm_io_ispif_irq(int irq_num, void *data)
static int msm_ispif_set_vfe_info(struct ispif_device *ispif,
struct msm_ispif_vfe_info *vfe_info)
{
if (!vfe_info || (vfe_info->num_vfe <= 0) ||
((uint32_t)(vfe_info->num_vfe) > VFE_MAX)) {
pr_err("Invalid VFE info: %p %d\n", vfe_info,
(vfe_info ? vfe_info->num_vfe:0));
return -EINVAL;
}
memcpy(&ispif->vfe_info, vfe_info, sizeof(struct msm_ispif_vfe_info));
return 0;