mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
dsp: Fix issues due to accessing array out of bounds
Add check for ASM_ACTIVE_STREAMS_ALLOWED sessions to avoid accessing the array out of bounds. Change-Id: I7b2fe2dffdb3132fded0b1e268ebd29139050823 Signed-off-by: Prasad Kumpatla <nkumpat@codeaurora.org>
This commit is contained in:
parent
a387074fd0
commit
69415f2e6c
1 changed files with 12 additions and 0 deletions
12
dsp/rtac.c
12
dsp/rtac.c
|
|
@ -957,6 +957,12 @@ void rtac_set_asm_handle(u32 session_id, void *handle)
|
|||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
|
||||
if (session_id >= (ASM_ACTIVE_STREAMS_ALLOWED + 1)) {
|
||||
pr_err_ratelimited("%s: Invalid Session = %d\n",
|
||||
__func__, session_id);
|
||||
return;
|
||||
}
|
||||
|
||||
mutex_lock(&rtac_asm_apr_mutex);
|
||||
rtac_asm_apr_data[session_id].apr_handle = handle;
|
||||
mutex_unlock(&rtac_asm_apr_mutex);
|
||||
|
|
@ -965,6 +971,12 @@ void rtac_set_asm_handle(u32 session_id, void *handle)
|
|||
bool rtac_make_asm_callback(u32 session_id, uint32_t *payload,
|
||||
u32 payload_size)
|
||||
{
|
||||
if (session_id >= (ASM_ACTIVE_STREAMS_ALLOWED + 1)) {
|
||||
pr_err_ratelimited("%s: Invalid Session = %d\n",
|
||||
__func__, session_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (atomic_read(&rtac_asm_apr_data[session_id].cmd_state) != 1)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue