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

Commit 2b0acb8d authored by Sumukh Hallymysore Ravindra's avatar Sumukh Hallymysore Ravindra
Browse files

msm: synx: default user callback fix



Avoid race with enqueue and dequeue of user callback
data. This is necessary since the callback added in the
event queue could be dequeued and variable cleaned up
before wake up function is completed.

Change-Id: I70aa09d8fc88bcb6e7e4b7aebd0f854a9de075d0
Signed-off-by: default avatarSumukh Hallymysore Ravindra <shallymy@codeaurora.org>
parent 0f30cf7e
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -719,14 +719,17 @@ void synx_util_default_user_callback(s32 h_synx,
	int status, void *data)
{
	struct synx_client_cb *cb = data;
	struct synx_client *client = NULL;

	if (cb && cb->client) {
		pr_debug("user cb queued for handle %d\n", h_synx);
		client = cb->client;
		pr_debug("[sess: %u] user cb queued for handle %d\n",
			client->id, h_synx);
		cb->kernel_cb.status = status;
		mutex_lock(&cb->client->event_q_lock);
		list_add_tail(&cb->node, &cb->client->event_q);
		mutex_unlock(&cb->client->event_q_lock);
		wake_up_all(&cb->client->event_wq);
		mutex_lock(&client->event_q_lock);
		list_add_tail(&cb->node, &client->event_q);
		mutex_unlock(&client->event_q_lock);
		wake_up_all(&client->event_wq);
	} else {
		pr_err("%s: invalid params\n", __func__);
	}