summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajesh Bondugula <rajeshb@codeaurora.org>2017-02-07 10:17:25 -0800
committerRajesh Bondugula <rajeshb@codeaurora.org>2017-02-07 14:59:09 -0800
commit79b8a6edd3ef9957e9dc0895ddf1b650fd4d5a48 (patch)
treef068f66d96063b1084fd2712f8da56bea482bd9d
parent2dc96b1cbbdcf5aef3780696708012d55fec57f2 (diff)
msm: camera: sensor: Validate destination step position
dest_step_position is sent from userspace and is used in kernel to calculate the final DAC value. dest_step_position must be validated against total steps. Actuator will have an unexpected behavior if lens value is programed to actuator based on invalid dest_step_position. CRs-Fixed: 1102580 Change-Id: Idcd97043d3bd583d8577233d446a99d1829a4ee6 Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
index 4b6005b9af46..0641eb7fe5b7 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2017, 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
@@ -528,6 +528,12 @@ static int32_t msm_actuator_piezo_move_focus(
return -EFAULT;
}
+ if (dest_step_position > a_ctrl->total_steps) {
+ pr_err("Step pos greater than total steps = %d\n",
+ dest_step_position);
+ return -EFAULT;
+ }
+
a_ctrl->i2c_tbl_index = 0;
a_ctrl->func_tbl->actuator_parse_i2c_params(a_ctrl,
(num_steps *