summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Samuelov <amirs@codeaurora.org>2017-09-24 16:32:28 +0300
committerGerrit - the friendly Code Review server <code-review@localhost>2017-09-28 00:39:07 -0700
commit7ced3825dfe4ecb0d7d925716a3f163ab5eb8c0f (patch)
tree8996877c50da3c27045c51e47018354f724c4334
parent22b400edb3a3722788750ba8f4f58a1168bd9df8 (diff)
spcom: avoid using stale glink handle
spcom_notify_state() is a callback called by glink upon channel connect. It is asynchronous callback, that might be called after glink_close(). Avoid storing stale glink handle in such case. Change-Id: I10359f38ca48f618899673f677a6409b01bc6618 Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
-rw-r--r--drivers/soc/qcom/spcom.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c
index a49848808078..d25ae66fc453 100644
--- a/drivers/soc/qcom/spcom.c
+++ b/drivers/soc/qcom/spcom.c
@@ -493,13 +493,10 @@ static void spcom_notify_state(void *handle, const void *priv, unsigned event)
ch->glink_state = event;
- /*
- * if spcom_notify_state() is called within glink_open()
- * then ch->glink_handle is not updated yet.
- */
- if (!ch->glink_handle) {
- pr_debug("update glink_handle, ch [%s].\n", ch->name);
- ch->glink_handle = handle;
+ if (!handle) {
+ pr_err("inavlid glink_handle, ch [%s].\n", ch->name);
+ mutex_unlock(&ch->lock);
+ return;
}
/* signal before unlock mutex & before calling glink */
@@ -512,8 +509,7 @@ static void spcom_notify_state(void *handle, const void *priv, unsigned event)
*/
pr_debug("call glink_queue_rx_intent() ch [%s].\n", ch->name);
- ret = glink_queue_rx_intent(ch->glink_handle,
- ch, ch->rx_buf_size);
+ ret = glink_queue_rx_intent(handle, ch, ch->rx_buf_size);
if (ret) {
pr_err("glink_queue_rx_intent() err [%d]\n", ret);
} else {