ASoC: msm: qdsp6v2: add range check for audio port index

Add range check to make sure the received audio port index
from ADSP is within the valid range.

Change-Id: Ief647df1659f7f349a843f666d8f92f34a9a43be
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
This commit is contained in:
Xiaoyu Ye 2019-01-15 15:49:59 -08:00 committed by syphyr
parent 0177bc3f55
commit a219fb4db3
1 changed files with 7 additions and 0 deletions

View File

@ -1429,6 +1429,13 @@ static int32_t q6asm_srvc_callback(struct apr_client_data *data, void *priv)
}
dir = (data->token & 0x0F);
if (dir != IN && dir != OUT) {
pr_err("%s: Invalid audio port index: %d\n", __func__, dir);
if ((sid > 0 && sid <= SESSION_MAX))
spin_unlock_irqrestore(
&(session[sid].session_lock), flags);
return 0;
}
port = &ac->port[dir];
switch (data->opcode) {