* [PATCH] rpmsg: glink: keep balance of mutex locks in qcom_glink_request_intent()
@ 2017-10-06 21:23 Alexey Khoroshilov
2017-10-10 18:26 ` Bjorn Andersson
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2017-10-06 21:23 UTC (permalink / raw)
To: Ohad Ben-Cohen, Bjorn Andersson
Cc: Alexey Khoroshilov, linux-remoteproc, linux-kernel, ldv-project
If qcom_glink_tx() fails in qcom_glink_request_intent(),
it returns immediately leaving intent_req_lock mutex locked.
So the next tries to send intent request lead to deadlock.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/rpmsg/qcom_glink_native.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 5a5e927ea50f..fecb1dafa8f3 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1197,7 +1197,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
ret = qcom_glink_tx(glink, &cmd, sizeof(cmd), NULL, 0, true);
if (ret)
- return ret;
+ goto unlock;
ret = wait_for_completion_timeout(&channel->intent_req_comp, 10 * HZ);
if (!ret) {
@@ -1207,6 +1207,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
ret = channel->intent_req_result ? 0 : -ECANCELED;
}
+unlock:
mutex_unlock(&channel->intent_req_lock);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rpmsg: glink: keep balance of mutex locks in qcom_glink_request_intent()
2017-10-06 21:23 [PATCH] rpmsg: glink: keep balance of mutex locks in qcom_glink_request_intent() Alexey Khoroshilov
@ 2017-10-10 18:26 ` Bjorn Andersson
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2017-10-10 18:26 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Ohad Ben-Cohen, linux-remoteproc, linux-kernel, ldv-project
On Fri 06 Oct 14:23 PDT 2017, Alexey Khoroshilov wrote:
> If qcom_glink_tx() fails in qcom_glink_request_intent(),
> it returns immediately leaving intent_req_lock mutex locked.
> So the next tries to send intent request lead to deadlock.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Thanks Alexey.
This was found by Dan Carpenter a few weeks ago, but I failed to send
the pull request for it, will do so now.
Regards,
Bjorn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-10 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06 21:23 [PATCH] rpmsg: glink: keep balance of mutex locks in qcom_glink_request_intent() Alexey Khoroshilov
2017-10-10 18:26 ` Bjorn Andersson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.