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

Commit 196c5330 authored by Gaoxiang Chen's avatar Gaoxiang Chen Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: validate num_streams in stream_cfg_cmd before using it



stream_cfg_cmd->num_streams is from userspace,
need to check it against MSM_ISP_STATS_MAX before using it.

CRs-Fixed: 2029867
Change-Id: I2ab892b7d406fc56de94c261a396866269e91d1a
Signed-off-by: default avatarGaoxiang Chen <gaochen@codeaurora.org>
parent cbf162ed
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -624,6 +624,12 @@ int msm_isp_cfg_stats_stream(struct vfe_device *vfe_dev, void *arg)
	if (vfe_dev->stats_data.num_active_stream == 0)
		vfe_dev->hw_info->vfe_ops.stats_ops.cfg_ub(vfe_dev);

	if (stream_cfg_cmd->num_streams > MSM_ISP_STATS_MAX) {
		pr_err("%s invalid num_streams %d\n", __func__,
			stream_cfg_cmd->num_streams);
		return -EINVAL;
	}

	if (stream_cfg_cmd->enable) {
		msm_isp_stats_update_cgc_override(vfe_dev, stream_cfg_cmd);