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

Commit 8073a40a authored by VijayaKumar T M's avatar VijayaKumar T M Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: sensor: Add boundary check for cci master



Add boundary check for cci master in i2c_read.
This value is passed from userpsace. If user sends an
invalid number for master there is a possibility of
accessing unintended buffer.

This change addresses the issue.

CRs-Fixed: 1086764
Signed-off-by: default avatarRajesh Bondugula <rajeshb@codeaurora.org>
Signed-off-by: default avatarVijayaKumar T M <vtmuni@codeaurora.org>
Change-Id: Ice3bde902aea96382ceb4dfddfd28a5ea89c183d
parent caf88f5a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -317,10 +317,17 @@ static int32_t msm_cci_i2c_read(struct v4l2_subdev *sd,
	enum cci_i2c_queue_t queue = QUEUE_1;
	struct cci_device *cci_dev = NULL;
	struct msm_camera_cci_i2c_read_cfg *read_cfg = NULL;

	CDBG("%s line %d\n", __func__, __LINE__);
	cci_dev = v4l2_get_subdevdata(sd);
	master = c_ctrl->cci_info->cci_i2c_master;
	read_cfg = &c_ctrl->cfg.cci_i2c_read_cfg;
	if (master >= MASTER_MAX || master < 0) {
		pr_err("%s:%d Invalid I2C master %d\n",
			__func__, __LINE__, master);
		return -EINVAL;
	}

	mutex_lock(&cci_dev->cci_master_info[master].mutex);

	/*