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

Commit f0a86d24 authored by Haibin Liu's avatar Haibin Liu Committed by Gerrit - the friendly Code Review server
Browse files

msm: sensor: actuator: fix out of bound read for region params



Issue:
the region index is not validated against the region size.
this cause out-of-bound read on the KASAN kernel.

Fix:
Add restriction that region index smaller than region size.

CRs-Fixed: 2153841
Change-Id: I141bba45662769f0661c947fb642c2671578f32e
Signed-off-by: default avatarHaibin Liu <haibinl@codeaurora.org>
parent a2143369
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -638,6 +638,8 @@ static int32_t msm_actuator_move_focus(
		a_ctrl->curr_step_pos, dest_step_pos, curr_lens_pos);

	while (a_ctrl->curr_step_pos != dest_step_pos) {
		if (a_ctrl->curr_region_index >= a_ctrl->region_size)
			break;
		step_boundary =
			a_ctrl->region_params[a_ctrl->curr_region_index].
			step_bound[dir];