summaryrefslogtreecommitdiffstats
path: root/drivers/slimbus
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-09-17 01:45:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 20:21:02 +0200
commit0e321f19be94448ca0375e2e0cc28a5f3950e9bb (patch)
tree00abdb3b59247c7b538f78f50ce58adecdf344f4 /drivers/slimbus
parentsilmbus: ngd: register controller after power up. (diff)
downloadlinux-0e321f19be94448ca0375e2e0cc28a5f3950e9bb.tar.xz
linux-0e321f19be94448ca0375e2e0cc28a5f3950e9bb.zip
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>
Diffstat (limited to 'drivers/slimbus')
-rw-r--r--drivers/slimbus/qcom-ngd-ctrl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 986e8de4146a..7218fb963d0a 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1004,6 +1004,7 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl,
struct slim_eaddr *ea, u8 *laddr)
{
struct slim_val_inf msg = {0};
+ u8 failed_ea[6] = {0, 0, 0, 0, 0, 0};
struct slim_msg_txn txn;
u8 wbuf[10] = {0};
u8 rbuf[10] = {0};
@@ -1034,6 +1035,9 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl,
return ret;
}
+ if (!memcmp(rbuf, failed_ea, 6))
+ return -ENXIO;
+
*laddr = rbuf[6];
return ret;