diff options
| author | Dhoat Harpal <hdhoat@codeaurora.org> | 2017-04-05 15:54:34 +0530 |
|---|---|---|
| committer | Dhoat Harpal <hdhoat@codeaurora.org> | 2017-04-05 16:38:17 +0530 |
| commit | ced05f44be171b31aa579dd9a88508cd240d3de9 (patch) | |
| tree | 763cb417b2f960cd7287d86fe742b5b0aa6b7d7b | |
| parent | 22fe1e7de09a84524893aa46463035de51f6adeb (diff) | |
soc: qcom: glink_pkt: Add mutex in glink_pkt_read
Glink_pkt_read calls glink_queue_rx_intent without mutex lock.
This result in race condition where glink_queue_rx_intent generates
same intent id for two intents.
Mutex lock is added to avoid race condition in glink_queue_rx_intent.
CRs-Fixed: 2026579
Change-Id: Iedb9a8874193479154ebb932fa8ff80703402215
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/msm_glink_pkt.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soc/qcom/msm_glink_pkt.c b/drivers/soc/qcom/msm_glink_pkt.c index 78f6a2aa8f66..a92e5c416678 100644 --- a/drivers/soc/qcom/msm_glink_pkt.c +++ b/drivers/soc/qcom/msm_glink_pkt.c @@ -625,14 +625,17 @@ ssize_t glink_pkt_read(struct file *file, return -ENETRESET; } + mutex_lock(&devp->ch_lock); if (!glink_rx_intent_exists(devp->handle, count)) { ret = glink_queue_rx_intent(devp->handle, devp, count); if (ret) { GLINK_PKT_ERR("%s: failed to queue_rx_intent ret[%d]\n", __func__, ret); + mutex_unlock(&devp->ch_lock); return ret; } } + mutex_unlock(&devp->ch_lock); GLINK_PKT_INFO("Begin %s on glink_pkt_dev id:%d buffer_size %zu\n", __func__, devp->i, count); |
