slimbus: ngd: validate logical address assigned by remote

Validate logical address assigned by remote, in failure cases this value
is all zeors.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Srinivas Kandagatla 2018-09-16 16:45:43 -07:00 committed by Greg Kroah-Hartman
parent 94fe5f2b45
commit 0e321f19be
1 changed files with 4 additions and 0 deletions

View File

@ -1004,6 +1004,7 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl,
struct slim_eaddr *ea, u8 *laddr) struct slim_eaddr *ea, u8 *laddr)
{ {
struct slim_val_inf msg = {0}; struct slim_val_inf msg = {0};
u8 failed_ea[6] = {0, 0, 0, 0, 0, 0};
struct slim_msg_txn txn; struct slim_msg_txn txn;
u8 wbuf[10] = {0}; u8 wbuf[10] = {0};
u8 rbuf[10] = {0}; u8 rbuf[10] = {0};
@ -1034,6 +1035,9 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl,
return ret; return ret;
} }
if (!memcmp(rbuf, failed_ea, 6))
return -ENXIO;
*laddr = rbuf[6]; *laddr = rbuf[6];
return ret; return ret;