ASoC: apr: Add validity check to APR port
Add boundary checks for APR port received from ADSP. CRs-Fixed: 2143207 Change-Id: I9a7fa39ee223e1859323caa6eb74c1c8a26a041d Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
parent
b598eeb6bc
commit
c643a15d73
2 changed files with 6 additions and 4 deletions
|
@ -679,9 +679,10 @@ void apr_cb_func(void *buf, int len, void *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_port = ((data.dest_port >> 8) * 8) + (data.dest_port & 0xFF);
|
temp_port = ((data.dest_port >> 8) * 8) + (data.dest_port & 0xFF);
|
||||||
pr_debug("port = %d t_port = %d\n", data.src_port, temp_port);
|
if (((temp_port >= 0) && (temp_port < APR_MAX_PORTS))
|
||||||
if (c_svc->port_cnt && c_svc->port_fn[temp_port])
|
&& (c_svc->port_cnt && c_svc->port_fn[temp_port]))
|
||||||
c_svc->port_fn[temp_port](&data, c_svc->port_priv[temp_port]);
|
c_svc->port_fn[temp_port](&data,
|
||||||
|
c_svc->port_priv[temp_port]);
|
||||||
else if (c_svc->fn)
|
else if (c_svc->fn)
|
||||||
c_svc->fn(&data, c_svc->priv);
|
c_svc->fn(&data, c_svc->priv);
|
||||||
else
|
else
|
||||||
|
|
|
@ -514,7 +514,8 @@ static int apr_vm_cb_process_evt(char *buf, int len)
|
||||||
|
|
||||||
temp_port = ((data.dest_port >> 8) * 8) + (data.dest_port & 0xFF);
|
temp_port = ((data.dest_port >> 8) * 8) + (data.dest_port & 0xFF);
|
||||||
pr_debug("port = %d t_port = %d\n", data.src_port, temp_port);
|
pr_debug("port = %d t_port = %d\n", data.src_port, temp_port);
|
||||||
if (c_svc->port_cnt && c_svc->port_fn[temp_port])
|
if (((temp_port >= 0) && (temp_port < APR_MAX_PORTS))
|
||||||
|
&& (c_svc->port_cnt && c_svc->port_fn[temp_port]))
|
||||||
c_svc->port_fn[temp_port](&data, c_svc->port_priv[temp_port]);
|
c_svc->port_fn[temp_port](&data, c_svc->port_priv[temp_port]);
|
||||||
else if (c_svc->fn)
|
else if (c_svc->fn)
|
||||||
c_svc->fn(&data, c_svc->priv);
|
c_svc->fn(&data, c_svc->priv);
|
||||||
|
|
Loading…
Add table
Reference in a new issue