summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2016-06-10 00:22:56 (GMT)
committerAndy Gross <andy.gross@linaro.org>2016-06-24 18:34:00 (GMT)
commit63af8e44eaa56ffe613628742a2642c4c2f1a029 (patch)
tree9c8fb55184165a30173cd401a3ba514122ceb33e /drivers
parent6be2b3d0848d1ed3e78e416cc4ae9007e85c7533 (diff)
downloadlinux-63af8e44eaa56ffe613628742a2642c4c2f1a029.tar.xz
soc: qcom: smp2p: Correct addressing of outgoing value
The valid_entries index should not be incremented until after we have acquired the pointer to the value, or we will read and write data one item off. Fixes: 50e99641413e ("soc: qcom: smp2p: Qualcomm Shared Memory Point to Point") Cc: stable@vger.kernel.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/qcom/smp2p.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index f1eed7f..9c2788b 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -344,11 +344,12 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p,
/* Allocate an entry from the smem item */
strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME);
memcpy_toio(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME);
- out->valid_entries++;
/* Make the logical entry reference the physical value */
entry->value = &out->entries[out->valid_entries].value;
+ out->valid_entries++;
+
entry->state = qcom_smem_state_register(node, &smp2p_state_ops, entry);
if (IS_ERR(entry->state)) {
dev_err(smp2p->dev, "failed to register qcom_smem_state\n");