Merge "dsp: q6voice: Check size of shared memory buffer before access"
diff --git a/dsp/q6usm.c b/dsp/q6usm.c
index 1ed74a9..01e5f84 100644
--- a/dsp/q6usm.c
+++ b/dsp/q6usm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, 2019, 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
@@ -502,6 +502,11 @@
uint32_t token;
uint32_t *payload = data->payload;
+ if (data->payload_size < (2 * sizeof(uint32_t))) {
+ pr_err("%s: payload has invalid size[%d]\n", __func__,
+ data->payload_size);
+ return -EINVAL;
+ }
pr_debug("%s: ptr0[0x%x]; ptr1[0x%x]; opcode[0x%x]\n",
__func__, payload[0], payload[1], data->opcode);
pr_debug("%s: token[0x%x]; payload_size[%d]; src[%d]; dest[%d];\n",