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

Commit c625d76e authored by Mukund Madhusudan Atre's avatar Mukund Madhusudan Atre Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: icp: Fixing OOB read in icp manager



Adding check for command descriptor offset and length
against length obtained from kernel.

Change-Id: Ic9a4d0612870df5268a47fc59490b688f9939748
Signed-off-by: default avatarMukund Madhusudan Atre <matre@codeaurora.org>
parent f5f31790
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3397,6 +3397,13 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
					num_cmd_buf--;
				goto rel_cmd_buf;
			}
			if ((len <= cmd_desc[i].offset) ||
				(cmd_desc[i].size < cmd_desc[i].length) ||
				((len - cmd_desc[i].offset) <
				cmd_desc[i].length)) {
				CAM_ERR(CAM_ICP, "Invalid offset or length");
				goto rel_cmd_buf;
			}
			cpu_addr = cpu_addr + cmd_desc[i].offset;
		}
	}