Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 948bd820 authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: rpmh: Wakeup only when the wait count is zero



Wakeup the waiting thread only when the wait count is zero. Currently,
if there are two responses coming back that use the same waitq object,
both of these threads would decrement the atomic wait_count variable and
then try to wakeup the waitq object. Since the wait count has been
decremented by both the threads, the waiting thread will see its
condition turning true and therefore would bail out releasing the waitq
object from the stack. The second thread that tries to acquire the waitq
and wake it up will crash.

Change-Id: Ie1f38df8341e3cb8cfca803e89c6d4a430626686
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 1aa5d272
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -153,11 +153,10 @@ static void rpmh_tx_done(struct mbox_client *cl, void *msg, int r)
	}

	/* Signal the blocking thread we are done */
	if (waitq) {
		atomic_dec(wc);
	if (wc && atomic_dec_and_test(wc))
		if (waitq)
			wake_up(waitq);
}
}

static struct rpmh_req *__find_req(struct rpmh_client *rc, u32 addr)
{