summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Jain <ashishj@codeaurora.org>2016-06-20 18:09:07 +0530
committerKyle Yan <kyan@codeaurora.org>2016-06-24 15:05:31 -0700
commit54588859dbe2840d4cd4657bbca6fa142f4d23a4 (patch)
tree1445fe39a96049258d95e70f3aa36c493226ea9d
parent5812a73a1459918f892f96213f44eb083a66b538 (diff)
ASoC: msm: qdsp6v2: DAP: Add check to validate data length
Validate input data length to ensure only relevant data is copied. CRs-Fixed: 1027585 Change-Id: I67eb4f162f944bbf4d9e55fb8fe93759e6b8ff91 Signed-off-by: Ashish Jain <ashishj@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/msm-ds2-dap-config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-ds2-dap-config.c b/sound/soc/msm/qdsp6v2/msm-ds2-dap-config.c
index fea7bb4e7331..379062eee285 100644
--- a/sound/soc/msm/qdsp6v2/msm-ds2-dap-config.c
+++ b/sound/soc/msm/qdsp6v2/msm-ds2-dap-config.c
@@ -1522,6 +1522,14 @@ static int msm_ds2_dap_get_param(u32 cmd, void *arg)
goto end;
}
+ /* Return if invalid length */
+ if (dolby_data->length >
+ (DOLBY_MAX_LENGTH_INDIVIDUAL_PARAM - DOLBY_PARAM_PAYLOAD_SIZE)) {
+ pr_err("Invalid length %d", dolby_data->length);
+ rc = -EINVAL;
+ goto end;
+ }
+
for (i = 0; i < DS2_DEVICES_ALL; i++) {
if ((dev_map[i].active) &&
(dev_map[i].device_id & dolby_data->device_id)) {